@fluidframework/routerlicious-driver 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -12
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +156 -0
- package/README.md +39 -1
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/routerlicious-driver.api.md +108 -0
- package/dist/cache.cjs +30 -0
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.ts +7 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/{definitions.js → contracts.cjs} +1 -1
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.d.ts +42 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/{createNewUtils.js → createNewUtils.cjs} +7 -5
- package/dist/createNewUtils.cjs.map +1 -0
- package/dist/createNewUtils.d.ts +1 -1
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/{defaultTokenProvider.js → defaultTokenProvider.cjs} +2 -1
- package/dist/defaultTokenProvider.cjs.map +1 -0
- package/dist/defaultTokenProvider.d.ts +1 -0
- package/dist/defaultTokenProvider.d.ts.map +1 -1
- package/dist/definitions.cjs +7 -0
- package/dist/definitions.cjs.map +1 -0
- package/dist/definitions.d.ts.map +1 -1
- package/dist/deltaStorageService.cjs +122 -0
- package/dist/deltaStorageService.cjs.map +1 -0
- package/dist/deltaStorageService.d.ts +7 -6
- package/dist/deltaStorageService.d.ts.map +1 -1
- package/dist/{documentDeltaConnection.js → documentDeltaConnection.cjs} +8 -13
- package/dist/documentDeltaConnection.cjs.map +1 -0
- package/dist/documentDeltaConnection.d.ts +3 -4
- package/dist/documentDeltaConnection.d.ts.map +1 -1
- package/dist/{documentService.js → documentService.cjs} +61 -64
- package/dist/documentService.cjs.map +1 -0
- package/dist/documentService.d.ts +12 -4
- package/dist/documentService.d.ts.map +1 -1
- package/dist/{documentServiceFactory.js → documentServiceFactory.cjs} +87 -33
- package/dist/documentServiceFactory.cjs.map +1 -0
- package/dist/documentServiceFactory.d.ts +5 -3
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/{documentStorageService.js → documentStorageService.cjs} +18 -16
- package/dist/documentStorageService.cjs.map +1 -0
- package/dist/documentStorageService.d.ts +4 -3
- package/dist/documentStorageService.d.ts.map +1 -1
- package/dist/errorUtils.cjs +87 -0
- package/dist/errorUtils.cjs.map +1 -0
- package/dist/errorUtils.d.ts +56 -10
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/gitManager.cjs +46 -0
- package/dist/gitManager.cjs.map +1 -0
- package/dist/gitManager.d.ts +27 -0
- package/dist/gitManager.d.ts.map +1 -0
- package/dist/historian.cjs +72 -0
- package/dist/historian.cjs.map +1 -0
- package/dist/historian.d.ts +34 -0
- package/dist/historian.d.ts.map +1 -0
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/mapWithExpiration.cjs +105 -0
- package/dist/mapWithExpiration.cjs.map +1 -0
- package/dist/mapWithExpiration.d.ts +34 -0
- package/dist/mapWithExpiration.d.ts.map +1 -0
- package/dist/{nullBlobStorageService.js → nullBlobStorageService.cjs} +5 -5
- package/dist/nullBlobStorageService.cjs.map +1 -0
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/{policies.js → policies.cjs} +1 -1
- package/dist/policies.cjs.map +1 -0
- package/dist/policies.d.ts +22 -9
- package/dist/policies.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.cjs +73 -0
- package/dist/r11sSnapshotParser.cjs.map +1 -0
- package/dist/r11sSnapshotParser.d.ts +14 -0
- package/dist/r11sSnapshotParser.d.ts.map +1 -0
- package/dist/restWrapper.cjs +249 -0
- package/dist/restWrapper.cjs.map +1 -0
- package/dist/restWrapper.d.ts +32 -12
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapperBase.cjs +89 -0
- package/dist/restWrapperBase.cjs.map +1 -0
- package/dist/restWrapperBase.d.ts +26 -0
- package/dist/restWrapperBase.d.ts.map +1 -0
- package/dist/retriableGitManager.cjs +40 -0
- package/dist/retriableGitManager.cjs.map +1 -0
- package/dist/retriableGitManager.d.ts +13 -23
- package/dist/retriableGitManager.d.ts.map +1 -1
- package/dist/routerlicious-driver-alpha.d.ts +92 -0
- package/dist/routerlicious-driver-beta.d.ts +98 -0
- package/dist/routerlicious-driver-public.d.ts +98 -0
- package/dist/routerlicious-driver-untrimmed.d.ts +261 -0
- package/dist/{shreddedSummaryDocumentStorageService.js → shreddedSummaryDocumentStorageService.cjs} +41 -34
- package/dist/shreddedSummaryDocumentStorageService.cjs.map +1 -0
- package/dist/shreddedSummaryDocumentStorageService.d.ts +6 -5
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/storageContracts.cjs +7 -0
- package/dist/storageContracts.cjs.map +1 -0
- package/dist/storageContracts.d.ts +45 -0
- package/dist/storageContracts.d.ts.map +1 -0
- package/dist/summaryTreeUploadManager.cjs +110 -0
- package/dist/summaryTreeUploadManager.cjs.map +1 -0
- package/dist/summaryTreeUploadManager.d.ts +23 -0
- package/dist/summaryTreeUploadManager.d.ts.map +1 -0
- package/dist/{tokens.js → tokens.cjs} +1 -1
- package/dist/tokens.cjs.map +1 -0
- package/dist/tokens.d.ts +34 -5
- package/dist/tokens.d.ts.map +1 -1
- package/dist/treeUtils.cjs +107 -0
- package/dist/treeUtils.cjs.map +1 -0
- package/dist/treeUtils.d.ts +58 -0
- package/dist/treeUtils.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/{urlUtils.js → urlUtils.cjs} +21 -25
- package/dist/urlUtils.cjs.map +1 -0
- package/dist/urlUtils.d.ts +2 -2
- package/dist/urlUtils.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.cjs +253 -0
- package/dist/wholeSummaryDocumentStorageService.cjs.map +1 -0
- package/dist/wholeSummaryDocumentStorageService.d.ts +10 -8
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryUploadManager.cjs +37 -0
- package/dist/wholeSummaryUploadManager.cjs.map +1 -0
- package/dist/wholeSummaryUploadManager.d.ts +16 -0
- package/dist/wholeSummaryUploadManager.d.ts.map +1 -0
- package/lib/{cache.d.ts → cache.d.mts} +7 -0
- package/lib/cache.d.mts.map +1 -0
- package/lib/cache.mjs +25 -0
- package/lib/cache.mjs.map +1 -0
- package/lib/contracts.d.mts +42 -0
- package/lib/contracts.d.mts.map +1 -0
- package/lib/{definitions.js → contracts.mjs} +1 -1
- package/lib/contracts.mjs.map +1 -0
- package/lib/{createNewUtils.d.ts → createNewUtils.d.mts} +1 -1
- package/lib/{createNewUtils.d.ts.map → createNewUtils.d.mts.map} +1 -1
- package/lib/{createNewUtils.js → createNewUtils.mjs} +7 -5
- package/lib/createNewUtils.mjs.map +1 -0
- package/lib/{defaultTokenProvider.d.ts → defaultTokenProvider.d.mts} +2 -1
- package/lib/defaultTokenProvider.d.mts.map +1 -0
- package/lib/{defaultTokenProvider.js → defaultTokenProvider.mjs} +2 -1
- package/lib/defaultTokenProvider.mjs.map +1 -0
- package/lib/definitions.d.mts.map +1 -0
- package/lib/definitions.mjs +6 -0
- package/{dist/definitions.js.map → lib/definitions.mjs.map} +1 -1
- package/lib/{deltaStorageService.d.ts → deltaStorageService.d.mts} +8 -7
- package/lib/deltaStorageService.d.mts.map +1 -0
- package/lib/deltaStorageService.mjs +117 -0
- package/lib/deltaStorageService.mjs.map +1 -0
- package/lib/{documentDeltaConnection.d.ts → documentDeltaConnection.d.mts} +3 -4
- package/lib/documentDeltaConnection.d.mts.map +1 -0
- package/lib/{documentDeltaConnection.js → documentDeltaConnection.mjs} +8 -13
- package/lib/documentDeltaConnection.mjs.map +1 -0
- package/lib/{documentService.d.ts → documentService.d.mts} +16 -8
- package/lib/documentService.d.mts.map +1 -0
- package/lib/{documentService.js → documentService.mjs} +60 -44
- package/lib/documentService.mjs.map +1 -0
- package/lib/{documentServiceFactory.d.ts → documentServiceFactory.d.mts} +7 -5
- package/lib/documentServiceFactory.d.mts.map +1 -0
- package/lib/{documentServiceFactory.js → documentServiceFactory.mjs} +88 -34
- package/lib/documentServiceFactory.mjs.map +1 -0
- package/lib/{documentStorageService.d.ts → documentStorageService.d.mts} +7 -6
- package/lib/documentStorageService.d.mts.map +1 -0
- package/lib/{documentStorageService.js → documentStorageService.mjs} +19 -17
- package/lib/documentStorageService.mjs.map +1 -0
- package/lib/errorUtils.d.mts +93 -0
- package/lib/errorUtils.d.mts.map +1 -0
- package/lib/errorUtils.mjs +81 -0
- package/lib/errorUtils.mjs.map +1 -0
- package/lib/gitManager.d.mts +27 -0
- package/lib/gitManager.d.mts.map +1 -0
- package/lib/gitManager.mjs +42 -0
- package/lib/gitManager.mjs.map +1 -0
- package/lib/historian.d.mts +34 -0
- package/lib/historian.d.mts.map +1 -0
- package/lib/historian.mjs +67 -0
- package/lib/historian.mjs.map +1 -0
- package/lib/index.d.mts +10 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +8 -0
- package/lib/index.mjs.map +1 -0
- package/lib/mapWithExpiration.d.mts +34 -0
- package/lib/mapWithExpiration.d.mts.map +1 -0
- package/lib/mapWithExpiration.mjs +101 -0
- package/lib/mapWithExpiration.mjs.map +1 -0
- package/lib/nullBlobStorageService.d.mts.map +1 -0
- package/lib/{nullBlobStorageService.js → nullBlobStorageService.mjs} +5 -5
- package/lib/nullBlobStorageService.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
- package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{policies.d.ts → policies.d.mts} +22 -9
- package/lib/policies.d.mts.map +1 -0
- package/lib/{policies.js → policies.mjs} +1 -1
- package/lib/policies.mjs.map +1 -0
- package/lib/r11sSnapshotParser.d.mts +14 -0
- package/lib/r11sSnapshotParser.d.mts.map +1 -0
- package/lib/r11sSnapshotParser.mjs +69 -0
- package/lib/r11sSnapshotParser.mjs.map +1 -0
- package/lib/restWrapper.d.mts +53 -0
- package/lib/restWrapper.d.mts.map +1 -0
- package/lib/restWrapper.mjs +236 -0
- package/lib/restWrapper.mjs.map +1 -0
- package/lib/restWrapperBase.d.mts +26 -0
- package/lib/restWrapperBase.d.mts.map +1 -0
- package/lib/restWrapperBase.mjs +84 -0
- package/lib/restWrapperBase.mjs.map +1 -0
- package/lib/retriableGitManager.d.mts +24 -0
- package/lib/retriableGitManager.d.mts.map +1 -0
- package/lib/retriableGitManager.mjs +36 -0
- package/lib/retriableGitManager.mjs.map +1 -0
- package/lib/routerlicious-driver-alpha.d.mts +92 -0
- package/lib/routerlicious-driver-beta.d.mts +98 -0
- package/lib/routerlicious-driver-public.d.mts +98 -0
- package/lib/routerlicious-driver-untrimmed.d.mts +261 -0
- package/lib/{shreddedSummaryDocumentStorageService.d.ts → shreddedSummaryDocumentStorageService.d.mts} +9 -8
- package/lib/shreddedSummaryDocumentStorageService.d.mts.map +1 -0
- package/lib/{shreddedSummaryDocumentStorageService.js → shreddedSummaryDocumentStorageService.mjs} +41 -34
- package/lib/shreddedSummaryDocumentStorageService.mjs.map +1 -0
- package/lib/storageContracts.d.mts +45 -0
- package/lib/storageContracts.d.mts.map +1 -0
- package/lib/storageContracts.mjs +6 -0
- package/lib/storageContracts.mjs.map +1 -0
- package/lib/summaryTreeUploadManager.d.mts +23 -0
- package/lib/summaryTreeUploadManager.d.mts.map +1 -0
- package/lib/summaryTreeUploadManager.mjs +106 -0
- package/lib/summaryTreeUploadManager.mjs.map +1 -0
- package/lib/{tokens.d.ts → tokens.d.mts} +34 -5
- package/lib/tokens.d.mts.map +1 -0
- package/lib/{tokens.js → tokens.mjs} +1 -1
- package/lib/tokens.mjs.map +1 -0
- package/lib/treeUtils.d.mts +58 -0
- package/lib/treeUtils.d.mts.map +1 -0
- package/lib/treeUtils.mjs +100 -0
- package/lib/treeUtils.mjs.map +1 -0
- package/lib/{urlUtils.d.ts → urlUtils.d.mts} +2 -2
- package/lib/urlUtils.d.mts.map +1 -0
- package/lib/urlUtils.mjs +38 -0
- package/lib/urlUtils.mjs.map +1 -0
- package/lib/{wholeSummaryDocumentStorageService.d.ts → wholeSummaryDocumentStorageService.d.mts} +12 -10
- package/lib/wholeSummaryDocumentStorageService.d.mts.map +1 -0
- package/lib/wholeSummaryDocumentStorageService.mjs +249 -0
- package/lib/wholeSummaryDocumentStorageService.mjs.map +1 -0
- package/lib/wholeSummaryUploadManager.d.mts +16 -0
- package/lib/wholeSummaryUploadManager.d.mts.map +1 -0
- package/lib/wholeSummaryUploadManager.mjs +33 -0
- package/lib/wholeSummaryUploadManager.mjs.map +1 -0
- package/package.json +104 -68
- package/prettier.config.cjs +8 -0
- package/src/cache.ts +25 -9
- package/src/contracts.ts +60 -0
- package/src/createNewUtils.ts +26 -24
- package/src/defaultTokenProvider.ts +14 -15
- package/src/definitions.ts +2 -2
- package/src/deltaStorageService.ts +145 -91
- package/src/documentDeltaConnection.ts +54 -52
- package/src/documentService.ts +272 -242
- package/src/documentServiceFactory.ts +338 -237
- package/src/documentStorageService.ts +92 -84
- package/src/errorUtils.ts +117 -79
- package/src/gitManager.ts +67 -0
- package/src/historian.ts +121 -0
- package/src/index.ts +15 -8
- package/src/mapWithExpiration.ts +124 -0
- package/src/nullBlobStorageService.ts +24 -21
- package/src/packageVersion.ts +1 -1
- package/src/policies.ts +51 -38
- package/src/r11sSnapshotParser.ts +82 -0
- package/src/restWrapper.ts +400 -216
- package/src/restWrapperBase.ts +146 -0
- package/src/retriableGitManager.ts +76 -153
- package/src/shreddedSummaryDocumentStorageService.ts +214 -195
- package/src/storageContracts.ts +63 -0
- package/src/summaryTreeUploadManager.ts +155 -0
- package/src/tokens.ts +74 -39
- package/src/treeUtils.ts +138 -0
- package/src/urlUtils.ts +27 -28
- package/src/wholeSummaryDocumentStorageService.ts +352 -252
- package/src/wholeSummaryUploadManager.ts +64 -0
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +10 -13
- package/dist/cache.js +0 -20
- package/dist/cache.js.map +0 -1
- package/dist/createNewUtils.js.map +0 -1
- package/dist/defaultTokenProvider.js.map +0 -1
- package/dist/deltaStorageService.js +0 -82
- package/dist/deltaStorageService.js.map +0 -1
- package/dist/documentDeltaConnection.js.map +0 -1
- package/dist/documentService.js.map +0 -1
- package/dist/documentServiceFactory.js.map +0 -1
- package/dist/documentStorageService.js.map +0 -1
- package/dist/errorUtils.js +0 -56
- package/dist/errorUtils.js.map +0 -1
- package/dist/index.js +0 -25
- package/dist/index.js.map +0 -1
- package/dist/nullBlobStorageService.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/policies.js.map +0 -1
- package/dist/restWrapper.js +0 -153
- package/dist/restWrapper.js.map +0 -1
- package/dist/retriableGitManager.js +0 -76
- package/dist/retriableGitManager.js.map +0 -1
- package/dist/shreddedSummaryDocumentStorageService.js.map +0 -1
- package/dist/tokens.js.map +0 -1
- package/dist/urlUtils.js.map +0 -1
- package/dist/wholeSummaryDocumentStorageService.js +0 -191
- package/dist/wholeSummaryDocumentStorageService.js.map +0 -1
- package/lib/cache.d.ts.map +0 -1
- package/lib/cache.js +0 -16
- package/lib/cache.js.map +0 -1
- package/lib/createNewUtils.js.map +0 -1
- package/lib/defaultTokenProvider.d.ts.map +0 -1
- package/lib/defaultTokenProvider.js.map +0 -1
- package/lib/definitions.d.ts.map +0 -1
- package/lib/definitions.js.map +0 -1
- package/lib/deltaStorageService.d.ts.map +0 -1
- package/lib/deltaStorageService.js +0 -77
- package/lib/deltaStorageService.js.map +0 -1
- package/lib/documentDeltaConnection.d.ts.map +0 -1
- package/lib/documentDeltaConnection.js.map +0 -1
- package/lib/documentService.d.ts.map +0 -1
- package/lib/documentService.js.map +0 -1
- package/lib/documentServiceFactory.d.ts.map +0 -1
- package/lib/documentServiceFactory.js.map +0 -1
- package/lib/documentStorageService.d.ts.map +0 -1
- package/lib/documentStorageService.js.map +0 -1
- package/lib/errorUtils.d.ts +0 -47
- package/lib/errorUtils.d.ts.map +0 -1
- package/lib/errorUtils.js +0 -50
- package/lib/errorUtils.js.map +0 -1
- package/lib/index.d.ts +0 -13
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -13
- package/lib/index.js.map +0 -1
- package/lib/nullBlobStorageService.d.ts.map +0 -1
- package/lib/nullBlobStorageService.js.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/policies.d.ts.map +0 -1
- package/lib/policies.js.map +0 -1
- package/lib/restWrapper.d.ts +0 -33
- package/lib/restWrapper.d.ts.map +0 -1
- package/lib/restWrapper.js +0 -144
- package/lib/restWrapper.js.map +0 -1
- package/lib/retriableGitManager.d.ts +0 -34
- package/lib/retriableGitManager.d.ts.map +0 -1
- package/lib/retriableGitManager.js +0 -72
- package/lib/retriableGitManager.js.map +0 -1
- package/lib/shreddedSummaryDocumentStorageService.d.ts.map +0 -1
- package/lib/shreddedSummaryDocumentStorageService.js.map +0 -1
- package/lib/tokens.d.ts.map +0 -1
- package/lib/tokens.js.map +0 -1
- package/lib/urlUtils.d.ts.map +0 -1
- package/lib/urlUtils.js +0 -42
- package/lib/urlUtils.js.map +0 -1
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +0 -1
- package/lib/wholeSummaryDocumentStorageService.js +0 -187
- package/lib/wholeSummaryDocumentStorageService.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
- /package/lib/{definitions.d.ts → definitions.d.mts} +0 -0
- /package/lib/{nullBlobStorageService.d.ts → nullBlobStorageService.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wholeSummaryDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/wholeSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"wholeSummaryDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/wholeSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EAInB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EACN,uBAAuB,EACvB,eAAe,EACf,+BAA+B,EAC/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAiB,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAM1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,wBAAwB,EAAsB,MAAM,aAAa,CAAC;AAK3E,qBAAa,kCAAmC,YAAW,uBAAuB;IAYhF,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM;IAC7B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU;IACtC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB;aAC9B,QAAQ,EAAE,+BAA+B;IACzD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACnC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAnBnC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IACvC,OAAO,CAAC,iBAAiB,CAAiB;IAE1C,SAAgB,aAAa,MAAM;YAErB,uBAAuB;gBAMjB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,+BAA+B,EACxC,cAAc,CAAC,0CAA8B,EAC7C,SAAS,GAAE,MAAM,CAAC,eAAe,CAAuB,EACxD,iBAAiB,GAAE,MAAM,CAAC,wBAAwB,CAAuB,EACzE,iBAAiB,CAAC,wBAAY,EAC9B,iBAAiB,GAAE,CACnC,YAAY,CAAC,EAAE,OAAO,KAClB,OAAO,CAAC,UAAU,CAGP;IAQJ,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IA0FzE,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IA+BlE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAgClD,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAqBL,eAAe,CAAC,aAAa,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAwBrE,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAqB9D,iBAAiB;YA4CjB,sBAAsB;YAetB,gBAAgB;IAS9B,OAAO,CAAC,WAAW;CAGnB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.WholeSummaryUploadManager = void 0;
|
|
8
|
+
const server_services_client_1 = require("@fluidframework/server-services-client");
|
|
9
|
+
/**
|
|
10
|
+
* Converts summary to snapshot tree and uploads with single snaphot tree payload.
|
|
11
|
+
*/
|
|
12
|
+
class WholeSummaryUploadManager {
|
|
13
|
+
constructor(manager) {
|
|
14
|
+
this.manager = manager;
|
|
15
|
+
}
|
|
16
|
+
async writeSummaryTree(summaryTree, parentHandle, summaryType, sequenceNumber = 0, initial = false) {
|
|
17
|
+
const id = await this.writeSummaryTreeCore(parentHandle, summaryTree, summaryType, sequenceNumber, initial);
|
|
18
|
+
if (!id) {
|
|
19
|
+
throw new Error(`Failed to write summary tree`);
|
|
20
|
+
}
|
|
21
|
+
return id;
|
|
22
|
+
}
|
|
23
|
+
async writeSummaryTreeCore(parentHandle, tree, type, sequenceNumber, initial) {
|
|
24
|
+
const snapshotTree = (0, server_services_client_1.convertSummaryTreeToWholeSummaryTree)(parentHandle, tree, "", type === "channel" ? ".app" : "");
|
|
25
|
+
const snapshotPayload = {
|
|
26
|
+
entries: snapshotTree.entries ?? [],
|
|
27
|
+
message: "",
|
|
28
|
+
sequenceNumber,
|
|
29
|
+
type,
|
|
30
|
+
};
|
|
31
|
+
return this.manager
|
|
32
|
+
.createSummary(snapshotPayload, initial)
|
|
33
|
+
.then((response) => response.content.id);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.WholeSummaryUploadManager = WholeSummaryUploadManager;
|
|
37
|
+
//# sourceMappingURL=wholeSummaryUploadManager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wholeSummaryUploadManager.cjs","sourceRoot":"","sources":["../src/wholeSummaryUploadManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mFAKgD;AAGhD;;GAEG;AACH,MAAa,yBAAyB;IACrC,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAE9C,KAAK,CAAC,gBAAgB,CAC5B,WAAyB,EACzB,YAAgC,EAChC,WAAqC,EACrC,iBAAyB,CAAC,EAC1B,UAAmB,KAAK;QAExB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,oBAAoB,CACzC,YAAY,EACZ,WAAW,EACX,WAAW,EACX,cAAc,EACd,OAAO,CACP,CAAC;QACF,IAAI,CAAC,EAAE,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SAChD;QACD,OAAO,EAAE,CAAC;IACX,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,YAAgC,EAChC,IAAkB,EAClB,IAA8B,EAC9B,cAAsB,EACtB,OAAgB;QAEhB,MAAM,YAAY,GAAG,IAAA,6DAAoC,EACxD,YAAY,EACZ,IAAI,EACJ,EAAE,EACF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAChC,CAAC;QACF,MAAM,eAAe,GAAyB;YAC7C,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,EAAE;YACnC,OAAO,EAAE,EAAE;YACX,cAAc;YACd,IAAI;SACJ,CAAC;QAEF,OAAO,IAAI,CAAC,OAAO;aACjB,aAAa,CAAC,eAAe,EAAE,OAAO,CAAC;aACvC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;CACD;AA/CD,8DA+CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tISummaryTree,\n\tIWholeSummaryPayload,\n\tIWholeSummaryPayloadType,\n\tconvertSummaryTreeToWholeSummaryTree,\n} from \"@fluidframework/server-services-client\";\nimport { IGitManager, ISummaryUploadManager } from \"./storageContracts\";\n\n/**\n * Converts summary to snapshot tree and uploads with single snaphot tree payload.\n */\nexport class WholeSummaryUploadManager implements ISummaryUploadManager {\n\tconstructor(private readonly manager: IGitManager) {}\n\n\tpublic async writeSummaryTree(\n\t\tsummaryTree: ISummaryTree,\n\t\tparentHandle: string | undefined,\n\t\tsummaryType: IWholeSummaryPayloadType,\n\t\tsequenceNumber: number = 0,\n\t\tinitial: boolean = false,\n\t): Promise<string> {\n\t\tconst id = await this.writeSummaryTreeCore(\n\t\t\tparentHandle,\n\t\t\tsummaryTree,\n\t\t\tsummaryType,\n\t\t\tsequenceNumber,\n\t\t\tinitial,\n\t\t);\n\t\tif (!id) {\n\t\t\tthrow new Error(`Failed to write summary tree`);\n\t\t}\n\t\treturn id;\n\t}\n\n\tprivate async writeSummaryTreeCore(\n\t\tparentHandle: string | undefined,\n\t\ttree: ISummaryTree,\n\t\ttype: IWholeSummaryPayloadType,\n\t\tsequenceNumber: number,\n\t\tinitial: boolean,\n\t): Promise<string> {\n\t\tconst snapshotTree = convertSummaryTreeToWholeSummaryTree(\n\t\t\tparentHandle,\n\t\t\ttree,\n\t\t\t\"\",\n\t\t\ttype === \"channel\" ? \".app\" : \"\",\n\t\t);\n\t\tconst snapshotPayload: IWholeSummaryPayload = {\n\t\t\tentries: snapshotTree.entries ?? [],\n\t\t\tmessage: \"\",\n\t\t\tsequenceNumber,\n\t\t\ttype,\n\t\t};\n\n\t\treturn this.manager\n\t\t\t.createSummary(snapshotPayload, initial)\n\t\t\t.then((response) => response.content.id);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ISummaryTree, IWholeSummaryPayloadType } from "@fluidframework/server-services-client";
|
|
6
|
+
import { IGitManager, ISummaryUploadManager } from "./storageContracts";
|
|
7
|
+
/**
|
|
8
|
+
* Converts summary to snapshot tree and uploads with single snaphot tree payload.
|
|
9
|
+
*/
|
|
10
|
+
export declare class WholeSummaryUploadManager implements ISummaryUploadManager {
|
|
11
|
+
private readonly manager;
|
|
12
|
+
constructor(manager: IGitManager);
|
|
13
|
+
writeSummaryTree(summaryTree: ISummaryTree, parentHandle: string | undefined, summaryType: IWholeSummaryPayloadType, sequenceNumber?: number, initial?: boolean): Promise<string>;
|
|
14
|
+
private writeSummaryTreeCore;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=wholeSummaryUploadManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wholeSummaryUploadManager.d.ts","sourceRoot":"","sources":["../src/wholeSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EAEZ,wBAAwB,EAExB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAExE;;GAEG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,WAAW;IAEpC,gBAAgB,CAC5B,WAAW,EAAE,YAAY,EACzB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,WAAW,EAAE,wBAAwB,EACrC,cAAc,GAAE,MAAU,EAC1B,OAAO,GAAE,OAAe,GACtB,OAAO,CAAC,MAAM,CAAC;YAcJ,oBAAoB;CAwBlC"}
|
|
@@ -6,8 +6,15 @@ export interface ICache<T> {
|
|
|
6
6
|
get(key: string): Promise<T | undefined>;
|
|
7
7
|
put(key: string, value: T): Promise<void>;
|
|
8
8
|
}
|
|
9
|
+
/** A basic in-memory cache that optionally supports expiring entries after a period of inactivity */
|
|
9
10
|
export declare class InMemoryCache<T> implements ICache<T> {
|
|
10
11
|
private readonly cache;
|
|
12
|
+
constructor(expirationMs?: number);
|
|
13
|
+
get(key: string): Promise<T | undefined>;
|
|
14
|
+
put(key: string, value: T): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/** This "cache" does nothing on put, and get always returns undefined */
|
|
17
|
+
export declare class NullCache<T> implements ICache<T> {
|
|
11
18
|
get(key: string): Promise<T | undefined>;
|
|
12
19
|
put(key: string, value: T): Promise<void>;
|
|
13
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,MAAM,CAAC,CAAC;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,qGAAqG;AACrG,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;gBAE3B,YAAY,CAAC,EAAE,MAAM;IAIpB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtD;AAED,yEAAyE;AACzE,qBAAa,SAAS,CAAC,CAAC,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;IAChC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CACtD"}
|
package/lib/cache.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { MapWithExpiration } from "./mapWithExpiration.mjs";
|
|
6
|
+
/** A basic in-memory cache that optionally supports expiring entries after a period of inactivity */
|
|
7
|
+
export class InMemoryCache {
|
|
8
|
+
constructor(expirationMs) {
|
|
9
|
+
this.cache = expirationMs !== undefined ? new MapWithExpiration(expirationMs) : new Map();
|
|
10
|
+
}
|
|
11
|
+
async get(key) {
|
|
12
|
+
return this.cache.get(key);
|
|
13
|
+
}
|
|
14
|
+
async put(key, value) {
|
|
15
|
+
this.cache.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** This "cache" does nothing on put, and get always returns undefined */
|
|
19
|
+
export class NullCache {
|
|
20
|
+
async get(key) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
async put(key, value) { }
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=cache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.mjs","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,iBAAiB,EAAE;AAO5B,qGAAqG;AACrG,MAAM,OAAO,aAAa;IAGzB,YAAY,YAAqB;QAChC,IAAI,CAAC,KAAK,GAAG,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,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;AAED,yEAAyE;AACzE,MAAM,OAAO,SAAS;IACd,KAAK,CAAC,GAAG,CAAC,GAAW;QAC3B,OAAO,SAAS,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAQ,IAAkB,CAAC;CACzD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { MapWithExpiration } from \"./mapWithExpiration\";\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 MapWithExpiration(expirationMs) : new Map();\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"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
6
|
+
export interface IWholeFlatSnapshotTreeEntryTree {
|
|
7
|
+
path: string;
|
|
8
|
+
type: "tree";
|
|
9
|
+
unreferenced?: true;
|
|
10
|
+
}
|
|
11
|
+
export interface IWholeFlatSnapshotTreeEntryBlob {
|
|
12
|
+
id: string;
|
|
13
|
+
path: string;
|
|
14
|
+
type: "blob";
|
|
15
|
+
}
|
|
16
|
+
export type IWholeFlatSnapshotTreeEntry = IWholeFlatSnapshotTreeEntryTree | IWholeFlatSnapshotTreeEntryBlob;
|
|
17
|
+
export interface IWholeFlatSnapshotTree {
|
|
18
|
+
entries: IWholeFlatSnapshotTreeEntry[];
|
|
19
|
+
id: string;
|
|
20
|
+
sequenceNumber: number;
|
|
21
|
+
}
|
|
22
|
+
export interface IWholeFlatSnapshotBlob {
|
|
23
|
+
content: string;
|
|
24
|
+
encoding: "base64" | "utf-8";
|
|
25
|
+
id: string;
|
|
26
|
+
size: number;
|
|
27
|
+
}
|
|
28
|
+
export interface IWholeFlatSnapshot {
|
|
29
|
+
id: string;
|
|
30
|
+
trees: IWholeFlatSnapshotTree[];
|
|
31
|
+
blobs?: IWholeFlatSnapshotBlob[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Normalized Whole Summary with decoded blobs and unflattened snapshot tree.
|
|
35
|
+
*/
|
|
36
|
+
export interface INormalizedWholeSnapshot {
|
|
37
|
+
blobs: Map<string, ArrayBuffer>;
|
|
38
|
+
snapshotTree: ISnapshotTree;
|
|
39
|
+
sequenceNumber: number | undefined;
|
|
40
|
+
id: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,aAAa,EAAE,MAAM,sCAAsC;AAQpE,MAAM,WAAW,+BAA+B;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IAEb,YAAY,CAAC,EAAE,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,2BAA2B,GACpC,+BAA+B,GAC/B,+BAA+B,CAAC;AAEnC,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IAElC,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChC,YAAY,EAAE,aAAa,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,EAAE,EAAE,MAAM,CAAC;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.mjs","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\n\n/*\n *\n * Whole Snapshot Download Data Structures\n *\n */\n\nexport interface IWholeFlatSnapshotTreeEntryTree {\n\tpath: string;\n\ttype: \"tree\";\n\t// Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.\n\tunreferenced?: true;\n}\n\nexport interface IWholeFlatSnapshotTreeEntryBlob {\n\tid: string;\n\tpath: string;\n\ttype: \"blob\";\n}\n\nexport type IWholeFlatSnapshotTreeEntry =\n\t| IWholeFlatSnapshotTreeEntryTree\n\t| IWholeFlatSnapshotTreeEntryBlob;\n\nexport interface IWholeFlatSnapshotTree {\n\tentries: IWholeFlatSnapshotTreeEntry[];\n\tid: string;\n\tsequenceNumber: number;\n}\n\nexport interface IWholeFlatSnapshotBlob {\n\tcontent: string;\n\tencoding: \"base64\" | \"utf-8\";\n\tid: string;\n\tsize: number;\n}\n\nexport interface IWholeFlatSnapshot {\n\t// The same as the id of the first snapshot tree in the trees array.\n\tid: string;\n\t// Receive an array of snapshot trees for future-proofing, however, always length 1 for now.\n\ttrees: IWholeFlatSnapshotTree[];\n\tblobs?: IWholeFlatSnapshotBlob[];\n}\n\n/**\n * Normalized Whole Summary with decoded blobs and unflattened snapshot tree.\n */\nexport interface INormalizedWholeSnapshot {\n\tblobs: Map<string, ArrayBuffer>;\n\tsnapshotTree: ISnapshotTree;\n\tsequenceNumber: number | undefined;\n\tid: string;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
|
6
6
|
/**
|
|
7
7
|
* Utility api to convert ISummaryTree to a summary tree where blob contents are only utf8 strings.
|
|
8
8
|
* @param summary - Summary supplied by the runtime to upload.
|
|
9
|
-
* @returns
|
|
9
|
+
* @returns Modified summary tree where the blob contents could be utf8 string only.
|
|
10
10
|
*/
|
|
11
11
|
export declare function convertSummaryToCreateNewSummary(summary: ISummaryTree): ISummaryTree;
|
|
12
12
|
//# sourceMappingURL=createNewUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNewUtils.d.ts","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"createNewUtils.d.ts","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,YAAY,EAAe,MAAM,sCAAsC;AAEhF;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CA2BpF"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { Uint8ArrayToString } from "@
|
|
5
|
+
import { Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
6
6
|
import { SummaryType } from "@fluidframework/protocol-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* Utility api to convert ISummaryTree to a summary tree where blob contents are only utf8 strings.
|
|
9
9
|
* @param summary - Summary supplied by the runtime to upload.
|
|
10
|
-
* @returns
|
|
10
|
+
* @returns Modified summary tree where the blob contents could be utf8 string only.
|
|
11
11
|
*/
|
|
12
12
|
export function convertSummaryToCreateNewSummary(summary) {
|
|
13
13
|
const keys = Object.keys(summary.tree);
|
|
@@ -19,8 +19,10 @@ export function convertSummaryToCreateNewSummary(summary) {
|
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
21
21
|
case SummaryType.Blob: {
|
|
22
|
-
summaryObject.content =
|
|
23
|
-
summaryObject.content
|
|
22
|
+
summaryObject.content =
|
|
23
|
+
typeof summaryObject.content === "string"
|
|
24
|
+
? summaryObject.content
|
|
25
|
+
: Uint8ArrayToString(summaryObject.content, "utf8");
|
|
24
26
|
break;
|
|
25
27
|
}
|
|
26
28
|
case SummaryType.Handle: {
|
|
@@ -33,4 +35,4 @@ export function convertSummaryToCreateNewSummary(summary) {
|
|
|
33
35
|
}
|
|
34
36
|
return summary;
|
|
35
37
|
}
|
|
36
|
-
//# sourceMappingURL=createNewUtils.
|
|
38
|
+
//# sourceMappingURL=createNewUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNewUtils.mjs","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,kBAAkB,EAAE,MAAM,8BAA8B;OAC1D,EAAgB,WAAW,EAAE,MAAM,sCAAsC;AAEhF;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAAC,OAAqB;IACrE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACvB,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAExC,QAAQ,aAAa,CAAC,IAAI,EAAE;YAC3B,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,gCAAgC,CAAC,aAAa,CAAC,CAAC;gBACpE,MAAM;aACN;YACD,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,aAAa,CAAC,OAAO;oBACpB,OAAO,aAAa,CAAC,OAAO,KAAK,QAAQ;wBACxC,CAAC,CAAC,aAAa,CAAC,OAAO;wBACvB,CAAC,CAAC,kBAAkB,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBACtD,MAAM;aACN;YACD,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;aACnE;YACD,OAAO,CAAC,CAAC;gBACR,MAAM,IAAI,KAAK,CAAC,qBAAqB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;aAC3D;SACD;KACD;IAED,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { ISummaryTree, SummaryType } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Utility api to convert ISummaryTree to a summary tree where blob contents are only utf8 strings.\n * @param summary - Summary supplied by the runtime to upload.\n * @returns Modified summary tree where the blob contents could be utf8 string only.\n */\nexport function convertSummaryToCreateNewSummary(summary: ISummaryTree): ISummaryTree {\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tsummary.tree[key] = convertSummaryToCreateNewSummary(summaryObject);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tsummaryObject.content =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? summaryObject.content\n\t\t\t\t\t\t: Uint8ArrayToString(summaryObject.content, \"utf8\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new Error(\"No handle should be present for first summary!!\");\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`Unknown tree type ${summaryObject.type}`);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn summary;\n}\n"]}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITokenProvider, ITokenResponse } from "./tokens";
|
|
5
|
+
import { ITokenProvider, ITokenResponse } from "./tokens.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* Default token provider in case the host does not provide one. It simply caches the provided jwt and returns it back.
|
|
8
|
+
* @internal
|
|
8
9
|
*/
|
|
9
10
|
export declare class DefaultTokenProvider implements ITokenProvider {
|
|
10
11
|
private readonly jwt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultTokenProvider.d.ts","sourceRoot":"","sources":["../src/defaultTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,cAAc,EAAE,cAAc,EAAE;AAEzC;;;GAGG;AAEH,qBAAa,oBAAqB,YAAW,cAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,MAAM;IAE3B,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAO5C,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;CAMzD"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Default token provider in case the host does not provide one. It simply caches the provided jwt and returns it back.
|
|
7
|
+
* @internal
|
|
7
8
|
*/
|
|
8
9
|
export class DefaultTokenProvider {
|
|
9
10
|
constructor(jwt) {
|
|
@@ -22,4 +23,4 @@ export class DefaultTokenProvider {
|
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
//# sourceMappingURL=defaultTokenProvider.
|
|
26
|
+
//# sourceMappingURL=defaultTokenProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultTokenProvider.mjs","sourceRoot":"","sources":["../src/defaultTokenProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AAEH,MAAM,OAAO,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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenProvider, ITokenResponse } from \"./tokens\";\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,aAAa,EAAE,MAAM,sCAAsC;AAEpE,MAAM,WAAW,oBAAoB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,aAAa,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.
|
|
1
|
+
{"version":3,"file":"definitions.mjs","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\n\nexport interface ISnapshotTreeVersion {\n\tid: string;\n\tsnapshotTree: ISnapshotTree;\n}\n"]}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IDeltaStorageService, IDocumentDeltaStorageService, IDeltasFetchResult, IStream } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { DocumentStorageService } from "./documentStorageService.mjs";
|
|
9
|
+
import { RestWrapper } from "./restWrapperBase.mjs";
|
|
10
10
|
/**
|
|
11
11
|
* Storage service limited to only being able to fetch documents for a specific document
|
|
12
12
|
*/
|
|
@@ -15,10 +15,11 @@ export declare class DocumentDeltaStorageService implements IDocumentDeltaStorag
|
|
|
15
15
|
private readonly id;
|
|
16
16
|
private readonly deltaStorageService;
|
|
17
17
|
private readonly documentStorageService;
|
|
18
|
-
|
|
18
|
+
private readonly logger;
|
|
19
|
+
constructor(tenantId: string, id: string, deltaStorageService: IDeltaStorageService, documentStorageService: DocumentStorageService, logger: ITelemetryLoggerExt);
|
|
19
20
|
private logtailSha;
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
private snapshotOps;
|
|
22
|
+
fetchMessages(fromTotal: number, toTotal: number | undefined, abortSignal?: AbortSignal, cachedOnly?: boolean, fetchReason?: string): IStream<ISequencedDocumentMessage[]>;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* Provides access to the underlying delta storage on the server for routerlicious driver.
|
|
@@ -29,7 +30,7 @@ export declare class DeltaStorageService implements IDeltaStorageService {
|
|
|
29
30
|
private readonly logger;
|
|
30
31
|
private readonly getRestWrapper;
|
|
31
32
|
private readonly getDeltaStorageUrl;
|
|
32
|
-
constructor(url: string, restWrapper: RestWrapper, logger:
|
|
33
|
+
constructor(url: string, restWrapper: RestWrapper, logger: ITelemetryLoggerExt, getRestWrapper?: () => Promise<RestWrapper>, getDeltaStorageUrl?: () => string);
|
|
33
34
|
get(tenantId: string, id: string, from: number, // inclusive
|
|
34
35
|
to: number): Promise<IDeltasFetchResult>;
|
|
35
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deltaStorageService.d.ts","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EACN,oBAAoB,EACpB,4BAA4B,EAC5B,kBAAkB,EAClB,OAAO,EACP,MAAM,oCAAoC;OACpC,EAAE,yBAAyB,EAAE,MAAM,sCAAsC;OAOzE,EAAE,mBAAmB,EAAoB,MAAM,iCAAiC;OAChF,EAAE,sBAAsB,EAAE;OAC1B,EAAE,WAAW,EAAE;AAWtB;;GAEG;AACH,qBAAa,2BAA4B,YAAW,4BAA4B;IAE9E,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJN,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,mBAAmB,EAAE,oBAAoB,EACzC,sBAAsB,EAAE,sBAAsB,EAC9C,MAAM,EAAE,mBAAmB;IAG7C,OAAO,CAAC,UAAU,CAA8D;IAChF,OAAO,CAAC,WAAW,CAA0C;IAE7D,aAAa,CACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,UAAU,CAAC,EAAE,OAAO,EACpB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAmEvC;AAED;;GAEG;AACH,qBAAa,mBAAoB,YAAW,oBAAoB;IAE9D,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAJlB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,mBAAmB,EAC3B,cAAc,GAAE,MAAM,OAAO,CAAC,WAAW,CAAgC,EACzE,kBAAkB,GAAE,MAAM,MAAuB;IAGtD,GAAG,CACf,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EAAE,YAAY;IAC1B,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,kBAAkB,CAAC;CAiC9B"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { getW3CData, validateMessages } from "@fluidframework/driver-base";
|
|
6
|
+
import { readAndParse, requestOps, emptyMessageStream, streamObserver, } from "@fluidframework/driver-utils";
|
|
7
|
+
import { PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
8
|
+
/**
|
|
9
|
+
* Maximum number of ops we can fetch at a time. This should be kept at 2k, as
|
|
10
|
+
* server determines whether to try to fallback to long-term storage if the ops range requested is larger than
|
|
11
|
+
* what they have locally available in short-term storage. So if we request 2k ops, they know it is not a
|
|
12
|
+
* specific request and they don't fall to long term storage which takes time.
|
|
13
|
+
* Please coordinate to AFR team if this value need to be changed.
|
|
14
|
+
*/
|
|
15
|
+
const MaxBatchDeltas = 2000;
|
|
16
|
+
/**
|
|
17
|
+
* Storage service limited to only being able to fetch documents for a specific document
|
|
18
|
+
*/
|
|
19
|
+
export class DocumentDeltaStorageService {
|
|
20
|
+
constructor(tenantId, id, deltaStorageService, documentStorageService, logger) {
|
|
21
|
+
this.tenantId = tenantId;
|
|
22
|
+
this.id = id;
|
|
23
|
+
this.deltaStorageService = deltaStorageService;
|
|
24
|
+
this.documentStorageService = documentStorageService;
|
|
25
|
+
this.logger = logger;
|
|
26
|
+
this.logtailSha = this.documentStorageService.logTailSha;
|
|
27
|
+
}
|
|
28
|
+
fetchMessages(fromTotal, toTotal, abortSignal, cachedOnly, fetchReason) {
|
|
29
|
+
if (cachedOnly) {
|
|
30
|
+
return emptyMessageStream;
|
|
31
|
+
}
|
|
32
|
+
let opsFromSnapshot = 0;
|
|
33
|
+
let opsFromStorage = 0;
|
|
34
|
+
const requestCallback = async (from, to, telemetryProps) => {
|
|
35
|
+
this.snapshotOps = this.logtailSha
|
|
36
|
+
? await readAndParse(this.documentStorageService, this.logtailSha)
|
|
37
|
+
: [];
|
|
38
|
+
this.logtailSha = undefined;
|
|
39
|
+
if (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {
|
|
40
|
+
const messages = this.snapshotOps.filter((op) => op.sequenceNumber >= from && op.sequenceNumber < to);
|
|
41
|
+
validateMessages("snapshotOps", messages, from, this.logger, false /* strict */);
|
|
42
|
+
if (messages.length > 0 && messages[0].sequenceNumber === from) {
|
|
43
|
+
this.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);
|
|
44
|
+
opsFromSnapshot += messages.length;
|
|
45
|
+
return { messages, partialResult: true };
|
|
46
|
+
}
|
|
47
|
+
this.snapshotOps = undefined;
|
|
48
|
+
}
|
|
49
|
+
const ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to);
|
|
50
|
+
validateMessages("storage", ops.messages, from, this.logger, false /* strict */);
|
|
51
|
+
opsFromStorage += ops.messages.length;
|
|
52
|
+
return ops;
|
|
53
|
+
};
|
|
54
|
+
const stream = requestOps(async (from, to, telemetryProps) => {
|
|
55
|
+
const result = await requestCallback(from, to, telemetryProps);
|
|
56
|
+
// Catch all case, just in case
|
|
57
|
+
validateMessages("catch all", result.messages, from, this.logger);
|
|
58
|
+
return result;
|
|
59
|
+
},
|
|
60
|
+
// Staging: starting with no concurrency, listening for feedback first.
|
|
61
|
+
// In future releases we will switch to actual concurrency
|
|
62
|
+
1, // concurrency
|
|
63
|
+
fromTotal, // inclusive
|
|
64
|
+
toTotal, // exclusive
|
|
65
|
+
MaxBatchDeltas, this.logger, abortSignal, fetchReason);
|
|
66
|
+
return streamObserver(stream, (result) => {
|
|
67
|
+
if (result.done && opsFromSnapshot + opsFromStorage !== 0) {
|
|
68
|
+
this.logger.sendPerformanceEvent({
|
|
69
|
+
eventName: "CacheOpsRetrieved",
|
|
70
|
+
opsFromSnapshot,
|
|
71
|
+
opsFromStorage,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Provides access to the underlying delta storage on the server for routerlicious driver.
|
|
79
|
+
*/
|
|
80
|
+
export class DeltaStorageService {
|
|
81
|
+
constructor(url, restWrapper, logger, getRestWrapper = async () => this.restWrapper, getDeltaStorageUrl = () => this.url) {
|
|
82
|
+
this.url = url;
|
|
83
|
+
this.restWrapper = restWrapper;
|
|
84
|
+
this.logger = logger;
|
|
85
|
+
this.getRestWrapper = getRestWrapper;
|
|
86
|
+
this.getDeltaStorageUrl = getDeltaStorageUrl;
|
|
87
|
+
}
|
|
88
|
+
async get(tenantId, id, from, // inclusive
|
|
89
|
+
to) {
|
|
90
|
+
const ops = await PerformanceEvent.timedExecAsync(this.logger, {
|
|
91
|
+
eventName: "OpsFetch",
|
|
92
|
+
from,
|
|
93
|
+
to,
|
|
94
|
+
}, async (event) => {
|
|
95
|
+
const restWrapper = await this.getRestWrapper();
|
|
96
|
+
const url = this.getDeltaStorageUrl();
|
|
97
|
+
const response = await restWrapper.get(url, {
|
|
98
|
+
from: from - 1,
|
|
99
|
+
to,
|
|
100
|
+
});
|
|
101
|
+
event.end({
|
|
102
|
+
length: response.content.length,
|
|
103
|
+
details: JSON.stringify({
|
|
104
|
+
firstOpSeqNumber: response.content[0]?.sequenceNumber,
|
|
105
|
+
lastOpSeqNumber: response.content[response.content.length - 1]?.sequenceNumber,
|
|
106
|
+
}),
|
|
107
|
+
...response.propsToLog,
|
|
108
|
+
...getW3CData(response.requestUrl, "xmlhttprequest"),
|
|
109
|
+
});
|
|
110
|
+
return response.content;
|
|
111
|
+
});
|
|
112
|
+
// It is assumed that server always returns all the ops that it has in the range that was requested.
|
|
113
|
+
// This may change in the future, if so, we need to adjust and receive "end" value from server in such case.
|
|
114
|
+
return { messages: ops, partialResult: false };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=deltaStorageService.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deltaStorageService.mjs","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,6BAA6B;OAQnE,EACN,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,GACd,MAAM,8BAA8B;OAC9B,EAAuB,gBAAgB,EAAE,MAAM,iCAAiC;AAIvF;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACvC,YACkB,QAAgB,EAChB,EAAU,EACV,mBAAyC,EACzC,sBAA8C,EAC9C,MAA2B;QAJ3B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,wBAAmB,GAAnB,mBAAmB,CAAsB;QACzC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,WAAM,GAAN,MAAM,CAAqB;QAGrC,eAAU,GAAuB,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC;IAF7E,CAAC;IAKJ,aAAa,CACZ,SAAiB,EACjB,OAA2B,EAC3B,WAAyB,EACzB,UAAoB,EACpB,WAAoB;QAEpB,IAAI,UAAU,EAAE;YACf,OAAO,kBAAkB,CAAC;SAC1B;QAED,IAAI,eAAe,GAAG,CAAC,CAAC;QACxB,IAAI,cAAc,GAAG,CAAC,CAAC;QACvB,MAAM,eAAe,GAAG,KAAK,EAC5B,IAAY,EACZ,EAAU,EACV,cAAoC,EACnC,EAAE;YACH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU;gBACjC,CAAC,CAAC,MAAM,YAAY,CAClB,IAAI,CAAC,sBAAsB,EAC3B,IAAI,CAAC,UAAU,CACd;gBACH,CAAC,CAAC,EAAE,CAAC;YACN,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAE5B,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CACvC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,cAAc,IAAI,IAAI,IAAI,EAAE,CAAC,cAAc,GAAG,EAAE,CAC3D,CAAC;gBACF,gBAAgB,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;gBACjF,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,KAAK,IAAI,EAAE;oBAC/D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;oBAC5E,eAAe,IAAI,QAAQ,CAAC,MAAM,CAAC;oBACnC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;iBACzC;gBACD,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;aAC7B;YAED,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YACjF,gBAAgB,CAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;YACjF,cAAc,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YACtC,OAAO,GAAG,CAAC;QACZ,CAAC,CAAC;QAEF,MAAM,MAAM,GAAG,UAAU,CACxB,KAAK,EAAE,IAAY,EAAE,EAAU,EAAE,cAAoC,EAAE,EAAE;YACxE,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;YAC/D,+BAA+B;YAC/B,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAClE,OAAO,MAAM,CAAC;QACf,CAAC;QACD,uEAAuE;QACvE,0DAA0D;QAC1D,CAAC,EAAE,cAAc;QACjB,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,YAAY;QACrB,cAAc,EACd,IAAI,CAAC,MAAM,EACX,WAAW,EACX,WAAW,CACX,CAAC;QAEF,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;YACxC,IAAI,MAAM,CAAC,IAAI,IAAI,eAAe,GAAG,cAAc,KAAK,CAAC,EAAE;gBAC1D,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;oBAChC,SAAS,EAAE,mBAAmB;oBAC9B,eAAe;oBACf,cAAc;iBACd,CAAC,CAAC;aACH;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC/B,YACkB,GAAW,EACX,WAAwB,EACxB,MAA2B,EAC3B,iBAA6C,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,EACzE,qBAAmC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG;QAJjD,QAAG,GAAH,GAAG,CAAQ;QACX,gBAAW,GAAX,WAAW,CAAa;QACxB,WAAM,GAAN,MAAM,CAAqB;QAC3B,mBAAc,GAAd,cAAc,CAA2D;QACzE,uBAAkB,GAAlB,kBAAkB,CAA+B;IAChE,CAAC;IAEG,KAAK,CAAC,GAAG,CACf,QAAgB,EAChB,EAAU,EACV,IAAY,EAAE,YAAY;IAC1B,EAAU;QAEV,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,cAAc,CAChD,IAAI,CAAC,MAAM,EACX;YACC,SAAS,EAAE,UAAU;YACrB,IAAI;YACJ,EAAE;SACF,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;YACf,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAChD,MAAM,GAAG,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAA8B,GAAG,EAAE;gBACxE,IAAI,EAAE,IAAI,GAAG,CAAC;gBACd,EAAE;aACF,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC;gBACT,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM;gBAC/B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc;oBACrD,eAAe,EACd,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,cAAc;iBAC9D,CAAC;gBACF,GAAG,QAAQ,CAAC,UAAU;gBACtB,GAAG,UAAU,CAAC,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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport { getW3CData, validateMessages } from \"@fluidframework/driver-base\";\nimport {\n\tIDeltaStorageService,\n\tIDocumentDeltaStorageService,\n\tIDeltasFetchResult,\n\tIStream,\n} from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\treadAndParse,\n\trequestOps,\n\temptyMessageStream,\n\tstreamObserver,\n} from \"@fluidframework/driver-utils\";\nimport { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { DocumentStorageService } from \"./documentStorageService\";\nimport { RestWrapper } from \"./restWrapperBase\";\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: ITelemetryLoggerExt,\n\t) {}\n\n\tprivate logtailSha: string | undefined = this.documentStorageService.logTailSha;\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: ITelemetryProperties,\n\t\t) => {\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 )\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(this.tenantId, this.id, from, to);\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: ITelemetryProperties) => {\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: ITelemetryLoggerExt,\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): 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});\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:\n\t\t\t\t\t\t\tresponse.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"]}
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
6
|
import { DocumentDeltaConnection } from "@fluidframework/driver-base";
|
|
7
|
-
import { IDocumentDeltaConnection } from "@fluidframework/driver-definitions";
|
|
8
|
-
import { IAnyDriverError } from "@fluidframework/driver-utils";
|
|
7
|
+
import { IAnyDriverError, IDocumentDeltaConnection } from "@fluidframework/driver-definitions";
|
|
9
8
|
import { IClient } from "@fluidframework/protocol-definitions";
|
|
10
9
|
import type { io as SocketIOClientStatic } from "socket.io-client";
|
|
11
10
|
/**
|
|
12
11
|
* Wrapper over the shared one for driver specific translation.
|
|
13
12
|
*/
|
|
14
13
|
export declare class R11sDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
15
|
-
static create(tenantId: string, id: string, token: string | null, io: typeof SocketIOClientStatic, client: IClient, url: string, logger:
|
|
14
|
+
static create(tenantId: string, id: string, token: string | null, io: typeof SocketIOClientStatic, client: IClient, url: string, logger: ITelemetryLoggerExt, timeoutMs?: number, enableLongPollingDowngrade?: boolean): Promise<IDocumentDeltaConnection>;
|
|
16
15
|
/**
|
|
17
16
|
* Error raising for socket.io issues
|
|
18
17
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAC9D,EAAE,uBAAuB,EAAE,MAAM,6BAA6B;OAC9D,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,oCAAoC;OACvF,EAAE,OAAO,EAAY,MAAM,sCAAsC;OACjE,KAAK,EAAE,EAAE,IAAI,oBAAoB,EAAE,MAAM,kBAAkB;AAMlE;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,uBAAuB;WACnD,MAAM,CACzB,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,EAAE,EAAE,OAAO,oBAAoB,EAC/B,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,mBAAmB,EAC3B,SAAS,SAAQ,EACjB,0BAA0B,UAAO,GAC/B,OAAO,CAAC,wBAAwB,CAAC;IAmCpC;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,UAAO,GAAG,eAAe;CAQ3F"}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { DocumentDeltaConnection } from "@fluidframework/driver-base";
|
|
6
|
-
import { errorObjectFromSocketError } from "./errorUtils";
|
|
7
|
-
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
6
|
+
import { errorObjectFromSocketError } from "./errorUtils.mjs";
|
|
7
|
+
import { pkgVersion as driverVersion } from "./packageVersion.mjs";
|
|
8
8
|
const protocolVersions = ["^0.4.0", "^0.3.0", "^0.2.0", "^0.1.0"];
|
|
9
9
|
/**
|
|
10
10
|
* Wrapper over the shared one for driver specific translation.
|
|
11
11
|
*/
|
|
12
12
|
export class R11sDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
13
|
-
static async create(tenantId, id, token, io, client, url, logger, timeoutMs = 20000) {
|
|
13
|
+
static async create(tenantId, id, token, io, client, url, logger, timeoutMs = 20000, enableLongPollingDowngrade = true) {
|
|
14
14
|
const socket = io(url, {
|
|
15
15
|
query: {
|
|
16
16
|
documentId: id,
|
|
@@ -30,9 +30,7 @@ export class R11sDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
|
30
30
|
versions: protocolVersions,
|
|
31
31
|
relayUserAgent: [client.details.environment, ` driverVersion:${driverVersion}`].join(";"),
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
const enableLongPollingDowngrades = true;
|
|
35
|
-
const deltaConnection = new R11sDocumentDeltaConnection(socket, id, logger, enableLongPollingDowngrades);
|
|
33
|
+
const deltaConnection = new R11sDocumentDeltaConnection(socket, id, logger, enableLongPollingDowngrade);
|
|
36
34
|
await deltaConnection.initialize(connectMessage, timeoutMs);
|
|
37
35
|
return deltaConnection;
|
|
38
36
|
}
|
|
@@ -43,12 +41,9 @@ export class R11sDocumentDeltaConnection extends DocumentDeltaConnection {
|
|
|
43
41
|
// Note: we suspect the incoming error object is either:
|
|
44
42
|
// - a socketError: add it to the R11sError object for driver to be able to parse it and reason over it.
|
|
45
43
|
// - anything else: let base class handle it
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
else {
|
|
50
|
-
return super.createErrorObject(handler, error, canRetry);
|
|
51
|
-
}
|
|
44
|
+
return canRetry && Number.isInteger(error?.code) && typeof error?.message === "string"
|
|
45
|
+
? errorObjectFromSocketError(error, handler)
|
|
46
|
+
: super.createErrorObject(handler, error, canRetry);
|
|
52
47
|
}
|
|
53
48
|
}
|
|
54
|
-
//# sourceMappingURL=documentDeltaConnection.
|
|
49
|
+
//# sourceMappingURL=documentDeltaConnection.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentDeltaConnection.mjs","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,uBAAuB,EAAE,MAAM,6BAA6B;OAI9D,EAAE,0BAA0B,EAAoB;OAChD,EAAE,UAAU,IAAI,aAAa,EAAE;AAEtC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IAChE,MAAM,CAAC,KAAK,CAAC,MAAM,CACzB,QAAgB,EAChB,EAAU,EACV,KAAoB,EACpB,EAA+B,EAC/B,MAAe,EACf,GAAW,EACX,MAA2B,EAC3B,SAAS,GAAG,KAAK,EACjB,0BAA0B,GAAG,IAAI;QAEjC,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,EAAE;YACtB,KAAK,EAAE;gBACN,UAAU,EAAE,EAAE;gBACd,QAAQ;aACR;YACD,YAAY,EAAE,KAAK;YACnB,8DAA8D;YAC9D,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,OAAO,EAAE,SAAS;SAClB,CAAC,CAAC;QAEH,MAAM,cAAc,GAAa;YAChC,MAAM;YACN,EAAE;YACF,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ;YACR,KAAK;YACL,QAAQ,EAAE,gBAAgB;YAC1B,cAAc,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,kBAAkB,aAAa,EAAE,CAAC,CAAC,IAAI,CACnF,GAAG,CACH;SACD,CAAC;QAEF,MAAM,eAAe,GAAG,IAAI,2BAA2B,CACtD,MAAM,EACN,EAAE,EACF,MAAM,EACN,0BAA0B,CAC1B,CAAC;QAEF,MAAM,eAAe,CAAC,UAAU,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;QAC5D,OAAO,eAAe,CAAC;IACxB,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,OAAe,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,0BAA0B,CAAC,KAAyB,EAAE,OAAO,CAAC;YAChE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { DocumentDeltaConnection } from \"@fluidframework/driver-base\";\nimport { IAnyDriverError, IDocumentDeltaConnection } from \"@fluidframework/driver-definitions\";\nimport { IClient, IConnect } from \"@fluidframework/protocol-definitions\";\nimport type { io as SocketIOClientStatic } from \"socket.io-client\";\nimport { errorObjectFromSocketError, IR11sSocketError } from \"./errorUtils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\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: ITelemetryLoggerExt,\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\tenableLongPollingDowngrade,\n\t\t);\n\n\t\tawait deltaConnection.initialize(connectMessage, timeoutMs);\n\t\treturn deltaConnection;\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(error as IR11sSocketError, handler)\n\t\t\t: super.createErrorObject(handler, error, canRetry);\n\t}\n}\n"]}
|