@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
@@ -3,19 +3,19 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import {
6
- AttachState,
7
- IContainer,
8
- IFluidModuleWithDetails,
6
+ AttachState,
7
+ IContainer,
8
+ IFluidModuleWithDetails,
9
9
  } from "@fluidframework/container-definitions";
10
10
  import { Loader } from "@fluidframework/container-loader";
11
11
  import { IDocumentServiceFactory, IUrlResolver } from "@fluidframework/driver-definitions";
12
12
  import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils";
13
13
  import {
14
- ContainerSchema,
15
- DOProviderContainerRuntimeFactory,
16
- FluidContainer,
17
- IFluidContainer,
18
- RootDataObject,
14
+ ContainerSchema,
15
+ DOProviderContainerRuntimeFactory,
16
+ FluidContainer,
17
+ IFluidContainer,
18
+ RootDataObject,
19
19
  } from "@fluidframework/fluid-static";
20
20
  import { IClient, SummaryType } from "@fluidframework/protocol-definitions";
21
21
  import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver";
@@ -24,11 +24,11 @@ import { requestFluidObject } from "@fluidframework/runtime-utils";
24
24
  import { AzureAudience } from "./AzureAudience";
25
25
  import { AzureUrlResolver, createAzureCreateNewRequest } from "./AzureUrlResolver";
26
26
  import {
27
- AzureClientProps,
28
- AzureConnectionConfig,
29
- AzureContainerServices,
30
- AzureContainerVersion,
31
- AzureGetVersionsOptions,
27
+ AzureClientProps,
28
+ AzureConnectionConfig,
29
+ AzureContainerServices,
30
+ AzureContainerVersion,
31
+ AzureGetVersionsOptions,
32
32
  } from "./interfaces";
33
33
  import { isAzureRemoteConnectionConfig } from "./utils";
34
34
 
@@ -37,9 +37,9 @@ import { isAzureRemoteConnectionConfig } from "./utils";
37
37
  */
38
38
  const LOCAL_MODE_TENANT_ID = "local";
39
39
  const getTenantId = (connectionProps: AzureConnectionConfig): string => {
40
- return isAzureRemoteConnectionConfig(connectionProps)
41
- ? connectionProps.tenantId
42
- : LOCAL_MODE_TENANT_ID;
40
+ return isAzureRemoteConnectionConfig(connectionProps)
41
+ ? connectionProps.tenantId
42
+ : LOCAL_MODE_TENANT_ID;
43
43
  };
44
44
 
45
45
  const MAX_VERSION_COUNT = 5;
@@ -49,212 +49,212 @@ const MAX_VERSION_COUNT = 5;
49
49
  * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.
50
50
  */
51
51
  export class AzureClient {
52
- private readonly documentServiceFactory: IDocumentServiceFactory;
53
- private readonly urlResolver: IUrlResolver;
52
+ private readonly documentServiceFactory: IDocumentServiceFactory;
53
+ private readonly urlResolver: IUrlResolver;
54
54
 
55
- /**
56
- * Creates a new client instance using configuration parameters.
57
- * @param props - Properties for initializing a new AzureClient instance
58
- */
59
- constructor(private readonly props: AzureClientProps) {
60
- // remove trailing slash from URL if any
61
- props.connection.endpoint = props.connection.endpoint.replace(/\/$/, "");
62
- this.urlResolver = new AzureUrlResolver();
63
- // The local service implementation differs from the Azure Fluid Relay in blob
64
- // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
65
- const isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);
66
- this.documentServiceFactory = new RouterliciousDocumentServiceFactory(
67
- this.props.connection.tokenProvider,
68
- { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },
69
- );
70
- }
55
+ /**
56
+ * Creates a new client instance using configuration parameters.
57
+ * @param props - Properties for initializing a new AzureClient instance
58
+ */
59
+ public constructor(private readonly props: AzureClientProps) {
60
+ // remove trailing slash from URL if any
61
+ props.connection.endpoint = props.connection.endpoint.replace(/\/$/, "");
62
+ this.urlResolver = new AzureUrlResolver();
63
+ // The local service implementation differs from the Azure Fluid Relay in blob
64
+ // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
65
+ const isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);
66
+ this.documentServiceFactory = new RouterliciousDocumentServiceFactory(
67
+ this.props.connection.tokenProvider,
68
+ { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },
69
+ );
70
+ }
71
71
 
72
- /**
73
- * Creates a new detached container instance in the Azure Fluid Relay.
74
- * @param containerSchema - Container schema for the new container.
75
- * @returns New detached container instance along with associated services.
76
- */
77
- public async createContainer(containerSchema: ContainerSchema): Promise<{
78
- container: IFluidContainer;
79
- services: AzureContainerServices;
80
- }> {
81
- const loader = this.createLoader(containerSchema);
72
+ /**
73
+ * Creates a new detached container instance in the Azure Fluid Relay.
74
+ * @param containerSchema - Container schema for the new container.
75
+ * @returns New detached container instance along with associated services.
76
+ */
77
+ public async createContainer(containerSchema: ContainerSchema): Promise<{
78
+ container: IFluidContainer;
79
+ services: AzureContainerServices;
80
+ }> {
81
+ const loader = this.createLoader(containerSchema);
82
82
 
83
- const container = await loader.createDetachedContainer({
84
- package: "no-dynamic-package",
85
- config: {},
86
- });
83
+ const container = await loader.createDetachedContainer({
84
+ package: "no-dynamic-package",
85
+ config: {},
86
+ });
87
87
 
88
- const fluidContainer = await this.createFluidContainer(container, this.props.connection);
89
- const services = this.getContainerServices(container);
90
- return { container: fluidContainer, services };
91
- }
88
+ const fluidContainer = await this.createFluidContainer(container, this.props.connection);
89
+ const services = this.getContainerServices(container);
90
+ return { container: fluidContainer, services };
91
+ }
92
92
 
93
- /**
94
- * Creates new detached container out of specific version of another container.
95
- * @param id - Unique ID of the source container in Azure Fluid Relay.
96
- * @param containerSchema - Container schema used to access data objects in the container.
97
- * @param version - Unique version of the source container in Azure Fluid Relay.
98
- * It defaults to latest version if parameter not provided.
99
- * @returns New detached container instance along with associated services.
100
- */
101
- public async copyContainer(
102
- id: string,
103
- containerSchema: ContainerSchema,
104
- version?: AzureContainerVersion,
105
- ): Promise<{
106
- container: IFluidContainer;
107
- services: AzureContainerServices;
108
- }> {
109
- const loader = this.createLoader(containerSchema);
110
- const url = new URL(this.props.connection.endpoint);
111
- url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
112
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
113
- url.searchParams.append("containerId", encodeURIComponent(id));
114
- const sourceContainer = await loader.resolve({ url: url.href });
93
+ /**
94
+ * Creates new detached container out of specific version of another container.
95
+ * @param id - Unique ID of the source container in Azure Fluid Relay.
96
+ * @param containerSchema - Container schema used to access data objects in the container.
97
+ * @param version - Unique version of the source container in Azure Fluid Relay.
98
+ * It defaults to latest version if parameter not provided.
99
+ * @returns New detached container instance along with associated services.
100
+ */
101
+ public async copyContainer(
102
+ id: string,
103
+ containerSchema: ContainerSchema,
104
+ version?: AzureContainerVersion,
105
+ ): Promise<{
106
+ container: IFluidContainer;
107
+ services: AzureContainerServices;
108
+ }> {
109
+ const loader = this.createLoader(containerSchema);
110
+ const url = new URL(this.props.connection.endpoint);
111
+ url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
112
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
113
+ url.searchParams.append("containerId", encodeURIComponent(id));
114
+ const sourceContainer = await loader.resolve({ url: url.href });
115
115
 
116
- if (sourceContainer.resolvedUrl === undefined) {
117
- throw new Error("Source container cannot resolve URL.");
118
- }
116
+ if (sourceContainer.resolvedUrl === undefined) {
117
+ throw new Error("Source container cannot resolve URL.");
118
+ }
119
119
 
120
- const documentService = await this.documentServiceFactory.createDocumentService(
121
- sourceContainer.resolvedUrl,
122
- );
123
- const storage = await documentService.connectToStorage();
124
- const handle = {
125
- type: SummaryType.Handle,
126
- handleType: SummaryType.Tree,
127
- handle: version?.id ?? "latest",
128
- };
129
- const tree = await storage.downloadSummary(handle);
120
+ const documentService = await this.documentServiceFactory.createDocumentService(
121
+ sourceContainer.resolvedUrl,
122
+ );
123
+ const storage = await documentService.connectToStorage();
124
+ const handle = {
125
+ type: SummaryType.Handle,
126
+ handleType: SummaryType.Tree,
127
+ handle: version?.id ?? "latest",
128
+ };
129
+ const tree = await storage.downloadSummary(handle);
130
130
 
131
- const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));
131
+ const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));
132
132
 
133
- const fluidContainer = await this.createFluidContainer(container, this.props.connection);
134
- const services = this.getContainerServices(container);
135
- return { container: fluidContainer, services };
136
- }
133
+ const fluidContainer = await this.createFluidContainer(container, this.props.connection);
134
+ const services = this.getContainerServices(container);
135
+ return { container: fluidContainer, services };
136
+ }
137
137
 
138
- /**
139
- * Accesses the existing container given its unique ID in the Azure Fluid Relay.
140
- * @param id - Unique ID of the container in Azure Fluid Relay.
141
- * @param containerSchema - Container schema used to access data objects in the container.
142
- * @returns Existing container instance along with associated services.
143
- */
144
- public async getContainer(
145
- id: string,
146
- containerSchema: ContainerSchema,
147
- ): Promise<{
148
- container: IFluidContainer;
149
- services: AzureContainerServices;
150
- }> {
151
- const loader = this.createLoader(containerSchema);
152
- const url = new URL(this.props.connection.endpoint);
153
- url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
154
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
155
- url.searchParams.append("containerId", encodeURIComponent(id));
156
- const container = await loader.resolve({ url: url.href });
157
- const rootDataObject = await requestFluidObject<RootDataObject>(container, "/");
158
- const fluidContainer = new FluidContainer(container, rootDataObject);
159
- const services = this.getContainerServices(container);
160
- return { container: fluidContainer, services };
161
- }
138
+ /**
139
+ * Accesses the existing container given its unique ID in the Azure Fluid Relay.
140
+ * @param id - Unique ID of the container in Azure Fluid Relay.
141
+ * @param containerSchema - Container schema used to access data objects in the container.
142
+ * @returns Existing container instance along with associated services.
143
+ */
144
+ public async getContainer(
145
+ id: string,
146
+ containerSchema: ContainerSchema,
147
+ ): Promise<{
148
+ container: IFluidContainer;
149
+ services: AzureContainerServices;
150
+ }> {
151
+ const loader = this.createLoader(containerSchema);
152
+ const url = new URL(this.props.connection.endpoint);
153
+ url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
154
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
155
+ url.searchParams.append("containerId", encodeURIComponent(id));
156
+ const container = await loader.resolve({ url: url.href });
157
+ const rootDataObject = await requestFluidObject<RootDataObject>(container, "/");
158
+ const fluidContainer = new FluidContainer(container, rootDataObject);
159
+ const services = this.getContainerServices(container);
160
+ return { container: fluidContainer, services };
161
+ }
162
162
 
163
- /**
164
- * Get the list of versions for specific container.
165
- * @param id - Unique ID of the source container in Azure Fluid Relay.
166
- * @param options - "Get" options. If options are not provided, API
167
- * will assume maxCount of versions to retreive to be 5.
168
- * @returns Array of available container versions.
169
- */
170
- public async getContainerVersions(
171
- id: string,
172
- options?: AzureGetVersionsOptions,
173
- ): Promise<AzureContainerVersion[]> {
174
- const url = new URL(this.props.connection.endpoint);
175
- url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
176
- url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
177
- url.searchParams.append("containerId", encodeURIComponent(id));
163
+ /**
164
+ * Get the list of versions for specific container.
165
+ * @param id - Unique ID of the source container in Azure Fluid Relay.
166
+ * @param options - "Get" options. If options are not provided, API
167
+ * will assume maxCount of versions to retreive to be 5.
168
+ * @returns Array of available container versions.
169
+ */
170
+ public async getContainerVersions(
171
+ id: string,
172
+ options?: AzureGetVersionsOptions,
173
+ ): Promise<AzureContainerVersion[]> {
174
+ const url = new URL(this.props.connection.endpoint);
175
+ url.searchParams.append("storage", encodeURIComponent(this.props.connection.endpoint));
176
+ url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.props.connection)));
177
+ url.searchParams.append("containerId", encodeURIComponent(id));
178
178
 
179
- const resolvedUrl = await this.urlResolver.resolve({ url: url.href });
180
- if (!resolvedUrl) {
181
- throw new Error("Unable to resolved URL");
182
- }
183
- const documentService = await this.documentServiceFactory.createDocumentService(
184
- resolvedUrl,
185
- );
186
- const storage = await documentService.connectToStorage();
179
+ const resolvedUrl = await this.urlResolver.resolve({ url: url.href });
180
+ if (!resolvedUrl) {
181
+ throw new Error("Unable to resolved URL");
182
+ }
183
+ const documentService = await this.documentServiceFactory.createDocumentService(
184
+ resolvedUrl,
185
+ );
186
+ const storage = await documentService.connectToStorage();
187
187
 
188
- // External API uses null
189
- // eslint-disable-next-line unicorn/no-null
190
- const versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);
188
+ // External API uses null
189
+ // eslint-disable-next-line unicorn/no-null
190
+ const versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);
191
191
 
192
- return versions.map((item) => {
193
- return { id: item.id, date: item.date };
194
- });
195
- }
192
+ return versions.map((item) => {
193
+ return { id: item.id, date: item.date };
194
+ });
195
+ }
196
196
 
197
- private getContainerServices(container: IContainer): AzureContainerServices {
198
- return {
199
- audience: new AzureAudience(container),
200
- };
201
- }
197
+ private getContainerServices(container: IContainer): AzureContainerServices {
198
+ return {
199
+ audience: new AzureAudience(container),
200
+ };
201
+ }
202
202
 
203
- private createLoader(containerSchema: ContainerSchema): Loader {
204
- const runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);
205
- const load = async (): Promise<IFluidModuleWithDetails> => {
206
- return {
207
- module: { fluidExport: runtimeFactory },
208
- details: { package: "no-dynamic-package", config: {} },
209
- };
210
- };
203
+ private createLoader(containerSchema: ContainerSchema): Loader {
204
+ const runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);
205
+ const load = async (): Promise<IFluidModuleWithDetails> => {
206
+ return {
207
+ module: { fluidExport: runtimeFactory },
208
+ details: { package: "no-dynamic-package", config: {} },
209
+ };
210
+ };
211
211
 
212
- const codeLoader = { load };
213
- const client: IClient = {
214
- details: {
215
- capabilities: { interactive: true },
216
- },
217
- permission: [],
218
- scopes: [],
219
- user: { id: "" },
220
- mode: "write",
221
- };
212
+ const codeLoader = { load };
213
+ const client: IClient = {
214
+ details: {
215
+ capabilities: { interactive: true },
216
+ },
217
+ permission: [],
218
+ scopes: [],
219
+ user: { id: "" },
220
+ mode: "write",
221
+ };
222
222
 
223
- return new Loader({
224
- urlResolver: this.urlResolver,
225
- documentServiceFactory: this.documentServiceFactory,
226
- codeLoader,
227
- logger: this.props.logger,
228
- options: { client },
229
- });
230
- }
223
+ return new Loader({
224
+ urlResolver: this.urlResolver,
225
+ documentServiceFactory: this.documentServiceFactory,
226
+ codeLoader,
227
+ logger: this.props.logger,
228
+ options: { client },
229
+ });
230
+ }
231
231
 
232
- private async createFluidContainer(
233
- container: IContainer,
234
- connection: AzureConnectionConfig,
235
- ): Promise<FluidContainer> {
236
- const createNewRequest = createAzureCreateNewRequest(
237
- connection.endpoint,
238
- getTenantId(connection),
239
- );
232
+ private async createFluidContainer(
233
+ container: IContainer,
234
+ connection: AzureConnectionConfig,
235
+ ): Promise<FluidContainer> {
236
+ const createNewRequest = createAzureCreateNewRequest(
237
+ connection.endpoint,
238
+ getTenantId(connection),
239
+ );
240
240
 
241
- const rootDataObject = await requestFluidObject<RootDataObject>(container, "/");
241
+ const rootDataObject = await requestFluidObject<RootDataObject>(container, "/");
242
242
 
243
- /**
244
- * See {@link FluidContainer.attach}
245
- */
246
- const attach = async (): Promise<string> => {
247
- if (container.attachState !== AttachState.Detached) {
248
- throw new Error("Cannot attach container. Container is not in detached state");
249
- }
250
- await container.attach(createNewRequest);
251
- const resolved = container.resolvedUrl;
252
- ensureFluidResolvedUrl(resolved);
253
- return resolved.id;
254
- };
255
- const fluidContainer = new FluidContainer(container, rootDataObject);
256
- fluidContainer.attach = attach;
257
- return fluidContainer;
258
- }
259
- // #endregion
243
+ /**
244
+ * See {@link FluidContainer.attach}
245
+ */
246
+ const attach = async (): Promise<string> => {
247
+ if (container.attachState !== AttachState.Detached) {
248
+ throw new Error("Cannot attach container. Container is not in detached state");
249
+ }
250
+ await container.attach(createNewRequest);
251
+ const resolved = container.resolvedUrl;
252
+ ensureFluidResolvedUrl(resolved);
253
+ return resolved.id;
254
+ };
255
+ const fluidContainer = new FluidContainer(container, rootDataObject);
256
+ fluidContainer.attach = attach;
257
+ return fluidContainer;
258
+ }
259
+ // #endregion
260
260
  }
@@ -11,40 +11,44 @@ import { AzureMember } from "./interfaces";
11
11
  /**
12
12
  * Token Provider implementation for connecting to an Azure Function endpoint for
13
13
  * Azure Fluid Relay token resolution.
14
+ *
15
+ * @deprecated 1.2.0, This API will be removed in 2.0.0
16
+ * No replacement since it is not expected anyone will use this token provider as is
17
+ * See https://github.com/microsoft/FluidFramework/issues/13693 for context
14
18
  */
15
19
  export class AzureFunctionTokenProvider implements ITokenProvider {
16
- /**
17
- * Creates a new instance using configuration parameters.
18
- * @param azFunctionUrl - URL to Azure Function endpoint
19
- * @param user - User object
20
- */
21
- constructor(
22
- private readonly azFunctionUrl: string,
23
- private readonly user?: Pick<AzureMember, "userId" | "userName" | "additionalDetails">,
24
- ) {}
20
+ /**
21
+ * Creates a new instance using configuration parameters.
22
+ * @param azFunctionUrl - URL to Azure Function endpoint
23
+ * @param user - User object
24
+ */
25
+ public constructor(
26
+ private readonly azFunctionUrl: string,
27
+ private readonly user?: Pick<AzureMember, "userId" | "userName" | "additionalDetails">,
28
+ ) {}
25
29
 
26
- public async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {
27
- return {
28
- jwt: await this.getToken(tenantId, documentId),
29
- };
30
- }
30
+ public async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {
31
+ return {
32
+ jwt: await this.getToken(tenantId, documentId),
33
+ };
34
+ }
31
35
 
32
- public async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {
33
- return {
34
- jwt: await this.getToken(tenantId, documentId),
35
- };
36
- }
36
+ public async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {
37
+ return {
38
+ jwt: await this.getToken(tenantId, documentId),
39
+ };
40
+ }
37
41
 
38
- private async getToken(tenantId: string, documentId?: string): Promise<string> {
39
- const response = await axios.get(this.azFunctionUrl, {
40
- params: {
41
- tenantId,
42
- documentId,
43
- userId: this.user?.userId,
44
- userName: this.user?.userName,
45
- additionalDetails: this.user?.additionalDetails as unknown,
46
- },
47
- });
48
- return response.data as string;
49
- }
42
+ private async getToken(tenantId: string, documentId?: string): Promise<string> {
43
+ const response = await axios.get(this.azFunctionUrl, {
44
+ params: {
45
+ tenantId,
46
+ documentId,
47
+ userId: this.user?.userId,
48
+ userName: this.user?.userName,
49
+ additionalDetails: this.user?.additionalDetails as unknown,
50
+ },
51
+ });
52
+ return response.data as string;
53
+ }
50
54
  }