@fluidframework/azure-client 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.203917
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 +31 -1
- package/CHANGELOG.md +52 -0
- package/api-extractor.json +1 -9
- package/api-report/azure-client.api.md +131 -0
- package/dist/AzureAudience.d.ts +4 -2
- package/dist/AzureAudience.d.ts.map +1 -1
- package/dist/AzureAudience.js +2 -0
- package/dist/AzureAudience.js.map +1 -1
- package/dist/AzureClient.d.ts +7 -5
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/AzureClient.js +28 -24
- package/dist/AzureClient.js.map +1 -1
- package/dist/AzureFunctionTokenProvider.d.ts +4 -2
- package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/dist/AzureFunctionTokenProvider.js +2 -0
- package/dist/AzureFunctionTokenProvider.js.map +1 -1
- package/dist/AzureUrlResolver.d.ts +2 -2
- package/dist/AzureUrlResolver.d.ts.map +1 -1
- package/dist/AzureUrlResolver.js +5 -5
- package/dist/AzureUrlResolver.js.map +1 -1
- package/dist/azure-client-alpha.d.ts +312 -0
- package/dist/azure-client-beta.d.ts +312 -0
- package/dist/azure-client-public.d.ts +312 -0
- package/dist/azure-client-untrimmed.d.ts +321 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +43 -15
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/AzureAudience.d.ts +4 -2
- package/lib/AzureAudience.d.ts.map +1 -1
- package/lib/AzureAudience.js +2 -0
- package/lib/AzureAudience.js.map +1 -1
- package/lib/AzureClient.d.ts +7 -5
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.js +28 -24
- package/lib/AzureClient.js.map +1 -1
- package/lib/AzureFunctionTokenProvider.d.ts +4 -2
- package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/lib/AzureFunctionTokenProvider.js +2 -0
- package/lib/AzureFunctionTokenProvider.js.map +1 -1
- package/lib/AzureUrlResolver.d.ts +2 -2
- package/lib/AzureUrlResolver.d.ts.map +1 -1
- package/lib/AzureUrlResolver.js +6 -6
- package/lib/AzureUrlResolver.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +43 -15
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +41 -31
- package/src/AzureAudience.ts +4 -2
- package/src/AzureClient.ts +60 -39
- package/src/AzureFunctionTokenProvider.ts +4 -2
- package/src/AzureUrlResolver.ts +11 -7
- package/src/index.ts +4 -3
- package/src/interfaces.ts +41 -13
- package/src/utils.ts +1 -1
package/.eslintrc.js
CHANGED
|
@@ -5,8 +5,38 @@
|
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
|
|
8
|
-
plugins: ["eslint-plugin-jsdoc"],
|
|
9
8
|
parserOptions: {
|
|
10
9
|
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
11
10
|
},
|
|
11
|
+
rules: {
|
|
12
|
+
// Useful for developer accessibility
|
|
13
|
+
"unicorn/prevent-abbreviations": [
|
|
14
|
+
"error",
|
|
15
|
+
{
|
|
16
|
+
// Exact variable name checks.
|
|
17
|
+
// See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#allowlist
|
|
18
|
+
allowList: {
|
|
19
|
+
// Industry-standard index variable name.
|
|
20
|
+
i: true,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
// RegEx-based exclusions
|
|
24
|
+
// See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prevent-abbreviations.md#ignore
|
|
25
|
+
ignore: [
|
|
26
|
+
// "props" has become something of an industry standard abbreviation for "properties".
|
|
27
|
+
// Allow names to include "props" / "Props".
|
|
28
|
+
"[pP]rops",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
overrides: [
|
|
34
|
+
{
|
|
35
|
+
// Overrides for type-tests
|
|
36
|
+
files: ["src/test/types/*"],
|
|
37
|
+
rules: {
|
|
38
|
+
"unicorn/prevent-abbreviations": "off",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
12
42
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @fluidframework/azure-client
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.7.1.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.7.0.0
|
|
8
|
+
|
|
9
|
+
### Major Changes
|
|
10
|
+
|
|
11
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
12
|
+
|
|
13
|
+
This included the following changes from the protocol-definitions release:
|
|
14
|
+
|
|
15
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
16
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
17
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
18
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
19
|
+
ISignalMessageBase interface that contains common members.
|
|
20
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
21
|
+
|
|
22
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
23
|
+
|
|
24
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
25
|
+
|
|
26
|
+
- @fluidframework/gitresources: 2.0.1
|
|
27
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
28
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
29
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
30
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
31
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
32
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
33
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
34
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
35
|
+
- @fluidframework/server-services: 2.0.1
|
|
36
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
37
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
38
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
39
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
40
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
41
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
42
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
43
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
44
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
45
|
+
- tinylicious: 2.0.1
|
|
46
|
+
|
|
47
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
48
|
+
|
|
49
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
50
|
+
|
|
51
|
+
## 2.0.0-internal.6.4.0
|
|
52
|
+
|
|
53
|
+
Dependency updates only.
|
|
54
|
+
|
|
3
55
|
## 2.0.0-internal.6.3.0
|
|
4
56
|
|
|
5
57
|
Dependency updates only.
|
package/api-extractor.json
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "@fluidframework/build-common/api-extractor-
|
|
4
|
-
"apiReport": {
|
|
5
|
-
"enabled": true,
|
|
6
|
-
"reportFolder": "<projectFolder>/../../../api-report/"
|
|
7
|
-
},
|
|
8
|
-
"docModel": {
|
|
9
|
-
"enabled": true,
|
|
10
|
-
"apiJsonFilePath": "<projectFolder>/../../_api-extractor-temp/doc-models/<unscopedPackageName>.api.json"
|
|
11
|
-
}
|
|
3
|
+
"extends": "@fluidframework/build-common/api-extractor-base.json"
|
|
12
4
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
## API Report File for "@fluidframework/azure-client"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { ContainerSchema } from '@fluidframework/fluid-static';
|
|
8
|
+
import { IClient } from '@fluidframework/protocol-definitions';
|
|
9
|
+
import { ICompressionStorageConfig } from '@fluidframework/driver-utils';
|
|
10
|
+
import { IConfigProviderBase } from '@fluidframework/telemetry-utils';
|
|
11
|
+
import { IFluidContainer } from '@fluidframework/fluid-static';
|
|
12
|
+
import { IMember } from '@fluidframework/fluid-static';
|
|
13
|
+
import { IServiceAudience } from '@fluidframework/fluid-static';
|
|
14
|
+
import { ITelemetryBaseEvent } from '@fluidframework/core-interfaces';
|
|
15
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
16
|
+
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
17
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
18
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
19
|
+
import { IUser } from '@fluidframework/protocol-definitions';
|
|
20
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
21
|
+
import { ServiceAudience } from '@fluidframework/fluid-static';
|
|
22
|
+
|
|
23
|
+
// @public
|
|
24
|
+
export class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
25
|
+
// @internal
|
|
26
|
+
protected createServiceMember(audienceMember: IClient): AzureMember;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// @public
|
|
30
|
+
export class AzureClient {
|
|
31
|
+
constructor(properties: AzureClientProps);
|
|
32
|
+
copyContainer(id: string, containerSchema: ContainerSchema, version?: AzureContainerVersion): Promise<{
|
|
33
|
+
container: IFluidContainer;
|
|
34
|
+
services: AzureContainerServices;
|
|
35
|
+
}>;
|
|
36
|
+
createContainer(containerSchema: ContainerSchema): Promise<{
|
|
37
|
+
container: IFluidContainer;
|
|
38
|
+
services: AzureContainerServices;
|
|
39
|
+
}>;
|
|
40
|
+
getContainer(id: string, containerSchema: ContainerSchema): Promise<{
|
|
41
|
+
container: IFluidContainer;
|
|
42
|
+
services: AzureContainerServices;
|
|
43
|
+
}>;
|
|
44
|
+
getContainerVersions(id: string, options?: AzureGetVersionsOptions): Promise<AzureContainerVersion[]>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// @public
|
|
48
|
+
export interface AzureClientProps {
|
|
49
|
+
readonly configProvider?: IConfigProviderBase;
|
|
50
|
+
readonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;
|
|
51
|
+
readonly logger?: ITelemetryBaseLogger;
|
|
52
|
+
// (undocumented)
|
|
53
|
+
readonly summaryCompression?: boolean | ICompressionStorageConfig;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// @public
|
|
57
|
+
export interface AzureConnectionConfig {
|
|
58
|
+
endpoint: string;
|
|
59
|
+
tokenProvider: ITokenProvider;
|
|
60
|
+
type: AzureConnectionConfigType;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// @public
|
|
64
|
+
export type AzureConnectionConfigType = "local" | "remote";
|
|
65
|
+
|
|
66
|
+
// @public
|
|
67
|
+
export interface AzureContainerServices {
|
|
68
|
+
audience: IAzureAudience;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// @public
|
|
72
|
+
export interface AzureContainerVersion {
|
|
73
|
+
date?: string;
|
|
74
|
+
id: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// @public @deprecated
|
|
78
|
+
export class AzureFunctionTokenProvider implements ITokenProvider {
|
|
79
|
+
constructor(azFunctionUrl: string, user?: Pick<AzureMember<any>, "userId" | "userName" | "additionalDetails"> | undefined);
|
|
80
|
+
// (undocumented)
|
|
81
|
+
fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
|
|
82
|
+
// (undocumented)
|
|
83
|
+
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// @public
|
|
87
|
+
export interface AzureGetVersionsOptions {
|
|
88
|
+
maxCount: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// @public
|
|
92
|
+
export interface AzureLocalConnectionConfig extends AzureConnectionConfig {
|
|
93
|
+
type: "local";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// @public
|
|
97
|
+
export interface AzureMember<T = any> extends IMember {
|
|
98
|
+
additionalDetails?: T;
|
|
99
|
+
userName: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// @public
|
|
103
|
+
export interface AzureRemoteConnectionConfig extends AzureConnectionConfig {
|
|
104
|
+
tenantId: string;
|
|
105
|
+
type: "remote";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// @public
|
|
109
|
+
export interface AzureUser<T = any> extends IUser {
|
|
110
|
+
additionalDetails?: T;
|
|
111
|
+
name: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// @public
|
|
115
|
+
export type IAzureAudience = IServiceAudience<AzureMember>;
|
|
116
|
+
|
|
117
|
+
export { ITelemetryBaseEvent }
|
|
118
|
+
|
|
119
|
+
export { ITelemetryBaseLogger }
|
|
120
|
+
|
|
121
|
+
export { ITokenClaims }
|
|
122
|
+
|
|
123
|
+
export { ITokenProvider }
|
|
124
|
+
|
|
125
|
+
export { ITokenResponse }
|
|
126
|
+
|
|
127
|
+
export { IUser }
|
|
128
|
+
|
|
129
|
+
export { ScopeType }
|
|
130
|
+
|
|
131
|
+
```
|
package/dist/AzureAudience.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ServiceAudience } from "@fluidframework/fluid-static";
|
|
2
|
-
import { IClient } from "@fluidframework/protocol-definitions";
|
|
3
|
-
import { AzureMember, IAzureAudience } from "./interfaces";
|
|
2
|
+
import { type IClient } from "@fluidframework/protocol-definitions";
|
|
3
|
+
import { type AzureMember, type IAzureAudience } from "./interfaces";
|
|
4
4
|
/**
|
|
5
5
|
* Azure-specific {@link @fluidframework/fluid-static#ServiceAudience} implementation.
|
|
6
6
|
*
|
|
7
7
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
8
10
|
*/
|
|
9
11
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
10
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,KAAK,WAAW,EAAkB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACxF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAWnE"}
|
package/dist/AzureAudience.js
CHANGED
|
@@ -11,6 +11,8 @@ const fluid_static_1 = require("@fluidframework/fluid-static");
|
|
|
11
11
|
* Azure-specific {@link @fluidframework/fluid-static#ServiceAudience} implementation.
|
|
12
12
|
*
|
|
13
13
|
* @remarks Operates in terms of {@link AzureMember}s.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
14
16
|
*/
|
|
15
17
|
class AzureAudience extends fluid_static_1.ServiceAudience {
|
|
16
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.js","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAoD;AACpD,+DAA+D;AAK/D
|
|
1
|
+
{"version":3,"file":"AzureAudience.js","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAAoD;AACpD,+DAA+D;AAK/D;;;;;;GAMG;AACH,MAAa,aAAc,SAAQ,8BAA4B;IAC9D;;;;;;;;OAQG;IACO,mBAAmB,CAAC,cAAuB;QACpD,MAAM,SAAS,GAAG,cAAc,CAAC,IAAiB,CAAC;QACnD,IAAA,mBAAM,EAAC,SAAS,EAAE,IAAI,KAAK,SAAS,EAAE,uCAAuC,CAAC,CAAC;QAE/E,OAAO;YACN,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE;YAC9B,QAAQ,EAAE,SAAS,CAAC,IAAI;YACxB,WAAW,EAAE,EAAE;YACf,iBAAiB,EAAE,SAAS,CAAC,iBAA4B;SACzD,CAAC;IACH,CAAC;CACD;AArBD,sCAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ServiceAudience } from \"@fluidframework/fluid-static\";\nimport { type IClient } from \"@fluidframework/protocol-definitions\";\n\nimport { type AzureMember, type AzureUser, type IAzureAudience } from \"./interfaces\";\n\n/**\n * Azure-specific {@link @fluidframework/fluid-static#ServiceAudience} implementation.\n *\n * @remarks Operates in terms of {@link AzureMember}s.\n *\n * @public\n */\nexport class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {\n\t/**\n\t * Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided\n\t * {@link @fluidframework/protocol-definitions#IClient | audience member}.\n\t *\n\t * @param audienceMember - Audience member for which the `ServiceAudience` will be generated.\n\t * Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.\n\t *\n\t * @internal\n\t */\n\tprotected createServiceMember(audienceMember: IClient): AzureMember {\n\t\tconst azureUser = audienceMember.user as AzureUser;\n\t\tassert(azureUser?.name !== undefined, 'Provided user was not an \"AzureUser\".');\n\n\t\treturn {\n\t\t\tuserId: audienceMember.user.id,\n\t\t\tuserName: azureUser.name,\n\t\t\tconnections: [],\n\t\t\tadditionalDetails: azureUser.additionalDetails as unknown,\n\t\t};\n\t}\n}\n"]}
|
package/dist/AzureClient.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { ContainerSchema, IFluidContainer } from "@fluidframework/fluid-static";
|
|
2
|
-
import { AzureClientProps, AzureContainerServices, AzureContainerVersion, AzureGetVersionsOptions } from "./interfaces";
|
|
1
|
+
import { type ContainerSchema, type IFluidContainer } from "@fluidframework/fluid-static";
|
|
2
|
+
import { type AzureClientProps, type AzureContainerServices, type AzureContainerVersion, type AzureGetVersionsOptions } from "./interfaces";
|
|
3
3
|
/**
|
|
4
4
|
* AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,
|
|
5
5
|
* when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
6
8
|
*/
|
|
7
9
|
export declare class AzureClient {
|
|
8
|
-
private readonly
|
|
10
|
+
private readonly properties;
|
|
9
11
|
private readonly documentServiceFactory;
|
|
10
12
|
private readonly urlResolver;
|
|
11
13
|
private readonly configProvider;
|
|
12
14
|
/**
|
|
13
15
|
* Creates a new client instance using configuration parameters.
|
|
14
|
-
* @param
|
|
16
|
+
* @param properties - Properties for initializing a new AzureClient instance
|
|
15
17
|
*/
|
|
16
|
-
constructor(
|
|
18
|
+
constructor(properties: AzureClientProps);
|
|
17
19
|
/**
|
|
18
20
|
* Creates a new detached container instance in the Azure Fluid Relay.
|
|
19
21
|
* @param containerSchema - Container schema for the new container.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AzureClient.d.ts","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":"AAeA,OAAO,EACN,KAAK,eAAe,EAGpB,KAAK,eAAe,EAEpB,MAAM,8BAA8B,CAAC;AAStC,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,MAAM,cAAc,CAAC;AAetB;;;;;GAKG;AACH,qBAAa,WAAW;IASJ,OAAO,CAAC,QAAQ,CAAC,UAAU;IAR9C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;IAEjE;;;OAGG;gBACiC,UAAU,EAAE,gBAAgB;IAoBhE;;;;OAIG;IACU,eAAe,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC;QACvE,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAgBF;;;;;;;OAOG;IACU,aAAa,CACzB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAoCF;;;;;OAKG;IACU,YAAY,CACxB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,GAC9B,OAAO,CAAC;QACV,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACjC,CAAC;IAiBF;;;;;;OAMG;IACU,oBAAoB,CAChC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA0BnC,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,YAAY;YA8BN,oBAAoB;CA8BlC"}
|
package/dist/AzureClient.js
CHANGED
|
@@ -11,6 +11,7 @@ const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
|
11
11
|
const fluid_static_1 = require("@fluidframework/fluid-static");
|
|
12
12
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
13
13
|
const routerlicious_driver_1 = require("@fluidframework/routerlicious-driver");
|
|
14
|
+
// eslint-disable-next-line import/no-deprecated
|
|
14
15
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
15
16
|
const AzureAudience_1 = require("./AzureAudience");
|
|
16
17
|
const AzureUrlResolver_1 = require("./AzureUrlResolver");
|
|
@@ -19,35 +20,37 @@ const utils_1 = require("./utils");
|
|
|
19
20
|
* Strongly typed id for connecting to a local Azure Fluid Relay.
|
|
20
21
|
*/
|
|
21
22
|
const LOCAL_MODE_TENANT_ID = "local";
|
|
22
|
-
const getTenantId = (
|
|
23
|
-
return (0, utils_1.isAzureRemoteConnectionConfig)(
|
|
24
|
-
?
|
|
23
|
+
const getTenantId = (connectionProperties) => {
|
|
24
|
+
return (0, utils_1.isAzureRemoteConnectionConfig)(connectionProperties)
|
|
25
|
+
? connectionProperties.tenantId
|
|
25
26
|
: LOCAL_MODE_TENANT_ID;
|
|
26
27
|
};
|
|
27
28
|
const MAX_VERSION_COUNT = 5;
|
|
28
29
|
/**
|
|
29
30
|
* AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,
|
|
30
31
|
* when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
31
34
|
*/
|
|
32
35
|
class AzureClient {
|
|
33
36
|
/**
|
|
34
37
|
* Creates a new client instance using configuration parameters.
|
|
35
|
-
* @param
|
|
38
|
+
* @param properties - Properties for initializing a new AzureClient instance
|
|
36
39
|
*/
|
|
37
|
-
constructor(
|
|
38
|
-
this.
|
|
40
|
+
constructor(properties) {
|
|
41
|
+
this.properties = properties;
|
|
39
42
|
// remove trailing slash from URL if any
|
|
40
|
-
|
|
43
|
+
properties.connection.endpoint = properties.connection.endpoint.replace(/\/$/, "");
|
|
41
44
|
this.urlResolver = new AzureUrlResolver_1.AzureUrlResolver();
|
|
42
45
|
// The local service implementation differs from the Azure Fluid Relay in blob
|
|
43
46
|
// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.
|
|
44
|
-
const isRemoteConnection = (0, utils_1.isAzureRemoteConnectionConfig)(this.
|
|
45
|
-
const origDocumentServiceFactory = new routerlicious_driver_1.RouterliciousDocumentServiceFactory(this.
|
|
47
|
+
const isRemoteConnection = (0, utils_1.isAzureRemoteConnectionConfig)(this.properties.connection);
|
|
48
|
+
const origDocumentServiceFactory = new routerlicious_driver_1.RouterliciousDocumentServiceFactory(this.properties.connection.tokenProvider, {
|
|
46
49
|
enableWholeSummaryUpload: isRemoteConnection,
|
|
47
50
|
enableDiscovery: isRemoteConnection,
|
|
48
51
|
});
|
|
49
|
-
this.documentServiceFactory = (0, driver_utils_1.applyStorageCompression)(origDocumentServiceFactory,
|
|
50
|
-
this.configProvider =
|
|
52
|
+
this.documentServiceFactory = (0, driver_utils_1.applyStorageCompression)(origDocumentServiceFactory, properties.summaryCompression);
|
|
53
|
+
this.configProvider = properties.configProvider;
|
|
51
54
|
}
|
|
52
55
|
/**
|
|
53
56
|
* Creates a new detached container instance in the Azure Fluid Relay.
|
|
@@ -60,7 +63,7 @@ class AzureClient {
|
|
|
60
63
|
package: "no-dynamic-package",
|
|
61
64
|
config: {},
|
|
62
65
|
});
|
|
63
|
-
const fluidContainer = await this.createFluidContainer(container, this.
|
|
66
|
+
const fluidContainer = await this.createFluidContainer(container, this.properties.connection);
|
|
64
67
|
const services = this.getContainerServices(container);
|
|
65
68
|
return { container: fluidContainer, services };
|
|
66
69
|
}
|
|
@@ -74,9 +77,9 @@ class AzureClient {
|
|
|
74
77
|
*/
|
|
75
78
|
async copyContainer(id, containerSchema, version) {
|
|
76
79
|
const loader = this.createLoader(containerSchema);
|
|
77
|
-
const url = new URL(this.
|
|
78
|
-
url.searchParams.append("storage", encodeURIComponent(this.
|
|
79
|
-
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.
|
|
80
|
+
const url = new URL(this.properties.connection.endpoint);
|
|
81
|
+
url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
|
|
82
|
+
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
|
|
80
83
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
81
84
|
const sourceContainer = await loader.resolve({ url: url.href });
|
|
82
85
|
if (sourceContainer.resolvedUrl === undefined) {
|
|
@@ -91,7 +94,7 @@ class AzureClient {
|
|
|
91
94
|
};
|
|
92
95
|
const tree = await storage.downloadSummary(handle);
|
|
93
96
|
const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));
|
|
94
|
-
const fluidContainer = await this.createFluidContainer(container, this.
|
|
97
|
+
const fluidContainer = await this.createFluidContainer(container, this.properties.connection);
|
|
95
98
|
const services = this.getContainerServices(container);
|
|
96
99
|
return { container: fluidContainer, services };
|
|
97
100
|
}
|
|
@@ -103,11 +106,12 @@ class AzureClient {
|
|
|
103
106
|
*/
|
|
104
107
|
async getContainer(id, containerSchema) {
|
|
105
108
|
const loader = this.createLoader(containerSchema);
|
|
106
|
-
const url = new URL(this.
|
|
107
|
-
url.searchParams.append("storage", encodeURIComponent(this.
|
|
108
|
-
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.
|
|
109
|
+
const url = new URL(this.properties.connection.endpoint);
|
|
110
|
+
url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
|
|
111
|
+
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
|
|
109
112
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
110
113
|
const container = await loader.resolve({ url: url.href });
|
|
114
|
+
// eslint-disable-next-line import/no-deprecated
|
|
111
115
|
const rootDataObject = await (0, runtime_utils_1.requestFluidObject)(container, "/");
|
|
112
116
|
const fluidContainer = new fluid_static_1.FluidContainer(container, rootDataObject);
|
|
113
117
|
const services = this.getContainerServices(container);
|
|
@@ -121,9 +125,9 @@ class AzureClient {
|
|
|
121
125
|
* @returns Array of available container versions.
|
|
122
126
|
*/
|
|
123
127
|
async getContainerVersions(id, options) {
|
|
124
|
-
const url = new URL(this.
|
|
125
|
-
url.searchParams.append("storage", encodeURIComponent(this.
|
|
126
|
-
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.
|
|
128
|
+
const url = new URL(this.properties.connection.endpoint);
|
|
129
|
+
url.searchParams.append("storage", encodeURIComponent(this.properties.connection.endpoint));
|
|
130
|
+
url.searchParams.append("tenantId", encodeURIComponent(getTenantId(this.properties.connection)));
|
|
127
131
|
url.searchParams.append("containerId", encodeURIComponent(id));
|
|
128
132
|
const resolvedUrl = await this.urlResolver.resolve({ url: url.href });
|
|
129
133
|
if (!resolvedUrl) {
|
|
@@ -165,13 +169,14 @@ class AzureClient {
|
|
|
165
169
|
urlResolver: this.urlResolver,
|
|
166
170
|
documentServiceFactory: this.documentServiceFactory,
|
|
167
171
|
codeLoader,
|
|
168
|
-
logger: this.
|
|
172
|
+
logger: this.properties.logger,
|
|
169
173
|
options: { client },
|
|
170
174
|
configProvider: this.configProvider,
|
|
171
175
|
});
|
|
172
176
|
}
|
|
173
177
|
async createFluidContainer(container, connection) {
|
|
174
178
|
const createNewRequest = (0, AzureUrlResolver_1.createAzureCreateNewRequest)(connection.endpoint, getTenantId(connection));
|
|
179
|
+
// eslint-disable-next-line import/no-deprecated
|
|
175
180
|
const rootDataObject = await (0, runtime_utils_1.requestFluidObject)(container, "/");
|
|
176
181
|
/**
|
|
177
182
|
* See {@link FluidContainer.attach}
|
|
@@ -184,7 +189,6 @@ class AzureClient {
|
|
|
184
189
|
if (container.resolvedUrl === undefined) {
|
|
185
190
|
throw new Error("Resolved Url not available on attached container");
|
|
186
191
|
}
|
|
187
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
188
192
|
return container.resolvedUrl.id;
|
|
189
193
|
};
|
|
190
194
|
const fluidContainer = new fluid_static_1.FluidContainer(container, rootDataObject);
|
package/dist/AzureClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,iFAI+C;AAC/C,uEAA0D;AAE1D,+DAAuE;AACvE,+DAMsC;AACtC,+EAA4E;AAC5E,+EAA2F;AAC3F,iEAAmE;AAGnE,mDAAgD;AAChD,yDAAmF;AAQnF,mCAAwD;AAExD;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,eAAsC,EAAU,EAAE;IACtE,OAAO,IAAA,qCAA6B,EAAC,eAAe,CAAC;QACp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B,EACrB,UAAiC;QAEjC,MAAM,gBAAgB,GAAG,IAAA,8CAA2B,EACnD,UAAU,CAAC,QAAQ,EACnB,WAAW,CAAC,UAAU,CAAC,CACvB,CAAC;QAEF,MAAM,cAAc,GAAG,MAAM,IAAA,kCAAkB,EAAkB,SAAS,EAAE,GAAG,CAAC,CAAC;QAEjF;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE;gBACnD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAC/E;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE;gBACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACpE;YACD,+DAA+D;YAC/D,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,6BAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AA5ND,kCA4NC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tAttachState,\n\tIContainer,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\tContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\tIFluidContainer,\n\tIRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\n\nimport { IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\tAzureClientProps,\n\tAzureConnectionConfig,\n\tAzureContainerServices,\n\tAzureContainerVersion,\n\tAzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProps: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProps)\n\t\t? connectionProps.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param props - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(private readonly props: AzureClientProps) {\n\t\t// remove trailing slash from URL if any\n\t\tprops.connection.endpoint = props.connection.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.props.connection.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tprops.summaryCompression,\n\t\t);\n\t\tthis.configProvider = props.configProvider;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @param containerSchema - Container schema for the new container.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer(containerSchema: ContainerSchema): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\n\t\tconst container = await loader.createDetachedContainer({\n\t\t\tpackage: \"no-dynamic-package\",\n\t\t\tconfig: {},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer(container, this.props.connection);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Creates new detached container out of specific version of another container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * It defaults to latest version if parameter not provided.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async copyContainer(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst sourceContainer = await loader.resolve({ url: url.href });\n\n\t\tif (sourceContainer.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Source container cannot resolve URL.\");\n\t\t}\n\n\t\tconst documentService = await this.documentServiceFactory.createDocumentService(\n\t\t\tsourceContainer.resolvedUrl,\n\t\t);\n\t\tconst storage = await documentService.connectToStorage();\n\t\tconst handle = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType: SummaryType.Tree,\n\t\t\thandle: version?.id ?? \"latest\",\n\t\t};\n\t\tconst tree = await storage.downloadSummary(handle);\n\n\t\tconst container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\n\n\t\tconst fluidContainer = await this.createFluidContainer(container, this.props.connection);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @returns Existing container instance along with associated services.\n\t */\n\tpublic async getContainer(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loader.resolve({ url: url.href });\n\t\tconst rootDataObject = await requestFluidObject<IRootDataObject>(container, \"/\");\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retreive to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.props.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n\t\turl.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService = await this.documentServiceFactory.createDocumentService(\n\t\t\tresolvedUrl,\n\t\t);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: new AzureAudience(container),\n\t\t};\n\t}\n\n\tprivate createLoader(containerSchema: ContainerSchema): Loader {\n\t\tconst runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn new Loader({\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.props.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t});\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<FluidContainer> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\tconst rootDataObject = await requestFluidObject<IRootDataObject>(container, \"/\");\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,iFAI+C;AAC/C,uEAA0D;AAK1D,+DAAuE;AACvE,+DAMsC;AACtC,+EAAiF;AACjF,+EAA2F;AAC3F,gDAAgD;AAChD,iEAAmE;AAGnE,mDAAgD;AAChD,yDAAmF;AAQnF,mCAAwD;AAExD;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,oBAA2C,EAAU,EAAE;IAC3E,OAAO,IAAA,qCAA6B,EAAC,oBAAoB,CAAC;QACzD,CAAC,CAAC,oBAAoB,CAAC,QAAQ;QAC/B,CAAC,CAAC,oBAAoB,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GA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AAC,UAAU,CAAC,CACvB,CAAC;QAEF,gDAAgD;QAChD,MAAM,cAAc,GAAG,MAAM,IAAA,kCAAkB,EAAkB,SAAS,EAAE,GAAG,CAAC,CAAC;QAEjF;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YAC1C,IAAI,SAAS,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE;gBACnD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAC/E;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE;gBACxC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACpE;YACD,OAAO,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,CAAC,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,6BAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;QAC/B,OAAO,cAAc,CAAC;IACvB,CAAC;CAED;AA3OD,kCA2OC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n\ttype IDocumentServiceFactory,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { applyStorageCompression } from \"@fluidframework/driver-utils\";\nimport {\n\ttype ContainerSchema,\n\tDOProviderContainerRuntimeFactory,\n\tFluidContainer,\n\ttype IFluidContainer,\n\ttype IRootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { type IClient, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\n// eslint-disable-next-line import/no-deprecated\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\n\nimport { type IConfigProviderBase } from \"@fluidframework/telemetry-utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n\ttype AzureClientProps,\n\ttype AzureConnectionConfig,\n\ttype AzureContainerServices,\n\ttype AzureContainerVersion,\n\ttype AzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\n\n/**\n * Strongly typed id for connecting to a local Azure Fluid Relay.\n */\nconst LOCAL_MODE_TENANT_ID = \"local\";\nconst getTenantId = (connectionProperties: AzureConnectionConfig): string => {\n\treturn isAzureRemoteConnectionConfig(connectionProperties)\n\t\t? connectionProperties.tenantId\n\t\t: LOCAL_MODE_TENANT_ID;\n};\n\nconst MAX_VERSION_COUNT = 5;\n\n/**\n * AzureClient provides the ability to have a Fluid object backed by the Azure Fluid Relay or,\n * when running with local tenantId, have it be backed by a local Azure Fluid Relay instance.\n *\n * @public\n */\nexport class AzureClient {\n\tprivate readonly documentServiceFactory: IDocumentServiceFactory;\n\tprivate readonly urlResolver: IUrlResolver;\n\tprivate readonly configProvider: IConfigProviderBase | undefined;\n\n\t/**\n\t * Creates a new client instance using configuration parameters.\n\t * @param properties - Properties for initializing a new AzureClient instance\n\t */\n\tpublic constructor(private readonly properties: AzureClientProps) {\n\t\t// remove trailing slash from URL if any\n\t\tproperties.connection.endpoint = properties.connection.endpoint.replace(/\\/$/, \"\");\n\t\tthis.urlResolver = new AzureUrlResolver();\n\t\t// The local service implementation differs from the Azure Fluid Relay in blob\n\t\t// storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n\t\tconst isRemoteConnection = isAzureRemoteConnectionConfig(this.properties.connection);\n\t\tconst origDocumentServiceFactory: IDocumentServiceFactory =\n\t\t\tnew RouterliciousDocumentServiceFactory(this.properties.connection.tokenProvider, {\n\t\t\t\tenableWholeSummaryUpload: isRemoteConnection,\n\t\t\t\tenableDiscovery: isRemoteConnection,\n\t\t\t});\n\n\t\tthis.documentServiceFactory = applyStorageCompression(\n\t\t\torigDocumentServiceFactory,\n\t\t\tproperties.summaryCompression,\n\t\t);\n\t\tthis.configProvider = properties.configProvider;\n\t}\n\n\t/**\n\t * Creates a new detached container instance in the Azure Fluid Relay.\n\t * @param containerSchema - Container schema for the new container.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async createContainer(containerSchema: ContainerSchema): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\n\t\tconst container = await loader.createDetachedContainer({\n\t\t\tpackage: \"no-dynamic-package\",\n\t\t\tconfig: {},\n\t\t});\n\n\t\tconst fluidContainer = await this.createFluidContainer(\n\t\t\tcontainer,\n\t\t\tthis.properties.connection,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Creates new detached container out of specific version of another container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @param version - Unique version of the source container in Azure Fluid Relay.\n\t * It defaults to latest version if parameter not provided.\n\t * @returns New detached container instance along with associated services.\n\t */\n\tpublic async copyContainer(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t\tversion?: AzureContainerVersion,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.properties.connection)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst sourceContainer = await loader.resolve({ url: url.href });\n\n\t\tif (sourceContainer.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Source container cannot resolve URL.\");\n\t\t}\n\n\t\tconst documentService = await this.documentServiceFactory.createDocumentService(\n\t\t\tsourceContainer.resolvedUrl,\n\t\t);\n\t\tconst storage = await documentService.connectToStorage();\n\t\tconst handle = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType: SummaryType.Tree,\n\t\t\thandle: version?.id ?? \"latest\",\n\t\t};\n\t\tconst tree = await storage.downloadSummary(handle);\n\n\t\tconst container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\n\n\t\tconst fluidContainer = await this.createFluidContainer(\n\t\t\tcontainer,\n\t\t\tthis.properties.connection,\n\t\t);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n\t * @param id - Unique ID of the container in Azure Fluid Relay.\n\t * @param containerSchema - Container schema used to access data objects in the container.\n\t * @returns Existing container instance along with associated services.\n\t */\n\tpublic async getContainer(\n\t\tid: string,\n\t\tcontainerSchema: ContainerSchema,\n\t): Promise<{\n\t\tcontainer: IFluidContainer;\n\t\tservices: AzureContainerServices;\n\t}> {\n\t\tconst loader = this.createLoader(containerSchema);\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.properties.connection)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\t\tconst container = await loader.resolve({ url: url.href });\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tconst rootDataObject = await requestFluidObject<IRootDataObject>(container, \"/\");\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tconst services = this.getContainerServices(container);\n\t\treturn { container: fluidContainer, services };\n\t}\n\n\t/**\n\t * Get the list of versions for specific container.\n\t * @param id - Unique ID of the source container in Azure Fluid Relay.\n\t * @param options - \"Get\" options. If options are not provided, API\n\t * will assume maxCount of versions to retreive to be 5.\n\t * @returns Array of available container versions.\n\t */\n\tpublic async getContainerVersions(\n\t\tid: string,\n\t\toptions?: AzureGetVersionsOptions,\n\t): Promise<AzureContainerVersion[]> {\n\t\tconst url = new URL(this.properties.connection.endpoint);\n\t\turl.searchParams.append(\"storage\", encodeURIComponent(this.properties.connection.endpoint));\n\t\turl.searchParams.append(\n\t\t\t\"tenantId\",\n\t\t\tencodeURIComponent(getTenantId(this.properties.connection)),\n\t\t);\n\t\turl.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n\t\tconst resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n\t\tif (!resolvedUrl) {\n\t\t\tthrow new Error(\"Unable to resolved URL\");\n\t\t}\n\t\tconst documentService =\n\t\t\tawait this.documentServiceFactory.createDocumentService(resolvedUrl);\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\t// External API uses null\n\t\t// eslint-disable-next-line unicorn/no-null\n\t\tconst versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n\t\treturn versions.map((item) => {\n\t\t\treturn { id: item.id, date: item.date };\n\t\t});\n\t}\n\n\tprivate getContainerServices(container: IContainer): AzureContainerServices {\n\t\treturn {\n\t\t\taudience: new AzureAudience(container),\n\t\t};\n\t}\n\n\tprivate createLoader(containerSchema: ContainerSchema): Loader {\n\t\tconst runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);\n\t\tconst load = async (): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn {\n\t\t\t\tmodule: { fluidExport: runtimeFactory },\n\t\t\t\tdetails: { package: \"no-dynamic-package\", config: {} },\n\t\t\t};\n\t\t};\n\n\t\tconst codeLoader = { load };\n\t\tconst client: IClient = {\n\t\t\tdetails: {\n\t\t\t\tcapabilities: { interactive: true },\n\t\t\t},\n\t\t\tpermission: [],\n\t\t\tscopes: [],\n\t\t\tuser: { id: \"\" },\n\t\t\tmode: \"write\",\n\t\t};\n\n\t\treturn new Loader({\n\t\t\turlResolver: this.urlResolver,\n\t\t\tdocumentServiceFactory: this.documentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\tlogger: this.properties.logger,\n\t\t\toptions: { client },\n\t\t\tconfigProvider: this.configProvider,\n\t\t});\n\t}\n\n\tprivate async createFluidContainer(\n\t\tcontainer: IContainer,\n\t\tconnection: AzureConnectionConfig,\n\t): Promise<FluidContainer> {\n\t\tconst createNewRequest = createAzureCreateNewRequest(\n\t\t\tconnection.endpoint,\n\t\t\tgetTenantId(connection),\n\t\t);\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tconst rootDataObject = await requestFluidObject<IRootDataObject>(container, \"/\");\n\n\t\t/**\n\t\t * See {@link FluidContainer.attach}\n\t\t */\n\t\tconst attach = async (): Promise<string> => {\n\t\t\tif (container.attachState !== AttachState.Detached) {\n\t\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state\");\n\t\t\t}\n\t\t\tawait container.attach(createNewRequest);\n\t\t\tif (container.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\"Resolved Url not available on attached container\");\n\t\t\t}\n\t\t\treturn container.resolvedUrl.id;\n\t\t};\n\t\tconst fluidContainer = new FluidContainer(container, rootDataObject);\n\t\tfluidContainer.attach = attach;\n\t\treturn fluidContainer;\n\t}\n\t// #endregion\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
2
|
-
import { AzureMember } from "./interfaces";
|
|
1
|
+
import { type ITokenProvider, type ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
2
|
+
import { type AzureMember } from "./interfaces";
|
|
3
3
|
/**
|
|
4
4
|
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
5
5
|
* Azure Fluid Relay token resolution.
|
|
@@ -7,6 +7,8 @@ import { AzureMember } from "./interfaces";
|
|
|
7
7
|
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
8
8
|
* No replacement since it is not expected anyone will use this token provider as is
|
|
9
9
|
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
10
12
|
*/
|
|
11
13
|
export declare class AzureFunctionTokenProvider implements ITokenProvider {
|
|
12
14
|
private readonly azFunctionUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEhG,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;GASG;AACH,qBAAa,0BAA2B,YAAW,cAAc;IAO/D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAPvB;;;;OAIG;gBAEe,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,iFAAgE;IAG1E,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMjF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;YAM/E,QAAQ;CAYtB"}
|
|
@@ -16,6 +16,8 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
16
16
|
* @deprecated 1.2.0, This API will be removed in 2.0.0
|
|
17
17
|
* No replacement since it is not expected anyone will use this token provider as is
|
|
18
18
|
* See https://github.com/microsoft/FluidFramework/issues/13693 for context
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
19
21
|
*/
|
|
20
22
|
class AzureFunctionTokenProvider {
|
|
21
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,kDAA0B;AAM1B
|
|
1
|
+
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,kDAA0B;AAM1B;;;;;;;;;GASG;AACH,MAAa,0BAA0B;IACtC;;;;OAIG;IACH,YACkB,aAAqB,EACrB,IAAqE;QADrE,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAiE;IACpF,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAmB;QACnE,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAkB;QAClE,OAAO;YACN,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,UAAmB;QAC3D,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;YACpD,MAAM,EAAE;gBACP,QAAQ;gBACR,UAAU;gBACV,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM;gBACzB,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ;gBAC7B,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,iBAA4B;aAC1D;SACD,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IAChC,CAAC;CACD;AAnCD,gEAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport axios from \"axios\";\n\nimport { type ITokenProvider, type ITokenResponse } from \"@fluidframework/routerlicious-driver\";\n\nimport { type AzureMember } from \"./interfaces\";\n\n/**\n * Token Provider implementation for connecting to an Azure Function endpoint for\n * Azure Fluid Relay token resolution.\n *\n * @deprecated 1.2.0, This API will be removed in 2.0.0\n * No replacement since it is not expected anyone will use this token provider as is\n * See https://github.com/microsoft/FluidFramework/issues/13693 for context\n *\n * @public\n */\nexport class AzureFunctionTokenProvider implements ITokenProvider {\n\t/**\n\t * Creates a new instance using configuration parameters.\n\t * @param azFunctionUrl - URL to Azure Function endpoint\n\t * @param user - User object\n\t */\n\tpublic constructor(\n\t\tprivate readonly azFunctionUrl: string,\n\t\tprivate readonly user?: Pick<AzureMember, \"userId\" | \"userName\" | \"additionalDetails\">,\n\t) {}\n\n\tpublic async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tjwt: await this.getToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate async getToken(tenantId: string, documentId?: string): Promise<string> {\n\t\tconst response = await axios.get(this.azFunctionUrl, {\n\t\t\tparams: {\n\t\t\t\ttenantId,\n\t\t\t\tdocumentId,\n\t\t\t\tuserId: this.user?.userId,\n\t\t\t\tuserName: this.user?.userName,\n\t\t\t\tadditionalDetails: this.user?.additionalDetails as unknown,\n\t\t\t},\n\t\t});\n\t\treturn response.data as string;\n\t}\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { type IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IResolvedUrl, type IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the
|
|
9
9
|
* Azure Fluid Relay based off of the orderer and storage URLs provide.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,oCAAoC,CAAC;AAE5C;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGvC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAoCjD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM5F;AA+BD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,gBAAiB,MAAM,YAAY,MAAM,KAAG,QAUnF,CAAC"}
|