@fluidframework/driver-utils 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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 (180) hide show
  1. package/.eslintrc.js +17 -19
  2. package/.mocharc.js +2 -2
  3. package/api-extractor.json +2 -2
  4. package/dist/buildSnapshotTree.d.ts.map +1 -1
  5. package/dist/buildSnapshotTree.js.map +1 -1
  6. package/dist/documentStorageServiceProxy.d.ts.map +1 -1
  7. package/dist/documentStorageServiceProxy.js.map +1 -1
  8. package/dist/error.d.ts.map +1 -1
  9. package/dist/error.js.map +1 -1
  10. package/dist/fluidResolvedUrl.d.ts +8 -0
  11. package/dist/fluidResolvedUrl.d.ts.map +1 -1
  12. package/dist/fluidResolvedUrl.js +8 -0
  13. package/dist/fluidResolvedUrl.js.map +1 -1
  14. package/dist/index.d.ts +4 -10
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -19
  17. package/dist/index.js.map +1 -1
  18. package/dist/insecureUrlResolver.d.ts.map +1 -1
  19. package/dist/insecureUrlResolver.js +2 -1
  20. package/dist/insecureUrlResolver.js.map +1 -1
  21. package/dist/messageRecognition.d.ts +0 -20
  22. package/dist/messageRecognition.d.ts.map +1 -1
  23. package/dist/messageRecognition.js +1 -37
  24. package/dist/messageRecognition.js.map +1 -1
  25. package/dist/network.d.ts +0 -15
  26. package/dist/network.d.ts.map +1 -1
  27. package/dist/network.js +4 -3
  28. package/dist/network.js.map +1 -1
  29. package/dist/networkUtils.d.ts +0 -10
  30. package/dist/networkUtils.d.ts.map +1 -1
  31. package/dist/networkUtils.js +3 -35
  32. package/dist/networkUtils.js.map +1 -1
  33. package/dist/packageVersion.d.ts +1 -1
  34. package/dist/packageVersion.js +1 -1
  35. package/dist/packageVersion.js.map +1 -1
  36. package/dist/parallelRequests.d.ts.map +1 -1
  37. package/dist/parallelRequests.js +52 -23
  38. package/dist/parallelRequests.js.map +1 -1
  39. package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
  40. package/dist/prefetchDocumentStorageService.js.map +1 -1
  41. package/dist/rateLimiter.d.ts.map +1 -1
  42. package/dist/rateLimiter.js.map +1 -1
  43. package/dist/readAndParse.d.ts.map +1 -1
  44. package/dist/readAndParse.js.map +1 -1
  45. package/dist/runWithRetry.d.ts.map +1 -1
  46. package/dist/runWithRetry.js +10 -0
  47. package/dist/runWithRetry.js.map +1 -1
  48. package/dist/summaryForCreateNew.d.ts +21 -1
  49. package/dist/summaryForCreateNew.d.ts.map +1 -1
  50. package/dist/summaryForCreateNew.js +26 -1
  51. package/dist/summaryForCreateNew.js.map +1 -1
  52. package/dist/treeConversions.d.ts.map +1 -1
  53. package/dist/treeConversions.js +6 -10
  54. package/dist/treeConversions.js.map +1 -1
  55. package/lib/buildSnapshotTree.d.ts.map +1 -1
  56. package/lib/buildSnapshotTree.js.map +1 -1
  57. package/lib/documentStorageServiceProxy.d.ts.map +1 -1
  58. package/lib/documentStorageServiceProxy.js.map +1 -1
  59. package/lib/error.d.ts.map +1 -1
  60. package/lib/error.js.map +1 -1
  61. package/lib/fluidResolvedUrl.d.ts +8 -0
  62. package/lib/fluidResolvedUrl.d.ts.map +1 -1
  63. package/lib/fluidResolvedUrl.js +8 -0
  64. package/lib/fluidResolvedUrl.js.map +1 -1
  65. package/lib/index.d.ts +4 -10
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/index.js +3 -9
  68. package/lib/index.js.map +1 -1
  69. package/lib/insecureUrlResolver.d.ts.map +1 -1
  70. package/lib/insecureUrlResolver.js +2 -1
  71. package/lib/insecureUrlResolver.js.map +1 -1
  72. package/lib/messageRecognition.d.ts +0 -20
  73. package/lib/messageRecognition.d.ts.map +1 -1
  74. package/lib/messageRecognition.js +1 -36
  75. package/lib/messageRecognition.js.map +1 -1
  76. package/lib/network.d.ts +0 -15
  77. package/lib/network.d.ts.map +1 -1
  78. package/lib/network.js +4 -3
  79. package/lib/network.js.map +1 -1
  80. package/lib/networkUtils.d.ts +0 -10
  81. package/lib/networkUtils.d.ts.map +1 -1
  82. package/lib/networkUtils.js +2 -33
  83. package/lib/networkUtils.js.map +1 -1
  84. package/lib/packageVersion.d.ts +1 -1
  85. package/lib/packageVersion.js +1 -1
  86. package/lib/packageVersion.js.map +1 -1
  87. package/lib/parallelRequests.d.ts.map +1 -1
  88. package/lib/parallelRequests.js +53 -24
  89. package/lib/parallelRequests.js.map +1 -1
  90. package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
  91. package/lib/prefetchDocumentStorageService.js.map +1 -1
  92. package/lib/rateLimiter.d.ts.map +1 -1
  93. package/lib/rateLimiter.js.map +1 -1
  94. package/lib/readAndParse.d.ts.map +1 -1
  95. package/lib/readAndParse.js.map +1 -1
  96. package/lib/runWithRetry.d.ts.map +1 -1
  97. package/lib/runWithRetry.js +10 -0
  98. package/lib/runWithRetry.js.map +1 -1
  99. package/lib/summaryForCreateNew.d.ts +21 -1
  100. package/lib/summaryForCreateNew.d.ts.map +1 -1
  101. package/lib/summaryForCreateNew.js +24 -0
  102. package/lib/summaryForCreateNew.js.map +1 -1
  103. package/lib/treeConversions.d.ts.map +1 -1
  104. package/lib/treeConversions.js +9 -13
  105. package/lib/treeConversions.js.map +1 -1
  106. package/package.json +54 -52
  107. package/prettier.config.cjs +1 -1
  108. package/src/buildSnapshotTree.ts +54 -51
  109. package/src/documentStorageServiceProxy.ts +49 -43
  110. package/src/error.ts +5 -7
  111. package/src/fluidResolvedUrl.ts +17 -6
  112. package/src/index.ts +4 -14
  113. package/src/insecureUrlResolver.ts +127 -116
  114. package/src/messageRecognition.ts +14 -44
  115. package/src/network.ts +112 -126
  116. package/src/networkUtils.ts +19 -48
  117. package/src/packageVersion.ts +1 -1
  118. package/src/parallelRequests.ts +591 -510
  119. package/src/prefetchDocumentStorageService.ts +76 -74
  120. package/src/rateLimiter.ts +29 -29
  121. package/src/readAndParse.ts +7 -4
  122. package/src/runWithRetry.ts +106 -84
  123. package/src/summaryForCreateNew.ts +74 -25
  124. package/src/treeConversions.ts +47 -70
  125. package/tsconfig.esnext.json +6 -6
  126. package/tsconfig.json +8 -12
  127. package/dist/blobAggregationStorage.d.ts +0 -43
  128. package/dist/blobAggregationStorage.d.ts.map +0 -1
  129. package/dist/blobAggregationStorage.js +0 -318
  130. package/dist/blobAggregationStorage.js.map +0 -1
  131. package/dist/blobCacheStorageService.d.ts +0 -16
  132. package/dist/blobCacheStorageService.d.ts.map +0 -1
  133. package/dist/blobCacheStorageService.js +0 -29
  134. package/dist/blobCacheStorageService.js.map +0 -1
  135. package/dist/emptyDocumentDeltaStorageService.d.ts +0 -13
  136. package/dist/emptyDocumentDeltaStorageService.d.ts.map +0 -1
  137. package/dist/emptyDocumentDeltaStorageService.js +0 -20
  138. package/dist/emptyDocumentDeltaStorageService.js.map +0 -1
  139. package/dist/multiDocumentServiceFactory.d.ts +0 -16
  140. package/dist/multiDocumentServiceFactory.d.ts.map +0 -1
  141. package/dist/multiDocumentServiceFactory.js +0 -63
  142. package/dist/multiDocumentServiceFactory.js.map +0 -1
  143. package/dist/multiUrlResolver.d.ts +0 -20
  144. package/dist/multiUrlResolver.d.ts.map +0 -1
  145. package/dist/multiUrlResolver.js +0 -45
  146. package/dist/multiUrlResolver.js.map +0 -1
  147. package/dist/treeUtils.d.ts +0 -51
  148. package/dist/treeUtils.d.ts.map +0 -1
  149. package/dist/treeUtils.js +0 -85
  150. package/dist/treeUtils.js.map +0 -1
  151. package/lib/blobAggregationStorage.d.ts +0 -43
  152. package/lib/blobAggregationStorage.d.ts.map +0 -1
  153. package/lib/blobAggregationStorage.js +0 -313
  154. package/lib/blobAggregationStorage.js.map +0 -1
  155. package/lib/blobCacheStorageService.d.ts +0 -16
  156. package/lib/blobCacheStorageService.d.ts.map +0 -1
  157. package/lib/blobCacheStorageService.js +0 -25
  158. package/lib/blobCacheStorageService.js.map +0 -1
  159. package/lib/emptyDocumentDeltaStorageService.d.ts +0 -13
  160. package/lib/emptyDocumentDeltaStorageService.d.ts.map +0 -1
  161. package/lib/emptyDocumentDeltaStorageService.js +0 -16
  162. package/lib/emptyDocumentDeltaStorageService.js.map +0 -1
  163. package/lib/multiDocumentServiceFactory.d.ts +0 -16
  164. package/lib/multiDocumentServiceFactory.d.ts.map +0 -1
  165. package/lib/multiDocumentServiceFactory.js +0 -59
  166. package/lib/multiDocumentServiceFactory.js.map +0 -1
  167. package/lib/multiUrlResolver.d.ts +0 -20
  168. package/lib/multiUrlResolver.d.ts.map +0 -1
  169. package/lib/multiUrlResolver.js +0 -40
  170. package/lib/multiUrlResolver.js.map +0 -1
  171. package/lib/treeUtils.d.ts +0 -51
  172. package/lib/treeUtils.d.ts.map +0 -1
  173. package/lib/treeUtils.js +0 -80
  174. package/lib/treeUtils.js.map +0 -1
  175. package/src/blobAggregationStorage.ts +0 -374
  176. package/src/blobCacheStorageService.ts +0 -32
  177. package/src/emptyDocumentDeltaStorageService.ts +0 -24
  178. package/src/multiDocumentServiceFactory.ts +0 -80
  179. package/src/multiUrlResolver.ts +0 -51
  180. package/src/treeUtils.ts +0 -111
@@ -1,29 +0,0 @@
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.BlobCacheStorageService = void 0;
8
- const documentStorageServiceProxy_1 = require("./documentStorageServiceProxy");
9
- /**
10
- * IDocumentStorageService adapter with pre-cached blobs.
11
- */
12
- class BlobCacheStorageService extends documentStorageServiceProxy_1.DocumentStorageServiceProxy {
13
- constructor(internalStorageService, blobs) {
14
- super(internalStorageService);
15
- this.blobs = blobs;
16
- }
17
- get policies() {
18
- return this.internalStorageService.policies;
19
- }
20
- async readBlob(id) {
21
- const blob = this.blobs.get(id);
22
- if (blob !== undefined) {
23
- return blob;
24
- }
25
- return this.internalStorageService.readBlob(id);
26
- }
27
- }
28
- exports.BlobCacheStorageService = BlobCacheStorageService;
29
- //# sourceMappingURL=blobCacheStorageService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blobCacheStorageService.js","sourceRoot":"","sources":["../src/blobCacheStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+EAA4E;AAE5E;;GAEG;AACH,MAAa,uBAAwB,SAAQ,yDAA2B;IACpE,YACI,sBAA+C,EAC9B,KAAmC;QAEpD,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAFb,UAAK,GAAL,KAAK,CAA8B;IAGxD,CAAC;IAED,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,EAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,IAAI,KAAK,SAAS,EAAE;YACpB,OAAO,IAAI,CAAC;SACf;QAED,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACJ;AApBD,0DAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentStorageService, IDocumentStorageServicePolicies } from \"@fluidframework/driver-definitions\";\nimport { DocumentStorageServiceProxy } from \"./documentStorageServiceProxy\";\n\n/**\n * IDocumentStorageService adapter with pre-cached blobs.\n */\nexport class BlobCacheStorageService extends DocumentStorageServiceProxy {\n constructor(\n internalStorageService: IDocumentStorageService,\n private readonly blobs: Map<string, ArrayBufferLike>,\n ) {\n super(internalStorageService);\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n return this.internalStorageService.policies;\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n const blob = this.blobs.get(id);\n if (blob !== undefined) {\n return blob;\n }\n\n return this.internalStorageService.readBlob(id);\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IDocumentDeltaStorageService, IStream } from "@fluidframework/driver-definitions";
6
- import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
- /**
8
- * Implementation of IDocumentDeltaStorageService that will always return an empty message queue when fetching messages
9
- */
10
- export declare class EmptyDocumentDeltaStorageService implements IDocumentDeltaStorageService {
11
- fetchMessages(from: number, _to: number | undefined, _abortSignal?: AbortSignal, _cachedOnly?: boolean, _fetchReason?: string): IStream<ISequencedDocumentMessage[]>;
12
- }
13
- //# sourceMappingURL=emptyDocumentDeltaStorageService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emptyDocumentDeltaStorageService.d.ts","sourceRoot":"","sources":["../src/emptyDocumentDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,4BAA4B,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAGjF;;GAEG;AACH,qBAAa,gCAAiC,YAAW,4BAA4B;IAC1E,aAAa,CAAC,IAAI,EAAE,MAAM,EAC7B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,YAAY,CAAC,EAAE,WAAW,EAC1B,WAAW,CAAC,EAAE,OAAO,EACrB,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAK1C"}
@@ -1,20 +0,0 @@
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.EmptyDocumentDeltaStorageService = void 0;
8
- const parallelRequests_1 = require("./parallelRequests");
9
- /**
10
- * Implementation of IDocumentDeltaStorageService that will always return an empty message queue when fetching messages
11
- */
12
- class EmptyDocumentDeltaStorageService {
13
- fetchMessages(from, _to, _abortSignal, _cachedOnly, _fetchReason) {
14
- const queue = new parallelRequests_1.Queue();
15
- queue.pushDone();
16
- return queue;
17
- }
18
- }
19
- exports.EmptyDocumentDeltaStorageService = EmptyDocumentDeltaStorageService;
20
- //# sourceMappingURL=emptyDocumentDeltaStorageService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emptyDocumentDeltaStorageService.js","sourceRoot":"","sources":["../src/emptyDocumentDeltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,yDAA2C;AAE3C;;GAEG;AACH,MAAa,gCAAgC;IAClC,aAAa,CAAC,IAAY,EAC7B,GAAuB,EACvB,YAA0B,EAC1B,WAAqB,EACrB,YAAqB;QAErB,MAAM,KAAK,GAAG,IAAI,wBAAK,EAA+B,CAAC;QACvD,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAXD,4EAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentDeltaStorageService, IStream } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { Queue } from \"./parallelRequests\";\n\n/**\n * Implementation of IDocumentDeltaStorageService that will always return an empty message queue when fetching messages\n */\nexport class EmptyDocumentDeltaStorageService implements IDocumentDeltaStorageService {\n public fetchMessages(from: number,\n _to: number | undefined,\n _abortSignal?: AbortSignal,\n _cachedOnly?: boolean,\n _fetchReason?: string,\n ): IStream<ISequencedDocumentMessage[]> {\n const queue = new Queue<ISequencedDocumentMessage[]>();\n queue.pushDone();\n return queue;\n }\n}\n"]}
@@ -1,16 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IDocumentServiceFactory, IResolvedUrl, IDocumentService } from "@fluidframework/driver-definitions";
6
- import { ISummaryTree } from "@fluidframework/protocol-definitions";
7
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
8
- export declare class MultiDocumentServiceFactory implements IDocumentServiceFactory {
9
- static create(documentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[]): IDocumentServiceFactory;
10
- private readonly protocolToDocumentFactoryMap;
11
- constructor(documentServiceFactories: IDocumentServiceFactory[]);
12
- readonly protocolName = "none:";
13
- createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
14
- createContainer(createNewSummary: ISummaryTree, createNewResolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
15
- }
16
- //# sourceMappingURL=multiDocumentServiceFactory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multiDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,qBAAa,2BAA4B,YAAW,uBAAuB;WACzD,MAAM,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,uBAAuB,EAAE;IAmBhG,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAuC;gBAExE,wBAAwB,EAAE,uBAAuB,EAAE;IAM/D,SAAgB,YAAY,WAAW;IACjC,qBAAqB,CACvB,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IAcf,eAAe,CACxB,gBAAgB,EAAE,YAAY,EAC9B,oBAAoB,EAAE,YAAY,EAClC,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC7B,OAAO,CAAC,gBAAgB,CAAC;CAY/B"}
@@ -1,63 +0,0 @@
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.MultiDocumentServiceFactory = void 0;
8
- const url_1 = require("url");
9
- const fluidResolvedUrl_1 = require("./fluidResolvedUrl");
10
- class MultiDocumentServiceFactory {
11
- constructor(documentServiceFactories) {
12
- this.protocolName = "none:";
13
- this.protocolToDocumentFactoryMap = new Map();
14
- documentServiceFactories.forEach((factory) => {
15
- this.protocolToDocumentFactoryMap.set(factory.protocolName, factory);
16
- });
17
- }
18
- static create(documentServiceFactory) {
19
- if (Array.isArray(documentServiceFactory)) {
20
- const factories = [];
21
- documentServiceFactory.forEach((factory) => {
22
- const maybeMulti = factory;
23
- if (maybeMulti.protocolToDocumentFactoryMap !== undefined) {
24
- factories.push(...maybeMulti.protocolToDocumentFactoryMap.values());
25
- }
26
- else {
27
- factories.push(factory);
28
- }
29
- });
30
- if (factories.length === 1) {
31
- return factories[0];
32
- }
33
- return new MultiDocumentServiceFactory(factories);
34
- }
35
- return documentServiceFactory;
36
- }
37
- async createDocumentService(resolvedUrl, logger, clientIsSummarizer) {
38
- (0, fluidResolvedUrl_1.ensureFluidResolvedUrl)(resolvedUrl);
39
- const urlObj = (0, url_1.parse)(resolvedUrl.url);
40
- if (urlObj.protocol === undefined || urlObj.protocol === null) {
41
- throw new Error("No protocol provided");
42
- }
43
- const factory = this.protocolToDocumentFactoryMap.get(urlObj.protocol);
44
- if (factory === undefined) {
45
- throw new Error("Unknown Fluid protocol");
46
- }
47
- return factory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);
48
- }
49
- async createContainer(createNewSummary, createNewResolvedUrl, logger, clientIsSummarizer) {
50
- (0, fluidResolvedUrl_1.ensureFluidResolvedUrl)(createNewResolvedUrl);
51
- const urlObj = (0, url_1.parse)(createNewResolvedUrl.url);
52
- if (urlObj.protocol === undefined || urlObj.protocol === null) {
53
- throw new Error("No protocol provided");
54
- }
55
- const factory = this.protocolToDocumentFactoryMap.get(urlObj.protocol);
56
- if (factory === undefined) {
57
- throw new Error("Unknown Fluid protocol");
58
- }
59
- return factory.createContainer(createNewSummary, createNewResolvedUrl, logger, clientIsSummarizer);
60
- }
61
- }
62
- exports.MultiDocumentServiceFactory = MultiDocumentServiceFactory;
63
- //# sourceMappingURL=multiDocumentServiceFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multiDocumentServiceFactory.js","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAA4B;AAQ5B,yDAA4D;AAE5D,MAAa,2BAA2B;IAsBpC,YAAY,wBAAmD;QAM/C,iBAAY,GAAG,OAAO,CAAC;QALnC,IAAI,CAAC,4BAA4B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC9C,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAgC,EAAE,EAAE;YAClE,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;IA1BM,MAAM,CAAC,MAAM,CAAC,sBAA2E;QAC5F,IAAI,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;YACvC,MAAM,SAAS,GAA8B,EAAE,CAAC;YAChD,sBAAsB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACvC,MAAM,UAAU,GAAG,OAAsC,CAAC;gBAC1D,IAAI,UAAU,CAAC,4BAA4B,KAAK,SAAS,EAAE;oBACvD,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,4BAA4B,CAAC,MAAM,EAAE,CAAC,CAAC;iBACvE;qBAAM;oBACH,SAAS,CAAC,IAAI,CAAC,OAAO,CA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C,4BAA4B,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5G,IAAI,OAAO,KAAK,SAAS,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC7C;QACD,OAAO,OAAO,CAAC,eAAe,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACvG,CAAC;CACJ;AAhED,kEAgEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport {\n IDocumentServiceFactory,\n IResolvedUrl,\n IDocumentService,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ensureFluidResolvedUrl } from \"./fluidResolvedUrl\";\n\nexport class MultiDocumentServiceFactory implements IDocumentServiceFactory {\n public static create(documentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[]) {\n if (Array.isArray(documentServiceFactory)) {\n const factories: IDocumentServiceFactory[] = [];\n documentServiceFactory.forEach((factory) => {\n const maybeMulti = factory as MultiDocumentServiceFactory;\n if (maybeMulti.protocolToDocumentFactoryMap !== undefined) {\n factories.push(...maybeMulti.protocolToDocumentFactoryMap.values());\n } else {\n factories.push(factory);\n }\n });\n if (factories.length === 1) {\n return factories[0];\n }\n return new MultiDocumentServiceFactory(factories);\n }\n return documentServiceFactory;\n }\n\n private readonly protocolToDocumentFactoryMap: Map<string, IDocumentServiceFactory>;\n\n constructor(documentServiceFactories: IDocumentServiceFactory[]) {\n this.protocolToDocumentFactoryMap = new Map();\n documentServiceFactories.forEach((factory: IDocumentServiceFactory) => {\n this.protocolToDocumentFactoryMap.set(factory.protocolName, factory);\n });\n }\n public readonly protocolName = \"none:\";\n async createDocumentService(\n resolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n ensureFluidResolvedUrl(resolvedUrl);\n const urlObj = parse(resolvedUrl.url);\n if (urlObj.protocol === undefined || urlObj.protocol === null) {\n throw new Error(\"No protocol provided\");\n }\n const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(urlObj.protocol);\n if (factory === undefined) {\n throw new Error(\"Unknown Fluid protocol\");\n }\n\n return factory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);\n }\n\n public async createContainer(\n createNewSummary: ISummaryTree,\n createNewResolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n ensureFluidResolvedUrl(createNewResolvedUrl);\n const urlObj = parse(createNewResolvedUrl.url);\n if (urlObj.protocol === undefined || urlObj.protocol === null) {\n throw new Error(\"No protocol provided\");\n }\n const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(urlObj.protocol);\n if (factory === undefined) {\n throw new Error(\"Unknown Fluid protocol\");\n }\n return factory.createContainer(createNewSummary, createNewResolvedUrl, logger, clientIsSummarizer);\n }\n}\n"]}
@@ -1,20 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IRequest } from "@fluidframework/core-interfaces";
6
- import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
7
- /**
8
- * Resolver that takes a list of url resolvers and then try each of them to resolve the url.
9
- * @param resolversList - List of url resolvers to be used to resolve the request.
10
- * @param request - Request to be resolved.
11
- */
12
- export declare function configurableUrlResolver(resolversList: IUrlResolver[], request: IRequest): Promise<IResolvedUrl | undefined>;
13
- export declare class MultiUrlResolver implements IUrlResolver {
14
- private readonly urlResolvers;
15
- static create(urlResolver: IUrlResolver | IUrlResolver[]): IUrlResolver;
16
- private constructor();
17
- resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
18
- getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
19
- }
20
- //# sourceMappingURL=multiUrlResolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multiUrlResolver.d.ts","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEhF;;;;GAIG;AACH,wBAAsB,uBAAuB,CACzC,aAAa,EAAE,YAAY,EAAE,EAC7B,OAAO,EAAE,QAAQ,GAClB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CASnC;AAED,qBAAa,gBAAiB,YAAW,YAAY;IAW7B,OAAO,CAAC,QAAQ,CAAC,YAAY;WAVnC,MAAM,CAAC,WAAW,EAAE,YAAY,GAAG,YAAY,EAAE;IAU/D,OAAO;IAED,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAItD,cAAc,CACvB,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC;CAGrB"}
@@ -1,45 +0,0 @@
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.MultiUrlResolver = exports.configurableUrlResolver = void 0;
8
- /**
9
- * Resolver that takes a list of url resolvers and then try each of them to resolve the url.
10
- * @param resolversList - List of url resolvers to be used to resolve the request.
11
- * @param request - Request to be resolved.
12
- */
13
- async function configurableUrlResolver(resolversList, request) {
14
- let resolved;
15
- for (const resolver of resolversList) {
16
- resolved = await resolver.resolve(Object.assign({}, request));
17
- if (resolved !== undefined) {
18
- return resolved;
19
- }
20
- }
21
- return undefined;
22
- }
23
- exports.configurableUrlResolver = configurableUrlResolver;
24
- class MultiUrlResolver {
25
- constructor(urlResolvers) {
26
- this.urlResolvers = urlResolvers;
27
- }
28
- static create(urlResolver) {
29
- if (Array.isArray(urlResolver)) {
30
- if (urlResolver.length === 1) {
31
- return urlResolver[0];
32
- }
33
- return new MultiUrlResolver(urlResolver);
34
- }
35
- return urlResolver;
36
- }
37
- async resolve(request) {
38
- return configurableUrlResolver(this.urlResolvers, request);
39
- }
40
- async getAbsoluteUrl(resolvedUrl, relativeUrl) {
41
- throw new Error("Not implmented");
42
- }
43
- }
44
- exports.MultiUrlResolver = MultiUrlResolver;
45
- //# sourceMappingURL=multiUrlResolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multiUrlResolver.js","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;;GAIG;AACI,KAAK,UAAU,uBAAuB,CACzC,aAA6B,EAC7B,OAAiB;IAEjB,IAAI,QAAkC,CAAC;IACvC,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE;QAClC,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,mBAAM,OAAO,EAAG,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS,EAAE;YACxB,OAAO,QAAQ,CAAC;SACnB;KACJ;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAZD,0DAYC;AAED,MAAa,gBAAgB;IAWzB,YAAqC,YAA4B;QAA5B,iBAAY,GAAZ,YAAY,CAAgB;IAAI,CAAC;IAV/D,MAAM,CAAC,MAAM,CAAC,WAA0C;QAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC5B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC1B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;aACzB;YACD,OAAO,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;SAC5C;QACD,OAAO,WAAW,CAAC;IACvB,CAAC;IAID,KAAK,CAAC,OAAO,CAAC,OAAiB;QAC3B,OAAO,uBAAuB,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAEM,KAAK,CAAC,cAAc,CACvB,WAAyB,EACzB,WAAmB;QAEnB,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACtC,CAAC;CACJ;AAvBD,4CAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\n\n/**\n * Resolver that takes a list of url resolvers and then try each of them to resolve the url.\n * @param resolversList - List of url resolvers to be used to resolve the request.\n * @param request - Request to be resolved.\n */\nexport async function configurableUrlResolver(\n resolversList: IUrlResolver[],\n request: IRequest,\n): Promise<IResolvedUrl | undefined> {\n let resolved: IResolvedUrl | undefined;\n for (const resolver of resolversList) {\n resolved = await resolver.resolve({ ...request });\n if (resolved !== undefined) {\n return resolved;\n }\n }\n return undefined;\n}\n\nexport class MultiUrlResolver implements IUrlResolver {\n public static create(urlResolver: IUrlResolver | IUrlResolver[]) {\n if (Array.isArray(urlResolver)) {\n if (urlResolver.length === 1) {\n return urlResolver[0];\n }\n return new MultiUrlResolver(urlResolver);\n }\n return urlResolver;\n }\n\n private constructor(private readonly urlResolvers: IUrlResolver[]) { }\n\n async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n return configurableUrlResolver(this.urlResolvers, request);\n }\n\n public async getAbsoluteUrl(\n resolvedUrl: IResolvedUrl,\n relativeUrl: string,\n ): Promise<string> {\n throw new Error(\"Not implmented\");\n }\n}\n"]}
@@ -1,51 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { SummaryType, ISnapshotTree, ISummaryTree } from "@fluidframework/protocol-definitions";
6
- /**
7
- * Summary tree assembler props
8
- */
9
- export interface ISummaryTreeAssemblerProps {
10
- /**
11
- * Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.
12
- */
13
- unreferenced?: true;
14
- }
15
- /**
16
- * Summary tree assembler (without stats collection).
17
- */
18
- export declare class SummaryTreeAssembler {
19
- private readonly props?;
20
- private attachmentCounter;
21
- private readonly summaryTree;
22
- constructor(props?: ISummaryTreeAssemblerProps | undefined);
23
- /**
24
- * Get final summary
25
- */
26
- get summary(): ISummaryTree;
27
- /**
28
- * Add blob to summary
29
- */
30
- addBlob(key: string, content: string | Uint8Array): void;
31
- /**
32
- * Add handle to summary
33
- */
34
- addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
35
- /**
36
- * Add tree to summary
37
- */
38
- addTree(key: string, summary: ISummaryTree): void;
39
- /**
40
- * Add attachment to summary
41
- */
42
- addAttachment(id: string): void;
43
- }
44
- /**
45
- * Helper function that converts ISnapshotTree and blobs to ISummaryTree
46
- * @param snapshot - Source snapshot tree
47
- * @param blobs - Blobs cache
48
- * @returns Converted snapshot in ISummaryTree format
49
- */
50
- export declare function convertSnapshotAndBlobsToSummaryTree(snapshot: ISnapshotTree, blobs: Map<string, ArrayBuffer>): ISummaryTree;
51
- //# sourceMappingURL=treeUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"treeUtils.d.ts","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACH,WAAW,EACX,aAAa,EACb,YAAY,EAEf,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC;;OAEA;IACA,YAAY,CAAC,EAAE,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAKzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAJ3B,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0C;gBAGjD,KAAK,CAAC,wCAA4B;IAGvD;;MAEE;IACF,IAAW,OAAO,IAAI,YAAY,CAMjC;IAED;;MAEE;IACK,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAO/D;;MAEE;IACK,SAAS,CACZ,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,UAAU,EACxE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQzB;;MAEE;IACK,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAIxD;;MAEE;IACK,aAAa,CAAC,EAAE,EAAE,MAAM;CAGlC;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAChD,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAChC,YAAY,CAcd"}
package/dist/treeUtils.js DELETED
@@ -1,85 +0,0 @@
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.convertSnapshotAndBlobsToSummaryTree = exports.SummaryTreeAssembler = void 0;
8
- const common_utils_1 = require("@fluidframework/common-utils");
9
- const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
10
- /**
11
- * Summary tree assembler (without stats collection).
12
- */
13
- class SummaryTreeAssembler {
14
- constructor(props) {
15
- this.props = props;
16
- this.attachmentCounter = 0;
17
- this.summaryTree = {};
18
- }
19
- /**
20
- * Get final summary
21
- */
22
- get summary() {
23
- var _a;
24
- return {
25
- type: protocol_definitions_1.SummaryType.Tree,
26
- tree: Object.assign({}, this.summaryTree),
27
- unreferenced: (_a = this.props) === null || _a === void 0 ? void 0 : _a.unreferenced,
28
- };
29
- }
30
- /**
31
- * Add blob to summary
32
- */
33
- addBlob(key, content) {
34
- this.summaryTree[key] = {
35
- type: protocol_definitions_1.SummaryType.Blob,
36
- content,
37
- };
38
- }
39
- /**
40
- * Add handle to summary
41
- */
42
- addHandle(key, handleType, handle) {
43
- this.summaryTree[key] = {
44
- type: protocol_definitions_1.SummaryType.Handle,
45
- handleType,
46
- handle,
47
- };
48
- }
49
- /**
50
- * Add tree to summary
51
- */
52
- addTree(key, summary) {
53
- this.summaryTree[key] = summary;
54
- }
55
- /**
56
- * Add attachment to summary
57
- */
58
- addAttachment(id) {
59
- this.summaryTree[this.attachmentCounter++] = { id, type: protocol_definitions_1.SummaryType.Attachment };
60
- }
61
- }
62
- exports.SummaryTreeAssembler = SummaryTreeAssembler;
63
- /**
64
- * Helper function that converts ISnapshotTree and blobs to ISummaryTree
65
- * @param snapshot - Source snapshot tree
66
- * @param blobs - Blobs cache
67
- * @returns Converted snapshot in ISummaryTree format
68
- */
69
- function convertSnapshotAndBlobsToSummaryTree(snapshot, blobs) {
70
- const assembler = new SummaryTreeAssembler({
71
- unreferenced: snapshot.unreferenced,
72
- });
73
- for (const [path, id] of Object.entries(snapshot.blobs)) {
74
- const blob = blobs.get(id);
75
- (0, common_utils_1.assert)(blob !== undefined, 0x2dd /* "Cannot find blob for a given id" */);
76
- assembler.addBlob(path, common_utils_1.IsoBuffer.from(blob).toString("utf-8"));
77
- }
78
- for (const [key, tree] of Object.entries(snapshot.trees)) {
79
- const subtree = convertSnapshotAndBlobsToSummaryTree(tree, blobs);
80
- assembler.addTree(key, subtree);
81
- }
82
- return assembler.summary;
83
- }
84
- exports.convertSnapshotAndBlobsToSummaryTree = convertSnapshotAndBlobsToSummaryTree;
85
- //# sourceMappingURL=treeUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"treeUtils.js","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAGsC;AACtC,+EAK8C;AAY9C;;GAEG;AACH,MAAa,oBAAo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AM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACrD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3B,IAAA,qBAAM,EAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1E,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,wBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KACnE;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACtD,MAAM,OAAO,GAAG,oCAAoC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClE,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KACnC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC;AAC7B,CAAC;AAjBD,oFAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n assert,\n IsoBuffer,\n} from \"@fluidframework/common-utils\";\nimport {\n SummaryType,\n ISnapshotTree,\n ISummaryTree,\n SummaryObject,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Summary tree assembler props\n */\nexport interface ISummaryTreeAssemblerProps {\n /**\n\t * Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.\n\t */\n unreferenced?: true;\n}\n\n/**\n * Summary tree assembler (without stats collection).\n */\nexport class SummaryTreeAssembler {\n private attachmentCounter: number = 0;\n private readonly summaryTree: { [path: string]: SummaryObject; } = {};\n\n constructor(\n private readonly props?: ISummaryTreeAssemblerProps,\n ) { }\n\n /**\n * Get final summary\n */\n public get summary(): ISummaryTree {\n return {\n type: SummaryType.Tree,\n tree: { ...this.summaryTree },\n unreferenced: this.props?.unreferenced,\n };\n }\n\n /**\n * Add blob to summary\n */\n public addBlob(key: string, content: string | Uint8Array): void {\n this.summaryTree[key] = {\n type: SummaryType.Blob,\n content,\n };\n }\n\n /**\n * Add handle to summary\n */\n public addHandle(\n key: string,\n handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment,\n handle: string): void {\n this.summaryTree[key] = {\n type: SummaryType.Handle,\n handleType,\n handle,\n };\n }\n\n /**\n * Add tree to summary\n */\n public addTree(key: string, summary: ISummaryTree): void {\n this.summaryTree[key] = summary;\n }\n\n /**\n * Add attachment to summary\n */\n public addAttachment(id: string) {\n this.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };\n }\n}\n\n/**\n * Helper function that converts ISnapshotTree and blobs to ISummaryTree\n * @param snapshot - Source snapshot tree\n * @param blobs - Blobs cache\n * @returns Converted snapshot in ISummaryTree format\n */\nexport function convertSnapshotAndBlobsToSummaryTree(\n snapshot: ISnapshotTree,\n blobs: Map<string, ArrayBuffer>,\n): ISummaryTree {\n const assembler = new SummaryTreeAssembler({\n unreferenced: snapshot.unreferenced,\n });\n for (const [path, id] of Object.entries(snapshot.blobs)) {\n const blob = blobs.get(id);\n assert(blob !== undefined, 0x2dd /* \"Cannot find blob for a given id\" */);\n assembler.addBlob(path, IsoBuffer.from(blob).toString(\"utf-8\"));\n }\n for (const [key, tree] of Object.entries(snapshot.trees)) {\n const subtree = convertSnapshotAndBlobsToSummaryTree(tree, blobs);\n assembler.addTree(key, subtree);\n }\n return assembler.summary;\n}\n"]}
@@ -1,43 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
6
- import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
7
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
8
- export declare abstract class SnapshotExtractor {
9
- protected readonly aggregatedBlobName = "__big";
10
- protected readonly virtualIdPrefix = "__";
11
- protected virtualIdCounter: number;
12
- protected getNextVirtualId(): string;
13
- abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;
14
- abstract setBlob(id: string, tree: ISnapshotTree, content: string): any;
15
- unpackSnapshotCore(snapshot: ISnapshotTree, level?: number): Promise<void>;
16
- }
17
- export declare class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {
18
- private readonly storage;
19
- private readonly logger;
20
- private readonly allowPacking;
21
- private readonly packingLevel;
22
- private readonly blobCutOffSize?;
23
- static readonly fullDataStoreSummaries = true;
24
- protected loadedFromSummary: boolean;
25
- protected virtualBlobs: Map<string, ArrayBufferLike>;
26
- static wrap(storage: IDocumentStorageService, logger: ITelemetryLogger, allowPacking?: boolean, packingLevel?: number): BlobAggregationStorage;
27
- static unpackSnapshot(snapshot: ISnapshotTree): Promise<void>;
28
- get policies(): IDocumentStorageServicePolicies | undefined;
29
- unpackSnapshot(snapshot: ISnapshotTree): Promise<void>;
30
- protected constructor(storage: IDocumentStorageService, logger: ITelemetryLogger, allowPacking: boolean, packingLevel: number, blobCutOffSize?: number | undefined);
31
- setBlob(id: string, tree: ISnapshotTree, content: string): void;
32
- getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;
33
- get repositoryUrl(): string;
34
- getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
35
- downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
36
- createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
37
- getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
38
- readBlob(id: string): Promise<ArrayBufferLike>;
39
- uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
40
- private compressSmallBlobs;
41
- protected isRealStorageId(id: string): boolean;
42
- }
43
- //# sourceMappingURL=blobAggregationStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blobAggregationStor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