@fluid-experimental/tree 2.80.0 → 2.81.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 (84) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/assertTagging.config.mjs +14 -0
  3. package/dist/migration-shim/migrationDeltaHandler.d.ts +2 -2
  4. package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
  5. package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
  6. package/dist/migration-shim/migrationShim.d.ts +5 -5
  7. package/dist/migration-shim/migrationShim.d.ts.map +1 -1
  8. package/dist/migration-shim/migrationShim.js +1 -0
  9. package/dist/migration-shim/migrationShim.js.map +1 -1
  10. package/dist/migration-shim/migrationShimFactory.d.ts +3 -3
  11. package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
  12. package/dist/migration-shim/migrationShimFactory.js.map +1 -1
  13. package/dist/migration-shim/sharedTreeDeltaHandler.d.ts +2 -2
  14. package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
  15. package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
  16. package/dist/migration-shim/sharedTreeShim.d.ts +5 -5
  17. package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
  18. package/dist/migration-shim/sharedTreeShim.js.map +1 -1
  19. package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -1
  20. package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
  21. package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
  22. package/dist/migration-shim/shimChannelServices.d.ts +1 -1
  23. package/dist/migration-shim/shimChannelServices.d.ts.map +1 -1
  24. package/dist/migration-shim/shimChannelServices.js.map +1 -1
  25. package/dist/migration-shim/shimDeltaConnection.d.ts +2 -2
  26. package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
  27. package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
  28. package/dist/migration-shim/shimHandle.d.ts +1 -1
  29. package/dist/migration-shim/shimHandle.d.ts.map +1 -1
  30. package/dist/migration-shim/shimHandle.js.map +1 -1
  31. package/dist/migration-shim/types.d.ts +4 -4
  32. package/dist/migration-shim/types.d.ts.map +1 -1
  33. package/dist/migration-shim/types.js.map +1 -1
  34. package/dist/migration-shim/utils.d.ts +3 -3
  35. package/dist/migration-shim/utils.d.ts.map +1 -1
  36. package/dist/migration-shim/utils.js.map +1 -1
  37. package/eslint.config.mts +5 -4
  38. package/lib/migration-shim/migrationDeltaHandler.d.ts +2 -2
  39. package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
  40. package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
  41. package/lib/migration-shim/migrationShim.d.ts +5 -5
  42. package/lib/migration-shim/migrationShim.d.ts.map +1 -1
  43. package/lib/migration-shim/migrationShim.js +1 -0
  44. package/lib/migration-shim/migrationShim.js.map +1 -1
  45. package/lib/migration-shim/migrationShimFactory.d.ts +3 -3
  46. package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
  47. package/lib/migration-shim/migrationShimFactory.js.map +1 -1
  48. package/lib/migration-shim/sharedTreeDeltaHandler.d.ts +2 -2
  49. package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
  50. package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
  51. package/lib/migration-shim/sharedTreeShim.d.ts +5 -5
  52. package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
  53. package/lib/migration-shim/sharedTreeShim.js.map +1 -1
  54. package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -1
  55. package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
  56. package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
  57. package/lib/migration-shim/shimChannelServices.d.ts +1 -1
  58. package/lib/migration-shim/shimChannelServices.d.ts.map +1 -1
  59. package/lib/migration-shim/shimChannelServices.js.map +1 -1
  60. package/lib/migration-shim/shimDeltaConnection.d.ts +2 -2
  61. package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
  62. package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
  63. package/lib/migration-shim/shimHandle.d.ts +1 -1
  64. package/lib/migration-shim/shimHandle.d.ts.map +1 -1
  65. package/lib/migration-shim/shimHandle.js.map +1 -1
  66. package/lib/migration-shim/types.d.ts +4 -4
  67. package/lib/migration-shim/types.d.ts.map +1 -1
  68. package/lib/migration-shim/types.js.map +1 -1
  69. package/lib/migration-shim/utils.d.ts +3 -3
  70. package/lib/migration-shim/utils.d.ts.map +1 -1
  71. package/lib/migration-shim/utils.js.map +1 -1
  72. package/package.json +26 -26
  73. package/src/migration-shim/migrationDeltaHandler.ts +2 -2
  74. package/src/migration-shim/migrationShim.ts +11 -13
  75. package/src/migration-shim/migrationShimFactory.ts +7 -10
  76. package/src/migration-shim/sharedTreeDeltaHandler.ts +2 -2
  77. package/src/migration-shim/sharedTreeShim.ts +14 -14
  78. package/src/migration-shim/sharedTreeShimFactory.ts +5 -5
  79. package/src/migration-shim/shimChannelServices.ts +4 -4
  80. package/src/migration-shim/shimDeltaConnection.ts +5 -5
  81. package/src/migration-shim/shimHandle.ts +1 -1
  82. package/src/migration-shim/types.ts +8 -8
  83. package/src/migration-shim/utils.ts +3 -3
  84. package/.eslintrc.cjs +0 -45
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-experimental/tree
2
2
 
3
+ ## 2.81.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.80.0
4
8
 
5
9
  Dependency updates only.
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * @type {import("@fluid-tools/build-cli").AssertTaggingPackageConfig}
8
+ */
9
+ export default {
10
+ assertionFunctions: {
11
+ // Just tag assert, not `fail` as this package has its own fail utility which is not worth unifying with the common one.
12
+ 'assert': 1,
13
+ },
14
+ };
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
5
+ import type { IChannelAttributes, IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
6
6
  import { type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
7
7
  import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
8
- import { type IOpContents, type IShimDeltaHandler } from './types.js';
8
+ import type { IOpContents, IShimDeltaHandler } from './types.js';
9
9
  /**
10
10
  * Handles incoming and outgoing deltas/ops for the Migration Shim distributed data structure.
11
11
  * Intercepts processing of ops to allow for migration, and swapping from LegacySharedTree to new SharedTree
@@ -1 +1 @@
1
- {"version":3,"file":"migrationDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC7G,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC1G,OAAO,KAAK,EAAE,yBAAyB,EAA2B,MAAM,8CAA8C,CAAC;AAEvH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtE;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,YAAW,iBAAiB;aAKjD,gBAAgB,EAAE,CACjC,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO,KACpB,OAAO;IACZ,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAV5B,OAAO,CAAC,iBAAiB,CAAC,CAAgB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAgB;gBAGtB,gBAAgB,EAAE,CACjC,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AAC;CACD;AAnKD,8DAmKC","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 { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { IRuntimeMessageCollection, IRuntimeMessagesContent } from '@fluidframework/runtime-definitions/internal';\n\nimport { type IOpContents, type IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isBarrierOp, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the Migration Shim distributed data structure.\n * Intercepts processing of ops to allow for migration, and swapping from LegacySharedTree to new SharedTree\n *\n * Able to process v1 and v2 ops, differentiate between them, understand the various states and drop v1 ops after\n * migration.\n *\n * TODO: After the MSN of the barrier op, it needs to process v2 ops without needing to check for the v2 stamp.\n */\nexport class MigrationShimDeltaHandler implements IShimDeltaHandler {\n\tprivate legacyTreeHandler?: IDeltaHandler;\n\tprivate newTreeHandler?: IDeltaHandler;\n\tpublic constructor(\n\t\t// Maybe it would be better to pass in a different interface?\n\t\tpublic readonly processMigrateOp: (\n\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\tlocalOpMetadata: unknown\n\t\t) => boolean,\n\t\tprivate readonly submitLocalMessage: (message: IOpContents) => void,\n\t\tprivate readonly attributes: IChannelAttributes\n\t) {}\n\t// Introduction of invariant, we always expect an old handler.\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined;\n\t}\n\n\tprivate get treeDeltaHandler(): IDeltaHandler {\n\t\tconst handler = this.newTreeHandler ?? this.legacyTreeHandler;\n\t\tassert(handler !== undefined, 0x7e2 /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic isPreAttachState(): boolean {\n\t\tconst preAttach = this.legacyTreeHandler === undefined && this.newTreeHandler === undefined;\n\t\tassert(!preAttach || !this.attached, 0x82a /* Should not be attached in preAttach state */);\n\t\treturn preAttach;\n\t}\n\n\tpublic isUsingOldV1(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined && this.newTreeHandler === undefined;\n\t}\n\n\tpublic isUsingNewV2(): boolean {\n\t\tconst isUsingV2 = this.legacyTreeHandler !== undefined && this.newTreeHandler !== undefined;\n\t\tassert(!isUsingV2 || this.attached, 0x82b /* Should be attached if in v2 state */);\n\t\treturn isUsingV2;\n\t}\n\n\t// Allow for the handler to be swapped out for the new SharedTree's handler\n\tpublic attachTreeDeltaHandler(treeDeltaHandler: IDeltaHandler): void {\n\t\tassert(!this.isUsingNewV2(), 0x7e3 /* Can't swap tree handlers more than once! */);\n\t\tif (this.isPreAttachState()) {\n\t\t\tthis.legacyTreeHandler = treeDeltaHandler;\n\t\t\treturn;\n\t\t}\n\t\tassert(this.isUsingOldV1(), 0x7e4 /* Can only swap handlers after the old handler is loaded */);\n\t\tthis.newTreeHandler = treeDeltaHandler;\n\t\tassert(this.isUsingNewV2(), 0x7e5 /* Should be using new handler after swap */);\n\t}\n\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\tassert(!this.isPreAttachState(), 0x82c /* Can't process ops before attaching tree handler */);\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(contents)) {\n\t\t\tthis.processMigrateOp(message, local, localOpMetadata);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\tconst messagesContent: IRuntimeMessagesContent[] = [\n\t\t\t{\n\t\t\t\tcontents,\n\t\t\t\tlocalOpMetadata,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t},\n\t\t];\n\t\t// Another thought, flatten the IShimDeltaHandler and the MigrationShim into one class\n\t\treturn this.treeDeltaHandler.processMessages({ envelope: message, messagesContent, local });\n\t}\n\n\tpublic processMessages(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messagesCollection;\n\t\tfor (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {\n\t\t\tthis.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);\n\t\t}\n\t}\n\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.treeDeltaHandler.setConnectionState(connected);\n\t}\n\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(opContents)) {\n\t\t\treturn;\n\t\t}\n\t\treturn this.treeDeltaHandler.reSubmit(contents, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\t!this.shouldDropOp(opContents),\n\t\t\t0x8aa /* MigrationShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.treeDeltaHandler.applyStashedOp(contents);\n\t}\n\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (isBarrierOp(opContents)) {\n\t\t\tthrow new Error('MigrationShim does not support rollback of barrier ops');\n\t\t}\n\t\treturn this.treeDeltaHandler.rollback?.(contents, localOpMetadata);\n\t}\n\n\tprivate isInV1StateAndIsBarrierOp(contents: IOpContents): boolean {\n\t\treturn this.isUsingOldV1() && isBarrierOp(contents);\n\t}\n\n\t/**\n\t * We should drop an op when we are v2 state and the op is a v1 op or a migrate op.\n\t *\n\t * @param contents - op contents we expect to interrogate, this could be anything\n\t * @returns whether or not we should drop the op\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tassert(!this.isPreAttachState(), 0x82d /* Can't process ops before attaching tree handler */);\n\t\t// Don't drop ops when we are in v1 state\n\t\tif (this.isUsingOldV1()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Drop v1 ops when in v2 state\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x82e /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
1
+ {"version":3,"file":"migrationDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/migrationDeltaHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,0EAA0G;AAI1G,yCAAuE;AAEvE;;;;;;;;GAQG;AACH,MAAa,yBAAyB;IAGrC;IACC,6DAA6D;IAC7C,gBAIJ,EACK,kBAAkD,EAClD,UAA8B;QAN/B,qBAAgB,GAAhB,gBAAgB,CAIpB;QACK,uBAAkB,GAAlB,kBAAkB,CAAgC;QAClD,eAAU,GAAV,UAAU,CAAoB;QAaxC,cAAS,GAAG,KAAK,CAAC;IAZvB,CAAC;IACJ,8DAA8D;IACvD,mBAAmB;QACzB,OAAO,IAAI,CAAC,iBAAiB,KAAK,SAAS,CAAC;IAC7C,CAAC;IAED,IAAY,gBAAgB;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,iBAAiB,CAAC;QAC9D,IAAA,iBAAM,EAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8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W,EAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED;;;;;OAKG;IACK,YAAY,CAAC,QAAqB;QACzC,IAAA,iBAAM,EAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAC9F,yCAAyC;QACzC,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACd,CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,IAAA,sBAAW,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gCAAgC;QAChC,IAAA,iBAAM,EACL,IAAA,0BAAe,EAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAnKD,8DAmKC","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 type { IChannelAttributes, IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { IRuntimeMessageCollection, IRuntimeMessagesContent } from '@fluidframework/runtime-definitions/internal';\n\nimport type { IOpContents, IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isBarrierOp, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the Migration Shim distributed data structure.\n * Intercepts processing of ops to allow for migration, and swapping from LegacySharedTree to new SharedTree\n *\n * Able to process v1 and v2 ops, differentiate between them, understand the various states and drop v1 ops after\n * migration.\n *\n * TODO: After the MSN of the barrier op, it needs to process v2 ops without needing to check for the v2 stamp.\n */\nexport class MigrationShimDeltaHandler implements IShimDeltaHandler {\n\tprivate legacyTreeHandler?: IDeltaHandler;\n\tprivate newTreeHandler?: IDeltaHandler;\n\tpublic constructor(\n\t\t// Maybe it would be better to pass in a different interface?\n\t\tpublic readonly processMigrateOp: (\n\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\tlocal: boolean,\n\t\t\tlocalOpMetadata: unknown\n\t\t) => boolean,\n\t\tprivate readonly submitLocalMessage: (message: IOpContents) => void,\n\t\tprivate readonly attributes: IChannelAttributes\n\t) {}\n\t// Introduction of invariant, we always expect an old handler.\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined;\n\t}\n\n\tprivate get treeDeltaHandler(): IDeltaHandler {\n\t\tconst handler = this.newTreeHandler ?? this.legacyTreeHandler;\n\t\tassert(handler !== undefined, 0x7e2 /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic isPreAttachState(): boolean {\n\t\tconst preAttach = this.legacyTreeHandler === undefined && this.newTreeHandler === undefined;\n\t\tassert(!preAttach || !this.attached, 0x82a /* Should not be attached in preAttach state */);\n\t\treturn preAttach;\n\t}\n\n\tpublic isUsingOldV1(): boolean {\n\t\treturn this.legacyTreeHandler !== undefined && this.newTreeHandler === undefined;\n\t}\n\n\tpublic isUsingNewV2(): boolean {\n\t\tconst isUsingV2 = this.legacyTreeHandler !== undefined && this.newTreeHandler !== undefined;\n\t\tassert(!isUsingV2 || this.attached, 0x82b /* Should be attached if in v2 state */);\n\t\treturn isUsingV2;\n\t}\n\n\t// Allow for the handler to be swapped out for the new SharedTree's handler\n\tpublic attachTreeDeltaHandler(treeDeltaHandler: IDeltaHandler): void {\n\t\tassert(!this.isUsingNewV2(), 0x7e3 /* Can't swap tree handlers more than once! */);\n\t\tif (this.isPreAttachState()) {\n\t\t\tthis.legacyTreeHandler = treeDeltaHandler;\n\t\t\treturn;\n\t\t}\n\t\tassert(this.isUsingOldV1(), 0x7e4 /* Can only swap handlers after the old handler is loaded */);\n\t\tthis.newTreeHandler = treeDeltaHandler;\n\t\tassert(this.isUsingNewV2(), 0x7e5 /* Should be using new handler after swap */);\n\t}\n\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\tassert(!this.isPreAttachState(), 0x82c /* Can't process ops before attaching tree handler */);\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(contents)) {\n\t\t\tthis.processMigrateOp(message, local, localOpMetadata);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\tconst messagesContent: IRuntimeMessagesContent[] = [\n\t\t\t{\n\t\t\t\tcontents,\n\t\t\t\tlocalOpMetadata,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t},\n\t\t];\n\t\t// Another thought, flatten the IShimDeltaHandler and the MigrationShim into one class\n\t\treturn this.treeDeltaHandler.processMessages({ envelope: message, messagesContent, local });\n\t}\n\n\tpublic processMessages(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messagesCollection;\n\t\tfor (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {\n\t\t\tthis.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);\n\t\t}\n\t}\n\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.treeDeltaHandler.setConnectionState(connected);\n\t}\n\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.shouldDropOp(opContents)) {\n\t\t\treturn;\n\t\t}\n\t\treturn this.treeDeltaHandler.reSubmit(contents, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (this.isInV1StateAndIsBarrierOp(opContents)) {\n\t\t\tthis.submitLocalMessage(opContents);\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\t!this.shouldDropOp(opContents),\n\t\t\t0x8aa /* MigrationShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.treeDeltaHandler.applyStashedOp(contents);\n\t}\n\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tconst opContents = contents as IOpContents;\n\t\tif (isBarrierOp(opContents)) {\n\t\t\tthrow new Error('MigrationShim does not support rollback of barrier ops');\n\t\t}\n\t\treturn this.treeDeltaHandler.rollback?.(contents, localOpMetadata);\n\t}\n\n\tprivate isInV1StateAndIsBarrierOp(contents: IOpContents): boolean {\n\t\treturn this.isUsingOldV1() && isBarrierOp(contents);\n\t}\n\n\t/**\n\t * We should drop an op when we are v2 state and the op is a v1 op or a migrate op.\n\t *\n\t * @param contents - op contents we expect to interrogate, this could be anything\n\t * @returns whether or not we should drop the op\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tassert(!this.isPreAttachState(), 0x82d /* Can't process ops before attaching tree handler */);\n\t\t// Don't drop ops when we are in v1 state\n\t\tif (this.isUsingOldV1()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Drop v1 ops when in v2 state\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x82e /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
@@ -2,13 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IEvent, type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';
5
+ import type { IEvent, IFluidHandle, IFluidLoadable } from '@fluidframework/core-interfaces';
6
6
  import { type IChannelAttributes, IChannelFactory, type IFluidDataStoreRuntime, type IChannel, type IChannelServices } from '@fluidframework/datastore-definitions/internal';
7
- import { type IExperimentalIncrementalSummaryContext, type IGarbageCollectionData, type ISummaryTreeWithStats, type ITelemetryContext } from '@fluidframework/runtime-definitions/internal';
7
+ import type { IExperimentalIncrementalSummaryContext, IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext } from '@fluidframework/runtime-definitions/internal';
8
8
  import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils/internal';
9
- import { type ITree } from '@fluidframework/tree';
10
- import { type SharedTree as LegacySharedTree, type SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';
11
- import { type IShim } from './types.js';
9
+ import type { ITree } from '@fluidframework/tree';
10
+ import type { SharedTree as LegacySharedTree, SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';
11
+ import type { IShim } from './types.js';
12
12
  /**
13
13
  * Interface for migration events to indicate the stage of the migration. There really is two stages: before, and after.
14
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"migrationShim.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationShim.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtG,OAAO,EACN,KAAK,kBAAkB,EACvB,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,MAAM,gDAAgD,CAAC;AAIxD,OAAO,EACN,KAAK,sCAAsC,EAC3C,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAuB,6BAA6B,EAAE,MAAM,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rB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,EAC9B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,EAChC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,SAAS,EAChD,yBAAyB,CAAC,EAAE,sCAAsC,GAAG,SAAS,GAC5E,OAAO,CAAC,qBAAqB,CAAC;IAG1B,UAAU,IAAI,OAAO;IAKrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAMhD,OAAO,CAAC,SAAS;IAgBjB;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;IAiBzB,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,sBAAsB;IAG/D,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAW,cAAc,IAAI,cAAc,CAE1C;CACD"}
@@ -88,6 +88,7 @@ class MigrationShim extends internal_3.EventEmitterWithErrorHandling {
88
88
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeWithError}
89
89
  */
90
90
  closeWithError(error) {
91
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions, @typescript-eslint/prefer-nullish-coalescing -- intentional behavior
91
92
  if (this.closeError === undefined) {
92
93
  this.closeError = error;
93
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"migrationShim.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShim.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iFAAoE;AAEpE,kEAA6D;AAQ7D,0EAA0G;AAS1G,uEAA8G;AAQ9G,yEAAuE;AACvE,qEAA8F;AAC9F,qEAA6F;AAC7F,mDAA6C;AAmC7C,MAAM,cAAc,GAAG,sCAAmD,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAc,SAAQ,wCAA8C;IAChF,YACiB,EAAU,EACT,OAA+B,EAC/B,iBAA0C,EAC1C,cAAsC,EACtC,yBAAiF;QAElG,KAAK,CAAC,CAAC,KAA4B,EAAE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A2B,KAAK,SAAS,EAC7E,KAAK,CAAC,uBAAuB,CAC7B,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,2BAA2B,GAAG,IAAI,oDAA2B,CACjE,IAAI,CAAC,QAAQ,CAAC,eAAe,EAC7B,IAAI,CAAC,qBAAqB,CAC1B,CAAC;QACF,MAAM,YAAY,GAAyB;YAC1C,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;YAC1C,eAAe,EAAE,IAAI,CAAC,2BAA2B;SACjD,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,MAA4B;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA7MD,sCA6MC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type EventEmitterEventType } from '@fluid-internal/client-utils';\nimport { AttachState } from '@fluidframework/container-definitions';\nimport { type IEvent, type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\ttype IChannelAttributes,\n\tIChannelFactory,\n\ttype IFluidDataStoreRuntime,\n\ttype IChannel,\n\ttype IChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { SessionId } from '@fluidframework/id-compressor';\nimport type { IIdCompressorCore } from '@fluidframework/id-compressor/internal';\nimport {\n\ttype IExperimentalIncrementalSummaryContext,\n\ttype IGarbageCollectionData,\n\ttype ISummaryTreeWithStats,\n\ttype ITelemetryContext,\n} from '@fluidframework/runtime-definitions/internal';\nimport { DataProcessingError, EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils/internal';\nimport { type ITree } from '@fluidframework/tree';\n\nimport {\n\ttype SharedTree as LegacySharedTree,\n\ttype SharedTreeFactory as LegacySharedTreeFactory,\n} from '../SharedTree.js';\n\nimport { MigrationShimDeltaHandler } from './migrationDeltaHandler.js';\nimport { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';\nimport { PreMigrationDeltaConnection, StampDeltaConnection } from './shimDeltaConnection.js';\nimport { ShimHandle } from './shimHandle.js';\nimport { type IOpContents, type IShim } from './types.js';\n\n/**\n * Interface for migration events to indicate the stage of the migration. There really is two stages: before, and after.\n *\n * @internal\n */\nexport interface IMigrationEvent extends IEvent {\n\t/**\n\t * Event that is emitted when the migration is complete.\n\t */\n\t(event: 'migrated', listener: () => void);\n}\n\n/**\n * Interface for migration operation.\n */\nexport interface IMigrationOp {\n\t/**\n\t * Type of the migration operation.\n\t */\n\ttype: 'barrier';\n\t/**\n\t * Old channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what state of the document was before the migration op initiated at.\n\t */\n\toldAttributes: IChannelAttributes;\n\t/**\n\t * New channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what the migration state of the new container is expected to be.\n\t */\n\tnewAttributes: IChannelAttributes;\n}\n\nconst ghostSessionId = '3692b242-46c0-4076-abea-c2ac1e896dee' as SessionId;\n\n/**\n * The MigrationShim loads in place of the legacy SharedTree. It provides API surface for migrating it to the new SharedTree, while also providing access to the current SharedTree for usage.\n *\n * @remarks\n *\n * This MigrationShim is responsible for submitting a migration op, processing the migrate op, swapping from the old\n * tree to the new tree, loading an old tree snapshot and creating an old tree.\n *\n * The MigrationShim expects to always load from a legacy SharedTree snapshot, though by the time it catches up in\n * processing all ops, it may find that the migration has already occurred. After migration occurs, it modifies its\n * attributes to point at the SharedTreeShimFactory. This will cause future clients to load with a SharedTreeShim and\n * the new SharedTree snapshot instead after the next summarization.\n *\n * @internal\n */\nexport class MigrationShim extends EventEmitterWithErrorHandling<IMigrationEvent> implements IShim {\n\tpublic constructor(\n\t\tpublic readonly id: string,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly legacyTreeFactory: LegacySharedTreeFactory,\n\t\tprivate readonly newTreeFactory: IChannelFactory<ITree>,\n\t\tprivate readonly populateNewSharedObjectFn: (legacyTree: LegacySharedTree, newTree: ITree) => void\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: unknown) => this.eventListenerErrorHandler(event, e));\n\t\t// TODO: consider flattening this class\n\t\tthis.migrationDeltaHandler = new MigrationShimDeltaHandler(\n\t\t\tthis.processMigrateOp,\n\t\t\tthis.submitLocalMessage,\n\t\t\tthis.newTreeFactory.attributes\n\t\t);\n\t\tthis.handle = new ShimHandle<MigrationShim>(this);\n\t}\n\n\tprivate readonly processMigrateOp = (message: ISequencedDocumentMessage): boolean => {\n\t\tif (message.type !== MessageType.Operation || (message.contents as Partial<IMigrationOp>).type !== 'barrier') {\n\t\t\treturn false;\n\t\t}\n\t\tconst newTree = this.newTreeFactory.create(this.runtime, this.id);\n\t\tassert(this.preMigrationDeltaConnection !== undefined, 0x82f /* Should be in v1 state */);\n\t\tthis.preMigrationDeltaConnection.disableSubmit();\n\t\tconst { idCompressor } = this.runtime;\n\t\tif (idCompressor !== undefined) {\n\t\t\t(idCompressor as unknown as IIdCompressorCore).beginGhostSession(ghostSessionId, () =>\n\t\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree)\n\t\t\t);\n\t\t} else {\n\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree);\n\t\t}\n\t\tthis.newTree = newTree;\n\t\tthis.reconnect();\n\t\tthis.emit('migrated');\n\t\treturn true;\n\t};\n\n\tprivate readonly migrationDeltaHandler: MigrationShimDeltaHandler;\n\tprivate services?: IChannelServices;\n\tprivate preMigrationDeltaConnection?: PreMigrationDeltaConnection;\n\tprivate postMigrationServices?: IShimChannelServices;\n\n\tprivate _legacyTree: LegacySharedTree | undefined;\n\tprivate get legacyTree(): LegacySharedTree {\n\t\tassert(this._legacyTree !== undefined, 0x7e6 /* Old tree not initialized */);\n\t\treturn this._legacyTree;\n\t}\n\n\tprivate newTree: (IChannel & ITree) | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeError}\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.eventListenerErrorHandler}\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: unknown): void {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(e, 'SharedObjectEventListenerException');\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeWithError}\n\t */\n\tprivate closeWithError(error: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>): void {\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.verifyNotClosed}\n\t */\n\tprivate verifyNotClosed(): void {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.submitLocalMessage}\n\t */\n\tprivate readonly submitLocalMessage = (message: IOpContents): void => {\n\t\tthis.verifyNotClosed();\n\t\t// This is a copy of submit local message from SharedObject\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(message, undefined);\n\t\t}\n\t};\n\n\t// Migration occurs once this op is read.\n\tpublic submitMigrateOp(): void {\n\t\tconst migrateOp: IMigrationOp = {\n\t\t\ttype: 'barrier',\n\t\t\toldAttributes: this.legacyTreeFactory.attributes,\n\t\t\tnewAttributes: this.newTreeFactory.attributes,\n\t\t};\n\n\t\tthis.submitLocalMessage(migrateOp);\n\t}\n\n\tpublic get currentTree(): IChannel & (LegacySharedTree | ITree) {\n\t\treturn this.newTree ?? this.legacyTree;\n\t}\n\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tconst shimServices =\n\t\t\tthis.runtime.attachState === AttachState.Detached\n\t\t\t\t? new NoDeltasChannelServices(services)\n\t\t\t\t: this.generateShimServicesOnce(services);\n\t\tthis._legacyTree = await this.legacyTreeFactory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tshimServices,\n\t\t\tthis.legacyTreeFactory.attributes\n\t\t);\n\t}\n\tpublic create(): void {\n\t\tthis._legacyTree = this.legacyTreeFactory.create(this.runtime, this.id);\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.currentTree.attributes;\n\t}\n\tpublic getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\treturn this.currentTree.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\tpublic async summarize(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.currentTree.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);\n\t}\n\tpublic isAttached(): boolean {\n\t\treturn this.currentTree.isAttached();\n\t}\n\n\t// Only connect to the legacy shared tree\n\tpublic connect(services: IChannelServices): void {\n\t\tconst shimServices = this.generateShimServicesOnce(services);\n\t\tthis.legacyTree.connect(shimServices);\n\t}\n\n\t// Only reconnect to the new shared tree this limits us to only migrating\n\tprivate reconnect(): void {\n\t\tassert(this.services !== undefined, 0x7e7 /* Not connected */);\n\t\tassert(this.newTree !== undefined, 0x7e8 /* New tree not initialized */);\n\t\tassert(this.postMigrationServices === undefined, 0x830 /* Already reconnected! */);\n\t\t// This method attaches the newTree's delta handler to the MigrationShimDeltaHandler\n\t\tthis.postMigrationServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: new StampDeltaConnection(\n\t\t\t\tthis.services.deltaConnection,\n\t\t\t\tthis.migrationDeltaHandler,\n\t\t\t\tthis.newTree.attributes\n\t\t\t),\n\t\t};\n\t\tthis.newTree.connect(this.postMigrationServices);\n\t}\n\n\t/**\n\t * Only generate the ShimServices once as the underlying DeltaHandler can only be connected to once. If we connect\n\t * twice, we will be in a \"v2\" state even though we really are in a \"v1\" state. We will encounter unexpected op\n\t * dropping behavior or lack thereof and may corrupt the document.\n\t * @param services - the services to generate the shim services from\n\t * @returns shim services\n\t */\n\tprivate generateShimServicesOnce(services: IChannelServices): IShimChannelServices {\n\t\tassert(\n\t\t\tthis.services === undefined && this.preMigrationDeltaConnection === undefined,\n\t\t\t0x7e9 /* Already connected */\n\t\t);\n\t\tthis.services = services;\n\t\tthis.preMigrationDeltaConnection = new PreMigrationDeltaConnection(\n\t\t\tthis.services.deltaConnection,\n\t\t\tthis.migrationDeltaHandler\n\t\t);\n\t\tconst shimServices: IShimChannelServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: this.preMigrationDeltaConnection,\n\t\t};\n\t\treturn shimServices;\n\t}\n\n\tpublic getGCData(fullGC?: boolean | undefined): IGarbageCollectionData {\n\t\treturn this.currentTree.getGCData(fullGC);\n\t}\n\tpublic handle: IFluidHandle<MigrationShim>;\n\tpublic get IFluidLoadable(): IFluidLoadable {\n\t\treturn this;\n\t}\n}\n"]}
1
+ {"version":3,"file":"migrationShim.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShim.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iFAAoE;AAEpE,kEAA6D;AAQ7D,0EAA0G;AAS1G,uEAA8G;AAK9G,yEAAuE;AACvE,qEAA8F;AAC9F,qEAA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CAAC,OAAO,CAAC,UAAU,CACvB;SACD,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;OAMG;IACK,wBAAwB,CAAC,QAA0B;QAC1D,IAAA,iBAAM,EACL,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,2BAA2B,KAAK,SAAS,EAC7E,KAAK,CAAC,uBAAuB,CAC7B,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,2BAA2B,GAAG,IAAI,oDAA2B,CACjE,IAAI,CAAC,QAAQ,CAAC,eAAe,EAC7B,IAAI,CAAC,qBAAqB,CAC1B,CAAC;QACF,MAAM,YAAY,GAAyB;YAC1C,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;YAC1C,eAAe,EAAE,IAAI,CAAC,2BAA2B;SACjD,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,MAA4B;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA9MD,sCA8MC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { EventEmitterEventType } from '@fluid-internal/client-utils';\nimport { AttachState } from '@fluidframework/container-definitions';\nimport type { IEvent, IFluidHandle, IFluidLoadable } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\ttype IChannelAttributes,\n\tIChannelFactory,\n\ttype IFluidDataStoreRuntime,\n\ttype IChannel,\n\ttype IChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { SessionId } from '@fluidframework/id-compressor';\nimport type { IIdCompressorCore } from '@fluidframework/id-compressor/internal';\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from '@fluidframework/runtime-definitions/internal';\nimport { DataProcessingError, EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils/internal';\nimport type { ITree } from '@fluidframework/tree';\n\nimport type { SharedTree as LegacySharedTree, SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';\n\nimport { MigrationShimDeltaHandler } from './migrationDeltaHandler.js';\nimport { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';\nimport { PreMigrationDeltaConnection, StampDeltaConnection } from './shimDeltaConnection.js';\nimport { ShimHandle } from './shimHandle.js';\nimport type { IOpContents, IShim } from './types.js';\n\n/**\n * Interface for migration events to indicate the stage of the migration. There really is two stages: before, and after.\n *\n * @internal\n */\nexport interface IMigrationEvent extends IEvent {\n\t/**\n\t * Event that is emitted when the migration is complete.\n\t */\n\t(event: 'migrated', listener: () => void);\n}\n\n/**\n * Interface for migration operation.\n */\nexport interface IMigrationOp {\n\t/**\n\t * Type of the migration operation.\n\t */\n\ttype: 'barrier';\n\t/**\n\t * Old channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what state of the document was before the migration op initiated at.\n\t */\n\toldAttributes: IChannelAttributes;\n\t/**\n\t * New channel attributes so we can do verification and understand what changed. This will allow future clients to\n\t * accurately reason about what the migration state of the new container is expected to be.\n\t */\n\tnewAttributes: IChannelAttributes;\n}\n\nconst ghostSessionId = '3692b242-46c0-4076-abea-c2ac1e896dee' as SessionId;\n\n/**\n * The MigrationShim loads in place of the legacy SharedTree. It provides API surface for migrating it to the new SharedTree, while also providing access to the current SharedTree for usage.\n *\n * @remarks\n *\n * This MigrationShim is responsible for submitting a migration op, processing the migrate op, swapping from the old\n * tree to the new tree, loading an old tree snapshot and creating an old tree.\n *\n * The MigrationShim expects to always load from a legacy SharedTree snapshot, though by the time it catches up in\n * processing all ops, it may find that the migration has already occurred. After migration occurs, it modifies its\n * attributes to point at the SharedTreeShimFactory. This will cause future clients to load with a SharedTreeShim and\n * the new SharedTree snapshot instead after the next summarization.\n *\n * @internal\n */\nexport class MigrationShim extends EventEmitterWithErrorHandling<IMigrationEvent> implements IShim {\n\tpublic constructor(\n\t\tpublic readonly id: string,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly legacyTreeFactory: LegacySharedTreeFactory,\n\t\tprivate readonly newTreeFactory: IChannelFactory<ITree>,\n\t\tprivate readonly populateNewSharedObjectFn: (legacyTree: LegacySharedTree, newTree: ITree) => void\n\t) {\n\t\tsuper((event: EventEmitterEventType, e: unknown) => this.eventListenerErrorHandler(event, e));\n\t\t// TODO: consider flattening this class\n\t\tthis.migrationDeltaHandler = new MigrationShimDeltaHandler(\n\t\t\tthis.processMigrateOp,\n\t\t\tthis.submitLocalMessage,\n\t\t\tthis.newTreeFactory.attributes\n\t\t);\n\t\tthis.handle = new ShimHandle<MigrationShim>(this);\n\t}\n\n\tprivate readonly processMigrateOp = (message: ISequencedDocumentMessage): boolean => {\n\t\tif (message.type !== MessageType.Operation || (message.contents as Partial<IMigrationOp>).type !== 'barrier') {\n\t\t\treturn false;\n\t\t}\n\t\tconst newTree = this.newTreeFactory.create(this.runtime, this.id);\n\t\tassert(this.preMigrationDeltaConnection !== undefined, 0x82f /* Should be in v1 state */);\n\t\tthis.preMigrationDeltaConnection.disableSubmit();\n\t\tconst { idCompressor } = this.runtime;\n\t\tif (idCompressor !== undefined) {\n\t\t\t(idCompressor as unknown as IIdCompressorCore).beginGhostSession(ghostSessionId, () =>\n\t\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree)\n\t\t\t);\n\t\t} else {\n\t\t\tthis.populateNewSharedObjectFn(this.legacyTree, newTree);\n\t\t}\n\t\tthis.newTree = newTree;\n\t\tthis.reconnect();\n\t\tthis.emit('migrated');\n\t\treturn true;\n\t};\n\n\tprivate readonly migrationDeltaHandler: MigrationShimDeltaHandler;\n\tprivate services?: IChannelServices;\n\tprivate preMigrationDeltaConnection?: PreMigrationDeltaConnection;\n\tprivate postMigrationServices?: IShimChannelServices;\n\n\tprivate _legacyTree: LegacySharedTree | undefined;\n\tprivate get legacyTree(): LegacySharedTree {\n\t\tassert(this._legacyTree !== undefined, 0x7e6 /* Old tree not initialized */);\n\t\treturn this._legacyTree;\n\t}\n\n\tprivate newTree: (IChannel & ITree) | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeError}\n\t */\n\tprivate closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.eventListenerErrorHandler}\n\t */\n\tprivate eventListenerErrorHandler(event: EventEmitterEventType, e: unknown): void {\n\t\tconst error = DataProcessingError.wrapIfUnrecognized(e, 'SharedObjectEventListenerException');\n\t\terror.addTelemetryProperties({ emittedEventName: String(event) });\n\n\t\tthis.closeWithError(error);\n\t\tthrow error;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.closeWithError}\n\t */\n\tprivate closeWithError(error: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>): void {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions, @typescript-eslint/prefer-nullish-coalescing -- intentional behavior\n\t\tif (this.closeError === undefined) {\n\t\t\tthis.closeError = error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.verifyNotClosed}\n\t */\n\tprivate verifyNotClosed(): void {\n\t\tif (this.closeError !== undefined) {\n\t\t\tthrow this.closeError;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.submitLocalMessage}\n\t */\n\tprivate readonly submitLocalMessage = (message: IOpContents): void => {\n\t\tthis.verifyNotClosed();\n\t\t// This is a copy of submit local message from SharedObject\n\t\tif (this.isAttached()) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.services!.deltaConnection.submit(message, undefined);\n\t\t}\n\t};\n\n\t// Migration occurs once this op is read.\n\tpublic submitMigrateOp(): void {\n\t\tconst migrateOp: IMigrationOp = {\n\t\t\ttype: 'barrier',\n\t\t\toldAttributes: this.legacyTreeFactory.attributes,\n\t\t\tnewAttributes: this.newTreeFactory.attributes,\n\t\t};\n\n\t\tthis.submitLocalMessage(migrateOp);\n\t}\n\n\tpublic get currentTree(): IChannel & (LegacySharedTree | ITree) {\n\t\treturn this.newTree ?? this.legacyTree;\n\t}\n\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\tconst shimServices =\n\t\t\tthis.runtime.attachState === AttachState.Detached\n\t\t\t\t? new NoDeltasChannelServices(services)\n\t\t\t\t: this.generateShimServicesOnce(services);\n\t\tthis._legacyTree = await this.legacyTreeFactory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tshimServices,\n\t\t\tthis.legacyTreeFactory.attributes\n\t\t);\n\t}\n\tpublic create(): void {\n\t\tthis._legacyTree = this.legacyTreeFactory.create(this.runtime, this.id);\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.currentTree.attributes;\n\t}\n\tpublic getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\treturn this.currentTree.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\tpublic async summarize(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.currentTree.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);\n\t}\n\tpublic isAttached(): boolean {\n\t\treturn this.currentTree.isAttached();\n\t}\n\n\t// Only connect to the legacy shared tree\n\tpublic connect(services: IChannelServices): void {\n\t\tconst shimServices = this.generateShimServicesOnce(services);\n\t\tthis.legacyTree.connect(shimServices);\n\t}\n\n\t// Only reconnect to the new shared tree this limits us to only migrating\n\tprivate reconnect(): void {\n\t\tassert(this.services !== undefined, 0x7e7 /* Not connected */);\n\t\tassert(this.newTree !== undefined, 0x7e8 /* New tree not initialized */);\n\t\tassert(this.postMigrationServices === undefined, 0x830 /* Already reconnected! */);\n\t\t// This method attaches the newTree's delta handler to the MigrationShimDeltaHandler\n\t\tthis.postMigrationServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: new StampDeltaConnection(\n\t\t\t\tthis.services.deltaConnection,\n\t\t\t\tthis.migrationDeltaHandler,\n\t\t\t\tthis.newTree.attributes\n\t\t\t),\n\t\t};\n\t\tthis.newTree.connect(this.postMigrationServices);\n\t}\n\n\t/**\n\t * Only generate the ShimServices once as the underlying DeltaHandler can only be connected to once. If we connect\n\t * twice, we will be in a \"v2\" state even though we really are in a \"v1\" state. We will encounter unexpected op\n\t * dropping behavior or lack thereof and may corrupt the document.\n\t * @param services - the services to generate the shim services from\n\t * @returns shim services\n\t */\n\tprivate generateShimServicesOnce(services: IChannelServices): IShimChannelServices {\n\t\tassert(\n\t\t\tthis.services === undefined && this.preMigrationDeltaConnection === undefined,\n\t\t\t0x7e9 /* Already connected */\n\t\t);\n\t\tthis.services = services;\n\t\tthis.preMigrationDeltaConnection = new PreMigrationDeltaConnection(\n\t\t\tthis.services.deltaConnection,\n\t\t\tthis.migrationDeltaHandler\n\t\t);\n\t\tconst shimServices: IShimChannelServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: this.preMigrationDeltaConnection,\n\t\t};\n\t\treturn shimServices;\n\t}\n\n\tpublic getGCData(fullGC?: boolean | undefined): IGarbageCollectionData {\n\t\treturn this.currentTree.getGCData(fullGC);\n\t}\n\tpublic handle: IFluidHandle<MigrationShim>;\n\tpublic get IFluidLoadable(): IFluidLoadable {\n\t\treturn this;\n\t}\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IChannelAttributes, type IChannelFactory, type IFluidDataStoreRuntime, type IChannelServices } from '@fluidframework/datastore-definitions/internal';
6
- import { type ITree } from '@fluidframework/tree';
7
- import { type SharedTree as LegacySharedTree, type SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';
5
+ import type { IChannelAttributes, IChannelFactory, IFluidDataStoreRuntime, IChannelServices } from '@fluidframework/datastore-definitions/internal';
6
+ import type { ITree } from '@fluidframework/tree';
7
+ import type { SharedTree as LegacySharedTree, SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';
8
8
  import { MigrationShim } from './migrationShim.js';
9
9
  /**
10
10
  * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link MigrationShim}.
@@ -1 +1 @@
1
- {"version":3,"file":"migrationShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/migrationShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACN,KAAK,UAAU,IAAI,gBAAgB,EACnC,KAAK,iBAAiB,IAAI,uBAAuB,EACjD,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IAE1D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,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C,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,KAAK,IAAI;IAGjG;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;;;;OAKG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAQzB;;;;;;OAMG;IACI,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa;CAMzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"migrationShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAc7D,yDAAmD;AACnD,yCAA6C;AAE7C;;;;;;;;;;;GAWG;AACH,MAAa,oBAAoB;IAChC,YACkB,UAAmC,EACnC,UAAkC,EAClC,oBAA+E;QAF/E,eAAU,GAAV,UAAU,CAAyB;QACnC,eAAU,GAAV,UAAU,CAAwB;QAClC,yBAAoB,GAApB,oBAAoB,CAA2D;IAC9F,CAAC;IAEJ;;;;OAIG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,mKAAmK;QACnK,IAAA,iBAAM,EAAC,IAAA,0BAAe,EAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACrG,MAAM,aAAa,GAAG,IAAI,gCAAa,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAClH,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,aAAa,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,oCAAoC;QACpC,MAAM,aAAa,GAAG,IAAI,gCAAa,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAClH,aAAa,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,aAAa,CAAC;IACtB,CAAC;CACD;AAzDD,oDAyDC","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 {\n\ttype IChannelAttributes,\n\ttype IChannelFactory,\n\ttype IFluidDataStoreRuntime,\n\ttype IChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport { type ITree } from '@fluidframework/tree';\n\nimport {\n\ttype SharedTree as LegacySharedTree,\n\ttype SharedTreeFactory as LegacySharedTreeFactory,\n} from '../SharedTree.js';\n\nimport { MigrationShim } from './migrationShim.js';\nimport { attributesMatch } from './utils.js';\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link MigrationShim}.\n *\n * Creates the migration shim that allows a migration from legacy shared tree to shared tree.\n * @remarks\n *\n * It takes over the attributes of the legacy factory, so that it is loaded instead of the normal legacy factory. Once migration finishes, the shim it produces will change its attributes to those of the new factory - meaning that on the next summarization the shim will write a summary that will cause future clients to load a different factory and shim (the SharedTreeShimFactory and SharedTreeShim).\n * 1. pre-migration\n *\n * @sealed\n * @internal\n */\nexport class MigrationShimFactory implements IChannelFactory {\n\tpublic constructor(\n\t\tprivate readonly oldFactory: LegacySharedTreeFactory,\n\t\tprivate readonly newFactory: IChannelFactory<ITree>,\n\t\tprivate readonly populateNewChannelFn: (oldChannel: LegacySharedTree, newChannel: ITree) => void\n\t) {}\n\n\t/**\n\t * This factory takes over the type of the oldFactory to load in its place. The user must not include the MigrationShimFactory and the oldFactory in the same registry to avoid conflict.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.oldFactory.type;\n\t}\n\n\t/**\n\t * Should be the LegacySharedTree attributes\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.oldFactory.attributes;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.load}\n\t *\n\t * Should be loading the MigrationShim - it should just load the old tree as this makes the factory's\n\t * responsibility simple. Trying to follow the Single Responsibility Principle here.\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes\n\t): Promise<MigrationShim> {\n\t\t// TODO: remove attributes check and move it to an automated test that constructing a MigrationShimFactory and checking its attributes/type matches the oldFactory.\n\t\tassert(attributesMatch(attributes, this.oldFactory.attributes), 0x7ea /* Attributes do not match */);\n\t\tconst migrationShim = new MigrationShim(id, runtime, this.oldFactory, this.newFactory, this.populateNewChannelFn);\n\t\tawait migrationShim.load(services);\n\t\treturn migrationShim;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n\t *\n\t * Create MigrationShim that can hot swap from one DDS to a new DDS. We want the capability of creating an old tree\n\t * as when this code rolls out, there may be clients on the v1 version of the code, and we may want to have a dark\n\t * rollout capability.\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): MigrationShim {\n\t\t// Maybe this should throw an error.\n\t\tconst migrationShim = new MigrationShim(id, runtime, this.oldFactory, this.newFactory, this.populateNewChannelFn);\n\t\tmigrationShim.create();\n\t\treturn migrationShim;\n\t}\n}\n"]}
1
+ {"version":3,"file":"migrationShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/migrationShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAW7D,yDAAmD;AACnD,yCAA6C;AAE7C;;;;;;;;;;;GAWG;AACH,MAAa,oBAAoB;IAChC,YACkB,UAAmC,EACnC,UAAkC,EAClC,oBAA+E;QAF/E,eAAU,GAAV,UAAU,CAAyB;QACnC,eAAU,GAAV,UAAU,CAAwB;QAClC,yBAAoB,GAApB,oBAAoB,CAA2D;IAC9F,CAAC;IAEJ;;;;OAIG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,mKAAmK;QACnK,IAAA,iBAAM,EAAC,IAAA,0BAAe,EAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACrG,MAAM,aAAa,GAAG,IAAI,gCAAa,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAClH,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,aAAa,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,oCAAoC;QACpC,MAAM,aAAa,GAAG,IAAI,gCAAa,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAClH,aAAa,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,aAAa,CAAC;IACtB,CAAC;CACD;AAzDD,oDAyDC","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 type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport type { ITree } from '@fluidframework/tree';\n\nimport type { SharedTree as LegacySharedTree, SharedTreeFactory as LegacySharedTreeFactory } from '../SharedTree.js';\n\nimport { MigrationShim } from './migrationShim.js';\nimport { attributesMatch } from './utils.js';\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link MigrationShim}.\n *\n * Creates the migration shim that allows a migration from legacy shared tree to shared tree.\n * @remarks\n *\n * It takes over the attributes of the legacy factory, so that it is loaded instead of the normal legacy factory. Once migration finishes, the shim it produces will change its attributes to those of the new factory - meaning that on the next summarization the shim will write a summary that will cause future clients to load a different factory and shim (the SharedTreeShimFactory and SharedTreeShim).\n * 1. pre-migration\n *\n * @sealed\n * @internal\n */\nexport class MigrationShimFactory implements IChannelFactory {\n\tpublic constructor(\n\t\tprivate readonly oldFactory: LegacySharedTreeFactory,\n\t\tprivate readonly newFactory: IChannelFactory<ITree>,\n\t\tprivate readonly populateNewChannelFn: (oldChannel: LegacySharedTree, newChannel: ITree) => void\n\t) {}\n\n\t/**\n\t * This factory takes over the type of the oldFactory to load in its place. The user must not include the MigrationShimFactory and the oldFactory in the same registry to avoid conflict.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.oldFactory.type;\n\t}\n\n\t/**\n\t * Should be the LegacySharedTree attributes\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.oldFactory.attributes;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.load}\n\t *\n\t * Should be loading the MigrationShim - it should just load the old tree as this makes the factory's\n\t * responsibility simple. Trying to follow the Single Responsibility Principle here.\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes\n\t): Promise<MigrationShim> {\n\t\t// TODO: remove attributes check and move it to an automated test that constructing a MigrationShimFactory and checking its attributes/type matches the oldFactory.\n\t\tassert(attributesMatch(attributes, this.oldFactory.attributes), 0x7ea /* Attributes do not match */);\n\t\tconst migrationShim = new MigrationShim(id, runtime, this.oldFactory, this.newFactory, this.populateNewChannelFn);\n\t\tawait migrationShim.load(services);\n\t\treturn migrationShim;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n\t *\n\t * Create MigrationShim that can hot swap from one DDS to a new DDS. We want the capability of creating an old tree\n\t * as when this code rolls out, there may be clients on the v1 version of the code, and we may want to have a dark\n\t * rollout capability.\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): MigrationShim {\n\t\t// Maybe this should throw an error.\n\t\tconst migrationShim = new MigrationShim(id, runtime, this.oldFactory, this.newFactory, this.populateNewChannelFn);\n\t\tmigrationShim.create();\n\t\treturn migrationShim;\n\t}\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
5
+ import type { IChannelAttributes, IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
6
6
  import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
7
- import { type IShimDeltaHandler } from './types.js';
7
+ import type { IShimDeltaHandler } from './types.js';
8
8
  /**
9
9
  * Handles incoming and outgoing deltas/ops for the SharedTreeShim distributed data structure.
10
10
  * This serves as an adapter to the real DeltaHandler, filter/process migration ops
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAE7G,OAAO,KAAK,EAAE,yBAAyB,EAA2B,MAAM,8CAA8C,CAAC;AAEvH,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtE;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,kBAAkB;IAElE,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,CAAC,SAAS,CAAS;IAC1B,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAEM,YAAY,IAAI,IAAI;IAIpB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKpD,mBAAmB,IAAI,OAAO;IAIrC,OAAO,CAAC,OAAO;IAsBR,eAAe,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,IAAI;IAQpE,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAK5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAS3D,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAQ9C;;;OAGG;IACI,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQnE;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAYpB"}
1
+ {"version":3,"file":"sharedTreeDeltaHandler.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAExG,OAAO,KAAK,EAAE,yBAAyB,EAA2B,MAAM,8CAA8C,CAAC;AAEvH,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGjE;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,kBAAkB;IAElE,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,CAAC,SAAS,CAAS;IAC1B,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAEM,YAAY,IAAI,IAAI;IAIpB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKpD,mBAAmB,IAAI,OAAO;IAIrC,OAAO,CAAC,OAAO;IAsBR,eAAe,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,IAAI;IAQpE,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAK5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAS3D,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAQ9C;;;OAGG;IACI,QAAQ,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQnE;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAYpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,0EAA0G;A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AI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,QAAqB;QACzC,IAAI,CAAC,IAAA,sBAAW,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gCAAgC;QAChC,IAAA,iBAAM,EACL,IAAA,0BAAe,EAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AA7GD,gEA6GC","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 { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { IRuntimeMessageCollection, IRuntimeMessagesContent } from '@fluidframework/runtime-definitions/internal';\n\nimport { type IOpContents, type IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the SharedTreeShim distributed data structure.\n * This serves as an adapter to the real DeltaHandler, filter/process migration ops\n *\n * This should just have the ability to drop v1 & migrate ops, and process v2 ops. There may be an opportunity to\n * combine this class with the MigrationShimDeltaHandler, but for now the classes are separated. Once it is clear what\n * exact code can be shared between the two classes is and how it can be merge, we may figure out a way of merging\n * MigrationShimDeltaHandler and SharedTreeShimDeltaHandler.\n */\nexport class SharedTreeShimDeltaHandler implements IShimDeltaHandler {\n\tpublic constructor(private readonly attributes: IChannelAttributes) {}\n\n\tprivate _handler?: IDeltaHandler;\n\tprivate get handler(): IDeltaHandler {\n\t\tconst handler = this._handler;\n\t\tassert(handler !== undefined, 0x7eb /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic attachTreeDeltaHandler(handler: IDeltaHandler): void {\n\t\tassert(this._handler === undefined, 0x7ec /* Should only be able to connect once! */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this._handler !== undefined;\n\t}\n\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\t// Drop v1 ops\n\t\tassert(this.hasTreeDeltaHandler(), 0x831 /* Can't process ops before attaching tree handler */);\n\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\tconst messagesContent: IRuntimeMessagesContent[] = [\n\t\t\t{\n\t\t\t\tcontents,\n\t\t\t\tlocalOpMetadata,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t},\n\t\t];\n\t\treturn this.handler.processMessages({ envelope: message, messagesContent, local });\n\t}\n\n\tpublic processMessages(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messagesCollection;\n\t\tfor (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {\n\t\t\tthis.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);\n\t\t}\n\t}\n\n\t// No idea whether any of the below 4 methods work as expected\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.handler.setConnectionState(connected);\n\t}\n\n\t// Resubmitting v1 ops should fail. We should not be resubmitting v1 ops.\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x832 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.reSubmit(contents, localOpMetadata);\n\t}\n\n\t// We are not capable of applying stashed v1 ops.\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x8ab /* SharedTreeShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.handler.applyStashedOp(contents);\n\t}\n\n\t/**\n\t * We cannot rollback v1 ops, we have already migrated and are in v2 state, thus we should not be able to generate.\n\t * v1 ops\n\t */\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x833 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.rollback?.(contents, localOpMetadata);\n\t}\n\n\t/**\n\t * The SharedTreeShimDeltaHandler is already in a v2 state. Thus it should drop all v1 and migrate ops.\n\t * @param contents - the interrogable op contents to figure out if this is a v1 op, a migrate op, or a v2 op.\n\t * @returns whether or not the op is a v1 or migrate op and should be dropped/ignored.\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x834 /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTreeDeltaHandler.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeDeltaHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,0EAA0G;AAI1G,yCAA0D;AAE1D;;;;;;;;GAQG;AACH,MAAa,0BAA0B;IACtC,YAAoC,UAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;QAS1D,cAAS,GAAG,KAAK,CAAC;IAT2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AA,sBAAW,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QAED,gCAAgC;QAChC,IAAA,iBAAM,EACL,IAAA,0BAAe,EAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,EAC9D,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AA7GD,gEA6GC","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 type { IChannelAttributes, IDeltaHandler } from '@fluidframework/datastore-definitions/internal';\nimport { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';\nimport type { IRuntimeMessageCollection, IRuntimeMessagesContent } from '@fluidframework/runtime-definitions/internal';\n\nimport type { IOpContents, IShimDeltaHandler } from './types.js';\nimport { attributesMatch, isStampedOp } from './utils.js';\n\n/**\n * Handles incoming and outgoing deltas/ops for the SharedTreeShim distributed data structure.\n * This serves as an adapter to the real DeltaHandler, filter/process migration ops\n *\n * This should just have the ability to drop v1 & migrate ops, and process v2 ops. There may be an opportunity to\n * combine this class with the MigrationShimDeltaHandler, but for now the classes are separated. Once it is clear what\n * exact code can be shared between the two classes is and how it can be merge, we may figure out a way of merging\n * MigrationShimDeltaHandler and SharedTreeShimDeltaHandler.\n */\nexport class SharedTreeShimDeltaHandler implements IShimDeltaHandler {\n\tpublic constructor(private readonly attributes: IChannelAttributes) {}\n\n\tprivate _handler?: IDeltaHandler;\n\tprivate get handler(): IDeltaHandler {\n\t\tconst handler = this._handler;\n\t\tassert(handler !== undefined, 0x7eb /* No handler to process op */);\n\t\treturn handler;\n\t}\n\n\tprivate _attached = false;\n\tpublic get attached(): boolean {\n\t\treturn this._attached;\n\t}\n\n\tpublic markAttached(): void {\n\t\tthis._attached = true;\n\t}\n\n\tpublic attachTreeDeltaHandler(handler: IDeltaHandler): void {\n\t\tassert(this._handler === undefined, 0x7ec /* Should only be able to connect once! */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic hasTreeDeltaHandler(): boolean {\n\t\treturn this._handler !== undefined;\n\t}\n\n\tprivate process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n\t\t// This allows us to process the migrate op and prevent the shared object from processing the wrong ops\n\t\t// Drop v1 ops\n\t\tassert(this.hasTreeDeltaHandler(), 0x831 /* Can't process ops before attaching tree handler */);\n\n\t\tif (message.type !== MessageType.Operation) {\n\t\t\treturn;\n\t\t}\n\t\tconst contents = message.contents as IOpContents;\n\t\tif (this.shouldDropOp(contents)) {\n\t\t\treturn;\n\t\t}\n\t\tconst messagesContent: IRuntimeMessagesContent[] = [\n\t\t\t{\n\t\t\t\tcontents,\n\t\t\t\tlocalOpMetadata,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t},\n\t\t];\n\t\treturn this.handler.processMessages({ envelope: message, messagesContent, local });\n\t}\n\n\tpublic processMessages(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messagesCollection;\n\t\tfor (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {\n\t\t\tthis.process({ ...envelope, contents, clientSequenceNumber }, local, localOpMetadata);\n\t\t}\n\t}\n\n\t// No idea whether any of the below 4 methods work as expected\n\tpublic setConnectionState(connected: boolean): void {\n\t\treturn this.handler.setConnectionState(connected);\n\t}\n\n\t// Resubmitting v1 ops should fail. We should not be resubmitting v1 ops.\n\tpublic reSubmit(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x832 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.reSubmit(contents, localOpMetadata);\n\t}\n\n\t// We are not capable of applying stashed v1 ops.\n\tpublic applyStashedOp(contents: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x8ab /* SharedTreeShim should not be able to apply v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\tthis.handler.applyStashedOp(contents);\n\t}\n\n\t/**\n\t * We cannot rollback v1 ops, we have already migrated and are in v2 state, thus we should not be able to generate.\n\t * v1 ops\n\t */\n\tpublic rollback?(contents: unknown, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\t!this.shouldDropOp(contents as IOpContents),\n\t\t\t0x833 /* Should not be able to rollback v1 ops as they shouldn't have been created locally. */\n\t\t);\n\t\treturn this.handler.rollback?.(contents, localOpMetadata);\n\t}\n\n\t/**\n\t * The SharedTreeShimDeltaHandler is already in a v2 state. Thus it should drop all v1 and migrate ops.\n\t * @param contents - the interrogable op contents to figure out if this is a v1 op, a migrate op, or a v2 op.\n\t * @returns whether or not the op is a v1 or migrate op and should be dropped/ignored.\n\t */\n\tprivate shouldDropOp(contents: IOpContents): boolean {\n\t\tif (!isStampedOp(contents)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Don't drop v2 ops in v2 state\n\t\tassert(\n\t\t\tattributesMatch(contents.fluidMigrationStamp, this.attributes),\n\t\t\t0x834 /* Unexpected v2 op with mismatched attributes */\n\t\t);\n\t\treturn false;\n\t}\n}\n"]}
@@ -2,11 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';
6
- import { type IChannel, type IChannelAttributes, type IChannelFactory, type IFluidDataStoreRuntime, type IChannelServices } from '@fluidframework/datastore-definitions/internal';
7
- import { type IExperimentalIncrementalSummaryContext, type IGarbageCollectionData, type ISummaryTreeWithStats, type ITelemetryContext } from '@fluidframework/runtime-definitions/internal';
8
- import { type ITree } from '@fluidframework/tree';
9
- import { type IShim } from './types.js';
5
+ import type { IFluidHandle, IFluidLoadable } from '@fluidframework/core-interfaces';
6
+ import type { IChannel, IChannelAttributes, IChannelFactory, IFluidDataStoreRuntime, IChannelServices } from '@fluidframework/datastore-definitions/internal';
7
+ import type { IExperimentalIncrementalSummaryContext, IGarbageCollectionData, ISummaryTreeWithStats, ITelemetryContext } from '@fluidframework/runtime-definitions/internal';
8
+ import type { ITree } from '@fluidframework/tree';
9
+ import type { IShim } from './types.js';
10
10
  /**
11
11
  * SharedTreeShim is loaded by clients that join after the migration completes, and holds the new SharedTree.
12
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeShim.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShim.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEzF,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,KAAK,sCAAsC,EAC3C,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;GAUG;AACH,qBAAa,cAAe,YAAW,KAAK;aAE1B,EAAE,EAAE,MAAM;aACV,OAAO,EAAE,sBAAsB;aAC/B,iBAAiB,EAAE,eAAe,CAAC,KAAK,CAAC;gBAFzC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,iBAAiB,EAAE,eAAe,CAAC,KAAK,CAAC;IAM1D,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA6B;IACrE,OAAO,CAAC,QAAQ,CAAC,CAAmB;IACpC,OAAO,CAAC,YAAY,CAAC,CAAmB;IACxC,IAAW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,CAAC,eAAe,EAC7B,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CAAC,iBAAiB,CAAC,UAAU,CACjC;SACD,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,MAA4B;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACD;AAtFD,wCAsFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from '@fluidframework/container-definitions';\nimport { type IFluidHandle, type IFluidLoadable } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\ttype IChannel,\n\ttype IChannelAttributes,\n\ttype IChannelFactory,\n\ttype IFluidDataStoreRuntime,\n\ttype IChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport {\n\ttype IExperimentalIncrementalSummaryContext,\n\ttype IGarbageCollectionData,\n\ttype ISummaryTreeWithStats,\n\ttype ITelemetryContext,\n} from '@fluidframework/runtime-definitions/internal';\nimport { type ITree } from '@fluidframework/tree';\n\nimport { SharedTreeShimDeltaHandler } from './sharedTreeDeltaHandler.js';\nimport { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';\nimport { StampDeltaConnection } from './shimDeltaConnection.js';\nimport { ShimHandle } from './shimHandle.js';\nimport { type IShim } from './types.js';\n\n/**\n * SharedTreeShim is loaded by clients that join after the migration completes, and holds the new SharedTree.\n *\n * @remarks\n *\n * Its sole responsibility should be to drop v1 & migrate ops. It should not be responsible for any other migration\n * logic. This should make the classes easier to reason about.\n * about.\n *\n * @internal\n */\nexport class SharedTreeShim implements IShim {\n\tpublic constructor(\n\t\tpublic readonly id: string,\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly sharedTreeFactory: IChannelFactory<ITree>\n\t) {\n\t\tthis.newTreeShimDeltaHandler = new SharedTreeShimDeltaHandler(sharedTreeFactory.attributes);\n\t\tthis.handle = new ShimHandle<SharedTreeShim>(this);\n\t}\n\n\tprivate readonly newTreeShimDeltaHandler: SharedTreeShimDeltaHandler;\n\tprivate services?: IChannelServices;\n\tprivate _currentTree?: ITree & IChannel;\n\tpublic get currentTree(): ITree & IChannel {\n\t\tassert(this._currentTree !== undefined, 0x7ed /* No current tree initialized */);\n\t\treturn this._currentTree;\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.currentTree.attributes;\n\t}\n\n\tpublic handle: IFluidHandle<SharedTreeShim>;\n\tpublic get IFluidLoadable(): IFluidLoadable {\n\t\treturn this;\n\t}\n\tpublic getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\treturn this.currentTree.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\tpublic async summarize(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.currentTree.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);\n\t}\n\tpublic isAttached(): boolean {\n\t\treturn this.currentTree.isAttached();\n\t}\n\tpublic connect(services: IChannelServices): void {\n\t\tconst shimServices = this.generateShimServicesOnce(services);\n\t\treturn this.currentTree.connect(shimServices);\n\t}\n\n\t// The goal here is to mimic the SharedObject.load functionality\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\t// This weird shimServices logic is to enable rehydration of the SharedTreeShim from a snapshot in a detached\n\t\t// state.\n\t\tconst shimServices =\n\t\t\tthis.runtime.attachState === AttachState.Detached\n\t\t\t\t? new NoDeltasChannelServices(services)\n\t\t\t\t: this.generateShimServicesOnce(services);\n\t\tthis._currentTree = await this.sharedTreeFactory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tshimServices,\n\t\t\tthis.sharedTreeFactory.attributes\n\t\t);\n\t}\n\n\tpublic create(): void {\n\t\tthis._currentTree = this.sharedTreeFactory.create(this.runtime, this.id);\n\t}\n\n\tprivate generateShimServicesOnce(services: IChannelServices): IShimChannelServices {\n\t\tassert(this.services === undefined, 0x7ee /* Already connected */);\n\t\tthis.services = services;\n\t\tconst shimServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: new StampDeltaConnection(\n\t\t\t\tthis.services.deltaConnection,\n\t\t\t\tthis.newTreeShimDeltaHandler,\n\t\t\t\tthis.sharedTreeFactory.attributes\n\t\t\t),\n\t\t};\n\t\treturn shimServices;\n\t}\n\n\tpublic getGCData(fullGC?: boolean | undefined): IGarbageCollectionData {\n\t\treturn this.currentTree.getGCData(fullGC);\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTreeShim.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShim.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AAEpE,kEAA6D;AAgB7D,2EAAyE;AACzE,qEAA8F;AAC9F,qEAAgE;AAChE,mDAA6C;AAG7C;;;;;;;;;;GAUG;AACH,MAAa,cAAc;IAC1B,YACiB,EAAU,EACV,OAA+B,EAC/B,iBAAyC;QAFzC,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAwB;QAC/B,sBAAiB,GAAjB,iBAAiB,CAAwB;QAEzD,IAAI,CAAC,uBAAuB,GAAG,IAAI,sDAA0B,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC5F,IAAI,CAAC,MAAM,GAAG,IAAI,0BAAU,CAAiB,IAAI,CAAC,CAAC;IACpD,CAAC;IAKD,IAAW,WAAW;QACrB,IAAA,iBAAM,EAAC,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACjF,OA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jC,CAAC;IACH,CAAC;IAEM,MAAM;QACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAEO,wBAAwB,CAAC,QAA0B;QAC1D,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,YAAY,GAAG;YACpB,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;YAC1C,eAAe,EAAE,IAAI,6CAAoB,CACxC,IAAI,CAAC,QAAQ,CAAC,eAAe,EAC7B,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CAAC,iBAAiB,CAAC,UAAU,CACjC;SACD,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,MAA4B;QAC5C,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACD;AAtFD,wCAsFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from '@fluidframework/container-definitions';\nimport type { IFluidHandle, IFluidLoadable } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport type {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from '@fluidframework/runtime-definitions/internal';\nimport type { ITree } from '@fluidframework/tree';\n\nimport { SharedTreeShimDeltaHandler } from './sharedTreeDeltaHandler.js';\nimport { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';\nimport { StampDeltaConnection } from './shimDeltaConnection.js';\nimport { ShimHandle } from './shimHandle.js';\nimport type { IShim } from './types.js';\n\n/**\n * SharedTreeShim is loaded by clients that join after the migration completes, and holds the new SharedTree.\n *\n * @remarks\n *\n * Its sole responsibility should be to drop v1 & migrate ops. It should not be responsible for any other migration\n * logic. This should make the classes easier to reason about.\n * about.\n *\n * @internal\n */\nexport class SharedTreeShim implements IShim {\n\tpublic constructor(\n\t\tpublic readonly id: string,\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly sharedTreeFactory: IChannelFactory<ITree>\n\t) {\n\t\tthis.newTreeShimDeltaHandler = new SharedTreeShimDeltaHandler(sharedTreeFactory.attributes);\n\t\tthis.handle = new ShimHandle<SharedTreeShim>(this);\n\t}\n\n\tprivate readonly newTreeShimDeltaHandler: SharedTreeShimDeltaHandler;\n\tprivate services?: IChannelServices;\n\tprivate _currentTree?: ITree & IChannel;\n\tpublic get currentTree(): ITree & IChannel {\n\t\tassert(this._currentTree !== undefined, 0x7ed /* No current tree initialized */);\n\t\treturn this._currentTree;\n\t}\n\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.currentTree.attributes;\n\t}\n\n\tpublic handle: IFluidHandle<SharedTreeShim>;\n\tpublic get IFluidLoadable(): IFluidLoadable {\n\t\treturn this;\n\t}\n\tpublic getAttachSummary(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined\n\t): ISummaryTreeWithStats {\n\t\treturn this.currentTree.getAttachSummary(fullTree, trackState, telemetryContext);\n\t}\n\tpublic async summarize(\n\t\tfullTree?: boolean | undefined,\n\t\ttrackState?: boolean | undefined,\n\t\ttelemetryContext?: ITelemetryContext | undefined,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined\n\t): Promise<ISummaryTreeWithStats> {\n\t\treturn this.currentTree.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);\n\t}\n\tpublic isAttached(): boolean {\n\t\treturn this.currentTree.isAttached();\n\t}\n\tpublic connect(services: IChannelServices): void {\n\t\tconst shimServices = this.generateShimServicesOnce(services);\n\t\treturn this.currentTree.connect(shimServices);\n\t}\n\n\t// The goal here is to mimic the SharedObject.load functionality\n\tpublic async load(services: IChannelServices): Promise<void> {\n\t\t// This weird shimServices logic is to enable rehydration of the SharedTreeShim from a snapshot in a detached\n\t\t// state.\n\t\tconst shimServices =\n\t\t\tthis.runtime.attachState === AttachState.Detached\n\t\t\t\t? new NoDeltasChannelServices(services)\n\t\t\t\t: this.generateShimServicesOnce(services);\n\t\tthis._currentTree = await this.sharedTreeFactory.load(\n\t\t\tthis.runtime,\n\t\t\tthis.id,\n\t\t\tshimServices,\n\t\t\tthis.sharedTreeFactory.attributes\n\t\t);\n\t}\n\n\tpublic create(): void {\n\t\tthis._currentTree = this.sharedTreeFactory.create(this.runtime, this.id);\n\t}\n\n\tprivate generateShimServicesOnce(services: IChannelServices): IShimChannelServices {\n\t\tassert(this.services === undefined, 0x7ee /* Already connected */);\n\t\tthis.services = services;\n\t\tconst shimServices = {\n\t\t\tobjectStorage: this.services.objectStorage,\n\t\t\tdeltaConnection: new StampDeltaConnection(\n\t\t\t\tthis.services.deltaConnection,\n\t\t\t\tthis.newTreeShimDeltaHandler,\n\t\t\t\tthis.sharedTreeFactory.attributes\n\t\t\t),\n\t\t};\n\t\treturn shimServices;\n\t}\n\n\tpublic getGCData(fullGC?: boolean | undefined): IGarbageCollectionData {\n\t\treturn this.currentTree.getGCData(fullGC);\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IChannelAttributes, type IChannelFactory, type IFluidDataStoreRuntime, type IChannelServices } from '@fluidframework/datastore-definitions/internal';
5
+ import type { IChannelAttributes, IChannelFactory, IFluidDataStoreRuntime, IChannelServices } from '@fluidframework/datastore-definitions/internal';
6
6
  import type { ITree } from '@fluidframework/tree';
7
7
  import { SharedTreeShim } from './sharedTreeShim.js';
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC;IAEnE;;;;;OAKG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;;OAKG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;;;OAIG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAQ1B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK1E"}
1
+ {"version":3,"file":"sharedTreeShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD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K,CAAC,6BAA6B,CAAC,CAAC;QAClG,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,cAAc,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AApDD,sDAoDC","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 {\n\ttype IChannelAttributes,\n\ttype IChannelFactory,\n\ttype IFluidDataStoreRuntime,\n\ttype IChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport type { ITree } from '@fluidframework/tree';\n\nimport { SharedTreeShim } from './sharedTreeShim.js';\nimport { attributesMatch } from './utils.js';\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedTreeShim}.\n *\n * Creates the migration shim that allows a migration from legacy shared tree to shared tree.\n * Note: There may be a need for 3 different factories for different parts of the migration.\n * That or three different shims. Potentially we can just do 2 as 2 and 3 can be combined.\n * 1. pre-migration\n * 2. after a summary has been generated but there may still be potential v1 ops\n * 3. post-migration after a summary has been generated and the msn has moved far enough forward for only v2 ops\n *\n * @sealed\n * @internal\n */\nexport class SharedTreeShimFactory implements IChannelFactory {\n\tpublic constructor(private readonly factory: IChannelFactory<ITree>) {}\n\n\t/**\n\t * Can only load the new SharedTree - this allows our snapshots to be simple. We do not have to consider any new\n\t * unique snapshot formats and how to load from them.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.factory.type;\n\t}\n\n\t/**\n\t * Should be the new SharedTree attributes - this should indicate what type of tree snapshot we are expecting or\n\t * are capable of loading from.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.factory.attributes;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.load}\n\t *\n\t * Should be loading the SharedTreeShim from a new SharedTree snapshot only.\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes\n\t): Promise<SharedTreeShim> {\n\t\t// TODO: remove attributes check and move it to an automated test that constructing a SharedTreeShimFactory and checking its attributes/type matches the oldFactory.\n\t\tassert(attributesMatch(attributes, this.factory.attributes), 0x7ef /* Attributes do not match */);\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tawait sharedTreeShim.load(services);\n\t\treturn sharedTreeShim;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n\t *\n\t * Should be only creating the SharedTreeShim, which will only generate a new SharedTree snapshot. That way we do\n\t * not have the capability of accidentally creating a LegacySharedTree snapshot.\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeShim {\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tsharedTreeShim.create();\n\t\treturn sharedTreeShim;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedTreeShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAS7D,2DAAqD;AACrD,yCAA6C;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAqB;IACjC,YAAoC,OAA+B;QAA/B,YAAO,GAAP,OAAO,CAAwB;IAAG,CAAC;IAEvE;;;;;OAKG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,oKAAoK;QACpK,IAAA,iBAAM,EAAC,IAAA,0BAAe,EAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClG,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,cAAc,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AApDD,sDAoDC","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 type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport type { ITree } from '@fluidframework/tree';\n\nimport { SharedTreeShim } from './sharedTreeShim.js';\nimport { attributesMatch } from './utils.js';\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedTreeShim}.\n *\n * Creates the migration shim that allows a migration from legacy shared tree to shared tree.\n * Note: There may be a need for 3 different factories for different parts of the migration.\n * That or three different shims. Potentially we can just do 2 as 2 and 3 can be combined.\n * 1. pre-migration\n * 2. after a summary has been generated but there may still be potential v1 ops\n * 3. post-migration after a summary has been generated and the msn has moved far enough forward for only v2 ops\n *\n * @sealed\n * @internal\n */\nexport class SharedTreeShimFactory implements IChannelFactory {\n\tpublic constructor(private readonly factory: IChannelFactory<ITree>) {}\n\n\t/**\n\t * Can only load the new SharedTree - this allows our snapshots to be simple. We do not have to consider any new\n\t * unique snapshot formats and how to load from them.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.factory.type;\n\t}\n\n\t/**\n\t * Should be the new SharedTree attributes - this should indicate what type of tree snapshot we are expecting or\n\t * are capable of loading from.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.factory.attributes;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.load}\n\t *\n\t * Should be loading the SharedTreeShim from a new SharedTree snapshot only.\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes\n\t): Promise<SharedTreeShim> {\n\t\t// TODO: remove attributes check and move it to an automated test that constructing a SharedTreeShimFactory and checking its attributes/type matches the oldFactory.\n\t\tassert(attributesMatch(attributes, this.factory.attributes), 0x7ef /* Attributes do not match */);\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tawait sharedTreeShim.load(services);\n\t\treturn sharedTreeShim;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n\t *\n\t * Should be only creating the SharedTreeShim, which will only generate a new SharedTree snapshot. That way we do\n\t * not have the capability of accidentally creating a LegacySharedTree snapshot.\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeShim {\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tsharedTreeShim.create();\n\t\treturn sharedTreeShim;\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type IChannelServices, type IChannelStorageService, type IDeltaConnection } from '@fluidframework/datastore-definitions/internal';
5
+ import type { IChannelServices, IChannelStorageService, IDeltaConnection } from '@fluidframework/datastore-definitions/internal';
6
6
  /**
7
7
  * ShimChannelServices wraps an existing IChannelServices object and provides a new ShimDeltaConnection
8
8
  * object in place of the original deltaConnection object.
@@ -1 +1 @@
1
- {"version":3,"file":"shimChannelServices.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,MAAM,gDAAgD,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC7D,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;gBAC5C,eAAe,EAAE,gBAAgB;IAIpD,IAAW,eAAe,IAAI,gBAAgB,CAE7C;IACD,SAAgB,aAAa,EAAE,sBAAsB,CAAC;CACtD"}
1
+ {"version":3,"file":"shimChannelServices.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC7D,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;gBAC5C,eAAe,EAAE,gBAAgB;IAIpD,IAAW,eAAe,IAAI,gBAAgB,CAE7C;IACD,SAAgB,aAAa,EAAE,sBAAsB,CAAC;CACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"shimChannelServices.js","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAuBH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,uBAAuB;IACnC,YAAmB,eAAiC;QACnD,IAAI,CAAC,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;IACpD,CAAC;IAED,IAAW,eAAe;QACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACjD,CAAC;CAED;AATD,0DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype IChannelServices,\n\ttype IChannelStorageService,\n\ttype IDeltaConnection,\n} from '@fluidframework/datastore-definitions/internal';\n\n/**\n * ShimChannelServices wraps an existing IChannelServices object and provides a new ShimDeltaConnection\n * object in place of the original deltaConnection object.\n *\n * ShimChannelServices allows us to encapsulate all the wrapping logic without having to modify the original services.\n *\n * At some point, in the SharedObject code we call this.services.deltaConnection.attach(this.handler). Therefore before\n * we call attach, we need to swap out the deltaConnection object for the ShimDeltaConnection object. This makes\n * it consistent as we will always be passing this shim\n */\nexport interface IShimChannelServices extends IChannelServices {\n\treadonly objectStorage: IChannelStorageService;\n\treadonly deltaConnection: IDeltaConnection;\n}\n\n/**\n * NoDeltasChannelServices wraps an existing IChannelServices object. During rehydration of a container, loading in a\n * detached state, we only want to connect to the deltaConnection once on attached. We also only want to set the\n * channel services once. This enables us to allow deltaHandler attach only once, even though there are flows that\n * call only load, only connect, and load and then connect.\n *\n * Steps:\n * 1. Rehydrate/load SharedObject in detached container runtime state\n * 2. Attach detached container runtime\n * 3. Connect SharedObject.\n *\n * Refer to SharedObject.load for the scenario.\n *\n * This potentially can be baked into the ShimChannelServices.\n *\n * TODO: convert this to a test and remove usage of this class\n */\nexport class NoDeltasChannelServices implements IChannelServices {\n\tpublic constructor(channelServices: IChannelServices) {\n\t\tthis.objectStorage = channelServices.objectStorage;\n\t}\n\n\tpublic get deltaConnection(): IDeltaConnection {\n\t\tthrow new Error('No deltaConnection available');\n\t}\n\tpublic readonly objectStorage: IChannelStorageService;\n}\n"]}
1
+ {"version":3,"file":"shimChannelServices.js","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAuBH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,uBAAuB;IACnC,YAAmB,eAAiC;QACnD,IAAI,CAAC,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;IACpD,CAAC;IAED,IAAW,eAAe;QACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACjD,CAAC;CAED;AATD,0DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelServices,\n\tIChannelStorageService,\n\tIDeltaConnection,\n} from '@fluidframework/datastore-definitions/internal';\n\n/**\n * ShimChannelServices wraps an existing IChannelServices object and provides a new ShimDeltaConnection\n * object in place of the original deltaConnection object.\n *\n * ShimChannelServices allows us to encapsulate all the wrapping logic without having to modify the original services.\n *\n * At some point, in the SharedObject code we call this.services.deltaConnection.attach(this.handler). Therefore before\n * we call attach, we need to swap out the deltaConnection object for the ShimDeltaConnection object. This makes\n * it consistent as we will always be passing this shim\n */\nexport interface IShimChannelServices extends IChannelServices {\n\treadonly objectStorage: IChannelStorageService;\n\treadonly deltaConnection: IDeltaConnection;\n}\n\n/**\n * NoDeltasChannelServices wraps an existing IChannelServices object. During rehydration of a container, loading in a\n * detached state, we only want to connect to the deltaConnection once on attached. We also only want to set the\n * channel services once. This enables us to allow deltaHandler attach only once, even though there are flows that\n * call only load, only connect, and load and then connect.\n *\n * Steps:\n * 1. Rehydrate/load SharedObject in detached container runtime state\n * 2. Attach detached container runtime\n * 3. Connect SharedObject.\n *\n * Refer to SharedObject.load for the scenario.\n *\n * This potentially can be baked into the ShimChannelServices.\n *\n * TODO: convert this to a test and remove usage of this class\n */\nexport class NoDeltasChannelServices implements IChannelServices {\n\tpublic constructor(channelServices: IChannelServices) {\n\t\tthis.objectStorage = channelServices.objectStorage;\n\t}\n\n\tpublic get deltaConnection(): IDeltaConnection {\n\t\tthrow new Error('No deltaConnection available');\n\t}\n\tpublic readonly objectStorage: IChannelStorageService;\n}\n"]}
@@ -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 { type IChannelAttributes, type IDeltaConnection, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
6
- import { type IShimDeltaHandler, type IUnstampedContents } from './types.js';
5
+ import type { IChannelAttributes, IDeltaConnection, IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
6
+ import type { IShimDeltaHandler, IUnstampedContents } from './types.js';
7
7
  /**
8
8
  * Represents a connection to a Shim data store that can receive and submit deltas.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"shimDeltaConnection.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;;;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eAAe,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,OAAsB;QACnC,qDAAqD;QACrD,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACnD,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QACtC,CAAC;IACF,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACD;AAzCD,oDAyCC","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 {\n\ttype IChannelAttributes,\n\ttype IDeltaConnection,\n\ttype IDeltaHandler,\n} from '@fluidframework/datastore-definitions/internal';\n\nimport { type IShimDeltaHandler, type IUnstampedContents } from './types.js';\n\n/**\n * Represents a connection to a Shim data store that can receive and submit deltas.\n *\n * This allows the Shim class to swap out the delta handler on the fly.\n *\n * The PreMigrationDeltaConnection does not stamp ops so that those ops can be considered v1 ops.\n *\n * This special logic allows for connect to be called for the underlying new SharedObject without the need for\n * modifications on the current ChannelDeltaConnection.\n */\nexport class PreMigrationDeltaConnection implements IDeltaConnection {\n\tpublic constructor(\n\t\tprivate readonly deltaConnection: IDeltaConnection,\n\t\tprivate readonly shimDeltaHandler: IShimDeltaHandler\n\t) {}\n\n\tpublic get connected(): boolean {\n\t\treturn this.deltaConnection.connected;\n\t}\n\n\tprivate canSubmit = true;\n\tpublic disableSubmit(): void {\n\t\tthis.canSubmit = false;\n\t}\n\n\t// This is for submitting v1 ops\n\tpublic submit(messageContent: unknown, localOpMetadata: unknown): void {\n\t\tif (this.canSubmit) {\n\t\t\tthis.deltaConnection.submit(messageContent, localOpMetadata);\n\t\t}\n\t\t// We don't want to throw so we can revert local changes on the LegacySharedTree\n\t}\n\n\t// We only want to call attach on the underlying delta connection once, as we'll hit an assert if we call it twice.\n\t// Note: SharedObject.load calls attach as well as SharedObject.connect\n\tpublic attach(handler: IDeltaHandler): void {\n\t\t// There are essentially two delta handlers that process ops, the shim delta handler to process shim ops\n\t\t// preventing them from being processed by the tree delta handler, and the tree delta handler to process tree\n\t\t// ops. Post migration v1 ops can be considered \"shim\" ops as they are dropped.\n\t\tthis.shimDeltaHandler.attachTreeDeltaHandler(handler);\n\t\tif (!this.shimDeltaHandler.attached) {\n\t\t\tthis.deltaConnection.attach(this.shimDeltaHandler);\n\t\t\tthis.shimDeltaHandler.markAttached();\n\t\t}\n\t}\n\tpublic dirty(): void {\n\t\tthis.deltaConnection.dirty();\n\t}\n}\n\n/**\n * A delta connection that stamps ops with a particular channel attributes so that those ops won't get dropped\n */\nexport class StampDeltaConnection implements IDeltaConnection {\n\tpublic constructor(\n\t\tprivate readonly deltaConnection: IDeltaConnection,\n\t\tprivate readonly shimDeltaHandler: IShimDeltaHandler,\n\t\tprivate readonly attributes: IChannelAttributes\n\t) {}\n\n\tpublic get connected(): boolean {\n\t\treturn this.deltaConnection.connected;\n\t}\n\n\t// This is for submitting v2 ops\n\tpublic submit(messageContent: IUnstampedContents, localOpMetadata: unknown): void {\n\t\tassert(messageContent.fluidMigrationStamp === undefined, 0x835 /* Should not be stamping ops twice! */);\n\t\tmessageContent.fluidMigrationStamp = {\n\t\t\t...this.attributes,\n\t\t};\n\t\tthis.deltaConnection.submit(messageContent, localOpMetadata);\n\t}\n\n\t/**\n\t * For the MigrationShim because we only attach once to the actual delta connection, we store state in the\n\t * migrationDeltaHandler to know if we've already attached. We will call attach once on the\n\t * PreMigrationDeltaConnection and once on the StampDeltaConnection.\n\t *\n\t * The SharedTreeShim should not be swapping delta connections and thus the if statement should always be executed.\n\t *\n\t * @param handler - this delta handler can only connect once.\n\t */\n\tpublic attach(handler: IDeltaHandler): void {\n\t\t// Maybe put an assert here to only call attach once?\n\t\tthis.shimDeltaHandler.attachTreeDeltaHandler(handler);\n\t\tif (!this.shimDeltaHandler.attached) {\n\t\t\tthis.deltaConnection.attach(this.shimDeltaHandler);\n\t\t\tthis.shimDeltaHandler.markAttached();\n\t\t}\n\t}\n\n\tpublic dirty(): void {\n\t\tthis.deltaConnection.dirty();\n\t}\n}\n"]}
1
+ {"version":3,"file":"shimDeltaConnection.js","sourceRoot":"","sources":["../../src/migration-shim/shimDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAS7D;;;;;;;;;GASG;AACH,MAAa,2BAA2B;IACvC,YACkB,eAAiC,EACjC,gBAAmC;QADnC,oBAAe,GAAf,eAAe,CAAkB;QACjC,qBAAgB,GAAhB,gBAAgB,CAAmB;QAO7C,cAAS,GAAG,IAAI,CAAC;IANtB,CAAC;IAEJ,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC;IACvC,CAAC;IAGM,aAAa;QACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,gCAAgC;IACzB,MAAM,CAAC,cAAuB,EAAE,eAAwB;QAC9D,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QAC9D,CAAC;QACD,gFAAgF;IACjF,CAAC;IAED,mHAAmH;IACnH,uEAAuE;IAChE,MAAM,CAAC,OAAsB;QACnC,wGAAwG;QACxG,6GAA6G;QAC7G,+EAA+E;QAC/E,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,eAAe,CAAC,MAAM,C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c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\nimport type {\n\tIChannelAttributes,\n\tIDeltaConnection,\n\tIDeltaHandler,\n} from '@fluidframework/datastore-definitions/internal';\n\nimport type { IShimDeltaHandler, IUnstampedContents } from './types.js';\n\n/**\n * Represents a connection to a Shim data store that can receive and submit deltas.\n *\n * This allows the Shim class to swap out the delta handler on the fly.\n *\n * The PreMigrationDeltaConnection does not stamp ops so that those ops can be considered v1 ops.\n *\n * This special logic allows for connect to be called for the underlying new SharedObject without the need for\n * modifications on the current ChannelDeltaConnection.\n */\nexport class PreMigrationDeltaConnection implements IDeltaConnection {\n\tpublic constructor(\n\t\tprivate readonly deltaConnection: IDeltaConnection,\n\t\tprivate readonly shimDeltaHandler: IShimDeltaHandler\n\t) {}\n\n\tpublic get connected(): boolean {\n\t\treturn this.deltaConnection.connected;\n\t}\n\n\tprivate canSubmit = true;\n\tpublic disableSubmit(): void {\n\t\tthis.canSubmit = false;\n\t}\n\n\t// This is for submitting v1 ops\n\tpublic submit(messageContent: unknown, localOpMetadata: unknown): void {\n\t\tif (this.canSubmit) {\n\t\t\tthis.deltaConnection.submit(messageContent, localOpMetadata);\n\t\t}\n\t\t// We don't want to throw so we can revert local changes on the LegacySharedTree\n\t}\n\n\t// We only want to call attach on the underlying delta connection once, as we'll hit an assert if we call it twice.\n\t// Note: SharedObject.load calls attach as well as SharedObject.connect\n\tpublic attach(handler: IDeltaHandler): void {\n\t\t// There are essentially two delta handlers that process ops, the shim delta handler to process shim ops\n\t\t// preventing them from being processed by the tree delta handler, and the tree delta handler to process tree\n\t\t// ops. Post migration v1 ops can be considered \"shim\" ops as they are dropped.\n\t\tthis.shimDeltaHandler.attachTreeDeltaHandler(handler);\n\t\tif (!this.shimDeltaHandler.attached) {\n\t\t\tthis.deltaConnection.attach(this.shimDeltaHandler);\n\t\t\tthis.shimDeltaHandler.markAttached();\n\t\t}\n\t}\n\tpublic dirty(): void {\n\t\tthis.deltaConnection.dirty();\n\t}\n}\n\n/**\n * A delta connection that stamps ops with a particular channel attributes so that those ops won't get dropped\n */\nexport class StampDeltaConnection implements IDeltaConnection {\n\tpublic constructor(\n\t\tprivate readonly deltaConnection: IDeltaConnection,\n\t\tprivate readonly shimDeltaHandler: IShimDeltaHandler,\n\t\tprivate readonly attributes: IChannelAttributes\n\t) {}\n\n\tpublic get connected(): boolean {\n\t\treturn this.deltaConnection.connected;\n\t}\n\n\t// This is for submitting v2 ops\n\tpublic submit(messageContent: IUnstampedContents, localOpMetadata: unknown): void {\n\t\tassert(messageContent.fluidMigrationStamp === undefined, 0x835 /* Should not be stamping ops twice! */);\n\t\tmessageContent.fluidMigrationStamp = {\n\t\t\t...this.attributes,\n\t\t};\n\t\tthis.deltaConnection.submit(messageContent, localOpMetadata);\n\t}\n\n\t/**\n\t * For the MigrationShim because we only attach once to the actual delta connection, we store state in the\n\t * migrationDeltaHandler to know if we've already attached. We will call attach once on the\n\t * PreMigrationDeltaConnection and once on the StampDeltaConnection.\n\t *\n\t * The SharedTreeShim should not be swapping delta connections and thus the if statement should always be executed.\n\t *\n\t * @param handler - this delta handler can only connect once.\n\t */\n\tpublic attach(handler: IDeltaHandler): void {\n\t\t// Maybe put an assert here to only call attach once?\n\t\tthis.shimDeltaHandler.attachTreeDeltaHandler(handler);\n\t\tif (!this.shimDeltaHandler.attached) {\n\t\t\tthis.deltaConnection.attach(this.shimDeltaHandler);\n\t\t\tthis.shimDeltaHandler.markAttached();\n\t\t}\n\t}\n\n\tpublic dirty(): void {\n\t\tthis.deltaConnection.dirty();\n\t}\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { FluidHandleBase } from '@fluidframework/runtime-utils/internal';
6
- import { type IShim } from './types.js';
6
+ import type { IShim } from './types.js';
7
7
  /**
8
8
  * ShimHandle is a special class to handle the fact that we are essentially creating a proxy for a DDS.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"shimHandle.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAyB,MAAM,wCAAwC,CAAC;AAEhG,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,qBAAa,UAAU,CAAC,KAAK,SAAS,KAAK,CAAE,SAAQ,eAAe,CAAC,KAAK,CAAC;IACvD,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,KAAK;IAI/C,IAAW,YAAY,IAAI,MAAM,CAEhC;IACD,IAAW,UAAU,IAAI,OAAO,CAE/B;IACM,WAAW,IAAI,IAAI;IAGb,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;CAGlC"}
1
+ {"version":3,"file":"shimHandle.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAyB,MAAM,wCAAwC,CAAC;AAEhG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,qBAAa,UAAU,CAAC,KAAK,SAAS,KAAK,CAAE,SAAQ,eAAe,CAAC,KAAK,CAAC;IACvD,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,KAAK;IAI/C,IAAW,YAAY,IAAI,MAAM,CAEhC;IACD,IAAW,UAAU,IAAI,OAAO,CAE/B;IACM,WAAW,IAAI,IAAI;IAGb,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;CAGlC"}