@fluidframework/azure-client 2.0.0-dev-rc.3.0.0.254674 → 2.0.0-dev-rc.4.0.0.261659
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 +23 -0
- package/README.md +3 -3
- package/api-report/azure-client.api.md +5 -6
- package/beta.d.ts +11 -0
- package/dist/AzureAudience.js +5 -6
- package/dist/AzureAudience.js.map +1 -1
- package/dist/AzureClient.d.ts +9 -11
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/AzureClient.js +36 -43
- package/dist/AzureClient.js.map +1 -1
- package/dist/AzureFunctionTokenProvider.d.ts +1 -1
- package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/dist/AzureFunctionTokenProvider.js +2 -2
- package/dist/AzureFunctionTokenProvider.js.map +1 -1
- package/dist/beta.d.ts +2 -1
- package/dist/interfaces.d.ts +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/{alpha.d.ts → legacy.d.ts} +3 -2
- package/dist/public.d.ts +2 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/AzureAudience.js +5 -6
- package/lib/AzureAudience.js.map +1 -1
- package/lib/AzureClient.d.ts +9 -11
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.js +22 -29
- package/lib/AzureClient.js.map +1 -1
- package/lib/AzureFunctionTokenProvider.d.ts +1 -1
- package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/lib/AzureFunctionTokenProvider.js +2 -2
- package/lib/AzureFunctionTokenProvider.js.map +1 -1
- package/lib/beta.d.ts +2 -1
- package/lib/interfaces.d.ts +1 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/{alpha.d.ts → legacy.d.ts} +3 -2
- package/lib/public.d.ts +2 -1
- package/package.json +40 -31
- package/src/AzureAudience.ts +5 -6
- package/src/AzureClient.ts +23 -39
- package/src/AzureFunctionTokenProvider.ts +3 -3
- package/src/interfaces.ts +1 -1
package/src/AzureAudience.ts
CHANGED
|
@@ -18,8 +18,8 @@ export function createAzureAudienceMember(audienceMember: IClient): AzureMember
|
|
|
18
18
|
assertIsAzureUser(user);
|
|
19
19
|
|
|
20
20
|
return {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
id: user.id,
|
|
22
|
+
name: user.name,
|
|
23
23
|
connections: [],
|
|
24
24
|
additionalDetails: user.additionalDetails,
|
|
25
25
|
};
|
|
@@ -34,8 +34,7 @@ function assertIsAzureUser(user: IUser): asserts user is AzureUser<unknown> {
|
|
|
34
34
|
if (maybeAzureUser.id === undefined) {
|
|
35
35
|
throw new TypeError(`${baseMessage} Missing required "id" property.`);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// }
|
|
37
|
+
if (maybeAzureUser.name === undefined) {
|
|
38
|
+
throw new TypeError(`${baseMessage} Missing required "name" property.`);
|
|
39
|
+
}
|
|
41
40
|
}
|
package/src/AzureClient.ts
CHANGED
|
@@ -7,8 +7,9 @@ import { AttachState } from "@fluidframework/container-definitions";
|
|
|
7
7
|
import {
|
|
8
8
|
type IContainer,
|
|
9
9
|
type IFluidModuleWithDetails,
|
|
10
|
+
LoaderHeader,
|
|
10
11
|
} from "@fluidframework/container-definitions/internal";
|
|
11
|
-
import { Loader } from "@fluidframework/container-loader/internal";
|
|
12
|
+
import { Loader, loadContainerPaused } from "@fluidframework/container-loader/internal";
|
|
12
13
|
import { type FluidObject, type IConfigProviderBase } from "@fluidframework/core-interfaces";
|
|
13
14
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
14
15
|
import {
|
|
@@ -23,7 +24,7 @@ import {
|
|
|
23
24
|
createFluidContainer,
|
|
24
25
|
createServiceAudience,
|
|
25
26
|
} from "@fluidframework/fluid-static/internal";
|
|
26
|
-
import { type IClient
|
|
27
|
+
import { type IClient } from "@fluidframework/protocol-definitions";
|
|
27
28
|
import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver/internal";
|
|
28
29
|
import { wrapConfigProviderWithDefaults } from "@fluidframework/telemetry-utils/internal";
|
|
29
30
|
|
|
@@ -145,19 +146,16 @@ export class AzureClient {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
/**
|
|
148
|
-
*
|
|
149
|
+
* Accesses the existing container given its unique ID in the Azure Fluid Relay.
|
|
149
150
|
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
150
151
|
* (normally not explicitly specified.)
|
|
151
|
-
* @param id - Unique ID of the
|
|
152
|
+
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
152
153
|
* @param containerSchema - Container schema used to access data objects in the container.
|
|
153
|
-
* @
|
|
154
|
-
* It defaults to latest version if parameter not provided.
|
|
155
|
-
* @returns New detached container instance along with associated services.
|
|
154
|
+
* @returns Existing container instance along with associated services.
|
|
156
155
|
*/
|
|
157
|
-
public async
|
|
156
|
+
public async getContainer<TContainerSchema extends ContainerSchema>(
|
|
158
157
|
id: string,
|
|
159
158
|
containerSchema: TContainerSchema,
|
|
160
|
-
version?: AzureContainerVersion,
|
|
161
159
|
): Promise<{
|
|
162
160
|
container: IFluidContainer<TContainerSchema>;
|
|
163
161
|
services: AzureContainerServices;
|
|
@@ -170,47 +168,31 @@ export class AzureClient {
|
|
|
170
168
|
encodeURIComponent(getTenantId(this.properties.connection)),
|
|
171
169
|
);
|
|
172
170
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
throw new Error("Source container cannot resolve URL.");
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const documentService = await this.documentServiceFactory.createDocumentService(
|
|
180
|
-
sourceContainer.resolvedUrl,
|
|
181
|
-
);
|
|
182
|
-
const storage = await documentService.connectToStorage();
|
|
183
|
-
const handle = {
|
|
184
|
-
type: SummaryType.Handle,
|
|
185
|
-
handleType: SummaryType.Tree,
|
|
186
|
-
handle: version?.id ?? "latest",
|
|
187
|
-
};
|
|
188
|
-
const tree = await storage.downloadSummary(handle);
|
|
189
|
-
|
|
190
|
-
const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));
|
|
191
|
-
|
|
192
|
-
const fluidContainer = await this.createFluidContainer<TContainerSchema>(
|
|
171
|
+
const container = await loader.resolve({ url: url.href });
|
|
172
|
+
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
173
|
+
const fluidContainer = createFluidContainer<TContainerSchema>({
|
|
193
174
|
container,
|
|
194
|
-
|
|
195
|
-
);
|
|
175
|
+
rootDataObject,
|
|
176
|
+
});
|
|
196
177
|
const services = this.getContainerServices(container);
|
|
197
178
|
return { container: fluidContainer, services };
|
|
198
179
|
}
|
|
199
180
|
|
|
200
181
|
/**
|
|
201
|
-
*
|
|
182
|
+
* Load a specific version of a container for viewing only.
|
|
202
183
|
* @typeparam TContainerSchema - Used to infer the the type of 'initialObjects' in the returned container.
|
|
203
184
|
* (normally not explicitly specified.)
|
|
204
|
-
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
185
|
+
* @param id - Unique ID of the source container in Azure Fluid Relay.
|
|
205
186
|
* @param containerSchema - Container schema used to access data objects in the container.
|
|
206
|
-
* @
|
|
187
|
+
* @param version - Unique version of the source container in Azure Fluid Relay.
|
|
188
|
+
* @returns Loaded container instance at the specified version.
|
|
207
189
|
*/
|
|
208
|
-
public async
|
|
190
|
+
public async viewContainerVersion<TContainerSchema extends ContainerSchema>(
|
|
209
191
|
id: string,
|
|
210
192
|
containerSchema: TContainerSchema,
|
|
193
|
+
version: AzureContainerVersion,
|
|
211
194
|
): Promise<{
|
|
212
195
|
container: IFluidContainer<TContainerSchema>;
|
|
213
|
-
services: AzureContainerServices;
|
|
214
196
|
}> {
|
|
215
197
|
const loader = this.createLoader(containerSchema);
|
|
216
198
|
const url = new URL(this.properties.connection.endpoint);
|
|
@@ -220,14 +202,16 @@ export class AzureClient {
|
|
|
220
202
|
encodeURIComponent(getTenantId(this.properties.connection)),
|
|
221
203
|
);
|
|
222
204
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
223
|
-
const container = await loader
|
|
205
|
+
const container = await loadContainerPaused(loader, {
|
|
206
|
+
url: url.href,
|
|
207
|
+
headers: { [LoaderHeader.version]: version.id },
|
|
208
|
+
});
|
|
224
209
|
const rootDataObject = await this.getContainerEntryPoint(container);
|
|
225
210
|
const fluidContainer = createFluidContainer<TContainerSchema>({
|
|
226
211
|
container,
|
|
227
212
|
rootDataObject,
|
|
228
213
|
});
|
|
229
|
-
|
|
230
|
-
return { container: fluidContainer, services };
|
|
214
|
+
return { container: fluidContainer };
|
|
231
215
|
}
|
|
232
216
|
|
|
233
217
|
/**
|
|
@@ -25,7 +25,7 @@ export class AzureFunctionTokenProvider implements ITokenProvider {
|
|
|
25
25
|
*/
|
|
26
26
|
public constructor(
|
|
27
27
|
private readonly azFunctionUrl: string,
|
|
28
|
-
private readonly user?: Pick<AzureMember, "
|
|
28
|
+
private readonly user?: Pick<AzureMember, "id" | "name" | "additionalDetails">,
|
|
29
29
|
) {}
|
|
30
30
|
|
|
31
31
|
public async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {
|
|
@@ -45,8 +45,8 @@ export class AzureFunctionTokenProvider implements ITokenProvider {
|
|
|
45
45
|
params: {
|
|
46
46
|
tenantId,
|
|
47
47
|
documentId,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
id: this.user?.id,
|
|
49
|
+
name: this.user?.name,
|
|
50
50
|
additionalDetails: this.user?.additionalDetails as unknown,
|
|
51
51
|
},
|
|
52
52
|
});
|