@fluidframework/azure-client 2.0.0-dev.4.4.0.162574 → 2.0.0-dev.5.3.2.178189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @fluidframework/azure-client
2
2
 
3
+ ## 2.0.0-internal.5.3.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.0.0-internal.5.2.0
8
+
9
+ Dependency updates only.
10
+
11
+ ## 2.0.0-internal.5.1.0
12
+
13
+ Dependency updates only.
14
+
15
+ ## 2.0.0-internal.5.0.0
16
+
17
+ Dependency updates only.
18
+
19
+ ## 2.0.0-internal.4.4.0
20
+
21
+ Dependency updates only.
22
+
3
23
  ## 2.0.0-internal.4.1.0
4
24
 
5
25
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAYA,OAAO,EACN,eAAe,EAGf,eAAe,EAEf,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EACN,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,MAAM,cAAc,CAAC;AAetB;;;GAGG;AACH,qBAAa,WAAW;IASJ,OAAO,CAAC,QAAQ,CAAC,KAAK;IARzC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IAEjE;;;OAGG;gBACiC,KAAK,EAAE,gBAAgB;IAc3D;;;;OAIG;IACU,eAAe,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC;QACvE,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAaF;;;;;;;OAOG;IACU,aAAa,CACzB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE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AC,EAAE,qBAAqB,GAC7B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IA8BF;;;;;OAKG;IACU,YAAY,CACxB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,GAC9B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAaF;;;;;;OAMG;IACU,oBAAoB,CAChC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAwBnC,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,YAAY;YA8BN,oBAAoB;CA8BlC"}
@@ -42,7 +42,11 @@ class AzureClient {
42
42
  // The local service implementation differs from the Azure Fluid Relay in blob
43
43
  // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
44
44
  const isRemoteConnection = (0, utils_1.isAzureRemoteConnectionConfig)(this.props.connection);
45
- this.documentServiceFactory = new routerlicious_driver_1.RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection });
45
+ const origDocumentServiceFactory = new routerlicious_driver_1.RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, {
46
+ enableWholeSummaryUpload: isRemoteConnection,
47
+ enableDiscovery: isRemoteConnection,
48
+ });
49
+ this.documentServiceFactory = (0, driver_utils_1.applyStorageCompression)(origDocumentServiceFactory, props.summaryCompression);
46
50
  this.configProvider = props.configProvider;
47
51
  }
48
52
  /**
@@ -179,9 +183,11 @@ class AzureClient {
179
183
  throw new Error("Cannot attach container. Container is not in detached state");
180
184
  }
181
185
  await container.attach(createNewRequest);
182
- const resolved = container.resolvedUrl;
183
- (0, driver_utils_1.ensureFluidResolvedUrl)(resolved);
184
- return resolved.id;
186
+ if (container.resolvedUrl === undefined) {
187
+ throw new Error("Resolved Url not available on attached container");
188
+ }
189
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
190
+ return container.resolvedUrl.id;
185
191
  };
186
192
  const fluidContainer = new fluid_static_1.FluidContainer(container, rootDataObject);
187
193
  fluidContainer.attach = attach;
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,iFAI+C;AAC/C,uEAA0D;AAE1D,+DAAsE;AACtE,+DAMsC;AACtC,+EAA4E;AAC5E,+EAA2F;AAC3F,iEAAmE;AAGnE,mDAAgD;AAChD,yDAAmF;AAQnF,mCAAwD;AAExD;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,eAAsC,EAAU,EAAE;IACtE,OAAO,IAAA,qCAA6B,EAAC,eAAe,CAAC;QACpD,CAAC,CAAC,eAAe,CAAC,QAAQ;QAC1B,CAAC,CAAC,oBAAoB,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAa,WAAW;IAKvB;;;OAGG;IACH,YAAoC,KAAuB;QAAvB,UAAK,GAAL,KAAK,CAAkB;QAC1D,wCAAwC;QACxC,KAAK,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,WAAW,GAAG,IAAI,mCAAgB,EAAE,CAAC;QAC1C,8EAA8E;QAC9E,6FAA6F;QAC7F,MAAM,kBAAkB,GAAG,IAAA,qCAA6B,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAChF,IAAI,CAAC,sBAAsB,GAAG,IAAI,0DAAmC,CACpE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,EACnC,EAAE,wBAAwB,EAAE,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MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AApND,kCAoNC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tAttachState,\n\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport {\n\tContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\tIFluidContainer,\n\tRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\n\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\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 = (connectionProps: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProps)\n\t\t? connectionProps.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 */\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 props - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(private readonly props: AzureClientProps) {\n\t\t// remove trailing slash from URL if any\n\t\tprops.connection.endpoint = props.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.props.connection);\n\t\tthis.documentServiceFactory = new RouterliciousDocumentServiceFactory(\n\t\t\tthis.props.connection.tokenProvider,\n\t\t\t{ enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },\n\t\t);\n\t\tthis.configProvider = props.configProvider;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\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(containerSchema: ContainerSchema): Promise<{\n\t\tcontainer: IFluidContainer;\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loader.resolve({ url: url.href });\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n\t\tconst fluidContainer = new FluidContainer(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.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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 = await this.documentServiceFactory.createDocumentService(\n\t\t\tresolvedUrl,\n\t\t);\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.props.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t});\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<FluidContainer> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(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\tconst resolved = container.resolvedUrl;\n\t\t\tensureFluidResolvedUrl(resolved);\n\t\t\treturn resolved.id;\n\t\t};\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
1
+ {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,iFAI+C;AAC/C,uEAA0D;AAE1D,+DAAuE;AACvE,+DAMsC;AACtC,+EAA4E;AAC5E,+EAA2F;AAC3F,iEAAmE;AAGnE,mDAAgD;AAChD,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AC7B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACzB,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,MAAM,IAAA,kCAAkB,EAAiB,SAAS,EAAE,GAAG,CAAC,CAAC;QAEhF;;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,+DAA+D;YAC/D,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,6BAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AA5ND,kCA4NC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tAttachState,\n\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\tContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\tIFluidContainer,\n\tRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\n\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\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 = (connectionProps: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProps)\n\t\t? connectionProps.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 */\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 props - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(private readonly props: AzureClientProps) {\n\t\t// remove trailing slash from URL if any\n\t\tprops.connection.endpoint = props.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.props.connection);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.props.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\tprops.summaryCompression,\n\t\t);\n\t\tthis.configProvider = props.configProvider;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\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(containerSchema: ContainerSchema): Promise<{\n\t\tcontainer: IFluidContainer;\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loader.resolve({ url: url.href });\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n\t\tconst fluidContainer = new FluidContainer(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.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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 = await this.documentServiceFactory.createDocumentService(\n\t\t\tresolvedUrl,\n\t\t);\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.props.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t});\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<FluidContainer> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
@@ -2,12 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
6
  import { IMember, IServiceAudience } from "@fluidframework/fluid-static";
7
7
  import { IUser } from "@fluidframework/protocol-definitions";
8
8
  import { ITokenProvider } from "@fluidframework/routerlicious-driver";
9
9
  import { IConfigProviderBase } from "@fluidframework/telemetry-utils";
10
- export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
10
+ import { ICompressionStorageConfig } from "@fluidframework/driver-utils";
11
+ export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
11
12
  /**
12
13
  * Props for initializing a new AzureClient instance
13
14
  */
@@ -24,6 +25,7 @@ export interface AzureClientProps {
24
25
  * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.
25
26
  */
26
27
  readonly configProvider?: IConfigProviderBase;
28
+ readonly summaryCompression?: boolean | ICompressionStorageConfig;
27
29
  }
28
30
  /**
29
31
  * Container version metadata.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,2BAA2B,GAAG,0BAA0B,CAAC;IAC9E;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAA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;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACxE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,QAAQ,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;GAOG;AAGH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,KAAK;IAChD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACtB;AAED;;;;;;;;GAQG;AAGH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO;IACpD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACtB;AAED;;GAEG;AACH,oBAAY,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\n\n// Re-export so developers can build loggers without pulling in common-definitions\nexport { ITelemetryBaseEvent, ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\n\n/**\n * Props for initializing a new AzureClient instance\n */\nexport interface AzureClientProps {\n\t/**\n\t * Configuration for establishing a connection with the Azure Fluid Relay.\n\t */\n\treadonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * Container version metadata.\n */\nexport interface AzureContainerVersion {\n\t/**\n\t * Version ID\n\t */\n\tid: string;\n\n\t/**\n\t * Time when version was generated.\n\t * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n\t */\n\tdate?: string;\n}\n\n/**\n * Options for \"Get Container Versions\" API.\n */\nexport interface AzureGetVersionsOptions {\n\t/**\n\t * Max number of versions\n\t */\n\tmaxCount: number;\n}\n\n/**\n * The type of connection.\n * - \"local\" for local connections to a Fluid relay instance running on the localhost\n * - \"remote\" for client connections to the Azure Fluid Relay service\n */\nexport type AzureConnectionConfigType = \"local\" | \"remote\";\n\n/**\n * Parameters for establishing a connection with the Azure Fluid Relay.\n */\nexport interface AzureConnectionConfig {\n\t/**\n\t * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.\n\t */\n\ttype: AzureConnectionConfigType;\n\t/**\n\t * URI to the Azure Fluid Relay service discovery endpoint.\n\t */\n\tendpoint: string;\n\t/**\n\t * Instance that provides Azure Fluid Relay endpoint tokens.\n\t */\n\ttokenProvider: ITokenProvider;\n}\n\n/**\n * Parameters for establishing a remote connection with the Azure Fluid Relay.\n */\nexport interface AzureRemoteConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"remote\";\n\t/**\n\t * Unique tenant identifier.\n\t */\n\ttenantId: string;\n}\n\n/**\n * Parameters for establishing a local connection with a local instance of the Azure Fluid Relay.\n */\nexport interface AzureLocalConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"local\";\n}\n\n/**\n * AzureContainerServices is returned by the AzureClient alongside a FluidContainer.\n * It holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in\n * the FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to use,\n * will not be included here but rather on the FluidContainer class itself.\n */\nexport interface AzureContainerServices {\n\t/**\n\t * Provides an object that can be used to get the users that are present in this Fluid session and\n\t * listeners for when the roster has any changes from users joining/leaving the session\n\t */\n\taudience: IAzureAudience;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IUser} interface to include this service-specific value. *\n *\n * @typeParam T - See {@link AzureUser.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureUser<T = any> extends IUser {\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\n\t/**\n\t * Custom, app-specific user information\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected to Azure.\n *\n * @typeParam T - See {@link AzureMember.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureMember<T = any> extends IMember {\n\t/**\n\t * {@inheritDoc AzureUser.name}\n\t */\n\tuserName: string;\n\n\t/**\n\t * {@inheritDoc AzureUser.additionalDetails}\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Audience object for Azure Fluid Relay containers\n */\nexport type IAzureAudience = IServiceAudience<AzureMember>;\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { ICompressionStorageConfig } from \"@fluidframework/driver-utils\";\n\n// Re-export so developers can build loggers without pulling in core-interfaces\nexport { ITelemetryBaseEvent, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\n/**\n * Props for initializing a new AzureClient instance\n */\nexport interface AzureClientProps {\n\t/**\n\t * Configuration for establishing a connection with the Azure Fluid Relay.\n\t */\n\treadonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n\n\treadonly summaryCompression?: boolean | ICompressionStorageConfig;\n}\n\n/**\n * Container version metadata.\n */\nexport interface AzureContainerVersion {\n\t/**\n\t * Version ID\n\t */\n\tid: string;\n\n\t/**\n\t * Time when version was generated.\n\t * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n\t */\n\tdate?: string;\n}\n\n/**\n * Options for \"Get Container Versions\" API.\n */\nexport interface AzureGetVersionsOptions {\n\t/**\n\t * Max number of versions\n\t */\n\tmaxCount: number;\n}\n\n/**\n * The type of connection.\n * - \"local\" for local connections to a Fluid relay instance running on the localhost\n * - \"remote\" for client connections to the Azure Fluid Relay service\n */\nexport type AzureConnectionConfigType = \"local\" | \"remote\";\n\n/**\n * Parameters for establishing a connection with the Azure Fluid Relay.\n */\nexport interface AzureConnectionConfig {\n\t/**\n\t * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.\n\t */\n\ttype: AzureConnectionConfigType;\n\t/**\n\t * URI to the Azure Fluid Relay service discovery endpoint.\n\t */\n\tendpoint: string;\n\t/**\n\t * Instance that provides Azure Fluid Relay endpoint tokens.\n\t */\n\ttokenProvider: ITokenProvider;\n}\n\n/**\n * Parameters for establishing a remote connection with the Azure Fluid Relay.\n */\nexport interface AzureRemoteConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"remote\";\n\t/**\n\t * Unique tenant identifier.\n\t */\n\ttenantId: string;\n}\n\n/**\n * Parameters for establishing a local connection with a local instance of the Azure Fluid Relay.\n */\nexport interface AzureLocalConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"local\";\n}\n\n/**\n * AzureContainerServices is returned by the AzureClient alongside a FluidContainer.\n * It holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in\n * the FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to use,\n * will not be included here but rather on the FluidContainer class itself.\n */\nexport interface AzureContainerServices {\n\t/**\n\t * Provides an object that can be used to get the users that are present in this Fluid session and\n\t * listeners for when the roster has any changes from users joining/leaving the session\n\t */\n\taudience: IAzureAudience;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IUser} interface to include this service-specific value. *\n *\n * @typeParam T - See {@link AzureUser.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureUser<T = any> extends IUser {\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\n\t/**\n\t * Custom, app-specific user information\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected to Azure.\n *\n * @typeParam T - See {@link AzureMember.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureMember<T = any> extends IMember {\n\t/**\n\t * {@inheritDoc AzureUser.name}\n\t */\n\tuserName: string;\n\n\t/**\n\t * {@inheritDoc AzureUser.additionalDetails}\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Audience object for Azure Fluid Relay containers\n */\nexport type IAzureAudience = IServiceAudience<AzureMember>;\n"]}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.34.9"
9
+ }
10
+ ]
11
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAYA,OAAO,EACN,eAAe,EAGf,eAAe,EAEf,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EACN,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,MAAM,cAAc,CAAC;AAetB;;;GAGG;AACH,qBAAa,WAAW;IASJ,OAAO,CAAC,QAAQ,CAAC,KAAK;IARzC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IAEjE;;;OAGG;gBACiC,KAAK,EAAE,gBAAgB;IAc3D;;;;OAIG;IACU,eAAe,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAA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AAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAaF;;;;;;;OAOG;IACU,aAAa,CACzB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IA8BF;;;;;OAKG;IACU,YAAY,CACxB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,GAC9B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAaF;;;;;;OAMG;IACU,oBAAoB,CAChC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAwBnC,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,YAAY;YA8BN,oBAAoB;CA8BlC"}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { AttachState, } from "@fluidframework/container-definitions";
6
6
  import { Loader } from "@fluidframework/container-loader";
7
- import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils";
7
+ import { applyStorageCompression } from "@fluidframework/driver-utils";
8
8
  import { DOProviderContainerRuntimeFactory, FluidContainer, } from "@fluidframework/fluid-static";
9
9
  import { SummaryType } from "@fluidframework/protocol-definitions";
10
10
  import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver";
@@ -39,7 +39,11 @@ export class AzureClient {
39
39
  // The local service implementation differs from the Azure Fluid Relay in blob
40
40
  // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
41
41
  const isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);
42
- this.documentServiceFactory = new RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection });
42
+ const origDocumentServiceFactory = new RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, {
43
+ enableWholeSummaryUpload: isRemoteConnection,
44
+ enableDiscovery: isRemoteConnection,
45
+ });
46
+ this.documentServiceFactory = applyStorageCompression(origDocumentServiceFactory, props.summaryCompression);
43
47
  this.configProvider = props.configProvider;
44
48
  }
45
49
  /**
@@ -176,9 +180,11 @@ export class AzureClient {
176
180
  throw new Error("Cannot attach container. Container is not in detached state");
177
181
  }
178
182
  await container.attach(createNewRequest);
179
- const resolved = container.resolvedUrl;
180
- ensureFluidResolvedUrl(resolved);
181
- return resolved.id;
183
+ if (container.resolvedUrl === undefined) {
184
+ throw new Error("Resolved Url not available on attached container");
185
+ }
186
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
187
+ return container.resolvedUrl.id;
182
188
  };
183
189
  const fluidContainer = new FluidContainer(container, rootDataObject);
184
190
  fluidContainer.attach = attach;
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,WAAW,GAGX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAEN,iCAAiC,EACjC,cAAc,GAGd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAW,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAQnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD;;GAEG;AACH,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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,MAAM,kBAAkB,CAAiB,SAAS,EAAE,GAAG,CAAC,CAAC;QAEhF;;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,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC;YACvC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;YACjC,OAAO,QAAQ,CAAC,EAAE,CAAC;QACpB,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACrE,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\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport {\n\tContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\tIFluidContainer,\n\tRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\n\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\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 = (connectionProps: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProps)\n\t\t? connectionProps.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 */\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 props - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(private readonly props: AzureClientProps) {\n\t\t// remove trailing slash from URL if any\n\t\tprops.connection.endpoint = props.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.props.connection);\n\t\tthis.documentServiceFactory = new RouterliciousDocumentServiceFactory(\n\t\t\tthis.props.connection.tokenProvider,\n\t\t\t{ enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },\n\t\t);\n\t\tthis.configProvider = props.configProvider;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\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(containerSchema: ContainerSchema): Promise<{\n\t\tcontainer: IFluidContainer;\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loader.resolve({ url: url.href });\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n\t\tconst fluidContainer = new FluidContainer(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.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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 = await this.documentServiceFactory.createDocumentService(\n\t\t\tresolvedUrl,\n\t\t);\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.props.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t});\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<FluidContainer> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(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\tconst resolved = container.resolvedUrl;\n\t\t\tensureFluidResolvedUrl(resolved);\n\t\t\treturn resolved.id;\n\t\t};\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
1
+ {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,WAAW,GAGX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAEN,iCAAiC,EACjC,cAAc,GAGd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAW,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAQnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAA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AE,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,MAAM,kBAAkB,CAAiB,SAAS,EAAE,GAAG,CAAC,CAAC;QAEhF;;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,+DAA+D;YAC/D,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACrE,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\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\tContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\tIFluidContainer,\n\tRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\n\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\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 = (connectionProps: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProps)\n\t\t? connectionProps.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 */\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 props - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(private readonly props: AzureClientProps) {\n\t\t// remove trailing slash from URL if any\n\t\tprops.connection.endpoint = props.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.props.connection);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.props.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\tprops.summaryCompression,\n\t\t);\n\t\tthis.configProvider = props.configProvider;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\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(containerSchema: ContainerSchema): Promise<{\n\t\tcontainer: IFluidContainer;\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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(container, this.props.connection);\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 * @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(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loader.resolve({ url: url.href });\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n\t\tconst fluidContainer = new FluidContainer(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.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\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 = await this.documentServiceFactory.createDocumentService(\n\t\t\tresolvedUrl,\n\t\t);\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.props.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t});\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<FluidContainer> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\tconst rootDataObject = await requestFluidObject<RootDataObject>(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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
@@ -2,12 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
6
  import { IMember, IServiceAudience } from "@fluidframework/fluid-static";
7
7
  import { IUser } from "@fluidframework/protocol-definitions";
8
8
  import { ITokenProvider } from "@fluidframework/routerlicious-driver";
9
9
  import { IConfigProviderBase } from "@fluidframework/telemetry-utils";
10
- export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
10
+ import { ICompressionStorageConfig } from "@fluidframework/driver-utils";
11
+ export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
11
12
  /**
12
13
  * Props for initializing a new AzureClient instance
13
14
  */
@@ -24,6 +25,7 @@ export interface AzureClientProps {
24
25
  * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.
25
26
  */
26
27
  readonly configProvider?: IConfigProviderBase;
28
+ readonly summaryCompression?: boolean | ICompressionStorageConfig;
27
29
  }
28
30
  /**
29
31
  * Container version metadata.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,2BAA2B,GAAG,0BAA0B,CAAC;IAC9E;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,oBAAY,yBAAy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IAAI,EAAE,OAAO,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,QAAQ,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;GAOG;AAGH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,KAAK;IAChD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACtB;AAED;;;;;;;;GAQG;AAGH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO;IACpD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACtB;AAED;;GAEG;AACH,oBAAY,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\n\n// Re-export so developers can build loggers without pulling in common-definitions\nexport { ITelemetryBaseEvent, ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\n\n/**\n * Props for initializing a new AzureClient instance\n */\nexport interface AzureClientProps {\n\t/**\n\t * Configuration for establishing a connection with the Azure Fluid Relay.\n\t */\n\treadonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * Container version metadata.\n */\nexport interface AzureContainerVersion {\n\t/**\n\t * Version ID\n\t */\n\tid: string;\n\n\t/**\n\t * Time when version was generated.\n\t * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n\t */\n\tdate?: string;\n}\n\n/**\n * Options for \"Get Container Versions\" API.\n */\nexport interface AzureGetVersionsOptions {\n\t/**\n\t * Max number of versions\n\t */\n\tmaxCount: number;\n}\n\n/**\n * The type of connection.\n * - \"local\" for local connections to a Fluid relay instance running on the localhost\n * - \"remote\" for client connections to the Azure Fluid Relay service\n */\nexport type AzureConnectionConfigType = \"local\" | \"remote\";\n\n/**\n * Parameters for establishing a connection with the Azure Fluid Relay.\n */\nexport interface AzureConnectionConfig {\n\t/**\n\t * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.\n\t */\n\ttype: AzureConnectionConfigType;\n\t/**\n\t * URI to the Azure Fluid Relay service discovery endpoint.\n\t */\n\tendpoint: string;\n\t/**\n\t * Instance that provides Azure Fluid Relay endpoint tokens.\n\t */\n\ttokenProvider: ITokenProvider;\n}\n\n/**\n * Parameters for establishing a remote connection with the Azure Fluid Relay.\n */\nexport interface AzureRemoteConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"remote\";\n\t/**\n\t * Unique tenant identifier.\n\t */\n\ttenantId: string;\n}\n\n/**\n * Parameters for establishing a local connection with a local instance of the Azure Fluid Relay.\n */\nexport interface AzureLocalConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"local\";\n}\n\n/**\n * AzureContainerServices is returned by the AzureClient alongside a FluidContainer.\n * It holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in\n * the FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to use,\n * will not be included here but rather on the FluidContainer class itself.\n */\nexport interface AzureContainerServices {\n\t/**\n\t * Provides an object that can be used to get the users that are present in this Fluid session and\n\t * listeners for when the roster has any changes from users joining/leaving the session\n\t */\n\taudience: IAzureAudience;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IUser} interface to include this service-specific value. *\n *\n * @typeParam T - See {@link AzureUser.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureUser<T = any> extends IUser {\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\n\t/**\n\t * Custom, app-specific user information\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected to Azure.\n *\n * @typeParam T - See {@link AzureMember.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureMember<T = any> extends IMember {\n\t/**\n\t * {@inheritDoc AzureUser.name}\n\t */\n\tuserName: string;\n\n\t/**\n\t * {@inheritDoc AzureUser.additionalDetails}\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Audience object for Azure Fluid Relay containers\n */\nexport type IAzureAudience = IServiceAudience<AzureMember>;\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { ICompressionStorageConfig } from \"@fluidframework/driver-utils\";\n\n// Re-export so developers can build loggers without pulling in core-interfaces\nexport { ITelemetryBaseEvent, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\n/**\n * Props for initializing a new AzureClient instance\n */\nexport interface AzureClientProps {\n\t/**\n\t * Configuration for establishing a connection with the Azure Fluid Relay.\n\t */\n\treadonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n\t/**\n\t * Optional. A logger instance to receive diagnostic messages.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n\n\treadonly summaryCompression?: boolean | ICompressionStorageConfig;\n}\n\n/**\n * Container version metadata.\n */\nexport interface AzureContainerVersion {\n\t/**\n\t * Version ID\n\t */\n\tid: string;\n\n\t/**\n\t * Time when version was generated.\n\t * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n\t */\n\tdate?: string;\n}\n\n/**\n * Options for \"Get Container Versions\" API.\n */\nexport interface AzureGetVersionsOptions {\n\t/**\n\t * Max number of versions\n\t */\n\tmaxCount: number;\n}\n\n/**\n * The type of connection.\n * - \"local\" for local connections to a Fluid relay instance running on the localhost\n * - \"remote\" for client connections to the Azure Fluid Relay service\n */\nexport type AzureConnectionConfigType = \"local\" | \"remote\";\n\n/**\n * Parameters for establishing a connection with the Azure Fluid Relay.\n */\nexport interface AzureConnectionConfig {\n\t/**\n\t * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.\n\t */\n\ttype: AzureConnectionConfigType;\n\t/**\n\t * URI to the Azure Fluid Relay service discovery endpoint.\n\t */\n\tendpoint: string;\n\t/**\n\t * Instance that provides Azure Fluid Relay endpoint tokens.\n\t */\n\ttokenProvider: ITokenProvider;\n}\n\n/**\n * Parameters for establishing a remote connection with the Azure Fluid Relay.\n */\nexport interface AzureRemoteConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"remote\";\n\t/**\n\t * Unique tenant identifier.\n\t */\n\ttenantId: string;\n}\n\n/**\n * Parameters for establishing a local connection with a local instance of the Azure Fluid Relay.\n */\nexport interface AzureLocalConnectionConfig extends AzureConnectionConfig {\n\t/**\n\t * The type of connection. Set to a remote connection.\n\t */\n\ttype: \"local\";\n}\n\n/**\n * AzureContainerServices is returned by the AzureClient alongside a FluidContainer.\n * It holds the functionality specifically tied to the Azure Fluid Relay, and how the data stored in\n * the FluidContainer is persisted in the backend and consumed by users. Any functionality regarding\n * how the data is handled within the FluidContainer itself, i.e. which data objects or DDSes to use,\n * will not be included here but rather on the FluidContainer class itself.\n */\nexport interface AzureContainerServices {\n\t/**\n\t * Provides an object that can be used to get the users that are present in this Fluid session and\n\t * listeners for when the roster has any changes from users joining/leaving the session\n\t */\n\taudience: IAzureAudience;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IUser} interface to include this service-specific value. *\n *\n * @typeParam T - See {@link AzureUser.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureUser<T = any> extends IUser {\n\t/**\n\t * The user's name\n\t */\n\tname: string;\n\n\t/**\n\t * Custom, app-specific user information\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Since Azure provides user names for all of its members, we extend the\n * {@link @fluidframework/protocol-definitions#IMember} interface to include this service-specific value.\n * It will be returned for all audience members connected to Azure.\n *\n * @typeParam T - See {@link AzureMember.additionalDetails}.\n * Note: must be JSON-serializable.\n * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.\n */\n// TODO: this should be updated to use something other than `any` (unknown)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface AzureMember<T = any> extends IMember {\n\t/**\n\t * {@inheritDoc AzureUser.name}\n\t */\n\tuserName: string;\n\n\t/**\n\t * {@inheritDoc AzureUser.additionalDetails}\n\t */\n\tadditionalDetails?: T;\n}\n\n/**\n * Audience object for Azure Fluid Relay containers\n */\nexport type IAzureAudience = IServiceAudience<AzureMember>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/azure-client",
3
- "version": "2.0.0-dev.4.4.0.162574",
3
+ "version": "2.0.0-dev.5.3.2.178189",
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": {
@@ -15,36 +15,36 @@
15
15
  "module": "lib/index.js",
16
16
  "types": "dist/index.d.ts",
17
17
  "dependencies": {
18
- "@fluidframework/common-definitions": "^0.20.1",
19
18
  "@fluidframework/common-utils": "^1.1.1",
20
- "@fluidframework/container-definitions": "2.0.0-dev.4.4.0.162574",
21
- "@fluidframework/container-loader": "2.0.0-dev.4.4.0.162574",
22
- "@fluidframework/core-interfaces": "2.0.0-dev.4.4.0.162574",
23
- "@fluidframework/driver-definitions": "2.0.0-dev.4.4.0.162574",
24
- "@fluidframework/driver-utils": "2.0.0-dev.4.4.0.162574",
25
- "@fluidframework/fluid-static": "2.0.0-dev.4.4.0.162574",
26
- "@fluidframework/map": "2.0.0-dev.4.4.0.162574",
19
+ "@fluidframework/container-definitions": "2.0.0-dev.5.3.2.178189",
20
+ "@fluidframework/container-loader": "2.0.0-dev.5.3.2.178189",
21
+ "@fluidframework/core-interfaces": "2.0.0-dev.5.3.2.178189",
22
+ "@fluidframework/driver-definitions": "2.0.0-dev.5.3.2.178189",
23
+ "@fluidframework/driver-utils": "2.0.0-dev.5.3.2.178189",
24
+ "@fluidframework/fluid-static": "2.0.0-dev.5.3.2.178189",
25
+ "@fluidframework/map": "2.0.0-dev.5.3.2.178189",
27
26
  "@fluidframework/protocol-definitions": "^1.1.0",
28
- "@fluidframework/routerlicious-driver": "2.0.0-dev.4.4.0.162574",
29
- "@fluidframework/runtime-utils": "2.0.0-dev.4.4.0.162574",
27
+ "@fluidframework/routerlicious-driver": "2.0.0-dev.5.3.2.178189",
28
+ "@fluidframework/runtime-utils": "2.0.0-dev.5.3.2.178189",
30
29
  "@fluidframework/server-services-client": "^0.1038.4000",
31
- "@fluidframework/telemetry-utils": "2.0.0-dev.4.4.0.162574",
30
+ "@fluidframework/telemetry-utils": "2.0.0-dev.5.3.2.178189",
32
31
  "axios": "^0.26.0"
33
32
  },
34
33
  "devDependencies": {
35
- "@fluid-tools/build-cli": "^0.17.0",
36
- "@fluidframework/aqueduct": "2.0.0-dev.4.4.0.162574",
37
- "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0-internal.4.1.0",
38
- "@fluidframework/azure-local-service": "2.0.0-dev.4.4.0.162574",
39
- "@fluidframework/build-common": "^1.1.0",
40
- "@fluidframework/build-tools": "^0.17.0",
41
- "@fluidframework/counter": "2.0.0-dev.4.4.0.162574",
34
+ "@fluid-tools/build-cli": "^0.21.0",
35
+ "@fluidframework/aqueduct": "2.0.0-dev.5.3.2.178189",
36
+ "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0-internal.5.2.0",
37
+ "@fluidframework/azure-local-service": "2.0.0-dev.5.3.2.178189",
38
+ "@fluidframework/build-common": "^1.2.0",
39
+ "@fluidframework/build-tools": "^0.21.0",
40
+ "@fluidframework/counter": "2.0.0-dev.5.3.2.178189",
42
41
  "@fluidframework/eslint-config-fluid": "^2.0.0",
43
- "@fluidframework/test-client-utils": "2.0.0-dev.4.4.0.162574",
44
- "@fluidframework/test-utils": "2.0.0-dev.4.4.0.162574",
42
+ "@fluidframework/test-runtime-utils": "2.0.0-dev.5.3.2.178189",
43
+ "@fluidframework/test-utils": "2.0.0-dev.5.3.2.178189",
45
44
  "@microsoft/api-extractor": "^7.34.4",
46
45
  "@types/mocha": "^9.1.1",
47
46
  "@types/node": "^14.18.38",
47
+ "@types/uuid": "^8.3.0",
48
48
  "concurrently": "^7.6.0",
49
49
  "copyfiles": "^2.4.1",
50
50
  "cross-env": "^7.0.3",
@@ -55,19 +55,18 @@
55
55
  "prettier": "~2.6.2",
56
56
  "rimraf": "^4.4.0",
57
57
  "start-server-and-test": "^1.11.7",
58
- "typescript": "~4.5.5"
58
+ "typescript": "~4.5.5",
59
+ "uuid": "^8.3.1"
59
60
  },
60
61
  "typeValidation": {
61
62
  "broken": {}
62
63
  },
63
64
  "scripts": {
64
- "build": "concurrently npm:build:compile npm:lint && npm run build:docs",
65
- "build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
66
- "build:compile": "concurrently npm:build:commonjs npm:build:esnext",
65
+ "build": "fluid-build . --task build",
66
+ "build:commonjs": "fluid-build . --task commonjs",
67
+ "build:compile": "fluid-build . --task compile",
67
68
  "build:docs": "api-extractor run --local",
68
69
  "build:esnext": "tsc --project ./tsconfig.esnext.json",
69
- "build:full": "npm run build",
70
- "build:full:compile": "npm run build:compile",
71
70
  "build:test": "tsc --project ./src/test/tsconfig.json",
72
71
  "ci:build:docs": "api-extractor run",
73
72
  "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
@@ -84,6 +83,6 @@
84
83
  "test:realsvc:tinylicious": "start-server-and-test start:tinylicious:test 7070 test:realsvc:local:run",
85
84
  "tsc": "tsc",
86
85
  "typetests:gen": "fluid-type-test-generator",
87
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
86
+ "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
88
87
  }
89
88
  }
@@ -9,7 +9,7 @@ import {
9
9
  } from "@fluidframework/container-definitions";
10
10
  import { Loader } from "@fluidframework/container-loader";
11
11
  import { IDocumentServiceFactory, IUrlResolver } from "@fluidframework/driver-definitions";
12
- import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils";
12
+ import { applyStorageCompression } from "@fluidframework/driver-utils";
13
13
  import {
14
14
  ContainerSchema,
15
15
  DOProviderContainerRuntimeFactory,
@@ -65,9 +65,15 @@ export class AzureClient {
65
65
  // The local service implementation differs from the Azure Fluid Relay in blob
66
66
  // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
67
67
  const isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);
68
- this.documentServiceFactory = new RouterliciousDocumentServiceFactory(
69
- this.props.connection.tokenProvider,
70
- { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },
68
+ const origDocumentServiceFactory: IDocumentServiceFactory =
69
+ new RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, {
70
+ enableWholeSummaryUpload: isRemoteConnection,
71
+ enableDiscovery: isRemoteConnection,
72
+ });
73
+
74
+ this.documentServiceFactory = applyStorageCompression(
75
+ origDocumentServiceFactory,
76
+ props.summaryCompression,
71
77
  );
72
78
  this.configProvider = props.configProvider;
73
79
  }
@@ -252,9 +258,11 @@ export class AzureClient {
252
258
  throw new Error("Cannot attach container. Container is not in detached state");
253
259
  }
254
260
  await container.attach(createNewRequest);
255
- const resolved = container.resolvedUrl;
256
- ensureFluidResolvedUrl(resolved);
257
- return resolved.id;
261
+ if (container.resolvedUrl === undefined) {
262
+ throw new Error("Resolved Url not available on attached container");
263
+ }
264
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
265
+ return container.resolvedUrl.id;
258
266
  };
259
267
  const fluidContainer = new FluidContainer(container, rootDataObject);
260
268
  fluidContainer.attach = attach;
package/src/interfaces.ts CHANGED
@@ -2,14 +2,15 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
6
  import { IMember, IServiceAudience } from "@fluidframework/fluid-static";
7
7
  import { IUser } from "@fluidframework/protocol-definitions";
8
8
  import { ITokenProvider } from "@fluidframework/routerlicious-driver";
9
9
  import { IConfigProviderBase } from "@fluidframework/telemetry-utils";
10
+ import { ICompressionStorageConfig } from "@fluidframework/driver-utils";
10
11
 
11
- // Re-export so developers can build loggers without pulling in common-definitions
12
- export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
12
+ // Re-export so developers can build loggers without pulling in core-interfaces
13
+ export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
13
14
 
14
15
  /**
15
16
  * Props for initializing a new AzureClient instance
@@ -28,6 +29,8 @@ export interface AzureClientProps {
28
29
  * Base interface for providing configurations to control experimental features. If unsure, leave this undefined.
29
30
  */
30
31
  readonly configProvider?: IConfigProviderBase;
32
+
33
+ readonly summaryCompression?: boolean | ICompressionStorageConfig;
31
34
  }
32
35
 
33
36
  /**