diff --git a/package-lock.json b/package-lock.json index 6c20a43f8..59da1dd5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -270,9 +270,9 @@ "integrity": "sha512-oN3y7FAROHhrAt7Rr7PnTSwrHrZVRTS2ZbyxeQwSSYD0ifwM3YNgQqbaRmjcWoPyq77MjchusjJDspbzMmip1Q==" }, "@npmcli/git": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.3.tgz", - "integrity": "sha512-c/ODsV5ppjB12VDXKc6hzVNgg6ZJX/etILUn3WgF5NLAYBhQLJ3fBq6uB2jQD4OwqOzJdPT1/xA3Xh3aaWGk5w==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.4.tgz", + "integrity": "sha512-OJZCmJ9DNn1cz9HPXXsPmUBnqaArot3CGYo63CyajHQk+g87rPXVOJByGsskQJhPsUUEXJcsZ2Q6bWd2jSwnBA==", "requires": { "@npmcli/promise-spawn": "^1.1.0", "lru-cache": "^6.0.0", @@ -489,12 +489,12 @@ "dev": true }, "@paperbits/azure": { - "version": "0.1.314", - "resolved": "https://registry.npmjs.org/@paperbits/azure/-/azure-0.1.314.tgz", - "integrity": "sha512-h8mguo2iArKW7Ir0YqZNerJflRbKph9tbEPvrorZYYpdLsbXUtOcixNWMVHsnkxGH+4CF7WskuuHo7HQ8qyVxA==", + "version": "0.1.317", + "resolved": "https://registry.npmjs.org/@paperbits/azure/-/azure-0.1.317.tgz", + "integrity": "sha512-t8ZPfONrul3KkEMbOWAAkVBQdFvdIZfP1YkBK2linbbRyGj82g9jPsKQt4HnooCSipFI4kDqxtTUNMtMXUlOAA==", "requires": { "@azure/storage-blob": "10.3.0", - "@paperbits/common": "0.1.314", + "@paperbits/common": "0.1.317", "applicationinsights-js": "1.0.21", "mime-types": "2.1.27" }, @@ -520,9 +520,9 @@ } }, "@paperbits/common": { - "version": "0.1.314", - "resolved": "https://registry.npmjs.org/@paperbits/common/-/common-0.1.314.tgz", - "integrity": "sha512-AGijhvjOIL4GvmnMXIo1iL7Es/Lt1QHPXri40aBEIKdUT3QrFx3l1zNVXndagb6QjkM3tiCy+mEFV4BOYdWIjg==", + "version": "0.1.317", + "resolved": "https://registry.npmjs.org/@paperbits/common/-/common-0.1.317.tgz", + "integrity": "sha512-quVAaXywd+TWnfb8ytjGl3cnVXXSVFMwaC2VZWO1J6EEeFechE0qVXlRbDXbRwBFmWrnyrphoe5Tx5e5ynvxNQ==", "requires": { "deepmerge": "^4.2.2", "domino": "^2.1.4", @@ -539,12 +539,12 @@ } }, "@paperbits/core": { - "version": "0.1.314", - "resolved": "https://registry.npmjs.org/@paperbits/core/-/core-0.1.314.tgz", - "integrity": "sha512-lWFPDhzu3fRO31chvqS1ju6NED1xxj7JRMo79iasYGTOEQjFYoKQSuxzNXCnas4Thgc2V4iS+OMyZQOCjHdQHQ==", + "version": "0.1.317", + "resolved": "https://registry.npmjs.org/@paperbits/core/-/core-0.1.317.tgz", + "integrity": "sha512-hONbUJ52+WBsrHkUVxh8aBOj8+id++86gkMwUUbKr1uZ32QCQs+0Fc2j7Npj/Smooh5vjEmSO1vlY7IrdFpjCA==", "requires": { - "@paperbits/common": "0.1.314", - "@paperbits/styles": "0.1.314", + "@paperbits/common": "0.1.317", + "@paperbits/styles": "0.1.317", "await-parallel-limit": "^2.1.0", "basiclightbox": "^5.0.3", "cropperjs": "^1.5.6", @@ -568,11 +568,11 @@ } }, "@paperbits/prosemirror": { - "version": "0.1.314", - "resolved": "https://registry.npmjs.org/@paperbits/prosemirror/-/prosemirror-0.1.314.tgz", - "integrity": "sha512-ptB3xfVkZxBv6nwzEumy7FC1pQJmDBBNJvvRUroZJJWlVs9WlL9C5M+sKsMYIG3CjvZWWoA5PucMwAuaBWASHQ==", + "version": "0.1.317", + "resolved": "https://registry.npmjs.org/@paperbits/prosemirror/-/prosemirror-0.1.317.tgz", + "integrity": "sha512-K/Lqki3EhADKVbzyPFw/2Mi2L/eQk9E3Be0j3j7RK29Q/2YKHxpCXTkvAMBULcl2zyJyPIt+mPSiK5KHegRFjw==", "requires": { - "@paperbits/common": "0.1.314", + "@paperbits/common": "0.1.317", "npm-check-updates": "^7.0.1", "prosemirror-commands": "^1.1.4", "prosemirror-history": "^1.1.3", @@ -586,11 +586,11 @@ } }, "@paperbits/styles": { - "version": "0.1.314", - "resolved": "https://registry.npmjs.org/@paperbits/styles/-/styles-0.1.314.tgz", - "integrity": "sha512-rEvHWl5phzqSTABJK3X8wqHY6jY3u32l9Qvg5vTUB8ejDAHMhFmgqdf99vF4J/s56NRCQo3OQXk/1u4df9w2OA==", + "version": "0.1.317", + "resolved": "https://registry.npmjs.org/@paperbits/styles/-/styles-0.1.317.tgz", + "integrity": "sha512-YL5Cozm2nk3GSifQQobLr3jk75OJLSkT805OPBsspIchC72CfpDqXDOLvraVdjif8J7U/vlidOLJhGCQ/YnJZQ==", "requires": { - "@paperbits/common": "0.1.314", + "@paperbits/common": "0.1.317", "@simonwep/pickr": "^1.7.1", "cropperjs": "^1.5.6", "google-maps": "^3.3.0", @@ -1884,9 +1884,9 @@ } }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "requires": { "has-flag": "^4.0.0" } @@ -2482,9 +2482,9 @@ } }, "cli-boxes": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", - "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==" }, "cli-table": { "version": "0.3.1", @@ -6417,9 +6417,9 @@ "dev": true }, "json-parse-even-better-errors": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.0.tgz", - "integrity": "sha512-o3aP+RsWDJZayj1SbHNQAI8x0v3T3SKiGoZlNYfbUP1S3omJQ6i9CnqADqkSPaOAxwua4/1YWx5CM7oiChJt2Q==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "json-parse-helpfulerror": { "version": "1.0.3", @@ -7258,9 +7258,9 @@ } }, "minipass-fetch": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.3.0.tgz", - "integrity": "sha512-Yb23ESZZ/8QxiBvSpJ4atbVMVDx2CXrerzrtQzQ67eLqKg+zFIkYFTagk3xh6fdo+e/FvDtVuCD4QcuYDRR3hw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.3.1.tgz", + "integrity": "sha512-N0ddPAD8OZnoAHUYj1ZH4ZJVna+ucy7if777LrdeIV1ko8f46af4jbyM5EC1gN4xc9Wq5c3C38GnxRJ2gneXRA==", "requires": { "encoding": "^0.1.12", "minipass": "^3.1.0", @@ -7928,9 +7928,9 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "commander": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.0.0.tgz", - "integrity": "sha512-s7EA+hDtTYNhuXkTlhqew4txMZVdszBmKWSPEMxGr8ru8JXR7bLUFIAtPhcSuFdJQ0ILMxnJi8GkQL0yvDy/YA==" + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz", + "integrity": "sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==" }, "find-up": { "version": "4.1.0", @@ -7994,9 +7994,9 @@ "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "requires": { "has-flag": "^4.0.0" } @@ -10543,11 +10543,11 @@ } }, "socks": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.4.1.tgz", - "integrity": "sha512-8mWHeYC1OA0500qzb+sqwm0Hzi8oBpeuI1JugoBVMEJtJvxSgco8xFSK+NRnZcHeeWjTbF82KUDo5sXH22TY5A==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.4.2.tgz", + "integrity": "sha512-cE6P9R+/CET9XhIMvqhRgaNT1GXKIahioMjwwhgYOd+8UQWP50rrFm+faqG/4xkZsjTdVeBYr0Tb246BSC9/fg==", "requires": { - "ip": "1.1.5", + "ip": "^1.1.5", "smart-buffer": "^4.1.0" } }, @@ -11826,9 +11826,9 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "requires": { "has-flag": "^4.0.0" } diff --git a/package.json b/package.json index ea870273e..f1bb40e27 100644 --- a/package.json +++ b/package.json @@ -62,11 +62,11 @@ "webpack-merge": "^5.1.2" }, "dependencies": { - "@paperbits/azure": "0.1.314", - "@paperbits/common": "0.1.314", - "@paperbits/core": "0.1.314", - "@paperbits/prosemirror": "0.1.314", - "@paperbits/styles": "0.1.314", + "@paperbits/azure": "0.1.317", + "@paperbits/common": "0.1.317", + "@paperbits/core": "0.1.317", + "@paperbits/prosemirror": "0.1.317", + "@paperbits/styles": "0.1.317", "@webcomponents/custom-elements": "1.4.2", "@webcomponents/shadydom": "^1.7.4", "adal-vanilla": "^1.0.18", diff --git a/src/apim.design.module.ts b/src/apim.design.module.ts index 5f1db6b82..b6f77e235 100644 --- a/src/apim.design.module.ts +++ b/src/apim.design.module.ts @@ -1,6 +1,6 @@ import * as Constants from "./constants"; import { UnsavedChangesRouteGuard } from "./routing/unsavedChangesRouteGuard"; -import { MapiObjectStorage } from "./persistence/mapiObjectStorage"; +import { MapiObjectStorage, MapiBlobStorage } from "./persistence"; import { DefaultAuthenticator } from "./components/defaultAuthenticator"; import { IInjector, IInjectorModule } from "@paperbits/common/injection"; import { ConsoleLogger } from "@paperbits/common/logging"; @@ -25,7 +25,6 @@ import { SubscriptionsDesignModule } from "./components/users/subscriptions/subs import { ProductDetailsModule } from "./components/products/product-details/productDetails.module"; import { ProductDetailsDesignModule } from "./components/products/product-details/productDetails.design.module"; import { MapiClient, IdentityService } from "./services"; -import { AzureBlobStorage } from "@paperbits/azure"; import { SetupModule } from "./components/setup/setup.module"; import { ContentModule } from "./components/content"; import { OperationListModule } from "./components/operations/operation-list/ko/operationList.module"; @@ -110,7 +109,6 @@ export class ApimDesignModule implements IInjectorModule { injector.bindModule(new SigninSocialEditorModule()); injector.bindSingleton("app", App); injector.bindSingleton("logger", ConsoleLogger); - injector.bindSingleton("blobStorage", AzureBlobStorage); injector.bindSingleton("tenantService", TenantService); injector.bindSingleton("backendService", BackendService); injector.bindSingleton("roleService", StaticRoleService); @@ -120,6 +118,7 @@ export class ApimDesignModule implements IInjectorModule { injector.bindSingleton("mapiClient", MapiClient); injector.bindSingleton("authenticator", DefaultAuthenticator); injector.bindSingleton("objectStorage", MapiObjectStorage); + injector.bindSingleton("blobStorage", MapiBlobStorage); injector.bindToCollection("routeGuards", OldContentRouteGuard); injector.bindToCollection("routeGuards", UnsavedChangesRouteGuard); injector.bindInstance("reservedPermalinks", Constants.reservedPermalinks); diff --git a/src/apim.publish.module.ts b/src/apim.publish.module.ts index ebdd1480a..216ab78f1 100644 --- a/src/apim.publish.module.ts +++ b/src/apim.publish.module.ts @@ -1,8 +1,7 @@ import { IInjector, IInjectorModule } from "@paperbits/common/injection"; import { ConsoleLogger } from "@paperbits/common/logging"; -import { AzureBlobStorage } from "@paperbits/azure"; import { MapiClient } from "./services/mapiClient"; -import { MapiObjectStorage } from "./persistence/mapiObjectStorage"; +import { MapiObjectStorage, MapiBlobStorage } from "./persistence"; import { ListOfApisModule } from "./components/apis/list-of-apis/ko/listOfApis.module"; import { DetailsOfApiModule } from "./components/apis/details-of-api/ko/detailsOfApi.module"; import { HistoryOfApiModule } from "./components/apis/history-of-api/ko/historyOfApi.module"; @@ -56,8 +55,7 @@ export class ApimPublishModule implements IInjectorModule { injector.bindModule(new ConfirmPasswordModule()); injector.bindModule(new ChangePasswordModule()); injector.bindModule(new ReportsModule()); - injector.bindModule(new ValidationSummaryModule()); - injector.bindSingleton("blobStorage", AzureBlobStorage); + injector.bindModule(new ValidationSummaryModule()); injector.bindSingleton("tenantService", TenantService); injector.bindSingleton("backendService", BackendService); injector.bindSingleton("userService", StaticUserService); @@ -68,6 +66,7 @@ export class ApimPublishModule implements IInjectorModule { injector.bindSingleton("authenticator", StaticAuthenticator); injector.bindSingleton("mapiClient", MapiClient); injector.bindSingleton("objectStorage", MapiObjectStorage); + injector.bindSingleton("blobStorage", MapiBlobStorage); injector.bindSingleton("logger", ConsoleLogger); injector.bindSingleton("oauthService", OAuthService); } diff --git a/src/components/operations/operation-details/ko/runtime/operation-details.ts b/src/components/operations/operation-details/ko/runtime/operation-details.ts index 9f2960633..c47ec52ea 100644 --- a/src/components/operations/operation-details/ko/runtime/operation-details.ts +++ b/src/components/operations/operation-details/ko/runtime/operation-details.ts @@ -233,8 +233,7 @@ export class OperationDetails { if ((definition.type instanceof TypeDefinitionPropertyTypeReference || definition.type instanceof TypeDefinitionPropertyTypeArrayOfPrimitive - || definition.type instanceof TypeDefinitionPropertyTypeArrayOfReference) - && !skipNames.includes(definition.type.name)) { + || definition.type instanceof TypeDefinitionPropertyTypeArrayOfReference)) { result.push(definition.type.name); } @@ -243,7 +242,7 @@ export class OperationDetails { } }); - return result; + return result.filter(x => !skipNames.includes(x)); } public async loadGatewayInfo(apiName: string): Promise { diff --git a/src/config.design.json b/src/config.design.json index 0fd99487f..d125ac42a 100644 --- a/src/config.design.json +++ b/src/config.design.json @@ -1,9 +1,7 @@ { - "managementApiUrl": "https://.management.azure-api.net", - "managementApiAccessToken": "SharedAccessSignature ...", - "blobStorageContainer": "content", - "blobStorageUrl": "https://.blob.core.windows.net?st=...", - "environment": "development", - "backendUrl": "https://.developer.azure-api.net", - "useHipCaptcha": false + "environment": "development", + "managementApiUrl": "https://.management.azure-api.net", + "managementApiAccessToken": "SharedAccessSignature ...", + "backendUrl": "https://.developer.azure-api.net", + "useHipCaptcha": false } \ No newline at end of file diff --git a/src/config.publish.json b/src/config.publish.json index 38be0f721..301b6b0d3 100644 --- a/src/config.publish.json +++ b/src/config.publish.json @@ -1,8 +1,6 @@ { - "managementApiUrl": "https://.management.azure-api.net", - "managementApiAccessToken": "SharedAccessSignature...", - "blobStorageContainer": "content", - "blobStorageConnectionString": "DefaultEndpointsProtocol=...", - "environment": "publishing", - "useHipCaptcha": false + "environment": "publishing", + "managementApiUrl": "https://.management.azure-api.net", + "managementApiAccessToken": "SharedAccessSignature...", + "useHipCaptcha": false } \ No newline at end of file diff --git a/src/config.runtime.json b/src/config.runtime.json index 687e9c0a7..d94587284 100644 --- a/src/config.runtime.json +++ b/src/config.runtime.json @@ -1,5 +1,5 @@ { - "managementApiUrl": "https://.management.azure-api.net", - "environment": "runtime", - "backendUrl": "https://.developer.azure-api.net" + "environment": "runtime", + "managementApiUrl": "https://.management.azure-api.net", + "backendUrl": "https://.developer.azure-api.net" } \ No newline at end of file diff --git a/src/persistence/index.ts b/src/persistence/index.ts new file mode 100644 index 000000000..ada36c0e0 --- /dev/null +++ b/src/persistence/index.ts @@ -0,0 +1,2 @@ +export * from "./mapiObjectStorage"; +export * from "./mapiBlobStorage"; \ No newline at end of file diff --git a/src/persistence/mapiBlobStorage.ts b/src/persistence/mapiBlobStorage.ts index b7aba0d46..18405661f 100644 --- a/src/persistence/mapiBlobStorage.ts +++ b/src/persistence/mapiBlobStorage.ts @@ -2,25 +2,52 @@ import { MapiClient } from "./../services/mapiClient"; import { IBlobStorage } from "@paperbits/common/persistence"; import { AzureBlobStorage } from "@paperbits/azure"; import { StaticSettingsProvider } from "../components/staticSettingsProvider"; +import { ISettingsProvider } from "@paperbits/common/configuration"; + + +const defaultContainerName = "content"; export class MapiBlobStorage implements IBlobStorage { private storageClient: AzureBlobStorage; - constructor(private readonly mapiClient: MapiClient) { } + constructor( + private readonly mapiClient: MapiClient, + private readonly settingsProvider: ISettingsProvider + ) { } private async getStorageClient(): Promise { if (this.storageClient) { return this.storageClient; } - const result = await this.mapiClient.post(`/portalSettings/mediaContent/listSecrets`); - const blobStorageUrl = result.containerSasUrl; + let storageSettingsProvider: ISettingsProvider; - const settingsProvider = new StaticSettingsProvider({ - blobStorageUrl: blobStorageUrl - }); + const blobStorageContainer = await this.settingsProvider.getSetting("blobStorageContainer"); + const blobStorageConnectionString = await this.settingsProvider.getSetting("blobStorageConnectionString"); + const blobStorageUrl = await this.settingsProvider.getSetting("blobStorageUrl"); + + if (blobStorageConnectionString) { + storageSettingsProvider = new StaticSettingsProvider({ + blobStorageConnectionString: blobStorageConnectionString, + blobStorageContainer: blobStorageContainer || defaultContainerName + }); + } + else if (blobStorageUrl) { + storageSettingsProvider = new StaticSettingsProvider({ + blobStorageUrl: blobStorageUrl, + blobStorageContainer: blobStorageContainer || defaultContainerName + }); + } + else { + const result = await this.mapiClient.post(`/portalSettings/mediaContent/listSecrets`); + const blobStorageUrl = result.containerSasUrl; + + storageSettingsProvider = new StaticSettingsProvider({ + blobStorageUrl: blobStorageUrl + }); + } - this.storageClient = new AzureBlobStorage(settingsProvider); + this.storageClient = new AzureBlobStorage(storageSettingsProvider); return this.storageClient; }