@fluid-experimental/ot 0.56.7 → 0.57.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/dist/ot.d.ts CHANGED
@@ -39,7 +39,6 @@ export declare abstract class SharedOT<TState, TOp> extends SharedObject {
39
39
  protected abstract transform(input: TOp, transform: TOp): TOp;
40
40
  protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
41
41
  protected loadCore(storage: IChannelStorageService): Promise<void>;
42
- protected registerCore(): void;
43
42
  protected onDisconnect(): void;
44
43
  protected processCore(message: ISequencedDocumentMessage, local: boolean): void;
45
44
  protected get state(): TState;
package/dist/ot.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ot.d.ts","sourceRoot":"","sources":["../src/ot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAA2B,gBAAgB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAQ7G,8BAAsB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAE,SAAQ,YAAY;IAC5D;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+B;IAE5D;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,sEAAsE;IACtE,OAAO,CAAC,MAAM,CAAS;IAEvB;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;gBAEf,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM;IAM7G,SAAS,CAAC,KAAK,CAAC,EAAE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AE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM;IAM7G,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG;IAavB;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,MAAM;IAE5D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG;IAE7D,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;cAO5D,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE,SAAS,CAAC,YAAY;IAEtB,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO;IA4CxE,SAAS,KAAK,KAAK,WAclB;IAED,SAAS,CAAC,cAAc;CAG3B"}
package/dist/ot.js CHANGED
@@ -45,7 +45,6 @@ class SharedOT extends shared_object_base_1.SharedObject {
45
45
  const rawContent = common_utils_1.bufferToString(blob, "utf8");
46
46
  this.global = this.local = this.serializer.parse(rawContent);
47
47
  }
48
- registerCore() { }
49
48
  onDisconnect() { }
50
49
  processCore(message, local) {
51
50
  var _a;
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;AAQtE,2EAA6G;AAQ7G,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,eA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,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;AAtID,4BAsIC","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 { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { createSingleBlobSummary, IFluidSerializer, 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 summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Summarizer must not have locally pending changes.\n assert(this.pendingOps.length === 0, 0);\n\n return createSingleBlobSummary(\"header\", serializer.stringify(this.global, this.handle));\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"]}
1
+ {"version":3,"file":"ot.js","sourceRoot":"","sources":["../src/ot.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsE;AAQtE,2EAA6G;AAQ7G,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;IAC5C,CAAC;IAES,KAAK,CAAC,EAAO;Q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ACrF,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;AApID,4BAoIC","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 { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { createSingleBlobSummary, IFluidSerializer, 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 summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Summarizer must not have locally pending changes.\n assert(this.pendingOps.length === 0, 0);\n\n return createSingleBlobSummary(\"header\", serializer.stringify(this.global, this.handle));\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 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"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluid-experimental/ot";
8
- export declare const pkgVersion = "0.56.7";
8
+ export declare const pkgVersion = "0.57.1";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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.56.7";
11
+ exports.pkgVersion = "0.57.1";
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.56.7\";\n"]}
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.57.1\";\n"]}
package/lib/ot.d.ts CHANGED
@@ -39,7 +39,6 @@ export declare abstract class SharedOT<TState, TOp> extends SharedObject {
39
39
  protected abstract transform(input: TOp, transform: TOp): TOp;
40
40
  protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
41
41
  protected loadCore(storage: IChannelStorageService): Promise<void>;
42
- protected registerCore(): void;
43
42
  protected onDisconnect(): void;
44
43
  protected processCore(message: ISequencedDocumentMessage, local: boolean): void;
45
44
  protected get state(): TState;
package/lib/ot.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ot.d.ts","sourceRoot":"","sources":["../src/ot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAA2B,gBAAgB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAQ7G,8BAAsB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAE,SAAQ,YAAY;IAC5D;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAA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AQ7G,8BAAsB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAE,SAAQ,YAAY;IAC5D;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+B;IAE5D;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,sEAAsE;IACtE,OAAO,CAAC,MAAM,CAAS;IAEvB;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;gBAEf,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM;IAM7G,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG;IAavB;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,MAAM;IAE5D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG;IAE7D,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;cAO5D,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE,SAAS,CAAC,YAAY;IAEtB,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO;IA4CxE,SAAS,KAAK,KAAK,WAclB;IAED,SAAS,CAAC,cAAc;CAG3B"}
package/lib/ot.js CHANGED
@@ -42,7 +42,6 @@ export class SharedOT extends SharedObject {
42
42
  const rawContent = bufferToString(blob, "utf8");
43
43
  this.global = this.local = this.serializer.parse(rawContent);
44
44
  }
45
- registerCore() { }
46
45
  onDisconnect() { }
47
46
  processCore(message, local) {
48
47
  var _a;
package/lib/ot.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ot.js","sourceR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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","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 { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { createSingleBlobSummary, IFluidSerializer, 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 summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Summarizer must not have locally pending changes.\n assert(this.pendingOps.length === 0, 0);\n\n return createSingleBlobSummary(\"header\", serializer.stringify(this.global, this.handle));\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"]}
1
+ {"version":3,"file":"ot.js","sourceRoot":"","sources":["../src/ot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAA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AM,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","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 { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { createSingleBlobSummary, IFluidSerializer, 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 summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Summarizer must not have locally pending changes.\n assert(this.pendingOps.length === 0, 0);\n\n return createSingleBlobSummary(\"header\", serializer.stringify(this.global, this.handle));\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 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"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluid-experimental/ot";
8
- export declare const pkgVersion = "0.56.7";
8
+ export declare const pkgVersion = "0.57.1";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluid-experimental/ot";
8
- export const pkgVersion = "0.56.7";
8
+ export const pkgVersion = "0.57.1";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -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.56.7\";\n"]}
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.57.1\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-experimental/ot",
3
- "version": "0.56.7",
3
+ "version": "0.57.1",
4
4
  "description": "Distributed data structure for hosting ottypes",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": "https://github.com/microsoft/FluidFramework",
@@ -57,17 +57,17 @@
57
57
  "dependencies": {
58
58
  "@fluidframework/common-utils": "^0.32.1",
59
59
  "@fluidframework/core-interfaces": "^0.42.0",
60
- "@fluidframework/datastore-definitions": "^0.56.7",
60
+ "@fluidframework/datastore-definitions": "^0.57.1",
61
61
  "@fluidframework/protocol-definitions": "^0.1026.0",
62
- "@fluidframework/runtime-definitions": "^0.56.7",
63
- "@fluidframework/shared-object-base": "^0.56.7"
62
+ "@fluidframework/runtime-definitions": "^0.57.1",
63
+ "@fluidframework/shared-object-base": "^0.57.1"
64
64
  },
65
65
  "devDependencies": {
66
- "@fluid-internal/test-dds-utils": "^0.56.7",
66
+ "@fluid-internal/test-dds-utils": "^0.57.1",
67
67
  "@fluidframework/build-common": "^0.23.0",
68
- "@fluidframework/eslint-config-fluid": "^0.25.0",
69
- "@fluidframework/mocha-test-setup": "^0.56.7",
70
- "@fluidframework/test-runtime-utils": "^0.56.7",
68
+ "@fluidframework/eslint-config-fluid": "^0.26.0",
69
+ "@fluidframework/mocha-test-setup": "^0.57.1",
70
+ "@fluidframework/test-runtime-utils": "^0.57.1",
71
71
  "@microsoft/api-extractor": "^7.16.1",
72
72
  "@rushstack/eslint-config": "^2.5.1",
73
73
  "@types/mocha": "^8.2.2",
package/src/ot.ts CHANGED
@@ -86,8 +86,6 @@ export abstract class SharedOT<TState, TOp> extends SharedObject {
86
86
  this.global = this.local = this.serializer.parse(rawContent);
87
87
  }
88
88
 
89
- protected registerCore() {}
90
-
91
89
  protected onDisconnect() { }
92
90
 
93
91
  protected processCore(message: ISequencedDocumentMessage, local: boolean) {
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluid-experimental/ot";
9
- export const pkgVersion = "0.56.7";
9
+ export const pkgVersion = "0.57.1";