@fluidframework/odsp-driver 0.59.2001 → 0.59.3000
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 +0 -1
- package/dist/ReadBufferUtils.js +2 -2
- package/dist/ReadBufferUtils.js.map +1 -1
- package/dist/WriteBufferUtils.js +14 -14
- package/dist/WriteBufferUtils.js.map +1 -1
- package/dist/checkUrl.js +1 -1
- package/dist/checkUrl.js.map +1 -1
- package/dist/compactSnapshotParser.js +27 -27
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.js +15 -15
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +0 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createFile.js +15 -15
- package/dist/createFile.js.map +1 -1
- package/dist/createNewUtils.js +4 -4
- package/dist/createNewUtils.js.map +1 -1
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +11 -11
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetch.js +1 -1
- package/dist/fetch.js.map +1 -1
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +19 -19
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.js +19 -19
- package/dist/getFileLink.js.map +1 -1
- package/dist/getQueryString.d.ts.map +1 -1
- package/dist/getQueryString.js.map +1 -1
- package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
- package/dist/getUrlAndHeadersWithAuth.js.map +1 -1
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/odspDeltaStorageService.js +5 -5
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +12 -12
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.js +9 -8
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.js +1 -1
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +20 -12
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +1 -0
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +34 -32
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDriverUrlResolver.js +10 -10
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +10 -10
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspError.d.ts +1 -1
- package/dist/odspError.d.ts.map +1 -1
- package/dist/odspError.js +1 -1
- package/dist/odspError.js.map +1 -1
- package/dist/odspFluidFileLink.js +2 -2
- package/dist/odspFluidFileLink.js.map +1 -1
- package/dist/odspPublicUtils.js +1 -1
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSnapshotParser.js +3 -3
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspSummaryUploadManager.js +7 -7
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUtils.js +9 -9
- package/dist/odspUtils.js.map +1 -1
- package/dist/opsCaching.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/prefetchLatestSnapshot.js +7 -7
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js +1 -1
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.js +4 -4
- package/dist/retryUtils.js.map +1 -1
- package/dist/vroom.js +3 -3
- package/dist/vroom.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js +21 -12
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/WriteBufferUtils.js +1 -1
- package/lib/WriteBufferUtils.js.map +1 -1
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/contracts.d.ts +0 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/createFile.js.map +1 -1
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js +1 -1
- package/lib/epochTracker.js.map +1 -1
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/getFileLink.js +6 -6
- package/lib/getFileLink.js.map +1 -1
- package/lib/getQueryString.d.ts.map +1 -1
- package/lib/getQueryString.js.map +1 -1
- package/lib/getUrlAndHeadersWithAuth.d.ts.map +1 -1
- package/lib/getUrlAndHeadersWithAuth.js.map +1 -1
- package/lib/odspCache.d.ts.map +1 -1
- package/lib/odspCache.js.map +1 -1
- package/lib/odspDeltaStorageService.d.ts.map +1 -1
- package/lib/odspDeltaStorageService.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +1 -1
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.js +2 -1
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js +10 -2
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts +1 -0
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +17 -15
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDriverUrlResolver.js +5 -5
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspError.d.ts +1 -1
- package/lib/odspError.d.ts.map +1 -1
- package/lib/odspFluidFileLink.js.map +1 -1
- package/lib/odspSnapshotParser.js +1 -1
- package/lib/odspSnapshotParser.js.map +1 -1
- package/lib/odspUtils.js.map +1 -1
- package/lib/opsCaching.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/lib/retryErrorsStorageAdapter.js.map +1 -1
- package/lib/retryUtils.js +1 -1
- package/lib/retryUtils.js.map +1 -1
- package/lib/vroom.js.map +1 -1
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/zipItDataRepresentationUtils.js +12 -3
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +14 -13
- package/src/compactSnapshotParser.ts +2 -2
- package/src/contracts.ts +4 -5
- package/src/createFile.ts +2 -2
- package/src/epochTracker.ts +9 -10
- package/src/fetchSnapshot.ts +10 -10
- package/src/getFileLink.ts +10 -10
- package/src/getQueryString.ts +1 -1
- package/src/getUrlAndHeadersWithAuth.ts +1 -1
- package/src/odspCache.ts +2 -2
- package/src/odspDeltaStorageService.ts +4 -5
- package/src/odspDocumentDeltaConnection.ts +2 -2
- package/src/odspDocumentService.ts +5 -5
- package/src/odspDocumentServiceFactoryCore.ts +13 -1
- package/src/odspDocumentStorageManager.ts +25 -18
- package/src/odspDriverUrlResolver.ts +2 -2
- package/src/odspDriverUrlResolverForShareLink.ts +1 -1
- package/src/odspSnapshotParser.ts +2 -2
- package/src/odspUtils.ts +6 -6
- package/src/opsCaching.ts +2 -2
- package/src/packageVersion.ts +1 -1
- package/src/retryErrorsStorageAdapter.ts +1 -1
- package/src/vroom.ts +1 -1
- package/src/zipItDataRepresentationUtils.ts +15 -13
package/.eslintrc.js
CHANGED
package/dist/ReadBufferUtils.js
CHANGED
|
@@ -36,7 +36,7 @@ class ReadBuffer {
|
|
|
36
36
|
let multiplier = 1;
|
|
37
37
|
let length = lengthArg;
|
|
38
38
|
while (length > 0) {
|
|
39
|
-
common_utils_1.assert(!this.eof, 0x223 /* "unexpected end of buffer" */);
|
|
39
|
+
(0, common_utils_1.assert)(!this.eof, 0x223 /* "unexpected end of buffer" */);
|
|
40
40
|
res += this.data[this.index] * multiplier;
|
|
41
41
|
this.index++;
|
|
42
42
|
multiplier *= 256;
|
|
@@ -45,7 +45,7 @@ class ReadBuffer {
|
|
|
45
45
|
return res;
|
|
46
46
|
}
|
|
47
47
|
skip(length) {
|
|
48
|
-
common_utils_1.assert(length >= 0, 0x224 /* "Skip length should be positive" */);
|
|
48
|
+
(0, common_utils_1.assert)(length >= 0, 0x224 /* "Skip length should be positive" */);
|
|
49
49
|
this.index += length;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadBufferUtils.js","sourceRoot":"","sources":["../src/ReadBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAEtD;;;GAGG;AACH,MAAa,UAAU;IAOnB,YAA+B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QANrC,UAAK,GAAG,CAAC,CAAC;QAOhB,4DAA4D;QAC5D,+DAA+D;QAC/D,8DAA8D;QAC9D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IATD,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IASD,IAAW,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,IAAW,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,IAAW,MAAM,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,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G,CAAC,CAAC;IACnB,CAAC;IAEM,IAAI,CAAC,SAAS,GAAG,CAAC;QACrB,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,MAAM,GAAG,SAAS,CAAC;QACvB,OAAO,MAAM,GAAG,CAAC,EAAE;YACf,IAAA,qBAAM,EAAC,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAC1D,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;YAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,UAAU,IAAI,GAAG,CAAC;YAClB,MAAM,EAAE,CAAC;SACZ;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,IAAI,CAAC,MAAc;QACtB,IAAA,qBAAM,EAAC,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC;IACzB,CAAC;CACJ;AA5CD,gCA4CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\n\n/**\n * Buffer class, used to sequentially read data.\n * Used by tree code to reconstruct a tree from binary representation.\n */\nexport class ReadBuffer {\n protected index = 0;\n\n public get buffer() {\n return this.data;\n }\n\n constructor(protected readonly data: Uint8Array) {\n // BlobShallowCopy will return to users parts of this array.\n // We need to ensure that nobody can change it, as it will have\n // catastrophic result and will be really hard to investigate.\n Object.freeze(data.buffer);\n }\n\n public get eof() { return this.index === this.data.length; }\n public get pos() { return this.index; }\n public get length() { return this.data.length; }\n\n public slice(start: number, end: number) {\n return this.data.slice(start, end);\n }\n\n public reset() {\n this.index = 0;\n }\n\n public read(lengthArg = 1): number {\n let res = 0;\n let multiplier = 1;\n let length = lengthArg;\n while (length > 0) {\n assert(!this.eof, 0x223 /* \"unexpected end of buffer\" */);\n res += this.data[this.index] * multiplier;\n this.index++;\n multiplier *= 256;\n length--;\n }\n return res;\n }\n\n public skip(length: number) {\n assert(length >= 0, 0x224 /* \"Skip length should be positive\" */);\n this.index += length;\n }\n}\n"]}
|
package/dist/WriteBufferUtils.js
CHANGED
|
@@ -18,7 +18,7 @@ class WriteBuffer {
|
|
|
18
18
|
this.index = 0;
|
|
19
19
|
}
|
|
20
20
|
push(code) {
|
|
21
|
-
common_utils_1.assert(this.data !== undefined, 0x225 /* "Data should be there" */);
|
|
21
|
+
(0, common_utils_1.assert)(this.data !== undefined, 0x225 /* "Data should be there" */);
|
|
22
22
|
const length = this.data.length;
|
|
23
23
|
if (this.index === length) {
|
|
24
24
|
const newData = new Uint8Array(length * 1.2 + 4096);
|
|
@@ -41,10 +41,10 @@ class WriteBuffer {
|
|
|
41
41
|
code = Math.floor(code / 256);
|
|
42
42
|
length--;
|
|
43
43
|
}
|
|
44
|
-
common_utils_1.assert(code === 0, 0x226 /* `Should write complete data code= ${codeArg} ${lengthArg}` */);
|
|
44
|
+
(0, common_utils_1.assert)(code === 0, 0x226 /* `Should write complete data code= ${codeArg} ${lengthArg}` */);
|
|
45
45
|
}
|
|
46
46
|
done() {
|
|
47
|
-
common_utils_1.assert(this.data !== undefined, 0x227 /* "Data should be there" */);
|
|
47
|
+
(0, common_utils_1.assert)(this.data !== undefined, 0x227 /* "Data should be there" */);
|
|
48
48
|
// We can slice it to have smaller memory representation.
|
|
49
49
|
// But it will be way more expensive in terms of CPU cycles!
|
|
50
50
|
const buffer = new ReadBufferUtils_1.ReadBuffer(this.data.subarray(0, this.index));
|
|
@@ -100,7 +100,7 @@ const integerBytesToCodeMap = {
|
|
|
100
100
|
*/
|
|
101
101
|
const boolToCodeMap = [
|
|
102
102
|
12,
|
|
103
|
-
11,
|
|
103
|
+
11, // true
|
|
104
104
|
];
|
|
105
105
|
/**
|
|
106
106
|
* Calculate how many bytes are required to encode an integer. This is always power of 2.
|
|
@@ -151,9 +151,9 @@ function serializeBlob(buffer, blob, dictionary) {
|
|
|
151
151
|
}
|
|
152
152
|
// Write marker code for const string.
|
|
153
153
|
buffer.write(code);
|
|
154
|
-
const bytes = zipItDataRepresentationUtils_1.getValueSafely(zipItDataRepresentationUtils_1.codeToBytesMap, code);
|
|
155
|
-
common_utils_1.assert(bytes >= lengthOfDataLen, 0x283 /* "Length of data len should fit in the bytes from the map" */);
|
|
156
|
-
common_utils_1.assert(bytes >= idLength, 0x284 /* "Length of id should fit in the bytes from the map" */);
|
|
154
|
+
const bytes = (0, zipItDataRepresentationUtils_1.getValueSafely)(zipItDataRepresentationUtils_1.codeToBytesMap, code);
|
|
155
|
+
(0, common_utils_1.assert)(bytes >= lengthOfDataLen, 0x283 /* "Length of data len should fit in the bytes from the map" */);
|
|
156
|
+
(0, common_utils_1.assert)(bytes >= idLength, 0x284 /* "Length of id should fit in the bytes from the map" */);
|
|
157
157
|
// Assign and write id for const string.
|
|
158
158
|
buffer.write(id, bytes);
|
|
159
159
|
// Write length of const string.
|
|
@@ -167,14 +167,14 @@ function serializeBlob(buffer, blob, dictionary) {
|
|
|
167
167
|
idLength = calcLength(id);
|
|
168
168
|
}
|
|
169
169
|
// Write Marker Code
|
|
170
|
-
buffer.write(zipItDataRepresentationUtils_1.getValueSafely(constStringBytesToCodeMap, idLength));
|
|
170
|
+
buffer.write((0, zipItDataRepresentationUtils_1.getValueSafely)(constStringBytesToCodeMap, idLength));
|
|
171
171
|
// Write id of const string
|
|
172
172
|
buffer.write(id, idLength);
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
175
|
// Write Marker code.
|
|
176
|
-
buffer.write(blob.useUtf8Code ? zipItDataRepresentationUtils_1.getValueSafely(utf8StringBytesToCodeMap, lengthOfDataLen)
|
|
177
|
-
: zipItDataRepresentationUtils_1.getValueSafely(binaryBytesToCodeMap, lengthOfDataLen));
|
|
176
|
+
buffer.write(blob.useUtf8Code ? (0, zipItDataRepresentationUtils_1.getValueSafely)(utf8StringBytesToCodeMap, lengthOfDataLen)
|
|
177
|
+
: (0, zipItDataRepresentationUtils_1.getValueSafely)(binaryBytesToCodeMap, lengthOfDataLen));
|
|
178
178
|
// Write actual data if length greater than 0, otherwise Marker Code is enough.
|
|
179
179
|
if (lengthOfDataLen > 0) {
|
|
180
180
|
buffer.write(data.length, lengthOfDataLen);
|
|
@@ -196,8 +196,8 @@ function serializeNodeCore(buffer, nodeCore, dictionary) {
|
|
|
196
196
|
// For a tree node start and end with set/list start and end marker codes.
|
|
197
197
|
const startCode = zipItDataRepresentationUtils_1.MarkerCodesStart[child.type];
|
|
198
198
|
const endCode = zipItDataRepresentationUtils_1.MarkerCodesEnd[child.type];
|
|
199
|
-
common_utils_1.assert(startCode !== undefined, 0x285 /* "Start code should not undefined" */);
|
|
200
|
-
common_utils_1.assert(endCode !== undefined, 0x286 /* "End code should not undefined" */);
|
|
199
|
+
(0, common_utils_1.assert)(startCode !== undefined, 0x285 /* "Start code should not undefined" */);
|
|
200
|
+
(0, common_utils_1.assert)(endCode !== undefined, 0x286 /* "End code should not undefined" */);
|
|
201
201
|
buffer.write(startCode);
|
|
202
202
|
serializeNodeCore(buffer, child, dictionary);
|
|
203
203
|
buffer.write(endCode);
|
|
@@ -209,7 +209,7 @@ function serializeNodeCore(buffer, nodeCore, dictionary) {
|
|
|
209
209
|
// Calculate length in which integer will be stored
|
|
210
210
|
const len = calcLength(child);
|
|
211
211
|
// Write corresponding Marker code for length of integer.
|
|
212
|
-
buffer.write(zipItDataRepresentationUtils_1.getValueSafely(integerBytesToCodeMap, len));
|
|
212
|
+
buffer.write((0, zipItDataRepresentationUtils_1.getValueSafely)(integerBytesToCodeMap, len));
|
|
213
213
|
// Write actual number if greater than 0, otherwise Marker Code is enough.
|
|
214
214
|
if (len > 0) {
|
|
215
215
|
buffer.write(child, len);
|
|
@@ -219,7 +219,7 @@ function serializeNodeCore(buffer, nodeCore, dictionary) {
|
|
|
219
219
|
buffer.write(boolToCodeMap[child ? 1 : 0]);
|
|
220
220
|
}
|
|
221
221
|
else {
|
|
222
|
-
common_utils_1.unreachableCase(child, "Unsupported node type");
|
|
222
|
+
(0, common_utils_1.unreachableCase)(child, "Unsupported node type");
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WriteBufferUtils.js","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAuE;AACvE,uDAA+C;AAC/C,iFASwC;AAExC;;;GAGG;AACH,MAAa,WAAW;IAAxB;QACc,SAAI,GAAgB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,UAAK,GAAG,CAAC,CAAC;IAsCxB,CAAC;IApCa,IAAI,CAAC,IAAY;QACvB,qBAAM,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE;YACvB,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;YACpD,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;YAC1B,OAAO,KAAK,GAAG,MAAM,EAAE;gBACnB,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChC,KAAK,EAAE,CAAC;aACX;YACD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;SACvB;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,SAA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C1E,IAAI,GAAG,GAAG,CAAC,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;aAC5B;SACJ;aAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;YACnC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C;aAAM;YACH,8BAAe,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;SACnD;KACJ;AACL,CAAC;AAED,MAAM,kBAAmB,SAAQ,uCAAQ;IACrC;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IAEM,SAAS,CAAC,MAAmB;QAChC,iBAAiB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC/D,CAAC;CACJ;AAED,MAAa,qBAAsB,SAAQ,kBAAkB;IACzD;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAAkB;QAC1B,OAAO,0CAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAEM,SAAS;QACZ,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;CACJ;AAdD,sDAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport {\n BlobCore,\n codeToBytesMap,\n getValueSafely,\n MarkerCodes,\n MarkerCodesEnd,\n MarkerCodesStart,\n NodeCore,\n TreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\n\n/**\n * Buffer class, used to sequentially writ data.\n * Used by tree code to serialize tree into binary representation.\n */\nexport class WriteBuffer {\n protected data?: Uint8Array = new Uint8Array(4096);\n protected index = 0;\n\n protected push(code: number) {\n assert(this.data !== undefined, 0x225 /* \"Data should be there\" */);\n const length = this.data.length;\n if (this.index === length) {\n const newData = new Uint8Array(length * 1.2 + 4096);\n let index = 0;\n const oldData = this.data;\n while (index < length) {\n newData[index] = oldData[index];\n index++;\n }\n this.data = newData;\n }\n this.data[this.index] = code % 256;\n this.index++;\n }\n\n public write(codeArg: number, lengthArg = 1) {\n let code = codeArg;\n let length = lengthArg;\n while (length > 0) {\n this.push(code % 256);\n code = Math.floor(code / 256);\n length--;\n }\n assert(code === 0, 0x226 /* `Should write complete data code= ${codeArg} ${lengthArg}` */);\n }\n\n public done(): ReadBuffer {\n assert(this.data !== undefined, 0x227 /* \"Data should be there\" */);\n // We can slice it to have smaller memory representation.\n // But it will be way more expensive in terms of CPU cycles!\n const buffer = new ReadBuffer(this.data.subarray(0, this.index));\n this.data = undefined;\n return buffer;\n }\n}\n\n// This list of maps below is reverse mapping of Marker Codes specified in zipItDataRepresentationUtils.ts file.\n// We can also found them on server filestore code.\n// eslint-disable-next-line max-len\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n\n/**\n * This contains mapping of number of bytes representing the corresponding string length to Marker Codes.\n*/\nconst utf8StringBytesToCodeMap = {\n 0: 13,\n 1: 14,\n 2: 15,\n 4: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding length in which actual data(base64 string)\n * will be stored to Marker Codes.\n*/\nconst binaryBytesToCodeMap = {\n 0: 32,\n 1: 33,\n 2: 34,\n 4: 35,\n 8: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding const string id to Marker Codes.\n*/\nconst constStringBytesToCodeMap = {\n 1: 17,\n 2: 18,\n 4: 19,\n};\n\n/**\n * This contains mapping of number of bytes to Marker Codes representing the corresponding Integer.\n*/\nconst integerBytesToCodeMap = {\n 0: 1,\n 1: 3,\n 2: 5,\n 4: 7,\n 8: 9,\n};\n\n/**\n * This contains mapping of boolean to Marker Codes representing the corresponding bool value.\n*/\nconst boolToCodeMap = [\n 12, // false\n 11, // true\n];\n\n/**\n * Calculate how many bytes are required to encode an integer. This is always power of 2.\n * So if 6 bytes are required to store an integer than it will return 8. 0 is a special case for which we\n * return 0 as it is usually just represented by marker code and we don't store the actual data.\n * @param num - number to encode.\n */\n export function calcLength(numArg: number) {\n if (numArg === 0) {\n return 0;\n }\n let num = numArg;\n let lengthLen = 0;\n while (num > 0) {\n num = Math.floor(num / 256);\n lengthLen++;\n }\n let res = 1;\n while (res < lengthLen) {\n res *= 2;\n }\n return res;\n}\n\n/**\n * Implementation of serialization of blobs in buffer with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param blob - blob to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeBlob(buffer: WriteBuffer, blob: BlobCore, dictionary: Map<string, number>) {\n const data = blob.buffer;\n const lengthOfDataLen = calcLength(data.length);\n if (blob.constString) {\n const content = blob.toString();\n let id = dictionary.get(content);\n let idLength: number;\n if (id === undefined) {\n id = dictionary.size + 1;\n idLength = calcLength(id);\n dictionary.set(content, id);\n let code: number;\n if (lengthOfDataLen > 1 || idLength > 1) {\n code = MarkerCodes.ConstStringDeclareBig;\n } else {\n code = MarkerCodes.ConstStringDeclare;\n }\n // Write marker code for const string.\n buffer.write(code);\n const bytes = getValueSafely(codeToBytesMap, code);\n assert(bytes >= lengthOfDataLen, 0x283 /* \"Length of data len should fit in the bytes from the map\" */);\n assert(bytes >= idLength, 0x284 /* \"Length of id should fit in the bytes from the map\" */);\n // Assign and write id for const string.\n buffer.write(id, bytes);\n // Write length of const string.\n buffer.write(data.length, bytes);\n // Write const string data.\n for (const element of data) {\n buffer.write(element);\n }\n } else {\n idLength = calcLength(id);\n }\n // Write Marker Code\n buffer.write(getValueSafely(constStringBytesToCodeMap, idLength));\n // Write id of const string\n buffer.write(id, idLength);\n } else {\n // Write Marker code.\n buffer.write(blob.useUtf8Code ? getValueSafely(utf8StringBytesToCodeMap, lengthOfDataLen)\n : getValueSafely(binaryBytesToCodeMap, lengthOfDataLen));\n // Write actual data if length greater than 0, otherwise Marker Code is enough.\n if (lengthOfDataLen > 0) {\n buffer.write(data.length, lengthOfDataLen);\n for (const element of data) {\n buffer.write(element);\n }\n }\n }\n}\n\n/**\n * Implementation of serialization of nodes with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param nodeCore - Node to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeNodeCore(buffer: WriteBuffer, nodeCore: NodeCore, dictionary: Map<string, number>) {\n for (const child of nodeCore.nodes) {\n if (child instanceof NodeCore) {\n // For a tree node start and end with set/list start and end marker codes.\n const startCode = MarkerCodesStart[child.type];\n const endCode = MarkerCodesEnd[child.type];\n assert(startCode !== undefined, 0x285 /* \"Start code should not undefined\" */);\n assert(endCode !== undefined, 0x286 /* \"End code should not undefined\" */);\n buffer.write(startCode);\n serializeNodeCore(buffer, child, dictionary);\n buffer.write(endCode);\n } else if (child instanceof BlobCore) {\n serializeBlob(buffer, child, dictionary);\n } else if (typeof child === \"number\") {\n // Calculate length in which integer will be stored\n const len = calcLength(child);\n // Write corresponding Marker code for length of integer.\n buffer.write(getValueSafely(integerBytesToCodeMap, len));\n // Write actual number if greater than 0, otherwise Marker Code is enough.\n if (len > 0) {\n buffer.write(child, len);\n }\n } else if (typeof child === \"boolean\") {\n buffer.write(boolToCodeMap[child ? 1 : 0]);\n } else {\n unreachableCase(child, \"Unsupported node type\");\n }\n }\n}\n\nclass NodeCoreSerializer extends NodeCore {\n constructor() {\n super();\n }\n\n public serialize(buffer: WriteBuffer) {\n serializeNodeCore(buffer, this, new Map<string, number>());\n }\n}\n\nexport class TreeBuilderSerializer extends NodeCoreSerializer {\n constructor() {\n super();\n }\n\n static load(buffer: ReadBuffer): TreeBuilder {\n return TreeBuilder.load(buffer);\n }\n\n public serialize(): ReadBuffer {\n const buffer = new WriteBuffer();\n super.serialize(buffer);\n return buffer.done();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"WriteBufferUtils.js","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAuE;AACvE,uDAA+C;AAC/C,iFASwC;AAExC;;;GAGG;AACH,MAAa,WAAW;IAAxB;QACc,SAAI,GAAgB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,UAAK,GAAG,CAAC,CAAC;IAsCxB,CAAC;IApCa,IAAI,CAAC,IAAY;QACvB,IAAA,qBAAM,EAAC,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE;YACvB,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;YACpD,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;YAC1B,OAAO,KAAK,GAAG,MAAM,EAAE;gBACnB,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChC,KAAK,EAAE,CAAC;aACX;YACD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;SACvB;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,SAAS,GAAG,CAAC;QACvC,IAAI,IAAI,GAAG,OAAO,CAAC;QACnB,IAAI,MAAM,GAAG,SAAS,CAAC;QACvB,OAAO,MAAM,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C,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;aAC5B;SACJ;aAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;YACnC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C;aAAM;YACH,IAAA,8BAAe,EAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;SACnD;KACJ;AACL,CAAC;AAED,MAAM,kBAAmB,SAAQ,uCAAQ;IACrC;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IAEM,SAAS,CAAC,MAAmB;QAChC,iBAAiB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC/D,CAAC;CACJ;AAED,MAAa,qBAAsB,SAAQ,kBAAkB;IACzD;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAAkB;QAC1B,OAAO,0CAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAEM,SAAS;QACZ,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QACjC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;CACJ;AAdD,sDAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport {\n BlobCore,\n codeToBytesMap,\n getValueSafely,\n MarkerCodes,\n MarkerCodesEnd,\n MarkerCodesStart,\n NodeCore,\n TreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\n\n/**\n * Buffer class, used to sequentially writ data.\n * Used by tree code to serialize tree into binary representation.\n */\nexport class WriteBuffer {\n protected data?: Uint8Array = new Uint8Array(4096);\n protected index = 0;\n\n protected push(code: number) {\n assert(this.data !== undefined, 0x225 /* \"Data should be there\" */);\n const length = this.data.length;\n if (this.index === length) {\n const newData = new Uint8Array(length * 1.2 + 4096);\n let index = 0;\n const oldData = this.data;\n while (index < length) {\n newData[index] = oldData[index];\n index++;\n }\n this.data = newData;\n }\n this.data[this.index] = code % 256;\n this.index++;\n }\n\n public write(codeArg: number, lengthArg = 1) {\n let code = codeArg;\n let length = lengthArg;\n while (length > 0) {\n this.push(code % 256);\n code = Math.floor(code / 256);\n length--;\n }\n assert(code === 0, 0x226 /* `Should write complete data code= ${codeArg} ${lengthArg}` */);\n }\n\n public done(): ReadBuffer {\n assert(this.data !== undefined, 0x227 /* \"Data should be there\" */);\n // We can slice it to have smaller memory representation.\n // But it will be way more expensive in terms of CPU cycles!\n const buffer = new ReadBuffer(this.data.subarray(0, this.index));\n this.data = undefined;\n return buffer;\n }\n}\n\n// This list of maps below is reverse mapping of Marker Codes specified in zipItDataRepresentationUtils.ts file.\n// We can also found them on server filestore code.\n// eslint-disable-next-line max-len\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n\n/**\n * This contains mapping of number of bytes representing the corresponding string length to Marker Codes.\n*/\nconst utf8StringBytesToCodeMap = {\n 0: 13,\n 1: 14,\n 2: 15,\n 4: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding length in which actual data(base64 string)\n * will be stored to Marker Codes.\n*/\nconst binaryBytesToCodeMap = {\n 0: 32,\n 1: 33,\n 2: 34,\n 4: 35,\n 8: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding const string id to Marker Codes.\n*/\nconst constStringBytesToCodeMap = {\n 1: 17,\n 2: 18,\n 4: 19,\n};\n\n/**\n * This contains mapping of number of bytes to Marker Codes representing the corresponding Integer.\n*/\nconst integerBytesToCodeMap = {\n 0: 1,\n 1: 3,\n 2: 5,\n 4: 7,\n 8: 9,\n};\n\n/**\n * This contains mapping of boolean to Marker Codes representing the corresponding bool value.\n*/\nconst boolToCodeMap = [\n 12, // false\n 11, // true\n];\n\n/**\n * Calculate how many bytes are required to encode an integer. This is always power of 2.\n * So if 6 bytes are required to store an integer than it will return 8. 0 is a special case for which we\n * return 0 as it is usually just represented by marker code and we don't store the actual data.\n * @param num - number to encode.\n */\n export function calcLength(numArg: number) {\n if (numArg === 0) {\n return 0;\n }\n let num = numArg;\n let lengthLen = 0;\n while (num > 0) {\n num = Math.floor(num / 256);\n lengthLen++;\n }\n let res = 1;\n while (res < lengthLen) {\n res *= 2;\n }\n return res;\n}\n\n/**\n * Implementation of serialization of blobs in buffer with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param blob - blob to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeBlob(buffer: WriteBuffer, blob: BlobCore, dictionary: Map<string, number>) {\n const data = blob.buffer;\n const lengthOfDataLen = calcLength(data.length);\n if (blob.constString) {\n const content = blob.toString();\n let id = dictionary.get(content);\n let idLength: number;\n if (id === undefined) {\n id = dictionary.size + 1;\n idLength = calcLength(id);\n dictionary.set(content, id);\n let code: number;\n if (lengthOfDataLen > 1 || idLength > 1) {\n code = MarkerCodes.ConstStringDeclareBig;\n } else {\n code = MarkerCodes.ConstStringDeclare;\n }\n // Write marker code for const string.\n buffer.write(code);\n const bytes = getValueSafely(codeToBytesMap, code);\n assert(bytes >= lengthOfDataLen, 0x283 /* \"Length of data len should fit in the bytes from the map\" */);\n assert(bytes >= idLength, 0x284 /* \"Length of id should fit in the bytes from the map\" */);\n // Assign and write id for const string.\n buffer.write(id, bytes);\n // Write length of const string.\n buffer.write(data.length, bytes);\n // Write const string data.\n for (const element of data) {\n buffer.write(element);\n }\n } else {\n idLength = calcLength(id);\n }\n // Write Marker Code\n buffer.write(getValueSafely(constStringBytesToCodeMap, idLength));\n // Write id of const string\n buffer.write(id, idLength);\n } else {\n // Write Marker code.\n buffer.write(blob.useUtf8Code ? getValueSafely(utf8StringBytesToCodeMap, lengthOfDataLen)\n : getValueSafely(binaryBytesToCodeMap, lengthOfDataLen));\n // Write actual data if length greater than 0, otherwise Marker Code is enough.\n if (lengthOfDataLen > 0) {\n buffer.write(data.length, lengthOfDataLen);\n for (const element of data) {\n buffer.write(element);\n }\n }\n }\n}\n\n/**\n * Implementation of serialization of nodes with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param nodeCore - Node to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeNodeCore(buffer: WriteBuffer, nodeCore: NodeCore, dictionary: Map<string, number>) {\n for (const child of nodeCore.nodes) {\n if (child instanceof NodeCore) {\n // For a tree node start and end with set/list start and end marker codes.\n const startCode = MarkerCodesStart[child.type];\n const endCode = MarkerCodesEnd[child.type];\n assert(startCode !== undefined, 0x285 /* \"Start code should not undefined\" */);\n assert(endCode !== undefined, 0x286 /* \"End code should not undefined\" */);\n buffer.write(startCode);\n serializeNodeCore(buffer, child, dictionary);\n buffer.write(endCode);\n } else if (child instanceof BlobCore) {\n serializeBlob(buffer, child, dictionary);\n } else if (typeof child === \"number\") {\n // Calculate length in which integer will be stored\n const len = calcLength(child);\n // Write corresponding Marker code for length of integer.\n buffer.write(getValueSafely(integerBytesToCodeMap, len));\n // Write actual number if greater than 0, otherwise Marker Code is enough.\n if (len > 0) {\n buffer.write(child, len);\n }\n } else if (typeof child === \"boolean\") {\n buffer.write(boolToCodeMap[child ? 1 : 0]);\n } else {\n unreachableCase(child, \"Unsupported node type\");\n }\n }\n}\n\nclass NodeCoreSerializer extends NodeCore {\n constructor() {\n super();\n }\n\n public serialize(buffer: WriteBuffer) {\n serializeNodeCore(buffer, this, new Map<string, number>());\n }\n}\n\nexport class TreeBuilderSerializer extends NodeCoreSerializer {\n constructor() {\n super();\n }\n\n static load(buffer: ReadBuffer): TreeBuilder {\n return TreeBuilder.load(buffer);\n }\n\n public serialize(): ReadBuffer {\n const buffer = new WriteBuffer();\n super.serialize(buffer);\n return buffer.done();\n }\n}\n"]}
|
package/dist/checkUrl.js
CHANGED
|
@@ -13,7 +13,7 @@ const odspFluidFileLink_1 = require("./odspFluidFileLink");
|
|
|
13
13
|
* before the entire Fluid loading process needs to be kicked off.
|
|
14
14
|
*/
|
|
15
15
|
function checkUrl(documentUrl) {
|
|
16
|
-
const locator = odspFluidFileLink_1.getLocatorFromOdspUrl(documentUrl);
|
|
16
|
+
const locator = (0, odspFluidFileLink_1.getLocatorFromOdspUrl)(documentUrl);
|
|
17
17
|
if (!locator) {
|
|
18
18
|
return undefined;
|
|
19
19
|
}
|
package/dist/checkUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkUrl.js","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2DAA4D;AAE5D;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACvC,MAAM,OAAO,GAAG,yCAAqB,
|
|
1
|
+
{"version":3,"file":"checkUrl.js","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2DAA4D;AAE5D;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACvC,MAAM,OAAO,GAAG,IAAA,yCAAqB,EAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,UAA8B,CAAC;IACnC,IAAI;QACF,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,EAAE;YACpB,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC,MAAM,CAAC;SAC/C;KACF;IAAC,WAAM,GAAE;IAEV,OAAO;QACL,eAAe,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB;QAC9C,uEAAuE;QACvE,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;KAC3D,CAAC;AACJ,CAAC;AAnBD,4BAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DriverPreCheckInfo } from \"@fluidframework/driver-definitions\";\nimport { getLocatorFromOdspUrl } from \"./odspFluidFileLink\";\n\n/**\n * A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.\n * Note that returning information here is NOT a full guarentee that resolve will ultimately be successsful.\n * Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs\n * before the entire Fluid loading process needs to be kicked off.\n */\nexport function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined {\n const locator = getLocatorFromOdspUrl(documentUrl);\n\n if (!locator) {\n return undefined;\n }\n\n let siteOrigin: string | undefined;\n try {\n if (locator?.siteUrl) {\n siteOrigin = new URL(locator?.siteUrl).origin;\n }\n } catch {}\n\n return {\n codeDetailsHint: locator?.containerPackageName,\n // Add the snapshot endpoint, which has the same domain as the site URL\n criticalBootDomains: siteOrigin ? [siteOrigin] : undefined,\n };\n}\n"]}
|
|
@@ -14,13 +14,13 @@ exports.currentReadVersion = "1.0";
|
|
|
14
14
|
* @param node - tree node to read blob section from
|
|
15
15
|
*/
|
|
16
16
|
function readBlobSection(node) {
|
|
17
|
-
zipItDataRepresentationUtils_1.assertNodeCoreInstance(node, "TreeBlobs should be of type NodeCore");
|
|
17
|
+
(0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "TreeBlobs should be of type NodeCore");
|
|
18
18
|
const blobs = new Map();
|
|
19
19
|
for (let count = 0; count < node.length; ++count) {
|
|
20
20
|
const blob = node.getNode(count);
|
|
21
|
-
const records = zipItDataRepresentationUtils_1.getAndValidateNodeProps(blob, ["id", "data"]);
|
|
22
|
-
zipItDataRepresentationUtils_1.assertBlobCoreInstance(records.data, "data should be of BlobCore type");
|
|
23
|
-
zipItDataRepresentationUtils_1.assertBlobCoreInstance(records.id, "blob id should be of BlobCore type");
|
|
21
|
+
const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(blob, ["id", "data"]);
|
|
22
|
+
(0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.data, "data should be of BlobCore type");
|
|
23
|
+
(0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.id, "blob id should be of BlobCore type");
|
|
24
24
|
blobs.set(records.id.toString(), records.data.arrayBuffer);
|
|
25
25
|
}
|
|
26
26
|
return blobs;
|
|
@@ -30,15 +30,15 @@ function readBlobSection(node) {
|
|
|
30
30
|
* @param node - tree node to read ops section from
|
|
31
31
|
*/
|
|
32
32
|
function readOpsSection(node) {
|
|
33
|
-
zipItDataRepresentationUtils_1.assertNodeCoreInstance(node, "Deltas should be of type NodeCore");
|
|
33
|
+
(0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "Deltas should be of type NodeCore");
|
|
34
34
|
const ops = [];
|
|
35
|
-
const records = zipItDataRepresentationUtils_1.getAndValidateNodeProps(node, ["firstSequenceNumber", "deltas"]);
|
|
36
|
-
zipItDataRepresentationUtils_1.assertNumberInstance(records.firstSequenceNumber, "Seq number should be a number");
|
|
37
|
-
zipItDataRepresentationUtils_1.assertNodeCoreInstance(records.deltas, "Deltas should be a Node");
|
|
35
|
+
const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(node, ["firstSequenceNumber", "deltas"]);
|
|
36
|
+
(0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.firstSequenceNumber, "Seq number should be a number");
|
|
37
|
+
(0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.deltas, "Deltas should be a Node");
|
|
38
38
|
for (let i = 0; i < records.deltas.length; ++i) {
|
|
39
39
|
ops.push(JSON.parse(records.deltas.getString(i)));
|
|
40
40
|
}
|
|
41
|
-
common_utils_1.assert(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber, 0x280 /* "Validate first op seq number" */);
|
|
41
|
+
(0, common_utils_1.assert)(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber, 0x280 /* "Validate first op seq number" */);
|
|
42
42
|
return ops;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
@@ -52,21 +52,21 @@ function readTreeSection(node) {
|
|
|
52
52
|
};
|
|
53
53
|
for (let count = 0; count < node.length; count++) {
|
|
54
54
|
const treeNode = node.getNode(count);
|
|
55
|
-
const records = zipItDataRepresentationUtils_1.getAndValidateNodeProps(treeNode, ["name", "value", "children", "unreferenced"], false);
|
|
56
|
-
zipItDataRepresentationUtils_1.assertBlobCoreInstance(records.name, "Path should be of BlobCore");
|
|
55
|
+
const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(treeNode, ["name", "value", "children", "unreferenced"], false);
|
|
56
|
+
(0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.name, "Path should be of BlobCore");
|
|
57
57
|
const path = records.name.toString();
|
|
58
58
|
if (records.value !== undefined) {
|
|
59
|
-
zipItDataRepresentationUtils_1.assertBlobCoreInstance(records.value, "Blob value should be BlobCore");
|
|
59
|
+
(0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.value, "Blob value should be BlobCore");
|
|
60
60
|
snapshotTree.blobs[path] = records.value.toString();
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
zipItDataRepresentationUtils_1.assertNodeCoreInstance(records.children, "Trees should be of type NodeCore");
|
|
63
|
+
(0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.children, "Trees should be of type NodeCore");
|
|
64
64
|
snapshotTree.trees[path] = readTreeSection(records.children);
|
|
65
65
|
}
|
|
66
66
|
if (records.unreferenced !== undefined) {
|
|
67
|
-
zipItDataRepresentationUtils_1.assertBoolInstance(records.unreferenced, "Unreferenced flag should be bool");
|
|
67
|
+
(0, zipItDataRepresentationUtils_1.assertBoolInstance)(records.unreferenced, "Unreferenced flag should be bool");
|
|
68
68
|
const unreferenced = records.unreferenced.valueOf();
|
|
69
|
-
common_utils_1.assert(unreferenced, 0x281 /* "Unreferenced if present should be true" */);
|
|
69
|
+
(0, common_utils_1.assert)(unreferenced, 0x281 /* "Unreferenced if present should be true" */);
|
|
70
70
|
snapshotTree.unreferenced = unreferenced;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -77,11 +77,11 @@ function readTreeSection(node) {
|
|
|
77
77
|
* @param node - tree node to de-serialize from
|
|
78
78
|
*/
|
|
79
79
|
function readSnapshotSection(node) {
|
|
80
|
-
zipItDataRepresentationUtils_1.assertNodeCoreInstance(node, "Snapshot should be of type NodeCore");
|
|
81
|
-
const records = zipItDataRepresentationUtils_1.getAndValidateNodeProps(node, ["id", "sequenceNumber", "treeNodes"]);
|
|
82
|
-
zipItDataRepresentationUtils_1.assertNodeCoreInstance(records.treeNodes, "TreeNodes should be of type NodeCore");
|
|
83
|
-
zipItDataRepresentationUtils_1.assertNumberInstance(records.sequenceNumber, "sequenceNumber should be of type number");
|
|
84
|
-
zipItDataRepresentationUtils_1.assertBlobCoreInstance(records.id, "snapshotId should be BlobCore");
|
|
80
|
+
(0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "Snapshot should be of type NodeCore");
|
|
81
|
+
const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(node, ["id", "sequenceNumber", "treeNodes"]);
|
|
82
|
+
(0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.treeNodes, "TreeNodes should be of type NodeCore");
|
|
83
|
+
(0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.sequenceNumber, "sequenceNumber should be of type number");
|
|
84
|
+
(0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.id, "snapshotId should be BlobCore");
|
|
85
85
|
const snapshotTree = readTreeSection(records.treeNodes);
|
|
86
86
|
snapshotTree.id = records.id.toString();
|
|
87
87
|
const sequenceNumber = records.sequenceNumber.valueOf();
|
|
@@ -97,14 +97,14 @@ function readSnapshotSection(node) {
|
|
|
97
97
|
*/
|
|
98
98
|
function parseCompactSnapshotResponse(buffer) {
|
|
99
99
|
const builder = zipItDataRepresentationUtils_1.TreeBuilder.load(buffer);
|
|
100
|
-
common_utils_1.assert(builder.length === 1, 0x219 /* "1 root should be there" */);
|
|
100
|
+
(0, common_utils_1.assert)(builder.length === 1, 0x219 /* "1 root should be there" */);
|
|
101
101
|
const root = builder.getNode(0);
|
|
102
|
-
const records = zipItDataRepresentationUtils_1.getAndValidateNodeProps(root, ["mrv", "cv", "snapshot", "blobs", "deltas"], false);
|
|
103
|
-
zipItDataRepresentationUtils_1.assertBlobCoreInstance(records.mrv, "minReadVersion should be of BlobCore type");
|
|
104
|
-
zipItDataRepresentationUtils_1.assertBlobCoreInstance(records.cv, "createVersion should be of BlobCore type");
|
|
105
|
-
common_utils_1.assert(exports.snapshotMinReadVersion >= records.mrv.toString(), 0x20f /* "Driver min read version should >= to server minReadVersion" */);
|
|
106
|
-
common_utils_1.assert(records.cv.toString() >= exports.snapshotMinReadVersion, 0x210 /* "Snapshot should be created with minReadVersion or above" */);
|
|
107
|
-
common_utils_1.assert(exports.currentReadVersion === records.cv.toString(), 0x2c2 /* "Create Version should be equal to currentReadVersion" */);
|
|
102
|
+
const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(root, ["mrv", "cv", "snapshot", "blobs", "deltas"], false);
|
|
103
|
+
(0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.mrv, "minReadVersion should be of BlobCore type");
|
|
104
|
+
(0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.cv, "createVersion should be of BlobCore type");
|
|
105
|
+
(0, common_utils_1.assert)(exports.snapshotMinReadVersion >= records.mrv.toString(), 0x20f /* "Driver min read version should >= to server minReadVersion" */);
|
|
106
|
+
(0, common_utils_1.assert)(records.cv.toString() >= exports.snapshotMinReadVersion, 0x210 /* "Snapshot should be created with minReadVersion or above" */);
|
|
107
|
+
(0, common_utils_1.assert)(exports.currentReadVersion === records.cv.toString(), 0x2c2 /* "Create Version should be equal to currentReadVersion" */);
|
|
108
108
|
return Object.assign(Object.assign({}, readSnapshotSection(records.snapshot)), { blobs: readBlobSection(records.blobs), ops: records.deltas !== undefined ? readOpsSection(records.deltas) : [] });
|
|
109
109
|
}
|
|
110
110
|
exports.parseCompactSnapshotResponse = parseCompactSnapshotResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compactSnapshotParser.js","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAItD,iFASwC;AAE3B,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAC/B,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAOxC;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAe;IACpC,qDAAsB,CAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACrE,MAAM,KAAK,GAA6B,IAAI,GAAG,EAAE,CAAC;IAClD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,sDAAuB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9D,qDAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,iCAAiC,CAAC,CAAC;QACxE,qDAAsB,CAAC,OAAO,CAAC,EAAE,EAAE,oCAAoC,CAAC,CAAC;QACzE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KAC9D;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAA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SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IACzE;AACN,CAAC;AArBD,oEAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { ISnapshotContents } from \"./odspUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport {\n assertBlobCoreInstance,\n assertBoolInstance,\n assertNodeCoreInstance,\n assertNumberInstance,\n getAndValidateNodeProps,\n NodeCore,\n NodeTypes,\n TreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\n\nexport const snapshotMinReadVersion = \"1.0\";\nexport const currentReadVersion = \"1.0\";\n\ninterface ISnapshotSection {\n snapshotTree: ISnapshotTree,\n sequenceNumber: number,\n}\n\n/**\n * Recreates blobs section of the tree.\n * @param node - tree node to read blob section from\n */\nfunction readBlobSection(node: NodeTypes) {\n assertNodeCoreInstance(node, \"TreeBlobs should be of type NodeCore\");\n const blobs: Map<string, ArrayBuffer> = new Map();\n for (let count = 0; count < node.length; ++count) {\n const blob = node.getNode(count);\n const records = getAndValidateNodeProps(blob, [\"id\", \"data\"]);\n assertBlobCoreInstance(records.data, \"data should be of BlobCore type\");\n assertBlobCoreInstance(records.id, \"blob id should be of BlobCore type\");\n blobs.set(records.id.toString(), records.data.arrayBuffer);\n }\n return blobs;\n}\n\n/**\n * Recreates ops section of the tree.\n * @param node - tree node to read ops section from\n */\nfunction readOpsSection(node: NodeTypes) {\n assertNodeCoreInstance(node, \"Deltas should be of type NodeCore\");\n const ops: ISequencedDocumentMessage[] = [];\n const records = getAndValidateNodeProps(node, [\"firstSequenceNumber\", \"deltas\"]);\n assertNumberInstance(records.firstSequenceNumber, \"Seq number should be a number\");\n assertNodeCoreInstance(records.deltas, \"Deltas should be a Node\");\n for (let i = 0; i < records.deltas.length; ++i) {\n ops.push(JSON.parse(records.deltas.getString(i)));\n }\n assert(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,\n 0x280 /* \"Validate first op seq number\" */);\n return ops;\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readTreeSection(node: NodeCore) {\n const snapshotTree: ISnapshotTree = {\n blobs: {},\n trees: {},\n };\n for (let count = 0; count < node.length; count++) {\n const treeNode = node.getNode(count);\n const records = getAndValidateNodeProps(treeNode,\n [\"name\", \"value\", \"children\", \"unreferenced\"], false);\n assertBlobCoreInstance(records.name, \"Path should be of BlobCore\");\n const path = records.name.toString();\n if (records.value !== undefined) {\n assertBlobCoreInstance(records.value, \"Blob value should be BlobCore\");\n snapshotTree.blobs[path] = records.value.toString();\n } else {\n assertNodeCoreInstance(records.children, \"Trees should be of type NodeCore\");\n snapshotTree.trees[path] = readTreeSection(records.children);\n }\n if (records.unreferenced !== undefined) {\n assertBoolInstance(records.unreferenced, \"Unreferenced flag should be bool\");\n const unreferenced = records.unreferenced.valueOf();\n assert(unreferenced, 0x281 /* \"Unreferenced if present should be true\" */);\n snapshotTree.unreferenced = unreferenced;\n }\n }\n return snapshotTree;\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readSnapshotSection(node: NodeTypes): ISnapshotSection {\n assertNodeCoreInstance(node, \"Snapshot should be of type NodeCore\");\n const records = getAndValidateNodeProps(node,\n [\"id\", \"sequenceNumber\", \"treeNodes\"]);\n\n assertNodeCoreInstance(records.treeNodes, \"TreeNodes should be of type NodeCore\");\n assertNumberInstance(records.sequenceNumber, \"sequenceNumber should be of type number\");\n assertBlobCoreInstance(records.id, \"snapshotId should be BlobCore\");\n const snapshotTree: ISnapshotTree = readTreeSection(records.treeNodes);\n snapshotTree.id = records.id.toString();\n const sequenceNumber = records.sequenceNumber.valueOf();\n return {\n sequenceNumber,\n snapshotTree,\n };\n}\n\n/**\n * Converts snapshot from binary compact representation to tree/blobs/ops.\n * @param buffer - Compact snapshot to be parsed into tree/blobs/ops.\n * @returns - tree, blobs and ops from the snapshot.\n */\nexport function parseCompactSnapshotResponse(buffer: ReadBuffer): ISnapshotContents {\n const builder = TreeBuilder.load(buffer);\n assert(builder.length === 1, 0x219 /* \"1 root should be there\" */);\n const root = builder.getNode(0);\n\n const records = getAndValidateNodeProps(root,\n [\"mrv\", \"cv\", \"snapshot\", \"blobs\", \"deltas\"], false);\n\n assertBlobCoreInstance(records.mrv, \"minReadVersion should be of BlobCore type\");\n assertBlobCoreInstance(records.cv, \"createVersion should be of BlobCore type\");\n assert(snapshotMinReadVersion >= records.mrv.toString(),\n 0x20f /* \"Driver min read version should >= to server minReadVersion\" */);\n assert(records.cv.toString() >= snapshotMinReadVersion,\n 0x210 /* \"Snapshot should be created with minReadVersion or above\" */);\n assert(currentReadVersion === records.cv.toString(),\n 0x2c2 /* \"Create Version should be equal to currentReadVersion\" */);\n return {\n ...readSnapshotSection(records.snapshot),\n blobs: readBlobSection(records.blobs),\n ops: records.deltas !== undefined ? readOpsSection(records.deltas) : [],\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compactSnapshotParser.js","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAItD,iFASwC;AAE3B,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAC/B,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAOxC;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAe;IACpC,IAAA,qDAAsB,EAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACrE,MAAM,KAAK,GAA6B,IAAI,GAAG,EAAE,CAAC;IAClD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC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2CAA2C,CAAC,CAAC;IACjF,IAAA,qDAAsB,EAAC,OAAO,CAAC,EAAE,EAAE,0CAA0C,CAAC,CAAC;IAC/E,IAAA,qBAAM,EAAC,8BAAsB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EACnD,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAC9E,IAAA,qBAAM,EAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,8BAAsB,EAClD,KAAK,CAAC,+DAA+D,CAAC,CAAC;IAC3E,IAAA,qBAAM,EAAC,0BAAkB,KAAK,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,EAC/C,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACxE,uCACO,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,KACxC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,EACrC,GAAG,EAAE,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IACzE;AACN,CAAC;AArBD,oEAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { ISnapshotContents } from \"./odspUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport {\n assertBlobCoreInstance,\n assertBoolInstance,\n assertNodeCoreInstance,\n assertNumberInstance,\n getAndValidateNodeProps,\n NodeCore,\n NodeTypes,\n TreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\n\nexport const snapshotMinReadVersion = \"1.0\";\nexport const currentReadVersion = \"1.0\";\n\ninterface ISnapshotSection {\n snapshotTree: ISnapshotTree;\n sequenceNumber: number;\n}\n\n/**\n * Recreates blobs section of the tree.\n * @param node - tree node to read blob section from\n */\nfunction readBlobSection(node: NodeTypes) {\n assertNodeCoreInstance(node, \"TreeBlobs should be of type NodeCore\");\n const blobs: Map<string, ArrayBuffer> = new Map();\n for (let count = 0; count < node.length; ++count) {\n const blob = node.getNode(count);\n const records = getAndValidateNodeProps(blob, [\"id\", \"data\"]);\n assertBlobCoreInstance(records.data, \"data should be of BlobCore type\");\n assertBlobCoreInstance(records.id, \"blob id should be of BlobCore type\");\n blobs.set(records.id.toString(), records.data.arrayBuffer);\n }\n return blobs;\n}\n\n/**\n * Recreates ops section of the tree.\n * @param node - tree node to read ops section from\n */\nfunction readOpsSection(node: NodeTypes) {\n assertNodeCoreInstance(node, \"Deltas should be of type NodeCore\");\n const ops: ISequencedDocumentMessage[] = [];\n const records = getAndValidateNodeProps(node, [\"firstSequenceNumber\", \"deltas\"]);\n assertNumberInstance(records.firstSequenceNumber, \"Seq number should be a number\");\n assertNodeCoreInstance(records.deltas, \"Deltas should be a Node\");\n for (let i = 0; i < records.deltas.length; ++i) {\n ops.push(JSON.parse(records.deltas.getString(i)));\n }\n assert(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,\n 0x280 /* \"Validate first op seq number\" */);\n return ops;\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readTreeSection(node: NodeCore) {\n const snapshotTree: ISnapshotTree = {\n blobs: {},\n trees: {},\n };\n for (let count = 0; count < node.length; count++) {\n const treeNode = node.getNode(count);\n const records = getAndValidateNodeProps(treeNode,\n [\"name\", \"value\", \"children\", \"unreferenced\"], false);\n assertBlobCoreInstance(records.name, \"Path should be of BlobCore\");\n const path = records.name.toString();\n if (records.value !== undefined) {\n assertBlobCoreInstance(records.value, \"Blob value should be BlobCore\");\n snapshotTree.blobs[path] = records.value.toString();\n } else {\n assertNodeCoreInstance(records.children, \"Trees should be of type NodeCore\");\n snapshotTree.trees[path] = readTreeSection(records.children);\n }\n if (records.unreferenced !== undefined) {\n assertBoolInstance(records.unreferenced, \"Unreferenced flag should be bool\");\n const unreferenced = records.unreferenced.valueOf();\n assert(unreferenced, 0x281 /* \"Unreferenced if present should be true\" */);\n snapshotTree.unreferenced = unreferenced;\n }\n }\n return snapshotTree;\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readSnapshotSection(node: NodeTypes): ISnapshotSection {\n assertNodeCoreInstance(node, \"Snapshot should be of type NodeCore\");\n const records = getAndValidateNodeProps(node,\n [\"id\", \"sequenceNumber\", \"treeNodes\"]);\n\n assertNodeCoreInstance(records.treeNodes, \"TreeNodes should be of type NodeCore\");\n assertNumberInstance(records.sequenceNumber, \"sequenceNumber should be of type number\");\n assertBlobCoreInstance(records.id, \"snapshotId should be BlobCore\");\n const snapshotTree: ISnapshotTree = readTreeSection(records.treeNodes);\n snapshotTree.id = records.id.toString();\n const sequenceNumber = records.sequenceNumber.valueOf();\n return {\n sequenceNumber,\n snapshotTree,\n };\n}\n\n/**\n * Converts snapshot from binary compact representation to tree/blobs/ops.\n * @param buffer - Compact snapshot to be parsed into tree/blobs/ops.\n * @returns - tree, blobs and ops from the snapshot.\n */\nexport function parseCompactSnapshotResponse(buffer: ReadBuffer): ISnapshotContents {\n const builder = TreeBuilder.load(buffer);\n assert(builder.length === 1, 0x219 /* \"1 root should be there\" */);\n const root = builder.getNode(0);\n\n const records = getAndValidateNodeProps(root,\n [\"mrv\", \"cv\", \"snapshot\", \"blobs\", \"deltas\"], false);\n\n assertBlobCoreInstance(records.mrv, \"minReadVersion should be of BlobCore type\");\n assertBlobCoreInstance(records.cv, \"createVersion should be of BlobCore type\");\n assert(snapshotMinReadVersion >= records.mrv.toString(),\n 0x20f /* \"Driver min read version should >= to server minReadVersion\" */);\n assert(records.cv.toString() >= snapshotMinReadVersion,\n 0x210 /* \"Snapshot should be created with minReadVersion or above\" */);\n assert(currentReadVersion === records.cv.toString(),\n 0x2c2 /* \"Create Version should be equal to currentReadVersion\" */);\n return {\n ...readSnapshotSection(records.snapshot),\n blobs: readBlobSection(records.blobs),\n ops: records.deltas !== undefined ? readOpsSection(records.deltas) : [],\n };\n}\n"]}
|
|
@@ -15,9 +15,9 @@ const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils")
|
|
|
15
15
|
* @param latestSequenceNumber - latest seq number of the container.
|
|
16
16
|
*/
|
|
17
17
|
function writeSnapshotProps(node, latestSequenceNumber) {
|
|
18
|
-
zipItDataRepresentationUtils_1.addStringProperty(node, "mrv", compactSnapshotParser_1.snapshotMinReadVersion);
|
|
19
|
-
zipItDataRepresentationUtils_1.addStringProperty(node, "cv", compactSnapshotParser_1.snapshotMinReadVersion);
|
|
20
|
-
zipItDataRepresentationUtils_1.addNumberProperty(node, "lsn", latestSequenceNumber);
|
|
18
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(node, "mrv", compactSnapshotParser_1.snapshotMinReadVersion);
|
|
19
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(node, "cv", compactSnapshotParser_1.snapshotMinReadVersion);
|
|
20
|
+
(0, zipItDataRepresentationUtils_1.addNumberProperty)(node, "lsn", latestSequenceNumber);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Represents blobs in the tree.
|
|
@@ -30,13 +30,13 @@ function writeBlobsSection(snapshotNode, blobs) {
|
|
|
30
30
|
const blobsNode = snapshotNode.addNode("list");
|
|
31
31
|
for (const [storageBlobId, blob] of blobs) {
|
|
32
32
|
const blobNode = blobsNode.addNode();
|
|
33
|
-
zipItDataRepresentationUtils_1.addStringProperty(blobNode, "id", storageBlobId, true);
|
|
33
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(blobNode, "id", storageBlobId, true);
|
|
34
34
|
blobNode.addString("data", true);
|
|
35
35
|
if (blob instanceof ArrayBuffer) {
|
|
36
36
|
blobNode.addBlob(new Uint8Array(blob), false);
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
blobNode.addBlob(new Uint8Array(common_utils_1.stringToBuffer(blob.contents, (_a = blob.encoding) !== null && _a !== void 0 ? _a : "utf-8")), false);
|
|
39
|
+
blobNode.addBlob(new Uint8Array((0, common_utils_1.stringToBuffer)(blob.contents, (_a = blob.encoding) !== null && _a !== void 0 ? _a : "utf-8")), false);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -53,9 +53,9 @@ function writeTreeSection(snapshotNode, snapshotTree) {
|
|
|
53
53
|
function writeTreeSectionCore(treesNode, snapshotTree) {
|
|
54
54
|
for (const [path, value] of Object.entries(snapshotTree.trees)) {
|
|
55
55
|
const treeNode = treesNode.addNode();
|
|
56
|
-
zipItDataRepresentationUtils_1.addStringProperty(treeNode, "name", path);
|
|
56
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(treeNode, "name", path);
|
|
57
57
|
if (snapshotTree.unreferenced) {
|
|
58
|
-
zipItDataRepresentationUtils_1.addBoolProperty(treeNode, "unreferenced", snapshotTree.unreferenced);
|
|
58
|
+
(0, zipItDataRepresentationUtils_1.addBoolProperty)(treeNode, "unreferenced", snapshotTree.unreferenced);
|
|
59
59
|
}
|
|
60
60
|
treeNode.addString("children", true);
|
|
61
61
|
const childNode = treeNode.addNode("list");
|
|
@@ -64,8 +64,8 @@ function writeTreeSectionCore(treesNode, snapshotTree) {
|
|
|
64
64
|
if (snapshotTree.blobs) {
|
|
65
65
|
for (const [path, id] of Object.entries(snapshotTree.blobs)) {
|
|
66
66
|
const blobNode = treesNode.addNode();
|
|
67
|
-
zipItDataRepresentationUtils_1.addStringProperty(blobNode, "name", path);
|
|
68
|
-
zipItDataRepresentationUtils_1.addStringProperty(blobNode, "value", id, true);
|
|
67
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(blobNode, "name", path);
|
|
68
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(blobNode, "value", id, true);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -80,10 +80,10 @@ function writeSnapshotSection(rootNode, snapshotTree, snapshotSequenceNumber) {
|
|
|
80
80
|
rootNode.addString("snapshot", true);
|
|
81
81
|
const snapshotNode = rootNode.addNode();
|
|
82
82
|
const snapshotId = snapshotTree.id;
|
|
83
|
-
common_utils_1.assert(snapshotId !== undefined, 0x21b /* "Snapshot id should be provided" */);
|
|
84
|
-
zipItDataRepresentationUtils_1.addStringProperty(snapshotNode, "id", snapshotId);
|
|
85
|
-
zipItDataRepresentationUtils_1.addStringProperty(snapshotNode, "message", `Snapshot@${snapshotSequenceNumber}`);
|
|
86
|
-
zipItDataRepresentationUtils_1.addNumberProperty(snapshotNode, "sequenceNumber", snapshotSequenceNumber);
|
|
83
|
+
(0, common_utils_1.assert)(snapshotId !== undefined, 0x21b /* "Snapshot id should be provided" */);
|
|
84
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(snapshotNode, "id", snapshotId);
|
|
85
|
+
(0, zipItDataRepresentationUtils_1.addStringProperty)(snapshotNode, "message", `Snapshot@${snapshotSequenceNumber}`);
|
|
86
|
+
(0, zipItDataRepresentationUtils_1.addNumberProperty)(snapshotNode, "sequenceNumber", snapshotSequenceNumber);
|
|
87
87
|
// Add Trees
|
|
88
88
|
writeTreeSection(snapshotNode, snapshotTree);
|
|
89
89
|
}
|
|
@@ -100,7 +100,7 @@ function writeOpsSection(rootNode, ops) {
|
|
|
100
100
|
if (firstSequenceNumber !== undefined) {
|
|
101
101
|
rootNode.addString("deltas", true);
|
|
102
102
|
const opsNode = rootNode.addNode();
|
|
103
|
-
zipItDataRepresentationUtils_1.addNumberProperty(opsNode, "firstSequenceNumber", firstSequenceNumber);
|
|
103
|
+
(0, zipItDataRepresentationUtils_1.addNumberProperty)(opsNode, "firstSequenceNumber", firstSequenceNumber);
|
|
104
104
|
opsNode.addString("deltas", true);
|
|
105
105
|
const deltaNode = opsNode.addNode("list");
|
|
106
106
|
ops.forEach((op) => {
|
|
@@ -117,7 +117,7 @@ function convertToCompactSnapshot(snapshotContents) {
|
|
|
117
117
|
const builder = new WriteBufferUtils_1.TreeBuilderSerializer();
|
|
118
118
|
// Create the root node.
|
|
119
119
|
const rootNode = builder.addNode();
|
|
120
|
-
common_utils_1.assert(snapshotContents.sequenceNumber !== undefined, 0x21c /* "Seq number should be provided" */);
|
|
120
|
+
(0, common_utils_1.assert)(snapshotContents.sequenceNumber !== undefined, 0x21c /* "Seq number should be provided" */);
|
|
121
121
|
const ops = snapshotContents.ops;
|
|
122
122
|
const latestSequenceNumber = ops.length > 0 ? ops[ops.length - 1].sequenceNumber : snapshotContents.sequenceNumber;
|
|
123
123
|
writeSnapshotProps(rootNode, latestSequenceNumber);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compactSnapshotWriter.js","sourceRoot":"","sources":["../src/compactSnapshotWriter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsE;AAEtE,mEAAiE;AAGjE,yDAA2D;AAC3D,iFAAiH;AAEjH;;;;EAIE;AACF,SAAS,kBAAkB,CAAC,IAAc,EAAE,oBAA4B;IACpE,gDAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,8CAAsB,CAAC,CAAC;IACvD,gDAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,8CAAsB,CAAC,CAAC;IACtD,gDAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;AACzD,CAAC;AAED;;;;EAIE;AACF,SAAS,iBAAiB,CAAC,YAAsB,EAAE,KAAuC;;IACtF,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,KAAK,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE;QACvC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;QACrC,gDAAiB,CAAC,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;QACvD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AAO,OAAO,CAAC,SAAS,EAAE,CAAC;AAC/B,CAAC;AAtBD,4DAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, stringToBuffer } from \"@fluidframework/common-utils\";\nimport { IBlob, ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { snapshotMinReadVersion } from \"./compactSnapshotParser\";\nimport { ISnapshotContents } from \"./odspUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport { TreeBuilderSerializer } from \"./WriteBufferUtils\";\nimport { addBoolProperty, addNumberProperty, addStringProperty, NodeCore } from \"./zipItDataRepresentationUtils\";\n\n/**\n * Writes header section of the snapshot.\n * @param node - snapshot node to serialize to\n * @param latestSequenceNumber - latest seq number of the container.\n*/\nfunction writeSnapshotProps(node: NodeCore, latestSequenceNumber: number) {\n addStringProperty(node, \"mrv\", snapshotMinReadVersion);\n addStringProperty(node, \"cv\", snapshotMinReadVersion);\n addNumberProperty(node, \"lsn\", latestSequenceNumber);\n}\n\n/**\n * Represents blobs in the tree.\n * @param snapshotNode - node to serialize to.\n * @param blobs - blobs that is being serialized\n*/\nfunction writeBlobsSection(snapshotNode: NodeCore, blobs: Map<string, IBlob | ArrayBuffer>) {\n snapshotNode.addString(\"blobs\", true);\n const blobsNode = snapshotNode.addNode(\"list\");\n for (const [storageBlobId, blob] of blobs) {\n const blobNode = blobsNode.addNode();\n addStringProperty(blobNode, \"id\", storageBlobId, true);\n blobNode.addString(\"data\", true);\n if (blob instanceof ArrayBuffer) {\n blobNode.addBlob(new Uint8Array(blob), false);\n } else {\n blobNode.addBlob(new Uint8Array(stringToBuffer(blob.contents, blob.encoding ?? \"utf-8\")), false);\n }\n }\n}\n\n/**\n * Represents and serializes tree part of the snapshot\n * @param snapshotNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n*/\nfunction writeTreeSection(snapshotNode: NodeCore, snapshotTree: ISnapshotTree) {\n snapshotNode.addString(\"treeNodes\", true);\n const treesNode = snapshotNode.addNode(\"list\");\n writeTreeSectionCore(treesNode, snapshotTree);\n}\n\nfunction writeTreeSectionCore(treesNode: NodeCore, snapshotTree: ISnapshotTree) {\n for (const [path, value] of Object.entries(snapshotTree.trees)) {\n const treeNode = treesNode.addNode();\n addStringProperty(treeNode, \"name\", path);\n if (snapshotTree.unreferenced) {\n addBoolProperty(treeNode, \"unreferenced\", snapshotTree.unreferenced);\n }\n treeNode.addString(\"children\", true);\n const childNode = treeNode.addNode(\"list\");\n writeTreeSectionCore(childNode, value);\n }\n\n if (snapshotTree.blobs) {\n for (const [path, id] of Object.entries(snapshotTree.blobs)) {\n const blobNode = treesNode.addNode();\n addStringProperty(blobNode, \"name\", path);\n addStringProperty(blobNode, \"value\", id, true);\n }\n }\n}\n\n/**\n * Represents (serializes) snapshot tree as generalizes tree\n * @param rootNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n * @param blobs - blobs mapping of the snapshot\n * @param snapshotSequenceNumber - seq number at which snapshot is taken\n*/\nfunction writeSnapshotSection(\n rootNode: NodeCore,\n snapshotTree: ISnapshotTree,\n snapshotSequenceNumber: number,\n) {\n rootNode.addString(\"snapshot\", true);\n const snapshotNode = rootNode.addNode();\n\n const snapshotId = snapshotTree.id;\n assert(snapshotId !== undefined, 0x21b /* \"Snapshot id should be provided\" */);\n addStringProperty(snapshotNode, \"id\", snapshotId);\n addStringProperty(snapshotNode, \"message\", `Snapshot@${snapshotSequenceNumber}`);\n addNumberProperty(snapshotNode, \"sequenceNumber\", snapshotSequenceNumber);\n\n // Add Trees\n writeTreeSection(snapshotNode, snapshotTree);\n}\n\n/**\n * Represents ops in the tree.\n * @param rootNode - node to serialize to.\n * @param ops - ops that is being serialized\n*/\nfunction writeOpsSection(rootNode: NodeCore, ops: ISequencedDocumentMessage[]) {\n let firstSequenceNumber: number | undefined;\n if (ops.length > 0) {\n firstSequenceNumber = ops[0].sequenceNumber;\n }\n if (firstSequenceNumber !== undefined) {\n rootNode.addString(\"deltas\", true);\n const opsNode = rootNode.addNode();\n addNumberProperty(opsNode, \"firstSequenceNumber\", firstSequenceNumber);\n opsNode.addString(\"deltas\", true);\n const deltaNode = opsNode.addNode(\"list\");\n ops.forEach((op) => {\n deltaNode.addString(JSON.stringify(op), false);\n });\n }\n}\n\n/**\n * Converts trees/blobs/ops to binary compact representation.\n * @param snapshotContents - snapshot tree contents to serialize\n * @returns - ReadBuffer - binary representation of the data.\n */\nexport function convertToCompactSnapshot(snapshotContents: ISnapshotContents): ReadBuffer {\n const builder = new TreeBuilderSerializer();\n // Create the root node.\n const rootNode = builder.addNode();\n assert(snapshotContents.sequenceNumber !== undefined, 0x21c /* \"Seq number should be provided\" */);\n const ops = snapshotContents.ops;\n const latestSequenceNumber = ops.length > 0 ? ops[ops.length - 1].sequenceNumber : snapshotContents.sequenceNumber;\n writeSnapshotProps(rootNode, latestSequenceNumber);\n\n writeSnapshotSection(\n rootNode,\n snapshotContents.snapshotTree,\n snapshotContents.sequenceNumber,\n );\n\n // Add Blobs\n writeBlobsSection(rootNode, snapshotContents.blobs);\n\n // Then write the ops node.\n writeOpsSection(rootNode, ops);\n\n return builder.serialize();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compactSnapshotWriter.js","sourceRoot":"","sources":["../src/compactSnapshotWriter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsE;AAEtE,mEAAiE;AAGjE,yDAA2D;AAC3D,iFAAiH;AAEjH;;;;EAIE;AACF,SAAS,kBAAkB,CAAC,IAAc,EAAE,oBAA4B;IACpE,IAAA,gDAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,8CAAsB,CAAC,CAAC;IACvD,IAAA,gDAAiB,EAAC,IAAI,EAAE,IAAI,EAAE,8CAAsB,CAAC,CAAC;IACtD,IAAA,gDAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;AACzD,CAAC;AAED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AAoB,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC,cAAc,CAAC;IACnH,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAEnD,oBAAoB,CAChB,QAAQ,EACR,gBAAgB,CAAC,YAAY,EAC7B,gBAAgB,CAAC,cAAc,CAClC,CAAC;IAEF,YAAY;IACZ,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEpD,2BAA2B;IAC3B,eAAe,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAE/B,OAAO,OAAO,CAAC,SAAS,EAAE,CAAC;AAC/B,CAAC;AAtBD,4DAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, stringToBuffer } from \"@fluidframework/common-utils\";\nimport { IBlob, ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { snapshotMinReadVersion } from \"./compactSnapshotParser\";\nimport { ISnapshotContents } from \"./odspUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport { TreeBuilderSerializer } from \"./WriteBufferUtils\";\nimport { addBoolProperty, addNumberProperty, addStringProperty, NodeCore } from \"./zipItDataRepresentationUtils\";\n\n/**\n * Writes header section of the snapshot.\n * @param node - snapshot node to serialize to\n * @param latestSequenceNumber - latest seq number of the container.\n*/\nfunction writeSnapshotProps(node: NodeCore, latestSequenceNumber: number) {\n addStringProperty(node, \"mrv\", snapshotMinReadVersion);\n addStringProperty(node, \"cv\", snapshotMinReadVersion);\n addNumberProperty(node, \"lsn\", latestSequenceNumber);\n}\n\n/**\n * Represents blobs in the tree.\n * @param snapshotNode - node to serialize to.\n * @param blobs - blobs that is being serialized\n*/\nfunction writeBlobsSection(snapshotNode: NodeCore, blobs: Map<string, IBlob | ArrayBuffer>) {\n snapshotNode.addString(\"blobs\", true);\n const blobsNode = snapshotNode.addNode(\"list\");\n for (const [storageBlobId, blob] of blobs) {\n const blobNode = blobsNode.addNode();\n addStringProperty(blobNode, \"id\", storageBlobId, true);\n blobNode.addString(\"data\", true);\n if (blob instanceof ArrayBuffer) {\n blobNode.addBlob(new Uint8Array(blob), false);\n } else {\n blobNode.addBlob(new Uint8Array(stringToBuffer(blob.contents, blob.encoding ?? \"utf-8\")), false);\n }\n }\n}\n\n/**\n * Represents and serializes tree part of the snapshot\n * @param snapshotNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n*/\nfunction writeTreeSection(snapshotNode: NodeCore, snapshotTree: ISnapshotTree) {\n snapshotNode.addString(\"treeNodes\", true);\n const treesNode = snapshotNode.addNode(\"list\");\n writeTreeSectionCore(treesNode, snapshotTree);\n}\n\nfunction writeTreeSectionCore(treesNode: NodeCore, snapshotTree: ISnapshotTree) {\n for (const [path, value] of Object.entries(snapshotTree.trees)) {\n const treeNode = treesNode.addNode();\n addStringProperty(treeNode, \"name\", path);\n if (snapshotTree.unreferenced) {\n addBoolProperty(treeNode, \"unreferenced\", snapshotTree.unreferenced);\n }\n treeNode.addString(\"children\", true);\n const childNode = treeNode.addNode(\"list\");\n writeTreeSectionCore(childNode, value);\n }\n\n if (snapshotTree.blobs) {\n for (const [path, id] of Object.entries(snapshotTree.blobs)) {\n const blobNode = treesNode.addNode();\n addStringProperty(blobNode, \"name\", path);\n addStringProperty(blobNode, \"value\", id, true);\n }\n }\n}\n\n/**\n * Represents (serializes) snapshot tree as generalizes tree\n * @param rootNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n * @param blobs - blobs mapping of the snapshot\n * @param snapshotSequenceNumber - seq number at which snapshot is taken\n*/\nfunction writeSnapshotSection(\n rootNode: NodeCore,\n snapshotTree: ISnapshotTree,\n snapshotSequenceNumber: number,\n) {\n rootNode.addString(\"snapshot\", true);\n const snapshotNode = rootNode.addNode();\n\n const snapshotId = snapshotTree.id;\n assert(snapshotId !== undefined, 0x21b /* \"Snapshot id should be provided\" */);\n addStringProperty(snapshotNode, \"id\", snapshotId);\n addStringProperty(snapshotNode, \"message\", `Snapshot@${snapshotSequenceNumber}`);\n addNumberProperty(snapshotNode, \"sequenceNumber\", snapshotSequenceNumber);\n\n // Add Trees\n writeTreeSection(snapshotNode, snapshotTree);\n}\n\n/**\n * Represents ops in the tree.\n * @param rootNode - node to serialize to.\n * @param ops - ops that is being serialized\n*/\nfunction writeOpsSection(rootNode: NodeCore, ops: ISequencedDocumentMessage[]) {\n let firstSequenceNumber: number | undefined;\n if (ops.length > 0) {\n firstSequenceNumber = ops[0].sequenceNumber;\n }\n if (firstSequenceNumber !== undefined) {\n rootNode.addString(\"deltas\", true);\n const opsNode = rootNode.addNode();\n addNumberProperty(opsNode, \"firstSequenceNumber\", firstSequenceNumber);\n opsNode.addString(\"deltas\", true);\n const deltaNode = opsNode.addNode(\"list\");\n ops.forEach((op) => {\n deltaNode.addString(JSON.stringify(op), false);\n });\n }\n}\n\n/**\n * Converts trees/blobs/ops to binary compact representation.\n * @param snapshotContents - snapshot tree contents to serialize\n * @returns - ReadBuffer - binary representation of the data.\n */\nexport function convertToCompactSnapshot(snapshotContents: ISnapshotContents): ReadBuffer {\n const builder = new TreeBuilderSerializer();\n // Create the root node.\n const rootNode = builder.addNode();\n assert(snapshotContents.sequenceNumber !== undefined, 0x21c /* \"Seq number should be provided\" */);\n const ops = snapshotContents.ops;\n const latestSequenceNumber = ops.length > 0 ? ops[ops.length - 1].sequenceNumber : snapshotContents.sequenceNumber;\n writeSnapshotProps(rootNode, latestSequenceNumber);\n\n writeSnapshotSection(\n rootNode,\n snapshotContents.snapshotTree,\n snapshotContents.sequenceNumber,\n );\n\n // Add Blobs\n writeBlobsSection(rootNode, snapshotContents.blobs);\n\n // Then write the ops node.\n writeOpsSection(rootNode, ops);\n\n return builder.serialize();\n}\n"]}
|
package/dist/contracts.d.ts
CHANGED
package/dist/contracts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IAEpC,EAAE,EAAE,MAAM,CAAC;IAIX,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IAEjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,GAAG,CAAC,yBAAyB,EAAE,GAAG,wBAAwB,EAAE,CAAC;CACvE;AAED,MAAM,WAAW,wBAAwB;IACrC,EAAE,EAAE,GAAG,CAAC,yBAAyB,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mCAAmC;IAChD,KAAK,EAAE,uBAAuB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,uBAAuB;IACpC,
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","s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CAC9C;AAED,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC3D,cAAc,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/contracts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoNU,QAAA,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { HostStoragePolicy } from \"@fluidframework/odsp-driver-definitions\";\nimport { ISnapshotContents } from \"./odspUtils\";\n\n/**\n * Socket storage discovery api response\n */\nexport interface ISocketStorageDiscovery {\n // The id of the web socket\n id: string;\n\n // SPO gives us runtimeTenantId, we remap it to tenantId\n // See getSocketStorageDiscovery\n runtimeTenantId?: string;\n tenantId: string;\n\n snapshotStorageUrl: string;\n deltaStorageUrl: string;\n\n /**\n * PUSH URL\n */\n deltaStreamSocketUrl: string;\n\n /**\n * The access token for PushChannel. Optionally returned, depending on implementation.\n * OneDrive for Consumer implementation returns it and OneDrive for Business implementation\n * does not return it and instead expects token to be returned via `getWebsocketToken` callback\n * passed as a parameter to `OdspDocumentService.create()` factory.\n */\n socketToken?: string;\n\n /**\n * This is the time within which client has to refresh the session on (ODSP) relay service.\n */\n refreshSessionDurationSeconds?: number;\n}\n\n/**\n * Interface for error responses for the WebSocket connection\n */\nexport interface IOdspSocketError {\n /**\n * An error code number for the error that occurred\n * It will be a valid HTTP status code\n */\n code: number;\n\n /**\n * A message about the error that occurred for debugging / logging purposes\n * This should not be displayed to the user directly\n */\n message: string;\n\n /**\n * Optional Retry-After time in seconds\n * The client should wait this many seconds before retrying its request\n */\n retryAfter?: number;\n}\n\n/**\n * Interface for delta storage response.\n * Contains either SequencedDocumentMessages or SequencedDeltaOpMessage.\n */\nexport interface IDeltaStorageGetResponse {\n value: api.ISequencedDocumentMessage[] | ISequencedDeltaOpMessage[];\n}\n\nexport interface ISequencedDeltaOpMessage {\n op: api.ISequencedDocumentMessage;\n sequenceNumber: number;\n}\n\nexport interface IDocumentStorageGetVersionsResponse {\n value: IDocumentStorageVersion[];\n}\n\nexport interface IDocumentStorageVersion {\n id: string;\n}\n\n/**\n *\n * Data structures that form ODSP Summary\n *\n */\n\nexport interface IOdspSummaryPayload {\n type: \"container\" | \"channel\";\n message: string;\n sequenceNumber: number;\n entries: OdspSummaryTreeEntry[];\n}\n\nexport interface IWriteSummaryResponse {\n id: string;\n}\n\nexport type OdspSummaryTreeEntry = IOdspSummaryTreeValueEntry | IOdspSummaryTreeHandleEntry;\n\nexport interface IOdspSummaryTreeBaseEntry {\n path: string;\n type: \"blob\" | \"tree\" | \"commit\";\n}\n\nexport interface IOdspSummaryTreeValueEntry extends IOdspSummaryTreeBaseEntry {\n value: OdspSummaryTreeValue;\n // Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.\n unreferenced?: true;\n}\n\nexport interface IOdspSummaryTreeHandleEntry extends IOdspSummaryTreeBaseEntry {\n id: string;\n}\n\nexport type OdspSummaryTreeValue = IOdspSummaryTree | IOdspSummaryBlob;\n\nexport interface IOdspSummaryTree {\n type: \"tree\";\n entries?: OdspSummaryTreeEntry[];\n}\n\nexport interface IOdspSummaryBlob {\n type: \"blob\";\n content: string;\n encoding: \"base64\" | \"utf-8\";\n}\n\n/**\n *\n * Data structures that form ODSP Snapshot\n *\n */\n\nexport interface IOdspSnapshotTreeEntryTree {\n path: string;\n type: \"tree\";\n // Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.\n unreferenced?: true;\n}\n\nexport interface IOdspSnapshotTreeEntryCommit {\n id: string;\n path: string;\n type: \"commit\";\n}\n\nexport interface IOdspSnapshotTreeEntryBlob {\n id: string;\n path: string;\n type: \"blob\";\n}\n\nexport type IOdspSnapshotTreeEntry =\n | IOdspSnapshotTreeEntryTree\n | IOdspSnapshotTreeEntryCommit\n | IOdspSnapshotTreeEntryBlob;\n\nexport interface IOdspSnapshotCommit {\n entries: IOdspSnapshotTreeEntry[];\n id: string;\n sequenceNumber: number;\n}\n\n/**\n * Blob content, represents blobs in downloaded snapshot.\n */\nexport interface IOdspSnapshotBlob {\n content: string;\n // SPO only uses \"base64\" today for download.\n // We are adding undefined too, as temp way to roundtrip strings unchanged.\n encoding: \"base64\" | undefined;\n id: string;\n size: number;\n}\n\nexport interface IOdspSnapshot {\n id: string;\n trees: IOdspSnapshotCommit[];\n blobs?: IOdspSnapshotBlob[];\n ops?: ISequencedDeltaOpMessage[];\n}\n\n/**\n * Same as HostStoragePolicy, but adds options that are internal to runtime.\n * All fields should be optional.\n */\nexport interface HostStoragePolicyInternal extends HostStoragePolicy {\n summarizerClient?: boolean;\n}\n\nexport interface ICreateFileResponse {\n \"@odata.context\": string;\n driveId: string;\n id: string;\n itemId: string;\n itemUrl: string;\n sequenceNumber: number;\n sharingLink?: string;\n sharingLinkErrorReason?: string;\n}\n\nexport interface IVersionedValueWithEpoch {\n value: any;\n fluidEpoch: string;\n // This is same as \"persistedCacheValueVersion\" below. This represents the version of data stored in cache.\n version: 3;\n}\n\nexport const persistedCacheValueVersion = 3;\n\nexport interface IGetOpsResponse {\n nonce: string;\n code: number;\n /** Time in seconds. Currently never set by PUSH */\n retryAfter?: number;\n messages?: api.ISequencedDocumentMessage[];\n}\n\nexport interface IFlushOpsResponse {\n nonce: string;\n code: number;\n /** Time in seconds */\n retryAfter?: number;\n lastPersistedSequenceNumber?: number;\n}\n\n/**\n * Represents the cached snapshot value.\n */\nexport interface ISnapshotCachedEntry extends ISnapshotContents {\n cacheEntryTime: number;\n}\n"]}
|