@fluidframework/tinylicious-driver 2.117.0 → 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.
- package/CHANGELOG.md +36 -2
- package/README.md +49 -46
- package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
- package/api-extractor/api-extractor-report.json +5 -0
- package/dist/insecureTinyliciousTokenProvider.d.ts.map +1 -1
- package/dist/insecureTinyliciousTokenProvider.js +3 -2
- package/dist/insecureTinyliciousTokenProvider.js.map +1 -1
- package/dist/insecureTinyliciousUrlResolver.d.ts.map +1 -1
- package/dist/insecureTinyliciousUrlResolver.js +3 -2
- package/dist/insecureTinyliciousUrlResolver.js.map +1 -1
- package/lib/insecureTinyliciousTokenProvider.d.ts.map +1 -1
- package/lib/insecureTinyliciousTokenProvider.js +1 -0
- package/lib/insecureTinyliciousTokenProvider.js.map +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 +24 -38
- package/tsconfig.json +1 -1
- package/internal.d.ts +0 -11
- package/test-utils.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
# @fluidframework/tinylicious-driver
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 3.0.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Removal of direct CommonJS support ([#28124](https://github.com/microsoft/FluidFramework/pull/28124)) [0f84e3b8878](https://github.com/microsoft/FluidFramework/commit/0f84e3b8878a5e75b2253976d98fd963bbd9db88)
|
|
8
|
+
|
|
9
|
+
Direct `require()` import is no longer directly supported.
|
|
10
|
+
Package is transpiled as ECMAScript Module.
|
|
11
|
+
|
|
12
|
+
See [Removal of direct CommonJS support in v3.0](https://github.com/microsoft/FluidFramework/issues/27444) for more information.
|
|
13
|
+
|
|
14
|
+
- Require modern TypeScript module resolution ([#27970](https://github.com/microsoft/FluidFramework/pull/27970)) [325e2016ca9](https://github.com/microsoft/FluidFramework/commit/325e2016ca9978d4a1f7552c97ba34feac9df41f)
|
|
15
|
+
|
|
16
|
+
Fluid Framework Client packages no longer include type declaration compatibility entrypoints for TypeScript's legacy Node10 resolution mode (`"moduleResolution": "node"` or `"node10"`).
|
|
17
|
+
Applications upgrading to Fluid Framework 3.0 must use one of the following supported configurations:
|
|
18
|
+
- `"module": "Node16"` with `"moduleResolution": "Node16"`
|
|
19
|
+
- `"module": "NodeNext"` with `"moduleResolution": "NodeNext"`
|
|
20
|
+
- `"module": "ESNext"` with `"moduleResolution": "Bundler"`
|
|
21
|
+
|
|
22
|
+
Existing public package entrypoints exposed through `package.json` exports, including `/alpha`, `/beta`, and `/legacy`, remain available under supported module resolution modes.
|
|
23
|
+
|
|
24
|
+
See [Removal of Node10 resolutions in v3.0](https://github.com/microsoft/FluidFramework/issues/27457) for more information.
|
|
25
|
+
|
|
26
|
+
- Client packages now target ES2022 ([#27846](https://github.com/microsoft/FluidFramework/pull/27846)) [91c78541bdd](https://github.com/microsoft/FluidFramework/commit/91c78541bddcbca5d6c5f357b023eeaee617d885)
|
|
27
|
+
|
|
28
|
+
The TypeScript compilation `target` and `lib` for the Fluid Framework client packages have been raised from ES2021/ES2020 to **ES2022**.
|
|
29
|
+
The published JavaScript now uses ES2022 language features (with correspondingly less down-leveling), so consuming these packages requires a runtime that supports ES2022.
|
|
30
|
+
All actively supported Node.js versions and evergreen browsers already meet this requirement.
|
|
31
|
+
|
|
32
|
+
Note that Fluid Framework has not officially supported targets older than ES2022 since before 2.0: this is documented in [ClientRequirements.md](https://github.com/microsoft/FluidFramework/blob/main/ClientRequirements.md) as well as the README for every client package.
|
|
33
|
+
|
|
34
|
+
It is possible this change could impact users of less up to date JavaScript runtimes.
|
|
35
|
+
Impacted users can use a tool like [babel](https://babeljs.io/) to transpile out unsupported language features.
|
|
36
|
+
|
|
37
|
+
- Build with TypeScript 6 ([#28052](https://github.com/microsoft/FluidFramework/pull/28052)) [7ab015c49de](https://github.com/microsoft/FluidFramework/commit/7ab015c49deec84833cdfe1fb5e1606b901f6e81)
|
|
38
|
+
|
|
39
|
+
FluidFramework Client SDK is now built using TypeScript 6. Consumers should build with TypeScript v6 or v7 or compatible tooling.
|
|
6
40
|
|
|
7
41
|
## 2.116.0
|
|
8
42
|
|
package/README.md
CHANGED
|
@@ -13,15 +13,15 @@ Some additional test utilities are provided via `@fluidframework/tinylicious-dri
|
|
|
13
13
|
|
|
14
14
|
## Using Fluid Framework libraries
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
library consumers should always prefer `^`.
|
|
16
|
+
For a dependency on a Fluid Framework library's public APIs, we recommend a `^` (caret) version range.
|
|
17
|
+
For example, use `^1.3.4`.
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
For a dependency on an unstable API, such as a `beta` API, we recommend a more restrictive version range.
|
|
20
|
+
For example, use a `~` version range.
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Run this command to install the package:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
npm i @fluidframework/tinylicious-driver
|
|
@@ -29,7 +29,7 @@ npm i @fluidframework/tinylicious-driver
|
|
|
29
29
|
|
|
30
30
|
## API Documentation
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Read the **@fluidframework/tinylicious-driver** API documentation at <https://fluidframework.com/docs/apis/tinylicious-driver>.
|
|
33
33
|
|
|
34
34
|
<!-- prettier-ignore-end -->
|
|
35
35
|
|
|
@@ -42,62 +42,69 @@ API documentation for **@fluidframework/tinylicious-driver** is available at <ht
|
|
|
42
42
|
|
|
43
43
|
## Minimum Client Requirements
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
These requirements
|
|
47
|
-
|
|
45
|
+
Fluid Framework client libraries support the platforms in this document.
|
|
46
|
+
These requirements are intentionally restrictive.
|
|
47
|
+
Within a major version series, we can relax these requirements, but we cannot make them stricter.
|
|
48
|
+
For a Long Term Support (LTS) version, we might need to support these platforms for several years.
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
If
|
|
51
|
-
|
|
50
|
+
Other configurations can work, but Fluid Framework does not support them.
|
|
51
|
+
If an unsupported configuration stops working, we do not classify this as a bug.
|
|
52
|
+
To request support for a configuration that is not listed, file an issue.
|
|
53
|
+
The product team will evaluate your request.
|
|
54
|
+
In the issue, specify the current status of the configuration:
|
|
55
|
+
|
|
56
|
+
- The configuration works but needs official support.
|
|
57
|
+
- The configuration does not work and requires changes.
|
|
52
58
|
|
|
53
59
|
### Supported Runtimes
|
|
54
60
|
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
61
|
+
- Fluid Framework supports Node.js versions 22 and 24 while they receive [upstream support](https://nodejs.org/en/about/previous-releases).
|
|
62
|
+
- Fluid Framework will stop support for version 22 [when upstream support ends on 2027-04-30](https://github.com/nodejs/release#release-schedule).
|
|
63
|
+
- Fluid Framework does not support Node.js with the `--no-experimental-fetch` flag.
|
|
64
|
+
- Fluid Framework supports modern browsers that support the ES2022 standard library.
|
|
58
65
|
|
|
59
66
|
### Supported Tools
|
|
60
67
|
|
|
61
|
-
- TypeScript
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
- [
|
|
65
|
-
-
|
|
66
|
-
|
|
68
|
+
- [TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0):
|
|
69
|
+
- Fluid Framework supports all [`strict`](https://www.typescriptlang.org/tsconfig) options.
|
|
70
|
+
- Set the build targets (`lib`, `target`) to `ES2022` or later.
|
|
71
|
+
- Enable [`strictNullChecks`](https://www.typescriptlang.org/tsconfig).
|
|
72
|
+
- Fluid Framework does not support [configuration options deprecated in TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0#breaking-changes-and-deprecations-in-typescript-6-0).
|
|
73
|
+
- Fluid Framework does not fully support `exactOptionalPropertyTypes`.
|
|
74
|
+
If you enable this option, do not use `in`, `Reflect.has`, `Object.hasOwn`, or `Object.prototype.hasOwnProperty` to narrow members of Fluid Framework types.
|
|
75
|
+
These methods can incorrectly exclude `undefined` from the possible values.
|
|
67
76
|
- [webpack](https://webpack.js.org/) 5
|
|
68
|
-
- We
|
|
69
|
-
Other bundlers
|
|
77
|
+
- We do not require a specific bundler.
|
|
78
|
+
Other bundlers that handle ES Modules can work, but we actively test only webpack.
|
|
70
79
|
|
|
71
80
|
### Module Resolution
|
|
72
81
|
|
|
73
|
-
[`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution)
|
|
74
|
-
|
|
82
|
+
In TypeScript `compilerOptions`, use [`Node16`, `Node20`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) module resolution.
|
|
83
|
+
These settings follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
|
|
84
|
+
|
|
85
|
+
Do not use `Node10` module resolution.
|
|
75
86
|
|
|
76
87
|
### Module Formats
|
|
77
88
|
|
|
78
89
|
- ES Modules:
|
|
79
|
-
ES Modules
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
This is done to accommodate some workflows without good ES Module support.
|
|
83
|
-
If you have a workflow you would like included in this list, file an issue.
|
|
84
|
-
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.
|
|
85
|
-
|
|
86
|
-
- 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))
|
|
90
|
+
Use ES Modules to consume Fluid Framework client packages, including in Node.js.
|
|
91
|
+
- CommonJS:
|
|
92
|
+
Fluid Framework does not officially support CommonJS in version 3.0 or later.
|
|
87
93
|
|
|
88
94
|
## Contribution Guidelines
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
You can [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid Framework in these ways:
|
|
91
97
|
|
|
92
|
-
-
|
|
93
|
-
- [Submit
|
|
94
|
-
- Review
|
|
98
|
+
- Answer questions in [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
|
|
99
|
+
- [Submit bug reports](https://github.com/microsoft/FluidFramework/issues) and help verify fixes.
|
|
100
|
+
- Review [source code changes](https://github.com/microsoft/FluidFramework/pulls).
|
|
95
101
|
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
|
|
96
102
|
|
|
97
|
-
|
|
103
|
+
For detailed instructions, read the [repo documentation](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
|
|
98
104
|
|
|
99
|
-
This project
|
|
100
|
-
For more information
|
|
105
|
+
This project follows the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
106
|
+
For more information, read the [Code of Conduct frequently asked questions](https://opensource.microsoft.com/codeofconduct/faq/).
|
|
107
|
+
For questions or comments, contact [opencode@microsoft.com](mailto:opencode@microsoft.com).
|
|
101
108
|
|
|
102
109
|
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
103
110
|
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
|
|
@@ -105,13 +112,9 @@ Use of Microsoft trademarks or logos in modified versions of this project must n
|
|
|
105
112
|
|
|
106
113
|
## Help
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
Check out [fluidframework.com](https://fluidframework.com/docs/).
|
|
110
|
-
|
|
111
|
-
Still not finding what you're looking for?
|
|
112
|
-
Please [file an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
|
|
115
|
+
Read the [Fluid Framework documentation](https://fluidframework.com/docs/) for information about Fluid Framework concepts and APIs.
|
|
113
116
|
|
|
114
|
-
|
|
117
|
+
To request information that the documentation does not contain, [create an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
|
|
115
118
|
|
|
116
119
|
## Trademark
|
|
117
120
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-model.esm.json"
|
|
4
4
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report-base.esm.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
|
|
5
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc;IAErE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IARxB;;;;;;;OAOG;IACc,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc;IAErE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IARxB;;;;;;;OAOG;IACc,MAAM,CAAC,EAAE,SAAS,EAAE,YAAA;IAGzB,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAOb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAO1B,OAAO,CAAC,cAAc;CAkCtB;AAED;;GAEG;AACH,wBAAgB,0CAA0C,IAAI,cAAc,CAE3E"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.InsecureTinyliciousTokenProvider = void 0;
|
|
8
|
+
exports.createInsecureTinyliciousTestTokenProvider = createInsecureTinyliciousTestTokenProvider;
|
|
8
9
|
const internal_1 = require("@fluidframework/driver-definitions/internal");
|
|
9
10
|
const jsrsasign_1 = require("jsrsasign");
|
|
10
11
|
const uuid_1 = require("uuid");
|
|
@@ -14,6 +15,7 @@ const uuid_1 = require("uuid");
|
|
|
14
15
|
* @internal
|
|
15
16
|
*/
|
|
16
17
|
class InsecureTinyliciousTokenProvider {
|
|
18
|
+
scopes;
|
|
17
19
|
constructor(
|
|
18
20
|
/**
|
|
19
21
|
* Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider
|
|
@@ -68,5 +70,4 @@ exports.InsecureTinyliciousTokenProvider = InsecureTinyliciousTokenProvider;
|
|
|
68
70
|
function createInsecureTinyliciousTestTokenProvider() {
|
|
69
71
|
return new InsecureTinyliciousTokenProvider();
|
|
70
72
|
}
|
|
71
|
-
exports.createInsecureTinyliciousTestTokenProvider = createInsecureTinyliciousTestTokenProvider;
|
|
72
73
|
//# sourceMappingURL=insecureTinyliciousTokenProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoFH,gGAEC;AApFD,0EAA2F;AAE3F,yCAA8C;AAC9C,+BAAkC;AAElC;;;;GAIG;AACH,MAAa,gCAAgC;IAU1B;IATlB;IACC;;;;;;;OAOG;IACc,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IACnC,CAAC;IAEG,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAmB;QAEnB,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,UAAkB;QAElB,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9C,CAAC;IACH,CAAC;IAEO,cAAc,CACrB,QAAgB,EAChB,UAA8B,EAC9B,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;QAEnB,MAAM,MAAM,GAAG,IAAA,SAAI,GAAE,CAAC;QACtB,MAAM,KAAK,GAAG,4BAA4B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxD,MAAM,QAAQ,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,uEAAuE;QAE5H,0BAA0B;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAE5C,MAAM,MAAM,GAAiB;YAC5B,UAAU,EAAE,UAAU,IAAI,EAAE;YAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,oBAAS,CAAC,OAAO,EAAE,oBAAS,CAAC,QAAQ,EAAE,oBAAS,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;AAnED,4EAmEC;AAED;;GAEG;AACH,SAAgB,0CAA0C;IACzD,OAAO,IAAI,gCAAgC,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\nimport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n * @internal\n */\nexport class InsecureTinyliciousTokenProvider implements ITokenProvider {\n\tconstructor(\n\t\t/**\n\t\t * Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider\n\t\t * will use the default scopes which are document read, write and summarizer write.\n\t\t *\n\t\t * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n\t\t *\n\t\t * @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]\n\t\t */\n\t\tprivate readonly scopes?: ScopeType[],\n\t) {}\n\n\tpublic async fetchOrdererToken(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate getSignedToken(\n\t\ttenantId: string,\n\t\tdocumentId: string | undefined,\n\t\tlifetime: number = 60 * 60,\n\t\tver: string = \"1.0\",\n\t): string {\n\t\tconst userId = uuid();\n\t\tconst match = /^([\\da-f]{8})-([\\da-f]{4})/.exec(userId);\n\t\tconst userName = match === null ? userId : match[0]; // Just use the first two segments of the (fake) userId as a fake name.\n\n\t\t// Current time in seconds\n\t\tconst now = Math.round(Date.now() / 1000);\n\t\tconst user = { id: userId, name: userName };\n\n\t\tconst claims: ITokenClaims = {\n\t\t\tdocumentId: documentId ?? \"\",\n\t\t\tscopes: this.scopes ?? [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite],\n\t\t\ttenantId,\n\t\t\tuser,\n\t\t\tiat: now,\n\t\t\texp: now + lifetime,\n\t\t\tver,\n\t\t};\n\n\t\tconst utf8Key = { utf8: \"12345\" };\n\t\treturn jsrsasign.jws.JWS.sign(\n\t\t\t// External API uses `null`\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tnull,\n\t\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\t\tclaims,\n\t\t\tutf8Key,\n\t\t);\n\t}\n}\n\n/**\n * Creates an insecure Tinylicious token provider for testing purposes.\n */\nexport function createInsecureTinyliciousTestTokenProvider(): ITokenProvider {\n\treturn new InsecureTinyliciousTokenProvider();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,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;AA4BD;;;GAGG;AACH,wBAAgB,wCAAwC,IAAI,YAAY,CAGvE;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,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;AA4BD;;;GAGG;AACH,wBAAgB,wCAAwC,IAAI,YAAY,CAGvE;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,GAAI,aAAa,MAAM,KAAG,QAKtE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC,gBAVa,MAAM,KAAG,QAUc,CAAC"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.createTinyliciousTestCreateNewRequest = exports.createTinyliciousCreateNewRequest = exports.
|
|
7
|
+
exports.createTinyliciousTestCreateNewRequest = exports.createTinyliciousCreateNewRequest = exports.InsecureTinyliciousUrlResolver = exports.defaultTinyliciousEndpoint = exports.defaultTinyliciousPort = void 0;
|
|
8
|
+
exports.createInsecureTinyliciousTestUrlResolver = createInsecureTinyliciousTestUrlResolver;
|
|
8
9
|
const internal_1 = require("@fluidframework/driver-definitions/internal");
|
|
9
10
|
/**
|
|
10
11
|
* Default endpoint port. Will be used by the service if the consumer does not specify a port.
|
|
@@ -24,6 +25,7 @@ exports.defaultTinyliciousEndpoint = "http://localhost";
|
|
|
24
25
|
* @internal
|
|
25
26
|
*/
|
|
26
27
|
class InsecureTinyliciousUrlResolver {
|
|
28
|
+
tinyliciousEndpoint;
|
|
27
29
|
constructor(port = exports.defaultTinyliciousPort, endpoint = exports.defaultTinyliciousEndpoint) {
|
|
28
30
|
this.tinyliciousEndpoint = `${endpoint}:${port}`;
|
|
29
31
|
}
|
|
@@ -109,7 +111,6 @@ function createInsecureTinyliciousTestUrlResolver() {
|
|
|
109
111
|
const { endpoint, port } = getTinyliciousEndpoint();
|
|
110
112
|
return new InsecureTinyliciousUrlResolver(port, endpoint);
|
|
111
113
|
}
|
|
112
|
-
exports.createInsecureTinyliciousTestUrlResolver = createInsecureTinyliciousTestUrlResolver;
|
|
113
114
|
/**
|
|
114
115
|
* Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.
|
|
115
116
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyHH,4FAGC;AAzHD,0EAIqD;AAErD;;;GAGG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACU,QAAA,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAa,8BAA8B;IACzB,mBAAmB,CAAS;IAC7C,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,GA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AALU,QAAA,iCAAiC,qCAK3C;AAEH;;GAEG;AACU,QAAA,qCAAqC,GAAG,yCAAiC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IResolvedUrl,\n\ttype IUrlResolver,\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\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.\n * Detects the appropriate Tinylicious endpoint based on the environment.\n * @returns In GitHub Codespaces, returns the forwarded port URL. Otherwise returns localhost.\n * @remarks If using codespaces, set tinylicious (port 7070) visibility to \"public\" for this to work.\n */\nfunction getTinyliciousEndpoint(): { endpoint: string; port: number } {\n\tif (typeof window !== \"undefined\") {\n\t\t// Detect GitHub Codespaces and use the forwarded port URL\n\t\t// <codespace-name>-<fowarded-port>.<domain>\n\t\t// e.g. my-codespace-7070.githubpreview.dev\n\t\t// Capture Group 1: <codespace-name>\n\t\t// Capture Group 2: <domain>\n\t\t// reconstruct a hostname that fowards tinlicious's port via HTTPS.\n\t\tconst match = /^(.+)-\\d+\\.(.+)$/.exec(window.location.hostname);\n\t\tif (match) {\n\t\t\t// In Codespaces, the port is embedded in the hostname, use HTTPS port 443\n\t\t\treturn {\n\t\t\t\tendpoint: `https://${match[1]}-${defaultTinyliciousPort}.${match[2]}`,\n\t\t\t\tport: 443,\n\t\t\t};\n\t\t}\n\t}\n\treturn { endpoint: defaultTinyliciousEndpoint, port: defaultTinyliciousPort };\n}\n\n/**\n * Creates an insecure Tinylicious URL resolver for testing purposes.\n * Automatically detects GitHub Codespaces and uses the appropriate endpoint.\n */\nexport function createInsecureTinyliciousTestUrlResolver(): IUrlResolver {\n\tconst { endpoint, port } = getTinyliciousEndpoint();\n\treturn new InsecureTinyliciousUrlResolver(port, endpoint);\n}\n\n/**\n * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.\n * @internal\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n\n/**\n * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.\n */\nexport const createTinyliciousTestCreateNewRequest = createTinyliciousCreateNewRequest;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc;IAErE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IARxB;;;;;;;OAOG;IACc,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousTokenProvider.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc;IAErE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IARxB;;;;;;;OAOG;IACc,MAAM,CAAC,EAAE,SAAS,EAAE,YAAA;IAGzB,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAOb,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,CAAC;IAO1B,OAAO,CAAC,cAAc;CAkCtB;AAED;;GAEG;AACH,wBAAgB,0CAA0C,IAAI,cAAc,CAE3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousTokenProvider.js","sourceRoot":"","sources":["../src/insecureTinyliciousTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAE3F,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,I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,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAE5C,MAAM,MAAM,GAAiB;YAC5B,UAAU,EAAE,UAAU,IAAI,EAAE;YAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC;YACtF,QAAQ;YACR,IAAI;YACJ,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,GAAG,GAAG,QAAQ;YACnB,GAAG;SACH,CAAC;QAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAClC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;QAC5B,2BAA2B;QAC3B,2CAA2C;QAC3C,IAAI,EACJ,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,EACN,OAAO,CACP,CAAC;IACH,CAAC;CACD;AAED;;GAEG;AACH,MAAM,UAAU,0CAA0C;IACzD,OAAO,IAAI,gCAAgC,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ITokenClaims, ScopeType } from \"@fluidframework/driver-definitions/internal\";\nimport type { ITokenProvider, ITokenResponse } from \"@fluidframework/routerlicious-driver\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n * @internal\n */\nexport class InsecureTinyliciousTokenProvider implements ITokenProvider {\n\tconstructor(\n\t\t/**\n\t\t * Optional. Override of scopes. If a param is not provided, InsecureTinyliciousTokenProvider\n\t\t * will use the default scopes which are document read, write and summarizer write.\n\t\t *\n\t\t * @param scopes - See {@link @fluidframework/protocol-definitions#ITokenClaims.scopes}\n\t\t *\n\t\t * @defaultValue [ ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite ]\n\t\t */\n\t\tprivate readonly scopes?: ScopeType[],\n\t) {}\n\n\tpublic async fetchOrdererToken(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.getSignedToken(tenantId, documentId),\n\t\t};\n\t}\n\n\tprivate getSignedToken(\n\t\ttenantId: string,\n\t\tdocumentId: string | undefined,\n\t\tlifetime: number = 60 * 60,\n\t\tver: string = \"1.0\",\n\t): string {\n\t\tconst userId = uuid();\n\t\tconst match = /^([\\da-f]{8})-([\\da-f]{4})/.exec(userId);\n\t\tconst userName = match === null ? userId : match[0]; // Just use the first two segments of the (fake) userId as a fake name.\n\n\t\t// Current time in seconds\n\t\tconst now = Math.round(Date.now() / 1000);\n\t\tconst user = { id: userId, name: userName };\n\n\t\tconst claims: ITokenClaims = {\n\t\t\tdocumentId: documentId ?? \"\",\n\t\t\tscopes: this.scopes ?? [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite],\n\t\t\ttenantId,\n\t\t\tuser,\n\t\t\tiat: now,\n\t\t\texp: now + lifetime,\n\t\t\tver,\n\t\t};\n\n\t\tconst utf8Key = { utf8: \"12345\" };\n\t\treturn jsrsasign.jws.JWS.sign(\n\t\t\t// External API uses `null`\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tnull,\n\t\t\tJSON.stringify({ alg: \"HS256\", typ: \"JWT\" }),\n\t\t\tclaims,\n\t\t\tutf8Key,\n\t\t);\n\t}\n}\n\n/**\n * Creates an insecure Tinylicious token provider for testing purposes.\n */\nexport function createInsecureTinyliciousTestTokenProvider(): ITokenProvider {\n\treturn new InsecureTinyliciousTokenProvider();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,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;AA4BD;;;GAGG;AACH,wBAAgB,wCAAwC,IAAI,YAAY,CAGvE;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,
|
|
1
|
+
{"version":3,"file":"insecureTinyliciousUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,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;AA4BD;;;GAGG;AACH,wBAAgB,wCAAwC,IAAI,YAAY,CAGvE;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,GAAI,aAAa,MAAM,KAAG,QAKtE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qCAAqC,gBAVa,MAAM,KAAG,QAUc,CAAC"}
|
|
@@ -21,6 +21,7 @@ export const defaultTinyliciousEndpoint = "http://localhost";
|
|
|
21
21
|
* @internal
|
|
22
22
|
*/
|
|
23
23
|
export class InsecureTinyliciousUrlResolver {
|
|
24
|
+
tinyliciousEndpoint;
|
|
24
25
|
constructor(port = defaultTinyliciousPort, endpoint = defaultTinyliciousEndpoint) {
|
|
25
26
|
this.tinyliciousEndpoint = `${endpoint}:${port}`;
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureTinyliciousUrlResolver.js","sourceRoot":"","sources":["../src/insecureTinyliciousUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAGZ,MAAM,6CAA6C,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,OAAO,8B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QAAQ,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC,IAAI,sBAAsB,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;gBACrE,IAAI,EAAE,GAAG;aACT,CAAC;QACH,CAAC;IACF,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,0BAA0B,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wCAAwC;IACvD,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACpD,OAAO,IAAI,8BAA8B,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,UAAmB,EAAY,EAAE,CAAC,CAAC;IACpF,GAAG,EAAE,UAAU,IAAI,EAAE;IACrB,OAAO,EAAE;QACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;KAC9B;CACD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,iCAAiC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IResolvedUrl,\n\ttype IUrlResolver,\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\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior\n\t\tif (request.headers && request.headers[DriverHeader.createNew] === true) {\n\t\t\t// Use the document ID passed by the application via the create request;\n\t\t\t// if none was passed, use the reserved keyword to let the driver generate the ID.\n\t\t\t// TODO: deprecate this capability for tinylicious as the r11s driver will stop using the document ID\n\t\t\t// in create requests.\n\t\t\tif (finalDocumentId === \"\") {\n\t\t\t\tfinalDocumentId = \"new\";\n\t\t\t}\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${finalDocumentId}`;\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${finalDocumentId}`;\n\t\t} else {\n\t\t\tconst encodedDocId = encodeURIComponent(finalDocumentId);\n\t\t\tconst documentRelativePath = relativeUrl.slice(documentIdFromRequest.length);\n\t\t\tdocumentUrl = `${this.tinyliciousEndpoint}/tinylicious/${encodedDocId}${documentRelativePath}`;\n\t\t\tdeltaStorageUrl = `${this.tinyliciousEndpoint}/deltas/tinylicious/${encodedDocId}`;\n\t\t}\n\n\t\treturn {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.tinyliciousEndpoint,\n\t\t\t\tstorageUrl: `${this.tinyliciousEndpoint}/repos/tinylicious`,\n\t\t\t},\n\t\t\tid: finalDocumentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst documentId = decodeURIComponent(\n\t\t\tresolvedUrl.url.replace(`${this.tinyliciousEndpoint}/tinylicious/`, \"\"),\n\t\t);\n\t\t/*\n\t\t * The detached container flow will ultimately call getAbsoluteUrl() with the resolved.url produced by\n\t\t * resolve(). The container expects getAbsoluteUrl's return value to be a URL that can then be roundtripped\n\t\t * back through resolve() again, and get the same result again. So we'll return a \"URL\" with the same format\n\t\t * described above.\n\t\t */\n\t\treturn `${documentId}/${relativeUrl}`;\n\t}\n}\n\n/**\n * Creates an insecure Tinylicious URL resolver for testing purposes with localhost port 7070.\n * Detects the appropriate Tinylicious endpoint based on the environment.\n * @returns In GitHub Codespaces, returns the forwarded port URL. Otherwise returns localhost.\n * @remarks If using codespaces, set tinylicious (port 7070) visibility to \"public\" for this to work.\n */\nfunction getTinyliciousEndpoint(): { endpoint: string; port: number } {\n\tif (typeof window !== \"undefined\") {\n\t\t// Detect GitHub Codespaces and use the forwarded port URL\n\t\t// <codespace-name>-<fowarded-port>.<domain>\n\t\t// e.g. my-codespace-7070.githubpreview.dev\n\t\t// Capture Group 1: <codespace-name>\n\t\t// Capture Group 2: <domain>\n\t\t// reconstruct a hostname that fowards tinlicious's port via HTTPS.\n\t\tconst match = /^(.+)-\\d+\\.(.+)$/.exec(window.location.hostname);\n\t\tif (match) {\n\t\t\t// In Codespaces, the port is embedded in the hostname, use HTTPS port 443\n\t\t\treturn {\n\t\t\t\tendpoint: `https://${match[1]}-${defaultTinyliciousPort}.${match[2]}`,\n\t\t\t\tport: 443,\n\t\t\t};\n\t\t}\n\t}\n\treturn { endpoint: defaultTinyliciousEndpoint, port: defaultTinyliciousPort };\n}\n\n/**\n * Creates an insecure Tinylicious URL resolver for testing purposes.\n * Automatically detects GitHub Codespaces and uses the appropriate endpoint.\n */\nexport function createInsecureTinyliciousTestUrlResolver(): IUrlResolver {\n\tconst { endpoint, port } = getTinyliciousEndpoint();\n\treturn new InsecureTinyliciousUrlResolver(port, endpoint);\n}\n\n/**\n * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest}.\n * @internal\n */\nexport const createTinyliciousCreateNewRequest = (documentId?: string): IRequest => ({\n\turl: documentId ?? \"\",\n\theaders: {\n\t\t[DriverHeader.createNew]: true,\n\t},\n});\n\n/**\n * Creates a Tinylicious {@link @fluidframework/core-interfaces#IRequest} for testing purposes.\n */\nexport const createTinyliciousTestCreateNewRequest = createTinyliciousCreateNewRequest;\n"]}
|
package/lib/public.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib
|
|
8
|
+
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tinylicious-driver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Driver for tinylicious",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -13,50 +13,33 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"require": {
|
|
21
|
-
"types": "./dist/public.d.ts",
|
|
22
|
-
"default": "./dist/index.js"
|
|
16
|
+
"types": "./lib/public.d.ts",
|
|
17
|
+
"default": "./lib/index.js",
|
|
18
|
+
"internal-entrypoint-generation": {
|
|
19
|
+
"types": "./dist/public.d.ts"
|
|
23
20
|
}
|
|
24
21
|
},
|
|
25
22
|
"./test-utils": {
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"default": "./lib/testUtils.js"
|
|
29
|
-
},
|
|
30
|
-
"require": {
|
|
31
|
-
"types": "./dist/testUtils.d.ts",
|
|
32
|
-
"default": "./dist/testUtils.js"
|
|
33
|
-
}
|
|
23
|
+
"types": "./lib/testUtils.d.ts",
|
|
24
|
+
"default": "./lib/testUtils.js"
|
|
34
25
|
},
|
|
35
26
|
"./internal": {
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"default": "./lib/index.js"
|
|
39
|
-
},
|
|
40
|
-
"require": {
|
|
41
|
-
"types": "./dist/index.d.ts",
|
|
42
|
-
"default": "./dist/index.js"
|
|
43
|
-
}
|
|
27
|
+
"types": "./lib/index.d.ts",
|
|
28
|
+
"default": "./lib/index.js"
|
|
44
29
|
}
|
|
45
30
|
},
|
|
46
|
-
"main": "lib/index.js",
|
|
47
|
-
"types": "lib/public.d.ts",
|
|
48
31
|
"dependencies": {
|
|
49
|
-
"@fluidframework/core-interfaces": "~
|
|
50
|
-
"@fluidframework/driver-definitions": "~
|
|
51
|
-
"@fluidframework/driver-utils": "~
|
|
52
|
-
"@fluidframework/routerlicious-driver": "~
|
|
32
|
+
"@fluidframework/core-interfaces": "~3.0.0",
|
|
33
|
+
"@fluidframework/driver-definitions": "~3.0.0",
|
|
34
|
+
"@fluidframework/driver-utils": "~3.0.0",
|
|
35
|
+
"@fluidframework/routerlicious-driver": "~3.0.0",
|
|
53
36
|
"jsrsasign": "^11.1.1",
|
|
54
37
|
"uuid": "^11.1.0"
|
|
55
38
|
},
|
|
56
39
|
"devDependencies": {
|
|
57
40
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
58
41
|
"@biomejs/biome": "~2.4.5",
|
|
59
|
-
"@fluid-internal/mocha-test-setup": "~
|
|
42
|
+
"@fluid-internal/mocha-test-setup": "~3.0.0",
|
|
60
43
|
"@fluid-tools/build-cli": "^0.67.0",
|
|
61
44
|
"@fluidframework/build-common": "^2.0.3",
|
|
62
45
|
"@fluidframework/build-tools": "^0.67.0",
|
|
@@ -73,7 +56,7 @@
|
|
|
73
56
|
"jiti": "^2.6.1",
|
|
74
57
|
"mocha": "^11.7.5",
|
|
75
58
|
"rimraf": "^6.1.3",
|
|
76
|
-
"typescript": "~
|
|
59
|
+
"typescript": "~6.0.3"
|
|
77
60
|
},
|
|
78
61
|
"typeValidation": {
|
|
79
62
|
"broken": {},
|
|
@@ -81,17 +64,19 @@
|
|
|
81
64
|
},
|
|
82
65
|
"scripts": {
|
|
83
66
|
"build": "fluid-build . --task build",
|
|
67
|
+
"build:api-reports": "api-extractor run --local --config api-extractor/api-extractor-report.json",
|
|
68
|
+
"build:cjs": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
84
69
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
85
70
|
"build:compile": "fluid-build . --task compile",
|
|
86
|
-
"build:docs": "api-extractor run --local",
|
|
71
|
+
"build:docs": "api-extractor run --local --config api-extractor/api-extractor-model.json",
|
|
87
72
|
"build:entrypoints": "fluid-build . --task build:entrypoints",
|
|
88
73
|
"build:entrypoints:cjs": "flub generate entrypoints --resolutionConditions require --outFileLegacyBeta legacy --outDir ./dist",
|
|
89
|
-
"build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib
|
|
90
|
-
"build:
|
|
74
|
+
"build:entrypoints:esm": "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib",
|
|
75
|
+
"build:esm": "tsc --project ./tsconfig.json",
|
|
91
76
|
"build:test": "concurrently npm:build:test:esm npm:build:test:cjs",
|
|
92
77
|
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
93
78
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
94
|
-
"check:are-the-types-wrong": "attw --pack .",
|
|
79
|
+
"check:are-the-types-wrong": "attw --pack . --profile esm-only",
|
|
95
80
|
"check:biome": "biome check .",
|
|
96
81
|
"check:exports": "concurrently \"npm:check:exports:*\"",
|
|
97
82
|
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
|
|
@@ -100,7 +85,9 @@
|
|
|
100
85
|
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
101
86
|
"check:exports:esm:testUtils": "api-extractor run --config api-extractor/api-extractor-lint-testUtils.esm.json",
|
|
102
87
|
"check:format": "npm run check:biome",
|
|
103
|
-
"
|
|
88
|
+
"check:types:inexactOptionalPropertyTypes": "tsc --project ./tsconfig.json --noEmit --exactOptionalPropertyTypes false --skipLibCheck --emitDeclarationOnly false --tsBuildInfoFile ./tsconfig.inexactOptionalPropertyTypes.tsbuildinfo",
|
|
89
|
+
"ci:build:api-reports": "api-extractor run --config api-extractor/api-extractor-report.json",
|
|
90
|
+
"ci:build:docs": "api-extractor run --config api-extractor/api-extractor-model.json",
|
|
104
91
|
"clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
105
92
|
"eslint": "eslint --quiet --format stylish src",
|
|
106
93
|
"eslint:fix": "eslint --quiet --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
@@ -113,7 +100,6 @@
|
|
|
113
100
|
"test:mocha:cjs": "cross-env FLUID_TEST_MODULE_SYSTEM=CJS mocha",
|
|
114
101
|
"test:mocha:esm": "mocha",
|
|
115
102
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
116
|
-
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
117
103
|
"typetests:gen": "flub generate typetests --dir . -v"
|
|
118
104
|
}
|
|
119
105
|
}
|
package/tsconfig.json
CHANGED
package/internal.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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 --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export * from "./lib/index.js";
|
package/test-utils.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* This is required for compiling with Node10 moduleResolution. No runtime support.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export * from "./lib/testUtils.js";
|