@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.
- package/.eslintrc.js +5 -37
- package/.prettierignore +5 -0
- package/README.md +88 -29
- package/api-extractor.json +10 -10
- package/dist/AzureAudience.d.ts.map +1 -1
- package/dist/AzureAudience.js.map +1 -1
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/AzureClient.js.map +1 -1
- package/dist/AzureFunctionTokenProvider.d.ts +4 -0
- package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/dist/AzureFunctionTokenProvider.js +4 -0
- package/dist/AzureFunctionTokenProvider.js.map +1 -1
- package/dist/AzureUrlResolver.d.ts +7 -0
- package/dist/AzureUrlResolver.d.ts.map +1 -1
- package/dist/AzureUrlResolver.js +7 -0
- package/dist/AzureUrlResolver.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/AzureAudience.d.ts.map +1 -1
- package/lib/AzureAudience.js.map +1 -1
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.js.map +1 -1
- package/lib/AzureFunctionTokenProvider.d.ts +4 -0
- package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/lib/AzureFunctionTokenProvider.js +4 -0
- package/lib/AzureFunctionTokenProvider.js.map +1 -1
- package/lib/AzureUrlResolver.d.ts +7 -0
- package/lib/AzureUrlResolver.d.ts.map +1 -1
- package/lib/AzureUrlResolver.js +7 -0
- package/lib/AzureUrlResolver.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +92 -97
- package/src/AzureAudience.ts +19 -19
- package/src/AzureClient.ts +203 -203
- package/src/AzureFunctionTokenProvider.ts +35 -31
- package/src/AzureUrlResolver.ts +87 -80
- package/src/index.ts +13 -13
- package/src/interfaces.ts +66 -66
- package/src/packageVersion.ts +1 -1
- package/src/utils.ts +7 -7
- package/tsconfig.esnext.json +5 -5
- package/tsconfig.json +9 -9
package/src/AzureClient.ts
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
53
|
-
|
|
52
|
+
private readonly documentServiceFactory: IDocumentServiceFactory;
|
|
53
|
+
private readonly urlResolver: IUrlResolver;
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
const container = await loader.createDetachedContainer({
|
|
84
|
+
package: "no-dynamic-package",
|
|
85
|
+
config: {},
|
|
86
|
+
});
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
if (sourceContainer.resolvedUrl === undefined) {
|
|
117
|
+
throw new Error("Source container cannot resolve URL.");
|
|
118
|
+
}
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
131
|
+
const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
return versions.map((item) => {
|
|
193
|
+
return { id: item.id, date: item.date };
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
private getContainerServices(container: IContainer): AzureContainerServices {
|
|
198
|
+
return {
|
|
199
|
+
audience: new AzureAudience(container),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
202
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
|
|
241
|
+
const rootDataObject = await requestFluidObject<RootDataObject>(container, "/");
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
}
|