@itwin/core-backend 5.14.0-dev.2 → 5.14.0-dev.21
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.
- package/CHANGELOG.md +53 -1
- package/lib/cjs/BriefcaseManager.d.ts +6 -0
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +12 -6
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/ChangesetReader.d.ts +1 -1
- package/lib/cjs/ChangesetReader.d.ts.map +1 -1
- package/lib/cjs/ChangesetReader.js +3 -2
- package/lib/cjs/ChangesetReader.js.map +1 -1
- package/lib/cjs/ChangesetReaderTypes.d.ts +6 -2
- package/lib/cjs/ChangesetReaderTypes.d.ts.map +1 -1
- package/lib/cjs/ChangesetReaderTypes.js +3 -0
- package/lib/cjs/ChangesetReaderTypes.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +9 -2
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +52 -0
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +52 -0
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/Element.d.ts +1 -1
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +7 -4
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/Entity.d.ts +3 -3
- package/lib/cjs/Entity.js +3 -3
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +83 -35
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +203 -89
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +51 -17
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/SchemaSync.d.ts +126 -18
- package/lib/cjs/SchemaSync.d.ts.map +1 -1
- package/lib/cjs/SchemaSync.js +303 -81
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts +16 -8
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +11 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SynchronousChannel.d.ts +11 -1
- package/lib/cjs/SynchronousChannel.d.ts.map +1 -1
- package/lib/cjs/SynchronousChannel.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +20 -13
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/internal/IntegrityCheck.d.ts +57 -0
- package/lib/cjs/internal/IntegrityCheck.d.ts.map +1 -1
- package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
- package/lib/cjs/internal/SchemaSyncReservations.d.ts.map +1 -1
- package/lib/cjs/internal/SchemaSyncReservations.js +13 -3
- package/lib/cjs/internal/SchemaSyncReservations.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +6 -0
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +12 -6
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/ChangesetReader.d.ts +1 -1
- package/lib/esm/ChangesetReader.d.ts.map +1 -1
- package/lib/esm/ChangesetReader.js +3 -2
- package/lib/esm/ChangesetReader.js.map +1 -1
- package/lib/esm/ChangesetReaderTypes.d.ts +6 -2
- package/lib/esm/ChangesetReaderTypes.d.ts.map +1 -1
- package/lib/esm/ChangesetReaderTypes.js +3 -0
- package/lib/esm/ChangesetReaderTypes.js.map +1 -1
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js +10 -3
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/ECDb.d.ts +52 -0
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +52 -0
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/Element.d.ts +1 -1
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +7 -4
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/Entity.d.ts +3 -3
- package/lib/esm/Entity.js +3 -3
- package/lib/esm/Entity.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +83 -35
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +203 -89
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IpcHost.d.ts.map +1 -1
- package/lib/esm/IpcHost.js +52 -18
- package/lib/esm/IpcHost.js.map +1 -1
- package/lib/esm/SchemaSync.d.ts +126 -18
- package/lib/esm/SchemaSync.d.ts.map +1 -1
- package/lib/esm/SchemaSync.js +304 -82
- package/lib/esm/SchemaSync.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.d.ts +16 -8
- package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/esm/SqliteChangesetReader.js +11 -1
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/SynchronousChannel.d.ts +11 -1
- package/lib/esm/SynchronousChannel.d.ts.map +1 -1
- package/lib/esm/SynchronousChannel.js.map +1 -1
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +21 -14
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/internal/IntegrityCheck.d.ts +57 -0
- package/lib/esm/internal/IntegrityCheck.d.ts.map +1 -1
- package/lib/esm/internal/IntegrityCheck.js.map +1 -1
- package/lib/esm/internal/SchemaSyncReservations.d.ts.map +1 -1
- package/lib/esm/internal/SchemaSyncReservations.js +13 -3
- package/lib/esm/internal/SchemaSyncReservations.js.map +1 -1
- package/lib/esm/test/annotations/FrameGeometry.test.js +1 -1
- package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
- package/lib/esm/test/ecdb/CSVImport.test.d.ts +2 -0
- package/lib/esm/test/ecdb/CSVImport.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/CSVImport.test.js +186 -0
- package/lib/esm/test/ecdb/CSVImport.test.js.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js +19 -2
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js +7 -0
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +86 -7
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +65 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +3 -1
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SemanticRebase.test.js +218 -28
- package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.d.ts +3 -0
- package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.js +15 -0
- package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.js.map +1 -0
- package/lib/esm/test/imodel/IModelElements.test.js +5 -0
- package/lib/esm/test/imodel/IModelElements.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +111 -2
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js +61 -0
- package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js.map +1 -1
- package/lib/esm/test/standalone/SQLiteDb.test.d.ts.map +1 -1
- package/lib/esm/test/standalone/SQLiteDb.test.js +116 -0
- package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
- package/lib/esm/test/standalone/SchemaSyncDb.test.js +5 -25
- package/lib/esm/test/standalone/SchemaSyncDb.test.js.map +1 -1
- package/lib/esm/test/standalone/SchemaSyncElementReservation.test.js +1 -0
- package/lib/esm/test/standalone/SchemaSyncElementReservation.test.js.map +1 -1
- package/package.json +13 -13
|
@@ -96,117 +96,174 @@ type IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResult
|
|
|
96
96
|
* Return type for quick integrity check
|
|
97
97
|
*/
|
|
98
98
|
export interface QuickIntegrityCheckResultRow {
|
|
99
|
+
/** Name of the integrity check. */
|
|
99
100
|
check: string;
|
|
101
|
+
/** Whether the check passed. Quick checks do not include problem details. */
|
|
100
102
|
passed: boolean;
|
|
103
|
+
/** Elapsed time for the check, in seconds. */
|
|
101
104
|
elapsedSeconds: string;
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
104
107
|
* Return type for Check Data Columns integrity check
|
|
105
108
|
*/
|
|
106
109
|
export interface CheckDataColumnsResultRow {
|
|
110
|
+
/** Sequential result row number. */
|
|
107
111
|
sno: number;
|
|
112
|
+
/** Mapped data table containing a missing column. */
|
|
108
113
|
table: string;
|
|
114
|
+
/** Name of the missing nonvirtual physical column. */
|
|
109
115
|
column: string;
|
|
110
116
|
}
|
|
111
117
|
/**
|
|
112
118
|
* Return type for Check EC Profile integrity check
|
|
113
119
|
*/
|
|
114
120
|
export interface CheckECProfileResultRow {
|
|
121
|
+
/** Sequential result row number. */
|
|
115
122
|
sno: number;
|
|
123
|
+
/** Type of EC profile object, such as a table, index, or iModel trigger. */
|
|
116
124
|
type: string;
|
|
125
|
+
/** Name of the EC profile object. */
|
|
117
126
|
name: string;
|
|
127
|
+
/** Description of the missing or mismatching object definition. */
|
|
118
128
|
issue: string;
|
|
119
129
|
}
|
|
120
130
|
/**
|
|
121
131
|
* Return type for Check Navigation Class Ids integrity check
|
|
122
132
|
*/
|
|
123
133
|
export interface CheckNavClassIdsResultRow {
|
|
134
|
+
/** Sequential result row number. */
|
|
124
135
|
sno: number;
|
|
136
|
+
/** ID of the source instance row containing the navigation property. */
|
|
125
137
|
id: string;
|
|
138
|
+
/** Declaring or scanned class for the source row; rows from derived classes may be included. */
|
|
126
139
|
class: string;
|
|
140
|
+
/** Name of the navigation property. */
|
|
127
141
|
property: string;
|
|
142
|
+
/** ID of the referenced instance stored by the navigation property. */
|
|
128
143
|
navId: string;
|
|
144
|
+
/** Relationship class ID stored by the navigation property, not the target instance class ID. */
|
|
129
145
|
navClassId: string;
|
|
130
146
|
}
|
|
131
147
|
/**
|
|
132
148
|
* Return type for Check Navigation Ids integrity check
|
|
133
149
|
*/
|
|
134
150
|
export interface CheckNavIdsResultRow {
|
|
151
|
+
/** Sequential result row number. */
|
|
135
152
|
sno: number;
|
|
153
|
+
/** ID of the source instance row containing the navigation property. */
|
|
136
154
|
id: string;
|
|
155
|
+
/** Declaring or scanned class for the source row; rows from derived classes may be included. */
|
|
137
156
|
class: string;
|
|
157
|
+
/** Name of the navigation property. */
|
|
138
158
|
property: string;
|
|
159
|
+
/** ID of the referenced instance stored by the navigation property. */
|
|
139
160
|
navId: string;
|
|
161
|
+
/** Class queried for the referenced row: the first relationship constraint class in the navigation direction, including derived classes. */
|
|
140
162
|
primaryClass: string;
|
|
141
163
|
}
|
|
142
164
|
/**
|
|
143
165
|
* Return type for Check Link Table Foreign Key Class Ids integrity check
|
|
144
166
|
*/
|
|
145
167
|
export interface CheckLinkTableFkClassIdsResultRow {
|
|
168
|
+
/** Sequential result row number. */
|
|
146
169
|
sno: number;
|
|
170
|
+
/** ID of the relationship row containing the foreign key. */
|
|
147
171
|
id: string;
|
|
172
|
+
/** Link-table relationship class. */
|
|
148
173
|
relationship: string;
|
|
174
|
+
/** Endpoint class-ID property: SourceECClassId or TargetECClassId. */
|
|
149
175
|
property: string;
|
|
176
|
+
/** Source or target endpoint instance ID stored in the link table. */
|
|
150
177
|
keyId: string;
|
|
178
|
+
/** Source or target endpoint class ID; the check verifies that the class exists. */
|
|
151
179
|
keyClassId: string;
|
|
152
180
|
}
|
|
153
181
|
/**
|
|
154
182
|
* Return type for Check Link Table Foreign Key Ids integrity check
|
|
155
183
|
*/
|
|
156
184
|
export interface CheckLinkTableFkIdsResultRow {
|
|
185
|
+
/** Sequential result row number. */
|
|
157
186
|
sno: number;
|
|
187
|
+
/** ID of the relationship row containing the foreign key. */
|
|
158
188
|
id: string;
|
|
189
|
+
/** Link-table relationship class. */
|
|
159
190
|
relationship: string;
|
|
191
|
+
/** Endpoint instance-ID property: SourceECInstanceId or TargetECInstanceId. */
|
|
160
192
|
property: string;
|
|
193
|
+
/** Source or target endpoint instance ID stored in the link table. */
|
|
161
194
|
keyId: string;
|
|
195
|
+
/** Class queried for the referenced endpoint row: the first endpoint constraint class, including derived classes. */
|
|
162
196
|
primaryClass: string;
|
|
163
197
|
}
|
|
164
198
|
/**
|
|
165
199
|
* Return type for Check Class Ids integrity check
|
|
166
200
|
*/
|
|
167
201
|
export interface CheckClassIdsResultRow {
|
|
202
|
+
/** Sequential result row number. */
|
|
168
203
|
sno: number;
|
|
204
|
+
/** Declaring or scanned class for the row; rows from derived classes may be included. */
|
|
169
205
|
class: string;
|
|
206
|
+
/** ECInstanceId for primary/joined results, or the physical RowId for overflow results. */
|
|
170
207
|
id: string;
|
|
208
|
+
/** Persisted ECClassId value with no matching class definition. */
|
|
171
209
|
classId: string;
|
|
210
|
+
/** Check category: "primary", "joined", or "overflow". */
|
|
172
211
|
type: string;
|
|
173
212
|
}
|
|
174
213
|
/**
|
|
175
214
|
* Return type for Check Data Schema integrity check
|
|
176
215
|
*/
|
|
177
216
|
export interface CheckDataSchemaResultRow {
|
|
217
|
+
/** Sequential result row number. */
|
|
178
218
|
sno: number;
|
|
219
|
+
/** Type of missing mapped schema object, such as a table or index. */
|
|
179
220
|
type: string;
|
|
221
|
+
/** Name of the missing mapped schema object. */
|
|
180
222
|
name: string;
|
|
181
223
|
}
|
|
182
224
|
/**
|
|
183
225
|
* Return type for Check Schema Load integrity check
|
|
184
226
|
*/
|
|
185
227
|
export interface CheckSchemaLoadResultRow {
|
|
228
|
+
/** Sequential result row number. */
|
|
186
229
|
sno: number;
|
|
230
|
+
/** Name of the schema that the schema manager could not load. */
|
|
187
231
|
schema: string;
|
|
188
232
|
}
|
|
189
233
|
/**
|
|
190
234
|
* Return type for Check Missing Child Rows integrity check
|
|
191
235
|
*/
|
|
192
236
|
export interface CheckMissingChildRowsResultRow {
|
|
237
|
+
/** Sequential result row number. */
|
|
193
238
|
sno: number;
|
|
239
|
+
/** Class used to identify the checked rows: "BisCore:Element". */
|
|
194
240
|
class: string;
|
|
241
|
+
/** ID of the existing bis_Element row missing a required child row. */
|
|
195
242
|
id: string;
|
|
243
|
+
/** Persisted ECClassId of the existing element row. */
|
|
196
244
|
classId: string;
|
|
245
|
+
/** Comma-separated names of all child tables checked for the row, not only tables with a missing child row. */
|
|
197
246
|
missingRowInTables: string;
|
|
198
247
|
}
|
|
199
248
|
/**
|
|
200
249
|
* Return type for Check Diverged Property Maps integrity check
|
|
201
250
|
*/
|
|
202
251
|
export interface CheckDivergedPropMapsResultRow {
|
|
252
|
+
/** Sequential result row number. */
|
|
203
253
|
sno: number;
|
|
254
|
+
/** ID of the derived class whose inherited property map diverges. */
|
|
204
255
|
derivedClassId: Id64String;
|
|
256
|
+
/** Name of the derived class whose inherited property map diverges. */
|
|
205
257
|
derivedClassName: string;
|
|
258
|
+
/** ID of the base class whose mapping was compared with the derived class. */
|
|
206
259
|
baseClassId: Id64String;
|
|
260
|
+
/** Name of the base class whose mapping was compared with the derived class. */
|
|
207
261
|
baseClassName: string;
|
|
262
|
+
/** Access path of the inherited property with different column mappings. */
|
|
208
263
|
propertyName: string;
|
|
264
|
+
/** Base class mapping, formatted as table.column. */
|
|
209
265
|
baseColumn: string;
|
|
266
|
+
/** Derived class mapping, formatted as table.column. */
|
|
210
267
|
divergedColumn: string;
|
|
211
268
|
}
|
|
212
269
|
/**
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AE,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,CAAC,cAAc,EAAE,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;YAC7Q,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD;YACE,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;IACnF,CAAC;AACH,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 { Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"../IModelDb\";\r\n\r\n/**\r\n * Information about each integrity check type, including the name, expected result type, and SQL query to execute\r\n * @internal\r\n */\r\nexport const integrityCheckTypeMap = {\r\n checkDataColumns: {\r\n name: \"Check Data Columns\",\r\n resultType: \"CheckDataColumnsResultRow\",\r\n sqlCommand: \"check_data_columns\",\r\n sqlQuery: `PRAGMA integrity_check(check_data_columns) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkECProfile: {\r\n name: \"Check EC Profile\",\r\n resultType: \"CheckECProfileResultRow\",\r\n sqlCommand: \"check_ec_profile\",\r\n sqlQuery: `PRAGMA integrity_check(check_ec_profile) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkNavigationClassIds: {\r\n name: \"Check Navigation Class Ids\",\r\n resultType: \"CheckNavClassIdsResultRow\",\r\n sqlCommand: \"check_nav_class_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkNavigationIds: {\r\n name: \"Check Navigation Ids\",\r\n resultType: \"CheckNavIdsResultRow\",\r\n sqlCommand: \"check_nav_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_nav_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkLinktableForeignKeyClassIds: {\r\n name: \"Check Link Table Foreign Key Class Ids\",\r\n resultType: \"CheckLinkTableFkClassIdsResultRow\",\r\n sqlCommand: \"check_linktable_fk_class_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkLinktableForeignKeyIds: {\r\n name: \"Check Link Table Foreign Key Ids\",\r\n resultType: \"CheckLinkTableFkIdsResultRow\",\r\n sqlCommand: \"check_linktable_fk_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkClassIds: {\r\n name: \"Check Class Ids\",\r\n resultType: \"CheckClassIdsResultRow\",\r\n sqlCommand: \"check_class_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkDataSchema: {\r\n name: \"Check Data Schema\",\r\n resultType: \"CheckDataSchemaResultRow\",\r\n sqlCommand: \"check_data_schema\",\r\n sqlQuery: `PRAGMA integrity_check(check_data_schema) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkSchemaLoad: {\r\n name: \"Check Schema Load\",\r\n resultType: \"CheckSchemaLoadResultRow\",\r\n sqlCommand: \"check_schema_load\",\r\n sqlQuery: `PRAGMA integrity_check(check_schema_load) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkMissingChildRows: {\r\n name: \"Check Missing Child Rows\",\r\n resultType: \"CheckMissingChildRowsResultRow\",\r\n sqlCommand: \"check_missing_child_rows\",\r\n sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkDivergedPropMaps: {\r\n name: \"Check Diverged Property Maps\",\r\n resultType: \"CheckDivergedPropMapsResultRow\",\r\n sqlCommand: \"check_diverged_prop_maps\",\r\n sqlQuery: `PRAGMA integrity_check(check_diverged_prop_maps) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n} as const;\r\n\r\n/**\r\n * Type representing the keys of the integrityCheckType map, which correspond to the different types of integrity checks that can be performed.\r\n */\r\nexport type IntegrityCheckKey = keyof typeof integrityCheckTypeMap;\r\n\r\n/** Map of integrity check keys to their result row types */\r\ninterface IntegrityCheckResultTypeMap {\r\n checkDataColumns: CheckDataColumnsResultRow;\r\n checkECProfile: CheckECProfileResultRow;\r\n checkNavigationClassIds: CheckNavClassIdsResultRow;\r\n checkNavigationIds: CheckNavIdsResultRow;\r\n checkLinktableForeignKeyClassIds: CheckLinkTableFkClassIdsResultRow;\r\n checkLinktableForeignKeyIds: CheckLinkTableFkIdsResultRow;\r\n checkClassIds: CheckClassIdsResultRow;\r\n checkDataSchema: CheckDataSchemaResultRow;\r\n checkSchemaLoad: CheckSchemaLoadResultRow;\r\n checkMissingChildRows: CheckMissingChildRowsResultRow;\r\n checkDivergedPropMaps: CheckDivergedPropMapsResultRow;\r\n}\r\n\r\n/** Checks the Map to give the return type of a specific integrity check */\r\ntype IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResultTypeMap[K];\r\n\r\n/**\r\n * Return type for quick integrity check\r\n */\r\nexport interface QuickIntegrityCheckResultRow {\r\n check: string;\r\n passed: boolean;\r\n elapsedSeconds: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Data Columns integrity check\r\n */\r\nexport interface CheckDataColumnsResultRow {\r\n sno: number;\r\n table: string;\r\n column: string;\r\n}\r\n\r\n/**\r\n * Return type for Check EC Profile integrity check\r\n */\r\nexport interface CheckECProfileResultRow {\r\n sno: number;\r\n type: string;\r\n name: string;\r\n issue: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Navigation Class Ids integrity check\r\n */\r\nexport interface CheckNavClassIdsResultRow {\r\n sno: number;\r\n id: string;\r\n class: string;\r\n property: string;\r\n navId: string;\r\n navClassId: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Navigation Ids integrity check\r\n */\r\nexport interface CheckNavIdsResultRow {\r\n sno: number;\r\n id: string;\r\n class: string;\r\n property: string;\r\n navId: string;\r\n primaryClass: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Link Table Foreign Key Class Ids integrity check\r\n */\r\nexport interface CheckLinkTableFkClassIdsResultRow {\r\n sno: number;\r\n id: string;\r\n relationship: string;\r\n property: string;\r\n keyId: string;\r\n keyClassId: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Link Table Foreign Key Ids integrity check\r\n */\r\nexport interface CheckLinkTableFkIdsResultRow {\r\n sno: number;\r\n id: string;\r\n relationship: string;\r\n property: string;\r\n keyId: string;\r\n primaryClass: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Class Ids integrity check\r\n */\r\nexport interface CheckClassIdsResultRow {\r\n sno: number;\r\n class: string;\r\n id: string;\r\n classId: string;\r\n type: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Data Schema integrity check\r\n */\r\nexport interface CheckDataSchemaResultRow {\r\n sno: number;\r\n type: string;\r\n name: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Schema Load integrity check\r\n */\r\nexport interface CheckSchemaLoadResultRow {\r\n sno: number;\r\n schema: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Missing Child Rows integrity check\r\n */\r\nexport interface CheckMissingChildRowsResultRow {\r\n sno: number;\r\n class: string;\r\n id: string;\r\n classId: string;\r\n missingRowInTables: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Diverged Property Maps integrity check\r\n */\r\nexport interface CheckDivergedPropMapsResultRow {\r\n sno: number;\r\n derivedClassId: Id64String;\r\n derivedClassName: string;\r\n baseClassId: Id64String;\r\n baseClassName: string;\r\n propertyName: string;\r\n baseColumn: string;\r\n divergedColumn: string;\r\n}\r\n\r\n/**\r\n * Return type for integrity check results, including the check name, whether it passed, and the specific results (if any)\r\n */\r\nexport interface IntegrityCheckResult {\r\n /** The name of the integrity check that was performed */\r\n check: string;\r\n /** Whether the integrity check passed (i.e. no issues were found = true) */\r\n passed: boolean;\r\n /** The specific results returned by the integrity check, which may include details about any issues that were found.\r\n * In the case where issues are found, this will be an array of result rows specific to the type of check that was performed,\r\n * or an array of quick integrity check results if it was a quick check. */\r\n results: IntegrityCheckResultRow<IntegrityCheckKey>[] | QuickIntegrityCheckResultRow[];\r\n}\r\n\r\n/**\r\n * Gets the user-friendly name of an integrity check based on its key or SQL command.\r\n * It first attempts to find a direct match for the key in the integrityCheckTypeMap. If not found, it searches for a match based on the SQL command.\r\n * If still not found, it returns the original check string.\r\n * @param check - The integrity check key or SQL command to get the name of\r\n * @returns The user-friendly name of the integrity check, or the original check string if no match is found\r\n * @internal\r\n */\r\nexport function getIntegrityCheckName(check: string): string {\r\n // First try direct lookup by key\r\n const directLookup = integrityCheckTypeMap[check as IntegrityCheckKey];\r\n if (directLookup) {\r\n return directLookup.name;\r\n }\r\n // If not found, search by sqlCommand\r\n for (const [, value] of Object.entries(integrityCheckTypeMap)) {\r\n if (value.sqlCommand === check) {\r\n return value.name;\r\n }\r\n }\r\n // Fallback to the original check string\r\n return check;\r\n}\r\n\r\n/**\r\n * Performs a quick integrity check on the given iModel.\r\n * @param iModel The IModelDb instance to perform the integrity check on\r\n * @returns An array of results for each check performed, including the check name, whether it passed, and the elapsed time in seconds\r\n * @internal\r\n */\r\nexport async function performQuickIntegrityCheck(iModel: IModelDb): Promise<QuickIntegrityCheckResultRow[]> {\r\n const integrityCheckQuery = \"PRAGMA integrity_check ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES\";\r\n const integrityCheckResults: QuickIntegrityCheckResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckQuery, undefined, { usePrimaryConn: true })) {\r\n integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec });\r\n };\r\n return integrityCheckResults;\r\n}\r\n\r\n/**\r\n * Performs a specific integrity check on the given iModel based on the provided check key, and returns the results specific to that check type.\r\n * @param iModel The IModelDb instance to perform the integrity check on\r\n * @param check The key of the specific integrity check to perform\r\n * @return An array of results specific to the integrity check that was performed. The type of the result rows will depend on the check that was executed.\r\n * @throws IModelError with status BadRequest if an unknown integrity check key is provided\r\n * @internal\r\n */\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataColumns\"): Promise<IntegrityCheckResultRow<\"checkDataColumns\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkECProfile\"): Promise<IntegrityCheckResultRow<\"checkECProfile\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationClassIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationClassIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyClassIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyClassIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkClassIds\"): Promise<IntegrityCheckResultRow<\"checkClassIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataSchema\"): Promise<IntegrityCheckResultRow<\"checkDataSchema\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkSchemaLoad\"): Promise<IntegrityCheckResultRow<\"checkSchemaLoad\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkMissingChildRows\"): Promise<IntegrityCheckResultRow<\"checkMissingChildRows\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDivergedPropMaps\"): Promise<IntegrityCheckResultRow<\"checkDivergedPropMaps\">[]>;\r\nexport async function performSpecificIntegrityCheck<K extends IntegrityCheckKey>(iModel: IModelDb, check: K): Promise<IntegrityCheckResultRow<K>[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: IntegrityCheckKey): Promise<IntegrityCheckResultRow<IntegrityCheckKey>[]> {\r\n switch (check) {\r\n case \"checkDataColumns\": {\r\n const results: CheckDataColumnsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, table: row.table, column: row.column });\r\n }\r\n return results;\r\n }\r\n case \"checkECProfile\": {\r\n const results: CheckECProfileResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });\r\n }\r\n return results;\r\n }\r\n case \"checkNavigationClassIds\": {\r\n const results: CheckNavClassIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });\r\n }\r\n return results;\r\n }\r\n case \"checkNavigationIds\": {\r\n const results: CheckNavIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });\r\n }\r\n return results;\r\n }\r\n case \"checkLinktableForeignKeyClassIds\": {\r\n const results: CheckLinkTableFkClassIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });\r\n }\r\n return results;\r\n }\r\n case \"checkLinktableForeignKeyIds\": {\r\n const results: CheckLinkTableFkIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });\r\n }\r\n return results;\r\n }\r\n case \"checkClassIds\": {\r\n const results: CheckClassIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });\r\n }\r\n return results;\r\n }\r\n case \"checkDataSchema\": {\r\n const results: CheckDataSchemaResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, type: row.type, name: row.name });\r\n }\r\n return results;\r\n }\r\n case \"checkSchemaLoad\": {\r\n const results: CheckSchemaLoadResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, schema: row.schema });\r\n }\r\n return results;\r\n }\r\n case \"checkMissingChildRows\": {\r\n const results: CheckMissingChildRowsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });\r\n }\r\n return results;\r\n }\r\n case \"checkDivergedPropMaps\": {\r\n const results: CheckDivergedPropMapsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDivergedPropMaps.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, derivedClassId: row.derivedClassId, derivedClassName: row.derivedClassName, baseClassId: row.baseClassId, baseClassName: row.baseClassName, propertyName: row.propertyName, baseColumn: row.baseColumn, divergedColumn: row.divergedColumn });\r\n }\r\n return results;\r\n }\r\n default:\r\n throw new IModelError(IModelStatus.BadRequest, `Unknown integrity check type`);\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"file":"IntegrityCheck.js","sourceRoot":"","sources":["../../../src/internal/IntegrityCheck.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE,2BAA2B;QACvC,UAAU,EAAE,oBAAoB;QAChC,QAAQ,EAAE,sFAAsF;KACjG;IACD,cAAc,EAAE;QACd,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,yBAAyB;QACrC,UAAU,EAAE,kBAAkB;QAC9B,QAAQ,EAAE,oFAAoF;KAC/F;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,4BAA4B;QAClC,UAAU,EAAE,2BAA2B;QACvC,UAAU,EAAE,qBAAqB;QACjC,QAAQ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YACrD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;gBAC5I,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,CAAC,cAAc,EAAE,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,GAAG,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;YAC7Q,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD;YACE,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;IACnF,CAAC;AACH,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 { Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"../IModelDb\";\r\n\r\n/**\r\n * Information about each integrity check type, including the name, expected result type, and SQL query to execute\r\n * @internal\r\n */\r\nexport const integrityCheckTypeMap = {\r\n checkDataColumns: {\r\n name: \"Check Data Columns\",\r\n resultType: \"CheckDataColumnsResultRow\",\r\n sqlCommand: \"check_data_columns\",\r\n sqlQuery: `PRAGMA integrity_check(check_data_columns) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkECProfile: {\r\n name: \"Check EC Profile\",\r\n resultType: \"CheckECProfileResultRow\",\r\n sqlCommand: \"check_ec_profile\",\r\n sqlQuery: `PRAGMA integrity_check(check_ec_profile) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkNavigationClassIds: {\r\n name: \"Check Navigation Class Ids\",\r\n resultType: \"CheckNavClassIdsResultRow\",\r\n sqlCommand: \"check_nav_class_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkNavigationIds: {\r\n name: \"Check Navigation Ids\",\r\n resultType: \"CheckNavIdsResultRow\",\r\n sqlCommand: \"check_nav_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_nav_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkLinktableForeignKeyClassIds: {\r\n name: \"Check Link Table Foreign Key Class Ids\",\r\n resultType: \"CheckLinkTableFkClassIdsResultRow\",\r\n sqlCommand: \"check_linktable_fk_class_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkLinktableForeignKeyIds: {\r\n name: \"Check Link Table Foreign Key Ids\",\r\n resultType: \"CheckLinkTableFkIdsResultRow\",\r\n sqlCommand: \"check_linktable_fk_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkClassIds: {\r\n name: \"Check Class Ids\",\r\n resultType: \"CheckClassIdsResultRow\",\r\n sqlCommand: \"check_class_ids\",\r\n sqlQuery: `PRAGMA integrity_check(check_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkDataSchema: {\r\n name: \"Check Data Schema\",\r\n resultType: \"CheckDataSchemaResultRow\",\r\n sqlCommand: \"check_data_schema\",\r\n sqlQuery: `PRAGMA integrity_check(check_data_schema) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkSchemaLoad: {\r\n name: \"Check Schema Load\",\r\n resultType: \"CheckSchemaLoadResultRow\",\r\n sqlCommand: \"check_schema_load\",\r\n sqlQuery: `PRAGMA integrity_check(check_schema_load) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkMissingChildRows: {\r\n name: \"Check Missing Child Rows\",\r\n resultType: \"CheckMissingChildRowsResultRow\",\r\n sqlCommand: \"check_missing_child_rows\",\r\n sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n checkDivergedPropMaps: {\r\n name: \"Check Diverged Property Maps\",\r\n resultType: \"CheckDivergedPropMapsResultRow\",\r\n sqlCommand: \"check_diverged_prop_maps\",\r\n sqlQuery: `PRAGMA integrity_check(check_diverged_prop_maps) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\r\n },\r\n} as const;\r\n\r\n/**\r\n * Type representing the keys of the integrityCheckType map, which correspond to the different types of integrity checks that can be performed.\r\n */\r\nexport type IntegrityCheckKey = keyof typeof integrityCheckTypeMap;\r\n\r\n/** Map of integrity check keys to their result row types */\r\ninterface IntegrityCheckResultTypeMap {\r\n checkDataColumns: CheckDataColumnsResultRow;\r\n checkECProfile: CheckECProfileResultRow;\r\n checkNavigationClassIds: CheckNavClassIdsResultRow;\r\n checkNavigationIds: CheckNavIdsResultRow;\r\n checkLinktableForeignKeyClassIds: CheckLinkTableFkClassIdsResultRow;\r\n checkLinktableForeignKeyIds: CheckLinkTableFkIdsResultRow;\r\n checkClassIds: CheckClassIdsResultRow;\r\n checkDataSchema: CheckDataSchemaResultRow;\r\n checkSchemaLoad: CheckSchemaLoadResultRow;\r\n checkMissingChildRows: CheckMissingChildRowsResultRow;\r\n checkDivergedPropMaps: CheckDivergedPropMapsResultRow;\r\n}\r\n\r\n/** Checks the Map to give the return type of a specific integrity check */\r\ntype IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResultTypeMap[K];\r\n\r\n/**\r\n * Return type for quick integrity check\r\n */\r\nexport interface QuickIntegrityCheckResultRow {\r\n /** Name of the integrity check. */\r\n check: string;\r\n /** Whether the check passed. Quick checks do not include problem details. */\r\n passed: boolean;\r\n /** Elapsed time for the check, in seconds. */\r\n elapsedSeconds: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Data Columns integrity check\r\n */\r\nexport interface CheckDataColumnsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** Mapped data table containing a missing column. */\r\n table: string;\r\n /** Name of the missing nonvirtual physical column. */\r\n column: string;\r\n}\r\n\r\n/**\r\n * Return type for Check EC Profile integrity check\r\n */\r\nexport interface CheckECProfileResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** Type of EC profile object, such as a table, index, or iModel trigger. */\r\n type: string;\r\n /** Name of the EC profile object. */\r\n name: string;\r\n /** Description of the missing or mismatching object definition. */\r\n issue: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Navigation Class Ids integrity check\r\n */\r\nexport interface CheckNavClassIdsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** ID of the source instance row containing the navigation property. */\r\n id: string;\r\n /** Declaring or scanned class for the source row; rows from derived classes may be included. */\r\n class: string;\r\n /** Name of the navigation property. */\r\n property: string;\r\n /** ID of the referenced instance stored by the navigation property. */\r\n navId: string;\r\n /** Relationship class ID stored by the navigation property, not the target instance class ID. */\r\n navClassId: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Navigation Ids integrity check\r\n */\r\nexport interface CheckNavIdsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** ID of the source instance row containing the navigation property. */\r\n id: string;\r\n /** Declaring or scanned class for the source row; rows from derived classes may be included. */\r\n class: string;\r\n /** Name of the navigation property. */\r\n property: string;\r\n /** ID of the referenced instance stored by the navigation property. */\r\n navId: string;\r\n /** Class queried for the referenced row: the first relationship constraint class in the navigation direction, including derived classes. */\r\n primaryClass: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Link Table Foreign Key Class Ids integrity check\r\n */\r\nexport interface CheckLinkTableFkClassIdsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** ID of the relationship row containing the foreign key. */\r\n id: string;\r\n /** Link-table relationship class. */\r\n relationship: string;\r\n /** Endpoint class-ID property: SourceECClassId or TargetECClassId. */\r\n property: string;\r\n /** Source or target endpoint instance ID stored in the link table. */\r\n keyId: string;\r\n /** Source or target endpoint class ID; the check verifies that the class exists. */\r\n keyClassId: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Link Table Foreign Key Ids integrity check\r\n */\r\nexport interface CheckLinkTableFkIdsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** ID of the relationship row containing the foreign key. */\r\n id: string;\r\n /** Link-table relationship class. */\r\n relationship: string;\r\n /** Endpoint instance-ID property: SourceECInstanceId or TargetECInstanceId. */\r\n property: string;\r\n /** Source or target endpoint instance ID stored in the link table. */\r\n keyId: string;\r\n /** Class queried for the referenced endpoint row: the first endpoint constraint class, including derived classes. */\r\n primaryClass: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Class Ids integrity check\r\n */\r\nexport interface CheckClassIdsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** Declaring or scanned class for the row; rows from derived classes may be included. */\r\n class: string;\r\n /** ECInstanceId for primary/joined results, or the physical RowId for overflow results. */\r\n id: string;\r\n /** Persisted ECClassId value with no matching class definition. */\r\n classId: string;\r\n /** Check category: \"primary\", \"joined\", or \"overflow\". */\r\n type: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Data Schema integrity check\r\n */\r\nexport interface CheckDataSchemaResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** Type of missing mapped schema object, such as a table or index. */\r\n type: string;\r\n /** Name of the missing mapped schema object. */\r\n name: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Schema Load integrity check\r\n */\r\nexport interface CheckSchemaLoadResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** Name of the schema that the schema manager could not load. */\r\n schema: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Missing Child Rows integrity check\r\n */\r\nexport interface CheckMissingChildRowsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** Class used to identify the checked rows: \"BisCore:Element\". */\r\n class: string;\r\n /** ID of the existing bis_Element row missing a required child row. */\r\n id: string;\r\n /** Persisted ECClassId of the existing element row. */\r\n classId: string;\r\n /** Comma-separated names of all child tables checked for the row, not only tables with a missing child row. */\r\n missingRowInTables: string;\r\n}\r\n\r\n/**\r\n * Return type for Check Diverged Property Maps integrity check\r\n */\r\nexport interface CheckDivergedPropMapsResultRow {\r\n /** Sequential result row number. */\r\n sno: number;\r\n /** ID of the derived class whose inherited property map diverges. */\r\n derivedClassId: Id64String;\r\n /** Name of the derived class whose inherited property map diverges. */\r\n derivedClassName: string;\r\n /** ID of the base class whose mapping was compared with the derived class. */\r\n baseClassId: Id64String;\r\n /** Name of the base class whose mapping was compared with the derived class. */\r\n baseClassName: string;\r\n /** Access path of the inherited property with different column mappings. */\r\n propertyName: string;\r\n /** Base class mapping, formatted as table.column. */\r\n baseColumn: string;\r\n /** Derived class mapping, formatted as table.column. */\r\n divergedColumn: string;\r\n}\r\n\r\n/**\r\n * Return type for integrity check results, including the check name, whether it passed, and the specific results (if any)\r\n */\r\nexport interface IntegrityCheckResult {\r\n /** The name of the integrity check that was performed */\r\n check: string;\r\n /** Whether the integrity check passed (i.e. no issues were found = true) */\r\n passed: boolean;\r\n /** The specific results returned by the integrity check, which may include details about any issues that were found.\r\n * In the case where issues are found, this will be an array of result rows specific to the type of check that was performed,\r\n * or an array of quick integrity check results if it was a quick check. */\r\n results: IntegrityCheckResultRow<IntegrityCheckKey>[] | QuickIntegrityCheckResultRow[];\r\n}\r\n\r\n/**\r\n * Gets the user-friendly name of an integrity check based on its key or SQL command.\r\n * It first attempts to find a direct match for the key in the integrityCheckTypeMap. If not found, it searches for a match based on the SQL command.\r\n * If still not found, it returns the original check string.\r\n * @param check - The integrity check key or SQL command to get the name of\r\n * @returns The user-friendly name of the integrity check, or the original check string if no match is found\r\n * @internal\r\n */\r\nexport function getIntegrityCheckName(check: string): string {\r\n // First try direct lookup by key\r\n const directLookup = integrityCheckTypeMap[check as IntegrityCheckKey];\r\n if (directLookup) {\r\n return directLookup.name;\r\n }\r\n // If not found, search by sqlCommand\r\n for (const [, value] of Object.entries(integrityCheckTypeMap)) {\r\n if (value.sqlCommand === check) {\r\n return value.name;\r\n }\r\n }\r\n // Fallback to the original check string\r\n return check;\r\n}\r\n\r\n/**\r\n * Performs a quick integrity check on the given iModel.\r\n * @param iModel The IModelDb instance to perform the integrity check on\r\n * @returns An array of results for each check performed, including the check name, whether it passed, and the elapsed time in seconds\r\n * @internal\r\n */\r\nexport async function performQuickIntegrityCheck(iModel: IModelDb): Promise<QuickIntegrityCheckResultRow[]> {\r\n const integrityCheckQuery = \"PRAGMA integrity_check ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES\";\r\n const integrityCheckResults: QuickIntegrityCheckResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckQuery, undefined, { usePrimaryConn: true })) {\r\n integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec });\r\n };\r\n return integrityCheckResults;\r\n}\r\n\r\n/**\r\n * Performs a specific integrity check on the given iModel based on the provided check key, and returns the results specific to that check type.\r\n * @param iModel The IModelDb instance to perform the integrity check on\r\n * @param check The key of the specific integrity check to perform\r\n * @return An array of results specific to the integrity check that was performed. The type of the result rows will depend on the check that was executed.\r\n * @throws IModelError with status BadRequest if an unknown integrity check key is provided\r\n * @internal\r\n */\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataColumns\"): Promise<IntegrityCheckResultRow<\"checkDataColumns\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkECProfile\"): Promise<IntegrityCheckResultRow<\"checkECProfile\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationClassIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationClassIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyClassIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyClassIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkClassIds\"): Promise<IntegrityCheckResultRow<\"checkClassIds\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataSchema\"): Promise<IntegrityCheckResultRow<\"checkDataSchema\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkSchemaLoad\"): Promise<IntegrityCheckResultRow<\"checkSchemaLoad\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkMissingChildRows\"): Promise<IntegrityCheckResultRow<\"checkMissingChildRows\">[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDivergedPropMaps\"): Promise<IntegrityCheckResultRow<\"checkDivergedPropMaps\">[]>;\r\nexport async function performSpecificIntegrityCheck<K extends IntegrityCheckKey>(iModel: IModelDb, check: K): Promise<IntegrityCheckResultRow<K>[]>;\r\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: IntegrityCheckKey): Promise<IntegrityCheckResultRow<IntegrityCheckKey>[]> {\r\n switch (check) {\r\n case \"checkDataColumns\": {\r\n const results: CheckDataColumnsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, table: row.table, column: row.column });\r\n }\r\n return results;\r\n }\r\n case \"checkECProfile\": {\r\n const results: CheckECProfileResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });\r\n }\r\n return results;\r\n }\r\n case \"checkNavigationClassIds\": {\r\n const results: CheckNavClassIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });\r\n }\r\n return results;\r\n }\r\n case \"checkNavigationIds\": {\r\n const results: CheckNavIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });\r\n }\r\n return results;\r\n }\r\n case \"checkLinktableForeignKeyClassIds\": {\r\n const results: CheckLinkTableFkClassIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });\r\n }\r\n return results;\r\n }\r\n case \"checkLinktableForeignKeyIds\": {\r\n const results: CheckLinkTableFkIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });\r\n }\r\n return results;\r\n }\r\n case \"checkClassIds\": {\r\n const results: CheckClassIdsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });\r\n }\r\n return results;\r\n }\r\n case \"checkDataSchema\": {\r\n const results: CheckDataSchemaResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, type: row.type, name: row.name });\r\n }\r\n return results;\r\n }\r\n case \"checkSchemaLoad\": {\r\n const results: CheckSchemaLoadResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, schema: row.schema });\r\n }\r\n return results;\r\n }\r\n case \"checkMissingChildRows\": {\r\n const results: CheckMissingChildRowsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });\r\n }\r\n return results;\r\n }\r\n case \"checkDivergedPropMaps\": {\r\n const results: CheckDivergedPropMapsResultRow[] = [];\r\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDivergedPropMaps.sqlQuery, undefined, { usePrimaryConn: true })) {\r\n results.push({ sno: row.sno, derivedClassId: row.derivedClassId, derivedClassName: row.derivedClassName, baseClassId: row.baseClassId, baseClassName: row.baseClassName, propertyName: row.propertyName, baseColumn: row.baseColumn, divergedColumn: row.divergedColumn });\r\n }\r\n return results;\r\n }\r\n default:\r\n throw new IModelError(IModelStatus.BadRequest, `Unknown integrity check type`);\r\n }\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaSyncReservations.d.ts","sourceRoot":"","sources":["../../../src/internal/SchemaSyncReservations.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAwB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SchemaSyncReservations.d.ts","sourceRoot":"","sources":["../../../src/internal/SchemaSyncReservations.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAwB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAuI3D,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAE7G"}
|
|
@@ -15,18 +15,28 @@ class SchemaSyncReservations {
|
|
|
15
15
|
get isServerBased() { return true; }
|
|
16
16
|
_iModel;
|
|
17
17
|
_schemaSync;
|
|
18
|
+
_isClosed = false;
|
|
18
19
|
constructor(iModel, schemaSync) {
|
|
19
20
|
this._iModel = iModel;
|
|
20
21
|
this._schemaSync = schemaSync;
|
|
21
22
|
}
|
|
22
23
|
static async create(iModel) {
|
|
23
24
|
const schemaSync = await SchemaSync.getCloudAccess(iModel);
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
try {
|
|
26
|
+
schemaSync.synchronizeWithCloud();
|
|
27
|
+
return new SchemaSyncReservations(iModel, schemaSync);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
SchemaSync.releaseCloudAccess(schemaSync);
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
[_close]() {
|
|
35
|
+
if (this._isClosed)
|
|
36
|
+
return;
|
|
37
|
+
this._isClosed = true;
|
|
28
38
|
try {
|
|
29
|
-
this._schemaSync
|
|
39
|
+
SchemaSync.releaseCloudAccess(this._schemaSync);
|
|
30
40
|
}
|
|
31
41
|
catch {
|
|
32
42
|
// best-effort cleanup; never throw out of close hooks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaSyncReservations.js","sourceRoot":"","sources":["../../../src/internal/SchemaSyncReservations.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAInE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACnG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,sBAAsB;IACV,CAAC,yBAAyB,CAAC,GAAG,SAAS,CAAC;IACxD,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAW;IAClB,WAAW,CAAyB;IAErD,YAAoB,MAAgB,EAAE,UAAkC;QACtE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAgB;QACzC,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,UAAU,CAAC,oBAAoB,EAAE,CAAC;QAClC,OAAO,IAAI,sBAAsB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxD,CAAC;IAEM,CAAC,MAAM,CAAC;QACb,IAAI,CAAC;YACH,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,sDAAsD;QACxD,CAAC;IACH,CAAC;IAEM,uBAAuB,CAAC,cAA0B;QACv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C,MAAM,GAAG,CAAC;YACnB,uBAAuB,CAAC,UAAU,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,0CAA0C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAE1I,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,MAAgB;IACjE,OAAO,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/C,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\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { Guid, GuidString, Id64 } from \"@itwin/core-bentley\";\r\nimport { Code, ElementReservationError } from \"@itwin/core-common\";\r\nimport { OnElementPropsArg } from \"../Element\";\r\nimport { IModelDb, InsertElementOptions } from \"../IModelDb\";\r\nimport { SynchronousChannel } from \"../SynchronousChannel\";\r\nimport { SchemaSync } from \"../SchemaSync\";\r\nimport { _close, _implementationProhibited, _nativeDb, _onReservedElementInsert } from \"./Symbols\";\r\nimport { Category } from \"../Category\";\r\n\r\nclass SchemaSyncReservations implements SynchronousChannel.Reservations {\r\n public readonly [_implementationProhibited] = undefined;\r\n public get isServerBased() { return true; }\r\n private readonly _iModel: IModelDb;\r\n private readonly _schemaSync: SchemaSync.CloudAccess;\r\n\r\n private constructor(iModel: IModelDb, schemaSync: SchemaSync.CloudAccess) {\r\n this._iModel = iModel;\r\n this._schemaSync = schemaSync;\r\n }\r\n\r\n public static async create(iModel: IModelDb): Promise<SchemaSyncReservations> {\r\n const schemaSync = await SchemaSync.getCloudAccess(iModel);\r\n schemaSync.synchronizeWithCloud();\r\n return new SchemaSyncReservations(iModel, schemaSync);\r\n }\r\n\r\n public [_close](): void {\r\n try {\r\n this._schemaSync.close();\r\n } catch {\r\n // best-effort cleanup; never throw out of close hooks\r\n }\r\n }\r\n\r\n public needsElementReservation(federationGuid: GuidString): boolean {\r\n if (!SchemaSync.isEnabled(this._iModel))\r\n return false;\r\n\r\n if (!Guid.isGuid(federationGuid))\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: \"Invalid federationGuid\" });\r\n\r\n return !this._schemaSync.reader.findReservedElement(federationGuid);\r\n }\r\n\r\n public async reserveElements(args: SynchronousChannel.ReserveElementsArgs): Promise<void> {\r\n const validated = this.validateProposedReservations(args);\r\n await this._schemaSync.writeLocker.reserveElements(validated);\r\n }\r\n\r\n public [_onReservedElementInsert](arg: OnElementPropsArg): void {\r\n if (!SchemaSync.isEnabled(arg.iModel) || arg.iModel.holdsSchemaLock)\r\n return;\r\n\r\n const fedGuid = arg.props.federationGuid;\r\n // The hook is only invoked for elements with an explicitly-set federationGuid (gated in Element.onInsert),\r\n // but validate defensively.\r\n if (fedGuid === undefined || !Guid.isGuid(fedGuid))\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: \"Element inserts require a valid federationGuid when SchemaSync is enabled\" });\r\n\r\n // It should be impossible for us to still have local changes, but check just in case,\r\n // since we can't trust the contents of the SchemaSyncDb until they've been successfully pushed.\r\n if (this._schemaSync.container.hasLocalChanges)\r\n ElementReservationError.throwError(\"container-has-local-changes\", { message: \"Element inserts are not allowed when there are local changes in the SchemaSync container\" });\r\n\r\n const code = Code.fromJSON(arg.props.code);\r\n\r\n const existing = this._schemaSync.reader.findReservedElement(fedGuid);\r\n if (!existing) {\r\n ElementReservationError.throwError(\"reservation-not-found\", {\r\n message: `No SchemaSync reservation found for element with federationGuid ${fedGuid} — include it in a SynchronousChannel.Reservations.reserveElements call before inserting`,\r\n federationGuid: fedGuid,\r\n });\r\n }\r\n\r\n const expectedClassId = arg.iModel[_nativeDb].classNameToId(arg.props.classFullName);\r\n if (existing.ecClassId !== expectedClassId) {\r\n ElementReservationError.throwError(\"reservation-conflict\", {\r\n message: `Element ${existing.federationGuid} reserved as a different class than the insert (${existing.ecClassId} vs ${expectedClassId})`,\r\n federationGuid: existing.federationGuid,\r\n });\r\n }\r\n\r\n if (!existing.code.equals(code))\r\n ElementReservationError.throwError(\"reservation-conflict\", {\r\n message: `Element ${existing.federationGuid} insert uses a different Code than was reserved`,\r\n federationGuid: existing.federationGuid,\r\n });\r\n\r\n arg.props.id = existing.elementId;\r\n const options = arg.options ?? (arg.options = {} as InsertElementOptions);\r\n options.forceUseId = true;\r\n }\r\n\r\n private validateProposedReservations(args: SynchronousChannel.ReserveElementsArgs): SchemaSync.ProposedElementReservation[] {\r\n const out: SchemaSync.ProposedElementReservation[] = [];\r\n const errors: string[] = [];\r\n for (const props of args.elements) {\r\n if (!props.federationGuid || !Guid.isGuid(props.federationGuid)) {\r\n errors.push(`element reservation requires an explicit, valid federationGuid (got '${props.federationGuid ?? \"<none>\"}')`);\r\n continue;\r\n }\r\n\r\n const code = props.code ? Code.fromJSON(props.code) : Code.createEmpty();\r\n if (code.value && !Code.isValid(code)) {\r\n errors.push(`(${props.federationGuid}): invalid code '${code.toString()}'`);\r\n continue;\r\n }\r\n\r\n const ecClassId = this._iModel[_nativeDb].classNameToId(props.classFullName);\r\n if (!Id64.isValidId64(ecClassId)) {\r\n errors.push(`(${props.federationGuid}): unknown class '${props.classFullName}'`);\r\n continue;\r\n }\r\n\r\n out.push({\r\n federationGuid: props.federationGuid,\r\n ecClassId,\r\n code,\r\n isCategory: props.classFullName === Category.classFullName || this._iModel[_nativeDb].isSubClassOf(props.classFullName, Category.classFullName),\r\n });\r\n }\r\n\r\n if (errors.length > 0)\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: `Invalid element(s) for reservation:\\n ${errors.join(\"\\n \")}` });\r\n\r\n return out;\r\n }\r\n}\r\n\r\nexport async function createSchemaSyncReservations(iModel: IModelDb): Promise<SynchronousChannel.Reservations> {\r\n return SchemaSyncReservations.create(iModel);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaS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Aa,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC;aAChJ,CAAC,CAAC;QACL,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YACnB,uBAAuB,CAAC,UAAU,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,0CAA0C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAE1I,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,MAAgB;IACjE,OAAO,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/C,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\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { Guid, GuidString, Id64 } from \"@itwin/core-bentley\";\r\nimport { Code, ElementReservationError } from \"@itwin/core-common\";\r\nimport { OnElementPropsArg } from \"../Element\";\r\nimport { IModelDb, InsertElementOptions } from \"../IModelDb\";\r\nimport { SynchronousChannel } from \"../SynchronousChannel\";\r\nimport { SchemaSync } from \"../SchemaSync\";\r\nimport { _close, _implementationProhibited, _nativeDb, _onReservedElementInsert } from \"./Symbols\";\r\nimport { Category } from \"../Category\";\r\n\r\nclass SchemaSyncReservations implements SynchronousChannel.Reservations {\r\n public readonly [_implementationProhibited] = undefined;\r\n public get isServerBased() { return true; }\r\n private readonly _iModel: IModelDb;\r\n private readonly _schemaSync: SchemaSync.CloudAccess;\r\n private _isClosed = false;\r\n\r\n private constructor(iModel: IModelDb, schemaSync: SchemaSync.CloudAccess) {\r\n this._iModel = iModel;\r\n this._schemaSync = schemaSync;\r\n }\r\n\r\n public static async create(iModel: IModelDb): Promise<SchemaSyncReservations> {\r\n const schemaSync = await SchemaSync.getCloudAccess(iModel);\r\n try {\r\n schemaSync.synchronizeWithCloud();\r\n return new SchemaSyncReservations(iModel, schemaSync);\r\n } catch (error) {\r\n SchemaSync.releaseCloudAccess(schemaSync);\r\n throw error;\r\n }\r\n }\r\n\r\n public [_close](): void {\r\n if (this._isClosed)\r\n return;\r\n\r\n this._isClosed = true;\r\n try {\r\n SchemaSync.releaseCloudAccess(this._schemaSync);\r\n } catch {\r\n // best-effort cleanup; never throw out of close hooks\r\n }\r\n }\r\n\r\n public needsElementReservation(federationGuid: GuidString): boolean {\r\n if (!SchemaSync.isEnabled(this._iModel))\r\n return false;\r\n\r\n if (!Guid.isGuid(federationGuid))\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: \"Invalid federationGuid\" });\r\n\r\n return !this._schemaSync.reader.findReservedElement(federationGuid);\r\n }\r\n\r\n public async reserveElements(args: SynchronousChannel.ReserveElementsArgs): Promise<void> {\r\n const validated = this.validateProposedReservations(args);\r\n await this._schemaSync.writeLocker.reserveElements(validated);\r\n }\r\n\r\n public [_onReservedElementInsert](arg: OnElementPropsArg): void {\r\n if (!SchemaSync.isEnabled(arg.iModel) || arg.iModel.holdsSchemaLock)\r\n return;\r\n\r\n const fedGuid = arg.props.federationGuid;\r\n // The hook is only invoked for elements with an explicitly-set federationGuid (gated in Element.onInsert),\r\n // but validate defensively.\r\n if (fedGuid === undefined || !Guid.isGuid(fedGuid))\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: \"Element inserts require a valid federationGuid when SchemaSync is enabled\" });\r\n\r\n // It should be impossible for us to still have local changes, but check just in case,\r\n // since we can't trust the contents of the SchemaSyncDb until they've been successfully pushed.\r\n if (this._schemaSync.container.hasLocalChanges)\r\n ElementReservationError.throwError(\"container-has-local-changes\", { message: \"Element inserts are not allowed when there are local changes in the SchemaSync container\" });\r\n\r\n const code = Code.fromJSON(arg.props.code);\r\n\r\n const existing = this._schemaSync.reader.findReservedElement(fedGuid);\r\n if (!existing) {\r\n ElementReservationError.throwError(\"reservation-not-found\", {\r\n message: `No SchemaSync reservation found for element with federationGuid ${fedGuid} — include it in a SynchronousChannel.Reservations.reserveElements call before inserting`,\r\n federationGuid: fedGuid,\r\n });\r\n }\r\n\r\n const expectedClassId = arg.iModel[_nativeDb].classNameToId(arg.props.classFullName);\r\n if (existing.ecClassId !== expectedClassId) {\r\n ElementReservationError.throwError(\"reservation-conflict\", {\r\n message: `Element ${existing.federationGuid} reserved as a different class than the insert (${existing.ecClassId} vs ${expectedClassId})`,\r\n federationGuid: existing.federationGuid,\r\n });\r\n }\r\n\r\n if (!existing.code.equals(code))\r\n ElementReservationError.throwError(\"reservation-conflict\", {\r\n message: `Element ${existing.federationGuid} insert uses a different Code than was reserved`,\r\n federationGuid: existing.federationGuid,\r\n });\r\n\r\n arg.props.id = existing.elementId;\r\n const options = arg.options ?? (arg.options = {} as InsertElementOptions);\r\n options.forceUseId = true;\r\n }\r\n\r\n private validateProposedReservations(args: SynchronousChannel.ReserveElementsArgs): SchemaSync.ProposedElementReservation[] {\r\n const out: SchemaSync.ProposedElementReservation[] = [];\r\n const errors: string[] = [];\r\n for (const props of args.elements) {\r\n if (!props.federationGuid || !Guid.isGuid(props.federationGuid)) {\r\n errors.push(`element reservation requires an explicit, valid federationGuid (got '${props.federationGuid ?? \"<none>\"}')`);\r\n continue;\r\n }\r\n\r\n const code = props.code ? Code.fromJSON(props.code) : Code.createEmpty();\r\n if (code.value && !Code.isValid(code)) {\r\n errors.push(`(${props.federationGuid}): invalid code '${code.toString()}'`);\r\n continue;\r\n }\r\n\r\n const ecClassId = this._iModel[_nativeDb].classNameToId(props.classFullName);\r\n if (!Id64.isValidId64(ecClassId)) {\r\n errors.push(`(${props.federationGuid}): unknown class '${props.classFullName}'`);\r\n continue;\r\n }\r\n\r\n out.push({\r\n federationGuid: props.federationGuid,\r\n ecClassId,\r\n code,\r\n isCategory: props.classFullName === Category.classFullName || this._iModel[_nativeDb].isSubClassOf(props.classFullName, Category.classFullName),\r\n });\r\n }\r\n\r\n if (errors.length > 0)\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: `Invalid element(s) for reservation:\\n ${errors.join(\"\\n \")}` });\r\n\r\n return out;\r\n }\r\n}\r\n\r\nexport async function createSchemaSyncReservations(iModel: IModelDb): Promise<SynchronousChannel.Reservations> {\r\n return SchemaSyncReservations.create(iModel);\r\n}\r\n"]}
|
|
@@ -78,7 +78,7 @@ describe("FrameGeometry", () => {
|
|
|
78
78
|
for (const shape of shapes) {
|
|
79
79
|
const rotatedFrame = computeFrame({ frame: shape, range: defaultRange, transform });
|
|
80
80
|
const unRotatedFrame = computeFrame({ frame: shape, range: defaultRange, transform: defaultTransform });
|
|
81
|
-
const control = unRotatedFrame.cloneTransformed(transform);
|
|
81
|
+
const control = unRotatedFrame.cloneTransformed(transform);
|
|
82
82
|
expect(rotatedFrame.isAlmostEqual(control), `Rotated frame for shape ${shape} should match control`).to.be.true;
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameGeometry.test.js","sourceRoot":"","sources":["../../../../src/test/annotations/FrameGeometry.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAkB,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,yBAAyB,EAAuB,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,SAAS,YAAY,CAAC,UAA4B;IA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C,CAAC;gBAExG,MAAM,OAAO,GAAG,cAAc,CAAC,gBAAgB,CAAC,SAAS,CAAE,CAAC,CAAC,wEAAwE;gBACrI,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,2BAA2B,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAClH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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 { expect } from \"chai\";\r\nimport { CurvePrimitive, Geometry, Path, Point3d, Range2d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { ColorDef, GeometryParams, textAnnotationFrameShapes, TextFrameStyleProps } from \"@itwin/core-common\";\r\nimport { appendFrameToBuilder, computeFrame } from \"../../annotations/FrameGeometry\";\r\nimport { Id64 } from \"@itwin/core-bentley\";\r\nimport { MockBuilder } from \"../AnnotationTestUtils\";\r\n\r\nfunction isContinuous(geometries: CurvePrimitive[]): boolean {\r\n return geometries.every((current, index) => {\r\n // If the index is 0, get the last geometry in the list to see if they connect and form a loop\r\n const previous = (index === 0) ? geometries[geometries.length - 1] : geometries[index - 1];\r\n\r\n return previous.endPoint().isAlmostEqual(current.startPoint(), Geometry.smallMetricDistance);\r\n });\r\n}\r\n\r\ndescribe(\"FrameGeometry\", () => {\r\n const defaultRange = Range2d.createXYXY(0, 0, 10, 20);\r\n const defaultTransform = Transform.createIdentity();\r\n const defaultParams = new GeometryParams(Id64.invalid);\r\n\r\n describe(\"appendFrameToBuilder\", () => {\r\n it(\"should not append frame if shape is undefined or 'none'\", () => {\r\n const builder = new MockBuilder();\r\n expect(appendFrameToBuilder(builder, { shape: undefined }, defaultRange, defaultTransform, defaultParams)).to.be.false;\r\n expect(appendFrameToBuilder(builder, { shape: \"none\" }, defaultRange, defaultTransform, defaultParams)).to.be.false;\r\n expect(appendFrameToBuilder(builder, { shape: \"none\", fillColor: ColorDef.green.toJSON() }, defaultRange, defaultTransform, defaultParams)).to.be.false;\r\n });\r\n\r\n it(\"should append only a frame\", () => {\r\n const builder = new MockBuilder();\r\n const frame: TextFrameStyleProps = { shape: \"rectangle\" };\r\n const result = appendFrameToBuilder(builder, frame, defaultRange, defaultTransform, defaultParams);\r\n expect(result).to.be.true;\r\n expect(builder.geometries.length).to.be.equal(1);\r\n });\r\n\r\n it(\"should append a frame and fill\", () => {\r\n const builder = new MockBuilder();\r\n const frame: TextFrameStyleProps = { shape: \"rectangle\", fillColor: ColorDef.green.toJSON() };\r\n const result = appendFrameToBuilder(builder, frame, defaultRange, defaultTransform, defaultParams);\r\n expect(result).to.be.true;\r\n expect(builder.geometries.length).to.be.equal(2);\r\n expect(builder.geometries[1] instanceof Path).to.be.true; // The second geometry should be the outline geometry, which is a Path\r\n });\r\n\r\n it(\"should set fill and border colors from frame\", () => {\r\n const builder = new MockBuilder();\r\n const frame: TextFrameStyleProps = {\r\n shape: \"rectangle\",\r\n fillColor: ColorDef.blue.toJSON(),\r\n borderColor: ColorDef.red.toJSON(),\r\n borderWeight: 3,\r\n };\r\n appendFrameToBuilder(builder, frame, defaultRange, defaultTransform, defaultParams);\r\n const params = builder.params[builder.params.length - 1];\r\n expect(params.fillColor?.tbgr).to.equal(ColorDef.blue.tbgr);\r\n expect(params.lineColor?.tbgr).to.equal(ColorDef.red.tbgr);\r\n expect(params.weight).to.equal(3);\r\n });\r\n\r\n });\r\n describe(\"computeGeometry\", () => {\r\n const shapes = textAnnotationFrameShapes.filter(shape => shape !== \"none\");\r\n it(\"should compute different frame shapes and they should be continuous\", () => {\r\n for (const shape of shapes) {\r\n const frame = computeFrame({ frame: shape, range: defaultRange, transform: defaultTransform });\r\n expect(frame).to.exist;\r\n\r\n const curvePrimitives = frame.collectCurvePrimitives(undefined, true);\r\n\r\n if (curvePrimitives.length > 1) {\r\n // The start point of a given segment should be the end point of the previous segment\r\n const isContinuousShape = isContinuous(frame.collectCurvePrimitives(undefined, true))\r\n expect(isContinuousShape, `Frame shape ${shape} should be continuous`).to.be.true;\r\n }\r\n }\r\n });\r\n\r\n it(\"should apply transform\", () => {\r\n const origin = Point3d.create(5, 6, 7);\r\n const vector = Vector3d.create(1, 2, 3);\r\n vector.tryNormalizeInPlace();\r\n const transform = Transform.createRigidFromOriginAndVector(origin, vector)!; // This transform is something I made up for this test. It should exist.\r\n\r\n for (const shape of shapes) {\r\n const rotatedFrame = computeFrame({ frame: shape, range: defaultRange, transform });\r\n const unRotatedFrame = computeFrame({ frame: shape, range: defaultRange, transform: defaultTransform });\r\n\r\n const control = unRotatedFrame.cloneTransformed(transform)!; // This transform is something I made up for this test. It should exist.\r\n expect(rotatedFrame.isAlmostEqual(control), `Rotated frame for shape ${shape} should match control`).to.be.true;\r\n }\r\n });\r\n });\r\n});\r\n"]}
|
|
1
|
+
{"version":3,"file":"FrameGeometry.test.js","sourceRoot":"","sources":["../../../../src/test/annotations/FrameGeometry.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAkB,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,yBAAyB,EAAuB,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,SAAS,YAAY,CAAC,UAA4B;IAChD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,OA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AC,gBAAgB,CAAC,SAAS,CAAC,CAAC;gBAC3D,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,2BAA2B,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAClH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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 { expect } from \"chai\";\r\nimport { CurvePrimitive, Geometry, Path, Point3d, Range2d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { ColorDef, GeometryParams, textAnnotationFrameShapes, TextFrameStyleProps } from \"@itwin/core-common\";\r\nimport { appendFrameToBuilder, computeFrame } from \"../../annotations/FrameGeometry\";\r\nimport { Id64 } from \"@itwin/core-bentley\";\r\nimport { MockBuilder } from \"../AnnotationTestUtils\";\r\n\r\nfunction isContinuous(geometries: CurvePrimitive[]): boolean {\r\n return geometries.every((current, index) => {\r\n // If the index is 0, get the last geometry in the list to see if they connect and form a loop\r\n const previous = (index === 0) ? geometries[geometries.length - 1] : geometries[index - 1];\r\n\r\n return previous.endPoint().isAlmostEqual(current.startPoint(), Geometry.smallMetricDistance);\r\n });\r\n}\r\n\r\ndescribe(\"FrameGeometry\", () => {\r\n const defaultRange = Range2d.createXYXY(0, 0, 10, 20);\r\n const defaultTransform = Transform.createIdentity();\r\n const defaultParams = new GeometryParams(Id64.invalid);\r\n\r\n describe(\"appendFrameToBuilder\", () => {\r\n it(\"should not append frame if shape is undefined or 'none'\", () => {\r\n const builder = new MockBuilder();\r\n expect(appendFrameToBuilder(builder, { shape: undefined }, defaultRange, defaultTransform, defaultParams)).to.be.false;\r\n expect(appendFrameToBuilder(builder, { shape: \"none\" }, defaultRange, defaultTransform, defaultParams)).to.be.false;\r\n expect(appendFrameToBuilder(builder, { shape: \"none\", fillColor: ColorDef.green.toJSON() }, defaultRange, defaultTransform, defaultParams)).to.be.false;\r\n });\r\n\r\n it(\"should append only a frame\", () => {\r\n const builder = new MockBuilder();\r\n const frame: TextFrameStyleProps = { shape: \"rectangle\" };\r\n const result = appendFrameToBuilder(builder, frame, defaultRange, defaultTransform, defaultParams);\r\n expect(result).to.be.true;\r\n expect(builder.geometries.length).to.be.equal(1);\r\n });\r\n\r\n it(\"should append a frame and fill\", () => {\r\n const builder = new MockBuilder();\r\n const frame: TextFrameStyleProps = { shape: \"rectangle\", fillColor: ColorDef.green.toJSON() };\r\n const result = appendFrameToBuilder(builder, frame, defaultRange, defaultTransform, defaultParams);\r\n expect(result).to.be.true;\r\n expect(builder.geometries.length).to.be.equal(2);\r\n expect(builder.geometries[1] instanceof Path).to.be.true; // The second geometry should be the outline geometry, which is a Path\r\n });\r\n\r\n it(\"should set fill and border colors from frame\", () => {\r\n const builder = new MockBuilder();\r\n const frame: TextFrameStyleProps = {\r\n shape: \"rectangle\",\r\n fillColor: ColorDef.blue.toJSON(),\r\n borderColor: ColorDef.red.toJSON(),\r\n borderWeight: 3,\r\n };\r\n appendFrameToBuilder(builder, frame, defaultRange, defaultTransform, defaultParams);\r\n const params = builder.params[builder.params.length - 1];\r\n expect(params.fillColor?.tbgr).to.equal(ColorDef.blue.tbgr);\r\n expect(params.lineColor?.tbgr).to.equal(ColorDef.red.tbgr);\r\n expect(params.weight).to.equal(3);\r\n });\r\n\r\n });\r\n describe(\"computeGeometry\", () => {\r\n const shapes = textAnnotationFrameShapes.filter(shape => shape !== \"none\");\r\n it(\"should compute different frame shapes and they should be continuous\", () => {\r\n for (const shape of shapes) {\r\n const frame = computeFrame({ frame: shape, range: defaultRange, transform: defaultTransform });\r\n expect(frame).to.exist;\r\n\r\n const curvePrimitives = frame.collectCurvePrimitives(undefined, true);\r\n\r\n if (curvePrimitives.length > 1) {\r\n // The start point of a given segment should be the end point of the previous segment\r\n const isContinuousShape = isContinuous(frame.collectCurvePrimitives(undefined, true))\r\n expect(isContinuousShape, `Frame shape ${shape} should be continuous`).to.be.true;\r\n }\r\n }\r\n });\r\n\r\n it(\"should apply transform\", () => {\r\n const origin = Point3d.create(5, 6, 7);\r\n const vector = Vector3d.create(1, 2, 3);\r\n vector.tryNormalizeInPlace();\r\n const transform = Transform.createRigidFromOriginAndVector(origin, vector)!; // This transform is something I made up for this test. It should exist.\r\n\r\n for (const shape of shapes) {\r\n const rotatedFrame = computeFrame({ frame: shape, range: defaultRange, transform });\r\n const unRotatedFrame = computeFrame({ frame: shape, range: defaultRange, transform: defaultTransform });\r\n\r\n const control = unRotatedFrame.cloneTransformed(transform);\r\n expect(rotatedFrame.isAlmostEqual(control), `Rotated frame for shape ${shape} should match control`).to.be.true;\r\n }\r\n });\r\n });\r\n});\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSVImport.test.d.ts","sourceRoot":"","sources":["../../../../src/test/ecdb/CSVImport.test.ts"],"names":[],"mappings":""}
|