@fluidframework/tinylicious-driver 2.0.0-internal.7.3.0 → 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.
Files changed (33) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +9 -1
  4. package/api-report/tinylicious-driver.api.md +5 -5
  5. package/dist/insecureTinyliciousTokenProvider.cjs +1 -2
  6. package/dist/insecureTinyliciousTokenProvider.cjs.map +1 -1
  7. package/dist/insecureTinyliciousTokenProvider.d.ts +1 -2
  8. package/dist/insecureTinyliciousTokenProvider.d.ts.map +1 -1
  9. package/dist/insecureTinyliciousUrlResolver.cjs +4 -8
  10. package/dist/insecureTinyliciousUrlResolver.cjs.map +1 -1
  11. package/dist/insecureTinyliciousUrlResolver.d.ts +4 -8
  12. package/dist/insecureTinyliciousUrlResolver.d.ts.map +1 -1
  13. package/dist/tinylicious-driver-alpha.d.ts +18 -0
  14. package/dist/tinylicious-driver-beta.d.ts +28 -0
  15. package/dist/tinylicious-driver-public.d.ts +28 -0
  16. package/dist/tinylicious-driver-untrimmed.d.ts +71 -0
  17. package/lib/index.d.ts +2 -2
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/insecureTinyliciousTokenProvider.d.ts +1 -2
  20. package/lib/insecureTinyliciousTokenProvider.d.ts.map +1 -1
  21. package/lib/insecureTinyliciousTokenProvider.mjs +1 -2
  22. package/lib/insecureTinyliciousTokenProvider.mjs.map +1 -1
  23. package/lib/insecureTinyliciousUrlResolver.d.ts +4 -8
  24. package/lib/insecureTinyliciousUrlResolver.d.ts.map +1 -1
  25. package/lib/insecureTinyliciousUrlResolver.mjs +4 -8
  26. package/lib/insecureTinyliciousUrlResolver.mjs.map +1 -1
  27. package/lib/tinylicious-driver-alpha.d.ts +18 -0
  28. package/lib/tinylicious-driver-beta.d.ts +28 -0
  29. package/lib/tinylicious-driver-public.d.ts +28 -0
  30. package/lib/tinylicious-driver-untrimmed.d.ts +71 -0
  31. package/package.json +30 -23
  32. package/src/insecureTinyliciousTokenProvider.ts +1 -2
  33. package/src/insecureTinyliciousUrlResolver.ts +4 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/tinylicious-driver
2
2
 
3
+ ## 2.0.0-internal.7.4.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-internal.7.3.0
4
8
 
5
9
  Dependency updates only.
@@ -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
+ }
@@ -1,4 +1,12 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "@fluidframework/build-common/api-extractor-base.json"
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
- // @public
14
+ // @internal
15
15
  export const createTinyliciousCreateNewRequest: (documentId?: string) => IRequest;
16
16
 
17
- // @public
17
+ // @internal
18
18
  export const defaultTinyliciousEndpoint = "http://localhost";
19
19
 
20
- // @public
20
+ // @internal
21
21
  export const defaultTinyliciousPort = 7070;
22
22
 
23
- // @public
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
- // @public
33
+ // @internal
34
34
  export class InsecureTinyliciousUrlResolver implements IUrlResolver {
35
35
  constructor(port?: number, endpoint?: string);
36
36
  // (undocumented)
@@ -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(
@@ -1 +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;;;;;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
+ {"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,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 * @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;;;;;GAKG;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"}
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 ?? "",
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolver.cjs","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAA8F;AAE9F;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;;G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,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"]}
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,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;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;;;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;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;;;;;GAOG;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;;;;GAIG;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,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/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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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"}
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"}
@@ -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;;;;;GAKG;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"}
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(
@@ -1 +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,EAAE,MAAM,MAAM;AAEjC;;;;;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,GAA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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
+ {"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,EAAE,MAAM,MAAM;AAEjC;;;;GAIG;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 * @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;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAgB,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AC,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 ?? "",
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolver.mjs","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,YAAY,EAA8B,MAAM,oCAAoC;AAE7F;;;;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;IAG1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I,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;AAED;;;;GAIG;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 *\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"]}
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,EAA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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;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.0",
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,43 +10,33 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
- "exports": {
14
- ".": {
15
- "import": {
16
- "types": "./lib/index.d.ts",
17
- "default": "./lib/index.mjs"
18
- },
19
- "require": {
20
- "types": "./dist/index.d.ts",
21
- "default": "./dist/index.cjs"
22
- }
23
- }
24
- },
25
13
  "main": "dist/index.cjs",
26
14
  "module": "lib/index.mjs",
27
15
  "types": "dist/index.d.ts",
28
16
  "dependencies": {
29
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
30
- "@fluidframework/driver-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
31
- "@fluidframework/driver-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
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",
32
20
  "@fluidframework/protocol-definitions": "^3.0.0",
33
- "@fluidframework/routerlicious-driver": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
21
+ "@fluidframework/routerlicious-driver": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
34
22
  "jsrsasign": "^10.5.25",
35
23
  "uuid": "^9.0.0"
36
24
  },
37
25
  "devDependencies": {
26
+ "@arethetypeswrong/cli": "^0.13.3",
38
27
  "@fluid-tools/build-cli": "^0.28.0",
39
28
  "@fluidframework/build-common": "^2.0.3",
40
29
  "@fluidframework/build-tools": "^0.28.0",
41
30
  "@fluidframework/eslint-config-fluid": "^3.1.0",
42
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
31
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
43
32
  "@fluidframework/test-tools": "^1.0.195075",
44
33
  "@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.0.0-internal.7.2.0",
45
34
  "@microsoft/api-extractor": "^7.38.3",
46
35
  "@types/jsrsasign": "^8.0.8",
47
36
  "@types/mocha": "^9.1.1",
48
- "@types/node": "^16.18.38",
37
+ "@types/node": "^18.19.0",
49
38
  "@types/uuid": "^9.0.2",
39
+ "copyfiles": "^2.4.1",
50
40
  "cross-env": "^7.0.3",
51
41
  "eslint": "~8.50.0",
52
42
  "mocha": "^10.2.0",
@@ -55,25 +45,42 @@
55
45
  "tsc-multi": "^1.1.0",
56
46
  "typescript": "~5.1.6"
57
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
+ },
58
60
  "typeValidation": {
59
61
  "broken": {}
60
62
  },
61
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",
62
67
  "build": "fluid-build . --task build",
63
68
  "build:commonjs": "fluid-build . --task commonjs",
64
69
  "build:compile": "fluid-build . --task compile",
65
- "build:docs": "api-extractor run --local",
70
+ "build:docs": "fluid-build . --task api",
66
71
  "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
67
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",
68
75
  "ci:build:docs": "api-extractor run",
69
76
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
70
77
  "eslint": "eslint --format stylish src",
71
78
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
72
79
  "format": "npm run prettier:fix",
73
- "lint": "npm run prettier && npm run eslint",
80
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
74
81
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
75
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
76
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
82
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
83
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
77
84
  "test": "npm run test:mocha",
78
85
  "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
79
86
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
@@ -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 ?? "",