@fluidframework/tinylicious-driver 2.1.0-276985 → 2.1.0-281041
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -1
- package/dist/insecureTinyliciousUrlResolver.d.ts.map +1 -1
- package/dist/insecureTinyliciousUrlResolver.js +1 -0
- package/dist/insecureTinyliciousUrlResolver.js.map +1 -1
- package/dist/public.d.ts +1 -1
- package/internal.d.ts +1 -1
- package/lib/insecureTinyliciousUrlResolver.d.ts.map +1 -1
- package/lib/insecureTinyliciousUrlResolver.js +1 -0
- package/lib/insecureTinyliciousUrlResolver.js.map +1 -1
- package/lib/public.d.ts +1 -1
- package/package.json +12 -12
- package/src/insecureTinyliciousUrlResolver.ts +2 -1
- package/tsconfig.json +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @fluidframework/tinylicious-driver
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Driver for the `tinylicious` Fluid service.
|
|
4
|
+
|
|
5
|
+
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README_HEADER) -->
|
|
4
6
|
|
|
5
7
|
<!-- prettier-ignore-start -->
|
|
6
8
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
@@ -21,10 +23,63 @@ To get started, install the package by running the following command:
|
|
|
21
23
|
npm i @fluidframework/tinylicious-driver
|
|
22
24
|
```
|
|
23
25
|
|
|
26
|
+
<!-- prettier-ignore-end -->
|
|
27
|
+
|
|
28
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
29
|
+
|
|
30
|
+
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README_FOOTER) -->
|
|
31
|
+
|
|
32
|
+
<!-- prettier-ignore-start -->
|
|
33
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
34
|
+
|
|
24
35
|
## API Documentation
|
|
25
36
|
|
|
26
37
|
API documentation for **@fluidframework/tinylicious-driver** is available at <https://fluidframework.com/docs/apis/tinylicious-driver>.
|
|
27
38
|
|
|
39
|
+
## Minimum Client Requirements
|
|
40
|
+
|
|
41
|
+
These are the platform requirements for the current version of Fluid Framework Client Packages.
|
|
42
|
+
These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
|
|
43
|
+
For Long Term Support (LTS) versions this can require supporting these platforms for several years.
|
|
44
|
+
|
|
45
|
+
It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
|
|
46
|
+
If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
|
|
47
|
+
When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
|
|
48
|
+
|
|
49
|
+
### Supported Runtimes
|
|
50
|
+
|
|
51
|
+
- NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
|
|
52
|
+
- Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
|
|
53
|
+
|
|
54
|
+
### Supported Tools
|
|
55
|
+
|
|
56
|
+
- TypeScript 5.4:
|
|
57
|
+
- All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
|
|
58
|
+
- [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
|
|
59
|
+
- [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
|
|
60
|
+
- `exactOptionalPropertyTypes` is currently not fully supported.
|
|
61
|
+
If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
|
|
62
|
+
- [webpack](https://webpack.js.org/) 5
|
|
63
|
+
- We are not intending to be prescriptive about what bundler to use.
|
|
64
|
+
Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
|
|
65
|
+
|
|
66
|
+
### Module Resolution
|
|
67
|
+
|
|
68
|
+
[`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
|
|
69
|
+
Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
|
|
70
|
+
|
|
71
|
+
### Module Formats
|
|
72
|
+
|
|
73
|
+
- ES Modules:
|
|
74
|
+
ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
|
|
75
|
+
- CommonJs:
|
|
76
|
+
Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
|
|
77
|
+
This is done to accommodate some workflows without good ES Module support.
|
|
78
|
+
If you have a workflow you would like included in this list, file an issue.
|
|
79
|
+
Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
|
|
80
|
+
|
|
81
|
+
- Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
|
|
82
|
+
|
|
28
83
|
## Contribution Guidelines
|
|
29
84
|
|
|
30
85
|
There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEN,YAAY,EACZ,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;;;;GAMG;AACH,qBAAa,8BAA+B,YAAW,YAAY;IAClE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;gBAC1B,IAAI,SAAyB,EAAE,QAAQ,SAA6B;IAI1E,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
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;IAwCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAYlB;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gBAAiB,MAAM,KAAG,QAKtE,CAAC"}
|
|
@@ -29,6 +29,7 @@ class InsecureTinyliciousUrlResolver {
|
|
|
29
29
|
}
|
|
30
30
|
async resolve(request) {
|
|
31
31
|
const relativeUrl = request.url.replace(`${this.tinyliciousEndpoint}/`, "");
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- <string>.split() always returns an array with at least one item
|
|
32
33
|
const documentIdFromRequest = relativeUrl.split("/")[0];
|
|
33
34
|
let deltaStorageUrl;
|
|
34
35
|
let documentUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAIqD;AAErD;;;GAGG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACU,QAAA,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAa,8BAA8B;IAE1C,YAAmB,IAAI,GAAG,8BAAsB,EAAE,QAAQ,GAAG,kCAA0B;QACtF,IAAI,CAAC,mBAAmB,GAAG,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,GAAG,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,qBAAqB,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,
|
|
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,IA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AAC,mBAAmB,oBAAoB;aAC3D;YACD,EAAE,EAAE,eAAe;YACnB,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,WAAW;SAChB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,cAAc,CAC1B,WAAyB,EACzB,WAAmB;QAEnB,MAAM,UAAU,GAAG,kBAAkB,CACpC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,eAAe,EAAE,EAAE,CAAC,CACvE,CAAC;QACF;;;;;WAKG;QACH,OAAO,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;IACvC,CAAC;CACD;AA7DD,wEA6DC;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\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- <string>.split() always returns an array with at least one item\n\t\tconst documentIdFromRequest = relativeUrl.split(\"/\")[0]!;\n\n\t\tlet deltaStorageUrl: string;\n\t\tlet documentUrl: string;\n\t\tlet finalDocumentId: string = documentIdFromRequest;\n\n\t\t// Special handling if the request is to create a new container\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.\n * @internal\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n"]}
|
package/dist/public.d.ts
CHANGED
package/internal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEN,YAAY,EACZ,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;;;;GAMG;AACH,qBAAa,8BAA+B,YAAW,YAAY;IAClE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;gBAC1B,IAAI,SAAyB,EAAE,QAAQ,SAA6B;IAI1E,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
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;IAwCjD,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CAYlB;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gBAAiB,MAAM,KAAG,QAKtE,CAAC"}
|
|
@@ -26,6 +26,7 @@ export class InsecureTinyliciousUrlResolver {
|
|
|
26
26
|
}
|
|
27
27
|
async resolve(request) {
|
|
28
28
|
const relativeUrl = request.url.replace(`${this.tinyliciousEndpoint}/`, "");
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- <string>.split() always returns an array with at least one item
|
|
29
30
|
const documentIdFromRequest = relativeUrl.split("/")[0];
|
|
30
31
|
let deltaStorageUrl;
|
|
31
32
|
let documentUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAGZ,MAAM,6C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AAU,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\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- <string>.split() always returns an array with at least one item\n\t\tconst documentIdFromRequest = relativeUrl.split(\"/\")[0]!;\n\n\t\tlet deltaStorageUrl: string;\n\t\tlet documentUrl: string;\n\t\tlet finalDocumentId: string = documentIdFromRequest;\n\n\t\t// Special handling if the request is to create a new container\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates a Routerlicious {@link @fluidframework/core-interfaces#IRequest}.\n * @internal\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n"]}
|
package/lib/public.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tinylicious-driver",
|
|
3
|
-
"version": "2.1.0-
|
|
3
|
+
"version": "2.1.0-281041",
|
|
4
4
|
"description": "Driver for tinylicious",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"main": "lib/index.js",
|
|
37
37
|
"types": "lib/public.d.ts",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluidframework/core-interfaces": "2.1.0-
|
|
40
|
-
"@fluidframework/driver-definitions": "2.1.0-
|
|
41
|
-
"@fluidframework/driver-utils": "2.1.0-
|
|
42
|
-
"@fluidframework/routerlicious-driver": "2.1.0-
|
|
39
|
+
"@fluidframework/core-interfaces": "2.1.0-281041",
|
|
40
|
+
"@fluidframework/driver-definitions": "2.1.0-281041",
|
|
41
|
+
"@fluidframework/driver-utils": "2.1.0-281041",
|
|
42
|
+
"@fluidframework/routerlicious-driver": "2.1.0-281041",
|
|
43
43
|
"jsrsasign": "^11.0.0",
|
|
44
44
|
"uuid": "^9.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
48
|
-
"@biomejs/biome": "
|
|
49
|
-
"@fluid-internal/mocha-test-setup": "2.1.0-
|
|
50
|
-
"@fluid-tools/build-cli": "^0.
|
|
48
|
+
"@biomejs/biome": "~1.8.3",
|
|
49
|
+
"@fluid-internal/mocha-test-setup": "2.1.0-281041",
|
|
50
|
+
"@fluid-tools/build-cli": "^0.40.0",
|
|
51
51
|
"@fluidframework/build-common": "^2.0.3",
|
|
52
|
-
"@fluidframework/build-tools": "^0.
|
|
52
|
+
"@fluidframework/build-tools": "^0.40.0",
|
|
53
53
|
"@fluidframework/eslint-config-fluid": "^5.3.0",
|
|
54
|
-
"@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.0.0
|
|
54
|
+
"@fluidframework/tinylicious-driver-previous": "npm:@fluidframework/tinylicious-driver@2.0.0",
|
|
55
55
|
"@microsoft/api-extractor": "^7.45.1",
|
|
56
56
|
"@types/jsrsasign": "^10.5.12",
|
|
57
57
|
"@types/mocha": "^9.1.1",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
83
83
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
84
84
|
"check:are-the-types-wrong": "attw --pack .",
|
|
85
|
-
"check:biome": "biome check .
|
|
85
|
+
"check:biome": "biome check .",
|
|
86
86
|
"check:exports": "concurrently \"npm:check:exports:*\"",
|
|
87
87
|
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
|
|
88
88
|
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"eslint": "eslint --format stylish src",
|
|
95
95
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
96
96
|
"format": "npm run format:biome",
|
|
97
|
-
"format:biome": "biome check . --
|
|
97
|
+
"format:biome": "biome check . --write",
|
|
98
98
|
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
99
99
|
"lint": "fluid-build . --task lint",
|
|
100
100
|
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
@@ -37,7 +37,8 @@ export class InsecureTinyliciousUrlResolver implements IUrlResolver {
|
|
|
37
37
|
|
|
38
38
|
public async resolve(request: IRequest): Promise<IResolvedUrl> {
|
|
39
39
|
const relativeUrl = request.url.replace(`${this.tinyliciousEndpoint}/`, "");
|
|
40
|
-
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- <string>.split() always returns an array with at least one item
|
|
41
|
+
const documentIdFromRequest = relativeUrl.split("/")[0]!;
|
|
41
42
|
|
|
42
43
|
let deltaStorageUrl: string;
|
|
43
44
|
let documentUrl: string;
|