Skip to content

Commit eeade01

Browse files
committed
Merge master.
2 parents ee416b3 + 320cf6d commit eeade01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3221
-1599
lines changed

package-lock.json

Lines changed: 2442 additions & 1182 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -24,88 +24,88 @@
2424
"build-static-data": "webpack --config webpack.staticData.js && node dist/publisher/index.js"
2525
},
2626
"devDependencies": {
27-
"@azure/storage-blob": "12.8.0",
27+
"@azure/storage-blob": "12.9.0",
2828
"@types/chai": "^4.3.0",
2929
"@types/google-maps": "^3.2.3",
3030
"@types/knockout": "^3.4.71",
3131
"@types/knockout.mapping": "^2.0.37",
3232
"@types/knockout.validation": "0.0.38",
3333
"@types/mime": "^2.0.3",
3434
"@types/mocha": "9.1.0",
35-
"@types/node": "^17.0.17",
36-
"@types/puppeteer": "5.4.4",
37-
"autoprefixer": "^10.4.2",
35+
"@types/node": "^17.0.23",
36+
"@types/puppeteer": "5.4.5",
37+
"autoprefixer": "^10.4.4",
3838
"buffer": "^6.0.3",
3939
"chai": "^4.3.6",
4040
"clean-webpack-plugin": "4.0.0",
4141
"copy-webpack-plugin": "^10.2.4",
42-
"css-loader": "^6.6.0",
42+
"css-loader": "^6.7.1",
4343
"file-loader": "^6.2.0",
4444
"fs": "^0.0.1-security",
4545
"html-loader": "^3.1.0",
46-
"mini-css-extract-plugin": "^2.5.3",
47-
"mocha": "^9.2.0",
46+
"mini-css-extract-plugin": "^2.6.0",
47+
"mocha": "^9.2.2",
4848
"path": "^0.12.7",
4949
"postcss-loader": "^6.2.1",
50-
"puppeteer": "13.3.1",
50+
"puppeteer": "13.5.1",
5151
"querystring-es3": "^0.2.1",
5252
"raw-loader": "^4.0.2",
53-
"sass": "^1.49.7",
54-
"sass-loader": "^12.4.0",
53+
"sass": "^1.49.9",
54+
"sass-loader": "^12.6.0",
5555
"stream-browserify": "^3.0.0",
5656
"style-loader": "^3.3.1",
5757
"terser-webpack-plugin": "^5.3.1",
58-
"ts-loader": "^9.2.6",
59-
"ts-node": "10.5.0",
58+
"ts-loader": "^9.2.8",
59+
"ts-node": "10.7.0",
6060
"tslint": "^6.1.3",
61-
"typescript": "^4.5.5",
61+
"typescript": "^4.6.3",
6262
"url-loader": "^4.1.1",
63-
"webpack": "5.68.0",
63+
"webpack": "5.70.0",
6464
"webpack-cli": "4.9.2 ",
6565
"webpack-dev-server": "4.7.4",
6666
"webpack-merge": "5.8.0"
6767
},
68-
"dependencies": {
69-
"@azure/msal-browser": "^2.20.0",
70-
"@braintree/sanitize-url": "^5.0.2",
71-
"@monaco-editor/loader": "^1.2.0",
72-
"@paperbits/azure": "0.1.486",
73-
"@paperbits/common": "0.1.486",
74-
"@paperbits/core": "0.1.486",
75-
"@paperbits/prosemirror": "0.1.486",
76-
"@paperbits/styles": "0.1.486",
77-
"@webcomponents/custom-elements": "1.5.0",
78-
"@webcomponents/shadydom": "^1.9.0",
79-
"applicationinsights-js": "^1.0.21",
80-
"client-oauth2": "4.3.3",
81-
"codemirror": "^5.65.1",
82-
"core-js": "^3.21.0",
83-
"d3": "^5.11.0",
84-
"google-maps": "^4.3.3",
85-
"graphql": "^15.5.0",
86-
"graphql-config": "^4.0.1",
87-
"graphql-language-service": "^3.1.4",
88-
"js-beautify": "^1.14.0",
89-
"knockout": "^3.5.1",
90-
"knockout-mapping": "^2.6.0",
91-
"knockout.validation": "^2.0.4",
92-
"liquidjs": "^9.34.0",
93-
"lunr": "^2.3.9",
94-
"mime": "^3.0.0",
95-
"moment": "^2.29.1",
96-
"monaco-editor": "^0.29.1",
97-
"msal": "^1.4.16",
98-
"prettier": "^2.5.1",
99-
"prismjs": "^1.26.0",
100-
"rehype-raw": "^6.1.1",
101-
"rehype-sanitize": "^5.0.1",
102-
"rehype-stringify": "^9.0.3",
103-
"remark": "^14.0.2",
104-
"remark-gfm": "^3.0.1",
105-
"remark-parse": "^10.0.1",
106-
"remark-rehype": "^10.1.0",
107-
"saxen": "^8.1.2",
108-
"topojson-client": "^3.1.0",
109-
"truncate-html": "^1.0.4"
110-
}
68+
"dependencies": {
69+
"@azure/msal-browser": "^2.22.1",
70+
"@braintree/sanitize-url": "^6.0.0",
71+
"@monaco-editor/loader": "^1.3.0",
72+
"@paperbits/azure": "0.1.493",
73+
"@paperbits/common": "0.1.493",
74+
"@paperbits/core": "0.1.493",
75+
"@paperbits/prosemirror": "0.1.493",
76+
"@paperbits/styles": "0.1.493",
77+
"@webcomponents/custom-elements": "1.5.0",
78+
"@webcomponents/shadydom": "^1.9.0",
79+
"applicationinsights-js": "^1.0.21",
80+
"client-oauth2": "4.3.3",
81+
"codemirror": "^5.65.2",
82+
"core-js": "^3.21.1",
83+
"d3": "^7.4.0",
84+
"google-maps": "^4.3.3",
85+
"graphql": "^15.5.0",
86+
"graphql-config": "^4.0.1",
87+
"graphql-language-service": "^3.1.4",
88+
"js-beautify": "^1.14.2",
89+
"knockout": "^3.5.1",
90+
"knockout-mapping": "^2.6.0",
91+
"knockout.validation": "^2.0.4",
92+
"liquidjs": "^9.36.0",
93+
"lunr": "^2.3.9",
94+
"mime": "^3.0.0",
95+
"moment": "^2.29.1",
96+
"monaco-editor": "^0.29.1",
97+
"msal": "^1.4.16",
98+
"prettier": "^2.6.1",
99+
"prismjs": "^1.27.0",
100+
"rehype-raw": "^6.1.1",
101+
"rehype-sanitize": "^5.0.1",
102+
"rehype-stringify": "^9.0.3",
103+
"remark": "^14.0.2",
104+
"remark-gfm": "^3.0.1",
105+
"remark-parse": "^10.0.1",
106+
"remark-rehype": "^10.1.0",
107+
"saxen": "^8.1.2",
108+
"topojson-client": "^3.1.0",
109+
"truncate-html": "^1.0.4"
110+
}
111111
}

scripts.v2/utils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ async function downloadBlobs(blobStorageUrl, snapshotMediaFolder) {
152152
}
153153

154154
async function uploadBlobs(blobStorageUrl, localMediaFolder) {
155+
if (!fs.existsSync(localMediaFolder)) {
156+
console.info("No media files found in the snapshot folder. Skipping media upload...");
157+
return;
158+
}
159+
155160
try {
156161
const blobServiceClient = new BlobServiceClient(blobStorageUrl.replace(`/${blobStorageContainer}`, ""));
157162
const containerClient = blobServiceClient.getContainerClient(blobStorageContainer);

scripts.v3/generate.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* node ./cleanup ^
1313
* --subscriptionId < your subscription ID > ^
1414
* --resourceGroupName < your resource group name > ^
15-
* --serviceName < your service name >
15+
* --serviceName < your service name > ^
16+
* --publish true [false: default]
1617
*/
1718

1819
const path = require("path");
@@ -45,6 +46,12 @@ const yargs = require('yargs')
4546
example: '../dist/snapshot',
4647
demandOption: false
4748
})
49+
.option('publish', {
50+
type: 'boolean',
51+
default: false,
52+
description: 'Enabling this flag will publish the developer portal changes.',
53+
demandOption: false
54+
})
4855
.help()
4956
.argv;
5057

@@ -68,6 +75,14 @@ async function generate() {
6875
);
6976

7077
await importerExporter.import();
78+
79+
if (yargs.publish === true) {
80+
console.log("Publishing changes...");
81+
await importerExporter.publish();
82+
console.log("Published.");
83+
} else {
84+
console.warn("Skipped publishing changes! If you want to publish the changes run the script with --publish true flag.");
85+
}
7186
}
7287

7388
generate()

scripts.v3/utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,14 @@ class ImporterExporter {
259259
* Uploads media files to storage of specified API Management service.
260260
*/
261261
async uploadBlobs() {
262+
const snapshotMediaFolder = `${this.snapshotFolder}/media`;
263+
264+
if (!fs.existsSync(snapshotMediaFolder)) {
265+
console.info("No media files found in the snapshot folder. Skipping media upload...");
266+
return;
267+
}
268+
262269
try {
263-
const snapshotMediaFolder = `${this.snapshotFolder}/media`;
264270
const blobStorageUrl = await this.getStorageSasUrl();
265271
const blobServiceClient = new BlobServiceClient(blobStorageUrl.replace(`/${blobStorageContainer}`, ""));
266272
const containerClient = blobServiceClient.getContainerClient(blobStorageContainer);

src/apim.design.module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ export class ApimDesignModule implements IInjectorModule {
118118
injector.bindModule(new HelpModule());
119119
injector.bindModule(new ValidationSummaryDesignModule());
120120
injector.bindModule(new ValidationSummaryModule());
121-
injector.bindModule(new SigninSocialEditorModule());
122121
injector.bindModule(new CustomHtmlDesignModule());
123122
injector.bindSingleton("app", App);
124123
injector.bindSingleton("logger", ConsoleLogger);

src/apim.runtime.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import "./bindingHandlers/scrollintoview";
2020
import "./bindingHandlers/syntaxHighlight";
2121
import "./bindingHandlers/tab";
2222
import { ApiProducts } from "./components/apis/api-products/ko/runtime/api-products";
23+
import { ApiProductsDropdown } from "./components/apis/api-products/ko/runtime/api-products-dropdown";
2324
import { ApiProductsTiles } from "./components/apis/api-products/ko/runtime/api-products-tiles";
2425
import { ApiDetails } from "./components/apis/details-of-api/ko/runtime/api-details";
2526
import { ApiHistory } from "./components/apis/history-of-api/ko/runtime/api-history";
@@ -50,6 +51,7 @@ import { ConfirmPassword } from "./components/users/confirm-password/ko/runtime/
5051
import { Profile } from "./components/users/profile/ko/runtime/profile";
5152
import { ResetPassword } from "./components/users/reset-password/ko/runtime/reset-password";
5253
import { HipCaptcha } from "./components/users/runtime/hip-captcha/hip-captcha";
54+
import { TermsOfUse } from "./components/users/runtime/terms-of-use/terms-of-use";
5355
import { SignInAad } from "./components/users/signin-social/ko/runtime/signin-aad";
5456
import { SignInAadB2C } from "./components/users/signin-social/ko/runtime/signin-aad-b2c";
5557
import { Signin } from "./components/users/signin/ko/runtime/signin";
@@ -99,6 +101,7 @@ export class ApimRuntimeModule implements IInjectorModule {
99101
injector.bind("apiListDropdown", ApiListDropdown);
100102
injector.bind("apiListTiles", ApiListTiles);
101103
injector.bind("apiProducts", ApiProducts);
104+
injector.bind("apiProductsDropdown", ApiProductsDropdown);
102105
injector.bind("apiProductsTiles", ApiProductsTiles);
103106
injector.bind("apiDetails", ApiDetails);
104107
injector.bind("apiHistory", ApiHistory);
@@ -136,6 +139,7 @@ export class ApimRuntimeModule implements IInjectorModule {
136139
injector.bind("usersService", UsersService);
137140
injector.bind("reports", Reports);
138141
injector.bind("hipCaptcha", HipCaptcha);
142+
injector.bind("termsOfUse", TermsOfUse);
139143
injector.bind("resetPassword", ResetPassword);
140144
injector.bind("confirmPassword", ConfirmPassword);
141145
injector.bind("changePassword", ChangePassword);

src/authentication/accessToken.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ export class AccessToken {
3737
}
3838

3939
private static parseSharedAccessSignature(value: string): AccessToken {
40-
const regex = /^[\w\-]*\&(\d*)\&/gm;
40+
const regex = /^([\w\-]*)\&(\d*)\&/gm;
4141
const match = regex.exec(value);
4242

43-
if (!match || match.length < 2) {
43+
if (!match || match.length < 3) {
4444
throw new Error(`SharedAccessSignature token format is not valid.`);
4545
}
4646

47-
const dateTime = match[1];
47+
const userId = match[1];
48+
const dateTime = match[2];
4849
const year = dateTime.substr(0, 4);
4950
const month = dateTime.substr(4, 2);
5051
const day = dateTime.substr(6, 2);
@@ -53,7 +54,7 @@ export class AccessToken {
5354
const dateTimeIso = `${year}-${month}-${day}T${hour}:${minute}:00.000Z`;
5455
const expirationDateUtc = new Date(dateTimeIso);
5556

56-
return new AccessToken("SharedAccessSignature", value, expirationDateUtc);
57+
return new AccessToken("SharedAccessSignature", value, expirationDateUtc, userId);
5758
}
5859

5960
private static parseBearerToken(value: string): AccessToken {

src/components/apis/api-products/apiProductsContract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HyperlinkContract } from "@paperbits/common/editing";
66
*/
77
export interface ApiProductsContract extends Contract {
88
/**
9-
* List layout. "list" or "tiles"
9+
* List layout. "list", "dropdown" or "tiles"
1010
*/
1111
itemStyleView?: string;
1212

src/components/apis/api-products/apiProductsHandlers.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ export class ApiProductsHandlers implements IWidgetHandler {
1616
}
1717
}
1818

19+
export class ApiProductsDropdownHandlers implements IWidgetHandler {
20+
public async getWidgetOrder(): Promise<IWidgetOrder> {
21+
const widgetOrder: IWidgetOrder = {
22+
name: "api-products-dropdown",
23+
category: "APIs",
24+
displayName: "API: Products (dropdown)",
25+
iconClass: "widget-icon widget-icon-api-management",
26+
requires: ["html"],
27+
createModel: async () => new ApiProductsModel("dropdown"),
28+
};
29+
30+
return widgetOrder;
31+
}
32+
}
33+
1934
export class ApiProductsTilesHandlers implements IWidgetHandler {
2035
public async getWidgetOrder(): Promise<IWidgetOrder> {
2136
const widgetOrder: IWidgetOrder = {

0 commit comments

Comments
 (0)