@itwin/core-backend 5.2.0-dev.8 → 5.3.0-dev.2

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 (198) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +2 -0
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BackendLoggerCategory.d.ts +6 -0
  6. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  7. package/lib/cjs/BackendLoggerCategory.js +6 -0
  8. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  9. package/lib/cjs/BriefcaseManager.d.ts +57 -3
  10. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  11. package/lib/cjs/BriefcaseManager.js +151 -42
  12. package/lib/cjs/BriefcaseManager.js.map +1 -1
  13. package/lib/cjs/CloudSqlite.d.ts +4 -0
  14. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  15. package/lib/cjs/CloudSqlite.js.map +1 -1
  16. package/lib/cjs/ECDb.d.ts +8 -0
  17. package/lib/cjs/ECDb.d.ts.map +1 -1
  18. package/lib/cjs/ECDb.js +22 -0
  19. package/lib/cjs/ECDb.js.map +1 -1
  20. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  21. package/lib/cjs/GeographicCRSServices.js +2 -0
  22. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  23. package/lib/cjs/IModelDb.d.ts +54 -3
  24. package/lib/cjs/IModelDb.d.ts.map +1 -1
  25. package/lib/cjs/IModelDb.js +87 -9
  26. package/lib/cjs/IModelDb.js.map +1 -1
  27. package/lib/cjs/IModelHost.d.ts +11 -1
  28. package/lib/cjs/IModelHost.d.ts.map +1 -1
  29. package/lib/cjs/IModelHost.js +5 -0
  30. package/lib/cjs/IModelHost.js.map +1 -1
  31. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +1 -5
  32. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  33. package/lib/cjs/IModelIncrementalSchemaLocater.js +0 -6
  34. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  35. package/lib/cjs/SqliteChangesetReader.d.ts +8 -0
  36. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  37. package/lib/cjs/SqliteChangesetReader.js +11 -0
  38. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  39. package/lib/cjs/StashManager.d.ts +175 -0
  40. package/lib/cjs/StashManager.d.ts.map +1 -0
  41. package/lib/cjs/StashManager.js +306 -0
  42. package/lib/cjs/StashManager.js.map +1 -0
  43. package/lib/cjs/TxnManager.d.ts +226 -15
  44. package/lib/cjs/TxnManager.d.ts.map +1 -1
  45. package/lib/cjs/TxnManager.js +249 -23
  46. package/lib/cjs/TxnManager.js.map +1 -1
  47. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  48. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  49. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +15 -6
  50. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  51. package/lib/cjs/annotations/LeaderGeometry.d.ts +3 -2
  52. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  53. package/lib/cjs/annotations/LeaderGeometry.js +5 -4
  54. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  55. package/lib/cjs/annotations/TextAnnotationElement.d.ts +52 -24
  56. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  57. package/lib/cjs/annotations/TextAnnotationElement.js +49 -59
  58. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  59. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +2 -0
  60. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  61. package/lib/cjs/annotations/TextAnnotationGeometry.js +26 -19
  62. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  63. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -1
  64. package/lib/cjs/annotations/TextBlockGeometry.js +8 -0
  65. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  66. package/lib/cjs/annotations/TextBlockLayout.d.ts +49 -36
  67. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
  68. package/lib/cjs/annotations/TextBlockLayout.js +204 -135
  69. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  70. package/lib/cjs/internal/ChannelAdmin.js +1 -1
  71. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  72. package/lib/cjs/internal/Symbols.d.ts +1 -0
  73. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  74. package/lib/cjs/internal/Symbols.js +2 -1
  75. package/lib/cjs/internal/Symbols.js.map +1 -1
  76. package/lib/cjs/internal/annotations/fields.d.ts +2 -12
  77. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  78. package/lib/cjs/internal/annotations/fields.js +49 -45
  79. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  80. package/lib/cjs/workspace/Workspace.d.ts +1 -1
  81. package/lib/cjs/workspace/Workspace.js.map +1 -1
  82. package/lib/esm/BackendHubAccess.d.ts +2 -0
  83. package/lib/esm/BackendHubAccess.d.ts.map +1 -1
  84. package/lib/esm/BackendHubAccess.js.map +1 -1
  85. package/lib/esm/BackendLoggerCategory.d.ts +6 -0
  86. package/lib/esm/BackendLoggerCategory.d.ts.map +1 -1
  87. package/lib/esm/BackendLoggerCategory.js +6 -0
  88. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  89. package/lib/esm/BriefcaseManager.d.ts +57 -3
  90. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  91. package/lib/esm/BriefcaseManager.js +152 -43
  92. package/lib/esm/BriefcaseManager.js.map +1 -1
  93. package/lib/esm/CloudSqlite.d.ts +4 -0
  94. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  95. package/lib/esm/CloudSqlite.js.map +1 -1
  96. package/lib/esm/ECDb.d.ts +8 -0
  97. package/lib/esm/ECDb.d.ts.map +1 -1
  98. package/lib/esm/ECDb.js +22 -0
  99. package/lib/esm/ECDb.js.map +1 -1
  100. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  101. package/lib/esm/GeographicCRSServices.js +2 -0
  102. package/lib/esm/GeographicCRSServices.js.map +1 -1
  103. package/lib/esm/IModelDb.d.ts +54 -3
  104. package/lib/esm/IModelDb.d.ts.map +1 -1
  105. package/lib/esm/IModelDb.js +88 -10
  106. package/lib/esm/IModelDb.js.map +1 -1
  107. package/lib/esm/IModelHost.d.ts +11 -1
  108. package/lib/esm/IModelHost.d.ts.map +1 -1
  109. package/lib/esm/IModelHost.js +5 -0
  110. package/lib/esm/IModelHost.js.map +1 -1
  111. package/lib/esm/IModelIncrementalSchemaLocater.d.ts +1 -5
  112. package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  113. package/lib/esm/IModelIncrementalSchemaLocater.js +0 -6
  114. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  115. package/lib/esm/SqliteChangesetReader.d.ts +8 -0
  116. package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
  117. package/lib/esm/SqliteChangesetReader.js +11 -0
  118. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  119. package/lib/esm/StashManager.d.ts +175 -0
  120. package/lib/esm/StashManager.d.ts.map +1 -0
  121. package/lib/esm/StashManager.js +301 -0
  122. package/lib/esm/StashManager.js.map +1 -0
  123. package/lib/esm/TxnManager.d.ts +226 -15
  124. package/lib/esm/TxnManager.d.ts.map +1 -1
  125. package/lib/esm/TxnManager.js +247 -21
  126. package/lib/esm/TxnManager.js.map +1 -1
  127. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  128. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  129. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +13 -5
  130. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  131. package/lib/esm/annotations/LeaderGeometry.d.ts +3 -2
  132. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  133. package/lib/esm/annotations/LeaderGeometry.js +5 -4
  134. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  135. package/lib/esm/annotations/TextAnnotationElement.d.ts +52 -24
  136. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  137. package/lib/esm/annotations/TextAnnotationElement.js +51 -61
  138. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  139. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +2 -0
  140. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  141. package/lib/esm/annotations/TextAnnotationGeometry.js +26 -19
  142. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  143. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -1
  144. package/lib/esm/annotations/TextBlockGeometry.js +8 -0
  145. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  146. package/lib/esm/annotations/TextBlockLayout.d.ts +49 -36
  147. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
  148. package/lib/esm/annotations/TextBlockLayout.js +205 -136
  149. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  150. package/lib/esm/internal/ChannelAdmin.js +1 -1
  151. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  152. package/lib/esm/internal/Symbols.d.ts +1 -0
  153. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  154. package/lib/esm/internal/Symbols.js +1 -0
  155. package/lib/esm/internal/Symbols.js.map +1 -1
  156. package/lib/esm/internal/annotations/fields.d.ts +2 -12
  157. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  158. package/lib/esm/internal/annotations/fields.js +51 -47
  159. package/lib/esm/internal/annotations/fields.js.map +1 -1
  160. package/lib/esm/test/AnnotationTestUtils.d.ts +5 -1
  161. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -1
  162. package/lib/esm/test/AnnotationTestUtils.js +6 -1
  163. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  164. package/lib/esm/test/annotations/Fields.test.js +163 -46
  165. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  166. package/lib/esm/test/annotations/LeaderGeometry.test.js +12 -10
  167. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  168. package/lib/esm/test/annotations/TextAnnotation.test.js +299 -43
  169. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  170. package/lib/esm/test/annotations/TextBlock.test.js +453 -86
  171. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  172. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +46 -0
  173. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -1
  174. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +20 -2
  175. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  176. package/lib/esm/test/ecdb/ECDb.test.js +71 -1
  177. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  178. package/lib/esm/test/hubaccess/Rebase.test.d.ts +2 -0
  179. package/lib/esm/test/hubaccess/Rebase.test.d.ts.map +1 -0
  180. package/lib/esm/test/hubaccess/Rebase.test.js +640 -0
  181. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -0
  182. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +20 -20
  183. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  184. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +3 -3
  185. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  186. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +16 -1
  187. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -1
  188. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +47 -0
  189. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  190. package/lib/esm/test/standalone/ChangeMerge.test.js +15 -19
  191. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  192. package/lib/esm/test/standalone/ChangesetReader.test.js +131 -1
  193. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  194. package/lib/esm/test/standalone/MergeConflict.test.js +3 -3
  195. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  196. package/lib/esm/workspace/Workspace.d.ts +1 -1
  197. package/lib/esm/workspace/Workspace.js.map +1 -1
  198. package/package.json +13 -13
@@ -110,7 +110,7 @@ describe.skip("Merge conflict & locking", () => {
110
110
  b2.saveChanges();
111
111
  const conflicts = [];
112
112
  // we will not handle conflict and let the default conflict handler deal with it.
113
- b2.txns.changeMergeManager.addConflictHandler({
113
+ b2.txns.rebaser.addConflictHandler({
114
114
  id: "custom", handler: (arg) => {
115
115
  conflicts.push({
116
116
  cause: arg.cause,
@@ -198,7 +198,7 @@ describe.skip("Merge conflict & locking", () => {
198
198
  await b1.pushChanges({ accessToken: accessToken1, description: `deleted element ${el1}` });
199
199
  const conflicts = [];
200
200
  // we will not handle conflict and let the default conflict handler deal with it.
201
- b2.txns.changeMergeManager.addConflictHandler({
201
+ b2.txns.rebaser.addConflictHandler({
202
202
  id: "custom", handler: (arg) => {
203
203
  let id;
204
204
  if (arg.cause !== "ForeignKey") {
@@ -235,7 +235,7 @@ describe.skip("Merge conflict & locking", () => {
235
235
  id: undefined
236
236
  }
237
237
  ]);
238
- b2.txns.changeMergeManager.addConflictHandler({
238
+ b2.txns.rebaser.addConflictHandler({
239
239
  id: "delete_aspect_when_element_is_deleted", handler: (arg) => {
240
240
  if (arg.cause === "NotFound" && arg.tableName === "bis_Element") {
241
241
  // if element does not exist any more let delete the aspects as well.
@@ -1 +1 @@
1
- {"version":3,"file":"MergeConflict.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/MergeConflict.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAG/F,OAAO,EAEL,MAAM,EACN,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EACL,WAAW,EACX,cAAc,EAGd,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,QAAqB,EAAE,MAAmB;IACxF,+BAA+B;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,MAAM,eAAe,CAAC,6CAA6C,CAAC,QAAQ,EAAE,eAAe,CAAC,kBAAkB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAElL,oCAAoC;IACpC,MAAM,UAAU,GAAoB,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAkB,MAAM,CAAC,YAAY,CAAC,CAAC;IACnG,MAAM,eAAe,GAAG,eAAe,CAAC,4BAA4B,CAAC,UAAU,EAAE,yBAAyB,CAAC,CAAC;IAC5G,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CA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E,CAAC,CAAC,EAAE,gFAAgF,CAAC,CAAC;QAClI,uBAAuB,CAAC,OAAO,EAAE,CAAC;QAClC,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { GuidString, Id64String } from \"@itwin/core-bentley\";\nimport {\n ElementAspectProps,\n IModel,\n SubCategoryAppearance,\n} from \"@itwin/core-common\";\nimport * as chai from \"chai\";\nimport { assert, expect } from \"chai\";\nimport * as chaiAsPromised from \"chai-as-promised\";\nimport { HubWrappers, KnownTestLocations } from \"../\";\nimport { HubMock } from \"../../internal/HubMock\";\nimport {\n BriefcaseDb,\n ChannelControl,\n DictionaryModel,\n ExternalSourceAspect,\n SpatialCategory,\n SqliteChangeOp,\n} from \"../../core-backend\";\nimport { IModelTestUtils, TestUserType } from \"../IModelTestUtils\";\nimport { RebaseChangesetConflictArgs, SqliteConflictCause } from \"../../internal/ChangesetConflictArgs\";\nchai.use(chaiAsPromised);\nimport * as sinon from \"sinon\";\n\nexport async function createNewModelAndCategory(rwIModel: BriefcaseDb, parent?: Id64String) {\n // Create a new physical model.\n const [, modelId] = await IModelTestUtils.createAndInsertPhysicalPartitionAndModelAsync(rwIModel, IModelTestUtils.getUniqueModelCode(rwIModel, \"newPhysicalModel\"), true, parent);\n\n // Find or create a SpatialCategory.\n const dictionary: DictionaryModel = rwIModel.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n const category = SpatialCategory.create(rwIModel, IModel.dictionaryId, newCategoryCode.value);\n const spatialCategoryId = rwIModel.elements.insertElement(category.toJSON());\n category.setDefaultAppearance(new SubCategoryAppearance({ color: 0xff0000 }));\n\n return { modelId, spatialCategoryId };\n}\n\nasync function assertThrowsAsync<T>(test: () => Promise<T>, msg?: string) {\n try {\n await test();\n } catch (e) {\n if (e instanceof Error && msg) {\n assert.equal(e.message, msg);\n }\n return;\n }\n throw new Error(`Failed to throw error with message: \"${msg}\"`);\n}\n\ndescribe.skip(\"Merge conflict & locking\", () => { // ###TODO FLAKY https://github.com/iTwin/itwinjs-core/issues/7730\n let iTwinId: GuidString;\n\n before(() => {\n HubMock.startup(\"MergeConflictTest\", KnownTestLocations.outputDir);\n iTwinId = HubMock.iTwinId;\n });\n after(() => HubMock.shutdown());\n\n it(\"pull/merge causing update conflict - dirty read/modify (with no lock)\", async () => {\n /**\n * To simulate a a data conflict for dirty read we update same aspect from two different briefcases\n * and when the second briefcase try to push its changes it will fail with following error.\n * \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered.\"\n */\n const accessToken1 = await HubWrappers.getAccessToken(TestUserType.SuperManager);\n const accessToken2 = await HubWrappers.getAccessToken(TestUserType.Regular);\n const accessToken3 = await HubWrappers.getAccessToken(TestUserType.Super);\n\n // Delete any existing iModels with the same name as the read-write test iModel\n const iModelName = \"TestIModel\";\n\n // Create a new empty iModel on the Hub & obtain a briefcase\n const rwIModelId = await HubMock.createNewIModel({ accessToken: accessToken1, iTwinId, iModelName, description: \"TestSubject\", noLocks: undefined });\n assert.isNotEmpty(rwIModelId);\n\n // to reproduce the issue we will disable locks altogether.\n const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken1, iTwinId, iModelId: rwIModelId, noLock: true });\n b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken2, iTwinId, iModelId: rwIModelId, noLock: true });\n b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken3, iTwinId, iModelId: rwIModelId, noLock: true });\n\n // create and insert a new model with code1\n const [, modelId] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(\n b1,\n IModelTestUtils.getUniqueModelCode(b1, \"newPhysicalModel\"),\n true);\n\n const dictionary: DictionaryModel = b1.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n\n const spatialCategoryId = SpatialCategory.insert(\n dictionary.iModel,\n dictionary.id,\n newCategoryCode.value,\n new SubCategoryAppearance({ color: 0xff0000 }),\n );\n\n // insert element and aspect\n const el1 = b1.elements.insertElement(IModelTestUtils.createPhysicalObject(b1, modelId, spatialCategoryId).toJSON());\n await b1.pullChanges();\n const aspectId1 = b1.elements.insertAspect({\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier\",\n } as ElementAspectProps);\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `inserted element with aspect ${el1}` });\n\n // b1 same as b2 and now both will modify same aspect\n await b2.pullChanges();\n\n // b1 will change identifier from \"test identifier\" to \"test identifier (modified by b1)\"\n b1.elements.updateAspect({\n id: aspectId1,\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier (modified by b1)\",\n } as ElementAspectProps);\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `modify aspect ${aspectId1} with no lock` });\n\n // b2 will change identifier from \"test identifier\" to \"test identifier (modified by b2)\"\n b2.elements.updateAspect({\n id: aspectId1,\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier (modified by b2)\",\n } as ElementAspectProps);\n b2.saveChanges();\n\n const conflicts: {\n cause: SqliteConflictCause,\n tableName: string,\n opcode?: SqliteChangeOp,\n id: Id64String,\n }[] = [];\n\n // we will not handle conflict and let the default conflict handler deal with it.\n b2.txns.changeMergeManager.addConflictHandler({\n id: \"custom\", handler: (arg: RebaseChangesetConflictArgs) => {\n conflicts.push({\n cause: arg.cause,\n tableName: arg.tableName,\n opcode: arg.opcode,\n id: arg.getValueId(0, arg.opcode === \"Inserted\" ? \"New\" : \"Old\") as Id64String,\n });\n return undefined;\n }\n });\n\n await b2.pushChanges({ accessToken: accessToken1, description: `modify aspect ${aspectId1} with no lock` });\n\n expect(conflicts.length).to.be.equals(3);\n\n chai.expect(\n [\n {\n \"cause\": \"Data\",\n \"tableName\": \"bis_Element\",\n \"opcode\": \"Updated\",\n \"id\": \"0x20000000004\"\n },\n {\n \"cause\": \"Data\",\n \"tableName\": \"bis_ElementMultiAspect\",\n \"opcode\": \"Updated\",\n \"id\": \"0x20000000001\"\n },\n {\n \"cause\": \"Data\",\n \"tableName\": \"bis_Model\",\n \"opcode\": \"Updated\",\n \"id\": \"0x20000000001\"\n }\n ]).to.be.deep.equals(conflicts);\n\n await b3.pullChanges();\n await b1.pullChanges();\n\n // b2 win as default conflict handler choose Replace to override local changes over master.\n (b2.elements.getAspect(aspectId1) as ExternalSourceAspect).identifier = \"test identifier (modified by b2)\";\n (b3.elements.getAspect(aspectId1) as ExternalSourceAspect).identifier = \"test identifier (modified by b2)\";\n (b1.elements.getAspect(aspectId1) as ExternalSourceAspect).identifier = \"test identifier (modified by b2)\";\n\n b1.close();\n b2.close();\n b3.close();\n });\n it(\"pull/merge causing update conflict - update causing local changes (with no lock)\", async () => {\n /**\n * To simulate a a data conflict for dirty read we update same aspect from two different briefcases\n * and when the second briefcase try to push its changes it will fail with following error.\n * \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered.\"\n */\n const accessToken1 = await HubWrappers.getAccessToken(TestUserType.SuperManager);\n const accessToken2 = await HubWrappers.getAccessToken(TestUserType.Regular);\n const accessToken3 = await HubWrappers.getAccessToken(TestUserType.Super);\n\n // Delete any existing iModels with the same name as the read-write test iModel\n const iModelName = \"TestIModel\";\n\n // Create a new empty iModel on the Hub & obtain a briefcase\n const rwIModelId = await HubMock.createNewIModel({ accessToken: accessToken1, iTwinId, iModelName, description: \"TestSubject\", noLocks: undefined });\n assert.isNotEmpty(rwIModelId);\n\n // to reproduce the issue we will disable locks altogether.\n const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken1, iTwinId, iModelId: rwIModelId, noLock: true });\n b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken2, iTwinId, iModelId: rwIModelId, noLock: true });\n b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken3, iTwinId, iModelId: rwIModelId, noLock: true });\n\n // create and insert a new model with code1\n const [, modelId] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(\n b1,\n IModelTestUtils.getUniqueModelCode(b1, \"newPhysicalModel\"),\n true);\n\n const dictionary: DictionaryModel = b1.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n\n const spatialCategoryId = SpatialCategory.insert(\n dictionary.iModel,\n dictionary.id,\n newCategoryCode.value,\n new SubCategoryAppearance({ color: 0xff0000 }),\n );\n\n // insert element and aspect\n const el1 = b1.elements.insertElement(IModelTestUtils.createPhysicalObject(b1, modelId, spatialCategoryId).toJSON());\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `inserted element with aspect ${el1}` });\n\n await b2.pullChanges();\n const aspectId1 = b2.elements.insertAspect({\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier\",\n } as ElementAspectProps);\n b2.saveChanges();\n\n b1.elements.deleteElement(el1);\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `deleted element ${el1}` });\n\n const conflicts: {\n cause: SqliteConflictCause,\n tableName: string,\n opcode?: SqliteChangeOp,\n id: Id64String | undefined,\n }[] = [];\n\n // we will not handle conflict and let the default conflict handler deal with it.\n b2.txns.changeMergeManager.addConflictHandler({\n id: \"custom\", handler: (arg: RebaseChangesetConflictArgs) => {\n let id;\n if (arg.cause !== \"ForeignKey\") {\n id = arg.getValueId(0, arg.opcode === \"Inserted\" ? \"New\" : \"Old\") as Id64String;\n }\n conflicts.push({\n cause: arg.cause,\n tableName: arg.tableName,\n opcode: arg.opcode,\n id,\n });\n return undefined;\n }\n });\n\n\n await assertThrowsAsync(\n async () => b2.pushChanges({ accessToken: accessToken1, description: `inserted element with aspect ${el1}` }),\n \"Foreign key conflicts in ChangeSet. Aborting rebase.\");\n\n expect(conflicts.length).to.be.equals(3);\n expect(conflicts).to.deep.equal([\n {\n cause: \"NotFound\",\n tableName: \"bis_Element\",\n opcode: \"Updated\",\n id: \"0x20000000004\"\n },\n {\n cause: \"Data\",\n tableName: \"bis_Model\",\n opcode: \"Updated\",\n id: \"0x20000000001\"\n },\n {\n cause: \"ForeignKey\",\n tableName: \"\",\n opcode: undefined,\n id: undefined\n }\n ]);\n\n b2.txns.changeMergeManager.addConflictHandler({\n id: \"delete_aspect_when_element_is_deleted\", handler: (arg: RebaseChangesetConflictArgs) => {\n if (arg.cause === \"NotFound\" && arg.tableName === \"bis_Element\") {\n // if element does not exist any more let delete the aspects as well.\n const elId = arg.getValueId(0, arg.opcode === \"Inserted\" ? \"New\" : \"Old\") as Id64String;\n b2.elements.getAspects(elId).forEach((aspect) => {\n b2.elements.deleteAspect(aspect.id);\n });\n }\n return undefined;\n }\n });\n\n b2.saveChanges();\n conflicts.length = 0;\n\n await b2.pushChanges({ accessToken: accessToken1, description: `nothing is pushed as the only change we made is reverted` });\n await b3.pullChanges();\n await b1.pullChanges();\n\n expect(() => b1.elements.getElement(el1)).throws(`Element=${el1}`);\n expect(() => b2.elements.getElement(el1)).throws(`Element=${el1}`);\n expect(() => b3.elements.getElement(el1)).throws(`Element=${el1}`);\n\n expect(() => b1.elements.getAspect(aspectId1)).throws(`ElementAspect not found ${aspectId1}`);\n expect(() => b2.elements.getAspect(aspectId1)).throws(`ElementAspect not found ${aspectId1}`);\n expect(() => b3.elements.getAspect(aspectId1)).throws(`ElementAspect not found ${aspectId1}`);\n\n b1.close();\n b2.close();\n b3.close();\n });\n\n it(\"aspect insert, update & delete requires exclusive lock\", async () => {\n const accessToken1 = await HubWrappers.getAccessToken(TestUserType.SuperManager);\n const accessToken2 = await HubWrappers.getAccessToken(TestUserType.Regular);\n const accessToken3 = await HubWrappers.getAccessToken(TestUserType.Super);\n\n // Delete any existing iModels with the same name as the read-write test iModel\n const iModelName = \"TestIModel\";\n\n // Create a new empty iModel on the Hub & obtain a briefcase\n const rwIModelId = await HubMock.createNewIModel({ accessToken: accessToken1, iTwinId, iModelName, description: \"TestSubject\", noLocks: undefined });\n assert.isNotEmpty(rwIModelId);\n\n const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken1, iTwinId, iModelId: rwIModelId });\n b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken2, iTwinId, iModelId: rwIModelId });\n b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken3, iTwinId, iModelId: rwIModelId });\n\n await b1.locks.acquireLocks({ shared: IModel.repositoryModelId });\n await b2.locks.acquireLocks({ shared: IModel.repositoryModelId });\n\n // create and insert a new model with code1\n const [, modelId] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(\n b1,\n IModelTestUtils.getUniqueModelCode(b1, \"newPhysicalModel\"),\n true);\n\n const dictionary: DictionaryModel = b1.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n\n await b1.locks.acquireLocks({ shared: dictionary.id });\n const spatialCategoryId = SpatialCategory.insert(\n dictionary.iModel,\n dictionary.id,\n newCategoryCode.value,\n new SubCategoryAppearance({ color: 0xff0000 }),\n );\n const el1 = b1.elements.insertElement(IModelTestUtils.createPhysicalObject(b1, modelId, spatialCategoryId).toJSON());\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `inserted element ${el1}` });\n\n await b2.pullChanges();\n let aspectId: Id64String;\n const insertAspectIntoB2 = () => {\n aspectId = b2.elements.insertAspect({\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier\",\n } as ElementAspectProps);\n };\n\n /* attempt to insert aspect without a lock */\n assert.throws(insertAspectIntoB2, \"Error inserting ElementAspect [exclusive lock not held on element for insert aspect (id=0x20000000004)], class: BisCore:ExternalSourceAspect\");\n\n /* acquire lock and try again */\n await b2.locks.acquireLocks({ exclusive: el1 });\n insertAspectIntoB2();\n\n /* b1 cannot acquire lock on el1 as its already taken by b2 */\n await expect(b1.locks.acquireLocks({ exclusive: el1 })).to.be.rejectedWith(\"exclusive lock is already held\");\n\n /* push changes on b2 to release lock on el1 */\n b2.saveChanges();\n await b2.pushChanges({ accessToken: accessToken2, description: `add aspect to element ${el1}` });\n\n await b1.pullChanges();\n\n const updateAspectIntoB1 = () => {\n b1.elements.updateAspect({\n id: aspectId,\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier (modified)\",\n } as ElementAspectProps);\n };\n\n /* attempt to update aspect without a lock */\n assert.throws(updateAspectIntoB1, \"Error updating ElementAspect [exclusive lock not held on element for update aspect (id=0x20000000004)], id: 0x30000000001\");\n\n /* acquire lock and try again */\n await b1.locks.acquireLocks({ exclusive: el1 });\n updateAspectIntoB1();\n\n /* delete the element */\n b1.elements.deleteElement(el1);\n b1.saveChanges();\n\n await b1.pushChanges({ accessToken: accessToken1, description: `deleted element ${el1}` });\n\n const onChangesetConflictStub = sinon.stub(BriefcaseDb.prototype, \"onChangesetConflict\" as any);\n /* we should be able to apply all changesets */\n await b3.pullChanges();\n expect(onChangesetConflictStub.callCount).eq(0, \"native conflict handler should not be called BriefcaseDb.onChangesetConflict()\");\n onChangesetConflictStub.restore();\n b1.close();\n b2.close();\n b3.close();\n });\n});\n"]}
1
+ {"version":3,"file":"MergeConflict.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/MergeConflict.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAG/F,OAAO,EAEL,MAAM,EACN,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EACL,WAAW,EACX,cAAc,EAGd,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,QAAqB,EAAE,MAAmB;IACxF,+BAA+B;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,MAAM,eAAe,CAAC,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C,CAAC;QAC/B,EAAE,CAAC,WAAW,EAAE,CAAC;QAEjB,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,GAAG,EAAE,EAAE,CAAC,CAAC;QAE3F,MAAM,uBAAuB,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,qBAA4B,CAAC,CAAC;QAChG,+CAA+C;QAC/C,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,gFAAgF,CAAC,CAAC;QAClI,uBAAuB,CAAC,OAAO,EAAE,CAAC;QAClC,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { GuidString, Id64String } from \"@itwin/core-bentley\";\nimport {\n ElementAspectProps,\n IModel,\n SubCategoryAppearance,\n} from \"@itwin/core-common\";\nimport * as chai from \"chai\";\nimport { assert, expect } from \"chai\";\nimport * as chaiAsPromised from \"chai-as-promised\";\nimport { HubWrappers, KnownTestLocations } from \"../\";\nimport { HubMock } from \"../../internal/HubMock\";\nimport {\n BriefcaseDb,\n ChannelControl,\n DictionaryModel,\n ExternalSourceAspect,\n SpatialCategory,\n SqliteChangeOp,\n} from \"../../core-backend\";\nimport { IModelTestUtils, TestUserType } from \"../IModelTestUtils\";\nimport { RebaseChangesetConflictArgs, SqliteConflictCause } from \"../../internal/ChangesetConflictArgs\";\nchai.use(chaiAsPromised);\nimport * as sinon from \"sinon\";\n\nexport async function createNewModelAndCategory(rwIModel: BriefcaseDb, parent?: Id64String) {\n // Create a new physical model.\n const [, modelId] = await IModelTestUtils.createAndInsertPhysicalPartitionAndModelAsync(rwIModel, IModelTestUtils.getUniqueModelCode(rwIModel, \"newPhysicalModel\"), true, parent);\n\n // Find or create a SpatialCategory.\n const dictionary: DictionaryModel = rwIModel.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n const category = SpatialCategory.create(rwIModel, IModel.dictionaryId, newCategoryCode.value);\n const spatialCategoryId = rwIModel.elements.insertElement(category.toJSON());\n category.setDefaultAppearance(new SubCategoryAppearance({ color: 0xff0000 }));\n\n return { modelId, spatialCategoryId };\n}\n\nasync function assertThrowsAsync<T>(test: () => Promise<T>, msg?: string) {\n try {\n await test();\n } catch (e) {\n if (e instanceof Error && msg) {\n assert.equal(e.message, msg);\n }\n return;\n }\n throw new Error(`Failed to throw error with message: \"${msg}\"`);\n}\n\ndescribe.skip(\"Merge conflict & locking\", () => { // ###TODO FLAKY https://github.com/iTwin/itwinjs-core/issues/7730\n let iTwinId: GuidString;\n\n before(() => {\n HubMock.startup(\"MergeConflictTest\", KnownTestLocations.outputDir);\n iTwinId = HubMock.iTwinId;\n });\n after(() => HubMock.shutdown());\n\n it(\"pull/merge causing update conflict - dirty read/modify (with no lock)\", async () => {\n /**\n * To simulate a a data conflict for dirty read we update same aspect from two different briefcases\n * and when the second briefcase try to push its changes it will fail with following error.\n * \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered.\"\n */\n const accessToken1 = await HubWrappers.getAccessToken(TestUserType.SuperManager);\n const accessToken2 = await HubWrappers.getAccessToken(TestUserType.Regular);\n const accessToken3 = await HubWrappers.getAccessToken(TestUserType.Super);\n\n // Delete any existing iModels with the same name as the read-write test iModel\n const iModelName = \"TestIModel\";\n\n // Create a new empty iModel on the Hub & obtain a briefcase\n const rwIModelId = await HubMock.createNewIModel({ accessToken: accessToken1, iTwinId, iModelName, description: \"TestSubject\", noLocks: undefined });\n assert.isNotEmpty(rwIModelId);\n\n // to reproduce the issue we will disable locks altogether.\n const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken1, iTwinId, iModelId: rwIModelId, noLock: true });\n b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken2, iTwinId, iModelId: rwIModelId, noLock: true });\n b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken3, iTwinId, iModelId: rwIModelId, noLock: true });\n\n // create and insert a new model with code1\n const [, modelId] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(\n b1,\n IModelTestUtils.getUniqueModelCode(b1, \"newPhysicalModel\"),\n true);\n\n const dictionary: DictionaryModel = b1.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n\n const spatialCategoryId = SpatialCategory.insert(\n dictionary.iModel,\n dictionary.id,\n newCategoryCode.value,\n new SubCategoryAppearance({ color: 0xff0000 }),\n );\n\n // insert element and aspect\n const el1 = b1.elements.insertElement(IModelTestUtils.createPhysicalObject(b1, modelId, spatialCategoryId).toJSON());\n await b1.pullChanges();\n const aspectId1 = b1.elements.insertAspect({\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier\",\n } as ElementAspectProps);\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `inserted element with aspect ${el1}` });\n\n // b1 same as b2 and now both will modify same aspect\n await b2.pullChanges();\n\n // b1 will change identifier from \"test identifier\" to \"test identifier (modified by b1)\"\n b1.elements.updateAspect({\n id: aspectId1,\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier (modified by b1)\",\n } as ElementAspectProps);\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `modify aspect ${aspectId1} with no lock` });\n\n // b2 will change identifier from \"test identifier\" to \"test identifier (modified by b2)\"\n b2.elements.updateAspect({\n id: aspectId1,\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier (modified by b2)\",\n } as ElementAspectProps);\n b2.saveChanges();\n\n const conflicts: {\n cause: SqliteConflictCause,\n tableName: string,\n opcode?: SqliteChangeOp,\n id: Id64String,\n }[] = [];\n\n // we will not handle conflict and let the default conflict handler deal with it.\n b2.txns.rebaser.addConflictHandler({\n id: \"custom\", handler: (arg: RebaseChangesetConflictArgs) => {\n conflicts.push({\n cause: arg.cause,\n tableName: arg.tableName,\n opcode: arg.opcode,\n id: arg.getValueId(0, arg.opcode === \"Inserted\" ? \"New\" : \"Old\") as Id64String,\n });\n return undefined;\n }\n });\n\n await b2.pushChanges({ accessToken: accessToken1, description: `modify aspect ${aspectId1} with no lock` });\n\n expect(conflicts.length).to.be.equals(3);\n\n chai.expect(\n [\n {\n \"cause\": \"Data\",\n \"tableName\": \"bis_Element\",\n \"opcode\": \"Updated\",\n \"id\": \"0x20000000004\"\n },\n {\n \"cause\": \"Data\",\n \"tableName\": \"bis_ElementMultiAspect\",\n \"opcode\": \"Updated\",\n \"id\": \"0x20000000001\"\n },\n {\n \"cause\": \"Data\",\n \"tableName\": \"bis_Model\",\n \"opcode\": \"Updated\",\n \"id\": \"0x20000000001\"\n }\n ]).to.be.deep.equals(conflicts);\n\n await b3.pullChanges();\n await b1.pullChanges();\n\n // b2 win as default conflict handler choose Replace to override local changes over master.\n (b2.elements.getAspect(aspectId1) as ExternalSourceAspect).identifier = \"test identifier (modified by b2)\";\n (b3.elements.getAspect(aspectId1) as ExternalSourceAspect).identifier = \"test identifier (modified by b2)\";\n (b1.elements.getAspect(aspectId1) as ExternalSourceAspect).identifier = \"test identifier (modified by b2)\";\n\n b1.close();\n b2.close();\n b3.close();\n });\n it(\"pull/merge causing update conflict - update causing local changes (with no lock)\", async () => {\n /**\n * To simulate a a data conflict for dirty read we update same aspect from two different briefcases\n * and when the second briefcase try to push its changes it will fail with following error.\n * \"UPDATE/DELETE before value do not match with one in db or CASCADE action was triggered.\"\n */\n const accessToken1 = await HubWrappers.getAccessToken(TestUserType.SuperManager);\n const accessToken2 = await HubWrappers.getAccessToken(TestUserType.Regular);\n const accessToken3 = await HubWrappers.getAccessToken(TestUserType.Super);\n\n // Delete any existing iModels with the same name as the read-write test iModel\n const iModelName = \"TestIModel\";\n\n // Create a new empty iModel on the Hub & obtain a briefcase\n const rwIModelId = await HubMock.createNewIModel({ accessToken: accessToken1, iTwinId, iModelName, description: \"TestSubject\", noLocks: undefined });\n assert.isNotEmpty(rwIModelId);\n\n // to reproduce the issue we will disable locks altogether.\n const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken1, iTwinId, iModelId: rwIModelId, noLock: true });\n b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken2, iTwinId, iModelId: rwIModelId, noLock: true });\n b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken3, iTwinId, iModelId: rwIModelId, noLock: true });\n\n // create and insert a new model with code1\n const [, modelId] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(\n b1,\n IModelTestUtils.getUniqueModelCode(b1, \"newPhysicalModel\"),\n true);\n\n const dictionary: DictionaryModel = b1.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n\n const spatialCategoryId = SpatialCategory.insert(\n dictionary.iModel,\n dictionary.id,\n newCategoryCode.value,\n new SubCategoryAppearance({ color: 0xff0000 }),\n );\n\n // insert element and aspect\n const el1 = b1.elements.insertElement(IModelTestUtils.createPhysicalObject(b1, modelId, spatialCategoryId).toJSON());\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `inserted element with aspect ${el1}` });\n\n await b2.pullChanges();\n const aspectId1 = b2.elements.insertAspect({\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier\",\n } as ElementAspectProps);\n b2.saveChanges();\n\n b1.elements.deleteElement(el1);\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `deleted element ${el1}` });\n\n const conflicts: {\n cause: SqliteConflictCause,\n tableName: string,\n opcode?: SqliteChangeOp,\n id: Id64String | undefined,\n }[] = [];\n\n // we will not handle conflict and let the default conflict handler deal with it.\n b2.txns.rebaser.addConflictHandler({\n id: \"custom\", handler: (arg: RebaseChangesetConflictArgs) => {\n let id;\n if (arg.cause !== \"ForeignKey\") {\n id = arg.getValueId(0, arg.opcode === \"Inserted\" ? \"New\" : \"Old\") as Id64String;\n }\n conflicts.push({\n cause: arg.cause,\n tableName: arg.tableName,\n opcode: arg.opcode,\n id,\n });\n return undefined;\n }\n });\n\n\n await assertThrowsAsync(\n async () => b2.pushChanges({ accessToken: accessToken1, description: `inserted element with aspect ${el1}` }),\n \"Foreign key conflicts in ChangeSet. Aborting rebase.\");\n\n expect(conflicts.length).to.be.equals(3);\n expect(conflicts).to.deep.equal([\n {\n cause: \"NotFound\",\n tableName: \"bis_Element\",\n opcode: \"Updated\",\n id: \"0x20000000004\"\n },\n {\n cause: \"Data\",\n tableName: \"bis_Model\",\n opcode: \"Updated\",\n id: \"0x20000000001\"\n },\n {\n cause: \"ForeignKey\",\n tableName: \"\",\n opcode: undefined,\n id: undefined\n }\n ]);\n\n b2.txns.rebaser.addConflictHandler({\n id: \"delete_aspect_when_element_is_deleted\", handler: (arg: RebaseChangesetConflictArgs) => {\n if (arg.cause === \"NotFound\" && arg.tableName === \"bis_Element\") {\n // if element does not exist any more let delete the aspects as well.\n const elId = arg.getValueId(0, arg.opcode === \"Inserted\" ? \"New\" : \"Old\") as Id64String;\n b2.elements.getAspects(elId).forEach((aspect) => {\n b2.elements.deleteAspect(aspect.id);\n });\n }\n return undefined;\n }\n });\n\n b2.saveChanges();\n conflicts.length = 0;\n\n await b2.pushChanges({ accessToken: accessToken1, description: `nothing is pushed as the only change we made is reverted` });\n await b3.pullChanges();\n await b1.pullChanges();\n\n expect(() => b1.elements.getElement(el1)).throws(`Element=${el1}`);\n expect(() => b2.elements.getElement(el1)).throws(`Element=${el1}`);\n expect(() => b3.elements.getElement(el1)).throws(`Element=${el1}`);\n\n expect(() => b1.elements.getAspect(aspectId1)).throws(`ElementAspect not found ${aspectId1}`);\n expect(() => b2.elements.getAspect(aspectId1)).throws(`ElementAspect not found ${aspectId1}`);\n expect(() => b3.elements.getAspect(aspectId1)).throws(`ElementAspect not found ${aspectId1}`);\n\n b1.close();\n b2.close();\n b3.close();\n });\n\n it(\"aspect insert, update & delete requires exclusive lock\", async () => {\n const accessToken1 = await HubWrappers.getAccessToken(TestUserType.SuperManager);\n const accessToken2 = await HubWrappers.getAccessToken(TestUserType.Regular);\n const accessToken3 = await HubWrappers.getAccessToken(TestUserType.Super);\n\n // Delete any existing iModels with the same name as the read-write test iModel\n const iModelName = \"TestIModel\";\n\n // Create a new empty iModel on the Hub & obtain a briefcase\n const rwIModelId = await HubMock.createNewIModel({ accessToken: accessToken1, iTwinId, iModelName, description: \"TestSubject\", noLocks: undefined });\n assert.isNotEmpty(rwIModelId);\n\n const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken1, iTwinId, iModelId: rwIModelId });\n b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken2, iTwinId, iModelId: rwIModelId });\n b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: accessToken3, iTwinId, iModelId: rwIModelId });\n\n await b1.locks.acquireLocks({ shared: IModel.repositoryModelId });\n await b2.locks.acquireLocks({ shared: IModel.repositoryModelId });\n\n // create and insert a new model with code1\n const [, modelId] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(\n b1,\n IModelTestUtils.getUniqueModelCode(b1, \"newPhysicalModel\"),\n true);\n\n const dictionary: DictionaryModel = b1.models.getModel<DictionaryModel>(IModel.dictionaryId);\n const newCategoryCode = IModelTestUtils.getUniqueSpatialCategoryCode(dictionary, \"ThisTestSpatialCategory\");\n\n await b1.locks.acquireLocks({ shared: dictionary.id });\n const spatialCategoryId = SpatialCategory.insert(\n dictionary.iModel,\n dictionary.id,\n newCategoryCode.value,\n new SubCategoryAppearance({ color: 0xff0000 }),\n );\n const el1 = b1.elements.insertElement(IModelTestUtils.createPhysicalObject(b1, modelId, spatialCategoryId).toJSON());\n b1.saveChanges();\n await b1.pushChanges({ accessToken: accessToken1, description: `inserted element ${el1}` });\n\n await b2.pullChanges();\n let aspectId: Id64String;\n const insertAspectIntoB2 = () => {\n aspectId = b2.elements.insertAspect({\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier\",\n } as ElementAspectProps);\n };\n\n /* attempt to insert aspect without a lock */\n assert.throws(insertAspectIntoB2, \"Error inserting ElementAspect [exclusive lock not held on element for insert aspect (id=0x20000000004)], class: BisCore:ExternalSourceAspect\");\n\n /* acquire lock and try again */\n await b2.locks.acquireLocks({ exclusive: el1 });\n insertAspectIntoB2();\n\n /* b1 cannot acquire lock on el1 as its already taken by b2 */\n await expect(b1.locks.acquireLocks({ exclusive: el1 })).to.be.rejectedWith(\"exclusive lock is already held\");\n\n /* push changes on b2 to release lock on el1 */\n b2.saveChanges();\n await b2.pushChanges({ accessToken: accessToken2, description: `add aspect to element ${el1}` });\n\n await b1.pullChanges();\n\n const updateAspectIntoB1 = () => {\n b1.elements.updateAspect({\n id: aspectId,\n classFullName: \"BisCore:ExternalSourceAspect\",\n element: {\n relClassName: \"BisCore:ElementOwnsExternalSourceAspects\",\n id: el1,\n },\n kind: \"\",\n identifier: \"test identifier (modified)\",\n } as ElementAspectProps);\n };\n\n /* attempt to update aspect without a lock */\n assert.throws(updateAspectIntoB1, \"Error updating ElementAspect [exclusive lock not held on element for update aspect (id=0x20000000004)], id: 0x30000000001\");\n\n /* acquire lock and try again */\n await b1.locks.acquireLocks({ exclusive: el1 });\n updateAspectIntoB1();\n\n /* delete the element */\n b1.elements.deleteElement(el1);\n b1.saveChanges();\n\n await b1.pushChanges({ accessToken: accessToken1, description: `deleted element ${el1}` });\n\n const onChangesetConflictStub = sinon.stub(BriefcaseDb.prototype, \"onChangesetConflict\" as any);\n /* we should be able to apply all changesets */\n await b3.pullChanges();\n expect(onChangesetConflictStub.callCount).eq(0, \"native conflict handler should not be called BriefcaseDb.onChangesetConflict()\");\n onChangesetConflictStub.restore();\n b1.close();\n b2.close();\n b3.close();\n });\n});\n"]}
@@ -102,7 +102,7 @@ export interface WorkspaceDbQueryResourcesArgs {
102
102
  */
103
103
  export interface WorkspaceDbManifest {
104
104
  /** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough
105
- * so that uses may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in
105
+ * so that users may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in
106
106
  * lists of WorkspaceDbs.
107
107
  * @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).
108
108
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Workspace.js","sourceRoot":"","sources":["../../../src/workspace/Workspace.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;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O,CAAC,qBAAqB,CAAC,SAAS,EAAE,6BAA6B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACxI,CAAC,CAAC;IAmBF;;;;;OAKG;IACH,SAAgB,iBAAiB,CAAC,IAA8B;QAC9D,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAuB,CAAC;IACnF,CAAC;IAFe,2BAAiB,oBAEhC,CAAA;IAED;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,IAA8B;QAC5D,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAA2B,CAAC;IACrF,CAAC;IAFe,yBAAe,kBAE9B,CAAA;IAED;;;OAGG;IACH,SAAgB,cAAc,CAAC,IAAiC;QAC9D,MAAM,SAAS,GAA6C,EAAE,CAAC;QAC/D,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC1B,EAAE,CAAC,cAAc,CAAC;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;wBACzB,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC/B,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAhBe,wBAAc,iBAgB7B,CAAA;AACH,CAAC,EAtFgB,SAAS,KAAT,SAAS,QAsFzB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Workspace\n */\n\nimport { AccessToken, BeEvent, ITwinError, Logger, Optional, UnexpectedErrors } from \"@itwin/core-bentley\";\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\nimport { CloudSqlite } from \"../CloudSqlite\";\nimport { SQLiteDb } from \"../SQLiteDb\";\nimport { SettingName, Settings, SettingsDictionary, SettingsPriority } from \"./Settings\";\nimport type { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { _implementationProhibited } from \"../internal/Symbols\";\n\n/** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.\n * A valid `WorkspaceContainerId` must conform to the following constraints:\n * - Consist solely of a combination of lower case letters, numbers, and dashes.\n * - May not start or end with a dash.\n * - Must be at least 3 characters long and no longer than 63 characters.\n * @beta\n */\nexport type WorkspaceContainerId = string;\n\n/** Properties describing a [[WorkspaceContainer]] for methods like [[Workspace.getContainerAsync]].\n * @beta\n */\nexport interface WorkspaceContainerProps extends Optional<CloudSqlite.ContainerAccessProps, \"accessToken\"> {\n /** Whether to synchronize the container via [[CloudSqlite.CloudContainer.checkForChanges]] whenever it is connected to a [[CloudSqlite.CloudCache]].\n * @note This property defaults to `true`.\n */\n readonly syncOnConnect?: boolean;\n /** A user-friendly description of the container's contents. */\n readonly description?: string;\n /** A message to display to the user if problems occur while loading the container. */\n readonly loadingHelp?: string;\n}\n\n/** The base name of a [[WorkspaceDb]], without any version information.\n * The name must conform to the following constraints:\n * - Case-insensitively unique among all [[WorkspaceDb]]s in the same [[WorkspaceContainer]].\n * - Between 1 and 255 characters in length.\n * - A legal filename on both [Windows](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and UNIX.\n * - Contain none of the following characters: forward or backward slash, period, single or double quote, backtick, and \"#\".\n * - Begin or end with a whitespace character.\n * @see [[WorkspaceDbFullName]] for the fully-specified name, including version information.\n * @beta\n */\nexport type WorkspaceDbName = string;\n\n/** The fully-specified name of a [[WorkspaceDb]], combining its [[WorkspaceDbName]] and [[WorkspaceDbVersion]] in the format \"name:version\".\n * @beta\n */\nexport type WorkspaceDbFullName = string;\n\n/** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., \"4.2.11\".\n * @beta\n */\nexport type WorkspaceDbVersion = CloudSqlite.DbVersion;\n\n/** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,\n * e.g., \">=1.2.7 <1.3.0\".\n * @beta\n */\nexport type WorkspaceDbVersionRange = CloudSqlite.DbVersionRange;\n\n/** Specifies the name and version of a [[WorkspaceDb]].\n * @beta\n */\nexport type WorkspaceDbNameAndVersion = Optional<CloudSqlite.DbNameAndVersion, \"dbName\">;\n\n/** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {\n /** If true, allow semver [prerelease versions](https://github.com/npm/node-semver?tab=readme-ov-file#prerelease-tags), e.g., \"1.4.2-beta.0\".\n * By default, only released version are allowed.\n */\n readonly includePrerelease?: boolean;\n /** If true, start a prefetch operation whenever this [[WorkspaceDb]] is opened, to begin downloading pages of the database before they are needed. */\n readonly prefetch?: boolean;\n}\n\n/** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.\n * @beta\n */\nexport type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;\n\n/** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.\n * @beta\n */\nexport type WorkspaceDbQueryResourcesCallback = (resourceNames: Iterable<string>) => void;\n\n/** Arguments supplied to [[WorkspaceDb.queryResources]].\n * @beta\n */\nexport interface WorkspaceDbQueryResourcesArgs {\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored if [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criterion. */\n callback: WorkspaceDbQueryResourcesCallback;\n}\n\n/** Metadata stored inside a [[WorkspaceDb]] describing the database's contents, to help users understand the purpose of the [[WorkspaceDb]], who to\n * contact with questions about it, and so on.\n * @note Only the [[workspaceName]] field is required, and users may add additional fields for their own purposes.\n * @note Since the information is stored inside of the [[WorkspaceDb]], it is versioned along with the rest of the contents.\n * @beta\n */\nexport interface WorkspaceDbManifest {\n /** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough\n * so that uses may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in\n * lists of WorkspaceDbs.\n * @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).\n */\n readonly workspaceName: string;\n /** A description of the contents of this [[WorkspaceDb]] to help users understand its purpose and appropriate usage. */\n readonly description?: string;\n /** The name of the person to contact with questions about this [[WorkspaceDb]]. */\n readonly contactName?: string;\n /** The name of the person who last modified this [[WorkspaceDb]]. */\n readonly lastEditedBy?: string;\n}\n\n/**\n * An exception thrown when attempting to load a [[WorkspaceDb]] or some of its data; for example, if the [[WorkspaceDb]] could not be found or the user\n * is not authorized to access its [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbLoadError extends ITwinError {\n /** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */\n wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;\n /** The [[WorkspaceDb]] in which the error occurred, if available. */\n wsDb?: WorkspaceDb;\n}\n\n/** An exception that may occur while opening an [[IModelDb]] if any problems are detected while loading its [[IModelDb.workspace]].\n * This exception is never actually thrown; instead, after the iModel is opened, the exception is forwarded to [[Workspace.exceptionDiagnosticFn]]\n * so that the user can be notified of the problems.\n * @beta\n */\nexport interface WorkspaceDbLoadErrors extends ITwinError {\n /** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem\n * is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..\n */\n wsLoadErrors?: WorkspaceDbLoadError[];\n}\n\n/** Specifies a resource inside a [[WorkspaceDb]] that holds a [[SettingsDictionary]] to load into [[Workspace.settings]].\n * Settings of this type named [[WorkspaceSettingNames.settingsWorkspaces]] are automatically loaded by [[Workspace.loadSettingsDictionary]].\n * @beta\n */\nexport interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {\n /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */\n resourceName: string;\n /** The priority to assign to the [[SettingsDictionary]]. */\n priority: SettingsPriority;\n}\n\n/** The name of a blob, string, or file resource stored in a [[WorkspaceDb]].\n * Resource names must conform to the following constraints:\n * - At least 1 character and no more than 1024 characters in length.\n * - No leading or trailing whitespace characters.\n * Each resource of a given type must has a unique name within the [[WorkspaceDb]]. It is technically possible, but discouraged, to define\n * resources with the same name but different types.\n * @beta\n */\nexport type WorkspaceResourceName = string;\n\n/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.\n * Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:\n * - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.\n * - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].\n * - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.\n *\n * Ultimately, each resource is stored in one of the following formats:\n * - A `string`, which is often a stringified `JSON` representation of the resource;\n * - A binary `blob`; or\n * - An embedded file.\n *\n * Strings and blobs can be accessed directly using [[getString]] and [[getBlob]]. Files must first be copied to the local file system using [[getFile]], and should be avoided unless the software\n * that uses them is written to access them from disk.\n *\n * A `WorkspaceDb` resides in a [[WorkspaceContainer]] that can be published to the cloud. Once published, the `WorkspaceDb` becomes immutable.\n * However, multiple versions of a single `WorkspaceDb` can be created, allowing the [[Workspace]] contents to evolve over time.\n * `WorkspaceDb`s use [semantic versioning](https://github.com/npm/node-semver).\n *\n * The set of available `WorkspaceDb`s available for use for specific purposes are defined in the [[Workspace]]'s [[Settings]]. You can obtain\n * a single `WorkspaceDb` using [[WorkspaceContainer.getWorkspaceDb]], but more commonly you will use [[Workspace.getWorkspaceDbs]] to obtain\n * a list of all of the `WorkspaceDb`s, sorted by priority, that correspond to a given [[SettingName]].\n *\n * You can create new `WorkspaceDb`s (or new versions of existing `WorkspaceDb`s) using [[WorkspaceEditor]].\n * @beta\n */\nexport interface WorkspaceDb {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** The [[WorkspaceContainer]] in which this db resides. */\n readonly container: WorkspaceContainer;\n /** The base name of this WorkspaceDb, without version */\n readonly dbName: WorkspaceDbName;\n /** An event raised before this WorkspaceDb is [[close]]d. */\n readonly onClose: BeEvent<() => void>;\n /** The name by which the WorkspaceDb can be opened. This will be either a local file name or the name of a database in a [[CloudSqlite.CloudContainer]]. */\n readonly dbFileName: string;\n /** The underlying SQLite database that stores this WorkspaceDb's resources. */\n readonly sqliteDb: SQLiteDb;\n /** Whether the underlying [[sqliteDb]] is currently [[open]]ed. */\n readonly isOpen: boolean;\n /** The manifest that describes the contents and context of this WorkspaceDb. */\n readonly manifest: WorkspaceDbManifest;\n /** The version of this WorkspaceDb */\n readonly version: WorkspaceDbVersion;\n\n /** Open the underlying [[sqliteDb]] to perform a query. Generally WorkspaceDbs are left closed and opened/closed as they're used. However,\n * when there will be significant activity against a WorkspaceDb, it may be useful to open it before the operations and close it afterwards.\n * Methods like [[queryResources]] open the SQLite database automatically and [[close]] it before they return.\n */\n open(): void;\n\n /** Close the underlying [[sqliteDb]]. You should call this after [[open]]ing the database and completing your query. */\n close(): void;\n\n /** Look up a string resource by name, if one exists. */\n getString(rscName: WorkspaceResourceName): string | undefined;\n\n /** Look up a binary resource by name, if one exists. */\n getBlob(rscName: WorkspaceResourceName): Uint8Array | undefined;\n\n /** Get a BlobIO reader for a blob WorkspaceResource.\n * @note when finished, caller *must* call `close` on the BlobIO.\n * @internal\n */\n getBlobReader(rscName: WorkspaceResourceName): SQLiteDb.BlobIO;\n\n /**\n * Extract a local copy of a file resource from this WorkspaceDb, if present.\n * @param rscName The name of the file resource in the WorkspaceDb\n * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If\n * you know the full path to use for the extracted file, you can supply it. Generally, it is best to *not* supply the filename and\n * keep the extracted files in the directory specified by [[WorkspaceContainer.filesDir]].\n * @returns the full path to a file on the local file system, or undefined if the no file named `rscName` exists.\n * @note The file is copied from the file into the local file system so it may be accessed directly. This happens only\n * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.\n * For this reason, you should not save the local file name, and instead call this method every time you access it, so its\n * content is always holds the correct version.\n * @note The filename will be a hash value, not the resource name.\n * @note Workspace resource files are set as read-only as they are copied from the file.\n * To edit them, you must first copy them to another location.\n */\n getFile(rscName: WorkspaceResourceName, targetFileName?: LocalFileName): LocalFileName | undefined;\n\n /**\n * Ensure that the contents of this `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.\n * Until the promise resolves, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.\n * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.\n * @returns a [[CloudSqlite.CloudPrefetch]] object that can be used to await and/or cancel the prefetch.\n * @throws if this WorkspaceDb is not from a [[CloudSqlite.CloudContainer]].\n */\n prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;\n\n /** Find resources of a particular type with names matching a specified pattern.\n * The matching resources will be supplied to [[WorkspaceDbQueryResourcesArgs.callbackk]].\n * @see [[Workspace.queryResources]] to query resources within multiple `WorkspaceDb`s.\n */\n queryResources(args: WorkspaceDbQueryResourcesArgs): void;\n\n /** @internal */\n queryFileResource(rscName: WorkspaceResourceName): { localFileName: LocalFileName, info: IModelJsNative.EmbedFileQuery } | undefined;\n}\n\n/** Options supplied to [[IModelHost.startup]] via [[IModelHostOptions.workspace]] to customize the initialization of [[IModelHost.appWorkspace]].\n * @beta\n */\nexport interface WorkspaceOpts {\n /** The local directory for non-cloud-based [[WorkspaceDb]] files. The [[Workspace]] API will look in this directory\n * for files named `${containerId}/${dbId}.itwin-workspace`.\n * @note if not supplied, defaults to \"iTwin/Workspace\" in the user-local folder.\n */\n containerDir?: LocalDirName;\n\n /** The name(s) of one or more local JSON files containing [[SettingsDictionary]]s to load when initializing the [[Workspace]]. */\n settingsFiles?: LocalFileName | LocalFileName[];\n}\n\n/** Arguments supplied to [[Workspace.getContainer]] and [[WorkspaceEditor.getContainer]].\n * @beta\n */\nexport interface GetWorkspaceContainerArgs extends WorkspaceContainerProps {\n /** Token required to access the container. */\n accessToken: AccessToken;\n}\n\n/**\n * Settings and resources that customize an application for the current session.\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\n * @beta\n */\nexport interface Workspace {\n /** @internal */\n [_implementationProhibited]: unknown;\n\n /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`.\n * @internal\n */\n readonly containerDir: LocalDirName;\n\n /** The current [[Settings]] for this Workspace */\n readonly settings: Settings;\n\n /** Get the cloud cache for cloud-based [[WorkspaceContainer]]s. */\n getCloudCache(): CloudSqlite.CloudCache;\n\n /** Search for a container previously opened by [[getContainer]] or [[getContainerAsync]].\n * @param containerId The id of the container\n * @returns the [[WorkspaceContainer]] for `containerId`, or `undefined` if no such container has been opened.\n * @internal\n */\n findContainer(containerId: WorkspaceContainerId): WorkspaceContainer | undefined;\n\n /** Obtain the [[WorkspaceContainer]] specified by `props`.\n * @param props The properties of the `WorkspaceContainer`, opening it if it is not already opened.\n * Otherwise it is created.\n * @note This function allows a `WorkspaceContainer.Props` without its [AccessToken]($bentley). It will attempt to obtain one from the [[BlobContainer]] service,\n * hence this function is async.\n * @see [[getContainer]] to obtain a container synchronously.\n */\n getContainerAsync(props: WorkspaceContainerProps): Promise<WorkspaceContainer>;\n\n /** Get a WorkspaceContainer with a supplied access token. This function is synchronous and may be used if:\n * - a valid [AccessToken]($bentley) is already available;\n * - the container has already been previously prefetched in another session (this is useful for offline usage); or\n * - the container is public and doesn't require an [AccessToken]($bentley).\n * @see [[getContainerAsync]] to obtain a container asynchronously if the above conditions do not apply.\n */\n getContainer(props: GetWorkspaceContainerArgs): WorkspaceContainer;\n\n /** Load a [[SettingsDictionary]] from the specified [[WorkspaceDb]] and add it to this workspace's current [[Settings]].\n * @note this function will load the dictionaries from the supplied list, and it will also call itself recursively for any entries in\n * the loaded Settings with the name [[WorkspaceSettingNames.settingsWorkspaces]]. In this manner, WorkspaceSettings may be \"chained\" together so that loading one\n * causes its \"dependent\" WorkspaceSettings to be loaded. Its `Promise` is resolved after all have been loaded (or failed to load).\n */\n loadSettingsDictionary(\n /** The properties of the [[WorkspaceDb]], plus the resourceName and [[SettingsPriority]]. May be either a single value or an array of them */\n props: WorkspaceDbSettingsProps | WorkspaceDbSettingsProps[],\n /** If present, an array that is populated with a list of problems while attempting to load the [[SettingsDictionary]](s). */\n problems?: WorkspaceDbLoadError[]\n ): Promise<void>;\n\n /** Get a single [[WorkspaceDb]]. */\n getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;\n\n /**\n * Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]\n * that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].\n * The returned array will be sorted according to their [[SettingsPriority]], with the first entry being the highest priority [[WorkspaceDb]].\n * @note The list is built by combining, in order, all of the settings with the supplied [[SettingName]]. It may therefore include the\n * properties of same WorkspaceDb multiple times. This list is automatically de-duped by [[getWorkspaceDb]].\n * @note This function is rarely used directly. Usually it is called by [[getWorkspaceDbs]]. However, this function is synchronous and may sometimes\n * be useful for editors, tests, or diagnostics.\n */\n resolveWorkspaceDbSetting(\n /** the name of the setting. */\n settingName: SettingName,\n /** optional filter to choose specific WorkspaceDbs from the settings values. If present, only those WorkspaceDbs for which the filter returns `true` will be included. */\n filter?: Workspace.DbListFilter): WorkspaceDbCloudProps[];\n\n /**\n * Get a sorted array of [[WorkspaceDb]]s that can be used to query or load resources. If the arguments supply a `settingName`, this function will\n * use [[resolveWorkspaceDbSetting]] to get get the array of [[WorkspaceDbCloudProps]].\n * @returns A `Promise` resolving to an array of [[WorkspaceDb]]s sorted by [[SettingsPriority]] so that resources found in WorkspaceDbs earlier in the list take precedence\n * over ones with the same name in later WorkspaceDbs. No WorkspaceDb will appear more than once in the list.\n * @note this function may request an [AccessToken]($bentley) for each WorkspaceDb if necessary, and hence is asynchronous.\n */\n getWorkspaceDbs(\n args: Workspace.DbListOrSettingName & {\n /** if supplied, this array is populated with a list of problems (e.g. no read permission) attempting to load WorkspacesDbs. */\n problems?: WorkspaceDbLoadError[];\n /** only valid when called with a settingName, if so passed as `filter` argument to [[resolveWorkspaceDbSetting]] */\n filter?: Workspace.DbListFilter;\n }): Promise<WorkspaceDb[]>;\n}\n\n/**\n * A WorkspaceContainer is a type of [[CloudSqlite.CloudContainer]] that holds one or more [[WorkspaceDb]]s. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.\n * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that\n * older versions of the WorkspaceDb may continue to be used, for example by archived projects. For programmers familiar with [NPM](https://www.npmjs.com/), this is conceptually\n * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).\n * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.\n * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.\n * @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.\n * In this case, [[cloudContainer]] will be `undefined`.\n * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.\n * @beta\n */\nexport interface WorkspaceContainer {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.\n * @internal\n */\n readonly filesDir: LocalDirName;\n /** The workspace into which this container was loaded. */\n readonly workspace: Workspace;\n /** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */\n readonly cloudContainer?: CloudSqlite.CloudContainer;\n /** Properties supplied when this container was loaded */\n readonly fromProps: WorkspaceContainerProps;\n\n /** @internal */\n addWorkspaceDb(toAdd: WorkspaceDb): void;\n\n /**\n * Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.\n * @throws Error if no version satisfying the criteria exists.\n */\n resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;\n\n /** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */\n getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;\n\n /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.\n * @internal\n */\n closeWorkspaceDb(container: WorkspaceDb): void;\n}\n\nfunction makeSettingName(name: string) {\n return `${\"itwin/core/workspace\"}/${name}`;\n}\n\n/** The names of various [[Setting]]s with special meaning to the [[Workspace]] system.\n * @beta\n */\nexport namespace WorkspaceSettingNames {\n /** The name of a setting that, when present in a [[WorkspaceDb]] loaded by [[Workspace.loadSettingsDictionary]], will automatically\n * be used to find and load additional [[SettingsDictionary]]'s in other [[WorkspaceDb]]s. This permits you to chain the settings inside on [[WorkspaceDb]]\n * to others upon which they depend.\n * This setting's value is an array of [[WorkspaceDbSettingsProps]]s.\n */\n export const settingsWorkspaces = makeSettingName(\"settingsWorkspaces\");\n}\n\n/** A function supplied as part of a [[QueryWorkspaceResourcesArgs]] to iterate the resources retrieved by [[Workspace.queryResources]].\n * The `resources` object should only be used inside the function - it is an error to attempt to iterate it after the function returns.\n * @beta\n */\nexport type QueryWorkspaceResourcesCallback = (resources: Iterable<{ name: string, db: WorkspaceDb }>) => void;\n\n/** Arguments supplied to [[Workspace.queryResources]] defining the query criteria and the list of [[WorkspaceDb]]s to query.\n * @beta\n */\nexport interface QueryWorkspaceResourcesArgs {\n /** The list of `WorkspaceDb`s to query, in the order in which they are to be queried.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored i [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criteria. */\n callback: QueryWorkspaceResourcesCallback;\n}\n\nfunction getWorkspaceResource(dbs: WorkspaceDb[], name: string, type: \"string\" | \"blob\"): string | Uint8Array | undefined {\n for (const db of dbs) {\n const val = type === \"blob\" ? db.getBlob(name) : db.getString(name);\n if (undefined !== val) {\n return val;\n }\n }\n\n return undefined;\n}\n\n/** Arguments supplied to [[Workspace.getStringResource]] and [[WOrkspace.getBlobResource]].\n * @beta\n */\nexport interface GetWorkspaceResourceArgs {\n /** The list of `WorkspaceDb`s to search, in the order in which they are to be searched.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The name of the resource to find. */\n name: WorkspaceResourceName;\n}\n\n/** @beta */\nexport namespace Workspace {\n /** A function invoked to handle exceptions produced while loading workspace data.\n * Applications can override this function to notify the user and/or attempt to diagnose the problem.\n * The default implementation simply logs each exception.\n */\n export let exceptionDiagnosticFn = (e: WorkspaceDbLoadErrors) => { // eslint-disable-line prefer-const\n if (e instanceof Error)\n Logger.logException(BackendLoggerCategory.Workspace, e);\n else\n UnexpectedErrors.handle(e);\n };\n\n /** Arguments supplied to [[Workspace.onSettingsDictionaryLoadedFn]] for every [[SettingsDictionary]] that is loaded from a [[WorkspaceDb]]. */\n export interface SettingsDictionaryLoaded {\n /** The dictionary that was loaded */\n dict: SettingsDictionary;\n /** The WorkspaceDb from which the dictionary was loaded. */\n from: WorkspaceDb;\n }\n\n /** A function invoked each time any [[SettingsDictionary]] is loaded from a [[WorkspaceDb]].\n * Applications can override this function to notify the user and/or record diagnostics.\n * The default implementation simply records an information message in the [Logger]($bentley).\n */\n export let onSettingsDictionaryLoadedFn = (loaded: SettingsDictionaryLoaded) => { // eslint-disable-line prefer-const\n Logger.logInfo(BackendLoggerCategory.Workspace, `loaded setting dictionary ${loaded.dict.props.name} from ${loaded.from.dbFileName}`);\n };\n\n /** Either an array of [[WorkspaceDbCloudProps]] or the name of a [[Setting]] that resolves to an array of [[WorkspaceDbCloudProps]].\n * Used by [[Workspace.getWorkspaceDbs]].\n */\n export type DbListOrSettingName = { readonly dbs: WorkspaceDbCloudProps[], readonly settingName?: never } | { readonly settingName: SettingName, readonly dbs?: never };\n\n /** In arguments supplied to [[Workspace.getWorkspaceDbs]] and [[Workspace.resolveWorkspaceDbSetting]], an optional function used to exclude some\n * [[WorkspaceDb]]s. Only those [[WorkspaceDb]]s for which the function returns `true` will be included.\n */\n export type DbListFilter = (\n /** The properties of the WorkspaceDb to be returned */\n dbProp: WorkspaceDbCloudProps,\n /** The SettingsDictionary holding the [[WorkspaceSettingNames.settingsWorkspace]] setting. May be used, for example, to determine the\n * [[SettingsPriority]] of the dictionary.\n */\n dict: SettingsDictionary\n ) => boolean;\n\n /** Searches a list of [[WorkspaceDb]]s for a string resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getString]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getStringResource(args: GetWorkspaceResourceArgs): string | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"string\") as string | undefined;\n }\n\n /** Searches a list of [[WorkspaceDb]]s for a blob resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getblob]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getBlobResource(args: GetWorkspaceResourceArgs): Uint8Array | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"blob\") as Uint8Array | undefined;\n }\n\n /** Query a list of [[WorkspaceDb]]s to find resources of a particular type with names matching a specified pattern.\n * @see [[WorkspaceDb.queryResources]] if you only need to query a single `WorkspaceDb`.\n * @beta\n */\n export function queryResources(args: QueryWorkspaceResourcesArgs): void {\n const resources: Array<{ name: string, db: WorkspaceDb }> = [];\n for (const db of args.dbs) {\n db.queryResources({\n type: args.type,\n namePattern: args.namePattern,\n nameCompare: args.nameCompare,\n callback: (names) => {\n for (const name of names) {\n resources.push({ db, name });\n }\n },\n });\n }\n\n args.callback(resources);\n }\n}\n"]}
1
+ {"version":3,"file":"Workspace.js","sourceRoot":"","sources":["../../../src/workspace/Workspace.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAoC,MAAM,EAAY,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAuahE,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,GAAG,sBAAsB,IAAI,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,KAAW,qBAAqB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CAAC;IAFe,2BAAiB,oBAEhC,CAAA;IAED;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,IAA8B;QAC5D,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAA2B,CAAC;IACrF,CAAC;IAFe,yBAAe,kBAE9B,CAAA;IAED;;;OAGG;IACH,SAAgB,cAAc,CAAC,IAAiC;QAC9D,MAAM,SAAS,GAA6C,EAAE,CAAC;QAC/D,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC1B,EAAE,CAAC,cAAc,CAAC;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;wBACzB,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC/B,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAhBe,wBAAc,iBAgB7B,CAAA;AACH,CAAC,EAtFgB,SAAS,KAAT,SAAS,QAsFzB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Workspace\n */\n\nimport { AccessToken, BeEvent, ITwinError, Logger, Optional, UnexpectedErrors } from \"@itwin/core-bentley\";\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\nimport { CloudSqlite } from \"../CloudSqlite\";\nimport { SQLiteDb } from \"../SQLiteDb\";\nimport { SettingName, Settings, SettingsDictionary, SettingsPriority } from \"./Settings\";\nimport type { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { _implementationProhibited } from \"../internal/Symbols\";\n\n/** The unique identifier of a [[WorkspaceContainer]]. This becomes the base name for a local file directory holding the container's [[WorkspaceDb]]s.\n * A valid `WorkspaceContainerId` must conform to the following constraints:\n * - Consist solely of a combination of lower case letters, numbers, and dashes.\n * - May not start or end with a dash.\n * - Must be at least 3 characters long and no longer than 63 characters.\n * @beta\n */\nexport type WorkspaceContainerId = string;\n\n/** Properties describing a [[WorkspaceContainer]] for methods like [[Workspace.getContainerAsync]].\n * @beta\n */\nexport interface WorkspaceContainerProps extends Optional<CloudSqlite.ContainerAccessProps, \"accessToken\"> {\n /** Whether to synchronize the container via [[CloudSqlite.CloudContainer.checkForChanges]] whenever it is connected to a [[CloudSqlite.CloudCache]].\n * @note This property defaults to `true`.\n */\n readonly syncOnConnect?: boolean;\n /** A user-friendly description of the container's contents. */\n readonly description?: string;\n /** A message to display to the user if problems occur while loading the container. */\n readonly loadingHelp?: string;\n}\n\n/** The base name of a [[WorkspaceDb]], without any version information.\n * The name must conform to the following constraints:\n * - Case-insensitively unique among all [[WorkspaceDb]]s in the same [[WorkspaceContainer]].\n * - Between 1 and 255 characters in length.\n * - A legal filename on both [Windows](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions) and UNIX.\n * - Contain none of the following characters: forward or backward slash, period, single or double quote, backtick, and \"#\".\n * - Begin or end with a whitespace character.\n * @see [[WorkspaceDbFullName]] for the fully-specified name, including version information.\n * @beta\n */\nexport type WorkspaceDbName = string;\n\n/** The fully-specified name of a [[WorkspaceDb]], combining its [[WorkspaceDbName]] and [[WorkspaceDbVersion]] in the format \"name:version\".\n * @beta\n */\nexport type WorkspaceDbFullName = string;\n\n/** A [semver](https://github.com/npm/node-semver) string describing the version of a [[WorkspaceDb]], e.g., \"4.2.11\".\n * @beta\n */\nexport type WorkspaceDbVersion = CloudSqlite.DbVersion;\n\n/** A [semver string](https://github.com/npm/node-semver?tab=readme-ov-file#ranges) describing a range of acceptable [[WorkspaceDbVersion]]s,\n * e.g., \">=1.2.7 <1.3.0\".\n * @beta\n */\nexport type WorkspaceDbVersionRange = CloudSqlite.DbVersionRange;\n\n/** Specifies the name and version of a [[WorkspaceDb]].\n * @beta\n */\nexport type WorkspaceDbNameAndVersion = Optional<CloudSqlite.DbNameAndVersion, \"dbName\">;\n\n/** Properties that specify how to load a [[WorkspaceDb]] within a [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbProps extends WorkspaceDbNameAndVersion {\n /** If true, allow semver [prerelease versions](https://github.com/npm/node-semver?tab=readme-ov-file#prerelease-tags), e.g., \"1.4.2-beta.0\".\n * By default, only released version are allowed.\n */\n readonly includePrerelease?: boolean;\n /** If true, start a prefetch operation whenever this [[WorkspaceDb]] is opened, to begin downloading pages of the database before they are needed. */\n readonly prefetch?: boolean;\n}\n\n/** Properties describing a [[WorkspaceDb]] and the [[WorkspaceContainer]] containing it.\n * @beta\n */\nexport type WorkspaceDbCloudProps = WorkspaceDbProps & WorkspaceContainerProps;\n\n/** A function supplied as [[WorkspaceDbQueryResourcesArgs.callback]] to be invoked to process the requested resources.\n * @beta\n */\nexport type WorkspaceDbQueryResourcesCallback = (resourceNames: Iterable<string>) => void;\n\n/** Arguments supplied to [[WorkspaceDb.queryResources]].\n * @beta\n */\nexport interface WorkspaceDbQueryResourcesArgs {\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored if [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criterion. */\n callback: WorkspaceDbQueryResourcesCallback;\n}\n\n/** Metadata stored inside a [[WorkspaceDb]] describing the database's contents, to help users understand the purpose of the [[WorkspaceDb]], who to\n * contact with questions about it, and so on.\n * @note Only the [[workspaceName]] field is required, and users may add additional fields for their own purposes.\n * @note Since the information is stored inside of the [[WorkspaceDb]], it is versioned along with the rest of the contents.\n * @beta\n */\nexport interface WorkspaceDbManifest {\n /** The name of the [[WorkspaceDb]] to be shown in user interfaces. Organizations should attempt to make this name informative enough\n * so that users may refer to this name in conversations. It should also be unique enough that there's no confusion when it appears in\n * lists of WorkspaceDbs.\n * @note it is possible and valid to change the workspaceName between new version of a WorkspaceDb (e.g. incorporating a date).\n */\n readonly workspaceName: string;\n /** A description of the contents of this [[WorkspaceDb]] to help users understand its purpose and appropriate usage. */\n readonly description?: string;\n /** The name of the person to contact with questions about this [[WorkspaceDb]]. */\n readonly contactName?: string;\n /** The name of the person who last modified this [[WorkspaceDb]]. */\n readonly lastEditedBy?: string;\n}\n\n/**\n * An exception thrown when attempting to load a [[WorkspaceDb]] or some of its data; for example, if the [[WorkspaceDb]] could not be found or the user\n * is not authorized to access its [[WorkspaceContainer]].\n * @beta\n */\nexport interface WorkspaceDbLoadError extends ITwinError {\n /** The properties of the [[WorkspaceDb]] that was attempted to load, including the identity of its [[WorkspaceContainer]]. */\n wsDbProps?: WorkspaceDbProps & Partial<WorkspaceDbCloudProps>;\n /** The [[WorkspaceDb]] in which the error occurred, if available. */\n wsDb?: WorkspaceDb;\n}\n\n/** An exception that may occur while opening an [[IModelDb]] if any problems are detected while loading its [[IModelDb.workspace]].\n * This exception is never actually thrown; instead, after the iModel is opened, the exception is forwarded to [[Workspace.exceptionDiagnosticFn]]\n * so that the user can be notified of the problems.\n * @beta\n */\nexport interface WorkspaceDbLoadErrors extends ITwinError {\n /** An array of problems that were encountered attempting to load [[WorkspaceDb]]s for an [[IModelDb]]. The most common problem\n * is that the user doesn't have read access to one or more [[WorkspaceContainer]]s used by the iModel's [[Workspace]]..\n */\n wsLoadErrors?: WorkspaceDbLoadError[];\n}\n\n/** Specifies a resource inside a [[WorkspaceDb]] that holds a [[SettingsDictionary]] to load into [[Workspace.settings]].\n * Settings of this type named [[WorkspaceSettingNames.settingsWorkspaces]] are automatically loaded by [[Workspace.loadSettingsDictionary]].\n * @beta\n */\nexport interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {\n /** The name of the resource holding the stringified JSON of the [[SettingsDictionary]]. */\n resourceName: string;\n /** The priority to assign to the [[SettingsDictionary]]. */\n priority: SettingsPriority;\n}\n\n/** The name of a blob, string, or file resource stored in a [[WorkspaceDb]].\n * Resource names must conform to the following constraints:\n * - At least 1 character and no more than 1024 characters in length.\n * - No leading or trailing whitespace characters.\n * Each resource of a given type must has a unique name within the [[WorkspaceDb]]. It is technically possible, but discouraged, to define\n * resources with the same name but different types.\n * @beta\n */\nexport type WorkspaceResourceName = string;\n\n/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.\n * Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:\n * - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.\n * - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].\n * - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.\n *\n * Ultimately, each resource is stored in one of the following formats:\n * - A `string`, which is often a stringified `JSON` representation of the resource;\n * - A binary `blob`; or\n * - An embedded file.\n *\n * Strings and blobs can be accessed directly using [[getString]] and [[getBlob]]. Files must first be copied to the local file system using [[getFile]], and should be avoided unless the software\n * that uses them is written to access them from disk.\n *\n * A `WorkspaceDb` resides in a [[WorkspaceContainer]] that can be published to the cloud. Once published, the `WorkspaceDb` becomes immutable.\n * However, multiple versions of a single `WorkspaceDb` can be created, allowing the [[Workspace]] contents to evolve over time.\n * `WorkspaceDb`s use [semantic versioning](https://github.com/npm/node-semver).\n *\n * The set of available `WorkspaceDb`s available for use for specific purposes are defined in the [[Workspace]]'s [[Settings]]. You can obtain\n * a single `WorkspaceDb` using [[WorkspaceContainer.getWorkspaceDb]], but more commonly you will use [[Workspace.getWorkspaceDbs]] to obtain\n * a list of all of the `WorkspaceDb`s, sorted by priority, that correspond to a given [[SettingName]].\n *\n * You can create new `WorkspaceDb`s (or new versions of existing `WorkspaceDb`s) using [[WorkspaceEditor]].\n * @beta\n */\nexport interface WorkspaceDb {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** The [[WorkspaceContainer]] in which this db resides. */\n readonly container: WorkspaceContainer;\n /** The base name of this WorkspaceDb, without version */\n readonly dbName: WorkspaceDbName;\n /** An event raised before this WorkspaceDb is [[close]]d. */\n readonly onClose: BeEvent<() => void>;\n /** The name by which the WorkspaceDb can be opened. This will be either a local file name or the name of a database in a [[CloudSqlite.CloudContainer]]. */\n readonly dbFileName: string;\n /** The underlying SQLite database that stores this WorkspaceDb's resources. */\n readonly sqliteDb: SQLiteDb;\n /** Whether the underlying [[sqliteDb]] is currently [[open]]ed. */\n readonly isOpen: boolean;\n /** The manifest that describes the contents and context of this WorkspaceDb. */\n readonly manifest: WorkspaceDbManifest;\n /** The version of this WorkspaceDb */\n readonly version: WorkspaceDbVersion;\n\n /** Open the underlying [[sqliteDb]] to perform a query. Generally WorkspaceDbs are left closed and opened/closed as they're used. However,\n * when there will be significant activity against a WorkspaceDb, it may be useful to open it before the operations and close it afterwards.\n * Methods like [[queryResources]] open the SQLite database automatically and [[close]] it before they return.\n */\n open(): void;\n\n /** Close the underlying [[sqliteDb]]. You should call this after [[open]]ing the database and completing your query. */\n close(): void;\n\n /** Look up a string resource by name, if one exists. */\n getString(rscName: WorkspaceResourceName): string | undefined;\n\n /** Look up a binary resource by name, if one exists. */\n getBlob(rscName: WorkspaceResourceName): Uint8Array | undefined;\n\n /** Get a BlobIO reader for a blob WorkspaceResource.\n * @note when finished, caller *must* call `close` on the BlobIO.\n * @internal\n */\n getBlobReader(rscName: WorkspaceResourceName): SQLiteDb.BlobIO;\n\n /**\n * Extract a local copy of a file resource from this WorkspaceDb, if present.\n * @param rscName The name of the file resource in the WorkspaceDb\n * @param targetFileName optional name for extracted file. Some applications require files in specific locations or filenames. If\n * you know the full path to use for the extracted file, you can supply it. Generally, it is best to *not* supply the filename and\n * keep the extracted files in the directory specified by [[WorkspaceContainer.filesDir]].\n * @returns the full path to a file on the local file system, or undefined if the no file named `rscName` exists.\n * @note The file is copied from the file into the local file system so it may be accessed directly. This happens only\n * as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file.\n * For this reason, you should not save the local file name, and instead call this method every time you access it, so its\n * content is always holds the correct version.\n * @note The filename will be a hash value, not the resource name.\n * @note Workspace resource files are set as read-only as they are copied from the file.\n * To edit them, you must first copy them to another location.\n */\n getFile(rscName: WorkspaceResourceName, targetFileName?: LocalFileName): LocalFileName | undefined;\n\n /**\n * Ensure that the contents of this `WorkspaceDb` are downloaded into the local cache so that it may be accessed offline.\n * Until the promise resolves, the `WorkspaceDb` is not fully downloaded, but it *may* be safely accessed during the download.\n * To determine the progress of the download, use the `localBlocks` and `totalBlocks` values returned by `CloudContainer.queryDatabase`.\n * @returns a [[CloudSqlite.CloudPrefetch]] object that can be used to await and/or cancel the prefetch.\n * @throws if this WorkspaceDb is not from a [[CloudSqlite.CloudContainer]].\n */\n prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;\n\n /** Find resources of a particular type with names matching a specified pattern.\n * The matching resources will be supplied to [[WorkspaceDbQueryResourcesArgs.callbackk]].\n * @see [[Workspace.queryResources]] to query resources within multiple `WorkspaceDb`s.\n */\n queryResources(args: WorkspaceDbQueryResourcesArgs): void;\n\n /** @internal */\n queryFileResource(rscName: WorkspaceResourceName): { localFileName: LocalFileName, info: IModelJsNative.EmbedFileQuery } | undefined;\n}\n\n/** Options supplied to [[IModelHost.startup]] via [[IModelHostOptions.workspace]] to customize the initialization of [[IModelHost.appWorkspace]].\n * @beta\n */\nexport interface WorkspaceOpts {\n /** The local directory for non-cloud-based [[WorkspaceDb]] files. The [[Workspace]] API will look in this directory\n * for files named `${containerId}/${dbId}.itwin-workspace`.\n * @note if not supplied, defaults to \"iTwin/Workspace\" in the user-local folder.\n */\n containerDir?: LocalDirName;\n\n /** The name(s) of one or more local JSON files containing [[SettingsDictionary]]s to load when initializing the [[Workspace]]. */\n settingsFiles?: LocalFileName | LocalFileName[];\n}\n\n/** Arguments supplied to [[Workspace.getContainer]] and [[WorkspaceEditor.getContainer]].\n * @beta\n */\nexport interface GetWorkspaceContainerArgs extends WorkspaceContainerProps {\n /** Token required to access the container. */\n accessToken: AccessToken;\n}\n\n/**\n * Settings and resources that customize an application for the current session.\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\n * @beta\n */\nexport interface Workspace {\n /** @internal */\n [_implementationProhibited]: unknown;\n\n /** The directory for local WorkspaceDb files with the name `${containerId}/${dbId}.itwin-workspace`.\n * @internal\n */\n readonly containerDir: LocalDirName;\n\n /** The current [[Settings]] for this Workspace */\n readonly settings: Settings;\n\n /** Get the cloud cache for cloud-based [[WorkspaceContainer]]s. */\n getCloudCache(): CloudSqlite.CloudCache;\n\n /** Search for a container previously opened by [[getContainer]] or [[getContainerAsync]].\n * @param containerId The id of the container\n * @returns the [[WorkspaceContainer]] for `containerId`, or `undefined` if no such container has been opened.\n * @internal\n */\n findContainer(containerId: WorkspaceContainerId): WorkspaceContainer | undefined;\n\n /** Obtain the [[WorkspaceContainer]] specified by `props`.\n * @param props The properties of the `WorkspaceContainer`, opening it if it is not already opened.\n * Otherwise it is created.\n * @note This function allows a `WorkspaceContainer.Props` without its [AccessToken]($bentley). It will attempt to obtain one from the [[BlobContainer]] service,\n * hence this function is async.\n * @see [[getContainer]] to obtain a container synchronously.\n */\n getContainerAsync(props: WorkspaceContainerProps): Promise<WorkspaceContainer>;\n\n /** Get a WorkspaceContainer with a supplied access token. This function is synchronous and may be used if:\n * - a valid [AccessToken]($bentley) is already available;\n * - the container has already been previously prefetched in another session (this is useful for offline usage); or\n * - the container is public and doesn't require an [AccessToken]($bentley).\n * @see [[getContainerAsync]] to obtain a container asynchronously if the above conditions do not apply.\n */\n getContainer(props: GetWorkspaceContainerArgs): WorkspaceContainer;\n\n /** Load a [[SettingsDictionary]] from the specified [[WorkspaceDb]] and add it to this workspace's current [[Settings]].\n * @note this function will load the dictionaries from the supplied list, and it will also call itself recursively for any entries in\n * the loaded Settings with the name [[WorkspaceSettingNames.settingsWorkspaces]]. In this manner, WorkspaceSettings may be \"chained\" together so that loading one\n * causes its \"dependent\" WorkspaceSettings to be loaded. Its `Promise` is resolved after all have been loaded (or failed to load).\n */\n loadSettingsDictionary(\n /** The properties of the [[WorkspaceDb]], plus the resourceName and [[SettingsPriority]]. May be either a single value or an array of them */\n props: WorkspaceDbSettingsProps | WorkspaceDbSettingsProps[],\n /** If present, an array that is populated with a list of problems while attempting to load the [[SettingsDictionary]](s). */\n problems?: WorkspaceDbLoadError[]\n ): Promise<void>;\n\n /** Get a single [[WorkspaceDb]]. */\n getWorkspaceDb(props: WorkspaceDbCloudProps): Promise<WorkspaceDb>;\n\n /**\n * Resolve the value of all [[Setting]]s from this workspace with the supplied `settingName` into an array of [[WorkspaceDbCloudProps]]\n * that can be used to query or load workspace resources. The settings must each be an array of type [[WorkspaceDbSettingsProps]].\n * The returned array will be sorted according to their [[SettingsPriority]], with the first entry being the highest priority [[WorkspaceDb]].\n * @note The list is built by combining, in order, all of the settings with the supplied [[SettingName]]. It may therefore include the\n * properties of same WorkspaceDb multiple times. This list is automatically de-duped by [[getWorkspaceDb]].\n * @note This function is rarely used directly. Usually it is called by [[getWorkspaceDbs]]. However, this function is synchronous and may sometimes\n * be useful for editors, tests, or diagnostics.\n */\n resolveWorkspaceDbSetting(\n /** the name of the setting. */\n settingName: SettingName,\n /** optional filter to choose specific WorkspaceDbs from the settings values. If present, only those WorkspaceDbs for which the filter returns `true` will be included. */\n filter?: Workspace.DbListFilter): WorkspaceDbCloudProps[];\n\n /**\n * Get a sorted array of [[WorkspaceDb]]s that can be used to query or load resources. If the arguments supply a `settingName`, this function will\n * use [[resolveWorkspaceDbSetting]] to get get the array of [[WorkspaceDbCloudProps]].\n * @returns A `Promise` resolving to an array of [[WorkspaceDb]]s sorted by [[SettingsPriority]] so that resources found in WorkspaceDbs earlier in the list take precedence\n * over ones with the same name in later WorkspaceDbs. No WorkspaceDb will appear more than once in the list.\n * @note this function may request an [AccessToken]($bentley) for each WorkspaceDb if necessary, and hence is asynchronous.\n */\n getWorkspaceDbs(\n args: Workspace.DbListOrSettingName & {\n /** if supplied, this array is populated with a list of problems (e.g. no read permission) attempting to load WorkspacesDbs. */\n problems?: WorkspaceDbLoadError[];\n /** only valid when called with a settingName, if so passed as `filter` argument to [[resolveWorkspaceDbSetting]] */\n filter?: Workspace.DbListFilter;\n }): Promise<WorkspaceDb[]>;\n}\n\n/**\n * A WorkspaceContainer is a type of [[CloudSqlite.CloudContainer]] that holds one or more [[WorkspaceDb]]s. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.\n * Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that\n * older versions of the WorkspaceDb may continue to be used, for example by archived projects. For programmers familiar with [NPM](https://www.npmjs.com/), this is conceptually\n * similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).\n * @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.\n * That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.\n * @note Not every WorkspaceContainer is associated with a [[CloudSqlite.CloudContainer]] - WorkspaceContainers may also be loaded from the local file system.\n * In this case, [[cloudContainer]] will be `undefined`.\n * @see [[Workspace.getContainer]] and [[Workspace.getContainerAsync]] to load a container.\n * @beta\n */\nexport interface WorkspaceContainer {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** the local directory where this WorkspaceContainer will store temporary files extracted for file-resources.\n * @internal\n */\n readonly filesDir: LocalDirName;\n /** The workspace into which this container was loaded. */\n readonly workspace: Workspace;\n /** Cloud container for this WorkspaceContainer, or `undefined` if this is a local WorkspaceContainer. */\n readonly cloudContainer?: CloudSqlite.CloudContainer;\n /** Properties supplied when this container was loaded */\n readonly fromProps: WorkspaceContainerProps;\n\n /** @internal */\n addWorkspaceDb(toAdd: WorkspaceDb): void;\n\n /**\n * Find the fully-qualified name of a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`.\n * @throws Error if no version satisfying the criteria exists.\n */\n resolveDbFileName(props: WorkspaceDbProps): WorkspaceDbFullName;\n\n /** Obtain a [[WorkspaceDb]] satisfying the name and version criteria specified by `props`. */\n getWorkspaceDb(props?: WorkspaceDbProps): WorkspaceDb;\n\n /** Close and remove a currently opened [[WorkspaceDb]] from this Workspace.\n * @internal\n */\n closeWorkspaceDb(container: WorkspaceDb): void;\n}\n\nfunction makeSettingName(name: string) {\n return `${\"itwin/core/workspace\"}/${name}`;\n}\n\n/** The names of various [[Setting]]s with special meaning to the [[Workspace]] system.\n * @beta\n */\nexport namespace WorkspaceSettingNames {\n /** The name of a setting that, when present in a [[WorkspaceDb]] loaded by [[Workspace.loadSettingsDictionary]], will automatically\n * be used to find and load additional [[SettingsDictionary]]'s in other [[WorkspaceDb]]s. This permits you to chain the settings inside on [[WorkspaceDb]]\n * to others upon which they depend.\n * This setting's value is an array of [[WorkspaceDbSettingsProps]]s.\n */\n export const settingsWorkspaces = makeSettingName(\"settingsWorkspaces\");\n}\n\n/** A function supplied as part of a [[QueryWorkspaceResourcesArgs]] to iterate the resources retrieved by [[Workspace.queryResources]].\n * The `resources` object should only be used inside the function - it is an error to attempt to iterate it after the function returns.\n * @beta\n */\nexport type QueryWorkspaceResourcesCallback = (resources: Iterable<{ name: string, db: WorkspaceDb }>) => void;\n\n/** Arguments supplied to [[Workspace.queryResources]] defining the query criteria and the list of [[WorkspaceDb]]s to query.\n * @beta\n */\nexport interface QueryWorkspaceResourcesArgs {\n /** The list of `WorkspaceDb`s to query, in the order in which they are to be queried.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The type of resource to query. */\n type?: \"string\" | \"blob\";\n /** A pattern against which to compare the name of each resource, using [[nameCompare]] as the comparison operator.\n * Only resources whose names match the pattern will be included in the query results.\n */\n namePattern?: string;\n /** The comparison operator by which to compare the name of each resource to [[namePattern]].\n * Only resources whose names match the pattern will be included in the query results.\n * Ignored i [[namePattern]] is undefined.\n */\n nameCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** A function invoked to process the resources that match the query criteria. */\n callback: QueryWorkspaceResourcesCallback;\n}\n\nfunction getWorkspaceResource(dbs: WorkspaceDb[], name: string, type: \"string\" | \"blob\"): string | Uint8Array | undefined {\n for (const db of dbs) {\n const val = type === \"blob\" ? db.getBlob(name) : db.getString(name);\n if (undefined !== val) {\n return val;\n }\n }\n\n return undefined;\n}\n\n/** Arguments supplied to [[Workspace.getStringResource]] and [[WOrkspace.getBlobResource]].\n * @beta\n */\nexport interface GetWorkspaceResourceArgs {\n /** The list of `WorkspaceDb`s to search, in the order in which they are to be searched.\n * @see [[Workspace.resolveWorkspaceDbSetting]] or [[Workspace.getWorkspaceDbs]] to obtain an appropriate list of `WorkspaceDb`s.\n */\n dbs: WorkspaceDb[];\n /** The name of the resource to find. */\n name: WorkspaceResourceName;\n}\n\n/** @beta */\nexport namespace Workspace {\n /** A function invoked to handle exceptions produced while loading workspace data.\n * Applications can override this function to notify the user and/or attempt to diagnose the problem.\n * The default implementation simply logs each exception.\n */\n export let exceptionDiagnosticFn = (e: WorkspaceDbLoadErrors) => { // eslint-disable-line prefer-const\n if (e instanceof Error)\n Logger.logException(BackendLoggerCategory.Workspace, e);\n else\n UnexpectedErrors.handle(e);\n };\n\n /** Arguments supplied to [[Workspace.onSettingsDictionaryLoadedFn]] for every [[SettingsDictionary]] that is loaded from a [[WorkspaceDb]]. */\n export interface SettingsDictionaryLoaded {\n /** The dictionary that was loaded */\n dict: SettingsDictionary;\n /** The WorkspaceDb from which the dictionary was loaded. */\n from: WorkspaceDb;\n }\n\n /** A function invoked each time any [[SettingsDictionary]] is loaded from a [[WorkspaceDb]].\n * Applications can override this function to notify the user and/or record diagnostics.\n * The default implementation simply records an information message in the [Logger]($bentley).\n */\n export let onSettingsDictionaryLoadedFn = (loaded: SettingsDictionaryLoaded) => { // eslint-disable-line prefer-const\n Logger.logInfo(BackendLoggerCategory.Workspace, `loaded setting dictionary ${loaded.dict.props.name} from ${loaded.from.dbFileName}`);\n };\n\n /** Either an array of [[WorkspaceDbCloudProps]] or the name of a [[Setting]] that resolves to an array of [[WorkspaceDbCloudProps]].\n * Used by [[Workspace.getWorkspaceDbs]].\n */\n export type DbListOrSettingName = { readonly dbs: WorkspaceDbCloudProps[], readonly settingName?: never } | { readonly settingName: SettingName, readonly dbs?: never };\n\n /** In arguments supplied to [[Workspace.getWorkspaceDbs]] and [[Workspace.resolveWorkspaceDbSetting]], an optional function used to exclude some\n * [[WorkspaceDb]]s. Only those [[WorkspaceDb]]s for which the function returns `true` will be included.\n */\n export type DbListFilter = (\n /** The properties of the WorkspaceDb to be returned */\n dbProp: WorkspaceDbCloudProps,\n /** The SettingsDictionary holding the [[WorkspaceSettingNames.settingsWorkspace]] setting. May be used, for example, to determine the\n * [[SettingsPriority]] of the dictionary.\n */\n dict: SettingsDictionary\n ) => boolean;\n\n /** Searches a list of [[WorkspaceDb]]s for a string resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getString]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getStringResource(args: GetWorkspaceResourceArgs): string | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"string\") as string | undefined;\n }\n\n /** Searches a list of [[WorkspaceDb]]s for a blob resource of a given name.\n * The list is searched in order, and the first resource with the request name is returned.\n * If no such resource exists, the function returns `undefined`.\n * @see [[WorkspaceDb.getblob]] if you only need to search a single `WorkspaceDb`.\n * @beta\n */\n export function getBlobResource(args: GetWorkspaceResourceArgs): Uint8Array | undefined {\n return getWorkspaceResource(args.dbs, args.name, \"blob\") as Uint8Array | undefined;\n }\n\n /** Query a list of [[WorkspaceDb]]s to find resources of a particular type with names matching a specified pattern.\n * @see [[WorkspaceDb.queryResources]] if you only need to query a single `WorkspaceDb`.\n * @beta\n */\n export function queryResources(args: QueryWorkspaceResourcesArgs): void {\n const resources: Array<{ name: string, db: WorkspaceDb }> = [];\n for (const db of args.dbs) {\n db.queryResources({\n type: args.type,\n namePattern: args.namePattern,\n nameCompare: args.nameCompare,\n callback: (names) => {\n for (const name of names) {\n resources.push({ db, name });\n }\n },\n });\n }\n\n args.callback(resources);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-backend",
3
- "version": "5.2.0-dev.8",
3
+ "version": "5.3.0-dev.2",
4
4
  "description": "iTwin.js backend components",
5
5
  "main": "lib/cjs/core-backend.js",
6
6
  "module": "lib/esm/core-backend.js",
@@ -27,10 +27,10 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@opentelemetry/api": "^1.0.4",
30
- "@itwin/core-bentley": "5.2.0-dev.8",
31
- "@itwin/core-common": "5.2.0-dev.8",
32
- "@itwin/core-geometry": "5.2.0-dev.8",
33
- "@itwin/ecschema-metadata": "5.2.0-dev.8"
30
+ "@itwin/core-bentley": "5.3.0-dev.2",
31
+ "@itwin/ecschema-metadata": "5.3.0-dev.2",
32
+ "@itwin/core-common": "5.3.0-dev.2",
33
+ "@itwin/core-geometry": "5.3.0-dev.2"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@opentelemetry/api": {
@@ -76,17 +76,17 @@
76
76
  "marked": "^14.1.3",
77
77
  "sql-formatter": "^15.4.6",
78
78
  "webpack": "^5.97.1",
79
- "@itwin/build-tools": "5.2.0-dev.8",
80
- "@itwin/core-bentley": "5.2.0-dev.8",
81
- "@itwin/core-common": "5.2.0-dev.8",
82
- "@itwin/ecschema-locaters": "5.2.0-dev.8",
83
- "@itwin/ecschema-metadata": "5.2.0-dev.8",
84
- "@itwin/ecsql-common": "5.2.0-dev.8",
79
+ "@itwin/core-bentley": "5.3.0-dev.2",
80
+ "@itwin/ecsql-common": "5.3.0-dev.2",
81
+ "@itwin/ecschema-locaters": "5.3.0-dev.2",
82
+ "@itwin/build-tools": "5.3.0-dev.2",
85
83
  "internal-tools": "3.0.0-dev.69",
86
- "@itwin/core-geometry": "5.2.0-dev.8"
84
+ "@itwin/ecschema-metadata": "5.3.0-dev.2",
85
+ "@itwin/core-common": "5.3.0-dev.2",
86
+ "@itwin/core-geometry": "5.3.0-dev.2"
87
87
  },
88
88
  "dependencies": {
89
- "@bentley/imodeljs-native": "5.2.5",
89
+ "@bentley/imodeljs-native": "5.3.1",
90
90
  "@itwin/cloud-agnostic-core": "^2.2.4",
91
91
  "@itwin/object-storage-azure": "^2.3.0",
92
92
  "@itwin/object-storage-core": "^2.3.0",