@fluidframework/azure-client 1.0.2 → 1.1.0-101037

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 (74) hide show
  1. package/.eslintrc.js +5 -7
  2. package/CHANGELOG.md +1 -2
  3. package/README.md +12 -10
  4. package/api-extractor.json +2 -1
  5. package/dist/AzureAudience.d.ts +7 -5
  6. package/dist/AzureAudience.d.ts.map +1 -1
  7. package/dist/AzureAudience.js +13 -4
  8. package/dist/AzureAudience.js.map +1 -1
  9. package/dist/AzureClient.d.ts.map +1 -1
  10. package/dist/AzureClient.js +23 -15
  11. package/dist/AzureClient.js.map +1 -1
  12. package/dist/AzureFunctionTokenProvider.d.ts +0 -4
  13. package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
  14. package/dist/AzureFunctionTokenProvider.js +4 -4
  15. package/dist/AzureFunctionTokenProvider.js.map +1 -1
  16. package/dist/AzureUrlResolver.d.ts +7 -0
  17. package/dist/AzureUrlResolver.d.ts.map +1 -1
  18. package/dist/AzureUrlResolver.js +11 -13
  19. package/dist/AzureUrlResolver.js.map +1 -1
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +7 -15
  23. package/dist/index.js.map +1 -1
  24. package/dist/interfaces.d.ts +34 -4
  25. package/dist/interfaces.d.ts.map +1 -1
  26. package/dist/interfaces.js +0 -4
  27. package/dist/interfaces.js.map +1 -1
  28. package/dist/packageVersion.d.ts +1 -1
  29. package/dist/packageVersion.d.ts.map +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/dist/utils.d.ts +1 -1
  33. package/dist/utils.d.ts.map +1 -1
  34. package/dist/utils.js.map +1 -1
  35. package/lib/AzureAudience.d.ts +7 -5
  36. package/lib/AzureAudience.d.ts.map +1 -1
  37. package/lib/AzureAudience.js +11 -2
  38. package/lib/AzureAudience.js.map +1 -1
  39. package/lib/AzureClient.d.ts.map +1 -1
  40. package/lib/AzureClient.js +25 -17
  41. package/lib/AzureClient.js.map +1 -1
  42. package/lib/AzureFunctionTokenProvider.d.ts +0 -4
  43. package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
  44. package/lib/AzureFunctionTokenProvider.js.map +1 -1
  45. package/lib/AzureUrlResolver.d.ts +7 -0
  46. package/lib/AzureUrlResolver.d.ts.map +1 -1
  47. package/lib/AzureUrlResolver.js +11 -13
  48. package/lib/AzureUrlResolver.js.map +1 -1
  49. package/lib/index.d.ts +5 -5
  50. package/lib/index.d.ts.map +1 -1
  51. package/lib/index.js +3 -4
  52. package/lib/index.js.map +1 -1
  53. package/lib/interfaces.d.ts +34 -4
  54. package/lib/interfaces.d.ts.map +1 -1
  55. package/lib/interfaces.js +0 -4
  56. package/lib/interfaces.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.d.ts.map +1 -1
  59. package/lib/packageVersion.js +1 -1
  60. package/lib/packageVersion.js.map +1 -1
  61. package/lib/utils.d.ts +1 -1
  62. package/lib/utils.d.ts.map +1 -1
  63. package/lib/utils.js.map +1 -1
  64. package/package.json +36 -43
  65. package/src/AzureAudience.ts +23 -13
  66. package/src/AzureClient.ts +44 -70
  67. package/src/AzureFunctionTokenProvider.ts +4 -3
  68. package/src/AzureUrlResolver.ts +15 -24
  69. package/src/index.ts +19 -5
  70. package/src/interfaces.ts +42 -12
  71. package/src/packageVersion.ts +1 -1
  72. package/src/utils.ts +9 -3
  73. package/tsconfig.esnext.json +5 -5
  74. package/tsconfig.json +9 -15
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EACH,OAAO,EACP,gBAAgB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAGtE,OAAO,EACH,mBAAmB,EACnB,oBAAoB,GACvB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAC3C;;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,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACtE;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACrE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;OAGG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACzB;AAED;;GAEG;AACH,oBAAY,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC"}
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,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACtE;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACrE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;OAGG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC5B;AAED;;;;;;;GAOG;AAGH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,KAAK;IAC7C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACzB;AAED;;;;;;;;GAQG;AAGH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO;IACjD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACzB;AAED;;GAEG;AACH,oBAAY,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC"}
package/lib/interfaces.js CHANGED
@@ -1,6 +1,2 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
1
  export {};
6
2
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport {\n IMember,\n IServiceAudience,\n} from \"@fluidframework/fluid-static\";\nimport { ITokenProvider } from \"@fluidframework/routerlicious-driver\";\n\n// Re-export so developers can build loggers without pulling in common-definitions\nexport {\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n} 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: AzureConnectionConfig;\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 IMember interface to include\n * this service-specific value. It will be returned for all audience members connected to Azure.\n */\nexport interface AzureMember<T = any> extends IMember {\n userName: string;\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 /**\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"]}
@@ -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.0.2";
8
+ export declare const pkgVersion = "1.1.0-101037";
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,UAAU,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,iBAAiB,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/azure-client";
8
- export const pkgVersion = "1.0.2";
8
+ export const pkgVersion = "1.1.0-101037";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,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.0.2\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,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.1.0-101037\";\n"]}
package/lib/utils.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { AzureRemoteConnectionConfig, AzureLocalConnectionConfig, AzureConnectionConfig } from "./interfaces";
5
+ import { AzureConnectionConfig, AzureLocalConnectionConfig, AzureRemoteConnectionConfig } from "./interfaces";
6
6
  /**
7
7
  * Type guard for validating a given AzureConnectionConfig is a remote connection type (AzureRemoteConnectionConfig)
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE9G;;GAEG;AACH,wBAAgB,6BAA6B,CACzC,gBAAgB,EAAE,qBAAqB,GAAG,gBAAgB,IAAI,2BAA2B,CAE5F;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CACxC,gBAAgB,EAAE,qBAAqB,GAAG,gBAAgB,IAAI,0BAA0B,CAE3F"}
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"}
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,UAAU,6BAA6B,CACzC,gBAAuC;IACvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CACxC,gBAAuC;IACvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,OAAO,CAAC;AAC7C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { AzureRemoteConnectionConfig, AzureLocalConnectionConfig, AzureConnectionConfig } 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): 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): 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,MAAM,UAAU,6BAA6B,CACzC,gBAAuC;IAEvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CACxC,gBAAuC;IAEvC,OAAO,gBAAgB,CAAC,IAAI,KAAK,OAAO,CAAC;AAC7C,CAAC","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"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@fluidframework/azure-client",
3
- "version": "1.0.2",
3
+ "version": "1.1.0-101037",
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": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/microsoft/FluidFramework.git",
9
- "directory": "packages/framework/azure-client"
9
+ "directory": "azure/packages/azure-client"
10
10
  },
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
@@ -28,14 +28,16 @@
28
28
  "clean": "rimraf dist *.tsbuildinfo *.build.log",
29
29
  "eslint": "eslint --format stylish src",
30
30
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
31
- "lint": "npm run eslint",
32
- "lint:fix": "npm run eslint:fix",
31
+ "format": "npm run prettier:fix",
32
+ "lint": "npm run prettier && npm run eslint",
33
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
33
34
  "postpack": "cd dist && tar -cvf ../azure-client.test-files.tar ./test",
35
+ "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
36
+ "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
34
37
  "start:tinylicious:test": "npx @fluidframework/azure-local-service > tinylicious.log 2>&1",
35
38
  "test:realsvc": "npm run test:realsvc:tinylicious",
36
- "test:realsvc:azure": "cross-env FLUID_CLIENT=azure npm run test:realsvc:azure:run",
37
- "test:realsvc:azure:run": "mocha --unhandled-rejections=strict --recursive dist/test/**/*.spec.js --exit --timeout 10000",
38
- "test:realsvc:tinylicious": "start-server-and-test start:tinylicious:test 7070 test:realsvc:azure:run",
39
+ "test:realsvc:local:run": "mocha --unhandled-rejections=strict --recursive dist/test/**/*.spec.js --exit --timeout 10000",
40
+ "test:realsvc:tinylicious": "start-server-and-test start:tinylicious:test 7070 test:realsvc:local:run",
39
41
  "tsc": "tsc",
40
42
  "tsfmt": "tsfmt --verify",
41
43
  "tsfmt:fix": "tsfmt --replace",
@@ -43,61 +45,52 @@
43
45
  },
44
46
  "dependencies": {
45
47
  "@fluidframework/common-definitions": "^0.20.1",
46
- "@fluidframework/container-definitions": "^1.2.3",
47
- "@fluidframework/container-loader": "^1.2.3",
48
- "@fluidframework/core-interfaces": "^1.2.3",
49
- "@fluidframework/driver-definitions": "^1.2.3",
50
- "@fluidframework/driver-utils": "^1.2.3",
51
- "@fluidframework/fluid-static": "^1.2.3",
52
- "@fluidframework/map": "^1.2.3",
53
- "@fluidframework/protocol-definitions": "^0.1028.2000",
54
- "@fluidframework/routerlicious-driver": "^1.2.3",
55
- "@fluidframework/runtime-utils": "^1.2.3",
56
- "@fluidframework/server-services-client": "^0.1036.4000",
57
- "axios": "^0.26.0",
48
+ "@fluidframework/common-utils": "^1.0.0",
49
+ "@fluidframework/container-definitions": "^1.3.0-100520",
50
+ "@fluidframework/container-loader": "^1.3.0-100520",
51
+ "@fluidframework/core-interfaces": "^1.3.0-100520",
52
+ "@fluidframework/driver-definitions": "^1.3.0-100520",
53
+ "@fluidframework/driver-utils": "^1.3.0-100520",
54
+ "@fluidframework/fluid-static": "^1.3.0-100520",
55
+ "@fluidframework/map": "^1.3.0-100520",
56
+ "@fluidframework/protocol-definitions": "^1.0.0",
57
+ "@fluidframework/routerlicious-driver": "^1.3.0-100520",
58
+ "@fluidframework/runtime-utils": "^1.3.0-100520",
59
+ "@fluidframework/server-services-client": "^0.1037.1000-0",
60
+ "axios": "^0.21.2",
58
61
  "uuid": "^8.3.1"
59
62
  },
60
63
  "devDependencies": {
61
- "@fluidframework/aqueduct": "^1.2.3",
62
- "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@0.59.3000",
63
- "@fluidframework/azure-local-service": "^0.1.38773",
64
- "@fluidframework/build-common": "^0.23.0",
65
- "@fluidframework/build-tools": "^0.2.71273",
66
- "@fluidframework/counter": "^1.2.3",
67
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
68
- "@fluidframework/test-client-utils": "^1.2.3",
69
- "@fluidframework/test-utils": "^1.2.3",
64
+ "@fluidframework/aqueduct": "^1.3.0-100520",
65
+ "@fluidframework/azure-client-previous": "npm:@fluidframework/azure-client@1.0.0-73930",
66
+ "@fluidframework/azure-local-service": "1.1.0-101037",
67
+ "@fluidframework/build-common": "^1.0.0",
68
+ "@fluidframework/build-tools": "^0.4.4000",
69
+ "@fluidframework/counter": "^1.3.0-100520",
70
+ "@fluidframework/eslint-config-fluid": "^1.0.0",
71
+ "@fluidframework/test-client-utils": "^1.3.0-100520",
72
+ "@fluidframework/test-utils": "^1.3.0-100520",
70
73
  "@microsoft/api-extractor": "^7.22.2",
71
74
  "@rushstack/eslint-config": "^2.5.1",
72
75
  "@types/mocha": "^9.1.1",
73
76
  "concurrently": "^6.2.0",
74
- "copyfiles": "^2.1.0",
77
+ "copyfiles": "^2.4.1",
75
78
  "cross-env": "^7.0.2",
76
79
  "eslint": "~8.6.0",
80
+ "eslint-config-prettier": "~8.5.0",
77
81
  "mocha": "^10.0.0",
82
+ "prettier": "~2.6.2",
78
83
  "rimraf": "^2.6.2",
79
84
  "start-server-and-test": "^1.11.7",
80
85
  "typescript": "~4.5.5"
81
86
  },
82
87
  "peerDependencies": {
83
- "fluid-framework": "^1.2.3"
88
+ "fluid-framework": "^1.3.0-100520"
84
89
  },
85
90
  "typeValidation": {
86
- "version": "1.0.0",
91
+ "version": "1.1.0",
87
92
  "broken": {
88
- "ClassDeclaration_AzureClient": {
89
- "forwardCompat": false
90
- },
91
93
  "InterfaceDeclaration_AzureClientProps": {
92
- "backCompat": false,
93
- "forwardCompat": false
94
- },
95
- "InterfaceDeclaration_AzureConnectionConfig": {
96
- "backCompat": false,
97
- "forwardCompat": false
98
- },
99
- "RemovedVariableDeclaration_LOCAL_MODE_TENANT_ID": {
100
- "backCompat": false,
101
94
  "forwardCompat": false
102
95
  }
103
96
  }
@@ -2,21 +2,31 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
-
5
+ import { assert } from "@fluidframework/common-utils";
6
6
  import { ServiceAudience } from "@fluidframework/fluid-static";
7
7
  import { IClient } from "@fluidframework/protocol-definitions";
8
- import { IAzureAudience, AzureMember } from "./interfaces";
8
+
9
+ import { AzureMember, AzureUser, IAzureAudience } from "./interfaces";
9
10
 
10
11
  export class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
11
- /**
12
- * @internal
13
- */
14
- protected createServiceMember(audienceMember: IClient): AzureMember {
15
- return {
16
- userId: audienceMember.user.id,
17
- userName: (audienceMember.user as any).name,
18
- connections: [],
19
- additionalDetails: (audienceMember.user as any).additionalDetails,
20
- };
21
- }
12
+ /**
13
+ * Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided
14
+ * {@link @fluidframework/protocol-definitions#IClient | audience member}.
15
+ *
16
+ * @param audienceMember - Audience member for which the `ServiceAudience` will be generated.
17
+ * Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.
18
+ *
19
+ * @internal
20
+ */
21
+ protected createServiceMember(audienceMember: IClient): AzureMember {
22
+ const azureUser = audienceMember.user as AzureUser;
23
+ assert(azureUser?.name !== undefined, 'Provided user was not an "AzureUser".');
24
+
25
+ return {
26
+ userId: audienceMember.user.id,
27
+ userName: azureUser.name,
28
+ connections: [],
29
+ additionalDetails: azureUser.additionalDetails as unknown,
30
+ };
31
+ }
22
32
  }
@@ -2,18 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { Loader } from "@fluidframework/container-loader";
6
- import {
7
- IDocumentServiceFactory,
8
- IUrlResolver,
9
- } from "@fluidframework/driver-definitions";
10
5
  import {
11
6
  AttachState,
12
7
  IContainer,
13
8
  IFluidModuleWithDetails,
14
9
  } from "@fluidframework/container-definitions";
15
- import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver";
16
- import { requestFluidObject } from "@fluidframework/runtime-utils";
10
+ import { Loader } from "@fluidframework/container-loader";
11
+ import { IDocumentServiceFactory, IUrlResolver } from "@fluidframework/driver-definitions";
17
12
  import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils";
18
13
  import {
19
14
  ContainerSchema,
@@ -22,11 +17,12 @@ import {
22
17
  IFluidContainer,
23
18
  RootDataObject,
24
19
  } from "@fluidframework/fluid-static";
20
+ import { SummaryType } from "@fluidframework/protocol-definitions";
21
+ import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver";
22
+ import { requestFluidObject } from "@fluidframework/runtime-utils";
25
23
 
26
- import {
27
- SummaryType,
28
- } from "@fluidframework/protocol-definitions";
29
-
24
+ import { AzureAudience } from "./AzureAudience";
25
+ import { AzureUrlResolver, createAzureCreateNewRequest } from "./AzureUrlResolver";
30
26
  import {
31
27
  AzureClientProps,
32
28
  AzureConnectionConfig,
@@ -35,18 +31,15 @@ import {
35
31
  AzureGetVersionsOptions,
36
32
  } from "./interfaces";
37
33
  import { isAzureRemoteConnectionConfig } from "./utils";
38
- import { AzureAudience } from "./AzureAudience";
39
- import {
40
- AzureUrlResolver,
41
- createAzureCreateNewRequest,
42
- } from "./AzureUrlResolver";
43
34
 
44
35
  /**
45
36
  * Strongly typed id for connecting to a local Azure Fluid Relay.
46
37
  */
47
38
  const LOCAL_MODE_TENANT_ID = "local";
48
39
  const getTenantId = (connectionProps: AzureConnectionConfig): string => {
49
- return isAzureRemoteConnectionConfig(connectionProps) ? connectionProps.tenantId : LOCAL_MODE_TENANT_ID;
40
+ return isAzureRemoteConnectionConfig(connectionProps)
41
+ ? connectionProps.tenantId
42
+ : LOCAL_MODE_TENANT_ID;
50
43
  };
51
44
 
52
45
  const MAX_VERSION_COUNT = 5;
@@ -81,9 +74,7 @@ export class AzureClient {
81
74
  * @param containerSchema - Container schema for the new container.
82
75
  * @returns New detached container instance along with associated services.
83
76
  */
84
- public async createContainer(
85
- containerSchema: ContainerSchema,
86
- ): Promise<{
77
+ public async createContainer(containerSchema: ContainerSchema): Promise<{
87
78
  container: IFluidContainer;
88
79
  services: AzureContainerServices;
89
80
  }> {
@@ -94,10 +85,7 @@ export class AzureClient {
94
85
  config: {},
95
86
  });
96
87
 
97
- const fluidContainer = await this.createFluidContainer(
98
- container,
99
- this.props.connection,
100
- );
88
+ const fluidContainer = await this.createFluidContainer(container, this.props.connection);
101
89
  const services = this.getContainerServices(container);
102
90
  return { container: fluidContainer, services };
103
91
  }
@@ -126,12 +114,12 @@ export class AzureClient {
126
114
  const sourceContainer = await loader.resolve({ url: url.href });
127
115
 
128
116
  if (sourceContainer.resolvedUrl === undefined) {
129
- throw new Error(
130
- "Source container cannot resolve URL.",
131
- );
117
+ throw new Error("Source container cannot resolve URL.");
132
118
  }
133
119
 
134
- const documentService = await this.documentServiceFactory.createDocumentService(sourceContainer.resolvedUrl);
120
+ const documentService = await this.documentServiceFactory.createDocumentService(
121
+ sourceContainer.resolvedUrl,
122
+ );
135
123
  const storage = await documentService.connectToStorage();
136
124
  const handle = {
137
125
  type: SummaryType.Handle,
@@ -140,14 +128,9 @@ export class AzureClient {
140
128
  };
141
129
  const tree = await storage.downloadSummary(handle);
142
130
 
143
- const container = await loader.rehydrateDetachedContainerFromSnapshot(
144
- JSON.stringify(tree),
145
- );
131
+ const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));
146
132
 
147
- const fluidContainer = await this.createFluidContainer(
148
- container,
149
- this.props.connection,
150
- );
133
+ const fluidContainer = await this.createFluidContainer(container, this.props.connection);
151
134
  const services = this.getContainerServices(container);
152
135
  return { container: fluidContainer, services };
153
136
  }
@@ -171,10 +154,7 @@ export class AzureClient {
171
154
  url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
172
155
  url.searchParams.append("containerId", encodeURIComponent(id));
173
156
  const container = await loader.resolve({ url: url.href });
174
- const rootDataObject = await requestFluidObject<RootDataObject>(
175
- container,
176
- "/",
177
- );
157
+ const rootDataObject = await requestFluidObject<RootDataObject>(container, "/");
178
158
  const fluidContainer = new FluidContainer(container, rootDataObject);
179
159
  const services = this.getContainerServices(container);
180
160
  return { container: fluidContainer, services };
@@ -192,25 +172,21 @@ export class AzureClient {
192
172
  options?: AzureGetVersionsOptions,
193
173
  ): Promise<AzureContainerVersion[]> {
194
174
  const url = new URL(this.props.connection.endpoint);
195
- url.searchParams.append(
196
- "storage",
197
- encodeURIComponent(this.props.connection.endpoint),
198
- );
199
- url.searchParams.append(
200
- "tenantId",
201
- encodeURIComponent(getTenantId(this.props.connection)),
202
- );
175
+ url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
176
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
203
177
  url.searchParams.append("containerId", encodeURIComponent(id));
204
178
 
205
179
  const resolvedUrl = await this.urlResolver.resolve({ url: url.href });
206
180
  if (!resolvedUrl) {
207
181
  throw new Error("Unable to resolved URL");
208
182
  }
209
- const documentService =
210
- await this.documentServiceFactory.createDocumentService(
211
- resolvedUrl,
212
- );
183
+ const documentService = await this.documentServiceFactory.createDocumentService(
184
+ resolvedUrl,
185
+ );
213
186
  const storage = await documentService.connectToStorage();
187
+
188
+ // External API uses null
189
+ // eslint-disable-next-line unicorn/no-null
214
190
  const versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);
215
191
 
216
192
  return versions.map((item) => {
@@ -225,9 +201,7 @@ export class AzureClient {
225
201
  }
226
202
 
227
203
  private createLoader(containerSchema: ContainerSchema): Loader {
228
- const runtimeFactory = new DOProviderContainerRuntimeFactory(
229
- containerSchema,
230
- );
204
+ const runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);
231
205
  const load = async (): Promise<IFluidModuleWithDetails> => {
232
206
  return {
233
207
  module: { fluidExport: runtimeFactory },
@@ -253,23 +227,23 @@ export class AzureClient {
253
227
  getTenantId(connection),
254
228
  );
255
229
 
256
- const rootDataObject = await requestFluidObject<RootDataObject>(
257
- container,
258
- "/",
259
- );
260
- return new (class extends FluidContainer {
261
- async attach() {
262
- if (this.attachState !== AttachState.Detached) {
263
- throw new Error(
264
- "Cannot attach container. Container is not in detached state",
265
- );
266
- }
267
- await container.attach(createNewRequest);
268
- const resolved = container.resolvedUrl;
269
- ensureFluidResolvedUrl(resolved);
270
- return resolved.id;
230
+ const rootDataObject = await requestFluidObject<RootDataObject>(container, "/");
231
+
232
+ /**
233
+ * See {@link FluidContainer.attach}
234
+ */
235
+ const attach = async (): Promise<string> => {
236
+ if (container.attachState !== AttachState.Detached) {
237
+ throw new Error("Cannot attach container. Container is not in detached state");
271
238
  }
272
- })(container, rootDataObject);
239
+ await container.attach(createNewRequest);
240
+ const resolved = container.resolvedUrl;
241
+ ensureFluidResolvedUrl(resolved);
242
+ return resolved.id;
243
+ };
244
+ const fluidContainer = new FluidContainer(container, rootDataObject);
245
+ fluidContainer.attach = attach;
246
+ return fluidContainer;
273
247
  }
274
248
  // #endregion
275
249
  }
@@ -2,9 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import axios from "axios";
5
6
 
6
7
  import { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
7
- import axios from "axios";
8
+
8
9
  import { AzureMember } from "./interfaces";
9
10
 
10
11
  /**
@@ -20,7 +21,7 @@ export class AzureFunctionTokenProvider implements ITokenProvider {
20
21
  constructor(
21
22
  private readonly azFunctionUrl: string,
22
23
  private readonly user?: Pick<AzureMember, "userId" | "userName" | "additionalDetails">,
23
- ) { }
24
+ ) {}
24
25
 
25
26
  public async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {
26
27
  return {
@@ -41,7 +42,7 @@ export class AzureFunctionTokenProvider implements ITokenProvider {
41
42
  documentId,
42
43
  userId: this.user?.userId,
43
44
  userName: this.user?.userName,
44
- additionalDetails: this.user?.additionalDetails,
45
+ additionalDetails: this.user?.additionalDetails as unknown,
45
46
  },
46
47
  });
47
48
  return response.data as string;
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
-
6
5
  import { IRequest } from "@fluidframework/core-interfaces";
7
6
  import {
8
7
  DriverHeader,
@@ -11,23 +10,21 @@ import {
11
10
  IUrlResolver,
12
11
  } from "@fluidframework/driver-definitions";
13
12
 
14
- // Implementation of a URL resolver to resolve documents stored using the Azure Fluid Relay
15
- // based off of the orderer and storage URLs provide. The token provider here can be a
16
- // InsecureTokenProvider for basic scenarios or more robust, secure providers that fulfill the
17
- // ITokenProvider interface
13
+ /**
14
+ * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the
15
+ * Azure Fluid Relay based off of the orderer and storage URLs provide.
16
+ *
17
+ * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure
18
+ * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.
19
+ */
18
20
  export class AzureUrlResolver implements IUrlResolver {
19
- constructor() { }
21
+ constructor() {}
20
22
 
21
23
  public async resolve(request: IRequest): Promise<IFluidResolvedUrl> {
22
- const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(
23
- request.url,
24
- );
24
+ const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);
25
25
  // determine whether the request is for creating of a new container.
26
26
  // such request has the `createNew` header set to true and doesn't have a container ID.
27
- if (
28
- request.headers &&
29
- request.headers[DriverHeader.createNew] === true
30
- ) {
27
+ if (request.headers && request.headers[DriverHeader.createNew] === true) {
31
28
  return {
32
29
  endpoints: {
33
30
  deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,
@@ -46,7 +43,7 @@ export class AzureUrlResolver implements IUrlResolver {
46
43
  throw new Error("Azure URL did not contain containerId");
47
44
  }
48
45
  const documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;
49
- return Promise.resolve({
46
+ return {
50
47
  endpoints: {
51
48
  deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,
52
49
  ordererUrl,
@@ -56,15 +53,12 @@ export class AzureUrlResolver implements IUrlResolver {
56
53
  tokens: {},
57
54
  type: "fluid",
58
55
  url: documentUrl,
59
- });
56
+ };
60
57
  }
61
58
 
62
- public async getAbsoluteUrl(
63
- resolvedUrl: IResolvedUrl,
64
- relativeUrl: string,
65
- ): Promise<string> {
59
+ public async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {
66
60
  if (resolvedUrl.type !== "fluid") {
67
- throw Error("Invalid Resolved Url");
61
+ throw new Error("Invalid Resolved Url");
68
62
  }
69
63
  return `${resolvedUrl.url}/${relativeUrl}`;
70
64
  }
@@ -99,10 +93,7 @@ function decodeAzureUrl(urlString: string): {
99
93
  };
100
94
  }
101
95
 
102
- export const createAzureCreateNewRequest = (
103
- endpointUrl: string,
104
- tenantId: string,
105
- ): IRequest => {
96
+ export const createAzureCreateNewRequest = (endpointUrl: string, tenantId: string): IRequest => {
106
97
  const url = new URL(endpointUrl);
107
98
  url.searchParams.append("storage", encodeURIComponent(endpointUrl));
108
99
  url.searchParams.append("tenantId", encodeURIComponent(tenantId));
package/src/index.ts CHANGED
@@ -9,10 +9,24 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
 
12
- export * from "./AzureAudience";
13
- export * from "./AzureClient";
14
- export * from "./AzureFunctionTokenProvider";
15
- export * from "./interfaces";
12
+ export { AzureAudience } from "./AzureAudience";
13
+ export { AzureClient } from "./AzureClient";
14
+ export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider";
15
+ export {
16
+ AzureClientProps,
17
+ AzureConnectionConfig,
18
+ AzureConnectionConfigType,
19
+ AzureContainerServices,
20
+ AzureContainerVersion,
21
+ AzureGetVersionsOptions,
22
+ AzureLocalConnectionConfig,
23
+ AzureMember,
24
+ AzureRemoteConnectionConfig,
25
+ AzureUser,
26
+ IAzureAudience,
27
+ ITelemetryBaseEvent,
28
+ ITelemetryBaseLogger,
29
+ } from "./interfaces";
16
30
 
17
31
  export { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
18
- export { ScopeType, ITokenClaims, IUser } from "@fluidframework/protocol-definitions";
32
+ export { ITokenClaims, IUser, ScopeType } from "@fluidframework/protocol-definitions";