@fluidframework/azure-client 2.74.0 → 2.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fluidframework/azure-client
2
2
 
3
+ ## 2.81.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.80.0
8
+
9
+ Dependency updates only.
10
+
3
11
  ## 2.74.0
4
12
 
5
13
  Dependency updates only.
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,KAAK,EACX,gBAAgB,EAGhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EAGvB,MAAM,iBAAiB,CAAC;AAiCzB;;;;GAIG;AACH,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IACjE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2D;IAC5F,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAE1D,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAMzB;IAEtB;;;OAGG;gBACgB,UAAU,EAAE,gBAAgB;IA0B/C;;;;;;;OAOG;IACU,eAAe,CAAC,KAAK,CAAC,gBAAgB,SAAS,eAAe,EAC1E,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB,GAClC,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC7C,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAmBF;;;;;;;;OAQG;IACU,YAAY,CA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AAQ,CAAC,6BAA6B,CAAC,CAMzB;IAEtB;;;OAGG;gBACgB,UAAU,EAAE,gBAAgB;IA0B/C;;;;;;;OAOG;IAEU,eAAe,CAAC,KAAK,CAAC,gBAAgB,SAAS,eAAe,EAC1E,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB,GAClC,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC7C,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAmBF;;;;;;;;OAQG;IAEU,YAAY,CAAC,gBAAgB,SAAS,eAAe,EACjE,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB,GAClC,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC7C,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAsBF;;;;;;;;;OASG;IACU,oBAAoB,CAAC,gBAAgB,SAAS,eAAe,EACzE,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,gBAAgB,EACjC,OAAO,EAAE,qBAAqB,EAC9B,iBAAiB,EAAE,iBAAiB,GAClC,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;KAC7C,CAAC;IAmBF;;;;;;OAMG;IACU,oBAAoB,CAChC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA0BnC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,cAAc;YA0CR,oBAAoB;CA6BlC"}
@@ -76,6 +76,7 @@ class AzureClient {
76
76
  * @param compatibilityMode - Compatibility mode the container should run in.
77
77
  * @returns New detached container instance along with associated services.
78
78
  */
79
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
79
80
  async createContainer(containerSchema, compatibilityMode) {
80
81
  const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
81
82
  const container = await (0, internal_2.createDetachedContainer)({
@@ -98,6 +99,7 @@ class AzureClient {
98
99
  * @param compatibilityMode - Compatibility mode the container should run in.
99
100
  * @returns Existing container instance along with associated services.
100
101
  */
102
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
101
103
  async getContainer(id, containerSchema, compatibilityMode) {
102
104
  const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
103
105
  const url = new URL(this.connectionConfig.endpoint);
@@ -111,6 +113,7 @@ class AzureClient {
111
113
  const fluidContainer = await (0, internal_4.createFluidContainer)({
112
114
  container,
113
115
  });
116
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
114
117
  const services = this.getContainerServices(container);
115
118
  return { container: fluidContainer, services };
116
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AACpE,6EAKwD;AACxD,wEAKmD;AAUnD,oEAAgF;AAMhF,oEAI+C;AAC/C,4EAAoG;AACpG,uEAA0F;AAE1F,yDAA+D;AAC/D,+DAAsF;AAWtF,yCAA2D;AAE3D;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,oBAA2C,EAAU,EAAE;IAC3E,OAAO,IAAA,wCAA6B,EAAC,oBAAoB,CAAC;QACzD,CAAC,CAAC,oBAAoB,CAAC,QAAQ;QAC/B,CAAC,CAAC,oBAAoB,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAM,uBAAuB,GAAG;IAC/B,sDAAsD;IACtD,sCAAsC,EAAE,IAAI;CAC5C,CAAC;AAEF;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,kBAAwC;IACnE,OAAO,IAAA,yCAA8B,EAAC,kBAAkB,EAAE,uBAAuB,CAAC,CA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gBACzC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,IAAA,+BAAoB,EAAmB;YACnE,SAAS;SACT,CAAC,CAAC;QACH,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AA3QD,kCA2QC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n\ttype IRuntimeFactory,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadContainerPaused,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tContainerSchema,\n\tIFluidContainer,\n\tCompatibilityMode,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\tcreateServiceAudience,\n} from \"@fluidframework/fluid-static/internal\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createAzureAudienceMember } from \"./AzureAudience.js\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver.js\";\nimport type {\n\tAzureClientProps,\n\tAzureClientPropsInternal,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureRemoteConnectionConfig,\n} from \"./interfaces.js\";\nimport { isAzureRemoteConnectionConfig } from \"./utils.js\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProperties: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProperties)\n\t\t? connectionProperties.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst azureClientFeatureGates = {\n\t// Azure client requires a write connection by default\n\t\"Fluid.Container.ForceWriteConnection\": true,\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for Azure Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, azureClientFeatureGates);\n}\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n * @public\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tprivate readonly createContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tcompatibilityMode,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tcompatibilityMode: CompatibilityMode;\n\t}) => IRuntimeFactory;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param properties - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(properties: AzureClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\t// remove trailing slash from URL if any\n\t\tthis.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tproperties.summaryCompression,\n\t\t);\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\n\t\tthis.createContainerRuntimeFactory = (\n\t\t\tproperties as Partial<AzureClientPropsInternal>\n\t\t).createContainerRuntimeFactory;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param containerSchema - Container schema for the new container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer<const TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<TContainerSchema>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Existing container instance along with associated services.\n\t */\n\tpublic async getContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst container = await loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: { url: url.href },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Load a specific version of a container for viewing only.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Loaded container instance at the specified version.\n\t */\n\tpublic async viewContainerVersion<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion: AzureContainerVersion,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loadContainerPaused(loaderProps, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\treturn { container: fluidContainer };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retrieve to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService =\n\t\t\tawait this.documentServiceFactory.createDocumentService(resolvedUrl);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: createServiceAudience({\n\t\t\t\tcontainer,\n\t\t\t\tcreateServiceMember: createAzureAudienceMember,\n\t\t\t}),\n\t\t};\n\t}\n\n\tprivate getLoaderProps(\n\t\tschema: ContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): ILoaderProps {\n\t\tconst runtimeFactory = this.createContainerRuntimeFactory\n\t\t\t? this.createContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t})\n\t\t\t: createDOProviderContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t});\n\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<IFluidContainer<TContainerSchema>> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
1
+ {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AACpE,6EAKwD;AACxD,wEAKmD;AAUnD,oEAAgF;AAMhF,oEAI+C;AAC/C,4EAAoG;AACpG,uEAA0F;AAE1F,yDAA+D;AAC/D,+DAAsF;AAWtF,yCAA2D;AAE3D;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,oBAA2C,EAAU,EAAE;IAC3E,OAAO,IAAA,wCAA6B,EAAC,oBAAoB,CAAC;QACzD,CAAC,CAAC,oBAAoB,CAAC,QAAQ;QAC/B,CAAC,CAAC,oBAAoB,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;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AAqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,IAAA,+BAAoB,EAAmB;YACnE,SAAS;SACT,CAAC,CAAC;QACH,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AA9QD,kCA8QC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n\ttype IRuntimeFactory,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadContainerPaused,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tContainerSchema,\n\tIFluidContainer,\n\tCompatibilityMode,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\tcreateServiceAudience,\n} from \"@fluidframework/fluid-static/internal\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createAzureAudienceMember } from \"./AzureAudience.js\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver.js\";\nimport type {\n\tAzureClientProps,\n\tAzureClientPropsInternal,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureRemoteConnectionConfig,\n} from \"./interfaces.js\";\nimport { isAzureRemoteConnectionConfig } from \"./utils.js\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProperties: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProperties)\n\t\t? connectionProperties.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst azureClientFeatureGates = {\n\t// Azure client requires a write connection by default\n\t\"Fluid.Container.ForceWriteConnection\": true,\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for Azure Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, azureClientFeatureGates);\n}\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n * @public\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tprivate readonly createContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tcompatibilityMode,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tcompatibilityMode: CompatibilityMode;\n\t}) => IRuntimeFactory;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param properties - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(properties: AzureClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\t// remove trailing slash from URL if any\n\t\tthis.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tproperties.summaryCompression,\n\t\t);\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\n\t\tthis.createContainerRuntimeFactory = (\n\t\t\tproperties as Partial<AzureClientPropsInternal>\n\t\t).createContainerRuntimeFactory;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param containerSchema - Container schema for the new container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns New detached container instance along with associated services.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation\n\tpublic async createContainer<const TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<TContainerSchema>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Existing container instance along with associated services.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation\n\tpublic async getContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst container = await loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: { url: url.href },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Load a specific version of a container for viewing only.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Loaded container instance at the specified version.\n\t */\n\tpublic async viewContainerVersion<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion: AzureContainerVersion,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loadContainerPaused(loaderProps, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\treturn { container: fluidContainer };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retrieve to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService =\n\t\t\tawait this.documentServiceFactory.createDocumentService(resolvedUrl);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: createServiceAudience({\n\t\t\t\tcontainer,\n\t\t\t\tcreateServiceMember: createAzureAudienceMember,\n\t\t\t}),\n\t\t};\n\t}\n\n\tprivate getLoaderProps(\n\t\tschema: ContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): ILoaderProps {\n\t\tconst runtimeFactory = this.createContainerRuntimeFactory\n\t\t\t? this.createContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t})\n\t\t\t: createDOProviderContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t});\n\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<IFluidContainer<TContainerSchema>> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGvC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAoCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAMlB;AAgCD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,gBAC1B,MAAM,YACT,MAAM,KACd,QAUF,CAAC"}
1
+ {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGvC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAqCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAMlB;AAgCD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,gBAC1B,MAAM,YACT,MAAM,KACd,QAUF,CAAC"}
@@ -19,6 +19,7 @@ class AzureUrlResolver {
19
19
  const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);
20
20
  // determine whether the request is for creating of a new container.
21
21
  // such request has the `createNew` header set to true and doesn't have a container ID.
22
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
22
23
  if (request.headers && request.headers[internal_1.DriverHeader.createNew] === true) {
23
24
  return {
24
25
  endpoints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kBAAkB;KAC/B,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACI,MAAM,2BAA2B,GAAG,CAC1C,WAAmB,EACnB,QAAgB,EACL,EAAE;IACb,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;IACpE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO;QACN,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,OAAO,EAAE;YACR,CAAC,uBAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SAC9B;KACD,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IResolvedUrl,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the\n * Azure Fluid Relay based off of the orderer and storage URLs provide.\n *\n * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure\n * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.\n */\nexport class AzureUrlResolver implements IUrlResolver {\n\tpublic constructor() {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);\n\t\t// determine whether the request is for creating of a new container.\n\t\t// such request has the `createNew` header set to true and doesn't have a container ID.\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\treturn {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n\t\t\t\t\tordererUrl,\n\t\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t\t},\n\t\t\t\t// id is a mandatory attribute, but it's ignored by the driver for new container requests.\n\t\t\t\tid: \"\",\n\t\t\t\t// tokens attribute is redundant as all tokens are generated via ITokenProvider\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `${ordererUrl}/${tenantId}/new`,\n\t\t\t};\n\t\t}\n\t\tif (containerId === undefined) {\n\t\t\tthrow new Error(\"Azure URL did not contain containerId\");\n\t\t}\n\t\tconst documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n\t\t\t\tordererUrl,\n\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t},\n\t\t\tid: containerId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tif (resolvedUrl.type !== \"fluid\") {\n\t\t\tthrow new Error(\"Invalid Resolved Url\");\n\t\t}\n\t\treturn `${resolvedUrl.url}/${relativeUrl}`;\n\t}\n}\n\nfunction decodeAzureUrl(urlString: string): {\n\tordererUrl: string;\n\tstorageUrl: string;\n\ttenantId: string;\n\tcontainerId?: string;\n} {\n\tconst url = new URL(urlString);\n\tconst ordererUrl = url.origin;\n\tconst searchParameters = url.searchParams;\n\tconst storageUrl = searchParameters.get(\"storage\");\n\tif (storageUrl === null) {\n\t\tthrow new Error(\"Azure URL did not contain a storage URL\");\n\t}\n\tconst tenantId = searchParameters.get(\"tenantId\");\n\tif (tenantId === null) {\n\t\tthrow new Error(\"Azure URL did not contain a tenant ID\");\n\t}\n\tconst storageUrlDecoded = decodeURIComponent(storageUrl);\n\tconst tenantIdDecoded = decodeURIComponent(tenantId);\n\tconst containerId = searchParameters.get(\"containerId\");\n\tconst containerIdDecoded =\n\t\tcontainerId === null ? undefined : decodeURIComponent(containerId);\n\treturn {\n\t\tordererUrl,\n\t\tstorageUrl: storageUrlDecoded,\n\t\ttenantId: tenantIdDecoded,\n\t\tcontainerId: containerIdDecoded,\n\t};\n}\n\n/**\n * Creates a request object that can be passed to {@link @fluidframework/fluid-static#IFluidContainer.attach} to\n * request creation of a new Fluid Container on the Azure service.\n *\n * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.\n * @param tenantId - Unique tenant identifier.\n */\nexport const createAzureCreateNewRequest = (\n\tendpointUrl: string,\n\ttenantId: string,\n): IRequest => {\n\tconst url = new URL(endpointUrl);\n\turl.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n\turl.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n\treturn {\n\t\turl: url.href,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n};\n"]}
1
+ {"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAIqD;AAErD;;;;;;GAMG;AACH,MAAa,gBAAgB;IAC5B,gBAAsB,CAAC;IAEhB,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtF,oEAAoE;QACpE,uFAAuF;QACvF,sGAAsG;QACtG,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,uBAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;YACzE,OAAO;gBACN,SAAS,EAAE;oBACV,eAAe,EAAE,GAAG,UAAU,WAAW,Q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n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IResolvedUrl,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the\n * Azure Fluid Relay based off of the orderer and storage URLs provide.\n *\n * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure\n * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.\n */\nexport class AzureUrlResolver implements IUrlResolver {\n\tpublic constructor() {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);\n\t\t// determine whether the request is for creating of a new container.\n\t\t// such request has the `createNew` header set to true and doesn't have a container ID.\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\treturn {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n\t\t\t\t\tordererUrl,\n\t\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t\t},\n\t\t\t\t// id is a mandatory attribute, but it's ignored by the driver for new container requests.\n\t\t\t\tid: \"\",\n\t\t\t\t// tokens attribute is redundant as all tokens are generated via ITokenProvider\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `${ordererUrl}/${tenantId}/new`,\n\t\t\t};\n\t\t}\n\t\tif (containerId === undefined) {\n\t\t\tthrow new Error(\"Azure URL did not contain containerId\");\n\t\t}\n\t\tconst documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n\t\t\t\tordererUrl,\n\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t},\n\t\t\tid: containerId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tif (resolvedUrl.type !== \"fluid\") {\n\t\t\tthrow new Error(\"Invalid Resolved Url\");\n\t\t}\n\t\treturn `${resolvedUrl.url}/${relativeUrl}`;\n\t}\n}\n\nfunction decodeAzureUrl(urlString: string): {\n\tordererUrl: string;\n\tstorageUrl: string;\n\ttenantId: string;\n\tcontainerId?: string;\n} {\n\tconst url = new URL(urlString);\n\tconst ordererUrl = url.origin;\n\tconst searchParameters = url.searchParams;\n\tconst storageUrl = searchParameters.get(\"storage\");\n\tif (storageUrl === null) {\n\t\tthrow new Error(\"Azure URL did not contain a storage URL\");\n\t}\n\tconst tenantId = searchParameters.get(\"tenantId\");\n\tif (tenantId === null) {\n\t\tthrow new Error(\"Azure URL did not contain a tenant ID\");\n\t}\n\tconst storageUrlDecoded = decodeURIComponent(storageUrl);\n\tconst tenantIdDecoded = decodeURIComponent(tenantId);\n\tconst containerId = searchParameters.get(\"containerId\");\n\tconst containerIdDecoded =\n\t\tcontainerId === null ? undefined : decodeURIComponent(containerId);\n\treturn {\n\t\tordererUrl,\n\t\tstorageUrl: storageUrlDecoded,\n\t\ttenantId: tenantIdDecoded,\n\t\tcontainerId: containerIdDecoded,\n\t};\n}\n\n/**\n * Creates a request object that can be passed to {@link @fluidframework/fluid-static#IFluidContainer.attach} to\n * request creation of a new Fluid Container on the Azure service.\n *\n * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.\n * @param tenantId - Unique tenant identifier.\n */\nexport const createAzureCreateNewRequest = (\n\tendpointUrl: string,\n\ttenantId: string,\n): IRequest => {\n\tconst url = new URL(endpointUrl);\n\turl.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n\turl.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n\treturn {\n\t\turl: url.href,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n};\n"]}
package/eslint.config.mts CHANGED
@@ -1,8 +1,8 @@
1
- /* eslint-disable */
2
- /**
3
- * GENERATED FILE - DO NOT EDIT DIRECTLY.
4
- * To regenerate: pnpm tsx scripts/generate-flat-eslint-configs.ts --typescript
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
5
4
  */
5
+
6
6
  import type { Linter } from "eslint";
7
7
  import { strict } from "../../../common/build/eslint-config-fluid/flat.mts";
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,KAAK,EACX,gBAAgB,EAGhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EAGvB,MAAM,iBAAiB,CAAC;AAiCzB;;;;GAIG;AACH,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IACjE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2D;IAC5F,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAE1D,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAMzB;IAEtB;;;OAGG;gBACgB,UAAU,EAAE,gBAAgB;IA0B/C;;;;;;;OAOG;IACU,eAAe,CAAC,KAAK,CAAC,gBAAgB,SAAS,eAAe,EAC1E,eAA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 +73,7 @@ export class AzureClient {
73
73
  * @param compatibilityMode - Compatibility mode the container should run in.
74
74
  * @returns New detached container instance along with associated services.
75
75
  */
76
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
76
77
  async createContainer(containerSchema, compatibilityMode) {
77
78
  const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
78
79
  const container = await createDetachedContainer({
@@ -95,6 +96,7 @@ export class AzureClient {
95
96
  * @param compatibilityMode - Compatibility mode the container should run in.
96
97
  * @returns Existing container instance along with associated services.
97
98
  */
99
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
98
100
  async getContainer(id, containerSchema, compatibilityMode) {
99
101
  const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
100
102
  const url = new URL(this.connectionConfig.endpoint);
@@ -108,6 +110,7 @@ export class AzureClient {
108
110
  const fluidContainer = await createFluidContainer({
109
111
  container,
110
112
  });
113
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
111
114
  const services = this.getContainerServices(container);
112
115
  return { container: fluidContainer, services };
113
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAIN,YAAY,GACZ,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,GAErB,MAAM,2CAA2C,CAAC;AAUnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAMhF,OAAO,EACN,uCAAuC,EACvC,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAE1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oB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AAM;YACnB,OAAO,EAAE,EAAE,MAAM,EAAE;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,SAAqB,EACrB,UAAiC;QAEjC,MAAM,gBAAgB,GAAG,2BAA2B,CACnD,UAAU,CAAC,QAAQ,EACnB,WAAW,CAAC,UAAU,CAAC,CACvB,CAAC;QAEF;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAmB;YACnE,SAAS;SACT,CAAC,CAAC;QACH,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n\ttype IRuntimeFactory,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadContainerPaused,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tContainerSchema,\n\tIFluidContainer,\n\tCompatibilityMode,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\tcreateServiceAudience,\n} from \"@fluidframework/fluid-static/internal\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createAzureAudienceMember } from \"./AzureAudience.js\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver.js\";\nimport type {\n\tAzureClientProps,\n\tAzureClientPropsInternal,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureRemoteConnectionConfig,\n} from \"./interfaces.js\";\nimport { isAzureRemoteConnectionConfig } from \"./utils.js\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProperties: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProperties)\n\t\t? connectionProperties.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst azureClientFeatureGates = {\n\t// Azure client requires a write connection by default\n\t\"Fluid.Container.ForceWriteConnection\": true,\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for Azure Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, azureClientFeatureGates);\n}\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n * @public\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tprivate readonly createContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tcompatibilityMode,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tcompatibilityMode: CompatibilityMode;\n\t}) => IRuntimeFactory;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param properties - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(properties: AzureClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\t// remove trailing slash from URL if any\n\t\tthis.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tproperties.summaryCompression,\n\t\t);\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\n\t\tthis.createContainerRuntimeFactory = (\n\t\t\tproperties as Partial<AzureClientPropsInternal>\n\t\t).createContainerRuntimeFactory;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param containerSchema - Container schema for the new container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer<const TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<TContainerSchema>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Existing container instance along with associated services.\n\t */\n\tpublic async getContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst container = await loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: { url: url.href },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Load a specific version of a container for viewing only.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Loaded container instance at the specified version.\n\t */\n\tpublic async viewContainerVersion<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion: AzureContainerVersion,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loadContainerPaused(loaderProps, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\treturn { container: fluidContainer };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retrieve to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService =\n\t\t\tawait this.documentServiceFactory.createDocumentService(resolvedUrl);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: createServiceAudience({\n\t\t\t\tcontainer,\n\t\t\t\tcreateServiceMember: createAzureAudienceMember,\n\t\t\t}),\n\t\t};\n\t}\n\n\tprivate getLoaderProps(\n\t\tschema: ContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): ILoaderProps {\n\t\tconst runtimeFactory = this.createContainerRuntimeFactory\n\t\t\t? this.createContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t})\n\t\t\t: createDOProviderContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t});\n\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<IFluidContainer<TContainerSchema>> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endreg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OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAmB;YACnE,SAAS;SACT,CAAC,CAAC;QACH,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n\ttype IRuntimeFactory,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadContainerPaused,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tContainerSchema,\n\tIFluidContainer,\n\tCompatibilityMode,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\tcreateServiceAudience,\n} from \"@fluidframework/fluid-static/internal\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createAzureAudienceMember } from \"./AzureAudience.js\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver.js\";\nimport type {\n\tAzureClientProps,\n\tAzureClientPropsInternal,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureRemoteConnectionConfig,\n} from \"./interfaces.js\";\nimport { isAzureRemoteConnectionConfig } from \"./utils.js\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProperties: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProperties)\n\t\t? connectionProperties.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst azureClientFeatureGates = {\n\t// Azure client requires a write connection by default\n\t\"Fluid.Container.ForceWriteConnection\": true,\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for Azure Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, azureClientFeatureGates);\n}\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n * @public\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tprivate readonly createContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tcompatibilityMode,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tcompatibilityMode: CompatibilityMode;\n\t}) => IRuntimeFactory;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param properties - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(properties: AzureClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\t// remove trailing slash from URL if any\n\t\tthis.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tproperties.summaryCompression,\n\t\t);\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\n\t\tthis.createContainerRuntimeFactory = (\n\t\t\tproperties as Partial<AzureClientPropsInternal>\n\t\t).createContainerRuntimeFactory;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param containerSchema - Container schema for the new container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns New detached container instance along with associated services.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation\n\tpublic async createContainer<const TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<TContainerSchema>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Existing container instance along with associated services.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation\n\tpublic async getContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst container = await loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: { url: url.href },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Load a specific version of a container for viewing only.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Loaded container instance at the specified version.\n\t */\n\tpublic async viewContainerVersion<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion: AzureContainerVersion,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loadContainerPaused(loaderProps, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\treturn { container: fluidContainer };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retrieve to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService =\n\t\t\tawait this.documentServiceFactory.createDocumentService(resolvedUrl);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: createServiceAudience({\n\t\t\t\tcontainer,\n\t\t\t\tcreateServiceMember: createAzureAudienceMember,\n\t\t\t}),\n\t\t};\n\t}\n\n\tprivate getLoaderProps(\n\t\tschema: ContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): ILoaderProps {\n\t\tconst runtimeFactory = this.createContainerRuntimeFactory\n\t\t\t? this.createContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t})\n\t\t\t: createDOProviderContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t});\n\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<IFluidContainer<TContainerSchema>> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGvC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAoCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAMlB;AAgCD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,gBAC1B,MAAM,YACT,MAAM,KACd,QAUF,CAAC"}
1
+ {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGvC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAqCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAMlB;AAgCD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,gBAC1B,MAAM,YACT,MAAM,KACd,QAUF,CAAC"}
@@ -16,6 +16,7 @@ export class AzureUrlResolver {
16
16
  const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);
17
17
  // determine whether the request is for creating of a new container.
18
18
  // such request has the `createNew` header set to true and doesn't have a container ID.
19
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
19
20
  if (request.headers && request.headers[DriverHeader.createNew] === true) {
20
21
  return {
21
22
  endpoints: {
@@ -1 +1 @@
1
- {"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAGZ,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC5B,gBAAsB,CAAC;IAEhB,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC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AE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO;QACN,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,OAAO,EAAE;YACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SAC9B;KACD,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IResolvedUrl,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the\n * Azure Fluid Relay based off of the orderer and storage URLs provide.\n *\n * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure\n * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.\n */\nexport class AzureUrlResolver implements IUrlResolver {\n\tpublic constructor() {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);\n\t\t// determine whether the request is for creating of a new container.\n\t\t// such request has the `createNew` header set to true and doesn't have a container ID.\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\treturn {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n\t\t\t\t\tordererUrl,\n\t\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t\t},\n\t\t\t\t// id is a mandatory attribute, but it's ignored by the driver for new container requests.\n\t\t\t\tid: \"\",\n\t\t\t\t// tokens attribute is redundant as all tokens are generated via ITokenProvider\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `${ordererUrl}/${tenantId}/new`,\n\t\t\t};\n\t\t}\n\t\tif (containerId === undefined) {\n\t\t\tthrow new Error(\"Azure URL did not contain containerId\");\n\t\t}\n\t\tconst documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n\t\t\t\tordererUrl,\n\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t},\n\t\t\tid: containerId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tif (resolvedUrl.type !== \"fluid\") {\n\t\t\tthrow new Error(\"Invalid Resolved Url\");\n\t\t}\n\t\treturn `${resolvedUrl.url}/${relativeUrl}`;\n\t}\n}\n\nfunction decodeAzureUrl(urlString: string): {\n\tordererUrl: string;\n\tstorageUrl: string;\n\ttenantId: string;\n\tcontainerId?: string;\n} {\n\tconst url = new URL(urlString);\n\tconst ordererUrl = url.origin;\n\tconst searchParameters = url.searchParams;\n\tconst storageUrl = searchParameters.get(\"storage\");\n\tif (storageUrl === null) {\n\t\tthrow new Error(\"Azure URL did not contain a storage URL\");\n\t}\n\tconst tenantId = searchParameters.get(\"tenantId\");\n\tif (tenantId === null) {\n\t\tthrow new Error(\"Azure URL did not contain a tenant ID\");\n\t}\n\tconst storageUrlDecoded = decodeURIComponent(storageUrl);\n\tconst tenantIdDecoded = decodeURIComponent(tenantId);\n\tconst containerId = searchParameters.get(\"containerId\");\n\tconst containerIdDecoded =\n\t\tcontainerId === null ? undefined : decodeURIComponent(containerId);\n\treturn {\n\t\tordererUrl,\n\t\tstorageUrl: storageUrlDecoded,\n\t\ttenantId: tenantIdDecoded,\n\t\tcontainerId: containerIdDecoded,\n\t};\n}\n\n/**\n * Creates a request object that can be passed to {@link @fluidframework/fluid-static#IFluidContainer.attach} to\n * request creation of a new Fluid Container on the Azure service.\n *\n * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.\n * @param tenantId - Unique tenant identifier.\n */\nexport const createAzureCreateNewRequest = (\n\tendpointUrl: string,\n\ttenantId: string,\n): IRequest => {\n\tconst url = new URL(endpointUrl);\n\turl.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n\turl.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n\treturn {\n\t\turl: url.href,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n};\n"]}
1
+ {"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAGZ,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC5B,gBAAsB,CAAC;IAEhB,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtF,oEAAoE;QACpE,uFAAuF;QACvF,sGAAsG;QACtG,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;YACzE,OAAO;gBACN,SAAS,EAAE;oBACV,eAAe,EAAE,GAAG,UAAU,WAAW,QAAQ,MAAM;oBACvD,UAAU;oBACV,UAAU,EAAE,GAAG,UAAU,UAAU,QAAQ,EAAE;iBAC7C;gBACD,0FAA0F;gBAC1F,EAAE,EAAE,EAAE;gBACN,+EAA+E;gBAC/E,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,GAAG,UAAU,IAAI,QAAQ,MAAM;aACpC,CAAC;QACH,CAAC;QACD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC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,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACxD,MAAM,kBAAkB,GACvB,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpE,OAAO;QACN,UAAU;QACV,UAAU,EAAE,iBAAiB;QAC7B,QAAQ,EAAE,eAAe;QACzB,WAAW,EAAE,kBAAkB;KAC/B,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAC1C,WAAmB,EACnB,QAAgB,EACL,EAAE;IACb,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;IACpE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO;QACN,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,OAAO,EAAE;YACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SAC9B;KACD,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IResolvedUrl,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the\n * Azure Fluid Relay based off of the orderer and storage URLs provide.\n *\n * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure\n * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.\n */\nexport class AzureUrlResolver implements IUrlResolver {\n\tpublic constructor() {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);\n\t\t// determine whether the request is for creating of a new container.\n\t\t// such request has the `createNew` header set to true and doesn't have a container ID.\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\treturn {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n\t\t\t\t\tordererUrl,\n\t\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t\t},\n\t\t\t\t// id is a mandatory attribute, but it's ignored by the driver for new container requests.\n\t\t\t\tid: \"\",\n\t\t\t\t// tokens attribute is redundant as all tokens are generated via ITokenProvider\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `${ordererUrl}/${tenantId}/new`,\n\t\t\t};\n\t\t}\n\t\tif (containerId === undefined) {\n\t\t\tthrow new Error(\"Azure URL did not contain containerId\");\n\t\t}\n\t\tconst documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n\t\t\t\tordererUrl,\n\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t},\n\t\t\tid: containerId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tif (resolvedUrl.type !== \"fluid\") {\n\t\t\tthrow new Error(\"Invalid Resolved Url\");\n\t\t}\n\t\treturn `${resolvedUrl.url}/${relativeUrl}`;\n\t}\n}\n\nfunction decodeAzureUrl(urlString: string): {\n\tordererUrl: string;\n\tstorageUrl: string;\n\ttenantId: string;\n\tcontainerId?: string;\n} {\n\tconst url = new URL(urlString);\n\tconst ordererUrl = url.origin;\n\tconst searchParameters = url.searchParams;\n\tconst storageUrl = searchParameters.get(\"storage\");\n\tif (storageUrl === null) {\n\t\tthrow new Error(\"Azure URL did not contain a storage URL\");\n\t}\n\tconst tenantId = searchParameters.get(\"tenantId\");\n\tif (tenantId === null) {\n\t\tthrow new Error(\"Azure URL did not contain a tenant ID\");\n\t}\n\tconst storageUrlDecoded = decodeURIComponent(storageUrl);\n\tconst tenantIdDecoded = decodeURIComponent(tenantId);\n\tconst containerId = searchParameters.get(\"containerId\");\n\tconst containerIdDecoded =\n\t\tcontainerId === null ? undefined : decodeURIComponent(containerId);\n\treturn {\n\t\tordererUrl,\n\t\tstorageUrl: storageUrlDecoded,\n\t\ttenantId: tenantIdDecoded,\n\t\tcontainerId: containerIdDecoded,\n\t};\n}\n\n/**\n * Creates a request object that can be passed to {@link @fluidframework/fluid-static#IFluidContainer.attach} to\n * request creation of a new Fluid Container on the Azure service.\n *\n * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.\n * @param tenantId - Unique tenant identifier.\n */\nexport const createAzureCreateNewRequest = (\n\tendpointUrl: string,\n\ttenantId: string,\n): IRequest => {\n\tconst url = new URL(endpointUrl);\n\turl.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n\turl.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n\treturn {\n\t\turl: url.href,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/azure-client",
3
- "version": "2.74.0",
3
+ "version": "2.81.0",
4
4
  "description": "A tool to enable creation and loading of Fluid containers using the Azure Fluid Relay service",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -47,39 +47,39 @@
47
47
  "main": "lib/index.js",
48
48
  "types": "lib/public.d.ts",
49
49
  "dependencies": {
50
- "@fluidframework/container-definitions": "~2.74.0",
51
- "@fluidframework/container-loader": "~2.74.0",
52
- "@fluidframework/core-interfaces": "~2.74.0",
53
- "@fluidframework/driver-definitions": "~2.74.0",
54
- "@fluidframework/driver-utils": "~2.74.0",
55
- "@fluidframework/fluid-static": "~2.74.0",
56
- "@fluidframework/routerlicious-driver": "~2.74.0",
57
- "@fluidframework/telemetry-utils": "~2.74.0"
50
+ "@fluidframework/container-definitions": "~2.81.0",
51
+ "@fluidframework/container-loader": "~2.81.0",
52
+ "@fluidframework/core-interfaces": "~2.81.0",
53
+ "@fluidframework/driver-definitions": "~2.81.0",
54
+ "@fluidframework/driver-utils": "~2.81.0",
55
+ "@fluidframework/fluid-static": "~2.81.0",
56
+ "@fluidframework/routerlicious-driver": "~2.81.0",
57
+ "@fluidframework/telemetry-utils": "~2.81.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@arethetypeswrong/cli": "^0.17.1",
60
+ "@arethetypeswrong/cli": "^0.18.2",
61
61
  "@biomejs/biome": "~1.9.3",
62
- "@fluid-tools/build-cli": "^0.61.0",
63
- "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.73.0",
64
- "@fluidframework/azure-local-service": "~2.74.0",
62
+ "@fluid-tools/build-cli": "^0.63.0",
63
+ "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.80.0",
64
+ "@fluidframework/azure-local-service": "~2.81.0",
65
65
  "@fluidframework/build-common": "^2.0.3",
66
- "@fluidframework/build-tools": "^0.61.0",
67
- "@fluidframework/container-runtime": "~2.74.0",
68
- "@fluidframework/eslint-config-fluid": "~2.74.0",
69
- "@fluidframework/test-runtime-utils": "~2.74.0",
70
- "@fluidframework/test-utils": "~2.74.0",
66
+ "@fluidframework/build-tools": "^0.63.0",
67
+ "@fluidframework/container-runtime": "~2.81.0",
68
+ "@fluidframework/eslint-config-fluid": "~2.81.0",
69
+ "@fluidframework/test-runtime-utils": "~2.81.0",
70
+ "@fluidframework/test-utils": "~2.81.0",
71
71
  "@microsoft/api-extractor": "7.52.11",
72
72
  "@types/mocha": "^10.0.10",
73
73
  "@types/node": "^18.19.0",
74
- "concurrently": "^8.2.1",
74
+ "concurrently": "^9.2.1",
75
75
  "copyfiles": "^2.4.1",
76
- "cross-env": "^7.0.3",
77
- "eslint": "~8.57.1",
76
+ "cross-env": "^10.1.0",
77
+ "eslint": "~9.39.1",
78
78
  "eslint-config-prettier": "~10.1.8",
79
- "fluid-framework": "~2.74.0",
79
+ "fluid-framework": "~2.81.0",
80
80
  "jiti": "^2.6.1",
81
81
  "mocha": "^10.8.2",
82
- "rimraf": "^4.4.0",
82
+ "rimraf": "^6.1.2",
83
83
  "start-server-and-test": "^2.0.3",
84
84
  "typescript": "~5.4.5",
85
85
  "uuid": "^11.1.0"
@@ -141,6 +141,7 @@ export class AzureClient {
141
141
  * @param compatibilityMode - Compatibility mode the container should run in.
142
142
  * @returns New detached container instance along with associated services.
143
143
  */
144
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
144
145
  public async createContainer<const TContainerSchema extends ContainerSchema>(
145
146
  containerSchema: TContainerSchema,
146
147
  compatibilityMode: CompatibilityMode,
@@ -175,6 +176,7 @@ export class AzureClient {
175
176
  * @param compatibilityMode - Compatibility mode the container should run in.
176
177
  * @returns Existing container instance along with associated services.
177
178
  */
179
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
178
180
  public async getContainer<TContainerSchema extends ContainerSchema>(
179
181
  id: string,
180
182
  containerSchema: TContainerSchema,
@@ -199,6 +201,7 @@ export class AzureClient {
199
201
  const fluidContainer = await createFluidContainer<TContainerSchema>({
200
202
  container,
201
203
  });
204
+ // eslint-disable-next-line @typescript-eslint/await-thenable -- known limitation
202
205
  const services = this.getContainerServices(container);
203
206
  return { container: fluidContainer, services };
204
207
  }
@@ -24,6 +24,7 @@ export class AzureUrlResolver implements IUrlResolver {
24
24
  const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);
25
25
  // determine whether the request is for creating of a new container.
26
26
  // such request has the `createNew` header set to true and doesn't have a container ID.
27
+ // eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
27
28
  if (request.headers && request.headers[DriverHeader.createNew] === true) {
28
29
  return {
29
30
  endpoints: {
package/.eslintrc.cjs DELETED
@@ -1,50 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- module.exports = {
7
- extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
8
- parserOptions: {
9
- project: ["./tsconfig.json", "./src/test/tsconfig.json"],
10
- },
11
- rules: {
12
- // Useful for developer accessibility
13
- "unicorn/prevent-abbreviations": [
14
- "error",
15
- {
16
- // Exact variable name checks.
17
- // See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#allowlist
18
- allowList: {
19
- // Industry-standard index variable name.
20
- i: true,
21
- },
22
-
23
- // RegEx-based exclusions
24
- // See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#ignore
25
- ignore: [
26
- // "props" has become something of an industry standard abbreviation for "properties".
27
- // Allow names to include "props" / "Props".
28
- "[pP]rops",
29
- ],
30
- },
31
- ],
32
- },
33
- overrides: [
34
- {
35
- // Overrides for type-tests
36
- files: ["src/test/types/*"],
37
- rules: {
38
- "unicorn/prevent-abbreviations": "off",
39
- },
40
- },
41
- {
42
- // Overrides for tests
43
- files: ["src/test/*.spec.ts"],
44
- rules: {
45
- // Mocha tests should prefer regular functions, see https://mochajs.org/#arrow-functions
46
- "prefer-arrow-callback": "off",
47
- },
48
- },
49
- ],
50
- };