@fluidframework/azure-client 2.1.0-274160 → 2.1.0-276985
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/README.md +34 -28
- package/api-report/{azure-client.alpha.api.md → azure-client.legacy.alpha.api.md} +2 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/package.json +25 -21
- package/src/index.ts +0 -1
- package/dist/AzureFunctionTokenProvider.d.ts +0 -29
- package/dist/AzureFunctionTokenProvider.d.ts.map +0 -1
- package/dist/AzureFunctionTokenProvider.js +0 -55
- package/dist/AzureFunctionTokenProvider.js.map +0 -1
- package/lib/AzureFunctionTokenProvider.d.ts +0 -29
- package/lib/AzureFunctionTokenProvider.d.ts.map +0 -1
- package/lib/AzureFunctionTokenProvider.js +0 -48
- package/lib/AzureFunctionTokenProvider.js.map +0 -1
- package/src/AzureFunctionTokenProvider.ts +0 -61
package/README.md
CHANGED
|
@@ -9,10 +9,32 @@ The azure-client package provides a simple and powerful way to consume collabora
|
|
|
9
9
|
|
|
10
10
|
## Using Fluid Framework libraries
|
|
11
11
|
|
|
12
|
-
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
12
|
+
When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
13
13
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
14
14
|
library consumers should always prefer `^`.
|
|
15
15
|
|
|
16
|
+
If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
|
|
17
|
+
|
|
18
|
+
<!-- prettier-ignore-end -->
|
|
19
|
+
|
|
20
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
21
|
+
|
|
22
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_IMPORT_INSTRUCTIONS:includeHeading=TRUE) -->
|
|
23
|
+
|
|
24
|
+
<!-- prettier-ignore-start -->
|
|
25
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
26
|
+
|
|
27
|
+
## Importing from this package
|
|
28
|
+
|
|
29
|
+
This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
|
|
30
|
+
For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
|
|
31
|
+
|
|
32
|
+
To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/azure-client` like normal.
|
|
33
|
+
|
|
34
|
+
To access the `beta` APIs, import via `@fluidframework/azure-client/beta`.
|
|
35
|
+
|
|
36
|
+
To access the `legacy` APIs, import via `@fluidframework/azure-client/legacy`.
|
|
37
|
+
|
|
16
38
|
<!-- prettier-ignore-end -->
|
|
17
39
|
|
|
18
40
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
@@ -106,7 +128,7 @@ const schema = {
|
|
|
106
128
|
],
|
|
107
129
|
};
|
|
108
130
|
const azureClient = new AzureClient(props);
|
|
109
|
-
const { container, services } = await azureClient.createContainer(schema);
|
|
131
|
+
const { container, services } = await azureClient.createContainer(schema, "2" /* compatibilityMode */);
|
|
110
132
|
|
|
111
133
|
// Set any default data on the container's `initialObjects` before attaching
|
|
112
134
|
// Returned ID can be used to fetch the container via `getContainer` below
|
|
@@ -121,7 +143,7 @@ Using the `AzureClient` object the developer can create and get Fluid containers
|
|
|
121
143
|
import { AzureClient } from "@fluidframework/azure-client";
|
|
122
144
|
|
|
123
145
|
const azureClient = new AzureClient(props);
|
|
124
|
-
const { container, services } = await azureClient.getContainer("_unique-id_", schema);
|
|
146
|
+
const { container, services } = await azureClient.getContainer("_unique-id_", schema, "2" /* compatibilityMode */);
|
|
125
147
|
```
|
|
126
148
|
|
|
127
149
|
**Note:** When using the `AzureClient` with `tenantId` set to `"local"`, all containers that have been created will be deleted when the instance of the local Azure Fluid Relay service (not client) that was run from the terminal window is closed. However, any containers created when running against a remote Azure Fluid Relay service will be persisted. Container IDs **cannot** be reused between local and remote Azure Fluid Relay services to fetch back the same container.
|
|
@@ -143,7 +165,7 @@ const schema = {
|
|
|
143
165
|
};
|
|
144
166
|
|
|
145
167
|
// Fetch back the container that had been created earlier with the same ID and schema
|
|
146
|
-
const { container, services } = await azureClient.getContainer("_unique-id_", schema);
|
|
168
|
+
const { container, services } = await azureClient.getContainer("_unique-id_", schema, "2" /* compatibilityMode */);
|
|
147
169
|
|
|
148
170
|
// Get our list of initial objects that we had defined in the schema. initialObjects here will have the same signature
|
|
149
171
|
const initialObjects = container.initialObjects;
|
|
@@ -168,7 +190,7 @@ const schema = {
|
|
|
168
190
|
dynamicObjectTypes: [SharedString],
|
|
169
191
|
};
|
|
170
192
|
|
|
171
|
-
const { container, services } = await azureClient.getContainer("_unique-id_", schema);
|
|
193
|
+
const { container, services } = await azureClient.getContainer("_unique-id_", schema, "2" /* compatibilityMode */);
|
|
172
194
|
const map1 = container.initialObjects.map1;
|
|
173
195
|
|
|
174
196
|
const text1 = await container.create(SharedString);
|
|
@@ -184,11 +206,15 @@ const text1 = await map1.get(); // Resolve the handle to get the object
|
|
|
184
206
|
const text1 = await map1.get("text1-unique-id").get();
|
|
185
207
|
```
|
|
186
208
|
|
|
187
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
209
|
+
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE&installation=FALSE&importInstructions=FALSE) -->
|
|
188
210
|
|
|
189
211
|
<!-- prettier-ignore-start -->
|
|
190
212
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
191
213
|
|
|
214
|
+
## API Documentation
|
|
215
|
+
|
|
216
|
+
API documentation for **@fluidframework/azure-client** is available at <https://fluidframework.com/docs/apis/azure-client>.
|
|
217
|
+
|
|
192
218
|
## Contribution Guidelines
|
|
193
219
|
|
|
194
220
|
There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
|
|
@@ -207,34 +233,14 @@ This project may contain Microsoft trademarks or logos for Microsoft projects, p
|
|
|
207
233
|
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
|
|
208
234
|
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
209
235
|
|
|
210
|
-
<!-- prettier-ignore-end -->
|
|
211
|
-
|
|
212
|
-
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
213
|
-
|
|
214
|
-
<!-- AUTO-GENERATED-CONTENT:START (README_HELP_SECTION:includeHeading=TRUE) -->
|
|
215
|
-
|
|
216
|
-
<!-- prettier-ignore-start -->
|
|
217
|
-
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
218
|
-
|
|
219
236
|
## Help
|
|
220
237
|
|
|
221
|
-
Not finding what you're looking for in this README? Check out
|
|
222
|
-
Wiki](https://github.com/microsoft/FluidFramework/wiki) or [fluidframework.com](https://fluidframework.com/docs/).
|
|
238
|
+
Not finding what you're looking for in this README? Check out [fluidframework.com](https://fluidframework.com/docs/).
|
|
223
239
|
|
|
224
|
-
Still not finding what you're looking for? Please [file an
|
|
225
|
-
issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
|
|
240
|
+
Still not finding what you're looking for? Please [file an issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
|
|
226
241
|
|
|
227
242
|
Thank you!
|
|
228
243
|
|
|
229
|
-
<!-- prettier-ignore-end -->
|
|
230
|
-
|
|
231
|
-
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
232
|
-
|
|
233
|
-
<!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
|
|
234
|
-
|
|
235
|
-
<!-- prettier-ignore-start -->
|
|
236
|
-
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
237
|
-
|
|
238
244
|
## Trademark
|
|
239
245
|
|
|
240
246
|
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
export { AzureClient } from "./AzureClient.js";
|
|
11
|
-
export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider.js";
|
|
12
11
|
export type { AzureClientProps, AzureConnectionConfig, AzureConnectionConfigType, AzureContainerServices, AzureContainerVersion, AzureGetVersionsOptions, AzureLocalConnectionConfig, AzureMember, AzureRemoteConnectionConfig, AzureUser, IAzureAudience, } from "./interfaces.js";
|
|
13
12
|
export type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
14
13
|
export type { IUser } from "@fluidframework/driver-definitions";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACX,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,2BAA2B,EAC3B,SAAS,EACT,cAAc,GACd,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3F,YAAY,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAG3F,YAAY,EACX,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ScopeType = exports.
|
|
7
|
+
exports.ScopeType = exports.AzureClient = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.
|
|
10
10
|
*
|
|
@@ -12,8 +12,6 @@ exports.ScopeType = exports.AzureFunctionTokenProvider = exports.AzureClient = v
|
|
|
12
12
|
*/
|
|
13
13
|
var AzureClient_js_1 = require("./AzureClient.js");
|
|
14
14
|
Object.defineProperty(exports, "AzureClient", { enumerable: true, get: function () { return AzureClient_js_1.AzureClient; } });
|
|
15
|
-
var AzureFunctionTokenProvider_js_1 = require("./AzureFunctionTokenProvider.js");
|
|
16
|
-
Object.defineProperty(exports, "AzureFunctionTokenProvider", { enumerable: true, get: function () { return AzureFunctionTokenProvider_js_1.AzureFunctionTokenProvider; } });
|
|
17
15
|
var internal_1 = require("@fluidframework/driver-definitions/internal");
|
|
18
16
|
Object.defineProperty(exports, "ScopeType", { enumerable: true, get: function () { return internal_1.ScopeType; } });
|
|
19
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AAiBpB,wEAA2F;AAA/D,qGAAA,SAAS,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.\n *\n * @packageDocumentation\n */\n\nexport { AzureClient } from \"./AzureClient.js\";\nexport type {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureConnectionConfigType,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureMember,\n\tAzureRemoteConnectionConfig,\n\tAzureUser,\n\tIAzureAudience,\n} from \"./interfaces.js\";\n\nexport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nexport type { IUser } from \"@fluidframework/driver-definitions\";\nexport { type ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\n\n// Re-export so developers can build loggers without pulling in core-interfaces\nexport type {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\n\n// Re-export so developers have access to parameter types for createContainer/getContainer without pulling in fluid-static\nexport type { CompatibilityMode } from \"@fluidframework/fluid-static\";\n"]}
|
package/dist/legacy.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
export { AzureClient } from "./AzureClient.js";
|
|
11
|
-
export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider.js";
|
|
12
11
|
export type { AzureClientProps, AzureConnectionConfig, AzureConnectionConfigType, AzureContainerServices, AzureContainerVersion, AzureGetVersionsOptions, AzureLocalConnectionConfig, AzureMember, AzureRemoteConnectionConfig, AzureUser, IAzureAudience, } from "./interfaces.js";
|
|
13
12
|
export type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
14
13
|
export type { IUser } from "@fluidframework/driver-definitions";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACX,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,2BAA2B,EAC3B,SAAS,EACT,cAAc,GACd,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3F,YAAY,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAG3F,YAAY,EACX,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -8,6 +8,5 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
export { AzureClient } from "./AzureClient.js";
|
|
11
|
-
export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider.js";
|
|
12
11
|
export { ScopeType } from "@fluidframework/driver-definitions/internal";
|
|
13
12
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAiB/C,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.\n *\n * @packageDocumentation\n */\n\nexport { AzureClient } from \"./AzureClient.js\";\nexport type {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureConnectionConfigType,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureMember,\n\tAzureRemoteConnectionConfig,\n\tAzureUser,\n\tIAzureAudience,\n} from \"./interfaces.js\";\n\nexport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nexport type { IUser } from \"@fluidframework/driver-definitions\";\nexport { type ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\n\n// Re-export so developers can build loggers without pulling in core-interfaces\nexport type {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\n\n// Re-export so developers have access to parameter types for createContainer/getContainer without pulling in fluid-static\nexport type { CompatibilityMode } from \"@fluidframework/fluid-static\";\n"]}
|
package/lib/legacy.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/azure-client",
|
|
3
|
-
"version": "2.1.0-
|
|
3
|
+
"version": "2.1.0-276985",
|
|
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": {
|
|
@@ -57,32 +57,31 @@
|
|
|
57
57
|
"main": "lib/index.js",
|
|
58
58
|
"types": "lib/public.d.ts",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@fluidframework/container-definitions": "2.1.0-
|
|
61
|
-
"@fluidframework/container-loader": "2.1.0-
|
|
62
|
-
"@fluidframework/core-interfaces": "2.1.0-
|
|
63
|
-
"@fluidframework/core-utils": "2.1.0-
|
|
64
|
-
"@fluidframework/driver-definitions": "2.1.0-
|
|
65
|
-
"@fluidframework/driver-utils": "2.1.0-
|
|
66
|
-
"@fluidframework/fluid-static": "2.1.0-
|
|
67
|
-
"@fluidframework/map": "2.1.0-
|
|
68
|
-
"@fluidframework/routerlicious-driver": "2.1.0-
|
|
69
|
-
"@fluidframework/runtime-utils": "2.1.0-
|
|
70
|
-
"@fluidframework/telemetry-utils": "2.1.0-
|
|
71
|
-
"axios": "^1.6.2"
|
|
60
|
+
"@fluidframework/container-definitions": "2.1.0-276985",
|
|
61
|
+
"@fluidframework/container-loader": "2.1.0-276985",
|
|
62
|
+
"@fluidframework/core-interfaces": "2.1.0-276985",
|
|
63
|
+
"@fluidframework/core-utils": "2.1.0-276985",
|
|
64
|
+
"@fluidframework/driver-definitions": "2.1.0-276985",
|
|
65
|
+
"@fluidframework/driver-utils": "2.1.0-276985",
|
|
66
|
+
"@fluidframework/fluid-static": "2.1.0-276985",
|
|
67
|
+
"@fluidframework/map": "2.1.0-276985",
|
|
68
|
+
"@fluidframework/routerlicious-driver": "2.1.0-276985",
|
|
69
|
+
"@fluidframework/runtime-utils": "2.1.0-276985",
|
|
70
|
+
"@fluidframework/telemetry-utils": "2.1.0-276985"
|
|
72
71
|
},
|
|
73
72
|
"devDependencies": {
|
|
74
73
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
75
74
|
"@biomejs/biome": "^1.7.3",
|
|
76
75
|
"@fluid-tools/build-cli": "^0.39.0",
|
|
77
|
-
"@fluidframework/aqueduct": "2.1.0-
|
|
76
|
+
"@fluidframework/aqueduct": "2.1.0-276985",
|
|
78
77
|
"@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@2.0.0-rc.5.0.0",
|
|
79
|
-
"@fluidframework/azure-local-service": "2.1.0-
|
|
78
|
+
"@fluidframework/azure-local-service": "2.1.0-276985",
|
|
80
79
|
"@fluidframework/build-common": "^2.0.3",
|
|
81
80
|
"@fluidframework/build-tools": "^0.39.0",
|
|
82
81
|
"@fluidframework/eslint-config-fluid": "^5.3.0",
|
|
83
|
-
"@fluidframework/test-runtime-utils": "2.1.0-
|
|
84
|
-
"@fluidframework/test-utils": "2.1.0-
|
|
85
|
-
"@fluidframework/tree": "2.1.0-
|
|
82
|
+
"@fluidframework/test-runtime-utils": "2.1.0-276985",
|
|
83
|
+
"@fluidframework/test-utils": "2.1.0-276985",
|
|
84
|
+
"@fluidframework/tree": "2.1.0-276985",
|
|
86
85
|
"@microsoft/api-extractor": "^7.45.1",
|
|
87
86
|
"@types/mocha": "^9.1.1",
|
|
88
87
|
"@types/node": "^18.19.0",
|
|
@@ -100,12 +99,17 @@
|
|
|
100
99
|
"uuid": "^9.0.0"
|
|
101
100
|
},
|
|
102
101
|
"typeValidation": {
|
|
103
|
-
"broken": {
|
|
102
|
+
"broken": {
|
|
103
|
+
"RemovedClassDeclaration_AzureFunctionTokenProvider": {
|
|
104
|
+
"backCompat": false,
|
|
105
|
+
"forwardCompat": false
|
|
106
|
+
}
|
|
107
|
+
}
|
|
104
108
|
},
|
|
105
109
|
"scripts": {
|
|
106
110
|
"api": "fluid-build . --task api",
|
|
107
|
-
"api-extractor:commonjs": "flub generate entrypoints --
|
|
108
|
-
"api-extractor:esnext": "flub generate entrypoints --
|
|
111
|
+
"api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
|
|
112
|
+
"api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
|
|
109
113
|
"build": "fluid-build . --task build",
|
|
110
114
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
111
115
|
"build:compile": "fluid-build . --task compile",
|
package/src/index.ts
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
6
|
-
import type { AzureMember } from "./interfaces.js";
|
|
7
|
-
/**
|
|
8
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
9
|
-
* Azure Fluid Relay token resolution.
|
|
10
|
-
*
|
|
11
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
12
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
13
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare class AzureFunctionTokenProvider implements ITokenProvider {
|
|
17
|
-
private readonly azFunctionUrl;
|
|
18
|
-
private readonly user?;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new instance using configuration parameters.
|
|
21
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
22
|
-
* @param user - User object
|
|
23
|
-
*/
|
|
24
|
-
constructor(azFunctionUrl: string, user?: Pick<AzureMember<any>, "name" | "id" | "additionalDetails"> | undefined);
|
|
25
|
-
fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
|
|
26
|
-
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
|
|
27
|
-
private getToken;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=AzureFunctionTokenProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAG3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,cAAc;IAO/D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAPvB;;;;OAIG;gBAEe,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,yEAAwD;IAGlE,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAMb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;YAMZ,QAAQ;CAYtB"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AzureFunctionTokenProvider = void 0;
|
|
11
|
-
const axios_1 = __importDefault(require("axios"));
|
|
12
|
-
/**
|
|
13
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
14
|
-
* Azure Fluid Relay token resolution.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
17
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
18
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
class AzureFunctionTokenProvider {
|
|
22
|
-
/**
|
|
23
|
-
* Creates a new instance using configuration parameters.
|
|
24
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
25
|
-
* @param user - User object
|
|
26
|
-
*/
|
|
27
|
-
constructor(azFunctionUrl, user) {
|
|
28
|
-
this.azFunctionUrl = azFunctionUrl;
|
|
29
|
-
this.user = user;
|
|
30
|
-
}
|
|
31
|
-
async fetchOrdererToken(tenantId, documentId) {
|
|
32
|
-
return {
|
|
33
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
async fetchStorageToken(tenantId, documentId) {
|
|
37
|
-
return {
|
|
38
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
async getToken(tenantId, documentId) {
|
|
42
|
-
const response = await axios_1.default.get(this.azFunctionUrl, {
|
|
43
|
-
params: {
|
|
44
|
-
tenantId,
|
|
45
|
-
documentId,
|
|
46
|
-
id: this.user?.id,
|
|
47
|
-
name: this.user?.name,
|
|
48
|
-
additionalDetails: this.user?.additionalDetails,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
return response.data;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.AzureFunctionTokenProvider = AzureFunctionTokenProvider;
|
|
55
|
-
//# sourceMappingURL=AzureFunctionTokenProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAGH,kDAA0B;AAI1B;;;;;;;;GAQG;AACH,MAAa,0BAA0B;IACtC;;;;OAIG;IACH,YACkB,aAAqB,EACrB,IAA6D;QAD7D,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAyD;IAC5E,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAmB;QAEnB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAkB;QAElB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,UAAmB;QAC3D,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;YACpD,MAAM,EAAE;gBACP,QAAQ;gBACR,UAAU;gBACV,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI;gBACrB,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,iBAA4B;aAC1D;SACD,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IAChC,CAAC;CACD;AAzCD,gEAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport axios from \"axios\";\n\nimport type { AzureMember } from \"./interfaces.js\";\n\n/**\n * Token Provider implementation for connecting to an Azure Function endpoint for\n * Azure Fluid Relay token resolution.\n *\n * @deprecated 1.2.0, This API will be removed in 2.0.0\n * No replacement since it is not expected anyone will use this token provider as is\n * See https://github.com/microsoft/FluidFramework/issues/13693 for context\n * @internal\n */\nexport class AzureFunctionTokenProvider implements ITokenProvider {\n\t/**\n\t * Creates a new instance using configuration parameters.\n\t * @param azFunctionUrl - URL to Azure Function endpoint\n\t * @param user - User object\n\t */\n\tpublic constructor(\n\t\tprivate readonly azFunctionUrl: string,\n\t\tprivate readonly user?: Pick<AzureMember, \"id\" | \"name\" | \"additionalDetails\">,\n\t) {}\n\n\tpublic async fetchOrdererToken(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate async getToken(tenantId: string, documentId?: string): Promise<string> {\n\t\tconst response = await axios.get(this.azFunctionUrl, {\n\t\t\tparams: {\n\t\t\t\ttenantId,\n\t\t\t\tdocumentId,\n\t\t\t\tid: this.user?.id,\n\t\t\t\tname: this.user?.name,\n\t\t\t\tadditionalDetails: this.user?.additionalDetails as unknown,\n\t\t\t},\n\t\t});\n\t\treturn response.data as string;\n\t}\n}\n"]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
6
|
-
import type { AzureMember } from "./interfaces.js";
|
|
7
|
-
/**
|
|
8
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
9
|
-
* Azure Fluid Relay token resolution.
|
|
10
|
-
*
|
|
11
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
12
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
13
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare class AzureFunctionTokenProvider implements ITokenProvider {
|
|
17
|
-
private readonly azFunctionUrl;
|
|
18
|
-
private readonly user?;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new instance using configuration parameters.
|
|
21
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
22
|
-
* @param user - User object
|
|
23
|
-
*/
|
|
24
|
-
constructor(azFunctionUrl: string, user?: Pick<AzureMember<any>, "name" | "id" | "additionalDetails"> | undefined);
|
|
25
|
-
fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
|
|
26
|
-
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
|
|
27
|
-
private getToken;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=AzureFunctionTokenProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAG3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,cAAc;IAO/D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAPvB;;;;OAIG;gBAEe,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,yEAAwD;IAGlE,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAMb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;YAMZ,QAAQ;CAYtB"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import axios from "axios";
|
|
6
|
-
/**
|
|
7
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
8
|
-
* Azure Fluid Relay token resolution.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
11
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
12
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export class AzureFunctionTokenProvider {
|
|
16
|
-
/**
|
|
17
|
-
* Creates a new instance using configuration parameters.
|
|
18
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
19
|
-
* @param user - User object
|
|
20
|
-
*/
|
|
21
|
-
constructor(azFunctionUrl, user) {
|
|
22
|
-
this.azFunctionUrl = azFunctionUrl;
|
|
23
|
-
this.user = user;
|
|
24
|
-
}
|
|
25
|
-
async fetchOrdererToken(tenantId, documentId) {
|
|
26
|
-
return {
|
|
27
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
async fetchStorageToken(tenantId, documentId) {
|
|
31
|
-
return {
|
|
32
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
async getToken(tenantId, documentId) {
|
|
36
|
-
const response = await axios.get(this.azFunctionUrl, {
|
|
37
|
-
params: {
|
|
38
|
-
tenantId,
|
|
39
|
-
documentId,
|
|
40
|
-
id: this.user?.id,
|
|
41
|
-
name: this.user?.name,
|
|
42
|
-
additionalDetails: this.user?.additionalDetails,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
return response.data;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=AzureFunctionTokenProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA0B;IACtC;;;;OAIG;IACH,YACkB,aAAqB,EACrB,IAA6D;QAD7D,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAyD;IAC5E,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAmB;QAEnB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAkB;QAElB,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,UAAmB;QAC3D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;YACpD,MAAM,EAAE;gBACP,QAAQ;gBACR,UAAU;gBACV,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI;gBACrB,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,iBAA4B;aAC1D;SACD,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IAChC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport axios from \"axios\";\n\nimport type { AzureMember } from \"./interfaces.js\";\n\n/**\n * Token Provider implementation for connecting to an Azure Function endpoint for\n * Azure Fluid Relay token resolution.\n *\n * @deprecated 1.2.0, This API will be removed in 2.0.0\n * No replacement since it is not expected anyone will use this token provider as is\n * See https://github.com/microsoft/FluidFramework/issues/13693 for context\n * @internal\n */\nexport class AzureFunctionTokenProvider implements ITokenProvider {\n\t/**\n\t * Creates a new instance using configuration parameters.\n\t * @param azFunctionUrl - URL to Azure Function endpoint\n\t * @param user - User object\n\t */\n\tpublic constructor(\n\t\tprivate readonly azFunctionUrl: string,\n\t\tprivate readonly user?: Pick<AzureMember, \"id\" | \"name\" | \"additionalDetails\">,\n\t) {}\n\n\tpublic async fetchOrdererToken(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate async getToken(tenantId: string, documentId?: string): Promise<string> {\n\t\tconst response = await axios.get(this.azFunctionUrl, {\n\t\t\tparams: {\n\t\t\t\ttenantId,\n\t\t\t\tdocumentId,\n\t\t\t\tid: this.user?.id,\n\t\t\t\tname: this.user?.name,\n\t\t\t\tadditionalDetails: this.user?.additionalDetails as unknown,\n\t\t\t},\n\t\t});\n\t\treturn response.data as string;\n\t}\n}\n"]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
7
|
-
import axios from "axios";
|
|
8
|
-
|
|
9
|
-
import type { AzureMember } from "./interfaces.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
13
|
-
* Azure Fluid Relay token resolution.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
16
|
-
* No replacement since it is not expected anyone will use this token provider as is
|
|
17
|
-
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export class AzureFunctionTokenProvider implements ITokenProvider {
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new instance using configuration parameters.
|
|
23
|
-
* @param azFunctionUrl - URL to Azure Function endpoint
|
|
24
|
-
* @param user - User object
|
|
25
|
-
*/
|
|
26
|
-
public constructor(
|
|
27
|
-
private readonly azFunctionUrl: string,
|
|
28
|
-
private readonly user?: Pick<AzureMember, "id" | "name" | "additionalDetails">,
|
|
29
|
-
) {}
|
|
30
|
-
|
|
31
|
-
public async fetchOrdererToken(
|
|
32
|
-
tenantId: string,
|
|
33
|
-
documentId?: string,
|
|
34
|
-
): Promise<ITokenResponse> {
|
|
35
|
-
return {
|
|
36
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public async fetchStorageToken(
|
|
41
|
-
tenantId: string,
|
|
42
|
-
documentId: string,
|
|
43
|
-
): Promise<ITokenResponse> {
|
|
44
|
-
return {
|
|
45
|
-
jwt: await this.getToken(tenantId, documentId),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private async getToken(tenantId: string, documentId?: string): Promise<string> {
|
|
50
|
-
const response = await axios.get(this.azFunctionUrl, {
|
|
51
|
-
params: {
|
|
52
|
-
tenantId,
|
|
53
|
-
documentId,
|
|
54
|
-
id: this.user?.id,
|
|
55
|
-
name: this.user?.name,
|
|
56
|
-
additionalDetails: this.user?.additionalDetails as unknown,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
return response.data as string;
|
|
60
|
-
}
|
|
61
|
-
}
|