@fluid-experimental/ot 0.52.1 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ot.js +1 -1
- package/dist/ot.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/lib/ot.js +1 -1
- package/lib/ot.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/package.json +7 -7
- package/src/ot.ts +1 -1
- package/src/packageVersion.ts +1 -1
package/dist/ot.js
CHANGED
|
@@ -55,7 +55,7 @@ class SharedOT extends shared_object_base_1.SharedObject {
|
|
|
55
55
|
async loadCore(storage) {
|
|
56
56
|
const blob = await storage.readBlob("header");
|
|
57
57
|
const rawContent = common_utils_1.bufferToString(blob, "utf8");
|
|
58
|
-
this.global = this.local = this.
|
|
58
|
+
this.global = this.local = this.serializer.parse(rawContent);
|
|
59
59
|
}
|
|
60
60
|
registerCore() { }
|
|
61
61
|
onDisconnect() { }
|
package/dist/ot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ot.js","sourceRoot":"","sources":["../src/ot.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsE;AAEtE,+EAK8C;AAM9C,2EAAkE;AAQlE,MAAsB,QAAsB,SAAQ,iCAAY;IAyB5D,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B,EAAE,YAAoB;QACzG,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAzBnC;;;;WAIG;QACc,iBAAY,GAA4B,EAAE,CAAC;QAE5D;;;;WAIG;QACc,eAAU,GAAU,EAAE,CAAC;QAUhC,eAAU,GAAG,KAAK,CAAC;QAKvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;IAC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CAAC,CAAC;QAEhF,0FAA0F;QAC1F,OAAO;QACP,EAAE;QACF,qFAAqF;QACrF,0DAA0D;QAC1D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEpD,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;SAC3B;aAAM;YACH,2EAA2E;YAC3E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YAEvB,sFAAsF;YACtF,kDAAkD;YAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC7C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;aACrE;SACJ;IACL,CAAC;IAED,IAAc,KAAK;QACf,qFAAqF;QACrF,sCAAsC;QACtC,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;YAEzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE;gBAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;aAC/C;YAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;SAC3B;QAED,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AAlJD,4BAkJC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, bufferToString } from \"@fluidframework/common-utils\";\nimport { IFluidSerializer } from \"@fluidframework/core-interfaces\";\nimport {\n FileMode,\n ISequencedDocumentMessage,\n ITree,\n TreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport { SharedObject } from \"@fluidframework/shared-object-base\";\n\ninterface ISequencedOpInfo<TOp> {\n client: string;\n seq: number;\n op: TOp;\n}\n\nexport abstract class SharedOT<TState, TOp> extends SharedObject {\n /**\n * Queue of sequenced ops that are above minSeq. Used by 'processCore' to\n * adjust incoming ops to account for prior ops that the sender didn't know about\n * at the time they submitted their op.\n */\n private readonly sequencedOps: ISequencedOpInfo<TOp>[] = [];\n\n /**\n * Queue of local pending ops that have not yet been ACKed by the service. Used\n * to lazily rebuild the \"local\" state cache when it is invalidated by interleaved\n * remote ops.\n */\n private readonly pendingOps: TOp[] = [];\n\n /** The \"global\" state is the result of applying all sequenced ops. */\n private global: TState;\n\n /**\n * Lazily cached result of optimistically applying pendingOps on top of the current\n * \"global\" state.\n */\n private local: TState;\n private localDirty = false;\n\n constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, initialValue: TState) {\n super(id, runtime, attributes);\n\n this.global = this.local = initialValue;\n }\n\n protected apply(op: TOp) {\n this.local = this.applyCore(this.state, op);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n this.global = this.local;\n return;\n }\n\n this.pendingOps.push(op);\n this.submitLocalMessage(op);\n }\n\n /**\n * Apply the given 'op' to the provided 'state', producing a new instance of state.\n */\n protected abstract applyCore(state: TState, op: TOp): TState;\n\n /**\n * Transform the 'input' op to adjust for the earlier 'transform' op.\n */\n protected abstract transform(input: TOp, transform: TOp): TOp;\n\n protected snapshotCore(serializer: IFluidSerializer): ITree {\n // Summarizer must not have locally pending changes.\n assert(this.pendingOps.length === 0, 0);\n\n const tree: ITree = {\n entries: [{\n mode: FileMode.File,\n path: \"header\",\n type: TreeEntry.Blob,\n value: {\n contents: serializer.stringify(this.global, this.handle),\n encoding: \"utf-8\",\n },\n }],\n };\n\n return tree;\n }\n\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const blob = await storage.readBlob(\"header\");\n const rawContent = bufferToString(blob, \"utf8\");\n this.global = this.local = this.serializer.parse(rawContent);\n }\n\n protected registerCore() {}\n\n protected onDisconnect() { }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean) {\n // Discard any sequenced ops that are now below the minimum sequence number.\n const minSeq = this.runtime.deltaManager.minimumSequenceNumber;\n while (this.sequencedOps[0]?.seq < minSeq) {\n this.sequencedOps.shift();\n }\n\n let remoteOp = message.contents;\n const messageSeq = message.sequenceNumber;\n const remoteRefSeq = message.referenceSequenceNumber;\n const remoteClient = message.clientId;\n\n // Adjust the incoming sequenced op to account for prior sequenced ops that the\n // sender hadn't yet seen at the time they sent the op.\n for (const { op, seq, client } of this.sequencedOps) {\n if (remoteRefSeq < seq && remoteClient !== client) {\n remoteOp = this.transform(remoteOp, op);\n }\n }\n\n // Retain the adjusted op in order to adjust future remote ops.\n this.sequencedOps.push({ seq: messageSeq, client: remoteClient, op: remoteOp });\n\n // The incoming sequenced op is now part of the \"global\" state. Apply it to \"this.global\"\n // now.\n //\n // TODO: If the op is local, we could defer applying the remoteOp and wait and see if\n // the global state catches up with our local state.\n this.global = this.applyCore(this.global, remoteOp);\n\n if (local) {\n this.pendingOps.shift();\n } else {\n // Our optimistic local cache (if any) did not account for the incoming op.\n this.localDirty = true;\n\n // Adjust our queue of locally pending ops to account for the incoming op so that they\n // may be reapplied to the global state if needed.\n for (let i = 0; i < this.pendingOps.length; i++) {\n this.pendingOps[i] = this.transform(this.pendingOps[i], remoteOp);\n }\n }\n }\n\n protected get state() {\n // If the locally cached state is dirty, reset it to the global state and reapply our\n // pending ops to bring it up to date.\n if (this.localDirty) {\n this.local = this.global;\n\n for (const op of this.pendingOps) {\n this.local = this.applyCore(this.local, op);\n }\n\n this.localDirty = false;\n }\n\n return this.local;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluid-experimental/ot";
|
|
11
|
-
exports.pkgVersion = "0.
|
|
11
|
+
exports.pkgVersion = "0.54.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/ot\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/ot\";\nexport const pkgVersion = \"0.54.0\";\n"]}
|
package/lib/ot.js
CHANGED
|
@@ -52,7 +52,7 @@ export class SharedOT extends SharedObject {
|
|
|
52
52
|
async loadCore(storage) {
|
|
53
53
|
const blob = await storage.readBlob("header");
|
|
54
54
|
const rawContent = bufferToString(blob, "utf8");
|
|
55
|
-
this.global = this.local = this.
|
|
55
|
+
this.global = this.local = this.serializer.parse(rawContent);
|
|
56
56
|
}
|
|
57
57
|
registerCore() { }
|
|
58
58
|
onDisconnect() { }
|
package/lib/ot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ot.js","sourceRoot":"","sources":["../src/ot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EACH,QAAQ,EAGR,SAAS,GACZ,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAQlE,MAAM,OAAgB,QAAsB,SAAQ,YAAY;IAyB5D,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B,EAAE,YAAoB;QACzG,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAzBnC;;;;WAIG;QACc,iBAAY,GAA4B,EAAE,CAAC;QAE5D;;;;WAIG;QACc,eAAU,GAAU,EAAE,CAAC;QAUhC,eAAU,GAAG,KAAK,CAAC;QAKvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;IAC5C,CAAC;IAES,KAAK,CAAC,EAAO;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAE5C,+CAA+C;QAC/C,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;YACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,OAAO;SACV;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAYS,YAAY,CAAC,UAA4B;QAC/C,oDAAo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U,GAAG,IAAI,CAAC;YAEvB,sFAAsF;YACtF,kDAAkD;YAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC7C,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;aACrE;SACJ;IACL,CAAC;IAED,IAAc,KAAK;QACf,qFAAqF;QACrF,sCAAsC;QACtC,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;YAEzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE;gBAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;aAC/C;YAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;SAC3B;QAED,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, bufferToString } from \"@fluidframework/common-utils\";\nimport { IFluidSerializer } from \"@fluidframework/core-interfaces\";\nimport {\n FileMode,\n ISequencedDocumentMessage,\n ITree,\n TreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport { SharedObject } from \"@fluidframework/shared-object-base\";\n\ninterface ISequencedOpInfo<TOp> {\n client: string;\n seq: number;\n op: TOp;\n}\n\nexport abstract class SharedOT<TState, TOp> extends SharedObject {\n /**\n * Queue of sequenced ops that are above minSeq. Used by 'processCore' to\n * adjust incoming ops to account for prior ops that the sender didn't know about\n * at the time they submitted their op.\n */\n private readonly sequencedOps: ISequencedOpInfo<TOp>[] = [];\n\n /**\n * Queue of local pending ops that have not yet been ACKed by the service. Used\n * to lazily rebuild the \"local\" state cache when it is invalidated by interleaved\n * remote ops.\n */\n private readonly pendingOps: TOp[] = [];\n\n /** The \"global\" state is the result of applying all sequenced ops. */\n private global: TState;\n\n /**\n * Lazily cached result of optimistically applying pendingOps on top of the current\n * \"global\" state.\n */\n private local: TState;\n private localDirty = false;\n\n constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, initialValue: TState) {\n super(id, runtime, attributes);\n\n this.global = this.local = initialValue;\n }\n\n protected apply(op: TOp) {\n this.local = this.applyCore(this.state, op);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n this.global = this.local;\n return;\n }\n\n this.pendingOps.push(op);\n this.submitLocalMessage(op);\n }\n\n /**\n * Apply the given 'op' to the provided 'state', producing a new instance of state.\n */\n protected abstract applyCore(state: TState, op: TOp): TState;\n\n /**\n * Transform the 'input' op to adjust for the earlier 'transform' op.\n */\n protected abstract transform(input: TOp, transform: TOp): TOp;\n\n protected snapshotCore(serializer: IFluidSerializer): ITree {\n // Summarizer must not have locally pending changes.\n assert(this.pendingOps.length === 0, 0);\n\n const tree: ITree = {\n entries: [{\n mode: FileMode.File,\n path: \"header\",\n type: TreeEntry.Blob,\n value: {\n contents: serializer.stringify(this.global, this.handle),\n encoding: \"utf-8\",\n },\n }],\n };\n\n return tree;\n }\n\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const blob = await storage.readBlob(\"header\");\n const rawContent = bufferToString(blob, \"utf8\");\n this.global = this.local = this.serializer.parse(rawContent);\n }\n\n protected registerCore() {}\n\n protected onDisconnect() { }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean) {\n // Discard any sequenced ops that are now below the minimum sequence number.\n const minSeq = this.runtime.deltaManager.minimumSequenceNumber;\n while (this.sequencedOps[0]?.seq < minSeq) {\n this.sequencedOps.shift();\n }\n\n let remoteOp = message.contents;\n const messageSeq = message.sequenceNumber;\n const remoteRefSeq = message.referenceSequenceNumber;\n const remoteClient = message.clientId;\n\n // Adjust the incoming sequenced op to account for prior sequenced ops that the\n // sender hadn't yet seen at the time they sent the op.\n for (const { op, seq, client } of this.sequencedOps) {\n if (remoteRefSeq < seq && remoteClient !== client) {\n remoteOp = this.transform(remoteOp, op);\n }\n }\n\n // Retain the adjusted op in order to adjust future remote ops.\n this.sequencedOps.push({ seq: messageSeq, client: remoteClient, op: remoteOp });\n\n // The incoming sequenced op is now part of the \"global\" state. Apply it to \"this.global\"\n // now.\n //\n // TODO: If the op is local, we could defer applying the remoteOp and wait and see if\n // the global state catches up with our local state.\n this.global = this.applyCore(this.global, remoteOp);\n\n if (local) {\n this.pendingOps.shift();\n } else {\n // Our optimistic local cache (if any) did not account for the incoming op.\n this.localDirty = true;\n\n // Adjust our queue of locally pending ops to account for the incoming op so that they\n // may be reapplied to the global state if needed.\n for (let i = 0; i < this.pendingOps.length; i++) {\n this.pendingOps[i] = this.transform(this.pendingOps[i], remoteOp);\n }\n }\n }\n\n protected get state() {\n // If the locally cached state is dirty, reset it to the global state and reapply our\n // pending ops to bring it up to date.\n if (this.localDirty) {\n this.local = this.global;\n\n for (const op of this.pendingOps) {\n this.local = this.applyCore(this.local, op);\n }\n\n this.localDirty = false;\n }\n\n return this.local;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,wBAAwB,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/ot\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,wBAAwB,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/ot\";\nexport const pkgVersion = \"0.54.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/ot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"description": "Distributed data structure for hosting ottypes",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": "https://github.com/microsoft/FluidFramework",
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@fluidframework/common-utils": "^0.32.1",
|
|
59
59
|
"@fluidframework/core-interfaces": "^0.41.0",
|
|
60
|
-
"@fluidframework/datastore-definitions": "^0.
|
|
60
|
+
"@fluidframework/datastore-definitions": "^0.54.0",
|
|
61
61
|
"@fluidframework/protocol-definitions": "^0.1026.0",
|
|
62
|
-
"@fluidframework/shared-object-base": "^0.
|
|
62
|
+
"@fluidframework/shared-object-base": "^0.54.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@fluid-internal/test-dds-utils": "^0.
|
|
65
|
+
"@fluid-internal/test-dds-utils": "^0.54.0",
|
|
66
66
|
"@fluidframework/build-common": "^0.23.0",
|
|
67
67
|
"@fluidframework/eslint-config-fluid": "^0.24.0",
|
|
68
|
-
"@fluidframework/mocha-test-setup": "^0.
|
|
69
|
-
"@fluidframework/test-runtime-utils": "^0.
|
|
68
|
+
"@fluidframework/mocha-test-setup": "^0.54.0",
|
|
69
|
+
"@fluidframework/test-runtime-utils": "^0.54.0",
|
|
70
70
|
"@microsoft/api-extractor": "^7.16.1",
|
|
71
71
|
"@types/mocha": "^8.2.2",
|
|
72
|
-
"@types/node": "^
|
|
72
|
+
"@types/node": "^14.18.0",
|
|
73
73
|
"@typescript-eslint/eslint-plugin": "~4.14.0",
|
|
74
74
|
"@typescript-eslint/parser": "~4.14.0",
|
|
75
75
|
"best-random": "^1.0.0",
|
package/src/ot.ts
CHANGED
|
@@ -100,7 +100,7 @@ export abstract class SharedOT<TState, TOp> extends SharedObject {
|
|
|
100
100
|
protected async loadCore(storage: IChannelStorageService): Promise<void> {
|
|
101
101
|
const blob = await storage.readBlob("header");
|
|
102
102
|
const rawContent = bufferToString(blob, "utf8");
|
|
103
|
-
this.global = this.local = this.
|
|
103
|
+
this.global = this.local = this.serializer.parse(rawContent);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
protected registerCore() {}
|
package/src/packageVersion.ts
CHANGED