@fluidframework/azure-client 1.2.0-106934 → 1.2.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 (59) hide show
  1. package/.eslintrc.js +5 -37
  2. package/.prettierignore +5 -0
  3. package/README.md +88 -29
  4. package/api-extractor.json +10 -10
  5. package/dist/AzureAudience.d.ts.map +1 -1
  6. package/dist/AzureAudience.js.map +1 -1
  7. package/dist/AzureClient.d.ts.map +1 -1
  8. package/dist/AzureClient.js.map +1 -1
  9. package/dist/AzureFunctionTokenProvider.d.ts +4 -0
  10. package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
  11. package/dist/AzureFunctionTokenProvider.js +4 -0
  12. package/dist/AzureFunctionTokenProvider.js.map +1 -1
  13. package/dist/AzureUrlResolver.d.ts +7 -0
  14. package/dist/AzureUrlResolver.d.ts.map +1 -1
  15. package/dist/AzureUrlResolver.js +7 -0
  16. package/dist/AzureUrlResolver.js.map +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/interfaces.d.ts.map +1 -1
  20. package/dist/interfaces.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.d.ts.map +1 -1
  23. package/dist/packageVersion.js +1 -1
  24. package/dist/packageVersion.js.map +1 -1
  25. package/dist/utils.d.ts.map +1 -1
  26. package/dist/utils.js.map +1 -1
  27. package/lib/AzureAudience.d.ts.map +1 -1
  28. package/lib/AzureAudience.js.map +1 -1
  29. package/lib/AzureClient.d.ts.map +1 -1
  30. package/lib/AzureClient.js.map +1 -1
  31. package/lib/AzureFunctionTokenProvider.d.ts +4 -0
  32. package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
  33. package/lib/AzureFunctionTokenProvider.js +4 -0
  34. package/lib/AzureFunctionTokenProvider.js.map +1 -1
  35. package/lib/AzureUrlResolver.d.ts +7 -0
  36. package/lib/AzureUrlResolver.d.ts.map +1 -1
  37. package/lib/AzureUrlResolver.js +7 -0
  38. package/lib/AzureUrlResolver.js.map +1 -1
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js.map +1 -1
  41. package/lib/interfaces.d.ts.map +1 -1
  42. package/lib/interfaces.js.map +1 -1
  43. package/lib/packageVersion.d.ts +1 -1
  44. package/lib/packageVersion.d.ts.map +1 -1
  45. package/lib/packageVersion.js +1 -1
  46. package/lib/packageVersion.js.map +1 -1
  47. package/lib/utils.d.ts.map +1 -1
  48. package/lib/utils.js.map +1 -1
  49. package/package.json +92 -97
  50. package/src/AzureAudience.ts +19 -19
  51. package/src/AzureClient.ts +203 -203
  52. package/src/AzureFunctionTokenProvider.ts +35 -31
  53. package/src/AzureUrlResolver.ts +87 -80
  54. package/src/index.ts +13 -13
  55. package/src/interfaces.ts +66 -66
  56. package/src/packageVersion.ts +1 -1
  57. package/src/utils.ts +7 -7
  58. package/tsconfig.esnext.json +5 -5
  59. package/tsconfig.json +9 -9
package/.eslintrc.js CHANGED
@@ -4,41 +4,9 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
8
- plugins: ["eslint-plugin-jsdoc"],
9
- parserOptions: {
10
- project: ["./tsconfig.json", "./src/test/tsconfig.json"],
11
- },
12
- rules: {
13
- // Require jsdoc/tsdoc comments on public/exported API items.
14
- "jsdoc/require-jsdoc": [
15
- "error",
16
- {
17
- // Indicates that only module exports should be flagged for lacking jsdoc comments
18
- publicOnly: true,
19
- enableFixer: false, // Prevents eslint from adding empty comment blocks when run with `--fix`
20
- require: {
21
- ClassDeclaration: true,
22
- FunctionDeclaration: true,
23
-
24
- // Will report for *any* methods on exported classes, regardless of whether or not they are public
25
- MethodDefinition: false,
26
- },
27
- contexts: ["TSEnumDeclaration", "TSInterfaceDeclaration", "TSTypeAliasDeclaration"],
28
- },
29
- ],
30
-
31
- // Ensure jsdoc/tsdoc comments contain a main description component
32
- // (disallows empty comments / only tags).
33
- "jsdoc/require-description": ["error", { checkConstructors: false }],
34
- },
35
- overrides: [
36
- {
37
- files: ["packageVersion.ts"],
38
- rules: {
39
- "jsdoc/require-jsdoc": "off",
40
- "jsdoc/require-description": "off",
41
- },
42
- },
43
- ],
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
8
+ plugins: ["eslint-plugin-jsdoc"],
9
+ parserOptions: {
10
+ project: ["./tsconfig.json", "./src/test/tsconfig.json"],
11
+ },
44
12
  };
@@ -0,0 +1,5 @@
1
+ _api-extractor-temp
2
+ dist
3
+ lib
4
+ node_modules
5
+ src/**/test/types/
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  The azure-client package provides a simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay service.
4
4
 
5
+ See [GitHub](https://github.com/microsoft/FluidFramework) for more details on the Fluid Framework and packages within.
6
+
5
7
  ## Using azure-client
6
8
 
7
9
  The azure-client package has a `AzureClient` class that allows you to interact with Fluid.
@@ -33,11 +35,11 @@ import { AzureClient, AzureConnectionConfig } from "@fluidframework/azure-client
33
35
  import { InsecureTokenProvider } from "@fluidframework/test-client-utils";
34
36
 
35
37
  const clientProps = {
36
- connection: {
37
- type: "local",
38
- tokenProvider: new InsecureTokenProvider("fooBar", { id: "123", name: "Test User" }),
39
- endpoint: "http://localhost:7070",
40
- },
38
+ connection: {
39
+ type: "local",
40
+ tokenProvider: new InsecureTokenProvider("fooBar", { id: "123", name: "Test User" }),
41
+ endpoint: "http://localhost:7070",
42
+ },
41
43
  };
42
44
  const azureClient = new AzureClient(clientProps);
43
45
  ```
@@ -50,15 +52,15 @@ When running against a live Azure Fluid Relay instance, we can use the same inte
50
52
  import { AzureClient, AzureConnectionConfig } from "@fluidframework/azure-client";
51
53
 
52
54
  const clientProps = {
53
- connection: {
54
- type: "remote",
55
- tenantId: "YOUR-TENANT-ID-HERE",
56
- tokenProvider: new AzureFunctionTokenProvider("AZURE-FUNCTION-URL" + "/api/GetAzureToken", {
57
- userId: "test-user",
58
- userName: "Test User",
59
- }),
60
- endpoint: "ENTER-SERVICE-DISCOVERY-URL-HERE",
61
- },
55
+ connection: {
56
+ type: "remote",
57
+ tenantId: "YOUR-TENANT-ID-HERE",
58
+ tokenProvider: new AzureFunctionTokenProvider("AZURE-FUNCTION-URL" + "/api/GetAzureToken", {
59
+ userId: "test-user",
60
+ userName: "Test User",
61
+ }),
62
+ endpoint: "ENTER-SERVICE-DISCOVERY-URL-HERE",
63
+ },
62
64
  };
63
65
  const azureClient = new AzureClient(clientProps);
64
66
  ```
@@ -77,12 +79,12 @@ See [`ContainerSchema`](./src/types.ts) in [`./src/types/ts`](./src/types.ts) fo
77
79
 
78
80
  ```typescript
79
81
  const schema = {
80
- initialObjects: {
81
- /* ... */
82
- },
83
- dynamicObjectTypes: [
84
- /*...*/
85
- ],
82
+ initialObjects: {
83
+ /* ... */
84
+ },
85
+ dynamicObjectTypes: [
86
+ /*...*/
87
+ ],
86
88
  };
87
89
  const azureClient = new AzureClient(props);
88
90
  const { container, services } = await azureClient.createContainer(schema);
@@ -115,10 +117,10 @@ The most common way to use Fluid is through initial collaborative objects that a
115
117
  // Define the keys and types of the initial list of collaborative objects.
116
118
  // Here, we are using a SharedMap DDS on key "map1" and a SharedString on key "text1".
117
119
  const schema = {
118
- initialObjects: {
119
- map1: SharedMap,
120
- text1: SharedString,
121
- },
120
+ initialObjects: {
121
+ map1: SharedMap,
122
+ text1: SharedString,
123
+ },
122
124
  };
123
125
 
124
126
  // Fetch back the container that had been created earlier with the same ID and schema
@@ -141,10 +143,10 @@ Dynamic objects are loaded on-demand to optimize for data virtualization. To get
141
143
 
142
144
  ```typescript
143
145
  const schema = {
144
- initialObjects: {
145
- map1: SharedMap,
146
- },
147
- dynamicObjectTypes: [SharedString],
146
+ initialObjects: {
147
+ map1: SharedMap,
148
+ },
149
+ dynamicObjectTypes: [SharedString],
148
150
  };
149
151
 
150
152
  const { container, services } = await azureClient.getContainer("_unique-id_", schema);
@@ -163,4 +165,61 @@ const text1 = await map1.get(); // Resolve the handle to get the object
163
165
  const text1 = await map1.get("text1-unique-id").get();
164
166
  ```
165
167
 
166
- See [GitHub](https://github.com/microsoft/FluidFramework) for more details on the Fluid Framework and packages within.
168
+ <!-- AUTO-GENERATED-CONTENT:START (README_CONTRIBUTION_GUIDELINES_SECTION:includeHeading=TRUE) -->
169
+
170
+ <!-- prettier-ignore-start -->
171
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
172
+
173
+ ## Contribution Guidelines
174
+
175
+ There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
176
+
177
+ - Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
178
+ - [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
179
+ - Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
180
+ - [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
181
+
182
+ Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki).
183
+
184
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
185
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
186
+
187
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
188
+ Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
189
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
190
+
191
+ <!-- prettier-ignore-end -->
192
+
193
+ <!-- AUTO-GENERATED-CONTENT:END -->
194
+
195
+ <!-- AUTO-GENERATED-CONTENT:START (README_HELP_SECTION:includeHeading=TRUE) -->
196
+
197
+ <!-- prettier-ignore-start -->
198
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
199
+
200
+ ## Help
201
+
202
+ Not finding what you're looking for in this README?
203
+ Check out our [GitHub Wiki](https://github.com/microsoft/FluidFramework/wiki) or [fluidframework.com](https://fluidframework.com/docs/).
204
+
205
+ Still not finding what you're looking for? Please [file an issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
206
+ Thank you!
207
+
208
+ <!-- prettier-ignore-end -->
209
+
210
+ <!-- AUTO-GENERATED-CONTENT:END -->
211
+
212
+ <!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
213
+
214
+ <!-- prettier-ignore-start -->
215
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
216
+
217
+ ## Trademark
218
+
219
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
220
+ Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
221
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
222
+
223
+ <!-- prettier-ignore-end -->
224
+
225
+ <!-- AUTO-GENERATED-CONTENT:END -->
@@ -1,12 +1,12 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "@fluidframework/build-common/api-extractor-common-strict.json",
4
- "apiReport": {
5
- "enabled": true,
6
- "reportFolder": "<projectFolder>/../../../api-report/"
7
- },
8
- "docModel": {
9
- "enabled": true,
10
- "apiJsonFilePath": "<projectFolder>/../../_api-extractor-temp/doc-models/<unscopedPackageName>.api.json"
11
- }
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "@fluidframework/build-common/api-extractor-common-strict.json",
4
+ "apiReport": {
5
+ "enabled": true,
6
+ "reportFolder": "<projectFolder>/../../../api-report/"
7
+ },
8
+ "docModel": {
9
+ "enabled": true,
10
+ "apiJsonFilePath": "<projectFolder>/../../_api-extractor-temp/doc-models/<unscopedPackageName>.api.json"
11
+ }
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAa,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACrF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAWtE"}
1
+ {"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAa,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACxF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAWnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"AzureAudience.js","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAsD;AACtD,+DAA+D;AAK/D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,8BAA4B;IAC3D;;;;;;;;OAQG;IACO,mBAAmB,CAAC,cAAuB;QACjD,MAAM,SAAS,GAAG,cAAc,CAAC,IAAiB,CAAC;QACnD,IAAA,qBAAM,EAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,SAAS,EAAE,uCAAuC,CAAC,CAAC;QAE/E,OAAO;YACH,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE;YAC9B,QAAQ,EAAE,SAAS,CAAC,IAAI;YACxB,WAAW,EAAE,EAAE;YACf,iBAAiB,EAAE,SAAS,CAAC,iBAA4B;SAC5D,CAAC;IACN,CAAC;CACJ;AArBD,sCAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\nimport { AzureMember, AzureUser, IAzureAudience } from \"./interfaces\";\n\n/**\n * Azure-specific {@link @fluidframework/fluid-static#ServiceAudience} implementation.\n *\n * @remarks Operates in terms of {@link AzureMember}s.\n */\nexport class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {\n /**\n * Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided\n * {@link @fluidframework/protocol-definitions#IClient | audience member}.\n *\n * @param audienceMember - Audience member for which the `ServiceAudience` will be generated.\n * Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.\n *\n * @internal\n */\n protected createServiceMember(audienceMember: IClient): AzureMember {\n const azureUser = audienceMember.user as AzureUser;\n assert(azureUser?.name !== undefined, 'Provided user was not an \"AzureUser\".');\n\n return {\n userId: audienceMember.user.id,\n userName: azureUser.name,\n connections: [],\n additionalDetails: azureUser.additionalDetails as unknown,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"AzureAudience.js","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAsD;AACtD,+DAA+D;AAK/D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,8BAA4B;IAC9D;;;;;;;;OAQG;IACO,mBAAmB,CAAC,cAAuB;QACpD,MAAM,SAAS,GAAG,cAAc,CAAC,IAAiB,CAAC;QACnD,IAAA,qBAAM,EAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,SAAS,EAAE,uCAAuC,CAAC,CAAC;QAE/E,OAAO;YACN,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE;YAC9B,QAAQ,EAAE,SAAS,CAAC,IAAI;YACxB,WAAW,EAAE,EAAE;YACf,iBAAiB,EAAE,SAAS,CAAC,iBAA4B;SACzD,CAAC;IACH,CAAC;CACD;AArBD,sCAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\nimport { AzureMember, AzureUser, IAzureAudience } from \"./interfaces\";\n\n/**\n * Azure-specific {@link @fluidframework/fluid-static#ServiceAudience} implementation.\n *\n * @remarks Operates in terms of {@link AzureMember}s.\n */\nexport class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {\n\t/**\n\t * Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided\n\t * {@link @fluidframework/protocol-definitions#IClient | audience member}.\n\t *\n\t * @param audienceMember - Audience member for which the `ServiceAudience` will be generated.\n\t * Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.\n\t *\n\t * @internal\n\t */\n\tprotected createServiceMember(audienceMember: IClient): AzureMember {\n\t\tconst azureUser = audienceMember.user as AzureUser;\n\t\tassert(azureUser?.name !== undefined, 'Provided user was not an \"AzureUser\".');\n\n\t\treturn {\n\t\t\tuserId: audienceMember.user.id,\n\t\t\tuserName: azureUser.name,\n\t\t\tconnections: [],\n\t\t\tadditionalDetails: azureUser.additionalDetails as unknown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","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAYA,OAAO,EACN,eAAe,EAGf,eAAe,EAEf,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EACN,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,MAAM,cAAc,CAAC;AAetB;;;GAGG;AACH,qBAAa,WAAW;IAQJ,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPzC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAE3C;;;OAGG;gBACiC,KAAK,EAAE,gBAAgB;IAa3D;;;;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,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;YA6BN,oBAAoB;CA4BlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;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AI,CAAC,sBAAsB;YACnD,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACzB,OAAO,EAAE,EAAE,MAAM,EAAE;SACtB,CAAC,CAAC;IACP,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAC9B,SAAqB,EACrB,UAAiC;QAEjC,MAAM,gBAAgB,GAAG,IAAA,8CAA2B,EAChD,UAAU,CAAC,QAAQ,EACnB,WAAW,CAAC,UAAU,CAAC,CAC1B,CAAC;QAEF,MAAM,cAAc,GAAG,MAAM,IAAA,kCAAkB,EAAiB,SAAS,EAAE,GAAG,CAAC,CAAC;QAEhF;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YACvC,IAAI,SAAS,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE;gBAChD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAClF;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC;YACvC,IAAA,qCAAsB,EAAC,QAAQ,CAAC,CAAC;YACjC,OAAO,QAAQ,CAAC,EAAE,CAAC;QACvB,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;IAC1B,CAAC;CAEJ;AAjND,kCAiNC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n AttachState,\n IContainer,\n IFluidModuleWithDetails,\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 ContainerSchema,\n DOProviderContainerRuntimeFactory,\n FluidContainer,\n IFluidContainer,\n RootDataObject,\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 { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n AzureClientProps,\n AzureConnectionConfig,\n AzureContainerServices,\n AzureContainerVersion,\n AzureGetVersionsOptions,\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 return isAzureRemoteConnectionConfig(connectionProps)\n ? connectionProps.tenantId\n : 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 private readonly documentServiceFactory: IDocumentServiceFactory;\n private readonly urlResolver: IUrlResolver;\n\n /**\n * Creates a new client instance using configuration parameters.\n * @param props - Properties for initializing a new AzureClient instance\n */\n constructor(private readonly props: AzureClientProps) {\n // remove trailing slash from URL if any\n props.connection.endpoint = props.connection.endpoint.replace(/\\/$/, \"\");\n this.urlResolver = new AzureUrlResolver();\n // The local service implementation differs from the Azure Fluid Relay in blob\n // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n const isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);\n this.documentServiceFactory = new RouterliciousDocumentServiceFactory(\n this.props.connection.tokenProvider,\n { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },\n );\n }\n\n /**\n * Creates a new detached container instance in the Azure Fluid Relay.\n * @param containerSchema - Container schema for the new container.\n * @returns New detached container instance along with associated services.\n */\n public async createContainer(containerSchema: ContainerSchema): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n\n const container = await loader.createDetachedContainer({\n package: \"no-dynamic-package\",\n config: {},\n });\n\n const fluidContainer = await this.createFluidContainer(container, this.props.connection);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Creates new detached container out of specific version of another container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @param version - Unique version of the source container in Azure Fluid Relay.\n * It defaults to latest version if parameter not provided.\n * @returns New detached container instance along with associated services.\n */\n public async copyContainer(\n id: string,\n containerSchema: ContainerSchema,\n version?: AzureContainerVersion,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const sourceContainer = await loader.resolve({ url: url.href });\n\n if (sourceContainer.resolvedUrl === undefined) {\n throw new Error(\"Source container cannot resolve URL.\");\n }\n\n const documentService = await this.documentServiceFactory.createDocumentService(\n sourceContainer.resolvedUrl,\n );\n const storage = await documentService.connectToStorage();\n const handle = {\n type: SummaryType.Handle,\n handleType: SummaryType.Tree,\n handle: version?.id ?? \"latest\",\n };\n const tree = await storage.downloadSummary(handle);\n\n const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\n\n const fluidContainer = await this.createFluidContainer(container, this.props.connection);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n * @param id - Unique ID of the container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @returns Existing container instance along with associated services.\n */\n public async getContainer(\n id: string,\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const container = await loader.resolve({ url: url.href });\n const rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n const fluidContainer = new FluidContainer(container, rootDataObject);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Get the list of versions for specific container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param options - \"Get\" options. If options are not provided, API\n * will assume maxCount of versions to retreive to be 5.\n * @returns Array of available container versions.\n */\n public async getContainerVersions(\n id: string,\n options?: AzureGetVersionsOptions,\n ): Promise<AzureContainerVersion[]> {\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n const resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n if (!resolvedUrl) {\n throw new Error(\"Unable to resolved URL\");\n }\n const documentService = await this.documentServiceFactory.createDocumentService(\n resolvedUrl,\n );\n const storage = await documentService.connectToStorage();\n\n // External API uses null\n // eslint-disable-next-line unicorn/no-null\n const versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n return versions.map((item) => {\n return { id: item.id, date: item.date };\n });\n }\n\n private getContainerServices(container: IContainer): AzureContainerServices {\n return {\n audience: new AzureAudience(container),\n };\n }\n\n private createLoader(containerSchema: ContainerSchema): Loader {\n const runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);\n const load = async (): Promise<IFluidModuleWithDetails> => {\n return {\n module: { fluidExport: runtimeFactory },\n details: { package: \"no-dynamic-package\", config: {} },\n };\n };\n\n const codeLoader = { load };\n const client: IClient = {\n details: {\n capabilities: { interactive: true },\n },\n permission: [],\n scopes: [],\n user: { id: \"\" },\n mode: \"write\",\n };\n\n return new Loader({\n urlResolver: this.urlResolver,\n documentServiceFactory: this.documentServiceFactory,\n codeLoader,\n logger: this.props.logger,\n options: { client },\n });\n }\n\n private async createFluidContainer(\n container: IContainer,\n connection: AzureConnectionConfig,\n ): Promise<FluidContainer> {\n const createNewRequest = createAzureCreateNewRequest(\n connection.endpoint,\n getTenantId(connection),\n );\n\n const rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n\n /**\n * See {@link FluidContainer.attach}\n */\n const attach = async (): Promise<string> => {\n if (container.attachState !== AttachState.Detached) {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n await container.attach(createNewRequest);\n const resolved = container.resolvedUrl;\n ensureFluidResolvedUrl(resolved);\n return resolved.id;\n };\n const fluidContainer = new FluidContainer(container, rootDataObject);\n fluidContainer.attach = attach;\n return fluidContainer;\n }\n // #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,+DAAsE;AACtE,+DAMsC;AACtC,+EAA4E;AAC5E,+EAA2F;AAC3F,iEAAmE;AAEnE,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,CA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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,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC;YACvC,IAAA,qCAAsB,EAAC,QAAQ,CAAC,CAAC;YACjC,OAAO,QAAQ,CAAC,EAAE,CAAC;QACpB,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;AAjND,kCAiNC","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 { 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\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}\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});\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"]}
@@ -3,6 +3,10 @@ import { AzureMember } from "./interfaces";
3
3
  /**
4
4
  * Token Provider implementation for connecting to an Azure Function endpoint for
5
5
  * Azure Fluid Relay token resolution.
6
+ *
7
+ * @deprecated 1.2.0, This API will be removed in 2.0.0
8
+ * No replacement since it is not expected anyone will use this token provider as is
9
+ * See https://github.com/microsoft/FluidFramework/issues/13693 for context
6
10
  */
7
11
  export declare class AzureFunctionTokenProvider implements ITokenProvider {
8
12
  private readonly azFunctionUrl;
@@ -1 +1 @@
1
- {"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,cAAc;IAOzD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAP1B;;;;OAIG;gBAEkB,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,iFAAgE;IAG7E,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMjF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;YAM/E,QAAQ;CAYzB"}
1
+ {"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;;GAOG;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,iFAAgE;IAG1E,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMjF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;YAM/E,QAAQ;CAYtB"}
@@ -12,6 +12,10 @@ const axios_1 = __importDefault(require("axios"));
12
12
  /**
13
13
  * Token Provider implementation for connecting to an Azure Function endpoint for
14
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
15
19
  */
16
20
  class AzureFunctionTokenProvider {
17
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,kDAA0B;AAM1B;;;GAGG;AACH,MAAa,0BAA0B;IACnC;;;;OAIG;IACH,YACqB,aAAqB,EACrB,IAAqE;QADrE,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAiE;IACvF,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAmB;QAChE,OAAO;YACH,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SACjD,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAkB;QAC/D,OAAO;YACH,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SACjD,CAAC;IACN,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,UAAmB;;QACxD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;YACjD,MAAM,EAAE;gBACJ,QAAQ;gBACR,UAAU;gBACV,MAAM,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM;gBACzB,QAAQ,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ;gBAC7B,iBAAiB,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,iBAA4B;aAC7D;SACJ,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IACnC,CAAC;CACJ;AAnCD,gEAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport axios from \"axios\";\n\nimport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\n\nimport { AzureMember } from \"./interfaces\";\n\n/**\n * Token Provider implementation for connecting to an Azure Function endpoint for\n * Azure Fluid Relay token resolution.\n */\nexport class AzureFunctionTokenProvider implements ITokenProvider {\n /**\n * Creates a new instance using configuration parameters.\n * @param azFunctionUrl - URL to Azure Function endpoint\n * @param user - User object\n */\n constructor(\n private readonly azFunctionUrl: string,\n private readonly user?: Pick<AzureMember, \"userId\" | \"userName\" | \"additionalDetails\">,\n ) {}\n\n public async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n return {\n jwt: await this.getToken(tenantId, documentId),\n };\n }\n\n public async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {\n return {\n jwt: await this.getToken(tenantId, documentId),\n };\n }\n\n private async getToken(tenantId: string, documentId?: string): Promise<string> {\n const response = await axios.get(this.azFunctionUrl, {\n params: {\n tenantId,\n documentId,\n userId: this.user?.userId,\n userName: this.user?.userName,\n additionalDetails: this.user?.additionalDetails as unknown,\n },\n });\n return response.data as string;\n }\n}\n"]}
1
+ {"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,kDAA0B;AAM1B;;;;;;;GAOG;AACH,MAAa,0BAA0B;IACtC;;;;OAIG;IACH,YACkB,aAAqB,EACrB,IAAqE;QADrE,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAiE;IACpF,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAmB;QACnE,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAkB;QAClE,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,MAAM,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM;gBACzB,QAAQ,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ;gBAC7B,iBAAiB,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,iBAA4B;aAC1D;SACD,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IAChC,CAAC;CACD;AAnCD,gEAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport axios from \"axios\";\n\nimport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\n\nimport { AzureMember } from \"./interfaces\";\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 */\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, \"userId\" | \"userName\" | \"additionalDetails\">,\n\t) {}\n\n\tpublic async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(tenantId: string, documentId: string): 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\tuserId: this.user?.userId,\n\t\t\t\tuserName: this.user?.userName,\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"]}
@@ -16,5 +16,12 @@ export declare class AzureUrlResolver implements IUrlResolver {
16
16
  resolve(request: IRequest): Promise<IFluidResolvedUrl>;
17
17
  getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
18
18
  }
19
+ /**
20
+ * Creates a request object that can be passed to {@link @fluidframework/fluid-static#IFluidContainer.attach} to
21
+ * request creation of a new Fluid Container on the Azure service.
22
+ *
23
+ * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.
24
+ * @param tenantId - Unique tenant identifier.
25
+ */
19
26
  export declare const createAzureCreateNewRequest: (endpointUrl: string, tenantId: string) => IRequest;
20
27
  //# sourceMappingURL=AzureUrlResolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEH,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACf,MAAM,oCAAoC,CAAC;AAE5C;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGpC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoCtD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM/F;AA+BD,eAAO,MAAM,2BAA2B,gBAAiB,MAAM,YAAY,MAAM,KAAG,QAUnF,CAAC"}
1
+ {"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEN,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAE5C;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGvC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoCtD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM5F;AA+BD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,gBAAiB,MAAM,YAAY,MAAM,KAAG,QAUnF,CAAC"}
@@ -77,6 +77,13 @@ function decodeAzureUrl(urlString) {
77
77
  containerId: containerIdDecoded,
78
78
  };
79
79
  }
80
+ /**
81
+ * Creates a request object that can be passed to {@link @fluidframework/fluid-static#IFluidContainer.attach} to
82
+ * request creation of a new Fluid Container on the Azure service.
83
+ *
84
+ * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.
85
+ * @param tenantId - Unique tenant identifier.
86
+ */
80
87
  const createAzureCreateNewRequest = (endpointUrl, tenantId) => {
81
88
  const url = new URL(endpointUrl);
82
89
  url.searchParams.append("storage", encodeURIComponent(endpointUrl));
@@ -1 +1 @@
1
- {"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":";;;AAKA,2EAK4C;AAE5C;;;;;;GAMG;AACH,MAAa,gBAAgB;IACzB,gBAAe,CAAC;IAET,KAAK,CAAC,OAAO,CAAC,OAAiB;QAClC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtF,oEAAoE;QACpE,uFAAuF;QACvF,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,iCAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;YACrE,OAAO;gBACH,SAAS,EAAE;oBACP,eAAe,EAAE,GAAG,UAAU,WAAW,QAAQ,MAAM;oBACvD,UAAU;oBACV,UAAU,EAAE,GAAG,UAAU,UAAU,QAAQ,EAAE;iBAChD;gBACD,0FAA0F;gBAC1F,EAAE,EAAE,EAAE;gBACN,+EAA+E;gBAC/E,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,GAAG,UAAU,IAAI,QAAQ,MAAM;aACvC,CAAC;SACL;QACD,IAAI,WAAW,KAAK,SAAS,EAAE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zD,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACpD,MAAM,kBAAkB,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9F,OAAO;QACH,UAAU;QACV,UAAU,EAAE,iBAAiB;QAC7B,QAAQ,EAAE,eAAe;QACzB,WAAW,EAAE,kBAAkB;KAClC,CAAC;AACN,CAAC;AAEM,MAAM,2BAA2B,GAAG,CAAC,WAAmB,EAAE,QAAgB,EAAY,EAAE;IAC3F,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;IACpE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO;QACH,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,OAAO,EAAE;YACL,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SACjC;KACJ,CAAC;AACN,CAAC,CAAC;AAVW,QAAA,2BAA2B,+BAUtC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n DriverHeader,\n IFluidResolvedUrl,\n IResolvedUrl,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\n\n/**\n * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the\n * Azure Fluid Relay based off of the orderer and storage URLs provide.\n *\n * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure\n * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.\n */\nexport class AzureUrlResolver implements IUrlResolver {\n constructor() {}\n\n public async resolve(request: IRequest): Promise<IFluidResolvedUrl> {\n const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);\n // determine whether the request is for creating of a new container.\n // such request has the `createNew` header set to true and doesn't have a container ID.\n if (request.headers && request.headers[DriverHeader.createNew] === true) {\n return {\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n // id is a mandatory attribute, but it's ignored by the driver for new container requests.\n id: \"\",\n // tokens attribute is redundant as all tokens are generated via ITokenProvider\n tokens: {},\n type: \"fluid\",\n url: `${ordererUrl}/${tenantId}/new`,\n };\n }\n if (containerId === undefined) {\n throw new Error(\"Azure URL did not contain containerId\");\n }\n const documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n return {\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n id: containerId,\n tokens: {},\n type: \"fluid\",\n url: documentUrl,\n };\n }\n\n public async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n if (resolvedUrl.type !== \"fluid\") {\n throw new Error(\"Invalid Resolved Url\");\n }\n return `${resolvedUrl.url}/${relativeUrl}`;\n }\n}\n\nfunction decodeAzureUrl(urlString: string): {\n ordererUrl: string;\n storageUrl: string;\n tenantId: string;\n containerId?: string;\n} {\n const url = new URL(urlString);\n const ordererUrl = url.origin;\n const searchParams = url.searchParams;\n const storageUrl = searchParams.get(\"storage\");\n if (storageUrl === null) {\n throw new Error(\"Azure URL did not contain a storage URL\");\n }\n const tenantId = searchParams.get(\"tenantId\");\n if (tenantId === null) {\n throw new Error(\"Azure URL did not contain a tenant ID\");\n }\n const storageUrlDecoded = decodeURIComponent(storageUrl);\n const tenantIdDecoded = decodeURIComponent(tenantId);\n const containerId = searchParams.get(\"containerId\");\n const containerIdDecoded = containerId !== null ? decodeURIComponent(containerId) : undefined;\n return {\n ordererUrl,\n storageUrl: storageUrlDecoded,\n tenantId: tenantIdDecoded,\n containerId: containerIdDecoded,\n };\n}\n\nexport const createAzureCreateNewRequest = (endpointUrl: string, tenantId: string): IRequest => {\n const url = new URL(endpointUrl);\n url.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n url.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n return {\n url: url.href,\n headers: {\n [DriverHeader.createNew]: true,\n },\n };\n};\n"]}
1
+ {"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":";;;AAKA,2EAK4C;AAE5C;;;;;;GAMG;AACH,MAAa,gBAAgB;IAC5B,gBAAsB,CAAC;IAEhB,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtF,oEAAoE;QACpE,uFAAuF;QACvF,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,iCAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;YACxE,OAAO;gBACN,SAAS,EAAE;oBACV,eAAe,EAAE,GAAG,UAAU,WAAW,QAAQ,MAAM;oBACvD,UAAU;oBACV,UAAU,EAAE,GAAG,UAAU,UAAU,QAAQ,EAAE;iBAC7C;gBACD,0FAA0F;gBAC1F,EAAE,EAAE,EAAE;gBACN,+EAA+E;gBAC/E,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,OAAO;gBACb,GAAG,EAAE,GAAG,UAAU,IAAI,QAAQ,MAAM;aACpC,CAAC;SACF;QACD,IAAI,WAAW,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;SACzD;QACD,M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AW,GAAG,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACpD,MAAM,kBAAkB,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9F,OAAO;QACN,UAAU;QACV,UAAU,EAAE,iBAAiB;QAC7B,QAAQ,EAAE,eAAe;QACzB,WAAW,EAAE,kBAAkB;KAC/B,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACI,MAAM,2BAA2B,GAAG,CAAC,WAAmB,EAAE,QAAgB,EAAY,EAAE;IAC9F,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;IACpE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO;QACN,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,OAAO,EAAE;YACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SAC9B;KACD,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,2BAA2B,+BAUtC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\tIFluidResolvedUrl,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\n\n/**\n * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the\n * Azure Fluid Relay based off of the orderer and storage URLs provide.\n *\n * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure\n * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.\n */\nexport class AzureUrlResolver implements IUrlResolver {\n\tpublic constructor() {}\n\n\tpublic async resolve(request: IRequest): Promise<IFluidResolvedUrl> {\n\t\tconst { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);\n\t\t// determine whether the request is for creating of a new container.\n\t\t// such request has the `createNew` header set to true and doesn't have a container ID.\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\treturn {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n\t\t\t\t\tordererUrl,\n\t\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t\t},\n\t\t\t\t// id is a mandatory attribute, but it's ignored by the driver for new container requests.\n\t\t\t\tid: \"\",\n\t\t\t\t// tokens attribute is redundant as all tokens are generated via ITokenProvider\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `${ordererUrl}/${tenantId}/new`,\n\t\t\t};\n\t\t}\n\t\tif (containerId === undefined) {\n\t\t\tthrow new Error(\"Azure URL did not contain containerId\");\n\t\t}\n\t\tconst documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n\t\t\t\tordererUrl,\n\t\t\t\tstorageUrl: `${storageUrl}/repos/${tenantId}`,\n\t\t\t},\n\t\t\tid: containerId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tif (resolvedUrl.type !== \"fluid\") {\n\t\t\tthrow new Error(\"Invalid Resolved Url\");\n\t\t}\n\t\treturn `${resolvedUrl.url}/${relativeUrl}`;\n\t}\n}\n\nfunction decodeAzureUrl(urlString: string): {\n\tordererUrl: string;\n\tstorageUrl: string;\n\ttenantId: string;\n\tcontainerId?: string;\n} {\n\tconst url = new URL(urlString);\n\tconst ordererUrl = url.origin;\n\tconst searchParams = url.searchParams;\n\tconst storageUrl = searchParams.get(\"storage\");\n\tif (storageUrl === null) {\n\t\tthrow new Error(\"Azure URL did not contain a storage URL\");\n\t}\n\tconst tenantId = searchParams.get(\"tenantId\");\n\tif (tenantId === null) {\n\t\tthrow new Error(\"Azure URL did not contain a tenant ID\");\n\t}\n\tconst storageUrlDecoded = decodeURIComponent(storageUrl);\n\tconst tenantIdDecoded = decodeURIComponent(tenantId);\n\tconst containerId = searchParams.get(\"containerId\");\n\tconst containerIdDecoded = containerId !== null ? decodeURIComponent(containerId) : undefined;\n\treturn {\n\t\tordererUrl,\n\t\tstorageUrl: storageUrlDecoded,\n\t\ttenantId: tenantIdDecoded,\n\t\tcontainerId: containerIdDecoded,\n\t};\n}\n\n/**\n * Creates a request object that can be passed to {@link @fluidframework/fluid-static#IFluidContainer.attach} to\n * request creation of a new Fluid Container on the Azure service.\n *\n * @param endpointUrl - URI to the Azure Fluid Relay service discovery endpoint.\n * @param tenantId - Unique tenant identifier.\n */\nexport const createAzureCreateNewRequest = (endpointUrl: string, tenantId: string): IRequest => {\n\tconst url = new URL(endpointUrl);\n\turl.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n\turl.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n\treturn {\n\t\turl: url.href,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,2BAA2B,EAC3B,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GACvB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,2BAA2B,EAC3B,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC"}
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,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AAkBnC,6EAAsF;AAAxD,iHAAA,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 { AzureAudience } from \"./AzureAudience\";\nexport { AzureClient } from \"./AzureClient\";\nexport { AzureFunctionTokenProvider } from \"./AzureFunctionTokenProvider\";\nexport {\n AzureClientProps,\n AzureConnectionConfig,\n AzureConnectionConfigType,\n AzureContainerServices,\n AzureContainerVersion,\n AzureGetVersionsOptions,\n AzureLocalConnectionConfig,\n AzureMember,\n AzureRemoteConnectionConfig,\n AzureUser,\n IAzureAudience,\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n} from \"./interfaces\";\n\nexport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nexport { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AAkBnC,6EAAsF;AAAxD,iHAAA,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 { AzureAudience } from \"./AzureAudience\";\nexport { AzureClient } from \"./AzureClient\";\nexport { AzureFunctionTokenProvider } from \"./AzureFunctionTokenProvider\";\nexport {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureConnectionConfigType,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n\tAzureLocalConnectionConfig,\n\tAzureMember,\n\tAzureRemoteConnectionConfig,\n\tAzureUser,\n\tIAzureAudience,\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n} from \"./interfaces\";\n\nexport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nexport { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\n"]}
@@ -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;AAGtE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,2BAA2B,GAAG,0BAA0B,CAAC;IAC9E;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,oBAAY,yBAAyB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,IAAI,EAAE,yBAAyB,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,EAAE,cAAc,CAAC;CACjC;AAED;;GAEG;AACH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iB,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\";\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 /**\n * Configuration for establishing a connection with the Azure Fluid Relay.\n */\n readonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;\n /**\n * Optional. A logger instance to receive diagnostic messages.\n */\n readonly logger?: ITelemetryBaseLogger;\n}\n\n/**\n * Container version metadata.\n */\nexport interface AzureContainerVersion {\n /**\n * Version ID\n */\n id: string;\n\n /**\n * Time when version was generated.\n * ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ\n */\n date?: string;\n}\n\n/**\n * Options for \"Get Container Versions\" API.\n */\nexport interface AzureGetVersionsOptions {\n /**\n * Max number of versions\n */\n maxCount: 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 /**\n * The type of connection. Whether we're connecting to a remote Fluid relay server or a local instance.\n */\n type: AzureConnectionConfigType;\n /**\n * URI to the Azure Fluid Relay service discovery endpoint.\n */\n endpoint: string;\n /**\n * Instance that provides Azure Fluid Relay endpoint tokens.\n */\n tokenProvider: ITokenProvider;\n}\n\n/**\n * Parameters for establishing a remote connection with the Azure Fluid Relay.\n */\nexport interface AzureRemoteConnectionConfig extends AzureConnectionConfig {\n /**\n * The type of connection. Set to a remote connection.\n */\n type: \"remote\";\n /**\n * Unique tenant identifier.\n */\n tenantId: 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 /**\n * The type of connection. Set to a remote connection.\n */\n type: \"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 /**\n * Provides an object that can be used to get the users that are present in this Fluid session and\n * listeners for when the roster has any changes from users joining/leaving the session\n */\n audience: 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 /**\n * The user's name\n */\n name: string;\n\n /**\n * Custom, app-specific user information\n */\n additionalDetails?: 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 /**\n * {@inheritDoc AzureUser.name}\n */\n userName: string;\n\n /**\n * {@inheritDoc AzureUser.additionalDetails}\n */\n additionalDetails?: 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/common-definitions\";\nimport { IMember, IServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IUser } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\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\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"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/azure-client";
8
- export declare const pkgVersion = "1.2.0-106934";
8
+ export declare const pkgVersion = "1.2.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,UAAU,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/azure-client";
11
- exports.pkgVersion = "1.2.0-106934";
11
+ exports.pkgVersion = "1.2.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-client\";\nexport const pkgVersion = \"1.2.0-106934\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-client\";\nexport const pkgVersion = \"1.2.0\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACH,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC9B,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,wBAAgB,6BAA6B,CACzC,gBAAgB,EAAE,qBAAqB,GACxC,gBAAgB,IAAI,2BAA2B,CAEjD;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CACxC,gBAAgB,EAAE,qBAAqB,GACxC,gBAAgB,IAAI,0BAA0B,CAEhD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,wBAAgB,6BAA6B,CAC5C,gBAAgB,EAAE,qBAAqB,GACrC,gBAAgB,IAAI,2BAA2B,CAEjD;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC3C,gBAAgB,EAAE,qBAAqB,GACrC,gBAAgB,IAAI,0BAA0B,CAEhD"}
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAUA;;GAEG;AACH,SAAgB,6BAA6B,CACzC,gBAAuC;IAEvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9C,CAAC;AAJD,sEAIC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CACxC,gBAAuC;IAEvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,OAAO,CAAC;AAC7C,CAAC;AAJD,oEAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n AzureConnectionConfig,\n AzureLocalConnectionConfig,\n AzureRemoteConnectionConfig,\n} from \"./interfaces\";\n\n/**\n * Type guard for validating a given AzureConnectionConfig is a remote connection type (AzureRemoteConnectionConfig)\n */\nexport function isAzureRemoteConnectionConfig(\n connectionConfig: AzureConnectionConfig,\n): connectionConfig is AzureRemoteConnectionConfig {\n return connectionConfig.type === \"remote\";\n}\n\n/**\n * Type guard for validating a given AzureConnectionConfig is a local connection type (AzureLocalConnectionConfig)\n */\nexport function isAzureLocalConnectionConfig(\n connectionConfig: AzureConnectionConfig,\n): connectionConfig is AzureLocalConnectionConfig {\n return connectionConfig.type === \"local\";\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAUA;;GAEG;AACH,SAAgB,6BAA6B,CAC5C,gBAAuC;IAEvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC3C,CAAC;AAJD,sEAIC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAC3C,gBAAuC;IAEvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,OAAO,CAAC;AAC1C,CAAC;AAJD,oEAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tAzureConnectionConfig,\n\tAzureLocalConnectionConfig,\n\tAzureRemoteConnectionConfig,\n} from \"./interfaces\";\n\n/**\n * Type guard for validating a given AzureConnectionConfig is a remote connection type (AzureRemoteConnectionConfig)\n */\nexport function isAzureRemoteConnectionConfig(\n\tconnectionConfig: AzureConnectionConfig,\n): connectionConfig is AzureRemoteConnectionConfig {\n\treturn connectionConfig.type === \"remote\";\n}\n\n/**\n * Type guard for validating a given AzureConnectionConfig is a local connection type (AzureLocalConnectionConfig)\n */\nexport function isAzureLocalConnectionConfig(\n\tconnectionConfig: AzureConnectionConfig,\n): connectionConfig is AzureLocalConnectionConfig {\n\treturn connectionConfig.type === \"local\";\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAa,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACrF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAWtE"}
1
+ {"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAa,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACxF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAWnE"}