@fluidframework/tinylicious-driver 2.11.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +4 -0
  3. package/api-extractor/api-extractor-lint-testUtils.cjs.json +13 -0
  4. package/api-extractor/api-extractor-lint-testUtils.esm.json +13 -0
  5. package/dist/insecureTinyliciousTokenProvider.d.ts +4 -0
  6. package/dist/insecureTinyliciousTokenProvider.d.ts.map +1 -1
  7. package/dist/insecureTinyliciousTokenProvider.js +8 -1
  8. package/dist/insecureTinyliciousTokenProvider.js.map +1 -1
  9. package/dist/insecureTinyliciousUrlResolver.d.ts +9 -1
  10. package/dist/insecureTinyliciousUrlResolver.d.ts.map +1 -1
  11. package/dist/insecureTinyliciousUrlResolver.js +13 -2
  12. package/dist/insecureTinyliciousUrlResolver.js.map +1 -1
  13. package/dist/testUtils.d.ts +7 -0
  14. package/dist/testUtils.d.ts.map +1 -0
  15. package/dist/testUtils.js +13 -0
  16. package/dist/testUtils.js.map +1 -0
  17. package/lib/insecureTinyliciousTokenProvider.d.ts +4 -0
  18. package/lib/insecureTinyliciousTokenProvider.d.ts.map +1 -1
  19. package/lib/insecureTinyliciousTokenProvider.js +6 -0
  20. package/lib/insecureTinyliciousTokenProvider.js.map +1 -1
  21. package/lib/insecureTinyliciousUrlResolver.d.ts +9 -1
  22. package/lib/insecureTinyliciousUrlResolver.d.ts.map +1 -1
  23. package/lib/insecureTinyliciousUrlResolver.js +11 -1
  24. package/lib/insecureTinyliciousUrlResolver.js.map +1 -1
  25. package/lib/testUtils.d.ts +7 -0
  26. package/lib/testUtils.d.ts.map +1 -0
  27. package/lib/testUtils.js +7 -0
  28. package/lib/testUtils.js.map +1 -0
  29. package/package.json +21 -9
  30. package/src/insecureTinyliciousTokenProvider.ts +7 -0
  31. package/src/insecureTinyliciousUrlResolver.ts +13 -1
  32. package/src/testUtils.ts +11 -0
  33. package/test-utils.d.ts +10 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fluidframework/tinylicious-driver
2
2
 
3
+ ## 2.13.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.12.0
8
+
9
+ Dependency updates only.
10
+
3
11
  ## 2.11.0
4
12
 
5
13
  Dependency updates only.
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Driver for the `tinylicious` Fluid service.
4
4
 
5
+ ## Additional Test Exports
6
+
7
+ Some additional test utilities are provided via `@fluidframework/tinylicious-driver/test-utils`. These are not meant for production use and may change in any minor update.
8
+
5
9
  <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER) -->
6
10
 
7
11
  <!-- prettier-ignore-start -->
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/testUtils.d.ts",
5
+ "messages": {
6
+ "extractorMessageReporting": {
7
+ // No release tags are used for custom test utilities
8
+ "ae-missing-release-tag": {
9
+ "logLevel": "none"
10
+ }
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/testUtils.d.ts",
5
+ "messages": {
6
+ "extractorMessageReporting": {
7
+ // No release tags are used for custom test utilities
8
+ "ae-missing-release-tag": {
9
+ "logLevel": "none"
10
+ }
11
+ }
12
+ }
13
+ }
@@ -33,4 +33,8 @@ export declare class InsecureTinyliciousTokenProvider implements ITokenProvider
33
33
  fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
34
34
  private getSignedToken;
35
35
  }
36
+ /**
37
+ * Creates an insecure Tinylicious token provider for testing purposes.
38
+ */
39
+ export declare function createInsecureTinyliciousTestTokenProvider(): ITokenProvider;
36
40
  //# sourceMappingURL=insecureTinyliciousTokenProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACtF,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,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAOb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAO1B,OAAO,CAAC,cAAc;CAkCtB"}
1
+ {"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACtF,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,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAOb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAO1B,OAAO,CAAC,cAAc;CAkCtB;AAED;;GAEG;AACH,wBAAgB,0CAA0C,IAAI,cAAc,CAE3E"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.InsecureTinyliciousTokenProvider = void 0;
7
+ exports.createInsecureTinyliciousTestTokenProvider = exports.InsecureTinyliciousTokenProvider = void 0;
8
8
  const internal_1 = require("@fluidframework/driver-definitions/internal");
9
9
  const jsrsasign_1 = require("jsrsasign");
10
10
  const uuid_1 = require("uuid");
@@ -62,4 +62,11 @@ class InsecureTinyliciousTokenProvider {
62
62
  }
63
63
  }
64
64
  exports.InsecureTinyliciousTokenProvider = InsecureTinyliciousTokenProvider;
65
+ /**
66
+ * Creates an insecure Tinylicious token provider for testing purposes.
67
+ */
68
+ function createInsecureTinyliciousTestTokenProvider() {
69
+ return new InsecureTinyliciousTokenProvider();
70
+ }
71
+ exports.createInsecureTinyliciousTestTokenProvider = createInsecureTinyliciousTestTokenProvider;
65
72
  //# sourceMappingURL=insecureTinyliciousTokenProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAAsF;AAEtF,yCAA8C;AAC9C,+BAAkC;AAElC;;;;GAIG;AACH,MAAa,gCAAgC;IAC5C;IACC;;;;;;;OAOG;IACc,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IACnC,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAmB;QAEnB,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,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AI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;IACH,CAAC;CACD;AAnED,4EAmEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\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(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): 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(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): 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
+ {"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAAsF;AAEtF,yCAA8C;AAC9C,+BAAkC;AAElC;;;;GAIG;AACH,MAAa,gCAAgC;IAC5C;IACC;;;;;;;OAOG;IACc,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IACnC,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAmB;QAEnB,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAkB;QAElB,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,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D,gGAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\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(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): 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(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): 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\n/**\n * Creates an insecure Tinylicious token provider for testing purposes.\n */\nexport function createInsecureTinyliciousTestTokenProvider(): ITokenProvider {\n\treturn new InsecureTinyliciousTokenProvider();\n}\n"]}
@@ -28,8 +28,16 @@ export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
28
28
  getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
29
29
  }
30
30
  /**
31
- * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
31
+ * Creates an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.
32
+ */
33
+ export declare function createInsecureTinyliciousTestUrlResolver(): IUrlResolver;
34
+ /**
35
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.
32
36
  * @internal
33
37
  */
34
38
  export declare const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
39
+ /**
40
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.
41
+ */
42
+ export declare const createTinyliciousTestCreateNewRequest: (documentId?: string) => IRequest;
35
43
  //# sourceMappingURL=insecureTinyliciousUrlResolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrl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,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAYlB;AAED;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,YAAY,CAEvE;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gBAAiB,MAAM,KAAG,QAKtE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC,gBAVa,MAAM,KAAG,QAUc,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createTinyliciousCreateNewRequest = exports.InsecureTinyliciousUrlResolver = exports.defaultTinyliciousEndpoint = exports.defaultTinyliciousPort = void 0;
7
+ exports.createTinyliciousTestCreateNewRequest = exports.createTinyliciousCreateNewRequest = exports.createInsecureTinyliciousTestUrlResolver = exports.InsecureTinyliciousUrlResolver = exports.defaultTinyliciousEndpoint = exports.defaultTinyliciousPort = void 0;
8
8
  const internal_1 = require("@fluidframework/driver-definitions/internal");
9
9
  /**
10
10
  * Default endpoint port. Will be used by the service if the consumer does not specify a port.
@@ -76,7 +76,14 @@ class InsecureTinyliciousUrlResolver {
76
76
  }
77
77
  exports.InsecureTinyliciousUrlResolver = InsecureTinyliciousUrlResolver;
78
78
  /**
79
- * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
79
+ * Creates an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.
80
+ */
81
+ function createInsecureTinyliciousTestUrlResolver() {
82
+ return new InsecureTinyliciousUrlResolver();
83
+ }
84
+ exports.createInsecureTinyliciousTestUrlResolver = createInsecureTinyliciousTestUrlResolver;
85
+ /**
86
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.
80
87
  * @internal
81
88
  */
82
89
  const createTinyliciousCreateNewRequest = (documentId) => ({
@@ -86,4 +93,8 @@ const createTinyliciousCreateNewRequest = (documentId) => ({
86
93
  },
87
94
  });
88
95
  exports.createTinyliciousCreateNewRequest = createTinyliciousCreateNewRequest;
96
+ /**
97
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.
98
+ */
99
+ exports.createTinyliciousTestCreateNewRequest = exports.createTinyliciousCreateNewRequest;
89
100
  //# sourceMappingURL=insecureTinyliciousUrlResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAIqD;AAErD;;;GAGG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACU,QAAA,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAa,8BAA8B;IAE1C,YAAmB,IAAI,GAAG,8BAAsB,EAAE,QAAQ,GAAG,kCAA0B;QACtF,IAAI,CAAC,mBAAmB,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;IAClD,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,uBAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;YACzE,wEAAwE;YACxE,kFAAkF;YAClF,qGAAqG;YACrG,sBAAsB;YACtB,IAAI,eAAe,KAAK,EAAE,EAAE,CAAC;gBAC5B,eAAe,GAAG,KAAK,CAAC;YACzB,CAAC;YACD,eAAe,GAAG,GAAG,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/*!\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 {\n\tDriverHeader,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\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 tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\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.tinyliciousEndpoint}/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.tinyliciousEndpoint}/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(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/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"]}
1
+ {"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":";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7E,WAAW,GAAG,GAAG,IAAI,CAAC,mBAAmB,gBAAgB,YAAY,GAAG,oBAAoB,EAAE,CAAC;YAC/F,eAAe,GAAG,GAAG,IAAI,CAAC,mBAAmB,uBAAuB,YAAY,EAAE,CAAC;QACpF,CAAC;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,CAC1B,WAAyB,EACzB,WAAmB;QAEnB,MAAM,UAAU,GAAG,kBAAkB,CACpC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,eAAe,EAAE,EAAE,CAAC,CACvE,CAAC;QACF;;;;;WAKG;QACH,OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AA5DD,wEA4DC;AAED;;GAEG;AACH,SAAgB,wCAAwC;IACvD,OAAO,IAAI,8BAA8B,EAAE,CAAC;AAC7C,CAAC;AAFD,4FAEC;AAED;;;GAGG;AACI,MAAM,iCAAiC,GAAG,CAAC,UAAmB,EAAY,EAAE,CAAC,CAAC;IACpF,GAAG,EAAE,UAAU,IAAI,EAAE;IACrB,OAAO,EAAE;QACR,CAAC,uBAAY,CAAC,SAAS,CAAC,EAAE,IAAI;KAC9B;CACD,CAAC,CAAC;AALU,QAAA,iCAAiC,qCAK3C;AAEH;;GAEG;AACU,QAAA,qCAAqC,GAAG,yCAAiC,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 {\n\tDriverHeader,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\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 tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\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.tinyliciousEndpoint}/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.tinyliciousEndpoint}/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(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/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 an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.\n */\nexport function createInsecureTinyliciousTestUrlResolver(): IUrlResolver {\n\treturn new InsecureTinyliciousUrlResolver();\n}\n\n/**\n * Creates a Tinylicious {@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\n/**\n * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.\n */\nexport const createTinyliciousTestCreateNewRequest = createTinyliciousCreateNewRequest;\n"]}
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { createInsecureTinyliciousTestTokenProvider } from "./insecureTinyliciousTokenProvider.js";
6
+ export { createInsecureTinyliciousTestUrlResolver, createTinyliciousTestCreateNewRequest, } from "./insecureTinyliciousUrlResolver.js";
7
+ //# sourceMappingURL=testUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,OAAO,EACN,wCAAwC,EACxC,qCAAqC,GACrC,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createTinyliciousTestCreateNewRequest = exports.createInsecureTinyliciousTestUrlResolver = exports.createInsecureTinyliciousTestTokenProvider = void 0;
8
+ var insecureTinyliciousTokenProvider_js_1 = require("./insecureTinyliciousTokenProvider.js");
9
+ Object.defineProperty(exports, "createInsecureTinyliciousTestTokenProvider", { enumerable: true, get: function () { return insecureTinyliciousTokenProvider_js_1.createInsecureTinyliciousTestTokenProvider; } });
10
+ var insecureTinyliciousUrlResolver_js_1 = require("./insecureTinyliciousUrlResolver.js");
11
+ Object.defineProperty(exports, "createInsecureTinyliciousTestUrlResolver", { enumerable: true, get: function () { return insecureTinyliciousUrlResolver_js_1.createInsecureTinyliciousTestUrlResolver; } });
12
+ Object.defineProperty(exports, "createTinyliciousTestCreateNewRequest", { enumerable: true, get: function () { return insecureTinyliciousUrlResolver_js_1.createTinyliciousTestCreateNewRequest; } });
13
+ //# sourceMappingURL=testUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6FAAmG;AAA1F,iKAAA,0CAA0C,OAAA;AAEnD,yFAG6C;AAF5C,6JAAA,wCAAwC,OAAA;AACxC,0JAAA,qCAAqC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { createInsecureTinyliciousTestTokenProvider } from \"./insecureTinyliciousTokenProvider.js\";\n\nexport {\n\tcreateInsecureTinyliciousTestUrlResolver,\n\tcreateTinyliciousTestCreateNewRequest,\n} from \"./insecureTinyliciousUrlResolver.js\";\n"]}
@@ -33,4 +33,8 @@ export declare class InsecureTinyliciousTokenProvider implements ITokenProvider
33
33
  fetchStorageToken(tenantId: string, documentId: string): Promise<ITokenResponse>;
34
34
  private getSignedToken;
35
35
  }
36
+ /**
37
+ * Creates an insecure Tinylicious token provider for testing purposes.
38
+ */
39
+ export declare function createInsecureTinyliciousTestTokenProvider(): ITokenProvider;
36
40
  //# sourceMappingURL=insecureTinyliciousTokenProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACtF,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,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAOb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAO1B,OAAO,CAAC,cAAc;CAkCtB"}
1
+ {"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACtF,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,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAOb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAO1B,OAAO,CAAC,cAAc;CAkCtB;AAED;;GAEG;AACH,wBAAgB,0CAA0C,IAAI,cAAc,CAE3E"}
@@ -58,4 +58,10 @@ export class InsecureTinyliciousTokenProvider {
58
58
  null, JSON.stringify({ alg: "HS256", typ: "JWT" }), claims, utf8Key);
59
59
  }
60
60
  }
61
+ /**
62
+ * Creates an insecure Tinylicious token provider for testing purposes.
63
+ */
64
+ export function createInsecureTinyliciousTestTokenProvider() {
65
+ return new InsecureTinyliciousTokenProvider();
66
+ }
61
67
  //# sourceMappingURL=insecureTinyliciousTokenProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAEtF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AI,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 { ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\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(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): 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(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): 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
+ {"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAEtF,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;;G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AG;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;AAED;;GAEG;AACH,MAAM,UAAU,0CAA0C;IACzD,OAAO,IAAI,gCAAgC,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\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(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): 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(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): 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\n/**\n * Creates an insecure Tinylicious token provider for testing purposes.\n */\nexport function createInsecureTinyliciousTestTokenProvider(): ITokenProvider {\n\treturn new InsecureTinyliciousTokenProvider();\n}\n"]}
@@ -28,8 +28,16 @@ export declare class InsecureTinyliciousUrlResolver implements IUrlResolver {
28
28
  getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
29
29
  }
30
30
  /**
31
- * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
31
+ * Creates an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.
32
+ */
33
+ export declare function createInsecureTinyliciousTestUrlResolver(): IUrlResolver;
34
+ /**
35
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.
32
36
  * @internal
33
37
  */
34
38
  export declare const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
39
+ /**
40
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.
41
+ */
42
+ export declare const createTinyliciousTestCreateNewRequest: (documentId?: string) => IRequest;
35
43
  //# 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,EAEN,YAAY,EACZ,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD;;;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,mBAAmB,CAAS;gBAC1B,IAAI,SAAyB,EAAE,QAAQ,SAA6B;IAI1E,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAuCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAYlB;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gBAAiB,MAAM,KAAG,QAKtE,CAAC"}
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,EAEN,YAAY,EACZ,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD;;;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,mBAAmB,CAAS;gBAC1B,IAAI,SAAyB,EAAE,QAAQ,SAA6B;IAI1E,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAuCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAYlB;AAED;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,YAAY,CAEvE;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gBAAiB,MAAM,KAAG,QAKtE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC,gBAVa,MAAM,KAAG,QAUc,CAAC"}
@@ -72,7 +72,13 @@ export class InsecureTinyliciousUrlResolver {
72
72
  }
73
73
  }
74
74
  /**
75
- * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
75
+ * Creates an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.
76
+ */
77
+ export function createInsecureTinyliciousTestUrlResolver() {
78
+ return new InsecureTinyliciousUrlResolver();
79
+ }
80
+ /**
81
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.
76
82
  * @internal
77
83
  */
78
84
  export const createTinyliciousCreateNewRequest = (documentId) => ({
@@ -81,4 +87,8 @@ export const createTinyliciousCreateNewRequest = (documentId) => ({
81
87
  [DriverHeader.createNew]: true,
82
88
  },
83
89
  });
90
+ /**
91
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.
92
+ */
93
+ export const createTinyliciousTestCreateNewRequest = createTinyliciousCreateNewRequest;
84
94
  //# sourceMappingURL=insecureTinyliciousUrlResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAGZ,MAAM,6CAA6C,CAAC;AAErD;;;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;IAE1C,YAAmB,IAAI,GAAG,sBAAsB,EAAE,QAAQ,GAAG,0BAA0B;QACtF,IAAI,CAAC,mBAAmB,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;IAClD,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,YAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;YACzE,wEAAwE;YACxE,kFAAkF;YAClF,qGAAqG;YACrG,sBAAsB;YACtB,IAAI,eAAe,KAAK,EAAE,EAAE,CAAC;gBAC5B,eAAe,GAAG,KAAK,CAAC;YACzB,CAAC;YACD,eAAe,GAAG,GAAG,IAAI,CAAC,mBAAmB,uBAAuB,eAAe,EAAE,CAAC;YACtF,WAAW,GAAG,GAAG,IAAI,CAAC,mBAAmB,gBAAgB,eAAe,EAAE,CAAC;QAC5E,CAAC;aAAM,CAAC;YACP,MAAM,YAAY,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;YACzD,MAAM,oBAAoB,GAAG,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;YAC7E,WAAW,GAAG,GAAG,IAAI,CAAC,mBAAmB,gBAAgB,YAAY,GAAG,oBAAoB,EAAE,CAAC;YAC/F,eAAe,GAAG,GAAG,IAAI,CAAC,mBAAmB,uBAAuB,YAAY,EAAE,CAAC;QACpF,CAAC;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,CAC1B,WAAyB,EACzB,WAAmB;QAEnB,MAAM,UAAU,GAAG,kBAAkB,CACpC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,eAAe,EAAE,EAAE,CAAC,CACvE,CAAC;QACF;;;;;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 {\n\tDriverHeader,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\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 tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\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.tinyliciousEndpoint}/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.tinyliciousEndpoint}/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(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/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"]}
1
+ {"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAGZ,MAAM,6CAA6C,CAAC;AAErD;;;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AAG,GAAG,IAAI,CAAC,mBAAmB,gBAAgB,YAAY,GAAG,oBAAoB,EAAE,CAAC;YAC/F,eAAe,GAAG,GAAG,IAAI,CAAC,mBAAmB,uBAAuB,YAAY,EAAE,CAAC;QACpF,CAAC;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,CAC1B,WAAyB,EACzB,WAAmB;QAEnB,MAAM,UAAU,GAAG,kBAAkB,CACpC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,eAAe,EAAE,EAAE,CAAC,CACvE,CAAC;QACF;;;;;WAKG;QACH,OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AAED;;GAEG;AACH,MAAM,UAAU,wCAAwC;IACvD,OAAO,IAAI,8BAA8B,EAAE,CAAC;AAC7C,CAAC;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;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,iCAAiC,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 {\n\tDriverHeader,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\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 tinyliciousEndpoint: string;\n\tpublic constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {\n\t\tthis.tinyliciousEndpoint = `${endpoint}:${port}`;\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.tinyliciousEndpoint}/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.tinyliciousEndpoint}/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(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/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 an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.\n */\nexport function createInsecureTinyliciousTestUrlResolver(): IUrlResolver {\n\treturn new InsecureTinyliciousUrlResolver();\n}\n\n/**\n * Creates a Tinylicious {@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\n/**\n * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.\n */\nexport const createTinyliciousTestCreateNewRequest = createTinyliciousCreateNewRequest;\n"]}
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { createInsecureTinyliciousTestTokenProvider } from "./insecureTinyliciousTokenProvider.js";
6
+ export { createInsecureTinyliciousTestUrlResolver, createTinyliciousTestCreateNewRequest, } from "./insecureTinyliciousUrlResolver.js";
7
+ //# sourceMappingURL=testUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,OAAO,EACN,wCAAwC,EACxC,qCAAqC,GACrC,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { createInsecureTinyliciousTestTokenProvider } from "./insecureTinyliciousTokenProvider.js";
6
+ export { createInsecureTinyliciousTestUrlResolver, createTinyliciousTestCreateNewRequest, } from "./insecureTinyliciousUrlResolver.js";
7
+ //# sourceMappingURL=testUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,OAAO,EACN,wCAAwC,EACxC,qCAAqC,GACrC,MAAM,qCAAqC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { createInsecureTinyliciousTestTokenProvider } from \"./insecureTinyliciousTokenProvider.js\";\n\nexport {\n\tcreateInsecureTinyliciousTestUrlResolver,\n\tcreateTinyliciousTestCreateNewRequest,\n} from \"./insecureTinyliciousUrlResolver.js\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tinylicious-driver",
3
- "version": "2.11.0",
3
+ "version": "2.13.0",
4
4
  "description": "Driver for tinylicious",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -22,6 +22,16 @@
22
22
  "default": "./dist/index.js"
23
23
  }
24
24
  },
25
+ "./test-utils": {
26
+ "import": {
27
+ "types": "./lib/testUtils.d.ts",
28
+ "default": "./lib/testUtils.js"
29
+ },
30
+ "require": {
31
+ "types": "./dist/testUtils.d.ts",
32
+ "default": "./dist/testUtils.js"
33
+ }
34
+ },
25
35
  "./internal": {
26
36
  "import": {
27
37
  "types": "./lib/index.d.ts",
@@ -36,25 +46,25 @@
36
46
  "main": "lib/index.js",
37
47
  "types": "lib/public.d.ts",
38
48
  "dependencies": {
39
- "@fluidframework/core-interfaces": "~2.11.0",
40
- "@fluidframework/driver-definitions": "~2.11.0",
41
- "@fluidframework/driver-utils": "~2.11.0",
42
- "@fluidframework/routerlicious-driver": "~2.11.0",
49
+ "@fluidframework/core-interfaces": "~2.13.0",
50
+ "@fluidframework/driver-definitions": "~2.13.0",
51
+ "@fluidframework/driver-utils": "~2.13.0",
52
+ "@fluidframework/routerlicious-driver": "~2.13.0",
43
53
  "jsrsasign": "^11.0.0",
44
54
  "uuid": "^9.0.0"
45
55
  },
46
56
  "devDependencies": {
47
- "@arethetypeswrong/cli": "^0.16.4",
57
+ "@arethetypeswrong/cli": "^0.17.1",
48
58
  "@biomejs/biome": "~1.9.3",
49
- "@fluid-internal/mocha-test-setup": "~2.11.0",
59
+ "@fluid-internal/mocha-test-setup": "~2.13.0",
50
60
  "@fluid-tools/build-cli": "^0.51.0",
51
61
  "@fluidframework/build-common": "^2.0.3",
52
62
  "@fluidframework/build-tools": "^0.51.0",
53
63
  "@fluidframework/eslint-config-fluid": "^5.6.0",
54
- "@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.10.0",
64
+ "@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.12.0",
55
65
  "@microsoft/api-extractor": "7.47.8",
56
66
  "@types/jsrsasign": "^10.5.12",
57
- "@types/mocha": "^9.1.1",
67
+ "@types/mocha": "^10.0.10",
58
68
  "@types/node": "^18.19.0",
59
69
  "@types/uuid": "^9.0.2",
60
70
  "concurrently": "^8.2.1",
@@ -87,7 +97,9 @@
87
97
  "check:exports": "concurrently \"npm:check:exports:*\"",
88
98
  "check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
89
99
  "check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
100
+ "check:exports:cjs:testUtils": "api-extractor run --config api-extractor/api-extractor-lint-testUtils.cjs.json",
90
101
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
102
+ "check:exports:esm:testUtils": "api-extractor run --config api-extractor/api-extractor-lint-testUtils.esm.json",
91
103
  "check:format": "npm run check:biome",
92
104
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
93
105
  "ci:build:docs": "api-extractor run",
@@ -81,3 +81,10 @@ export class InsecureTinyliciousTokenProvider implements ITokenProvider {
81
81
  );
82
82
  }
83
83
  }
84
+
85
+ /**
86
+ * Creates an insecure Tinylicious token provider for testing purposes.
87
+ */
88
+ export function createInsecureTinyliciousTestTokenProvider(): ITokenProvider {
89
+ return new InsecureTinyliciousTokenProvider();
90
+ }
@@ -92,7 +92,14 @@ export class InsecureTinyliciousUrlResolver implements IUrlResolver {
92
92
  }
93
93
 
94
94
  /**
95
- * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.
95
+ * Creates an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.
96
+ */
97
+ export function createInsecureTinyliciousTestUrlResolver(): IUrlResolver {
98
+ return new InsecureTinyliciousUrlResolver();
99
+ }
100
+
101
+ /**
102
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.
96
103
  * @internal
97
104
  */
98
105
  export const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({
@@ -101,3 +108,8 @@ export const createTinyliciousCreateNewRequest = (documentId?: string): IRequest
101
108
  [DriverHeader.createNew]: true,
102
109
  },
103
110
  });
111
+
112
+ /**
113
+ * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.
114
+ */
115
+ export const createTinyliciousTestCreateNewRequest = createTinyliciousCreateNewRequest;
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export { createInsecureTinyliciousTestTokenProvider } from "./insecureTinyliciousTokenProvider.js";
7
+
8
+ export {
9
+ createInsecureTinyliciousTestUrlResolver,
10
+ createTinyliciousTestCreateNewRequest,
11
+ } from "./insecureTinyliciousUrlResolver.js";
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * This is required for compiling with Node10 moduleResolution. No runtime support.
8
+ */
9
+
10
+ export * from "./lib/testUtils.js";