@itwin/core-backend 5.9.0-dev.10 → 5.9.0-dev.12
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/lib/cjs/EditTxn.d.ts +8 -0
- package/lib/cjs/EditTxn.d.ts.map +1 -1
- package/lib/cjs/EditTxn.js +27 -0
- package/lib/cjs/EditTxn.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +8 -1
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +10 -0
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +14 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +25 -0
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/internal/IntegrityCheck.d.ts +10 -10
- package/lib/cjs/internal/IntegrityCheck.js +22 -22
- package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
- package/lib/esm/EditTxn.d.ts +8 -0
- package/lib/esm/EditTxn.d.ts.map +1 -1
- package/lib/esm/EditTxn.js +28 -1
- package/lib/esm/EditTxn.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +8 -1
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +10 -0
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +14 -0
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +25 -0
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/internal/IntegrityCheck.d.ts +10 -10
- package/lib/esm/internal/IntegrityCheck.js +22 -22
- package/lib/esm/internal/IntegrityCheck.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts +1 -0
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +5 -0
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/element/DeleteDefinitionElements.test.js +810 -26
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
- package/lib/esm/test/imodel/SchemaXmlImport.test.js +64 -0
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/standalone/DeleteElements.test.d.ts +2 -0
- package/lib/esm/test/standalone/DeleteElements.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/DeleteElements.test.js +601 -0
- package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -0
- package/lib/esm/test/standalone/IntegrityCheck.test.js +213 -4
- package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +90 -0
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/package.json +13 -13
|
@@ -13,61 +13,61 @@ export const integrityCheckTypeMap = {
|
|
|
13
13
|
name: "Check Data Columns",
|
|
14
14
|
resultType: "CheckDataColumnsResultRow",
|
|
15
15
|
sqlCommand: "check_data_columns",
|
|
16
|
-
sqlQuery: `PRAGMA integrity_check(check_data_columns)
|
|
16
|
+
sqlQuery: `PRAGMA integrity_check(check_data_columns) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
17
17
|
},
|
|
18
18
|
checkECProfile: {
|
|
19
19
|
name: "Check EC Profile",
|
|
20
20
|
resultType: "CheckECProfileResultRow",
|
|
21
21
|
sqlCommand: "check_ec_profile",
|
|
22
|
-
sqlQuery: `PRAGMA integrity_check(check_ec_profile)
|
|
22
|
+
sqlQuery: `PRAGMA integrity_check(check_ec_profile) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
23
23
|
},
|
|
24
24
|
checkNavigationClassIds: {
|
|
25
25
|
name: "Check Navigation Class Ids",
|
|
26
26
|
resultType: "CheckNavClassIdsResultRow",
|
|
27
27
|
sqlCommand: "check_nav_class_ids",
|
|
28
|
-
sqlQuery: `PRAGMA integrity_check(check_nav_class_ids)
|
|
28
|
+
sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
29
29
|
},
|
|
30
30
|
checkNavigationIds: {
|
|
31
31
|
name: "Check Navigation Ids",
|
|
32
32
|
resultType: "CheckNavIdsResultRow",
|
|
33
33
|
sqlCommand: "check_nav_ids",
|
|
34
|
-
sqlQuery: `PRAGMA integrity_check(check_nav_ids)
|
|
34
|
+
sqlQuery: `PRAGMA integrity_check(check_nav_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
35
35
|
},
|
|
36
36
|
checkLinktableForeignKeyClassIds: {
|
|
37
37
|
name: "Check Link Table Foreign Key Class Ids",
|
|
38
38
|
resultType: "CheckLinkTableFkClassIdsResultRow",
|
|
39
39
|
sqlCommand: "check_linktable_fk_class_ids",
|
|
40
|
-
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids)
|
|
40
|
+
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
41
41
|
},
|
|
42
42
|
checkLinktableForeignKeyIds: {
|
|
43
43
|
name: "Check Link Table Foreign Key Ids",
|
|
44
44
|
resultType: "CheckLinkTableFkIdsResultRow",
|
|
45
45
|
sqlCommand: "check_linktable_fk_ids",
|
|
46
|
-
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids)
|
|
46
|
+
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
47
47
|
},
|
|
48
48
|
checkClassIds: {
|
|
49
49
|
name: "Check Class Ids",
|
|
50
50
|
resultType: "CheckClassIdsResultRow",
|
|
51
51
|
sqlCommand: "check_class_ids",
|
|
52
|
-
sqlQuery: `PRAGMA integrity_check(check_class_ids)
|
|
52
|
+
sqlQuery: `PRAGMA integrity_check(check_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
53
53
|
},
|
|
54
54
|
checkDataSchema: {
|
|
55
55
|
name: "Check Data Schema",
|
|
56
56
|
resultType: "CheckDataSchemaResultRow",
|
|
57
57
|
sqlCommand: "check_data_schema",
|
|
58
|
-
sqlQuery: `PRAGMA integrity_check(check_data_schema)
|
|
58
|
+
sqlQuery: `PRAGMA integrity_check(check_data_schema) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
59
59
|
},
|
|
60
60
|
checkSchemaLoad: {
|
|
61
61
|
name: "Check Schema Load",
|
|
62
62
|
resultType: "CheckSchemaLoadResultRow",
|
|
63
63
|
sqlCommand: "check_schema_load",
|
|
64
|
-
sqlQuery: `PRAGMA integrity_check(check_schema_load)
|
|
64
|
+
sqlQuery: `PRAGMA integrity_check(check_schema_load) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
65
65
|
},
|
|
66
66
|
checkMissingChildRows: {
|
|
67
67
|
name: "Check Missing Child Rows",
|
|
68
68
|
resultType: "CheckMissingChildRowsResultRow",
|
|
69
69
|
sqlCommand: "check_missing_child_rows",
|
|
70
|
-
sqlQuery: `PRAGMA integrity_check(check_missing_child_rows)
|
|
70
|
+
sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
71
71
|
},
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
@@ -100,9 +100,9 @@ export function getIntegrityCheckName(check) {
|
|
|
100
100
|
* @internal
|
|
101
101
|
*/
|
|
102
102
|
export async function performQuickIntegrityCheck(iModel) {
|
|
103
|
-
const integrityCheckQuery = "PRAGMA integrity_check
|
|
103
|
+
const integrityCheckQuery = "PRAGMA integrity_check ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
104
104
|
const integrityCheckResults = [];
|
|
105
|
-
for await (const row of iModel.createQueryReader(integrityCheckQuery)) {
|
|
105
|
+
for await (const row of iModel.createQueryReader(integrityCheckQuery, undefined, { usePrimaryConn: true })) {
|
|
106
106
|
integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec });
|
|
107
107
|
}
|
|
108
108
|
;
|
|
@@ -112,70 +112,70 @@ export async function performSpecificIntegrityCheck(iModel, check) {
|
|
|
112
112
|
switch (check) {
|
|
113
113
|
case "checkDataColumns": {
|
|
114
114
|
const results = [];
|
|
115
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery)) {
|
|
115
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
116
116
|
results.push({ sno: row.sno, table: row.table, column: row.column });
|
|
117
117
|
}
|
|
118
118
|
return results;
|
|
119
119
|
}
|
|
120
120
|
case "checkECProfile": {
|
|
121
121
|
const results = [];
|
|
122
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery)) {
|
|
122
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
123
123
|
results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });
|
|
124
124
|
}
|
|
125
125
|
return results;
|
|
126
126
|
}
|
|
127
127
|
case "checkNavigationClassIds": {
|
|
128
128
|
const results = [];
|
|
129
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery)) {
|
|
129
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
130
130
|
results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });
|
|
131
131
|
}
|
|
132
132
|
return results;
|
|
133
133
|
}
|
|
134
134
|
case "checkNavigationIds": {
|
|
135
135
|
const results = [];
|
|
136
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery)) {
|
|
136
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
137
137
|
results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });
|
|
138
138
|
}
|
|
139
139
|
return results;
|
|
140
140
|
}
|
|
141
141
|
case "checkLinktableForeignKeyClassIds": {
|
|
142
142
|
const results = [];
|
|
143
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery)) {
|
|
143
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
144
144
|
results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });
|
|
145
145
|
}
|
|
146
146
|
return results;
|
|
147
147
|
}
|
|
148
148
|
case "checkLinktableForeignKeyIds": {
|
|
149
149
|
const results = [];
|
|
150
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery)) {
|
|
150
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
151
151
|
results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });
|
|
152
152
|
}
|
|
153
153
|
return results;
|
|
154
154
|
}
|
|
155
155
|
case "checkClassIds": {
|
|
156
156
|
const results = [];
|
|
157
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery)) {
|
|
157
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
158
158
|
results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });
|
|
159
159
|
}
|
|
160
160
|
return results;
|
|
161
161
|
}
|
|
162
162
|
case "checkDataSchema": {
|
|
163
163
|
const results = [];
|
|
164
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery)) {
|
|
164
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
165
165
|
results.push({ sno: row.sno, type: row.type, name: row.name });
|
|
166
166
|
}
|
|
167
167
|
return results;
|
|
168
168
|
}
|
|
169
169
|
case "checkSchemaLoad": {
|
|
170
170
|
const results = [];
|
|
171
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery)) {
|
|
171
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
172
172
|
results.push({ sno: row.sno, schema: row.schema });
|
|
173
173
|
}
|
|
174
174
|
return results;
|
|
175
175
|
}
|
|
176
176
|
case "checkMissingChildRows": {
|
|
177
177
|
const results = [];
|
|
178
|
-
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery)) {
|
|
178
|
+
for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
179
179
|
results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });
|
|
180
180
|
}
|
|
181
181
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrityCheck.js","sourceRoot":"","sources":["../../../src/internal/IntegrityCheck.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gBAAgB,EAAE;QAChB,IA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AK,iBAAiB,CAAC,CAAC,CAAC;YACvB,MAAM,OAAO,GAA+B,EAAE,CAAC;YAC/C,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACjG,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YACrD,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,KAAK,uBAAuB,CAAC,CAAC,CAAC;YAC7B,MAAM,OAAO,GAAqC,EAAE,CAAC;YACrD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACvG,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC;YAClI,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\n\n/**\n * Information about each integrity check type, including the name, expected result type, and SQL query to execute\n * @internal\n */\nexport const integrityCheckTypeMap = {\n checkDataColumns: {\n name: \"Check Data Columns\",\n resultType: \"CheckDataColumnsResultRow\",\n sqlCommand: \"check_data_columns\",\n sqlQuery: `PRAGMA integrity_check(check_data_columns) options enable_experimental_features`,\n },\n checkECProfile: {\n name: \"Check EC Profile\",\n resultType: \"CheckECProfileResultRow\",\n sqlCommand: \"check_ec_profile\",\n sqlQuery: `PRAGMA integrity_check(check_ec_profile) options enable_experimental_features`,\n },\n checkNavigationClassIds: {\n name: \"Check Navigation Class Ids\",\n resultType: \"CheckNavClassIdsResultRow\",\n sqlCommand: \"check_nav_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) options enable_experimental_features`,\n },\n checkNavigationIds: {\n name: \"Check Navigation Ids\",\n resultType: \"CheckNavIdsResultRow\",\n sqlCommand: \"check_nav_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_ids) options enable_experimental_features`,\n },\n checkLinktableForeignKeyClassIds: {\n name: \"Check Link Table Foreign Key Class Ids\",\n resultType: \"CheckLinkTableFkClassIdsResultRow\",\n sqlCommand: \"check_linktable_fk_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) options enable_experimental_features`,\n },\n checkLinktableForeignKeyIds: {\n name: \"Check Link Table Foreign Key Ids\",\n resultType: \"CheckLinkTableFkIdsResultRow\",\n sqlCommand: \"check_linktable_fk_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) options enable_experimental_features`,\n },\n checkClassIds: {\n name: \"Check Class Ids\",\n resultType: \"CheckClassIdsResultRow\",\n sqlCommand: \"check_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_class_ids) options enable_experimental_features`,\n },\n checkDataSchema: {\n name: \"Check Data Schema\",\n resultType: \"CheckDataSchemaResultRow\",\n sqlCommand: \"check_data_schema\",\n sqlQuery: `PRAGMA integrity_check(check_data_schema) options enable_experimental_features`,\n },\n checkSchemaLoad: {\n name: \"Check Schema Load\",\n resultType: \"CheckSchemaLoadResultRow\",\n sqlCommand: \"check_schema_load\",\n sqlQuery: `PRAGMA integrity_check(check_schema_load) options enable_experimental_features`,\n },\n checkMissingChildRows: {\n name: \"Check Missing Child Rows\",\n resultType: \"CheckMissingChildRowsResultRow\",\n sqlCommand: \"check_missing_child_rows\",\n sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) options enable_experimental_features`,\n },\n} as const;\n\n/**\n * Type representing the keys of the integrityCheckType map, which correspond to the different types of integrity checks that can be performed.\n */\nexport type IntegrityCheckKey = keyof typeof integrityCheckTypeMap;\n\n/** Map of integrity check keys to their result row types */\ninterface IntegrityCheckResultTypeMap {\n checkDataColumns: CheckDataColumnsResultRow;\n checkECProfile: CheckECProfileResultRow;\n checkNavigationClassIds: CheckNavClassIdsResultRow;\n checkNavigationIds: CheckNavIdsResultRow;\n checkLinktableForeignKeyClassIds: CheckLinkTableFkClassIdsResultRow;\n checkLinktableForeignKeyIds: CheckLinkTableFkIdsResultRow;\n checkClassIds: CheckClassIdsResultRow;\n checkDataSchema: CheckDataSchemaResultRow;\n checkSchemaLoad: CheckSchemaLoadResultRow;\n checkMissingChildRows: CheckMissingChildRowsResultRow;\n}\n\n/** Checks the Map to give the return type of a specific integrity check */\ntype IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResultTypeMap[K];\n\n/**\n * Return type for quick integrity check\n */\nexport interface QuickIntegrityCheckResultRow {\n check: string;\n passed: boolean;\n elapsedSeconds: string;\n}\n\n/**\n * Return type for Check Data Columns integrity check\n */\nexport interface CheckDataColumnsResultRow {\n sno: number;\n table: string;\n column: string;\n}\n\n/**\n * Return type for Check EC Profile integrity check\n */\nexport interface CheckECProfileResultRow {\n sno: number;\n type: string;\n name: string;\n issue: string;\n}\n\n/**\n * Return type for Check Navigation Class Ids integrity check\n */\nexport interface CheckNavClassIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n navClassId: string;\n}\n\n/**\n * Return type for Check Navigation Ids integrity check\n */\nexport interface CheckNavIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Class Ids integrity check\n */\nexport interface CheckLinkTableFkClassIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n keyClassId: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Ids integrity check\n */\nexport interface CheckLinkTableFkIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Class Ids integrity check\n */\nexport interface CheckClassIdsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n type: string;\n}\n\n/**\n * Return type for Check Data Schema integrity check\n */\nexport interface CheckDataSchemaResultRow {\n sno: number;\n type: string;\n name: string;\n}\n\n/**\n * Return type for Check Schema Load integrity check\n */\nexport interface CheckSchemaLoadResultRow {\n sno: number;\n schema: string;\n}\n\n/**\n * Return type for Check Missing Child Rows integrity check\n */\nexport interface CheckMissingChildRowsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n missingRowInTables: string;\n}\n\n/**\n * Return type for integrity check results, including the check name, whether it passed, and the specific results (if any)\n */\nexport interface IntegrityCheckResult {\n /** The name of the integrity check that was performed */\n check: string;\n /** Whether the integrity check passed (i.e. no issues were found = true) */\n passed: boolean;\n /** The specific results returned by the integrity check, which may include details about any issues that were found.\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,\n * or an array of quick integrity check results if it was a quick check. */\n results: IntegrityCheckResultRow<IntegrityCheckKey>[] | QuickIntegrityCheckResultRow[];\n}\n\n/**\n * Gets the user-friendly name of an integrity check based on its key or SQL command.\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.\n * If still not found, it returns the original check string.\n * @param check - The integrity check key or SQL command to get the name of\n * @returns The user-friendly name of the integrity check, or the original check string if no match is found\n * @internal\n */\nexport function getIntegrityCheckName(check: string): string {\n // First try direct lookup by key\n const directLookup = integrityCheckTypeMap[check as IntegrityCheckKey];\n if (directLookup) {\n return directLookup.name;\n }\n // If not found, search by sqlCommand\n for (const [, value] of Object.entries(integrityCheckTypeMap)) {\n if (value.sqlCommand === check) {\n return value.name;\n }\n }\n // Fallback to the original check string\n return check;\n}\n\n/**\n * Performs a quick integrity check on the given iModel.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @returns An array of results for each check performed, including the check name, whether it passed, and the elapsed time in seconds\n * @internal\n */\nexport async function performQuickIntegrityCheck(iModel: IModelDb): Promise<QuickIntegrityCheckResultRow[]> {\n const integrityCheckQuery = \"PRAGMA integrity_check options enable_experimental_features\";\n const integrityCheckResults: QuickIntegrityCheckResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckQuery)) {\n integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec});\n };\n return integrityCheckResults;\n}\n\n/**\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.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @param check The key of the specific integrity check to perform\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.\n * @throws IModelError with status BadRequest if an unknown integrity check key is provided\n * @internal\n */\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataColumns\"): Promise<IntegrityCheckResultRow<\"checkDataColumns\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkECProfile\"): Promise<IntegrityCheckResultRow<\"checkECProfile\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationClassIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyClassIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkClassIds\"): Promise<IntegrityCheckResultRow<\"checkClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataSchema\"): Promise<IntegrityCheckResultRow<\"checkDataSchema\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkSchemaLoad\"): Promise<IntegrityCheckResultRow<\"checkSchemaLoad\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkMissingChildRows\"): Promise<IntegrityCheckResultRow<\"checkMissingChildRows\">[]>;\nexport async function performSpecificIntegrityCheck<K extends IntegrityCheckKey>(iModel: IModelDb, check: K): Promise<IntegrityCheckResultRow<K>[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: IntegrityCheckKey): Promise<IntegrityCheckResultRow<IntegrityCheckKey>[]> {\n switch (check) {\n case \"checkDataColumns\": {\n const results: CheckDataColumnsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery)) {\n results.push({ sno: row.sno, table: row.table, column: row.column });\n }\n return results;\n }\n case \"checkECProfile\": {\n const results: CheckECProfileResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery)) {\n results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });\n }\n return results;\n }\n case \"checkNavigationClassIds\": {\n const results: CheckNavClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });\n }\n return results;\n }\n case \"checkNavigationIds\": {\n const results: CheckNavIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkLinktableForeignKeyClassIds\": {\n const results: CheckLinkTableFkClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });\n }\n return results;\n }\n case \"checkLinktableForeignKeyIds\": {\n const results: CheckLinkTableFkIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkClassIds\": {\n const results: CheckClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery)) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });\n }\n return results;\n }\n case \"checkDataSchema\": {\n const results: CheckDataSchemaResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery)) {\n results.push({ sno: row.sno, type: row.type, name: row.name });\n }\n return results;\n }\n case \"checkSchemaLoad\": {\n const results: CheckSchemaLoadResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery)) {\n results.push({ sno: row.sno, schema: row.schema });\n }\n return results;\n }\n case \"checkMissingChildRows\": {\n const results: CheckMissingChildRowsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery)) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });\n }\n return results;\n }\n default:\n throw new IModelError(IModelStatus.BadRequest, `Unknown integrity check type`);\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"IntegrityCheck.js","sourceRoot":"","sources":["../../../src/internal/IntegrityCheck.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,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,EAAE,uFAAuF;KAClG;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,sBAAsB;QAC5B,UAAU,EAAE,sBAAsB;QAClC,UAAU,EAAE,eAAe;QAC3B,QAAQ,EAAE,iFAAiF;KAC5F;IACD,gCAAgC,EAAE;QAChC,IAAI,EAAE,wCAAwC;QAC9C,UAAU,EAAE,mCAAmC;QAC/C,UAAU,EAAE,8BAA8B;QAC1C,QAAQ,EAAE,gGAAgG;KAC3G;IACD,2BAA2B,EAAE;QAC3B,IAAI,EAAE,kCAAkC;QACxC,UAAU,EAAE,8BAA8B;QAC1C,UAAU,EAAE,wBAAwB;QACpC,QAAQ,EAAE,0FAA0F;KACrG;IACD,aAAa,EAAE;QACb,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE,wBAAwB;QACpC,UAAU,EAAE,iBAAiB;QAC7B,QAAQ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,MAAM,OAAO,GAAqC,EAAE,CAAC;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,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC;YAClI,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\n\n/**\n * Information about each integrity check type, including the name, expected result type, and SQL query to execute\n * @internal\n */\nexport const integrityCheckTypeMap = {\n checkDataColumns: {\n name: \"Check Data Columns\",\n resultType: \"CheckDataColumnsResultRow\",\n sqlCommand: \"check_data_columns\",\n sqlQuery: `PRAGMA integrity_check(check_data_columns) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkECProfile: {\n name: \"Check EC Profile\",\n resultType: \"CheckECProfileResultRow\",\n sqlCommand: \"check_ec_profile\",\n sqlQuery: `PRAGMA integrity_check(check_ec_profile) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkNavigationClassIds: {\n name: \"Check Navigation Class Ids\",\n resultType: \"CheckNavClassIdsResultRow\",\n sqlCommand: \"check_nav_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkNavigationIds: {\n name: \"Check Navigation Ids\",\n resultType: \"CheckNavIdsResultRow\",\n sqlCommand: \"check_nav_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkLinktableForeignKeyClassIds: {\n name: \"Check Link Table Foreign Key Class Ids\",\n resultType: \"CheckLinkTableFkClassIdsResultRow\",\n sqlCommand: \"check_linktable_fk_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkLinktableForeignKeyIds: {\n name: \"Check Link Table Foreign Key Ids\",\n resultType: \"CheckLinkTableFkIdsResultRow\",\n sqlCommand: \"check_linktable_fk_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkClassIds: {\n name: \"Check Class Ids\",\n resultType: \"CheckClassIdsResultRow\",\n sqlCommand: \"check_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkDataSchema: {\n name: \"Check Data Schema\",\n resultType: \"CheckDataSchemaResultRow\",\n sqlCommand: \"check_data_schema\",\n sqlQuery: `PRAGMA integrity_check(check_data_schema) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkSchemaLoad: {\n name: \"Check Schema Load\",\n resultType: \"CheckSchemaLoadResultRow\",\n sqlCommand: \"check_schema_load\",\n sqlQuery: `PRAGMA integrity_check(check_schema_load) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkMissingChildRows: {\n name: \"Check Missing Child Rows\",\n resultType: \"CheckMissingChildRowsResultRow\",\n sqlCommand: \"check_missing_child_rows\",\n sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n} as const;\n\n/**\n * Type representing the keys of the integrityCheckType map, which correspond to the different types of integrity checks that can be performed.\n */\nexport type IntegrityCheckKey = keyof typeof integrityCheckTypeMap;\n\n/** Map of integrity check keys to their result row types */\ninterface IntegrityCheckResultTypeMap {\n checkDataColumns: CheckDataColumnsResultRow;\n checkECProfile: CheckECProfileResultRow;\n checkNavigationClassIds: CheckNavClassIdsResultRow;\n checkNavigationIds: CheckNavIdsResultRow;\n checkLinktableForeignKeyClassIds: CheckLinkTableFkClassIdsResultRow;\n checkLinktableForeignKeyIds: CheckLinkTableFkIdsResultRow;\n checkClassIds: CheckClassIdsResultRow;\n checkDataSchema: CheckDataSchemaResultRow;\n checkSchemaLoad: CheckSchemaLoadResultRow;\n checkMissingChildRows: CheckMissingChildRowsResultRow;\n}\n\n/** Checks the Map to give the return type of a specific integrity check */\ntype IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResultTypeMap[K];\n\n/**\n * Return type for quick integrity check\n */\nexport interface QuickIntegrityCheckResultRow {\n check: string;\n passed: boolean;\n elapsedSeconds: string;\n}\n\n/**\n * Return type for Check Data Columns integrity check\n */\nexport interface CheckDataColumnsResultRow {\n sno: number;\n table: string;\n column: string;\n}\n\n/**\n * Return type for Check EC Profile integrity check\n */\nexport interface CheckECProfileResultRow {\n sno: number;\n type: string;\n name: string;\n issue: string;\n}\n\n/**\n * Return type for Check Navigation Class Ids integrity check\n */\nexport interface CheckNavClassIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n navClassId: string;\n}\n\n/**\n * Return type for Check Navigation Ids integrity check\n */\nexport interface CheckNavIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Class Ids integrity check\n */\nexport interface CheckLinkTableFkClassIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n keyClassId: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Ids integrity check\n */\nexport interface CheckLinkTableFkIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Class Ids integrity check\n */\nexport interface CheckClassIdsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n type: string;\n}\n\n/**\n * Return type for Check Data Schema integrity check\n */\nexport interface CheckDataSchemaResultRow {\n sno: number;\n type: string;\n name: string;\n}\n\n/**\n * Return type for Check Schema Load integrity check\n */\nexport interface CheckSchemaLoadResultRow {\n sno: number;\n schema: string;\n}\n\n/**\n * Return type for Check Missing Child Rows integrity check\n */\nexport interface CheckMissingChildRowsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n missingRowInTables: string;\n}\n\n/**\n * Return type for integrity check results, including the check name, whether it passed, and the specific results (if any)\n */\nexport interface IntegrityCheckResult {\n /** The name of the integrity check that was performed */\n check: string;\n /** Whether the integrity check passed (i.e. no issues were found = true) */\n passed: boolean;\n /** The specific results returned by the integrity check, which may include details about any issues that were found.\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,\n * or an array of quick integrity check results if it was a quick check. */\n results: IntegrityCheckResultRow<IntegrityCheckKey>[] | QuickIntegrityCheckResultRow[];\n}\n\n/**\n * Gets the user-friendly name of an integrity check based on its key or SQL command.\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.\n * If still not found, it returns the original check string.\n * @param check - The integrity check key or SQL command to get the name of\n * @returns The user-friendly name of the integrity check, or the original check string if no match is found\n * @internal\n */\nexport function getIntegrityCheckName(check: string): string {\n // First try direct lookup by key\n const directLookup = integrityCheckTypeMap[check as IntegrityCheckKey];\n if (directLookup) {\n return directLookup.name;\n }\n // If not found, search by sqlCommand\n for (const [, value] of Object.entries(integrityCheckTypeMap)) {\n if (value.sqlCommand === check) {\n return value.name;\n }\n }\n // Fallback to the original check string\n return check;\n}\n\n/**\n * Performs a quick integrity check on the given iModel.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @returns An array of results for each check performed, including the check name, whether it passed, and the elapsed time in seconds\n * @internal\n */\nexport async function performQuickIntegrityCheck(iModel: IModelDb): Promise<QuickIntegrityCheckResultRow[]> {\n const integrityCheckQuery = \"PRAGMA integrity_check ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES\";\n const integrityCheckResults: QuickIntegrityCheckResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckQuery, undefined, { usePrimaryConn: true })) {\n integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec});\n };\n return integrityCheckResults;\n}\n\n/**\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.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @param check The key of the specific integrity check to perform\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.\n * @throws IModelError with status BadRequest if an unknown integrity check key is provided\n * @internal\n */\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataColumns\"): Promise<IntegrityCheckResultRow<\"checkDataColumns\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkECProfile\"): Promise<IntegrityCheckResultRow<\"checkECProfile\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationClassIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyClassIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkClassIds\"): Promise<IntegrityCheckResultRow<\"checkClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataSchema\"): Promise<IntegrityCheckResultRow<\"checkDataSchema\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkSchemaLoad\"): Promise<IntegrityCheckResultRow<\"checkSchemaLoad\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkMissingChildRows\"): Promise<IntegrityCheckResultRow<\"checkMissingChildRows\">[]>;\nexport async function performSpecificIntegrityCheck<K extends IntegrityCheckKey>(iModel: IModelDb, check: K): Promise<IntegrityCheckResultRow<K>[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: IntegrityCheckKey): Promise<IntegrityCheckResultRow<IntegrityCheckKey>[]> {\n switch (check) {\n case \"checkDataColumns\": {\n const results: CheckDataColumnsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, table: row.table, column: row.column });\n }\n return results;\n }\n case \"checkECProfile\": {\n const results: CheckECProfileResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });\n }\n return results;\n }\n case \"checkNavigationClassIds\": {\n const results: CheckNavClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });\n }\n return results;\n }\n case \"checkNavigationIds\": {\n const results: CheckNavIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkLinktableForeignKeyClassIds\": {\n const results: CheckLinkTableFkClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });\n }\n return results;\n }\n case \"checkLinktableForeignKeyIds\": {\n const results: CheckLinkTableFkIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkClassIds\": {\n const results: CheckClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });\n }\n return results;\n }\n case \"checkDataSchema\": {\n const results: CheckDataSchemaResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, type: row.type, name: row.name });\n }\n return results;\n }\n case \"checkSchemaLoad\": {\n const results: CheckSchemaLoadResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, schema: row.schema });\n }\n return results;\n }\n case \"checkMissingChildRows\": {\n const results: CheckMissingChildRowsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });\n }\n return results;\n }\n default:\n throw new IModelError(IModelStatus.BadRequest, `Unknown integrity check type`);\n }\n}"]}
|
|
@@ -158,6 +158,7 @@ export declare class IModelTestUtils {
|
|
|
158
158
|
static insertSpatialCategory(iModelDb: IModelDb, modelId: Id64String, categoryName: string, color: ColorDef): Id64String;
|
|
159
159
|
static createBoxes(subCategoryIds: Id64String[]): GeometryStreamProps;
|
|
160
160
|
static createBox(size: Point3d, categoryId?: Id64String, subCategoryId?: Id64String, renderMaterialId?: Id64String, geometryPartId?: Id64String): GeometryStreamProps;
|
|
161
|
+
static insertTextureElement(txn: EditTxn, modelId: Id64String, textureName: string): Id64String;
|
|
161
162
|
static createCylinder(radius: number): GeometryStreamProps;
|
|
162
163
|
static createRectangle(size: Point2d): GeometryStreamProps;
|
|
163
164
|
static queryByUserLabel(iModelDb: IModelDb, userLabel: string): Id64String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTestUtils.d.ts","sourceRoot":"","sources":["../../../src/test/IModelTestUtils.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAkB,UAAU,EAAQ,UAAU,EAAsB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEvI,OAAO,EACuC,oBAAoB,EAAE,IAAI,EAAE,SAAS,EAA2B,QAAQ,EAEpH,mBAAmB,EAAiF,kBAAkB,EAAE,aAAa,EACrI,oBAAoB,EAA0B,cAAc,EAAuB,wBAAwB,EAE5G,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA2B,OAAO,EAAE,OAAO,EAAqE,MAAM,sBAAsB,CAAC;AACpJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAA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WAMxF,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;WASnD,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,mBAAmB;WAYnD,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU;WAQnE,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU;WAQnE,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU;WAW9F,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU;WAa3F,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAgEvD;AAED,qBAAa,qBAAqB;IAChC,MAAM,CAAC,gBAAgB,SAAsB;IAC7C,MAAM,CAAC,eAAe,SAAsB;WAExB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;WAO5C,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;WAiUnD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;WA+FlC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAE,OAAc,GAAG,IAAI;CAoGzF"}
|
|
@@ -523,6 +523,11 @@ export class IModelTestUtils {
|
|
|
523
523
|
}
|
|
524
524
|
return geometryStreamBuilder.geometryStream;
|
|
525
525
|
}
|
|
526
|
+
static insertTextureElement(txn, modelId, textureName) {
|
|
527
|
+
// This is an encoded png containing a 3x3 square with white in top left pixel, blue in middle pixel, and green in bottom right pixel. The rest of the square is red.
|
|
528
|
+
const pngData = [137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 3, 0, 0, 0, 3, 8, 2, 0, 0, 0, 217, 74, 34, 232, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 0, 4, 103, 65, 77, 65, 0, 0, 177, 143, 11, 252, 97, 5, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 14, 195, 0, 0, 14, 195, 1, 199, 111, 168, 100, 0, 0, 0, 24, 73, 68, 65, 84, 24, 87, 99, 248, 15, 4, 12, 12, 64, 4, 198, 64, 46, 132, 5, 162, 254, 51, 0, 0, 195, 90, 10, 246, 127, 175, 154, 145, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130];
|
|
529
|
+
return Texture.insertTexture(txn, modelId, textureName, ImageSourceFormat.Png, Buffer.from(pngData).toString("base64"), `Description for ${textureName}`);
|
|
530
|
+
}
|
|
526
531
|
static createCylinder(radius) {
|
|
527
532
|
const pointA = Point3d.create(0, 0, 0);
|
|
528
533
|
const pointB = Point3d.create(0, 0, 2 * radius);
|