@itwin/core-backend 5.10.0-dev.1 → 5.10.0-dev.11

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 (152) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/lib/cjs/BriefcaseManager.d.ts +17 -59
  3. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  4. package/lib/cjs/BriefcaseManager.js +45 -162
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/Category.d.ts +4 -4
  7. package/lib/cjs/Category.js.map +1 -1
  8. package/lib/cjs/ChangesetECAdaptor.d.ts +6 -6
  9. package/lib/cjs/ChangesetECAdaptor.js +4 -4
  10. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  11. package/lib/cjs/CodeSpecs.d.ts +3 -3
  12. package/lib/cjs/CodeSpecs.js.map +1 -1
  13. package/lib/cjs/DisplayStyle.d.ts +2 -2
  14. package/lib/cjs/DisplayStyle.js.map +1 -1
  15. package/lib/cjs/Element.d.ts +10 -10
  16. package/lib/cjs/Element.d.ts.map +1 -1
  17. package/lib/cjs/Element.js +2 -2
  18. package/lib/cjs/Element.js.map +1 -1
  19. package/lib/cjs/ElementAspect.d.ts +1 -1
  20. package/lib/cjs/ElementAspect.js.map +1 -1
  21. package/lib/cjs/ElementTreeWalker.d.ts +5 -5
  22. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  23. package/lib/cjs/ExternalSource.d.ts +2 -2
  24. package/lib/cjs/ExternalSource.d.ts.map +1 -1
  25. package/lib/cjs/ExternalSource.js.map +1 -1
  26. package/lib/cjs/IModelDb.d.ts +22 -22
  27. package/lib/cjs/IModelDb.js +20 -20
  28. package/lib/cjs/IModelDb.js.map +1 -1
  29. package/lib/cjs/IModelJsFs.d.ts +2 -0
  30. package/lib/cjs/IModelJsFs.d.ts.map +1 -1
  31. package/lib/cjs/IModelJsFs.js +14 -0
  32. package/lib/cjs/IModelJsFs.js.map +1 -1
  33. package/lib/cjs/LineStyle.d.ts +6 -6
  34. package/lib/cjs/LineStyle.js.map +1 -1
  35. package/lib/cjs/LocalHub.d.ts +6 -0
  36. package/lib/cjs/LocalHub.d.ts.map +1 -1
  37. package/lib/cjs/LocalHub.js +23 -0
  38. package/lib/cjs/LocalHub.js.map +1 -1
  39. package/lib/cjs/Material.d.ts +1 -1
  40. package/lib/cjs/Material.js.map +1 -1
  41. package/lib/cjs/Model.d.ts +6 -6
  42. package/lib/cjs/Model.d.ts.map +1 -1
  43. package/lib/cjs/Model.js.map +1 -1
  44. package/lib/cjs/Relationship.d.ts +10 -10
  45. package/lib/cjs/Relationship.js +6 -6
  46. package/lib/cjs/Relationship.js.map +1 -1
  47. package/lib/cjs/SheetIndex.d.ts +4 -4
  48. package/lib/cjs/SheetIndex.d.ts.map +1 -1
  49. package/lib/cjs/SheetIndex.js.map +1 -1
  50. package/lib/cjs/Texture.d.ts +1 -1
  51. package/lib/cjs/Texture.js.map +1 -1
  52. package/lib/cjs/TxnManager.d.ts +3 -0
  53. package/lib/cjs/TxnManager.d.ts.map +1 -1
  54. package/lib/cjs/TxnManager.js +95 -13
  55. package/lib/cjs/TxnManager.js.map +1 -1
  56. package/lib/cjs/ViewDefinition.d.ts +6 -6
  57. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  58. package/lib/cjs/ViewDefinition.js.map +1 -1
  59. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  60. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  61. package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
  62. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
  63. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  64. package/lib/cjs/domains/GenericElements.d.ts +2 -2
  65. package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
  66. package/lib/cjs/domains/GenericElements.js.map +1 -1
  67. package/lib/cjs/internal/ChannelAdmin.d.ts +2 -2
  68. package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
  69. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  70. package/lib/cjs/internal/HubMock.d.ts +24 -1
  71. package/lib/cjs/internal/HubMock.d.ts.map +1 -1
  72. package/lib/cjs/internal/HubMock.js +60 -39
  73. package/lib/cjs/internal/HubMock.js.map +1 -1
  74. package/lib/esm/BriefcaseManager.d.ts +17 -59
  75. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  76. package/lib/esm/BriefcaseManager.js +46 -163
  77. package/lib/esm/BriefcaseManager.js.map +1 -1
  78. package/lib/esm/Category.d.ts +4 -4
  79. package/lib/esm/Category.js.map +1 -1
  80. package/lib/esm/ChangesetECAdaptor.d.ts +6 -6
  81. package/lib/esm/ChangesetECAdaptor.js +4 -4
  82. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  83. package/lib/esm/CodeSpecs.d.ts +3 -3
  84. package/lib/esm/CodeSpecs.js.map +1 -1
  85. package/lib/esm/DisplayStyle.d.ts +2 -2
  86. package/lib/esm/DisplayStyle.js.map +1 -1
  87. package/lib/esm/Element.d.ts +10 -10
  88. package/lib/esm/Element.d.ts.map +1 -1
  89. package/lib/esm/Element.js +2 -2
  90. package/lib/esm/Element.js.map +1 -1
  91. package/lib/esm/ElementAspect.d.ts +1 -1
  92. package/lib/esm/ElementAspect.js.map +1 -1
  93. package/lib/esm/ElementTreeWalker.d.ts +5 -5
  94. package/lib/esm/ElementTreeWalker.js.map +1 -1
  95. package/lib/esm/ExternalSource.d.ts +2 -2
  96. package/lib/esm/ExternalSource.d.ts.map +1 -1
  97. package/lib/esm/ExternalSource.js.map +1 -1
  98. package/lib/esm/IModelDb.d.ts +22 -22
  99. package/lib/esm/IModelDb.js +20 -20
  100. package/lib/esm/IModelDb.js.map +1 -1
  101. package/lib/esm/IModelJsFs.d.ts +2 -0
  102. package/lib/esm/IModelJsFs.d.ts.map +1 -1
  103. package/lib/esm/IModelJsFs.js +14 -0
  104. package/lib/esm/IModelJsFs.js.map +1 -1
  105. package/lib/esm/LineStyle.d.ts +6 -6
  106. package/lib/esm/LineStyle.js.map +1 -1
  107. package/lib/esm/LocalHub.d.ts +6 -0
  108. package/lib/esm/LocalHub.d.ts.map +1 -1
  109. package/lib/esm/LocalHub.js +23 -0
  110. package/lib/esm/LocalHub.js.map +1 -1
  111. package/lib/esm/Material.d.ts +1 -1
  112. package/lib/esm/Material.js.map +1 -1
  113. package/lib/esm/Model.d.ts +6 -6
  114. package/lib/esm/Model.d.ts.map +1 -1
  115. package/lib/esm/Model.js.map +1 -1
  116. package/lib/esm/Relationship.d.ts +10 -10
  117. package/lib/esm/Relationship.js +6 -6
  118. package/lib/esm/Relationship.js.map +1 -1
  119. package/lib/esm/SheetIndex.d.ts +4 -4
  120. package/lib/esm/SheetIndex.d.ts.map +1 -1
  121. package/lib/esm/SheetIndex.js.map +1 -1
  122. package/lib/esm/Texture.d.ts +1 -1
  123. package/lib/esm/Texture.js.map +1 -1
  124. package/lib/esm/TxnManager.d.ts +3 -0
  125. package/lib/esm/TxnManager.d.ts.map +1 -1
  126. package/lib/esm/TxnManager.js +96 -14
  127. package/lib/esm/TxnManager.js.map +1 -1
  128. package/lib/esm/ViewDefinition.d.ts +6 -6
  129. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  130. package/lib/esm/ViewDefinition.js.map +1 -1
  131. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  132. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  133. package/lib/esm/domains/FunctionalElements.d.ts +1 -1
  134. package/lib/esm/domains/FunctionalElements.d.ts.map +1 -1
  135. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  136. package/lib/esm/domains/GenericElements.d.ts +2 -2
  137. package/lib/esm/domains/GenericElements.d.ts.map +1 -1
  138. package/lib/esm/domains/GenericElements.js.map +1 -1
  139. package/lib/esm/internal/ChannelAdmin.d.ts +2 -2
  140. package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
  141. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  142. package/lib/esm/internal/HubMock.d.ts +24 -1
  143. package/lib/esm/internal/HubMock.d.ts.map +1 -1
  144. package/lib/esm/internal/HubMock.js +61 -40
  145. package/lib/esm/internal/HubMock.js.map +1 -1
  146. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts +2 -0
  147. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts.map +1 -0
  148. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js +239 -0
  149. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js.map +1 -0
  150. package/lib/esm/test/hubaccess/SemanticRebase.test.js +2276 -70
  151. package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
  152. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"HubMock.js","sourceRoot":"","sources":["../../../src/internal/HubMock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA4B;AAC5B,sDAAuD;AASvD,4DAA+I;AAC/I,8CAA2C;AAC3C,8CAA2C;AAC3C,0CAAuC;AAEvC,uCAA0E;AAC1E,0DAAuD;AACvD,6BAA6B;AAE7B,SAAS,UAAU,CAAC,GAAuB;IACzC,IAAI,SAAS,KAAK,GAAG;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,UAAU,CAAC,IAA6E;IAC/F,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC;AACD,MAAM,cAAc,GAAmB;IACrC,UAAU,EAAE,CAAC,UAA2B,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,mCAAgB,CAAC,oBAAoB,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC;QAC9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,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC5D,IAAI,CAAC,QAAQ,IAAI,gBAAgB,CAAC,eAAe,EAAE,SAAS,CAAC,KAAK,kCAAc,CAAC,KAAK,EAAE,CAAC;oBACvF,QAAQ,GAAG,IAAI,CAAC;oBAChB,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,CAAC;YAEF,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtC,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACvC,UAAU,CAAC,GAAG,EAAE;gBACd,YAAY,CAAC,CAAC,CAAC,CAAC;gBAChB,OAAO,CAAC,SAAS,CAAC,CAAC;YACrB,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACL,CAAC;;AApOH,0BAqOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { join } from \"path\";\r\nimport { Guid, GuidString } from \"@itwin/core-bentley\";\r\nimport {\r\n ChangesetFileProps, ChangesetIndex, ChangesetIndexOrId, ChangesetProps, ChangesetRange, IModelVersion, LocalDirName,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n AcquireNewBriefcaseIdArg,\r\n BackendHubAccess, BriefcaseDbArg, BriefcaseIdArg, ChangesetArg, CreateNewIModelProps, DownloadChangesetArg, DownloadChangesetRangeArg, IModelIdArg, IModelNameArg,\r\n LockMap, LockProps, V2CheckpointAccessProps,\r\n} from \"../BackendHubAccess\";\r\nimport { CheckpointProps, DownloadRequest, MockCheckpoint, ProgressFunction, ProgressStatus, V2CheckpointManager } from \"../CheckpointManager\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { IModelJsFs } from \"../IModelJsFs\";\r\nimport { LocalHub } from \"../LocalHub\";\r\nimport { TokenArg } from \"../IModelDb\";\r\nimport { _getHubAccess, _mockCheckpoint, _setHubAccess } from \"./Symbols\";\r\nimport { BriefcaseManager } from \"../BriefcaseManager\";\r\nimport * as path from \"path\";\r\n\r\nfunction wasStarted(val: string | undefined): asserts val is string {\r\n if (undefined === val)\r\n throw new Error(\"Call HubMock.startup first\");\r\n}\r\n\r\nfunction doDownload(args: { iModelId: string, changeset: ChangesetIndexOrId, targetFile: string }) {\r\n HubMock.findLocalHub(args.iModelId).downloadCheckpoint(args);\r\n}\r\nconst mockCheckpoint: MockCheckpoint = {\r\n mockAttach: (checkpoint: CheckpointProps) => {\r\n const targetFile = path.join(BriefcaseManager.getBriefcaseBasePath(checkpoint.iModelId), `${checkpoint.changeset.index}.bim`);\r\n doDownload({ ...checkpoint, targetFile })\r\n return targetFile;\r\n },\r\n\r\n mockDownload: (request: DownloadRequest) => {\r\n doDownload({ ...request.checkpoint, targetFile: request.localFile });\r\n }\r\n};\r\n\r\n/**\r\n * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.\r\n *\r\n * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:\r\n * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs\r\n * - waste network and data center resources (i.e. $$$s),\r\n * - interfere with other tests running on the same or other systems, and\r\n * - (far worse) are the source of test flakiness outside of the api being tested.\r\n *\r\n * This class can be used to create tests that do not require authentication, are synchronous,\r\n * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside\r\n * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.\r\n *\r\n * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests\r\n * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to\r\n * low level testing of the core apis only.\r\n *\r\n * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be\r\n * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean\r\n * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the\r\n * test against a \"real\" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your\r\n * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)\r\n *\r\n * Mocked tests must always start by creating a new iModel via [[IModelHost[_hubAccess].createNewIModel]] with a `version0` iModel.\r\n * They use mock (aka \"bogus\") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current\r\n * computer.\r\n *\r\n * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests\r\n * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.\r\n *\r\n * @internal\r\n */\r\nexport class HubMock {\r\n private static mockRoot: LocalDirName | undefined;\r\n private static hubs = new Map<string, LocalHub>();\r\n private static _saveHubAccess: BackendHubAccess | undefined;\r\n private static _iTwinId: GuidString | undefined;\r\n\r\n /** Determine whether a test us currently being run under HubMock */\r\n public static get isValid() { return undefined !== this.mockRoot; }\r\n public static get iTwinId() {\r\n wasStarted(this._iTwinId);\r\n return this._iTwinId;\r\n }\r\n\r\n /**\r\n * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].\r\n * @param mockName a unique name (e.g. \"MyTest\") for this HubMock to disambiguate tests when more than one is simultaneously active.\r\n * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.\r\n */\r\n public static startup(mockName: LocalDirName, outputDir: string) {\r\n if (this.isValid)\r\n throw new Error(\"Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed\");\r\n\r\n this.hubs.clear();\r\n this.mockRoot = join(outputDir, \"HubMock\", mockName);\r\n IModelJsFs.recursiveMkDirSync(this.mockRoot);\r\n IModelJsFs.purgeDirSync(this.mockRoot);\r\n this._saveHubAccess = IModelHost[_getHubAccess]();\r\n\r\n IModelHost[_setHubAccess](this);\r\n HubMock._iTwinId = Guid.createValue(); // all iModels for this test get the same \"iTwinId\"\r\n\r\n V2CheckpointManager[_mockCheckpoint] = mockCheckpoint;\r\n }\r\n\r\n /** Stop a HubMock that was previously started with [[startup]]\r\n * @note this function throws an exception if any of the iModels used during the tests are left open.\r\n */\r\n public static shutdown() {\r\n if (this.mockRoot === undefined)\r\n return;\r\n\r\n V2CheckpointManager[_mockCheckpoint] = undefined;\r\n\r\n HubMock._iTwinId = undefined;\r\n for (const hub of this.hubs)\r\n hub[1].cleanup();\r\n\r\n this.hubs.clear();\r\n IModelJsFs.purgeDirSync(this.mockRoot);\r\n IModelJsFs.removeSync(this.mockRoot);\r\n IModelHost[_setHubAccess](this._saveHubAccess);\r\n this.mockRoot = undefined;\r\n }\r\n\r\n public static findLocalHub(iModelId: GuidString): LocalHub {\r\n const hub = this.hubs.get(iModelId);\r\n if (!hub)\r\n throw new Error(`local hub for iModel ${iModelId} not created`);\r\n return hub;\r\n }\r\n\r\n /** create a [[LocalHub]] for an iModel. */\r\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\r\n wasStarted(this.mockRoot);\r\n const props = { ...arg, iModelId: Guid.createValue() };\r\n const mock = new LocalHub(join(this.mockRoot, props.iModelId), props);\r\n this.hubs.set(props.iModelId, mock);\r\n return props.iModelId;\r\n }\r\n\r\n /** remove the [[LocalHub]] for an iModel */\r\n public static destroy(iModelId: GuidString) {\r\n this.findLocalHub(iModelId).cleanup();\r\n this.hubs.delete(iModelId);\r\n }\r\n\r\n /** All methods below are mocks of the [[BackendHubAccess]] interface */\r\n\r\n public static async getChangesetFromNamedVersion(arg: IModelIdArg & { versionName: string }): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);\r\n }\r\n\r\n private static changesetIndexFromArg(arg: ChangesetArg) {\r\n return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);\r\n }\r\n\r\n public static async getChangesetFromVersion(arg: IModelIdArg & { version: IModelVersion }): Promise<ChangesetProps> {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n const version = arg.version;\r\n if (version.isFirst)\r\n return hub.getChangesetByIndex(0);\r\n\r\n const asOf = version.getAsOfChangeSet();\r\n if (asOf)\r\n return hub.getChangesetById(asOf);\r\n\r\n const versionName = version.getName();\r\n if (versionName)\r\n return hub.findNamedVersion(versionName);\r\n\r\n return hub.getLatestChangeset();\r\n }\r\n\r\n public static async getLatestChangeset(arg: IModelIdArg): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).getLatestChangeset();\r\n }\r\n\r\n private static async getAccessToken(arg: TokenArg) {\r\n return arg.accessToken ?? await IModelHost.getAccessToken();\r\n }\r\n\r\n public static async getMyBriefcaseIds(arg: IModelIdArg): Promise<number[]> {\r\n const accessToken = await this.getAccessToken(arg);\r\n return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);\r\n }\r\n\r\n public static async acquireNewBriefcaseId(arg: AcquireNewBriefcaseIdArg): Promise<number> {\r\n const accessToken = await this.getAccessToken(arg);\r\n return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);\r\n }\r\n\r\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\r\n public static async releaseBriefcase(arg: BriefcaseIdArg): Promise<void> {\r\n return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);\r\n }\r\n\r\n public static async downloadChangeset(arg: DownloadChangesetArg): Promise<ChangesetFileProps> {\r\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });\r\n\r\n if (arg.progressCallback) {\r\n const totalSize = IModelJsFs.lstatSync(changesetProps.pathname)?.size;\r\n if (totalSize)\r\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\r\n }\r\n\r\n return changesetProps;\r\n }\r\n\r\n public static async downloadChangesets(arg: DownloadChangesetRangeArg): Promise<ChangesetFileProps[]> {\r\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });\r\n\r\n if (arg.progressCallback) {\r\n const totalSize = changesetProps.reduce((sum, props) => sum + (IModelJsFs.lstatSync(props.pathname)?.size ?? 0), 0);\r\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\r\n }\r\n\r\n return changesetProps;\r\n }\r\n\r\n public static async queryChangeset(arg: ChangesetArg): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));\r\n }\r\n\r\n public static async queryChangesets(arg: IModelIdArg & { range?: ChangesetRange }): Promise<ChangesetProps[]> {\r\n return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);\r\n }\r\n\r\n public static async pushChangeset(arg: IModelIdArg & { changesetProps: ChangesetFileProps }): Promise<ChangesetIndex> {\r\n return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);\r\n }\r\n\r\n public static async queryV2Checkpoint(arg: CheckpointProps): Promise<V2CheckpointAccessProps | undefined> {\r\n return {\r\n accountName: \"none\",\r\n sasToken: \"none\",\r\n containerId: Guid.createValue(),\r\n dbName: `${arg.changeset.index ?? 0}.bim`,\r\n storageType: \"mock\",\r\n isMock: true,\r\n checkpoint: arg,\r\n } as V2CheckpointAccessProps;\r\n }\r\n\r\n public static async releaseAllLocks(arg: BriefcaseDbArg) {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });\r\n }\r\n\r\n public static async abandonAllLocks(arg: BriefcaseIdArg): Promise<void> {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n hub.abandonAllLocks(arg);\r\n }\r\n\r\n public static async queryAllLocks(_arg: BriefcaseDbArg): Promise<LockProps[]> {\r\n return [];\r\n }\r\n\r\n public static async acquireLocks(arg: BriefcaseDbArg, locks: LockMap): Promise<void> {\r\n this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);\r\n }\r\n\r\n public static async abandonLocks(arg: BriefcaseIdArg, locks: LockMap): Promise<void> {\r\n this.findLocalHub(arg.iModelId).abandonLocks(locks, arg);\r\n }\r\n\r\n public static async queryIModelByName(arg: IModelNameArg): Promise<GuidString | undefined> {\r\n for (const hub of this.hubs) {\r\n const localHub = hub[1];\r\n if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)\r\n return localHub.iModelId;\r\n }\r\n return undefined;\r\n }\r\n\r\n public static async deleteIModel(arg: IModelIdArg & { iTwinId: GuidString }): Promise<void> {\r\n return this.destroy(arg.iModelId);\r\n }\r\n\r\n private static async mockProgressReporting(progressCallback: ProgressFunction, totalSize: number): Promise<void> {\r\n await new Promise((resolve, reject) => {\r\n let rejected = false;\r\n\r\n const mockProgress = (index: number) => {\r\n const bytesDownloaded = Math.floor(totalSize * (index / 4));\r\n if (!rejected && progressCallback(bytesDownloaded, totalSize) === ProgressStatus.Abort) {\r\n rejected = true;\r\n reject(new Error(\"AbortError\"));\r\n }\r\n };\r\n\r\n mockProgress(1);\r\n setTimeout(() => mockProgress(2), 50);\r\n setTimeout(() => mockProgress(3), 100);\r\n setTimeout(() => {\r\n mockProgress(4);\r\n resolve(undefined);\r\n }, 150);\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"HubMock.js","sourceRoot":"","sources":["../../../src/internal/HubMock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/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AE;YACpC,IAAI,QAAQ,GAAG,KAAK,CAAC;YAErB,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE;gBACrC,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC5D,IAAI,CAAC,QAAQ,IAAI,gBAAgB,CAAC,eAAe,EAAE,SAAS,CAAC,KAAK,kCAAc,CAAC,KAAK,EAAE,CAAC;oBACvF,QAAQ,GAAG,IAAI,CAAC;oBAChB,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,CAAC;YAEF,YAAY,CAAC,CAAC,CAAC,CAAC;YAChB,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtC,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACvC,UAAU,CAAC,GAAG,EAAE;gBACd,YAAY,CAAC,CAAC,CAAC,CAAC;gBAChB,OAAO,CAAC,SAAS,CAAC,CAAC;YACrB,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;IACL,CAAC;;AA9QH,0BA+QC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { join } from \"path\";\r\nimport { Guid, GuidString } from \"@itwin/core-bentley\";\r\nimport {\r\n ChangesetFileProps, ChangesetIndex, ChangesetIndexOrId, ChangesetProps, ChangesetRange, IModelVersion, LocalDirName,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n AcquireNewBriefcaseIdArg,\r\n BackendHubAccess, BriefcaseDbArg, BriefcaseIdArg, ChangesetArg, CreateNewIModelProps, DownloadChangesetArg, DownloadChangesetRangeArg, IModelIdArg, IModelNameArg,\r\n LockMap, LockProps, V2CheckpointAccessProps,\r\n} from \"../BackendHubAccess\";\r\nimport { CheckpointProps, DownloadRequest, MockCheckpoint, ProgressFunction, ProgressStatus, V2CheckpointManager } from \"../CheckpointManager\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { IModelJsFs } from \"../IModelJsFs\";\r\nimport { LocalHub } from \"../LocalHub\";\r\nimport { SnapshotDb, TokenArg } from \"../IModelDb\";\r\nimport { _getHubAccess, _mockCheckpoint, _nativeDb, _setHubAccess } from \"./Symbols\";\r\nimport { BriefcaseManager } from \"../BriefcaseManager\";\r\n\r\nfunction wasStarted(val: string | undefined): asserts val is string {\r\n if (undefined === val)\r\n throw new Error(\"Call HubMock.startup first\");\r\n}\r\n\r\n// Used by mockAttach: copies the nearest *prior* checkpoint (never newer) so the\r\n// returned file is already at or before the requested version.\r\nfunction doDownloadPrior(args: { iModelId: string, changeset: ChangesetIndexOrId, targetFile: string }) {\r\n HubMock.findLocalHub(args.iModelId).downloadCheckpoint(args);\r\n}\r\n\r\n// Used by mockDownload: copies the *nearest* checkpoint (forward or backward).\r\n// When the nearest is newer than the requested version, CheckpointManager.updateToRequestedVersion\r\n// will reverse it to the requested version via BriefcaseManager.pullAndApplyChangesets.\r\nfunction doDownloadNearest(args: { iModelId: string, changeset: ChangesetIndexOrId, targetFile: string }) {\r\n const hub = HubMock.findLocalHub(args.iModelId);\r\n const requestedIndex = hub.getIndexFromChangeset(args.changeset);\r\n const nearest = hub.queryNearestCheckpoint(requestedIndex);\r\n IModelJsFs.copySync(join(hub.checkpointDir, hub.checkpointNameFromIndex(nearest)), args.targetFile);\r\n}\r\n\r\nconst mockCheckpoint: MockCheckpoint = {\r\n mockAttach: (checkpoint: CheckpointProps) => {\r\n const targetFile = join(BriefcaseManager.getBriefcaseBasePath(checkpoint.iModelId), `${checkpoint.changeset.index}.bim`);\r\n doDownloadPrior({ ...checkpoint, targetFile });\r\n return targetFile;\r\n },\r\n\r\n mockDownload: (request: DownloadRequest) => {\r\n doDownloadNearest({ ...request.checkpoint, targetFile: request.localFile });\r\n }\r\n};\r\n\r\n/**\r\n * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.\r\n *\r\n * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:\r\n * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs\r\n * - waste network and data center resources (i.e. $$$s),\r\n * - interfere with other tests running on the same or other systems, and\r\n * - (far worse) are the source of test flakiness outside of the api being tested.\r\n *\r\n * This class can be used to create tests that do not require authentication, are synchronous,\r\n * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside\r\n * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.\r\n *\r\n * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests\r\n * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to\r\n * low level testing of the core apis only.\r\n *\r\n * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be\r\n * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean\r\n * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the\r\n * test against a \"real\" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your\r\n * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)\r\n *\r\n * Mocked tests must always start by creating a new iModel via [[IModelHost[_hubAccess].createNewIModel]] with a `version0` iModel.\r\n * They use mock (aka \"bogus\") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current\r\n * computer.\r\n *\r\n * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests\r\n * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.\r\n *\r\n * @internal\r\n */\r\n/** Options for [[HubMock.startup]]. @internal */\r\nexport interface HubMockStartupOptions {\r\n /**\r\n * When `true`, every successful [[HubMock.pushChangeset]] call automatically uploads a V1 checkpoint\r\n * (the current briefcase `.bim` file) for the tip changeset index into [[LocalHub]].\r\n * This lets tests download a tip checkpoint and reverse changesets from it.\r\n */\r\n createTipCheckpointOnPush?: boolean;\r\n}\r\n\r\nexport class HubMock {\r\n private static mockRoot: LocalDirName | undefined;\r\n private static hubs = new Map<string, LocalHub>();\r\n private static _saveHubAccess: BackendHubAccess | undefined;\r\n private static _iTwinId: GuidString | undefined;\r\n private static _createTipCheckpointOnPush = false;\r\n\r\n /** Determine whether a test us currently being run under HubMock */\r\n public static get isValid() { return undefined !== this.mockRoot; }\r\n public static get iTwinId() {\r\n wasStarted(this._iTwinId);\r\n return this._iTwinId;\r\n }\r\n\r\n /**\r\n * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].\r\n * @param mockName a unique name (e.g. \"MyTest\") for this HubMock to disambiguate tests when more than one is simultaneously active.\r\n * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.\r\n */\r\n public static startup(mockName: LocalDirName, outputDir: string, options?: HubMockStartupOptions) {\r\n if (this.isValid)\r\n throw new Error(\"Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed\");\r\n\r\n this.hubs.clear();\r\n this.mockRoot = join(outputDir, \"HubMock\", mockName);\r\n IModelJsFs.recursiveMkDirSync(this.mockRoot);\r\n IModelJsFs.purgeDirSync(this.mockRoot);\r\n this._saveHubAccess = IModelHost[_getHubAccess]();\r\n\r\n IModelHost[_setHubAccess](this);\r\n HubMock._iTwinId = Guid.createValue(); // all iModels for this test get the same \"iTwinId\"\r\n this._createTipCheckpointOnPush = options?.createTipCheckpointOnPush ?? false;\r\n\r\n V2CheckpointManager[_mockCheckpoint] = mockCheckpoint;\r\n }\r\n\r\n /** Stop a HubMock that was previously started with [[startup]]\r\n * @note this function throws an exception if any of the iModels used during the tests are left open.\r\n */\r\n public static shutdown() {\r\n if (this.mockRoot === undefined)\r\n return;\r\n\r\n V2CheckpointManager[_mockCheckpoint] = undefined;\r\n this._createTipCheckpointOnPush = false;\r\n\r\n HubMock._iTwinId = undefined;\r\n for (const hub of this.hubs)\r\n hub[1].cleanup();\r\n\r\n this.hubs.clear();\r\n IModelJsFs.purgeDirSync(this.mockRoot);\r\n IModelJsFs.removeSync(this.mockRoot);\r\n IModelHost[_setHubAccess](this._saveHubAccess);\r\n this.mockRoot = undefined;\r\n }\r\n\r\n public static findLocalHub(iModelId: GuidString): LocalHub {\r\n const hub = this.hubs.get(iModelId);\r\n if (!hub)\r\n throw new Error(`local hub for iModel ${iModelId} not created`);\r\n return hub;\r\n }\r\n\r\n /** create a [[LocalHub]] for an iModel. */\r\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\r\n wasStarted(this.mockRoot);\r\n const props = { ...arg, iModelId: Guid.createValue() };\r\n const mock = new LocalHub(join(this.mockRoot, props.iModelId), props);\r\n this.hubs.set(props.iModelId, mock);\r\n return props.iModelId;\r\n }\r\n\r\n /** remove the [[LocalHub]] for an iModel */\r\n public static destroy(iModelId: GuidString) {\r\n this.findLocalHub(iModelId).cleanup();\r\n this.hubs.delete(iModelId);\r\n }\r\n\r\n /** All methods below are mocks of the [[BackendHubAccess]] interface */\r\n\r\n public static async getChangesetFromNamedVersion(arg: IModelIdArg & { versionName: string }): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);\r\n }\r\n\r\n private static changesetIndexFromArg(arg: ChangesetArg) {\r\n return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);\r\n }\r\n\r\n public static async getChangesetFromVersion(arg: IModelIdArg & { version: IModelVersion }): Promise<ChangesetProps> {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n const version = arg.version;\r\n if (version.isFirst)\r\n return hub.getChangesetByIndex(0);\r\n\r\n const asOf = version.getAsOfChangeSet();\r\n if (asOf)\r\n return hub.getChangesetById(asOf);\r\n\r\n const versionName = version.getName();\r\n if (versionName)\r\n return hub.findNamedVersion(versionName);\r\n\r\n return hub.getLatestChangeset();\r\n }\r\n\r\n public static async getLatestChangeset(arg: IModelIdArg): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).getLatestChangeset();\r\n }\r\n\r\n private static async getAccessToken(arg: TokenArg) {\r\n return arg.accessToken ?? await IModelHost.getAccessToken();\r\n }\r\n\r\n public static async getMyBriefcaseIds(arg: IModelIdArg): Promise<number[]> {\r\n const accessToken = await this.getAccessToken(arg);\r\n return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);\r\n }\r\n\r\n public static async acquireNewBriefcaseId(arg: AcquireNewBriefcaseIdArg): Promise<number> {\r\n const accessToken = await this.getAccessToken(arg);\r\n return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);\r\n }\r\n\r\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\r\n public static async releaseBriefcase(arg: BriefcaseIdArg): Promise<void> {\r\n return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);\r\n }\r\n\r\n public static async downloadChangeset(arg: DownloadChangesetArg): Promise<ChangesetFileProps> {\r\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });\r\n\r\n if (arg.progressCallback) {\r\n const totalSize = IModelJsFs.lstatSync(changesetProps.pathname)?.size;\r\n if (totalSize)\r\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\r\n }\r\n\r\n return changesetProps;\r\n }\r\n\r\n public static async downloadChangesets(arg: DownloadChangesetRangeArg): Promise<ChangesetFileProps[]> {\r\n const changesetProps = this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });\r\n\r\n if (arg.progressCallback) {\r\n const totalSize = changesetProps.reduce((sum, props) => sum + (IModelJsFs.lstatSync(props.pathname)?.size ?? 0), 0);\r\n await HubMock.mockProgressReporting(arg.progressCallback, totalSize);\r\n }\r\n\r\n return changesetProps;\r\n }\r\n\r\n public static async queryChangeset(arg: ChangesetArg): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));\r\n }\r\n\r\n public static async queryChangesets(arg: IModelIdArg & { range?: ChangesetRange }): Promise<ChangesetProps[]> {\r\n return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);\r\n }\r\n\r\n public static async pushChangeset(arg: IModelIdArg & { changesetProps: ChangesetFileProps }): Promise<ChangesetIndex> {\r\n const csIndex = this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);\r\n if (this._createTipCheckpointOnPush)\r\n await this.createTipCheckpoint(arg.iModelId);\r\n return csIndex;\r\n }\r\n\r\n /**\r\n * Build and upload a V1 checkpoint at the current tip changeset of the given iModel.\r\n *\r\n * The checkpoint is constructed by copying the nearest prior checkpoint from [[LocalHub]] as a\r\n * starting base, then applying all subsequent changesets forward to the latest index via\r\n * [[BriefcaseManager.pullAndApplyChangesets]]. The result is registered in [[LocalHub]] so that\r\n * [[V2CheckpointManager]] (mock path) can serve it to consumers.\r\n *\r\n * When [[HubMockStartupOptions.createTipCheckpointOnPush]] is `true` this is called automatically\r\n * after every successful [[pushChangeset]]. Tests can also call it explicitly to create a single\r\n * checkpoint at the tip after all changesets have been pushed.\r\n */\r\n public static async createTipCheckpoint(iModelId: GuidString): Promise<void> {\r\n const hub = this.findLocalHub(iModelId);\r\n const csIndex = hub.latestChangesetIndex;\r\n // Find the nearest checkpoint that precedes the new tip and use it as the base.\r\n const prevIndex = hub.queryPreviousCheckpoint(csIndex);\r\n const prevCheckpointFile = join(hub.checkpointDir, hub.checkpointNameFromIndex(prevIndex));\r\n const tempFile = join(hub.rootDir, `checkpoint-building-${csIndex}.bim`);\r\n IModelJsFs.copySync(prevCheckpointFile, tempFile);\r\n try {\r\n const db = SnapshotDb.openForApplyChangesets(tempFile);\r\n try {\r\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken: \"\", toIndex: csIndex });\r\n db[_nativeDb].saveChanges();\r\n } finally {\r\n db.close();\r\n }\r\n\r\n hub.uploadCheckpoint({ changesetIndex: csIndex, localFile: tempFile });\r\n } finally {\r\n if (IModelJsFs.existsSync(tempFile))\r\n IModelJsFs.removeSync(tempFile);\r\n }\r\n }\r\n\r\n public static async queryV2Checkpoint(arg: CheckpointProps): Promise<V2CheckpointAccessProps | undefined> {\r\n return {\r\n accountName: \"none\",\r\n sasToken: \"none\",\r\n containerId: Guid.createValue(),\r\n dbName: `${arg.changeset.index ?? 0}.bim`,\r\n storageType: \"mock\",\r\n isMock: true,\r\n checkpoint: arg,\r\n } as V2CheckpointAccessProps;\r\n }\r\n\r\n public static async releaseAllLocks(arg: BriefcaseDbArg) {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });\r\n }\r\n\r\n public static async abandonAllLocks(arg: BriefcaseIdArg): Promise<void> {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n hub.abandonAllLocks(arg);\r\n }\r\n\r\n public static async queryAllLocks(_arg: BriefcaseDbArg): Promise<LockProps[]> {\r\n return [];\r\n }\r\n\r\n public static async acquireLocks(arg: BriefcaseDbArg, locks: LockMap): Promise<void> {\r\n this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);\r\n }\r\n\r\n public static async abandonLocks(arg: BriefcaseIdArg, locks: LockMap): Promise<void> {\r\n this.findLocalHub(arg.iModelId).abandonLocks(locks, arg);\r\n }\r\n\r\n public static async queryIModelByName(arg: IModelNameArg): Promise<GuidString | undefined> {\r\n for (const hub of this.hubs) {\r\n const localHub = hub[1];\r\n if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)\r\n return localHub.iModelId;\r\n }\r\n return undefined;\r\n }\r\n\r\n public static async deleteIModel(arg: IModelIdArg & { iTwinId: GuidString }): Promise<void> {\r\n return this.destroy(arg.iModelId);\r\n }\r\n\r\n private static async mockProgressReporting(progressCallback: ProgressFunction, totalSize: number): Promise<void> {\r\n await new Promise((resolve, reject) => {\r\n let rejected = false;\r\n\r\n const mockProgress = (index: number) => {\r\n const bytesDownloaded = Math.floor(totalSize * (index / 4));\r\n if (!rejected && progressCallback(bytesDownloaded, totalSize) === ProgressStatus.Abort) {\r\n rejected = true;\r\n reject(new Error(\"AbortError\"));\r\n }\r\n };\r\n\r\n mockProgress(1);\r\n setTimeout(() => mockProgress(2), 50);\r\n setTimeout(() => mockProgress(3), 100);\r\n setTimeout(() => {\r\n mockProgress(4);\r\n resolve(undefined);\r\n }, 150);\r\n });\r\n }\r\n}\r\n"]}
@@ -1,29 +1,18 @@
1
1
  /** @packageDocumentation
2
2
  * @module iModels
3
3
  */
4
- import { AccessToken, BeDuration, GuidString, Id64String, Optional } from "@itwin/core-bentley";
4
+ import { AccessToken, BeDuration, GuidString, Optional } from "@itwin/core-bentley";
5
5
  import { BriefcaseId, BriefcaseProps, ChangesetFileProps, ChangesetIndex, ChangesetIndexOrId, ChangesetProps, ChangesetRange, LocalBriefcaseProps, LocalDirName, LocalFileName, RequestNewBriefcaseProps } from "@itwin/core-common";
6
6
  import { AcquireNewBriefcaseIdArg, DownloadChangesetArg, DownloadChangesetRangeArg, IModelNameArg } from "./BackendHubAccess";
7
7
  import { ProgressFunction } from "./CheckpointManager";
8
8
  import { BriefcaseDb, IModelDb, TokenArg } from "./IModelDb";
9
9
  import { StashProps } from "./StashManager";
10
- import { ECSqlRow } from "./Entity";
11
- /**
12
- * The argument for identifying an Patch Instance Key
10
+ import { ChangeInstance, ChangeMeta } from "./ChangesetReaderTypes";
11
+ /** The argument for patch instances during semantic rebase
13
12
  * @internal
14
13
  */
15
- interface PatchInstanceKey {
16
- id: Id64String;
17
- classFullName: string;
18
- }
19
- /** The argument for patch instances during high level rebase application
20
- * @internal
21
- */
22
- export interface InstancePatch {
23
- key: PatchInstanceKey;
24
- op: "Inserted" | "Updated" | "Deleted";
25
- isIndirect: boolean;
26
- props?: ECSqlRow;
14
+ export interface InstancePatch extends Omit<ChangeInstance, "$meta"> {
15
+ $meta: Pick<ChangeMeta, "op" | "stage" | "isIndirectChange">;
27
16
  }
28
17
  /** The argument for [[BriefcaseManager.downloadBriefcase]]
29
18
  * @public
@@ -294,44 +283,14 @@ export declare class BriefcaseManager {
294
283
  private static readonly SCHEMAS_FOLDER;
295
284
  private static readonly DATA_FOLDER;
296
285
  private static readonly DATA_FILE_NAME;
297
- /**
298
- * Captures the changed instances as patch instances from each data txn in the briefcase db for semantic rebase
299
- * @param db The {@link BriefcaseDb} instance for which to capture the changed instances as patch instances for all data txns
300
- * @internal
301
- */
302
- private static capturePatchInstances;
303
- /**
304
- * Captures changed instances from a txn as JSON
305
- * @param txnId The txn id for which to capture changed instances
306
- * @param db The {@link BriefcaseDb} instance from which to capture changed instances as json
307
- * @returns changed instances for semantic rebase
308
- * @internal
309
- */
310
- private static captureChangedInstancesAsJSON;
311
- /**
312
- * Constructs patch instances from changed instances
313
- * @param changedInstances The changed instances from which to construct the patch instances
314
- * @param db The {@link BriefcaseDb} instance for which to construct the patch instances
315
- * @returns The {@link InstancePatch} instance patches for semantic rebase
316
- * @internal
317
- */
318
- private static constructPatchInstances;
319
- /**
320
- * Constructs a single patch instance from changed instance
321
- * @param changedInstance The changed instance from which to construct the patch instance
322
- * @param db The {@link BriefcaseDb} instance for which to construct the single patch instance
323
- * @returns a single instance patch {@link InstancePatch}
324
- * @throws IModelError If cannot determine classId or unknown operation encountered
325
- */
326
- private static constructPatchInstance;
327
286
  /**
328
287
  * Stores changed instances for semantic rebase locally in appropriate json file in a folder structure
329
- * @param db The {@link BriefcaseDb} instance for storing the changed instances against a txn
288
+ * @param db The [BriefcaseDb]($backend) instance for storing the changed instances against a txn
330
289
  * @param txnId The txn id for which we are storing the changed instances
331
- * @param instancePatches The {@link InstancePatch} instance patches to be stored
290
+ * @param instancePatches The [ChangeInstance]($backend) IterableIterator instance patches to be stored
332
291
  * @internal
333
292
  */
334
- private static storeChangedInstancesForSemanticRebase;
293
+ static storeChangedInstancesForSemanticRebase(db: BriefcaseDb, txnId: string, instancePatches: IterableIterator<ChangeInstance>): void;
335
294
  /**
336
295
  * Gets the base path for semantic rebase local files
337
296
  * @param db The {@link BriefcaseDb} instance for which to get the base path
@@ -341,7 +300,7 @@ export declare class BriefcaseManager {
341
300
  static getBasePathForSemanticRebaseLocalFiles(db: BriefcaseDb): string;
342
301
  /**
343
302
  * Stores schemas for semantic rebase locally in appropriate folder structure
344
- * @param db The {@link BriefcaseDb} instance for storing the schemas against a txn
303
+ * @param db The [BriefcaseDb]($backend) instance for storing the schemas against a txn
345
304
  * @param txnId The txn id for which we are storing the schemas
346
305
  * @param schemaFileNames The schema file paths or schema xml strings to be stored
347
306
  * @internal
@@ -349,7 +308,7 @@ export declare class BriefcaseManager {
349
308
  static storeSchemasForSemanticRebase<T extends LocalFileName[] | string[]>(db: BriefcaseDb, txnId: string, schemaFileNames: T): void;
350
309
  /**
351
310
  * Gets schemas for semantic rebase for a txn
352
- * @param db The {@link BriefcaseDb} instance for getting the locally stored schemas against a txn
311
+ * @param db The [BriefcaseDb]($backend) instance for getting the locally stored schemas against a txn
353
312
  * @param txnId The txn id for which we are getting the schemas
354
313
  * @returns the schema file paths
355
314
  * @internal
@@ -357,15 +316,15 @@ export declare class BriefcaseManager {
357
316
  static getSchemasForTxn(db: BriefcaseDb, txnId: string): string[];
358
317
  /**
359
318
  * Get the changed instances data for semantic rebase for a txn
360
- * @param db - The {@link BriefcaseDb} instance for getting the locally stored changed instances against a txn
319
+ * @param db - The [BriefcaseDb]($backend) instance for getting the locally stored changed instances against a txn
361
320
  * @param txnId - The txn id for which we are getting the changed instances
362
321
  * @returns Instance patches
363
322
  * @internal
364
323
  */
365
- static getChangedInstancesDataForTxn(db: BriefcaseDb, txnId: string): InstancePatch[];
324
+ static getChangedInstancesDataForTxn(db: BriefcaseDb, txnId: string): AsyncGenerator<InstancePatch>;
366
325
  /**
367
326
  * Checks if schema folder exists for semantic rebase for a txn
368
- * @param db - The {@link BriefcaseDb} instance for which TO check the schema folder
327
+ * @param db - The [BriefcaseDb]($backend) instance for which TO check the schema folder
369
328
  * @param txnId - The txn id for which we are check the schema folder
370
329
  * @returns true if exists, false otherwise
371
330
  * @internal
@@ -373,7 +332,7 @@ export declare class BriefcaseManager {
373
332
  static semanticRebaseSchemaFolderExists(db: BriefcaseDb, txnId: string): boolean;
374
333
  /**
375
334
  * Checks if data folder exists for semantic rebase for a txn
376
- * @param db The {@link BriefcaseDb} instance for which to check the data folder.
335
+ * @param db The [BriefcaseDb]($backend) instance for which to check the data folder.
377
336
  * @param txnId The txn id for which to check the data folder
378
337
  * @returns true if exists, false otherwise
379
338
  * @internal
@@ -381,21 +340,21 @@ export declare class BriefcaseManager {
381
340
  static semanticRebaseDataFolderExists(db: BriefcaseDb, txnId: string): boolean;
382
341
  /**
383
342
  * Deletes the schema folder for semantic rebase for a txn
384
- * @param db The {@link BriefcaseDb} instance for which to delete the schema folder.
343
+ * @param db The [BriefcaseDb]($backend) instance for which to delete the schema folder.
385
344
  * @param txnId The txn id for which to delete the schema folder
386
345
  * @internal
387
346
  */
388
347
  static deleteTxnSchemaFolder(db: BriefcaseDb, txnId: string): void;
389
348
  /**
390
349
  * Deletes the data folder for semantic rebase for a txn
391
- * @param db The {@link BriefcaseDb} instance for which to delete the data folder.
350
+ * @param db The [BriefcaseDb]($backend) instance for which to delete the data folder.
392
351
  * @param txnId The txn id for which to delete the data folder
393
352
  * @internal
394
353
  */
395
354
  static deleteTxnDataFolder(db: BriefcaseDb, txnId: string): void;
396
355
  /**
397
356
  * Deletes rebase folders for semantic rebase
398
- * @param db The {@link BriefcaseDb} instance for which to delete the rebase folders.
357
+ * @param db The [BriefcaseDb]($backend) instance for which to delete the rebase folders.
399
358
  * @param checkIfEmpty If true, only deletes the base folder if it is empty, default is false
400
359
  * @internal
401
360
  */
@@ -408,5 +367,4 @@ export declare class BriefcaseManager {
408
367
  */
409
368
  private static cleanupRebaseFolders;
410
369
  }
411
- export {};
412
370
  //# sourceMappingURL=BriefcaseManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BriefcaseManager.d.ts","sourceRoot":"","sources":["../../src/BriefcaseManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EACL,WAAW,EAAE,UAAU,EAA6B,UAAU,EAAE,UAAU,EAAmD,QAAQ,EACtI,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EAAoB,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAA6C,mBAAmB,EACrM,YAAY,EAAE,aAAa,EAAE,wBAAwB,EAEtD,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9H,OAAO,EAAsC,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM7D,OAAO,EAAgB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKpC;;;GAGG;AACH,UAAU,gBAAgB;IACxB,EAAE,EAAE,UAAU,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;AAWD;;EAEE;AACF,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,gBAAgB,CAAC;IACtB,EAAE,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC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6
  * @module iModels
7
7
  */
8
- var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
9
- if (value !== null && value !== void 0) {
10
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
11
- var dispose, inner;
12
- if (async) {
13
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
14
- dispose = value[Symbol.asyncDispose];
15
- }
16
- if (dispose === void 0) {
17
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
18
- dispose = value[Symbol.dispose];
19
- if (async) inner = dispose;
20
- }
21
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
22
- if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
23
- env.stack.push({ value: value, dispose: dispose, async: async });
24
- }
25
- else if (async) {
26
- env.stack.push({ async: true });
27
- }
28
- return value;
29
- };
30
- var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
31
- return function (env) {
32
- function fail(e) {
33
- env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
34
- env.hasError = true;
35
- }
36
- var r, s = 0;
37
- function next() {
38
- while (r = env.stack.pop()) {
39
- try {
40
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
41
- if (r.dispose) {
42
- var result = r.dispose.call(r.value);
43
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
44
- }
45
- else s |= 1;
46
- }
47
- catch (e) {
48
- fail(e);
49
- }
50
- }
51
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
52
- if (env.hasError) throw env.error;
53
- }
54
- return next();
55
- };
56
- })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
57
- var e = new Error(message);
58
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
59
- });
60
8
  // cspell:ignore cset csets ecchanges
61
9
  import * as path from "node:path";
62
10
  import * as os from "node:os";
63
11
  import { BeDuration, ChangeSetStatus, DbResult, IModelHubStatus, IModelStatus, Logger, OpenMode, StopWatch } from "@itwin/core-bentley";
64
- import { BriefcaseIdValue, ChangesetType, IModelError, IModelVersion, } from "@itwin/core-common";
12
+ import { Base64EncodedString, BriefcaseIdValue, ChangesetType, IModelError, IModelVersion, } from "@itwin/core-common";
65
13
  import { BackendLoggerCategory } from "./BackendLoggerCategory";
66
14
  import { CheckpointManager } from "./CheckpointManager";
67
15
  import { BriefcaseDb, IModelDb } from "./IModelDb";
@@ -71,8 +19,6 @@ import { SchemaSync } from "./SchemaSync";
71
19
  import { _hubAccess, _nativeDb, _releaseAllLocks } from "./internal/Symbols";
72
20
  import { IModelNative } from "./internal/NativePlatform";
73
21
  import { StashManager } from "./StashManager";
74
- import { ChangesetECAdaptor, ECChangeUnifierCache, PartialECChangeUnifier } from "./ChangesetECAdaptor";
75
- import { SqliteChangesetReader } from "./SqliteChangesetReader";
76
22
  const loggerCategory = BackendLoggerCategory.IModelDb;
77
23
  /** Manages downloading Briefcases and downloading and uploading changesets.
78
24
  * @public
@@ -528,11 +474,8 @@ export class BriefcaseManager {
528
474
  }
529
475
  if (!reverse) {
530
476
  if (briefcaseDb) {
531
- if (useSemanticRebase) {
532
- this.capturePatchInstances(briefcaseDb);
533
- }
534
477
  briefcaseDb.txns.rebaser.notifyReverseLocalChangesBegin();
535
- const reversedTxns = nativeDb.pullMergeReverseLocalChanges();
478
+ const reversedTxns = nativeDb.pullMergeReverseLocalChanges(useSemanticRebase);
536
479
  if (useSemanticRebase) {
537
480
  nativeDb.clearECDbCache(); // Clear the ECDb cache after reversing local changes to ensure consistency during semantic rebase with schema changes.
538
481
  }
@@ -757,101 +700,11 @@ export class BriefcaseManager {
757
700
  static SCHEMAS_FOLDER = "schemas";
758
701
  static DATA_FOLDER = "data";
759
702
  static DATA_FILE_NAME = "data.json";
760
- /**
761
- * Captures the changed instances as patch instances from each data txn in the briefcase db for semantic rebase
762
- * @param db The {@link BriefcaseDb} instance for which to capture the changed instances as patch instances for all data txns
763
- * @internal
764
- */
765
- static capturePatchInstances(db) {
766
- const txns = Array.from(db.txns.queryTxns());
767
- txns.forEach((txn) => {
768
- if (txn.type !== "Data")
769
- return;
770
- // already captured(This actually shows that first rebase operation is already done but during that while reinstating this txns,
771
- // some error happened so the folder still exists so we don't want to capture again)
772
- if (this.semanticRebaseDataFolderExists(db, txn.id))
773
- return;
774
- const changedInstances = this.captureChangedInstancesAsJSON(db, txn.id);
775
- const instancePatches = this.constructPatchInstances(db, changedInstances);
776
- this.storeChangedInstancesForSemanticRebase(db, txn.id, instancePatches);
777
- });
778
- }
779
- /**
780
- * Captures changed instances from a txn as JSON
781
- * @param txnId The txn id for which to capture changed instances
782
- * @param db The {@link BriefcaseDb} instance from which to capture changed instances as json
783
- * @returns changed instances for semantic rebase
784
- * @internal
785
- */
786
- static captureChangedInstancesAsJSON(db, txnId) {
787
- const env_1 = { stack: [], error: void 0, hasError: false };
788
- try {
789
- const reader = SqliteChangesetReader.openTxn({
790
- txnId, db, disableSchemaCheck: true
791
- });
792
- // eslint-disable-next-line @typescript-eslint/no-deprecated
793
- const adaptor = new ChangesetECAdaptor(reader);
794
- // eslint-disable-next-line @typescript-eslint/no-deprecated
795
- const indirectUnifier = __addDisposableResource(env_1, new PartialECChangeUnifier(reader.db, ECChangeUnifierCache.createInMemoryCache()), false);
796
- // eslint-disable-next-line @typescript-eslint/no-deprecated
797
- const directUnifier = __addDisposableResource(env_1, new PartialECChangeUnifier(reader.db, ECChangeUnifierCache.createInMemoryCache()), false);
798
- while (adaptor.step()) {
799
- if (adaptor.reader.isIndirect)
800
- indirectUnifier.appendFrom(adaptor); // eslint-disable-line @typescript-eslint/no-deprecated
801
- else
802
- directUnifier.appendFrom(adaptor); // eslint-disable-line @typescript-eslint/no-deprecated
803
- }
804
- return [...Array.from(directUnifier.instances).map((instance) => ({ isIndirect: false, instance })), ...Array.from(indirectUnifier.instances).map((instance) => ({ isIndirect: true, instance }))]; // eslint-disable-line @typescript-eslint/no-deprecated
805
- }
806
- catch (e_1) {
807
- env_1.error = e_1;
808
- env_1.hasError = true;
809
- }
810
- finally {
811
- __disposeResources(env_1);
812
- }
813
- }
814
- /**
815
- * Constructs patch instances from changed instances
816
- * @param changedInstances The changed instances from which to construct the patch instances
817
- * @param db The {@link BriefcaseDb} instance for which to construct the patch instances
818
- * @returns The {@link InstancePatch} instance patches for semantic rebase
819
- * @internal
820
- */
821
- static constructPatchInstances(db, changedInstances) {
822
- return changedInstances
823
- .filter((changedInstance) => !(changedInstance.instance.$meta?.op === "Updated" && changedInstance.instance.$meta.stage === "Old")) // we will not take the old stage of updated instances
824
- .map((changedInstance) => this.constructPatchInstance(db, changedInstance));
825
- }
826
- /**
827
- * Constructs a single patch instance from changed instance
828
- * @param changedInstance The changed instance from which to construct the patch instance
829
- * @param db The {@link BriefcaseDb} instance for which to construct the single patch instance
830
- * @returns a single instance patch {@link InstancePatch}
831
- * @throws IModelError If cannot determine classId or unknown operation encountered
832
- */
833
- static constructPatchInstance(db, changedInstance) {
834
- const className = (changedInstance.instance.ECClassId && db.getClassNameFromId(changedInstance.instance.ECClassId))
835
- ?? changedInstance.instance.$meta?.classFullName
836
- ?? (changedInstance.instance.$meta?.fallbackClassId && db.getClassNameFromId(changedInstance.instance.$meta.fallbackClassId));
837
- if (!className)
838
- throw new IModelError(IModelStatus.BadArg, "Cannot determine classId of changed instance");
839
- const instanceKey = { id: changedInstance.instance.ECInstanceId, classFullName: className };
840
- const op = changedInstance.instance.$meta?.op;
841
- if (op !== "Inserted" && op !== "Updated" && op !== "Deleted")
842
- throw new IModelError(IModelStatus.BadArg, `Unknown operation: ${op}`);
843
- return {
844
- key: instanceKey,
845
- op,
846
- isIndirect: changedInstance.isIndirect,
847
- props: op !== "Deleted" ? db[_nativeDb].readInstance(instanceKey, { useJsNames: true }) : undefined,
848
- };
849
- }
850
703
  /**
851
704
  * Stores changed instances for semantic rebase locally in appropriate json file in a folder structure
852
- * @param db The {@link BriefcaseDb} instance for storing the changed instances against a txn
705
+ * @param db The [BriefcaseDb]($backend) instance for storing the changed instances against a txn
853
706
  * @param txnId The txn id for which we are storing the changed instances
854
- * @param instancePatches The {@link InstancePatch} instance patches to be stored
707
+ * @param instancePatches The [ChangeInstance]($backend) IterableIterator instance patches to be stored
855
708
  * @internal
856
709
  */
857
710
  static storeChangedInstancesForSemanticRebase(db, txnId, instancePatches) {
@@ -861,7 +714,33 @@ export class BriefcaseManager {
861
714
  if (IModelJsFs.existsSync(targetDir))
862
715
  IModelJsFs.removeSync(targetDir);
863
716
  IModelJsFs.recursiveMkDirSync(targetDir);
864
- IModelJsFs.writeFileSync(filePath, JSON.stringify(instancePatches, undefined, 2));
717
+ const BATCH_SIZE = 100;
718
+ let isFirst = true;
719
+ let batchParts = [];
720
+ const flushBatch = () => {
721
+ if (batchParts.length === 0)
722
+ return;
723
+ IModelJsFs.appendFileSync(filePath, batchParts.join(""));
724
+ batchParts = [];
725
+ };
726
+ IModelJsFs.writeFileSync(filePath, "[");
727
+ for (const instancePatch of instancePatches) {
728
+ // we will not take the old stage of updated instances for now, because we still don't have conflict resolution on instance level while using semantic rebase.
729
+ // Once we have conflict resolution on instance level, we can consider taking old stage of updated instances as well.
730
+ if (instancePatch.$meta.op === "Updated" && instancePatch.$meta.stage === "Old")
731
+ continue;
732
+ const { $meta, ...rest } = instancePatch;
733
+ const transformedInstance = {
734
+ ...rest,
735
+ $meta: { op: $meta.op, stage: $meta.stage, isIndirectChange: $meta.isIndirectChange },
736
+ };
737
+ batchParts.push(`${isFirst ? "" : ","}\n${JSON.stringify(transformedInstance, Base64EncodedString.replacer)}`);
738
+ isFirst = false;
739
+ if (batchParts.length >= BATCH_SIZE)
740
+ flushBatch();
741
+ }
742
+ flushBatch();
743
+ IModelJsFs.appendFileSync(filePath, "\n]");
865
744
  }
866
745
  /**
867
746
  * Gets the base path for semantic rebase local files
@@ -874,7 +753,7 @@ export class BriefcaseManager {
874
753
  }
875
754
  /**
876
755
  * Stores schemas for semantic rebase locally in appropriate folder structure
877
- * @param db The {@link BriefcaseDb} instance for storing the schemas against a txn
756
+ * @param db The [BriefcaseDb]($backend) instance for storing the schemas against a txn
878
757
  * @param txnId The txn id for which we are storing the schemas
879
758
  * @param schemaFileNames The schema file paths or schema xml strings to be stored
880
759
  * @internal
@@ -900,7 +779,7 @@ export class BriefcaseManager {
900
779
  }
901
780
  /**
902
781
  * Gets schemas for semantic rebase for a txn
903
- * @param db The {@link BriefcaseDb} instance for getting the locally stored schemas against a txn
782
+ * @param db The [BriefcaseDb]($backend) instance for getting the locally stored schemas against a txn
904
783
  * @param txnId The txn id for which we are getting the schemas
905
784
  * @returns the schema file paths
906
785
  * @internal
@@ -912,21 +791,25 @@ export class BriefcaseManager {
912
791
  }
913
792
  /**
914
793
  * Get the changed instances data for semantic rebase for a txn
915
- * @param db - The {@link BriefcaseDb} instance for getting the locally stored changed instances against a txn
794
+ * @param db - The [BriefcaseDb]($backend) instance for getting the locally stored changed instances against a txn
916
795
  * @param txnId - The txn id for which we are getting the changed instances
917
796
  * @returns Instance patches
918
797
  * @internal
919
798
  */
920
- static getChangedInstancesDataForTxn(db, txnId) {
799
+ static async *getChangedInstancesDataForTxn(db, txnId) {
921
800
  const basePath = BriefcaseManager.getBasePathForSemanticRebaseLocalFiles(db);
922
801
  const folderPath = path.join(basePath, txnId, BriefcaseManager.DATA_FOLDER);
923
802
  const filePath = path.join(folderPath, BriefcaseManager.DATA_FILE_NAME);
924
- const fileContents = IModelJsFs.readFileWithEncodingSync(filePath, "utf-8");
925
- return JSON.parse(fileContents);
803
+ for await (const line of IModelJsFs.readLines(filePath)) {
804
+ if (line === "[" || line === "]" || line === "")
805
+ continue;
806
+ const trimmedLine = line.trim().endsWith(",") ? line.trim().slice(0, -1) : line.trim(); // remove trailing comma if exists
807
+ yield JSON.parse(trimmedLine, Base64EncodedString.reviver);
808
+ }
926
809
  }
927
810
  /**
928
811
  * Checks if schema folder exists for semantic rebase for a txn
929
- * @param db - The {@link BriefcaseDb} instance for which TO check the schema folder
812
+ * @param db - The [BriefcaseDb]($backend) instance for which TO check the schema folder
930
813
  * @param txnId - The txn id for which we are check the schema folder
931
814
  * @returns true if exists, false otherwise
932
815
  * @internal
@@ -938,7 +821,7 @@ export class BriefcaseManager {
938
821
  }
939
822
  /**
940
823
  * Checks if data folder exists for semantic rebase for a txn
941
- * @param db The {@link BriefcaseDb} instance for which to check the data folder.
824
+ * @param db The [BriefcaseDb]($backend) instance for which to check the data folder.
942
825
  * @param txnId The txn id for which to check the data folder
943
826
  * @returns true if exists, false otherwise
944
827
  * @internal
@@ -950,7 +833,7 @@ export class BriefcaseManager {
950
833
  }
951
834
  /**
952
835
  * Deletes the schema folder for semantic rebase for a txn
953
- * @param db The {@link BriefcaseDb} instance for which to delete the schema folder.
836
+ * @param db The [BriefcaseDb]($backend) instance for which to delete the schema folder.
954
837
  * @param txnId The txn id for which to delete the schema folder
955
838
  * @internal
956
839
  */
@@ -966,7 +849,7 @@ export class BriefcaseManager {
966
849
  }
967
850
  /**
968
851
  * Deletes the data folder for semantic rebase for a txn
969
- * @param db The {@link BriefcaseDb} instance for which to delete the data folder.
852
+ * @param db The [BriefcaseDb]($backend) instance for which to delete the data folder.
970
853
  * @param txnId The txn id for which to delete the data folder
971
854
  * @internal
972
855
  */
@@ -982,7 +865,7 @@ export class BriefcaseManager {
982
865
  }
983
866
  /**
984
867
  * Deletes rebase folders for semantic rebase
985
- * @param db The {@link BriefcaseDb} instance for which to delete the rebase folders.
868
+ * @param db The [BriefcaseDb]($backend) instance for which to delete the rebase folders.
986
869
  * @param checkIfEmpty If true, only deletes the base folder if it is empty, default is false
987
870
  * @internal
988
871
  */