@fluidframework/odsp-driver 2.3.0-288113 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/ReadBufferUtils.d.ts.map +1 -1
- package/dist/ReadBufferUtils.js +0 -1
- package/dist/ReadBufferUtils.js.map +1 -1
- package/dist/WriteBufferUtils.d.ts.map +1 -1
- package/dist/WriteBufferUtils.js +0 -2
- package/dist/WriteBufferUtils.js.map +1 -1
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +2 -18
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +1 -3
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createFile.js +10 -2
- package/dist/createFile.js.map +1 -1
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +0 -2
- package/dist/createNewUtils.js.map +1 -1
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +1 -2
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts +2 -2
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js +54 -28
- package/dist/getFileLink.js.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js +0 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +0 -2
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/odspDeltaStorageService.js +1 -4
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +1 -6
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +0 -2
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +1 -2
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js +1 -5
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/odspSummaryUploadManager.js +0 -1
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/odspUrlHelper.js +1 -5
- package/dist/odspUrlHelper.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js +0 -9
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/ReadBufferUtils.d.ts.map +1 -1
- package/lib/ReadBufferUtils.js +0 -1
- package/lib/ReadBufferUtils.js.map +1 -1
- package/lib/WriteBufferUtils.d.ts.map +1 -1
- package/lib/WriteBufferUtils.js +0 -2
- package/lib/WriteBufferUtils.js.map +1 -1
- package/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js +2 -18
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/compactSnapshotWriter.d.ts.map +1 -1
- package/lib/compactSnapshotWriter.js +1 -3
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/createFile.d.ts.map +1 -1
- package/lib/createFile.js +10 -2
- package/lib/createFile.js.map +1 -1
- package/lib/createNewUtils.d.ts.map +1 -1
- package/lib/createNewUtils.js +0 -2
- package/lib/createNewUtils.js.map +1 -1
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js +1 -2
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/getFileLink.d.ts +2 -2
- package/lib/getFileLink.d.ts.map +1 -1
- package/lib/getFileLink.js +48 -22
- package/lib/getFileLink.js.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js +0 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.js +0 -2
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
- package/lib/odspDeltaStorageService.d.ts.map +1 -1
- package/lib/odspDeltaStorageService.js +1 -4
- package/lib/odspDeltaStorageService.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +1 -6
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.js +0 -2
- package/lib/odspDocumentStorageServiceBase.js.map +1 -1
- package/lib/odspDriverUrlResolver.d.ts.map +1 -1
- package/lib/odspDriverUrlResolver.js +1 -2
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspSnapshotParser.d.ts.map +1 -1
- package/lib/odspSnapshotParser.js +1 -5
- package/lib/odspSnapshotParser.js.map +1 -1
- package/lib/odspSummaryUploadManager.d.ts.map +1 -1
- package/lib/odspSummaryUploadManager.js +0 -1
- package/lib/odspSummaryUploadManager.js.map +1 -1
- package/lib/odspUrlHelper.d.ts.map +1 -1
- package/lib/odspUrlHelper.js +1 -5
- package/lib/odspUrlHelper.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/zipItDataRepresentationUtils.js +0 -9
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +17 -16
- package/src/ReadBufferUtils.ts +1 -2
- package/src/WriteBufferUtils.ts +2 -4
- package/src/compactSnapshotParser.ts +14 -28
- package/src/compactSnapshotWriter.ts +2 -4
- package/src/createFile.ts +11 -2
- package/src/createNewUtils.ts +2 -4
- package/src/fetchSnapshot.ts +1 -2
- package/src/getFileLink.ts +54 -22
- package/src/localOdspDriver/localOdspDeltaStorageService.ts +1 -2
- package/src/odspDelayLoadedDeltaStream.ts +2 -4
- package/src/odspDeltaStorageService.ts +2 -4
- package/src/odspDocumentDeltaConnection.ts +3 -8
- package/src/odspDocumentStorageServiceBase.ts +2 -4
- package/src/odspDriverUrlResolver.ts +1 -2
- package/src/odspSnapshotParser.ts +4 -8
- package/src/odspSummaryUploadManager.ts +1 -2
- package/src/odspUrlHelper.ts +4 -8
- package/src/packageVersion.ts +1 -1
- package/src/zipItDataRepresentationUtils.ts +9 -18
- package/tsconfig.json +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zipItDataRepresentationUtils.js","sourceRoot":"","sources":["../src/zipItDataRepresentationUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAIlF,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAA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CACnC,IAAe,EACf,OAAe;IAEf,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;IACR,CAAC;IACD,yBAAyB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAe,EAAE,OAAe;IAClE,IAAI,OAAO,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO;IACR,CAAC;IACD,yBAAyB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,yBAAyB,CACjC,IAAe,EACf,gBAA0B,EAC1B,OAAe;IAEf,MAAM,IAAI,iBAAiB,CAC1B,6BAA6B,OAAO,EAAE,EACtC,cAAc,CAAC,uBAAuB,EACtC;QACC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC;QAC3B,gBAAgB;QAChB,aAAa;KACb,CACD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,QAAQ,CAAC;IACjB,CAAC;SAAM,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QACtC,OAAO,UAAU,CAAC;IACnB,CAAC;SAAM,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QACtC,OAAO,UAAU,CAAC;IACnB,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QACvC,OAAO,SAAS,CAAC;IAClB,CAAC;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QACjC,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,OAAO,aAAa,CAAC;AACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Data representation which is followed(zipIt Protocol) here is described in this document:\n * https://microsoft.sharepoint-df.com/:w:/t/ODSPFileStore/ER06b64K_XdDjEyAKl-UT60BJiId39SCVkYSyo_2pvH9gQ?e=KYQ0c5\n */\n\nimport { Uint8ArrayToArrayBuffer, Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils/internal\";\nimport { OdspErrorTypes } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ReadBuffer } from \"./ReadBufferUtils.js\";\nimport { measure } from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n/**\n * Control codes used by tree serialization / decentralization code. Same as on server. These can be found on\n * filestore code on server too at above link.\n */\nexport enum MarkerCodes {\n\tBoolTrue = 11, // value = true\n\tBoolFalse = 12, // value = false\n\n\tStringEmpty = 13, // value = \"\"\n\tString8Length = 14, // unsigned-8-bit little-endian length, follows by UTF-8 bytes of length\n\tString16Length = 15, // unsigned-16-bit little-endian length, follows by UTF-8 bytes of length\n\tString32Length = 16, // unsigned-32-bit little-endian length, follows by UTF-8 bytes of length\n\n\tConstString8Id = 17, // unsigned-8-bit little-endian const string id follows\n\tConstString16Id = 18, // unsigned-16-bit little-endian const string id follows\n\tConstString32Id = 19, // unsigned-32-bit little-endian const string id follows\n\tConstStringDeclare = 20, // Code for declaring a const string with size <= 1 byte\n\tConstStringDeclareBig = 21, // Code for declaring a const string with size > 1 byte. It is represented in 4 bytes.\n\n\tInt0 = 1, // value = 0\n\tUInt8 = 3, // unsigned-8-bit little-endian follows\n\tUInt16 = 5, // unsigned-16-bit little-endian follows\n\tUInt32 = 7, // unsigned-32-bit little-endian follows\n\tUInt64 = 9, // unsigned-64-bit little-endian follows\n\tInt8 = 2, // signed-8-bit little-endian follows\n\tInt16 = 4, // signed-16-bit little-endian follows\n\tInt32 = 6, // signed-32-bit little-endian follows\n\tInt64 = 8, // signed-64-bit little-endian follows\n\n\tBinaryEmpty = 32, // value = byte[]\n\tBinarySingle8 = 33, // unsigned-8-bit little-endian length, follows by bytes of length\n\tBinarySingle16 = 34, // unsigned-16-bit little-endian length, follows by bytes of length\n\tBinarySingle32 = 35, // unsigned-32-bit little-endian length, follows by bytes of length\n\tBinarySingle64 = 36, // unsigned-64-bit little-endian length, follows by bytes of length\n}\n\n/**\n * Control codes used by tree serialization / decentralization code. They mark the start of sections.\n */\nexport enum MarkerCodesStart {\n\t\"list\" = 49,\n\t\"set\" = 51,\n}\n\n/**\n * Control codes used by tree serialization / decentralization code. They mark the end of sections.\n */\nexport enum MarkerCodesEnd {\n\t\"list\" = 50,\n\t\"set\" = 52,\n}\n\n/**\n * This contains mapping of Marker Codes to number of bytes in which the corresponding data\n * will be stored.\n */\nexport const codeToBytesMap = {\n\t// Integer code to bytes\n\t1: 0,\n\t2: 1,\n\t3: 1,\n\t4: 2,\n\t5: 2,\n\t6: 4,\n\t7: 4,\n\t8: 8,\n\t9: 8,\n\n\t// String code to Bytes\n\t13: 0,\n\t14: 1,\n\t15: 2,\n\t16: 4,\n\n\t17: 1,\n\t18: 2,\n\t19: 4,\n\n\t20: 1,\n\t21: 4,\n\n\t// Binary code to bytes\n\t32: 0,\n\t33: 1,\n\t34: 2,\n\t35: 4,\n\t36: 8,\n};\n\nexport function getValueSafely(map: { [index: number]: number }, key: number): number {\n\tconst val = map[key];\n\tassert(val !== undefined, 0x287 /* key must exist in the map */);\n\treturn val;\n}\n\nexport function getNodeProps(node: NodeCore): Record<string, NodeTypes> {\n\tconst res: Record<string, NodeTypes> = {};\n\tfor (const [keyNode, valueNode] of node.iteratePairs()) {\n\t\tconst id = getStringInstance(keyNode, \"keynode should be a string\");\n\t\tres[id] = valueNode;\n\t}\n\treturn res;\n}\n\nexport function iteratePairs<T>(it: IterableIterator<T>): IterableIterator<[T, T]> {\n\tconst res: IterableIterator<[T, T]> = {\n\t\tnext: () => {\n\t\t\tconst a = it.next();\n\t\t\tif (a.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\tconst b = it.next();\n\t\t\tassert(b.done !== true, 0x22b /* \"Should be a pair\" */);\n\t\t\treturn { value: [a.value, b.value], done: b.done };\n\t\t},\n\t\t[Symbol.iterator]: () => {\n\t\t\treturn res;\n\t\t},\n\t};\n\treturn res;\n}\n\n/**\n * Helper function that returns iterator from an object\n * @param obj - object that supports iteration\n */\nexport function iterate<T>(obj: {\n\t[Symbol.iterator]: () => IterableIterator<T>;\n}): IterableIterator<T> {\n\treturn obj[Symbol.iterator]();\n}\n\n/**\n * Base class to represent binary blob element.\n * Binary blob is one of three types supported as a leaf node of a tree.\n * Note: concrete implementations (derived classes) are not exposed from this module\n */\nexport abstract class BlobCore {\n\tpublic abstract get buffer(): Uint8Array;\n\tpublic abstract get arrayBuffer(): ArrayBufferLike;\n\n\t/**\n\t * Represents a blob.\n\t */\n\tconstructor() {}\n}\n\n/**\n * \"deep copy\" blob, holds to binary data passed in\n * It is called deep copy as a counter-part to BlobShallowCopy, which\n * is a reference to underlying binary stream (ReadBuffer).\n */\nclass BlobDeepCopy extends BlobCore {\n\t/**\n\t * Represents a deep copy of the blob.\n\t * @param data - Data array of the blob\n\t */\n\tconstructor(protected readonly data: Uint8Array) {\n\t\tsuper();\n\t}\n\n\tpublic get buffer(): Uint8Array {\n\t\treturn this.data;\n\t}\n\n\tpublic get arrayBuffer(): ArrayBufferLike {\n\t\treturn Uint8ArrayToArrayBuffer(this.buffer);\n\t}\n\n\tpublic static read(buffer: ReadBuffer, lengthLen: number): BlobCore {\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst data = new Uint8Array(length);\n\t\tfor (let counter = 0; counter < length; counter++) {\n\t\t\tdata[counter] = buffer.read();\n\t\t}\n\t\treturn new BlobDeepCopy(data);\n\t}\n}\n\n/**\n * Shallow copy blob, keeps a reference to portion of ReadBuffer\n * it was constructed from. It takes much less memory compared to BlobDeepCopy\n */\nexport class BlobShallowCopy extends BlobCore {\n\t/**\n\t * Represents a shallow copy of the blob. It is not a separate blob, just reference to original blobs.\n\t * @param data - Data array of the blob\n\t * @param start - Start point of the blob in the buffer.\n\t * @param end - End point of the blob in the buffer.\n\t */\n\tconstructor(\n\t\tprotected data: Uint8Array,\n\t\tprotected start: number,\n\t\tprotected end: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic get buffer(): Uint8Array {\n\t\treturn this.data.subarray(this.start, this.end);\n\t}\n\n\t// Equivalent to Uint8ArrayToArrayBuffer(this.buffer)\n\tpublic get arrayBuffer(): ArrayBufferLike {\n\t\tconst offset = this.data.byteOffset;\n\t\treturn this.data.buffer.slice(this.start + offset, this.end + offset);\n\t}\n\n\tpublic static read(buffer: ReadBuffer, lengthLen: number): BlobCore {\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst pos = buffer.pos;\n\t\tbuffer.skip(length);\n\t\treturn new BlobShallowCopy(buffer.buffer, pos, pos + length);\n\t}\n}\n\nexport const addStringProperty = (node: NodeCore, a: string, b: string): void => {\n\tnode.addDictionaryString(a);\n\tnode.addString(b);\n};\nexport const addDictionaryStringProperty = (node: NodeCore, a: string, b: string): void => {\n\tnode.addDictionaryString(a);\n\tnode.addString(b);\n};\nexport const addNumberProperty = (node: NodeCore, a: string, b: number): void => {\n\tnode.addDictionaryString(a);\n\tnode.addNumber(b);\n};\nexport const addBoolProperty = (node: NodeCore, a: string, b: boolean): void => {\n\tnode.addDictionaryString(a);\n\tnode.addBool(b);\n};\n\nexport interface IStringElement {\n\tcontent: string;\n\tdictionary: boolean;\n\t_stringElement: true;\n}\n\nexport interface IStringElementInternal extends Omit<IStringElement, \"content\"> {\n\tcontent?: string;\n\tstartPos: number;\n\tendPos: number;\n}\n\n/**\n * Three leaf types supported by tree:\n * 1. Node (sub-tree)\n * 2. binary blob\n * 3. integer\n * 4. boolean\n */\nexport type NodeTypes = NodeCore | BlobCore | number | boolean | IStringElement;\n\nexport type NodeCoreTypes = \"list\" | \"set\";\n\n/**\n * Node - node in the tree (non-leaf element of the tree)\n */\nexport class NodeCore {\n\t// It is an array of nodes.\n\tprivate readonly children: NodeTypes[] = [];\n\tpublic get nodes(): NodeTypes[] {\n\t\treturn this.children;\n\t}\n\n\tconstructor(public type: NodeCoreTypes = \"set\") {}\n\n\tpublic [Symbol.iterator](): IterableIterator<NodeTypes> {\n\t\treturn this.children[Symbol.iterator]();\n\t}\n\n\tpublic iteratePairs(): IterableIterator<[NodeTypes, NodeTypes]> {\n\t\tassert(this.length % 2 === 0, 0x22c /* \"reading pairs\" */);\n\t\treturn iteratePairs(iterate(this));\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.children.length;\n\t}\n\n\tpublic get(index: number): NodeTypes {\n\t\t// TODO Why are we non null asserting here?\n\t\treturn this.children[index]!;\n\t}\n\n\tpublic getString(index: number): string {\n\t\t// TODO Why are we non null asserting here?\n\t\tconst node = this.children[index]!;\n\t\treturn getStringInstance(node, \"getString should return string\");\n\t}\n\n\tpublic getMaybeString(index: number): string | undefined {\n\t\t// TODO Why are we non null asserting here?\n\t\tconst node = this.children[index]!;\n\t\treturn getMaybeStringInstance(node);\n\t}\n\n\tpublic getBlob(index: number): BlobCore {\n\t\t// TODO Why are we non null asserting here?\n\t\tconst node = this.children[index]!;\n\t\tassertBlobCoreInstance(node, \"getBlob should return a blob\");\n\t\treturn node;\n\t}\n\n\tpublic getNode(index: number): NodeCore {\n\t\t// TODO Why are we non null asserting here?\n\t\tconst node = this.children[index]!;\n\t\tassertNodeCoreInstance(node, \"getNode should return a node\");\n\t\treturn node;\n\t}\n\n\tpublic getNumber(index: number): number {\n\t\t// TODO Why are we non null asserting here?\n\t\tconst node = this.children[index]!;\n\t\tassertNumberInstance(node, \"getNumber should return a number\");\n\t\treturn node;\n\t}\n\n\tpublic getBool(index: number): boolean {\n\t\t// TODO Why are we non null asserting here?\n\t\tconst node = this.children[index]!;\n\t\tassertBoolInstance(node, \"getBool should return a boolean\");\n\t\treturn node;\n\t}\n\n\tpublic addNode(type?: NodeCoreTypes): NodeCore {\n\t\tconst node = new NodeCore(type);\n\t\tthis.children.push(node);\n\t\treturn node;\n\t}\n\n\tpublic addBlob(blob: Uint8Array): void {\n\t\tthis.children.push(new BlobDeepCopy(blob));\n\t}\n\n\tpublic addDictionaryString(payload: string): void {\n\t\tthis.children.push({\n\t\t\tcontent: payload,\n\t\t\tdictionary: true,\n\t\t\t_stringElement: true,\n\t\t});\n\t}\n\n\tpublic addString(payload: string): void {\n\t\tthis.children.push({\n\t\t\tcontent: payload,\n\t\t\tdictionary: false,\n\t\t\t_stringElement: true,\n\t\t});\n\t}\n\n\tpublic addNumber(payload: number | undefined): void {\n\t\tassert(Number.isInteger(payload), 0x231 /* \"Number should be an integer\" */);\n\t\tassert(\n\t\t\tpayload !== undefined && payload >= 0,\n\t\t\t0x232 /* \"Payload should not be negative\" */,\n\t\t);\n\t\tthis.children.push(payload);\n\t}\n\n\tpublic addBool(payload: boolean): void {\n\t\tthis.children.push(payload);\n\t}\n\n\t// Can we do more efficiently here, without extra objects somehow??\n\tprivate static readString(\n\t\tbuffer: ReadBuffer,\n\t\tcode: number,\n\t\tdictionary: boolean,\n\t): IStringElementInternal & IStringElement {\n\t\tconst lengthLen = getValueSafely(codeToBytesMap, code);\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst startPos = buffer.pos;\n\t\tbuffer.skip(length);\n\t\tconst result: IStringElementInternal = {\n\t\t\t// Note: Setting here property 'content: undefined' makes code substantially slower!\n\t\t\tdictionary,\n\t\t\t_stringElement: true,\n\t\t\tstartPos,\n\t\t\tendPos: buffer.pos,\n\t\t};\n\n\t\t// We are lying here in terms of presence of `content` property.\n\t\t// This will be addressed at the bottom of NodeCore.load() by resolving all strings at once!\n\t\t// It's equivalent (but much slower!) to do it here via\n\t\t// result.content = Uint8ArrayToString(buffer.buffer.subarray(startPos, buffer.pos), \"utf-8\");\n\t\treturn result as IStringElementInternal & IStringElement;\n\t}\n\n\t/**\n\t * Load and parse the buffer into a tree.\n\t * @param buffer - buffer to read from.\n\t */\n\tprotected load(\n\t\tbuffer: ReadBuffer,\n\t\tlogger: ITelemetryLoggerExt,\n\t): {\n\t\tdurationStructure: number;\n\t\tdurationStrings: number;\n\t} {\n\t\tconst [stringsToResolve, durationStructure] = measure(() =>\n\t\t\tthis.loadStructure(buffer, logger),\n\t\t);\n\t\tconst [, durationStrings] = measure(() =>\n\t\t\tthis.loadStrings(buffer, stringsToResolve, logger),\n\t\t);\n\t\treturn { durationStructure, durationStrings };\n\t}\n\n\t/**\n\t * Load and parse the buffer into a tree.\n\t * @param buffer - buffer to read from.\n\t */\n\tprotected loadStructure(\n\t\tbuffer: ReadBuffer,\n\t\tlogger: ITelemetryLoggerExt,\n\t): IStringElementInternal[] {\n\t\tconst stack: NodeTypes[][] = [];\n\t\tconst stringsToResolve: IStringElementInternal[] = [];\n\t\tconst dictionary: IStringElement[] = [];\n\n\t\tlet children = this.children;\n\t\tfor (; !buffer.eof; ) {\n\t\t\tconst code = buffer.read();\n\t\t\tswitch (code) {\n\t\t\t\tcase MarkerCodesStart.list:\n\t\t\t\tcase MarkerCodesStart.set: {\n\t\t\t\t\tconst childValue = new NodeCore(code === MarkerCodesStart.set ? \"set\" : \"list\");\n\t\t\t\t\tchildren.push(childValue);\n\t\t\t\t\tstack.push(children);\n\t\t\t\t\tchildren = childValue.children;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.ConstStringDeclare:\n\t\t\t\tcase MarkerCodes.ConstStringDeclareBig: {\n\t\t\t\t\tconst stringId = buffer.read(getValueSafely(codeToBytesMap, code));\n\t\t\t\t\tconst constString = NodeCore.readString(buffer, code, true /* dictionary */);\n\t\t\t\t\tstringsToResolve.push(constString);\n\t\t\t\t\tdictionary[stringId] = constString;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.ConstString8Id:\n\t\t\t\tcase MarkerCodes.ConstString16Id:\n\t\t\t\tcase MarkerCodes.ConstString32Id: {\n\t\t\t\t\tconst stringId = buffer.read(getValueSafely(codeToBytesMap, code));\n\t\t\t\t\tconst content = dictionary[stringId];\n\t\t\t\t\tassert(content !== undefined, 0x3de /* const string not found */);\n\t\t\t\t\tchildren.push(content);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.StringEmpty:\n\t\t\t\tcase MarkerCodes.String8Length:\n\t\t\t\tcase MarkerCodes.String16Length:\n\t\t\t\tcase MarkerCodes.String32Length: {\n\t\t\t\t\tconst str = NodeCore.readString(buffer, code, false /* dictionary */);\n\t\t\t\t\tstringsToResolve.push(str);\n\t\t\t\t\tchildren.push(str);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BinaryEmpty:\n\t\t\t\tcase MarkerCodes.BinarySingle8:\n\t\t\t\tcase MarkerCodes.BinarySingle16:\n\t\t\t\tcase MarkerCodes.BinarySingle32:\n\t\t\t\tcase MarkerCodes.BinarySingle64: {\n\t\t\t\t\tchildren.push(BlobShallowCopy.read(buffer, getValueSafely(codeToBytesMap, code)));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// If integer is 0.\n\t\t\t\tcase MarkerCodes.Int0: {\n\t\t\t\t\tchildren.push(0);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.UInt8:\n\t\t\t\tcase MarkerCodes.UInt16:\n\t\t\t\tcase MarkerCodes.UInt32:\n\t\t\t\tcase MarkerCodes.UInt64:\n\t\t\t\tcase MarkerCodes.Int8:\n\t\t\t\tcase MarkerCodes.Int16:\n\t\t\t\tcase MarkerCodes.Int32:\n\t\t\t\tcase MarkerCodes.Int64: {\n\t\t\t\t\tchildren.push(buffer.read(getValueSafely(codeToBytesMap, code)));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BoolTrue: {\n\t\t\t\t\tchildren.push(true);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BoolFalse: {\n\t\t\t\t\tchildren.push(false);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodesEnd.list:\n\t\t\t\tcase MarkerCodesEnd.set: {\n\t\t\t\t\t// Note: We are not checking that end marker matches start marker.\n\t\t\t\t\t// I.e. that we do not have a case where we start a 'list' but end with a 'set'\n\t\t\t\t\t// Checking it would require more state tracking that seems not very useful, given\n\t\t\t\t\t// our code does not care.\n\t\t\t\t\tchildren = stack.pop()!;\n\n\t\t\t\t\t// To my surprise, checking children !== undefined adds measurable cost!\n\t\t\t\t\t// We will rely on children.push() crashing in case of mismatch, and check below\n\t\t\t\t\t// (outside of the loop)\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(`Invalid code: ${code}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// This also ensures that stack.length === 0.\n\t\tassert(children === this.children, 0x3e7 /* Unpaired start/end list/set markers! */);\n\n\t\treturn stringsToResolve;\n\t}\n\n\tprivate loadStrings(\n\t\tbuffer: ReadBuffer,\n\t\tstringsToResolve: IStringElementInternal[],\n\t\tlogger: ITelemetryLoggerExt,\n\t): void {\n\t\t/**\n\t\t * Process all the strings at once!\n\t\t */\n\t\tlet length = 0;\n\t\tfor (const el of stringsToResolve) {\n\t\t\tlength += el.endPos - el.startPos + 1;\n\t\t}\n\t\tconst stringBuffer = new Uint8Array(length);\n\n\t\tlength = 0;\n\t\tconst input = buffer.buffer;\n\t\tassert(input.byteOffset === 0, 0x3e8 /* code below assumes no offset */);\n\n\t\tfor (const el of stringsToResolve) {\n\t\t\tfor (let it = el.startPos; it < el.endPos; it++) {\n\t\t\t\t// Non null asserting here because we are iterating over startPos\n\t\t\t\tstringBuffer[length] = input[it]!;\n\t\t\t\tlength++;\n\t\t\t}\n\t\t\tstringBuffer[length] = 0;\n\t\t\tlength++;\n\t\t}\n\t\tassert(length === stringBuffer.length, 0x418 /* properly encoded */);\n\n\t\tconst result = Uint8ArrayToString(stringBuffer, \"utf8\").split(String.fromCodePoint(0));\n\t\tif (result.length === stringsToResolve.length + 1) {\n\t\t\t// All is good, we expect all the cases to get here\n\t\t\tfor (let i = 0; i < stringsToResolve.length; i++) {\n\t\t\t\t// Non null asserting here because we are iterating over stringsToResolve\n\t\t\t\tstringsToResolve[i]!.content = result[i];\n\t\t\t}\n\t\t} else {\n\t\t\t// String content has \\0 chars!\n\t\t\t// Recovery code\n\t\t\tlogger.sendErrorEvent({ eventName: \"StringParsingError\" });\n\t\t\tfor (const el of stringsToResolve) {\n\t\t\t\tassert(\n\t\t\t\t\tel.content === Uint8ArrayToString(input.subarray(el.startPos, el.endPos), \"utf8\"),\n\t\t\t\t\t0x3ea /* test */,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * TreeBuilder - Root of the tree.\n * Provides loading and serialization capabilities.\n */\nexport class TreeBuilder extends NodeCore {\n\tstatic load(\n\t\tbuffer: ReadBuffer,\n\t\tlogger: ITelemetryLoggerExt,\n\t): {\n\t\tbuilder: TreeBuilder;\n\t\ttelemetryProps: {\n\t\t\tdurationStructure: number;\n\t\t\tdurationStrings: number;\n\t\t};\n\t} {\n\t\tconst builder = new TreeBuilder();\n\t\tconst telemetryProps = builder.load(buffer, logger);\n\t\tassert(buffer.eof, 0x233 /* \"Unexpected data at the end of buffer\" */);\n\t\treturn { builder, telemetryProps };\n\t}\n}\n\nexport function getMaybeStringInstance(node: NodeTypes): string | undefined {\n\tconst maybeString = node as IStringElement;\n\tif (maybeString._stringElement) {\n\t\treturn maybeString.content;\n\t}\n}\n\nexport function getStringInstance(node: NodeTypes, message: string): string {\n\tconst maybeString = node as IStringElement;\n\tif (maybeString._stringElement) {\n\t\treturn maybeString.content;\n\t}\n\tthrowBufferParseException(node, \"BlobCore\", message);\n}\n\nexport function assertBlobCoreInstance(\n\tnode: NodeTypes,\n\tmessage: string,\n): asserts node is BlobCore {\n\tif (node instanceof BlobCore) {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"BlobCore\", message);\n}\n\nexport function assertNodeCoreInstance(\n\tnode: NodeTypes,\n\tmessage: string,\n): asserts node is NodeCore {\n\tif (node instanceof NodeCore) {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"NodeCore\", message);\n}\n\nexport function assertNumberInstance(\n\tnode: NodeTypes,\n\tmessage: string,\n): asserts node is number {\n\tif (typeof node === \"number\") {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"Number\", message);\n}\n\nexport function assertBoolInstance(node: NodeTypes, message: string): asserts node is boolean {\n\tif (typeof node === \"boolean\") {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"Boolean\", message);\n}\n\nfunction throwBufferParseException(\n\tnode: NodeTypes,\n\texpectedNodeType: NodeType,\n\tmessage: string,\n): never {\n\tthrow new NonRetryableError(\n\t\t`Buffer parsing exception: ${message}`,\n\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t{\n\t\t\tnodeType: getNodeType(node),\n\t\t\texpectedNodeType,\n\t\t\tdriverVersion,\n\t\t},\n\t);\n}\n\nfunction getNodeType(value: NodeTypes): NodeType {\n\tif (typeof value === \"number\") {\n\t\treturn \"Number\";\n\t} else if (value instanceof BlobCore) {\n\t\treturn \"BlobCore\";\n\t} else if (value instanceof NodeCore) {\n\t\treturn \"NodeCore\";\n\t} else if (typeof value === \"boolean\") {\n\t\treturn \"Boolean\";\n\t} else if (value._stringElement) {\n\t\treturn \"String\";\n\t}\n\treturn \"UnknownType\";\n}\n\ntype NodeType = \"Number\" | \"BlobCore\" | \"NodeCore\" | \"Boolean\" | \"UnknownType\" | \"String\";\n"]}
|
|
1
|
+
{"version":3,"file":"zipItDataRepresentationUtils.js","sourceRoot":"","sources":["../src/zipItDataRepresentationUtils.ts"],"names":[],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;QACjC,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,OAAO,aAAa,CAAC;AACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Data representation which is followed(zipIt Protocol) here is described in this document:\n * https://microsoft.sharepoint-df.com/:w:/t/ODSPFileStore/ER06b64K_XdDjEyAKl-UT60BJiId39SCVkYSyo_2pvH9gQ?e=KYQ0c5\n */\n\nimport { Uint8ArrayToArrayBuffer, Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils/internal\";\nimport { OdspErrorTypes } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ReadBuffer } from \"./ReadBufferUtils.js\";\nimport { measure } from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n/**\n * Control codes used by tree serialization / decentralization code. Same as on server. These can be found on\n * filestore code on server too at above link.\n */\nexport enum MarkerCodes {\n\tBoolTrue = 11, // value = true\n\tBoolFalse = 12, // value = false\n\n\tStringEmpty = 13, // value = \"\"\n\tString8Length = 14, // unsigned-8-bit little-endian length, follows by UTF-8 bytes of length\n\tString16Length = 15, // unsigned-16-bit little-endian length, follows by UTF-8 bytes of length\n\tString32Length = 16, // unsigned-32-bit little-endian length, follows by UTF-8 bytes of length\n\n\tConstString8Id = 17, // unsigned-8-bit little-endian const string id follows\n\tConstString16Id = 18, // unsigned-16-bit little-endian const string id follows\n\tConstString32Id = 19, // unsigned-32-bit little-endian const string id follows\n\tConstStringDeclare = 20, // Code for declaring a const string with size <= 1 byte\n\tConstStringDeclareBig = 21, // Code for declaring a const string with size > 1 byte. It is represented in 4 bytes.\n\n\tInt0 = 1, // value = 0\n\tUInt8 = 3, // unsigned-8-bit little-endian follows\n\tUInt16 = 5, // unsigned-16-bit little-endian follows\n\tUInt32 = 7, // unsigned-32-bit little-endian follows\n\tUInt64 = 9, // unsigned-64-bit little-endian follows\n\tInt8 = 2, // signed-8-bit little-endian follows\n\tInt16 = 4, // signed-16-bit little-endian follows\n\tInt32 = 6, // signed-32-bit little-endian follows\n\tInt64 = 8, // signed-64-bit little-endian follows\n\n\tBinaryEmpty = 32, // value = byte[]\n\tBinarySingle8 = 33, // unsigned-8-bit little-endian length, follows by bytes of length\n\tBinarySingle16 = 34, // unsigned-16-bit little-endian length, follows by bytes of length\n\tBinarySingle32 = 35, // unsigned-32-bit little-endian length, follows by bytes of length\n\tBinarySingle64 = 36, // unsigned-64-bit little-endian length, follows by bytes of length\n}\n\n/**\n * Control codes used by tree serialization / decentralization code. They mark the start of sections.\n */\nexport enum MarkerCodesStart {\n\t\"list\" = 49,\n\t\"set\" = 51,\n}\n\n/**\n * Control codes used by tree serialization / decentralization code. They mark the end of sections.\n */\nexport enum MarkerCodesEnd {\n\t\"list\" = 50,\n\t\"set\" = 52,\n}\n\n/**\n * This contains mapping of Marker Codes to number of bytes in which the corresponding data\n * will be stored.\n */\nexport const codeToBytesMap = {\n\t// Integer code to bytes\n\t1: 0,\n\t2: 1,\n\t3: 1,\n\t4: 2,\n\t5: 2,\n\t6: 4,\n\t7: 4,\n\t8: 8,\n\t9: 8,\n\n\t// String code to Bytes\n\t13: 0,\n\t14: 1,\n\t15: 2,\n\t16: 4,\n\n\t17: 1,\n\t18: 2,\n\t19: 4,\n\n\t20: 1,\n\t21: 4,\n\n\t// Binary code to bytes\n\t32: 0,\n\t33: 1,\n\t34: 2,\n\t35: 4,\n\t36: 8,\n};\n\nexport function getValueSafely(map: { [index: number]: number }, key: number): number {\n\tconst val = map[key];\n\tassert(val !== undefined, 0x287 /* key must exist in the map */);\n\treturn val;\n}\n\nexport function getNodeProps(node: NodeCore): Record<string, NodeTypes> {\n\tconst res: Record<string, NodeTypes> = {};\n\tfor (const [keyNode, valueNode] of node.iteratePairs()) {\n\t\tconst id = getStringInstance(keyNode, \"keynode should be a string\");\n\t\tres[id] = valueNode;\n\t}\n\treturn res;\n}\n\nexport function iteratePairs<T>(it: IterableIterator<T>): IterableIterator<[T, T]> {\n\tconst res: IterableIterator<[T, T]> = {\n\t\tnext: () => {\n\t\t\tconst a = it.next();\n\t\t\tif (a.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\tconst b = it.next();\n\t\t\tassert(b.done !== true, 0x22b /* \"Should be a pair\" */);\n\t\t\treturn { value: [a.value, b.value], done: b.done };\n\t\t},\n\t\t[Symbol.iterator]: () => {\n\t\t\treturn res;\n\t\t},\n\t};\n\treturn res;\n}\n\n/**\n * Helper function that returns iterator from an object\n * @param obj - object that supports iteration\n */\nexport function iterate<T>(obj: {\n\t[Symbol.iterator]: () => IterableIterator<T>;\n}): IterableIterator<T> {\n\treturn obj[Symbol.iterator]();\n}\n\n/**\n * Base class to represent binary blob element.\n * Binary blob is one of three types supported as a leaf node of a tree.\n * Note: concrete implementations (derived classes) are not exposed from this module\n */\nexport abstract class BlobCore {\n\tpublic abstract get buffer(): Uint8Array;\n\tpublic abstract get arrayBuffer(): ArrayBufferLike;\n\n\t/**\n\t * Represents a blob.\n\t */\n\tconstructor() {}\n}\n\n/**\n * \"deep copy\" blob, holds to binary data passed in\n * It is called deep copy as a counter-part to BlobShallowCopy, which\n * is a reference to underlying binary stream (ReadBuffer).\n */\nclass BlobDeepCopy extends BlobCore {\n\t/**\n\t * Represents a deep copy of the blob.\n\t * @param data - Data array of the blob\n\t */\n\tconstructor(protected readonly data: Uint8Array) {\n\t\tsuper();\n\t}\n\n\tpublic get buffer(): Uint8Array {\n\t\treturn this.data;\n\t}\n\n\tpublic get arrayBuffer(): ArrayBufferLike {\n\t\treturn Uint8ArrayToArrayBuffer(this.buffer);\n\t}\n\n\tpublic static read(buffer: ReadBuffer, lengthLen: number): BlobCore {\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst data = new Uint8Array(length);\n\t\tfor (let counter = 0; counter < length; counter++) {\n\t\t\tdata[counter] = buffer.read();\n\t\t}\n\t\treturn new BlobDeepCopy(data);\n\t}\n}\n\n/**\n * Shallow copy blob, keeps a reference to portion of ReadBuffer\n * it was constructed from. It takes much less memory compared to BlobDeepCopy\n */\nexport class BlobShallowCopy extends BlobCore {\n\t/**\n\t * Represents a shallow copy of the blob. It is not a separate blob, just reference to original blobs.\n\t * @param data - Data array of the blob\n\t * @param start - Start point of the blob in the buffer.\n\t * @param end - End point of the blob in the buffer.\n\t */\n\tconstructor(\n\t\tprotected data: Uint8Array,\n\t\tprotected start: number,\n\t\tprotected end: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic get buffer(): Uint8Array {\n\t\treturn this.data.subarray(this.start, this.end);\n\t}\n\n\t// Equivalent to Uint8ArrayToArrayBuffer(this.buffer)\n\tpublic get arrayBuffer(): ArrayBufferLike {\n\t\tconst offset = this.data.byteOffset;\n\t\treturn this.data.buffer.slice(this.start + offset, this.end + offset);\n\t}\n\n\tpublic static read(buffer: ReadBuffer, lengthLen: number): BlobCore {\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst pos = buffer.pos;\n\t\tbuffer.skip(length);\n\t\treturn new BlobShallowCopy(buffer.buffer, pos, pos + length);\n\t}\n}\n\nexport const addStringProperty = (node: NodeCore, a: string, b: string): void => {\n\tnode.addDictionaryString(a);\n\tnode.addString(b);\n};\nexport const addDictionaryStringProperty = (node: NodeCore, a: string, b: string): void => {\n\tnode.addDictionaryString(a);\n\tnode.addString(b);\n};\nexport const addNumberProperty = (node: NodeCore, a: string, b: number): void => {\n\tnode.addDictionaryString(a);\n\tnode.addNumber(b);\n};\nexport const addBoolProperty = (node: NodeCore, a: string, b: boolean): void => {\n\tnode.addDictionaryString(a);\n\tnode.addBool(b);\n};\n\nexport interface IStringElement {\n\tcontent: string;\n\tdictionary: boolean;\n\t_stringElement: true;\n}\n\nexport interface IStringElementInternal extends Omit<IStringElement, \"content\"> {\n\tcontent?: string;\n\tstartPos: number;\n\tendPos: number;\n}\n\n/**\n * Three leaf types supported by tree:\n * 1. Node (sub-tree)\n * 2. binary blob\n * 3. integer\n * 4. boolean\n */\nexport type NodeTypes = NodeCore | BlobCore | number | boolean | IStringElement;\n\nexport type NodeCoreTypes = \"list\" | \"set\";\n\n/**\n * Node - node in the tree (non-leaf element of the tree)\n */\nexport class NodeCore {\n\t// It is an array of nodes.\n\tprivate readonly children: NodeTypes[] = [];\n\tpublic get nodes(): NodeTypes[] {\n\t\treturn this.children;\n\t}\n\n\tconstructor(public type: NodeCoreTypes = \"set\") {}\n\n\tpublic [Symbol.iterator](): IterableIterator<NodeTypes> {\n\t\treturn this.children[Symbol.iterator]();\n\t}\n\n\tpublic iteratePairs(): IterableIterator<[NodeTypes, NodeTypes]> {\n\t\tassert(this.length % 2 === 0, 0x22c /* \"reading pairs\" */);\n\t\treturn iteratePairs(iterate(this));\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.children.length;\n\t}\n\n\tpublic get(index: number): NodeTypes {\n\t\treturn this.children[index];\n\t}\n\n\tpublic getString(index: number): string {\n\t\tconst node = this.children[index];\n\t\treturn getStringInstance(node, \"getString should return string\");\n\t}\n\n\tpublic getMaybeString(index: number): string | undefined {\n\t\tconst node = this.children[index];\n\t\treturn getMaybeStringInstance(node);\n\t}\n\n\tpublic getBlob(index: number): BlobCore {\n\t\tconst node = this.children[index];\n\t\tassertBlobCoreInstance(node, \"getBlob should return a blob\");\n\t\treturn node;\n\t}\n\n\tpublic getNode(index: number): NodeCore {\n\t\tconst node = this.children[index];\n\t\tassertNodeCoreInstance(node, \"getNode should return a node\");\n\t\treturn node;\n\t}\n\n\tpublic getNumber(index: number): number {\n\t\tconst node = this.children[index];\n\t\tassertNumberInstance(node, \"getNumber should return a number\");\n\t\treturn node;\n\t}\n\n\tpublic getBool(index: number): boolean {\n\t\tconst node = this.children[index];\n\t\tassertBoolInstance(node, \"getBool should return a boolean\");\n\t\treturn node;\n\t}\n\n\tpublic addNode(type?: NodeCoreTypes): NodeCore {\n\t\tconst node = new NodeCore(type);\n\t\tthis.children.push(node);\n\t\treturn node;\n\t}\n\n\tpublic addBlob(blob: Uint8Array): void {\n\t\tthis.children.push(new BlobDeepCopy(blob));\n\t}\n\n\tpublic addDictionaryString(payload: string): void {\n\t\tthis.children.push({\n\t\t\tcontent: payload,\n\t\t\tdictionary: true,\n\t\t\t_stringElement: true,\n\t\t});\n\t}\n\n\tpublic addString(payload: string): void {\n\t\tthis.children.push({\n\t\t\tcontent: payload,\n\t\t\tdictionary: false,\n\t\t\t_stringElement: true,\n\t\t});\n\t}\n\n\tpublic addNumber(payload: number | undefined): void {\n\t\tassert(Number.isInteger(payload), 0x231 /* \"Number should be an integer\" */);\n\t\tassert(\n\t\t\tpayload !== undefined && payload >= 0,\n\t\t\t0x232 /* \"Payload should not be negative\" */,\n\t\t);\n\t\tthis.children.push(payload);\n\t}\n\n\tpublic addBool(payload: boolean): void {\n\t\tthis.children.push(payload);\n\t}\n\n\t// Can we do more efficiently here, without extra objects somehow??\n\tprivate static readString(\n\t\tbuffer: ReadBuffer,\n\t\tcode: number,\n\t\tdictionary: boolean,\n\t): IStringElementInternal & IStringElement {\n\t\tconst lengthLen = getValueSafely(codeToBytesMap, code);\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst startPos = buffer.pos;\n\t\tbuffer.skip(length);\n\t\tconst result: IStringElementInternal = {\n\t\t\t// Note: Setting here property 'content: undefined' makes code substantially slower!\n\t\t\tdictionary,\n\t\t\t_stringElement: true,\n\t\t\tstartPos,\n\t\t\tendPos: buffer.pos,\n\t\t};\n\n\t\t// We are lying here in terms of presence of `content` property.\n\t\t// This will be addressed at the bottom of NodeCore.load() by resolving all strings at once!\n\t\t// It's equivalent (but much slower!) to do it here via\n\t\t// result.content = Uint8ArrayToString(buffer.buffer.subarray(startPos, buffer.pos), \"utf-8\");\n\t\treturn result as IStringElementInternal & IStringElement;\n\t}\n\n\t/**\n\t * Load and parse the buffer into a tree.\n\t * @param buffer - buffer to read from.\n\t */\n\tprotected load(\n\t\tbuffer: ReadBuffer,\n\t\tlogger: ITelemetryLoggerExt,\n\t): {\n\t\tdurationStructure: number;\n\t\tdurationStrings: number;\n\t} {\n\t\tconst [stringsToResolve, durationStructure] = measure(() =>\n\t\t\tthis.loadStructure(buffer, logger),\n\t\t);\n\t\tconst [, durationStrings] = measure(() =>\n\t\t\tthis.loadStrings(buffer, stringsToResolve, logger),\n\t\t);\n\t\treturn { durationStructure, durationStrings };\n\t}\n\n\t/**\n\t * Load and parse the buffer into a tree.\n\t * @param buffer - buffer to read from.\n\t */\n\tprotected loadStructure(\n\t\tbuffer: ReadBuffer,\n\t\tlogger: ITelemetryLoggerExt,\n\t): IStringElementInternal[] {\n\t\tconst stack: NodeTypes[][] = [];\n\t\tconst stringsToResolve: IStringElementInternal[] = [];\n\t\tconst dictionary: IStringElement[] = [];\n\n\t\tlet children = this.children;\n\t\tfor (; !buffer.eof; ) {\n\t\t\tconst code = buffer.read();\n\t\t\tswitch (code) {\n\t\t\t\tcase MarkerCodesStart.list:\n\t\t\t\tcase MarkerCodesStart.set: {\n\t\t\t\t\tconst childValue = new NodeCore(code === MarkerCodesStart.set ? \"set\" : \"list\");\n\t\t\t\t\tchildren.push(childValue);\n\t\t\t\t\tstack.push(children);\n\t\t\t\t\tchildren = childValue.children;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.ConstStringDeclare:\n\t\t\t\tcase MarkerCodes.ConstStringDeclareBig: {\n\t\t\t\t\tconst stringId = buffer.read(getValueSafely(codeToBytesMap, code));\n\t\t\t\t\tconst constString = NodeCore.readString(buffer, code, true /* dictionary */);\n\t\t\t\t\tstringsToResolve.push(constString);\n\t\t\t\t\tdictionary[stringId] = constString;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.ConstString8Id:\n\t\t\t\tcase MarkerCodes.ConstString16Id:\n\t\t\t\tcase MarkerCodes.ConstString32Id: {\n\t\t\t\t\tconst stringId = buffer.read(getValueSafely(codeToBytesMap, code));\n\t\t\t\t\tconst content = dictionary[stringId];\n\t\t\t\t\tassert(content !== undefined, 0x3de /* const string not found */);\n\t\t\t\t\tchildren.push(content);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.StringEmpty:\n\t\t\t\tcase MarkerCodes.String8Length:\n\t\t\t\tcase MarkerCodes.String16Length:\n\t\t\t\tcase MarkerCodes.String32Length: {\n\t\t\t\t\tconst str = NodeCore.readString(buffer, code, false /* dictionary */);\n\t\t\t\t\tstringsToResolve.push(str);\n\t\t\t\t\tchildren.push(str);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BinaryEmpty:\n\t\t\t\tcase MarkerCodes.BinarySingle8:\n\t\t\t\tcase MarkerCodes.BinarySingle16:\n\t\t\t\tcase MarkerCodes.BinarySingle32:\n\t\t\t\tcase MarkerCodes.BinarySingle64: {\n\t\t\t\t\tchildren.push(BlobShallowCopy.read(buffer, getValueSafely(codeToBytesMap, code)));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// If integer is 0.\n\t\t\t\tcase MarkerCodes.Int0: {\n\t\t\t\t\tchildren.push(0);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.UInt8:\n\t\t\t\tcase MarkerCodes.UInt16:\n\t\t\t\tcase MarkerCodes.UInt32:\n\t\t\t\tcase MarkerCodes.UInt64:\n\t\t\t\tcase MarkerCodes.Int8:\n\t\t\t\tcase MarkerCodes.Int16:\n\t\t\t\tcase MarkerCodes.Int32:\n\t\t\t\tcase MarkerCodes.Int64: {\n\t\t\t\t\tchildren.push(buffer.read(getValueSafely(codeToBytesMap, code)));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BoolTrue: {\n\t\t\t\t\tchildren.push(true);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BoolFalse: {\n\t\t\t\t\tchildren.push(false);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodesEnd.list:\n\t\t\t\tcase MarkerCodesEnd.set: {\n\t\t\t\t\t// Note: We are not checking that end marker matches start marker.\n\t\t\t\t\t// I.e. that we do not have a case where we start a 'list' but end with a 'set'\n\t\t\t\t\t// Checking it would require more state tracking that seems not very useful, given\n\t\t\t\t\t// our code does not care.\n\t\t\t\t\tchildren = stack.pop()!;\n\n\t\t\t\t\t// To my surprise, checking children !== undefined adds measurable cost!\n\t\t\t\t\t// We will rely on children.push() crashing in case of mismatch, and check below\n\t\t\t\t\t// (outside of the loop)\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(`Invalid code: ${code}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// This also ensures that stack.length === 0.\n\t\tassert(children === this.children, 0x3e7 /* Unpaired start/end list/set markers! */);\n\n\t\treturn stringsToResolve;\n\t}\n\n\tprivate loadStrings(\n\t\tbuffer: ReadBuffer,\n\t\tstringsToResolve: IStringElementInternal[],\n\t\tlogger: ITelemetryLoggerExt,\n\t): void {\n\t\t/**\n\t\t * Process all the strings at once!\n\t\t */\n\t\tlet length = 0;\n\t\tfor (const el of stringsToResolve) {\n\t\t\tlength += el.endPos - el.startPos + 1;\n\t\t}\n\t\tconst stringBuffer = new Uint8Array(length);\n\n\t\tlength = 0;\n\t\tconst input = buffer.buffer;\n\t\tassert(input.byteOffset === 0, 0x3e8 /* code below assumes no offset */);\n\n\t\tfor (const el of stringsToResolve) {\n\t\t\tfor (let it = el.startPos; it < el.endPos; it++) {\n\t\t\t\tstringBuffer[length] = input[it];\n\t\t\t\tlength++;\n\t\t\t}\n\t\t\tstringBuffer[length] = 0;\n\t\t\tlength++;\n\t\t}\n\t\tassert(length === stringBuffer.length, 0x418 /* properly encoded */);\n\n\t\tconst result = Uint8ArrayToString(stringBuffer, \"utf8\").split(String.fromCodePoint(0));\n\t\tif (result.length === stringsToResolve.length + 1) {\n\t\t\t// All is good, we expect all the cases to get here\n\t\t\tfor (let i = 0; i < stringsToResolve.length; i++) {\n\t\t\t\tstringsToResolve[i].content = result[i];\n\t\t\t}\n\t\t} else {\n\t\t\t// String content has \\0 chars!\n\t\t\t// Recovery code\n\t\t\tlogger.sendErrorEvent({ eventName: \"StringParsingError\" });\n\t\t\tfor (const el of stringsToResolve) {\n\t\t\t\tassert(\n\t\t\t\t\tel.content === Uint8ArrayToString(input.subarray(el.startPos, el.endPos), \"utf8\"),\n\t\t\t\t\t0x3ea /* test */,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * TreeBuilder - Root of the tree.\n * Provides loading and serialization capabilities.\n */\nexport class TreeBuilder extends NodeCore {\n\tstatic load(\n\t\tbuffer: ReadBuffer,\n\t\tlogger: ITelemetryLoggerExt,\n\t): {\n\t\tbuilder: TreeBuilder;\n\t\ttelemetryProps: {\n\t\t\tdurationStructure: number;\n\t\t\tdurationStrings: number;\n\t\t};\n\t} {\n\t\tconst builder = new TreeBuilder();\n\t\tconst telemetryProps = builder.load(buffer, logger);\n\t\tassert(buffer.eof, 0x233 /* \"Unexpected data at the end of buffer\" */);\n\t\treturn { builder, telemetryProps };\n\t}\n}\n\nexport function getMaybeStringInstance(node: NodeTypes): string | undefined {\n\tconst maybeString = node as IStringElement;\n\tif (maybeString._stringElement) {\n\t\treturn maybeString.content;\n\t}\n}\n\nexport function getStringInstance(node: NodeTypes, message: string): string {\n\tconst maybeString = node as IStringElement;\n\tif (maybeString._stringElement) {\n\t\treturn maybeString.content;\n\t}\n\tthrowBufferParseException(node, \"BlobCore\", message);\n}\n\nexport function assertBlobCoreInstance(\n\tnode: NodeTypes,\n\tmessage: string,\n): asserts node is BlobCore {\n\tif (node instanceof BlobCore) {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"BlobCore\", message);\n}\n\nexport function assertNodeCoreInstance(\n\tnode: NodeTypes,\n\tmessage: string,\n): asserts node is NodeCore {\n\tif (node instanceof NodeCore) {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"NodeCore\", message);\n}\n\nexport function assertNumberInstance(\n\tnode: NodeTypes,\n\tmessage: string,\n): asserts node is number {\n\tif (typeof node === \"number\") {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"Number\", message);\n}\n\nexport function assertBoolInstance(node: NodeTypes, message: string): asserts node is boolean {\n\tif (typeof node === \"boolean\") {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"Boolean\", message);\n}\n\nfunction throwBufferParseException(\n\tnode: NodeTypes,\n\texpectedNodeType: NodeType,\n\tmessage: string,\n): never {\n\tthrow new NonRetryableError(\n\t\t`Buffer parsing exception: ${message}`,\n\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t{\n\t\t\tnodeType: getNodeType(node),\n\t\t\texpectedNodeType,\n\t\t\tdriverVersion,\n\t\t},\n\t);\n}\n\nfunction getNodeType(value: NodeTypes): NodeType {\n\tif (typeof value === \"number\") {\n\t\treturn \"Number\";\n\t} else if (value instanceof BlobCore) {\n\t\treturn \"BlobCore\";\n\t} else if (value instanceof NodeCore) {\n\t\treturn \"NodeCore\";\n\t} else if (typeof value === \"boolean\") {\n\t\treturn \"Boolean\";\n\t} else if (value._stringElement) {\n\t\treturn \"String\";\n\t}\n\treturn \"UnknownType\";\n}\n\ntype NodeType = \"Number\" | \"BlobCore\" | \"NodeCore\" | \"Boolean\" | \"UnknownType\" | \"String\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -67,15 +67,15 @@
|
|
|
67
67
|
"temp-directory": "nyc/.nyc_output"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@fluid-internal/client-utils": "2.3.
|
|
71
|
-
"@fluidframework/core-interfaces": "2.3.
|
|
72
|
-
"@fluidframework/core-utils": "2.3.
|
|
73
|
-
"@fluidframework/driver-base": "2.3.
|
|
74
|
-
"@fluidframework/driver-definitions": "2.3.
|
|
75
|
-
"@fluidframework/driver-utils": "2.3.
|
|
76
|
-
"@fluidframework/odsp-doclib-utils": "2.3.
|
|
77
|
-
"@fluidframework/odsp-driver-definitions": "2.3.
|
|
78
|
-
"@fluidframework/telemetry-utils": "2.3.
|
|
70
|
+
"@fluid-internal/client-utils": "~2.3.1",
|
|
71
|
+
"@fluidframework/core-interfaces": "~2.3.1",
|
|
72
|
+
"@fluidframework/core-utils": "~2.3.1",
|
|
73
|
+
"@fluidframework/driver-base": "~2.3.1",
|
|
74
|
+
"@fluidframework/driver-definitions": "~2.3.1",
|
|
75
|
+
"@fluidframework/driver-utils": "~2.3.1",
|
|
76
|
+
"@fluidframework/odsp-doclib-utils": "~2.3.1",
|
|
77
|
+
"@fluidframework/odsp-driver-definitions": "~2.3.1",
|
|
78
|
+
"@fluidframework/telemetry-utils": "~2.3.1",
|
|
79
79
|
"node-fetch": "^2.6.9",
|
|
80
80
|
"socket.io-client": "^4.7.3",
|
|
81
81
|
"uuid": "^9.0.0"
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
85
85
|
"@biomejs/biome": "~1.8.3",
|
|
86
|
-
"@fluid-internal/mocha-test-setup": "2.3.
|
|
87
|
-
"@fluid-tools/build-cli": "^0.
|
|
86
|
+
"@fluid-internal/mocha-test-setup": "~2.3.1",
|
|
87
|
+
"@fluid-tools/build-cli": "^0.46.0",
|
|
88
88
|
"@fluidframework/build-common": "^2.0.3",
|
|
89
|
-
"@fluidframework/build-tools": "^0.
|
|
90
|
-
"@fluidframework/eslint-config-fluid": "^5.
|
|
89
|
+
"@fluidframework/build-tools": "^0.46.0",
|
|
90
|
+
"@fluidframework/eslint-config-fluid": "^5.4.0",
|
|
91
91
|
"@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver@2.2.0",
|
|
92
|
-
"@microsoft/api-extractor": "
|
|
92
|
+
"@microsoft/api-extractor": "7.47.8",
|
|
93
93
|
"@types/mocha": "^9.1.1",
|
|
94
94
|
"@types/node": "^18.19.0",
|
|
95
95
|
"@types/node-fetch": "^2.6.11",
|
|
@@ -110,7 +110,8 @@
|
|
|
110
110
|
"typescript": "~5.4.5"
|
|
111
111
|
},
|
|
112
112
|
"typeValidation": {
|
|
113
|
-
"broken": {}
|
|
113
|
+
"broken": {},
|
|
114
|
+
"entrypoint": "internal"
|
|
114
115
|
},
|
|
115
116
|
"scripts": {
|
|
116
117
|
"api": "fluid-build . --task api",
|
package/src/ReadBufferUtils.ts
CHANGED
|
@@ -47,8 +47,7 @@ export class ReadBuffer {
|
|
|
47
47
|
let length = lengthArg;
|
|
48
48
|
while (length > 0) {
|
|
49
49
|
assert(!this.eof, 0x223 /* "unexpected end of buffer" */);
|
|
50
|
-
|
|
51
|
-
res += this.data[this.index]! * multiplier;
|
|
50
|
+
res += this.data[this.index] * multiplier;
|
|
52
51
|
this.index++;
|
|
53
52
|
multiplier *= 256;
|
|
54
53
|
length--;
|
package/src/WriteBufferUtils.ts
CHANGED
|
@@ -32,8 +32,7 @@ export class WriteBuffer {
|
|
|
32
32
|
let index = 0;
|
|
33
33
|
const oldData = this.data;
|
|
34
34
|
while (index < length) {
|
|
35
|
-
|
|
36
|
-
newData[index] = oldData[index]!;
|
|
35
|
+
newData[index] = oldData[index];
|
|
37
36
|
index++;
|
|
38
37
|
}
|
|
39
38
|
this.data = newData;
|
|
@@ -253,8 +252,7 @@ function serializeNodeCore(
|
|
|
253
252
|
buffer.write(child, len);
|
|
254
253
|
}
|
|
255
254
|
} else if (typeof child === "boolean") {
|
|
256
|
-
|
|
257
|
-
buffer.write(boolToCodeMap[child ? 1 : 0]!);
|
|
255
|
+
buffer.write(boolToCodeMap[child ? 1 : 0]);
|
|
258
256
|
} else {
|
|
259
257
|
assert(child._stringElement, 0x3dd /* Unsupported node type */);
|
|
260
258
|
if (child.dictionary) {
|
|
@@ -70,10 +70,8 @@ function readBlobSection(node: NodeTypes): {
|
|
|
70
70
|
*/
|
|
71
71
|
slowBlobStructureCount += 1;
|
|
72
72
|
const records = getNodeProps(blob);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// TODO why are we non null asserting here?
|
|
76
|
-
const id = getStringInstance(records.id!, "blob id should be string");
|
|
73
|
+
assertBlobCoreInstance(records.data, "data should be of BlobCore type");
|
|
74
|
+
const id = getStringInstance(records.id, "blob id should be string");
|
|
77
75
|
blobContents.set(id, records.data.arrayBuffer);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
@@ -88,10 +86,8 @@ function readOpsSection(node: NodeTypes): ISequencedDocumentMessage[] {
|
|
|
88
86
|
assertNodeCoreInstance(node, "Deltas should be of type NodeCore");
|
|
89
87
|
const ops: ISequencedDocumentMessage[] = [];
|
|
90
88
|
const records = getNodeProps(node);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// TODO Why are we non null asserting here?
|
|
94
|
-
assertNodeCoreInstance(records.deltas!, "Deltas should be a Node");
|
|
89
|
+
assertNumberInstance(records.firstSequenceNumber, "Seq number should be a number");
|
|
90
|
+
assertNodeCoreInstance(records.deltas, "Deltas should be a Node");
|
|
95
91
|
for (let i = 0; i < records.deltas.length; ++i) {
|
|
96
92
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
97
93
|
ops.push(JSON.parse(records.deltas.getString(i)));
|
|
@@ -100,8 +96,7 @@ function readOpsSection(node: NodeTypes): ISequencedDocumentMessage[] {
|
|
|
100
96
|
// when there are no ops. So just make the code resilient to that bug. Service has also
|
|
101
97
|
// fixed that bug.
|
|
102
98
|
assert(
|
|
103
|
-
|
|
104
|
-
ops.length === 0 || records.firstSequenceNumber.valueOf() === ops[0]!.sequenceNumber,
|
|
99
|
+
ops.length === 0 || records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,
|
|
105
100
|
0x280 /* "Validate first op seq number" */,
|
|
106
101
|
);
|
|
107
102
|
return ops;
|
|
@@ -206,8 +201,7 @@ function readTreeSection(node: NodeCore): {
|
|
|
206
201
|
snapshotTree.unreferenced = true;
|
|
207
202
|
}
|
|
208
203
|
|
|
209
|
-
|
|
210
|
-
const path = getStringInstance(records.name!, "Path name should be string");
|
|
204
|
+
const path = getStringInstance(records.name, "Path name should be string");
|
|
211
205
|
if (records.value !== undefined) {
|
|
212
206
|
snapshotTree.blobs[path] = getStringInstance(
|
|
213
207
|
records.value,
|
|
@@ -220,8 +214,7 @@ function readTreeSection(node: NodeCore): {
|
|
|
220
214
|
trees[path] = result.snapshotTree;
|
|
221
215
|
if (records.groupId !== undefined) {
|
|
222
216
|
const groupId = getStringInstance(records.groupId, "groupId should be a string");
|
|
223
|
-
|
|
224
|
-
trees[path]!.groupId = groupId;
|
|
217
|
+
trees[path].groupId = groupId;
|
|
225
218
|
treeStructureCountWithGroupId++;
|
|
226
219
|
}
|
|
227
220
|
slowTreeStructureCount += result.slowTreeStructureCount;
|
|
@@ -246,14 +239,11 @@ function readSnapshotSection(node: NodeTypes): {
|
|
|
246
239
|
assertNodeCoreInstance(node, "Snapshot should be of type NodeCore");
|
|
247
240
|
const records = getNodeProps(node);
|
|
248
241
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// TODO Why are we non null asserting here?
|
|
252
|
-
assertNumberInstance(records.sequenceNumber!, "sequenceNumber should be of type number");
|
|
242
|
+
assertNodeCoreInstance(records.treeNodes, "TreeNodes should be of type NodeCore");
|
|
243
|
+
assertNumberInstance(records.sequenceNumber, "sequenceNumber should be of type number");
|
|
253
244
|
const { snapshotTree, slowTreeStructureCount, treeStructureCountWithGroupId } =
|
|
254
245
|
readTreeSection(records.treeNodes);
|
|
255
|
-
|
|
256
|
-
snapshotTree.id = getStringInstance(records.id!, "snapshotId should be string");
|
|
246
|
+
snapshotTree.id = getStringInstance(records.id, "snapshotId should be string");
|
|
257
247
|
const sequenceNumber = records.sequenceNumber.valueOf();
|
|
258
248
|
return {
|
|
259
249
|
sequenceNumber,
|
|
@@ -279,10 +269,8 @@ export function parseCompactSnapshotResponse(
|
|
|
279
269
|
|
|
280
270
|
const records = getNodeProps(root);
|
|
281
271
|
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
// TODO Why are we non null asserting here?
|
|
285
|
-
const cv = getStringInstance(records.cv!, "createVersion should be string");
|
|
272
|
+
const mrv = getStringInstance(records.mrv, "minReadVersion should be string");
|
|
273
|
+
const cv = getStringInstance(records.cv, "createVersion should be string");
|
|
286
274
|
if (records.lsn !== undefined) {
|
|
287
275
|
assertNumberInstance(records.lsn, "lsn should be a number");
|
|
288
276
|
}
|
|
@@ -301,11 +289,9 @@ export function parseCompactSnapshotResponse(
|
|
|
301
289
|
);
|
|
302
290
|
|
|
303
291
|
const [snapshot, durationSnapshotTree] = measure(() =>
|
|
304
|
-
|
|
305
|
-
readSnapshotSection(records.snapshot!),
|
|
292
|
+
readSnapshotSection(records.snapshot),
|
|
306
293
|
);
|
|
307
|
-
|
|
308
|
-
const [blobContents, durationBlobs] = measure(() => readBlobSection(records.blobs!));
|
|
294
|
+
const [blobContents, durationBlobs] = measure(() => readBlobSection(records.blobs));
|
|
309
295
|
|
|
310
296
|
return {
|
|
311
297
|
...snapshot,
|
|
@@ -130,8 +130,7 @@ function writeSnapshotSection(
|
|
|
130
130
|
function writeOpsSection(rootNode: NodeCore, ops: ISequencedDocumentMessage[]): void {
|
|
131
131
|
let firstSequenceNumber: number | undefined;
|
|
132
132
|
if (ops.length > 0) {
|
|
133
|
-
|
|
134
|
-
firstSequenceNumber = ops[0]!.sequenceNumber;
|
|
133
|
+
firstSequenceNumber = ops[0].sequenceNumber;
|
|
135
134
|
}
|
|
136
135
|
if (firstSequenceNumber !== undefined) {
|
|
137
136
|
rootNode.addDictionaryString("deltas");
|
|
@@ -163,8 +162,7 @@ export function convertToCompactSnapshot(snapshotContents: ISnapshot): Uint8Arra
|
|
|
163
162
|
if (latestSequenceNumber === undefined) {
|
|
164
163
|
latestSequenceNumber =
|
|
165
164
|
snapshotContents.ops.length > 0
|
|
166
|
-
?
|
|
167
|
-
snapshotContents.ops[snapshotContents.ops.length - 1]!.sequenceNumber
|
|
165
|
+
? snapshotContents.ops[snapshotContents.ops.length - 1].sequenceNumber
|
|
168
166
|
: snapshotContents.sequenceNumber;
|
|
169
167
|
}
|
|
170
168
|
|
package/src/createFile.ts
CHANGED
|
@@ -164,13 +164,22 @@ function extractShareLinkData(
|
|
|
164
164
|
return shareLinkInfo;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Encodes file path so it can be embedded in the request url
|
|
169
|
+
* @param path - path to encode
|
|
170
|
+
* @returns encoded path or "" if path is undefined
|
|
171
|
+
*/
|
|
172
|
+
function encodeFilePath(path: string | undefined): string {
|
|
173
|
+
return path ? encodeURIComponent(path.startsWith("/") ? path : `/${path}`) : "";
|
|
174
|
+
}
|
|
175
|
+
|
|
167
176
|
export async function createNewEmptyFluidFile(
|
|
168
177
|
getAuthHeader: InstrumentedStorageTokenFetcher,
|
|
169
178
|
newFileInfo: INewFileInfo,
|
|
170
179
|
logger: ITelemetryLoggerExt,
|
|
171
180
|
epochTracker: EpochTracker,
|
|
172
181
|
): Promise<string> {
|
|
173
|
-
const filePath =
|
|
182
|
+
const filePath = encodeFilePath(newFileInfo.filePath);
|
|
174
183
|
// add .tmp extension to empty file (host is expected to rename)
|
|
175
184
|
const encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);
|
|
176
185
|
const initialUrl = `${getApiRoot(new URL(newFileInfo.siteUrl))}/drives/${
|
|
@@ -234,7 +243,7 @@ export async function createNewFluidFileFromSummary(
|
|
|
234
243
|
epochTracker: EpochTracker,
|
|
235
244
|
forceAccessTokenViaAuthorizationHeader: boolean,
|
|
236
245
|
): Promise<ICreateFileResponse> {
|
|
237
|
-
const filePath =
|
|
246
|
+
const filePath = encodeFilePath(newFileInfo.filePath);
|
|
238
247
|
const encodedFilename = encodeURIComponent(newFileInfo.filename);
|
|
239
248
|
const baseUrl =
|
|
240
249
|
`${getApiRoot(new URL(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:` +
|
package/src/createNewUtils.ts
CHANGED
|
@@ -72,8 +72,7 @@ function convertCreateNewSummaryTreeToTreeAndBlobsCore(
|
|
|
72
72
|
};
|
|
73
73
|
const keys = Object.keys(summary.tree);
|
|
74
74
|
for (const key of keys) {
|
|
75
|
-
|
|
76
|
-
const summaryObject = summary.tree[key]!;
|
|
75
|
+
const summaryObject = summary.tree[key];
|
|
77
76
|
|
|
78
77
|
switch (summaryObject.type) {
|
|
79
78
|
case SummaryType.Tree: {
|
|
@@ -151,8 +150,7 @@ function convertSummaryToSnapshotTreeForCreateNew(summary: ISummaryTree): IOdspS
|
|
|
151
150
|
const keys = Object.keys(summary.tree);
|
|
152
151
|
for (const key of keys) {
|
|
153
152
|
assert(!key.includes("/"), 0x9cc /* id should not include slashes */);
|
|
154
|
-
|
|
155
|
-
const summaryObject = summary.tree[key]!;
|
|
153
|
+
const summaryObject = summary.tree[key];
|
|
156
154
|
|
|
157
155
|
let value: OdspSummaryTreeValue;
|
|
158
156
|
// Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the
|
package/src/fetchSnapshot.ts
CHANGED
|
@@ -505,8 +505,7 @@ async function fetchLatestSnapshotCore(
|
|
|
505
505
|
const sequenceNumber: number = snapshot.sequenceNumber ?? 0;
|
|
506
506
|
const seqNumberFromOps =
|
|
507
507
|
snapshot.ops && snapshot.ops.length > 0
|
|
508
|
-
?
|
|
509
|
-
snapshot.ops[0]!.sequenceNumber - 1
|
|
508
|
+
? snapshot.ops[0].sequenceNumber - 1
|
|
510
509
|
: undefined;
|
|
511
510
|
|
|
512
511
|
if (
|
package/src/getFileLink.ts
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
import type { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { NonRetryableError, runWithRetry } from "@fluidframework/driver-utils/internal";
|
|
9
|
-
import { hasRedirectionLocation } from "@fluidframework/odsp-doclib-utils/internal";
|
|
10
9
|
import {
|
|
11
10
|
IOdspUrlParts,
|
|
12
11
|
OdspErrorTypes,
|
|
13
12
|
OdspResourceTokenFetchOptions,
|
|
14
13
|
TokenFetcher,
|
|
14
|
+
type IOdspResolvedUrl,
|
|
15
15
|
} from "@fluidframework/odsp-driver-definitions/internal";
|
|
16
16
|
import {
|
|
17
17
|
ITelemetryLoggerExt,
|
|
@@ -44,10 +44,10 @@ const fileLinkCache = new Map<string, Promise<string>>();
|
|
|
44
44
|
*/
|
|
45
45
|
export async function getFileLink(
|
|
46
46
|
getToken: TokenFetcher<OdspResourceTokenFetchOptions>,
|
|
47
|
-
|
|
47
|
+
resolvedUrl: IOdspResolvedUrl,
|
|
48
48
|
logger: ITelemetryLoggerExt,
|
|
49
49
|
): Promise<string> {
|
|
50
|
-
const cacheKey = `${
|
|
50
|
+
const cacheKey = `${resolvedUrl.siteUrl}_${resolvedUrl.driveId}_${resolvedUrl.itemId}`;
|
|
51
51
|
const maybeFileLinkCacheEntry = fileLinkCache.get(cacheKey);
|
|
52
52
|
if (maybeFileLinkCacheEntry !== undefined) {
|
|
53
53
|
return maybeFileLinkCacheEntry;
|
|
@@ -61,7 +61,7 @@ export async function getFileLink(
|
|
|
61
61
|
async () =>
|
|
62
62
|
runWithRetryForCoherencyAndServiceReadOnlyErrors(
|
|
63
63
|
async () =>
|
|
64
|
-
getFileLinkWithLocationRedirectionHandling(getToken,
|
|
64
|
+
getFileLinkWithLocationRedirectionHandling(getToken, resolvedUrl, logger),
|
|
65
65
|
"getFileLinkCore",
|
|
66
66
|
logger,
|
|
67
67
|
),
|
|
@@ -116,32 +116,41 @@ export async function getFileLink(
|
|
|
116
116
|
*/
|
|
117
117
|
async function getFileLinkWithLocationRedirectionHandling(
|
|
118
118
|
getToken: TokenFetcher<OdspResourceTokenFetchOptions>,
|
|
119
|
-
|
|
119
|
+
resolvedUrl: IOdspResolvedUrl,
|
|
120
120
|
logger: ITelemetryLoggerExt,
|
|
121
121
|
): Promise<string> {
|
|
122
122
|
// We can have chains of location redirection one after the other, so have a for loop
|
|
123
123
|
// so that we can keep handling the same type of error. Set max number of redirection to 5.
|
|
124
124
|
let lastError: unknown;
|
|
125
|
+
let locationRedirected = false;
|
|
125
126
|
for (let count = 1; count <= 5; count++) {
|
|
126
127
|
try {
|
|
127
|
-
|
|
128
|
+
const fileItem = await getFileItemLite(getToken, resolvedUrl, logger, true);
|
|
129
|
+
// Sometimes the siteUrl in the actual file is different from the siteUrl in the resolvedUrl due to location
|
|
130
|
+
// redirection. This creates issues in the getSharingInformation call. So we need to update the siteUrl in the
|
|
131
|
+
// resolvedUrl to the siteUrl in the fileItem which is the updated siteUrl.
|
|
132
|
+
const oldSiteDomain = new URL(resolvedUrl.siteUrl).origin;
|
|
133
|
+
const newSiteDomain = new URL(fileItem.sharepointIds.siteUrl).origin;
|
|
134
|
+
if (oldSiteDomain !== newSiteDomain) {
|
|
135
|
+
locationRedirected = true;
|
|
136
|
+
logger.sendTelemetryEvent({
|
|
137
|
+
eventName: "LocationRedirectionErrorForGetOdspFileLink",
|
|
138
|
+
retryCount: count,
|
|
139
|
+
});
|
|
140
|
+
renameTenantInOdspResolvedUrl(resolvedUrl, newSiteDomain);
|
|
141
|
+
}
|
|
142
|
+
return await getFileLinkCore(getToken, resolvedUrl, logger, fileItem);
|
|
128
143
|
} catch (error: unknown) {
|
|
129
144
|
lastError = error;
|
|
145
|
+
// If the getSharingLink call fails with the 401/403/404 error, then it could be due to that the file has moved
|
|
146
|
+
// to another location. This could occur in case we have more than 1 tenant rename. In that case, we should retry
|
|
147
|
+
// the getFileItemLite call to get the updated fileItem.
|
|
130
148
|
if (
|
|
131
149
|
isFluidError(error) &&
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
150
|
+
locationRedirected &&
|
|
151
|
+
(error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError ||
|
|
152
|
+
error.errorType === OdspErrorTypes.authorizationError)
|
|
135
153
|
) {
|
|
136
|
-
const redirectLocation = error.redirectLocation;
|
|
137
|
-
logger.sendTelemetryEvent({
|
|
138
|
-
eventName: "LocationRedirectionErrorForGetOdspFileLink",
|
|
139
|
-
retryCount: count,
|
|
140
|
-
});
|
|
141
|
-
// Generate the new SiteUrl from the redirection location.
|
|
142
|
-
const newSiteDomain = new URL(redirectLocation).origin;
|
|
143
|
-
const newSiteUrl = `${newSiteDomain}${new URL(odspUrlParts.siteUrl).pathname}`;
|
|
144
|
-
odspUrlParts.siteUrl = newSiteUrl;
|
|
145
154
|
continue;
|
|
146
155
|
}
|
|
147
156
|
throw error;
|
|
@@ -154,9 +163,8 @@ async function getFileLinkCore(
|
|
|
154
163
|
getToken: TokenFetcher<OdspResourceTokenFetchOptions>,
|
|
155
164
|
odspUrlParts: IOdspUrlParts,
|
|
156
165
|
logger: ITelemetryLoggerExt,
|
|
166
|
+
fileItem: FileItemLite,
|
|
157
167
|
): Promise<string> {
|
|
158
|
-
const fileItem = await getFileItemLite(getToken, odspUrlParts, logger, true);
|
|
159
|
-
|
|
160
168
|
// ODSP link requires extra call to return link that is resistant to file being renamed or moved to different folder
|
|
161
169
|
return PerformanceEvent.timedExecAsync(
|
|
162
170
|
logger,
|
|
@@ -194,7 +202,6 @@ async function getFileLinkCore(
|
|
|
194
202
|
headers: {
|
|
195
203
|
"Content-Type": "application/json;odata=verbose",
|
|
196
204
|
"Accept": "application/json;odata=verbose",
|
|
197
|
-
"redirect": "manual",
|
|
198
205
|
...headers,
|
|
199
206
|
},
|
|
200
207
|
};
|
|
@@ -281,7 +288,6 @@ async function getFileItemLite(
|
|
|
281
288
|
);
|
|
282
289
|
|
|
283
290
|
const headers = getHeadersWithAuth(authHeader);
|
|
284
|
-
headers.redirect = "manual";
|
|
285
291
|
const requestInit = { method, headers };
|
|
286
292
|
const response = await fetchHelper(url, requestInit);
|
|
287
293
|
additionalProps = response.propsToLog;
|
|
@@ -302,3 +308,29 @@ async function getFileItemLite(
|
|
|
302
308
|
},
|
|
303
309
|
);
|
|
304
310
|
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* It takes a resolved url with old siteUrl and patches resolved url with updated site url domain.
|
|
314
|
+
* @param odspResolvedUrl - Previous odsp resolved url with older site url.
|
|
315
|
+
* @param newSiteDomain - New site domain after the tenant rename.
|
|
316
|
+
*/
|
|
317
|
+
function renameTenantInOdspResolvedUrl(
|
|
318
|
+
odspResolvedUrl: IOdspResolvedUrl,
|
|
319
|
+
newSiteDomain: string,
|
|
320
|
+
): void {
|
|
321
|
+
const newSiteUrl = `${newSiteDomain}${new URL(odspResolvedUrl.siteUrl).pathname}`;
|
|
322
|
+
odspResolvedUrl.siteUrl = newSiteUrl;
|
|
323
|
+
|
|
324
|
+
if (odspResolvedUrl.endpoints.attachmentGETStorageUrl) {
|
|
325
|
+
odspResolvedUrl.endpoints.attachmentGETStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.attachmentGETStorageUrl).pathname}`;
|
|
326
|
+
}
|
|
327
|
+
if (odspResolvedUrl.endpoints.attachmentPOSTStorageUrl) {
|
|
328
|
+
odspResolvedUrl.endpoints.attachmentPOSTStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.attachmentPOSTStorageUrl).pathname}`;
|
|
329
|
+
}
|
|
330
|
+
if (odspResolvedUrl.endpoints.deltaStorageUrl) {
|
|
331
|
+
odspResolvedUrl.endpoints.deltaStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.deltaStorageUrl).pathname}`;
|
|
332
|
+
}
|
|
333
|
+
if (odspResolvedUrl.endpoints.snapshotStorageUrl) {
|
|
334
|
+
odspResolvedUrl.endpoints.snapshotStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.snapshotStorageUrl).pathname}`;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
@@ -38,8 +38,7 @@ export class LocalOdspDeltaStorageService implements IDocumentDeltaStorageServic
|
|
|
38
38
|
);
|
|
39
39
|
validateMessages("cached", messages, from, this.logger);
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
if (messages.length === 0 || messages[0]!.sequenceNumber !== from) {
|
|
41
|
+
if (messages.length === 0 || messages[0].sequenceNumber !== from) {
|
|
43
42
|
this.snapshotOps = [];
|
|
44
43
|
}
|
|
45
44
|
this.snapshotOps = this.snapshotOps.filter(
|