@fluidframework/azure-client 2.101.1 → 2.103.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 +15 -0
- package/README.md +4 -4
- package/api-report/azure-client.beta.api.md +15 -1
- package/api-report/azure-client.legacy.beta.api.md +15 -1
- package/api-report/azure-client.legacy.public.api.md +15 -1
- package/api-report/azure-client.public.api.md +15 -1
- package/dist/AzureClient.d.ts +51 -3
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/AzureClient.js +15 -33
- package/dist/AzureClient.js.map +1 -1
- package/dist/interfaces.d.ts +4 -3
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/lib/AzureClient.d.ts +51 -3
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.js +16 -34
- package/lib/AzureClient.js.map +1 -1
- package/lib/interfaces.d.ts +4 -3
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/package.json +16 -15
- package/src/AzureClient.ts +102 -8
- package/src/interfaces.ts +4 -8
package/lib/AzureClient.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { ContainerSchema, IFluidContainer, CompatibilityMode } from "@fluidframework/fluid-static";
|
|
6
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions";
|
|
6
7
|
import type { AzureClientProps, AzureContainerServices, AzureContainerVersion, AzureGetVersionsOptions } from "./interfaces.js";
|
|
7
8
|
/**
|
|
8
9
|
* AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,
|
|
@@ -26,9 +27,24 @@ export declare class AzureClient {
|
|
|
26
27
|
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
27
28
|
* (normally not explicitly specified.)
|
|
28
29
|
* @param containerSchema - Container schema for the new container.
|
|
29
|
-
* @param
|
|
30
|
+
* @param minVersionForCollab - Minimum Fluid Framework version required for collaboration, as a
|
|
31
|
+
* SemVer string (e.g. `"1.0.0"`, `"2.100.0"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.
|
|
30
32
|
* @returns New detached container instance along with associated services.
|
|
31
33
|
*/
|
|
34
|
+
createContainer<const TContainerSchema extends ContainerSchema>(containerSchema: TContainerSchema, minVersionForCollab: MinimumVersionForCollab): Promise<{
|
|
35
|
+
container: IFluidContainer<TContainerSchema>;
|
|
36
|
+
services: AzureContainerServices;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new detached container instance in the Azure Fluid Relay.
|
|
40
|
+
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
41
|
+
* This does not normally need to be specified explicitly.
|
|
42
|
+
* @param containerSchema - Container schema for the new container.
|
|
43
|
+
* @param compatibilityMode - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.
|
|
44
|
+
* @returns New detached container instance along with associated services.
|
|
45
|
+
* @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `"2.0.0"`) instead. The legacy
|
|
46
|
+
* values `"1"` and `"2"` correspond to `"1.0.0"` and `"2.0.0"` respectively.
|
|
47
|
+
*/
|
|
32
48
|
createContainer<const TContainerSchema extends ContainerSchema>(containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
|
|
33
49
|
container: IFluidContainer<TContainerSchema>;
|
|
34
50
|
services: AzureContainerServices;
|
|
@@ -39,9 +55,25 @@ export declare class AzureClient {
|
|
|
39
55
|
* (normally not explicitly specified.)
|
|
40
56
|
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
41
57
|
* @param containerSchema - Container schema used to access data objects in the container.
|
|
42
|
-
* @param
|
|
58
|
+
* @param minVersionForCollab - Minimum framework version required for collaboration, as a
|
|
59
|
+
* SemVer string (e.g. `"1.0.0"`, `"2.100.0"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.
|
|
43
60
|
* @returns Existing container instance along with associated services.
|
|
44
61
|
*/
|
|
62
|
+
getContainer<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, minVersionForCollab: MinimumVersionForCollab): Promise<{
|
|
63
|
+
container: IFluidContainer<TContainerSchema>;
|
|
64
|
+
services: AzureContainerServices;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Accesses the existing container given its unique ID in the Azure Fluid Relay.
|
|
68
|
+
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
69
|
+
* (normally not explicitly specified.)
|
|
70
|
+
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
71
|
+
* @param containerSchema - Container schema used to access data objects in the container.
|
|
72
|
+
* @param compatibilityMode - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.
|
|
73
|
+
* @returns Existing container instance along with associated services.
|
|
74
|
+
* @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `"2.0.0"`) instead. The legacy
|
|
75
|
+
* values `"1"` and `"2"` correspond to `"1.0.0"` and `"2.0.0"` respectively.
|
|
76
|
+
*/
|
|
45
77
|
getContainer<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
|
|
46
78
|
container: IFluidContainer<TContainerSchema>;
|
|
47
79
|
services: AzureContainerServices;
|
|
@@ -53,8 +85,24 @@ export declare class AzureClient {
|
|
|
53
85
|
* @param id - Unique ID of the source container in Azure Fluid Relay.
|
|
54
86
|
* @param containerSchema - Container schema used to access data objects in the container.
|
|
55
87
|
* @param version - Unique version of the source container in Azure Fluid Relay.
|
|
56
|
-
* @param
|
|
88
|
+
* @param minVersionForCollab - Minimum framework version required for collaboration, as a
|
|
89
|
+
* SemVer string (e.g. `"1.0.0"`, `"2.100.0"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.
|
|
90
|
+
* @returns Loaded container instance at the specified version.
|
|
91
|
+
*/
|
|
92
|
+
viewContainerVersion<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, version: AzureContainerVersion, minVersionForCollab: MinimumVersionForCollab): Promise<{
|
|
93
|
+
container: IFluidContainer<TContainerSchema>;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Load a specific version of a container for viewing only.
|
|
97
|
+
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
98
|
+
* (normally not explicitly specified.)
|
|
99
|
+
* @param id - Unique ID of the source container in Azure Fluid Relay.
|
|
100
|
+
* @param containerSchema - Container schema used to access data objects in the container.
|
|
101
|
+
* @param version - Unique version of the source container in Azure Fluid Relay.
|
|
102
|
+
* @param compatibilityMode - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.
|
|
57
103
|
* @returns Loaded container instance at the specified version.
|
|
104
|
+
* @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `"2.0.0"`) instead. The legacy
|
|
105
|
+
* values `"1"` and `"2"` correspond to `"1.0.0"` and `"2.0.0"` respectively.
|
|
58
106
|
*/
|
|
59
107
|
viewContainerVersion<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, version: AzureContainerVersion, compatibilityMode: CompatibilityMode): Promise<{
|
|
60
108
|
container: IFluidContainer<TContainerSchema>;
|
package/lib/AzureClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,OAAO,KAAK,EACX,eAAe,EACf,eAAe,
|
|
1
|
+
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,OAAO,KAAK,EACX,eAAe,EACf,eAAe,EAEf,iBAAiB,EACjB,MAAM,8BAA8B,CAAC;AAQtC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;A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AY,CAAC,gBAAgB,SAAS,eAAe,EACjE,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,gBAAgB,EAEjC,iBAAiB,EAAE,iBAAiB,GAClC,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC7C,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IA8BF;;;;;;;;;;OAUG;IACU,oBAAoB,CAAC,gBAAgB,SAAS,eAAe,EACzE,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,gBAAgB,EACjC,OAAO,EAAE,qBAAqB,EAC9B,mBAAmB,EAAE,uBAAuB,GAC1C,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;KAC7C,CAAC;IACF;;;;;;;;;;;OAWG;IACU,oBAAoB,CAAC,gBAAgB,SAAS,eAAe,EACzE,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,gBAAgB,EACjC,OAAO,EAAE,qBAAqB,EAE9B,iBAAiB,EAAE,iBAAiB,GAClC,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;KAC7C,CAAC;IA4BF;;;;;;OAMG;IACU,oBAAoB,CAChC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA0BnC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,cAAc;YA6CR,oBAAoB;CA6BlC"}
|
package/lib/AzureClient.js
CHANGED
|
@@ -6,7 +6,7 @@ import { AttachState } from "@fluidframework/container-definitions";
|
|
|
6
6
|
import { LoaderHeader, } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { createDetachedContainer, loadContainerPaused, loadExistingContainer, } from "@fluidframework/container-loader/internal";
|
|
8
8
|
import { applyStorageCompression } from "@fluidframework/driver-utils/internal";
|
|
9
|
-
import { createDOProviderContainerRuntimeFactory, createFluidContainer, createServiceAudience, } from "@fluidframework/fluid-static/internal";
|
|
9
|
+
import { createDOProviderContainerRuntimeFactory, createFluidContainer, createServiceAudience, resolveCompatibilityModeToMinVersionForCollab, } from "@fluidframework/fluid-static/internal";
|
|
10
10
|
import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver/internal";
|
|
11
11
|
import { wrapConfigProviderWithDefaults } from "@fluidframework/telemetry-utils/internal";
|
|
12
12
|
import { createAzureAudienceMember } from "./AzureAudience.js";
|
|
@@ -65,15 +65,9 @@ export class AzureClient {
|
|
|
65
65
|
this.configProvider = wrapConfigProvider(properties.configProvider);
|
|
66
66
|
this.createContainerRuntimeFactory = properties.createContainerRuntimeFactory;
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* (normally not explicitly specified.)
|
|
72
|
-
* @param containerSchema - Container schema for the new container.
|
|
73
|
-
* @param compatibilityMode - Compatibility mode the container should run in.
|
|
74
|
-
* @returns New detached container instance along with associated services.
|
|
75
|
-
*/
|
|
76
|
-
async createContainer(containerSchema, compatibilityMode) {
|
|
68
|
+
async createContainer(containerSchema,
|
|
69
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
70
|
+
compatibilityMode) {
|
|
77
71
|
const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
|
|
78
72
|
const container = await createDetachedContainer({
|
|
79
73
|
...loaderProps,
|
|
@@ -86,16 +80,9 @@ export class AzureClient {
|
|
|
86
80
|
const services = this.getContainerServices(container);
|
|
87
81
|
return { container: fluidContainer, services };
|
|
88
82
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* (normally not explicitly specified.)
|
|
93
|
-
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
94
|
-
* @param containerSchema - Container schema used to access data objects in the container.
|
|
95
|
-
* @param compatibilityMode - Compatibility mode the container should run in.
|
|
96
|
-
* @returns Existing container instance along with associated services.
|
|
97
|
-
*/
|
|
98
|
-
async getContainer(id, containerSchema, compatibilityMode) {
|
|
83
|
+
async getContainer(id, containerSchema,
|
|
84
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
85
|
+
compatibilityMode) {
|
|
99
86
|
const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
|
|
100
87
|
const url = new URL(this.connectionConfig.endpoint);
|
|
101
88
|
url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
|
|
@@ -111,17 +98,9 @@ export class AzureClient {
|
|
|
111
98
|
const services = this.getContainerServices(container);
|
|
112
99
|
return { container: fluidContainer, services };
|
|
113
100
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* (normally not explicitly specified.)
|
|
118
|
-
* @param id - Unique ID of the source container in Azure Fluid Relay.
|
|
119
|
-
* @param containerSchema - Container schema used to access data objects in the container.
|
|
120
|
-
* @param version - Unique version of the source container in Azure Fluid Relay.
|
|
121
|
-
* @param compatibilityMode - Compatibility mode the container should run in.
|
|
122
|
-
* @returns Loaded container instance at the specified version.
|
|
123
|
-
*/
|
|
124
|
-
async viewContainerVersion(id, containerSchema, version, compatibilityMode) {
|
|
101
|
+
async viewContainerVersion(id, containerSchema, version,
|
|
102
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
103
|
+
compatibilityMode) {
|
|
125
104
|
const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
|
|
126
105
|
const url = new URL(this.connectionConfig.endpoint);
|
|
127
106
|
url.searchParams.append("storage", encodeURIComponent(this.connectionConfig.endpoint));
|
|
@@ -169,15 +148,18 @@ export class AzureClient {
|
|
|
169
148
|
}),
|
|
170
149
|
};
|
|
171
150
|
}
|
|
172
|
-
getLoaderProps(schema,
|
|
151
|
+
getLoaderProps(schema,
|
|
152
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
153
|
+
compatibilityMode) {
|
|
154
|
+
const minVersionForCollaboration = resolveCompatibilityModeToMinVersionForCollab(compatibilityMode);
|
|
173
155
|
const runtimeFactory = this.createContainerRuntimeFactory
|
|
174
156
|
? this.createContainerRuntimeFactory({
|
|
175
157
|
schema,
|
|
176
|
-
|
|
158
|
+
minVersionForCollaboration,
|
|
177
159
|
})
|
|
178
160
|
: createDOProviderContainerRuntimeFactory({
|
|
179
161
|
schema,
|
|
180
|
-
|
|
162
|
+
minVersionForCollaboration,
|
|
181
163
|
});
|
|
182
164
|
const load = async () => {
|
|
183
165
|
return {
|
package/lib/AzureClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAIN,YAAY,GACZ,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,GAErB,MAAM,2CAA2C,CAAC;AAUnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAMhF,OAAO,EACN,uCAAuC,EACvC,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAE1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAWtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,oBAA2C,EAAU,EAAE;IAC3E,OAAO,6BAA6B,CAAC,oBAAoB,CAAC;QACzD,CAAC,CAAC,oBAAoB,CAAC,QAAQ;QAC/B,CAAC,CAAC,oBAAoB,CAAC;AACzB,CAAC,CAAC;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EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAmB;YACnE,SAAS;SACT,CAAC,CAAC;QACH,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n\ttype IRuntimeFactory,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadContainerPaused,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tContainerSchema,\n\tIFluidContainer,\n\tCompatibilityMode,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\tcreateServiceAudience,\n} from \"@fluidframework/fluid-static/internal\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver/internal\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createAzureAudienceMember } from \"./AzureAudience.js\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver.js\";\nimport type {\n\tAzureClientProps,\n\tAzureClientPropsInternal,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureRemoteConnectionConfig,\n} from \"./interfaces.js\";\nimport { isAzureRemoteConnectionConfig } from \"./utils.js\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProperties: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProperties)\n\t\t? connectionProperties.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst azureClientFeatureGates = {\n\t// Azure client requires a write connection by default\n\t\"Fluid.Container.ForceWriteConnection\": true,\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for Azure Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, azureClientFeatureGates);\n}\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n * @public\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tprivate readonly createContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tcompatibilityMode,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tcompatibilityMode: CompatibilityMode;\n\t}) => IRuntimeFactory;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param properties - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(properties: AzureClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\t// remove trailing slash from URL if any\n\t\tthis.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tproperties.summaryCompression,\n\t\t);\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\n\t\tthis.createContainerRuntimeFactory = (\n\t\t\tproperties as Partial<AzureClientPropsInternal>\n\t\t).createContainerRuntimeFactory;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param containerSchema - Container schema for the new container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer<const TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<TContainerSchema>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Existing container instance along with associated services.\n\t */\n\tpublic async getContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst container = await loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: { url: url.href },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Load a specific version of a container for viewing only.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * @param compatibilityMode - Compatibility mode the container should run in.\n\t * @returns Loaded container instance at the specified version.\n\t */\n\tpublic async viewContainerVersion<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion: AzureContainerVersion,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loadContainerPaused(loaderProps, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\treturn { container: fluidContainer };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retrieve to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService =\n\t\t\tawait this.documentServiceFactory.createDocumentService(resolvedUrl);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: createServiceAudience({\n\t\t\t\tcontainer,\n\t\t\t\tcreateServiceMember: createAzureAudienceMember,\n\t\t\t}),\n\t\t};\n\t}\n\n\tprivate getLoaderProps(\n\t\tschema: ContainerSchema,\n\t\tcompatibilityMode: CompatibilityMode,\n\t): ILoaderProps {\n\t\tconst runtimeFactory = this.createContainerRuntimeFactory\n\t\t\t? this.createContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t})\n\t\t\t: createDOProviderContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tcompatibilityMode,\n\t\t\t\t});\n\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<IFluidContainer<TContainerSchema>> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAIN,YAAY,GACZ,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,GAErB,MAAM,2CAA2C,CAAC;AAUnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAOhF,OAAO,EACN,uCAAuC,E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AAE,WAAW,EAAE,IAAI,EAAE;aACnC;YACD,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;YAChB,IAAI,EAAE,OAAO;SACb,CAAC;QAEF,OAAO;YACN,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,EAAE,MAAM,EAAE;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,SAAqB,EACrB,UAAiC;QAEjC,MAAM,gBAAgB,GAAG,2BAA2B,CACnD,UAAU,CAAC,QAAQ,EACnB,WAAW,CAAC,UAAU,CAAC,CACvB,CAAC;QAEF;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChF,CAAC;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACrE,CAAC;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAmB;YACnE,SAAS;SACT,CAAC,CAAC;QACH,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n\ttype IRuntimeFactory,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tcreateDetachedContainer,\n\tloadContainerPaused,\n\tloadExistingContainer,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tContainerSchema,\n\tIFluidContainer,\n\t// eslint-disable-next-line import-x/no-deprecated\n\tCompatibilityMode,\n} from \"@fluidframework/fluid-static\";\nimport {\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\tcreateServiceAudience,\n\tresolveCompatibilityModeToMinVersionForCollab,\n} from \"@fluidframework/fluid-static/internal\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions\";\nimport { wrapConfigProviderWithDefaults } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { createAzureAudienceMember } from \"./AzureAudience.js\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver.js\";\nimport type {\n\tAzureClientProps,\n\tAzureClientPropsInternal,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureRemoteConnectionConfig,\n} from \"./interfaces.js\";\nimport { isAzureRemoteConnectionConfig } from \"./utils.js\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProperties: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProperties)\n\t\t? connectionProperties.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * Default feature gates.\n * These values will only be used if the feature gate is not already set by the supplied config provider.\n */\nconst azureClientFeatureGates = {\n\t// Azure client requires a write connection by default\n\t\"Fluid.Container.ForceWriteConnection\": true,\n};\n\n/**\n * Wrap the config provider to fall back on the appropriate defaults for Azure Client.\n * @param baseConfigProvider - The base config provider to wrap\n * @returns A new config provider with the appropriate defaults applied underneath the given provider\n */\nfunction wrapConfigProvider(baseConfigProvider?: IConfigProviderBase): IConfigProviderBase {\n\treturn wrapConfigProviderWithDefaults(baseConfigProvider, azureClientFeatureGates);\n}\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n * @public\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\tprivate readonly connectionConfig: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\tprivate readonly logger: ITelemetryBaseLogger | undefined;\n\n\tprivate readonly createContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tminVersionForCollaboration,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tminVersionForCollaboration: MinimumVersionForCollab;\n\t}) => IRuntimeFactory;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param properties - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(properties: AzureClientProps) {\n\t\tthis.connectionConfig = properties.connection;\n\t\tthis.logger = properties.logger;\n\t\t// remove trailing slash from URL if any\n\t\tthis.connectionConfig.endpoint = this.connectionConfig.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.connectionConfig);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.connectionConfig.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tproperties.summaryCompression,\n\t\t);\n\t\tthis.configProvider = wrapConfigProvider(properties.configProvider);\n\n\t\tthis.createContainerRuntimeFactory = (\n\t\t\tproperties as Partial<AzureClientPropsInternal>\n\t\t).createContainerRuntimeFactory;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param containerSchema - Container schema for the new container.\n\t * @param minVersionForCollab - Minimum Fluid Framework version required for collaboration, as a\n\t * SemVer string (e.g. `\"1.0.0\"`, `\"2.100.0\"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.\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\tminVersionForCollab: MinimumVersionForCollab,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}>;\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 * This does not normally need to be specified explicitly.\n\t * @param containerSchema - Container schema for the new container.\n\t * @param compatibilityMode - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.\n\t * @returns New detached container instance along with associated services.\n\t * @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `\"2.0.0\"`) instead. The legacy\n\t * values `\"1\"` and `\"2\"` correspond to `\"1.0.0\"` and `\"2.0.0\"` respectively.\n\t */\n\tpublic async createContainer<const TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}>;\n\tpublic async createContainer<const TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tcompatibilityMode: MinimumVersionForCollab | CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\n\t\tconst container = await createDetachedContainer({\n\t\t\t...loaderProps,\n\t\t\tcodeDetails: {\n\t\t\t\tpackage: \"no-dynamic-package\",\n\t\t\t\tconfig: {},\n\t\t\t},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer<TContainerSchema>(\n\t\t\tcontainer,\n\t\t\tthis.connectionConfig,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param minVersionForCollab - Minimum framework version required for collaboration, as a\n\t * SemVer string (e.g. `\"1.0.0\"`, `\"2.100.0\"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.\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\tminVersionForCollab: MinimumVersionForCollab,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}>;\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 - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.\n\t * @returns Existing container instance along with associated services.\n\t * @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `\"2.0.0\"`) instead. The legacy\n\t * values `\"1\"` and `\"2\"` correspond to `\"1.0.0\"` and `\"2.0.0\"` respectively.\n\t */\n\tpublic async getContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}>;\n\tpublic async getContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tcompatibilityMode: MinimumVersionForCollab | CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst container = await loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: { url: url.href },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Load a specific version of a container for viewing only.\n\t * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.\n\t * (normally not explicitly specified.)\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * @param minVersionForCollab - Minimum framework version required for collaboration, as a\n\t * SemVer string (e.g. `\"1.0.0\"`, `\"2.100.0\"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.\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\tminVersionForCollab: MinimumVersionForCollab,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}>;\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 - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.\n\t * @returns Loaded container instance at the specified version.\n\t * @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `\"2.0.0\"`) instead. The legacy\n\t * values `\"1\"` and `\"2\"` correspond to `\"1.0.0\"` and `\"2.0.0\"` respectively.\n\t */\n\tpublic async viewContainerVersion<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion: AzureContainerVersion,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tcompatibilityMode: CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}>;\n\tpublic async viewContainerVersion<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion: AzureContainerVersion,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tcompatibilityMode: MinimumVersionForCollab | CompatibilityMode,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t}> {\n\t\tconst loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loadContainerPaused(loaderProps, {\n\t\t\turl: url.href,\n\t\t\theaders: { [LoaderHeader.version]: version.id },\n\t\t});\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\treturn { container: fluidContainer };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retrieve to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.connectionConfig.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.connectionConfig.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.connectionConfig)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService =\n\t\t\tawait this.documentServiceFactory.createDocumentService(resolvedUrl);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: createServiceAudience({\n\t\t\t\tcontainer,\n\t\t\t\tcreateServiceMember: createAzureAudienceMember,\n\t\t\t}),\n\t\t};\n\t}\n\n\tprivate getLoaderProps(\n\t\tschema: ContainerSchema,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tcompatibilityMode: MinimumVersionForCollab | CompatibilityMode,\n\t): ILoaderProps {\n\t\tconst minVersionForCollaboration =\n\t\t\tresolveCompatibilityModeToMinVersionForCollab(compatibilityMode);\n\t\tconst runtimeFactory = this.createContainerRuntimeFactory\n\t\t\t? this.createContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tminVersionForCollaboration,\n\t\t\t\t})\n\t\t\t: createDOProviderContainerRuntimeFactory({\n\t\t\t\t\tschema,\n\t\t\t\t\tminVersionForCollaboration,\n\t\t\t\t});\n\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn {\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t};\n\t}\n\n\tprivate async createFluidContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<IFluidContainer<TContainerSchema>> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = await createFluidContainer<TContainerSchema>({\n\t\t\tcontainer,\n\t\t});\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ import type { IRuntimeFactory } from "@fluidframework/container-definitions/inte
|
|
|
6
6
|
import type { IConfigProviderBase, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
7
|
import type { IUser } from "@fluidframework/driver-definitions";
|
|
8
8
|
import type { ICompressionStorageConfig } from "@fluidframework/driver-utils";
|
|
9
|
-
import type {
|
|
9
|
+
import type { ContainerSchema, IMember, IServiceAudience } from "@fluidframework/fluid-static";
|
|
10
10
|
import type { ITokenProvider } from "@fluidframework/routerlicious-driver";
|
|
11
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions";
|
|
11
12
|
/**
|
|
12
13
|
* Props for initializing a new AzureClient instance
|
|
13
14
|
* @public
|
|
@@ -35,9 +36,9 @@ export interface AzureClientPropsInternal extends AzureClientProps {
|
|
|
35
36
|
/**
|
|
36
37
|
* Optional override for the container runtime factory used by the client.
|
|
37
38
|
*/
|
|
38
|
-
readonly createContainerRuntimeFactory?: ({ schema,
|
|
39
|
+
readonly createContainerRuntimeFactory?: ({ schema, minVersionForCollaboration, }: {
|
|
39
40
|
schema: ContainerSchema;
|
|
40
|
-
|
|
41
|
+
minVersionForCollaboration: MinimumVersionForCollab;
|
|
41
42
|
}) => IRuntimeFactory;
|
|
42
43
|
}
|
|
43
44
|
/**
|
package/lib/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO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B,SAAQ,qBAAqB;IACzE;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACxE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,QAAQ,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;;GAQG;AAGH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,KAAK;IAChD;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACtB;AAED;;;;;;;;;GASG;AAGH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO;IACpD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC"}
|
package/lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IUser } from \"@fluidframework/driver-definitions\";\nimport type { ICompressionStorageConfig } from \"@fluidframework/driver-utils\";\nimport type {
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tIConfigProviderBase,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IUser } from \"@fluidframework/driver-definitions\";\nimport type { ICompressionStorageConfig } from \"@fluidframework/driver-utils\";\nimport type { ContainerSchema, IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\nimport type { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions\";\n\n/**\n * Props for initializing a new AzureClient instance\n * @public\n */\nexport interface AzureClientProps {\n\t/**\n\t * Configuration for establishing a connection with the Azure Fluid Relay.\n\t */\n\treadonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n\n\treadonly summaryCompression?: boolean | ICompressionStorageConfig;\n}\n\n/**\n * Internal only {@link AzureClientProps}.\n * @internal\n */\nexport interface AzureClientPropsInternal extends AzureClientProps {\n\t/**\n\t * Optional override for the container runtime factory used by the client.\n\t */\n\treadonly createContainerRuntimeFactory?: ({\n\t\tschema,\n\t\tminVersionForCollaboration,\n\t}: {\n\t\tschema: ContainerSchema;\n\t\tminVersionForCollaboration: MinimumVersionForCollab;\n\t}) => IRuntimeFactory;\n}\n\n/**\n * Container version metadata.\n * @public\n */\nexport interface AzureContainerVersion {\n\t/**\n\t * Version ID\n\t */\n\tid: string;\n\n\t/**\n\t * Time when version was generated.\n\t * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n\t */\n\tdate?: string;\n}\n\n/**\n * Options for \"Get Container Versions\" API.\n * @public\n */\nexport interface AzureGetVersionsOptions {\n\t/**\n\t * Max number of versions\n\t */\n\tmaxCount: number;\n}\n\n/**\n * The type of connection.\n *\n * - \"local\" for local connections to a Fluid relay instance running on the localhost\n *\n * - \"remote\" for client connections to the Azure Fluid Relay service\n * @public\n */\nexport type AzureConnectionConfigType = \"local\" | \"remote\";\n\n/**\n * Parameters for establishing a connection with the Azure Fluid Relay.\n * @public\n */\nexport interface AzureConnectionConfig {\n\t/**\n\t * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.\n\t */\n\ttype: AzureConnectionConfigType;\n\t/**\n\t * URI to the Azure Fluid Relay service discovery endpoint.\n\t */\n\tendpoint: string;\n\t/**\n\t * Instance that provides Azure Fluid Relay endpoint tokens.\n\t */\n\ttokenProvider: ITokenProvider;\n}\n\n/**\n * Parameters for establishing a remote connection with the Azure Fluid Relay.\n * @public\n */\nexport interface AzureRemoteConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"remote\";\n\t/**\n\t * Unique tenant identifier.\n\t */\n\ttenantId: string;\n}\n\n/**\n * Parameters for establishing a local connection with a local instance of the Azure Fluid Relay.\n * @public\n */\nexport interface AzureLocalConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"local\";\n}\n\n/**\n * Holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in\n * the FluidContainer is persisted in the backend and consumed by users.\n *\n * @remarks\n *\n * Returned by the {@link AzureClient} alongside a {@link @fluidframework/fluid-static#FluidContainer}.\n *\n * Any functionality regarding how the data is handled within the FluidContainer itself, i.e. which data objects\n * or DDSes to use, will not be included here but rather on the FluidContainer class itself.\n * @public\n */\nexport interface AzureContainerServices {\n\t/**\n\t * Provides an object that can be used to get the users that are present in this Fluid session and\n\t * listeners for when the roster has any changes from users joining/leaving the session\n\t */\n\taudience: IAzureAudience;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IUser} interface to include this service-specific value.\n *\n * @typeParam T - See {@link AzureUser.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n * @internal\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureUser<T = any> extends IUser {\n\t/**\n\t * {@inheritDoc AzureMember.name}\n\t *\n\t */\n\tname: string;\n\n\t/**\n\t * {@inheritDoc AzureMember.additionalDetails}\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/fluid-static#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected to Azure.\n *\n * @typeParam T - See {@link AzureMember.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n * @public\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureMember<T = any> extends IMember {\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\n\t/**\n\t * Custom, app-specific user information\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Audience object for Azure Fluid Relay containers\n * @public\n */\nexport type IAzureAudience = IServiceAudience<AzureMember>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/azure-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.103.0",
|
|
4
4
|
"description": "A tool to enable creation and loading of Fluid containers using the Azure Fluid Relay service",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -47,27 +47,28 @@
|
|
|
47
47
|
"main": "lib/index.js",
|
|
48
48
|
"types": "lib/public.d.ts",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@fluidframework/container-definitions": "~2.
|
|
51
|
-
"@fluidframework/container-loader": "~2.
|
|
52
|
-
"@fluidframework/core-interfaces": "~2.
|
|
53
|
-
"@fluidframework/driver-definitions": "~2.
|
|
54
|
-
"@fluidframework/driver-utils": "~2.
|
|
55
|
-
"@fluidframework/fluid-static": "~2.
|
|
56
|
-
"@fluidframework/routerlicious-driver": "~2.
|
|
57
|
-
"@fluidframework/
|
|
50
|
+
"@fluidframework/container-definitions": "~2.103.0",
|
|
51
|
+
"@fluidframework/container-loader": "~2.103.0",
|
|
52
|
+
"@fluidframework/core-interfaces": "~2.103.0",
|
|
53
|
+
"@fluidframework/driver-definitions": "~2.103.0",
|
|
54
|
+
"@fluidframework/driver-utils": "~2.103.0",
|
|
55
|
+
"@fluidframework/fluid-static": "~2.103.0",
|
|
56
|
+
"@fluidframework/routerlicious-driver": "~2.103.0",
|
|
57
|
+
"@fluidframework/runtime-definitions": "~2.103.0",
|
|
58
|
+
"@fluidframework/telemetry-utils": "~2.103.0"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
61
62
|
"@biomejs/biome": "~2.4.5",
|
|
62
63
|
"@fluid-tools/build-cli": "^0.65.0",
|
|
63
|
-
"@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.
|
|
64
|
-
"@fluidframework/azure-local-service": "~2.
|
|
64
|
+
"@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.101.0",
|
|
65
|
+
"@fluidframework/azure-local-service": "~2.103.0",
|
|
65
66
|
"@fluidframework/build-common": "^2.0.3",
|
|
66
67
|
"@fluidframework/build-tools": "^0.65.0",
|
|
67
|
-
"@fluidframework/container-runtime": "~2.
|
|
68
|
+
"@fluidframework/container-runtime": "~2.103.0",
|
|
68
69
|
"@fluidframework/eslint-config-fluid": "^9.0.0",
|
|
69
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
70
|
-
"@fluidframework/test-utils": "~2.
|
|
70
|
+
"@fluidframework/test-runtime-utils": "~2.103.0",
|
|
71
|
+
"@fluidframework/test-utils": "~2.103.0",
|
|
71
72
|
"@microsoft/api-extractor": "7.58.1",
|
|
72
73
|
"@types/mocha": "^10.0.10",
|
|
73
74
|
"@types/node": "~22.19.17",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
"cross-env": "^10.1.0",
|
|
77
78
|
"eslint": "~9.39.1",
|
|
78
79
|
"eslint-config-prettier": "~10.1.8",
|
|
79
|
-
"fluid-framework": "~2.
|
|
80
|
+
"fluid-framework": "~2.103.0",
|
|
80
81
|
"jiti": "^2.6.1",
|
|
81
82
|
"mocha": "^11.7.5",
|
|
82
83
|
"rimraf": "^6.1.3",
|
package/src/AzureClient.ts
CHANGED
|
@@ -29,14 +29,17 @@ import { applyStorageCompression } from "@fluidframework/driver-utils/internal";
|
|
|
29
29
|
import type {
|
|
30
30
|
ContainerSchema,
|
|
31
31
|
IFluidContainer,
|
|
32
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
32
33
|
CompatibilityMode,
|
|
33
34
|
} from "@fluidframework/fluid-static";
|
|
34
35
|
import {
|
|
35
36
|
createDOProviderContainerRuntimeFactory,
|
|
36
37
|
createFluidContainer,
|
|
37
38
|
createServiceAudience,
|
|
39
|
+
resolveCompatibilityModeToMinVersionForCollab,
|
|
38
40
|
} from "@fluidframework/fluid-static/internal";
|
|
39
41
|
import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver/internal";
|
|
42
|
+
import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions";
|
|
40
43
|
import { wrapConfigProviderWithDefaults } from "@fluidframework/telemetry-utils/internal";
|
|
41
44
|
|
|
42
45
|
import { createAzureAudienceMember } from "./AzureAudience.js";
|
|
@@ -97,10 +100,10 @@ export class AzureClient {
|
|
|
97
100
|
|
|
98
101
|
private readonly createContainerRuntimeFactory?: ({
|
|
99
102
|
schema,
|
|
100
|
-
|
|
103
|
+
minVersionForCollaboration,
|
|
101
104
|
}: {
|
|
102
105
|
schema: ContainerSchema;
|
|
103
|
-
|
|
106
|
+
minVersionForCollaboration: MinimumVersionForCollab;
|
|
104
107
|
}) => IRuntimeFactory;
|
|
105
108
|
|
|
106
109
|
/**
|
|
@@ -138,15 +141,42 @@ export class AzureClient {
|
|
|
138
141
|
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
139
142
|
* (normally not explicitly specified.)
|
|
140
143
|
* @param containerSchema - Container schema for the new container.
|
|
141
|
-
* @param
|
|
144
|
+
* @param minVersionForCollab - Minimum Fluid Framework version required for collaboration, as a
|
|
145
|
+
* SemVer string (e.g. `"1.0.0"`, `"2.100.0"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.
|
|
142
146
|
* @returns New detached container instance along with associated services.
|
|
143
147
|
*/
|
|
144
148
|
public async createContainer<const TContainerSchema extends ContainerSchema>(
|
|
145
149
|
containerSchema: TContainerSchema,
|
|
150
|
+
minVersionForCollab: MinimumVersionForCollab,
|
|
151
|
+
): Promise<{
|
|
152
|
+
container: IFluidContainer<TContainerSchema>;
|
|
153
|
+
services: AzureContainerServices;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Creates a new detached container instance in the Azure Fluid Relay.
|
|
157
|
+
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
158
|
+
* This does not normally need to be specified explicitly.
|
|
159
|
+
* @param containerSchema - Container schema for the new container.
|
|
160
|
+
* @param compatibilityMode - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.
|
|
161
|
+
* @returns New detached container instance along with associated services.
|
|
162
|
+
* @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `"2.0.0"`) instead. The legacy
|
|
163
|
+
* values `"1"` and `"2"` correspond to `"1.0.0"` and `"2.0.0"` respectively.
|
|
164
|
+
*/
|
|
165
|
+
public async createContainer<const TContainerSchema extends ContainerSchema>(
|
|
166
|
+
containerSchema: TContainerSchema,
|
|
167
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
146
168
|
compatibilityMode: CompatibilityMode,
|
|
147
169
|
): Promise<{
|
|
148
170
|
container: IFluidContainer<TContainerSchema>;
|
|
149
171
|
services: AzureContainerServices;
|
|
172
|
+
}>;
|
|
173
|
+
public async createContainer<const TContainerSchema extends ContainerSchema>(
|
|
174
|
+
containerSchema: TContainerSchema,
|
|
175
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
176
|
+
compatibilityMode: MinimumVersionForCollab | CompatibilityMode,
|
|
177
|
+
): Promise<{
|
|
178
|
+
container: IFluidContainer<TContainerSchema>;
|
|
179
|
+
services: AzureContainerServices;
|
|
150
180
|
}> {
|
|
151
181
|
const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
|
|
152
182
|
|
|
@@ -172,16 +202,46 @@ export class AzureClient {
|
|
|
172
202
|
* (normally not explicitly specified.)
|
|
173
203
|
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
174
204
|
* @param containerSchema - Container schema used to access data objects in the container.
|
|
175
|
-
* @param
|
|
205
|
+
* @param minVersionForCollab - Minimum framework version required for collaboration, as a
|
|
206
|
+
* SemVer string (e.g. `"1.0.0"`, `"2.100.0"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.
|
|
207
|
+
* @returns Existing container instance along with associated services.
|
|
208
|
+
*/
|
|
209
|
+
public async getContainer<TContainerSchema extends ContainerSchema>(
|
|
210
|
+
id: string,
|
|
211
|
+
containerSchema: TContainerSchema,
|
|
212
|
+
minVersionForCollab: MinimumVersionForCollab,
|
|
213
|
+
): Promise<{
|
|
214
|
+
container: IFluidContainer<TContainerSchema>;
|
|
215
|
+
services: AzureContainerServices;
|
|
216
|
+
}>;
|
|
217
|
+
/**
|
|
218
|
+
* Accesses the existing container given its unique ID in the Azure Fluid Relay.
|
|
219
|
+
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
220
|
+
* (normally not explicitly specified.)
|
|
221
|
+
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
222
|
+
* @param containerSchema - Container schema used to access data objects in the container.
|
|
223
|
+
* @param compatibilityMode - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.
|
|
176
224
|
* @returns Existing container instance along with associated services.
|
|
225
|
+
* @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `"2.0.0"`) instead. The legacy
|
|
226
|
+
* values `"1"` and `"2"` correspond to `"1.0.0"` and `"2.0.0"` respectively.
|
|
177
227
|
*/
|
|
178
228
|
public async getContainer<TContainerSchema extends ContainerSchema>(
|
|
179
229
|
id: string,
|
|
180
230
|
containerSchema: TContainerSchema,
|
|
231
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
181
232
|
compatibilityMode: CompatibilityMode,
|
|
182
233
|
): Promise<{
|
|
183
234
|
container: IFluidContainer<TContainerSchema>;
|
|
184
235
|
services: AzureContainerServices;
|
|
236
|
+
}>;
|
|
237
|
+
public async getContainer<TContainerSchema extends ContainerSchema>(
|
|
238
|
+
id: string,
|
|
239
|
+
containerSchema: TContainerSchema,
|
|
240
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
241
|
+
compatibilityMode: MinimumVersionForCollab | CompatibilityMode,
|
|
242
|
+
): Promise<{
|
|
243
|
+
container: IFluidContainer<TContainerSchema>;
|
|
244
|
+
services: AzureContainerServices;
|
|
185
245
|
}> {
|
|
186
246
|
const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
|
|
187
247
|
const url = new URL(this.connectionConfig.endpoint);
|
|
@@ -210,16 +270,47 @@ export class AzureClient {
|
|
|
210
270
|
* @param id - Unique ID of the source container in Azure Fluid Relay.
|
|
211
271
|
* @param containerSchema - Container schema used to access data objects in the container.
|
|
212
272
|
* @param version - Unique version of the source container in Azure Fluid Relay.
|
|
213
|
-
* @param
|
|
273
|
+
* @param minVersionForCollab - Minimum framework version required for collaboration, as a
|
|
274
|
+
* SemVer string (e.g. `"1.0.0"`, `"2.100.0"`). Prefer the current Fluid Framework version so the container opts into the latest defaults.
|
|
214
275
|
* @returns Loaded container instance at the specified version.
|
|
215
276
|
*/
|
|
216
277
|
public async viewContainerVersion<TContainerSchema extends ContainerSchema>(
|
|
217
278
|
id: string,
|
|
218
279
|
containerSchema: TContainerSchema,
|
|
219
280
|
version: AzureContainerVersion,
|
|
281
|
+
minVersionForCollab: MinimumVersionForCollab,
|
|
282
|
+
): Promise<{
|
|
283
|
+
container: IFluidContainer<TContainerSchema>;
|
|
284
|
+
}>;
|
|
285
|
+
/**
|
|
286
|
+
* Load a specific version of a container for viewing only.
|
|
287
|
+
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
288
|
+
* (normally not explicitly specified.)
|
|
289
|
+
* @param id - Unique ID of the source container in Azure Fluid Relay.
|
|
290
|
+
* @param containerSchema - Container schema used to access data objects in the container.
|
|
291
|
+
* @param version - Unique version of the source container in Azure Fluid Relay.
|
|
292
|
+
* @param compatibilityMode - Legacy {@link @fluidframework/fluid-static#CompatibilityMode} value.
|
|
293
|
+
* @returns Loaded container instance at the specified version.
|
|
294
|
+
* @deprecated Pass a `MinimumVersionForCollab` SemVer string (e.g. `"2.0.0"`) instead. The legacy
|
|
295
|
+
* values `"1"` and `"2"` correspond to `"1.0.0"` and `"2.0.0"` respectively.
|
|
296
|
+
*/
|
|
297
|
+
public async viewContainerVersion<TContainerSchema extends ContainerSchema>(
|
|
298
|
+
id: string,
|
|
299
|
+
containerSchema: TContainerSchema,
|
|
300
|
+
version: AzureContainerVersion,
|
|
301
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
220
302
|
compatibilityMode: CompatibilityMode,
|
|
221
303
|
): Promise<{
|
|
222
304
|
container: IFluidContainer<TContainerSchema>;
|
|
305
|
+
}>;
|
|
306
|
+
public async viewContainerVersion<TContainerSchema extends ContainerSchema>(
|
|
307
|
+
id: string,
|
|
308
|
+
containerSchema: TContainerSchema,
|
|
309
|
+
version: AzureContainerVersion,
|
|
310
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
311
|
+
compatibilityMode: MinimumVersionForCollab | CompatibilityMode,
|
|
312
|
+
): Promise<{
|
|
313
|
+
container: IFluidContainer<TContainerSchema>;
|
|
223
314
|
}> {
|
|
224
315
|
const loaderProps = this.getLoaderProps(containerSchema, compatibilityMode);
|
|
225
316
|
const url = new URL(this.connectionConfig.endpoint);
|
|
@@ -286,16 +377,19 @@ export class AzureClient {
|
|
|
286
377
|
|
|
287
378
|
private getLoaderProps(
|
|
288
379
|
schema: ContainerSchema,
|
|
289
|
-
|
|
380
|
+
// eslint-disable-next-line import-x/no-deprecated
|
|
381
|
+
compatibilityMode: MinimumVersionForCollab | CompatibilityMode,
|
|
290
382
|
): ILoaderProps {
|
|
383
|
+
const minVersionForCollaboration =
|
|
384
|
+
resolveCompatibilityModeToMinVersionForCollab(compatibilityMode);
|
|
291
385
|
const runtimeFactory = this.createContainerRuntimeFactory
|
|
292
386
|
? this.createContainerRuntimeFactory({
|
|
293
387
|
schema,
|
|
294
|
-
|
|
388
|
+
minVersionForCollaboration,
|
|
295
389
|
})
|
|
296
390
|
: createDOProviderContainerRuntimeFactory({
|
|
297
391
|
schema,
|
|
298
|
-
|
|
392
|
+
minVersionForCollaboration,
|
|
299
393
|
});
|
|
300
394
|
|
|
301
395
|
const load = async (): Promise<IFluidModuleWithDetails> => {
|