@fluidframework/test-runtime-utils 2.74.0-368706 → 2.74.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/assertTagging.config.mjs +1 -1
  3. package/dist/assertionShortCodesMap.d.ts +8 -15
  4. package/dist/assertionShortCodesMap.d.ts.map +1 -1
  5. package/dist/assertionShortCodesMap.js +9 -16
  6. package/dist/assertionShortCodesMap.js.map +1 -1
  7. package/dist/deepFreeze.js.map +1 -1
  8. package/dist/mockDeltas.d.ts.map +1 -1
  9. package/dist/mockDeltas.js.map +1 -1
  10. package/dist/mockStorage.d.ts.map +1 -1
  11. package/dist/mockStorage.js.map +1 -1
  12. package/dist/mocks.d.ts.map +1 -1
  13. package/dist/mocks.js.map +1 -1
  14. package/dist/mocksDataStoreContext.d.ts.map +1 -1
  15. package/dist/mocksDataStoreContext.js.map +1 -1
  16. package/dist/mocksForReconnection.d.ts.map +1 -1
  17. package/dist/mocksForReconnection.js.map +1 -1
  18. package/eslint.config.mts +30 -0
  19. package/lib/assertionShortCodesMap.d.ts +8 -15
  20. package/lib/assertionShortCodesMap.d.ts.map +1 -1
  21. package/lib/assertionShortCodesMap.js +9 -16
  22. package/lib/assertionShortCodesMap.js.map +1 -1
  23. package/lib/deepFreeze.js.map +1 -1
  24. package/lib/mockDeltas.d.ts.map +1 -1
  25. package/lib/mockDeltas.js.map +1 -1
  26. package/lib/mockStorage.d.ts.map +1 -1
  27. package/lib/mockStorage.js.map +1 -1
  28. package/lib/mocks.d.ts.map +1 -1
  29. package/lib/mocks.js.map +1 -1
  30. package/lib/mocksDataStoreContext.d.ts.map +1 -1
  31. package/lib/mocksDataStoreContext.js.map +1 -1
  32. package/lib/mocksForReconnection.d.ts.map +1 -1
  33. package/lib/mocksForReconnection.js.map +1 -1
  34. package/package.json +19 -18
  35. package/src/assertionShortCodesMap.ts +9 -16
  36. package/src/deepFreeze.ts +1 -1
  37. package/src/mockDeltas.ts +9 -9
  38. package/src/mockStorage.ts +1 -1
  39. package/src/mocks.ts +39 -36
  40. package/src/mocksDataStoreContext.ts +5 -1
  41. package/src/mocksForReconnection.ts +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"mocksForReconnection.js","sourceRoot":"","sources":["../src/mocksForReconnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAGkD;AAClD,+BAAkC;AAElC,yCAMoB;AAEpB;;;GAGG;AACH,MAAa,mCAAoC,SAAQ,+BAAoB;IAM5E;;;;;OAKG;IACH,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,IAAW,SAAS,CAAC,SAAkB;QACtC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAES,sBAAsB,CAAC,eAA4C;QAC5E,KAAK,MAAM,aAAa,IAAI,eAAe,EAAE,CAAC;YAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;IAES,iBAAiB,CAAC,SAAkB;QAC7C,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO;QACR,CAAC;QAED,IAAA,8BAAmB,EAAC,IAAA,4BAAiB,GAAE,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAC1D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,IAAI,SAAS,EAAE,CAAC;YACf,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YACxD,IAAI,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;YACtC,IAAI,CAAC,YAAY,CAAC,oBAAoB,GAAG,CAAC,CAAC;YAC3C,gDAAgD;YAChD,IAAI,CAAC,QAAQ,GAAG,IAAA,SAAI,GAAE,CAAC;YACvB,gDAAgD;YAChD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,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CAAC,CAAC;QAC1F,kCAAkC;QAClC,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,oBAAoB,CACzB,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,kBAAkB,CAC7D,CAAC;QACH,CAAC;QACD,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACrF,CAAC;QACD,0CAA0C;QAC1C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;CACD;AAnMD,kFAmMC;AAED;;;GAGG;AACH,MAAa,0CAA2C,SAAQ,sCAA2B;IACjF,sBAAsB,CAC9B,gBAA2C,EAC3C,SAAwE;QAExE,MAAM,gBAAgB,GAAG,IAAI,mCAAmC,CAC/D,gBAAgB,EAChB,IAAI,EACJ,IAAI,CAAC,cAAc,EACnB,SAAS,CACT,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACpC,OAAO,gBAAgB,CAAC;IACzB,CAAC;IAEM,8BAA8B,CAAC,QAAgB;QACrD,8DAA8D;QAC9D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAkC,EAAE,EAAE;YAC3E,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AArBD,gGAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tcreateChildLogger,\n\traiseConnectedEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\ttype IMockContainerRuntimeIdAllocationMessage,\n\tIMockContainerRuntimeOptions,\n\tMockContainerRuntime,\n\tMockContainerRuntimeFactory,\n\tMockFluidDataStoreRuntime,\n} from \"./mocks.js\";\n\n/**\n * Specialized implementation of MockContainerRuntime for testing ops during reconnection.\n * @legacy @beta\n */\nexport class MockContainerRuntimeForReconnection extends MockContainerRuntime {\n\t/**\n\t * Contains messages from other clients that were sequenced while this runtime was marked as disconnected.\n\t */\n\tprotected readonly pendingRemoteMessages: ISequencedDocumentMessage[] = [];\n\n\t/**\n\t * Returns the connection state of the container runtime.\n\t * Any messages that are submitted while not connected will be resubmitted via the resubmit flow on reconnection.\n\t * Any messages received while disconnected will be processed on reconnection.\n\t * Also, the clientId of the runtime will change on reconnection.\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\tpublic set connected(connected: boolean) {\n\t\tthis.setConnectedState(connected);\n\t}\n\n\tprotected processPendingMessages(pendingMessages: ISequencedDocumentMessage[]) {\n\t\tfor (const remoteMessage of pendingMessages) {\n\t\t\tthis.process(remoteMessage);\n\t\t}\n\t}\n\n\tprotected setConnectedState(connected: boolean): void {\n\t\tif (this._connected === connected) {\n\t\t\treturn;\n\t\t}\n\n\t\traiseConnectedEvent(createChildLogger(), this, connected);\n\t\tthis._connected = connected;\n\n\t\tif (connected) {\n\t\t\tthis.processPendingMessages(this.pendingRemoteMessages);\n\t\t\tthis.pendingRemoteMessages.length = 0;\n\t\t\tthis.deltaManager.clientSequenceNumber = 0;\n\t\t\t// We should get a new clientId on reconnection.\n\t\t\tthis.clientId = uuid();\n\t\t\t// Update the clientId in FluidDataStoreRuntime.\n\t\t\tthis.dataStoreRuntime.clientId = this.clientId;\n\t\t\tthis.factory.quorum.addMember(this.clientId, {});\n\t\t\t// On reconnection, ask the DDSes to resubmit pending messages.\n\t\t\tconst messagesToResubmit = this.pendingMessages.slice();\n\t\t\tthis.pendingMessages.length = 0;\n\t\t\tthis.reSubmitMessages(messagesToResubmit);\n\t\t} else {\n\t\t\t// On disconnection, clear any outstanding messages for this client because it will be resent.\n\t\t\tthis.factory.clearOutstandingClientMessages(this.clientId);\n\t\t\tthis.factory.quorum.removeMember(this.clientId);\n\t\t\tfor (const message of this.outbox) {\n\t\t\t\tthis.addPendingMessage(\n\t\t\t\t\tmessage.content,\n\t\t\t\t\tmessage.localOpMetadata,\n\t\t\t\t\t++this.deltaManager.clientSequenceNumber,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.outbox.length = 0;\n\t\t}\n\n\t\t// Let the DDSes know that the connection state changed.\n\t\tthis.dataStoreRuntime.setConnectionState(this.connected, this.clientId);\n\t}\n\n\tprivate _connected = true;\n\tprotected readonly processedOps?: ISequencedDocumentMessage[];\n\tconstructor(\n\t\tdataStoreRuntime: MockFluidDataStoreRuntime,\n\t\tprotected override readonly factory: MockContainerRuntimeFactoryForReconnection,\n\t\truntimeOptions: IMockContainerRuntimeOptions = {},\n\t\toverrides?: { minimumSequenceNumber?: number; trackRemoteOps?: boolean },\n\t) {\n\t\tsuper(dataStoreRuntime, factory, runtimeOptions, overrides);\n\t\tif (overrides?.trackRemoteOps === true) {\n\t\t\tthis.processedOps = [];\n\t\t}\n\t}\n\n\toverride process(message: ISequencedDocumentMessage) {\n\t\tif (this.connected) {\n\t\t\tthis.processedOps?.push(message);\n\t\t\tsuper.process(message);\n\t\t} else {\n\t\t\tthis.pendingRemoteMessages.push(message);\n\t\t}\n\t}\n\n\toverride submit(messageContent: any, localOpMetadata: unknown) {\n\t\t// Submit messages only if we are connection, otherwise, just add it to the pending queue.\n\t\tif (this.connected) {\n\t\t\treturn super.submit(messageContent, localOpMetadata);\n\t\t}\n\n\t\tthis.addPendingMessage(messageContent, localOpMetadata, -1);\n\t\treturn -1;\n\t}\n\n\toverride flush() {\n\t\t// Flush messages only if we are connected, otherwise, just ignore it.\n\t\tif (this.connected) {\n\t\t\tsuper.flush();\n\t\t}\n\t}\n\n\tpublic async initializeWithStashedOps(\n\t\tfromContainerRuntime: MockContainerRuntimeForReconnection,\n\t) {\n\t\tif (this.pendingMessages.length !== 0 || this.deltaManager.clientSequenceNumber !== 0) {\n\t\t\tthrow new Error(\"applyStashedOps must be called first, and once.\");\n\t\t}\n\n\t\tif (fromContainerRuntime.processedOps === undefined) {\n\t\t\tthrow new Error(\"containerRuntime must have trackRemoteOps true\");\n\t\t}\n\n\t\t// shutdown the existing client\n\t\tfromContainerRuntime.connected = false;\n\t\tfromContainerRuntime.flush();\n\t\tthis.factory.removeContainerRuntime(fromContainerRuntime);\n\t\t// clear any unprocessed ops for this client\n\t\tthis.factory.clearOutstandingClientMessages(fromContainerRuntime.clientId);\n\n\t\t// get the saved ops seen by the client, and its pending ops\n\t\tconst pendingMessages = fromContainerRuntime.pendingMessages.splice(0);\n\t\tconst remoteOps = [\n\t\t\t...fromContainerRuntime.processedOps.splice(0),\n\t\t\t...fromContainerRuntime.pendingRemoteMessages.splice(0),\n\t\t];\n\n\t\t// ensure no ops are sent to, or produced by the old client\n\t\t// this can help find bugs in the the harness\n\t\tObject.freeze(fromContainerRuntime.pendingMessages);\n\t\tObject.freeze(fromContainerRuntime.pendingRemoteMessages);\n\t\tObject.freeze(fromContainerRuntime.processedOps);\n\n\t\tlet refSeq = Math.min(\n\t\t\tremoteOps[0]?.referenceSequenceNumber ?? Number.MAX_SAFE_INTEGER,\n\t\t\tpendingMessages[0]?.referenceSequenceNumber ?? Number.MAX_SAFE_INTEGER,\n\t\t);\n\t\tif (refSeq === Number.MAX_SAFE_INTEGER) {\n\t\t\trefSeq = 0;\n\t\t}\n\t\tif (\n\t\t\tthis.dataStoreRuntime.deltaManagerInternal.lastSequenceNumber !== refSeq ||\n\t\t\tthis.dataStoreRuntime.deltaManagerInternal.minimumSequenceNumber !== refSeq\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"computed min and ref seq don't match the loaded values; this indicates a bad load, or missing messages\",\n\t\t\t);\n\t\t}\n\n\t\tconst stashedOps = new Map<number, any>();\n\n\t\tremoteOps.forEach((op) => {\n\t\t\tif (op.clientId === this.clientId) {\n\t\t\t\tconst ops = stashedOps.get(op.referenceSequenceNumber) ?? [];\n\t\t\t\tops.push(op.contents);\n\t\t\t\tstashedOps.set(op.referenceSequenceNumber, ops);\n\t\t\t}\n\t\t});\n\t\tpendingMessages.forEach((op) => {\n\t\t\tconst ops = stashedOps.get(op.referenceSequenceNumber) ?? [];\n\t\t\tops.push(op.content);\n\t\t\tstashedOps.set(op.referenceSequenceNumber, ops);\n\t\t});\n\n\t\tconst applyStashedOpsAtSeq = async (seq: number) => {\n\t\t\tconst pendingAtSeq = stashedOps.get(seq);\n\t\t\tfor (const message of pendingAtSeq ?? []) {\n\t\t\t\t// As in production, do not locally apply any stashed ID allocation messages.\n\t\t\t\t// Instead, simply resubmit them.\n\t\t\t\tif ((message as IMockContainerRuntimeIdAllocationMessage).type === \"idAllocation\") {\n\t\t\t\t\tthis.submit(message, undefined);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.dataStoreRuntime.applyStashedOp(message);\n\t\t\t\t}\n\t\t\t}\n\t\t\tstashedOps.delete(seq);\n\t\t};\n\t\tawait applyStashedOpsAtSeq(this.dataStoreRuntime.deltaManagerInternal.lastSequenceNumber);\n\t\t// apply the saved and pending ops\n\t\tfor (const savedOp of remoteOps) {\n\t\t\tthis.process(savedOp);\n\t\t\tawait applyStashedOpsAtSeq(\n\t\t\t\tthis.dataStoreRuntime.deltaManagerInternal.lastSequenceNumber,\n\t\t\t);\n\t\t}\n\t\tif (stashedOps.size !== 0) {\n\t\t\tthrow new Error(\"There should be no pending message after saved ops are processed\");\n\t\t}\n\t\t// issue a reconnect to rebase pending ops\n\t\tthis.connected = false;\n\t\tthis.connected = true;\n\t}\n}\n\n/**\n * Specialized implementation of MockContainerRuntimeFactory for testing ops during reconnection.\n * @legacy @beta\n */\nexport class MockContainerRuntimeFactoryForReconnection extends MockContainerRuntimeFactory {\n\toverride createContainerRuntime(\n\t\tdataStoreRuntime: MockFluidDataStoreRuntime,\n\t\toverrides?: { minimumSequenceNumber?: number; trackRemoteOps?: boolean },\n\t): MockContainerRuntimeForReconnection {\n\t\tconst containerRuntime = new MockContainerRuntimeForReconnection(\n\t\t\tdataStoreRuntime,\n\t\t\tthis,\n\t\t\tthis.runtimeOptions,\n\t\t\toverrides,\n\t\t);\n\t\tthis.runtimes.add(containerRuntime);\n\t\treturn containerRuntime;\n\t}\n\n\tpublic clearOutstandingClientMessages(clientId: string) {\n\t\t// Delete all the messages for client with the given clientId.\n\t\tthis.messages = this.messages.filter((message: ISequencedDocumentMessage) => {\n\t\t\treturn message.clientId !== clientId;\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"mocksForReconnection.js","sourceRoot":"","sources":["../src/mocksForReconnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAGkD;AAClD,+BAAkC;AAElC,yCAMoB;AAEpB;;;GAGG;AACH,MAAa,mCAAoC,SAAQ,+BAAoB;IAM5E;;;;;OAKG;IACH,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,IAAW,SAAS,CAAC,SAAkB;QACtC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAES,sBAAsB,CAAC,eAA4C;QAC5E,KAAK,MAAM,aAAa,IAAI,eAAe,EAAE,CAAC;YAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC7B,CAAC;IACF,CAAC;IAES,iBAAiB,CAAC,SAAkB;QAC7C,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO;QACR,CAAC;QAED,IAAA,8BAAmB,EAAC,IAAA,4BAAiB,GAAE,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAC1D,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,IAAI,SAAS,EAAE,CAAC;YACf,IAAI,CAAC,sBAAs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AAK,QAAQ,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AArBD,gGAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tcreateChildLogger,\n\traiseConnectedEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\ttype IMockContainerRuntimeIdAllocationMessage,\n\tIMockContainerRuntimeOptions,\n\tMockContainerRuntime,\n\tMockContainerRuntimeFactory,\n\tMockFluidDataStoreRuntime,\n} from \"./mocks.js\";\n\n/**\n * Specialized implementation of MockContainerRuntime for testing ops during reconnection.\n * @legacy @beta\n */\nexport class MockContainerRuntimeForReconnection extends MockContainerRuntime {\n\t/**\n\t * Contains messages from other clients that were sequenced while this runtime was marked as disconnected.\n\t */\n\tprotected readonly pendingRemoteMessages: ISequencedDocumentMessage[] = [];\n\n\t/**\n\t * Returns the connection state of the container runtime.\n\t * Any messages that are submitted while not connected will be resubmitted via the resubmit flow on reconnection.\n\t * Any messages received while disconnected will be processed on reconnection.\n\t * Also, the clientId of the runtime will change on reconnection.\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\tpublic set connected(connected: boolean) {\n\t\tthis.setConnectedState(connected);\n\t}\n\n\tprotected processPendingMessages(pendingMessages: ISequencedDocumentMessage[]): void {\n\t\tfor (const remoteMessage of pendingMessages) {\n\t\t\tthis.process(remoteMessage);\n\t\t}\n\t}\n\n\tprotected setConnectedState(connected: boolean): void {\n\t\tif (this._connected === connected) {\n\t\t\treturn;\n\t\t}\n\n\t\traiseConnectedEvent(createChildLogger(), this, connected);\n\t\tthis._connected = connected;\n\n\t\tif (connected) {\n\t\t\tthis.processPendingMessages(this.pendingRemoteMessages);\n\t\t\tthis.pendingRemoteMessages.length = 0;\n\t\t\tthis.deltaManager.clientSequenceNumber = 0;\n\t\t\t// We should get a new clientId on reconnection.\n\t\t\tthis.clientId = uuid();\n\t\t\t// Update the clientId in FluidDataStoreRuntime.\n\t\t\tthis.dataStoreRuntime.clientId = this.clientId;\n\t\t\tthis.factory.quorum.addMember(this.clientId, {});\n\t\t\t// On reconnection, ask the DDSes to resubmit pending messages.\n\t\t\tconst messagesToResubmit = this.pendingMessages.slice();\n\t\t\tthis.pendingMessages.length = 0;\n\t\t\tthis.reSubmitMessages(messagesToResubmit);\n\t\t} else {\n\t\t\t// On disconnection, clear any outstanding messages for this client because it will be resent.\n\t\t\tthis.factory.clearOutstandingClientMessages(this.clientId);\n\t\t\tthis.factory.quorum.removeMember(this.clientId);\n\t\t\tfor (const message of this.outbox) {\n\t\t\t\tthis.addPendingMessage(\n\t\t\t\t\tmessage.content,\n\t\t\t\t\tmessage.localOpMetadata,\n\t\t\t\t\t++this.deltaManager.clientSequenceNumber,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.outbox.length = 0;\n\t\t}\n\n\t\t// Let the DDSes know that the connection state changed.\n\t\tthis.dataStoreRuntime.setConnectionState(this.connected, this.clientId);\n\t}\n\n\tprivate _connected = true;\n\tprotected readonly processedOps?: ISequencedDocumentMessage[];\n\tconstructor(\n\t\tdataStoreRuntime: MockFluidDataStoreRuntime,\n\t\tprotected override readonly factory: MockContainerRuntimeFactoryForReconnection,\n\t\truntimeOptions: IMockContainerRuntimeOptions = {},\n\t\toverrides?: { minimumSequenceNumber?: number; trackRemoteOps?: boolean },\n\t) {\n\t\tsuper(dataStoreRuntime, factory, runtimeOptions, overrides);\n\t\tif (overrides?.trackRemoteOps === true) {\n\t\t\tthis.processedOps = [];\n\t\t}\n\t}\n\n\toverride process(message: ISequencedDocumentMessage): void {\n\t\tif (this.connected) {\n\t\t\tthis.processedOps?.push(message);\n\t\t\tsuper.process(message);\n\t\t} else {\n\t\t\tthis.pendingRemoteMessages.push(message);\n\t\t}\n\t}\n\n\toverride submit(messageContent: any, localOpMetadata: unknown): number {\n\t\t// Submit messages only if we are connection, otherwise, just add it to the pending queue.\n\t\tif (this.connected) {\n\t\t\treturn super.submit(messageContent, localOpMetadata);\n\t\t}\n\n\t\tthis.addPendingMessage(messageContent, localOpMetadata, -1);\n\t\treturn -1;\n\t}\n\n\toverride flush(): void {\n\t\t// Flush messages only if we are connected, otherwise, just ignore it.\n\t\tif (this.connected) {\n\t\t\tsuper.flush();\n\t\t}\n\t}\n\n\tpublic async initializeWithStashedOps(\n\t\tfromContainerRuntime: MockContainerRuntimeForReconnection,\n\t): Promise<void> {\n\t\tif (this.pendingMessages.length !== 0 || this.deltaManager.clientSequenceNumber !== 0) {\n\t\t\tthrow new Error(\"applyStashedOps must be called first, and once.\");\n\t\t}\n\n\t\tif (fromContainerRuntime.processedOps === undefined) {\n\t\t\tthrow new Error(\"containerRuntime must have trackRemoteOps true\");\n\t\t}\n\n\t\t// shutdown the existing client\n\t\tfromContainerRuntime.connected = false;\n\t\tfromContainerRuntime.flush();\n\t\tthis.factory.removeContainerRuntime(fromContainerRuntime);\n\t\t// clear any unprocessed ops for this client\n\t\tthis.factory.clearOutstandingClientMessages(fromContainerRuntime.clientId);\n\n\t\t// get the saved ops seen by the client, and its pending ops\n\t\tconst pendingMessages = fromContainerRuntime.pendingMessages.splice(0);\n\t\tconst remoteOps = [\n\t\t\t...fromContainerRuntime.processedOps.splice(0),\n\t\t\t...fromContainerRuntime.pendingRemoteMessages.splice(0),\n\t\t];\n\n\t\t// ensure no ops are sent to, or produced by the old client\n\t\t// this can help find bugs in the the harness\n\t\tObject.freeze(fromContainerRuntime.pendingMessages);\n\t\tObject.freeze(fromContainerRuntime.pendingRemoteMessages);\n\t\tObject.freeze(fromContainerRuntime.processedOps);\n\n\t\tlet refSeq = Math.min(\n\t\t\tremoteOps[0]?.referenceSequenceNumber ?? Number.MAX_SAFE_INTEGER,\n\t\t\tpendingMessages[0]?.referenceSequenceNumber ?? Number.MAX_SAFE_INTEGER,\n\t\t);\n\t\tif (refSeq === Number.MAX_SAFE_INTEGER) {\n\t\t\trefSeq = 0;\n\t\t}\n\t\tif (\n\t\t\tthis.dataStoreRuntime.deltaManagerInternal.lastSequenceNumber !== refSeq ||\n\t\t\tthis.dataStoreRuntime.deltaManagerInternal.minimumSequenceNumber !== refSeq\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"computed min and ref seq don't match the loaded values; this indicates a bad load, or missing messages\",\n\t\t\t);\n\t\t}\n\n\t\tconst stashedOps = new Map<number, any>();\n\n\t\tremoteOps.forEach((op) => {\n\t\t\tif (op.clientId === this.clientId) {\n\t\t\t\tconst ops = stashedOps.get(op.referenceSequenceNumber) ?? [];\n\t\t\t\tops.push(op.contents);\n\t\t\t\tstashedOps.set(op.referenceSequenceNumber, ops);\n\t\t\t}\n\t\t});\n\t\tpendingMessages.forEach((op) => {\n\t\t\tconst ops = stashedOps.get(op.referenceSequenceNumber) ?? [];\n\t\t\tops.push(op.content);\n\t\t\tstashedOps.set(op.referenceSequenceNumber, ops);\n\t\t});\n\n\t\tconst applyStashedOpsAtSeq = async (seq: number): Promise<void> => {\n\t\t\tconst pendingAtSeq = stashedOps.get(seq);\n\t\t\tfor (const message of pendingAtSeq ?? []) {\n\t\t\t\t// As in production, do not locally apply any stashed ID allocation messages.\n\t\t\t\t// Instead, simply resubmit them.\n\t\t\t\tif ((message as IMockContainerRuntimeIdAllocationMessage).type === \"idAllocation\") {\n\t\t\t\t\tthis.submit(message, undefined);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.dataStoreRuntime.applyStashedOp(message);\n\t\t\t\t}\n\t\t\t}\n\t\t\tstashedOps.delete(seq);\n\t\t};\n\t\tawait applyStashedOpsAtSeq(this.dataStoreRuntime.deltaManagerInternal.lastSequenceNumber);\n\t\t// apply the saved and pending ops\n\t\tfor (const savedOp of remoteOps) {\n\t\t\tthis.process(savedOp);\n\t\t\tawait applyStashedOpsAtSeq(\n\t\t\t\tthis.dataStoreRuntime.deltaManagerInternal.lastSequenceNumber,\n\t\t\t);\n\t\t}\n\t\tif (stashedOps.size !== 0) {\n\t\t\tthrow new Error(\"There should be no pending message after saved ops are processed\");\n\t\t}\n\t\t// issue a reconnect to rebase pending ops\n\t\tthis.connected = false;\n\t\tthis.connected = true;\n\t}\n}\n\n/**\n * Specialized implementation of MockContainerRuntimeFactory for testing ops during reconnection.\n * @legacy @beta\n */\nexport class MockContainerRuntimeFactoryForReconnection extends MockContainerRuntimeFactory {\n\toverride createContainerRuntime(\n\t\tdataStoreRuntime: MockFluidDataStoreRuntime,\n\t\toverrides?: { minimumSequenceNumber?: number; trackRemoteOps?: boolean },\n\t): MockContainerRuntimeForReconnection {\n\t\tconst containerRuntime = new MockContainerRuntimeForReconnection(\n\t\t\tdataStoreRuntime,\n\t\t\tthis,\n\t\t\tthis.runtimeOptions,\n\t\t\toverrides,\n\t\t);\n\t\tthis.runtimes.add(containerRuntime);\n\t\treturn containerRuntime;\n\t}\n\n\tpublic clearOutstandingClientMessages(clientId: string): void {\n\t\t// Delete all the messages for client with the given clientId.\n\t\tthis.messages = this.messages.filter((message: ISequencedDocumentMessage) => {\n\t\t\treturn message.clientId !== clientId;\n\t\t});\n\t}\n}\n"]}
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * GENERATED FILE - DO NOT EDIT DIRECTLY.
4
+ * To regenerate: pnpm tsx scripts/generate-flat-eslint-configs.ts --typescript
5
+ */
6
+ import type { Linter } from "eslint";
7
+ import { minimalDeprecated } from "../../../common/build/eslint-config-fluid/flat.mts";
8
+
9
+ const config: Linter.Config[] = [
10
+ ...minimalDeprecated,
11
+ {
12
+ rules: {
13
+ "@typescript-eslint/strict-boolean-expressions": "off",
14
+ },
15
+ },
16
+ {
17
+ files: ["src/assertionShortCodesMap.ts"],
18
+ rules: {
19
+ "@typescript-eslint/comma-dangle": "off",
20
+ },
21
+ },
22
+ {
23
+ files: ["src/test/**"],
24
+ rules: {
25
+ "import-x/no-nodejs-modules": "off",
26
+ },
27
+ },
28
+ ];
29
+
30
+ export default config;
@@ -1419,18 +1419,6 @@ export declare const shortCodeMap: {
1419
1419
  "0xa6f": string;
1420
1420
  "0xa70": string;
1421
1421
  "0xa71": string;
1422
- "0xa73": string;
1423
- "0xa74": string;
1424
- "0xa75": string;
1425
- "0xa76": string;
1426
- "0xa77": string;
1427
- "0xa78": string;
1428
- "0xa79": string;
1429
- "0xa7a": string;
1430
- "0xa7b": string;
1431
- "0xa7c": string;
1432
- "0xa7d": string;
1433
- "0xa7e": string;
1434
1422
  "0xa7f": string;
1435
1423
  "0xa80": string;
1436
1424
  "0xa83": string;
@@ -1621,7 +1609,6 @@ export declare const shortCodeMap: {
1621
1609
  "0xb5d": string;
1622
1610
  "0xb5e": string;
1623
1611
  "0xb5f": string;
1624
- "0xb60": string;
1625
1612
  "0xb61": string;
1626
1613
  "0xb62": string;
1627
1614
  "0xb63": string;
@@ -1774,7 +1761,6 @@ export declare const shortCodeMap: {
1774
1761
  "0xc16": string;
1775
1762
  "0xc17": string;
1776
1763
  "0xc1a": string;
1777
- "0xc1b": string;
1778
1764
  "0xc1e": string;
1779
1765
  "0xc1f": string;
1780
1766
  "0xc20": string;
@@ -1838,7 +1824,6 @@ export declare const shortCodeMap: {
1838
1824
  "0xc62": string;
1839
1825
  "0xc63": string;
1840
1826
  "0xc64": string;
1841
- "0xc65": string;
1842
1827
  "0xc66": string;
1843
1828
  "0xc67": string;
1844
1829
  "0xc68": string;
@@ -1900,5 +1885,13 @@ export declare const shortCodeMap: {
1900
1885
  "0xca1": string;
1901
1886
  "0xca2": string;
1902
1887
  "0xca3": string;
1888
+ "0xca4": string;
1889
+ "0xca5": string;
1890
+ "0xca6": string;
1891
+ "0xca7": string;
1892
+ "0xca8": string;
1893
+ "0xca9": string;
1894
+ "0xcaa": string;
1895
+ "0xcab": string;
1903
1896
  };
1904
1897
  //# sourceMappingURL=assertionShortCodesMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertionShortCodesMap.d.ts","sour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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAi2DxB,CAAC"}
@@ -1420,18 +1420,6 @@ export const shortCodeMap = {
1420
1420
  "0xa6f": "Pending changes must exist for rollback when collaborating",
1421
1421
  "0xa70": "Pending changes must not exist when not collaborating",
1422
1422
  "0xa71": "must have local change to ack",
1423
- "0xa73": "The typeField must be present in new JSON content",
1424
- "0xa74": "Expected object schema",
1425
- "0xa75": "the field must be an array node",
1426
- "0xa76": "the modification must be an array node",
1427
- "0xa77": "node to move must exist",
1428
- "0xa78": "node to move must exist",
1429
- "0xa79": "objectId does not exist in nodeMap",
1430
- "0xa7a": "Different scopes not supported yet.",
1431
- "0xa7b": "Collision of object id property.",
1432
- "0xa7c": "Ref not found.",
1433
- "0xa7d": "Expected at least two types",
1434
- "0xa7e": "Expected at least two types",
1435
1423
  "0xa7f": "Delta manager does not have inbound/outbound queues.",
1436
1424
  "0xa80": "Invalid delta manager",
1437
1425
  "0xa83": "Expected commit(s) for a non no-op rebase",
@@ -1622,7 +1610,6 @@ export const shortCodeMap = {
1622
1610
  "0xb5d": "Expected last remove to be unacked",
1623
1611
  "0xb5e": "Expected prior remove to be acked",
1624
1612
  "0xb5f": "Expected same length for client ids and seqs",
1625
- "0xb60": "Invalid schema",
1626
1613
  "0xb61": "Invalid old reference",
1627
1614
  "0xb62": "Invalid new segment on rebase",
1628
1615
  "0xb63": "Resubmitting obliterate op without obliterate info in segment group",
@@ -1775,7 +1762,6 @@ export const shortCodeMap = {
1775
1762
  "0xc16": "missing schema for array node",
1776
1763
  "0xc17": "Expected MapNodeStoredSchema",
1777
1764
  "0xc1a": "Expected MapNodeStoredSchema",
1778
- "0xc1b": "Expected at least two types",
1779
1765
  "0xc1e": "Expected a constructed node to be an object",
1780
1766
  "0xc1f": "Transaction did not complete.",
1781
1767
  "0xc20": "snapshot tree not found for one of tree's summarizables",
@@ -1839,7 +1825,6 @@ export const shortCodeMap = {
1839
1825
  "0xc62": "Cannot encode branch base without originatorId",
1840
1826
  "0xc63": "Cannot decode branch id without originatorId",
1841
1827
  "0xc64": "Cannot decode branch base without originatorId",
1842
- "0xc65": "Cannot encode V5 summary without originator",
1843
1828
  "0xc66": "Shared branches must have an id",
1844
1829
  "0xc67": "Duplicate shared branch id",
1845
1830
  "0xc68": "Only commit messages are supported",
@@ -1900,6 +1885,14 @@ export const shortCodeMap = {
1900
1885
  "0xca0": "Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher",
1901
1886
  "0xca1": "Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher",
1902
1887
  "0xca2": "localOpActivity must be undefined when entering rollback",
1903
- "0xca3": "localOpActivity must be undefined when entering applyStashedOp"
1888
+ "0xca3": "localOpActivity must be undefined when entering applyStashedOp",
1889
+ "0xca4": "Expected applied commit to be parented",
1890
+ "0xca5": "Cannot encode vSharedBranches summary without originator",
1891
+ "0xca6": "Unsupported write version requested.",
1892
+ "0xca7": "getUnhydratedContext should not be reentrant",
1893
+ "0xca8": "missing schema",
1894
+ "0xca9": "missing schema",
1895
+ "0xcaa": "Reachable schema missing from input TreeSchema",
1896
+ "0xcab": "missing kind"
1904
1897
  };
1905
1898
  //# sourceMappingURL=assertionShortCodesMap.js.map