@itwin/core-backend 3.5.0-dev.19 → 3.5.0-dev.20

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 (243) hide show
  1. package/lib/cjs/AliCloudStorageService.d.ts +23 -23
  2. package/lib/cjs/AliCloudStorageService.js +71 -71
  3. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  4. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  5. package/lib/cjs/BackendHubAccess.js +41 -41
  6. package/lib/cjs/BackendHubAccess.js.map +1 -1
  7. package/lib/cjs/BackendLoggerCategory.d.ts +91 -91
  8. package/lib/cjs/BackendLoggerCategory.js +99 -99
  9. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  11. package/lib/cjs/BisCoreSchema.js +60 -60
  12. package/lib/cjs/BisCoreSchema.js.map +1 -1
  13. package/lib/cjs/BriefcaseManager.d.ts +165 -165
  14. package/lib/cjs/BriefcaseManager.js +405 -405
  15. package/lib/cjs/BriefcaseManager.js.map +1 -1
  16. package/lib/cjs/Category.d.ts +153 -153
  17. package/lib/cjs/Category.js +243 -243
  18. package/lib/cjs/Category.js.map +1 -1
  19. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  20. package/lib/cjs/ChangeSummaryManager.js +445 -445
  21. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  22. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  23. package/lib/cjs/ChangedElementsDb.js +165 -165
  24. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  25. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  26. package/lib/cjs/ChangedElementsManager.js +88 -88
  27. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  28. package/lib/cjs/CheckpointManager.d.ts +120 -120
  29. package/lib/cjs/CheckpointManager.js +343 -343
  30. package/lib/cjs/CheckpointManager.js.map +1 -1
  31. package/lib/cjs/ClassRegistry.d.ts +72 -71
  32. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  33. package/lib/cjs/ClassRegistry.js +243 -215
  34. package/lib/cjs/ClassRegistry.js.map +1 -1
  35. package/lib/cjs/CloudSqlite.d.ts +350 -350
  36. package/lib/cjs/CloudSqlite.js +152 -152
  37. package/lib/cjs/CloudSqlite.js.map +1 -1
  38. package/lib/cjs/CloudStorageBackend.d.ts +58 -58
  39. package/lib/cjs/CloudStorageBackend.js +173 -173
  40. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  41. package/lib/cjs/CodeService.d.ts +396 -396
  42. package/lib/cjs/CodeService.js +63 -63
  43. package/lib/cjs/CodeService.js.map +1 -1
  44. package/lib/cjs/CodeSpecs.d.ts +50 -50
  45. package/lib/cjs/CodeSpecs.js +112 -112
  46. package/lib/cjs/CodeSpecs.js.map +1 -1
  47. package/lib/cjs/ConcurrentQuery.d.ts +11 -11
  48. package/lib/cjs/ConcurrentQuery.js +30 -30
  49. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  50. package/lib/cjs/CustomViewState3dCreator.d.ts +32 -32
  51. package/lib/cjs/CustomViewState3dCreator.js +113 -113
  52. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  53. package/lib/cjs/DevTools.d.ts +71 -71
  54. package/lib/cjs/DevTools.js +154 -154
  55. package/lib/cjs/DevTools.js.map +1 -1
  56. package/lib/cjs/DisplayStyle.d.ts +106 -106
  57. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  58. package/lib/cjs/DisplayStyle.js +256 -256
  59. package/lib/cjs/DisplayStyle.js.map +1 -1
  60. package/lib/cjs/ECDb.d.ts +191 -191
  61. package/lib/cjs/ECDb.js +350 -350
  62. package/lib/cjs/ECDb.js.map +1 -1
  63. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  64. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  65. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  66. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  67. package/lib/cjs/ECSqlStatement.js +791 -791
  68. package/lib/cjs/ECSqlStatement.js.map +1 -1
  69. package/lib/cjs/Element.d.ts +1102 -1109
  70. package/lib/cjs/Element.d.ts.map +1 -1
  71. package/lib/cjs/Element.js +1416 -1420
  72. package/lib/cjs/Element.js.map +1 -1
  73. package/lib/cjs/ElementAspect.d.ts +158 -156
  74. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  75. package/lib/cjs/ElementAspect.js +186 -178
  76. package/lib/cjs/ElementAspect.js.map +1 -1
  77. package/lib/cjs/ElementGraphics.d.ts +9 -9
  78. package/lib/cjs/ElementGraphics.js +41 -41
  79. package/lib/cjs/ElementGraphics.js.map +1 -1
  80. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  81. package/lib/cjs/ElementTreeWalker.js +409 -409
  82. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  83. package/lib/cjs/Entity.d.ts +106 -76
  84. package/lib/cjs/Entity.d.ts.map +1 -1
  85. package/lib/cjs/Entity.js +134 -82
  86. package/lib/cjs/Entity.js.map +1 -1
  87. package/lib/cjs/EntityReferences.d.ts +50 -0
  88. package/lib/cjs/EntityReferences.d.ts.map +1 -0
  89. package/lib/cjs/EntityReferences.js +96 -0
  90. package/lib/cjs/EntityReferences.js.map +1 -0
  91. package/lib/cjs/ExportGraphics.d.ts +317 -317
  92. package/lib/cjs/ExportGraphics.js +208 -208
  93. package/lib/cjs/ExportGraphics.js.map +1 -1
  94. package/lib/cjs/ExternalSource.d.ts +96 -94
  95. package/lib/cjs/ExternalSource.d.ts.map +1 -1
  96. package/lib/cjs/ExternalSource.js +131 -125
  97. package/lib/cjs/ExternalSource.js.map +1 -1
  98. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  99. package/lib/cjs/GeoCoordConfig.js +82 -82
  100. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  101. package/lib/cjs/GeometrySummary.d.ts +4 -4
  102. package/lib/cjs/GeometrySummary.js +380 -380
  103. package/lib/cjs/GeometrySummary.js.map +1 -1
  104. package/lib/cjs/HubMock.d.ts +93 -93
  105. package/lib/cjs/HubMock.js +190 -190
  106. package/lib/cjs/HubMock.js.map +1 -1
  107. package/lib/cjs/IModelCloneContext.d.ts +8 -85
  108. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  109. package/lib/cjs/IModelCloneContext.js +15 -150
  110. package/lib/cjs/IModelCloneContext.js.map +1 -1
  111. package/lib/cjs/IModelDb.d.ts +1167 -1164
  112. package/lib/cjs/IModelDb.d.ts.map +1 -1
  113. package/lib/cjs/IModelDb.js +2332 -2329
  114. package/lib/cjs/IModelDb.js.map +1 -1
  115. package/lib/cjs/IModelElementCloneContext.d.ts +90 -0
  116. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -0
  117. package/lib/cjs/IModelElementCloneContext.js +160 -0
  118. package/lib/cjs/IModelElementCloneContext.js.map +1 -0
  119. package/lib/cjs/IModelHost.d.ts +369 -361
  120. package/lib/cjs/IModelHost.d.ts.map +1 -1
  121. package/lib/cjs/IModelHost.js +492 -489
  122. package/lib/cjs/IModelHost.js.map +1 -1
  123. package/lib/cjs/IModelJsFs.d.ts +62 -62
  124. package/lib/cjs/IModelJsFs.js +140 -140
  125. package/lib/cjs/IModelJsFs.js.map +1 -1
  126. package/lib/cjs/IpcHost.d.ts +98 -98
  127. package/lib/cjs/IpcHost.js +234 -234
  128. package/lib/cjs/IpcHost.js.map +1 -1
  129. package/lib/cjs/LineStyle.d.ts +311 -311
  130. package/lib/cjs/LineStyle.js +295 -295
  131. package/lib/cjs/LineStyle.js.map +1 -1
  132. package/lib/cjs/LocalHub.d.ts +162 -162
  133. package/lib/cjs/LocalHub.js +587 -587
  134. package/lib/cjs/LocalHub.js.map +1 -1
  135. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  136. package/lib/cjs/LocalhostIpcHost.js +81 -81
  137. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  138. package/lib/cjs/Material.d.ts +103 -103
  139. package/lib/cjs/Material.js +147 -147
  140. package/lib/cjs/Material.js.map +1 -1
  141. package/lib/cjs/Model.d.ts +388 -386
  142. package/lib/cjs/Model.d.ts.map +1 -1
  143. package/lib/cjs/Model.js +479 -471
  144. package/lib/cjs/Model.js.map +1 -1
  145. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  146. package/lib/cjs/NativeAppStorage.js +202 -202
  147. package/lib/cjs/NativeAppStorage.js.map +1 -1
  148. package/lib/cjs/NativeHost.d.ts +52 -52
  149. package/lib/cjs/NativeHost.js +168 -168
  150. package/lib/cjs/NativeHost.js.map +1 -1
  151. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  152. package/lib/cjs/NavigationRelationship.js +225 -225
  153. package/lib/cjs/NavigationRelationship.js.map +1 -1
  154. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  155. package/lib/cjs/PromiseMemoizer.js +101 -101
  156. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  157. package/lib/cjs/PropertyStore.d.ts +132 -132
  158. package/lib/cjs/PropertyStore.js +11 -11
  159. package/lib/cjs/PropertyStore.js.map +1 -1
  160. package/lib/cjs/Relationship.d.ts +416 -400
  161. package/lib/cjs/Relationship.d.ts.map +1 -1
  162. package/lib/cjs/Relationship.js +494 -465
  163. package/lib/cjs/Relationship.js.map +1 -1
  164. package/lib/cjs/RpcBackend.d.ts +28 -28
  165. package/lib/cjs/RpcBackend.js +126 -126
  166. package/lib/cjs/RpcBackend.js.map +1 -1
  167. package/lib/cjs/SQLiteDb.d.ts +219 -219
  168. package/lib/cjs/SQLiteDb.js +214 -214
  169. package/lib/cjs/SQLiteDb.js.map +1 -1
  170. package/lib/cjs/Schema.d.ts +55 -55
  171. package/lib/cjs/Schema.js +83 -83
  172. package/lib/cjs/Schema.js.map +1 -1
  173. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  174. package/lib/cjs/ServerBasedLocks.js +168 -168
  175. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  176. package/lib/cjs/SqliteStatement.d.ts +360 -360
  177. package/lib/cjs/SqliteStatement.js +586 -586
  178. package/lib/cjs/SqliteStatement.js.map +1 -1
  179. package/lib/cjs/Texture.d.ts +58 -58
  180. package/lib/cjs/Texture.js +82 -82
  181. package/lib/cjs/Texture.js.map +1 -1
  182. package/lib/cjs/TileStorage.d.ts +18 -18
  183. package/lib/cjs/TileStorage.js +90 -90
  184. package/lib/cjs/TileStorage.js.map +1 -1
  185. package/lib/cjs/TxnManager.d.ts +202 -202
  186. package/lib/cjs/TxnManager.js +356 -356
  187. package/lib/cjs/TxnManager.js.map +1 -1
  188. package/lib/cjs/ViewDefinition.d.ts +439 -435
  189. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  190. package/lib/cjs/ViewDefinition.js +646 -635
  191. package/lib/cjs/ViewDefinition.js.map +1 -1
  192. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  193. package/lib/cjs/ViewStateHydrator.js +103 -103
  194. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  195. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  196. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  197. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  198. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  199. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  200. package/lib/cjs/core-backend.d.ts +184 -182
  201. package/lib/cjs/core-backend.d.ts.map +1 -1
  202. package/lib/cjs/core-backend.js +204 -202
  203. package/lib/cjs/core-backend.js.map +1 -1
  204. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  205. package/lib/cjs/domains/FunctionalElements.js +145 -145
  206. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  207. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  208. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  209. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  210. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  211. package/lib/cjs/domains/GenericElements.js +263 -263
  212. package/lib/cjs/domains/GenericElements.js.map +1 -1
  213. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  214. package/lib/cjs/domains/GenericSchema.js +28 -28
  215. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  216. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  217. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  218. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  219. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +45 -45
  220. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +262 -262
  221. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  222. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  223. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +204 -204
  224. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  225. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  226. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  227. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  228. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  229. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  230. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  231. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  232. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  233. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  234. package/lib/cjs/workspace/Settings.d.ts +186 -186
  235. package/lib/cjs/workspace/Settings.js +155 -155
  236. package/lib/cjs/workspace/Settings.js.map +1 -1
  237. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  238. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  239. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  240. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  241. package/lib/cjs/workspace/Workspace.js +543 -543
  242. package/lib/cjs/workspace/Workspace.js.map +1 -1
  243. package/package.json +14 -13
@@ -1,191 +1,191 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.HubMock = void 0;
8
- const path_1 = require("path");
9
- const core_bentley_1 = require("@itwin/core-bentley");
10
- const IModelHost_1 = require("./IModelHost");
11
- const IModelJsFs_1 = require("./IModelJsFs");
12
- const LocalHub_1 = require("./LocalHub");
13
- function wasStarted(val) {
14
- if (undefined === val)
15
- throw new Error("Call HubMock.startup first");
16
- }
17
- /**
18
- * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.
19
- *
20
- * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:
21
- * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs
22
- * - waste network and data center resources (i.e. $$$s),
23
- * - interfere with other tests running on the same or other systems, and
24
- * - (far worse) are the source of test flakiness outside of the api being tested.
25
- *
26
- * This class can be used to create tests that do not require authentication, are synchronous,
27
- * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside
28
- * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.
29
- *
30
- * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests
31
- * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to
32
- * low level testing of the core apis only.
33
- *
34
- * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be
35
- * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean
36
- * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the
37
- * test against a "real" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your
38
- * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)
39
- *
40
- * Mocked tests must always start by creating a new iModel via [[IModelHost.hubAccess.createNewIModel]] with a `version0` iModel.
41
- * They use mock (aka "bogus") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current
42
- * computer.
43
- *
44
- * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests
45
- * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.
46
- *
47
- * @internal
48
- */
49
- class HubMock {
50
- /** Determine whether a test us currently being run under HubMock */
51
- static get isValid() { return undefined !== this.mockRoot; }
52
- static get iTwinId() {
53
- wasStarted(this._iTwinId);
54
- return this._iTwinId;
55
- }
56
- /**
57
- * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].
58
- * @param mockName a unique name (e.g. "MyTest") for this HubMock to disambiguate tests when more than one is simultaneously active.
59
- * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.
60
- */
61
- static startup(mockName, outputDir) {
62
- if (this.isValid)
63
- throw new Error("Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed");
64
- this.hubs.clear();
65
- this.mockRoot = (0, path_1.join)(outputDir, "HubMock", mockName);
66
- IModelJsFs_1.IModelJsFs.recursiveMkDirSync(this.mockRoot);
67
- IModelJsFs_1.IModelJsFs.purgeDirSync(this.mockRoot);
68
- this._saveHubAccess = IModelHost_1.IModelHost.getHubAccess();
69
- IModelHost_1.IModelHost.setHubAccess(this);
70
- HubMock._iTwinId = core_bentley_1.Guid.createValue(); // all iModels for this test get the same "iTwinId"
71
- }
72
- /** Stop a HubMock that was previously started with [[startup]]
73
- * @note this function throws an exception if any of the iModels used during the tests are left open.
74
- */
75
- static shutdown() {
76
- if (this.mockRoot === undefined)
77
- return;
78
- HubMock._iTwinId = undefined;
79
- for (const hub of this.hubs)
80
- hub[1].cleanup();
81
- this.hubs.clear();
82
- IModelJsFs_1.IModelJsFs.purgeDirSync(this.mockRoot);
83
- IModelJsFs_1.IModelJsFs.removeSync(this.mockRoot);
84
- IModelHost_1.IModelHost.setHubAccess(this._saveHubAccess);
85
- this.mockRoot = undefined;
86
- }
87
- static findLocalHub(iModelId) {
88
- const hub = this.hubs.get(iModelId);
89
- if (!hub)
90
- throw new Error(`local hub for iModel ${iModelId} not created`);
91
- return hub;
92
- }
93
- /** create a [[LocalHub]] for an iModel. */
94
- static async createNewIModel(arg) {
95
- wasStarted(this.mockRoot);
96
- const props = { ...arg, iModelId: core_bentley_1.Guid.createValue() };
97
- const mock = new LocalHub_1.LocalHub((0, path_1.join)(this.mockRoot, props.iModelId), props);
98
- this.hubs.set(props.iModelId, mock);
99
- return props.iModelId;
100
- }
101
- /** remove the [[LocalHub]] for an iModel */
102
- static destroy(iModelId) {
103
- this.findLocalHub(iModelId).cleanup();
104
- this.hubs.delete(iModelId);
105
- }
106
- /** All methods below are mocks of the [[BackendHubAccess]] interface */
107
- static async getChangesetFromNamedVersion(arg) {
108
- return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);
109
- }
110
- static changesetIndexFromArg(arg) {
111
- return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);
112
- }
113
- static async getChangesetFromVersion(arg) {
114
- const hub = this.findLocalHub(arg.iModelId);
115
- const version = arg.version;
116
- if (version.isFirst)
117
- return hub.getChangesetByIndex(0);
118
- const asOf = version.getAsOfChangeSet();
119
- if (asOf)
120
- return hub.getChangesetById(asOf);
121
- const versionName = version.getName();
122
- if (versionName)
123
- return hub.findNamedVersion(versionName);
124
- return hub.getLatestChangeset();
125
- }
126
- static async getLatestChangeset(arg) {
127
- return this.findLocalHub(arg.iModelId).getLatestChangeset();
128
- }
129
- static async getAccessToken(arg) {
130
- var _a;
131
- return (_a = arg.accessToken) !== null && _a !== void 0 ? _a : await IModelHost_1.IModelHost.getAccessToken();
132
- }
133
- static async getMyBriefcaseIds(arg) {
134
- const accessToken = await this.getAccessToken(arg);
135
- return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);
136
- }
137
- static async acquireNewBriefcaseId(arg) {
138
- const accessToken = await this.getAccessToken(arg);
139
- return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);
140
- }
141
- /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */
142
- static async releaseBriefcase(arg) {
143
- return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);
144
- }
145
- static async downloadChangeset(arg) {
146
- return this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });
147
- }
148
- static async downloadChangesets(arg) {
149
- return this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });
150
- }
151
- static async queryChangeset(arg) {
152
- return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));
153
- }
154
- static async queryChangesets(arg) {
155
- return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);
156
- }
157
- static async pushChangeset(arg) {
158
- return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);
159
- }
160
- static async queryV2Checkpoint(_arg) {
161
- return undefined;
162
- }
163
- // eslint-disable-next-line deprecation/deprecation
164
- static async downloadV1Checkpoint(arg) {
165
- return this.findLocalHub(arg.checkpoint.iModelId).downloadCheckpoint({ changeset: arg.checkpoint.changeset, targetFile: arg.localFile });
166
- }
167
- static async releaseAllLocks(arg) {
168
- const hub = this.findLocalHub(arg.iModelId);
169
- hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });
170
- }
171
- static async queryAllLocks(_arg) {
172
- return [];
173
- }
174
- static async acquireLocks(arg, locks) {
175
- this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);
176
- }
177
- static async queryIModelByName(arg) {
178
- for (const hub of this.hubs) {
179
- const localHub = hub[1];
180
- if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)
181
- return localHub.iModelId;
182
- }
183
- return undefined;
184
- }
185
- static async deleteIModel(arg) {
186
- return this.destroy(arg.iModelId);
187
- }
188
- }
189
- exports.HubMock = HubMock;
190
- HubMock.hubs = new Map();
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.HubMock = void 0;
8
+ const path_1 = require("path");
9
+ const core_bentley_1 = require("@itwin/core-bentley");
10
+ const IModelHost_1 = require("./IModelHost");
11
+ const IModelJsFs_1 = require("./IModelJsFs");
12
+ const LocalHub_1 = require("./LocalHub");
13
+ function wasStarted(val) {
14
+ if (undefined === val)
15
+ throw new Error("Call HubMock.startup first");
16
+ }
17
+ /**
18
+ * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.
19
+ *
20
+ * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:
21
+ * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs
22
+ * - waste network and data center resources (i.e. $$$s),
23
+ * - interfere with other tests running on the same or other systems, and
24
+ * - (far worse) are the source of test flakiness outside of the api being tested.
25
+ *
26
+ * This class can be used to create tests that do not require authentication, are synchronous,
27
+ * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside
28
+ * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.
29
+ *
30
+ * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests
31
+ * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to
32
+ * low level testing of the core apis only.
33
+ *
34
+ * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be
35
+ * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean
36
+ * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the
37
+ * test against a "real" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your
38
+ * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)
39
+ *
40
+ * Mocked tests must always start by creating a new iModel via [[IModelHost.hubAccess.createNewIModel]] with a `version0` iModel.
41
+ * They use mock (aka "bogus") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current
42
+ * computer.
43
+ *
44
+ * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests
45
+ * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.
46
+ *
47
+ * @internal
48
+ */
49
+ class HubMock {
50
+ /** Determine whether a test us currently being run under HubMock */
51
+ static get isValid() { return undefined !== this.mockRoot; }
52
+ static get iTwinId() {
53
+ wasStarted(this._iTwinId);
54
+ return this._iTwinId;
55
+ }
56
+ /**
57
+ * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].
58
+ * @param mockName a unique name (e.g. "MyTest") for this HubMock to disambiguate tests when more than one is simultaneously active.
59
+ * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.
60
+ */
61
+ static startup(mockName, outputDir) {
62
+ if (this.isValid)
63
+ throw new Error("Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed");
64
+ this.hubs.clear();
65
+ this.mockRoot = (0, path_1.join)(outputDir, "HubMock", mockName);
66
+ IModelJsFs_1.IModelJsFs.recursiveMkDirSync(this.mockRoot);
67
+ IModelJsFs_1.IModelJsFs.purgeDirSync(this.mockRoot);
68
+ this._saveHubAccess = IModelHost_1.IModelHost.getHubAccess();
69
+ IModelHost_1.IModelHost.setHubAccess(this);
70
+ HubMock._iTwinId = core_bentley_1.Guid.createValue(); // all iModels for this test get the same "iTwinId"
71
+ }
72
+ /** Stop a HubMock that was previously started with [[startup]]
73
+ * @note this function throws an exception if any of the iModels used during the tests are left open.
74
+ */
75
+ static shutdown() {
76
+ if (this.mockRoot === undefined)
77
+ return;
78
+ HubMock._iTwinId = undefined;
79
+ for (const hub of this.hubs)
80
+ hub[1].cleanup();
81
+ this.hubs.clear();
82
+ IModelJsFs_1.IModelJsFs.purgeDirSync(this.mockRoot);
83
+ IModelJsFs_1.IModelJsFs.removeSync(this.mockRoot);
84
+ IModelHost_1.IModelHost.setHubAccess(this._saveHubAccess);
85
+ this.mockRoot = undefined;
86
+ }
87
+ static findLocalHub(iModelId) {
88
+ const hub = this.hubs.get(iModelId);
89
+ if (!hub)
90
+ throw new Error(`local hub for iModel ${iModelId} not created`);
91
+ return hub;
92
+ }
93
+ /** create a [[LocalHub]] for an iModel. */
94
+ static async createNewIModel(arg) {
95
+ wasStarted(this.mockRoot);
96
+ const props = { ...arg, iModelId: core_bentley_1.Guid.createValue() };
97
+ const mock = new LocalHub_1.LocalHub((0, path_1.join)(this.mockRoot, props.iModelId), props);
98
+ this.hubs.set(props.iModelId, mock);
99
+ return props.iModelId;
100
+ }
101
+ /** remove the [[LocalHub]] for an iModel */
102
+ static destroy(iModelId) {
103
+ this.findLocalHub(iModelId).cleanup();
104
+ this.hubs.delete(iModelId);
105
+ }
106
+ /** All methods below are mocks of the [[BackendHubAccess]] interface */
107
+ static async getChangesetFromNamedVersion(arg) {
108
+ return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);
109
+ }
110
+ static changesetIndexFromArg(arg) {
111
+ return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);
112
+ }
113
+ static async getChangesetFromVersion(arg) {
114
+ const hub = this.findLocalHub(arg.iModelId);
115
+ const version = arg.version;
116
+ if (version.isFirst)
117
+ return hub.getChangesetByIndex(0);
118
+ const asOf = version.getAsOfChangeSet();
119
+ if (asOf)
120
+ return hub.getChangesetById(asOf);
121
+ const versionName = version.getName();
122
+ if (versionName)
123
+ return hub.findNamedVersion(versionName);
124
+ return hub.getLatestChangeset();
125
+ }
126
+ static async getLatestChangeset(arg) {
127
+ return this.findLocalHub(arg.iModelId).getLatestChangeset();
128
+ }
129
+ static async getAccessToken(arg) {
130
+ var _a;
131
+ return (_a = arg.accessToken) !== null && _a !== void 0 ? _a : await IModelHost_1.IModelHost.getAccessToken();
132
+ }
133
+ static async getMyBriefcaseIds(arg) {
134
+ const accessToken = await this.getAccessToken(arg);
135
+ return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);
136
+ }
137
+ static async acquireNewBriefcaseId(arg) {
138
+ const accessToken = await this.getAccessToken(arg);
139
+ return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);
140
+ }
141
+ /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */
142
+ static async releaseBriefcase(arg) {
143
+ return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);
144
+ }
145
+ static async downloadChangeset(arg) {
146
+ return this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });
147
+ }
148
+ static async downloadChangesets(arg) {
149
+ return this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });
150
+ }
151
+ static async queryChangeset(arg) {
152
+ return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));
153
+ }
154
+ static async queryChangesets(arg) {
155
+ return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);
156
+ }
157
+ static async pushChangeset(arg) {
158
+ return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);
159
+ }
160
+ static async queryV2Checkpoint(_arg) {
161
+ return undefined;
162
+ }
163
+ // eslint-disable-next-line deprecation/deprecation
164
+ static async downloadV1Checkpoint(arg) {
165
+ return this.findLocalHub(arg.checkpoint.iModelId).downloadCheckpoint({ changeset: arg.checkpoint.changeset, targetFile: arg.localFile });
166
+ }
167
+ static async releaseAllLocks(arg) {
168
+ const hub = this.findLocalHub(arg.iModelId);
169
+ hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });
170
+ }
171
+ static async queryAllLocks(_arg) {
172
+ return [];
173
+ }
174
+ static async acquireLocks(arg, locks) {
175
+ this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);
176
+ }
177
+ static async queryIModelByName(arg) {
178
+ for (const hub of this.hubs) {
179
+ const localHub = hub[1];
180
+ if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)
181
+ return localHub.iModelId;
182
+ }
183
+ return undefined;
184
+ }
185
+ static async deleteIModel(arg) {
186
+ return this.destroy(arg.iModelId);
187
+ }
188
+ }
189
+ exports.HubMock = HubMock;
190
+ HubMock.hubs = new Map();
191
191
  //# sourceMappingURL=HubMock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HubMock.js","sourceRoot":"","sources":["../../src/HubMock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA4B;AAC5B,sDAAuD;AAUvD,6CAA0C;AAC1C,6CAA0C;AAC1C,yCAAsC;AAGtC,SAAS,UAAU,CAAC,GAAuB;IACzC,IAAI,SAAS,KAAK,GAAG;QACnB,MAAM,IAAI,KAAK,CAAC,4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CAAC,aAAa,CAAC,IAAoB;QACpD,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAAmB,EAAE,KAAc;QAClE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAkB;QACtD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE;YAC3B,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,QAAQ,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO,IAAI,QAAQ,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;gBAC5E,OAAO,QAAQ,CAAC,QAAQ,CAAC;SAC5B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAA0C;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;;AA/KH,0BAgLC;AA9KgB,YAAI,GAAG,IAAI,GAAG,EAAoB,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 { join } from \"path\";\nimport { Guid, GuidString } from \"@itwin/core-bentley\";\nimport {\n ChangesetFileProps, ChangesetIndex, ChangesetIndexAndId, ChangesetProps, ChangesetRange, IModelVersion, LocalDirName,\n} from \"@itwin/core-common\";\nimport {\n AcquireNewBriefcaseIdArg,\n BackendHubAccess, BriefcaseDbArg, BriefcaseIdArg, ChangesetArg, CheckpointArg, CreateNewIModelProps, DownloadChangesetArg, DownloadChangesetRangeArg, IModelIdArg, IModelNameArg,\n LockMap, LockProps, V2CheckpointAccessProps,\n} from \"./BackendHubAccess\";\nimport { CheckpointProps } from \"./CheckpointManager\";\nimport { IModelHost } from \"./IModelHost\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { LocalHub } from \"./LocalHub\";\nimport { TokenArg } from \"./IModelDb\";\n\nfunction wasStarted(val: string | undefined): asserts val is string {\n if (undefined === val)\n throw new Error(\"Call HubMock.startup first\");\n}\n\n/**\n * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.\n *\n * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:\n * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs\n * - waste network and data center resources (i.e. $$$s),\n * - interfere with other tests running on the same or other systems, and\n * - (far worse) are the source of test flakiness outside of the api being tested.\n *\n * This class can be used to create tests that do not require authentication, are synchronous,\n * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside\n * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.\n *\n * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests\n * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to\n * low level testing of the core apis only.\n *\n * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be\n * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean\n * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the\n * test against a \"real\" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your\n * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)\n *\n * Mocked tests must always start by creating a new iModel via [[IModelHost.hubAccess.createNewIModel]] with a `version0` iModel.\n * They use mock (aka \"bogus\") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current\n * computer.\n *\n * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests\n * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.\n *\n * @internal\n */\nexport class HubMock {\n private static mockRoot: LocalDirName | undefined;\n private static hubs = new Map<string, LocalHub>();\n private static _saveHubAccess: BackendHubAccess | undefined;\n private static _iTwinId: GuidString | undefined;\n\n /** Determine whether a test us currently being run under HubMock */\n public static get isValid() { return undefined !== this.mockRoot; }\n public static get iTwinId() {\n wasStarted(this._iTwinId);\n return this._iTwinId;\n }\n\n /**\n * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].\n * @param mockName a unique name (e.g. \"MyTest\") for this HubMock to disambiguate tests when more than one is simultaneously active.\n * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.\n */\n public static startup(mockName: LocalDirName, outputDir: string) {\n if (this.isValid)\n throw new Error(\"Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed\");\n\n this.hubs.clear();\n this.mockRoot = join(outputDir, \"HubMock\", mockName);\n IModelJsFs.recursiveMkDirSync(this.mockRoot);\n IModelJsFs.purgeDirSync(this.mockRoot);\n this._saveHubAccess = IModelHost.getHubAccess();\n\n IModelHost.setHubAccess(this);\n HubMock._iTwinId = Guid.createValue(); // all iModels for this test get the same \"iTwinId\"\n }\n\n /** Stop a HubMock that was previously started with [[startup]]\n * @note this function throws an exception if any of the iModels used during the tests are left open.\n */\n public static shutdown() {\n if (this.mockRoot === undefined)\n return;\n\n HubMock._iTwinId = undefined;\n for (const hub of this.hubs)\n hub[1].cleanup();\n\n this.hubs.clear();\n IModelJsFs.purgeDirSync(this.mockRoot);\n IModelJsFs.removeSync(this.mockRoot);\n IModelHost.setHubAccess(this._saveHubAccess);\n this.mockRoot = undefined;\n }\n\n public static findLocalHub(iModelId: GuidString): LocalHub {\n const hub = this.hubs.get(iModelId);\n if (!hub)\n throw new Error(`local hub for iModel ${iModelId} not created`);\n return hub;\n }\n\n /** create a [[LocalHub]] for an iModel. */\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\n wasStarted(this.mockRoot);\n const props = { ...arg, iModelId: Guid.createValue() };\n const mock = new LocalHub(join(this.mockRoot, props.iModelId), props);\n this.hubs.set(props.iModelId, mock);\n return props.iModelId;\n }\n\n /** remove the [[LocalHub]] for an iModel */\n public static destroy(iModelId: GuidString) {\n this.findLocalHub(iModelId).cleanup();\n this.hubs.delete(iModelId);\n }\n\n /** All methods below are mocks of the [[BackendHubAccess]] interface */\n\n public static async getChangesetFromNamedVersion(arg: IModelIdArg & { versionName: string }): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);\n }\n\n private static changesetIndexFromArg(arg: ChangesetArg) {\n return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);\n }\n\n public static async getChangesetFromVersion(arg: IModelIdArg & { version: IModelVersion }): Promise<ChangesetProps> {\n const hub = this.findLocalHub(arg.iModelId);\n const version = arg.version;\n if (version.isFirst)\n return hub.getChangesetByIndex(0);\n\n const asOf = version.getAsOfChangeSet();\n if (asOf)\n return hub.getChangesetById(asOf);\n\n const versionName = version.getName();\n if (versionName)\n return hub.findNamedVersion(versionName);\n\n return hub.getLatestChangeset();\n }\n\n public static async getLatestChangeset(arg: IModelIdArg): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).getLatestChangeset();\n }\n\n private static async getAccessToken(arg: TokenArg) {\n return arg.accessToken ?? await IModelHost.getAccessToken();\n }\n\n public static async getMyBriefcaseIds(arg: IModelIdArg): Promise<number[]> {\n const accessToken = await this.getAccessToken(arg);\n return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);\n }\n\n public static async acquireNewBriefcaseId(arg: AcquireNewBriefcaseIdArg): Promise<number> {\n const accessToken = await this.getAccessToken(arg);\n return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);\n }\n\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\n public static async releaseBriefcase(arg: BriefcaseIdArg): Promise<void> {\n return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);\n }\n\n public static async downloadChangeset(arg: DownloadChangesetArg): Promise<ChangesetFileProps> {\n return this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });\n }\n\n public static async downloadChangesets(arg: DownloadChangesetRangeArg): Promise<ChangesetFileProps[]> {\n return this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });\n }\n\n public static async queryChangeset(arg: ChangesetArg): Promise<ChangesetProps> {\n return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));\n }\n\n public static async queryChangesets(arg: IModelIdArg & { range?: ChangesetRange }): Promise<ChangesetProps[]> {\n return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);\n }\n\n public static async pushChangeset(arg: IModelIdArg & { changesetProps: ChangesetFileProps }): Promise<ChangesetIndex> {\n return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);\n }\n\n public static async queryV2Checkpoint(_arg: CheckpointProps): Promise<V2CheckpointAccessProps | undefined> {\n return undefined;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n public static async downloadV1Checkpoint(arg: CheckpointArg): Promise<ChangesetIndexAndId> {\n return this.findLocalHub(arg.checkpoint.iModelId).downloadCheckpoint({ changeset: arg.checkpoint.changeset, targetFile: arg.localFile });\n }\n\n public static async releaseAllLocks(arg: BriefcaseDbArg) {\n const hub = this.findLocalHub(arg.iModelId);\n hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });\n }\n\n public static async queryAllLocks(_arg: BriefcaseDbArg): Promise<LockProps[]> {\n return [];\n }\n\n public static async acquireLocks(arg: BriefcaseDbArg, locks: LockMap): Promise<void> {\n this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);\n }\n\n public static async queryIModelByName(arg: IModelNameArg): Promise<GuidString | undefined> {\n for (const hub of this.hubs) {\n const localHub = hub[1];\n if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)\n return localHub.iModelId;\n }\n return undefined;\n }\n\n public static async deleteIModel(arg: IModelIdArg & { iTwinId: GuidString }): Promise<void> {\n return this.destroy(arg.iModelId);\n }\n}\n"]}
1
+ {"version":3,"file":"HubMock.js","sourceRoot":"","sources":["../../src/HubMock.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA4B;AAC5B,sDAAuD;AAUvD,6CAA0C;AAC1C,6CAA0C;AAC1C,yCAAsC;AAGtC,SAAS,UAAU,CAAC,GAAuB;IACzC,IAAI,SAAS,KAAK,GAAG;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,OAAO;IAMlB,oEAAoE;IAC7D,MAAM,KAAK,OAAO,KAAK,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,OAAO;QACvB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAAO,CAAC,QAAsB,EAAE,SAAiB;QAC7D,IAAI,IAAI,CAAC,OAAO;YACd,MAAM,IAAI,KAAK,CAAC,0JAA0J,CAAC,CAAC;QAE9K,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACrD,uBAAU,CAAC,kBAAkB,CAA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zE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;;AA/KH,0BAgLC;AA9KgB,YAAI,GAAG,IAAI,GAAG,EAAoB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { join } from \"path\";\r\nimport { Guid, GuidString } from \"@itwin/core-bentley\";\r\nimport {\r\n ChangesetFileProps, ChangesetIndex, ChangesetIndexAndId, ChangesetProps, ChangesetRange, IModelVersion, LocalDirName,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n AcquireNewBriefcaseIdArg,\r\n BackendHubAccess, BriefcaseDbArg, BriefcaseIdArg, ChangesetArg, CheckpointArg, CreateNewIModelProps, DownloadChangesetArg, DownloadChangesetRangeArg, IModelIdArg, IModelNameArg,\r\n LockMap, LockProps, V2CheckpointAccessProps,\r\n} from \"./BackendHubAccess\";\r\nimport { CheckpointProps } from \"./CheckpointManager\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { LocalHub } from \"./LocalHub\";\r\nimport { TokenArg } from \"./IModelDb\";\r\n\r\nfunction wasStarted(val: string | undefined): asserts val is string {\r\n if (undefined === val)\r\n throw new Error(\"Call HubMock.startup first\");\r\n}\r\n\r\n/**\r\n * Mocks iModelHub for testing creating Briefcases, downloading checkpoints, and simulating multiple users pushing and pulling changesets, etc.\r\n *\r\n * Generally, tests for apis that *create or modify* iModels can and should be mocked. Otherwise they:\r\n * - create tremendous load on the test servers when they run on programmer's desktops and in CI jobs\r\n * - waste network and data center resources (i.e. $$$s),\r\n * - interfere with other tests running on the same or other systems, and\r\n * - (far worse) are the source of test flakiness outside of the api being tested.\r\n *\r\n * This class can be used to create tests that do not require authentication, are synchronous,\r\n * are guaranteed to be self-contained (i.e. do not interfere with other tests running at the same time or later), and do not fail for reasons outside\r\n * of the control of the test itself. As a bonus, in addition to making tests more reliable, mocking IModelHub generally makes tests run *much* faster.\r\n *\r\n * On the other hand, tests that expect to find an existing iModels, checkpoints, changesets, etc. in IModelHub cannot be mocked. In that case, those tests\r\n * should be careful to NOT modify the data, since doing so causes interference with other tests running simultaneously. These tests should be limited to\r\n * low level testing of the core apis only.\r\n *\r\n * To initialize HubMock, call [[startup]] at the beginning of your test, usually in `describe.before`. Thereafter, all access to iModelHub for an iModel will be\r\n * directed to a [[LocalHub]] - your test code does not change. After the test(s) complete, call [[shutdown]] (usually in `describe.after`) to stop mocking IModelHub and clean\r\n * up any resources used by the test(s). If you want to mock a single test, call [[startup]] as the first line and [[shutdown]] as the last. If you wish to run the\r\n * test against a \"real\" IModelHub, you can simply comment off the call [[startup]], though in that case you should make sure the name of your\r\n * iModel is unique so your test won't collide with other tests (iModel name uniqueness is not necessary for mocked tests.)\r\n *\r\n * Mocked tests must always start by creating a new iModel via [[IModelHost.hubAccess.createNewIModel]] with a `version0` iModel.\r\n * They use mock (aka \"bogus\") credentials for `AccessTokens`, which is fine since [[HubMock]] never accesses resources outside the current\r\n * computer.\r\n *\r\n * @note Only one HubMock at a time, *running in a single process*, may be active. The comments above about multiple simultaneous tests refer to tests\r\n * running on different computers, or on a single computer in multiple processes. All of those scenarios are problematic without mocking.\r\n *\r\n * @internal\r\n */\r\nexport class HubMock {\r\n private static mockRoot: LocalDirName | undefined;\r\n private static hubs = new Map<string, LocalHub>();\r\n private static _saveHubAccess: BackendHubAccess | undefined;\r\n private static _iTwinId: GuidString | undefined;\r\n\r\n /** Determine whether a test us currently being run under HubMock */\r\n public static get isValid() { return undefined !== this.mockRoot; }\r\n public static get iTwinId() {\r\n wasStarted(this._iTwinId);\r\n return this._iTwinId;\r\n }\r\n\r\n /**\r\n * Begin mocking IModelHub access. After this call, all access to IModelHub will be directed to a [[LocalHub]].\r\n * @param mockName a unique name (e.g. \"MyTest\") for this HubMock to disambiguate tests when more than one is simultaneously active.\r\n * It is used to create a private directory used by the HubMock for a test. That directory is removed when [[shutdown]] is called.\r\n */\r\n public static startup(mockName: LocalDirName, outputDir: string) {\r\n if (this.isValid)\r\n throw new Error(\"Either a previous test did not call HubMock.shutdown() properly, or more than one test is simultaneously attempting to use HubMock, which is not allowed\");\r\n\r\n this.hubs.clear();\r\n this.mockRoot = join(outputDir, \"HubMock\", mockName);\r\n IModelJsFs.recursiveMkDirSync(this.mockRoot);\r\n IModelJsFs.purgeDirSync(this.mockRoot);\r\n this._saveHubAccess = IModelHost.getHubAccess();\r\n\r\n IModelHost.setHubAccess(this);\r\n HubMock._iTwinId = Guid.createValue(); // all iModels for this test get the same \"iTwinId\"\r\n }\r\n\r\n /** Stop a HubMock that was previously started with [[startup]]\r\n * @note this function throws an exception if any of the iModels used during the tests are left open.\r\n */\r\n public static shutdown() {\r\n if (this.mockRoot === undefined)\r\n return;\r\n\r\n HubMock._iTwinId = undefined;\r\n for (const hub of this.hubs)\r\n hub[1].cleanup();\r\n\r\n this.hubs.clear();\r\n IModelJsFs.purgeDirSync(this.mockRoot);\r\n IModelJsFs.removeSync(this.mockRoot);\r\n IModelHost.setHubAccess(this._saveHubAccess);\r\n this.mockRoot = undefined;\r\n }\r\n\r\n public static findLocalHub(iModelId: GuidString): LocalHub {\r\n const hub = this.hubs.get(iModelId);\r\n if (!hub)\r\n throw new Error(`local hub for iModel ${iModelId} not created`);\r\n return hub;\r\n }\r\n\r\n /** create a [[LocalHub]] for an iModel. */\r\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\r\n wasStarted(this.mockRoot);\r\n const props = { ...arg, iModelId: Guid.createValue() };\r\n const mock = new LocalHub(join(this.mockRoot, props.iModelId), props);\r\n this.hubs.set(props.iModelId, mock);\r\n return props.iModelId;\r\n }\r\n\r\n /** remove the [[LocalHub]] for an iModel */\r\n public static destroy(iModelId: GuidString) {\r\n this.findLocalHub(iModelId).cleanup();\r\n this.hubs.delete(iModelId);\r\n }\r\n\r\n /** All methods below are mocks of the [[BackendHubAccess]] interface */\r\n\r\n public static async getChangesetFromNamedVersion(arg: IModelIdArg & { versionName: string }): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).findNamedVersion(arg.versionName);\r\n }\r\n\r\n private static changesetIndexFromArg(arg: ChangesetArg) {\r\n return (undefined !== arg.changeset.index) ? arg.changeset.index : this.findLocalHub(arg.iModelId).getChangesetIndex(arg.changeset.id);\r\n }\r\n\r\n public static async getChangesetFromVersion(arg: IModelIdArg & { version: IModelVersion }): Promise<ChangesetProps> {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n const version = arg.version;\r\n if (version.isFirst)\r\n return hub.getChangesetByIndex(0);\r\n\r\n const asOf = version.getAsOfChangeSet();\r\n if (asOf)\r\n return hub.getChangesetById(asOf);\r\n\r\n const versionName = version.getName();\r\n if (versionName)\r\n return hub.findNamedVersion(versionName);\r\n\r\n return hub.getLatestChangeset();\r\n }\r\n\r\n public static async getLatestChangeset(arg: IModelIdArg): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).getLatestChangeset();\r\n }\r\n\r\n private static async getAccessToken(arg: TokenArg) {\r\n return arg.accessToken ?? await IModelHost.getAccessToken();\r\n }\r\n\r\n public static async getMyBriefcaseIds(arg: IModelIdArg): Promise<number[]> {\r\n const accessToken = await this.getAccessToken(arg);\r\n return this.findLocalHub(arg.iModelId).getBriefcaseIds(accessToken);\r\n }\r\n\r\n public static async acquireNewBriefcaseId(arg: AcquireNewBriefcaseIdArg): Promise<number> {\r\n const accessToken = await this.getAccessToken(arg);\r\n return this.findLocalHub(arg.iModelId).acquireNewBriefcaseId(accessToken, arg.briefcaseAlias);\r\n }\r\n\r\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\r\n public static async releaseBriefcase(arg: BriefcaseIdArg): Promise<void> {\r\n return this.findLocalHub(arg.iModelId).releaseBriefcaseId(arg.briefcaseId);\r\n }\r\n\r\n public static async downloadChangeset(arg: DownloadChangesetArg): Promise<ChangesetFileProps> {\r\n return this.findLocalHub(arg.iModelId).downloadChangeset({ index: this.changesetIndexFromArg(arg), targetDir: arg.targetDir });\r\n }\r\n\r\n public static async downloadChangesets(arg: DownloadChangesetRangeArg): Promise<ChangesetFileProps[]> {\r\n return this.findLocalHub(arg.iModelId).downloadChangesets({ range: arg.range, targetDir: arg.targetDir });\r\n }\r\n\r\n public static async queryChangeset(arg: ChangesetArg): Promise<ChangesetProps> {\r\n return this.findLocalHub(arg.iModelId).getChangesetByIndex(this.changesetIndexFromArg(arg));\r\n }\r\n\r\n public static async queryChangesets(arg: IModelIdArg & { range?: ChangesetRange }): Promise<ChangesetProps[]> {\r\n return this.findLocalHub(arg.iModelId).queryChangesets(arg.range);\r\n }\r\n\r\n public static async pushChangeset(arg: IModelIdArg & { changesetProps: ChangesetFileProps }): Promise<ChangesetIndex> {\r\n return this.findLocalHub(arg.iModelId).addChangeset(arg.changesetProps);\r\n }\r\n\r\n public static async queryV2Checkpoint(_arg: CheckpointProps): Promise<V2CheckpointAccessProps | undefined> {\r\n return undefined;\r\n }\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n public static async downloadV1Checkpoint(arg: CheckpointArg): Promise<ChangesetIndexAndId> {\r\n return this.findLocalHub(arg.checkpoint.iModelId).downloadCheckpoint({ changeset: arg.checkpoint.changeset, targetFile: arg.localFile });\r\n }\r\n\r\n public static async releaseAllLocks(arg: BriefcaseDbArg) {\r\n const hub = this.findLocalHub(arg.iModelId);\r\n hub.releaseAllLocks({ briefcaseId: arg.briefcaseId, changesetIndex: hub.getIndexFromChangeset(arg.changeset) });\r\n }\r\n\r\n public static async queryAllLocks(_arg: BriefcaseDbArg): Promise<LockProps[]> {\r\n return [];\r\n }\r\n\r\n public static async acquireLocks(arg: BriefcaseDbArg, locks: LockMap): Promise<void> {\r\n this.findLocalHub(arg.iModelId).acquireLocks(locks, arg);\r\n }\r\n\r\n public static async queryIModelByName(arg: IModelNameArg): Promise<GuidString | undefined> {\r\n for (const hub of this.hubs) {\r\n const localHub = hub[1];\r\n if (localHub.iTwinId === arg.iTwinId && localHub.iModelName === arg.iModelName)\r\n return localHub.iModelId;\r\n }\r\n return undefined;\r\n }\r\n\r\n public static async deleteIModel(arg: IModelIdArg & { iTwinId: GuidString }): Promise<void> {\r\n return this.destroy(arg.iModelId);\r\n }\r\n}\r\n"]}
@@ -1,86 +1,9 @@
1
- /** @packageDocumentation
2
- * @module iModels
3
- */
4
- import { Id64String } from "@itwin/core-bentley";
5
- import { ElementProps } from "@itwin/core-common";
6
- import { IModelJsNative } from "@bentley/imodeljs-native";
7
- import { Element } from "./Element";
8
- import { IModelDb } from "./IModelDb";
9
- import { SQLiteDb } from "./SQLiteDb";
10
- /** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.
11
- * @beta
12
- */
13
- export declare class IModelCloneContext {
14
- /** The source IModelDb. */
15
- readonly sourceDb: IModelDb;
16
- /** The target IModelDb. */
17
- readonly targetDb: IModelDb;
18
- /** The native import context */
19
- private _nativeContext;
20
- /** Construct a new IModelCloneContext.
21
- * @param sourceDb The source IModelDb.
22
- * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.
23
- */
24
- constructor(sourceDb: IModelDb, targetDb?: IModelDb);
25
- /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
26
- get isBetweenIModels(): boolean;
27
- /** Dispose any native resources associated with this IModelCloneContext. */
28
- dispose(): void;
29
- /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
30
- * @internal
31
- */
32
- dump(outputFileName: string): void;
33
- /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
34
- * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
35
- * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
36
- * @throws [[IModelError]] if either CodeSpec could not be found.
37
- */
38
- remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void;
39
- /** Add a rule that remaps the specified source class to the specified target class. */
40
- remapElementClass(sourceClassFullName: string, targetClassFullName: string): void;
41
- /** Add a rule that remaps the specified source Element to the specified target Element. */
42
- remapElement(sourceId: Id64String, targetId: Id64String): void;
43
- /** Remove a rule that remaps the specified source Element. */
44
- removeElement(sourceId: Id64String): void;
45
- /** Look up a target CodeSpecId from the source CodeSpecId.
46
- * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
47
- */
48
- findTargetCodeSpecId(sourceId: Id64String): Id64String;
49
- /** Look up a target ElementId from the source ElementId.
50
- * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
51
- */
52
- findTargetElementId(sourceElementId: Id64String): Id64String;
53
- /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
54
- * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
55
- * @see [SubCategory.isDefaultSubCategory]($backend)
56
- */
57
- filterSubCategory(sourceSubCategoryId: Id64String): void;
58
- /** Returns `true` if there are any SubCategories being filtered. */
59
- get hasSubCategoryFilter(): boolean;
60
- /** Returns `true` if this SubCategory is being filtered. */
61
- isSubCategoryFiltered(subCategoryId: Id64String): boolean;
62
- /** Import the specified font from the source iModel into the target iModel.
63
- * @internal
64
- */
65
- importFont(sourceFontNumber: number): void;
66
- /** Import a single CodeSpec from the source iModel into the target iModel.
67
- * @internal
68
- */
69
- importCodeSpec(sourceCodeSpecId: Id64String): void;
70
- /** Clone the specified source Element into ElementProps for the target iModel.
71
- * @internal
72
- */
73
- cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps;
74
- /**
75
- * serialize state to a sqlite database at a given path
76
- * assumes the database has not already had any context state serialized to it
77
- * @internal
78
- */
79
- saveStateToDb(db: SQLiteDb): void;
80
- /**
81
- * load state from a sqlite database at a given path
82
- * @internal
83
- */
84
- loadStateFromDb(db: SQLiteDb): void;
85
- }
1
+ /** @packageDocumentation
2
+ * @module iModels
3
+ */
4
+ import { IModelElementCloneContext } from "./IModelElementCloneContext";
5
+ /** @deprecated use [[IModelElementCloneContext]] instead, @beta */
6
+ export declare const IModelCloneContext: typeof IModelElementCloneContext;
7
+ /** @deprecated use [[IModelElementCloneContext]] instead, @beta */
8
+ export declare type IModelCloneContext = IModelElementCloneContext;
86
9
  //# sourceMappingURL=IModelCloneContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IModelCloneContext.d.ts","sourceRoot":"","sources":["../../src/IModelCloneContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAiC,YAAY,EAA4C,MAAM,oBAAoB,CAAC;AAC3H,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,2BAA2B;IAC3B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,2BAA2B;IAC3B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,gCAAgC;IAChC,OAAO,CAAC,cAAc,CAA+B;IAErD;;;OAGG;gBACgB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAM1D,sIAAsI;IACtI,IAAW,gBAAgB,IAAI,OAAO,CAA4C;IAElF,4EAA4E;IACrE,OAAO,IAAI,IAAI;IAEtB;;OAEG;IACI,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAEzC;;;;OAIG;IACI,aAAa,CAAC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,IAAI;IAMlF,uFAAuF;IAChF,iBAAiB,CAAC,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE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