@fluidframework/tinylicious-driver 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -2
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/tinylicious-driver.api.md +5 -5
- package/dist/{index.js → index.cjs} +3 -3
- package/dist/index.cjs.map +1 -0
- package/dist/{insecureTinyliciousTokenProvider.js → insecureTinyliciousTokenProvider.cjs} +2 -3
- package/dist/insecureTinyliciousTokenProvider.cjs.map +1 -0
- package/dist/insecureTinyliciousTokenProvider.d.ts +1 -2
- package/dist/insecureTinyliciousTokenProvider.d.ts.map +1 -1
- package/dist/{insecureTinyliciousUrlResolver.js → insecureTinyliciousUrlResolver.cjs} +5 -9
- package/dist/insecureTinyliciousUrlResolver.cjs.map +1 -0
- package/dist/insecureTinyliciousUrlResolver.d.ts +4 -8
- package/dist/insecureTinyliciousUrlResolver.d.ts.map +1 -1
- package/dist/tinylicious-driver-alpha.d.ts +18 -0
- package/dist/tinylicious-driver-beta.d.ts +28 -0
- package/dist/tinylicious-driver-public.d.ts +28 -0
- package/dist/tinylicious-driver-untrimmed.d.ts +71 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/{index.js → index.mjs} +3 -3
- package/lib/index.mjs.map +1 -0
- package/lib/insecureTinyliciousTokenProvider.d.ts +1 -2
- package/lib/insecureTinyliciousTokenProvider.d.ts.map +1 -1
- package/lib/{insecureTinyliciousTokenProvider.js → insecureTinyliciousTokenProvider.mjs} +2 -3
- package/lib/insecureTinyliciousTokenProvider.mjs.map +1 -0
- package/lib/insecureTinyliciousUrlResolver.d.ts +4 -8
- package/lib/insecureTinyliciousUrlResolver.d.ts.map +1 -1
- package/lib/{insecureTinyliciousUrlResolver.js → insecureTinyliciousUrlResolver.mjs} +5 -9
- package/lib/insecureTinyliciousUrlResolver.mjs.map +1 -0
- package/lib/tinylicious-driver-alpha.d.ts +18 -0
- package/lib/tinylicious-driver-beta.d.ts +28 -0
- package/lib/tinylicious-driver-public.d.ts +28 -0
- package/lib/tinylicious-driver-untrimmed.d.ts +71 -0
- package/package.json +43 -23
- package/src/insecureTinyliciousTokenProvider.ts +1 -2
- package/src/insecureTinyliciousUrlResolver.ts +4 -8
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +5 -3
- package/dist/index.js.map +0 -1
- package/dist/insecureTinyliciousTokenProvider.js.map +0 -1
- package/dist/insecureTinyliciousUrlResolver.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/insecureTinyliciousTokenProvider.js.map +0 -1
- package/lib/insecureTinyliciousUrlResolver.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -61,8 +61,7 @@ Thank you!
|
|
|
61
61
|
|
|
62
62
|
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
63
63
|
|
|
64
|
-
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand
|
|
65
|
-
Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
64
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
66
65
|
|
|
67
66
|
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
68
67
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: remove once base config has this enabled as an error
|
|
7
|
+
"ae-incompatible-release-tags": {
|
|
8
|
+
"logLevel": "error",
|
|
9
|
+
"addToApiReportFile": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: Add missing documentation and remove this rule override
|
|
7
|
+
"ae-undocumented": {
|
|
8
|
+
"logLevel": "none"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
4
12
|
}
|
|
@@ -11,16 +11,16 @@ import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
|
11
11
|
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
12
12
|
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
13
13
|
|
|
14
|
-
// @
|
|
14
|
+
// @internal
|
|
15
15
|
export const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
|
|
16
16
|
|
|
17
|
-
// @
|
|
17
|
+
// @internal
|
|
18
18
|
export const defaultTinyliciousEndpoint = "http://localhost";
|
|
19
19
|
|
|
20
|
-
// @
|
|
20
|
+
// @internal
|
|
21
21
|
export const defaultTinyliciousPort = 7070;
|
|
22
22
|
|
|
23
|
-
// @
|
|
23
|
+
// @internal
|
|
24
24
|
export class InsecureTinyliciousTokenProvider implements ITokenProvider {
|
|
25
25
|
constructor(
|
|
26
26
|
scopes?: ScopeType[] | undefined);
|
|
@@ -30,7 +30,7 @@ export class InsecureTinyliciousTokenProvider implements ITokenProvider {
|
|
|
30
30
|
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// @
|
|
33
|
+
// @internal
|
|
34
34
|
export class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
35
35
|
constructor(port?: number, endpoint?: string);
|
|
36
36
|
// (undocumented)
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.InsecureTinyliciousUrlResolver = exports.defaultTinyliciousPort = exports.defaultTinyliciousEndpoint = exports.createTinyliciousCreateNewRequest = exports.InsecureTinyliciousTokenProvider = void 0;
|
|
8
|
-
var insecureTinyliciousTokenProvider_1 = require("./insecureTinyliciousTokenProvider");
|
|
8
|
+
var insecureTinyliciousTokenProvider_1 = require("./insecureTinyliciousTokenProvider.cjs");
|
|
9
9
|
Object.defineProperty(exports, "InsecureTinyliciousTokenProvider", { enumerable: true, get: function () { return insecureTinyliciousTokenProvider_1.InsecureTinyliciousTokenProvider; } });
|
|
10
|
-
var insecureTinyliciousUrlResolver_1 = require("./insecureTinyliciousUrlResolver");
|
|
10
|
+
var insecureTinyliciousUrlResolver_1 = require("./insecureTinyliciousUrlResolver.cjs");
|
|
11
11
|
Object.defineProperty(exports, "createTinyliciousCreateNewRequest", { enumerable: true, get: function () { return insecureTinyliciousUrlResolver_1.createTinyliciousCreateNewRequest; } });
|
|
12
12
|
Object.defineProperty(exports, "defaultTinyliciousEndpoint", { enumerable: true, get: function () { return insecureTinyliciousUrlResolver_1.defaultTinyliciousEndpoint; } });
|
|
13
13
|
Object.defineProperty(exports, "defaultTinyliciousPort", { enumerable: true, get: function () { return insecureTinyliciousUrlResolver_1.defaultTinyliciousPort; } });
|
|
14
14
|
Object.defineProperty(exports, "InsecureTinyliciousUrlResolver", { enumerable: true, get: function () { return insecureTinyliciousUrlResolver_1.InsecureTinyliciousUrlResolver; } });
|
|
15
|
-
//# sourceMappingURL=index.
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2FAAsF;AAA7E,oJAAA,gCAAgC,OAAA;AACzC,uFAK0C;AAJzC,mJAAA,iCAAiC,OAAA;AACjC,4IAAA,0BAA0B,OAAA;AAC1B,wIAAA,sBAAsB,OAAA;AACtB,gJAAA,8BAA8B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { InsecureTinyliciousTokenProvider } from \"./insecureTinyliciousTokenProvider\";\nexport {\n\tcreateTinyliciousCreateNewRequest,\n\tdefaultTinyliciousEndpoint,\n\tdefaultTinyliciousPort,\n\tInsecureTinyliciousUrlResolver,\n} from \"./insecureTinyliciousUrlResolver\";\n"]}
|
|
@@ -11,8 +11,7 @@ const uuid_1 = require("uuid");
|
|
|
11
11
|
/**
|
|
12
12
|
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
13
13
|
* to get up and running.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
14
|
+
* @internal
|
|
16
15
|
*/
|
|
17
16
|
class InsecureTinyliciousTokenProvider {
|
|
18
17
|
constructor(
|
|
@@ -63,4 +62,4 @@ class InsecureTinyliciousTokenProvider {
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
exports.InsecureTinyliciousTokenProvider = InsecureTinyliciousTokenProvider;
|
|
66
|
-
//# sourceMappingURL=insecureTinyliciousTokenProvider.
|
|
65
|
+
//# sourceMappingURL=insecureTinyliciousTokenProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousTokenProvider.cjs","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAA+E;AAE/E,yCAA8C;AAC9C,+BAAkC;AAElC;;;;GAIG;AACH,MAAa,gCAAgC;IAC5C;IACC;;;;;;;OAOG;IACc,MAAoB;QAApB,WAAM,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,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAClC,OAAO,gBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;QAC5B,2BAA2B;QAC3B,2CAA2C;QAC3C,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;IACH,CAAC;CACD;AA7DD,4EA6DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ScopeType, ITokenClaims } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n * @internal\n */\nexport class InsecureTinyliciousTokenProvider implements ITokenProvider {\n\tconstructor(\n\t\t/**\n\t\t * Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider\n\t\t * will use the default scopes which are document read, write and summarizer write.\n\t\t *\n\t\t * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n\t\t *\n\t\t * @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]\n\t\t */\n\t\tprivate readonly scopes?: ScopeType[],\n\t) {}\n\n\tpublic async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate getSignedToken(\n\t\ttenantId: string,\n\t\tdocumentId: string | undefined,\n\t\tlifetime: number = 60 * 60,\n\t\tver: string = \"1.0\",\n\t): string {\n\t\tconst userId = uuid();\n\t\tconst match = userId.match(/^([\\da-f]{8})-([\\da-f]{4})/);\n\t\tconst userName = match === null ? userId : match[0]; // Just use the first two segments of the (fake) userId as a fake name.\n\n\t\t// Current time in seconds\n\t\tconst now = Math.round(Date.now() / 1000);\n\t\tconst user = { id: userId, name: userName };\n\n\t\tconst claims: ITokenClaims = {\n\t\t\tdocumentId: documentId ?? \"\",\n\t\t\tscopes: this.scopes ?? [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite],\n\t\t\ttenantId,\n\t\t\tuser,\n\t\t\tiat: now,\n\t\t\texp: now + lifetime,\n\t\t\tver,\n\t\t};\n\n\t\tconst utf8Key = { utf8: \"12345\" };\n\t\treturn jsrsasign.jws.JWS.sign(\n\t\t\t// External API uses `null`\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tnull,\n\t\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\t\tclaims,\n\t\t\tutf8Key,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -7,8 +7,7 @@ import { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-dr
|
|
|
7
7
|
/**
|
|
8
8
|
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
9
9
|
* to get up and running.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
10
|
+
* @internal
|
|
12
11
|
*/
|
|
13
12
|
export declare class InsecureTinyliciousTokenProvider implements ITokenProvider {
|
|
14
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAgB,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAItF
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAgB,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAItF;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc;IAErE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IARxB;;;;;;;OAOG;IACc,MAAM,CAAC,yBAAa;IAGzB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAOjF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAO7F,OAAO,CAAC,cAAc;CAkCtB"}
|
|
@@ -8,14 +8,12 @@ exports.createTinyliciousCreateNewRequest = exports.InsecureTinyliciousUrlResolv
|
|
|
8
8
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
9
9
|
/**
|
|
10
10
|
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
11
|
+
* @internal
|
|
13
12
|
*/
|
|
14
13
|
exports.defaultTinyliciousPort = 7070;
|
|
15
14
|
/**
|
|
16
15
|
* Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
16
|
+
* @internal
|
|
19
17
|
*/
|
|
20
18
|
exports.defaultTinyliciousEndpoint = "http://localhost";
|
|
21
19
|
/**
|
|
@@ -23,8 +21,7 @@ exports.defaultTinyliciousEndpoint = "http://localhost";
|
|
|
23
21
|
* for a given request. This particular implementation has a goal to avoid imposing requirements on the app's
|
|
24
22
|
* URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):
|
|
25
23
|
* documentId/containerRelativePathing
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
24
|
+
* @internal
|
|
28
25
|
*/
|
|
29
26
|
class InsecureTinyliciousUrlResolver {
|
|
30
27
|
constructor(port = exports.defaultTinyliciousPort, endpoint = exports.defaultTinyliciousEndpoint) {
|
|
@@ -81,8 +78,7 @@ class InsecureTinyliciousUrlResolver {
|
|
|
81
78
|
exports.InsecureTinyliciousUrlResolver = InsecureTinyliciousUrlResolver;
|
|
82
79
|
/**
|
|
83
80
|
* Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
84
|
-
*
|
|
85
|
-
* @public
|
|
81
|
+
* @internal
|
|
86
82
|
*/
|
|
87
83
|
const createTinyliciousCreateNewRequest = (documentId) => ({
|
|
88
84
|
url: documentId ?? "",
|
|
@@ -91,4 +87,4 @@ const createTinyliciousCreateNewRequest = (documentId) => ({
|
|
|
91
87
|
},
|
|
92
88
|
});
|
|
93
89
|
exports.createTinyliciousCreateNewRequest = createTinyliciousCreateNewRequest;
|
|
94
|
-
//# sourceMappingURL=insecureTinyliciousUrlResolver.
|
|
90
|
+
//# sourceMappingURL=insecureTinyliciousUrlResolver.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousUrlResolver.cjs","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAA8F;AAE9F;;;GAGG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACU,QAAA,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAa,8BAA8B;IAG1C,YAAmB,IAAI,GAAG,8BAAsB,EAAE,QAAQ,GAAG,kCAA0B;QACtF,IAAI,CAAC,mBAAmB,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;QACj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ACpC,UAAU,EAAE,GAAG,IAAI,CAAC,mBAAmB,oBAAoB;aAC3D;YACD,EAAE,EAAE,eAAe;YACnB,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,WAAW;SAChB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAyB,EAAE,WAAmB;QACzE,MAAM,UAAU,GAAG,kBAAkB,CACpC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,qBAAqB,eAAe,EAAE,EAAE,CAAC,CACzE,CAAC;QACF;;;;;WAKG;QACH,OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AA3DD,wEA2DC;AAED;;;GAGG;AACI,MAAM,iCAAiC,GAAG,CAAC,UAAmB,EAAY,EAAE,CAAC,CAAC;IACpF,GAAG,EAAE,UAAU,IAAI,EAAE;IACrB,OAAO,EAAE;QACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;KAC9B;CACD,CAAC,CAAC;AALU,QAAA,iCAAiC,qCAK3C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\n\n/**\n * Default endpoint port. Will be used by the service if the consumer does not specify a port.\n * @internal\n */\nexport const defaultTinyliciousPort = 7070;\n\n/**\n * Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.\n * @internal\n */\nexport const defaultTinyliciousEndpoint = \"http://localhost\";\n\n/**\n * InsecureTinyliciousUrlResolver knows how to get the URLs to the service (in this case Tinylicious) to use\n * for a given request. This particular implementation has a goal to avoid imposing requirements on the app's\n * URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):\n * documentId/containerRelativePathing\n * @internal\n */\nexport class InsecureTinyliciousUrlResolver implements IUrlResolver {\n\tprivate readonly fluidProtocolEndpoint: string;\n\tprivate readonly tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\n\t\tthis.fluidProtocolEndpoint = this.tinyliciousEndpoint.replace(/(^\\w+:|^)\\/\\//, \"fluid://\");\n\t}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst relativeUrl = request.url.replace(`${this.tinyliciousEndpoint}/`, \"\");\n\t\tconst documentIdFromRequest = relativeUrl.split(\"/\")[0];\n\n\t\tlet deltaStorageUrl: string;\n\t\tlet documentUrl: string;\n\t\tlet finalDocumentId: string = documentIdFromRequest;\n\n\t\t// Special handling if the request is to create a new container\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.fluidProtocolEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.\n * @internal\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n"]}
|
|
@@ -6,14 +6,12 @@ import { IRequest } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
9
|
+
* @internal
|
|
11
10
|
*/
|
|
12
11
|
export declare const defaultTinyliciousPort = 7070;
|
|
13
12
|
/**
|
|
14
13
|
* Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
14
|
+
* @internal
|
|
17
15
|
*/
|
|
18
16
|
export declare const defaultTinyliciousEndpoint = "http://localhost";
|
|
19
17
|
/**
|
|
@@ -21,8 +19,7 @@ export declare const defaultTinyliciousEndpoint = "http://localhost";
|
|
|
21
19
|
* for a given request. This particular implementation has a goal to avoid imposing requirements on the app's
|
|
22
20
|
* URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):
|
|
23
21
|
* documentId/containerRelativePathing
|
|
24
|
-
*
|
|
25
|
-
* @public
|
|
22
|
+
* @internal
|
|
26
23
|
*/
|
|
27
24
|
export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
28
25
|
private readonly fluidProtocolEndpoint;
|
|
@@ -33,8 +30,7 @@ export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
|
33
30
|
}
|
|
34
31
|
/**
|
|
35
32
|
* Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
33
|
+
* @internal
|
|
38
34
|
*/
|
|
39
35
|
export declare const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
|
|
40
36
|
//# sourceMappingURL=insecureTinyliciousUrlResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAgB,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAE9F
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAgB,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAE9F;;;GAGG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;;;;GAMG;AACH,qBAAa,8BAA+B,YAAW,YAAY;IAClE,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAC/C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;gBAC1B,IAAI,SAAyB,EAAE,QAAQ,SAA6B;IAK1E,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAuCjD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAY5F;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gBAAiB,MAAM,KAAG,QAKtE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/* Excluded from this release type: createTinyliciousCreateNewRequest */
|
|
9
|
+
|
|
10
|
+
/* Excluded from this release type: defaultTinyliciousEndpoint */
|
|
11
|
+
|
|
12
|
+
/* Excluded from this release type: defaultTinyliciousPort */
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: InsecureTinyliciousTokenProvider */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: InsecureTinyliciousUrlResolver */
|
|
17
|
+
|
|
18
|
+
export { }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/* Excluded from this release type: createTinyliciousCreateNewRequest */
|
|
9
|
+
|
|
10
|
+
/* Excluded from this release type: defaultTinyliciousEndpoint */
|
|
11
|
+
|
|
12
|
+
/* Excluded from this release type: defaultTinyliciousPort */
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: InsecureTinyliciousTokenProvider */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: InsecureTinyliciousUrlResolver */
|
|
17
|
+
|
|
18
|
+
/* Excluded from this release type: IRequest */
|
|
19
|
+
|
|
20
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
21
|
+
|
|
22
|
+
/* Excluded from this release type: ITokenProvider */
|
|
23
|
+
|
|
24
|
+
/* Excluded from this release type: ITokenResponse */
|
|
25
|
+
|
|
26
|
+
/* Excluded from this release type: IUrlResolver */
|
|
27
|
+
|
|
28
|
+
export { }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/* Excluded from this release type: createTinyliciousCreateNewRequest */
|
|
9
|
+
|
|
10
|
+
/* Excluded from this release type: defaultTinyliciousEndpoint */
|
|
11
|
+
|
|
12
|
+
/* Excluded from this release type: defaultTinyliciousPort */
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: InsecureTinyliciousTokenProvider */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: InsecureTinyliciousUrlResolver */
|
|
17
|
+
|
|
18
|
+
/* Excluded from this release type: IRequest */
|
|
19
|
+
|
|
20
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
21
|
+
|
|
22
|
+
/* Excluded from this release type: ITokenProvider */
|
|
23
|
+
|
|
24
|
+
/* Excluded from this release type: ITokenResponse */
|
|
25
|
+
|
|
26
|
+
/* Excluded from this release type: IUrlResolver */
|
|
27
|
+
|
|
28
|
+
export { }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const defaultTinyliciousEndpoint = "http://localhost";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare const defaultTinyliciousPort = 7070;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
28
|
+
* to get up and running.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare class InsecureTinyliciousTokenProvider implements ITokenProvider {
|
|
32
|
+
/**
|
|
33
|
+
* Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider
|
|
34
|
+
* will use the default scopes which are document read, write and summarizer write.
|
|
35
|
+
*
|
|
36
|
+
* @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]
|
|
39
|
+
*/
|
|
40
|
+
private readonly scopes?;
|
|
41
|
+
constructor(
|
|
42
|
+
/**
|
|
43
|
+
* Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider
|
|
44
|
+
* will use the default scopes which are document read, write and summarizer write.
|
|
45
|
+
*
|
|
46
|
+
* @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
|
|
47
|
+
*
|
|
48
|
+
* @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]
|
|
49
|
+
*/
|
|
50
|
+
scopes?: ScopeType[] | undefined);
|
|
51
|
+
fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
|
|
52
|
+
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
|
|
53
|
+
private getSignedToken;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* InsecureTinyliciousUrlResolver knows how to get the URLs to the service (in this case Tinylicious) to use
|
|
58
|
+
* for a given request. This particular implementation has a goal to avoid imposing requirements on the app's
|
|
59
|
+
* URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):
|
|
60
|
+
* documentId/containerRelativePathing
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
64
|
+
private readonly fluidProtocolEndpoint;
|
|
65
|
+
private readonly tinyliciousEndpoint;
|
|
66
|
+
constructor(port?: number, endpoint?: string);
|
|
67
|
+
resolve(request: IRequest): Promise<IResolvedUrl>;
|
|
68
|
+
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { }
|
package/dist/tsdoc-metadata.json
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { InsecureTinyliciousTokenProvider } from "./insecureTinyliciousTokenProvider";
|
|
6
|
-
export { createTinyliciousCreateNewRequest, defaultTinyliciousEndpoint, defaultTinyliciousPort, InsecureTinyliciousUrlResolver, } from "./insecureTinyliciousUrlResolver";
|
|
5
|
+
export { InsecureTinyliciousTokenProvider } from "./insecureTinyliciousTokenProvider.mjs";
|
|
6
|
+
export { createTinyliciousCreateNewRequest, defaultTinyliciousEndpoint, defaultTinyliciousPort, InsecureTinyliciousUrlResolver, } from "./insecureTinyliciousUrlResolver.mjs";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gCAAgC,EAAE;OACpC,EACN,iCAAiC,EACjC,0BAA0B,EAC1B,sBAAsB,EACtB,8BAA8B,GAC9B"}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { InsecureTinyliciousTokenProvider } from "./insecureTinyliciousTokenProvider";
|
|
6
|
-
export { createTinyliciousCreateNewRequest, defaultTinyliciousEndpoint, defaultTinyliciousPort, InsecureTinyliciousUrlResolver, } from "./insecureTinyliciousUrlResolver";
|
|
7
|
-
//# sourceMappingURL=index.
|
|
5
|
+
export { InsecureTinyliciousTokenProvider } from "./insecureTinyliciousTokenProvider.mjs";
|
|
6
|
+
export { createTinyliciousCreateNewRequest, defaultTinyliciousEndpoint, defaultTinyliciousPort, InsecureTinyliciousUrlResolver, } from "./insecureTinyliciousUrlResolver.mjs";
|
|
7
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gCAAgC,EAAE;OACpC,EACN,iCAAiC,EACjC,0BAA0B,EAC1B,sBAAsB,EACtB,8BAA8B,GAC9B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { InsecureTinyliciousTokenProvider } from \"./insecureTinyliciousTokenProvider\";\nexport {\n\tcreateTinyliciousCreateNewRequest,\n\tdefaultTinyliciousEndpoint,\n\tdefaultTinyliciousPort,\n\tInsecureTinyliciousUrlResolver,\n} from \"./insecureTinyliciousUrlResolver\";\n"]}
|
|
@@ -7,8 +7,7 @@ import { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-dr
|
|
|
7
7
|
/**
|
|
8
8
|
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
9
9
|
* to get up and running.
|
|
10
|
-
*
|
|
11
|
-
* @public
|
|
10
|
+
* @internal
|
|
12
11
|
*/
|
|
13
12
|
export declare class InsecureTinyliciousTokenProvider implements ITokenProvider {
|
|
14
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,SAAS,EAAgB,MAAM,sCAAsC;OACvE,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC;AAIrF;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc;IAErE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IARxB;;;;;;;OAOG;IACc,MAAM,CAAC,yBAAa;IAGzB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAOjF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAO7F,OAAO,CAAC,cAAc;CAkCtB"}
|
|
@@ -8,8 +8,7 @@ import { v4 as uuid } from "uuid";
|
|
|
8
8
|
/**
|
|
9
9
|
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
10
10
|
* to get up and running.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
11
|
+
* @internal
|
|
13
12
|
*/
|
|
14
13
|
export class InsecureTinyliciousTokenProvider {
|
|
15
14
|
constructor(
|
|
@@ -59,4 +58,4 @@ export class InsecureTinyliciousTokenProvider {
|
|
|
59
58
|
null, JSON.stringify({ alg: "HS256", typ: "JWT" }), claims, utf8Key);
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
|
-
//# sourceMappingURL=insecureTinyliciousTokenProvider.
|
|
61
|
+
//# sourceMappingURL=insecureTinyliciousTokenProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousTokenProvider.mjs","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,SAAS,EAAgB,MAAM,sCAAsC;OAEvE,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW;OACtC,EAAE,EAAE,IAAI,IAAI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,IAAI;YACJ,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,GAAG,GAAG,QAAQ;YACnB,GAAG;SACH,CAAC;QAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;QAC5B,2BAA2B;QAC3B,2CAA2C;QAC3C,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ScopeType, ITokenClaims } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n * @internal\n */\nexport class InsecureTinyliciousTokenProvider implements ITokenProvider {\n\tconstructor(\n\t\t/**\n\t\t * Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider\n\t\t * will use the default scopes which are document read, write and summarizer write.\n\t\t *\n\t\t * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n\t\t *\n\t\t * @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]\n\t\t */\n\t\tprivate readonly scopes?: ScopeType[],\n\t) {}\n\n\tpublic async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate getSignedToken(\n\t\ttenantId: string,\n\t\tdocumentId: string | undefined,\n\t\tlifetime: number = 60 * 60,\n\t\tver: string = \"1.0\",\n\t): string {\n\t\tconst userId = uuid();\n\t\tconst match = userId.match(/^([\\da-f]{8})-([\\da-f]{4})/);\n\t\tconst userName = match === null ? userId : match[0]; // Just use the first two segments of the (fake) userId as a fake name.\n\n\t\t// Current time in seconds\n\t\tconst now = Math.round(Date.now() / 1000);\n\t\tconst user = { id: userId, name: userName };\n\n\t\tconst claims: ITokenClaims = {\n\t\t\tdocumentId: documentId ?? \"\",\n\t\t\tscopes: this.scopes ?? [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite],\n\t\t\ttenantId,\n\t\t\tuser,\n\t\t\tiat: now,\n\t\t\texp: now + lifetime,\n\t\t\tver,\n\t\t};\n\n\t\tconst utf8Key = { utf8: \"12345\" };\n\t\treturn jsrsasign.jws.JWS.sign(\n\t\t\t// External API uses `null`\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tnull,\n\t\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\t\tclaims,\n\t\t\tutf8Key,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -6,14 +6,12 @@ import { IRequest } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
9
|
+
* @internal
|
|
11
10
|
*/
|
|
12
11
|
export declare const defaultTinyliciousPort = 7070;
|
|
13
12
|
/**
|
|
14
13
|
* Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
14
|
+
* @internal
|
|
17
15
|
*/
|
|
18
16
|
export declare const defaultTinyliciousEndpoint = "http://localhost";
|
|
19
17
|
/**
|
|
@@ -21,8 +19,7 @@ export declare const defaultTinyliciousEndpoint = "http://localhost";
|
|
|
21
19
|
* for a given request. This particular implementation has a goal to avoid imposing requirements on the app's
|
|
22
20
|
* URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):
|
|
23
21
|
* documentId/containerRelativePathing
|
|
24
|
-
*
|
|
25
|
-
* @public
|
|
22
|
+
* @internal
|
|
26
23
|
*/
|
|
27
24
|
export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
28
25
|
private readonly fluidProtocolEndpoint;
|
|
@@ -33,8 +30,7 @@ export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
|
33
30
|
}
|
|
34
31
|
/**
|
|
35
32
|
* Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
33
|
+
* @internal
|
|
38
34
|
*/
|
|
39
35
|
export declare const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
|
|
40
36
|
//# sourceMappingURL=insecureTinyliciousUrlResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,MAAM,iCAAiC;OACnD,EAAgB,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC;AAE7F;;;GAGG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;;;;GAMG;AACH,qBAAa,8BAA+B,YAAW,YAAY;IAClE,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAC/C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;gBAC1B,IAAI,SAAyB,EAAE,QAAQ,SAA6B;IAK1E,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAuCjD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAY5F;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gBAAiB,MAAM,KAAG,QAKtE,CAAC"}
|
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
6
6
|
/**
|
|
7
7
|
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
8
|
+
* @internal
|
|
10
9
|
*/
|
|
11
10
|
export const defaultTinyliciousPort = 7070;
|
|
12
11
|
/**
|
|
13
12
|
* Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
13
|
+
* @internal
|
|
16
14
|
*/
|
|
17
15
|
export const defaultTinyliciousEndpoint = "http://localhost";
|
|
18
16
|
/**
|
|
@@ -20,8 +18,7 @@ export const defaultTinyliciousEndpoint = "http://localhost";
|
|
|
20
18
|
* for a given request. This particular implementation has a goal to avoid imposing requirements on the app's
|
|
21
19
|
* URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):
|
|
22
20
|
* documentId/containerRelativePathing
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
21
|
+
* @internal
|
|
25
22
|
*/
|
|
26
23
|
export class InsecureTinyliciousUrlResolver {
|
|
27
24
|
constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {
|
|
@@ -77,8 +74,7 @@ export class InsecureTinyliciousUrlResolver {
|
|
|
77
74
|
}
|
|
78
75
|
/**
|
|
79
76
|
* Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
80
|
-
*
|
|
81
|
-
* @public
|
|
77
|
+
* @internal
|
|
82
78
|
*/
|
|
83
79
|
export const createTinyliciousCreateNewRequest = (documentId) => ({
|
|
84
80
|
url: documentId ?? "",
|
|
@@ -86,4 +82,4 @@ export const createTinyliciousCreateNewRequest = (documentId) => ({
|
|
|
86
82
|
[DriverHeader.createNew]: true,
|
|
87
83
|
},
|
|
88
84
|
});
|
|
89
|
-
//# sourceMappingURL=insecureTinyliciousUrlResolver.
|
|
85
|
+
//# sourceMappingURL=insecureTinyliciousUrlResolver.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousUrlResolver.mjs","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,YAAY,EAA8B,MAAM,oCAAoC;AAE7F;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,OAAO,8BAA8B;IAG1C,YAAmB,IAAI,GAAG,sBAAsB,EAAE,QAAQ,GAAG,0BAA0B;QACtF,IAAI,CAAC,mBAAmB,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC5F,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,GAAG,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,qBAAqB,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,IAAI,eAAu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;WAKG;QACH,OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,UAAmB,EAAY,EAAE,CAAC,CAAC;IACpF,GAAG,EAAE,UAAU,IAAI,EAAE;IACrB,OAAO,EAAE;QACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;KAC9B;CACD,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\n\n/**\n * Default endpoint port. Will be used by the service if the consumer does not specify a port.\n * @internal\n */\nexport const defaultTinyliciousPort = 7070;\n\n/**\n * Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.\n * @internal\n */\nexport const defaultTinyliciousEndpoint = \"http://localhost\";\n\n/**\n * InsecureTinyliciousUrlResolver knows how to get the URLs to the service (in this case Tinylicious) to use\n * for a given request. This particular implementation has a goal to avoid imposing requirements on the app's\n * URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):\n * documentId/containerRelativePathing\n * @internal\n */\nexport class InsecureTinyliciousUrlResolver implements IUrlResolver {\n\tprivate readonly fluidProtocolEndpoint: string;\n\tprivate readonly tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\n\t\tthis.fluidProtocolEndpoint = this.tinyliciousEndpoint.replace(/(^\\w+:|^)\\/\\//, \"fluid://\");\n\t}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst relativeUrl = request.url.replace(`${this.tinyliciousEndpoint}/`, \"\");\n\t\tconst documentIdFromRequest = relativeUrl.split(\"/\")[0];\n\n\t\tlet deltaStorageUrl: string;\n\t\tlet documentUrl: string;\n\t\tlet finalDocumentId: string = documentIdFromRequest;\n\n\t\t// Special handling if the request is to create a new container\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.fluidProtocolEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.\n * @internal\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/* Excluded from this release type: createTinyliciousCreateNewRequest */
|
|
9
|
+
|
|
10
|
+
/* Excluded from this release type: defaultTinyliciousEndpoint */
|
|
11
|
+
|
|
12
|
+
/* Excluded from this release type: defaultTinyliciousPort */
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: InsecureTinyliciousTokenProvider */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: InsecureTinyliciousUrlResolver */
|
|
17
|
+
|
|
18
|
+
export { }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/* Excluded from this release type: createTinyliciousCreateNewRequest */
|
|
9
|
+
|
|
10
|
+
/* Excluded from this release type: defaultTinyliciousEndpoint */
|
|
11
|
+
|
|
12
|
+
/* Excluded from this release type: defaultTinyliciousPort */
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: InsecureTinyliciousTokenProvider */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: InsecureTinyliciousUrlResolver */
|
|
17
|
+
|
|
18
|
+
/* Excluded from this release type: IRequest */
|
|
19
|
+
|
|
20
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
21
|
+
|
|
22
|
+
/* Excluded from this release type: ITokenProvider */
|
|
23
|
+
|
|
24
|
+
/* Excluded from this release type: ITokenResponse */
|
|
25
|
+
|
|
26
|
+
/* Excluded from this release type: IUrlResolver */
|
|
27
|
+
|
|
28
|
+
export { }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/* Excluded from this release type: createTinyliciousCreateNewRequest */
|
|
9
|
+
|
|
10
|
+
/* Excluded from this release type: defaultTinyliciousEndpoint */
|
|
11
|
+
|
|
12
|
+
/* Excluded from this release type: defaultTinyliciousPort */
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: InsecureTinyliciousTokenProvider */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: InsecureTinyliciousUrlResolver */
|
|
17
|
+
|
|
18
|
+
/* Excluded from this release type: IRequest */
|
|
19
|
+
|
|
20
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
21
|
+
|
|
22
|
+
/* Excluded from this release type: ITokenProvider */
|
|
23
|
+
|
|
24
|
+
/* Excluded from this release type: ITokenResponse */
|
|
25
|
+
|
|
26
|
+
/* Excluded from this release type: IUrlResolver */
|
|
27
|
+
|
|
28
|
+
export { }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
3
|
+
import { ITokenProvider } from '@fluidframework/routerlicious-driver';
|
|
4
|
+
import { ITokenResponse } from '@fluidframework/routerlicious-driver';
|
|
5
|
+
import { IUrlResolver } from '@fluidframework/driver-definitions';
|
|
6
|
+
import { ScopeType } from '@fluidframework/protocol-definitions';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const defaultTinyliciousEndpoint = "http://localhost";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare const defaultTinyliciousPort = 7070;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
28
|
+
* to get up and running.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare class InsecureTinyliciousTokenProvider implements ITokenProvider {
|
|
32
|
+
/**
|
|
33
|
+
* Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider
|
|
34
|
+
* will use the default scopes which are document read, write and summarizer write.
|
|
35
|
+
*
|
|
36
|
+
* @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]
|
|
39
|
+
*/
|
|
40
|
+
private readonly scopes?;
|
|
41
|
+
constructor(
|
|
42
|
+
/**
|
|
43
|
+
* Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider
|
|
44
|
+
* will use the default scopes which are document read, write and summarizer write.
|
|
45
|
+
*
|
|
46
|
+
* @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}
|
|
47
|
+
*
|
|
48
|
+
* @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]
|
|
49
|
+
*/
|
|
50
|
+
scopes?: ScopeType[] | undefined);
|
|
51
|
+
fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse>;
|
|
52
|
+
fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
|
|
53
|
+
private getSignedToken;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* InsecureTinyliciousUrlResolver knows how to get the URLs to the service (in this case Tinylicious) to use
|
|
58
|
+
* for a given request. This particular implementation has a goal to avoid imposing requirements on the app's
|
|
59
|
+
* URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):
|
|
60
|
+
* documentId/containerRelativePathing
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
64
|
+
private readonly fluidProtocolEndpoint;
|
|
65
|
+
private readonly tinyliciousEndpoint;
|
|
66
|
+
constructor(port?: number, endpoint?: string);
|
|
67
|
+
resolve(request: IRequest): Promise<IResolvedUrl>;
|
|
68
|
+
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tinylicious-driver",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.4.0",
|
|
4
4
|
"description": "Driver for tinylicious",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -10,61 +10,81 @@
|
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Microsoft and contributors",
|
|
13
|
-
"main": "dist/index.
|
|
14
|
-
"module": "lib/index.
|
|
13
|
+
"main": "dist/index.cjs",
|
|
14
|
+
"module": "lib/index.mjs",
|
|
15
15
|
"types": "dist/index.d.ts",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
18
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
19
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
17
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
18
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
19
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
20
20
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
21
|
-
"@fluidframework/routerlicious-driver": ">=2.0.0-internal.7.
|
|
21
|
+
"@fluidframework/routerlicious-driver": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
22
22
|
"jsrsasign": "^10.5.25",
|
|
23
23
|
"uuid": "^9.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@
|
|
26
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
27
|
+
"@fluid-tools/build-cli": "^0.28.0",
|
|
27
28
|
"@fluidframework/build-common": "^2.0.3",
|
|
28
|
-
"@fluidframework/build-tools": "^0.
|
|
29
|
-
"@fluidframework/eslint-config-fluid": "^3.
|
|
30
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
29
|
+
"@fluidframework/build-tools": "^0.28.0",
|
|
30
|
+
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
31
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
31
32
|
"@fluidframework/test-tools": "^1.0.195075",
|
|
32
|
-
"@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.0.0-internal.7.2.
|
|
33
|
-
"@microsoft/api-extractor": "^7.
|
|
33
|
+
"@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.0.0-internal.7.2.0",
|
|
34
|
+
"@microsoft/api-extractor": "^7.38.3",
|
|
34
35
|
"@types/jsrsasign": "^8.0.8",
|
|
35
36
|
"@types/mocha": "^9.1.1",
|
|
36
|
-
"@types/node": "^
|
|
37
|
+
"@types/node": "^18.19.0",
|
|
37
38
|
"@types/uuid": "^9.0.2",
|
|
39
|
+
"copyfiles": "^2.4.1",
|
|
38
40
|
"cross-env": "^7.0.3",
|
|
39
41
|
"eslint": "~8.50.0",
|
|
40
42
|
"mocha": "^10.2.0",
|
|
41
43
|
"prettier": "~3.0.3",
|
|
42
44
|
"rimraf": "^4.4.0",
|
|
45
|
+
"tsc-multi": "^1.1.0",
|
|
43
46
|
"typescript": "~5.1.6"
|
|
44
47
|
},
|
|
48
|
+
"fluidBuild": {
|
|
49
|
+
"tasks": {
|
|
50
|
+
"build:docs": {
|
|
51
|
+
"dependsOn": [
|
|
52
|
+
"...",
|
|
53
|
+
"api-extractor:commonjs",
|
|
54
|
+
"api-extractor:esnext"
|
|
55
|
+
],
|
|
56
|
+
"script": false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
45
60
|
"typeValidation": {
|
|
46
61
|
"broken": {}
|
|
47
62
|
},
|
|
48
63
|
"scripts": {
|
|
64
|
+
"api": "fluid-build . --task api",
|
|
65
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
66
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
49
67
|
"build": "fluid-build . --task build",
|
|
50
68
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
51
69
|
"build:compile": "fluid-build . --task compile",
|
|
52
|
-
"build:docs": "
|
|
53
|
-
"build:esnext": "tsc --
|
|
54
|
-
"build:test": "tsc --
|
|
70
|
+
"build:docs": "fluid-build . --task api",
|
|
71
|
+
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
72
|
+
"build:test": "tsc-multi --config ./tsc-multi.test.json",
|
|
73
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
74
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
55
75
|
"ci:build:docs": "api-extractor run",
|
|
56
|
-
"clean": "rimraf --glob dist lib \"
|
|
76
|
+
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
57
77
|
"eslint": "eslint --format stylish src",
|
|
58
78
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
59
79
|
"format": "npm run prettier:fix",
|
|
60
|
-
"lint": "npm run prettier && npm run eslint",
|
|
80
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
61
81
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
62
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
63
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
82
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
83
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
64
84
|
"test": "npm run test:mocha",
|
|
65
|
-
"test:mocha": "mocha --ignore
|
|
85
|
+
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
66
86
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
67
|
-
"tsc": "tsc",
|
|
87
|
+
"tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
|
|
68
88
|
"typetests:gen": "fluid-type-test-generator",
|
|
69
89
|
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
70
90
|
}
|
|
@@ -11,8 +11,7 @@ import { v4 as uuid } from "uuid";
|
|
|
11
11
|
/**
|
|
12
12
|
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
13
13
|
* to get up and running.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
14
|
+
* @internal
|
|
16
15
|
*/
|
|
17
16
|
export class InsecureTinyliciousTokenProvider implements ITokenProvider {
|
|
18
17
|
constructor(
|
|
@@ -8,15 +8,13 @@ import { DriverHeader, IResolvedUrl, IUrlResolver } from "@fluidframework/driver
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
11
|
+
* @internal
|
|
13
12
|
*/
|
|
14
13
|
export const defaultTinyliciousPort = 7070;
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
17
|
+
* @internal
|
|
20
18
|
*/
|
|
21
19
|
export const defaultTinyliciousEndpoint = "http://localhost";
|
|
22
20
|
|
|
@@ -25,8 +23,7 @@ export const defaultTinyliciousEndpoint = "http://localhost";
|
|
|
25
23
|
* for a given request. This particular implementation has a goal to avoid imposing requirements on the app's
|
|
26
24
|
* URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):
|
|
27
25
|
* documentId/containerRelativePathing
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
26
|
+
* @internal
|
|
30
27
|
*/
|
|
31
28
|
export class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
32
29
|
private readonly fluidProtocolEndpoint: string;
|
|
@@ -91,8 +88,7 @@ export class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
|
91
88
|
|
|
92
89
|
/**
|
|
93
90
|
* Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
94
|
-
*
|
|
95
|
-
* @public
|
|
91
|
+
* @internal
|
|
96
92
|
*/
|
|
97
93
|
export const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({
|
|
98
94
|
url: documentId ?? "",
|
package/tsconfig.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends":
|
|
2
|
+
"extends": [
|
|
3
|
+
"../../../common/build/build-common/tsconfig.base.json",
|
|
4
|
+
"../../../common/build/build-common/tsconfig.cjs.json",
|
|
5
|
+
],
|
|
6
|
+
"include": ["src/**/*"],
|
|
3
7
|
"exclude": ["src/test/**/*"],
|
|
4
8
|
"compilerOptions": {
|
|
5
9
|
"rootDir": "./src",
|
|
6
10
|
"outDir": "./dist",
|
|
7
|
-
"composite": true,
|
|
8
11
|
},
|
|
9
|
-
"include": ["src/**/*"],
|
|
10
12
|
}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uFAAsF;AAA7E,oJAAA,gCAAgC,OAAA;AACzC,mFAK0C;AAJzC,mJAAA,iCAAiC,OAAA;AACjC,4IAAA,0BAA0B,OAAA;AAC1B,wIAAA,sBAAsB,OAAA;AACtB,gJAAA,8BAA8B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { InsecureTinyliciousTokenProvider } from \"./insecureTinyliciousTokenProvider\";\nexport {\n\tcreateTinyliciousCreateNewRequest,\n\tdefaultTinyliciousEndpoint,\n\tdefaultTinyliciousPort,\n\tInsecureTinyliciousUrlResolver,\n} from \"./insecureTinyliciousUrlResolver\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAA+E;AAE/E,yCAA8C;AAC9C,+BAAkC;AAElC;;;;;GAKG;AACH,MAAa,gCAAgC;IAC5C;IACC;;;;;;;OAOG;IACc,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IACnC,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAmB;QACnE,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAkB;QAClE,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,cAAc,CACrB,QAAgB,EAChB,UAA8B,EAC9B,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;QAEnB,MAAM,MAAM,GAAG,IAAA,SAAI,GAAE,CAAC;QACtB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,uEAAuE;QAE5H,0BAA0B;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAE5C,MAAM,MAAM,GAAiB;YAC5B,UAAU,EAAE,UAAU,IAAI,EAAE;YAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,gCAAS,CAAC,OAAO,EAAE,gCAAS,CAAC,QAAQ,EAAE,gCAAS,CAAC,YAAY,CAAC;YACtF,QAAQ;YACR,IAAI;YACJ,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,GAAG,GAAG,QAAQ;YACnB,GAAG;SACH,CAAC;QAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAClC,OAAO,gBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;QAC5B,2BAA2B;QAC3B,2CAA2C;QAC3C,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;IACH,CAAC;CACD;AA7DD,4EA6DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ScopeType, ITokenClaims } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n *\n * @public\n */\nexport class InsecureTinyliciousTokenProvider implements ITokenProvider {\n\tconstructor(\n\t\t/**\n\t\t * Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider\n\t\t * will use the default scopes which are document read, write and summarizer write.\n\t\t *\n\t\t * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n\t\t *\n\t\t * @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]\n\t\t */\n\t\tprivate readonly scopes?: ScopeType[],\n\t) {}\n\n\tpublic async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate getSignedToken(\n\t\ttenantId: string,\n\t\tdocumentId: string | undefined,\n\t\tlifetime: number = 60 * 60,\n\t\tver: string = \"1.0\",\n\t): string {\n\t\tconst userId = uuid();\n\t\tconst match = userId.match(/^([\\da-f]{8})-([\\da-f]{4})/);\n\t\tconst userName = match === null ? userId : match[0]; // Just use the first two segments of the (fake) userId as a fake name.\n\n\t\t// Current time in seconds\n\t\tconst now = Math.round(Date.now() / 1000);\n\t\tconst user = { id: userId, name: userName };\n\n\t\tconst claims: ITokenClaims = {\n\t\t\tdocumentId: documentId ?? \"\",\n\t\t\tscopes: this.scopes ?? [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite],\n\t\t\ttenantId,\n\t\t\tuser,\n\t\t\tiat: now,\n\t\t\texp: now + lifetime,\n\t\t\tver,\n\t\t};\n\n\t\tconst utf8Key = { utf8: \"12345\" };\n\t\treturn jsrsasign.jws.JWS.sign(\n\t\t\t// External API uses `null`\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tnull,\n\t\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\t\tclaims,\n\t\t\tutf8Key,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/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kB,CAAC,eAAe,CAAC,CAAC;YACzD,MAAM,oBAAoB,GAAG,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;YAC7E,WAAW,GAAG,GAAG,IAAI,CAAC,qBAAqB,gBAAgB,YAAY,GAAG,oBAAoB,EAAE,CAAC;YACjG,eAAe,GAAG,GAAG,IAAI,CAAC,mBAAmB,uBAAuB,YAAY,EAAE,CAAC;SACnF;QAED,OAAO;YACN,SAAS,EAAE;gBACV,eAAe;gBACf,UAAU,EAAE,IAAI,CAAC,mBAAmB;gBACpC,UAAU,EAAE,GAAG,IAAI,CAAC,mBAAmB,oBAAoB;aAC3D;YACD,EAAE,EAAE,eAAe;YACnB,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,WAAW;SAChB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAyB,EAAE,WAAmB;QACzE,MAAM,UAAU,GAAG,kBAAkB,CACpC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,qBAAqB,eAAe,EAAE,EAAE,CAAC,CACzE,CAAC;QACF;;;;;WAKG;QACH,OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AA3DD,wEA2DC;AAED;;;;GAIG;AACI,MAAM,iCAAiC,GAAG,CAAC,UAAmB,EAAY,EAAE,CAAC,CAAC;IACpF,GAAG,EAAE,UAAU,IAAI,EAAE;IACrB,OAAO,EAAE;QACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;KAC9B;CACD,CAAC,CAAC;AALU,QAAA,iCAAiC,qCAK3C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\n\n/**\n * Default endpoint port. Will be used by the service if the consumer does not specify a port.\n *\n * @public\n */\nexport const defaultTinyliciousPort = 7070;\n\n/**\n * Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.\n *\n * @public\n */\nexport const defaultTinyliciousEndpoint = \"http://localhost\";\n\n/**\n * InsecureTinyliciousUrlResolver knows how to get the URLs to the service (in this case Tinylicious) to use\n * for a given request. This particular implementation has a goal to avoid imposing requirements on the app's\n * URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):\n * documentId/containerRelativePathing\n *\n * @public\n */\nexport class InsecureTinyliciousUrlResolver implements IUrlResolver {\n\tprivate readonly fluidProtocolEndpoint: string;\n\tprivate readonly tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\n\t\tthis.fluidProtocolEndpoint = this.tinyliciousEndpoint.replace(/(^\\w+:|^)\\/\\//, \"fluid://\");\n\t}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst relativeUrl = request.url.replace(`${this.tinyliciousEndpoint}/`, \"\");\n\t\tconst documentIdFromRequest = relativeUrl.split(\"/\")[0];\n\n\t\tlet deltaStorageUrl: string;\n\t\tlet documentUrl: string;\n\t\tlet finalDocumentId: string = documentIdFromRequest;\n\n\t\t// Special handling if the request is to create a new container\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.fluidProtocolEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.\n *\n * @public\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n"]}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EACN,iCAAiC,EACjC,0BAA0B,EAC1B,sBAAsB,EACtB,8BAA8B,GAC9B,MAAM,kCAAkC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { InsecureTinyliciousTokenProvider } from \"./insecureTinyliciousTokenProvider\";\nexport {\n\tcreateTinyliciousCreateNewRequest,\n\tdefaultTinyliciousEndpoint,\n\tdefaultTinyliciousPort,\n\tInsecureTinyliciousUrlResolver,\n} from \"./insecureTinyliciousUrlResolver\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAgB,MAAM,sCAAsC,CAAC;AAE/E,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;;;GAKG;AACH,MAAM,OAAO,gCAAgC;IAC5C;IACC;;;;;;;OAOG;IACc,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IACnC,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAmB;QACnE,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,UAAkB;QAClE,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,cAAc,CACrB,QAAgB,EAChB,UAA8B,EAC9B,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;QAEnB,MAAM,MAAM,GAAG,IAAI,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,uEAAuE;QAE5H,0BAA0B;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAE5C,MAAM,MAAM,GAAiB;YAC5B,UAAU,EAAE,UAAU,IAAI,EAAE;YAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC;YACtF,QAAQ;YACR,IAAI;YACJ,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,GAAG,GAAG,QAAQ;YACnB,GAAG;SACH,CAAC;QAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;QAC5B,2BAA2B;QAC3B,2CAA2C;QAC3C,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ScopeType, ITokenClaims } from \"@fluidframework/protocol-definitions\";\nimport { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n *\n * @public\n */\nexport class InsecureTinyliciousTokenProvider implements ITokenProvider {\n\tconstructor(\n\t\t/**\n\t\t * Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider\n\t\t * will use the default scopes which are document read, write and summarizer write.\n\t\t *\n\t\t * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n\t\t *\n\t\t * @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]\n\t\t */\n\t\tprivate readonly scopes?: ScopeType[],\n\t) {}\n\n\tpublic async fetchOrdererToken(tenantId: string, documentId?: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate getSignedToken(\n\t\ttenantId: string,\n\t\tdocumentId: string | undefined,\n\t\tlifetime: number = 60 * 60,\n\t\tver: string = \"1.0\",\n\t): string {\n\t\tconst userId = uuid();\n\t\tconst match = userId.match(/^([\\da-f]{8})-([\\da-f]{4})/);\n\t\tconst userName = match === null ? userId : match[0]; // Just use the first two segments of the (fake) userId as a fake name.\n\n\t\t// Current time in seconds\n\t\tconst now = Math.round(Date.now() / 1000);\n\t\tconst user = { id: userId, name: userName };\n\n\t\tconst claims: ITokenClaims = {\n\t\t\tdocumentId: documentId ?? \"\",\n\t\t\tscopes: this.scopes ?? [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite],\n\t\t\ttenantId,\n\t\t\tuser,\n\t\t\tiat: now,\n\t\t\texp: now + lifetime,\n\t\t\tver,\n\t\t};\n\n\t\tconst utf8Key = { utf8: \"12345\" };\n\t\treturn jsrsasign.jws.JWS.sign(\n\t\t\t// External API uses `null`\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tnull,\n\t\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\t\tclaims,\n\t\t\tutf8Key,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAA8B,MAAM,oCAAoC,CAAC;AAE9F;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,OAAO,8BAA8B;IAG1C,YAAmB,IAAI,GAAG,sBAAsB,EAAE,QAAQ,GAAG,0BAA0B;QACtF,IAAI,CAAC,mBAAmB,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC5F,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,GAAG,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,qBAAqB,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,IAAI,eAAuB,CAAC;QAC5B,IAAI,WAAmB,CAAC;QACxB,IAAI,eAAe,GAAW,qBAAqB,CAAC;QAEpD,+DAA+D;QAC/D,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,YA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,CAAC;IACpF,GAAG,EAAE,UAAU,IAAI,EAAE;IACrB,OAAO,EAAE;QACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;KAC9B;CACD,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\n\n/**\n * Default endpoint port. Will be used by the service if the consumer does not specify a port.\n *\n * @public\n */\nexport const defaultTinyliciousPort = 7070;\n\n/**\n * Default endpoint URL base. Will be used by the service if the consumer does not specify an endpoint.\n *\n * @public\n */\nexport const defaultTinyliciousEndpoint = \"http://localhost\";\n\n/**\n * InsecureTinyliciousUrlResolver knows how to get the URLs to the service (in this case Tinylicious) to use\n * for a given request. This particular implementation has a goal to avoid imposing requirements on the app's\n * URL shape, so it expects the request url to have this format (as opposed to a more traditional URL):\n * documentId/containerRelativePathing\n *\n * @public\n */\nexport class InsecureTinyliciousUrlResolver implements IUrlResolver {\n\tprivate readonly fluidProtocolEndpoint: string;\n\tprivate readonly tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\n\t\tthis.fluidProtocolEndpoint = this.tinyliciousEndpoint.replace(/(^\\w+:|^)\\/\\//, \"fluid://\");\n\t}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst relativeUrl = request.url.replace(`${this.tinyliciousEndpoint}/`, \"\");\n\t\tconst documentIdFromRequest = relativeUrl.split(\"/\")[0];\n\n\t\tlet deltaStorageUrl: string;\n\t\tlet documentUrl: string;\n\t\tlet finalDocumentId: string = documentIdFromRequest;\n\n\t\t// Special handling if the request is to create a new container\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.fluidProtocolEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.fluidProtocolEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.\n *\n * @public\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n"]}
|