@fluidframework/azure-client 2.1.0-276326 → 2.1.0-281041

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.
Files changed (46) hide show
  1. package/README.md +72 -25
  2. package/api-extractor/{api-extractor-lint-beta.cjs.json → api-extractor.current.json} +2 -2
  3. package/api-extractor/api-extractor.legacy.json +1 -1
  4. package/api-extractor.json +1 -1
  5. package/api-report/azure-client.beta.api.md +0 -4
  6. package/api-report/azure-client.legacy.alpha.api.md +0 -2
  7. package/api-report/azure-client.legacy.public.api.md +95 -0
  8. package/api-report/azure-client.public.api.md +0 -4
  9. package/dist/AzureClient.d.ts +2 -1
  10. package/dist/AzureClient.d.ts.map +1 -1
  11. package/dist/AzureClient.js +16 -16
  12. package/dist/AzureClient.js.map +1 -1
  13. package/dist/index.d.ts +0 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -3
  16. package/dist/index.js.map +1 -1
  17. package/dist/legacy.d.ts +7 -1
  18. package/dist/public.d.ts +7 -1
  19. package/internal.d.ts +1 -1
  20. package/legacy.d.ts +1 -1
  21. package/lib/AzureClient.d.ts +2 -1
  22. package/lib/AzureClient.d.ts.map +1 -1
  23. package/lib/AzureClient.js +16 -16
  24. package/lib/AzureClient.js.map +1 -1
  25. package/lib/index.d.ts +0 -1
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/index.js +0 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/legacy.d.ts +7 -1
  30. package/lib/public.d.ts +7 -1
  31. package/package.json +37 -43
  32. package/src/AzureClient.ts +26 -26
  33. package/src/index.ts +0 -1
  34. package/api-extractor/api-extractor-lint-beta.esm.json +0 -5
  35. package/beta.d.ts +0 -11
  36. package/dist/AzureFunctionTokenProvider.d.ts +0 -29
  37. package/dist/AzureFunctionTokenProvider.d.ts.map +0 -1
  38. package/dist/AzureFunctionTokenProvider.js +0 -55
  39. package/dist/AzureFunctionTokenProvider.js.map +0 -1
  40. package/dist/beta.d.ts +0 -30
  41. package/lib/AzureFunctionTokenProvider.d.ts +0 -29
  42. package/lib/AzureFunctionTokenProvider.d.ts.map +0 -1
  43. package/lib/AzureFunctionTokenProvider.js +0 -48
  44. package/lib/AzureFunctionTokenProvider.js.map +0 -1
  45. package/lib/beta.d.ts +0 -30
  46. package/src/AzureFunctionTokenProvider.ts +0 -61
@@ -50,14 +50,15 @@ export class AzureClient {
50
50
  * @param properties - Properties for initializing a new AzureClient instance
51
51
  */
52
52
  constructor(properties) {
53
- this.properties = properties;
53
+ this.connectionConfig = properties.connection;
54
+ this.logger = properties.logger;
54
55
  // remove trailing slash from URL if any
55
- properties.connection.endpoint = properties.connection.endpoint.replace(/\/$/, "");
56
+ this.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\/$/, "");
56
57
  this.urlResolver = new AzureUrlResolver();
57
58
  // The local service implementation differs from the Azure Fluid Relay in blob
58
59
  // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
59
- const isRemoteConnection = isAzureRemoteConnectionConfig(this.properties.connection);
60
- const origDocumentServiceFactory = new RouterliciousDocumentServiceFactory(this.properties.connection.tokenProvider, {
60
+ const isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);
61
+ const origDocumentServiceFactory = new RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {
61
62
  enableWholeSummaryUpload: isRemoteConnection,
62
63
  enableDiscovery: isRemoteConnection,
63
64
  });
@@ -78,7 +79,7 @@ export class AzureClient {
78
79
  package: "no-dynamic-package",
79
80
  config: {},
80
81
  });
81
- const fluidContainer = await this.createFluidContainer(container, this.properties.connection);
82
+ const fluidContainer = await this.createFluidContainer(container, this.connectionConfig);
82
83
  const services = this.getContainerServices(container);
83
84
  return { container: fluidContainer, services };
84
85
  }
@@ -93,9 +94,9 @@ export class AzureClient {
93
94
  */
94
95
  async getContainer(id, containerSchema, compatibilityMode) {
95
96
  const loader = this.createLoader(containerSchema, compatibilityMode);
96
- const url = new URL(this.properties.connection.endpoint);
97
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
98
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
97
+ const url = new URL(this.connectionConfig.endpoint);
98
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
99
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.connectionConfig)));
99
100
  url.searchParams.append("containerId", encodeURIComponent(id));
100
101
  const container = await loader.resolve({ url: url.href });
101
102
  const rootDataObject = await this.getContainerEntryPoint(container);
@@ -118,9 +119,9 @@ export class AzureClient {
118
119
  */
119
120
  async viewContainerVersion(id, containerSchema, version, compatibilityMode) {
120
121
  const loader = this.createLoader(containerSchema, compatibilityMode);
121
- const url = new URL(this.properties.connection.endpoint);
122
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
123
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
122
+ const url = new URL(this.connectionConfig.endpoint);
123
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
124
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.connectionConfig)));
124
125
  url.searchParams.append("containerId", encodeURIComponent(id));
125
126
  const container = await loadContainerPaused(loader, {
126
127
  url: url.href,
@@ -141,9 +142,9 @@ export class AzureClient {
141
142
  * @returns Array of available container versions.
142
143
  */
143
144
  async getContainerVersions(id, options) {
144
- const url = new URL(this.properties.connection.endpoint);
145
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
146
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
145
+ const url = new URL(this.connectionConfig.endpoint);
146
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
147
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.connectionConfig)));
147
148
  url.searchParams.append("containerId", encodeURIComponent(id));
148
149
  const resolvedUrl = await this.urlResolver.resolve({ url: url.href });
149
150
  if (!resolvedUrl) {
@@ -191,7 +192,7 @@ export class AzureClient {
191
192
  urlResolver: this.urlResolver,
192
193
  documentServiceFactory: this.documentServiceFactory,
193
194
  codeLoader,
194
- logger: this.properties.logger,
195
+ logger: this.logger,
195
196
  options: { client },
196
197
  configProvider: this.configProvider,
197
198
  });
@@ -203,7 +204,6 @@ export class AzureClient {
203
204
  * See {@link FluidContainer.attach}
204
205
  */
205
206
  const attach = async () => {
206
- // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- AB#7608
207
207
  if (container.attachState !== AttachState.Detached) {
208
208
  throw new Error("Cannot attach container. Container is not in detached state");
209
209
  }
@@ -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,EAGN,YAAY,GACZ,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAExF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAMhF,OAAO,EAEN,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,oBAAoB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAQtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,oBAA2C,EAAU,EAAE;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;QAEF,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAEpE;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YAC1C,mFAAmF;YACnF,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,oBAAoB,CAAmB;YAC7D,SAAS;YACT,cAAc;SACd,CAAC,CAAC;QACH,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAAC,SAAqB;QACzD,MAAM,cAAc,GAAiC,MAAM,SAAS,CAAC,aAAa,EAAE,CAAC;QACrF,MAAM,CACL,cAAc,CAAC,eAAe,KAAK,SAAS,EAC5C,KAAK,CAAC,gDAAgD,CACtD,CAAC;QACF,OAAO,cAAc,CAAC,eAAe,CAAC;IACvC,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\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport { Loader, loadContainerPaused } from \"@fluidframework/container-loader/internal\";\nimport type { FluidObject, IConfigProviderBase } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\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\ttype IRootDataObject,\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\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\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\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(private readonly properties: AzureClientProps) {\n\t\t// remove trailing slash from URL if any\n\t\tproperties.connection.endpoint = properties.connection.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.properties.connection);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.properties.connection.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\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 loader = this.createLoader(containerSchema, compatibilityMode);\n\n\t\tconst container = await loader.createDetachedContainer({\n\t\t\tpackage: \"no-dynamic-package\",\n\t\t\tconfig: {},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<TContainerSchema>(\n\t\t\tcontainer,\n\t\t\tthis.properties.connection,\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 loader = this.createLoader(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\n\t\t\t\"storage\",\n\t\t\tencodeURIComponent(this.properties.connection.endpoint),\n\t\t);\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.properties.connection)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loader.resolve({ url: url.href });\n\t\tconst rootDataObject = await this.getContainerEntryPoint(container);\n\t\tconst fluidContainer = createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t\trootDataObject,\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 loader = this.createLoader(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\n\t\t\t\"storage\",\n\t\t\tencodeURIComponent(this.properties.connection.endpoint),\n\t\t);\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.properties.connection)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loadContainerPaused(loader, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst rootDataObject = await this.getContainerEntryPoint(container);\n\t\tconst fluidContainer = createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t\trootDataObject,\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.properties.connection.endpoint);\n\t\turl.searchParams.append(\n\t\t\t\"storage\",\n\t\t\tencodeURIComponent(this.properties.connection.endpoint),\n\t\t);\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.properties.connection)),\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 createLoader(schema: ContainerSchema, compatibilityMode: CompatibilityMode): Loader {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({\n\t\t\tschema,\n\t\t\tcompatibilityMode,\n\t\t});\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 new Loader({\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.properties.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\tconst rootDataObject = await this.getContainerEntryPoint(container);\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- AB#7608\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 = createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t\trootDataObject,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\n\tprivate async getContainerEntryPoint(container: IContainer): Promise<IRootDataObject> {\n\t\tconst rootDataObject: FluidObject<IRootDataObject> = await container.getEntryPoint();\n\t\tassert(\n\t\t\trootDataObject.IRootDataObject !== undefined,\n\t\t\t0x90a /* entryPoint must be of type IRootDataObject */,\n\t\t);\n\t\treturn rootDataObject.IRootDataObject;\n\t}\n\t// #endregion\n}\n"]}
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,EAG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AAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAAC,SAAqB;QACzD,MAAM,cAAc,GAAiC,MAAM,SAAS,CAAC,aAAa,EAAE,CAAC;QACrF,MAAM,CACL,cAAc,CAAC,eAAe,KAAK,SAAS,EAC5C,KAAK,CAAC,gDAAgD,CACtD,CAAC;QACF,OAAO,cAAc,CAAC,eAAe,CAAC;IACvC,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\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport { Loader, loadContainerPaused } from \"@fluidframework/container-loader/internal\";\nimport type {\n\tFluidObject,\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\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\ttype IRootDataObject,\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\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\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\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 loader = this.createLoader(containerSchema, compatibilityMode);\n\n\t\tconst container = await loader.createDetachedContainer({\n\t\t\tpackage: \"no-dynamic-package\",\n\t\t\tconfig: {},\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 loader = this.createLoader(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 loader.resolve({ url: url.href });\n\t\tconst rootDataObject = await this.getContainerEntryPoint(container);\n\t\tconst fluidContainer = createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t\trootDataObject,\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 loader = this.createLoader(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(loader, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst rootDataObject = await this.getContainerEntryPoint(container);\n\t\tconst fluidContainer = createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t\trootDataObject,\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 createLoader(schema: ContainerSchema, compatibilityMode: CompatibilityMode): Loader {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({\n\t\t\tschema,\n\t\t\tcompatibilityMode,\n\t\t});\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 new Loader({\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\tconst rootDataObject = await this.getContainerEntryPoint(container);\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 = createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t\trootDataObject,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\n\tprivate async getContainerEntryPoint(container: IContainer): Promise<IRootDataObject> {\n\t\tconst rootDataObject: FluidObject<IRootDataObject> = await container.getEntryPoint();\n\t\tassert(\n\t\t\trootDataObject.IRootDataObject !== undefined,\n\t\t\t0x90a /* entryPoint must be of type IRootDataObject */,\n\t\t);\n\t\treturn rootDataObject.IRootDataObject;\n\t}\n\t// #endregion\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -8,7 +8,6 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  export { AzureClient } from "./AzureClient.js";
11
- export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider.js";
12
11
  export type { AzureClientProps, AzureConnectionConfig, AzureConnectionConfigType, AzureContainerServices, AzureContainerVersion, AzureGetVersionsOptions, AzureLocalConnectionConfig, AzureMember, AzureRemoteConnectionConfig, AzureUser, IAzureAudience, } from "./interfaces.js";
13
12
  export type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
14
13
  export type { IUser } from "@fluidframework/driver-definitions";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EACX,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,2BAA2B,EAC3B,SAAS,EACT,cAAc,GACd,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3F,YAAY,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAG3F,YAAY,EACX,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACX,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,2BAA2B,EAC3B,SAAS,EACT,cAAc,GACd,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3F,YAAY,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAG3F,YAAY,EACX,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
package/lib/index.js CHANGED
@@ -8,6 +8,5 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  export { AzureClient } from "./AzureClient.js";
11
- export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider.js";
12
11
  export { ScopeType } from "@fluidframework/driver-definitions/internal";
13
12
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAiB7E,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.\n *\n * @packageDocumentation\n */\n\nexport { AzureClient } from \"./AzureClient.js\";\nexport { AzureFunctionTokenProvider } from \"./AzureFunctionTokenProvider.js\";\nexport type {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureConnectionConfigType,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureMember,\n\tAzureRemoteConnectionConfig,\n\tAzureUser,\n\tIAzureAudience,\n} from \"./interfaces.js\";\n\nexport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nexport type { IUser } from \"@fluidframework/driver-definitions\";\nexport { type ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\n\n// Re-export so developers can build loggers without pulling in core-interfaces\nexport type {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\n\n// Re-export so developers have access to parameter types for createContainer/getContainer without pulling in fluid-static\nexport type { CompatibilityMode } from \"@fluidframework/fluid-static\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAiB/C,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.\n *\n * @packageDocumentation\n */\n\nexport { AzureClient } from \"./AzureClient.js\";\nexport type {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureConnectionConfigType,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureMember,\n\tAzureRemoteConnectionConfig,\n\tAzureUser,\n\tIAzureAudience,\n} from \"./interfaces.js\";\n\nexport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nexport type { IUser } from \"@fluidframework/driver-definitions\";\nexport { type ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\n\n// Re-export so developers can build loggers without pulling in core-interfaces\nexport type {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\n\n// Re-export so developers have access to parameter types for createContainer/getContainer without pulling in fluid-static\nexport type { CompatibilityMode } from \"@fluidframework/fluid-static\";\n"]}
package/lib/legacy.d.ts CHANGED
@@ -5,7 +5,13 @@
5
5
 
6
6
  /*
7
7
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
8
+ * Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
9
+ */
10
+
11
+ /**
12
+ * A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.
13
+ *
14
+ * @packageDocumentation
9
15
  */
10
16
 
11
17
  export {
package/lib/public.d.ts CHANGED
@@ -5,7 +5,13 @@
5
5
 
6
6
  /*
7
7
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
8
+ * Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
9
+ */
10
+
11
+ /**
12
+ * A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.
13
+ *
14
+ * @packageDocumentation
9
15
  */
10
16
 
11
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/azure-client",
3
- "version": "2.1.0-276326",
3
+ "version": "2.1.0-281041",
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": {
@@ -23,16 +23,6 @@
23
23
  "default": "./dist/index.js"
24
24
  }
25
25
  },
26
- "./beta": {
27
- "import": {
28
- "types": "./lib/beta.d.ts",
29
- "default": "./lib/index.js"
30
- },
31
- "require": {
32
- "types": "./dist/beta.d.ts",
33
- "default": "./dist/index.js"
34
- }
35
- },
36
26
  "./legacy": {
37
27
  "import": {
38
28
  "types": "./lib/legacy.d.ts",
@@ -57,32 +47,31 @@
57
47
  "main": "lib/index.js",
58
48
  "types": "lib/public.d.ts",
59
49
  "dependencies": {
60
- "@fluidframework/container-definitions": "2.1.0-276326",
61
- "@fluidframework/container-loader": "2.1.0-276326",
62
- "@fluidframework/core-interfaces": "2.1.0-276326",
63
- "@fluidframework/core-utils": "2.1.0-276326",
64
- "@fluidframework/driver-definitions": "2.1.0-276326",
65
- "@fluidframework/driver-utils": "2.1.0-276326",
66
- "@fluidframework/fluid-static": "2.1.0-276326",
67
- "@fluidframework/map": "2.1.0-276326",
68
- "@fluidframework/routerlicious-driver": "2.1.0-276326",
69
- "@fluidframework/runtime-utils": "2.1.0-276326",
70
- "@fluidframework/telemetry-utils": "2.1.0-276326",
71
- "axios": "^1.6.2"
50
+ "@fluidframework/container-definitions": "2.1.0-281041",
51
+ "@fluidframework/container-loader": "2.1.0-281041",
52
+ "@fluidframework/core-interfaces": "2.1.0-281041",
53
+ "@fluidframework/core-utils": "2.1.0-281041",
54
+ "@fluidframework/driver-definitions": "2.1.0-281041",
55
+ "@fluidframework/driver-utils": "2.1.0-281041",
56
+ "@fluidframework/fluid-static": "2.1.0-281041",
57
+ "@fluidframework/map": "2.1.0-281041",
58
+ "@fluidframework/routerlicious-driver": "2.1.0-281041",
59
+ "@fluidframework/runtime-utils": "2.1.0-281041",
60
+ "@fluidframework/telemetry-utils": "2.1.0-281041"
72
61
  },
73
62
  "devDependencies": {
74
63
  "@arethetypeswrong/cli": "^0.15.2",
75
- "@biomejs/biome": "^1.7.3",
76
- "@fluid-tools/build-cli": "^0.39.0",
77
- "@fluidframework/aqueduct": "2.1.0-276326",
78
- "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0-rc.5.0.0",
79
- "@fluidframework/azure-local-service": "2.1.0-276326",
64
+ "@biomejs/biome": "~1.8.3",
65
+ "@fluid-tools/build-cli": "^0.40.0",
66
+ "@fluidframework/aqueduct": "2.1.0-281041",
67
+ "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0",
68
+ "@fluidframework/azure-local-service": "2.1.0-281041",
80
69
  "@fluidframework/build-common": "^2.0.3",
81
- "@fluidframework/build-tools": "^0.39.0",
70
+ "@fluidframework/build-tools": "^0.40.0",
82
71
  "@fluidframework/eslint-config-fluid": "^5.3.0",
83
- "@fluidframework/test-runtime-utils": "2.1.0-276326",
84
- "@fluidframework/test-utils": "2.1.0-276326",
85
- "@fluidframework/tree": "2.1.0-276326",
72
+ "@fluidframework/test-runtime-utils": "2.1.0-281041",
73
+ "@fluidframework/test-utils": "2.1.0-281041",
74
+ "@fluidframework/tree": "2.1.0-281041",
86
75
  "@microsoft/api-extractor": "^7.45.1",
87
76
  "@types/mocha": "^9.1.1",
88
77
  "@types/node": "^18.19.0",
@@ -100,42 +89,47 @@
100
89
  "uuid": "^9.0.0"
101
90
  },
102
91
  "typeValidation": {
103
- "broken": {}
92
+ "broken": {
93
+ "RemovedClassDeclaration_AzureFunctionTokenProvider": {
94
+ "backCompat": false,
95
+ "forwardCompat": false
96
+ }
97
+ }
104
98
  },
105
99
  "scripts": {
106
100
  "api": "fluid-build . --task api",
107
101
  "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
108
102
  "api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
109
103
  "build": "fluid-build . --task build",
104
+ "build:api-reports": "concurrently \"npm:build:api-reports:*\"",
105
+ "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
106
+ "build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
110
107
  "build:commonjs": "fluid-build . --task commonjs",
111
108
  "build:compile": "fluid-build . --task compile",
112
- "build:docs": "concurrently \"npm:build:docs:*\"",
113
- "build:docs:current": "api-extractor run --local",
114
- "build:docs:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
109
+ "build:docs": "api-extractor run --local",
115
110
  "build:esnext": "tsc --project ./tsconfig.json",
116
111
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
117
112
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
118
113
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
119
114
  "check:are-the-types-wrong": "attw --pack .",
120
- "check:biome": "biome check . --formatter-enabled=true",
115
+ "check:biome": "biome check .",
121
116
  "check:exports": "concurrently \"npm:check:exports:*\"",
122
117
  "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
123
- "check:exports:cjs:beta": "api-extractor run --config api-extractor/api-extractor-lint-beta.cjs.json",
124
118
  "check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
125
119
  "check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
126
- "check:exports:esm:beta": "api-extractor run --config api-extractor/api-extractor-lint-beta.esm.json",
127
120
  "check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
128
121
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
129
122
  "check:format": "npm run check:biome",
130
123
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
131
- "ci:build:docs": "concurrently \"npm:ci:build:docs:*\"",
132
- "ci:build:docs:current": "api-extractor run",
133
- "ci:build:docs:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
124
+ "ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
125
+ "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
126
+ "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
127
+ "ci:build:docs": "api-extractor run",
134
128
  "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
135
129
  "eslint": "eslint --format stylish src",
136
130
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
137
131
  "format": "npm run format:biome",
138
- "format:biome": "biome check . --formatter-enabled=true --apply",
132
+ "format:biome": "biome check . --write",
139
133
  "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
140
134
  "lint": "fluid-build . --task lint",
141
135
  "lint:fix": "fluid-build . --task eslint:fix --task format",
@@ -10,7 +10,11 @@ import {
10
10
  LoaderHeader,
11
11
  } from "@fluidframework/container-definitions/internal";
12
12
  import { Loader, loadContainerPaused } from "@fluidframework/container-loader/internal";
13
- import type { FluidObject, IConfigProviderBase } from "@fluidframework/core-interfaces";
13
+ import type {
14
+ FluidObject,
15
+ IConfigProviderBase,
16
+ ITelemetryBaseLogger,
17
+ } from "@fluidframework/core-interfaces";
14
18
  import { assert } from "@fluidframework/core-utils/internal";
15
19
  import type { IClient } from "@fluidframework/driver-definitions";
16
20
  import type {
@@ -40,6 +44,8 @@ import type {
40
44
  AzureContainerServices,
41
45
  AzureContainerVersion,
42
46
  AzureGetVersionsOptions,
47
+ AzureLocalConnectionConfig,
48
+ AzureRemoteConnectionConfig,
43
49
  } from "./interfaces.js";
44
50
  import { isAzureRemoteConnectionConfig } from "./utils.js";
45
51
 
@@ -82,20 +88,24 @@ export class AzureClient {
82
88
  private readonly documentServiceFactory: IDocumentServiceFactory;
83
89
  private readonly urlResolver: IUrlResolver;
84
90
  private readonly configProvider: IConfigProviderBase | undefined;
91
+ private readonly connectionConfig: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;
92
+ private readonly logger: ITelemetryBaseLogger | undefined;
85
93
 
86
94
  /**
87
95
  * Creates a new client instance using configuration parameters.
88
96
  * @param properties - Properties for initializing a new AzureClient instance
89
97
  */
90
- public constructor(private readonly properties: AzureClientProps) {
98
+ public constructor(properties: AzureClientProps) {
99
+ this.connectionConfig = properties.connection;
100
+ this.logger = properties.logger;
91
101
  // remove trailing slash from URL if any
92
- properties.connection.endpoint = properties.connection.endpoint.replace(/\/$/, "");
102
+ this.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\/$/, "");
93
103
  this.urlResolver = new AzureUrlResolver();
94
104
  // The local service implementation differs from the Azure Fluid Relay in blob
95
105
  // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
96
- const isRemoteConnection = isAzureRemoteConnectionConfig(this.properties.connection);
106
+ const isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);
97
107
  const origDocumentServiceFactory: IDocumentServiceFactory =
98
- new RouterliciousDocumentServiceFactory(this.properties.connection.tokenProvider, {
108
+ new RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {
99
109
  enableWholeSummaryUpload: isRemoteConnection,
100
110
  enableDiscovery: isRemoteConnection,
101
111
  });
@@ -131,7 +141,7 @@ export class AzureClient {
131
141
 
132
142
  const fluidContainer = await this.createFluidContainer<TContainerSchema>(
133
143
  container,
134
- this.properties.connection,
144
+ this.connectionConfig,
135
145
  );
136
146
  const services = this.getContainerServices(container);
137
147
  return { container: fluidContainer, services };
@@ -155,14 +165,11 @@ export class AzureClient {
155
165
  services: AzureContainerServices;
156
166
  }> {
157
167
  const loader = this.createLoader(containerSchema, compatibilityMode);
158
- const url = new URL(this.properties.connection.endpoint);
159
- url.searchParams.append(
160
- "storage",
161
- encodeURIComponent(this.properties.connection.endpoint),
162
- );
168
+ const url = new URL(this.connectionConfig.endpoint);
169
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
163
170
  url.searchParams.append(
164
171
  "tenantId",
165
- encodeURIComponent(getTenantId(this.properties.connection)),
172
+ encodeURIComponent(getTenantId(this.connectionConfig)),
166
173
  );
167
174
  url.searchParams.append("containerId", encodeURIComponent(id));
168
175
  const container = await loader.resolve({ url: url.href });
@@ -194,14 +201,11 @@ export class AzureClient {
194
201
  container: IFluidContainer<TContainerSchema>;
195
202
  }> {
196
203
  const loader = this.createLoader(containerSchema, compatibilityMode);
197
- const url = new URL(this.properties.connection.endpoint);
198
- url.searchParams.append(
199
- "storage",
200
- encodeURIComponent(this.properties.connection.endpoint),
201
- );
204
+ const url = new URL(this.connectionConfig.endpoint);
205
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
202
206
  url.searchParams.append(
203
207
  "tenantId",
204
- encodeURIComponent(getTenantId(this.properties.connection)),
208
+ encodeURIComponent(getTenantId(this.connectionConfig)),
205
209
  );
206
210
  url.searchParams.append("containerId", encodeURIComponent(id));
207
211
  const container = await loadContainerPaused(loader, {
@@ -227,14 +231,11 @@ export class AzureClient {
227
231
  id: string,
228
232
  options?: AzureGetVersionsOptions,
229
233
  ): Promise<AzureContainerVersion[]> {
230
- const url = new URL(this.properties.connection.endpoint);
231
- url.searchParams.append(
232
- "storage",
233
- encodeURIComponent(this.properties.connection.endpoint),
234
- );
234
+ const url = new URL(this.connectionConfig.endpoint);
235
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
235
236
  url.searchParams.append(
236
237
  "tenantId",
237
- encodeURIComponent(getTenantId(this.properties.connection)),
238
+ encodeURIComponent(getTenantId(this.connectionConfig)),
238
239
  );
239
240
  url.searchParams.append("containerId", encodeURIComponent(id));
240
241
 
@@ -291,7 +292,7 @@ export class AzureClient {
291
292
  urlResolver: this.urlResolver,
292
293
  documentServiceFactory: this.documentServiceFactory,
293
294
  codeLoader,
294
- logger: this.properties.logger,
295
+ logger: this.logger,
295
296
  options: { client },
296
297
  configProvider: this.configProvider,
297
298
  });
@@ -312,7 +313,6 @@ export class AzureClient {
312
313
  * See {@link FluidContainer.attach}
313
314
  */
314
315
  const attach = async (): Promise<string> => {
315
- // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- AB#7608
316
316
  if (container.attachState !== AttachState.Detached) {
317
317
  throw new Error("Cannot attach container. Container is not in detached state");
318
318
  }
package/src/index.ts CHANGED
@@ -10,7 +10,6 @@
10
10
  */
11
11
 
12
12
  export { AzureClient } from "./AzureClient.js";
13
- export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider.js";
14
13
  export type {
15
14
  AzureClientProps,
16
15
  AzureConnectionConfig,
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
- "mainEntryPointFilePath": "<projectFolder>/lib/beta.d.ts"
5
- }
package/beta.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- /*
7
- * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
- */
10
-
11
- export * from "./lib/beta.js";
@@ -1,29 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
6
- import type { AzureMember } from "./interfaces.js";
7
- /**
8
- * Token Provider implementation for connecting to an Azure Function endpoint for
9
- * Azure Fluid Relay token resolution.
10
- *
11
- * @deprecated 1.2.0, This API will be removed in 2.0.0
12
- * No replacement since it is not expected anyone will use this token provider as is
13
- * See https://github.com/microsoft/FluidFramework/issues/13693 for context
14
- * @internal
15
- */
16
- export declare class AzureFunctionTokenProvider implements ITokenProvider {
17
- private readonly azFunctionUrl;
18
- private readonly user?;
19
- /**
20
- * Creates a new instance using configuration parameters.
21
- * @param azFunctionUrl - URL to Azure Function endpoint
22
- * @param user - User object
23
- */
24
- constructor(azFunctionUrl: string, user?: Pick<AzureMember<any>, "name" | "id" | "additionalDetails"> | undefined);
25
- fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
26
- fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
27
- private getToken;
28
- }
29
- //# sourceMappingURL=AzureFunctionTokenProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAG3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,cAAc;IAO/D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAPvB;;;;OAIG;gBAEe,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,yEAAwD;IAGlE,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAMb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;YAMZ,QAAQ;CAYtB"}