@fluidframework/azure-client 2.0.0-dev.7.3.0.211848 → 2.0.0-dev.7.4.0.214930
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 +4 -0
- package/api-extractor.json +9 -1
- package/api-report/azure-client.api.md +1 -1
- package/dist/AzureAudience.cjs +17 -9
- package/dist/AzureAudience.cjs.map +1 -1
- package/dist/AzureAudience.d.ts +5 -0
- package/dist/AzureAudience.d.ts.map +1 -1
- package/dist/AzureClient.cjs +26 -7
- package/dist/AzureClient.cjs.map +1 -1
- package/dist/AzureClient.d.ts +1 -0
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/azure-client-alpha.d.ts +2 -0
- package/dist/azure-client-beta.d.ts +2 -0
- package/dist/azure-client-public.d.ts +2 -0
- package/dist/azure-client-untrimmed.d.ts +2 -0
- package/lib/AzureAudience.d.ts +5 -0
- package/lib/AzureAudience.d.ts.map +1 -1
- package/lib/AzureAudience.mjs +15 -8
- package/lib/AzureAudience.mjs.map +1 -1
- package/lib/AzureClient.d.ts +1 -0
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.mjs +28 -9
- package/lib/AzureClient.mjs.map +1 -1
- package/lib/azure-client-alpha.d.ts +2 -0
- package/lib/azure-client-beta.d.ts +2 -0
- package/lib/azure-client-public.d.ts +2 -0
- package/lib/azure-client-untrimmed.d.ts +2 -0
- package/package.json +21 -21
- package/src/AzureAudience.ts +17 -9
- package/src/AzureClient.ts +34 -11
package/CHANGELOG.md
CHANGED
package/api-extractor.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json",
|
|
4
4
|
"dtsRollup": {
|
|
5
5
|
"enabled": true
|
|
6
|
+
},
|
|
7
|
+
"messages": {
|
|
8
|
+
"extractorMessageReporting": {
|
|
9
|
+
// TODO: Add missing documentation and remove this rule override
|
|
10
|
+
"ae-undocumented": {
|
|
11
|
+
"logLevel": "none"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
6
14
|
}
|
|
7
15
|
}
|
|
@@ -20,7 +20,7 @@ import { IUser } from '@fluidframework/protocol-definitions';
|
|
|
20
20
|
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
21
21
|
import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
22
22
|
|
|
23
|
-
// @public
|
|
23
|
+
// @public @deprecated
|
|
24
24
|
export class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
25
25
|
// @internal
|
|
26
26
|
protected createServiceMember(audienceMember: IClient): AzureMember;
|
package/dist/AzureAudience.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AzureAudience = void 0;
|
|
3
|
+
exports.createAzureAudienceMember = exports.AzureAudience = void 0;
|
|
4
4
|
/*!
|
|
5
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
6
|
* Licensed under the MIT License.
|
|
@@ -13,6 +13,7 @@ const fluid_static_1 = require("@fluidframework/fluid-static");
|
|
|
13
13
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
14
14
|
*
|
|
15
15
|
* @public
|
|
16
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
16
17
|
*/
|
|
17
18
|
class AzureAudience extends fluid_static_1.ServiceAudience {
|
|
18
19
|
/**
|
|
@@ -25,15 +26,22 @@ class AzureAudience extends fluid_static_1.ServiceAudience {
|
|
|
25
26
|
* @internal
|
|
26
27
|
*/
|
|
27
28
|
createServiceMember(audienceMember) {
|
|
28
|
-
|
|
29
|
-
(0, core_utils_1.assert)(azureUser?.name !== undefined, 'Provided user was not an "AzureUser".');
|
|
30
|
-
return {
|
|
31
|
-
userId: audienceMember.user.id,
|
|
32
|
-
userName: azureUser.name,
|
|
33
|
-
connections: [],
|
|
34
|
-
additionalDetails: azureUser.additionalDetails,
|
|
35
|
-
};
|
|
29
|
+
return createAzureAudienceMember(audienceMember);
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
32
|
exports.AzureAudience = AzureAudience;
|
|
33
|
+
/**
|
|
34
|
+
* Creates Azure-specific audience member
|
|
35
|
+
*/
|
|
36
|
+
function createAzureAudienceMember(audienceMember) {
|
|
37
|
+
const azureUser = audienceMember.user;
|
|
38
|
+
(0, core_utils_1.assert)(azureUser?.name !== undefined, 'Provided user was not an "AzureUser".');
|
|
39
|
+
return {
|
|
40
|
+
userId: audienceMember.user.id,
|
|
41
|
+
userName: azureUser.name,
|
|
42
|
+
connections: [],
|
|
43
|
+
additionalDetails: azureUser.additionalDetails,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.createAzureAudienceMember = createAzureAudienceMember;
|
|
39
47
|
//# sourceMappingURL=AzureAudience.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.cjs","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAoD;AACpD,+DAA+D;AAK/D
|
|
1
|
+
{"version":3,"file":"AzureAudience.cjs","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAoD;AACpD,+DAA+D;AAK/D;;;;;;;GAOG;AACH,MAAa,aAAc,SAAQ,8BAA4B;IAC9D;;;;;;;;OAQG;IACO,mBAAmB,CAAC,cAAuB;QACpD,OAAO,yBAAyB,CAAC,cAAc,CAAC,CAAC;IAClD,CAAC;CACD;AAbD,sCAaC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,cAAuB;IAChE,MAAM,SAAS,GAAG,cAAc,CAAC,IAAiB,CAAC;IACnD,IAAA,mBAAM,EAAC,SAAS,EAAE,IAAI,KAAK,SAAS,EAAE,uCAAuC,CAAC,CAAC;IAE/E,OAAO;QACN,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE;QAC9B,QAAQ,EAAE,SAAS,CAAC,IAAI;QACxB,WAAW,EAAE,EAAE;QACf,iBAAiB,EAAE,SAAS,CAAC,iBAA4B;KACzD,CAAC;AACH,CAAC;AAVD,8DAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ServiceAudience } from \"@fluidframework/fluid-static\";\nimport { type IClient } from \"@fluidframework/protocol-definitions\";\n\nimport { type AzureMember, type AzureUser, type IAzureAudience } from \"./interfaces\";\n\n/**\n * Azure-specific {@link @fluidframework/fluid-static#ServiceAudience} implementation.\n *\n * @remarks Operates in terms of {@link AzureMember}s.\n *\n * @public\n * @deprecated This class will be removed. use {@link IAzureAudience} instead\n */\nexport class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {\n\t/**\n\t * Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided\n\t * {@link @fluidframework/protocol-definitions#IClient | audience member}.\n\t *\n\t * @param audienceMember - Audience member for which the `ServiceAudience` will be generated.\n\t * Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.\n\t *\n\t * @internal\n\t */\n\tprotected createServiceMember(audienceMember: IClient): AzureMember {\n\t\treturn createAzureAudienceMember(audienceMember);\n\t}\n}\n\n/**\n * Creates Azure-specific audience member\n */\nexport function createAzureAudienceMember(audienceMember: IClient): AzureMember {\n\tconst azureUser = audienceMember.user as AzureUser;\n\tassert(azureUser?.name !== undefined, 'Provided user was not an \"AzureUser\".');\n\n\treturn {\n\t\tuserId: audienceMember.user.id,\n\t\tuserName: azureUser.name,\n\t\tconnections: [],\n\t\tadditionalDetails: azureUser.additionalDetails as unknown,\n\t};\n}\n"]}
|
package/dist/AzureAudience.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { type AzureMember, type IAzureAudience } from "./interfaces";
|
|
|
7
7
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
10
11
|
*/
|
|
11
12
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
12
13
|
/**
|
|
@@ -20,4 +21,8 @@ export declare class AzureAudience extends ServiceAudience<AzureMember> implemen
|
|
|
20
21
|
*/
|
|
21
22
|
protected createServiceMember(audienceMember: IClient): AzureMember;
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates Azure-specific audience member
|
|
26
|
+
*/
|
|
27
|
+
export declare function createAzureAudienceMember(audienceMember: IClient): AzureMember;
|
|
23
28
|
//# sourceMappingURL=AzureAudience.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,KAAK,WAAW,EAAkB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF
|
|
1
|
+
{"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,KAAK,WAAW,EAAkB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACxF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAGnE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW,CAU9E"}
|
package/dist/AzureClient.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
|
11
11
|
const fluid_static_1 = require("@fluidframework/fluid-static");
|
|
12
12
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
13
13
|
const routerlicious_driver_1 = require("@fluidframework/routerlicious-driver");
|
|
14
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
14
15
|
const AzureAudience_1 = require("./AzureAudience.cjs");
|
|
15
16
|
const AzureUrlResolver_1 = require("./AzureUrlResolver.cjs");
|
|
16
17
|
const utils_1 = require("./utils.cjs");
|
|
@@ -115,8 +116,11 @@ class AzureClient {
|
|
|
115
116
|
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
|
|
116
117
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
117
118
|
const container = await loader.resolve({ url: url.href });
|
|
118
|
-
const rootDataObject =
|
|
119
|
-
const fluidContainer =
|
|
119
|
+
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
120
|
+
const fluidContainer = (0, fluid_static_1.createFluidContainer)({
|
|
121
|
+
container,
|
|
122
|
+
rootDataObject,
|
|
123
|
+
});
|
|
120
124
|
const services = this.getContainerServices(container);
|
|
121
125
|
return { container: fluidContainer, services };
|
|
122
126
|
}
|
|
@@ -147,11 +151,14 @@ class AzureClient {
|
|
|
147
151
|
}
|
|
148
152
|
getContainerServices(container) {
|
|
149
153
|
return {
|
|
150
|
-
audience:
|
|
154
|
+
audience: (0, fluid_static_1.createServiceAudience)({
|
|
155
|
+
container,
|
|
156
|
+
createServiceMember: AzureAudience_1.createAzureAudienceMember,
|
|
157
|
+
}),
|
|
151
158
|
};
|
|
152
159
|
}
|
|
153
|
-
createLoader(
|
|
154
|
-
const runtimeFactory =
|
|
160
|
+
createLoader(schema) {
|
|
161
|
+
const runtimeFactory = (0, fluid_static_1.createDOProviderContainerRuntimeFactory)({ schema });
|
|
155
162
|
const load = async () => {
|
|
156
163
|
return {
|
|
157
164
|
module: { fluidExport: runtimeFactory },
|
|
@@ -179,7 +186,7 @@ class AzureClient {
|
|
|
179
186
|
}
|
|
180
187
|
async createFluidContainer(container, connection) {
|
|
181
188
|
const createNewRequest = (0, AzureUrlResolver_1.createAzureCreateNewRequest)(connection.endpoint, getTenantId(connection));
|
|
182
|
-
const rootDataObject =
|
|
189
|
+
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
183
190
|
/**
|
|
184
191
|
* See {@link FluidContainer.attach}
|
|
185
192
|
*/
|
|
@@ -193,10 +200,22 @@ class AzureClient {
|
|
|
193
200
|
}
|
|
194
201
|
return container.resolvedUrl.id;
|
|
195
202
|
};
|
|
196
|
-
const fluidContainer =
|
|
203
|
+
const fluidContainer = (0, fluid_static_1.createFluidContainer)({
|
|
204
|
+
container,
|
|
205
|
+
rootDataObject,
|
|
206
|
+
});
|
|
197
207
|
fluidContainer.attach = attach;
|
|
198
208
|
return fluidContainer;
|
|
199
209
|
}
|
|
210
|
+
async getContainerEntryPoint(container) {
|
|
211
|
+
const rootDataObject = await container.getEntryPoint();
|
|
212
|
+
(0, core_utils_1.assert)(rootDataObject !== undefined, "entryPoint must exist");
|
|
213
|
+
// ! This "if" is needed for back-compat (older instances of IRootDataObject may not have the IRootDataObject property)
|
|
214
|
+
if (rootDataObject.IRootDataObject === undefined) {
|
|
215
|
+
return rootDataObject;
|
|
216
|
+
}
|
|
217
|
+
return rootDataObject.IRootDataObject;
|
|
218
|
+
}
|
|
200
219
|
}
|
|
201
220
|
exports.AzureClient = AzureClient;
|
|
202
221
|
//# sourceMappingURL=AzureClient.cjs.map
|
package/dist/AzureClient.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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AAE,EAAE,EAAE;YAChB,IAAI,EAAE,OAAO;SACb,CAAC;QAEF,OAAO,IAAI,yBAAM,CAAC;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;YAC9B,OAAO,EAAE,EAAE,MAAM,EAAE;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,SAAqB,EACrB,UAAiC;QAEjC,MAAM,gBAAgB,GAAG,IAAA,8CAA2B,EACnD,UAAU,CAAC,QAAQ,EACnB,WAAW,CAAC,UAAU,CAAC,CACvB,CAAC;QAEF,MAAM,cAAc,GAAG,CAAC,MAAM,SAAS,CAAC,aAAa,EAAE,CAAoB,CAAC;QAE5E;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE;gBACnD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAC/E;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE;gBACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACpE;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,6BAAc,CAAmB,SAAS,EAAE,cAAc,CAAC,CAAC;QACvF,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AAjPD,kCAiPC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n\ttype IDocumentServiceFactory,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\ttype ContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\ttype IFluidContainer,\n\ttype IRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { type IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\n\nimport { type IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\ttype AzureClientProps,\n\ttype AzureConnectionConfig,\n\ttype AzureContainerServices,\n\ttype AzureContainerVersion,\n\ttype AzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\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 * 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 *\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 = 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 * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\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 * Creates new detached container out of specific version of another container.\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 * It defaults to latest version if parameter not provided.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async copyContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 sourceContainer = await loader.resolve({ url: url.href });\n\n\t\tif (sourceContainer.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Source container cannot resolve URL.\");\n\t\t}\n\n\t\tconst documentService = await this.documentServiceFactory.createDocumentService(\n\t\t\tsourceContainer.resolvedUrl,\n\t\t);\n\t\tconst storage = await documentService.connectToStorage();\n\t\tconst handle = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType: SummaryType.Tree,\n\t\t\thandle: version?.id ?? \"latest\",\n\t\t};\n\t\tconst tree = await storage.downloadSummary(handle);\n\n\t\tconst container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\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 * @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): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 container.getEntryPoint()) as IRootDataObject;\n\t\tconst fluidContainer = new FluidContainer<TContainerSchema>(container, rootDataObject);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\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 retreive 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(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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: new AzureAudience(container),\n\t\t};\n\t}\n\n\tprivate createLoader(containerSchema: ContainerSchema): Loader {\n\t\tconst runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);\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<FluidContainer<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 container.getEntryPoint()) as IRootDataObject;\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 = new FluidContainer<TContainerSchema>(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AzureClient.cjs","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,iFAI+C;AAC/C,uEAA0D;AAK1D,+DAAuE;AACvE,+DAOsC;AACtC,+EAAiF;AACjF,+EAA2F;AAI3F,2DAAoD;AACpD,uDAA4D;AAC5D,6DAAmF;AAQnF,uCAAwD;AAExD;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,oBAA2C,EAAU,EAAE;IAC3E,OAAO,IAAA,qCAA6B,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;;;;;GAKG;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,GAAG,IAAI,mCAAgB,EAAE,CAAC;QAC1C,8EAA8E;QAC9E,6FAA6F;QAC7F,MAAM,kBAAkB,GAAG,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,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE;gBACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACpE;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAA,mCAAoB,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,GACnB,MAAM,SAAS,CAAC,aAAa,EAAE,CAAC;QACjC,IAAA,mBAAM,EAAC,cAAc,KAAK,SAAS,EAAE,uBAAuB,CAAC,CAAC;QAC9D,uHAAuH;QACvH,IAAI,cAAc,CAAC,eAAe,KAAK,SAAS,EAAE;YACjD,OAAO,cAAiC,CAAC;SACzC;QACD,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 */\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n\ttype IDocumentServiceFactory,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\ttype ContainerSchema,\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\ttype IFluidContainer,\n\ttype IRootDataObject,\n\tcreateServiceAudience,\n} from \"@fluidframework/fluid-static\";\nimport { type IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\n\nimport { type IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { type FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { createAzureAudienceMember } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\ttype AzureClientProps,\n\ttype AzureConnectionConfig,\n\ttype AzureContainerServices,\n\ttype AzureContainerVersion,\n\ttype AzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\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 * 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 *\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 = 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 * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\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 * Creates new detached container out of specific version of another container.\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 * It defaults to latest version if parameter not provided.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async copyContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 sourceContainer = await loader.resolve({ url: url.href });\n\n\t\tif (sourceContainer.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Source container cannot resolve URL.\");\n\t\t}\n\n\t\tconst documentService = await this.documentServiceFactory.createDocumentService(\n\t\t\tsourceContainer.resolvedUrl,\n\t\t);\n\t\tconst storage = await documentService.connectToStorage();\n\t\tconst handle = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType: SummaryType.Tree,\n\t\t\thandle: version?.id ?? \"latest\",\n\t\t};\n\t\tconst tree = await storage.downloadSummary(handle);\n\n\t\tconst container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\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 * @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): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 * 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 retreive 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(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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): Loader {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({ schema });\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\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> | undefined =\n\t\t\tawait container.getEntryPoint();\n\t\tassert(rootDataObject !== undefined, \"entryPoint must exist\");\n\t\t// ! This \"if\" is needed for back-compat (older instances of IRootDataObject may not have the IRootDataObject property)\n\t\tif (rootDataObject.IRootDataObject === undefined) {\n\t\t\treturn rootDataObject as IRootDataObject;\n\t\t}\n\t\treturn rootDataObject.IRootDataObject;\n\t}\n\t// #endregion\n}\n"]}
|
package/dist/AzureClient.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,KAAK,eAAe,EAGpB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,KAAK,eAAe,EAGpB,KAAK,eAAe,EAGpB,MAAM,8BAA8B,CAAC;AAStC,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,MAAM,cAAc,CAAC;AAetB;;;;;GAKG;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;;;;;;OAMG;IACU,eAAe,CAAC,gBAAgB,SAAS,eAAe,EACpE,eAAe,EAAE,gBAAgB,GAC/B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC7C,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAgBF;;;;;;;;;OASG;IACU,aAAa,CAAC,gBAAgB,SAAS,eAAe,EAClE,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,gBAAgB,EACjC,OAAO,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC7C,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAoCF;;;;;;;OAOG;IACU,YAAY,CAAC,gBAAgB,SAAS,eAAe,EACjE,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,gBAAgB,GAC/B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC7C,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAmBF;;;;;;OAMG;IACU,oBAAoB,CAChC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA0BnC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,YAAY;YA8BN,oBAAoB;YAgCpB,sBAAsB;CAWpC"}
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/* Excluded from this release type: createServiceMember */
|
|
@@ -95,6 +96,7 @@ export declare class AzureClient {
|
|
|
95
96
|
private getContainerServices;
|
|
96
97
|
private createLoader;
|
|
97
98
|
private createFluidContainer;
|
|
99
|
+
private getContainerEntryPoint;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/* Excluded from this release type: createServiceMember */
|
|
@@ -95,6 +96,7 @@ export declare class AzureClient {
|
|
|
95
96
|
private getContainerServices;
|
|
96
97
|
private createLoader;
|
|
97
98
|
private createFluidContainer;
|
|
99
|
+
private getContainerEntryPoint;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/* Excluded from this release type: createServiceMember */
|
|
@@ -95,6 +96,7 @@ export declare class AzureClient {
|
|
|
95
96
|
private getContainerServices;
|
|
96
97
|
private createLoader;
|
|
97
98
|
private createFluidContainer;
|
|
99
|
+
private getContainerEntryPoint;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/**
|
|
@@ -104,6 +105,7 @@ export declare class AzureClient {
|
|
|
104
105
|
private getContainerServices;
|
|
105
106
|
private createLoader;
|
|
106
107
|
private createFluidContainer;
|
|
108
|
+
private getContainerEntryPoint;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
/**
|
package/lib/AzureAudience.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { type AzureMember, type IAzureAudience } from "./interfaces";
|
|
|
7
7
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
10
11
|
*/
|
|
11
12
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
12
13
|
/**
|
|
@@ -20,4 +21,8 @@ export declare class AzureAudience extends ServiceAudience<AzureMember> implemen
|
|
|
20
21
|
*/
|
|
21
22
|
protected createServiceMember(audienceMember: IClient): AzureMember;
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates Azure-specific audience member
|
|
26
|
+
*/
|
|
27
|
+
export declare function createAzureAudienceMember(audienceMember: IClient): AzureMember;
|
|
23
28
|
//# sourceMappingURL=AzureAudience.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,KAAK,WAAW,EAAkB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF
|
|
1
|
+
{"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,KAAK,WAAW,EAAkB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACxF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAGnE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW,CAU9E"}
|
package/lib/AzureAudience.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { ServiceAudience } from "@fluidframework/fluid-static";
|
|
|
6
6
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
7
7
|
*
|
|
8
8
|
* @public
|
|
9
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
9
10
|
*/
|
|
10
11
|
export class AzureAudience extends ServiceAudience {
|
|
11
12
|
/**
|
|
@@ -18,14 +19,20 @@ export class AzureAudience extends ServiceAudience {
|
|
|
18
19
|
* @internal
|
|
19
20
|
*/
|
|
20
21
|
createServiceMember(audienceMember) {
|
|
21
|
-
|
|
22
|
-
assert(azureUser?.name !== undefined, 'Provided user was not an "AzureUser".');
|
|
23
|
-
return {
|
|
24
|
-
userId: audienceMember.user.id,
|
|
25
|
-
userName: azureUser.name,
|
|
26
|
-
connections: [],
|
|
27
|
-
additionalDetails: azureUser.additionalDetails,
|
|
28
|
-
};
|
|
22
|
+
return createAzureAudienceMember(audienceMember);
|
|
29
23
|
}
|
|
30
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates Azure-specific audience member
|
|
27
|
+
*/
|
|
28
|
+
export function createAzureAudienceMember(audienceMember) {
|
|
29
|
+
const azureUser = audienceMember.user;
|
|
30
|
+
assert(azureUser?.name !== undefined, 'Provided user was not an "AzureUser".');
|
|
31
|
+
return {
|
|
32
|
+
userId: audienceMember.user.id,
|
|
33
|
+
userName: azureUser.name,
|
|
34
|
+
connections: [],
|
|
35
|
+
additionalDetails: azureUser.additionalDetails,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
31
38
|
//# sourceMappingURL=AzureAudience.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.mjs","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"OAIO,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,eAAe,EAAE,MAAM,8BAA8B;AAK9D
|
|
1
|
+
{"version":3,"file":"AzureAudience.mjs","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"OAIO,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,eAAe,EAAE,MAAM,8BAA8B;AAK9D;;;;;;;GAOG;AACH,MAAM,OAAO,aAAc,SAAQ,eAA4B;IAC9D;;;;;;;;OAQG;IACO,mBAAmB,CAAC,cAAuB;QACpD,OAAO,yBAAyB,CAAC,cAAc,CAAC,CAAC;IAClD,CAAC;CACD;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,cAAuB;IAChE,MAAM,SAAS,GAAG,cAAc,CAAC,IAAiB,CAAC;IACnD,MAAM,CAAC,SAAS,EAAE,IAAI,KAAK,SAAS,EAAE,uCAAuC,CAAC,CAAC;IAE/E,OAAO;QACN,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE;QAC9B,QAAQ,EAAE,SAAS,CAAC,IAAI;QACxB,WAAW,EAAE,EAAE;QACf,iBAAiB,EAAE,SAAS,CAAC,iBAA4B;KACzD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ServiceAudience } from \"@fluidframework/fluid-static\";\nimport { type IClient } from \"@fluidframework/protocol-definitions\";\n\nimport { type AzureMember, type AzureUser, type IAzureAudience } from \"./interfaces\";\n\n/**\n * Azure-specific {@link @fluidframework/fluid-static#ServiceAudience} implementation.\n *\n * @remarks Operates in terms of {@link AzureMember}s.\n *\n * @public\n * @deprecated This class will be removed. use {@link IAzureAudience} instead\n */\nexport class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {\n\t/**\n\t * Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided\n\t * {@link @fluidframework/protocol-definitions#IClient | audience member}.\n\t *\n\t * @param audienceMember - Audience member for which the `ServiceAudience` will be generated.\n\t * Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.\n\t *\n\t * @internal\n\t */\n\tprotected createServiceMember(audienceMember: IClient): AzureMember {\n\t\treturn createAzureAudienceMember(audienceMember);\n\t}\n}\n\n/**\n * Creates Azure-specific audience member\n */\nexport function createAzureAudienceMember(audienceMember: IClient): AzureMember {\n\tconst azureUser = audienceMember.user as AzureUser;\n\tassert(azureUser?.name !== undefined, 'Provided user was not an \"AzureUser\".');\n\n\treturn {\n\t\tuserId: audienceMember.user.id,\n\t\tuserName: azureUser.name,\n\t\tconnections: [],\n\t\tadditionalDetails: azureUser.additionalDetails as unknown,\n\t};\n}\n"]}
|
package/lib/AzureClient.d.ts
CHANGED
package/lib/AzureClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,KAAK,eAAe,EAGpB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,KAAK,eAAe,EAGpB,KAAK,eAAe,EAGpB,MAAM,8BAA8B,CAAC;AAStC,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,MAAM,cAAc,CAAC;AAetB;;;;;GAKG;AACH,qBAAa,WAAW;IASJ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luidframework/container-loader";
|
|
3
3
|
import { applyStorageCompression } from "@fluidframework/driver-utils";
|
|
4
|
-
import {
|
|
4
|
+
import { createDOProviderContainerRuntimeFactory, createFluidContainer, createServiceAudience, } from "@fluidframework/fluid-static";
|
|
5
5
|
import { SummaryType } from "@fluidframework/protocol-definitions";
|
|
6
6
|
import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver";
|
|
7
|
-
import {
|
|
7
|
+
import { assert } from "@fluidframework/core-utils";
|
|
8
|
+
import { createAzureAudienceMember } from "./AzureAudience.mjs";
|
|
8
9
|
import { AzureUrlResolver, createAzureCreateNewRequest } from "./AzureUrlResolver.mjs";
|
|
9
10
|
import { isAzureRemoteConnectionConfig } from "./utils.mjs";
|
|
10
11
|
/**
|
|
@@ -108,8 +109,11 @@ export class AzureClient {
|
|
|
108
109
|
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
|
|
109
110
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
110
111
|
const container = await loader.resolve({ url: url.href });
|
|
111
|
-
const rootDataObject =
|
|
112
|
-
const fluidContainer =
|
|
112
|
+
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
113
|
+
const fluidContainer = createFluidContainer({
|
|
114
|
+
container,
|
|
115
|
+
rootDataObject,
|
|
116
|
+
});
|
|
113
117
|
const services = this.getContainerServices(container);
|
|
114
118
|
return { container: fluidContainer, services };
|
|
115
119
|
}
|
|
@@ -140,11 +144,14 @@ export class AzureClient {
|
|
|
140
144
|
}
|
|
141
145
|
getContainerServices(container) {
|
|
142
146
|
return {
|
|
143
|
-
audience:
|
|
147
|
+
audience: createServiceAudience({
|
|
148
|
+
container,
|
|
149
|
+
createServiceMember: createAzureAudienceMember,
|
|
150
|
+
}),
|
|
144
151
|
};
|
|
145
152
|
}
|
|
146
|
-
createLoader(
|
|
147
|
-
const runtimeFactory =
|
|
153
|
+
createLoader(schema) {
|
|
154
|
+
const runtimeFactory = createDOProviderContainerRuntimeFactory({ schema });
|
|
148
155
|
const load = async () => {
|
|
149
156
|
return {
|
|
150
157
|
module: { fluidExport: runtimeFactory },
|
|
@@ -172,7 +179,7 @@ export class AzureClient {
|
|
|
172
179
|
}
|
|
173
180
|
async createFluidContainer(container, connection) {
|
|
174
181
|
const createNewRequest = createAzureCreateNewRequest(connection.endpoint, getTenantId(connection));
|
|
175
|
-
const rootDataObject =
|
|
182
|
+
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
176
183
|
/**
|
|
177
184
|
* See {@link FluidContainer.attach}
|
|
178
185
|
*/
|
|
@@ -186,9 +193,21 @@ export class AzureClient {
|
|
|
186
193
|
}
|
|
187
194
|
return container.resolvedUrl.id;
|
|
188
195
|
};
|
|
189
|
-
const fluidContainer =
|
|
196
|
+
const fluidContainer = createFluidContainer({
|
|
197
|
+
container,
|
|
198
|
+
rootDataObject,
|
|
199
|
+
});
|
|
190
200
|
fluidContainer.attach = attach;
|
|
191
201
|
return fluidContainer;
|
|
192
202
|
}
|
|
203
|
+
async getContainerEntryPoint(container) {
|
|
204
|
+
const rootDataObject = await container.getEntryPoint();
|
|
205
|
+
assert(rootDataObject !== undefined, "entryPoint must exist");
|
|
206
|
+
// ! This "if" is needed for back-compat (older instances of IRootDataObject may not have the IRootDataObject property)
|
|
207
|
+
if (rootDataObject.IRootDataObject === undefined) {
|
|
208
|
+
return rootDataObject;
|
|
209
|
+
}
|
|
210
|
+
return rootDataObject.IRootDataObject;
|
|
211
|
+
}
|
|
193
212
|
}
|
|
194
213
|
//# sourceMappingURL=AzureClient.mjs.map
|
package/lib/AzureClient.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.mjs","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"OAIO,EACN,WAAW,GAGX,MAAM,uCAAuC;OACvC,EAAE,MAAM,EAAE,MAAM,kCAAkC;OAKlD,EAAE,uBAAuB,EAAE,MAAM,8BAA8B;OAC/D,EAEN,iC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,EAAE;YAChB,IAAI,EAAE,OAAO;SACb,CAAC;QAEF,OAAO,IAAI,MAAM,CAAC;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;YAC9B,OAAO,EAAE,EAAE,MAAM,EAAE;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,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,MAAM,cAAc,GAAG,CAAC,MAAM,SAAS,CAAC,aAAa,EAAE,CAAoB,CAAC;QAE5E;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE;gBACnD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAC/E;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE;gBACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACpE;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,cAAc,CAAmB,SAAS,EAAE,cAAc,CAAC,CAAC;QACvF,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 */\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n\ttype IDocumentServiceFactory,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\ttype ContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\ttype IFluidContainer,\n\ttype IRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { type IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\n\nimport { type IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\ttype AzureClientProps,\n\ttype AzureConnectionConfig,\n\ttype AzureContainerServices,\n\ttype AzureContainerVersion,\n\ttype AzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\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 * 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 *\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 = 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 * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\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 * Creates new detached container out of specific version of another container.\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 * It defaults to latest version if parameter not provided.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async copyContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 sourceContainer = await loader.resolve({ url: url.href });\n\n\t\tif (sourceContainer.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Source container cannot resolve URL.\");\n\t\t}\n\n\t\tconst documentService = await this.documentServiceFactory.createDocumentService(\n\t\t\tsourceContainer.resolvedUrl,\n\t\t);\n\t\tconst storage = await documentService.connectToStorage();\n\t\tconst handle = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType: SummaryType.Tree,\n\t\t\thandle: version?.id ?? \"latest\",\n\t\t};\n\t\tconst tree = await storage.downloadSummary(handle);\n\n\t\tconst container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\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 * @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): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 container.getEntryPoint()) as IRootDataObject;\n\t\tconst fluidContainer = new FluidContainer<TContainerSchema>(container, rootDataObject);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\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 retreive 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(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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: new AzureAudience(container),\n\t\t};\n\t}\n\n\tprivate createLoader(containerSchema: ContainerSchema): Loader {\n\t\tconst runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);\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<FluidContainer<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 container.getEntryPoint()) as IRootDataObject;\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 = new FluidContainer<TContainerSchema>(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AzureClient.mjs","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"OAIO,EACN,WAAW,GAGX,MAAM,uCAAuC;OACvC,EAAE,MAAM,EAAE,MAAM,kCAAkC;OAKlD,EAAE,uBAAuB,EAAE,MAAM,8BAA8B;OAC/D,EAEN,uCAAuC,EACvC,oBAAoB,EAGpB,qBAAqB,GACrB,MAAM,8BAA8B;OAC9B,EAAgB,WAAW,EAAE,MAAM,sCAAsC;OACzE,EAAE,mCAAmC,EAAE,MAAM,sCAAsC;OAInF,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,yBAAyB,EAAE;OAC7B,EAAE,gBAAgB,EAAE,2BAA2B,EAAE;OAQjD,EAAE,6BAA6B,EAAE;AAExC;;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;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAKvB;;;OAGG;IACH,YAAoC,UAA4B;QAA5B,eAAU,GAAV,UAAU,CAAkB;QAC/D,wCAAwC;QACxC,UAAU,CAAC,UAAU,CAAC,Q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AqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE;gBACnD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAC/E;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE;gBACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACpE;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,GACnB,MAAM,SAAS,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,CAAC,cAAc,KAAK,SAAS,EAAE,uBAAuB,CAAC,CAAC;QAC9D,uHAAuH;QACvH,IAAI,cAAc,CAAC,eAAe,KAAK,SAAS,EAAE;YACjD,OAAO,cAAiC,CAAC;SACzC;QACD,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 */\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n\ttype IDocumentServiceFactory,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\ttype ContainerSchema,\n\tcreateDOProviderContainerRuntimeFactory,\n\tcreateFluidContainer,\n\ttype IFluidContainer,\n\ttype IRootDataObject,\n\tcreateServiceAudience,\n} from \"@fluidframework/fluid-static\";\nimport { type IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\n\nimport { type IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { type FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { createAzureAudienceMember } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\ttype AzureClientProps,\n\ttype AzureConnectionConfig,\n\ttype AzureContainerServices,\n\ttype AzureContainerVersion,\n\ttype AzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\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 * 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 *\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 = 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 * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer<TContainerSchema extends ContainerSchema>(\n\t\tcontainerSchema: TContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\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 * Creates new detached container out of specific version of another container.\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 * It defaults to latest version if parameter not provided.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async copyContainer<TContainerSchema extends ContainerSchema>(\n\t\tid: string,\n\t\tcontainerSchema: TContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 sourceContainer = await loader.resolve({ url: url.href });\n\n\t\tif (sourceContainer.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Source container cannot resolve URL.\");\n\t\t}\n\n\t\tconst documentService = await this.documentServiceFactory.createDocumentService(\n\t\t\tsourceContainer.resolvedUrl,\n\t\t);\n\t\tconst storage = await documentService.connectToStorage();\n\t\tconst handle = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType: SummaryType.Tree,\n\t\t\thandle: version?.id ?? \"latest\",\n\t\t};\n\t\tconst tree = await storage.downloadSummary(handle);\n\n\t\tconst container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\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 * @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): Promise<{\n\t\tcontainer: IFluidContainer<TContainerSchema>;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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 * 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 retreive 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(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\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): Loader {\n\t\tconst runtimeFactory = createDOProviderContainerRuntimeFactory({ schema });\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\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> | undefined =\n\t\t\tawait container.getEntryPoint();\n\t\tassert(rootDataObject !== undefined, \"entryPoint must exist\");\n\t\t// ! This \"if\" is needed for back-compat (older instances of IRootDataObject may not have the IRootDataObject property)\n\t\tif (rootDataObject.IRootDataObject === undefined) {\n\t\t\treturn rootDataObject as IRootDataObject;\n\t\t}\n\t\treturn rootDataObject.IRootDataObject;\n\t}\n\t// #endregion\n}\n"]}
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/* Excluded from this release type: createServiceMember */
|
|
@@ -95,6 +96,7 @@ export declare class AzureClient {
|
|
|
95
96
|
private getContainerServices;
|
|
96
97
|
private createLoader;
|
|
97
98
|
private createFluidContainer;
|
|
99
|
+
private getContainerEntryPoint;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/* Excluded from this release type: createServiceMember */
|
|
@@ -95,6 +96,7 @@ export declare class AzureClient {
|
|
|
95
96
|
private getContainerServices;
|
|
96
97
|
private createLoader;
|
|
97
98
|
private createFluidContainer;
|
|
99
|
+
private getContainerEntryPoint;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/* Excluded from this release type: createServiceMember */
|
|
@@ -95,6 +96,7 @@ export declare class AzureClient {
|
|
|
95
96
|
private getContainerServices;
|
|
96
97
|
private createLoader;
|
|
97
98
|
private createFluidContainer;
|
|
99
|
+
private getContainerEntryPoint;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
@@ -26,6 +26,7 @@ import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
|
26
26
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
27
27
|
*
|
|
28
28
|
* @public
|
|
29
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
29
30
|
*/
|
|
30
31
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
31
32
|
/**
|
|
@@ -104,6 +105,7 @@ export declare class AzureClient {
|
|
|
104
105
|
private getContainerServices;
|
|
105
106
|
private createLoader;
|
|
106
107
|
private createFluidContainer;
|
|
108
|
+
private getContainerEntryPoint;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/azure-client",
|
|
3
|
-
"version": "2.0.0-dev.7.
|
|
3
|
+
"version": "2.0.0-dev.7.4.0.214930",
|
|
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": {
|
|
@@ -27,32 +27,32 @@
|
|
|
27
27
|
"module": "lib/index.mjs",
|
|
28
28
|
"types": "dist/index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@fluidframework/container-definitions": "2.0.0-dev.7.
|
|
31
|
-
"@fluidframework/container-loader": "2.0.0-dev.7.
|
|
32
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.7.
|
|
33
|
-
"@fluidframework/core-utils": "2.0.0-dev.7.
|
|
34
|
-
"@fluidframework/driver-definitions": "2.0.0-dev.7.
|
|
35
|
-
"@fluidframework/driver-utils": "2.0.0-dev.7.
|
|
36
|
-
"@fluidframework/fluid-static": "2.0.0-dev.7.
|
|
37
|
-
"@fluidframework/map": "2.0.0-dev.7.
|
|
30
|
+
"@fluidframework/container-definitions": "2.0.0-dev.7.4.0.214930",
|
|
31
|
+
"@fluidframework/container-loader": "2.0.0-dev.7.4.0.214930",
|
|
32
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.214930",
|
|
33
|
+
"@fluidframework/core-utils": "2.0.0-dev.7.4.0.214930",
|
|
34
|
+
"@fluidframework/driver-definitions": "2.0.0-dev.7.4.0.214930",
|
|
35
|
+
"@fluidframework/driver-utils": "2.0.0-dev.7.4.0.214930",
|
|
36
|
+
"@fluidframework/fluid-static": "2.0.0-dev.7.4.0.214930",
|
|
37
|
+
"@fluidframework/map": "2.0.0-dev.7.4.0.214930",
|
|
38
38
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
39
|
-
"@fluidframework/routerlicious-driver": "2.0.0-dev.7.
|
|
40
|
-
"@fluidframework/runtime-utils": "2.0.0-dev.7.
|
|
39
|
+
"@fluidframework/routerlicious-driver": "2.0.0-dev.7.4.0.214930",
|
|
40
|
+
"@fluidframework/runtime-utils": "2.0.0-dev.7.4.0.214930",
|
|
41
41
|
"@fluidframework/server-services-client": "^2.0.1",
|
|
42
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev.7.
|
|
42
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev.7.4.0.214930",
|
|
43
43
|
"axios": "^0.26.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@fluid-tools/build-cli": "0.28.0
|
|
47
|
-
"@fluidframework/aqueduct": "2.0.0-dev.7.
|
|
46
|
+
"@fluid-tools/build-cli": "^0.28.0",
|
|
47
|
+
"@fluidframework/aqueduct": "2.0.0-dev.7.4.0.214930",
|
|
48
48
|
"@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0-internal.7.2.0",
|
|
49
|
-
"@fluidframework/azure-local-service": "2.0.0-dev.7.
|
|
49
|
+
"@fluidframework/azure-local-service": "2.0.0-dev.7.4.0.214930",
|
|
50
50
|
"@fluidframework/build-common": "^2.0.3",
|
|
51
|
-
"@fluidframework/build-tools": "0.28.0
|
|
52
|
-
"@fluidframework/counter": "2.0.0-dev.7.
|
|
51
|
+
"@fluidframework/build-tools": "^0.28.0",
|
|
52
|
+
"@fluidframework/counter": "2.0.0-dev.7.4.0.214930",
|
|
53
53
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
54
|
-
"@fluidframework/test-runtime-utils": "2.0.0-dev.7.
|
|
55
|
-
"@fluidframework/test-utils": "2.0.0-dev.7.
|
|
54
|
+
"@fluidframework/test-runtime-utils": "2.0.0-dev.7.4.0.214930",
|
|
55
|
+
"@fluidframework/test-utils": "2.0.0-dev.7.4.0.214930",
|
|
56
56
|
"@microsoft/api-extractor": "^7.38.3",
|
|
57
57
|
"@types/mocha": "^9.1.1",
|
|
58
58
|
"@types/node": "^16.18.38",
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"format": "npm run prettier:fix",
|
|
102
102
|
"lint": "npm run prettier && npm run eslint",
|
|
103
103
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
104
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
105
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
104
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
105
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
106
106
|
"start:tinylicious:test": "npx @fluidframework/azure-local-service > tinylicious.log 2>&1",
|
|
107
107
|
"test": "npm run test:realsvc",
|
|
108
108
|
"test:realsvc": "npm run test:realsvc:tinylicious",
|
package/src/AzureAudience.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { type AzureMember, type AzureUser, type IAzureAudience } from "./interfa
|
|
|
14
14
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
15
15
|
*
|
|
16
16
|
* @public
|
|
17
|
+
* @deprecated This class will be removed. use {@link IAzureAudience} instead
|
|
17
18
|
*/
|
|
18
19
|
export class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
19
20
|
/**
|
|
@@ -26,14 +27,21 @@ export class AzureAudience extends ServiceAudience<AzureMember> implements IAzur
|
|
|
26
27
|
* @internal
|
|
27
28
|
*/
|
|
28
29
|
protected createServiceMember(audienceMember: IClient): AzureMember {
|
|
29
|
-
|
|
30
|
-
assert(azureUser?.name !== undefined, 'Provided user was not an "AzureUser".');
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
userId: audienceMember.user.id,
|
|
34
|
-
userName: azureUser.name,
|
|
35
|
-
connections: [],
|
|
36
|
-
additionalDetails: azureUser.additionalDetails as unknown,
|
|
37
|
-
};
|
|
30
|
+
return createAzureAudienceMember(audienceMember);
|
|
38
31
|
}
|
|
39
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates Azure-specific audience member
|
|
36
|
+
*/
|
|
37
|
+
export function createAzureAudienceMember(audienceMember: IClient): AzureMember {
|
|
38
|
+
const azureUser = audienceMember.user as AzureUser;
|
|
39
|
+
assert(azureUser?.name !== undefined, 'Provided user was not an "AzureUser".');
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
userId: audienceMember.user.id,
|
|
43
|
+
userName: azureUser.name,
|
|
44
|
+
connections: [],
|
|
45
|
+
additionalDetails: azureUser.additionalDetails as unknown,
|
|
46
|
+
};
|
|
47
|
+
}
|
package/src/AzureClient.ts
CHANGED
|
@@ -15,16 +15,19 @@ import {
|
|
|
15
15
|
import { applyStorageCompression } from "@fluidframework/driver-utils";
|
|
16
16
|
import {
|
|
17
17
|
type ContainerSchema,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
createDOProviderContainerRuntimeFactory,
|
|
19
|
+
createFluidContainer,
|
|
20
20
|
type IFluidContainer,
|
|
21
21
|
type IRootDataObject,
|
|
22
|
+
createServiceAudience,
|
|
22
23
|
} from "@fluidframework/fluid-static";
|
|
23
24
|
import { type IClient, SummaryType } from "@fluidframework/protocol-definitions";
|
|
24
25
|
import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver";
|
|
25
26
|
|
|
26
27
|
import { type IConfigProviderBase } from "@fluidframework/telemetry-utils";
|
|
27
|
-
import {
|
|
28
|
+
import { type FluidObject } from "@fluidframework/core-interfaces";
|
|
29
|
+
import { assert } from "@fluidframework/core-utils";
|
|
30
|
+
import { createAzureAudienceMember } from "./AzureAudience";
|
|
28
31
|
import { AzureUrlResolver, createAzureCreateNewRequest } from "./AzureUrlResolver";
|
|
29
32
|
import {
|
|
30
33
|
type AzureClientProps,
|
|
@@ -187,8 +190,11 @@ export class AzureClient {
|
|
|
187
190
|
);
|
|
188
191
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
189
192
|
const container = await loader.resolve({ url: url.href });
|
|
190
|
-
const rootDataObject =
|
|
191
|
-
const fluidContainer =
|
|
193
|
+
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
194
|
+
const fluidContainer = createFluidContainer<TContainerSchema>({
|
|
195
|
+
container,
|
|
196
|
+
rootDataObject,
|
|
197
|
+
});
|
|
192
198
|
const services = this.getContainerServices(container);
|
|
193
199
|
return { container: fluidContainer, services };
|
|
194
200
|
}
|
|
@@ -231,12 +237,15 @@ export class AzureClient {
|
|
|
231
237
|
|
|
232
238
|
private getContainerServices(container: IContainer): AzureContainerServices {
|
|
233
239
|
return {
|
|
234
|
-
audience:
|
|
240
|
+
audience: createServiceAudience({
|
|
241
|
+
container,
|
|
242
|
+
createServiceMember: createAzureAudienceMember,
|
|
243
|
+
}),
|
|
235
244
|
};
|
|
236
245
|
}
|
|
237
246
|
|
|
238
|
-
private createLoader(
|
|
239
|
-
const runtimeFactory =
|
|
247
|
+
private createLoader(schema: ContainerSchema): Loader {
|
|
248
|
+
const runtimeFactory = createDOProviderContainerRuntimeFactory({ schema });
|
|
240
249
|
const load = async (): Promise<IFluidModuleWithDetails> => {
|
|
241
250
|
return {
|
|
242
251
|
module: { fluidExport: runtimeFactory },
|
|
@@ -268,13 +277,13 @@ export class AzureClient {
|
|
|
268
277
|
private async createFluidContainer<TContainerSchema extends ContainerSchema>(
|
|
269
278
|
container: IContainer,
|
|
270
279
|
connection: AzureConnectionConfig,
|
|
271
|
-
): Promise<
|
|
280
|
+
): Promise<IFluidContainer<TContainerSchema>> {
|
|
272
281
|
const createNewRequest = createAzureCreateNewRequest(
|
|
273
282
|
connection.endpoint,
|
|
274
283
|
getTenantId(connection),
|
|
275
284
|
);
|
|
276
285
|
|
|
277
|
-
const rootDataObject =
|
|
286
|
+
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
278
287
|
|
|
279
288
|
/**
|
|
280
289
|
* See {@link FluidContainer.attach}
|
|
@@ -289,9 +298,23 @@ export class AzureClient {
|
|
|
289
298
|
}
|
|
290
299
|
return container.resolvedUrl.id;
|
|
291
300
|
};
|
|
292
|
-
const fluidContainer =
|
|
301
|
+
const fluidContainer = createFluidContainer<TContainerSchema>({
|
|
302
|
+
container,
|
|
303
|
+
rootDataObject,
|
|
304
|
+
});
|
|
293
305
|
fluidContainer.attach = attach;
|
|
294
306
|
return fluidContainer;
|
|
295
307
|
}
|
|
308
|
+
|
|
309
|
+
private async getContainerEntryPoint(container: IContainer): Promise<IRootDataObject> {
|
|
310
|
+
const rootDataObject: FluidObject<IRootDataObject> | undefined =
|
|
311
|
+
await container.getEntryPoint();
|
|
312
|
+
assert(rootDataObject !== undefined, "entryPoint must exist");
|
|
313
|
+
// ! This "if" is needed for back-compat (older instances of IRootDataObject may not have the IRootDataObject property)
|
|
314
|
+
if (rootDataObject.IRootDataObject === undefined) {
|
|
315
|
+
return rootDataObject as IRootDataObject;
|
|
316
|
+
}
|
|
317
|
+
return rootDataObject.IRootDataObject;
|
|
318
|
+
}
|
|
296
319
|
// #endregion
|
|
297
320
|
}
|