@fluidframework/odsp-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.
Files changed (258) hide show
  1. package/CHANGELOG.md +92 -2
  2. package/README.md +53 -50
  3. package/api-extractor/api-extractor-lint-pointInTime.cjs.json +5 -0
  4. package/api-extractor/api-extractor-lint-pointInTime.esm.json +5 -0
  5. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  6. package/api-extractor/api-extractor-report.pointInTime.json +9 -0
  7. package/api-report/odsp-driver.legacy.alpha.api.md +28 -3
  8. package/api-report/odsp-driver.legacy.beta.api.md +28 -3
  9. package/api-report/odsp-driver.point-in-time.legacy.beta.api.md +117 -0
  10. package/dist/ReadBufferUtils.js +2 -1
  11. package/dist/ReadBufferUtils.js.map +1 -1
  12. package/dist/WriteBufferUtils.js +4 -6
  13. package/dist/WriteBufferUtils.js.map +1 -1
  14. package/dist/checkUrl.js +1 -2
  15. package/dist/checkUrl.js.map +1 -1
  16. package/dist/compactSnapshotParser.d.ts.map +1 -1
  17. package/dist/compactSnapshotParser.js +5 -4
  18. package/dist/compactSnapshotParser.js.map +1 -1
  19. package/dist/compactSnapshotWriter.js +1 -2
  20. package/dist/compactSnapshotWriter.js.map +1 -1
  21. package/dist/createFile/createFile.js +4 -5
  22. package/dist/createFile/createFile.js.map +1 -1
  23. package/dist/createFile/createNewContainerOnExistingFile.js +1 -2
  24. package/dist/createFile/createNewContainerOnExistingFile.js.map +1 -1
  25. package/dist/createFile/createNewUtils.d.ts.map +1 -1
  26. package/dist/createFile/createNewUtils.js +4 -5
  27. package/dist/createFile/createNewUtils.js.map +1 -1
  28. package/dist/createFile/index.js +1 -2
  29. package/dist/createFile/index.js.map +1 -1
  30. package/dist/createOdspCreateContainerRequest.js +1 -2
  31. package/dist/createOdspCreateContainerRequest.js.map +1 -1
  32. package/dist/createOdspUrl.js +1 -2
  33. package/dist/createOdspUrl.js.map +1 -1
  34. package/dist/epochTracker.d.ts.map +1 -1
  35. package/dist/epochTracker.js +17 -6
  36. package/dist/epochTracker.js.map +1 -1
  37. package/dist/fetchSnapshot.d.ts.map +1 -1
  38. package/dist/fetchSnapshot.js +5 -5
  39. package/dist/fetchSnapshot.js.map +1 -1
  40. package/dist/getFileLink.d.ts.map +1 -1
  41. package/dist/getQueryString.js +1 -2
  42. package/dist/getQueryString.js.map +1 -1
  43. package/dist/getUrlAndHeadersWithAuth.js +1 -2
  44. package/dist/getUrlAndHeadersWithAuth.js.map +1 -1
  45. package/dist/index.d.ts +3 -4
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +3 -5
  48. package/dist/index.js.map +1 -1
  49. package/dist/legacy.d.ts +4 -1
  50. package/dist/legacyAlpha.d.ts +4 -1
  51. package/dist/localOdspDriver/localOdspDeltaStorageService.js +2 -0
  52. package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  53. package/dist/localOdspDriver/localOdspDocumentService.js +5 -1
  54. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  55. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +2 -1
  56. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  57. package/dist/localOdspDriver/localOdspDocumentStorageManager.js +4 -1
  58. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  59. package/dist/mockify.js +2 -2
  60. package/dist/mockify.js.map +1 -1
  61. package/dist/odspCache.js +7 -8
  62. package/dist/odspCache.js.map +1 -1
  63. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  64. package/dist/odspDelayLoadedDeltaStream.js +42 -26
  65. package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
  66. package/dist/odspDeltaStorageService.js +14 -1
  67. package/dist/odspDeltaStorageService.js.map +1 -1
  68. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  69. package/dist/odspDocumentDeltaConnection.js +58 -41
  70. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  71. package/dist/odspDocumentService.js +16 -1
  72. package/dist/odspDocumentService.js.map +1 -1
  73. package/dist/odspDocumentServiceFactory.d.ts +30 -1
  74. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  75. package/dist/odspDocumentServiceFactory.js +30 -2
  76. package/dist/odspDocumentServiceFactory.js.map +1 -1
  77. package/dist/odspDocumentServiceFactoryCore.d.ts +83 -3
  78. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  79. package/dist/odspDocumentServiceFactoryCore.js +38 -12
  80. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  81. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  82. package/dist/odspDocumentStorageManager.js +31 -13
  83. package/dist/odspDocumentStorageManager.js.map +1 -1
  84. package/dist/odspDocumentStorageServiceBase.js +23 -20
  85. package/dist/odspDocumentStorageServiceBase.js.map +1 -1
  86. package/dist/odspDriverUrlResolver.js +2 -2
  87. package/dist/odspDriverUrlResolver.js.map +1 -1
  88. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  89. package/dist/odspDriverUrlResolverForShareLink.js +6 -1
  90. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  91. package/dist/odspError.js +1 -2
  92. package/dist/odspError.js.map +1 -1
  93. package/dist/odspFluidFileLink.js +4 -4
  94. package/dist/odspFluidFileLink.js.map +1 -1
  95. package/dist/odspLayerCompatState.d.ts +8 -1
  96. package/dist/odspLayerCompatState.d.ts.map +1 -1
  97. package/dist/odspLayerCompatState.js +20 -1
  98. package/dist/odspLayerCompatState.js.map +1 -1
  99. package/dist/odspLocationRedirection.js +1 -2
  100. package/dist/odspLocationRedirection.js.map +1 -1
  101. package/dist/odspPublicUtils.js +1 -2
  102. package/dist/odspPublicUtils.js.map +1 -1
  103. package/dist/odspSnapshotParser.js +1 -2
  104. package/dist/odspSnapshotParser.js.map +1 -1
  105. package/dist/odspSummaryUploadManager.js +7 -0
  106. package/dist/odspSummaryUploadManager.js.map +1 -1
  107. package/dist/odspUrlHelper.js +6 -7
  108. package/dist/odspUrlHelper.js.map +1 -1
  109. package/dist/odspUtils.d.ts.map +1 -1
  110. package/dist/odspUtils.js +21 -21
  111. package/dist/odspUtils.js.map +1 -1
  112. package/dist/odspVersionManager/odspFileVersionFetcher.js +1 -2
  113. package/dist/odspVersionManager/odspFileVersionFetcher.js.map +1 -1
  114. package/dist/odspVersionManager/odspVersionManager.js +9 -8
  115. package/dist/odspVersionManager/odspVersionManager.js.map +1 -1
  116. package/dist/opsCaching.js +7 -1
  117. package/dist/opsCaching.js.map +1 -1
  118. package/dist/packageVersion.d.ts +1 -1
  119. package/dist/packageVersion.d.ts.map +1 -1
  120. package/dist/packageVersion.js +1 -1
  121. package/dist/packageVersion.js.map +1 -1
  122. package/dist/pointInTime.d.ts +15 -0
  123. package/dist/pointInTime.d.ts.map +1 -0
  124. package/dist/pointInTime.js +16 -0
  125. package/dist/pointInTime.js.map +1 -0
  126. package/dist/pointInTimeDriver/createPointInTimeDocumentService.d.ts +34 -0
  127. package/dist/pointInTimeDriver/createPointInTimeDocumentService.d.ts.map +1 -0
  128. package/dist/pointInTimeDriver/createPointInTimeDocumentService.js +101 -0
  129. package/dist/pointInTimeDriver/createPointInTimeDocumentService.js.map +1 -0
  130. package/dist/pointInTimeDriver/odspPointInTimeDocumentService.js +10 -6
  131. package/dist/pointInTimeDriver/odspPointInTimeDocumentService.js.map +1 -1
  132. package/dist/prefetchLatestSnapshot.js +1 -2
  133. package/dist/prefetchLatestSnapshot.js.map +1 -1
  134. package/dist/retryErrorsStorageAdapter.js +3 -1
  135. package/dist/retryErrorsStorageAdapter.js.map +1 -1
  136. package/dist/retryUtils.js +1 -2
  137. package/dist/retryUtils.js.map +1 -1
  138. package/dist/vroom.d.ts.map +1 -1
  139. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  140. package/dist/zipItDataRepresentationUtils.js +20 -15
  141. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  142. package/lib/ReadBufferUtils.js +2 -1
  143. package/lib/ReadBufferUtils.js.map +1 -1
  144. package/lib/WriteBufferUtils.js +2 -4
  145. package/lib/WriteBufferUtils.js.map +1 -1
  146. package/lib/compactSnapshotParser.d.ts.map +1 -1
  147. package/lib/compactSnapshotParser.js +3 -2
  148. package/lib/compactSnapshotParser.js.map +1 -1
  149. package/lib/createFile/createNewUtils.d.ts.map +1 -1
  150. package/lib/createFile/createNewUtils.js +2 -2
  151. package/lib/createFile/createNewUtils.js.map +1 -1
  152. package/lib/epochTracker.d.ts.map +1 -1
  153. package/lib/epochTracker.js +15 -4
  154. package/lib/epochTracker.js.map +1 -1
  155. package/lib/fetchSnapshot.d.ts.map +1 -1
  156. package/lib/getFileLink.d.ts.map +1 -1
  157. package/lib/index.d.ts +3 -4
  158. package/lib/index.d.ts.map +1 -1
  159. package/lib/index.js +3 -6
  160. package/lib/index.js.map +1 -1
  161. package/lib/legacy.d.ts +5 -2
  162. package/lib/legacyAlpha.d.ts +5 -2
  163. package/lib/localOdspDriver/localOdspDeltaStorageService.js +2 -0
  164. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  165. package/lib/localOdspDriver/localOdspDocumentService.js +5 -1
  166. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
  167. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js +2 -1
  168. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  169. package/lib/localOdspDriver/localOdspDocumentStorageManager.js +4 -1
  170. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  171. package/lib/odspCache.js +7 -8
  172. package/lib/odspCache.js.map +1 -1
  173. package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  174. package/lib/odspDelayLoadedDeltaStream.js +42 -26
  175. package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
  176. package/lib/odspDeltaStorageService.js +14 -1
  177. package/lib/odspDeltaStorageService.js.map +1 -1
  178. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
  179. package/lib/odspDocumentDeltaConnection.js +58 -41
  180. package/lib/odspDocumentDeltaConnection.js.map +1 -1
  181. package/lib/odspDocumentService.js +16 -1
  182. package/lib/odspDocumentService.js.map +1 -1
  183. package/lib/odspDocumentServiceFactory.d.ts +30 -1
  184. package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
  185. package/lib/odspDocumentServiceFactory.js +28 -1
  186. package/lib/odspDocumentServiceFactory.js.map +1 -1
  187. package/lib/odspDocumentServiceFactoryCore.d.ts +83 -3
  188. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  189. package/lib/odspDocumentServiceFactoryCore.js +39 -13
  190. package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
  191. package/lib/odspDocumentStorageManager.d.ts.map +1 -1
  192. package/lib/odspDocumentStorageManager.js +32 -14
  193. package/lib/odspDocumentStorageManager.js.map +1 -1
  194. package/lib/odspDocumentStorageServiceBase.js +23 -20
  195. package/lib/odspDocumentStorageServiceBase.js.map +1 -1
  196. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  197. package/lib/odspDriverUrlResolverForShareLink.js +6 -1
  198. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
  199. package/lib/odspLayerCompatState.d.ts +8 -1
  200. package/lib/odspLayerCompatState.d.ts.map +1 -1
  201. package/lib/odspLayerCompatState.js +20 -1
  202. package/lib/odspLayerCompatState.js.map +1 -1
  203. package/lib/odspSummaryUploadManager.js +7 -0
  204. package/lib/odspSummaryUploadManager.js.map +1 -1
  205. package/lib/odspUtils.d.ts.map +1 -1
  206. package/lib/odspVersionManager/odspVersionManager.js +7 -6
  207. package/lib/odspVersionManager/odspVersionManager.js.map +1 -1
  208. package/lib/opsCaching.js +7 -1
  209. package/lib/opsCaching.js.map +1 -1
  210. package/lib/packageVersion.d.ts +1 -1
  211. package/lib/packageVersion.d.ts.map +1 -1
  212. package/lib/packageVersion.js +1 -1
  213. package/lib/packageVersion.js.map +1 -1
  214. package/lib/pointInTime.d.ts +15 -0
  215. package/lib/pointInTime.d.ts.map +1 -0
  216. package/lib/pointInTime.js +12 -0
  217. package/lib/pointInTime.js.map +1 -0
  218. package/lib/pointInTimeDriver/createPointInTimeDocumentService.d.ts +34 -0
  219. package/lib/pointInTimeDriver/createPointInTimeDocumentService.d.ts.map +1 -0
  220. package/lib/pointInTimeDriver/createPointInTimeDocumentService.js +99 -0
  221. package/lib/pointInTimeDriver/createPointInTimeDocumentService.js.map +1 -0
  222. package/lib/pointInTimeDriver/odspPointInTimeDocumentService.js +10 -6
  223. package/lib/pointInTimeDriver/odspPointInTimeDocumentService.js.map +1 -1
  224. package/lib/public.d.ts +1 -1
  225. package/lib/retryErrorsStorageAdapter.js +3 -1
  226. package/lib/retryErrorsStorageAdapter.js.map +1 -1
  227. package/lib/vroom.d.ts.map +1 -1
  228. package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
  229. package/lib/zipItDataRepresentationUtils.js +10 -5
  230. package/lib/zipItDataRepresentationUtils.js.map +1 -1
  231. package/package.json +49 -54
  232. package/src/compactSnapshotParser.ts +6 -2
  233. package/src/createFile/createNewUtils.ts +6 -2
  234. package/src/index.ts +10 -6
  235. package/src/odspDocumentServiceFactory.ts +69 -1
  236. package/src/odspDocumentServiceFactoryCore.ts +105 -4
  237. package/src/odspDocumentStorageManager.ts +2 -2
  238. package/src/odspLayerCompatState.ts +29 -1
  239. package/src/odspVersionManager/DEV.md +9 -8
  240. package/src/packageVersion.ts +1 -1
  241. package/src/pointInTime.ts +30 -0
  242. package/src/pointInTimeDriver/createPointInTimeDocumentService.ts +193 -0
  243. package/src/zipItDataRepresentationUtils.ts +3 -3
  244. package/tsconfig.json +1 -1
  245. package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts +0 -41
  246. package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts.map +0 -1
  247. package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js +0 -132
  248. package/dist/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js.map +0 -1
  249. package/internal.d.ts +0 -11
  250. package/legacy/alpha.d.ts +0 -11
  251. package/legacy.d.ts +0 -11
  252. package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts +0 -41
  253. package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.d.ts.map +0 -1
  254. package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js +0 -128
  255. package/lib/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.js.map +0 -1
  256. package/src/pointInTimeDriver/odspPointInTimeDocumentServiceFactory.ts +0 -260
  257. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  258. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
@@ -4,7 +4,8 @@
4
4
  */
5
5
  // eslint-disable-next-line import-x/no-internal-modules
6
6
  import { LocalOdspDocumentServiceFactory } from "./localOdspDriver/localOdspDocumentServiceFactory.js";
7
- import { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore.js";
7
+ import { OdspDocumentServiceFactoryCore, } from "./odspDocumentServiceFactoryCore.js";
8
+ import { LocalPersistentCache } from "./odspCache.js";
8
9
  /**
9
10
  * Factory for creating the sharepoint document service. Use this if you want to
10
11
  * use the sharepoint implementation.
@@ -16,6 +17,32 @@ export class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {
16
17
  super(getStorageToken, getWebsocketToken, persistedCache, hostPolicy);
17
18
  }
18
19
  }
20
+ /**
21
+ * Creates an ODSP document service factory with optional consumer-provided features.
22
+ *
23
+ * @param options - Tokens, cache, host policy, and optional feature implementations.
24
+ * @returns The configured ODSP document service factory.
25
+ *
26
+ * @legacy @beta
27
+ */
28
+ export function createOdspDocumentServiceFactory(options) {
29
+ const persistedCache = options.persistedCache ?? new LocalPersistentCache();
30
+ const pointInTimeImplementation = options.pointInTimeDocumentServiceImplementation;
31
+ class ConfiguredOdspDocumentServiceFactory extends OdspDocumentServiceFactory {
32
+ createPointInTimeDocumentService = pointInTimeImplementation === undefined
33
+ ? undefined
34
+ : async (resolvedUrl, targetSequenceNumber, logger, clientIsSummarizer) => pointInTimeImplementation({
35
+ resolvedUrl,
36
+ targetSequenceNumber,
37
+ logger,
38
+ clientIsSummarizer,
39
+ persistedCache,
40
+ getStorageToken: options.getStorageToken,
41
+ createDocumentService: async (url, odspLogger, cacheAndTracker, isSummarizer) => this.createDocumentServiceCore(url, odspLogger, cacheAndTracker, isSummarizer),
42
+ });
43
+ }
44
+ return new ConfiguredOdspDocumentServiceFactory(options.getStorageToken, options.getWebsocketToken, persistedCache, options.hostPolicy);
45
+ }
19
46
  /**
20
47
  * Creates a factory instance for creating a sharepoint document service from a provided snapshot.
21
48
  *
@@ -1 +1 @@
1
- {"version":3,"file":"odspDocumentServiceFactory.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,wDAAwD;AACxD,OAAO,EAAE,+BAA+B,EAAE,MAAM,sDAAsD,CAAC;AACvG,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF;;;;;GAKG;AACH,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IAC7E,YACC,eAA4D,EAC5D,iBAA0E,EAC1E,cAAgC,EAChC,UAA8B;QAE9B,KAAK,CAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC;CACD;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qCAAqC,CACpD,aAAkC;IAElC,OAAO,IAAI,+BAA+B,CAAC,aAAa,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIDocumentServiceFactory,\n\tIPersistedCache,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tHostStoragePolicy,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\n\n// eslint-disable-next-line import-x/no-internal-modules\nimport { LocalOdspDocumentServiceFactory } from \"./localOdspDriver/localOdspDocumentServiceFactory.js\";\nimport { OdspDocumentServiceFactoryCore } from \"./odspDocumentServiceFactoryCore.js\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n * @legacy\n * @beta\n */\nexport class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {\n\tconstructor(\n\t\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tgetWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n\t\tpersistedCache?: IPersistedCache,\n\t\thostPolicy?: HostStoragePolicy,\n\t) {\n\t\tsuper(getStorageToken, getWebsocketToken, persistedCache, hostPolicy);\n\t}\n}\n\n/**\n * Creates a factory instance for creating a sharepoint document service from a provided snapshot.\n *\n * @remarks Use if you don't want to connect to any kind of external/internal storages and want to provide\n * content directly.\n *\n * @legacy\n * @beta\n */\nexport function createLocalOdspDocumentServiceFactory(\n\tlocalSnapshot: Uint8Array | string,\n): IDocumentServiceFactory {\n\treturn new LocalOdspDocumentServiceFactory(localSnapshot);\n}\n"]}
1
+ {"version":3,"file":"odspDocumentServiceFactory.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,wDAAwD;AACxD,OAAO,EAAE,+BAA+B,EAAE,MAAM,sDAAsD,CAAC;AACvG,OAAO,EAGN,8BAA8B,GAC9B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAyBtD;;;;;GAKG;AACH,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IAC7E,YACC,eAA4D,EAC5D,iBAA0E,EAC1E,cAAgC,EAChC,UAA8B;QAE9B,KAAK,CAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gCAAgC,CAC/C,OAA2C;IAE3C,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,IAAI,oBAAoB,EAAE,CAAC;IAC5E,MAAM,yBAAyB,GAAG,OAAO,CAAC,wCAAwC,CAAC;IAEnF,MAAM,oCAAqC,SAAQ,0BAA0B;QACnD,gCAAgC,GAGxD,yBAAyB,KAAK,SAAS;YACtC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,CACxE,yBAAyB,CAAC;gBACzB,WAAW;gBACX,oBAAoB;gBACpB,MAAM;gBACN,kBAAkB;gBAClB,cAAc;gBACd,eAAe,EAAE,OAAO,CAAC,eAAe;gBACxC,qBAAqB,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,CAC/E,IAAI,CAAC,yBAAyB,CAAC,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,CAAC;aAC/E,CAAC,CAAC;KACP;IAED,OAAO,IAAI,oCAAoC,CAC9C,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,iBAAiB,EACzB,cAAc,EACd,OAAO,CAAC,UAAU,CAClB,CAAC;AACH,CAAC;AACD;;;;;;;;GAQG;AACH,MAAM,UAAU,qCAAqC,CACpD,aAAkC;IAElC,OAAO,IAAI,+BAA+B,CAAC,aAAa,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIDocumentServiceFactory,\n\tIPersistedCache,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tHostStoragePolicy,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\n\n// eslint-disable-next-line import-x/no-internal-modules\nimport { LocalOdspDocumentServiceFactory } from \"./localOdspDriver/localOdspDocumentServiceFactory.js\";\nimport {\n\ttype IPointInTimeDocumentServiceFactory,\n\ttype OdspPointInTimeDocumentServiceImplementation,\n\tOdspDocumentServiceFactoryCore,\n} from \"./odspDocumentServiceFactoryCore.js\";\nimport { LocalPersistentCache } from \"./odspCache.js\";\n\n/**\n * Options for creating an ODSP document service factory.\n *\n * @legacy @beta\n */\nexport interface IOdspDocumentServiceFactoryOptions {\n\t/** Fetches storage access tokens. */\n\treadonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>;\n\t/** Fetches websocket access tokens, or `undefined` when unavailable. */\n\treadonly getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined;\n\t/** Persisted ODSP cache. When omitted, a local in-memory cache is used. */\n\treadonly persistedCache?: IPersistedCache | undefined;\n\t/** Host storage policy. When omitted, the default driver policies are used. */\n\treadonly hostPolicy?: HostStoragePolicy | undefined;\n\t/**\n\t * Enables point-in-time loading. Consumers that omit this implementation do not include the\n\t * feature code in their dependency graph.\n\t */\n\treadonly pointInTimeDocumentServiceImplementation?:\n\t\t| OdspPointInTimeDocumentServiceImplementation\n\t\t| undefined;\n}\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n * @legacy\n * @beta\n */\nexport class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {\n\tconstructor(\n\t\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tgetWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n\t\tpersistedCache?: IPersistedCache,\n\t\thostPolicy?: HostStoragePolicy,\n\t) {\n\t\tsuper(getStorageToken, getWebsocketToken, persistedCache, hostPolicy);\n\t}\n}\n\n/**\n * Creates an ODSP document service factory with optional consumer-provided features.\n *\n * @param options - Tokens, cache, host policy, and optional feature implementations.\n * @returns The configured ODSP document service factory.\n *\n * @legacy @beta\n */\nexport function createOdspDocumentServiceFactory(\n\toptions: IOdspDocumentServiceFactoryOptions,\n): OdspDocumentServiceFactory {\n\tconst persistedCache = options.persistedCache ?? new LocalPersistentCache();\n\tconst pointInTimeImplementation = options.pointInTimeDocumentServiceImplementation;\n\n\tclass ConfiguredOdspDocumentServiceFactory extends OdspDocumentServiceFactory {\n\t\tpublic override readonly createPointInTimeDocumentService:\n\t\t\t| IPointInTimeDocumentServiceFactory[\"createPointInTimeDocumentService\"]\n\t\t\t| undefined =\n\t\t\tpointInTimeImplementation === undefined\n\t\t\t\t? undefined\n\t\t\t\t: async (resolvedUrl, targetSequenceNumber, logger, clientIsSummarizer) =>\n\t\t\t\t\t\tpointInTimeImplementation({\n\t\t\t\t\t\t\tresolvedUrl,\n\t\t\t\t\t\t\ttargetSequenceNumber,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\tclientIsSummarizer,\n\t\t\t\t\t\t\tpersistedCache,\n\t\t\t\t\t\t\tgetStorageToken: options.getStorageToken,\n\t\t\t\t\t\t\tcreateDocumentService: async (url, odspLogger, cacheAndTracker, isSummarizer) =>\n\t\t\t\t\t\t\t\tthis.createDocumentServiceCore(url, odspLogger, cacheAndTracker, isSummarizer),\n\t\t\t\t\t\t});\n\t}\n\n\treturn new ConfiguredOdspDocumentServiceFactory(\n\t\toptions.getStorageToken,\n\t\toptions.getWebsocketToken,\n\t\tpersistedCache,\n\t\toptions.hostPolicy,\n\t);\n}\n/**\n * Creates a factory instance for creating a sharepoint document service from a provided snapshot.\n *\n * @remarks Use if you don't want to connect to any kind of external/internal storages and want to provide\n * content directly.\n *\n * @legacy\n * @beta\n */\nexport function createLocalOdspDocumentServiceFactory(\n\tlocalSnapshot: Uint8Array | string,\n): IDocumentServiceFactory {\n\treturn new LocalOdspDocumentServiceFactory(localSnapshot);\n}\n"]}
@@ -9,12 +9,68 @@ import type { IDocumentService, IDocumentServiceFactory, IPersistedCache, IResol
9
9
  import { type HostStoragePolicy, type IRelaySessionAwareDriverFactory, type ISocketStorageDiscovery, type OdspResourceTokenFetchOptions, type TokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
10
10
  import { type ICacheAndTracker } from "./epochTracker.js";
11
11
  import { type IPrefetchSnapshotContents } from "./odspCache.js";
12
+ /**
13
+ * An ODSP document service factory that supports point-in-time (sequence-number-based) loading.
14
+ *
15
+ * @remarks
16
+ * The loader detects this capability structurally, so hosts can pass this factory directly to
17
+ * {@link @fluidframework/container-loader#loadContainerToSequenceNumber}.
18
+ *
19
+ * @legacy @beta
20
+ */
21
+ export interface IPointInTimeDocumentServiceFactory extends IDocumentServiceFactory {
22
+ /**
23
+ * Creates a document service that materializes the document at the requested sequence number.
24
+ *
25
+ * @param resolvedUrl - The resolved ODSP {@link @fluidframework/driver-definitions#IResolvedUrl}.
26
+ * @param targetSequenceNumber - The sequence number at which to materialize the document. See
27
+ * {@link @fluidframework/container-loader#ILoadContainerToSequenceNumberProps.loadToSequenceNumber}.
28
+ * @param logger - Optional {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}.
29
+ * @param clientIsSummarizer - Whether to apply summarizer policies and telemetry to the
30
+ * underlying document services. Defaults to `false`.
31
+ * @returns A read-only {@link @fluidframework/driver-definitions#IDocumentService} materialized
32
+ * at the requested sequence number.
33
+ */
34
+ createPointInTimeDocumentService(resolvedUrl: IResolvedUrl, targetSequenceNumber: number, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
35
+ }
36
+ /**
37
+ * Inputs supplied by the ODSP document service factory to an injected point-in-time implementation.
38
+ *
39
+ * @legacy @beta
40
+ */
41
+ export interface IOdspPointInTimeDocumentServiceImplementationProps {
42
+ /** The resolved ODSP URL for the document to materialize. */
43
+ readonly resolvedUrl: IResolvedUrl;
44
+ /** The sequence number at which to materialize the document. */
45
+ readonly targetSequenceNumber: number;
46
+ /** Optional telemetry logger for the point-in-time load. */
47
+ readonly logger?: ITelemetryBaseLogger;
48
+ /** Whether to apply summarizer policies and telemetry. Defaults to `false`. */
49
+ readonly clientIsSummarizer?: boolean;
50
+ /** The persisted ODSP cache supplied to the document service factory. */
51
+ readonly persistedCache: IPersistedCache;
52
+ /** Fetches storage access tokens for ODSP requests. */
53
+ readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>;
54
+ /**
55
+ * Creates an ODSP document service for a resolved URL.
56
+ *
57
+ * @param resolvedUrl - The resolved URL for the document or file version to load.
58
+ * @param logger - The telemetry logger for the document service.
59
+ * @param cacheAndTracker - The cache and epoch tracker shared by the point-in-time load.
60
+ * @param clientIsSummarizer - Whether to apply summarizer policies and telemetry.
61
+ * @returns The document service for the resolved URL.
62
+ */
63
+ readonly createDocumentService: (resolvedUrl: IResolvedUrl, logger: ITelemetryBaseLogger, cacheAndTracker: ICacheAndTracker, clientIsSummarizer?: boolean) => Promise<IDocumentService>;
64
+ }
65
+ /**
66
+ * Consumer-provided implementation of ODSP point-in-time loading.
67
+ *
68
+ * @legacy @beta
69
+ */
70
+ export type OdspPointInTimeDocumentServiceImplementation = (props: IOdspPointInTimeDocumentServiceImplementationProps) => Promise<IDocumentService>;
12
71
  /**
13
72
  * Factory for creating the sharepoint document service. Use this if you want to
14
73
  * use the sharepoint implementation.
15
- *
16
- * This constructor should be used by environments that support dynamic imports and that wish
17
- * to leverage code splitting as a means to keep bundles as small as possible.
18
74
  * @legacy
19
75
  * @beta
20
76
  */
@@ -53,7 +109,31 @@ export declare class OdspDocumentServiceFactoryCore implements IDocumentServiceF
53
109
  * is currently marked as legacy alpha. So, using unknown here.
54
110
  */
55
111
  readonly ILayerCompatDetails?: unknown;
112
+ /**
113
+ * The requirements that the Loader layer must meet to be compatible with this ODSP Driver. This is exposed to
114
+ * the Loader layer so that it can validate Loader / Driver compatibility on this Driver's behalf (the Driver has
115
+ * no reference to the Loader to validate it directly).
116
+ * @remarks This is for internal use only.
117
+ * The type of this should be ILayerCompatSupportRequirements. However, ILayerCompatSupportRequirements is
118
+ * internal and this class is currently marked as legacy alpha. So, using unknown here.
119
+ */
120
+ readonly ILayerCompatSupportRequirements?: unknown;
56
121
  createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
122
+ /**
123
+ * Creates a document service that reads its snapshot from the closest file version at or before
124
+ * the target and its deltas from the live document, materializing a requested sequence number
125
+ * through replay.
126
+ *
127
+ * @param resolvedUrl - The resolved ODSP {@link @fluidframework/driver-definitions#IResolvedUrl}.
128
+ * @param targetSequenceNumber - The sequence number at which to materialize the document. See
129
+ * {@link @fluidframework/container-loader#ILoadContainerToSequenceNumberProps.loadToSequenceNumber}.
130
+ * @param logger - Optional {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}.
131
+ * @param clientIsSummarizer - Whether to apply summarizer policies and telemetry to the
132
+ * underlying document services. Defaults to `false`.
133
+ * @returns A read-only {@link @fluidframework/driver-definitions#IDocumentService} materialized
134
+ * at the requested sequence number.
135
+ */
136
+ readonly createPointInTimeDocumentService?: IPointInTimeDocumentServiceFactory["createPointInTimeDocumentService"];
57
137
  protected createDocumentServiceCore(resolvedUrl: IResolvedUrl, odspLogger: ITelemetryBaseLogger, cacheAndTrackerArg?: ICacheAndTracker, clientIsSummarizer?: boolean): Promise<IDocumentService>;
58
138
  }
59
139
  //# sourceMappingURL=odspDocumentServiceFactoryCore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"odspDocumentServiceFactoryCore.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EACX,gBAAgB,EAChB,uB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D;IAED;;;;;OAKG;IACU,0BAA0B,CACtC,WAAW,EAAE,YAAY,GACvB,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;IAQlC,eAAe,CAC3B,gBAAgB,EAAE,YAAY,GAAG,SAAS,EAC1C,oBAAoB,EAAE,YAAY,EAClC,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAwH5B;;;;;;;;OAQG;gBAEe,eAAe,EAAE,YAAY,CAAC,6BAA6B,CAAC,EAC5D,iBAAiB,EAC/B,YAAY,CAAC,6BAA6B,CAAC,GAC3C,SAAS,EACF,cAAc,GAAE,eAA4C,EACrD,UAAU,GAAE,iBAAsB;IAcpD;;;;;;OAMG;IACH,SAAgB,mBAAmB,CAAC,EAAE,OAAO,CAAoC;IAEjF;;;;;;;OAOG;IACH,SAAgB,+BAA+B,CAAC,EAAE,OAAO,CAClB;IAE1B,qBAAqB,CACjC,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAS5B;;;;;;;;;;;;;OAaG;IACH,SAAgB,gCAAgC,CAAC,EAAE,kCAAkC,CAAC,kCAAkC,CAAC,CAAC;cAE1G,yBAAyB,CACxC,WAAW,EAAE,YAAY,EACzB,UAAU,EAAE,oBAAoB,EAChC,kBAAkB,CAAC,EAAE,gBAAgB,EACrC,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;CAsD5B"}
@@ -10,18 +10,21 @@ import { useCreateNewModule } from "./createFile/index.js";
10
10
  import { createOdspCacheAndTracker } from "./epochTracker.js";
11
11
  import { LocalPersistentCache, NonPersistentCache, } from "./odspCache.js";
12
12
  import { OdspDocumentService } from "./odspDocumentService.js";
13
- import { odspDriverCompatDetailsForLoader } from "./odspLayerCompatState.js";
13
+ import { odspDriverCompatDetailsForLoader, odspDriverCompatRequirementsForLoader, } from "./odspLayerCompatState.js";
14
14
  import { createOdspLogger, getJoinSessionCacheKey, getOdspResolvedUrl, isNewFileInfo, toInstrumentedOdspStorageTokenFetcher, toInstrumentedOdspTokenFetcher, } from "./odspUtils.js";
15
15
  /**
16
16
  * Factory for creating the sharepoint document service. Use this if you want to
17
17
  * use the sharepoint implementation.
18
- *
19
- * This constructor should be used by environments that support dynamic imports and that wish
20
- * to leverage code splitting as a means to keep bundles as small as possible.
21
18
  * @legacy
22
19
  * @beta
23
20
  */
24
21
  export class OdspDocumentServiceFactoryCore {
22
+ getStorageToken;
23
+ getWebsocketToken;
24
+ persistedCache;
25
+ hostPolicy;
26
+ nonPersistentCache = new NonPersistentCache();
27
+ socketReferenceKeyPrefix;
25
28
  get snapshotPrefetchResultCache() {
26
29
  return this.nonPersistentCache.snapshotPrefetchResultCache;
27
30
  }
@@ -125,15 +128,6 @@ export class OdspDocumentServiceFactoryCore {
125
128
  this.getWebsocketToken = getWebsocketToken;
126
129
  this.persistedCache = persistedCache;
127
130
  this.hostPolicy = hostPolicy;
128
- this.nonPersistentCache = new NonPersistentCache();
129
- /**
130
- * The compatibility details of the ODSP Driver layer that is exposed to the Loader layer
131
- * for validating Loader-Driver compatibility.
132
- * @remarks This is for internal use only.
133
- * The type of this should be ILayerCompatDetails. However, ILayerCompatDetails is internal and this class
134
- * is currently marked as legacy alpha. So, using unknown here.
135
- */
136
- this.ILayerCompatDetails = odspDriverCompatDetailsForLoader;
137
131
  if (this.hostPolicy.isolateSocketCache === true) {
138
132
  // create the key to separate the socket reuse cache
139
133
  this.socketReferenceKeyPrefix = uuid();
@@ -145,9 +139,41 @@ export class OdspDocumentServiceFactoryCore {
145
139
  ...this.hostPolicy.sessionOptions,
146
140
  };
147
141
  }
142
+ /**
143
+ * The compatibility details of the ODSP Driver layer that is exposed to the Loader layer
144
+ * for validating Loader-Driver compatibility.
145
+ * @remarks This is for internal use only.
146
+ * The type of this should be ILayerCompatDetails. However, ILayerCompatDetails is internal and this class
147
+ * is currently marked as legacy alpha. So, using unknown here.
148
+ */
149
+ ILayerCompatDetails = odspDriverCompatDetailsForLoader;
150
+ /**
151
+ * The requirements that the Loader layer must meet to be compatible with this ODSP Driver. This is exposed to
152
+ * the Loader layer so that it can validate Loader / Driver compatibility on this Driver's behalf (the Driver has
153
+ * no reference to the Loader to validate it directly).
154
+ * @remarks This is for internal use only.
155
+ * The type of this should be ILayerCompatSupportRequirements. However, ILayerCompatSupportRequirements is
156
+ * internal and this class is currently marked as legacy alpha. So, using unknown here.
157
+ */
158
+ ILayerCompatSupportRequirements = odspDriverCompatRequirementsForLoader;
148
159
  async createDocumentService(resolvedUrl, logger, clientIsSummarizer) {
149
160
  return this.createDocumentServiceCore(resolvedUrl, createOdspLogger(logger), undefined, clientIsSummarizer);
150
161
  }
162
+ /**
163
+ * Creates a document service that reads its snapshot from the closest file version at or before
164
+ * the target and its deltas from the live document, materializing a requested sequence number
165
+ * through replay.
166
+ *
167
+ * @param resolvedUrl - The resolved ODSP {@link @fluidframework/driver-definitions#IResolvedUrl}.
168
+ * @param targetSequenceNumber - The sequence number at which to materialize the document. See
169
+ * {@link @fluidframework/container-loader#ILoadContainerToSequenceNumberProps.loadToSequenceNumber}.
170
+ * @param logger - Optional {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}.
171
+ * @param clientIsSummarizer - Whether to apply summarizer policies and telemetry to the
172
+ * underlying document services. Defaults to `false`.
173
+ * @returns A read-only {@link @fluidframework/driver-definitions#IDocumentService} materialized
174
+ * at the requested sequence number.
175
+ */
176
+ createPointInTimeDocumentService;
151
177
  async createDocumentServiceCore(resolvedUrl, odspLogger, cacheAndTrackerArg, clientIsSummarizer) {
152
178
  const extLogger = createChildLogger({ logger: odspLogger });
153
179
  const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
@@ -1 +1 @@
1
- {"version":3,"file":"odspDocumentServiceFactoryCore.js","sourceRoot":"","sources":["../src/odspDocumentServ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C;AAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport type { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIFileEntry,\n\tIPersistedCache,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype HostStoragePolicy,\n\ttype IOdspUrlParts,\n\ttype IRelaySessionAwareDriverFactory,\n\ttype ISharingLinkKind,\n\ttype ISocketStorageDiscovery,\n\ttype OdspResourceTokenFetchOptions,\n\tSharingLinkRole,\n\tSharingLinkScope,\n\ttype TokenFetchOptions,\n\ttype TokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { PerformanceEvent, createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { useCreateNewModule } from \"./createFile/index.js\";\nimport { type ICacheAndTracker, createOdspCacheAndTracker } from \"./epochTracker.js\";\nimport {\n\ttype INonPersistentCache,\n\ttype IPrefetchSnapshotContents,\n\tLocalPersistentCache,\n\tNonPersistentCache,\n} from \"./odspCache.js\";\nimport { OdspDocumentService } from \"./odspDocumentService.js\";\nimport { odspDriverCompatDetailsForLoader } from \"./odspLayerCompatState.js\";\nimport {\n\ttype IExistingFileInfo,\n\ttype INewFileInfo,\n\tcreateOdspLogger,\n\tgetJoinSessionCacheKey,\n\tgetOdspResolvedUrl,\n\tisNewFileInfo,\n\ttoInstrumentedOdspStorageTokenFetcher,\n\ttoInstrumentedOdspTokenFetcher,\n} from \"./odspUtils.js\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n *\n * This constructor should be used by environments that support dynamic imports and that wish\n * to leverage code splitting as a means to keep bundles as small as possible.\n * @legacy\n * @beta\n */\nexport class OdspDocumentServiceFactoryCore\n\timplements IDocumentServiceFactory, IRelaySessionAwareDriverFactory\n{\n\tprivate readonly nonPersistentCache: INonPersistentCache = new NonPersistentCache();\n\tprivate readonly socketReferenceKeyPrefix?: string;\n\n\tpublic get snapshotPrefetchResultCache(): PromiseCache<string, IPrefetchSnapshotContents> {\n\t\treturn this.nonPersistentCache.snapshotPrefetchResultCache;\n\t}\n\n\t// TODO: return `IRelaySessionAwareDriverFactory` instead of `this` (breaking change)\n\tpublic get IRelaySessionAwareDriverFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * This function would return info about relay service session only if this factory established (or attempted to\n\t * establish) connection very recently. Otherwise, it will return undefined.\n\t * @param resolvedUrl - resolved url for container\n\t * @returns The current join session response stored in cache. `undefined` if not present.\n\t */\n\tpublic async getRelayServiceSessionInfo(\n\t\tresolvedUrl: IResolvedUrl,\n\t): Promise<ISocketStorageDiscovery | undefined> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst joinSessionResponse = await this.nonPersistentCache.sessionJoinCache.get(\n\t\t\tgetJoinSessionCacheKey(odspResolvedUrl),\n\t\t);\n\t\treturn joinSessionResponse?.joinSessionResponse;\n\t}\n\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree | undefined,\n\t\tcreateNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(createNewResolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\n\t\tlet fileInfo: INewFileInfo | IExistingFileInfo;\n\t\tlet createShareLinkParam: ISharingLinkKind | undefined;\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"Existing\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\titemId: odspResolvedUrl.itemId,\n\t\t\t};\n\t\t} else if (odspResolvedUrl.fileName) {\n\t\t\tconst [, queryString] = odspResolvedUrl.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst filePath = searchParams.get(\"path\");\n\t\t\tif (filePath === undefined || filePath === null) {\n\t\t\t\tthrow new Error(\"File path should be provided!!\");\n\t\t\t}\n\t\t\tcreateShareLinkParam = getSharingLinkParams(this.hostPolicy, searchParams);\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"New\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\tfilePath,\n\t\t\t\tfilename: odspResolvedUrl.fileName,\n\t\t\t\tcreateLinkType: createShareLinkParam,\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new Error(\"A new or existing file must be specified to create container!\");\n\t\t}\n\n\t\tif (isCombinedAppAndProtocolSummary(createNewSummary)) {\n\t\t\tconst documentAttributes = getDocAttributesFromProtocolSummary(\n\t\t\t\tcreateNewSummary.tree[\".protocol\"],\n\t\t\t);\n\t\t\tif (documentAttributes?.sequenceNumber !== 0) {\n\t\t\t\tthrow new Error(\"Seq number in detached ODSP container should be 0\");\n\t\t\t}\n\t\t}\n\n\t\tconst odspLogger = createOdspLogger(logger);\n\n\t\tconst fileEntry: IFileEntry = {\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\tfileVersion: undefined,\n\t\t};\n\t\tconst cacheAndTracker = createOdspCacheAndTracker(\n\t\t\tthis.persistedCache,\n\t\t\tthis.nonPersistentCache,\n\t\t\tfileEntry,\n\t\t\todspLogger,\n\t\t\tclientIsSummarizer,\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\todspLogger,\n\t\t\t{\n\t\t\t\teventName: \"CreateNew\",\n\t\t\t\tisWithSummaryUpload: true,\n\t\t\t\tcreateShareLinkParam: createShareLinkParam\n\t\t\t\t\t? JSON.stringify(createShareLinkParam)\n\t\t\t\t\t: undefined,\n\t\t\t\tenableSingleRequestForShareLinkWithCreate:\n\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\t\t\t\todspLogger,\n\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\tthis.getStorageToken,\n\t\t\t\t);\n\t\t\t\tconst _odspResolvedUrl = await useCreateNewModule(odspLogger, async (module) => {\n\t\t\t\t\treturn isNewFileInfo(fileInfo)\n\t\t\t\t\t\t? module.createNewFluidFile(\n\t\t\t\t\t\t\t\tgetAuthHeader,\n\t\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t\t\t\t\t\todspResolvedUrl,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: module.createNewContainerOnExistingFile(\n\t\t\t\t\t\t\t\tgetAuthHeader,\n\t\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t\t\t\todspResolvedUrl.fileMetadata?.eTag,\n\t\t\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tconst docService = this.createDocumentServiceCore(\n\t\t\t\t\t_odspResolvedUrl,\n\t\t\t\t\todspLogger,\n\t\t\t\t\tcacheAndTracker,\n\t\t\t\t\tclientIsSummarizer,\n\t\t\t\t);\n\t\t\t\tevent.end({\n\t\t\t\t\tdocId: _odspResolvedUrl.hashedDocumentId,\n\t\t\t\t});\n\t\t\t\treturn docService;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * @param getStorageToken - function that can provide the storage token for a given site. This is\n\t * is also referred to as the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also\n\t * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n\t * response payload.\n\t * @param persistedCache - PersistedCache provided by host for use in this session.\n\t * @param hostPolicy - Policy for storage provided by host.\n\t */\n\tconstructor(\n\t\tprivate readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tprivate readonly getWebsocketToken:\n\t\t\t| TokenFetcher<OdspResourceTokenFetchOptions>\n\t\t\t| undefined,\n\t\tprotected persistedCache: IPersistedCache = new LocalPersistentCache(),\n\t\tprivate readonly hostPolicy: HostStoragePolicy = {},\n\t) {\n\t\tif (this.hostPolicy.isolateSocketCache === true) {\n\t\t\t// create the key to separate the socket reuse cache\n\t\t\tthis.socketReferenceKeyPrefix = uuid();\n\t\t}\n\t\t// Set enableRedeemFallback by default as true.\n\t\tthis.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;\n\t\tthis.hostPolicy.sessionOptions = {\n\t\t\tforceAccessTokenViaAuthorizationHeader: true,\n\t\t\t...this.hostPolicy.sessionOptions,\n\t\t};\n\t}\n\n\t/**\n\t * The compatibility details of the ODSP Driver layer that is exposed to the Loader layer\n\t * for validating Loader-Driver compatibility.\n\t * @remarks This is for internal use only.\n\t * The type of this should be ILayerCompatDetails. However, ILayerCompatDetails is internal and this class\n\t * is currently marked as legacy alpha. So, using unknown here.\n\t */\n\tpublic readonly ILayerCompatDetails?: unknown = odspDriverCompatDetailsForLoader;\n\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn this.createDocumentServiceCore(\n\t\t\tresolvedUrl,\n\t\t\tcreateOdspLogger(logger),\n\t\t\tundefined,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n\n\tprotected async createDocumentServiceCore(\n\t\tresolvedUrl: IResolvedUrl,\n\t\todspLogger: ITelemetryBaseLogger,\n\t\tcacheAndTrackerArg?: ICacheAndTracker,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst extLogger = createChildLogger({ logger: odspLogger });\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\n\t\tconst cacheAndTracker =\n\t\t\tcacheAndTrackerArg ??\n\t\t\tcreateOdspCacheAndTracker(\n\t\t\t\tthis.persistedCache,\n\t\t\t\tthis.nonPersistentCache,\n\t\t\t\t{\n\t\t\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\t\t\tfileVersion: odspResolvedUrl.fileVersion,\n\t\t\t\t},\n\t\t\t\textLogger,\n\t\t\t\tclientIsSummarizer,\n\t\t\t);\n\n\t\tconst storageTokenFetcher = toInstrumentedOdspStorageTokenFetcher(\n\t\t\textLogger,\n\t\t\tresolvedUrlData,\n\t\t\tthis.getStorageToken,\n\t\t);\n\n\t\tconst webSocketTokenFetcher =\n\t\t\tthis.getWebsocketToken === undefined\n\t\t\t\t? undefined\n\t\t\t\t: async (options: TokenFetchOptions): Promise<string | null> =>\n\t\t\t\t\t\t// websocket expects a plain token\n\t\t\t\t\t\ttoInstrumentedOdspTokenFetcher(\n\t\t\t\t\t\t\textLogger,\n\t\t\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\t\t\tthis.getWebsocketToken!,\n\t\t\t\t\t\t\tfalse /* throwOnNullToken */,\n\t\t\t\t\t\t\ttrue /* returnPlainToken */,\n\t\t\t\t\t\t)(options, \"GetWebsocketToken\");\n\n\t\treturn OdspDocumentService.create(\n\t\t\tresolvedUrl,\n\t\t\tstorageTokenFetcher,\n\t\t\twebSocketTokenFetcher,\n\t\t\textLogger,\n\t\t\tcacheAndTracker.cache,\n\t\t\tthis.hostPolicy,\n\t\t\tcacheAndTracker.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n}\n\n/**\n * Extract the sharing link kind from the resolved URL's query paramerters\n */\nfunction getSharingLinkParams(\n\thostPolicy: HostStoragePolicy,\n\tsearchParams: URLSearchParams,\n): ISharingLinkKind | undefined {\n\t// extract request parameters for creation of sharing link (if provided) if the feature is enabled\n\tlet createShareLinkParam: ISharingLinkKind | undefined;\n\tif (hostPolicy.enableSingleRequestForShareLinkWithCreate) {\n\t\tconst createLinkScope = searchParams.get(\"createLinkScope\");\n\t\tconst createLinkRole = searchParams.get(\"createLinkRole\");\n\t\tif (createLinkScope && SharingLinkScope[createLinkScope]) {\n\t\t\tcreateShareLinkParam = {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tscope: SharingLinkScope[createLinkScope],\n\t\t\t\t...(createLinkRole && SharingLinkRole[createLinkRole]\n\t\t\t\t\t? // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\t\t{ role: SharingLinkRole[createLinkRole] }\n\t\t\t\t\t: {}),\n\t\t\t};\n\t\t}\n\t}\n\treturn createShareLinkParam;\n}\n"]}
1
+ {"version":3,"file":"odspDocumentServiceFactoryCore.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EACN,mCAAmC,EACnC,+BAA+B,GAC/B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAON,eAAe,EACf,gBAAgB,GAGhB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAyB,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAGN,oBAAoB,EACpB,kBAAkB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACN,gCAAgC,EAChC,qCAAqC,GACrC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGN,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,qCAAqC,EACrC,8BAA8B,GAC9B,MAAM,gBAAgB,CAAC;AA4ExB;;;;;GAKG;AACH,MAAM,OAAO,8BAA8B;IAsKxB;IACA;IAGP;IACO;IAxKD,kBAAkB,GAAwB,IAAI,kBAAkB,EAAE,CAAC;IACnE,wBA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,yCAAyC,EAAE,CAAC;QAC1D,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC5D,MAAM,cAAc,GAAG,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC1D,IAAI,eAAe,IAAI,gBAAgB,CAAC,eAAe,CAAC,EAAE,CAAC;YAC1D,oBAAoB,GAAG;gBACtB,mEAAmE;gBACnE,KAAK,EAAE,gBAAgB,CAAC,eAAe,CAAC;gBACxC,GAAG,CAAC,cAAc,IAAI,eAAe,CAAC,cAAc,CAAC;oBACpD,CAAC,CAAC,mEAAmE;wBACpE,EAAE,IAAI,EAAE,eAAe,CAAC,cAAc,CAAC,EAAE;oBAC1C,CAAC,CAAC,EAAE,CAAC;aACN,CAAC;QACH,CAAC;IACF,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport type { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIFileEntry,\n\tIPersistedCache,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype HostStoragePolicy,\n\ttype IOdspUrlParts,\n\ttype IRelaySessionAwareDriverFactory,\n\ttype ISharingLinkKind,\n\ttype ISocketStorageDiscovery,\n\ttype OdspResourceTokenFetchOptions,\n\tSharingLinkRole,\n\tSharingLinkScope,\n\ttype TokenFetchOptions,\n\ttype TokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { PerformanceEvent, createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { useCreateNewModule } from \"./createFile/index.js\";\nimport { type ICacheAndTracker, createOdspCacheAndTracker } from \"./epochTracker.js\";\nimport {\n\ttype INonPersistentCache,\n\ttype IPrefetchSnapshotContents,\n\tLocalPersistentCache,\n\tNonPersistentCache,\n} from \"./odspCache.js\";\nimport { OdspDocumentService } from \"./odspDocumentService.js\";\nimport {\n\todspDriverCompatDetailsForLoader,\n\todspDriverCompatRequirementsForLoader,\n} from \"./odspLayerCompatState.js\";\nimport {\n\ttype IExistingFileInfo,\n\ttype INewFileInfo,\n\tcreateOdspLogger,\n\tgetJoinSessionCacheKey,\n\tgetOdspResolvedUrl,\n\tisNewFileInfo,\n\ttoInstrumentedOdspStorageTokenFetcher,\n\ttoInstrumentedOdspTokenFetcher,\n} from \"./odspUtils.js\";\n\n/**\n * An ODSP document service factory that supports point-in-time (sequence-number-based) loading.\n *\n * @remarks\n * The loader detects this capability structurally, so hosts can pass this factory directly to\n * {@link @fluidframework/container-loader#loadContainerToSequenceNumber}.\n *\n * @legacy @beta\n */\nexport interface IPointInTimeDocumentServiceFactory extends IDocumentServiceFactory {\n\t/**\n\t * Creates a document service that materializes the document at the requested sequence number.\n\t *\n\t * @param resolvedUrl - The resolved ODSP {@link @fluidframework/driver-definitions#IResolvedUrl}.\n\t * @param targetSequenceNumber - The sequence number at which to materialize the document. See\n\t * {@link @fluidframework/container-loader#ILoadContainerToSequenceNumberProps.loadToSequenceNumber}.\n\t * @param logger - Optional {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}.\n\t * @param clientIsSummarizer - Whether to apply summarizer policies and telemetry to the\n\t * underlying document services. Defaults to `false`.\n\t * @returns A read-only {@link @fluidframework/driver-definitions#IDocumentService} materialized\n\t * at the requested sequence number.\n\t */\n\tcreatePointInTimeDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\ttargetSequenceNumber: number,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService>;\n}\n\n/**\n * Inputs supplied by the ODSP document service factory to an injected point-in-time implementation.\n *\n * @legacy @beta\n */\nexport interface IOdspPointInTimeDocumentServiceImplementationProps {\n\t/** The resolved ODSP URL for the document to materialize. */\n\treadonly resolvedUrl: IResolvedUrl;\n\t/** The sequence number at which to materialize the document. */\n\treadonly targetSequenceNumber: number;\n\t/** Optional telemetry logger for the point-in-time load. */\n\treadonly logger?: ITelemetryBaseLogger;\n\t/** Whether to apply summarizer policies and telemetry. Defaults to `false`. */\n\treadonly clientIsSummarizer?: boolean;\n\t/** The persisted ODSP cache supplied to the document service factory. */\n\treadonly persistedCache: IPersistedCache;\n\t/** Fetches storage access tokens for ODSP requests. */\n\treadonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>;\n\t/**\n\t * Creates an ODSP document service for a resolved URL.\n\t *\n\t * @param resolvedUrl - The resolved URL for the document or file version to load.\n\t * @param logger - The telemetry logger for the document service.\n\t * @param cacheAndTracker - The cache and epoch tracker shared by the point-in-time load.\n\t * @param clientIsSummarizer - Whether to apply summarizer policies and telemetry.\n\t * @returns The document service for the resolved URL.\n\t */\n\treadonly createDocumentService: (\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger: ITelemetryBaseLogger,\n\t\tcacheAndTracker: ICacheAndTracker,\n\t\tclientIsSummarizer?: boolean,\n\t) => Promise<IDocumentService>;\n}\n\n/**\n * Consumer-provided implementation of ODSP point-in-time loading.\n *\n * @legacy @beta\n */\nexport type OdspPointInTimeDocumentServiceImplementation = (\n\tprops: IOdspPointInTimeDocumentServiceImplementationProps,\n) => Promise<IDocumentService>;\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n * @legacy\n * @beta\n */\nexport class OdspDocumentServiceFactoryCore\n\timplements IDocumentServiceFactory, IRelaySessionAwareDriverFactory\n{\n\tprivate readonly nonPersistentCache: INonPersistentCache = new NonPersistentCache();\n\tprivate readonly socketReferenceKeyPrefix?: string;\n\n\tpublic get snapshotPrefetchResultCache(): PromiseCache<string, IPrefetchSnapshotContents> {\n\t\treturn this.nonPersistentCache.snapshotPrefetchResultCache;\n\t}\n\n\t// TODO: return `IRelaySessionAwareDriverFactory` instead of `this` (breaking change)\n\tpublic get IRelaySessionAwareDriverFactory(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * This function would return info about relay service session only if this factory established (or attempted to\n\t * establish) connection very recently. Otherwise, it will return undefined.\n\t * @param resolvedUrl - resolved url for container\n\t * @returns The current join session response stored in cache. `undefined` if not present.\n\t */\n\tpublic async getRelayServiceSessionInfo(\n\t\tresolvedUrl: IResolvedUrl,\n\t): Promise<ISocketStorageDiscovery | undefined> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst joinSessionResponse = await this.nonPersistentCache.sessionJoinCache.get(\n\t\t\tgetJoinSessionCacheKey(odspResolvedUrl),\n\t\t);\n\t\treturn joinSessionResponse?.joinSessionResponse;\n\t}\n\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree | undefined,\n\t\tcreateNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(createNewResolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\n\t\tlet fileInfo: INewFileInfo | IExistingFileInfo;\n\t\tlet createShareLinkParam: ISharingLinkKind | undefined;\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"Existing\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\titemId: odspResolvedUrl.itemId,\n\t\t\t};\n\t\t} else if (odspResolvedUrl.fileName) {\n\t\t\tconst [, queryString] = odspResolvedUrl.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst filePath = searchParams.get(\"path\");\n\t\t\tif (filePath === undefined || filePath === null) {\n\t\t\t\tthrow new Error(\"File path should be provided!!\");\n\t\t\t}\n\t\t\tcreateShareLinkParam = getSharingLinkParams(this.hostPolicy, searchParams);\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"New\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\tfilePath,\n\t\t\t\tfilename: odspResolvedUrl.fileName,\n\t\t\t\tcreateLinkType: createShareLinkParam,\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new Error(\"A new or existing file must be specified to create container!\");\n\t\t}\n\n\t\tif (isCombinedAppAndProtocolSummary(createNewSummary)) {\n\t\t\tconst documentAttributes = getDocAttributesFromProtocolSummary(\n\t\t\t\tcreateNewSummary.tree[\".protocol\"],\n\t\t\t);\n\t\t\tif (documentAttributes?.sequenceNumber !== 0) {\n\t\t\t\tthrow new Error(\"Seq number in detached ODSP container should be 0\");\n\t\t\t}\n\t\t}\n\n\t\tconst odspLogger = createOdspLogger(logger);\n\n\t\tconst fileEntry: IFileEntry = {\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\tfileVersion: undefined,\n\t\t};\n\t\tconst cacheAndTracker = createOdspCacheAndTracker(\n\t\t\tthis.persistedCache,\n\t\t\tthis.nonPersistentCache,\n\t\t\tfileEntry,\n\t\t\todspLogger,\n\t\t\tclientIsSummarizer,\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\todspLogger,\n\t\t\t{\n\t\t\t\teventName: \"CreateNew\",\n\t\t\t\tisWithSummaryUpload: true,\n\t\t\t\tcreateShareLinkParam: createShareLinkParam\n\t\t\t\t\t? JSON.stringify(createShareLinkParam)\n\t\t\t\t\t: undefined,\n\t\t\t\tenableSingleRequestForShareLinkWithCreate:\n\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\t\t\t\todspLogger,\n\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\tthis.getStorageToken,\n\t\t\t\t);\n\t\t\t\tconst _odspResolvedUrl = await useCreateNewModule(odspLogger, async (module) => {\n\t\t\t\t\treturn isNewFileInfo(fileInfo)\n\t\t\t\t\t\t? module.createNewFluidFile(\n\t\t\t\t\t\t\t\tgetAuthHeader,\n\t\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t\t\t\t\t\todspResolvedUrl,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: module.createNewContainerOnExistingFile(\n\t\t\t\t\t\t\t\tgetAuthHeader,\n\t\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t\t\t\todspResolvedUrl.fileMetadata?.eTag,\n\t\t\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tconst docService = this.createDocumentServiceCore(\n\t\t\t\t\t_odspResolvedUrl,\n\t\t\t\t\todspLogger,\n\t\t\t\t\tcacheAndTracker,\n\t\t\t\t\tclientIsSummarizer,\n\t\t\t\t);\n\t\t\t\tevent.end({\n\t\t\t\t\tdocId: _odspResolvedUrl.hashedDocumentId,\n\t\t\t\t});\n\t\t\t\treturn docService;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * @param getStorageToken - function that can provide the storage token for a given site. This is\n\t * is also referred to as the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also\n\t * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n\t * response payload.\n\t * @param persistedCache - PersistedCache provided by host for use in this session.\n\t * @param hostPolicy - Policy for storage provided by host.\n\t */\n\tconstructor(\n\t\tprivate readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tprivate readonly getWebsocketToken:\n\t\t\t| TokenFetcher<OdspResourceTokenFetchOptions>\n\t\t\t| undefined,\n\t\tprotected persistedCache: IPersistedCache = new LocalPersistentCache(),\n\t\tprivate readonly hostPolicy: HostStoragePolicy = {},\n\t) {\n\t\tif (this.hostPolicy.isolateSocketCache === true) {\n\t\t\t// create the key to separate the socket reuse cache\n\t\t\tthis.socketReferenceKeyPrefix = uuid();\n\t\t}\n\t\t// Set enableRedeemFallback by default as true.\n\t\tthis.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;\n\t\tthis.hostPolicy.sessionOptions = {\n\t\t\tforceAccessTokenViaAuthorizationHeader: true,\n\t\t\t...this.hostPolicy.sessionOptions,\n\t\t};\n\t}\n\n\t/**\n\t * The compatibility details of the ODSP Driver layer that is exposed to the Loader layer\n\t * for validating Loader-Driver compatibility.\n\t * @remarks This is for internal use only.\n\t * The type of this should be ILayerCompatDetails. However, ILayerCompatDetails is internal and this class\n\t * is currently marked as legacy alpha. So, using unknown here.\n\t */\n\tpublic readonly ILayerCompatDetails?: unknown = odspDriverCompatDetailsForLoader;\n\n\t/**\n\t * The requirements that the Loader layer must meet to be compatible with this ODSP Driver. This is exposed to\n\t * the Loader layer so that it can validate Loader / Driver compatibility on this Driver's behalf (the Driver has\n\t * no reference to the Loader to validate it directly).\n\t * @remarks This is for internal use only.\n\t * The type of this should be ILayerCompatSupportRequirements. However, ILayerCompatSupportRequirements is\n\t * internal and this class is currently marked as legacy alpha. So, using unknown here.\n\t */\n\tpublic readonly ILayerCompatSupportRequirements?: unknown =\n\t\todspDriverCompatRequirementsForLoader;\n\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn this.createDocumentServiceCore(\n\t\t\tresolvedUrl,\n\t\t\tcreateOdspLogger(logger),\n\t\t\tundefined,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n\n\t/**\n\t * Creates a document service that reads its snapshot from the closest file version at or before\n\t * the target and its deltas from the live document, materializing a requested sequence number\n\t * through replay.\n\t *\n\t * @param resolvedUrl - The resolved ODSP {@link @fluidframework/driver-definitions#IResolvedUrl}.\n\t * @param targetSequenceNumber - The sequence number at which to materialize the document. See\n\t * {@link @fluidframework/container-loader#ILoadContainerToSequenceNumberProps.loadToSequenceNumber}.\n\t * @param logger - Optional {@link @fluidframework/core-interfaces#ITelemetryBaseLogger}.\n\t * @param clientIsSummarizer - Whether to apply summarizer policies and telemetry to the\n\t * underlying document services. Defaults to `false`.\n\t * @returns A read-only {@link @fluidframework/driver-definitions#IDocumentService} materialized\n\t * at the requested sequence number.\n\t */\n\tpublic readonly createPointInTimeDocumentService?: IPointInTimeDocumentServiceFactory[\"createPointInTimeDocumentService\"];\n\n\tprotected async createDocumentServiceCore(\n\t\tresolvedUrl: IResolvedUrl,\n\t\todspLogger: ITelemetryBaseLogger,\n\t\tcacheAndTrackerArg?: ICacheAndTracker,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst extLogger = createChildLogger({ logger: odspLogger });\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\n\t\tconst cacheAndTracker =\n\t\t\tcacheAndTrackerArg ??\n\t\t\tcreateOdspCacheAndTracker(\n\t\t\t\tthis.persistedCache,\n\t\t\t\tthis.nonPersistentCache,\n\t\t\t\t{\n\t\t\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\t\t\tfileVersion: odspResolvedUrl.fileVersion,\n\t\t\t\t},\n\t\t\t\textLogger,\n\t\t\t\tclientIsSummarizer,\n\t\t\t);\n\n\t\tconst storageTokenFetcher = toInstrumentedOdspStorageTokenFetcher(\n\t\t\textLogger,\n\t\t\tresolvedUrlData,\n\t\t\tthis.getStorageToken,\n\t\t);\n\n\t\tconst webSocketTokenFetcher =\n\t\t\tthis.getWebsocketToken === undefined\n\t\t\t\t? undefined\n\t\t\t\t: async (options: TokenFetchOptions): Promise<string | null> =>\n\t\t\t\t\t\t// websocket expects a plain token\n\t\t\t\t\t\ttoInstrumentedOdspTokenFetcher(\n\t\t\t\t\t\t\textLogger,\n\t\t\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\t\t\tthis.getWebsocketToken!,\n\t\t\t\t\t\t\tfalse /* throwOnNullToken */,\n\t\t\t\t\t\t\ttrue /* returnPlainToken */,\n\t\t\t\t\t\t)(options, \"GetWebsocketToken\");\n\n\t\treturn OdspDocumentService.create(\n\t\t\tresolvedUrl,\n\t\t\tstorageTokenFetcher,\n\t\t\twebSocketTokenFetcher,\n\t\t\textLogger,\n\t\t\tcacheAndTracker.cache,\n\t\t\tthis.hostPolicy,\n\t\t\tcacheAndTracker.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n}\n\n/**\n * Extract the sharing link kind from the resolved URL's query paramerters\n */\nfunction getSharingLinkParams(\n\thostPolicy: HostStoragePolicy,\n\tsearchParams: URLSearchParams,\n): ISharingLinkKind | undefined {\n\t// extract request parameters for creation of sharing link (if provided) if the feature is enabled\n\tlet createShareLinkParam: ISharingLinkKind | undefined;\n\tif (hostPolicy.enableSingleRequestForShareLinkWithCreate) {\n\t\tconst createLinkScope = searchParams.get(\"createLinkScope\");\n\t\tconst createLinkRole = searchParams.get(\"createLinkRole\");\n\t\tif (createLinkScope && SharingLinkScope[createLinkScope]) {\n\t\t\tcreateShareLinkParam = {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tscope: SharingLinkScope[createLinkScope],\n\t\t\t\t...(createLinkRole && SharingLinkRole[createLinkRole]\n\t\t\t\t\t? // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\t\t{ role: SharingLinkRole[createLinkRole] }\n\t\t\t\t\t: {}),\n\t\t\t};\n\t\t}\n\t}\n\treturn createShareLinkParam;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"odspDocumentStorageManager.d.ts","sourceRoot":"","sources":["../src/odspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EACN,WAAW,EACX,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,MAAM,6CAA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CAAC,EAAE,yBAAyB,YAAA;IAWrE,IAAW,0BAA0B,IAAI,OAAO,GAAG,SAAS,CAE3D;IAEY,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;cAgD5D,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,WAAW,CAAC;IA+CV,eAAe,CAC3B,OAAO,CAAC,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GAEnB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAQhC;;;;OAIG;IACU,WAAW,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;YAgB5E,aAAa;IA4Md,WAAW,CAEvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;YA+ER,wBAAwB;YAuBxB,4BAA4B;IAgJ7B,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;YAyFJ,4BAA4B;IAuB1C,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,qBAAqB;cAUb,qBAAqB,CACpC,EAAE,EAAE,MAAM,EACV,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAwCrC"}
@@ -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 { performanceNow } from "@fluid-internal/client-utils";
5
+ import { ArrayBufferLikeToArrayBuffer, performanceNow } from "@fluid-internal/client-utils";
6
6
  import { LogLevel } from "@fluidframework/core-interfaces";
7
7
  import { assert, delay } from "@fluidframework/core-utils/internal";
8
8
  import { promiseRaceWithWinner } from "@fluidframework/driver-base/internal";
@@ -18,6 +18,36 @@ import { createCacheSnapshotKey, getWithRetryForTokenRefresh, isInstanceOfISnaps
18
18
  import { pkgVersion as driverVersion } from "./packageVersion.js";
19
19
  export const defaultSummarizerCacheExpiryTimeout = 60 * 1000; // 60 seconds.
20
20
  export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
21
+ odspResolvedUrl;
22
+ getAuthHeader;
23
+ logger;
24
+ fetchFullSnapshot;
25
+ cache;
26
+ hostPolicy;
27
+ epochTracker;
28
+ flushCallback;
29
+ relayServiceTenantAndSessionId;
30
+ snapshotFormatFetchType;
31
+ odspSummaryModuleLoaded = false;
32
+ summaryModuleP;
33
+ odspSummaryUploadManager;
34
+ firstSnapshotFetchCall = true;
35
+ _isFirstSnapshotFromNetwork;
36
+ documentId;
37
+ snapshotUrl;
38
+ attachmentPOSTUrl;
39
+ attachmentGETUrl;
40
+ config;
41
+ // Driver specified limits for snapshot size and time.
42
+ /**
43
+ * NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to
44
+ * happen until blob request throttling is implemented. Until then, as a temporary fix we set arbitrarily large
45
+ * snapshot size and timeout limits so that such failures are unlikely to occur.
46
+ */
47
+ maxSnapshotSizeLimit = 500000000; // 500 MB
48
+ maxSnapshotFetchTimeout = 120000; // 2 min
49
+ // limits the amount of parallel "attachment" blob uploads
50
+ createBlobRateLimiter = new RateLimiter(1);
21
51
  constructor(odspResolvedUrl, getAuthHeader, logger, fetchFullSnapshot, cache, hostPolicy, epochTracker, flushCallback, relayServiceTenantAndSessionId, snapshotFormatFetchType) {
22
52
  super(loggerToMonitoringContext(logger).config);
23
53
  this.odspResolvedUrl = odspResolvedUrl;
@@ -30,18 +60,6 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
30
60
  this.flushCallback = flushCallback;
31
61
  this.relayServiceTenantAndSessionId = relayServiceTenantAndSessionId;
32
62
  this.snapshotFormatFetchType = snapshotFormatFetchType;
33
- this.odspSummaryModuleLoaded = false;
34
- this.firstSnapshotFetchCall = true;
35
- // Driver specified limits for snapshot size and time.
36
- /**
37
- * NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to
38
- * happen until blob request throttling is implemented. Until then, as a temporary fix we set arbitrarily large
39
- * snapshot size and timeout limits so that such failures are unlikely to occur.
40
- */
41
- this.maxSnapshotSizeLimit = 500000000; // 500 MB
42
- this.maxSnapshotFetchTimeout = 120000; // 2 min
43
- // limits the amount of parallel "attachment" blob uploads
44
- this.createBlobRateLimiter = new RateLimiter(1);
45
63
  this.documentId = this.odspResolvedUrl.hashedDocumentId;
46
64
  this.snapshotUrl = this.odspResolvedUrl.endpoints.snapshotStorageUrl;
47
65
  this.attachmentPOSTUrl = this.odspResolvedUrl.endpoints.attachmentPOSTStorageUrl;
@@ -69,7 +87,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
69
87
  waitQueueLength: this.createBlobRateLimiter.waitQueueLength,
70
88
  }, async (event) => {
71
89
  const res = await this.createBlobRateLimiter.schedule(async () => this.epochTracker.fetchAndParseAsJSON(url, {
72
- body: file,
90
+ body: ArrayBufferLikeToArrayBuffer(file),
73
91
  headers,
74
92
  method,
75
93
  }, "createBlob"));