@fluidframework/azure-client 2.0.0-rc.4.0.6 → 2.0.0-rc.5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.eslintrc.cjs +8 -0
  2. package/CHANGELOG.md +12 -0
  3. package/api-extractor/api-extractor-lint-beta.cjs.json +5 -0
  4. package/api-extractor/api-extractor-lint-beta.esm.json +5 -0
  5. package/api-extractor/api-extractor-lint-bundle.json +5 -0
  6. package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
  7. package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
  8. package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
  9. package/api-extractor/api-extractor-lint-public.esm.json +5 -0
  10. package/api-extractor.json +1 -1
  11. package/api-report/{azure-client.api.md → azure-client.alpha.api.md} +15 -27
  12. package/api-report/azure-client.beta.api.md +110 -0
  13. package/api-report/azure-client.public.api.md +110 -0
  14. package/biome.jsonc +4 -0
  15. package/dist/AzureAudience.d.ts +2 -2
  16. package/dist/AzureAudience.d.ts.map +1 -1
  17. package/dist/AzureAudience.js.map +1 -1
  18. package/dist/AzureClient.d.ts +8 -5
  19. package/dist/AzureClient.d.ts.map +1 -1
  20. package/dist/AzureClient.js +16 -10
  21. package/dist/AzureClient.js.map +1 -1
  22. package/dist/AzureFunctionTokenProvider.d.ts +2 -2
  23. package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
  24. package/dist/AzureFunctionTokenProvider.js.map +1 -1
  25. package/dist/AzureUrlResolver.d.ts +1 -1
  26. package/dist/AzureUrlResolver.d.ts.map +1 -1
  27. package/dist/AzureUrlResolver.js.map +1 -1
  28. package/dist/beta.d.ts +1 -1
  29. package/dist/index.d.ts +4 -3
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -2
  32. package/dist/index.js.map +1 -1
  33. package/dist/interfaces.d.ts +10 -9
  34. package/dist/interfaces.d.ts.map +1 -1
  35. package/dist/interfaces.js.map +1 -1
  36. package/dist/legacy.d.ts +2 -1
  37. package/dist/public.d.ts +1 -1
  38. package/lib/AzureAudience.d.ts +2 -2
  39. package/lib/AzureAudience.d.ts.map +1 -1
  40. package/lib/AzureAudience.js.map +1 -1
  41. package/lib/AzureClient.d.ts +8 -5
  42. package/lib/AzureClient.d.ts.map +1 -1
  43. package/lib/AzureClient.js +16 -10
  44. package/lib/AzureClient.js.map +1 -1
  45. package/lib/AzureFunctionTokenProvider.d.ts +2 -2
  46. package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
  47. package/lib/AzureFunctionTokenProvider.js.map +1 -1
  48. package/lib/AzureUrlResolver.d.ts +1 -1
  49. package/lib/AzureUrlResolver.d.ts.map +1 -1
  50. package/lib/AzureUrlResolver.js.map +1 -1
  51. package/lib/beta.d.ts +1 -1
  52. package/lib/index.d.ts +4 -3
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +1 -1
  55. package/lib/index.js.map +1 -1
  56. package/lib/interfaces.d.ts +10 -9
  57. package/lib/interfaces.d.ts.map +1 -1
  58. package/lib/interfaces.js.map +1 -1
  59. package/lib/legacy.d.ts +2 -1
  60. package/lib/public.d.ts +1 -1
  61. package/lib/tsdoc-metadata.json +1 -1
  62. package/package.json +38 -37
  63. package/src/AzureAudience.ts +2 -2
  64. package/src/AzureClient.ts +42 -20
  65. package/src/AzureFunctionTokenProvider.ts +10 -4
  66. package/src/AzureUrlResolver.ts +11 -4
  67. package/src/index.ts +9 -3
  68. package/src/interfaces.ts +12 -11
  69. package/tsconfig.json +1 -0
  70. package/tsdoc.json +4 -0
@@ -10,32 +10,36 @@ import {
10
10
  LoaderHeader,
11
11
  } from "@fluidframework/container-definitions/internal";
12
12
  import { Loader, loadContainerPaused } from "@fluidframework/container-loader/internal";
13
- import { type FluidObject, type IConfigProviderBase } from "@fluidframework/core-interfaces";
13
+ import type { FluidObject, IConfigProviderBase } from "@fluidframework/core-interfaces";
14
14
  import { assert } from "@fluidframework/core-utils/internal";
15
- import {
16
- type IDocumentServiceFactory,
17
- type IUrlResolver,
15
+ import type { IClient } from "@fluidframework/driver-definitions";
16
+ import type {
17
+ IDocumentServiceFactory,
18
+ IUrlResolver,
18
19
  } from "@fluidframework/driver-definitions/internal";
19
20
  import { applyStorageCompression } from "@fluidframework/driver-utils/internal";
20
- import { type ContainerSchema, type IFluidContainer } from "@fluidframework/fluid-static";
21
+ import type {
22
+ ContainerSchema,
23
+ IFluidContainer,
24
+ CompatibilityMode,
25
+ } from "@fluidframework/fluid-static";
21
26
  import {
22
27
  type IRootDataObject,
23
28
  createDOProviderContainerRuntimeFactory,
24
29
  createFluidContainer,
25
30
  createServiceAudience,
26
31
  } from "@fluidframework/fluid-static/internal";
27
- import { type IClient } from "@fluidframework/protocol-definitions";
28
32
  import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver/internal";
29
33
  import { wrapConfigProviderWithDefaults } from "@fluidframework/telemetry-utils/internal";
30
34
 
31
35
  import { createAzureAudienceMember } from "./AzureAudience.js";
32
36
  import { AzureUrlResolver, createAzureCreateNewRequest } from "./AzureUrlResolver.js";
33
- import {
34
- type AzureClientProps,
35
- type AzureConnectionConfig,
36
- type AzureContainerServices,
37
- type AzureContainerVersion,
38
- type AzureGetVersionsOptions,
37
+ import type {
38
+ AzureClientProps,
39
+ AzureConnectionConfig,
40
+ AzureContainerServices,
41
+ AzureContainerVersion,
42
+ AzureGetVersionsOptions,
39
43
  } from "./interfaces.js";
40
44
  import { isAzureRemoteConnectionConfig } from "./utils.js";
41
45
 
@@ -122,15 +126,17 @@ export class AzureClient {
122
126
  * @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
123
127
  * (normally not explicitly specified.)
124
128
  * @param containerSchema - Container schema for the new container.
129
+ * @param compatibilityMode - Compatibility mode the container should run in.
125
130
  * @returns New detached container instance along with associated services.
126
131
  */
127
132
  public async createContainer<const TContainerSchema extends ContainerSchema>(
128
133
  containerSchema: TContainerSchema,
134
+ compatibilityMode: CompatibilityMode,
129
135
  ): Promise<{
130
136
  container: IFluidContainer<TContainerSchema>;
131
137
  services: AzureContainerServices;
132
138
  }> {
133
- const loader = this.createLoader(containerSchema);
139
+ const loader = this.createLoader(containerSchema, compatibilityMode);
134
140
 
135
141
  const container = await loader.createDetachedContainer({
136
142
  package: "no-dynamic-package",
@@ -151,18 +157,23 @@ export class AzureClient {
151
157
  * (normally not explicitly specified.)
152
158
  * @param id - Unique ID of the container in Azure Fluid Relay.
153
159
  * @param containerSchema - Container schema used to access data objects in the container.
160
+ * @param compatibilityMode - Compatibility mode the container should run in.
154
161
  * @returns Existing container instance along with associated services.
155
162
  */
156
163
  public async getContainer<TContainerSchema extends ContainerSchema>(
157
164
  id: string,
158
165
  containerSchema: TContainerSchema,
166
+ compatibilityMode: CompatibilityMode,
159
167
  ): Promise<{
160
168
  container: IFluidContainer<TContainerSchema>;
161
169
  services: AzureContainerServices;
162
170
  }> {
163
- const loader = this.createLoader(containerSchema);
171
+ const loader = this.createLoader(containerSchema, compatibilityMode);
164
172
  const url = new URL(this.properties.connection.endpoint);
165
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
173
+ url.searchParams.append(
174
+ "storage",
175
+ encodeURIComponent(this.properties.connection.endpoint),
176
+ );
166
177
  url.searchParams.append(
167
178
  "tenantId",
168
179
  encodeURIComponent(getTenantId(this.properties.connection)),
@@ -185,18 +196,23 @@ export class AzureClient {
185
196
  * @param id - Unique ID of the source container in Azure Fluid Relay.
186
197
  * @param containerSchema - Container schema used to access data objects in the container.
187
198
  * @param version - Unique version of the source container in Azure Fluid Relay.
199
+ * @param compatibilityMode - Compatibility mode the container should run in.
188
200
  * @returns Loaded container instance at the specified version.
189
201
  */
190
202
  public async viewContainerVersion<TContainerSchema extends ContainerSchema>(
191
203
  id: string,
192
204
  containerSchema: TContainerSchema,
193
205
  version: AzureContainerVersion,
206
+ compatibilityMode: CompatibilityMode,
194
207
  ): Promise<{
195
208
  container: IFluidContainer<TContainerSchema>;
196
209
  }> {
197
- const loader = this.createLoader(containerSchema);
210
+ const loader = this.createLoader(containerSchema, compatibilityMode);
198
211
  const url = new URL(this.properties.connection.endpoint);
199
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
212
+ url.searchParams.append(
213
+ "storage",
214
+ encodeURIComponent(this.properties.connection.endpoint),
215
+ );
200
216
  url.searchParams.append(
201
217
  "tenantId",
202
218
  encodeURIComponent(getTenantId(this.properties.connection)),
@@ -226,7 +242,10 @@ export class AzureClient {
226
242
  options?: AzureGetVersionsOptions,
227
243
  ): Promise<AzureContainerVersion[]> {
228
244
  const url = new URL(this.properties.connection.endpoint);
229
- url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
245
+ url.searchParams.append(
246
+ "storage",
247
+ encodeURIComponent(this.properties.connection.endpoint),
248
+ );
230
249
  url.searchParams.append(
231
250
  "tenantId",
232
251
  encodeURIComponent(getTenantId(this.properties.connection)),
@@ -259,8 +278,11 @@ export class AzureClient {
259
278
  };
260
279
  }
261
280
 
262
- private createLoader(schema: ContainerSchema): Loader {
263
- const runtimeFactory = createDOProviderContainerRuntimeFactory({ schema });
281
+ private createLoader(schema: ContainerSchema, compatibilityMode: CompatibilityMode): Loader {
282
+ const runtimeFactory = createDOProviderContainerRuntimeFactory({
283
+ schema,
284
+ compatibilityMode,
285
+ });
264
286
  const load = async (): Promise<IFluidModuleWithDetails> => {
265
287
  return {
266
288
  module: { fluidExport: runtimeFactory },
@@ -3,10 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { type ITokenProvider, type ITokenResponse } from "@fluidframework/routerlicious-driver";
6
+ import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
7
7
  import axios from "axios";
8
8
 
9
- import { type AzureMember } from "./interfaces.js";
9
+ import type { AzureMember } from "./interfaces.js";
10
10
 
11
11
  /**
12
12
  * Token Provider implementation for connecting to an Azure Function endpoint for
@@ -28,13 +28,19 @@ export class AzureFunctionTokenProvider implements ITokenProvider {
28
28
  private readonly user?: Pick<AzureMember, "id" | "name" | "additionalDetails">,
29
29
  ) {}
30
30
 
31
- public async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {
31
+ public async fetchOrdererToken(
32
+ tenantId: string,
33
+ documentId?: string,
34
+ ): Promise<ITokenResponse> {
32
35
  return {
33
36
  jwt: await this.getToken(tenantId, documentId),
34
37
  };
35
38
  }
36
39
 
37
- public async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {
40
+ public async fetchStorageToken(
41
+ tenantId: string,
42
+ documentId: string,
43
+ ): Promise<ITokenResponse> {
38
44
  return {
39
45
  jwt: await this.getToken(tenantId, documentId),
40
46
  };
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { type IRequest } from "@fluidframework/core-interfaces";
6
+ import type { IRequest } from "@fluidframework/core-interfaces";
7
7
  import {
8
8
  DriverHeader,
9
9
  type IResolvedUrl,
@@ -56,7 +56,10 @@ export class AzureUrlResolver implements IUrlResolver {
56
56
  };
57
57
  }
58
58
 
59
- public async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {
59
+ public async getAbsoluteUrl(
60
+ resolvedUrl: IResolvedUrl,
61
+ relativeUrl: string,
62
+ ): Promise<string> {
60
63
  if (resolvedUrl.type !== "fluid") {
61
64
  throw new Error("Invalid Resolved Url");
62
65
  }
@@ -84,7 +87,8 @@ function decodeAzureUrl(urlString: string): {
84
87
  const storageUrlDecoded = decodeURIComponent(storageUrl);
85
88
  const tenantIdDecoded = decodeURIComponent(tenantId);
86
89
  const containerId = searchParameters.get("containerId");
87
- const containerIdDecoded = containerId === null ? undefined : decodeURIComponent(containerId);
90
+ const containerIdDecoded =
91
+ containerId === null ? undefined : decodeURIComponent(containerId);
88
92
  return {
89
93
  ordererUrl,
90
94
  storageUrl: storageUrlDecoded,
@@ -100,7 +104,10 @@ function decodeAzureUrl(urlString: string): {
100
104
  * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.
101
105
  * @param tenantId - Unique tenant identifier.
102
106
  */
103
- export const createAzureCreateNewRequest = (endpointUrl: string, tenantId: string): IRequest => {
107
+ export const createAzureCreateNewRequest = (
108
+ endpointUrl: string,
109
+ tenantId: string,
110
+ ): IRequest => {
104
111
  const url = new URL(endpointUrl);
105
112
  url.searchParams.append("storage", encodeURIComponent(endpointUrl));
106
113
  url.searchParams.append("tenantId", encodeURIComponent(tenantId));
package/src/index.ts CHANGED
@@ -26,8 +26,14 @@ export type {
26
26
  } from "./interfaces.js";
27
27
 
28
28
  export type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
29
- export type { ITokenClaims, IUser } from "@fluidframework/protocol-definitions";
30
- export { ScopeType } from "@fluidframework/protocol-definitions";
29
+ export type { IUser } from "@fluidframework/driver-definitions";
30
+ export { type ITokenClaims, ScopeType } from "@fluidframework/driver-definitions/internal";
31
31
 
32
32
  // Re-export so developers can build loggers without pulling in core-interfaces
33
- export type { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
33
+ export type {
34
+ ITelemetryBaseEvent,
35
+ ITelemetryBaseLogger,
36
+ } from "@fluidframework/core-interfaces";
37
+
38
+ // Re-export so developers have access to parameter types for createContainer/getContainer without pulling in fluid-static
39
+ export type { CompatibilityMode } from "@fluidframework/fluid-static";
package/src/interfaces.ts CHANGED
@@ -3,14 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- type IConfigProviderBase,
8
- type ITelemetryBaseLogger,
6
+ import type {
7
+ IConfigProviderBase,
8
+ ITelemetryBaseLogger,
9
9
  } from "@fluidframework/core-interfaces";
10
- import { type ICompressionStorageConfig } from "@fluidframework/driver-utils";
11
- import { type IMember, type IServiceAudience } from "@fluidframework/fluid-static";
12
- import { type IUser } from "@fluidframework/protocol-definitions";
13
- import { type ITokenProvider } from "@fluidframework/routerlicious-driver";
10
+ import type { IUser } from "@fluidframework/driver-definitions";
11
+ import type { ICompressionStorageConfig } from "@fluidframework/driver-utils";
12
+ import type { IMember, IServiceAudience } from "@fluidframework/fluid-static";
13
+ import type { ITokenProvider } from "@fluidframework/routerlicious-driver";
14
14
 
15
15
  /**
16
16
  * Props for initializing a new AzureClient instance
@@ -150,12 +150,13 @@ export interface AzureContainerServices {
150
150
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
151
151
  export interface AzureUser<T = any> extends IUser {
152
152
  /**
153
- * The user's name
153
+ * {@inheritDoc AzureMember.name}
154
+ *
154
155
  */
155
156
  name: string;
156
157
 
157
158
  /**
158
- * Custom, app-specific user information
159
+ * {@inheritDoc AzureMember.additionalDetails}
159
160
  */
160
161
  additionalDetails?: T;
161
162
  }
@@ -174,12 +175,12 @@ export interface AzureUser<T = any> extends IUser {
174
175
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
175
176
  export interface AzureMember<T = any> extends IMember {
176
177
  /**
177
- * {@inheritDoc AzureUser.name}
178
+ * The user's name
178
179
  */
179
180
  name: string;
180
181
 
181
182
  /**
182
- * {@inheritDoc AzureUser.additionalDetails}
183
+ * Custom, app-specific user information
183
184
  */
184
185
  additionalDetails?: T;
185
186
  }
package/tsconfig.json CHANGED
@@ -5,5 +5,6 @@
5
5
  "compilerOptions": {
6
6
  "rootDir": "./src",
7
7
  "outDir": "./lib",
8
+ "exactOptionalPropertyTypes": false,
8
9
  },
9
10
  }
package/tsdoc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
3
+ "extends": ["../../../common/build/build-common/tsdoc-base.json"]
4
+ }