@itwin/core-backend 4.8.0-dev.3 → 4.8.0-dev.32

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 (249) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +18 -16
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js +16 -15
  5. package/lib/cjs/BackendHubAccess.js.map +1 -1
  6. package/lib/cjs/BackendLoggerCategory.d.ts +3 -1
  7. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.js +2 -0
  9. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/BlobContainerService.d.ts +3 -3
  11. package/lib/cjs/BlobContainerService.d.ts.map +1 -1
  12. package/lib/cjs/BlobContainerService.js.map +1 -1
  13. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  14. package/lib/cjs/BriefcaseManager.js +19 -11
  15. package/lib/cjs/BriefcaseManager.js.map +1 -1
  16. package/lib/cjs/Category.d.ts +0 -6
  17. package/lib/cjs/Category.d.ts.map +1 -1
  18. package/lib/cjs/Category.js +0 -6
  19. package/lib/cjs/Category.js.map +1 -1
  20. package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
  21. package/lib/cjs/ChangeSummaryManager.js +11 -9
  22. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  23. package/lib/cjs/ChangedElementsDb.d.ts +1 -0
  24. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
  25. package/lib/cjs/ChangedElementsDb.js +6 -4
  26. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  27. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  28. package/lib/cjs/ChangesetECAdaptor.js +26 -21
  29. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  30. package/lib/cjs/ChannelControl.d.ts +4 -26
  31. package/lib/cjs/ChannelControl.d.ts.map +1 -1
  32. package/lib/cjs/ChannelControl.js +2 -101
  33. package/lib/cjs/ChannelControl.js.map +1 -1
  34. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  35. package/lib/cjs/CheckpointManager.js +5 -3
  36. package/lib/cjs/CheckpointManager.js.map +1 -1
  37. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  38. package/lib/cjs/ClassRegistry.js +3 -2
  39. package/lib/cjs/ClassRegistry.js.map +1 -1
  40. package/lib/cjs/CloudSqlite.d.ts +49 -24
  41. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  42. package/lib/cjs/CloudSqlite.js +66 -7
  43. package/lib/cjs/CloudSqlite.js.map +1 -1
  44. package/lib/cjs/CodeService.d.ts +4 -4
  45. package/lib/cjs/CodeService.d.ts.map +1 -1
  46. package/lib/cjs/CodeService.js.map +1 -1
  47. package/lib/cjs/DevTools.d.ts.map +1 -1
  48. package/lib/cjs/DevTools.js +2 -1
  49. package/lib/cjs/DevTools.js.map +1 -1
  50. package/lib/cjs/DisplayStyle.d.ts +0 -3
  51. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  52. package/lib/cjs/DisplayStyle.js +0 -3
  53. package/lib/cjs/DisplayStyle.js.map +1 -1
  54. package/lib/cjs/ECDb.d.ts +6 -1
  55. package/lib/cjs/ECDb.d.ts.map +1 -1
  56. package/lib/cjs/ECDb.js +19 -14
  57. package/lib/cjs/ECDb.js.map +1 -1
  58. package/lib/cjs/ECSchemaXmlContext.js +2 -2
  59. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  60. package/lib/cjs/ECSqlStatement.d.ts +6 -3
  61. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  62. package/lib/cjs/ECSqlStatement.js +3 -3
  63. package/lib/cjs/ECSqlStatement.js.map +1 -1
  64. package/lib/cjs/Element.d.ts +3 -60
  65. package/lib/cjs/Element.d.ts.map +1 -1
  66. package/lib/cjs/Element.js +8 -64
  67. package/lib/cjs/Element.js.map +1 -1
  68. package/lib/cjs/ElementAspect.d.ts +0 -5
  69. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  70. package/lib/cjs/ElementAspect.js +4 -8
  71. package/lib/cjs/ElementAspect.js.map +1 -1
  72. package/lib/cjs/ElementGraphics.d.ts.map +1 -1
  73. package/lib/cjs/ElementGraphics.js +2 -1
  74. package/lib/cjs/ElementGraphics.js.map +1 -1
  75. package/lib/cjs/GeoCoordConfig.d.ts +10 -0
  76. package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
  77. package/lib/cjs/GeoCoordConfig.js +22 -24
  78. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  79. package/lib/cjs/GeographicCRSServices.js +2 -2
  80. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  81. package/lib/cjs/GeometrySummary.d.ts.map +1 -1
  82. package/lib/cjs/GeometrySummary.js +2 -1
  83. package/lib/cjs/GeometrySummary.js.map +1 -1
  84. package/lib/cjs/IModelDb.d.ts +33 -98
  85. package/lib/cjs/IModelDb.d.ts.map +1 -1
  86. package/lib/cjs/IModelDb.js +242 -156
  87. package/lib/cjs/IModelDb.js.map +1 -1
  88. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  89. package/lib/cjs/IModelElementCloneContext.js +5 -4
  90. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  91. package/lib/cjs/IModelHost.d.ts +13 -4
  92. package/lib/cjs/IModelHost.d.ts.map +1 -1
  93. package/lib/cjs/IModelHost.js +39 -32
  94. package/lib/cjs/IModelHost.js.map +1 -1
  95. package/lib/cjs/IpcHost.d.ts.map +1 -1
  96. package/lib/cjs/IpcHost.js +15 -13
  97. package/lib/cjs/IpcHost.js.map +1 -1
  98. package/lib/cjs/LocalHub.d.ts +2 -2
  99. package/lib/cjs/LocalHub.d.ts.map +1 -1
  100. package/lib/cjs/LocalHub.js +17 -17
  101. package/lib/cjs/LocalHub.js.map +1 -1
  102. package/lib/cjs/LockControl.d.ts +73 -0
  103. package/lib/cjs/LockControl.d.ts.map +1 -0
  104. package/lib/cjs/LockControl.js +11 -0
  105. package/lib/cjs/LockControl.js.map +1 -0
  106. package/lib/cjs/Material.d.ts +2 -5
  107. package/lib/cjs/Material.d.ts.map +1 -1
  108. package/lib/cjs/Material.js +6 -4
  109. package/lib/cjs/Material.js.map +1 -1
  110. package/lib/cjs/Model.d.ts +0 -22
  111. package/lib/cjs/Model.d.ts.map +1 -1
  112. package/lib/cjs/Model.js +5 -26
  113. package/lib/cjs/Model.js.map +1 -1
  114. package/lib/cjs/PropertyStore.d.ts +17 -7
  115. package/lib/cjs/PropertyStore.d.ts.map +1 -1
  116. package/lib/cjs/PropertyStore.js +11 -5
  117. package/lib/cjs/PropertyStore.js.map +1 -1
  118. package/lib/cjs/Relationship.d.ts +0 -12
  119. package/lib/cjs/Relationship.d.ts.map +1 -1
  120. package/lib/cjs/Relationship.js +5 -16
  121. package/lib/cjs/Relationship.js.map +1 -1
  122. package/lib/cjs/SQLiteDb.d.ts +8 -4
  123. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  124. package/lib/cjs/SQLiteDb.js +25 -19
  125. package/lib/cjs/SQLiteDb.js.map +1 -1
  126. package/lib/cjs/SchemaSync.d.ts +4 -1
  127. package/lib/cjs/SchemaSync.d.ts.map +1 -1
  128. package/lib/cjs/SchemaSync.js +24 -11
  129. package/lib/cjs/SchemaSync.js.map +1 -1
  130. package/lib/cjs/SchemaUtils.js +3 -3
  131. package/lib/cjs/SchemaUtils.js.map +1 -1
  132. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  133. package/lib/cjs/SqliteChangesetReader.js +2 -2
  134. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  135. package/lib/cjs/SqliteStatement.js +2 -2
  136. package/lib/cjs/SqliteStatement.js.map +1 -1
  137. package/lib/cjs/TextAnnotationGeometry.d.ts +5 -1
  138. package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -1
  139. package/lib/cjs/TextAnnotationGeometry.js +11 -8
  140. package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
  141. package/lib/cjs/TextAnnotationLayout.d.ts +21 -13
  142. package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
  143. package/lib/cjs/TextAnnotationLayout.js +134 -92
  144. package/lib/cjs/TextAnnotationLayout.js.map +1 -1
  145. package/lib/cjs/TxnManager.d.ts +2 -1
  146. package/lib/cjs/TxnManager.d.ts.map +1 -1
  147. package/lib/cjs/TxnManager.js +4 -2
  148. package/lib/cjs/TxnManager.js.map +1 -1
  149. package/lib/cjs/ViewDefinition.d.ts +1 -18
  150. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  151. package/lib/cjs/ViewDefinition.js +1 -18
  152. package/lib/cjs/ViewDefinition.js.map +1 -1
  153. package/lib/cjs/ViewStore.d.ts +16 -2
  154. package/lib/cjs/ViewStore.d.ts.map +1 -1
  155. package/lib/cjs/ViewStore.js +20 -6
  156. package/lib/cjs/ViewStore.js.map +1 -1
  157. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +33 -0
  158. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +17 -21
  159. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +80 -38
  160. package/lib/cjs/assets/Settings/backend.setting.json5 +8 -119
  161. package/lib/cjs/core-backend.d.ts +4 -2
  162. package/lib/cjs/core-backend.d.ts.map +1 -1
  163. package/lib/cjs/core-backend.js +5 -6
  164. package/lib/cjs/core-backend.js.map +1 -1
  165. package/lib/cjs/domains/FunctionalElements.d.ts +0 -10
  166. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
  167. package/lib/cjs/domains/FunctionalElements.js +0 -10
  168. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  169. package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
  170. package/lib/cjs/domains/FunctionalSchema.js +2 -1
  171. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  172. package/lib/cjs/domains/GenericElements.d.ts +0 -18
  173. package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
  174. package/lib/cjs/domains/GenericElements.js +0 -18
  175. package/lib/cjs/domains/GenericElements.js.map +1 -1
  176. package/lib/cjs/internal/ChangesetConflictArgs.d.ts +24 -0
  177. package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -0
  178. package/lib/cjs/internal/ChangesetConflictArgs.js +7 -0
  179. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -0
  180. package/lib/cjs/internal/ChannelAdmin.d.ts +34 -0
  181. package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -0
  182. package/lib/cjs/internal/ChannelAdmin.js +117 -0
  183. package/lib/cjs/internal/ChannelAdmin.js.map +1 -0
  184. package/lib/cjs/internal/NativePlatform.d.ts +15 -0
  185. package/lib/cjs/internal/NativePlatform.d.ts.map +1 -0
  186. package/lib/cjs/internal/NativePlatform.js +49 -0
  187. package/lib/cjs/internal/NativePlatform.js.map +1 -0
  188. package/lib/cjs/internal/NoLocks.d.ts +6 -0
  189. package/lib/cjs/internal/NoLocks.d.ts.map +1 -0
  190. package/lib/cjs/internal/NoLocks.js +31 -0
  191. package/lib/cjs/internal/NoLocks.js.map +1 -0
  192. package/lib/cjs/{ServerBasedLocks.d.ts → internal/ServerBasedLocks.d.ts} +10 -16
  193. package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -0
  194. package/lib/cjs/{ServerBasedLocks.js → internal/ServerBasedLocks.js} +29 -18
  195. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -0
  196. package/lib/cjs/internal/Symbols.d.ts +11 -0
  197. package/lib/cjs/internal/Symbols.d.ts.map +1 -0
  198. package/lib/cjs/internal/Symbols.js +21 -0
  199. package/lib/cjs/internal/Symbols.js.map +1 -0
  200. package/lib/cjs/internal/cross-package.d.ts +4 -0
  201. package/lib/cjs/internal/cross-package.d.ts.map +1 -0
  202. package/lib/cjs/internal/cross-package.js +16 -0
  203. package/lib/cjs/internal/cross-package.js.map +1 -0
  204. package/lib/cjs/internal/workspace/SettingsImpl.d.ts +43 -0
  205. package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -0
  206. package/lib/cjs/internal/workspace/SettingsImpl.js +161 -0
  207. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -0
  208. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts +6 -0
  209. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -0
  210. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +276 -0
  211. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -0
  212. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +41 -0
  213. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -0
  214. package/lib/cjs/internal/workspace/WorkspaceImpl.js +696 -0
  215. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -0
  216. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts +10 -0
  217. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -0
  218. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +42 -0
  219. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -0
  220. package/lib/cjs/rpc/tracing.d.ts.map +1 -1
  221. package/lib/cjs/rpc/tracing.js +5 -2
  222. package/lib/cjs/rpc/tracing.js.map +1 -1
  223. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -0
  224. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
  225. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +10 -6
  226. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  227. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  228. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +5 -3
  229. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  230. package/lib/cjs/workspace/Settings.d.ts +167 -138
  231. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  232. package/lib/cjs/workspace/Settings.js +68 -138
  233. package/lib/cjs/workspace/Settings.js.map +1 -1
  234. package/lib/cjs/workspace/SettingsSchemas.d.ts +112 -48
  235. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
  236. package/lib/cjs/workspace/SettingsSchemas.js +1 -172
  237. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  238. package/lib/cjs/workspace/Workspace.d.ts +411 -277
  239. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  240. package/lib/cjs/workspace/Workspace.js +76 -457
  241. package/lib/cjs/workspace/Workspace.js.map +1 -1
  242. package/lib/cjs/workspace/WorkspaceEditor.d.ts +245 -0
  243. package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -0
  244. package/lib/cjs/workspace/WorkspaceEditor.js +34 -0
  245. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -0
  246. package/package.json +15 -14
  247. package/lib/cjs/ServerBasedLocks.d.ts.map +0 -1
  248. package/lib/cjs/ServerBasedLocks.js.map +0 -1
  249. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +0 -45
@@ -10,7 +10,6 @@ export type { SourceAndTarget, RelationshipProps } from "@itwin/core-common";
10
10
  * @public
11
11
  */
12
12
  export declare class Relationship extends Entity {
13
- /** @internal */
14
13
  static get className(): string;
15
14
  readonly sourceId: Id64String;
16
15
  readonly targetId: Id64String;
@@ -43,7 +42,6 @@ export declare class Relationship extends Entity {
43
42
  * @public
44
43
  */
45
44
  export declare class ElementRefersToElements extends Relationship {
46
- /** @internal */
47
45
  static get className(): string;
48
46
  /** Create an instance of the Relationship.
49
47
  * @param iModel The iModel that will contain the relationship
@@ -65,14 +63,12 @@ export declare class ElementRefersToElements extends Relationship {
65
63
  * @public
66
64
  */
67
65
  export declare class DrawingGraphicRepresentsElement extends ElementRefersToElements {
68
- /** @internal */
69
66
  static get className(): string;
70
67
  }
71
68
  /** Relates a [[GraphicalElement3d]] to the [[Element]] that it represents
72
69
  * @public
73
70
  */
74
71
  export declare class GraphicalElement3dRepresentsElement extends ElementRefersToElements {
75
- /** @internal */
76
72
  static get className(): string;
77
73
  }
78
74
  /** Relates a [[SynchronizationConfigLink]] to N [[ExternalSource]] instances.
@@ -81,7 +77,6 @@ export declare class GraphicalElement3dRepresentsElement extends ElementRefersTo
81
77
  * @beta
82
78
  */
83
79
  export declare class SynchronizationConfigProcessesSources extends ElementRefersToElements {
84
- /** @internal */
85
80
  static get className(): string;
86
81
  }
87
82
  /** Relates a [[SynchronizationConfigLink]] to *root* [[ExternalSource]] instances.
@@ -89,7 +84,6 @@ export declare class SynchronizationConfigProcessesSources extends ElementRefers
89
84
  * @beta
90
85
  */
91
86
  export declare class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {
92
- /** @internal */
93
87
  static get className(): string;
94
88
  }
95
89
  /** Properties that are common to all types of link table ECRelationships
@@ -102,7 +96,6 @@ export interface ElementGroupsMembersProps extends RelationshipProps {
102
96
  * @public
103
97
  */
104
98
  export declare class ElementGroupsMembers extends ElementRefersToElements {
105
- /** @internal */
106
99
  static get className(): string;
107
100
  memberPriority: number;
108
101
  constructor(props: ElementGroupsMembersProps, iModel: IModelDb);
@@ -113,7 +106,6 @@ export declare class ElementGroupsMembers extends ElementRefersToElements {
113
106
  * @public
114
107
  */
115
108
  export declare class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {
116
- /** @internal */
117
109
  static get className(): string;
118
110
  }
119
111
  /** Represents group membership where the group Element (and its properties) impart information about the member Elements above mere membership.
@@ -122,7 +114,6 @@ export declare class DefinitionGroupGroupsDefinitions extends ElementGroupsMembe
122
114
  * @public
123
115
  */
124
116
  export declare class GroupImpartsToMembers extends ElementGroupsMembers {
125
- /** @internal */
126
117
  static get className(): string;
127
118
  }
128
119
  /** Relates an [[ExternalSourceGroup]] to its [[ExternalSource]] members.
@@ -130,7 +121,6 @@ export declare class GroupImpartsToMembers extends ElementGroupsMembers {
130
121
  * @beta
131
122
  */
132
123
  export declare class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {
133
- /** @internal */
134
124
  static get className(): string;
135
125
  }
136
126
  /** Properties that are common to all types of ElementDrivesElements
@@ -325,7 +315,6 @@ export interface ElementDrivesElementProps extends RelationshipProps {
325
315
  * @beta
326
316
  */
327
317
  export declare class ElementDrivesElement extends Relationship {
328
- /** @internal */
329
318
  static get className(): string;
330
319
  /** Relationship status
331
320
  * * 0 indicates no errors. Set after a successful evaluation.
@@ -347,7 +336,6 @@ export declare class ElementDrivesElement extends Relationship {
347
336
  * @internal
348
337
  */
349
338
  export declare class ModelSelectorRefersToModels extends Relationship {
350
- /** @internal */
351
339
  static get className(): string;
352
340
  protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
353
341
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Relationship.d.ts","sourceRoot":"","sources":["../../src/Relationship.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAkB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAA6B,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEvH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE7E;;GAEG;AACH,qBAAa,YAAa,SAAQ,MAAM;IACtC,gBAAgB;IAChB,WAA2B,SAAS,IAAI,MAAM,CAA2B;IACzE,SAAgB,QAAQ,EAAE,UAAU,CAAC;IACrC,SAAgB,QAAQ,EAAE,UAAU,CAAC;IAErC,SAAS,aAAa,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ;IAMhD,MAAM,IAAI,iBAAiB;IAO3C;;;;;;OAMG;WACW,aAAa,CAAC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,WAA2B,SAAS,IAAI,MAAM,CAA0C;cACrE,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;CAK/E;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAW;IAE1B,gBAAgB;gBACG,MAAM,EAAE,QAAQ;IAEnC;;;OAGG;IACI,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY;IAE7D,2EAA2E;IAC3E,OAAO,CAAC,sBAAsB;IAM9B;;;;OAIG;IACI,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,UAAU;IAK3D;;OAEG;IACI,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAIrD,wDAAwD;IACjD,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAIrD;;;;;OAKG;IACI,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,eAAe,GAAG,CAAC;IAQzH;;;;;;OAMG;IACI,mBAAmB,CAAC,CAAC,SAAS,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,eAAe,GAAG,CAAC,GAAG,SAAS;IAoBxI;;;;;OAKG;IACI,WAAW,CAAC,CAAC,SAAS,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,eAAe,GAAG,CAAC;IAI9G;;;;;;OAMG;IACI,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,eAAe,GAAG,CAAC,GAAG,SAAS;CAI/H"}
@@ -11,11 +11,11 @@ exports.Relationships = exports.ModelSelectorRefersToModels = exports.ElementDri
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_common_1 = require("@itwin/core-common");
13
13
  const Entity_1 = require("./Entity");
14
+ const Symbols_1 = require("./internal/Symbols");
14
15
  /** Base class for all link table ECRelationships
15
16
  * @public
16
17
  */
17
18
  class Relationship extends Entity_1.Entity {
18
- /** @internal */
19
19
  static get className() { return "Relationship"; }
20
20
  constructor(props, iModel) {
21
21
  super(props, iModel);
@@ -56,7 +56,6 @@ exports.Relationship = Relationship;
56
56
  * @public
57
57
  */
58
58
  class ElementRefersToElements extends Relationship {
59
- /** @internal */
60
59
  static get className() { return "ElementRefersToElements"; }
61
60
  /** Create an instance of the Relationship.
62
61
  * @param iModel The iModel that will contain the relationship
@@ -88,7 +87,6 @@ exports.ElementRefersToElements = ElementRefersToElements;
88
87
  * @public
89
88
  */
90
89
  class DrawingGraphicRepresentsElement extends ElementRefersToElements {
91
- /** @internal */
92
90
  static get className() { return "DrawingGraphicRepresentsElement"; }
93
91
  }
94
92
  exports.DrawingGraphicRepresentsElement = DrawingGraphicRepresentsElement;
@@ -96,7 +94,6 @@ exports.DrawingGraphicRepresentsElement = DrawingGraphicRepresentsElement;
96
94
  * @public
97
95
  */
98
96
  class GraphicalElement3dRepresentsElement extends ElementRefersToElements {
99
- /** @internal */
100
97
  static get className() { return "GraphicalElement3dRepresentsElement"; }
101
98
  }
102
99
  exports.GraphicalElement3dRepresentsElement = GraphicalElement3dRepresentsElement;
@@ -106,7 +103,6 @@ exports.GraphicalElement3dRepresentsElement = GraphicalElement3dRepresentsElemen
106
103
  * @beta
107
104
  */
108
105
  class SynchronizationConfigProcessesSources extends ElementRefersToElements {
109
- /** @internal */
110
106
  static get className() { return "SynchronizationConfigProcessesSources"; }
111
107
  }
112
108
  exports.SynchronizationConfigProcessesSources = SynchronizationConfigProcessesSources;
@@ -115,7 +111,6 @@ exports.SynchronizationConfigProcessesSources = SynchronizationConfigProcessesSo
115
111
  * @beta
116
112
  */
117
113
  class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {
118
- /** @internal */
119
114
  static get className() { return "SynchronizationConfigSpecifiesRootSources"; }
120
115
  }
121
116
  exports.SynchronizationConfigSpecifiesRootSources = SynchronizationConfigSpecifiesRootSources;
@@ -123,7 +118,6 @@ exports.SynchronizationConfigSpecifiesRootSources = SynchronizationConfigSpecifi
123
118
  * @public
124
119
  */
125
120
  class ElementGroupsMembers extends ElementRefersToElements {
126
- /** @internal */
127
121
  static get className() { return "ElementGroupsMembers"; }
128
122
  constructor(props, iModel) {
129
123
  super(props, iModel);
@@ -140,7 +134,6 @@ exports.ElementGroupsMembers = ElementGroupsMembers;
140
134
  * @public
141
135
  */
142
136
  class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {
143
- /** @internal */
144
137
  static get className() { return "DefinitionGroupGroupsDefinitions"; }
145
138
  }
146
139
  exports.DefinitionGroupGroupsDefinitions = DefinitionGroupGroupsDefinitions;
@@ -150,7 +143,6 @@ exports.DefinitionGroupGroupsDefinitions = DefinitionGroupGroupsDefinitions;
150
143
  * @public
151
144
  */
152
145
  class GroupImpartsToMembers extends ElementGroupsMembers {
153
- /** @internal */
154
146
  static get className() { return "GroupImpartsToMembers"; }
155
147
  }
156
148
  exports.GroupImpartsToMembers = GroupImpartsToMembers;
@@ -159,7 +151,6 @@ exports.GroupImpartsToMembers = GroupImpartsToMembers;
159
151
  * @beta
160
152
  */
161
153
  class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {
162
- /** @internal */
163
154
  static get className() { return "ExternalSourceGroupGroupsSources"; }
164
155
  }
165
156
  exports.ExternalSourceGroupGroupsSources = ExternalSourceGroupGroupsSources;
@@ -348,7 +339,6 @@ exports.ExternalSourceGroupGroupsSources = ExternalSourceGroupGroupsSources;
348
339
  * @beta
349
340
  */
350
341
  class ElementDrivesElement extends Relationship {
351
- /** @internal */
352
342
  static get className() { return "ElementDrivesElement"; }
353
343
  constructor(props, iModel) {
354
344
  super(props, iModel);
@@ -379,7 +369,6 @@ exports.ElementDrivesElement = ElementDrivesElement;
379
369
  * @internal
380
370
  */
381
371
  class ModelSelectorRefersToModels extends Relationship {
382
- /** @internal */
383
372
  static get className() { return "ModelSelectorRefersToModels"; }
384
373
  collectReferenceIds(referenceIds) {
385
374
  super.collectReferenceIds(referenceIds);
@@ -401,7 +390,7 @@ class Relationships {
401
390
  createInstance(props) { return this._iModel.constructEntity(props); }
402
391
  /** Check classFullName to ensure it is a link table relationship class. */
403
392
  checkRelationshipClass(classFullName) {
404
- if (!this._iModel.nativeDb.isLinkTableRelationship(classFullName.replace(".", ":"))) {
393
+ if (!this._iModel[Symbols_1._nativeDb].isLinkTableRelationship(classFullName.replace(".", ":"))) {
405
394
  throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, `Class '${classFullName}' must be a relationship class and it should be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.`);
406
395
  }
407
396
  }
@@ -412,17 +401,17 @@ class Relationships {
412
401
  */
413
402
  insertInstance(props) {
414
403
  this.checkRelationshipClass(props.classFullName);
415
- return props.id = this._iModel.nativeDb.insertLinkTableRelationship(props);
404
+ return props.id = this._iModel[Symbols_1._nativeDb].insertLinkTableRelationship(props);
416
405
  }
417
406
  /** Update the properties of an existing relationship instance in the iModel.
418
407
  * @param props the properties of the relationship instance to update. Any properties that are not present will be left unchanged.
419
408
  */
420
409
  updateInstance(props) {
421
- this._iModel.nativeDb.updateLinkTableRelationship(props);
410
+ this._iModel[Symbols_1._nativeDb].updateLinkTableRelationship(props);
422
411
  }
423
412
  /** Delete an Relationship instance from this iModel. */
424
413
  deleteInstance(props) {
425
- this._iModel.nativeDb.deleteLinkTableRelationship(props);
414
+ this._iModel[Symbols_1._nativeDb].deleteLinkTableRelationship(props);
426
415
  }
427
416
  /** Get the props of a Relationship instance
428
417
  * @param relClassFullName The full class name of the relationship in the form of "schema:class"
@@ -1 +1 @@
1
- {"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/Relationship.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAiE;AACjE,oDAAuH;AAEvH,qCAAkC;AAKlC;;GAEG;AACH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,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAClC,OAAO,uBAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YACjF,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YACxB,KAAK,CAAC,aAAa,GAAI,KAAa,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAyB,eAAuB,EAAE,QAAsC;QACxG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAyB,gBAAwB,EAAE,QAAsC;QAC5G,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAoB,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAClG,OAAO,SAAS,KAAK,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1G,CAAC;CACF;AAvGD,sCAuGC","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/** @packageDocumentation\r\n * @module Relationships\r\n */\r\n\r\nimport { DbResult, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { EntityReferenceSet, IModelError, IModelStatus, RelationshipProps, SourceAndTarget } from \"@itwin/core-common\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\nexport type { SourceAndTarget, RelationshipProps } from \"@itwin/core-common\"; // for backwards compatibility\r\n\r\n/** Base class for all link table ECRelationships\r\n * @public\r\n */\r\nexport class Relationship extends Entity {\r\n /** @internal */\r\n public static override get className(): string { return \"Relationship\"; }\r\n public readonly sourceId: Id64String;\r\n public readonly targetId: Id64String;\r\n\r\n protected constructor(props: RelationshipProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.sourceId = Id64.fromJSON(props.sourceId);\r\n this.targetId = Id64.fromJSON(props.targetId);\r\n }\r\n\r\n public override toJSON(): RelationshipProps {\r\n const val = super.toJSON() as RelationshipProps;\r\n val.sourceId = this.sourceId;\r\n val.targetId = this.targetId;\r\n return val;\r\n }\r\n\r\n /**\r\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when its input has changed or is the output of some upstream relationship whose input has changed.\r\n * This callback is invoked after the input element has been processed by upstream relationships.\r\n * A subclass of ElementDrivesElement can re-implement this static method to take some action. onRootChanged may modify the output element only.\r\n * @param _props The ElementDrivesElement relationship instance.\r\n * @param _iModel The iModel\r\n */\r\n public static onRootChanged(_props: RelationshipProps, _iModel: IModelDb): void { }\r\n\r\n /**\r\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when the relationship instance has been deleted.\r\n * A subclass of ElementDrivesElement can re-implement this static method to take some action.\r\n * @param _props The deleted ElementDrivesElement relationship instance.\r\n * @param _iModel The iModel\r\n */\r\n public static onDeletedDependency(_props: RelationshipProps, _iModel: IModelDb): void { }\r\n\r\n /** Insert this Relationship into the iModel. */\r\n public insert(): Id64String { return this.id = this.iModel.relationships.insertInstance(this.toJSON()); }\r\n /** Update this Relationship in the iModel. */\r\n public update() { this.iModel.relationships.updateInstance(this.toJSON()); }\r\n /** Delete this Relationship from the iModel. */\r\n public delete() { this.iModel.relationships.deleteInstance(this.toJSON()); }\r\n\r\n public static getInstance<T extends Relationship>(iModel: IModelDb, criteria: Id64String | SourceAndTarget): T { return iModel.relationships.getInstance(this.classFullName, criteria); }\r\n}\r\n\r\n/** A Relationship where one Element refers to another Element\r\n * @public\r\n */\r\nexport class ElementRefersToElements extends Relationship {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementRefersToElements\"; }\r\n /** Create an instance of the Relationship.\r\n * @param iModel The iModel that will contain the relationship\r\n * @param sourceId The sourceId of the relationship, that is, the driver element\r\n * @param targetId The targetId of the relationship, that is, the driven element\r\n * @return an instance of the specified class.\r\n */\r\n public static create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): T {\r\n return iModel.relationships.createInstance({ sourceId, targetId, classFullName: this.classFullName }) as T;\r\n }\r\n /** Insert a new instance of the Relationship.\r\n * @param iModel The iModel that will contain the relationship\r\n * @param sourceId The sourceId of the relationship, that is, the driver element\r\n * @param targetId The targetId of the relationship, that is, the driven element\r\n * @return The Id of the inserted Relationship.\r\n */\r\n public static insert<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): Id64String {\r\n const relationship: T = this.create(iModel, sourceId, targetId);\r\n return iModel.relationships.insertInstance(relationship.toJSON());\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addElement(this.targetId);\r\n }\r\n}\r\n\r\n/** Relates a [[DrawingGraphic]] to the [[Element]] that it represents\r\n * @public\r\n */\r\nexport class DrawingGraphicRepresentsElement extends ElementRefersToElements {\r\n /** @internal */\r\n public static override get className(): string { return \"DrawingGraphicRepresentsElement\"; }\r\n}\r\n\r\n/** Relates a [[GraphicalElement3d]] to the [[Element]] that it represents\r\n * @public\r\n */\r\nexport class GraphicalElement3dRepresentsElement extends ElementRefersToElements {\r\n /** @internal */\r\n public static override get className(): string { return \"GraphicalElement3dRepresentsElement\"; }\r\n}\r\n\r\n/** Relates a [[SynchronizationConfigLink]] to N [[ExternalSource]] instances.\r\n * Each relationship instance represents an external source processed by the synchronization configuration.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigProcessesSources extends ElementRefersToElements {\r\n /** @internal */\r\n public static override get className(): string { return \"SynchronizationConfigProcessesSources\"; }\r\n}\r\n\r\n/** Relates a [[SynchronizationConfigLink]] to *root* [[ExternalSource]] instances.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {\r\n /** @internal */\r\n public static override get className(): string { return \"SynchronizationConfigSpecifiesRootSources\"; }\r\n}\r\n\r\n/** Properties that are common to all types of link table ECRelationships\r\n * @public\r\n */\r\nexport interface ElementGroupsMembersProps extends RelationshipProps {\r\n memberPriority: number;\r\n}\r\n\r\n/** An ElementRefersToElements relationship where one Element *groups* a set of other Elements.\r\n * @public\r\n */\r\nexport class ElementGroupsMembers extends ElementRefersToElements {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementGroupsMembers\"; }\r\n public memberPriority: number;\r\n\r\n constructor(props: ElementGroupsMembersProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.memberPriority = props.memberPriority;\r\n }\r\n\r\n public static override create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, memberPriority: number = 0): T {\r\n const props: ElementGroupsMembersProps = { sourceId, targetId, memberPriority, classFullName: this.classFullName };\r\n return iModel.relationships.createInstance(props) as T;\r\n }\r\n}\r\n\r\n/** Relates a [[DefinitionGroup]] to its [[DefinitionElement]] members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\r\n * @public\r\n */\r\nexport class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {\r\n /** @internal */\r\n public static override get className(): string { return \"DefinitionGroupGroupsDefinitions\"; }\r\n}\r\n\r\n/** Represents group membership where the group Element (and its properties) impart information about the member Elements above mere membership.\r\n * Implies that properties of the group should be considered as properties of its members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.11\r\n * @public\r\n */\r\nexport class GroupImpartsToMembers extends ElementGroupsMembers {\r\n /** @internal */\r\n public static override get className(): string { return \"GroupImpartsToMembers\"; }\r\n}\r\n\r\n/** Relates an [[ExternalSourceGroup]] to its [[ExternalSource]] members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceGroupGroupsSources\"; }\r\n}\r\n\r\n/** Properties that are common to all types of ElementDrivesElements\r\n * @beta\r\n */\r\nexport interface ElementDrivesElementProps extends RelationshipProps {\r\n status: number;\r\n priority: number;\r\n}\r\n\r\n/** A Relationship indicating that one Element *drives* another Element.\r\n * An ElementDrivesElement relationship defines a one-way \"driving\" relationship from the source to the target.\r\n * When the source of an ElementDrivesElement relationship changes, the ElementDrivesElement itself can get a callback, and both the source and target elements can get callbacks.\r\n * By inserting ElementDrivesElement relationships, an app can create and store an acyclic directed graph of dependencies between elements.\r\n *\r\n * # Defining dependencies\r\n * Create an ElementDrivesElement relationship to specify that the source element drives the target element.\r\n * For example, to specify that element e1 drives element e2, create a relationship between them like this:\r\n * ```ts\r\n * const ede = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * ede.insert();\r\n * ```\r\n * This creates a persistent relationship. The fact that e1 drives e2 is persisted in the iModel.\r\n *\r\n * # Defining dependency graphs\r\n * When you create multiple ElementDrivesElement relationships, you create a network of dependencies. The target of one may be the source of another.\r\n * A change in the content of an DgnElement can therefore trigger changes to many downstream elements.\r\n *\r\n * For example, to make element e1 drive element e2 and e2 drive another element, e3, create two relationships like this:\r\n * ```ts\r\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\r\n * ede12.insert();\r\n * ede23.insert();\r\n * ```\r\n * Those two relationships create this graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n * Where the \"-->\" is meant to represent a driving relationship.\r\n *\r\n * The order in which you create the relationships does not matter.\r\n * The graph indicates that e3 depends on e2 and e2 depends on e1.\r\n *\r\n * An ElementDrivesElement relationship is between one source element and one target element.\r\n * Many ElementDrivesElement relationships can point to a given element, and many can point out of it.\r\n * Thus, you can define many:many relationships.\r\n * For example:\r\n * ```ts\r\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * const ede112 = ElementDrivesElement.create(iModel, e11id, e2id);\r\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\r\n * const ede231 = ElementDrivesElement.create(iModel, e2id, e31id);\r\n * ede12.insert();\r\n * ede112.insert();\r\n * ede23.insert();\r\n * ede231.insert();\r\n * ```\r\n * Creates this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * e2 depends on both e1 and e11. e2 then drives e3 and e31.\r\n *\r\n * In an ElementDrivesElement dependency graph, the relationships are the \"edges\" and the Elements are the \"nodes\".\r\n * The following terms are used when referring to the elements (nodes) in a dependency graph:\r\n * * Inputs - The sources of all edges that point to the element. This includes all upstream elements that flow into the element.\r\n * * Outputs - The targets of all edges that point out of the element. This includes all downstream elements.\r\n *\r\n * # Subgraph Processing\r\n * When changes are made, only the part of the overall graph that is affected will be processed. So, for example,\r\n * suppose we have this graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n * If e1 changes, then the subgraph to be processed is equal to the full graph, as shown.\r\n *\r\n * If only e2 changes, then the subgraph to be processed is just:\r\n * ```\r\n * e2 --> e3\r\n * ```\r\n * If only e3 changes, then the subgraph consists of e3 by itself.\r\n *\r\n * Returning to the second example above, suppose we have this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * If e1 is changed, the affected subgraph is:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * If e2 is changed, the affected subgraph is:\r\n * ```\r\n * e3\r\n * /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * # Callbacks\r\n * Once the affected subgraph to process is found, it propagates changes through it by making callbacks.\r\n * Classes for both elements (nodes) and ElementDrivesElements relationships (edges) can receive callbacks.\r\n *\r\n * ## ElementDrivesElement Callbacks\r\n * The following callbacks are invoked on ElementDrivesElement relationship classes (edges):\r\n * * onRootChanged\r\n * * onDeletedDependency\r\n *\r\n * Note that these are static methods. Their default implementations do nothing.\r\n * To receive and act on these callbacks, a domain should define a subclass of ElementDrivesElement and use that to create relationships.\r\n * The subclass should then implement the callbacks that it would like to act on.\r\n *\r\n * A ElementDrivesElement subclass callback is expected to make changes to the output element only!\r\n *\r\n * ## Element Callbacks\r\n * The following callbacks are invoked on Element classes (nodes):\r\n * * Element.onBeforeOutputsHandled\r\n * * Element.onAllInputsHandled\r\n *\r\n * ## Order\r\n * Callbacks are invoked by BriefcaseDb.saveChanges.\r\n * They are invoked in dependency (topological) order: driving elements first, then driven elements.\r\n *\r\n * Each callback is invoked only once. No matter how many times a given element was changed during the transaction,\r\n * a callback such as ElementDrivesElement.onRootChanged will be invoked only once.\r\n * In the same way, no matter how many of its inputs were changed, a callback such as Element.onAllInputsHandled will be\r\n * invoked only once.\r\n *\r\n * For example, suppose we have a graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n *\r\n * Suppose that e1 is directly modified. No callbacks are made at that time.\r\n * Later, when BriefcaseDb.saveChanges is called, the following callbacks are made, in order:\r\n * 1. Element.onBeforeOutputsHandled e1\r\n * 1. ElementDrivesElement.onRootChanged e1->e2\r\n * 1. Element.onAllInputsHandled e2\r\n * 1. ElementDrivesElement.onRootChanged e2->e3\r\n * 1. Element.onAllInputsHandled e3\r\n *\r\n * Suppose that e3 is modified directly and BriefcaseDb.saveChanges is called.\r\n * Since no input to a relationship was changed, the sub-graph will be empty, and no callbacks will be made.\r\n *\r\n * Returning to the second example above, suppose we have this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * If e1 is changed and BriefcaseDb.saveChanges is called, the subgraph is:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * The callbacks are:\r\n * 1. Element.onBeforeOutputsHandled e1\r\n * 1. ElementDrivesElement.onRootChanged e1->e2\r\n * 1. Element.onAllInputsHandled e2\r\n * 1. ElementDrivesElement.onRootChanged e2->e3\r\n * 1. Element.onAllInputsHandled e3\r\n * 1. ElementDrivesElement.onRootChanged e2->e31\r\n * 1. Element.onAllInputsHandled e31\r\n *\r\n * (The ElementDrivesElement.)\r\n *\r\n * #Errors\r\n * Circular dependencies are not permitted. If a cycle is detected, that is treated as a fatal error. All ElementDrivesElement relationships\r\n * involved in a cycle will have their status set to 1, indicating a failure.\r\n *\r\n * A callback may call txnManager.reportError to reject an invalid change. It can classify the error as fatal or just a warning.\r\n * A callback make set the status value of an ElementDrivesElement instance to 1 to indicate a processing failure in that edge.\r\n *\r\n * After BriefcaseDb.saveChanges is called, an app should check db.txns.validationErrors and db.txns.hasFatalError to find out if graph-evaluation failed.\r\n *\r\n * @beta\r\n */\r\nexport class ElementDrivesElement extends Relationship {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementDrivesElement\"; }\r\n /** Relationship status\r\n * * 0 indicates no errors. Set after a successful evaluation.\r\n * * 1 indicates that this driving relationship could not be evaluated. The callback itself can set this to indicate that it failed to process the input changes. Also, it is set if the relationship is part of a circular dependency.\r\n * * 0x80 The app or callback can set this to indicate to not propagate changes through this relationship.\r\n */\r\n public status: number;\r\n /** Affects the order in which relationships are processed in the case where two relationships have the same output. */\r\n public priority: number;\r\n\r\n protected constructor(props: ElementDrivesElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.status = props.status;\r\n this.priority = props.priority;\r\n }\r\n\r\n public static create<T extends ElementDrivesElement>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, priority: number = 0): T {\r\n const props: ElementDrivesElementProps = { sourceId, targetId, priority, status: 0, classFullName: this.classFullName };\r\n return iModel.relationships.createInstance(props) as T;\r\n }\r\n\r\n public override toJSON(): ElementDrivesElementProps {\r\n const props = super.toJSON() as ElementDrivesElementProps;\r\n props.status = this.status;\r\n props.priority = this.priority;\r\n return props;\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addElement(this.targetId);\r\n }\r\n}\r\n\r\n/** The third (and last) possible link-table relationship base class in an iModel.\r\n * Has no external use, but is included for completeness of the [Entity.collectReferenceIds]($backend)\r\n * implementations for link-table relationships. Generating the types of the source and target automatically would require\r\n * coupling this package with ecschema-metadata which we do not want to do.\r\n * @internal\r\n */\r\nexport class ModelSelectorRefersToModels extends Relationship {\r\n /** @internal */\r\n public static override get className(): string { return \"ModelSelectorRefersToModels\"; }\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addModel(this.targetId);\r\n }\r\n}\r\n\r\n/** Manages [[Relationship]]s.\r\n * @public\r\n */\r\nexport class Relationships {\r\n private _iModel: IModelDb;\r\n\r\n /** @internal */\r\n public constructor(iModel: IModelDb) { this._iModel = iModel; }\r\n\r\n /** Create a new instance of a Relationship.\r\n * @param props The properties of the new Relationship.\r\n * @throws [[IModelError]] if there is a problem creating the Relationship.\r\n */\r\n public createInstance(props: RelationshipProps): Relationship { return this._iModel.constructEntity<Relationship>(props); }\r\n\r\n /** Check classFullName to ensure it is a link table relationship class. */\r\n private checkRelationshipClass(classFullName: string) {\r\n if (!this._iModel.nativeDb.isLinkTableRelationship(classFullName.replace(\".\", \":\"))) {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Class '${classFullName}' must be a relationship class and it should be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.`);\r\n }\r\n }\r\n\r\n /** Insert a new relationship instance into the iModel. The relationship provided must be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.\r\n * @param props The properties of the new relationship.\r\n * @returns The Id of the newly inserted relationship.\r\n * @note The id property of the props object is set as a side effect of this function.\r\n */\r\n public insertInstance(props: RelationshipProps): Id64String {\r\n this.checkRelationshipClass(props.classFullName);\r\n return props.id = this._iModel.nativeDb.insertLinkTableRelationship(props);\r\n }\r\n\r\n /** Update the properties of an existing relationship instance in the iModel.\r\n * @param props the properties of the relationship instance to update. Any properties that are not present will be left unchanged.\r\n */\r\n public updateInstance(props: RelationshipProps): void {\r\n this._iModel.nativeDb.updateLinkTableRelationship(props);\r\n }\r\n\r\n /** Delete an Relationship instance from this iModel. */\r\n public deleteInstance(props: RelationshipProps): void {\r\n this._iModel.nativeDb.deleteLinkTableRelationship(props);\r\n }\r\n\r\n /** Get the props of a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\r\n * @see tryGetInstanceProps\r\n */\r\n public getInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T {\r\n const relationshipProps = this.tryGetInstanceProps<T>(relClassFullName, criteria);\r\n if (undefined === relationshipProps) {\r\n throw new IModelError(IModelStatus.NotFound, \"Relationship not found\");\r\n }\r\n return relationshipProps;\r\n }\r\n\r\n /** Get the props of a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @returns The RelationshipProps or `undefined` if the relationship is not found.\r\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\r\n * @see getInstanceProps\r\n */\r\n public tryGetInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\r\n let props: T | undefined;\r\n if (typeof criteria === \"string\") {\r\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE ecinstanceid=?`, (stmt: ECSqlStatement) => {\r\n stmt.bindId(1, criteria);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\r\n });\r\n } else {\r\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE SourceECInstanceId=? AND TargetECInstanceId=?`, (stmt: ECSqlStatement) => {\r\n stmt.bindId(1, criteria.sourceId);\r\n stmt.bindId(2, criteria.targetId);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\r\n });\r\n }\r\n if (undefined !== props) {\r\n props.classFullName = (props as any).className.replace(\".\", \":\");\r\n }\r\n return props;\r\n }\r\n\r\n /** Get a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\r\n * @see tryGetInstance\r\n */\r\n public getInstance<T extends Relationship>(relClassSqlName: string, criteria: Id64String | SourceAndTarget): T {\r\n return this._iModel.constructEntity<T>(this.getInstanceProps(relClassSqlName, criteria));\r\n }\r\n\r\n /** Get a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @returns The relationship or `undefined` if the relationship is not found.\r\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\r\n * @see getInstance\r\n */\r\n public tryGetInstance<T extends Relationship>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\r\n const relationshipProps = this.tryGetInstanceProps<RelationshipProps>(relClassFullName, criteria);\r\n return undefined !== relationshipProps ? this._iModel.construct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,iBAAiB,gBAAgB,sDAAsD,EAAE,CAAC,IAAoB,EAAE,EAAE;gBAC3J,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAClC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAClC,OAAO,uBAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YACjF,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YACxB,KAAK,CAAC,aAAa,GAAI,KAAa,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAyB,eAAuB,EAAE,QAAsC;QACxG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAyB,gBAAwB,EAAE,QAAsC;QAC5G,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAoB,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAClG,OAAO,SAAS,KAAK,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1G,CAAC;CACF;AAvGD,sCAuGC","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/** @packageDocumentation\r\n * @module Relationships\r\n */\r\n\r\nimport { DbResult, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { EntityReferenceSet, IModelError, IModelStatus, RelationshipProps, SourceAndTarget } from \"@itwin/core-common\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\n\r\nexport type { SourceAndTarget, RelationshipProps } from \"@itwin/core-common\"; // for backwards compatibility\r\n\r\n/** Base class for all link table ECRelationships\r\n * @public\r\n */\r\nexport class Relationship extends Entity {\r\n public static override get className(): string { return \"Relationship\"; }\r\n public readonly sourceId: Id64String;\r\n public readonly targetId: Id64String;\r\n\r\n protected constructor(props: RelationshipProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.sourceId = Id64.fromJSON(props.sourceId);\r\n this.targetId = Id64.fromJSON(props.targetId);\r\n }\r\n\r\n public override toJSON(): RelationshipProps {\r\n const val = super.toJSON() as RelationshipProps;\r\n val.sourceId = this.sourceId;\r\n val.targetId = this.targetId;\r\n return val;\r\n }\r\n\r\n /**\r\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when its input has changed or is the output of some upstream relationship whose input has changed.\r\n * This callback is invoked after the input element has been processed by upstream relationships.\r\n * A subclass of ElementDrivesElement can re-implement this static method to take some action. onRootChanged may modify the output element only.\r\n * @param _props The ElementDrivesElement relationship instance.\r\n * @param _iModel The iModel\r\n */\r\n public static onRootChanged(_props: RelationshipProps, _iModel: IModelDb): void { }\r\n\r\n /**\r\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when the relationship instance has been deleted.\r\n * A subclass of ElementDrivesElement can re-implement this static method to take some action.\r\n * @param _props The deleted ElementDrivesElement relationship instance.\r\n * @param _iModel The iModel\r\n */\r\n public static onDeletedDependency(_props: RelationshipProps, _iModel: IModelDb): void { }\r\n\r\n /** Insert this Relationship into the iModel. */\r\n public insert(): Id64String { return this.id = this.iModel.relationships.insertInstance(this.toJSON()); }\r\n /** Update this Relationship in the iModel. */\r\n public update() { this.iModel.relationships.updateInstance(this.toJSON()); }\r\n /** Delete this Relationship from the iModel. */\r\n public delete() { this.iModel.relationships.deleteInstance(this.toJSON()); }\r\n\r\n public static getInstance<T extends Relationship>(iModel: IModelDb, criteria: Id64String | SourceAndTarget): T { return iModel.relationships.getInstance(this.classFullName, criteria); }\r\n}\r\n\r\n/** A Relationship where one Element refers to another Element\r\n * @public\r\n */\r\nexport class ElementRefersToElements extends Relationship {\r\n public static override get className(): string { return \"ElementRefersToElements\"; }\r\n /** Create an instance of the Relationship.\r\n * @param iModel The iModel that will contain the relationship\r\n * @param sourceId The sourceId of the relationship, that is, the driver element\r\n * @param targetId The targetId of the relationship, that is, the driven element\r\n * @return an instance of the specified class.\r\n */\r\n public static create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): T {\r\n return iModel.relationships.createInstance({ sourceId, targetId, classFullName: this.classFullName }) as T;\r\n }\r\n /** Insert a new instance of the Relationship.\r\n * @param iModel The iModel that will contain the relationship\r\n * @param sourceId The sourceId of the relationship, that is, the driver element\r\n * @param targetId The targetId of the relationship, that is, the driven element\r\n * @return The Id of the inserted Relationship.\r\n */\r\n public static insert<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): Id64String {\r\n const relationship: T = this.create(iModel, sourceId, targetId);\r\n return iModel.relationships.insertInstance(relationship.toJSON());\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addElement(this.targetId);\r\n }\r\n}\r\n\r\n/** Relates a [[DrawingGraphic]] to the [[Element]] that it represents\r\n * @public\r\n */\r\nexport class DrawingGraphicRepresentsElement extends ElementRefersToElements {\r\n public static override get className(): string { return \"DrawingGraphicRepresentsElement\"; }\r\n}\r\n\r\n/** Relates a [[GraphicalElement3d]] to the [[Element]] that it represents\r\n * @public\r\n */\r\nexport class GraphicalElement3dRepresentsElement extends ElementRefersToElements {\r\n public static override get className(): string { return \"GraphicalElement3dRepresentsElement\"; }\r\n}\r\n\r\n/** Relates a [[SynchronizationConfigLink]] to N [[ExternalSource]] instances.\r\n * Each relationship instance represents an external source processed by the synchronization configuration.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigProcessesSources extends ElementRefersToElements {\r\n public static override get className(): string { return \"SynchronizationConfigProcessesSources\"; }\r\n}\r\n\r\n/** Relates a [[SynchronizationConfigLink]] to *root* [[ExternalSource]] instances.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {\r\n public static override get className(): string { return \"SynchronizationConfigSpecifiesRootSources\"; }\r\n}\r\n\r\n/** Properties that are common to all types of link table ECRelationships\r\n * @public\r\n */\r\nexport interface ElementGroupsMembersProps extends RelationshipProps {\r\n memberPriority: number;\r\n}\r\n\r\n/** An ElementRefersToElements relationship where one Element *groups* a set of other Elements.\r\n * @public\r\n */\r\nexport class ElementGroupsMembers extends ElementRefersToElements {\r\n public static override get className(): string { return \"ElementGroupsMembers\"; }\r\n public memberPriority: number;\r\n\r\n constructor(props: ElementGroupsMembersProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.memberPriority = props.memberPriority;\r\n }\r\n\r\n public static override create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, memberPriority: number = 0): T {\r\n const props: ElementGroupsMembersProps = { sourceId, targetId, memberPriority, classFullName: this.classFullName };\r\n return iModel.relationships.createInstance(props) as T;\r\n }\r\n}\r\n\r\n/** Relates a [[DefinitionGroup]] to its [[DefinitionElement]] members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\r\n * @public\r\n */\r\nexport class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {\r\n public static override get className(): string { return \"DefinitionGroupGroupsDefinitions\"; }\r\n}\r\n\r\n/** Represents group membership where the group Element (and its properties) impart information about the member Elements above mere membership.\r\n * Implies that properties of the group should be considered as properties of its members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.11\r\n * @public\r\n */\r\nexport class GroupImpartsToMembers extends ElementGroupsMembers {\r\n public static override get className(): string { return \"GroupImpartsToMembers\"; }\r\n}\r\n\r\n/** Relates an [[ExternalSourceGroup]] to its [[ExternalSource]] members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {\r\n public static override get className(): string { return \"ExternalSourceGroupGroupsSources\"; }\r\n}\r\n\r\n/** Properties that are common to all types of ElementDrivesElements\r\n * @beta\r\n */\r\nexport interface ElementDrivesElementProps extends RelationshipProps {\r\n status: number;\r\n priority: number;\r\n}\r\n\r\n/** A Relationship indicating that one Element *drives* another Element.\r\n * An ElementDrivesElement relationship defines a one-way \"driving\" relationship from the source to the target.\r\n * When the source of an ElementDrivesElement relationship changes, the ElementDrivesElement itself can get a callback, and both the source and target elements can get callbacks.\r\n * By inserting ElementDrivesElement relationships, an app can create and store an acyclic directed graph of dependencies between elements.\r\n *\r\n * # Defining dependencies\r\n * Create an ElementDrivesElement relationship to specify that the source element drives the target element.\r\n * For example, to specify that element e1 drives element e2, create a relationship between them like this:\r\n * ```ts\r\n * const ede = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * ede.insert();\r\n * ```\r\n * This creates a persistent relationship. The fact that e1 drives e2 is persisted in the iModel.\r\n *\r\n * # Defining dependency graphs\r\n * When you create multiple ElementDrivesElement relationships, you create a network of dependencies. The target of one may be the source of another.\r\n * A change in the content of an DgnElement can therefore trigger changes to many downstream elements.\r\n *\r\n * For example, to make element e1 drive element e2 and e2 drive another element, e3, create two relationships like this:\r\n * ```ts\r\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\r\n * ede12.insert();\r\n * ede23.insert();\r\n * ```\r\n * Those two relationships create this graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n * Where the \"-->\" is meant to represent a driving relationship.\r\n *\r\n * The order in which you create the relationships does not matter.\r\n * The graph indicates that e3 depends on e2 and e2 depends on e1.\r\n *\r\n * An ElementDrivesElement relationship is between one source element and one target element.\r\n * Many ElementDrivesElement relationships can point to a given element, and many can point out of it.\r\n * Thus, you can define many:many relationships.\r\n * For example:\r\n * ```ts\r\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * const ede112 = ElementDrivesElement.create(iModel, e11id, e2id);\r\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\r\n * const ede231 = ElementDrivesElement.create(iModel, e2id, e31id);\r\n * ede12.insert();\r\n * ede112.insert();\r\n * ede23.insert();\r\n * ede231.insert();\r\n * ```\r\n * Creates this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * e2 depends on both e1 and e11. e2 then drives e3 and e31.\r\n *\r\n * In an ElementDrivesElement dependency graph, the relationships are the \"edges\" and the Elements are the \"nodes\".\r\n * The following terms are used when referring to the elements (nodes) in a dependency graph:\r\n * * Inputs - The sources of all edges that point to the element. This includes all upstream elements that flow into the element.\r\n * * Outputs - The targets of all edges that point out of the element. This includes all downstream elements.\r\n *\r\n * # Subgraph Processing\r\n * When changes are made, only the part of the overall graph that is affected will be processed. So, for example,\r\n * suppose we have this graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n * If e1 changes, then the subgraph to be processed is equal to the full graph, as shown.\r\n *\r\n * If only e2 changes, then the subgraph to be processed is just:\r\n * ```\r\n * e2 --> e3\r\n * ```\r\n * If only e3 changes, then the subgraph consists of e3 by itself.\r\n *\r\n * Returning to the second example above, suppose we have this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * If e1 is changed, the affected subgraph is:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * If e2 is changed, the affected subgraph is:\r\n * ```\r\n * e3\r\n * /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * # Callbacks\r\n * Once the affected subgraph to process is found, it propagates changes through it by making callbacks.\r\n * Classes for both elements (nodes) and ElementDrivesElements relationships (edges) can receive callbacks.\r\n *\r\n * ## ElementDrivesElement Callbacks\r\n * The following callbacks are invoked on ElementDrivesElement relationship classes (edges):\r\n * * onRootChanged\r\n * * onDeletedDependency\r\n *\r\n * Note that these are static methods. Their default implementations do nothing.\r\n * To receive and act on these callbacks, a domain should define a subclass of ElementDrivesElement and use that to create relationships.\r\n * The subclass should then implement the callbacks that it would like to act on.\r\n *\r\n * A ElementDrivesElement subclass callback is expected to make changes to the output element only!\r\n *\r\n * ## Element Callbacks\r\n * The following callbacks are invoked on Element classes (nodes):\r\n * * Element.onBeforeOutputsHandled\r\n * * Element.onAllInputsHandled\r\n *\r\n * ## Order\r\n * Callbacks are invoked by BriefcaseDb.saveChanges.\r\n * They are invoked in dependency (topological) order: driving elements first, then driven elements.\r\n *\r\n * Each callback is invoked only once. No matter how many times a given element was changed during the transaction,\r\n * a callback such as ElementDrivesElement.onRootChanged will be invoked only once.\r\n * In the same way, no matter how many of its inputs were changed, a callback such as Element.onAllInputsHandled will be\r\n * invoked only once.\r\n *\r\n * For example, suppose we have a graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n *\r\n * Suppose that e1 is directly modified. No callbacks are made at that time.\r\n * Later, when BriefcaseDb.saveChanges is called, the following callbacks are made, in order:\r\n * 1. Element.onBeforeOutputsHandled e1\r\n * 1. ElementDrivesElement.onRootChanged e1->e2\r\n * 1. Element.onAllInputsHandled e2\r\n * 1. ElementDrivesElement.onRootChanged e2->e3\r\n * 1. Element.onAllInputsHandled e3\r\n *\r\n * Suppose that e3 is modified directly and BriefcaseDb.saveChanges is called.\r\n * Since no input to a relationship was changed, the sub-graph will be empty, and no callbacks will be made.\r\n *\r\n * Returning to the second example above, suppose we have this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * If e1 is changed and BriefcaseDb.saveChanges is called, the subgraph is:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * The callbacks are:\r\n * 1. Element.onBeforeOutputsHandled e1\r\n * 1. ElementDrivesElement.onRootChanged e1->e2\r\n * 1. Element.onAllInputsHandled e2\r\n * 1. ElementDrivesElement.onRootChanged e2->e3\r\n * 1. Element.onAllInputsHandled e3\r\n * 1. ElementDrivesElement.onRootChanged e2->e31\r\n * 1. Element.onAllInputsHandled e31\r\n *\r\n * (The ElementDrivesElement.)\r\n *\r\n * #Errors\r\n * Circular dependencies are not permitted. If a cycle is detected, that is treated as a fatal error. All ElementDrivesElement relationships\r\n * involved in a cycle will have their status set to 1, indicating a failure.\r\n *\r\n * A callback may call txnManager.reportError to reject an invalid change. It can classify the error as fatal or just a warning.\r\n * A callback make set the status value of an ElementDrivesElement instance to 1 to indicate a processing failure in that edge.\r\n *\r\n * After BriefcaseDb.saveChanges is called, an app should check db.txns.validationErrors and db.txns.hasFatalError to find out if graph-evaluation failed.\r\n *\r\n * @beta\r\n */\r\nexport class ElementDrivesElement extends Relationship {\r\n public static override get className(): string { return \"ElementDrivesElement\"; }\r\n /** Relationship status\r\n * * 0 indicates no errors. Set after a successful evaluation.\r\n * * 1 indicates that this driving relationship could not be evaluated. The callback itself can set this to indicate that it failed to process the input changes. Also, it is set if the relationship is part of a circular dependency.\r\n * * 0x80 The app or callback can set this to indicate to not propagate changes through this relationship.\r\n */\r\n public status: number;\r\n /** Affects the order in which relationships are processed in the case where two relationships have the same output. */\r\n public priority: number;\r\n\r\n protected constructor(props: ElementDrivesElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.status = props.status;\r\n this.priority = props.priority;\r\n }\r\n\r\n public static create<T extends ElementDrivesElement>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, priority: number = 0): T {\r\n const props: ElementDrivesElementProps = { sourceId, targetId, priority, status: 0, classFullName: this.classFullName };\r\n return iModel.relationships.createInstance(props) as T;\r\n }\r\n\r\n public override toJSON(): ElementDrivesElementProps {\r\n const props = super.toJSON() as ElementDrivesElementProps;\r\n props.status = this.status;\r\n props.priority = this.priority;\r\n return props;\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addElement(this.targetId);\r\n }\r\n}\r\n\r\n/** The third (and last) possible link-table relationship base class in an iModel.\r\n * Has no external use, but is included for completeness of the [Entity.collectReferenceIds]($backend)\r\n * implementations for link-table relationships. Generating the types of the source and target automatically would require\r\n * coupling this package with ecschema-metadata which we do not want to do.\r\n * @internal\r\n */\r\nexport class ModelSelectorRefersToModels extends Relationship {\r\n public static override get className(): string { return \"ModelSelectorRefersToModels\"; }\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addModel(this.targetId);\r\n }\r\n}\r\n\r\n/** Manages [[Relationship]]s.\r\n * @public\r\n */\r\nexport class Relationships {\r\n private _iModel: IModelDb;\r\n\r\n /** @internal */\r\n public constructor(iModel: IModelDb) { this._iModel = iModel; }\r\n\r\n /** Create a new instance of a Relationship.\r\n * @param props The properties of the new Relationship.\r\n * @throws [[IModelError]] if there is a problem creating the Relationship.\r\n */\r\n public createInstance(props: RelationshipProps): Relationship { return this._iModel.constructEntity<Relationship>(props); }\r\n\r\n /** Check classFullName to ensure it is a link table relationship class. */\r\n private checkRelationshipClass(classFullName: string) {\r\n if (!this._iModel[_nativeDb].isLinkTableRelationship(classFullName.replace(\".\", \":\"))) {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Class '${classFullName}' must be a relationship class and it should be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.`);\r\n }\r\n }\r\n\r\n /** Insert a new relationship instance into the iModel. The relationship provided must be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.\r\n * @param props The properties of the new relationship.\r\n * @returns The Id of the newly inserted relationship.\r\n * @note The id property of the props object is set as a side effect of this function.\r\n */\r\n public insertInstance(props: RelationshipProps): Id64String {\r\n this.checkRelationshipClass(props.classFullName);\r\n return props.id = this._iModel[_nativeDb].insertLinkTableRelationship(props);\r\n }\r\n\r\n /** Update the properties of an existing relationship instance in the iModel.\r\n * @param props the properties of the relationship instance to update. Any properties that are not present will be left unchanged.\r\n */\r\n public updateInstance(props: RelationshipProps): void {\r\n this._iModel[_nativeDb].updateLinkTableRelationship(props);\r\n }\r\n\r\n /** Delete an Relationship instance from this iModel. */\r\n public deleteInstance(props: RelationshipProps): void {\r\n this._iModel[_nativeDb].deleteLinkTableRelationship(props);\r\n }\r\n\r\n /** Get the props of a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\r\n * @see tryGetInstanceProps\r\n */\r\n public getInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T {\r\n const relationshipProps = this.tryGetInstanceProps<T>(relClassFullName, criteria);\r\n if (undefined === relationshipProps) {\r\n throw new IModelError(IModelStatus.NotFound, \"Relationship not found\");\r\n }\r\n return relationshipProps;\r\n }\r\n\r\n /** Get the props of a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @returns The RelationshipProps or `undefined` if the relationship is not found.\r\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\r\n * @see getInstanceProps\r\n */\r\n public tryGetInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\r\n let props: T | undefined;\r\n if (typeof criteria === \"string\") {\r\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE ecinstanceid=?`, (stmt: ECSqlStatement) => {\r\n stmt.bindId(1, criteria);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\r\n });\r\n } else {\r\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE SourceECInstanceId=? AND TargetECInstanceId=?`, (stmt: ECSqlStatement) => {\r\n stmt.bindId(1, criteria.sourceId);\r\n stmt.bindId(2, criteria.targetId);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\r\n });\r\n }\r\n if (undefined !== props) {\r\n props.classFullName = (props as any).className.replace(\".\", \":\");\r\n }\r\n return props;\r\n }\r\n\r\n /** Get a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\r\n * @see tryGetInstance\r\n */\r\n public getInstance<T extends Relationship>(relClassSqlName: string, criteria: Id64String | SourceAndTarget): T {\r\n return this._iModel.constructEntity<T>(this.getInstanceProps(relClassSqlName, criteria));\r\n }\r\n\r\n /** Get a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @returns The relationship or `undefined` if the relationship is not found.\r\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\r\n * @see getInstance\r\n */\r\n public tryGetInstance<T extends Relationship>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\r\n const relationshipProps = this.tryGetInstanceProps<RelationshipProps>(relClassFullName, criteria);\r\n return undefined !== relationshipProps ? this._iModel.constructEntity<T>(relationshipProps) : undefined;\r\n }\r\n}\r\n"]}
@@ -6,13 +6,18 @@ import { DbResult, OpenMode } from "@itwin/core-bentley";
6
6
  import { LocalFileName } from "@itwin/core-common";
7
7
  import { CloudSqlite } from "./CloudSqlite";
8
8
  import { SqliteStatement } from "./SqliteStatement";
9
+ import { _nativeDb } from "./internal/Symbols";
9
10
  /**
10
11
  * A "generic" SQLiteDb. This class may be used to access local files or databases in a cloud container.
11
12
  * @public
12
13
  */
13
14
  export declare class SQLiteDb {
15
+ /** @internal
16
+ * @deprecated in 4.8. This internal API will be removed in 5.0. Use SQLiteDb's public API instead.
17
+ */
18
+ get nativeDb(): IModelJsNative.SQLiteDb;
14
19
  /** @internal */
15
- readonly nativeDb: IModelJsNative.SQLiteDb;
20
+ readonly [_nativeDb]: IModelJsNative.SQLiteDb;
16
21
  private _sqliteStatementCache;
17
22
  /** @internal */
18
23
  static createBlobIO(): SQLiteDb.BlobIO;
@@ -167,13 +172,12 @@ export declare abstract class VersionedSqliteDb extends SQLiteDb {
167
172
  /**
168
173
  * Implement this method to create all tables for this subclass of `VersionedSqliteDb` when a new database file is created. Called from [[createNewDb]].
169
174
  */
170
- protected abstract createDDL(): void;
175
+ protected abstract createDDL(args: any): void;
171
176
  /**
172
177
  * Create a new database file for the subclass of VersionedSqliteDb.
173
- * @param fileName the name of a local
174
178
  * @note The required versions are saved as [[myVersion]] or newer for both read and write.
175
179
  */
176
- static createNewDb(fileName: LocalFileName): void;
180
+ static createNewDb(fileName: LocalFileName, setupArgs?: any): void;
177
181
  /**
178
182
  * Verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.
179
183
  * Throws otherwise.
@@ -1 +1 @@
1
- {"version":3,"file":"SQLiteDb.d.ts","sourceRoot":"","sources":["../../src/SQLiteDb.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CA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ACtB;CACF"}
@@ -6,6 +6,7 @@
6
6
  /** @packageDocumentation
7
7
  * @module SQLiteDb
8
8
  */
9
+ var _a;
9
10
  Object.defineProperty(exports, "__esModule", { value: true });
10
11
  exports.VersionedSqliteDb = exports.SQLiteDb = void 0;
11
12
  const fs = require("fs");
@@ -13,9 +14,10 @@ const path_1 = require("path");
13
14
  const semver = require("semver");
14
15
  const core_bentley_1 = require("@itwin/core-bentley");
15
16
  const CloudSqlite_1 = require("./CloudSqlite");
16
- const IModelHost_1 = require("./IModelHost");
17
+ const NativePlatform_1 = require("./internal/NativePlatform");
17
18
  const IModelJsFs_1 = require("./IModelJsFs");
18
19
  const SqliteStatement_1 = require("./SqliteStatement");
20
+ const Symbols_1 = require("./internal/Symbols");
19
21
  // cspell:ignore savepoint julianday rowid
20
22
  /* eslint-disable @typescript-eslint/unified-signatures */
21
23
  /**
@@ -25,12 +27,16 @@ const SqliteStatement_1 = require("./SqliteStatement");
25
27
  class SQLiteDb {
26
28
  constructor() {
27
29
  /** @internal */
28
- this.nativeDb = new IModelHost_1.IModelHost.platform.SQLiteDb();
30
+ this[_a] = new NativePlatform_1.IModelNative.platform.SQLiteDb();
29
31
  this._sqliteStatementCache = new SqliteStatement_1.StatementCache();
30
32
  }
33
+ /** @internal
34
+ * @deprecated in 4.8. This internal API will be removed in 5.0. Use SQLiteDb's public API instead.
35
+ */
36
+ get nativeDb() { return this[Symbols_1._nativeDb]; }
31
37
  /** @internal */
32
38
  static createBlobIO() {
33
- return new IModelHost_1.IModelHost.platform.BlobIO();
39
+ return new NativePlatform_1.IModelNative.platform.BlobIO();
34
40
  }
35
41
  /** alias for closeDb.
36
42
  * @deprecated in 4.0, use [[closeDb]]
@@ -39,10 +45,10 @@ class SQLiteDb {
39
45
  this.closeDb();
40
46
  }
41
47
  createDb(dbName, container, params) {
42
- this.nativeDb.createDb(dbName, container, params);
48
+ this[Symbols_1._nativeDb].createDb(dbName, container, params);
43
49
  }
44
50
  openDb(dbName, openMode, container) {
45
- this.nativeDb.openDb(dbName, openMode, container);
51
+ this[Symbols_1._nativeDb].openDb(dbName, openMode, container);
46
52
  }
47
53
  /** Close SQLiteDb.
48
54
  * @param saveChanges if true, call `saveChanges` before closing db. Otherwise unsaved changes are abandoned.
@@ -51,12 +57,12 @@ class SQLiteDb {
51
57
  if (saveChanges && this.isOpen)
52
58
  this.saveChanges();
53
59
  this._sqliteStatementCache.clear();
54
- this.nativeDb.closeDb();
60
+ this[Symbols_1._nativeDb].closeDb();
55
61
  }
56
62
  /** Returns true if this SQLiteDb is open */
57
- get isOpen() { return this.nativeDb.isOpen(); }
63
+ get isOpen() { return this[Symbols_1._nativeDb].isOpen(); }
58
64
  /** Returns true if this SQLiteDb is open readonly */
59
- get isReadonly() { return this.nativeDb.isReadonly(); }
65
+ get isReadonly() { return this[Symbols_1._nativeDb].isReadonly(); }
60
66
  /** Create a new table in this database. */
61
67
  createTable(args) {
62
68
  const timestampCol = args.addTimestamp ? ",lastMod TIMESTAMP NOT NULL DEFAULT(julianday('now'))" : "";
@@ -122,15 +128,15 @@ class SQLiteDb {
122
128
  * @see https://www.sqlite.org/lang_vacuum.html
123
129
  */
124
130
  vacuum(args) {
125
- this.nativeDb.vacuum(args);
131
+ this[Symbols_1._nativeDb].vacuum(args);
126
132
  }
127
133
  /** Commit the outermost transaction, writing changes to the file. Then, restart the default transaction. */
128
134
  saveChanges() {
129
- this.nativeDb.saveChanges();
135
+ this[Symbols_1._nativeDb].saveChanges();
130
136
  }
131
137
  /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the default transaction. */
132
138
  abandonChanges() {
133
- this.nativeDb.abandonChanges();
139
+ this[Symbols_1._nativeDb].abandonChanges();
134
140
  }
135
141
  /**
136
142
  * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist
@@ -201,7 +207,7 @@ class SQLiteDb {
201
207
  */
202
208
  prepareSqliteStatement(sql, logErrors = true) {
203
209
  const stmt = new SqliteStatement_1.SqliteStatement(sql);
204
- stmt.prepare(this.nativeDb, logErrors);
210
+ stmt.prepare(this[Symbols_1._nativeDb], logErrors);
205
211
  return stmt;
206
212
  }
207
213
  /** execute an SQL statement */
@@ -216,6 +222,7 @@ class SQLiteDb {
216
222
  }
217
223
  }
218
224
  exports.SQLiteDb = SQLiteDb;
225
+ _a = Symbols_1._nativeDb;
219
226
  /**
220
227
  * Abstract base class for a SQLite database that has [[SQLiteDb.RequiredVersionRanges]] stored in it.
221
228
  * This class provides version checking when the database is opened, to guarantee that a valid version of software is
@@ -236,16 +243,16 @@ class VersionedSqliteDb extends SQLiteDb {
236
243
  */
237
244
  setRequiredVersions(versions) {
238
245
  // NOTE: It might look tempting to just stringify the supplied `versions` object, but we only include required members - there may be others.
239
- this.nativeDb.saveFileProperty(VersionedSqliteDb._versionProps, JSON.stringify({ readVersion: versions.readVersion, writeVersion: versions.writeVersion }));
246
+ this[Symbols_1._nativeDb].saveFileProperty(VersionedSqliteDb._versionProps, JSON.stringify({ readVersion: versions.readVersion, writeVersion: versions.writeVersion }));
240
247
  }
241
248
  /** Get the required version ranges necessary to open this VersionedSqliteDb. */
242
249
  getRequiredVersions() {
243
250
  const checkIsString = (value) => {
244
251
  if (typeof value !== "string")
245
- throw new Error(`CloudDb ${this.nativeDb.getFilePath()} has invalid "versions" property`);
252
+ throw new Error(`CloudDb ${this[Symbols_1._nativeDb].getFilePath()} has invalid "versions" property`);
246
253
  return value;
247
254
  };
248
- const versionJson = checkIsString(this.nativeDb.queryFileProperty(VersionedSqliteDb._versionProps, true));
255
+ const versionJson = checkIsString(this[Symbols_1._nativeDb].queryFileProperty(VersionedSqliteDb._versionProps, true));
249
256
  const versionRanges = JSON.parse(versionJson);
250
257
  checkIsString(versionRanges.readVersion);
251
258
  checkIsString(versionRanges.writeVersion);
@@ -253,16 +260,15 @@ class VersionedSqliteDb extends SQLiteDb {
253
260
  }
254
261
  /**
255
262
  * Create a new database file for the subclass of VersionedSqliteDb.
256
- * @param fileName the name of a local
257
263
  * @note The required versions are saved as [[myVersion]] or newer for both read and write.
258
264
  */
259
- static createNewDb(fileName) {
265
+ static createNewDb(fileName, setupArgs) {
260
266
  const db = new this(); // "as any" necessary because VersionedSqliteDb is abstract
261
267
  IModelJsFs_1.IModelJsFs.recursiveMkDirSync((0, path_1.dirname)(fileName));
262
268
  if (fs.existsSync(fileName))
263
269
  fs.unlinkSync(fileName);
264
270
  db.createDb(fileName);
265
- db.createDDL();
271
+ db.createDDL(setupArgs);
266
272
  const minVer = `^${db.myVersion}`;
267
273
  db.setRequiredVersions({ readVersion: minVer, writeVersion: minVer });
268
274
  db.closeDb(true);
@@ -279,7 +285,7 @@ class VersionedSqliteDb extends SQLiteDb {
279
285
  return;
280
286
  this.closeDb();
281
287
  const tooNew = semver.gtr(this.myVersion, range);
282
- throw new Error(`${this.nativeDb.getFilePath()} requires ${tooNew ? "older" : "newer"} version of ${this.constructor.name} for ${isReadonly ? "read" : "write"}`);
288
+ throw new Error(`${this[Symbols_1._nativeDb].getFilePath()} requires ${tooNew ? "older" : "newer"} version of ${this.constructor.name} for ${isReadonly ? "read" : "write"}`);
283
289
  }
284
290
  /**
285
291
  * Open this database and verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.