@fluidframework/azure-client 1.0.2 → 1.1.0-101037
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +5 -7
- package/CHANGELOG.md +1 -2
- package/README.md +12 -10
- package/api-extractor.json +2 -1
- package/dist/AzureAudience.d.ts +7 -5
- package/dist/AzureAudience.d.ts.map +1 -1
- package/dist/AzureAudience.js +13 -4
- package/dist/AzureAudience.js.map +1 -1
- package/dist/AzureClient.d.ts.map +1 -1
- package/dist/AzureClient.js +23 -15
- package/dist/AzureClient.js.map +1 -1
- package/dist/AzureFunctionTokenProvider.d.ts +0 -4
- package/dist/AzureFunctionTokenProvider.d.ts.map +1 -1
- package/dist/AzureFunctionTokenProvider.js +4 -4
- 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 +11 -13
- package/dist/AzureUrlResolver.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -15
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +34 -4
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js +0 -4
- 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 +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/AzureAudience.d.ts +7 -5
- package/lib/AzureAudience.d.ts.map +1 -1
- package/lib/AzureAudience.js +11 -2
- package/lib/AzureAudience.js.map +1 -1
- package/lib/AzureClient.d.ts.map +1 -1
- package/lib/AzureClient.js +25 -17
- package/lib/AzureClient.js.map +1 -1
- package/lib/AzureFunctionTokenProvider.d.ts +0 -4
- package/lib/AzureFunctionTokenProvider.d.ts.map +1 -1
- 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 +11 -13
- package/lib/AzureUrlResolver.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +34 -4
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js +0 -4
- 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 +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +36 -43
- package/src/AzureAudience.ts +23 -13
- package/src/AzureClient.ts +44 -70
- package/src/AzureFunctionTokenProvider.ts +4 -3
- package/src/AzureUrlResolver.ts +15 -24
- package/src/index.ts +19 -5
- package/src/interfaces.ts +42 -12
- package/src/packageVersion.ts +1 -1
- package/src/utils.ts +9 -3
- package/tsconfig.esnext.json +5 -5
- package/tsconfig.json +9 -15
package/.eslintrc.js
CHANGED
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"parserOptions": {
|
|
11
|
-
"project": ["./tsconfig.json", "./src/test/tsconfig.json"]
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
12
10
|
},
|
|
13
|
-
|
|
14
|
-
}
|
|
11
|
+
rules: {},
|
|
12
|
+
};
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -53,10 +53,10 @@ const clientProps = {
|
|
|
53
53
|
connection: {
|
|
54
54
|
type: "remote",
|
|
55
55
|
tenantId: "YOUR-TENANT-ID-HERE",
|
|
56
|
-
tokenProvider: new AzureFunctionTokenProvider(
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
),
|
|
56
|
+
tokenProvider: new AzureFunctionTokenProvider("AZURE-FUNCTION-URL" + "/api/GetAzureToken", {
|
|
57
|
+
userId: "test-user",
|
|
58
|
+
userName: "Test User",
|
|
59
|
+
}),
|
|
60
60
|
endpoint: "ENTER-SERVICE-DISCOVERY-URL-HERE",
|
|
61
61
|
},
|
|
62
62
|
};
|
|
@@ -80,8 +80,10 @@ const schema = {
|
|
|
80
80
|
initialObjects: {
|
|
81
81
|
/* ... */
|
|
82
82
|
},
|
|
83
|
-
dynamicObjectTypes: [
|
|
84
|
-
|
|
83
|
+
dynamicObjectTypes: [
|
|
84
|
+
/*...*/
|
|
85
|
+
],
|
|
86
|
+
};
|
|
85
87
|
const azureClient = new AzureClient(props);
|
|
86
88
|
const { container, services } = await azureClient.createContainer(schema);
|
|
87
89
|
|
|
@@ -116,8 +118,8 @@ const schema = {
|
|
|
116
118
|
initialObjects: {
|
|
117
119
|
map1: SharedMap,
|
|
118
120
|
text1: SharedString,
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
+
},
|
|
122
|
+
};
|
|
121
123
|
|
|
122
124
|
// Fetch back the container that had been created earlier with the same ID and schema
|
|
123
125
|
const { container, services } = await azureClient.getContainer("_unique-id_", schema);
|
|
@@ -142,8 +144,8 @@ const schema = {
|
|
|
142
144
|
initialObjects: {
|
|
143
145
|
map1: SharedMap,
|
|
144
146
|
},
|
|
145
|
-
dynamicObjectTypes: [
|
|
146
|
-
}
|
|
147
|
+
dynamicObjectTypes: [SharedString],
|
|
148
|
+
};
|
|
147
149
|
|
|
148
150
|
const { container, services } = await azureClient.getContainer("_unique-id_", schema);
|
|
149
151
|
const map1 = container.initialObjects.map1;
|
package/api-extractor.json
CHANGED
package/dist/AzureAudience.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
1
|
import { ServiceAudience } from "@fluidframework/fluid-static";
|
|
6
2
|
import { IClient } from "@fluidframework/protocol-definitions";
|
|
7
|
-
import {
|
|
3
|
+
import { AzureMember, IAzureAudience } from "./interfaces";
|
|
8
4
|
export declare class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {
|
|
9
5
|
/**
|
|
6
|
+
* Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided
|
|
7
|
+
* {@link @fluidframework/protocol-definitions#IClient | audience member}.
|
|
8
|
+
*
|
|
9
|
+
* @param audienceMember - Audience member for which the `ServiceAudience` will be generated.
|
|
10
|
+
* Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.
|
|
11
|
+
*
|
|
10
12
|
* @internal
|
|
11
13
|
*/
|
|
12
14
|
protected createServiceMember(audienceMember: IClient): AzureMember;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.d.ts","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"
|
|
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;AAE/D,OAAO,EAAE,WAAW,EAAa,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtE,qBAAa,aAAc,SAAQ,eAAe,CAAC,WAAW,CAAE,YAAW,cAAc;IACrF;;;;;;;;OAQG;IACH,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW;CAWtE"}
|
package/dist/AzureAudience.js
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AzureAudience = void 0;
|
|
2
4
|
/*!
|
|
3
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
6
|
* Licensed under the MIT License.
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
exports.AzureAudience = void 0;
|
|
8
|
+
const common_utils_1 = require("@fluidframework/common-utils");
|
|
8
9
|
const fluid_static_1 = require("@fluidframework/fluid-static");
|
|
9
10
|
class AzureAudience extends fluid_static_1.ServiceAudience {
|
|
10
11
|
/**
|
|
12
|
+
* Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided
|
|
13
|
+
* {@link @fluidframework/protocol-definitions#IClient | audience member}.
|
|
14
|
+
*
|
|
15
|
+
* @param audienceMember - Audience member for which the `ServiceAudience` will be generated.
|
|
16
|
+
* Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.
|
|
17
|
+
*
|
|
11
18
|
* @internal
|
|
12
19
|
*/
|
|
13
20
|
createServiceMember(audienceMember) {
|
|
21
|
+
const azureUser = audienceMember.user;
|
|
22
|
+
(0, common_utils_1.assert)((azureUser === null || azureUser === void 0 ? void 0 : azureUser.name) !== undefined, 'Provided user was not an "AzureUser".');
|
|
14
23
|
return {
|
|
15
24
|
userId: audienceMember.user.id,
|
|
16
|
-
userName:
|
|
25
|
+
userName: azureUser.name,
|
|
17
26
|
connections: [],
|
|
18
|
-
additionalDetails:
|
|
27
|
+
additionalDetails: azureUser.additionalDetails,
|
|
19
28
|
};
|
|
20
29
|
}
|
|
21
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureAudience.js","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AzureAudience.js","sourceRoot":"","sources":["../src/AzureAudience.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAsD;AACtD,+DAA+D;AAK/D,MAAa,aAAc,SAAQ,8BAA4B;IAC3D;;;;;;;;OAQG;IACO,mBAAmB,CAAC,cAAuB;QACjD,MAAM,SAAS,GAAG,cAAc,CAAC,IAAiB,CAAC;QACnD,IAAA,qBAAM,EAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,SAAS,EAAE,uCAAuC,CAAC,CAAC;QAE/E,OAAO;YACH,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE;YAC9B,QAAQ,EAAE,SAAS,CAAC,IAAI;YACxB,WAAW,EAAE,EAAE;YACf,iBAAiB,EAAE,SAAS,CAAC,iBAA4B;SAC5D,CAAC;IACN,CAAC;CACJ;AArBD,sCAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ServiceAudience } from \"@fluidframework/fluid-static\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\nimport { AzureMember, AzureUser, IAzureAudience } from \"./interfaces\";\n\nexport class AzureAudience extends ServiceAudience<AzureMember> implements IAzureAudience {\n /**\n * Creates a {@link @fluidframework/fluid-static#ServiceAudience} from the provided\n * {@link @fluidframework/protocol-definitions#IClient | audience member}.\n *\n * @param audienceMember - Audience member for which the `ServiceAudience` will be generated.\n * Note: its {@link @fluidframework/protocol-definitions#IClient.user} is required to be an {@link AzureUser}.\n *\n * @internal\n */\n protected createServiceMember(audienceMember: IClient): AzureMember {\n const azureUser = audienceMember.user as AzureUser;\n assert(azureUser?.name !== undefined, 'Provided user was not an \"AzureUser\".');\n\n return {\n userId: audienceMember.user.id,\n userName: azureUser.name,\n connections: [],\n additionalDetails: azureUser.additionalDetails as unknown,\n };\n }\n}\n"]}
|
|
@@ -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":"AAYA,OAAO,EACH,eAAe,EAGf,eAAe,EAElB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EACH,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EAC1B,MAAM,cAAc,CAAC;AAetB;;;GAGG;AACH,qBAAa,WAAW;IAQR,OAAO,CAAC,QAAQ,CAAC,KAAK;IAPlC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA0B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAE3C;;;OAGG;gBAC0B,KAAK,EAAE,gBAAgB;IAapD;;;;OAIG;IACU,eAAe,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC;QACpE,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAaF;;;;;;;OAOG;IACU,aAAa,CACtB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,qBAAqB,GAChC,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IA8BF;;;;;OAKG;IACU,YAAY,CACrB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAaF;;;;;;OAMG;IACU,oBAAoB,CAC7B,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAwBnC,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,YAAY;YAkBN,oBAAoB;CA4BrC"}
|
package/dist/AzureClient.js
CHANGED
|
@@ -5,22 +5,24 @@ exports.AzureClient = void 0;
|
|
|
5
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
6
|
* Licensed under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
const container_loader_1 = require("@fluidframework/container-loader");
|
|
9
8
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
10
|
-
const
|
|
11
|
-
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
9
|
+
const container_loader_1 = require("@fluidframework/container-loader");
|
|
12
10
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
13
11
|
const fluid_static_1 = require("@fluidframework/fluid-static");
|
|
14
12
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
15
|
-
const
|
|
13
|
+
const routerlicious_driver_1 = require("@fluidframework/routerlicious-driver");
|
|
14
|
+
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
16
15
|
const AzureAudience_1 = require("./AzureAudience");
|
|
17
16
|
const AzureUrlResolver_1 = require("./AzureUrlResolver");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
18
|
/**
|
|
19
19
|
* Strongly typed id for connecting to a local Azure Fluid Relay.
|
|
20
20
|
*/
|
|
21
21
|
const LOCAL_MODE_TENANT_ID = "local";
|
|
22
22
|
const getTenantId = (connectionProps) => {
|
|
23
|
-
return (0, utils_1.isAzureRemoteConnectionConfig)(connectionProps)
|
|
23
|
+
return (0, utils_1.isAzureRemoteConnectionConfig)(connectionProps)
|
|
24
|
+
? connectionProps.tenantId
|
|
25
|
+
: LOCAL_MODE_TENANT_ID;
|
|
24
26
|
};
|
|
25
27
|
const MAX_VERSION_COUNT = 5;
|
|
26
28
|
/**
|
|
@@ -126,6 +128,8 @@ class AzureClient {
|
|
|
126
128
|
}
|
|
127
129
|
const documentService = await this.documentServiceFactory.createDocumentService(resolvedUrl);
|
|
128
130
|
const storage = await documentService.connectToStorage();
|
|
131
|
+
// External API uses null
|
|
132
|
+
// eslint-disable-next-line unicorn/no-null
|
|
129
133
|
const versions = await storage.getVersions(null, (_a = options === null || options === void 0 ? void 0 : options.maxCount) !== null && _a !== void 0 ? _a : MAX_VERSION_COUNT);
|
|
130
134
|
return versions.map((item) => {
|
|
131
135
|
return { id: item.id, date: item.date };
|
|
@@ -155,17 +159,21 @@ class AzureClient {
|
|
|
155
159
|
async createFluidContainer(container, connection) {
|
|
156
160
|
const createNewRequest = (0, AzureUrlResolver_1.createAzureCreateNewRequest)(connection.endpoint, getTenantId(connection));
|
|
157
161
|
const rootDataObject = await (0, runtime_utils_1.requestFluidObject)(container, "/");
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const resolved = container.resolvedUrl;
|
|
165
|
-
(0, driver_utils_1.ensureFluidResolvedUrl)(resolved);
|
|
166
|
-
return resolved.id;
|
|
162
|
+
/**
|
|
163
|
+
* See {@link FluidContainer.attach}
|
|
164
|
+
*/
|
|
165
|
+
const attach = async () => {
|
|
166
|
+
if (container.attachState !== container_definitions_1.AttachState.Detached) {
|
|
167
|
+
throw new Error("Cannot attach container. Container is not in detached state");
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
+
await container.attach(createNewRequest);
|
|
170
|
+
const resolved = container.resolvedUrl;
|
|
171
|
+
(0, driver_utils_1.ensureFluidResolvedUrl)(resolved);
|
|
172
|
+
return resolved.id;
|
|
173
|
+
};
|
|
174
|
+
const fluidContainer = new fluid_static_1.FluidContainer(container, rootDataObject);
|
|
175
|
+
fluidContainer.attach = attach;
|
|
176
|
+
return fluidContainer;
|
|
169
177
|
}
|
|
170
178
|
}
|
|
171
179
|
exports.AzureClient = AzureClient;
|
package/dist/AzureClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uEAA0D;AAK1D,iFAI+C;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,EAC3C,SAAS,EACT,GAAG,CACN,CAAC;QACF,OAAO,IAAI,CAAC,KAAM,SAAQ,6BAAc;YACpC,KAAK,CAAC,MAAM;gBACR,IAAI,IAAI,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE;oBAC3C,MAAM,IAAI,KAAK,CACX,6DAA6D,CAChE,CAAC;iBACL;gBACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACzC,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC;gBACvC,IAAA,qCAAsB,EAAC,QAAQ,CAAC,CAAC;gBACjC,OAAO,QAAQ,CAAC,EAAE,CAAC;YACvB,CAAC;SACJ,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAClC,CAAC;CAEJ;AAzND,kCAyNC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Loader } from \"@fluidframework/container-loader\";\nimport {\n IDocumentServiceFactory,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport {\n AttachState,\n IContainer,\n IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport {\n ContainerSchema,\n DOProviderContainerRuntimeFactory,\n FluidContainer,\n IFluidContainer,\n RootDataObject,\n} from \"@fluidframework/fluid-static\";\n\nimport {\n SummaryType,\n} from \"@fluidframework/protocol-definitions\";\n\nimport {\n AzureClientProps,\n AzureConnectionConfig,\n AzureContainerServices,\n AzureContainerVersion,\n AzureGetVersionsOptions,\n} from \"./interfaces\";\nimport { isAzureRemoteConnectionConfig } from \"./utils\";\nimport { AzureAudience } from \"./AzureAudience\";\nimport {\n AzureUrlResolver,\n createAzureCreateNewRequest,\n} from \"./AzureUrlResolver\";\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 return isAzureRemoteConnectionConfig(connectionProps) ? connectionProps.tenantId : 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 private readonly documentServiceFactory: IDocumentServiceFactory;\n private readonly urlResolver: IUrlResolver;\n\n /**\n * Creates a new client instance using configuration parameters.\n * @param props - Properties for initializing a new AzureClient instance\n */\n constructor(private readonly props: AzureClientProps) {\n // remove trailing slash from URL if any\n props.connection.endpoint = props.connection.endpoint.replace(/\\/$/, \"\");\n this.urlResolver = new AzureUrlResolver();\n // The local service implementation differs from the Azure Fluid Relay in blob\n // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n const isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);\n this.documentServiceFactory = new RouterliciousDocumentServiceFactory(\n this.props.connection.tokenProvider,\n { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },\n );\n }\n\n /**\n * Creates a new detached container instance in the Azure Fluid Relay.\n * @param containerSchema - Container schema for the new container.\n * @returns New detached container instance along with associated services.\n */\n public async createContainer(\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n\n const container = await loader.createDetachedContainer({\n package: \"no-dynamic-package\",\n config: {},\n });\n\n const fluidContainer = await this.createFluidContainer(\n container,\n this.props.connection,\n );\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Creates new detached container out of specific version of another container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @param version - Unique version of the source container in Azure Fluid Relay.\n * It defaults to latest version if parameter not provided.\n * @returns New detached container instance along with associated services.\n */\n public async copyContainer(\n id: string,\n containerSchema: ContainerSchema,\n version?: AzureContainerVersion,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const sourceContainer = await loader.resolve({ url: url.href });\n\n if (sourceContainer.resolvedUrl === undefined) {\n throw new Error(\n \"Source container cannot resolve URL.\",\n );\n }\n\n const documentService = await this.documentServiceFactory.createDocumentService(sourceContainer.resolvedUrl);\n const storage = await documentService.connectToStorage();\n const handle = {\n type: SummaryType.Handle,\n handleType: SummaryType.Tree,\n handle: version?.id ?? \"latest\",\n };\n const tree = await storage.downloadSummary(handle);\n\n const container = await loader.rehydrateDetachedContainerFromSnapshot(\n JSON.stringify(tree),\n );\n\n const fluidContainer = await this.createFluidContainer(\n container,\n this.props.connection,\n );\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n * @param id - Unique ID of the container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @returns Existing container instance along with associated services.\n */\n public async getContainer(\n id: string,\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const container = await loader.resolve({ url: url.href });\n const rootDataObject = await requestFluidObject<RootDataObject>(\n container,\n \"/\",\n );\n const fluidContainer = new FluidContainer(container, rootDataObject);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Get the list of versions for specific container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param options - \"Get\" options. If options are not provided, API\n * will assume maxCount of versions to retreive to be 5.\n * @returns Array of available container versions.\n */\n public async getContainerVersions(\n id: string,\n options?: AzureGetVersionsOptions,\n ): Promise<AzureContainerVersion[]> {\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\n \"storage\",\n encodeURIComponent(this.props.connection.endpoint),\n );\n url.searchParams.append(\n \"tenantId\",\n encodeURIComponent(getTenantId(this.props.connection)),\n );\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n const resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n if (!resolvedUrl) {\n throw new Error(\"Unable to resolved URL\");\n }\n const documentService =\n await this.documentServiceFactory.createDocumentService(\n resolvedUrl,\n );\n const storage = await documentService.connectToStorage();\n const versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n return versions.map((item) => {\n return { id: item.id, date: item.date };\n });\n }\n\n private getContainerServices(container: IContainer): AzureContainerServices {\n return {\n audience: new AzureAudience(container),\n };\n }\n\n private createLoader(containerSchema: ContainerSchema): Loader {\n const runtimeFactory = new DOProviderContainerRuntimeFactory(\n containerSchema,\n );\n const load = async (): Promise<IFluidModuleWithDetails> => {\n return {\n module: { fluidExport: runtimeFactory },\n details: { package: \"no-dynamic-package\", config: {} },\n };\n };\n\n const codeLoader = { load };\n return new Loader({\n urlResolver: this.urlResolver,\n documentServiceFactory: this.documentServiceFactory,\n codeLoader,\n logger: this.props.logger,\n });\n }\n\n private async createFluidContainer(\n container: IContainer,\n connection: AzureConnectionConfig,\n ): Promise<FluidContainer> {\n const createNewRequest = createAzureCreateNewRequest(\n connection.endpoint,\n getTenantId(connection),\n );\n\n const rootDataObject = await requestFluidObject<RootDataObject>(\n container,\n \"/\",\n );\n return new (class extends FluidContainer {\n async attach() {\n if (this.attachState !== AttachState.Detached) {\n throw new Error(\n \"Cannot attach container. Container is not in detached state\",\n );\n }\n await container.attach(createNewRequest);\n const resolved = container.resolvedUrl;\n ensureFluidResolvedUrl(resolved);\n return resolved.id;\n }\n })(container, rootDataObject);\n }\n // #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AzureClient.js","sourceRoot":"","sources":["../src/AzureClient.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,iFAI+C;AAC/C,uEAA0D;AAE1D,+DAAsE;AACtE,+DAMsC;AACtC,+EAAmE;AACnE,+EAA2F;AAC3F,iEAAmE;AAEnE,mDAAgD;AAChD,yDAAmF;AAQnF,mCAAwD;AAExD;;GAEG;AACH,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,eAAsC,EAAU,EAAE;IACnE,OAAO,IAAA,qCAA6B,EAAC,eAAe,CAAC;QACjD,CAAC,CAAC,eAAe,CAAC,QAAQ;QAC1B,CAAC,CAAC,oBAAoB,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAa,WAAW;IAIpB;;;OAGG;IACH,YAA6B,KAAuB;QAAvB,UAAK,GAAL,KAAK,CAAkB;QAChD,wCAAwC;QACxC,KAAK,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,WAAW,GAAG,IAAI,mCAAgB,EAAE,CAAC;QAC1C,8EAA8E;QAC9E,6FAA6F;QAC7F,MAAM,kBAAkB,GAAG,IAAA,qCAA6B,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAChF,IAAI,CAAC,sBAAsB,GAAG,IAAI,0DAAmC,CACjE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,EACnC,EAAE,wBAAwB,EAAE,k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AI,CAAC,WAAW;YAC7B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,UAAU;YACV,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;SAC5B,CAAC,CAAC;IACP,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAC9B,SAAqB,EACrB,UAAiC;QAEjC,MAAM,gBAAgB,GAAG,IAAA,8CAA2B,EAChD,UAAU,CAAC,QAAQ,EACnB,WAAW,CAAC,UAAU,CAAC,CAC1B,CAAC;QAEF,MAAM,cAAc,GAAG,MAAM,IAAA,kCAAkB,EAAiB,SAAS,EAAE,GAAG,CAAC,CAAC;QAEhF;;WAEG;QACH,MAAM,MAAM,GAAG,KAAK,IAAqB,EAAE;YACvC,IAAI,SAAS,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE;gBAChD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;aAClF;YACD,MAAM,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzC,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC;YACvC,IAAA,qCAAsB,EAAC,QAAQ,CAAC,CAAC;YACjC,OAAO,QAAQ,CAAC,EAAE,CAAC;QACvB,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;IAC1B,CAAC;CAEJ;AAtMD,kCAsMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n AttachState,\n IContainer,\n IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport {\n ContainerSchema,\n DOProviderContainerRuntimeFactory,\n FluidContainer,\n IFluidContainer,\n RootDataObject,\n} from \"@fluidframework/fluid-static\";\nimport { SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { RouterliciousDocumentServiceFactory } from \"@fluidframework/routerlicious-driver\";\nimport { requestFluidObject } from \"@fluidframework/runtime-utils\";\n\nimport { AzureAudience } from \"./AzureAudience\";\nimport { AzureUrlResolver, createAzureCreateNewRequest } from \"./AzureUrlResolver\";\nimport {\n AzureClientProps,\n AzureConnectionConfig,\n AzureContainerServices,\n AzureContainerVersion,\n 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 = (connectionProps: AzureConnectionConfig): string => {\n return isAzureRemoteConnectionConfig(connectionProps)\n ? connectionProps.tenantId\n : 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 private readonly documentServiceFactory: IDocumentServiceFactory;\n private readonly urlResolver: IUrlResolver;\n\n /**\n * Creates a new client instance using configuration parameters.\n * @param props - Properties for initializing a new AzureClient instance\n */\n constructor(private readonly props: AzureClientProps) {\n // remove trailing slash from URL if any\n props.connection.endpoint = props.connection.endpoint.replace(/\\/$/, \"\");\n this.urlResolver = new AzureUrlResolver();\n // The local service implementation differs from the Azure Fluid Relay in blob\n // storage format. Azure Fluid Relay supports whole summary upload. Local currently does not.\n const isRemoteConnection = isAzureRemoteConnectionConfig(this.props.connection);\n this.documentServiceFactory = new RouterliciousDocumentServiceFactory(\n this.props.connection.tokenProvider,\n { enableWholeSummaryUpload: isRemoteConnection, enableDiscovery: isRemoteConnection },\n );\n }\n\n /**\n * Creates a new detached container instance in the Azure Fluid Relay.\n * @param containerSchema - Container schema for the new container.\n * @returns New detached container instance along with associated services.\n */\n public async createContainer(containerSchema: ContainerSchema): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n\n const container = await loader.createDetachedContainer({\n package: \"no-dynamic-package\",\n config: {},\n });\n\n const fluidContainer = await this.createFluidContainer(container, this.props.connection);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Creates new detached container out of specific version of another container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @param version - Unique version of the source container in Azure Fluid Relay.\n * It defaults to latest version if parameter not provided.\n * @returns New detached container instance along with associated services.\n */\n public async copyContainer(\n id: string,\n containerSchema: ContainerSchema,\n version?: AzureContainerVersion,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const sourceContainer = await loader.resolve({ url: url.href });\n\n if (sourceContainer.resolvedUrl === undefined) {\n throw new Error(\"Source container cannot resolve URL.\");\n }\n\n const documentService = await this.documentServiceFactory.createDocumentService(\n sourceContainer.resolvedUrl,\n );\n const storage = await documentService.connectToStorage();\n const handle = {\n type: SummaryType.Handle,\n handleType: SummaryType.Tree,\n handle: version?.id ?? \"latest\",\n };\n const tree = await storage.downloadSummary(handle);\n\n const container = await loader.rehydrateDetachedContainerFromSnapshot(JSON.stringify(tree));\n\n const fluidContainer = await this.createFluidContainer(container, this.props.connection);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Accesses the existing container given its unique ID in the Azure Fluid Relay.\n * @param id - Unique ID of the container in Azure Fluid Relay.\n * @param containerSchema - Container schema used to access data objects in the container.\n * @returns Existing container instance along with associated services.\n */\n public async getContainer(\n id: string,\n containerSchema: ContainerSchema,\n ): Promise<{\n container: IFluidContainer;\n services: AzureContainerServices;\n }> {\n const loader = this.createLoader(containerSchema);\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n const container = await loader.resolve({ url: url.href });\n const rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n const fluidContainer = new FluidContainer(container, rootDataObject);\n const services = this.getContainerServices(container);\n return { container: fluidContainer, services };\n }\n\n /**\n * Get the list of versions for specific container.\n * @param id - Unique ID of the source container in Azure Fluid Relay.\n * @param options - \"Get\" options. If options are not provided, API\n * will assume maxCount of versions to retreive to be 5.\n * @returns Array of available container versions.\n */\n public async getContainerVersions(\n id: string,\n options?: AzureGetVersionsOptions,\n ): Promise<AzureContainerVersion[]> {\n const url = new URL(this.props.connection.endpoint);\n url.searchParams.append(\"storage\", encodeURIComponent(this.props.connection.endpoint));\n url.searchParams.append(\"tenantId\", encodeURIComponent(getTenantId(this.props.connection)));\n url.searchParams.append(\"containerId\", encodeURIComponent(id));\n\n const resolvedUrl = await this.urlResolver.resolve({ url: url.href });\n if (!resolvedUrl) {\n throw new Error(\"Unable to resolved URL\");\n }\n const documentService = await this.documentServiceFactory.createDocumentService(\n resolvedUrl,\n );\n const storage = await documentService.connectToStorage();\n\n // External API uses null\n // eslint-disable-next-line unicorn/no-null\n const versions = await storage.getVersions(null, options?.maxCount ?? MAX_VERSION_COUNT);\n\n return versions.map((item) => {\n return { id: item.id, date: item.date };\n });\n }\n\n private getContainerServices(container: IContainer): AzureContainerServices {\n return {\n audience: new AzureAudience(container),\n };\n }\n\n private createLoader(containerSchema: ContainerSchema): Loader {\n const runtimeFactory = new DOProviderContainerRuntimeFactory(containerSchema);\n const load = async (): Promise<IFluidModuleWithDetails> => {\n return {\n module: { fluidExport: runtimeFactory },\n details: { package: \"no-dynamic-package\", config: {} },\n };\n };\n\n const codeLoader = { load };\n return new Loader({\n urlResolver: this.urlResolver,\n documentServiceFactory: this.documentServiceFactory,\n codeLoader,\n logger: this.props.logger,\n });\n }\n\n private async createFluidContainer(\n container: IContainer,\n connection: AzureConnectionConfig,\n ): Promise<FluidContainer> {\n const createNewRequest = createAzureCreateNewRequest(\n connection.endpoint,\n getTenantId(connection),\n );\n\n const rootDataObject = await requestFluidObject<RootDataObject>(container, \"/\");\n\n /**\n * See {@link FluidContainer.attach}\n */\n const attach = async (): Promise<string> => {\n if (container.attachState !== AttachState.Detached) {\n throw new Error(\"Cannot attach container. Container is not in detached state\");\n }\n await container.attach(createNewRequest);\n const resolved = container.resolvedUrl;\n ensureFluidResolvedUrl(resolved);\n return resolved.id;\n };\n const fluidContainer = new FluidContainer(container, rootDataObject);\n fluidContainer.attach = attach;\n return fluidContainer;\n }\n // #endregion\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AzureFunctionTokenProvider.d.ts","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,cAAc;IAOzD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAP1B;;;;OAIG;gBAEkB,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,iFAAgE;IAG7E,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;CAYzB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
4
|
};
|
|
9
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
6
|
exports.AzureFunctionTokenProvider = void 0;
|
|
7
|
+
/*!
|
|
8
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License.
|
|
10
|
+
*/
|
|
11
11
|
const axios_1 = __importDefault(require("axios"));
|
|
12
12
|
/**
|
|
13
13
|
* Token Provider implementation for connecting to an Azure Function endpoint for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AzureFunctionTokenProvider.js","sourceRoot":"","sources":["../src/AzureFunctionTokenProvider.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,kDAA0B;AAM1B;;;GAGG;AACH,MAAa,0BAA0B;IACnC;;;;OAIG;IACH,YACqB,aAAqB,EACrB,IAAqE;QADrE,kBAAa,GAAb,aAAa,CAAQ;QACrB,SAAI,GAAJ,IAAI,CAAiE;IACvF,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAmB;QAChE,OAAO;YACH,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SACjD,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAkB;QAC/D,OAAO;YACH,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SACjD,CAAC;IACN,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,UAAmB;;QACxD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE;YACjD,MAAM,EAAE;gBACJ,QAAQ;gBACR,UAAU;gBACV,MAAM,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM;gBACzB,QAAQ,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ;gBAC7B,iBAAiB,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,iBAA4B;aAC7D;SACJ,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAc,CAAC;IACnC,CAAC;CACJ;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 { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\n\nimport { AzureMember } from \"./interfaces\";\n\n/**\n * Token Provider implementation for connecting to an Azure Function endpoint for\n * Azure Fluid Relay token resolution.\n */\nexport class AzureFunctionTokenProvider implements ITokenProvider {\n /**\n * Creates a new instance using configuration parameters.\n * @param azFunctionUrl - URL to Azure Function endpoint\n * @param user - User object\n */\n constructor(\n private readonly azFunctionUrl: string,\n private readonly user?: Pick<AzureMember, \"userId\" | \"userName\" | \"additionalDetails\">,\n ) {}\n\n public async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n return {\n jwt: await this.getToken(tenantId, documentId),\n };\n }\n\n public async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {\n return {\n jwt: await this.getToken(tenantId, documentId),\n };\n }\n\n private async getToken(tenantId: string, documentId?: string): Promise<string> {\n const response = await axios.get(this.azFunctionUrl, {\n params: {\n tenantId,\n documentId,\n userId: this.user?.userId,\n userName: this.user?.userName,\n additionalDetails: this.user?.additionalDetails as unknown,\n },\n });\n return response.data as string;\n }\n}\n"]}
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IFluidResolvedUrl, IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
|
+
/**
|
|
8
|
+
* Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the
|
|
9
|
+
* Azure Fluid Relay based off of the orderer and storage URLs provide.
|
|
10
|
+
*
|
|
11
|
+
* @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure
|
|
12
|
+
* providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.
|
|
13
|
+
*/
|
|
7
14
|
export declare class AzureUrlResolver implements IUrlResolver {
|
|
8
15
|
constructor();
|
|
9
16
|
resolve(request: IRequest): Promise<IFluidResolvedUrl>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"AzureUrlResolver.d.ts","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEH,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACf,MAAM,oCAAoC,CAAC;AAE5C;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;;IAGpC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoCtD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM/F;AA+BD,eAAO,MAAM,2BAA2B,gBAAiB,MAAM,YAAY,MAAM,KAAG,QAUnF,CAAC"}
|
package/dist/AzureUrlResolver.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
exports.createAzureCreateNewRequest = exports.AzureUrlResolver = void 0;
|
|
8
4
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the
|
|
7
|
+
* Azure Fluid Relay based off of the orderer and storage URLs provide.
|
|
8
|
+
*
|
|
9
|
+
* @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure
|
|
10
|
+
* providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.
|
|
11
|
+
*/
|
|
13
12
|
class AzureUrlResolver {
|
|
14
13
|
constructor() { }
|
|
15
14
|
async resolve(request) {
|
|
16
15
|
const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);
|
|
17
16
|
// determine whether the request is for creating of a new container.
|
|
18
17
|
// such request has the `createNew` header set to true and doesn't have a container ID.
|
|
19
|
-
if (request.headers &&
|
|
20
|
-
request.headers[driver_definitions_1.DriverHeader.createNew] === true) {
|
|
18
|
+
if (request.headers && request.headers[driver_definitions_1.DriverHeader.createNew] === true) {
|
|
21
19
|
return {
|
|
22
20
|
endpoints: {
|
|
23
21
|
deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,
|
|
@@ -36,7 +34,7 @@ class AzureUrlResolver {
|
|
|
36
34
|
throw new Error("Azure URL did not contain containerId");
|
|
37
35
|
}
|
|
38
36
|
const documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;
|
|
39
|
-
return
|
|
37
|
+
return {
|
|
40
38
|
endpoints: {
|
|
41
39
|
deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,
|
|
42
40
|
ordererUrl,
|
|
@@ -46,11 +44,11 @@ class AzureUrlResolver {
|
|
|
46
44
|
tokens: {},
|
|
47
45
|
type: "fluid",
|
|
48
46
|
url: documentUrl,
|
|
49
|
-
}
|
|
47
|
+
};
|
|
50
48
|
}
|
|
51
49
|
async getAbsoluteUrl(resolvedUrl, relativeUrl) {
|
|
52
50
|
if (resolvedUrl.type !== "fluid") {
|
|
53
|
-
throw Error("Invalid Resolved Url");
|
|
51
|
+
throw new Error("Invalid Resolved Url");
|
|
54
52
|
}
|
|
55
53
|
return `${resolvedUrl.url}/${relativeUrl}`;
|
|
56
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AzureUrlResolver.js","sourceRoot":"","sources":["../src/AzureUrlResolver.ts"],"names":[],"mappings":";;;AAKA,2EAK4C;AAE5C;;;;;;GAMG;AACH,MAAa,gBAAgB;IACzB,gBAAe,CAAC;IAET,KAAK,CAAC,OAAO,CAAC,OAAiB;QAClC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtF,oEAAoE;QACpE,uFAAuF;QACvF,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,iCAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;YACrE,OAAO;gBACH,SAAS,EAAE;oBACP,eAA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IT License.\n */\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n DriverHeader,\n IFluidResolvedUrl,\n IResolvedUrl,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\n\n/**\n * Implementation of {@link @fluidframework/driver-definitions#IUrlResolver} to resolve documents stored using the\n * Azure Fluid Relay based off of the orderer and storage URLs provide.\n *\n * @remarks The token provider here can be an `InsecureTokenProvider` for basic scenarios or more robust, secure\n * providers that fulfill the {@link @fluidframework/routerlicious-driver#ITokenProvider} interface.\n */\nexport class AzureUrlResolver implements IUrlResolver {\n constructor() {}\n\n public async resolve(request: IRequest): Promise<IFluidResolvedUrl> {\n const { ordererUrl, storageUrl, tenantId, containerId } = decodeAzureUrl(request.url);\n // determine whether the request is for creating of a new container.\n // such request has the `createNew` header set to true and doesn't have a container ID.\n if (request.headers && request.headers[DriverHeader.createNew] === true) {\n return {\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/new`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n // id is a mandatory attribute, but it's ignored by the driver for new container requests.\n id: \"\",\n // tokens attribute is redundant as all tokens are generated via ITokenProvider\n tokens: {},\n type: \"fluid\",\n url: `${ordererUrl}/${tenantId}/new`,\n };\n }\n if (containerId === undefined) {\n throw new Error(\"Azure URL did not contain containerId\");\n }\n const documentUrl = `${ordererUrl}/${tenantId}/${containerId}`;\n return {\n endpoints: {\n deltaStorageUrl: `${ordererUrl}/deltas/${tenantId}/${containerId}`,\n ordererUrl,\n storageUrl: `${storageUrl}/repos/${tenantId}`,\n },\n id: containerId,\n tokens: {},\n type: \"fluid\",\n url: documentUrl,\n };\n }\n\n public async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n if (resolvedUrl.type !== \"fluid\") {\n throw new Error(\"Invalid Resolved Url\");\n }\n return `${resolvedUrl.url}/${relativeUrl}`;\n }\n}\n\nfunction decodeAzureUrl(urlString: string): {\n ordererUrl: string;\n storageUrl: string;\n tenantId: string;\n containerId?: string;\n} {\n const url = new URL(urlString);\n const ordererUrl = url.origin;\n const searchParams = url.searchParams;\n const storageUrl = searchParams.get(\"storage\");\n if (storageUrl === null) {\n throw new Error(\"Azure URL did not contain a storage URL\");\n }\n const tenantId = searchParams.get(\"tenantId\");\n if (tenantId === null) {\n throw new Error(\"Azure URL did not contain a tenant ID\");\n }\n const storageUrlDecoded = decodeURIComponent(storageUrl);\n const tenantIdDecoded = decodeURIComponent(tenantId);\n const containerId = searchParams.get(\"containerId\");\n const containerIdDecoded = containerId !== null ? decodeURIComponent(containerId) : undefined;\n return {\n ordererUrl,\n storageUrl: storageUrlDecoded,\n tenantId: tenantIdDecoded,\n containerId: containerIdDecoded,\n };\n}\n\nexport const createAzureCreateNewRequest = (endpointUrl: string, tenantId: string): IRequest => {\n const url = new URL(endpointUrl);\n url.searchParams.append(\"storage\", encodeURIComponent(endpointUrl));\n url.searchParams.append(\"tenantId\", encodeURIComponent(tenantId));\n return {\n url: url.href,\n headers: {\n [DriverHeader.createNew]: true,\n },\n };\n};\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
10
|
+
export { AzureAudience } from "./AzureAudience";
|
|
11
|
+
export { AzureClient } from "./AzureClient";
|
|
12
|
+
export { AzureFunctionTokenProvider } from "./AzureFunctionTokenProvider";
|
|
13
|
+
export { AzureClientProps, AzureConnectionConfig, AzureConnectionConfigType, AzureContainerServices, AzureContainerVersion, AzureGetVersionsOptions, AzureLocalConnectionConfig, AzureMember, AzureRemoteConnectionConfig, AzureUser, IAzureAudience, ITelemetryBaseEvent, ITelemetryBaseLogger, } from "./interfaces";
|
|
14
14
|
export { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
|
|
15
|
-
export {
|
|
15
|
+
export { ITokenClaims, IUser, ScopeType } from "@fluidframework/protocol-definitions";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACX,2BAA2B,EAC3B,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GACvB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,27 +3,19 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ScopeType = void 0;
|
|
7
|
+
exports.ScopeType = exports.AzureFunctionTokenProvider = exports.AzureClient = exports.AzureAudience = void 0;
|
|
18
8
|
/**
|
|
19
9
|
* A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.
|
|
20
10
|
*
|
|
21
11
|
* @packageDocumentation
|
|
22
12
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
var AzureAudience_1 = require("./AzureAudience");
|
|
14
|
+
Object.defineProperty(exports, "AzureAudience", { enumerable: true, get: function () { return AzureAudience_1.AzureAudience; } });
|
|
15
|
+
var AzureClient_1 = require("./AzureClient");
|
|
16
|
+
Object.defineProperty(exports, "AzureClient", { enumerable: true, get: function () { return AzureClient_1.AzureClient; } });
|
|
17
|
+
var AzureFunctionTokenProvider_1 = require("./AzureFunctionTokenProvider");
|
|
18
|
+
Object.defineProperty(exports, "AzureFunctionTokenProvider", { enumerable: true, get: function () { return AzureFunctionTokenProvider_1.AzureFunctionTokenProvider; } });
|
|
27
19
|
var protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
28
20
|
Object.defineProperty(exports, "ScopeType", { enumerable: true, get: function () { return protocol_definitions_1.ScopeType; } });
|
|
29
21
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AAkBnC,6EAAsF;AAAxD,iHAAA,SAAS,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A simple and powerful way to consume collaborative Fluid data with the Azure Fluid Relay.\n *\n * @packageDocumentation\n */\n\nexport { AzureAudience } from \"./AzureAudience\";\nexport { AzureClient } from \"./AzureClient\";\nexport { AzureFunctionTokenProvider } from \"./AzureFunctionTokenProvider\";\nexport {\n AzureClientProps,\n AzureConnectionConfig,\n AzureConnectionConfigType,\n AzureContainerServices,\n AzureContainerVersion,\n AzureGetVersionsOptions,\n AzureLocalConnectionConfig,\n AzureMember,\n AzureRemoteConnectionConfig,\n AzureUser,\n IAzureAudience,\n ITelemetryBaseEvent,\n ITelemetryBaseLogger,\n} from \"./interfaces\";\n\nexport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nexport { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\n"]}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
6
6
|
import { IMember, IServiceAudience } from "@fluidframework/fluid-static";
|
|
7
|
+
import { IUser } from "@fluidframework/protocol-definitions";
|
|
7
8
|
import { ITokenProvider } from "@fluidframework/routerlicious-driver";
|
|
8
|
-
export { ITelemetryBaseEvent, ITelemetryBaseLogger
|
|
9
|
+
export { ITelemetryBaseEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
9
10
|
/**
|
|
10
11
|
* Props for initializing a new AzureClient instance
|
|
11
12
|
*/
|
|
@@ -13,7 +14,7 @@ export interface AzureClientProps {
|
|
|
13
14
|
/**
|
|
14
15
|
* Configuration for establishing a connection with the Azure Fluid Relay.
|
|
15
16
|
*/
|
|
16
|
-
readonly connection:
|
|
17
|
+
readonly connection: AzureRemoteConnectionConfig | AzureLocalConnectionConfig;
|
|
17
18
|
/**
|
|
18
19
|
* Optional. A logger instance to receive diagnostic messages.
|
|
19
20
|
*/
|
|
@@ -102,11 +103,40 @@ export interface AzureContainerServices {
|
|
|
102
103
|
audience: IAzureAudience;
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
|
-
* Since Azure provides user names for all of its members, we extend the
|
|
106
|
-
* this service-specific value.
|
|
106
|
+
* Since Azure provides user names for all of its members, we extend the
|
|
107
|
+
* {@link @fluidframework/protocol-definitions#IUser} interface to include this service-specific value. *
|
|
108
|
+
*
|
|
109
|
+
* @typeParam T - See {@link AzureUser.additionalDetails}.
|
|
110
|
+
* Note: must be JSON-serializable.
|
|
111
|
+
* Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.
|
|
112
|
+
*/
|
|
113
|
+
export interface AzureUser<T = any> extends IUser {
|
|
114
|
+
/**
|
|
115
|
+
* The user's name
|
|
116
|
+
*/
|
|
117
|
+
name: string;
|
|
118
|
+
/**
|
|
119
|
+
* Custom, app-specific user information
|
|
120
|
+
*/
|
|
121
|
+
additionalDetails?: T;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Since Azure provides user names for all of its members, we extend the
|
|
125
|
+
* {@link @fluidframework/protocol-definitions#IMember} interface to include this service-specific value.
|
|
126
|
+
* It will be returned for all audience members connected to Azure.
|
|
127
|
+
*
|
|
128
|
+
* @typeParam T - See {@link AzureMember.additionalDetails}.
|
|
129
|
+
* Note: must be JSON-serializable.
|
|
130
|
+
* Passing a non-serializable object (e.g. a `class`) will result in undefined behavior.
|
|
107
131
|
*/
|
|
108
132
|
export interface AzureMember<T = any> extends IMember {
|
|
133
|
+
/**
|
|
134
|
+
* {@inheritDoc AzureUser.name}
|
|
135
|
+
*/
|
|
109
136
|
userName: string;
|
|
137
|
+
/**
|
|
138
|
+
* {@inheritDoc AzureUser.additionalDetails}
|
|
139
|
+
*/
|
|
110
140
|
additionalDetails?: T;
|
|
111
141
|
}
|
|
112
142
|
/**
|