@fluidframework/tinylicious-driver 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.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 (34) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/tinylicious-driver.api.md +2 -2
  3. package/dist/insecureTinyliciousTokenProvider.d.ts.map +1 -1
  4. package/dist/insecureTinyliciousTokenProvider.js.map +1 -1
  5. package/dist/insecureTinyliciousUrlResolver.d.ts +1 -1
  6. package/dist/insecureTinyliciousUrlResolver.d.ts.map +1 -1
  7. package/dist/insecureTinyliciousUrlResolver.js +3 -3
  8. package/dist/insecureTinyliciousUrlResolver.js.map +1 -1
  9. package/dist/public.d.ts +12 -0
  10. package/internal.d.ts +11 -0
  11. package/lib/insecureTinyliciousTokenProvider.d.ts.map +1 -1
  12. package/lib/insecureTinyliciousTokenProvider.js.map +1 -1
  13. package/lib/insecureTinyliciousUrlResolver.d.ts +1 -1
  14. package/lib/insecureTinyliciousUrlResolver.d.ts.map +1 -1
  15. package/lib/insecureTinyliciousUrlResolver.js +1 -1
  16. package/lib/insecureTinyliciousUrlResolver.js.map +1 -1
  17. package/lib/public.d.ts +12 -0
  18. package/package.json +25 -46
  19. package/src/insecureTinyliciousTokenProvider.ts +1 -1
  20. package/src/insecureTinyliciousUrlResolver.ts +5 -1
  21. package/api-extractor-cjs.json +0 -8
  22. package/dist/tinylicious-driver-alpha.d.ts +0 -18
  23. package/dist/tinylicious-driver-beta.d.ts +0 -22
  24. package/dist/tinylicious-driver-public.d.ts +0 -22
  25. package/dist/tinylicious-driver-untrimmed.d.ts +0 -70
  26. package/lib/test/insecureTinyliciousUrlResolverTest.spec.js +0 -117
  27. package/lib/test/insecureTinyliciousUrlResolverTest.spec.js.map +0 -1
  28. package/lib/test/types/validateTinyliciousDriverPrevious.generated.js +0 -12
  29. package/lib/test/types/validateTinyliciousDriverPrevious.generated.js.map +0 -1
  30. package/lib/tinylicious-driver-alpha.d.ts +0 -18
  31. package/lib/tinylicious-driver-beta.d.ts +0 -22
  32. package/lib/tinylicious-driver-public.d.ts +0 -22
  33. package/lib/tinylicious-driver-untrimmed.d.ts +0 -70
  34. /package/{dist → lib}/tsdoc-metadata.json +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @fluidframework/tinylicious-driver
2
2
 
3
+ ## 2.0.0-rc.3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
8
+
9
+ Fluid Framework packages have been updated to use the [package.json "exports"
10
+ field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
11
+ TypeScript types and implementation code.
12
+
13
+ This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
14
+
15
+ - `"moduleResolution": "Node16"` with `"module": "Node16"`
16
+ - `"moduleResolution": "Bundler"` with `"module": "ESNext"`
17
+
18
+ We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
19
+ for use with modern versions of Node.js _and_ Bundlers.
20
+ [See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
21
+ regarding the module and moduleResolution options.
22
+
23
+ **Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
24
+ to distinguish stable APIs from those that are in development.**
25
+
3
26
  ## 2.0.0-rc.2.0.0
4
27
 
5
28
  ### Minor Changes
@@ -5,10 +5,10 @@
5
5
  ```ts
6
6
 
7
7
  import { IRequest } from '@fluidframework/core-interfaces';
8
- import { IResolvedUrl } from '@fluidframework/driver-definitions';
8
+ import { IResolvedUrl } from '@fluidframework/driver-definitions/internal';
9
9
  import { ITokenProvider } from '@fluidframework/routerlicious-driver';
10
10
  import { ITokenResponse } from '@fluidframework/routerlicious-driver';
11
- import { IUrlResolver } from '@fluidframework/driver-definitions';
11
+ import { IUrlResolver } from '@fluidframework/driver-definitions/internal';
12
12
  import { ScopeType } from '@fluidframework/protocol-definitions';
13
13
 
14
14
  // @internal
@@ -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;;;;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"}
1
+ {"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,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,QAA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AE,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"]}
1
+ {"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAA+E;AAE/E,yCAA8C;AAC9C,+BAAkC;AAElC;;;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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 { ITokenClaims, ScopeType } 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"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IRequest } from "@fluidframework/core-interfaces";
6
- import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
6
+ import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
7
7
  /**
8
8
  * Default endpoint port. Will be used by the service if the consumer does not specify a port.
9
9
  * @internal
@@ -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,E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AKtE,CAAC"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createTinyliciousCreateNewRequest = exports.InsecureTinyliciousUrlResolver = exports.defaultTinyliciousEndpoint = exports.defaultTinyliciousPort = void 0;
8
- const driver_definitions_1 = require("@fluidframework/driver-definitions");
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.
11
11
  * @internal
@@ -34,7 +34,7 @@ class InsecureTinyliciousUrlResolver {
34
34
  let documentUrl;
35
35
  let finalDocumentId = documentIdFromRequest;
36
36
  // Special handling if the request is to create a new container
37
- if (request.headers && request.headers[driver_definitions_1.DriverHeader.createNew] === true) {
37
+ if (request.headers && request.headers[internal_1.DriverHeader.createNew] === true) {
38
38
  // Use the document ID passed by the application via the create request;
39
39
  // if none was passed, use the reserved keyword to let the driver generate the ID.
40
40
  // TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID
@@ -82,7 +82,7 @@ exports.InsecureTinyliciousUrlResolver = InsecureTinyliciousUrlResolver;
82
82
  const createTinyliciousCreateNewRequest = (documentId) => ({
83
83
  url: documentId ?? "",
84
84
  headers: {
85
- [driver_definitions_1.DriverHeader.createNew]: true,
85
+ [internal_1.DriverHeader.createNew]: true,
86
86
  },
87
87
  });
88
88
  exports.createTinyliciousCreateNewRequest = createTinyliciousCreateNewRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolver.js","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;IAE1C,YAAmB,IAAI,GAAG,8BAAsB,EAAE,QAAQ,GAA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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,mBAAmB,eAAe,EAAE,EAAE,CAAC,CACvE,CAAC;QACF;;;;;WAKG;QACH,OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AAzDD,wEAyDC;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 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(resolvedUrl: IResolvedUrl, relativeUrl: string): 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,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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OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AAzDD,wEAyDC;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","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(resolvedUrl: IResolvedUrl, relativeUrl: string): 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"]}
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {}
12
+
package/internal.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export * from "./lib/index.js";
@@ -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;;;;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"}
1
+ {"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAgB,MAAM,sCAAsC,CAAC;AAE/E,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;;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,IAA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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"]}
1
+ {"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;;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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ributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenClaims, ScopeType } 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"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IRequest } from "@fluidframework/core-interfaces";
6
- import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
6
+ import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
7
7
  /**
8
8
  * Default endpoint port. Will be used by the service if the consumer does not specify a port.
9
9
  * @internal
@@ -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;;;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,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"}
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,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"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { DriverHeader } from "@fluidframework/driver-definitions";
5
+ import { DriverHeader, } from "@fluidframework/driver-definitions/internal";
6
6
  /**
7
7
  * Default endpoint port. Will be used by the service if the consumer does not specify a port.
8
8
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAA8B,MAAM,oCAAoC,CAAC;A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,mBAAmB,gBAAgB,YAAY,GAAG,oBAAoB,EAAE,CAAC;YAC/F,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,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 { 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 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(resolvedUrl: IResolvedUrl, relativeUrl: string): 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;;;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,CAA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O;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,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(resolvedUrl: IResolvedUrl, relativeUrl: string): 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"]}
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluidframework/build-tools.
9
+ */
10
+
11
+ export {}
12
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tinylicious-driver",
3
- "version": "2.0.0-rc.2.0.1",
3
+ "version": "2.0.0-rc.3.0.0",
4
4
  "description": "Driver for tinylicious",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,21 +14,11 @@
14
14
  "exports": {
15
15
  ".": {
16
16
  "import": {
17
- "types": "./lib/index.d.ts",
18
- "default": "./lib/index.js"
19
- },
20
- "require": {
21
- "types": "./dist/index.d.ts",
22
- "default": "./dist/index.js"
23
- }
24
- },
25
- "./public": {
26
- "import": {
27
- "types": "./lib/tinylicious-driver-public.d.ts",
17
+ "types": "./lib/public.d.ts",
28
18
  "default": "./lib/index.js"
29
19
  },
30
20
  "require": {
31
- "types": "./dist/tinylicious-driver-public.d.ts",
21
+ "types": "./dist/public.d.ts",
32
22
  "default": "./dist/index.js"
33
23
  }
34
24
  },
@@ -43,24 +33,25 @@
43
33
  }
44
34
  }
45
35
  },
46
- "main": "dist/index.js",
47
- "types": "dist/index.d.ts",
36
+ "main": "lib/index.js",
37
+ "types": "lib/public.d.ts",
48
38
  "dependencies": {
49
- "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
50
- "@fluidframework/driver-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
51
- "@fluidframework/driver-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
39
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
40
+ "@fluidframework/driver-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
41
+ "@fluidframework/driver-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
52
42
  "@fluidframework/protocol-definitions": "^3.2.0",
53
- "@fluidframework/routerlicious-driver": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
43
+ "@fluidframework/routerlicious-driver": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
54
44
  "jsrsasign": "^11.0.0",
55
45
  "uuid": "^9.0.0"
56
46
  },
57
47
  "devDependencies": {
58
- "@arethetypeswrong/cli": "^0.13.3",
59
- "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
60
- "@fluid-tools/build-cli": "^0.34.0",
48
+ "@arethetypeswrong/cli": "^0.15.2",
49
+ "@biomejs/biome": "^1.6.2",
50
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
51
+ "@fluid-tools/build-cli": "^0.37.0",
61
52
  "@fluidframework/build-common": "^2.0.3",
62
- "@fluidframework/build-tools": "^0.34.0",
63
- "@fluidframework/eslint-config-fluid": "^4.0.0",
53
+ "@fluidframework/build-tools": "^0.37.0",
54
+ "@fluidframework/eslint-config-fluid": "^5.1.0",
64
55
  "@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.0.0-internal.8.0.0",
65
56
  "@microsoft/api-extractor": "^7.42.3",
66
57
  "@types/jsrsasign": "^10.5.12",
@@ -75,44 +66,32 @@
75
66
  "rimraf": "^4.4.0",
76
67
  "typescript": "~5.1.6"
77
68
  },
78
- "fluidBuild": {
79
- "tasks": {
80
- "build:docs": {
81
- "dependsOn": [
82
- "...",
83
- "api-extractor:commonjs",
84
- "api-extractor:esnext"
85
- ],
86
- "script": false
87
- }
88
- }
89
- },
90
69
  "typeValidation": {
91
70
  "broken": {}
92
71
  },
93
72
  "scripts": {
94
73
  "api": "fluid-build . --task api",
95
- "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
96
- "api-extractor:esnext": "api-extractor run --local",
74
+ "api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
75
+ "api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
97
76
  "build": "fluid-build . --task build",
98
77
  "build:commonjs": "fluid-build . --task commonjs",
99
78
  "build:compile": "fluid-build . --task compile",
100
- "build:docs": "fluid-build . --task api",
79
+ "build:docs": "api-extractor run --local",
101
80
  "build:esnext": "tsc --project ./tsconfig.json",
102
81
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
103
82
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
104
83
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
105
- "check:are-the-types-wrong": "attw --pack . --entrypoints .",
84
+ "check:are-the-types-wrong": "attw --pack .",
85
+ "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
106
86
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
107
87
  "ci:build:docs": "api-extractor run",
108
- "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
88
+ "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
109
89
  "eslint": "eslint --format stylish src",
110
90
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
111
- "format": "npm run prettier:fix",
112
- "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
113
- "lint:fix": "npm run prettier:fix && npm run eslint:fix",
114
- "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
115
- "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
91
+ "format": "fluid-build --task format .",
92
+ "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
93
+ "lint": "fluid-build . --task lint",
94
+ "lint:fix": "fluid-build . --task eslint:fix --task format",
116
95
  "test": "npm run test:mocha",
117
96
  "test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
118
97
  "test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ScopeType, ITokenClaims } from "@fluidframework/protocol-definitions";
6
+ import { ITokenClaims, ScopeType } from "@fluidframework/protocol-definitions";
7
7
  import { ITokenProvider, ITokenResponse } from "@fluidframework/routerlicious-driver";
8
8
  import { KJUR as jsrsasign } from "jsrsasign";
9
9
  import { v4 as uuid } from "uuid";
@@ -4,7 +4,11 @@
4
4
  */
5
5
 
6
6
  import { IRequest } from "@fluidframework/core-interfaces";
7
- import { DriverHeader, IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
7
+ import {
8
+ DriverHeader,
9
+ IResolvedUrl,
10
+ IUrlResolver,
11
+ } from "@fluidframework/driver-definitions/internal";
8
12
 
9
13
  /**
10
14
  * Default endpoint port. Will be used by the service if the consumer does not specify a port.
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
4
- // CJS is actually secondary; so, no report.
5
- "apiReport": {
6
- "enabled": false
7
- }
8
- }
@@ -1,18 +0,0 @@
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 { }
@@ -1,22 +0,0 @@
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: IResolvedUrl */
19
-
20
- /* Excluded from this release type: IUrlResolver */
21
-
22
- export { }
@@ -1,22 +0,0 @@
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: IResolvedUrl */
19
-
20
- /* Excluded from this release type: IUrlResolver */
21
-
22
- export { }
@@ -1,70 +0,0 @@
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 tinyliciousEndpoint;
65
- constructor(port?: number, endpoint?: string);
66
- resolve(request: IRequest): Promise<IResolvedUrl>;
67
- getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
68
- }
69
-
70
- export { }
@@ -1,117 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { strict as assert } from "node:assert";
6
- import { DriverHeader } from "@fluidframework/driver-definitions";
7
- import { InsecureTinyliciousUrlResolver } from "../insecureTinyliciousUrlResolver.js";
8
- describe("Insecure Url Resolver Test", () => {
9
- const documentId = "fileName";
10
- const hostUrl = "http://localhost:7070";
11
- const tinyliciousEndpoint = "http://localhost:7070";
12
- let resolver;
13
- beforeEach(() => {
14
- resolver = new InsecureTinyliciousUrlResolver();
15
- });
16
- it("Should resolve url with only document id", async () => {
17
- const testRequest = {
18
- url: `${documentId}`,
19
- headers: {},
20
- };
21
- const resolvedUrl = await resolver.resolve(testRequest);
22
- const expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}`;
23
- assert.strictEqual(resolvedUrl.url, expectedResolvedUrl, "resolved url is wrong");
24
- });
25
- it("Should resolve url with custom domain and port", async () => {
26
- const customEndpoint = "http://custom-endpoint.io";
27
- const customFluidEndpoint = "http://custom-endpoint.io";
28
- const customPort = 1234;
29
- const customResolver = new InsecureTinyliciousUrlResolver(customPort, customEndpoint);
30
- const testRequest = {
31
- url: `${documentId}`,
32
- headers: {},
33
- };
34
- const resolvedUrl = await customResolver.resolve(testRequest);
35
- const expectedResolvedUrl = `${customFluidEndpoint}:${customPort}/tinylicious/${documentId}`;
36
- assert.strictEqual(resolvedUrl.url, expectedResolvedUrl, "resolved url is wrong");
37
- });
38
- it("Should resolve url with data object ids", async () => {
39
- const path = "dataObject1/dataObject2";
40
- const testRequest = {
41
- url: `${documentId}/${path}`,
42
- };
43
- const resolvedUrl = await resolver.resolve(testRequest);
44
- const expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}/${path}`;
45
- assert.strictEqual(resolvedUrl.url, expectedResolvedUrl, "resolved url is wrong");
46
- });
47
- it("Should resolve url with a slash at the end", async () => {
48
- const testRequest = {
49
- url: `${documentId}/`,
50
- };
51
- const resolvedUrl = await resolver.resolve(testRequest);
52
- const expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}/`;
53
- assert.strictEqual(resolvedUrl.url, expectedResolvedUrl, "resolved url is wrong");
54
- });
55
- it("Should resolve url with 2 slashes at the end", async () => {
56
- const testRequest = {
57
- url: `${documentId}//`,
58
- };
59
- const resolvedUrl = await resolver.resolve(testRequest);
60
- const expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}//`;
61
- assert.strictEqual(resolvedUrl.url, expectedResolvedUrl, "resolved url is wrong");
62
- });
63
- it("Should resolve url with special characters", async () => {
64
- const path = "dataObject!@$";
65
- const testDocumentId = "fileName!@$";
66
- const testRequest = {
67
- url: `${testDocumentId}/${path}`,
68
- };
69
- const resolvedUrl = await resolver.resolve(testRequest);
70
- const expectedResolvedUrl = `${hostUrl}/tinylicious/${encodeURIComponent(testDocumentId)}/${path}`;
71
- assert.strictEqual(resolvedUrl.url, expectedResolvedUrl, "resolved url is wrong");
72
- });
73
- it("Should correctly resolve url for a create-new request with a non-empty URL", async () => {
74
- const testDocumentId = "fileName!@$";
75
- const testRequest = {
76
- url: `${testDocumentId}`,
77
- headers: {
78
- [DriverHeader.createNew]: true,
79
- },
80
- };
81
- const resolvedUrl = await resolver.resolve(testRequest);
82
- const expectedResolvedUrl = {
83
- endpoints: {
84
- deltaStorageUrl: `${tinyliciousEndpoint}/deltas/tinylicious/${testDocumentId}`,
85
- ordererUrl: tinyliciousEndpoint,
86
- storageUrl: `${tinyliciousEndpoint}/repos/tinylicious`,
87
- },
88
- id: testDocumentId,
89
- tokens: {},
90
- type: "fluid",
91
- url: `${hostUrl}/tinylicious/${testDocumentId}`,
92
- };
93
- assert.deepStrictEqual(resolvedUrl, expectedResolvedUrl);
94
- });
95
- it("Should correctly resolve url for a create-new request with an empty URL", async () => {
96
- const testRequest = {
97
- url: "",
98
- headers: {
99
- [DriverHeader.createNew]: true,
100
- },
101
- };
102
- const resolvedUrl = await resolver.resolve(testRequest);
103
- const expectedResolvedUrl = {
104
- endpoints: {
105
- deltaStorageUrl: `${tinyliciousEndpoint}/deltas/tinylicious/new`,
106
- ordererUrl: tinyliciousEndpoint,
107
- storageUrl: `${tinyliciousEndpoint}/repos/tinylicious`,
108
- },
109
- id: "new",
110
- tokens: {},
111
- type: "fluid",
112
- url: `${hostUrl}/tinylicious/new`,
113
- };
114
- assert.deepStrictEqual(resolvedUrl, expectedResolvedUrl);
115
- });
116
- });
117
- //# sourceMappingURL=insecureTinyliciousUrlResolverTest.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insecureTinyliciousUrlResolverTest.spec.js","sourceRoot":"","sources":["../../src/test/insecureTinyliciousUrlResolverTest.spec.ts"],"names":[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E;YACV,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,GAAG,OAAO,gBAAgB,cAAc,EAAE;SAC/C,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,WAAW,GAAa;YAC7B,GAAG,EAAE,EAAE;YACP,OAAO,EAAE;gBACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAExD,MAAM,mBAAmB,GAAG;YAC3B,SAAS,EAAE;gBACV,eAAe,EAAE,GAAG,mBAAmB,yBAAyB;gBAChE,UAAU,EAAE,mBAAmB;gBAC/B,UAAU,EAAE,GAAG,mBAAmB,oBAAoB;aACtD;YACD,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,GAAG,OAAO,kBAAkB;SACjC,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions\";\nimport { InsecureTinyliciousUrlResolver } from \"../insecureTinyliciousUrlResolver.js\";\n\ndescribe(\"Insecure Url Resolver Test\", () => {\n\tconst documentId = \"fileName\";\n\tconst hostUrl = \"http://localhost:7070\";\n\tconst tinyliciousEndpoint = \"http://localhost:7070\";\n\tlet resolver: InsecureTinyliciousUrlResolver;\n\n\tbeforeEach(() => {\n\t\tresolver = new InsecureTinyliciousUrlResolver();\n\t});\n\n\tit(\"Should resolve url with only document id\", async () => {\n\t\tconst testRequest: IRequest = {\n\t\t\turl: `${documentId}`,\n\t\t\theaders: {},\n\t\t};\n\n\t\tconst resolvedUrl = await resolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}`;\n\t\tassert.strictEqual(resolvedUrl.url, expectedResolvedUrl, \"resolved url is wrong\");\n\t});\n\n\tit(\"Should resolve url with custom domain and port\", async () => {\n\t\tconst customEndpoint = \"http://custom-endpoint.io\";\n\t\tconst customFluidEndpoint = \"http://custom-endpoint.io\";\n\t\tconst customPort = 1234;\n\t\tconst customResolver = new InsecureTinyliciousUrlResolver(customPort, customEndpoint);\n\t\tconst testRequest: IRequest = {\n\t\t\turl: `${documentId}`,\n\t\t\theaders: {},\n\t\t};\n\n\t\tconst resolvedUrl = await customResolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = `${customFluidEndpoint}:${customPort}/tinylicious/${documentId}`;\n\t\tassert.strictEqual(resolvedUrl.url, expectedResolvedUrl, \"resolved url is wrong\");\n\t});\n\n\tit(\"Should resolve url with data object ids\", async () => {\n\t\tconst path = \"dataObject1/dataObject2\";\n\t\tconst testRequest: IRequest = {\n\t\t\turl: `${documentId}/${path}`,\n\t\t};\n\n\t\tconst resolvedUrl = await resolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}/${path}`;\n\t\tassert.strictEqual(resolvedUrl.url, expectedResolvedUrl, \"resolved url is wrong\");\n\t});\n\n\tit(\"Should resolve url with a slash at the end\", async () => {\n\t\tconst testRequest: IRequest = {\n\t\t\turl: `${documentId}/`,\n\t\t};\n\n\t\tconst resolvedUrl = await resolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}/`;\n\t\tassert.strictEqual(resolvedUrl.url, expectedResolvedUrl, \"resolved url is wrong\");\n\t});\n\n\tit(\"Should resolve url with 2 slashes at the end\", async () => {\n\t\tconst testRequest: IRequest = {\n\t\t\turl: `${documentId}//`,\n\t\t};\n\n\t\tconst resolvedUrl = await resolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = `${hostUrl}/tinylicious/${documentId}//`;\n\t\tassert.strictEqual(resolvedUrl.url, expectedResolvedUrl, \"resolved url is wrong\");\n\t});\n\n\tit(\"Should resolve url with special characters\", async () => {\n\t\tconst path = \"dataObject!@$\";\n\t\tconst testDocumentId = \"fileName!@$\";\n\t\tconst testRequest: IRequest = {\n\t\t\turl: `${testDocumentId}/${path}`,\n\t\t};\n\n\t\tconst resolvedUrl = await resolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = `${hostUrl}/tinylicious/${encodeURIComponent(\n\t\t\ttestDocumentId,\n\t\t)}/${path}`;\n\t\tassert.strictEqual(resolvedUrl.url, expectedResolvedUrl, \"resolved url is wrong\");\n\t});\n\n\tit(\"Should correctly resolve url for a create-new request with a non-empty URL\", async () => {\n\t\tconst testDocumentId = \"fileName!@$\";\n\t\tconst testRequest: IRequest = {\n\t\t\turl: `${testDocumentId}`,\n\t\t\theaders: {\n\t\t\t\t[DriverHeader.createNew]: true,\n\t\t\t},\n\t\t};\n\n\t\tconst resolvedUrl = await resolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `${tinyliciousEndpoint}/deltas/tinylicious/${testDocumentId}`,\n\t\t\t\tordererUrl: tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: testDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: `${hostUrl}/tinylicious/${testDocumentId}`,\n\t\t};\n\t\tassert.deepStrictEqual(resolvedUrl, expectedResolvedUrl);\n\t});\n\n\tit(\"Should correctly resolve url for a create-new request with an empty URL\", async () => {\n\t\tconst testRequest: IRequest = {\n\t\t\turl: \"\",\n\t\t\theaders: {\n\t\t\t\t[DriverHeader.createNew]: true,\n\t\t\t},\n\t\t};\n\n\t\tconst resolvedUrl = await resolver.resolve(testRequest);\n\n\t\tconst expectedResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `${tinyliciousEndpoint}/deltas/tinylicious/new`,\n\t\t\t\tordererUrl: tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: \"new\",\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: `${hostUrl}/tinylicious/new`,\n\t\t};\n\t\tassert.deepStrictEqual(resolvedUrl, expectedResolvedUrl);\n\t});\n});\n"]}
@@ -1,12 +0,0 @@
1
- use_current_ClassDeclaration_InsecureTinyliciousTokenProvider(get_old_ClassDeclaration_InsecureTinyliciousTokenProvider());
2
- use_old_ClassDeclaration_InsecureTinyliciousTokenProvider(get_current_ClassDeclaration_InsecureTinyliciousTokenProvider());
3
- use_current_ClassDeclaration_InsecureTinyliciousUrlResolver(get_old_ClassDeclaration_InsecureTinyliciousUrlResolver());
4
- use_old_ClassDeclaration_InsecureTinyliciousUrlResolver(get_current_ClassDeclaration_InsecureTinyliciousUrlResolver());
5
- use_current_VariableDeclaration_createTinyliciousCreateNewRequest(get_old_VariableDeclaration_createTinyliciousCreateNewRequest());
6
- use_old_VariableDeclaration_createTinyliciousCreateNewRequest(get_current_VariableDeclaration_createTinyliciousCreateNewRequest());
7
- use_current_VariableDeclaration_defaultTinyliciousEndpoint(get_old_VariableDeclaration_defaultTinyliciousEndpoint());
8
- use_old_VariableDeclaration_defaultTinyliciousEndpoint(get_current_VariableDeclaration_defaultTinyliciousEndpoint());
9
- use_current_VariableDeclaration_defaultTinyliciousPort(get_old_VariableDeclaration_defaultTinyliciousPort());
10
- use_old_VariableDeclaration_defaultTinyliciousPort(get_current_VariableDeclaration_defaultTinyliciousPort());
11
- export {};
12
- //# sourceMappingURL=validateTinyliciousDriverPrevious.generated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateTinyliciousDriverPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateTinyliciousDriverPrevious.generated.ts"],"names":[],"mappings":"AAgCA,6DAA6D,CACzD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,yDAAyD,CACrD,6DAA6D,EAAE,CAAC,CAAC;AAWrE,2DAA2D,CACvD,uDAAuD,EAAE,CAAC,CAAC;AAW/D,uDAAuD,CACnD,2DAA2D,EAAE,CAAC,CAAC;AAWnE,iEAAiE,CAC7D,6DAA6D,EAAE,CAAC,CAAC;AAWrE,6DAA6D,CACzD,iEAAiE,EAAE,CAAC,CAAC;AAWzE,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC;AAWlE,sDAAsD,CAClD,kDAAkD,EAAE,CAAC,CAAC;AAW1D,kDAAkD,CAC9C,sDAAsD,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/tinylicious-driver-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_InsecureTinyliciousTokenProvider\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_InsecureTinyliciousTokenProvider():\n TypeOnly<old.InsecureTinyliciousTokenProvider>;\ndeclare function use_current_ClassDeclaration_InsecureTinyliciousTokenProvider(\n use: TypeOnly<current.InsecureTinyliciousTokenProvider>): void;\nuse_current_ClassDeclaration_InsecureTinyliciousTokenProvider(\n get_old_ClassDeclaration_InsecureTinyliciousTokenProvider());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_InsecureTinyliciousTokenProvider\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_InsecureTinyliciousTokenProvider():\n TypeOnly<current.InsecureTinyliciousTokenProvider>;\ndeclare function use_old_ClassDeclaration_InsecureTinyliciousTokenProvider(\n use: TypeOnly<old.InsecureTinyliciousTokenProvider>): void;\nuse_old_ClassDeclaration_InsecureTinyliciousTokenProvider(\n get_current_ClassDeclaration_InsecureTinyliciousTokenProvider());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_InsecureTinyliciousUrlResolver\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_InsecureTinyliciousUrlResolver():\n TypeOnly<old.InsecureTinyliciousUrlResolver>;\ndeclare function use_current_ClassDeclaration_InsecureTinyliciousUrlResolver(\n use: TypeOnly<current.InsecureTinyliciousUrlResolver>): void;\nuse_current_ClassDeclaration_InsecureTinyliciousUrlResolver(\n get_old_ClassDeclaration_InsecureTinyliciousUrlResolver());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_InsecureTinyliciousUrlResolver\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_InsecureTinyliciousUrlResolver():\n TypeOnly<current.InsecureTinyliciousUrlResolver>;\ndeclare function use_old_ClassDeclaration_InsecureTinyliciousUrlResolver(\n use: TypeOnly<old.InsecureTinyliciousUrlResolver>): void;\nuse_old_ClassDeclaration_InsecureTinyliciousUrlResolver(\n get_current_ClassDeclaration_InsecureTinyliciousUrlResolver());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_createTinyliciousCreateNewRequest\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_createTinyliciousCreateNewRequest():\n TypeOnly<typeof old.createTinyliciousCreateNewRequest>;\ndeclare function use_current_VariableDeclaration_createTinyliciousCreateNewRequest(\n use: TypeOnly<typeof current.createTinyliciousCreateNewRequest>): void;\nuse_current_VariableDeclaration_createTinyliciousCreateNewRequest(\n get_old_VariableDeclaration_createTinyliciousCreateNewRequest());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_createTinyliciousCreateNewRequest\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_createTinyliciousCreateNewRequest():\n TypeOnly<typeof current.createTinyliciousCreateNewRequest>;\ndeclare function use_old_VariableDeclaration_createTinyliciousCreateNewRequest(\n use: TypeOnly<typeof old.createTinyliciousCreateNewRequest>): void;\nuse_old_VariableDeclaration_createTinyliciousCreateNewRequest(\n get_current_VariableDeclaration_createTinyliciousCreateNewRequest());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_defaultTinyliciousEndpoint\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_defaultTinyliciousEndpoint():\n TypeOnly<typeof old.defaultTinyliciousEndpoint>;\ndeclare function use_current_VariableDeclaration_defaultTinyliciousEndpoint(\n use: TypeOnly<typeof current.defaultTinyliciousEndpoint>): void;\nuse_current_VariableDeclaration_defaultTinyliciousEndpoint(\n get_old_VariableDeclaration_defaultTinyliciousEndpoint());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_defaultTinyliciousEndpoint\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_defaultTinyliciousEndpoint():\n TypeOnly<typeof current.defaultTinyliciousEndpoint>;\ndeclare function use_old_VariableDeclaration_defaultTinyliciousEndpoint(\n use: TypeOnly<typeof old.defaultTinyliciousEndpoint>): void;\nuse_old_VariableDeclaration_defaultTinyliciousEndpoint(\n get_current_VariableDeclaration_defaultTinyliciousEndpoint());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_defaultTinyliciousPort\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_defaultTinyliciousPort():\n TypeOnly<typeof old.defaultTinyliciousPort>;\ndeclare function use_current_VariableDeclaration_defaultTinyliciousPort(\n use: TypeOnly<typeof current.defaultTinyliciousPort>): void;\nuse_current_VariableDeclaration_defaultTinyliciousPort(\n get_old_VariableDeclaration_defaultTinyliciousPort());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_defaultTinyliciousPort\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_defaultTinyliciousPort():\n TypeOnly<typeof current.defaultTinyliciousPort>;\ndeclare function use_old_VariableDeclaration_defaultTinyliciousPort(\n use: TypeOnly<typeof old.defaultTinyliciousPort>): void;\nuse_old_VariableDeclaration_defaultTinyliciousPort(\n get_current_VariableDeclaration_defaultTinyliciousPort());\n"]}
@@ -1,18 +0,0 @@
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 { }
@@ -1,22 +0,0 @@
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: IResolvedUrl */
19
-
20
- /* Excluded from this release type: IUrlResolver */
21
-
22
- export { }
@@ -1,22 +0,0 @@
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: IResolvedUrl */
19
-
20
- /* Excluded from this release type: IUrlResolver */
21
-
22
- export { }
@@ -1,70 +0,0 @@
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 tinyliciousEndpoint;
65
- constructor(port?: number, endpoint?: string);
66
- resolve(request: IRequest): Promise<IResolvedUrl>;
67
- getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
68
- }
69
-
70
- export { }
File without changes