@fluidframework/azure-client 2.1.0-276985 → 2.1.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,9 @@
1
1
  # @fluidframework/azure-client
2
2
 
3
+ ## 2.1.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-rc.5.0.0
4
8
 
5
9
  ### Minor Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The azure-client package provides a simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay service.
4
4
 
5
- <!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
5
+ <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README_HEADER) -->
6
6
 
7
7
  <!-- prettier-ignore-start -->
8
8
  <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
@@ -15,14 +15,13 @@ library consumers should always prefer `^`.
15
15
 
16
16
  If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
17
17
 
18
- <!-- prettier-ignore-end -->
19
-
20
- <!-- AUTO-GENERATED-CONTENT:END -->
18
+ ## Installation
21
19
 
22
- <!-- AUTO-GENERATED-CONTENT:START (README_IMPORT_INSTRUCTIONS:includeHeading=TRUE) -->
20
+ To get started, install the package by running the following command:
23
21
 
24
- <!-- prettier-ignore-start -->
25
- <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
22
+ ```bash
23
+ npm i @fluidframework/azure-client
24
+ ```
26
25
 
27
26
  ## Importing from this package
28
27
 
@@ -31,10 +30,12 @@ For more information on the related support guarantees, see [API Support Levels]
31
30
 
32
31
  To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/azure-client` like normal.
33
32
 
34
- To access the `beta` APIs, import via `@fluidframework/azure-client/beta`.
35
-
36
33
  To access the `legacy` APIs, import via `@fluidframework/azure-client/legacy`.
37
34
 
35
+ ## API Documentation
36
+
37
+ API documentation for **@fluidframework/azure-client** is available at <https://fluidframework.com/docs/apis/azure-client>.
38
+
38
39
  <!-- prettier-ignore-end -->
39
40
 
40
41
  <!-- AUTO-GENERATED-CONTENT:END -->
@@ -206,14 +207,54 @@ const text1 = await map1.get(); // Resolve the handle to get the object
206
207
  const text1 = await map1.get("text1-unique-id").get();
207
208
  ```
208
209
 
209
- <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE&installation=FALSE&importInstructions=FALSE) -->
210
+ <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README_FOOTER) -->
210
211
 
211
212
  <!-- prettier-ignore-start -->
212
213
  <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
213
214
 
214
- ## API Documentation
215
+ ## Minimum Client Requirements
215
216
 
216
- API documentation for **@fluidframework/azure-client** is available at <https://fluidframework.com/docs/apis/azure-client>.
217
+ These are the platform requirements for the current version of Fluid Framework Client Packages.
218
+ These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
219
+ For Long Term Support (LTS) versions this can require supporting these platforms for several years.
220
+
221
+ It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
222
+ If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
223
+ When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
224
+
225
+ ### Supported Runtimes
226
+
227
+ - NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
228
+ - Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
229
+
230
+ ### Supported Tools
231
+
232
+ - TypeScript 5.4:
233
+ - All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
234
+ - [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
235
+ - [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
236
+ - `exactOptionalPropertyTypes` is currently not fully supported.
237
+ If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
238
+ - [webpack](https://webpack.js.org/) 5
239
+ - We are not intending to be prescriptive about what bundler to use.
240
+ Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
241
+
242
+ ### Module Resolution
243
+
244
+ [`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
245
+ Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
246
+
247
+ ### Module Formats
248
+
249
+ - ES Modules:
250
+ ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
251
+ - CommonJs:
252
+ Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
253
+ This is done to accommodate some workflows without good ES Module support.
254
+ If you have a workflow you would like included in this list, file an issue.
255
+ Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
256
+
257
+ - Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
217
258
 
218
259
  ## Contribution Guidelines
219
260
 
@@ -1,5 +1,5 @@
1
1
  {
2
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>/dist/beta.d.ts"
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.current.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
5
5
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-base.esm.legacy.json"
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.legacy.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.esm.current.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-model.esm.json"
4
4
  }
@@ -82,14 +82,10 @@ export { ITelemetryBaseEvent }
82
82
 
83
83
  export { ITelemetryBaseLogger }
84
84
 
85
- export { ITokenClaims }
86
-
87
85
  export { ITokenProvider }
88
86
 
89
87
  export { ITokenResponse }
90
88
 
91
89
  export { IUser }
92
90
 
93
- export { ScopeType }
94
-
95
91
  ```
@@ -92,6 +92,4 @@ export { IUser }
92
92
 
93
93
  export { ScopeType }
94
94
 
95
- // (No @packageDocumentation comment for this package)
96
-
97
95
  ```
@@ -0,0 +1,95 @@
1
+ ## Public API Report File for "@fluidframework/azure-client"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ // @public
8
+ export class AzureClient {
9
+ constructor(properties: AzureClientProps);
10
+ createContainer<const TContainerSchema extends ContainerSchema>(containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
11
+ container: IFluidContainer<TContainerSchema>;
12
+ services: AzureContainerServices;
13
+ }>;
14
+ getContainer<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
15
+ container: IFluidContainer<TContainerSchema>;
16
+ services: AzureContainerServices;
17
+ }>;
18
+ getContainerVersions(id: string, options?: AzureGetVersionsOptions): Promise<AzureContainerVersion[]>;
19
+ viewContainerVersion<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, version: AzureContainerVersion, compatibilityMode: CompatibilityMode): Promise<{
20
+ container: IFluidContainer<TContainerSchema>;
21
+ }>;
22
+ }
23
+
24
+ // @public
25
+ export interface AzureClientProps {
26
+ readonly configProvider?: IConfigProviderBase;
27
+ readonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;
28
+ readonly logger?: ITelemetryBaseLogger;
29
+ // (undocumented)
30
+ readonly summaryCompression?: boolean | ICompressionStorageConfig;
31
+ }
32
+
33
+ // @public
34
+ export interface AzureConnectionConfig {
35
+ endpoint: string;
36
+ tokenProvider: ITokenProvider;
37
+ type: AzureConnectionConfigType;
38
+ }
39
+
40
+ // @public
41
+ export type AzureConnectionConfigType = "local" | "remote";
42
+
43
+ // @public
44
+ export interface AzureContainerServices {
45
+ audience: IAzureAudience;
46
+ }
47
+
48
+ // @public
49
+ export interface AzureContainerVersion {
50
+ date?: string;
51
+ id: string;
52
+ }
53
+
54
+ // @public
55
+ export interface AzureGetVersionsOptions {
56
+ maxCount: number;
57
+ }
58
+
59
+ // @public
60
+ export interface AzureLocalConnectionConfig extends AzureConnectionConfig {
61
+ type: "local";
62
+ }
63
+
64
+ // @public
65
+ export interface AzureMember<T = any> extends IMember {
66
+ additionalDetails?: T;
67
+ name: string;
68
+ }
69
+
70
+ // @public
71
+ export interface AzureRemoteConnectionConfig extends AzureConnectionConfig {
72
+ tenantId: string;
73
+ type: "remote";
74
+ }
75
+
76
+ export { CompatibilityMode }
77
+
78
+ // @public
79
+ export type IAzureAudience = IServiceAudience<AzureMember>;
80
+
81
+ export { ITelemetryBaseEvent }
82
+
83
+ export { ITelemetryBaseLogger }
84
+
85
+ export { ITokenClaims }
86
+
87
+ export { ITokenProvider }
88
+
89
+ export { ITokenResponse }
90
+
91
+ export { IUser }
92
+
93
+ export { ScopeType }
94
+
95
+ ```
@@ -82,14 +82,10 @@ export { ITelemetryBaseEvent }
82
82
 
83
83
  export { ITelemetryBaseLogger }
84
84
 
85
- export { ITokenClaims }
86
-
87
85
  export { ITokenProvider }
88
86
 
89
87
  export { ITokenResponse }
90
88
 
91
89
  export { IUser }
92
90
 
93
- export { ScopeType }
94
-
95
91
  ```
@@ -10,10 +10,11 @@ import type { AzureClientProps, AzureContainerServices, AzureContainerVersion, A
10
10
  * @public
11
11
  */
12
12
  export declare class AzureClient {
13
- private readonly properties;
14
13
  private readonly documentServiceFactory;
15
14
  private readonly urlResolver;
16
15
  private readonly configProvider;
16
+ private readonly connectionConfig;
17
+ private readonly logger;
17
18
  /**
18
19
  * Creates a new client instance using configuration parameters.
19
20
  * @param properties - Properties for initializing a new AzureClient instance
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,MAAM,8BAA8B,CAAC;AAYtC,OAAO,KAAK,EACX,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,MAAM,iBAAiB,CAAC;AAiCzB;;;;GAIG;AACH,qBAAa,WAAW;IASJ,OAAO,CAAC,QAAQ,CAAC,UAAU;IAR9C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IAEjE;;;OAGG;gBACiC,UAAU,EAAE,gBAAgB;IAoBhE;;;;;;;OAOG;IACU,eAAe,CAAC,KAAK,CAAC,gBAAgB,SAAS,eAAe,EAC1E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53
  * @param properties - Properties for initializing a new AzureClient instance
54
54
  */
55
55
  constructor(properties) {
56
- this.properties = properties;
56
+ this.connectionConfig = properties.connection;
57
+ this.logger = properties.logger;
57
58
  // remove trailing slash from URL if any
58
- properties.connection.endpoint = properties.connection.endpoint.replace(/\/$/, "");
59
+ this.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\/$/, "");
59
60
  this.urlResolver = new AzureUrlResolver_js_1.AzureUrlResolver();
60
61
  // The local service implementation differs from the Azure Fluid Relay in blob
61
62
  // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
62
- const isRemoteConnection = (0, utils_js_1.isAzureRemoteConnectionConfig)(this.properties.connection);
63
- const origDocumentServiceFactory = new internal_6.RouterliciousDocumentServiceFactory(this.properties.connection.tokenProvider, {
63
+ const isRemoteConnection = (0, utils_js_1.isAzureRemoteConnectionConfig)(this.connectionConfig);
64
+ const origDocumentServiceFactory = new internal_6.RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {
64
65
  enableWholeSummaryUpload: isRemoteConnection,
65
66
  enableDiscovery: isRemoteConnection,
66
67
  });
@@ -81,7 +82,7 @@ class AzureClient {
81
82
  package: "no-dynamic-package",
82
83
  config: {},
83
84
  });
84
- const fluidContainer = await this.createFluidContainer(container, this.properties.connection);
85
+ const fluidContainer = await this.createFluidContainer(container, this.connectionConfig);
85
86
  const services = this.getContainerServices(container);
86
87
  return { container: fluidContainer, services };
87
88
  }
@@ -96,9 +97,9 @@ class AzureClient {
96
97
  */
97
98
  async getContainer(id, containerSchema, compatibilityMode) {
98
99
  const loader = this.createLoader(containerSchema, compatibilityMode);
99
- const url = new URL(this.properties.connection.endpoint);
100
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
101
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
100
+ const url = new URL(this.connectionConfig.endpoint);
101
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
102
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.connectionConfig)));
102
103
  url.searchParams.append("containerId", encodeURIComponent(id));
103
104
  const container = await loader.resolve({ url: url.href });
104
105
  const rootDataObject = await this.getContainerEntryPoint(container);
@@ -121,9 +122,9 @@ class AzureClient {
121
122
  */
122
123
  async viewContainerVersion(id, containerSchema, version, compatibilityMode) {
123
124
  const loader = this.createLoader(containerSchema, compatibilityMode);
124
- const url = new URL(this.properties.connection.endpoint);
125
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
126
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
125
+ const url = new URL(this.connectionConfig.endpoint);
126
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
127
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.connectionConfig)));
127
128
  url.searchParams.append("containerId", encodeURIComponent(id));
128
129
  const container = await (0, internal_2.loadContainerPaused)(loader, {
129
130
  url: url.href,
@@ -144,9 +145,9 @@ class AzureClient {
144
145
  * @returns Array of available container versions.
145
146
  */
146
147
  async getContainerVersions(id, options) {
147
- const url = new URL(this.properties.connection.endpoint);
148
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
149
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
148
+ const url = new URL(this.connectionConfig.endpoint);
149
+ url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
150
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.connectionConfig)));
150
151
  url.searchParams.append("containerId", encodeURIComponent(id));
151
152
  const resolvedUrl = await this.urlResolver.resolve({ url: url.href });
152
153
  if (!resolvedUrl) {
@@ -194,7 +195,7 @@ class AzureClient {
194
195
  urlResolver: this.urlResolver,
195
196
  documentServiceFactory: this.documentServiceFactory,
196
197
  codeLoader,
197
- logger: this.properties.logger,
198
+ logger: this.logger,
198
199
  options: { client },
199
200
  configProvider: this.configProvider,
200
201
  });
@@ -206,7 +207,6 @@ class AzureClient {
206
207
  * See {@link FluidContainer.attach}
207
208
  */
208
209
  const attach = async () => {
209
- // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- AB#7608
210
210
  if (container.attachState !== container_definitions_1.AttachState.Detached) {
211
211
  throw new Error("Cannot attach container. Container is not in detached state");
212
212
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AACpE,6EAIwD;AACxD,wEAAwF;AAExF,kEAA6D;AAM7D,oEAAgF;AAMhF,oEAK+C;AAC/C,4EAAoG;AACpG,uEAA0F;AAE1F,yDAA+D;AAC/D,+DAAsF;AAQtF,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,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,MAAa,WAAW;IAKvB;;;OAGG;IACH,YAAoC,UAA4B;QAA5B,eAAU,GAAV,UAAU,CAAkB;QAC/D,wCAAwC;QACxC,UAAU,CAAC,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,WAAW,GA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AAc,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,IAAA,iBAAM,EACL,cAAc,CAAC,eAAe,KAAK,SAAS,EAC5C,KAAK,CAAC,gDAAgD,CACtD,CAAC;QACF,OAAO,cAAc,CAAC,eAAe,CAAC;IACvC,CAAC;CAED;AArQD,kCAqQC","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,iFAAoE;AACpE,6EAIwD;AACxD,wEAAwF;AAMxF,kEAA6D;AAM7D,oEAAgF;AAMhF,oEAK+C;AAC/C,4EAAoG;AACpG,uEAA0F;AAE1F,yDAA+D;AAC/D,+DAAsF;AAUtF,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,uBAA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AS,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,IAAA,+BAAoB,EAAmB;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,IAAA,iBAAM,EACL,cAAc,CAAC,eAAe,KAAK,SAAS,EAC5C,KAAK,CAAC,gDAAgD,CACtD,CAAC;QACF,OAAO,cAAc,CAAC,eAAe,CAAC;IACvC,CAAC;CAED;AA/PD,kCA+PC","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/dist/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/dist/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/internal.d.ts CHANGED
@@ -5,7 +5,7 @@
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
9
  */
10
10
 
11
11
  export * from "./lib/index.js";
package/legacy.d.ts CHANGED
@@ -5,7 +5,7 @@
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
9
  */
10
10
 
11
11
  export * from "./lib/legacy.js";
@@ -10,10 +10,11 @@ import type { AzureClientProps, AzureContainerServices, AzureContainerVersion, A
10
10
  * @public
11
11
  */
12
12
  export declare class AzureClient {
13
- private readonly properties;
14
13
  private readonly documentServiceFactory;
15
14
  private readonly urlResolver;
16
15
  private readonly configProvider;
16
+ private readonly connectionConfig;
17
+ private readonly logger;
17
18
  /**
18
19
  * Creates a new client instance using configuration parameters.
19
20
  * @param properties - Properties for initializing a new AzureClient instance
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,MAAM,8BAA8B,CAAC;AAYtC,OAAO,KAAK,EACX,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,E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BAAiB,EAAE,iBAAiB,GAClC,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;KAC7C,CAAC;IAqBF;;;;;;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,YAAY;YAiCN,oBAAoB;YAgCpB,sBAAsB;CASpC"}
@@ -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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gBAAgB,GAAG,2BAA2B,CACnD,UAAU,CAAC,QAAQ,EACnB,WAAW,CAAC,UAAU,CAAC,CACvB,CAAC;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":[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M,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 {\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/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-276985",
3
+ "version": "2.1.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": {
@@ -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,31 +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-276985",
61
- "@fluidframework/container-loader": "2.1.0-276985",
62
- "@fluidframework/core-interfaces": "2.1.0-276985",
63
- "@fluidframework/core-utils": "2.1.0-276985",
64
- "@fluidframework/driver-definitions": "2.1.0-276985",
65
- "@fluidframework/driver-utils": "2.1.0-276985",
66
- "@fluidframework/fluid-static": "2.1.0-276985",
67
- "@fluidframework/map": "2.1.0-276985",
68
- "@fluidframework/routerlicious-driver": "2.1.0-276985",
69
- "@fluidframework/runtime-utils": "2.1.0-276985",
70
- "@fluidframework/telemetry-utils": "2.1.0-276985"
50
+ "@fluidframework/container-definitions": "~2.1.0",
51
+ "@fluidframework/container-loader": "~2.1.0",
52
+ "@fluidframework/core-interfaces": "~2.1.0",
53
+ "@fluidframework/core-utils": "~2.1.0",
54
+ "@fluidframework/driver-definitions": "~2.1.0",
55
+ "@fluidframework/driver-utils": "~2.1.0",
56
+ "@fluidframework/fluid-static": "~2.1.0",
57
+ "@fluidframework/map": "~2.1.0",
58
+ "@fluidframework/routerlicious-driver": "~2.1.0",
59
+ "@fluidframework/runtime-utils": "~2.1.0",
60
+ "@fluidframework/telemetry-utils": "~2.1.0"
71
61
  },
72
62
  "devDependencies": {
73
63
  "@arethetypeswrong/cli": "^0.15.2",
74
- "@biomejs/biome": "^1.7.3",
75
- "@fluid-tools/build-cli": "^0.39.0",
76
- "@fluidframework/aqueduct": "2.1.0-276985",
77
- "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0-rc.5.0.0",
78
- "@fluidframework/azure-local-service": "2.1.0-276985",
64
+ "@biomejs/biome": "~1.8.3",
65
+ "@fluid-tools/build-cli": "^0.41.0",
66
+ "@fluidframework/aqueduct": "~2.1.0",
67
+ "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0",
68
+ "@fluidframework/azure-local-service": "~2.1.0",
79
69
  "@fluidframework/build-common": "^2.0.3",
80
- "@fluidframework/build-tools": "^0.39.0",
70
+ "@fluidframework/build-tools": "^0.41.0",
81
71
  "@fluidframework/eslint-config-fluid": "^5.3.0",
82
- "@fluidframework/test-runtime-utils": "2.1.0-276985",
83
- "@fluidframework/test-utils": "2.1.0-276985",
84
- "@fluidframework/tree": "2.1.0-276985",
72
+ "@fluidframework/test-runtime-utils": "~2.1.0",
73
+ "@fluidframework/test-utils": "~2.1.0",
74
+ "@fluidframework/tree": "~2.1.0",
85
75
  "@microsoft/api-extractor": "^7.45.1",
86
76
  "@types/mocha": "^9.1.1",
87
77
  "@types/node": "^18.19.0",
@@ -100,7 +90,11 @@
100
90
  },
101
91
  "typeValidation": {
102
92
  "broken": {
103
- "RemovedClassDeclaration_AzureFunctionTokenProvider": {
93
+ "RemovedClassStatics_AzureFunctionTokenProvider": {
94
+ "backCompat": false,
95
+ "forwardCompat": false
96
+ },
97
+ "RemovedClass_AzureFunctionTokenProvider": {
104
98
  "backCompat": false,
105
99
  "forwardCompat": false
106
100
  }
@@ -111,35 +105,35 @@
111
105
  "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
112
106
  "api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
113
107
  "build": "fluid-build . --task build",
108
+ "build:api-reports": "concurrently \"npm:build:api-reports:*\"",
109
+ "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
110
+ "build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
114
111
  "build:commonjs": "fluid-build . --task commonjs",
115
112
  "build:compile": "fluid-build . --task compile",
116
- "build:docs": "concurrently \"npm:build:docs:*\"",
117
- "build:docs:current": "api-extractor run --local",
118
- "build:docs:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
113
+ "build:docs": "api-extractor run --local",
119
114
  "build:esnext": "tsc --project ./tsconfig.json",
120
115
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
121
116
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
122
117
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
123
118
  "check:are-the-types-wrong": "attw --pack .",
124
- "check:biome": "biome check . --formatter-enabled=true",
119
+ "check:biome": "biome check .",
125
120
  "check:exports": "concurrently \"npm:check:exports:*\"",
126
121
  "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
127
- "check:exports:cjs:beta": "api-extractor run --config api-extractor/api-extractor-lint-beta.cjs.json",
128
122
  "check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
129
123
  "check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
130
- "check:exports:esm:beta": "api-extractor run --config api-extractor/api-extractor-lint-beta.esm.json",
131
124
  "check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
132
125
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
133
126
  "check:format": "npm run check:biome",
134
127
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
135
- "ci:build:docs": "concurrently \"npm:ci:build:docs:*\"",
136
- "ci:build:docs:current": "api-extractor run",
137
- "ci:build:docs:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
128
+ "ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
129
+ "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
130
+ "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
131
+ "ci:build:docs": "api-extractor run",
138
132
  "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
139
133
  "eslint": "eslint --format stylish src",
140
134
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
141
135
  "format": "npm run format:biome",
142
- "format:biome": "biome check . --formatter-enabled=true --apply",
136
+ "format:biome": "biome check . --write",
143
137
  "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
144
138
  "lint": "fluid-build . --task lint",
145
139
  "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
  }
@@ -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";
package/dist/beta.d.ts DELETED
@@ -1,30 +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 {
12
- // @public APIs
13
- AzureClient,
14
- AzureClientProps,
15
- AzureConnectionConfig,
16
- AzureConnectionConfigType,
17
- AzureContainerServices,
18
- AzureContainerVersion,
19
- AzureGetVersionsOptions,
20
- AzureLocalConnectionConfig,
21
- AzureMember,
22
- AzureRemoteConnectionConfig,
23
- CompatibilityMode,
24
- IAzureAudience,
25
- ITelemetryBaseEvent,
26
- ITelemetryBaseLogger,
27
- ITokenProvider,
28
- ITokenResponse,
29
- IUser
30
- } from "./index.js";
package/lib/beta.d.ts DELETED
@@ -1,30 +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 {
12
- // @public APIs
13
- AzureClient,
14
- AzureClientProps,
15
- AzureConnectionConfig,
16
- AzureConnectionConfigType,
17
- AzureContainerServices,
18
- AzureContainerVersion,
19
- AzureGetVersionsOptions,
20
- AzureLocalConnectionConfig,
21
- AzureMember,
22
- AzureRemoteConnectionConfig,
23
- CompatibilityMode,
24
- IAzureAudience,
25
- ITelemetryBaseEvent,
26
- ITelemetryBaseLogger,
27
- ITokenProvider,
28
- ITokenResponse,
29
- IUser
30
- } from "./index.js";