@fluidframework/test-runtime-utils 2.74.0-370705 → 2.80.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 (53) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/api-report/test-runtime-utils.legacy.beta.api.md +3 -3
  3. package/assertTagging.config.mjs +1 -1
  4. package/dist/assertionShortCodesMap.d.ts +12 -21
  5. package/dist/assertionShortCodesMap.d.ts.map +1 -1
  6. package/dist/assertionShortCodesMap.js +13 -22
  7. package/dist/assertionShortCodesMap.js.map +1 -1
  8. package/dist/deepFreeze.js.map +1 -1
  9. package/dist/mockDeltas.d.ts.map +1 -1
  10. package/dist/mockDeltas.js.map +1 -1
  11. package/dist/mockStorage.d.ts.map +1 -1
  12. package/dist/mockStorage.js.map +1 -1
  13. package/dist/mocks.d.ts +3 -2
  14. package/dist/mocks.d.ts.map +1 -1
  15. package/dist/mocks.js +2 -1
  16. package/dist/mocks.js.map +1 -1
  17. package/dist/mocksDataStoreContext.d.ts.map +1 -1
  18. package/dist/mocksDataStoreContext.js.map +1 -1
  19. package/dist/mocksForReconnection.d.ts.map +1 -1
  20. package/dist/mocksForReconnection.js.map +1 -1
  21. package/dist/validateAssertionError.d.ts.map +1 -1
  22. package/dist/validateAssertionError.js +4 -4
  23. package/dist/validateAssertionError.js.map +1 -1
  24. package/eslint.config.mts +30 -0
  25. package/lib/assertionShortCodesMap.d.ts +12 -21
  26. package/lib/assertionShortCodesMap.d.ts.map +1 -1
  27. package/lib/assertionShortCodesMap.js +13 -22
  28. package/lib/assertionShortCodesMap.js.map +1 -1
  29. package/lib/deepFreeze.js.map +1 -1
  30. package/lib/mockDeltas.d.ts.map +1 -1
  31. package/lib/mockDeltas.js.map +1 -1
  32. package/lib/mockStorage.d.ts.map +1 -1
  33. package/lib/mockStorage.js.map +1 -1
  34. package/lib/mocks.d.ts +3 -2
  35. package/lib/mocks.d.ts.map +1 -1
  36. package/lib/mocks.js +2 -1
  37. package/lib/mocks.js.map +1 -1
  38. package/lib/mocksDataStoreContext.d.ts.map +1 -1
  39. package/lib/mocksDataStoreContext.js.map +1 -1
  40. package/lib/mocksForReconnection.d.ts.map +1 -1
  41. package/lib/mocksForReconnection.js.map +1 -1
  42. package/lib/validateAssertionError.d.ts.map +1 -1
  43. package/lib/validateAssertionError.js +1 -1
  44. package/lib/validateAssertionError.js.map +1 -1
  45. package/package.json +25 -24
  46. package/src/assertionShortCodesMap.ts +13 -22
  47. package/src/deepFreeze.ts +1 -1
  48. package/src/mockDeltas.ts +9 -9
  49. package/src/mockStorage.ts +1 -1
  50. package/src/mocks.ts +45 -37
  51. package/src/mocksDataStoreContext.ts +5 -1
  52. package/src/mocksForReconnection.ts +7 -7
  53. package/src/validateAssertionError.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mocksDataStoreContext.js","sourceRoot":"","sources":["../src/mocksDataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAEN,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IA0CrC,YACiB,KAAa,IAAI,EAAE,EACnB,WAAoB,KAAK,EACzB,aAAkC,iBAAiB,CAAC;QACnE,SAAS,EAAE,iCAAiC;KAC5C,CAAC,EACF,cAAuB,IAAI;QALX,OAAE,GAAF,EAAE,CAAiB;QACnB,aAAQ,GAAR,QAAQ,CAAiB;QACzB,eAAU,GAAV,UAAU,CAExB;QA9CI,qBAAgB,GAAY,IAAI,CAAC;QACjC,gBAAW,GAAsB,SAAgB,CAAC;QAElD,YAAO,GAAiC,EAAE,CAAC;QAC3C,aAAQ,GAAuB,IAAI,EAAE,CAAC;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B;QACxB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,eAAe,CAAC,OAAe;QACrC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAmB;QAC9C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,8BAA8B,CACpC,EAAU,EACV,WAA2C;QAE3C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,yBAAyB,CAAC,EAAU;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,IAAqB;QAErB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,oBAAoB,CAAC,QAAgB,EAAE,MAAc,EAAE,kBAA2B;QACxF,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState, IAudience } from \"@fluidframework/container-definitions\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidHandleContext,\n\ttype IFluidHandleInternal,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { IClientDetails, IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentMessage,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type { IIdCompressorCore } from \"@fluidframework/id-compressor/internal\";\nimport {\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tIContainerRuntimeBase,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreRegistry,\n\tIGarbageCollectionDetailsBase,\n\ttype IRuntimeStorageService,\n\ttype MinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { defaultMinVersionForCollab } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { MockDeltaManager } from \"./mockDeltas.js\";\n\n/**\n * @legacy @beta\n */\nexport class MockFluidDataStoreContext implements IFluidDataStoreContext {\n\tpublic isLocalDataStore: boolean = true;\n\tpublic packagePath: readonly string[] = undefined as any;\n\n\tpublic options: Record<string | number, any> = {};\n\tpublic clientId: string | undefined = uuid();\n\tpublic clientDetails: IClientDetails;\n\tpublic connected: boolean = true;\n\tpublic readonly: boolean = false;\n\tpublic baseSnapshot: ISnapshotTree | undefined;\n\tpublic deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> =\n\t\tnew MockDeltaManager(() => this.clientId);\n\n\tpublic containerRuntime: IContainerRuntimeBase = undefined as any;\n\tpublic storage: IRuntimeStorageService = undefined as any;\n\tpublic IFluidDataStoreRegistry: IFluidDataStoreRegistry = undefined as any;\n\tpublic IFluidHandleContext: IFluidHandleContext = undefined as any;\n\tpublic idCompressor: IIdCompressorCore & IIdCompressor = undefined as any;\n\tpublic readonly gcThrowOnTombstoneUsage = false;\n\tpublic readonly gcTombstoneEnforcementAllowed = false;\n\n\t/**\n\t * @remarks This is for internal use only.\n\t */\n\tpublic ILayerCompatDetails?: unknown;\n\n\t/**\n\t * Indicates the attachment state of the data store to a host service.\n\t */\n\tpublic attachState: AttachState = undefined as any;\n\n\t/**\n\t * @deprecated 0.16 Issue #1635, #3631\n\t */\n\tpublic createProps?: any;\n\tpublic scope: FluidObject = undefined as any;\n\n\t/**\n\t * {@inheritdoc @fluidframework/runtime-definitions#IFluidDataStoreContext.minVersionForCollab}\n\t */\n\tpublic minVersionForCollab: MinimumVersionForCollab = defaultMinVersionForCollab;\n\n\tconstructor(\n\t\tpublic readonly id: string = uuid(),\n\t\tpublic readonly existing: boolean = false,\n\t\tpublic readonly baseLogger: ITelemetryLoggerExt = createChildLogger({\n\t\t\tnamespace: \"fluid:MockFluidDataStoreContext\",\n\t\t}),\n\t\tinteractive: boolean = true,\n\t) {\n\t\tthis.clientDetails = { capabilities: { interactive } };\n\t}\n\n\ton(event: string | symbol, listener: (...args: any[]) => void): this {\n\t\tswitch (event) {\n\t\t\tcase \"attaching\":\n\t\t\tcase \"attached\":\n\t\t\t\treturn this;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"Method not implemented.\");\n\t\t}\n\t}\n\n\tonce(event: string | symbol, listener: (...args: any[]) => void): this {\n\t\treturn this;\n\t}\n\n\toff(event: string | symbol, listener: (...args: any[]) => void): this {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn undefined as any as IQuorumClients;\n\t}\n\n\tpublic getAudience(): IAudience {\n\t\treturn undefined as any as IAudience;\n\t}\n\n\tpublic submitMessage(): void {\n\t\t// No-op for mock context\n\t}\n\n\tpublic submitSignal(): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic makeLocallyVisible(): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic setChannelDirty(address: string): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic getCreateChildSummarizerNodeFn(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t): CreateChildSummarizerNodeFn {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic deleteChildSummarizerNode(id: string): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async uploadBlob(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic addedGCOutboundRoute(fromPath: string, toPath: string, messageTimestampMs?: number) {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n}\n"]}
1
+ {"version":3,"file":"mocksDataStoreContext.js","sourceRoot":"","sources":["../src/mocksDataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAEN,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IA0CrC,YACiB,KAAa,IAAI,EAAE,EACnB,WAAoB,KAAK,EACzB,aAAkC,iBAAiB,CAAC;QACnE,SAAS,EAAE,iCAAiC;KAC5C,CAAC,EACF,cAAuB,IAAI;QALX,OAAE,GAAF,EAAE,CAAiB;QACnB,aAAQ,GAAR,QAAQ,CAAiB;QACzB,eAAU,GAAV,UAAU,CAExB;QA9CI,qBAAgB,GAAY,IAAI,CAAC;QACjC,gBAAW,GAAsB,SAAgB,CAAC;QAElD,YAAO,GAAiC,EAAE,CAAC;QAC3C,aAAQ,GAAuB,IAAI,EAAE,CAAC;QAEtC,cAAS,GAAY,IAAI,CAAC;QAC1B,aAAQ,GAAY,KAAK,CAAC;QAE1B,iBAAY,GAClB,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ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IAC5C,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAmB;QAC9C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,8BAA8B,CACpC,EAAU,EACV,WAA2C;QAE3C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,yBAAyB,CAAC,EAAU;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,IAAqB;QAErB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAEM,oBAAoB,CAC1B,QAAgB,EAChB,MAAc,EACd,kBAA2B;QAE3B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState, IAudience } from \"@fluidframework/container-definitions\";\nimport { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidHandleContext,\n\ttype IFluidHandleInternal,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { IClientDetails, IQuorumClients } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentMessage,\n\tISnapshotTree,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type { IIdCompressorCore } from \"@fluidframework/id-compressor/internal\";\nimport {\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tIContainerRuntimeBase,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreRegistry,\n\tIGarbageCollectionDetailsBase,\n\ttype IRuntimeStorageService,\n\ttype MinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { defaultMinVersionForCollab } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { MockDeltaManager } from \"./mockDeltas.js\";\n\n/**\n * @legacy @beta\n */\nexport class MockFluidDataStoreContext implements IFluidDataStoreContext {\n\tpublic isLocalDataStore: boolean = true;\n\tpublic packagePath: readonly string[] = undefined as any;\n\n\tpublic options: Record<string | number, any> = {};\n\tpublic clientId: string | undefined = uuid();\n\tpublic clientDetails: IClientDetails;\n\tpublic connected: boolean = true;\n\tpublic readonly: boolean = false;\n\tpublic baseSnapshot: ISnapshotTree | undefined;\n\tpublic deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> =\n\t\tnew MockDeltaManager(() => this.clientId);\n\n\tpublic containerRuntime: IContainerRuntimeBase = undefined as any;\n\tpublic storage: IRuntimeStorageService = undefined as any;\n\tpublic IFluidDataStoreRegistry: IFluidDataStoreRegistry = undefined as any;\n\tpublic IFluidHandleContext: IFluidHandleContext = undefined as any;\n\tpublic idCompressor: IIdCompressorCore & IIdCompressor = undefined as any;\n\tpublic readonly gcThrowOnTombstoneUsage = false;\n\tpublic readonly gcTombstoneEnforcementAllowed = false;\n\n\t/**\n\t * @remarks This is for internal use only.\n\t */\n\tpublic ILayerCompatDetails?: unknown;\n\n\t/**\n\t * Indicates the attachment state of the data store to a host service.\n\t */\n\tpublic attachState: AttachState = undefined as any;\n\n\t/**\n\t * @deprecated 0.16 Issue #1635, #3631\n\t */\n\tpublic createProps?: any;\n\tpublic scope: FluidObject = undefined as any;\n\n\t/**\n\t * {@inheritdoc @fluidframework/runtime-definitions#IFluidDataStoreContext.minVersionForCollab}\n\t */\n\tpublic minVersionForCollab: MinimumVersionForCollab = defaultMinVersionForCollab;\n\n\tconstructor(\n\t\tpublic readonly id: string = uuid(),\n\t\tpublic readonly existing: boolean = false,\n\t\tpublic readonly baseLogger: ITelemetryLoggerExt = createChildLogger({\n\t\t\tnamespace: \"fluid:MockFluidDataStoreContext\",\n\t\t}),\n\t\tinteractive: boolean = true,\n\t) {\n\t\tthis.clientDetails = { capabilities: { interactive } };\n\t}\n\n\ton(event: string | symbol, listener: (...args: any[]) => void): this {\n\t\tswitch (event) {\n\t\t\tcase \"attaching\":\n\t\t\tcase \"attached\":\n\t\t\t\treturn this;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"Method not implemented.\");\n\t\t}\n\t}\n\n\tonce(event: string | symbol, listener: (...args: any[]) => void): this {\n\t\treturn this;\n\t}\n\n\toff(event: string | symbol, listener: (...args: any[]) => void): this {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn undefined as any as IQuorumClients;\n\t}\n\n\tpublic getAudience(): IAudience {\n\t\treturn undefined as any as IAudience;\n\t}\n\n\tpublic submitMessage(): void {\n\t\t// No-op for mock context\n\t}\n\n\tpublic submitSignal(): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic makeLocallyVisible(): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic setChannelDirty(address: string): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic getCreateChildSummarizerNodeFn(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t): CreateChildSummarizerNodeFn {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic deleteChildSummarizerNode(id: string): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async uploadBlob(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\tpublic addedGCOutboundRoute(\n\t\tfromPath: string,\n\t\ttoPath: string,\n\t\tmessageTimestampMs?: number,\n\t): void {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mocksForReconnection.d.ts","sourceRoot":"","sources":["../src/mocksForReconnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAOxF,OAAO,EAEN,4BAA4B,EAC5B,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,qBAAa,mCAAoC,SAAQ,oBAAoB;uBAqE/C,OAAO,EAAE,0CAA0C;IApEhF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,yBAAyB,EAAE,CAAM;IAE3E;;;;;OAKG;IACH,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,IAAW,SAAS,CAAC,SAAS,EAAE,OAAO,EAEtC;IAED,SAAS,CAAC,sBAAsB,CAAC,eAAe,EAAE,yBAAyB,EAAE;IAM7E,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAuCrD,OAAO,CAAC,UAAU,CAAQ;IAC1B,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,yBAAyB,EAAE,CAAC;gBAE7D,gBAAgB,EAAE,yBAAyB,EACf,OAAO,EAAE,0CAA0C,EAC/E,cAAc,GAAE,4BAAiC,EACjD,SAAS,CAAC,EAAE;QAAE,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE;IAQhE,OAAO,CAAC,OAAO,EAAE,yBAAy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I,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","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,OAAO,EACN,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAEl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AAC,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;AAED;;;GAGG;AACH,MAAM,OAAO,0CAA2C,SAAQ,2BAA2B;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","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"validateAssertionError.d.ts","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAC/B,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAmBxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAE5F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAE3F;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC5B,gBAAgB,EAAE,MAAM,GAAG,MAAM,EACjC,SAAS,GAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAa,GAC9C,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAaxB"}
1
+ {"version":3,"file":"validateAssertionError.d.ts","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAC/B,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAmBxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAE5F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAE3F;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC5B,gBAAgB,EAAE,MAAM,GAAG,MAAM,EACjC,SAAS,GAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAa,GAC9C,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAaxB"}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
5
  import { assert } from "@fluidframework/core-utils/internal";
6
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
7
  import { shortCodeMap } from "./assertionShortCodesMap.js";
8
8
  /**
9
9
  * Validates that an error thrown by our `assert()` function has the expected message, or a
@@ -1 +1 @@
1
- {"version":3,"file":"validateAssertionError.js","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,sBAAsB,CACrC,gBAAiC;IAEjC,OAAO,CAAC,KAAY,EAAE,EAAE;QACvB,iHAAiH;QACjH,oIAAoI;QACpI,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1C,IAAI,iBAAiB,IAAI,YAAY,EAAE,CAAC;YACvC,KAAK,CAAC,CAAC,CAAC,GAA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CAAC,aAAqB,EAAE,gBAAiC;IACjF,OAAO,OAAO,gBAAgB,KAAK,QAAQ;QAC1C,CAAC,CAAC,aAAa,KAAK,gBAAgB;QACpC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { shortCodeMap } from \"./assertionShortCodesMap.js\";\n\n/**\n * Validates that an error thrown by our `assert()` function has the expected message, or a\n * short code that corresponds to that message.\n *\n * @remarks\n * The main use case for this is so tests that expect specific assert() calls to fail can\n * always do comparisons based on the original string message, and work whether they run\n * before the policy-check tool replaces those strings with short codes, or after. Note that\n * it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).\n *\n * @param expectedErrorMessage - The message that the error object should match (either explicitly,\n * or because it contains a short code which maps to that message).\n * @returns an error validation function suitable for use with NodeJS's `assert.throws()`.\n * @internal\n */\nexport function validateAssertionError(\n\texpectedErrorMsg: string | RegExp,\n): (error: Error) => true {\n\treturn (error: Error) => {\n\t\t// Asserts with custom debugMessageBuilder put extra content on the second line of the message, even when tagged.\n\t\t// Thus extract the first line, which will be the assert tag if there is one, and replace it with the message from the shortCodeMap.\n\t\tconst split = error.message.split(\"\\n\");\n\t\tconst possibleShortCode = split[0].trim();\n\t\tif (possibleShortCode in shortCodeMap) {\n\t\t\tsplit[0] = shortCodeMap[possibleShortCode];\n\t\t}\n\t\tconst mappedMsg = split.join(\"\\n\");\n\n\t\tif (testErrorMessage(mappedMsg, expectedErrorMsg)) {\n\t\t\t// This throws an Error instead of an AssertionError because AssertionError would require a dependency on the\n\t\t\t// node assert library, which we don't want to do for this library because it's used in the browser.\n\t\t\tconst message = `Unexpected assertion thrown\\nActual: ${error.message === mappedMsg ? error.message : `${error.message} ('${mappedMsg}')}`}\\nExpected: ${expectedErrorMsg}`;\n\t\t\tthrow new Error(message);\n\t\t}\n\t\treturn true;\n\t};\n}\n\n/**\n * {@link validateError} for `UsageError`.\n * @internal\n */\nexport function validateUsageError(expectedErrorMsg: string | RegExp): (error: Error) => true {\n\treturn validateError(expectedErrorMsg, UsageError);\n}\n\n/**\n * {@link validateError} for `TypeError`.\n * @internal\n */\nexport function validateTypeError(expectedErrorMsg: string | RegExp): (error: Error) => true {\n\treturn validateError(expectedErrorMsg, TypeError);\n}\n\n/**\n * Validates that a specific kind of error was thrown with the expected message.\n * @remarks\n * Intended for use with NodeJS's `assert.throws`.\n * @see {@link validateAssertionError}, {@link validateUsageError}, {@link validateTypeError} for more specialized versions.\n * @returns an error validation function suitable for use with NodeJS's `assert.throws()`.\n * @internal\n */\nexport function validateError(\n\texpectedErrorMsg: string | RegExp,\n\terrorType: new (...args: any[]) => Error = Error,\n): (error: Error) => true {\n\treturn (error: Error) => {\n\t\tassert(\n\t\t\terror instanceof errorType,\n\t\t\t`Expected an error of type \"${errorType.name}\", but got \"${error}\"`,\n\t\t);\n\t\tif (testErrorMessage(error.message, expectedErrorMsg)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Unexpected ${errorType.name} thrown\\nActual: ${error.message}\\nExpected: ${expectedErrorMsg}`,\n\t\t\t);\n\t\t}\n\t\treturn true;\n\t};\n}\n\nfunction testErrorMessage(actualMessage: string, expectedErrorMsg: string | RegExp): boolean {\n\treturn typeof expectedErrorMsg === \"string\"\n\t\t? actualMessage !== expectedErrorMsg\n\t\t: !expectedErrorMsg.test(actualMessage);\n}\n"]}
1
+ {"version":3,"file":"validateAssertionError.js","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,6B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AAE,EAAE;QACvB,MAAM,CACL,KAAK,YAAY,SAAS,EAC1B,8BAA8B,SAAS,CAAC,IAAI,eAAe,KAAK,GAAG,CACnE,CAAC;QACF,IAAI,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CACd,cAAc,SAAS,CAAC,IAAI,oBAAoB,KAAK,CAAC,OAAO,eAAe,gBAAgB,EAAE,CAC9F,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,aAAqB,EAAE,gBAAiC;IACjF,OAAO,OAAO,gBAAgB,KAAK,QAAQ;QAC1C,CAAC,CAAC,aAAa,KAAK,gBAAgB;QACpC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { shortCodeMap } from \"./assertionShortCodesMap.js\";\n\n/**\n * Validates that an error thrown by our `assert()` function has the expected message, or a\n * short code that corresponds to that message.\n *\n * @remarks\n * The main use case for this is so tests that expect specific assert() calls to fail can\n * always do comparisons based on the original string message, and work whether they run\n * before the policy-check tool replaces those strings with short codes, or after. Note that\n * it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).\n *\n * @param expectedErrorMessage - The message that the error object should match (either explicitly,\n * or because it contains a short code which maps to that message).\n * @returns an error validation function suitable for use with NodeJS's `assert.throws()`.\n * @internal\n */\nexport function validateAssertionError(\n\texpectedErrorMsg: string | RegExp,\n): (error: Error) => true {\n\treturn (error: Error) => {\n\t\t// Asserts with custom debugMessageBuilder put extra content on the second line of the message, even when tagged.\n\t\t// Thus extract the first line, which will be the assert tag if there is one, and replace it with the message from the shortCodeMap.\n\t\tconst split = error.message.split(\"\\n\");\n\t\tconst possibleShortCode = split[0].trim();\n\t\tif (possibleShortCode in shortCodeMap) {\n\t\t\tsplit[0] = shortCodeMap[possibleShortCode];\n\t\t}\n\t\tconst mappedMsg = split.join(\"\\n\");\n\n\t\tif (testErrorMessage(mappedMsg, expectedErrorMsg)) {\n\t\t\t// This throws an Error instead of an AssertionError because AssertionError would require a dependency on the\n\t\t\t// node assert library, which we don't want to do for this library because it's used in the browser.\n\t\t\tconst message = `Unexpected assertion thrown\\nActual: ${error.message === mappedMsg ? error.message : `${error.message} ('${mappedMsg}')}`}\\nExpected: ${expectedErrorMsg}`;\n\t\t\tthrow new Error(message);\n\t\t}\n\t\treturn true;\n\t};\n}\n\n/**\n * {@link validateError} for `UsageError`.\n * @internal\n */\nexport function validateUsageError(expectedErrorMsg: string | RegExp): (error: Error) => true {\n\treturn validateError(expectedErrorMsg, UsageError);\n}\n\n/**\n * {@link validateError} for `TypeError`.\n * @internal\n */\nexport function validateTypeError(expectedErrorMsg: string | RegExp): (error: Error) => true {\n\treturn validateError(expectedErrorMsg, TypeError);\n}\n\n/**\n * Validates that a specific kind of error was thrown with the expected message.\n * @remarks\n * Intended for use with NodeJS's `assert.throws`.\n * @see {@link validateAssertionError}, {@link validateUsageError}, {@link validateTypeError} for more specialized versions.\n * @returns an error validation function suitable for use with NodeJS's `assert.throws()`.\n * @internal\n */\nexport function validateError(\n\texpectedErrorMsg: string | RegExp,\n\terrorType: new (...args: any[]) => Error = Error,\n): (error: Error) => true {\n\treturn (error: Error) => {\n\t\tassert(\n\t\t\terror instanceof errorType,\n\t\t\t`Expected an error of type \"${errorType.name}\", but got \"${error}\"`,\n\t\t);\n\t\tif (testErrorMessage(error.message, expectedErrorMsg)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Unexpected ${errorType.name} thrown\\nActual: ${error.message}\\nExpected: ${expectedErrorMsg}`,\n\t\t\t);\n\t\t}\n\t\treturn true;\n\t};\n}\n\nfunction testErrorMessage(actualMessage: string, expectedErrorMsg: string | RegExp): boolean {\n\treturn typeof expectedErrorMsg === \"string\"\n\t\t? actualMessage !== expectedErrorMsg\n\t\t: !expectedErrorMsg.test(actualMessage);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/test-runtime-utils",
3
- "version": "2.74.0-370705",
3
+ "version": "2.80.0",
4
4
  "description": "Fluid runtime test utilities",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,43 +69,44 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "2.74.0-370705",
73
- "@fluidframework/container-definitions": "2.74.0-370705",
74
- "@fluidframework/container-runtime-definitions": "2.74.0-370705",
75
- "@fluidframework/core-interfaces": "2.74.0-370705",
76
- "@fluidframework/core-utils": "2.74.0-370705",
77
- "@fluidframework/datastore-definitions": "2.74.0-370705",
78
- "@fluidframework/driver-definitions": "2.74.0-370705",
79
- "@fluidframework/driver-utils": "2.74.0-370705",
80
- "@fluidframework/id-compressor": "2.74.0-370705",
81
- "@fluidframework/routerlicious-driver": "2.74.0-370705",
82
- "@fluidframework/runtime-definitions": "2.74.0-370705",
83
- "@fluidframework/runtime-utils": "2.74.0-370705",
84
- "@fluidframework/telemetry-utils": "2.74.0-370705",
72
+ "@fluid-internal/client-utils": "~2.80.0",
73
+ "@fluidframework/container-definitions": "~2.80.0",
74
+ "@fluidframework/container-runtime-definitions": "~2.80.0",
75
+ "@fluidframework/core-interfaces": "~2.80.0",
76
+ "@fluidframework/core-utils": "~2.80.0",
77
+ "@fluidframework/datastore-definitions": "~2.80.0",
78
+ "@fluidframework/driver-definitions": "~2.80.0",
79
+ "@fluidframework/driver-utils": "~2.80.0",
80
+ "@fluidframework/id-compressor": "~2.80.0",
81
+ "@fluidframework/routerlicious-driver": "~2.80.0",
82
+ "@fluidframework/runtime-definitions": "~2.80.0",
83
+ "@fluidframework/runtime-utils": "~2.80.0",
84
+ "@fluidframework/telemetry-utils": "~2.80.0",
85
85
  "jsrsasign": "^11.0.0",
86
86
  "uuid": "^11.1.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@arethetypeswrong/cli": "^0.17.1",
89
+ "@arethetypeswrong/cli": "^0.18.2",
90
90
  "@biomejs/biome": "~1.9.3",
91
- "@fluid-internal/mocha-test-setup": "2.74.0-370705",
92
- "@fluid-tools/build-cli": "^0.60.0",
91
+ "@fluid-internal/mocha-test-setup": "~2.80.0",
92
+ "@fluid-tools/build-cli": "^0.62.0",
93
93
  "@fluidframework/build-common": "^2.0.3",
94
- "@fluidframework/build-tools": "^0.60.0",
95
- "@fluidframework/eslint-config-fluid": "2.74.0-370705",
96
- "@fluidframework/test-runtime-utils-previous": "npm:@fluidframework/test-runtime-utils@2.73.0",
94
+ "@fluidframework/build-tools": "^0.62.0",
95
+ "@fluidframework/eslint-config-fluid": "~2.80.0",
96
+ "@fluidframework/test-runtime-utils-previous": "npm:@fluidframework/test-runtime-utils@2.74.0",
97
97
  "@microsoft/api-extractor": "7.52.11",
98
98
  "@types/jsrsasign": "^10.5.12",
99
99
  "@types/mocha": "^10.0.10",
100
100
  "@types/node": "^18.19.0",
101
101
  "c8": "^10.1.3",
102
- "concurrently": "^8.2.1",
102
+ "concurrently": "^9.2.1",
103
103
  "copyfiles": "^2.4.1",
104
- "cross-env": "^7.0.3",
105
- "eslint": "~8.57.1",
104
+ "cross-env": "^10.1.0",
105
+ "eslint": "~9.39.1",
106
+ "jiti": "^2.6.1",
106
107
  "mocha": "^10.8.2",
107
108
  "mocha-multi-reporters": "^1.5.1",
108
- "rimraf": "^4.4.0",
109
+ "rimraf": "^6.1.2",
109
110
  "typescript": "~5.4.5"
110
111
  },
111
112
  "typeValidation": {
@@ -1009,7 +1009,6 @@ export const shortCodeMap = {
1009
1009
  "0x7a2": "Must be in a field in order to attach",
1010
1010
  "0x7a5": "Must be in a field in order to detach",
1011
1011
  "0x7a8": "should be in fields",
1012
- "0x7a9": "Collision during index update",
1013
1012
  "0x7aa": "Unknown removed node ID",
1014
1013
  "0x7af": "Destination must be a new empty detached field",
1015
1014
  "0x7b6": "Attach source field must be different from current field",
@@ -1287,14 +1286,10 @@ export const shortCodeMap = {
1287
1286
  "0x9aa": "identifier must be type string",
1288
1287
  "0x9ab": "childId is undefined in unpackChildNodesUsedRoutes",
1289
1288
  "0x9ad": "previous ordinal should not be empty",
1290
- "0x9af": "A view cannot be rebased while it has a pending transaction",
1291
- "0x9b0": "Views cannot be merged into a view while it has a pending transaction",
1292
1289
  "0x9b1": "Expected tree node to have kernel",
1293
1290
  "0x9b4": "Unexpected flex node implementation",
1294
1291
  "0x9b5": "Inheritance should work",
1295
1292
  "0x9b6": "No error to clear",
1296
- "0x9b8": "Inconsistent data: missing detached node entry",
1297
- "0x9b9": "Inconsistent data: missing node entry in latestRelevantRevision",
1298
1293
  "0x9ba": "Unable to delete unknown entry",
1299
1294
  "0x9bb": "Unable to delete unknown entry",
1300
1295
  "0x9bc": "detached node id does not exist in the detached field index",
@@ -1422,18 +1417,6 @@ export const shortCodeMap = {
1422
1417
  "0xa6f": "Pending changes must exist for rollback when collaborating",
1423
1418
  "0xa70": "Pending changes must not exist when not collaborating",
1424
1419
  "0xa71": "must have local change to ack",
1425
- "0xa73": "The typeField must be present in new JSON content",
1426
- "0xa74": "Expected object schema",
1427
- "0xa75": "the field must be an array node",
1428
- "0xa76": "the modification must be an array node",
1429
- "0xa77": "node to move must exist",
1430
- "0xa78": "node to move must exist",
1431
- "0xa79": "objectId does not exist in nodeMap",
1432
- "0xa7a": "Different scopes not supported yet.",
1433
- "0xa7b": "Collision of object id property.",
1434
- "0xa7c": "Ref not found.",
1435
- "0xa7d": "Expected at least two types",
1436
- "0xa7e": "Expected at least two types",
1437
1420
  "0xa7f": "Delta manager does not have inbound/outbound queues.",
1438
1421
  "0xa80": "Invalid delta manager",
1439
1422
  "0xa83": "Expected commit(s) for a non no-op rebase",
@@ -1452,7 +1435,6 @@ export const shortCodeMap = {
1452
1435
  "0xa94": "invalid forbidden field",
1453
1436
  "0xa95": "Invalid map schema",
1454
1437
  "0xa97": "Not in transaction",
1455
- "0xa98": "Expected transaction branch",
1456
1438
  "0xa99": "must have a parent",
1457
1439
  "0xa9a": "must have a parent",
1458
1440
  "0xa9b": "attach should happen in a node",
@@ -1624,7 +1606,6 @@ export const shortCodeMap = {
1624
1606
  "0xb5d": "Expected last remove to be unacked",
1625
1607
  "0xb5e": "Expected prior remove to be acked",
1626
1608
  "0xb5f": "Expected same length for client ids and seqs",
1627
- "0xb60": "Invalid schema",
1628
1609
  "0xb61": "Invalid old reference",
1629
1610
  "0xb62": "Invalid new segment on rebase",
1630
1611
  "0xb63": "Resubmitting obliterate op without obliterate info in segment group",
@@ -1777,7 +1758,6 @@ export const shortCodeMap = {
1777
1758
  "0xc16": "missing schema for array node",
1778
1759
  "0xc17": "Expected MapNodeStoredSchema",
1779
1760
  "0xc1a": "Expected MapNodeStoredSchema",
1780
- "0xc1b": "Expected at least two types",
1781
1761
  "0xc1e": "Expected a constructed node to be an object",
1782
1762
  "0xc1f": "Transaction did not complete.",
1783
1763
  "0xc20": "snapshot tree not found for one of tree's summarizables",
@@ -1841,7 +1821,6 @@ export const shortCodeMap = {
1841
1821
  "0xc62": "Cannot encode branch base without originatorId",
1842
1822
  "0xc63": "Cannot decode branch id without originatorId",
1843
1823
  "0xc64": "Cannot decode branch base without originatorId",
1844
- "0xc65": "Cannot encode V5 summary without originator",
1845
1824
  "0xc66": "Shared branches must have an id",
1846
1825
  "0xc67": "Duplicate shared branch id",
1847
1826
  "0xc68": "Only commit messages are supported",
@@ -1902,5 +1881,17 @@ export const shortCodeMap = {
1902
1881
  "0xca0": "Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher",
1903
1882
  "0xca1": "Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher",
1904
1883
  "0xca2": "localOpActivity must be undefined when entering rollback",
1905
- "0xca3": "localOpActivity must be undefined when entering applyStashedOp"
1884
+ "0xca3": "localOpActivity must be undefined when entering applyStashedOp",
1885
+ "0xca4": "Expected applied commit to be parented",
1886
+ "0xca5": "Cannot encode vSharedBranches summary without originator",
1887
+ "0xca6": "Unsupported write version requested.",
1888
+ "0xca7": "getUnhydratedContext should not be reentrant",
1889
+ "0xca8": "missing schema",
1890
+ "0xca9": "missing schema",
1891
+ "0xcaa": "Reachable schema missing from input TreeSchema",
1892
+ "0xcab": "missing kind",
1893
+ "0xcac": "Unexpected branch implementation",
1894
+ "0xcad": "Unexpected branch implementation",
1895
+ "0xcae": "The outer transaction should be ending",
1896
+ "0xcaf": "Unexpected commit in transaction"
1906
1897
  };
package/src/deepFreeze.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- const frozenMethod = () => {
6
+ const frozenMethod = (): never => {
7
7
  throw new Error("Object is frozen");
8
8
  };
9
9
 
package/src/mockDeltas.ts CHANGED
@@ -28,7 +28,7 @@ export class MockDeltaQueue<T> extends EventEmitter implements IDeltaQueue<T> {
28
28
  protected readonly queue: T[] = [];
29
29
  protected pauseCount = 0;
30
30
 
31
- public processCallback: (el: T) => void = () => {};
31
+ public processCallback: (el: T) => void = (): void => {};
32
32
 
33
33
  public get disposed(): any {
34
34
  return undefined;
@@ -38,7 +38,7 @@ export class MockDeltaQueue<T> extends EventEmitter implements IDeltaQueue<T> {
38
38
  return this.pauseCount !== 0;
39
39
  }
40
40
 
41
- public get length() {
41
+ public get length(): number {
42
42
  return this.queue.length;
43
43
  }
44
44
 
@@ -46,7 +46,7 @@ export class MockDeltaQueue<T> extends EventEmitter implements IDeltaQueue<T> {
46
46
  return this.queue.length === 0;
47
47
  }
48
48
 
49
- protected process() {
49
+ protected process(): void {
50
50
  void Promise.resolve().then(() => {
51
51
  while (this.pauseCount === 0 && this.length > 0) {
52
52
  const el = this.pop();
@@ -56,13 +56,13 @@ export class MockDeltaQueue<T> extends EventEmitter implements IDeltaQueue<T> {
56
56
  });
57
57
  }
58
58
 
59
- public push(el: T) {
59
+ public push(el: T): void {
60
60
  this.queue.push(el);
61
61
  this.emit("push", el);
62
62
  this.process();
63
63
  }
64
64
 
65
- public pop() {
65
+ public pop(): T | undefined {
66
66
  return this.queue.shift();
67
67
  }
68
68
 
@@ -84,7 +84,7 @@ export class MockDeltaQueue<T> extends EventEmitter implements IDeltaQueue<T> {
84
84
  return this.queue;
85
85
  }
86
86
 
87
- public dispose() {}
87
+ public dispose(): void {}
88
88
 
89
89
  public async waitTillProcessingDone(): Promise<{ count: number; duration: number }> {
90
90
  throw new Error("NYI");
@@ -110,7 +110,7 @@ export class MockDeltaManager
110
110
  public readOnlyInfo: ReadOnlyInfo = { readonly: false };
111
111
  public readonly clientType: string = undefined as any;
112
112
  public readonly clientDetails: IClientDetails = {} as any;
113
- public get IDeltaSender() {
113
+ public get IDeltaSender(): this {
114
114
  return this;
115
115
  }
116
116
 
@@ -155,7 +155,7 @@ export class MockDeltaManager
155
155
 
156
156
  public submitSignal(content: any): void {}
157
157
 
158
- public flush() {}
158
+ public flush(): void {}
159
159
 
160
160
  public submit(
161
161
  type: MessageType,
@@ -166,7 +166,7 @@ export class MockDeltaManager
166
166
  return 0;
167
167
  }
168
168
 
169
- public dispose() {
169
+ public dispose(): void {
170
170
  this.removeAllListeners();
171
171
  }
172
172
 
@@ -19,7 +19,7 @@ import {
19
19
  * @legacy @beta
20
20
  */
21
21
  export class MockStorage implements IChannelStorageService {
22
- public static createFromSummary(summaryTree: ISummaryTree) {
22
+ public static createFromSummary(summaryTree: ISummaryTree): MockStorage {
23
23
  const tree = convertSummaryTreeToITree(summaryTree);
24
24
  return new MockStorage(tree);
25
25
  }