@fluidframework/routerlicious-driver 2.118.1 → 3.0.1

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 (151) hide show
  1. package/.mocharc.cjs +3 -0
  2. package/CHANGELOG.md +34 -4
  3. package/README.md +53 -50
  4. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  5. package/dist/cache.js +1 -0
  6. package/dist/cache.js.map +1 -1
  7. package/dist/defaultTokenProvider.js +1 -0
  8. package/dist/defaultTokenProvider.js.map +1 -1
  9. package/dist/deltaStorageService.js +12 -0
  10. package/dist/deltaStorageService.js.map +1 -1
  11. package/dist/documentDeltaConnection.js +1 -0
  12. package/dist/documentDeltaConnection.js.map +1 -1
  13. package/dist/documentService.js +23 -0
  14. package/dist/documentService.js.map +1 -1
  15. package/dist/documentServiceFactory.d.ts +8 -2
  16. package/dist/documentServiceFactory.d.ts.map +1 -1
  17. package/dist/documentServiceFactory.js +19 -5
  18. package/dist/documentServiceFactory.js.map +1 -1
  19. package/dist/documentStorageService.d.ts.map +1 -1
  20. package/dist/documentStorageService.js +4 -1
  21. package/dist/documentStorageService.js.map +1 -1
  22. package/dist/errorUtils.js +8 -7
  23. package/dist/errorUtils.js.map +1 -1
  24. package/dist/gitManager.js +1 -0
  25. package/dist/gitManager.js.map +1 -1
  26. package/dist/historian.d.ts.map +1 -1
  27. package/dist/historian.js +4 -1
  28. package/dist/historian.js.map +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/mapWithExpiration.js +3 -2
  34. package/dist/mapWithExpiration.js.map +1 -1
  35. package/dist/packageVersion.d.ts +1 -1
  36. package/dist/packageVersion.d.ts.map +1 -1
  37. package/dist/packageVersion.js +1 -1
  38. package/dist/packageVersion.js.map +1 -1
  39. package/dist/queryStringUtils.js +1 -2
  40. package/dist/queryStringUtils.js.map +1 -1
  41. package/dist/r11sLayerCompatState.d.ts +8 -1
  42. package/dist/r11sLayerCompatState.d.ts.map +1 -1
  43. package/dist/r11sLayerCompatState.js +20 -1
  44. package/dist/r11sLayerCompatState.js.map +1 -1
  45. package/dist/r11sSnapshotParser.js +1 -2
  46. package/dist/r11sSnapshotParser.js.map +1 -1
  47. package/dist/restWrapper.d.ts.map +1 -1
  48. package/dist/restWrapper.js +18 -12
  49. package/dist/restWrapper.js.map +1 -1
  50. package/dist/restWrapperBase.d.ts.map +1 -1
  51. package/dist/restWrapperBase.js +4 -0
  52. package/dist/restWrapperBase.js.map +1 -1
  53. package/dist/retriableGitManager.js +2 -0
  54. package/dist/retriableGitManager.js.map +1 -1
  55. package/dist/routerliciousResolvedUrl.d.ts.map +1 -1
  56. package/dist/sessionInfoManager.js +13 -12
  57. package/dist/sessionInfoManager.js.map +1 -1
  58. package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  59. package/dist/shreddedSummaryDocumentStorageService.js +17 -3
  60. package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
  61. package/dist/summaryTreeUploadManager.d.ts.map +1 -1
  62. package/dist/summaryTreeUploadManager.js +7 -1
  63. package/dist/summaryTreeUploadManager.js.map +1 -1
  64. package/dist/treeUtils.d.ts.map +1 -1
  65. package/dist/treeUtils.js +7 -6
  66. package/dist/treeUtils.js.map +1 -1
  67. package/dist/urlUtils.d.ts.map +1 -1
  68. package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  69. package/dist/wholeSummaryDocumentStorageService.js +17 -1
  70. package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
  71. package/dist/wholeSummaryUploadManager.js +1 -0
  72. package/dist/wholeSummaryUploadManager.js.map +1 -1
  73. package/lib/cache.js +1 -0
  74. package/lib/cache.js.map +1 -1
  75. package/lib/defaultTokenProvider.js +1 -0
  76. package/lib/defaultTokenProvider.js.map +1 -1
  77. package/lib/deltaStorageService.js +12 -0
  78. package/lib/deltaStorageService.js.map +1 -1
  79. package/lib/documentDeltaConnection.js +1 -0
  80. package/lib/documentDeltaConnection.js.map +1 -1
  81. package/lib/documentService.js +23 -0
  82. package/lib/documentService.js.map +1 -1
  83. package/lib/documentServiceFactory.d.ts +8 -2
  84. package/lib/documentServiceFactory.d.ts.map +1 -1
  85. package/lib/documentServiceFactory.js +18 -4
  86. package/lib/documentServiceFactory.js.map +1 -1
  87. package/lib/documentStorageService.d.ts.map +1 -1
  88. package/lib/documentStorageService.js +4 -1
  89. package/lib/documentStorageService.js.map +1 -1
  90. package/lib/errorUtils.js +3 -2
  91. package/lib/errorUtils.js.map +1 -1
  92. package/lib/gitManager.js +1 -0
  93. package/lib/gitManager.js.map +1 -1
  94. package/lib/historian.d.ts.map +1 -1
  95. package/lib/historian.js +4 -1
  96. package/lib/historian.js.map +1 -1
  97. package/lib/index.d.ts +1 -1
  98. package/lib/index.d.ts.map +1 -1
  99. package/lib/index.js +1 -1
  100. package/lib/index.js.map +1 -1
  101. package/lib/legacy.d.ts +1 -1
  102. package/lib/mapWithExpiration.js +3 -2
  103. package/lib/mapWithExpiration.js.map +1 -1
  104. package/lib/packageVersion.d.ts +1 -1
  105. package/lib/packageVersion.d.ts.map +1 -1
  106. package/lib/packageVersion.js +1 -1
  107. package/lib/packageVersion.js.map +1 -1
  108. package/lib/public.d.ts +1 -1
  109. package/lib/r11sLayerCompatState.d.ts +8 -1
  110. package/lib/r11sLayerCompatState.d.ts.map +1 -1
  111. package/lib/r11sLayerCompatState.js +20 -1
  112. package/lib/r11sLayerCompatState.js.map +1 -1
  113. package/lib/restWrapper.d.ts.map +1 -1
  114. package/lib/restWrapper.js +13 -7
  115. package/lib/restWrapper.js.map +1 -1
  116. package/lib/restWrapperBase.d.ts.map +1 -1
  117. package/lib/restWrapperBase.js +4 -0
  118. package/lib/restWrapperBase.js.map +1 -1
  119. package/lib/retriableGitManager.js +2 -0
  120. package/lib/retriableGitManager.js.map +1 -1
  121. package/lib/routerliciousResolvedUrl.d.ts.map +1 -1
  122. package/lib/sessionInfoManager.js +13 -12
  123. package/lib/sessionInfoManager.js.map +1 -1
  124. package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  125. package/lib/shreddedSummaryDocumentStorageService.js +17 -3
  126. package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
  127. package/lib/summaryTreeUploadManager.d.ts.map +1 -1
  128. package/lib/summaryTreeUploadManager.js +7 -1
  129. package/lib/summaryTreeUploadManager.js.map +1 -1
  130. package/lib/treeUtils.d.ts.map +1 -1
  131. package/lib/treeUtils.js +3 -2
  132. package/lib/treeUtils.js.map +1 -1
  133. package/lib/urlUtils.d.ts.map +1 -1
  134. package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  135. package/lib/wholeSummaryDocumentStorageService.js +17 -1
  136. package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
  137. package/lib/wholeSummaryUploadManager.js +1 -0
  138. package/lib/wholeSummaryUploadManager.js.map +1 -1
  139. package/package.json +32 -45
  140. package/src/documentServiceFactory.ts +19 -2
  141. package/src/index.ts +4 -1
  142. package/src/packageVersion.ts +1 -1
  143. package/src/r11sLayerCompatState.ts +29 -1
  144. package/src/shreddedSummaryDocumentStorageService.ts +8 -1
  145. package/src/summaryTreeUploadManager.ts +5 -2
  146. package/src/wholeSummaryDocumentStorageService.ts +8 -1
  147. package/tsconfig.json +1 -1
  148. package/internal.d.ts +0 -11
  149. package/legacy.d.ts +0 -11
  150. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  151. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
package/.mocharc.cjs CHANGED
@@ -8,4 +8,7 @@
8
8
  const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
9
9
 
10
10
  const config = getFluidTestMochaConfig(__dirname);
11
+ const outputDirectory = process.env.FLUID_TEST_MODULE_SYSTEM === "CJS" ? "dist" : "lib";
12
+ config.require.push(`${__dirname}/${outputDirectory}/test/socketModuleMock.js`);
13
+ config["node-option"].push("experimental-test-module-mocks");
11
14
  module.exports = config;
package/CHANGELOG.md CHANGED
@@ -1,12 +1,42 @@
1
1
  # @fluidframework/routerlicious-driver
2
2
 
3
- ## 2.118.0
3
+ ## 3.0.0
4
4
 
5
- Dependency updates only.
5
+ ### Minor Changes
6
6
 
7
- ## 2.117.0
7
+ - Removal of direct CommonJS support ([#28124](https://github.com/microsoft/FluidFramework/pull/28124)) [0f84e3b8878](https://github.com/microsoft/FluidFramework/commit/0f84e3b8878a5e75b2253976d98fd963bbd9db88)
8
8
 
9
- Dependency updates only.
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.
10
40
 
11
41
  ## 2.116.0
12
42
 
package/README.md CHANGED
@@ -11,15 +11,15 @@ It also provides implementation of Document Storage, Delta Storage and Delta str
11
11
 
12
12
  ## Using Fluid Framework libraries
13
13
 
14
- When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
15
- While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
16
- library consumers should always prefer `^`.
14
+ For a dependency on a Fluid Framework library's public APIs, we recommend a `^` (caret) version range.
15
+ For example, use `^1.3.4`.
17
16
 
18
- If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
17
+ For a dependency on an unstable API, such as a `beta` API, we recommend a more restrictive version range.
18
+ For example, use a `~` version range.
19
19
 
20
20
  ## Installation
21
21
 
22
- To get started, install the package by running the following command:
22
+ Run this command to install the package:
23
23
 
24
24
  ```bash
25
25
  npm i @fluidframework/routerlicious-driver
@@ -27,16 +27,16 @@ npm i @fluidframework/routerlicious-driver
27
27
 
28
28
  ## Importing from this package
29
29
 
30
- This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
31
- For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
30
+ This package uses [package.json exports](https://nodejs.org/api/packages.html#exports) to separate APIs by support level.
31
+ For information about the support guarantees, read [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
32
32
 
33
- To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/routerlicious-driver` like normal.
33
+ Import the `public` APIs from `@fluidframework/routerlicious-driver`.
34
34
 
35
- To access the `legacy` APIs, import via `@fluidframework/routerlicious-driver/legacy`.
35
+ Import the `legacy` APIs from `@fluidframework/routerlicious-driver/legacy`.
36
36
 
37
37
  ## API Documentation
38
38
 
39
- API documentation for **@fluidframework/routerlicious-driver** is available at <https://fluidframework.com/docs/apis/routerlicious-driver>.
39
+ Read the **@fluidframework/routerlicious-driver** API documentation at <https://fluidframework.com/docs/apis/routerlicious-driver>.
40
40
 
41
41
  <!-- prettier-ignore-end -->
42
42
 
@@ -49,62 +49,69 @@ API documentation for **@fluidframework/routerlicious-driver** is available at <
49
49
 
50
50
  ## Minimum Client Requirements
51
51
 
52
- These are the platform requirements for the current version of Fluid Framework Client Packages.
53
- 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.
54
- For Long Term Support (LTS) versions this can require supporting these platforms for several years.
52
+ Fluid Framework client libraries support the platforms in this document.
53
+ These requirements are intentionally restrictive.
54
+ Within a major version series, we can relax these requirements, but we cannot make them stricter.
55
+ For a Long Term Support (LTS) version, we might need to support these platforms for several years.
55
56
 
56
- It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
57
- If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
58
- 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.
57
+ Other configurations can work, but Fluid Framework does not support them.
58
+ If an unsupported configuration stops working, we do not classify this as a bug.
59
+ To request support for a configuration that is not listed, file an issue.
60
+ The product team will evaluate your request.
61
+ In the issue, specify the current status of the configuration:
62
+
63
+ - The configuration works but needs official support.
64
+ - The configuration does not work and requires changes.
59
65
 
60
66
  ### Supported Runtimes
61
67
 
62
- - NodeJs ^22.22.2 except that we will drop support for it [when NodeJs 22 loses its upstream support on 2027-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS at least 1 year before 22 is end-of-life.
63
- - Running Fluid in a Node.js environment with the `--no-experimental-fetch` flag is not supported.
64
- - 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).
68
+ - Fluid Framework supports Node.js versions 22 and 24 while they receive [upstream support](https://nodejs.org/en/about/previous-releases).
69
+ - Fluid Framework will stop support for version 22 [when upstream support ends on 2027-04-30](https://github.com/nodejs/release#release-schedule).
70
+ - Fluid Framework does not support Node.js with the `--no-experimental-fetch` flag.
71
+ - Fluid Framework supports modern browsers that support the ES2022 standard library.
65
72
 
66
73
  ### Supported Tools
67
74
 
68
- - TypeScript 5.4:
69
- - All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
70
- - [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
71
- - [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
72
- - `exactOptionalPropertyTypes` is currently not fully supported.
73
- 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.
75
+ - [TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0):
76
+ - Fluid Framework supports all [`strict`](https://www.typescriptlang.org/tsconfig) options.
77
+ - Set the build targets (`lib`, `target`) to `ES2022` or later.
78
+ - Enable [`strictNullChecks`](https://www.typescriptlang.org/tsconfig).
79
+ - 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).
80
+ - Fluid Framework does not fully support `exactOptionalPropertyTypes`.
81
+ If you enable this option, do not use `in`, `Reflect.has`, `Object.hasOwn`, or `Object.prototype.hasOwnProperty` to narrow members of Fluid Framework types.
82
+ These methods can incorrectly exclude `undefined` from the possible values.
74
83
  - [webpack](https://webpack.js.org/) 5
75
- - We are not intending to be prescriptive about what bundler to use.
76
- Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
84
+ - We do not require a specific bundler.
85
+ Other bundlers that handle ES Modules can work, but we actively test only webpack.
77
86
 
78
87
  ### Module Resolution
79
88
 
80
- [`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).
81
- 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.
89
+ In TypeScript `compilerOptions`, use [`Node16`, `Node20`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) module resolution.
90
+ 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).
91
+
92
+ Do not use `Node10` module resolution.
82
93
 
83
94
  ### Module Formats
84
95
 
85
96
  - ES Modules:
86
- 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.
87
- - CommonJs:
88
- Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
89
- This is done to accommodate some workflows without good ES Module support.
90
- If you have a workflow you would like included in this list, file an issue.
91
- 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.
92
-
93
- - 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))
97
+ Use ES Modules to consume Fluid Framework client packages, including in Node.js.
98
+ - CommonJS:
99
+ Fluid Framework does not officially support CommonJS in version 3.0 or later.
94
100
 
95
101
  ## Contribution Guidelines
96
102
 
97
- There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
103
+ You can [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid Framework in these ways:
98
104
 
99
- - Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
100
- - [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
101
- - Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
105
+ - Answer questions in [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
106
+ - [Submit bug reports](https://github.com/microsoft/FluidFramework/issues) and help verify fixes.
107
+ - Review [source code changes](https://github.com/microsoft/FluidFramework/pulls).
102
108
  - [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
103
109
 
104
- Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
110
+ For detailed instructions, read the [repo documentation](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
105
111
 
106
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
107
- For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
112
+ This project follows the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
113
+ For more information, read the [Code of Conduct frequently asked questions](https://opensource.microsoft.com/codeofconduct/faq/).
114
+ For questions or comments, contact [opencode@microsoft.com](mailto:opencode@microsoft.com).
108
115
 
109
116
  This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
110
117
  Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
@@ -112,13 +119,9 @@ Use of Microsoft trademarks or logos in modified versions of this project must n
112
119
 
113
120
  ## Help
114
121
 
115
- Not finding what you're looking for in this README?
116
- Check out [fluidframework.com](https://fluidframework.com/docs/).
117
-
118
- Still not finding what you're looking for?
119
- Please [file an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
122
+ Read the [Fluid Framework documentation](https://fluidframework.com/docs/) for information about Fluid Framework concepts and APIs.
120
123
 
121
- Thank you!
124
+ 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).
122
125
 
123
126
  ## Trademark
124
127
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-model.esm.json"
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-model.esm.json"
4
4
  }
package/dist/cache.js CHANGED
@@ -8,6 +8,7 @@ exports.NullCache = exports.InMemoryCache = void 0;
8
8
  const mapWithExpiration_js_1 = require("./mapWithExpiration.js");
9
9
  /** A basic in-memory cache that optionally supports expiring entries after a period of inactivity */
10
10
  class InMemoryCache {
11
+ cache;
11
12
  constructor(expirationMs) {
12
13
  this.cache = expirationMs === undefined ? new Map() : new mapWithExpiration_js_1.MapWithExpiration(expirationMs);
13
14
  }
package/dist/cache.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAA2D;AAO3D,qGAAqG;AACrG,MAAa,aAAa;IAGzB,YAAY,YAAqB;QAChC,IAAI,CAAC,KAAK,GAAG,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,wCAAiB,CAAC,YAAY,CAAC,CAAC;IAC3F,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAQ;QACrC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD;AAdD,sCAcC;AAED,yEAAyE;AACzE,MAAa,SAAS;IACd,KAAK,CAAC,GAAG,CAAC,GAAW;QAC3B,OAAO,SAAS,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAQ,IAAkB,CAAC;CACzD;AAND,8BAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { MapWithExpiration } from \"./mapWithExpiration.js\";\n\nexport interface ICache<T> {\n\tget(key: string): Promise<T | undefined>;\n\tput(key: string, value: T): Promise<void>;\n}\n\n/** A basic in-memory cache that optionally supports expiring entries after a period of inactivity */\nexport class InMemoryCache<T> implements ICache<T> {\n\tprivate readonly cache: Map<string, T>;\n\n\tconstructor(expirationMs?: number) {\n\t\tthis.cache = expirationMs === undefined ? new Map() : new MapWithExpiration(expirationMs);\n\t}\n\n\tpublic async get(key: string): Promise<T | undefined> {\n\t\treturn this.cache.get(key);\n\t}\n\n\tpublic async put(key: string, value: T): Promise<void> {\n\t\tthis.cache.set(key, value);\n\t}\n}\n\n/** This \"cache\" does nothing on put, and get always returns undefined */\nexport class NullCache<T> implements ICache<T> {\n\tpublic async get(key: string): Promise<T | undefined> {\n\t\treturn undefined;\n\t}\n\n\tpublic async put(key: string, value: T): Promise<void> {}\n}\n"]}
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAA2D;AAO3D,qGAAqG;AACrG,MAAa,aAAa;IACR,KAAK,CAAiB;IAEvC,YAAY,YAAqB;QAChC,IAAI,CAAC,KAAK,GAAG,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,wCAAiB,CAAC,YAAY,CAAC,CAAC;IAC3F,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAQ;QACrC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD;AAdD,sCAcC;AAED,yEAAyE;AACzE,MAAa,SAAS;IACd,KAAK,CAAC,GAAG,CAAC,GAAW;QAC3B,OAAO,SAAS,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAQ,IAAkB,CAAC;CACzD;AAND,8BAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { MapWithExpiration } from \"./mapWithExpiration.js\";\n\nexport interface ICache<T> {\n\tget(key: string): Promise<T | undefined>;\n\tput(key: string, value: T): Promise<void>;\n}\n\n/** A basic in-memory cache that optionally supports expiring entries after a period of inactivity */\nexport class InMemoryCache<T> implements ICache<T> {\n\tprivate readonly cache: Map<string, T>;\n\n\tconstructor(expirationMs?: number) {\n\t\tthis.cache = expirationMs === undefined ? new Map() : new MapWithExpiration(expirationMs);\n\t}\n\n\tpublic async get(key: string): Promise<T | undefined> {\n\t\treturn this.cache.get(key);\n\t}\n\n\tpublic async put(key: string, value: T): Promise<void> {\n\t\tthis.cache.set(key, value);\n\t}\n}\n\n/** This \"cache\" does nothing on put, and get always returns undefined */\nexport class NullCache<T> implements ICache<T> {\n\tpublic async get(key: string): Promise<T | undefined> {\n\t\treturn undefined;\n\t}\n\n\tpublic async put(key: string, value: T): Promise<void> {}\n}\n"]}
@@ -10,6 +10,7 @@ exports.DefaultTokenProvider = void 0;
10
10
  * @internal
11
11
  */
12
12
  class DefaultTokenProvider {
13
+ jwt;
13
14
  constructor(jwt) {
14
15
  this.jwt = jwt;
15
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTokenProvider.js","sourceRoot":"","sources":["../src/defaultTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AAEH,MAAa,oBAAoB;IAChC,YAA6B,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAErC,KAAK,CAAC,iBAAiB;QAC7B,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;SACb,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB;QAC7B,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;SACb,CAAC;IACH,CAAC;CACD;AAhBD,oDAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenProvider, ITokenResponse } from \"./tokens.js\";\n\n/**\n * Default token provider in case the host does not provide one. It simply caches the provided jwt and returns it back.\n * @internal\n */\n\nexport class DefaultTokenProvider implements ITokenProvider {\n\tconstructor(private readonly jwt: string) {}\n\n\tpublic async fetchOrdererToken(): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.jwt,\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.jwt,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"defaultTokenProvider.js","sourceRoot":"","sources":["../src/defaultTokenProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AAEH,MAAa,oBAAoB;IACH;IAA7B,YAA6B,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAErC,KAAK,CAAC,iBAAiB;QAC7B,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;SACb,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,iBAAiB;QAC7B,OAAO;YACN,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;SACb,CAAC;IACH,CAAC;CACD;AAhBD,oDAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenProvider, ITokenResponse } from \"./tokens.js\";\n\n/**\n * Default token provider in case the host does not provide one. It simply caches the provided jwt and returns it back.\n * @internal\n */\n\nexport class DefaultTokenProvider implements ITokenProvider {\n\tconstructor(private readonly jwt: string) {}\n\n\tpublic async fetchOrdererToken(): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.jwt,\n\t\t};\n\t}\n\n\tpublic async fetchStorageToken(): Promise<ITokenResponse> {\n\t\treturn {\n\t\t\tfromCache: true,\n\t\t\tjwt: this.jwt,\n\t\t};\n\t}\n}\n"]}
@@ -20,6 +20,11 @@ const MaxBatchDeltas = 2000;
20
20
  * Storage service limited to only being able to fetch documents for a specific document
21
21
  */
22
22
  class DocumentDeltaStorageService {
23
+ tenantId;
24
+ id;
25
+ deltaStorageService;
26
+ documentStorageService;
27
+ logger;
23
28
  constructor(tenantId, id, deltaStorageService, documentStorageService, logger) {
24
29
  this.tenantId = tenantId;
25
30
  this.id = id;
@@ -28,6 +33,8 @@ class DocumentDeltaStorageService {
28
33
  this.logger = logger;
29
34
  this.logtailSha = documentStorageService.logTailSha;
30
35
  }
36
+ logtailSha;
37
+ snapshotOps;
31
38
  fetchMessages(fromTotal, toTotal, abortSignal, cachedOnly, fetchReason) {
32
39
  if (cachedOnly) {
33
40
  return internal_2.emptyMessageStream;
@@ -82,6 +89,11 @@ exports.DocumentDeltaStorageService = DocumentDeltaStorageService;
82
89
  * Provides access to the underlying delta storage on the server for routerlicious driver.
83
90
  */
84
91
  class DeltaStorageService {
92
+ url;
93
+ restWrapper;
94
+ logger;
95
+ getRestWrapper;
96
+ getDeltaStorageUrl;
85
97
  constructor(url, restWrapper, logger, getRestWrapper = async () => this.restWrapper, getDeltaStorageUrl = () => this.url) {
86
98
  this.url = url;
87
99
  this.restWrapper = restWrapper;
@@ -1 +1 @@
1
- {"version":3,"file":"deltaStorageService.js","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mEAAoF;AAQpF,oEAK+C;AAE/C,uEAA4E;AAK5E;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;GAEG;AACH,MAAa,2BAA2B;IACvC,YACkB,QAAgB,EAChB,EAAU,EACV,mBAAyC,EACzC,sBAA8C,EAC9C,MAA0B;QAJ1B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,wBAAmB,GAAnB,mBAAmB,CAAsB;QACzC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,WAAM,GAAN,MAAM,CAAoB;QAE3C,IAAI,CAAC,UAAU,GAAG,sBAAsB,CAAC,UAAU,CAAC;IACrD,CAAC;IAKD,aAAa,CACZ,SAAiB,EACjB,OAA2B,EAC3B,WAAyB,EACzB,UAAoB,EACpB,WAAoB;QAEpB,IAAI,UAAU,EAAE,CAAC;YAChB,OAAO,6BAAkB,CAAC;QAC3B,CAAC;QAED,IAAI,eAAe,GAAG,CAAC,CAAC;QACxB,IAAI,cAAc,GAAG,CAAC,CAAC;QACvB,MAAM,eAAe,GAAG,KAAK,EAC5B,IAAY,EACZ,EAAU,EACV,cAAwC,EACV,EAAE;YAChC,IAAI,CAAC,WAAW,GA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,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;CACD;AAhDD,kDAgDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { getW3CData, validateMessages } from \"@fluidframework/driver-base/internal\";\nimport type {\n\tIDeltaStorageService,\n\tIDeltasFetchResult,\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\temptyMessageStream,\n\treadAndParse,\n\trequestOps,\n\tstreamObserver,\n} from \"@fluidframework/driver-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { DocumentStorageService } from \"./documentStorageService.js\";\nimport type { RestWrapper } from \"./restWrapperBase.js\";\n\n/**\n * Maximum number of ops we can fetch at a time. This should be kept at 2k, as\n * server determines whether to try to fallback to long-term storage if the ops range requested is larger than\n * what they have locally available in short-term storage. So if we request 2k ops, they know it is not a\n * specific request and they don't fall to long term storage which takes time.\n * Please coordinate to AFR team if this value need to be changed.\n */\nconst MaxBatchDeltas = 2000;\n\n/**\n * Storage service limited to only being able to fetch documents for a specific document\n */\nexport class DocumentDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly deltaStorageService: IDeltaStorageService,\n\t\tprivate readonly documentStorageService: DocumentStorageService,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t) {\n\t\tthis.logtailSha = documentStorageService.logTailSha;\n\t}\n\n\tprivate logtailSha: string | undefined;\n\tprivate snapshotOps: ISequencedDocumentMessage[] | undefined;\n\n\tfetchMessages(\n\t\tfromTotal: number,\n\t\ttoTotal: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t\tfetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tif (cachedOnly) {\n\t\t\treturn emptyMessageStream;\n\t\t}\n\n\t\tlet opsFromSnapshot = 0;\n\t\tlet opsFromStorage = 0;\n\t\tconst requestCallback = async (\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\ttelemetryProps: ITelemetryBaseProperties,\n\t\t): Promise<IDeltasFetchResult> => {\n\t\t\tthis.snapshotOps = this.logtailSha\n\t\t\t\t? await readAndParse<ISequencedDocumentMessage[]>(\n\t\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\t\tthis.logtailSha,\n\t\t\t\t\t)\n\t\t\t\t: [];\n\t\t\tthis.logtailSha = undefined;\n\n\t\t\tif (this.snapshotOps !== undefined && this.snapshotOps.length > 0) {\n\t\t\t\tconst messages = this.snapshotOps.filter(\n\t\t\t\t\t(op) => op.sequenceNumber >= from && op.sequenceNumber < to,\n\t\t\t\t);\n\t\t\t\tvalidateMessages(\"snapshotOps\", messages, from, this.logger, false /* strict */);\n\t\t\t\tif (messages.length > 0 && messages[0].sequenceNumber === from) {\n\t\t\t\t\tthis.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n\t\t\t\t\topsFromSnapshot += messages.length;\n\t\t\t\t\treturn { messages, partialResult: true };\n\t\t\t\t}\n\t\t\t\tthis.snapshotOps = undefined;\n\t\t\t}\n\n\t\t\tconst ops = await this.deltaStorageService.get(\n\t\t\t\tthis.tenantId,\n\t\t\t\tthis.id,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t);\n\t\t\tvalidateMessages(\"storage\", ops.messages, from, this.logger, false /* strict */);\n\t\t\topsFromStorage += ops.messages.length;\n\t\t\treturn ops;\n\t\t};\n\n\t\tconst stream = requestOps(\n\t\t\tasync (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => {\n\t\t\t\tconst result = await requestCallback(from, to, telemetryProps);\n\t\t\t\t// Catch all case, just in case\n\t\t\t\tvalidateMessages(\"catch all\", result.messages, from, this.logger);\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t// Staging: starting with no concurrency, listening for feedback first.\n\t\t\t// In future releases we will switch to actual concurrency\n\t\t\t1, // concurrency\n\t\t\tfromTotal, // inclusive\n\t\t\ttoTotal, // exclusive\n\t\t\tMaxBatchDeltas,\n\t\t\tthis.logger,\n\t\t\tabortSignal,\n\t\t\tfetchReason,\n\t\t);\n\n\t\treturn streamObserver(stream, (result) => {\n\t\t\tif (result.done && opsFromSnapshot + opsFromStorage !== 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"CacheOpsRetrieved\",\n\t\t\t\t\topsFromSnapshot,\n\t\t\t\t\topsFromStorage,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Provides access to the underlying delta storage on the server for routerlicious driver.\n */\nexport class DeltaStorageService implements IDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly url: string,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t\tprivate readonly getRestWrapper: () => Promise<RestWrapper> = async () => this.restWrapper,\n\t\tprivate readonly getDeltaStorageUrl: () => string = () => this.url,\n\t) {}\n\n\tpublic async get(\n\t\ttenantId: string,\n\t\tid: string,\n\t\tfrom: number, // inclusive\n\t\tto: number, // exclusive\n\t\tfetchReason?: string,\n\t): Promise<IDeltasFetchResult> {\n\t\tconst ops = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"OpsFetch\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst restWrapper = await this.getRestWrapper();\n\t\t\t\tconst url = this.getDeltaStorageUrl();\n\t\t\t\tconst response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {\n\t\t\t\t\tfrom: from - 1,\n\t\t\t\t\tto,\n\t\t\t\t\tfetchReason: fetchReason ?? \"\",\n\t\t\t\t});\n\t\t\t\tevent.end({\n\t\t\t\t\tlength: response.content.length,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tfirstOpSeqNumber: response.content[0]?.sequenceNumber,\n\t\t\t\t\t\tlastOpSeqNumber: response.content[response.content.length - 1]?.sequenceNumber,\n\t\t\t\t\t}),\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\t// It is assumed that server always returns all the ops that it has in the range that was requested.\n\t\t// This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n\t\treturn { messages: ops, partialResult: false };\n\t}\n}\n"]}
1
+ {"version":3,"file":"deltaStorageService.js","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mEAAoF;AAQpF,oEAK+C;AAE/C,uEAA4E;AAK5E;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;GAEG;AACH,MAAa,2BAA2B;IAErB;IACA;IACA;IACA;IACA;IALlB,YACkB,QAAgB,EAChB,EAAU,EACV,mBAAyC,EACzC,sBAA8C,EAC9C,MAA0B;QAJ1B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,wBAAmB,GAAnB,mBAAmB,CAAsB;QACzC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,WAAM,GAAN,MAAM,CAAoB;QAE3C,IAAI,CAAC,UAAU,GAAG,sBAAsB,CAAC,UAAU,CAAC;IACrD,CAAC;IAEO,UAAU,CAAqB;IAC/B,WAAW,CAA0C;IAE7D,aAAa,CACZ,SAAiB,EACjB,OAA2B,EAC3B,WAAyB,EACzB,UAAoB,EACpB,WAAoB;QAEpB,IA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,CAAC,CAAC,EAAE,cAAc;iBAC9E,CAAC;gBACF,GAAG,QAAQ,CAAC,UAAU;gBACtB,GAAG,IAAA,qBAAU,EAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;aACpD,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,OAAO,CAAC;QACzB,CAAC,CACD,CAAC;QAEF,oGAAoG;QACpG,4GAA4G;QAC5G,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;CACD;AAhDD,kDAgDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { getW3CData, validateMessages } from \"@fluidframework/driver-base/internal\";\nimport type {\n\tIDeltaStorageService,\n\tIDeltasFetchResult,\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\temptyMessageStream,\n\treadAndParse,\n\trequestOps,\n\tstreamObserver,\n} from \"@fluidframework/driver-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { DocumentStorageService } from \"./documentStorageService.js\";\nimport type { RestWrapper } from \"./restWrapperBase.js\";\n\n/**\n * Maximum number of ops we can fetch at a time. This should be kept at 2k, as\n * server determines whether to try to fallback to long-term storage if the ops range requested is larger than\n * what they have locally available in short-term storage. So if we request 2k ops, they know it is not a\n * specific request and they don't fall to long term storage which takes time.\n * Please coordinate to AFR team if this value need to be changed.\n */\nconst MaxBatchDeltas = 2000;\n\n/**\n * Storage service limited to only being able to fetch documents for a specific document\n */\nexport class DocumentDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly deltaStorageService: IDeltaStorageService,\n\t\tprivate readonly documentStorageService: DocumentStorageService,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t) {\n\t\tthis.logtailSha = documentStorageService.logTailSha;\n\t}\n\n\tprivate logtailSha: string | undefined;\n\tprivate snapshotOps: ISequencedDocumentMessage[] | undefined;\n\n\tfetchMessages(\n\t\tfromTotal: number,\n\t\ttoTotal: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t\tfetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tif (cachedOnly) {\n\t\t\treturn emptyMessageStream;\n\t\t}\n\n\t\tlet opsFromSnapshot = 0;\n\t\tlet opsFromStorage = 0;\n\t\tconst requestCallback = async (\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\ttelemetryProps: ITelemetryBaseProperties,\n\t\t): Promise<IDeltasFetchResult> => {\n\t\t\tthis.snapshotOps = this.logtailSha\n\t\t\t\t? await readAndParse<ISequencedDocumentMessage[]>(\n\t\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\t\tthis.logtailSha,\n\t\t\t\t\t)\n\t\t\t\t: [];\n\t\t\tthis.logtailSha = undefined;\n\n\t\t\tif (this.snapshotOps !== undefined && this.snapshotOps.length > 0) {\n\t\t\t\tconst messages = this.snapshotOps.filter(\n\t\t\t\t\t(op) => op.sequenceNumber >= from && op.sequenceNumber < to,\n\t\t\t\t);\n\t\t\t\tvalidateMessages(\"snapshotOps\", messages, from, this.logger, false /* strict */);\n\t\t\t\tif (messages.length > 0 && messages[0].sequenceNumber === from) {\n\t\t\t\t\tthis.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n\t\t\t\t\topsFromSnapshot += messages.length;\n\t\t\t\t\treturn { messages, partialResult: true };\n\t\t\t\t}\n\t\t\t\tthis.snapshotOps = undefined;\n\t\t\t}\n\n\t\t\tconst ops = await this.deltaStorageService.get(\n\t\t\t\tthis.tenantId,\n\t\t\t\tthis.id,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t);\n\t\t\tvalidateMessages(\"storage\", ops.messages, from, this.logger, false /* strict */);\n\t\t\topsFromStorage += ops.messages.length;\n\t\t\treturn ops;\n\t\t};\n\n\t\tconst stream = requestOps(\n\t\t\tasync (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => {\n\t\t\t\tconst result = await requestCallback(from, to, telemetryProps);\n\t\t\t\t// Catch all case, just in case\n\t\t\t\tvalidateMessages(\"catch all\", result.messages, from, this.logger);\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t// Staging: starting with no concurrency, listening for feedback first.\n\t\t\t// In future releases we will switch to actual concurrency\n\t\t\t1, // concurrency\n\t\t\tfromTotal, // inclusive\n\t\t\ttoTotal, // exclusive\n\t\t\tMaxBatchDeltas,\n\t\t\tthis.logger,\n\t\t\tabortSignal,\n\t\t\tfetchReason,\n\t\t);\n\n\t\treturn streamObserver(stream, (result) => {\n\t\t\tif (result.done && opsFromSnapshot + opsFromStorage !== 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"CacheOpsRetrieved\",\n\t\t\t\t\topsFromSnapshot,\n\t\t\t\t\topsFromStorage,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Provides access to the underlying delta storage on the server for routerlicious driver.\n */\nexport class DeltaStorageService implements IDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly url: string,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t\tprivate readonly getRestWrapper: () => Promise<RestWrapper> = async () => this.restWrapper,\n\t\tprivate readonly getDeltaStorageUrl: () => string = () => this.url,\n\t) {}\n\n\tpublic async get(\n\t\ttenantId: string,\n\t\tid: string,\n\t\tfrom: number, // inclusive\n\t\tto: number, // exclusive\n\t\tfetchReason?: string,\n\t): Promise<IDeltasFetchResult> {\n\t\tconst ops = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"OpsFetch\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst restWrapper = await this.getRestWrapper();\n\t\t\t\tconst url = this.getDeltaStorageUrl();\n\t\t\t\tconst response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {\n\t\t\t\t\tfrom: from - 1,\n\t\t\t\t\tto,\n\t\t\t\t\tfetchReason: fetchReason ?? \"\",\n\t\t\t\t});\n\t\t\t\tevent.end({\n\t\t\t\t\tlength: response.content.length,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tfirstOpSeqNumber: response.content[0]?.sequenceNumber,\n\t\t\t\t\t\tlastOpSeqNumber: response.content[response.content.length - 1]?.sequenceNumber,\n\t\t\t\t\t}),\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\t// It is assumed that server always returns all the ops that it has in the range that was requested.\n\t\t// This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n\t\treturn { messages: ops, partialResult: false };\n\t}\n}\n"]}
@@ -13,6 +13,7 @@ const protocolVersions = ["^0.4.0", "^0.3.0", "^0.2.0", "^0.1.0"];
13
13
  * Wrapper over the shared one for driver specific translation.
14
14
  */
15
15
  class R11sDocumentDeltaConnection extends internal_1.DocumentDeltaConnection {
16
+ url;
16
17
  static async create(tenantId, id, token, io, client, url, logger, timeoutMs = 20000, enableLongPollingDowngrade = true) {
17
18
  const socket = io(url, {
18
19
  query: {
@@ -1 +1 @@
1
- {"version":3,"file":"documentDeltaConnection.js","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mEAA+E;AAY/E,mDAA+F;AAC/F,2DAAkE;AAGlE,MAAM,gBAAg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AAe,EAAE,KAAW,EAAE,QAAQ,GAAG,IAAI;QACxE,wDAAwD;QACxD,wGAAwG;QACxG,4CAA4C;QAC5C,OAAO,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,OAAO,KAAK,EAAE,OAAO,KAAK,QAAQ;YACrF,CAAC,CAAC,IAAA,0CAA0B,EAC1B,KAAyB,EACzB,OAAO,EACP,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CACrC;YACF,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAES,uBAAuB,CAAC,OAAe;QAChD,OAAO;YACN,GAAG,KAAK,CAAC,uBAAuB,CAAC,OAAO,CAAC;YACzC,GAAG,EAAE,IAAA,kCAAkB,EAAC,IAAI,CAAC,GAAG,EAAE,4BAAY,CAAC;SAC/C,CAAC;IACH,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,GAAoB;QAC5C,IACC,IAAI,CAAC,UAAU;YACf,IAAI,CAAC,MAAM,CAAC,SAAS;YACrB,GAAG,CAAC,OAAO,KAAK,kCAAuB,CAAC,wCAAwC,EAC/E,CAAC;YACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QACpF,CAAC;QACD,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACD;AA7FD,kEA6FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DocumentDeltaConnection } from \"@fluidframework/driver-base/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIAnyDriverError,\n\tIConnect,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { DriverErrorTelemetryProps } from \"@fluidframework/driver-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\n\nimport type { IR11sSocketError } from \"./errorUtils.js\";\nimport { errorObjectFromSocketError, getUrlForTelemetry, socketIoPath } from \"./errorUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport type { SocketIOClientStatic } from \"./socketModule.js\";\n\nconst protocolVersions = [\"^0.4.0\", \"^0.3.0\", \"^0.2.0\", \"^0.1.0\"];\n\n/**\n * Wrapper over the shared one for driver specific translation.\n */\nexport class R11sDocumentDeltaConnection extends DocumentDeltaConnection {\n\tpublic static async create(\n\t\ttenantId: string,\n\t\tid: string,\n\t\ttoken: string | null,\n\t\tio: typeof SocketIOClientStatic,\n\t\tclient: IClient,\n\t\turl: string,\n\t\tlogger: TelemetryLoggerExt,\n\t\ttimeoutMs = 20000,\n\t\tenableLongPollingDowngrade = true,\n\t): Promise<IDocumentDeltaConnection> {\n\t\tconst socket = io(url, {\n\t\t\tquery: {\n\t\t\t\tdocumentId: id,\n\t\t\t\ttenantId,\n\t\t\t},\n\t\t\treconnection: false,\n\t\t\t// Default to websocket connection, with long-polling disabled\n\t\t\ttransports: [\"websocket\"],\n\t\t\ttimeout: timeoutMs,\n\t\t});\n\n\t\tconst connectMessage: IConnect = {\n\t\t\tclient,\n\t\t\tid,\n\t\t\tmode: client.mode,\n\t\t\ttenantId,\n\t\t\ttoken, // Token is going to indicate tenant level information, etc...\n\t\t\tversions: protocolVersions,\n\t\t\trelayUserAgent: [client.details.environment, ` driverVersion:${driverVersion}`].join(\n\t\t\t\t\";\",\n\t\t\t),\n\t\t};\n\n\t\tconst deltaConnection = new R11sDocumentDeltaConnection(\n\t\t\tsocket,\n\t\t\tid,\n\t\t\tlogger,\n\t\t\turl,\n\t\t\tenableLongPollingDowngrade,\n\t\t);\n\n\t\tawait deltaConnection.initialize(connectMessage, timeoutMs);\n\t\treturn deltaConnection;\n\t}\n\n\tprivate constructor(\n\t\tsocket: Socket,\n\t\tdocumentId: string,\n\t\tlogger: TelemetryLoggerExt,\n\t\tprivate readonly url: string,\n\t\tenableLongPollingDowngrades?: boolean,\n\t) {\n\t\tsuper(socket, documentId, logger, enableLongPollingDowngrades);\n\t}\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(handler: string, error?: any, canRetry = true): IAnyDriverError {\n\t\t// Note: we suspect the incoming error object is either:\n\t\t// - a socketError: add it to the R11sError object for driver to be able to parse it and reason over it.\n\t\t// - anything else: let base class handle it\n\t\treturn canRetry && Number.isInteger(error?.code) && typeof error?.message === \"string\"\n\t\t\t? errorObjectFromSocketError(\n\t\t\t\t\terror as IR11sSocketError,\n\t\t\t\t\thandler,\n\t\t\t\t\tthis.getAdditionalErrorProps(handler),\n\t\t\t\t)\n\t\t\t: super.createErrorObject(handler, error, canRetry);\n\t}\n\n\tprotected getAdditionalErrorProps(handler: string): DriverErrorTelemetryProps {\n\t\treturn {\n\t\t\t...super.getAdditionalErrorProps(handler),\n\t\t\turl: getUrlForTelemetry(this.url, socketIoPath),\n\t\t};\n\t}\n\n\t/**\n\t * Disconnect from the websocket\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tif (\n\t\t\tthis.hasDetails &&\n\t\t\tthis.socket.connected &&\n\t\t\terr.message !== DocumentDeltaConnection.errorMessageForClientDisposeWithoutError\n\t\t) {\n\t\t\tthis.socket.emit(\"client_disconnect\", this.clientId, this.documentId, err.message);\n\t\t}\n\t\tsuper.disconnectCore(err);\n\t}\n}\n"]}
1
+ {"version":3,"file":"documentDeltaConnection.js","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mEAA+E;AAY/E,mDAA+F;AAC/F,2DAAkE;AAGlE,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,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ACxD,wGAAwG;QACxG,4CAA4C;QAC5C,OAAO,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,OAAO,KAAK,EAAE,OAAO,KAAK,QAAQ;YACrF,CAAC,CAAC,IAAA,0CAA0B,EAC1B,KAAyB,EACzB,OAAO,EACP,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CACrC;YACF,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAES,uBAAuB,CAAC,OAAe;QAChD,OAAO;YACN,GAAG,KAAK,CAAC,uBAAuB,CAAC,OAAO,CAAC;YACzC,GAAG,EAAE,IAAA,kCAAkB,EAAC,IAAI,CAAC,GAAG,EAAE,4BAAY,CAAC;SAC/C,CAAC;IACH,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,GAAoB;QAC5C,IACC,IAAI,CAAC,UAAU;YACf,IAAI,CAAC,MAAM,CAAC,SAAS;YACrB,GAAG,CAAC,OAAO,KAAK,kCAAuB,CAAC,wCAAwC,EAC/E,CAAC;YACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QACpF,CAAC;QACD,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACD;AA7FD,kEA6FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DocumentDeltaConnection } from \"@fluidframework/driver-base/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIAnyDriverError,\n\tIConnect,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { DriverErrorTelemetryProps } from \"@fluidframework/driver-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\n\nimport type { IR11sSocketError } from \"./errorUtils.js\";\nimport { errorObjectFromSocketError, getUrlForTelemetry, socketIoPath } from \"./errorUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport type { SocketIOClientStatic } from \"./socketModule.js\";\n\nconst protocolVersions = [\"^0.4.0\", \"^0.3.0\", \"^0.2.0\", \"^0.1.0\"];\n\n/**\n * Wrapper over the shared one for driver specific translation.\n */\nexport class R11sDocumentDeltaConnection extends DocumentDeltaConnection {\n\tpublic static async create(\n\t\ttenantId: string,\n\t\tid: string,\n\t\ttoken: string | null,\n\t\tio: typeof SocketIOClientStatic,\n\t\tclient: IClient,\n\t\turl: string,\n\t\tlogger: TelemetryLoggerExt,\n\t\ttimeoutMs = 20000,\n\t\tenableLongPollingDowngrade = true,\n\t): Promise<IDocumentDeltaConnection> {\n\t\tconst socket = io(url, {\n\t\t\tquery: {\n\t\t\t\tdocumentId: id,\n\t\t\t\ttenantId,\n\t\t\t},\n\t\t\treconnection: false,\n\t\t\t// Default to websocket connection, with long-polling disabled\n\t\t\ttransports: [\"websocket\"],\n\t\t\ttimeout: timeoutMs,\n\t\t});\n\n\t\tconst connectMessage: IConnect = {\n\t\t\tclient,\n\t\t\tid,\n\t\t\tmode: client.mode,\n\t\t\ttenantId,\n\t\t\ttoken, // Token is going to indicate tenant level information, etc...\n\t\t\tversions: protocolVersions,\n\t\t\trelayUserAgent: [client.details.environment, ` driverVersion:${driverVersion}`].join(\n\t\t\t\t\";\",\n\t\t\t),\n\t\t};\n\n\t\tconst deltaConnection = new R11sDocumentDeltaConnection(\n\t\t\tsocket,\n\t\t\tid,\n\t\t\tlogger,\n\t\t\turl,\n\t\t\tenableLongPollingDowngrade,\n\t\t);\n\n\t\tawait deltaConnection.initialize(connectMessage, timeoutMs);\n\t\treturn deltaConnection;\n\t}\n\n\tprivate constructor(\n\t\tsocket: Socket,\n\t\tdocumentId: string,\n\t\tlogger: TelemetryLoggerExt,\n\t\tprivate readonly url: string,\n\t\tenableLongPollingDowngrades?: boolean,\n\t) {\n\t\tsuper(socket, documentId, logger, enableLongPollingDowngrades);\n\t}\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(handler: string, error?: any, canRetry = true): IAnyDriverError {\n\t\t// Note: we suspect the incoming error object is either:\n\t\t// - a socketError: add it to the R11sError object for driver to be able to parse it and reason over it.\n\t\t// - anything else: let base class handle it\n\t\treturn canRetry && Number.isInteger(error?.code) && typeof error?.message === \"string\"\n\t\t\t? errorObjectFromSocketError(\n\t\t\t\t\terror as IR11sSocketError,\n\t\t\t\t\thandler,\n\t\t\t\t\tthis.getAdditionalErrorProps(handler),\n\t\t\t\t)\n\t\t\t: super.createErrorObject(handler, error, canRetry);\n\t}\n\n\tprotected getAdditionalErrorProps(handler: string): DriverErrorTelemetryProps {\n\t\treturn {\n\t\t\t...super.getAdditionalErrorProps(handler),\n\t\t\turl: getUrlForTelemetry(this.url, socketIoPath),\n\t\t};\n\t}\n\n\t/**\n\t * Disconnect from the websocket\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tif (\n\t\t\tthis.hasDetails &&\n\t\t\tthis.socket.connected &&\n\t\t\terr.message !== DocumentDeltaConnection.errorMessageForClientDisposeWithoutError\n\t\t) {\n\t\t\tthis.socket.emit(\"client_disconnect\", this.clientId, this.documentId, err.message);\n\t\t}\n\t\tsuper.disconnectCore(err);\n\t}\n}\n"]}
@@ -24,6 +24,28 @@ const socketModule_js_1 = require("./socketModule.js");
24
24
  * clients.
25
25
  */
26
26
  class DocumentService extends client_utils_1.TypedEventEmitter {
27
+ _resolvedUrl;
28
+ ordererUrl;
29
+ deltaStorageUrl;
30
+ deltaStreamUrl;
31
+ storageUrl;
32
+ logger;
33
+ tokenProvider;
34
+ tenantId;
35
+ documentId;
36
+ ordererRestWrapper;
37
+ documentStorageServicePolicies;
38
+ driverPolicies;
39
+ blobCache;
40
+ wholeSnapshotTreeCache;
41
+ shreddedSummaryTreeCache;
42
+ getSessionInfo;
43
+ storageRestWrapper;
44
+ storageTokenFetcher;
45
+ ordererTokenFetcher;
46
+ storageManager;
47
+ noCacheStorageManager;
48
+ _policies;
27
49
  get resolvedUrl() {
28
50
  return this._resolvedUrl;
29
51
  }
@@ -49,6 +71,7 @@ class DocumentService extends client_utils_1.TypedEventEmitter {
49
71
  this.storageTokenFetcher = storageTokenFetcher;
50
72
  this.ordererTokenFetcher = ordererTokenFetcher;
51
73
  }
74
+ documentStorageService;
52
75
  get policies() {
53
76
  return this._policies;
54
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"documentService.js","sourceRoot":"","sources":["../src/documentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AACjE,kEAA6D;AAY7D,oEAI+C;AAE/C,uEAAuF;AAKvF,qEAA4F;AAC5F,6EAA2E;AAC3E,2EAAqE;AACrE,mDAA2E;AAC3E,mDAA6C;AAC7C,iDAA2C;AAC3C,2EAAqE;AACrE,2DAAkE;AAGlE,qDAG0B;AAG1B,uDAAyD;AAGzD;;;GAGG;AACH,MAAa,eACZ,SAAQ,gCAAyC;IAQjD,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED,YACS,YAA0B,EACxB,UAAkB,EACpB,eAAuB,EACvB,cAAsB,EACtB,UAAkB,EACT,MAA0B,EACjC,aAA6B,EAC7B,QAAgB,EAChB,UAAkB,EAClB,kBAAmD,EAC5C,8BAA+D,EAC/D,cAA4C,EAC5C,SAAkC,EAClC,sBAAwD,EACxD,wBAAsD,EACtD,cAAsD,EAC/D,kBAAmD,EAC1C,mBAAiC,EACjC,mBAAiC;QAElD,KAAK,EAAE,CAAC;QApBA,iBAAY,GAAZ,YAAY,CAAc;QACxB,eAAU,GAAV,UAAU,CAAQ;QACpB,oBAAe,GAAf,eAAe,CAAQ;QACvB,mBAAc,GAAd,cAA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B,CAAC,SAAS,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC;QACnF,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA/PD,0CA+PC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceEvents,\n\tIDocumentServicePolicies,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tNetworkErrorBasic,\n\tRateLimiter,\n\tcanRetryOnError,\n} from \"@fluidframework/driver-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport { PerformanceEvent, wrapError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICache } from \"./cache.js\";\nimport type { INormalizedWholeSnapshot } from \"./contracts.js\";\nimport type { ISnapshotTreeVersion } from \"./definitions.js\";\nimport { DeltaStorageService, DocumentDeltaStorageService } from \"./deltaStorageService.js\";\nimport { R11sDocumentDeltaConnection } from \"./documentDeltaConnection.js\";\nimport { DocumentStorageService } from \"./documentStorageService.js\";\nimport { RouterliciousErrorTypes, type IR11sError } from \"./errorUtils.js\";\nimport { GitManager } from \"./gitManager.js\";\nimport { Historian } from \"./historian.js\";\nimport { NullBlobStorageService } from \"./nullBlobStorageService.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport type { IRouterliciousDriverPolicies } from \"./policies.js\";\nimport type { TokenFetcher } from \"./restWrapper.js\";\nimport {\n\tRouterliciousOrdererRestWrapper,\n\tRouterliciousStorageRestWrapper,\n} from \"./restWrapper.js\";\nimport type { RestWrapper } from \"./restWrapperBase.js\";\nimport type { IGetSessionInfoResponse } from \"./sessionInfoManager.js\";\nimport { SocketIOClientStatic } from \"./socketModule.js\";\nimport type { ITokenProvider } from \"./tokens.js\";\n\n/**\n * The DocumentService manages the Socket.IO connection and manages routing requests to connected\n * clients.\n */\nexport class DocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tprivate storageManager: GitManager | undefined;\n\tprivate noCacheStorageManager: GitManager | undefined;\n\n\tprivate _policies: IDocumentServicePolicies | undefined;\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this._resolvedUrl;\n\t}\n\n\tconstructor(\n\t\tprivate _resolvedUrl: IResolvedUrl,\n\t\tprotected ordererUrl: string,\n\t\tprivate deltaStorageUrl: string,\n\t\tprivate deltaStreamUrl: string,\n\t\tprivate storageUrl: string,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t\tprotected tokenProvider: ITokenProvider,\n\t\tprotected tenantId: string,\n\t\tprotected documentId: string,\n\t\tprotected ordererRestWrapper: RouterliciousOrdererRestWrapper,\n\t\tprivate readonly documentStorageServicePolicies: IDocumentStorageServicePolicies,\n\t\tprivate readonly driverPolicies: IRouterliciousDriverPolicies,\n\t\tprivate readonly blobCache: ICache<ArrayBufferLike>,\n\t\tprivate readonly wholeSnapshotTreeCache: ICache<INormalizedWholeSnapshot>,\n\t\tprivate readonly shreddedSummaryTreeCache: ICache<ISnapshotTreeVersion>,\n\t\tprivate readonly getSessionInfo: () => Promise<IGetSessionInfoResponse>,\n\t\tprivate storageRestWrapper: RouterliciousStorageRestWrapper,\n\t\tprivate readonly storageTokenFetcher: TokenFetcher,\n\t\tprivate readonly ordererTokenFetcher: TokenFetcher,\n\t) {\n\t\tsuper();\n\t}\n\n\tprivate documentStorageService: DocumentStorageService | undefined;\n\n\tpublic get policies(): IDocumentServicePolicies | undefined {\n\t\treturn this._policies;\n\t}\n\n\tpublic dispose(): void {}\n\n\t/**\n\t * Connects to a storage endpoint for snapshot service.\n\t *\n\t * @returns returns the document storage service for routerlicious driver.\n\t */\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\tif (this.documentStorageService !== undefined) {\n\t\t\treturn this.documentStorageService;\n\t\t}\n\n\t\tif (this.storageUrl === undefined) {\n\t\t\treturn new NullBlobStorageService();\n\t\t}\n\n\t\tconst getStorageManager = async (disableCache?: boolean): Promise<GitManager> => {\n\t\t\tconst refreshed = await this.refreshSessionInfoIfNeeded();\n\t\t\tif (!this.storageManager || !this.noCacheStorageManager || refreshed) {\n\t\t\t\tif (refreshed) {\n\t\t\t\t\tconst rateLimiter = new RateLimiter(\n\t\t\t\t\t\tthis.driverPolicies.maxConcurrentStorageRequests,\n\t\t\t\t\t);\n\t\t\t\t\tthis.storageRestWrapper = RouterliciousStorageRestWrapper.load(\n\t\t\t\t\t\tthis.tenantId,\n\t\t\t\t\t\tthis.storageTokenFetcher,\n\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\trateLimiter,\n\t\t\t\t\t\tthis.driverPolicies.enableRestLess,\n\t\t\t\t\t\tthis.storageUrl /* baseUrl */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst historian = new Historian(true, false, this.storageRestWrapper);\n\t\t\t\tthis.storageManager = new GitManager(historian);\n\t\t\t\tconst noCacheHistorian = new Historian(true, true, this.storageRestWrapper);\n\t\t\t\tthis.noCacheStorageManager = new GitManager(noCacheHistorian);\n\t\t\t}\n\n\t\t\treturn disableCache ? this.noCacheStorageManager : this.storageManager;\n\t\t};\n\t\t// Initialize storageManager and noCacheStorageManager\n\t\tconst storageManager = await getStorageManager();\n\t\tconst noCacheStorageManager = await getStorageManager(true);\n\t\tthis.documentStorageService = new DocumentStorageService(\n\t\t\tthis.documentId,\n\t\t\tstorageManager,\n\t\t\tthis.logger,\n\t\t\tthis.documentStorageServicePolicies,\n\t\t\tthis.driverPolicies,\n\t\t\tthis.blobCache,\n\t\t\tthis.wholeSnapshotTreeCache,\n\t\t\tthis.shreddedSummaryTreeCache,\n\t\t\tnoCacheStorageManager,\n\t\t\tgetStorageManager,\n\t\t);\n\t\treturn this.documentStorageService;\n\t}\n\n\t/**\n\t * Connects to a delta storage endpoint for getting ops between a range.\n\t *\n\t * @returns returns the document delta storage service for routerlicious driver.\n\t */\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\tawait this.connectToStorage();\n\t\tassert(!!this.documentStorageService, 0x0b1 /* \"Storage service not initialized\" */);\n\n\t\tconst getRestWrapper = async (): Promise<RestWrapper> => {\n\t\t\tconst refreshed = await this.refreshSessionInfoIfNeeded();\n\n\t\t\tif (refreshed) {\n\t\t\t\tconst rateLimiter = new RateLimiter(this.driverPolicies.maxConcurrentOrdererRequests);\n\t\t\t\tthis.ordererRestWrapper = RouterliciousOrdererRestWrapper.load(\n\t\t\t\t\tthis.ordererTokenFetcher,\n\t\t\t\t\tthis.logger,\n\t\t\t\t\trateLimiter,\n\t\t\t\t\tthis.driverPolicies.enableRestLess,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn this.ordererRestWrapper;\n\t\t};\n\t\tconst restWrapper = await getRestWrapper();\n\t\tconst deltaStorageService = new DeltaStorageService(\n\t\t\tthis.deltaStorageUrl,\n\t\t\trestWrapper,\n\t\t\tthis.logger,\n\t\t\tgetRestWrapper,\n\t\t\t() => this.deltaStorageUrl,\n\t\t);\n\t\treturn new DocumentDeltaStorageService(\n\t\t\tthis.tenantId,\n\t\t\tthis.documentId,\n\t\t\tdeltaStorageService,\n\t\t\tthis.documentStorageService,\n\t\t\tthis.logger,\n\t\t);\n\t}\n\n\t/**\n\t * Connects to a delta stream endpoint for emitting ops.\n\t *\n\t * @returns returns the document delta stream service for routerlicious driver.\n\t */\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\tconst connect = async (refreshToken?: boolean): Promise<IDocumentDeltaConnection> => {\n\t\t\tlet ordererToken = await this.ordererRestWrapper.getToken();\n\t\t\tawait this.refreshSessionInfoIfNeeded();\n\n\t\t\tif (refreshToken) {\n\t\t\t\tordererToken = await PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.logger,\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"GetDeltaStreamToken\",\n\t\t\t\t\t\tdocId: this.documentId,\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\trefreshToken,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tthis.tokenProvider\n\t\t\t\t\t\t\t.fetchOrdererToken(this.tenantId, this.documentId, refreshToken)\n\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t(newOrdererToken) => {\n\t\t\t\t\t\t\t\t\tthis.ordererRestWrapper.setToken(newOrdererToken);\n\t\t\t\t\t\t\t\t\treturn newOrdererToken;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t\t\tconst tokenError = wrapError(\n\t\t\t\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t\t\t\t(errorMessage) =>\n\t\t\t\t\t\t\t\t\t\t\tnew NetworkErrorBasic(\n\t\t\t\t\t\t\t\t\t\t\t\t`The Host-provided token fetcher threw an error`,\n\t\t\t\t\t\t\t\t\t\t\t\tRouterliciousErrorTypes.fetchTokenError,\n\t\t\t\t\t\t\t\t\t\t\t\tcanRetryOnError(error),\n\t\t\t\t\t\t\t\t\t\t\t\t{ errorMessage, driverVersion },\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tthrow tokenError;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"ConnectToDeltaStream\",\n\t\t\t\t\tdocId: this.documentId,\n\t\t\t\t},\n\t\t\t\tasync () => {\n\t\t\t\t\treturn R11sDocumentDeltaConnection.create(\n\t\t\t\t\t\tthis.tenantId,\n\t\t\t\t\t\tthis.documentId,\n\t\t\t\t\t\tordererToken.jwt,\n\t\t\t\t\t\tSocketIOClientStatic,\n\t\t\t\t\t\tclient,\n\t\t\t\t\t\tthis.deltaStreamUrl,\n\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\tundefined /* timeoutMs */,\n\t\t\t\t\t\tthis.driverPolicies.enableLongPollingDowngrade,\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t);\n\t\t};\n\n\t\t// Attempt to establish connection.\n\t\t// Retry with new token on authorization error; otherwise, allow container layer to handle.\n\t\ttry {\n\t\t\tconst connection = await connect();\n\t\t\t// Enable single-commit summaries via driver policy based on the enable_single_commit_summary flag which maybe provided by the service during connection.\n\t\t\t// summarizeProtocolTree flag is used by the loader layer to attach protocol tree along with the summary required in the single-commit summaries.\n\t\t\tconst shouldSummarizeProtocolTree = (connection as R11sDocumentDeltaConnection).details\n\t\t\t\t?.supportedFeatures?.enable_single_commit_summary\n\t\t\t\t? true\n\t\t\t\t: false;\n\t\t\tthis._policies = {\n\t\t\t\t...this._policies,\n\t\t\t\tsummarizeProtocolTree: shouldSummarizeProtocolTree,\n\t\t\t};\n\n\t\t\treturn connection;\n\t\t} catch (error: any) {\n\t\t\tif (\n\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\terror !== null &&\n\t\t\t\t(error as Partial<IR11sError>).errorType === RouterliciousErrorTypes.authorizationError\n\t\t\t) {\n\t\t\t\t// Fetch new token and retry once,\n\t\t\t\t// otherwise 401/403 will be bubbled up as non-retriable AuthorizationError.\n\t\t\t\treturn connect(true /* refreshToken */);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Refresh session info URLs if necessary.\n\t * @returns boolean - true if session info was refreshed\n\t */\n\tprivate async refreshSessionInfoIfNeeded(): Promise<boolean> {\n\t\tconst response = await this.getSessionInfo();\n\t\tif (!response.refreshed) {\n\t\t\treturn false;\n\t\t}\n\t\tconst fluidResolvedUrl = response.resolvedUrl;\n\t\tthis._resolvedUrl = fluidResolvedUrl;\n\t\tthis.storageUrl = fluidResolvedUrl.endpoints.storageUrl;\n\t\tthis.ordererUrl = fluidResolvedUrl.endpoints.ordererUrl;\n\t\tthis.deltaStorageUrl = fluidResolvedUrl.endpoints.deltaStorageUrl;\n\t\tthis.deltaStreamUrl = fluidResolvedUrl.endpoints.deltaStreamUrl ?? this.ordererUrl;\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"documentService.js","sourceRoot":"","sources":["../src/documentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AACjE,kEAA6D;AAY7D,oEAI+C;AAE/C,uEAAuF;AAKvF,qEAA4F;AAC5F,6EAA2E;AAC3E,2EAAqE;AACrE,mDAA2E;AAC3E,mDAA6C;AAC7C,iDAA2C;AAC3C,2EAAqE;AACrE,2DAAkE;AAGlE,qDAG0B;AAG1B,uDAAyD;AAGzD;;;GAGG;AACH,MAAa,eACZ,SAAQ,gCAAyC;IAaxC;IACE;IACF;IACA;IACA;IACS;IACP;IACA;IACA;IACA;IACO;IACA;IACA;IACA;IACA;IACA;IACT;IACS;IACA;IA5BV,cAAc,CAAyB;IACvC,qBAAqB,CAAyB;IAE9C,SAAS,CAAuC;IAExD,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED,YACS,YAA0B,EACxB,UAAkB,EACpB,eAAuB,EACvB,cAAsB,EACtB,UAAkB,EACT,MAA0B,EACjC,aAA6B,EAC7B,QAAgB,EAChB,UAAkB,EAClB,kBAAmD,EAC5C,8BAA+D,EAC/D,cAA4C,EAC5C,SAAkC,EAClC,sBAAwD,EACxD,wBAAsD,EACtD,cAAsD,EAC/D,kBAAmD,EAC1C,mBAAiC,EACjC,mBAAiC;QAElD,KAAK,EAAE,CAAC;QApBA,iBAAY,GAA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AS,CAAC,UAAU,CAAC;QACxD,IAAI,CAAC,eAAe,GAAG,gBAAgB,CAAC,SAAS,CAAC,eAAe,CAAC;QAClE,IAAI,CAAC,cAAc,GAAG,gBAAgB,CAAC,SAAS,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC;QACnF,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA/PD,0CA+PC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceEvents,\n\tIDocumentServicePolicies,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tNetworkErrorBasic,\n\tRateLimiter,\n\tcanRetryOnError,\n} from \"@fluidframework/driver-utils/internal\";\nimport type { TelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\nimport { PerformanceEvent, wrapError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICache } from \"./cache.js\";\nimport type { INormalizedWholeSnapshot } from \"./contracts.js\";\nimport type { ISnapshotTreeVersion } from \"./definitions.js\";\nimport { DeltaStorageService, DocumentDeltaStorageService } from \"./deltaStorageService.js\";\nimport { R11sDocumentDeltaConnection } from \"./documentDeltaConnection.js\";\nimport { DocumentStorageService } from \"./documentStorageService.js\";\nimport { RouterliciousErrorTypes, type IR11sError } from \"./errorUtils.js\";\nimport { GitManager } from \"./gitManager.js\";\nimport { Historian } from \"./historian.js\";\nimport { NullBlobStorageService } from \"./nullBlobStorageService.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport type { IRouterliciousDriverPolicies } from \"./policies.js\";\nimport type { TokenFetcher } from \"./restWrapper.js\";\nimport {\n\tRouterliciousOrdererRestWrapper,\n\tRouterliciousStorageRestWrapper,\n} from \"./restWrapper.js\";\nimport type { RestWrapper } from \"./restWrapperBase.js\";\nimport type { IGetSessionInfoResponse } from \"./sessionInfoManager.js\";\nimport { SocketIOClientStatic } from \"./socketModule.js\";\nimport type { ITokenProvider } from \"./tokens.js\";\n\n/**\n * The DocumentService manages the Socket.IO connection and manages routing requests to connected\n * clients.\n */\nexport class DocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tprivate storageManager: GitManager | undefined;\n\tprivate noCacheStorageManager: GitManager | undefined;\n\n\tprivate _policies: IDocumentServicePolicies | undefined;\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this._resolvedUrl;\n\t}\n\n\tconstructor(\n\t\tprivate _resolvedUrl: IResolvedUrl,\n\t\tprotected ordererUrl: string,\n\t\tprivate deltaStorageUrl: string,\n\t\tprivate deltaStreamUrl: string,\n\t\tprivate storageUrl: string,\n\t\tprivate readonly logger: TelemetryLoggerExt,\n\t\tprotected tokenProvider: ITokenProvider,\n\t\tprotected tenantId: string,\n\t\tprotected documentId: string,\n\t\tprotected ordererRestWrapper: RouterliciousOrdererRestWrapper,\n\t\tprivate readonly documentStorageServicePolicies: IDocumentStorageServicePolicies,\n\t\tprivate readonly driverPolicies: IRouterliciousDriverPolicies,\n\t\tprivate readonly blobCache: ICache<ArrayBufferLike>,\n\t\tprivate readonly wholeSnapshotTreeCache: ICache<INormalizedWholeSnapshot>,\n\t\tprivate readonly shreddedSummaryTreeCache: ICache<ISnapshotTreeVersion>,\n\t\tprivate readonly getSessionInfo: () => Promise<IGetSessionInfoResponse>,\n\t\tprivate storageRestWrapper: RouterliciousStorageRestWrapper,\n\t\tprivate readonly storageTokenFetcher: TokenFetcher,\n\t\tprivate readonly ordererTokenFetcher: TokenFetcher,\n\t) {\n\t\tsuper();\n\t}\n\n\tprivate documentStorageService: DocumentStorageService | undefined;\n\n\tpublic get policies(): IDocumentServicePolicies | undefined {\n\t\treturn this._policies;\n\t}\n\n\tpublic dispose(): void {}\n\n\t/**\n\t * Connects to a storage endpoint for snapshot service.\n\t *\n\t * @returns returns the document storage service for routerlicious driver.\n\t */\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\tif (this.documentStorageService !== undefined) {\n\t\t\treturn this.documentStorageService;\n\t\t}\n\n\t\tif (this.storageUrl === undefined) {\n\t\t\treturn new NullBlobStorageService();\n\t\t}\n\n\t\tconst getStorageManager = async (disableCache?: boolean): Promise<GitManager> => {\n\t\t\tconst refreshed = await this.refreshSessionInfoIfNeeded();\n\t\t\tif (!this.storageManager || !this.noCacheStorageManager || refreshed) {\n\t\t\t\tif (refreshed) {\n\t\t\t\t\tconst rateLimiter = new RateLimiter(\n\t\t\t\t\t\tthis.driverPolicies.maxConcurrentStorageRequests,\n\t\t\t\t\t);\n\t\t\t\t\tthis.storageRestWrapper = RouterliciousStorageRestWrapper.load(\n\t\t\t\t\t\tthis.tenantId,\n\t\t\t\t\t\tthis.storageTokenFetcher,\n\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\trateLimiter,\n\t\t\t\t\t\tthis.driverPolicies.enableRestLess,\n\t\t\t\t\t\tthis.storageUrl /* baseUrl */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst historian = new Historian(true, false, this.storageRestWrapper);\n\t\t\t\tthis.storageManager = new GitManager(historian);\n\t\t\t\tconst noCacheHistorian = new Historian(true, true, this.storageRestWrapper);\n\t\t\t\tthis.noCacheStorageManager = new GitManager(noCacheHistorian);\n\t\t\t}\n\n\t\t\treturn disableCache ? this.noCacheStorageManager : this.storageManager;\n\t\t};\n\t\t// Initialize storageManager and noCacheStorageManager\n\t\tconst storageManager = await getStorageManager();\n\t\tconst noCacheStorageManager = await getStorageManager(true);\n\t\tthis.documentStorageService = new DocumentStorageService(\n\t\t\tthis.documentId,\n\t\t\tstorageManager,\n\t\t\tthis.logger,\n\t\t\tthis.documentStorageServicePolicies,\n\t\t\tthis.driverPolicies,\n\t\t\tthis.blobCache,\n\t\t\tthis.wholeSnapshotTreeCache,\n\t\t\tthis.shreddedSummaryTreeCache,\n\t\t\tnoCacheStorageManager,\n\t\t\tgetStorageManager,\n\t\t);\n\t\treturn this.documentStorageService;\n\t}\n\n\t/**\n\t * Connects to a delta storage endpoint for getting ops between a range.\n\t *\n\t * @returns returns the document delta storage service for routerlicious driver.\n\t */\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\tawait this.connectToStorage();\n\t\tassert(!!this.documentStorageService, 0x0b1 /* \"Storage service not initialized\" */);\n\n\t\tconst getRestWrapper = async (): Promise<RestWrapper> => {\n\t\t\tconst refreshed = await this.refreshSessionInfoIfNeeded();\n\n\t\t\tif (refreshed) {\n\t\t\t\tconst rateLimiter = new RateLimiter(this.driverPolicies.maxConcurrentOrdererRequests);\n\t\t\t\tthis.ordererRestWrapper = RouterliciousOrdererRestWrapper.load(\n\t\t\t\t\tthis.ordererTokenFetcher,\n\t\t\t\t\tthis.logger,\n\t\t\t\t\trateLimiter,\n\t\t\t\t\tthis.driverPolicies.enableRestLess,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn this.ordererRestWrapper;\n\t\t};\n\t\tconst restWrapper = await getRestWrapper();\n\t\tconst deltaStorageService = new DeltaStorageService(\n\t\t\tthis.deltaStorageUrl,\n\t\t\trestWrapper,\n\t\t\tthis.logger,\n\t\t\tgetRestWrapper,\n\t\t\t() => this.deltaStorageUrl,\n\t\t);\n\t\treturn new DocumentDeltaStorageService(\n\t\t\tthis.tenantId,\n\t\t\tthis.documentId,\n\t\t\tdeltaStorageService,\n\t\t\tthis.documentStorageService,\n\t\t\tthis.logger,\n\t\t);\n\t}\n\n\t/**\n\t * Connects to a delta stream endpoint for emitting ops.\n\t *\n\t * @returns returns the document delta stream service for routerlicious driver.\n\t */\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\tconst connect = async (refreshToken?: boolean): Promise<IDocumentDeltaConnection> => {\n\t\t\tlet ordererToken = await this.ordererRestWrapper.getToken();\n\t\t\tawait this.refreshSessionInfoIfNeeded();\n\n\t\t\tif (refreshToken) {\n\t\t\t\tordererToken = await PerformanceEvent.timedExecAsync(\n\t\t\t\t\tthis.logger,\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"GetDeltaStreamToken\",\n\t\t\t\t\t\tdocId: this.documentId,\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\trefreshToken,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tthis.tokenProvider\n\t\t\t\t\t\t\t.fetchOrdererToken(this.tenantId, this.documentId, refreshToken)\n\t\t\t\t\t\t\t.then(\n\t\t\t\t\t\t\t\t(newOrdererToken) => {\n\t\t\t\t\t\t\t\t\tthis.ordererRestWrapper.setToken(newOrdererToken);\n\t\t\t\t\t\t\t\t\treturn newOrdererToken;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t\t\tconst tokenError = wrapError(\n\t\t\t\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t\t\t\t(errorMessage) =>\n\t\t\t\t\t\t\t\t\t\t\tnew NetworkErrorBasic(\n\t\t\t\t\t\t\t\t\t\t\t\t`The Host-provided token fetcher threw an error`,\n\t\t\t\t\t\t\t\t\t\t\t\tRouterliciousErrorTypes.fetchTokenError,\n\t\t\t\t\t\t\t\t\t\t\t\tcanRetryOnError(error),\n\t\t\t\t\t\t\t\t\t\t\t\t{ errorMessage, driverVersion },\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tthrow tokenError;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"ConnectToDeltaStream\",\n\t\t\t\t\tdocId: this.documentId,\n\t\t\t\t},\n\t\t\t\tasync () => {\n\t\t\t\t\treturn R11sDocumentDeltaConnection.create(\n\t\t\t\t\t\tthis.tenantId,\n\t\t\t\t\t\tthis.documentId,\n\t\t\t\t\t\tordererToken.jwt,\n\t\t\t\t\t\tSocketIOClientStatic,\n\t\t\t\t\t\tclient,\n\t\t\t\t\t\tthis.deltaStreamUrl,\n\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\tundefined /* timeoutMs */,\n\t\t\t\t\t\tthis.driverPolicies.enableLongPollingDowngrade,\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t);\n\t\t};\n\n\t\t// Attempt to establish connection.\n\t\t// Retry with new token on authorization error; otherwise, allow container layer to handle.\n\t\ttry {\n\t\t\tconst connection = await connect();\n\t\t\t// Enable single-commit summaries via driver policy based on the enable_single_commit_summary flag which maybe provided by the service during connection.\n\t\t\t// summarizeProtocolTree flag is used by the loader layer to attach protocol tree along with the summary required in the single-commit summaries.\n\t\t\tconst shouldSummarizeProtocolTree = (connection as R11sDocumentDeltaConnection).details\n\t\t\t\t?.supportedFeatures?.enable_single_commit_summary\n\t\t\t\t? true\n\t\t\t\t: false;\n\t\t\tthis._policies = {\n\t\t\t\t...this._policies,\n\t\t\t\tsummarizeProtocolTree: shouldSummarizeProtocolTree,\n\t\t\t};\n\n\t\t\treturn connection;\n\t\t} catch (error: any) {\n\t\t\tif (\n\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\terror !== null &&\n\t\t\t\t(error as Partial<IR11sError>).errorType === RouterliciousErrorTypes.authorizationError\n\t\t\t) {\n\t\t\t\t// Fetch new token and retry once,\n\t\t\t\t// otherwise 401/403 will be bubbled up as non-retriable AuthorizationError.\n\t\t\t\treturn connect(true /* refreshToken */);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Refresh session info URLs if necessary.\n\t * @returns boolean - true if session info was refreshed\n\t */\n\tprivate async refreshSessionInfoIfNeeded(): Promise<boolean> {\n\t\tconst response = await this.getSessionInfo();\n\t\tif (!response.refreshed) {\n\t\t\treturn false;\n\t\t}\n\t\tconst fluidResolvedUrl = response.resolvedUrl;\n\t\tthis._resolvedUrl = fluidResolvedUrl;\n\t\tthis.storageUrl = fluidResolvedUrl.endpoints.storageUrl;\n\t\tthis.ordererUrl = fluidResolvedUrl.endpoints.ordererUrl;\n\t\tthis.deltaStorageUrl = fluidResolvedUrl.endpoints.deltaStorageUrl;\n\t\tthis.deltaStreamUrl = fluidResolvedUrl.endpoints.deltaStreamUrl ?? this.ordererUrl;\n\t\treturn true;\n\t}\n}\n"]}
@@ -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 type { ILayerCompatDetails, IProvideLayerCompatDetails } from "@fluid-internal/client-utils";
5
+ import type { ILayerCompatDetails, IProvideLayerCompatDetails, ILayerCompatSupportRequirements, IProvideLayerCompatSupportRequirements } from "@fluid-internal/client-utils";
6
6
  import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
7
  import type { ISummaryTree } from "@fluidframework/driver-definitions";
8
8
  import type { IDocumentService, IDocumentServiceFactory, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
@@ -14,7 +14,7 @@ import type { ITokenProvider } from "./tokens.js";
14
14
  * use the routerlicious implementation.
15
15
  * @internal
16
16
  */
17
- export declare class RouterliciousDocumentServiceFactory implements IDocumentServiceFactory, IProvideLayerCompatDetails {
17
+ export declare class RouterliciousDocumentServiceFactory implements IDocumentServiceFactory, IProvideLayerCompatDetails, IProvideLayerCompatSupportRequirements {
18
18
  private readonly tokenProvider;
19
19
  private readonly driverPolicies;
20
20
  private readonly blobCache;
@@ -27,6 +27,12 @@ export declare class RouterliciousDocumentServiceFactory implements IDocumentSer
27
27
  * for validating Loader-Driver compatibility.
28
28
  */
29
29
  get ILayerCompatDetails(): ILayerCompatDetails;
30
+ /**
31
+ * The requirements that the Loader layer must meet to be compatible with this Routerlicious Driver. This is
32
+ * exposed to the Loader layer so that it can validate Loader / Driver compatibility on this Driver's behalf
33
+ * (the Driver has no reference to the Loader to validate it directly).
34
+ */
35
+ get ILayerCompatSupportRequirements(): ILayerCompatSupportRequirements;
30
36
  /**
31
37
  * {@inheritDoc @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer}
32
38
  *
@@ -1 +1 @@
1
- {"version":3,"file":"documentServiceFactory.d.ts","sourceRoot":"","sources":["../src/documentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,mBAAmB,EACnB,0BAA0B,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAEX,gBAAgB,EAChB,uBAAuB,EAEvB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAQrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAUvE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAUlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAgBlD;;;;GAIG;AACH,qBAAa,mCACZ,YAAW,uBAAuB,EAAE,0BAA0B;IAS7D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAP/B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA+B;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAqD;IAC5F,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAiD;IAC1F,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;gBAGt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