@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
package/src/interfaces.ts CHANGED
@@ -2,19 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
-
6
5
  import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
7
- import {
8
- IMember,
9
- IServiceAudience,
10
- } from "@fluidframework/fluid-static";
6
+ import { IMember, IServiceAudience } from "@fluidframework/fluid-static";
7
+ import { IUser } from "@fluidframework/protocol-definitions";
11
8
  import { ITokenProvider } from "@fluidframework/routerlicious-driver";
12
9
 
13
10
  // Re-export so developers can build loggers without pulling in common-definitions
14
- export {
15
- ITelemetryBaseEvent,
16
- ITelemetryBaseLogger,
17
- } from "@fluidframework/common-definitions";
11
+ export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
18
12
 
19
13
  /**
20
14
  * Props for initializing a new AzureClient instance
@@ -23,7 +17,7 @@ export interface AzureClientProps {
23
17
  /**
24
18
  * Configuration for establishing a connection with the Azure Fluid Relay.
25
19
  */
26
- readonly connection: AzureConnectionConfig;
20
+ readonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;
27
21
  /**
28
22
  * Optional. A logger instance to receive diagnostic messages.
29
23
  */
@@ -121,11 +115,47 @@ export interface AzureContainerServices {
121
115
  }
122
116
 
123
117
  /**
124
- * Since Azure provides user names for all of its members, we extend the IMember interface to include
125
- * this service-specific value. It will be returned for all audience members connected to Azure.
118
+ * Since Azure provides user names for all of its members, we extend the
119
+ * {@link @fluidframework/protocol-definitions#IUser} interface to include this service-specific value. *
120
+ *
121
+ * @typeParam T - See {@link AzureUser.additionalDetails}.
122
+ * Note: must be JSON-serializable.
123
+ * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.
124
+ */
125
+ // TODO: this should be updated to use something other than `any` (unknown)
126
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
+ export interface AzureUser<T = any> extends IUser {
128
+ /**
129
+ * The user's name
130
+ */
131
+ name: string;
132
+
133
+ /**
134
+ * Custom, app-specific user information
135
+ */
136
+ additionalDetails?: T;
137
+ }
138
+
139
+ /**
140
+ * Since Azure provides user names for all of its members, we extend the
141
+ * {@link @fluidframework/protocol-definitions#IMember} interface to include this service-specific value.
142
+ * It will be returned for all audience members connected to Azure.
143
+ *
144
+ * @typeParam T - See {@link AzureMember.additionalDetails}.
145
+ * Note: must be JSON-serializable.
146
+ * Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.
126
147
  */
148
+ // TODO: this should be updated to use something other than `any` (unknown)
149
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
150
  export interface AzureMember<T = any> extends IMember {
151
+ /**
152
+ * {@inheritDoc AzureUser.name}
153
+ */
128
154
  userName: string;
155
+
156
+ /**
157
+ * {@inheritDoc AzureUser.additionalDetails}
158
+ */
129
159
  additionalDetails?: T;
130
160
  }
131
161
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/azure-client";
9
- export const pkgVersion = "1.0.2";
9
+ export const pkgVersion = "1.1.0-101037";
package/src/utils.ts CHANGED
@@ -2,13 +2,18 @@
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 {
6
+ AzureConnectionConfig,
7
+ AzureLocalConnectionConfig,
8
+ AzureRemoteConnectionConfig,
9
+ } from "./interfaces";
6
10
 
7
11
  /**
8
12
  * Type guard for validating a given AzureConnectionConfig is a remote connection type (AzureRemoteConnectionConfig)
9
13
  */
10
14
  export function isAzureRemoteConnectionConfig(
11
- connectionConfig: AzureConnectionConfig): connectionConfig is AzureRemoteConnectionConfig {
15
+ connectionConfig: AzureConnectionConfig,
16
+ ): connectionConfig is AzureRemoteConnectionConfig {
12
17
  return connectionConfig.type === "remote";
13
18
  }
14
19
 
@@ -16,6 +21,7 @@ export function isAzureRemoteConnectionConfig(
16
21
  * Type guard for validating a given AzureConnectionConfig is a local connection type (AzureLocalConnectionConfig)
17
22
  */
18
23
  export function isAzureLocalConnectionConfig(
19
- connectionConfig: AzureConnectionConfig): connectionConfig is AzureLocalConnectionConfig {
24
+ connectionConfig: AzureConnectionConfig,
25
+ ): connectionConfig is AzureLocalConnectionConfig {
20
26
  return connectionConfig.type === "local";
21
27
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "module": "esnext"
6
- },
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib",
5
+ "module": "esnext",
6
+ },
7
7
  }
package/tsconfig.json CHANGED
@@ -1,17 +1,11 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "compilerOptions": {
4
- "rootDir": "./src",
5
- "outDir": "./dist",
6
- "composite": true,
7
- "types": [
8
- "node"
9
- ]
10
- },
11
- "include": [
12
- "src/**/*"
13
- ],
14
- "exclude": [
15
- "src/test/**/*"
16
- ]
2
+ "extends": "@fluidframework/build-common/ts-common-config.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "outDir": "./dist",
6
+ "composite": true,
7
+ "types": ["node"],
8
+ },
9
+ "include": ["src/**/*"],
10
+ "exclude": ["src/test/**/*"],
17
11
  }