@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.
- package/.eslintrc.cjs +8 -0
- package/CHANGELOG.md +12 -0
- package/api-extractor/api-extractor-lint-beta.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-beta.esm.json +5 -0
- package/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-extractor.json +1 -1
- package/api-report/{azure-client.api.md → azure-client.alpha.api.md} +15 -27
- package/api-report/azure-client.beta.api.md +110 -0
- package/api-report/azure-client.public.api.md +110 -0
- package/biome.jsonc +4 -0
- package/dist/AzureAudience.d.ts +2 -2
- package/dist/AzureAudience.d.ts.map +1 -1
- package/dist/AzureAudience.js.map +1 -1
- package/dist/AzureClient.d.ts +8 -5
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/AzureClient.js +16 -10
- package/dist/AzureClient.js.map +1 -1
- package/dist/AzureFunctionTokenProvider.d.ts +2 -2
- package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/dist/AzureFunctionTokenProvider.js.map +1 -1
- package/dist/AzureUrlResolver.d.ts +1 -1
- package/dist/AzureUrlResolver.d.ts.map +1 -1
- package/dist/AzureUrlResolver.js.map +1 -1
- package/dist/beta.d.ts +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +10 -9
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/legacy.d.ts +2 -1
- package/dist/public.d.ts +1 -1
- package/lib/AzureAudience.d.ts +2 -2
- package/lib/AzureAudience.d.ts.map +1 -1
- package/lib/AzureAudience.js.map +1 -1
- package/lib/AzureClient.d.ts +8 -5
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.js +16 -10
- package/lib/AzureClient.js.map +1 -1
- package/lib/AzureFunctionTokenProvider.d.ts +2 -2
- package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/lib/AzureFunctionTokenProvider.js.map +1 -1
- package/lib/AzureUrlResolver.d.ts +1 -1
- package/lib/AzureUrlResolver.d.ts.map +1 -1
- package/lib/AzureUrlResolver.js.map +1 -1
- package/lib/beta.d.ts +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +10 -9
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/legacy.d.ts +2 -1
- package/lib/public.d.ts +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +38 -37
- package/src/AzureAudience.ts +2 -2
- package/src/AzureClient.ts +42 -20
- package/src/AzureFunctionTokenProvider.ts +10 -4
- package/src/AzureUrlResolver.ts +11 -4
- package/src/index.ts +9 -3
- package/src/interfaces.ts +12 -11
- package/tsconfig.json +1 -0
- package/tsdoc.json +4 -0
package/src/AzureClient.ts
CHANGED
|
@@ -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 {
|
|
13
|
+
import type { FluidObject, IConfigProviderBase } from "@fluidframework/core-interfaces";
|
|
14
14
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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({
|
|
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 {
|
|
6
|
+
import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
7
7
|
import axios from "axios";
|
|
8
8
|
|
|
9
|
-
import {
|
|
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(
|
|
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(
|
|
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
|
};
|
package/src/AzureUrlResolver.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
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(
|
|
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 =
|
|
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 = (
|
|
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 {
|
|
30
|
-
export { ScopeType } from "@fluidframework/
|
|
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 {
|
|
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
|
-
|
|
8
|
-
|
|
6
|
+
import type {
|
|
7
|
+
IConfigProviderBase,
|
|
8
|
+
ITelemetryBaseLogger,
|
|
9
9
|
} from "@fluidframework/core-interfaces";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
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
|
-
*
|
|
153
|
+
* {@inheritDoc AzureMember.name}
|
|
154
|
+
*
|
|
154
155
|
*/
|
|
155
156
|
name: string;
|
|
156
157
|
|
|
157
158
|
/**
|
|
158
|
-
*
|
|
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
|
-
*
|
|
178
|
+
* The user's name
|
|
178
179
|
*/
|
|
179
180
|
name: string;
|
|
180
181
|
|
|
181
182
|
/**
|
|
182
|
-
*
|
|
183
|
+
* Custom, app-specific user information
|
|
183
184
|
*/
|
|
184
185
|
additionalDetails?: T;
|
|
185
186
|
}
|
package/tsconfig.json
CHANGED
package/tsdoc.json
ADDED