@itwin/core-backend 5.1.0-dev.58 → 5.1.0-dev.60
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 +6 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js +69 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js +65 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts +60 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js +69 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +1442 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +817 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +343 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +207 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +11 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +36 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +17 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +116 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +9 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +20 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -0
- package/package.json +16 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Change Log - @itwin/core-backend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 16 Jul 2025 15:01:35 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.0.4
|
|
6
|
+
Wed, 16 Jul 2025 14:59:59 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
4
9
|
|
|
5
10
|
## 5.0.3
|
|
6
11
|
Fri, 11 Jul 2025 00:56:56 GMT
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module iModels
|
|
3
|
+
*/
|
|
4
|
+
import { ECSqlQueryOptions, ECSqlSchemaLocater, ECSqlSchemaLocaterOptions, SchemaKey, SchemaProps } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { IModelDb } from "./IModelDb";
|
|
6
|
+
/**
|
|
7
|
+
* A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {
|
|
11
|
+
private readonly _iModel;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new IModelIncrementalSchemaLocater instance.
|
|
14
|
+
* @param iModel The [[IModelDb]] to query.
|
|
15
|
+
* @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).
|
|
16
|
+
*/
|
|
17
|
+
constructor(iModel: IModelDb, options?: ECSqlSchemaLocaterOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Gets the [[IModelDb]] targeted by this schema loader.
|
|
20
|
+
*/
|
|
21
|
+
get iModelDb(): IModelDb;
|
|
22
|
+
/**
|
|
23
|
+
* Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).
|
|
24
|
+
* This is the full schema json with all elements that are defined in the schema.
|
|
25
|
+
* @param schemaKey The key of the schema to be resolved.
|
|
26
|
+
*/
|
|
27
|
+
getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Executes an ECSql query against the IModelDb.
|
|
30
|
+
* @param query The query to execute
|
|
31
|
+
* @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.
|
|
32
|
+
* @returns A promise that resolves to read-only array of type TRow.
|
|
33
|
+
*/
|
|
34
|
+
protected executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=IModelIncrementalSchemaLocater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelIncrementalSchemaLocater.d.ts","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEpI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,qBAAa,8BAA+B,SAAQ,kBAAkB;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IAEnC;;;;OAIG;gBACS,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAKjE;;OAEG;IACH,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IAED;;;;OAIG;IACU,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAcnF;;;;;OAKG;cACa,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;CAU7G"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IModelIncrementalSchemaLocater = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
/** @packageDocumentation
|
|
9
|
+
* @module iModels
|
|
10
|
+
*/
|
|
11
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
12
|
+
const core_common_1 = require("@itwin/core-common");
|
|
13
|
+
/**
|
|
14
|
+
* A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
class IModelIncrementalSchemaLocater extends ecschema_metadata_1.ECSqlSchemaLocater {
|
|
18
|
+
_iModel;
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a new IModelIncrementalSchemaLocater instance.
|
|
21
|
+
* @param iModel The [[IModelDb]] to query.
|
|
22
|
+
* @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).
|
|
23
|
+
*/
|
|
24
|
+
constructor(iModel, options) {
|
|
25
|
+
super(options ?? { useMultipleQueries: true });
|
|
26
|
+
this._iModel = iModel;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets the [[IModelDb]] targeted by this schema loader.
|
|
30
|
+
*/
|
|
31
|
+
get iModelDb() {
|
|
32
|
+
return this._iModel;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).
|
|
36
|
+
* This is the full schema json with all elements that are defined in the schema.
|
|
37
|
+
* @param schemaKey The key of the schema to be resolved.
|
|
38
|
+
*/
|
|
39
|
+
async getSchemaProps(schemaKey) {
|
|
40
|
+
// To keep the main thread from being blocked in sync loading cases the resolving
|
|
41
|
+
// is triggered through a timeout. Even if there is no delay, it improves loading
|
|
42
|
+
// time by ~3x.
|
|
43
|
+
return new Promise((resolve, reject) => setTimeout(() => {
|
|
44
|
+
try {
|
|
45
|
+
resolve(this._iModel.getSchemaProps(schemaKey.name));
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
reject(error);
|
|
49
|
+
}
|
|
50
|
+
}, 0));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Executes an ECSql query against the IModelDb.
|
|
54
|
+
* @param query The query to execute
|
|
55
|
+
* @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.
|
|
56
|
+
* @returns A promise that resolves to read-only array of type TRow.
|
|
57
|
+
*/
|
|
58
|
+
async executeQuery(query, options) {
|
|
59
|
+
const queryParameters = options && options.parameters ? core_common_1.QueryBinder.from(options.parameters) : undefined;
|
|
60
|
+
return this._iModel
|
|
61
|
+
.createQueryReader(query, queryParameters, {
|
|
62
|
+
rowFormat: core_common_1.QueryRowFormat.UseECSqlPropertyNames,
|
|
63
|
+
limit: { count: options?.limit },
|
|
64
|
+
})
|
|
65
|
+
.toArray();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.IModelIncrementalSchemaLocater = IModelIncrementalSchemaLocater;
|
|
69
|
+
//# sourceMappingURL=IModelIncrementalSchemaLocater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelIncrementalSchemaLocater.js","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,gEAAoI;AACpI,oDAAiE;AAGjE;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,sCAAkB;IACnD,OAAO,CAAW;IAEnC;;;;OAIG;IACH,YAAY,MAAgB,EAAE,OAAmC;QAC/D,KAAK,CAAC,OAAO,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,cAAc,CAAC,SAAoB;QAC9C,iFAAiF;QACjF,iFAAiF;QACjF,eAAe;QACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE;YACtD,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAgB,CAAC,CAAC;YACtE,CAAC;YACD,OAAO,KAAU,EAAE,CAAC;gBAClB,MAAM,CAAC,KAAc,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACT,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,YAAY,CAAO,KAAa,EAAE,OAA2B;QAC3E,MAAM,eAAe,GAAG,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEzG,OAAO,IAAI,CAAC,OAAO;aAChB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE;YACzC,SAAS,EAAE,4BAAc,CAAC,qBAAqB;YAC/C,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;SACjC,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;CACF;AAvDD,wEAuDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\nimport { ECSqlQueryOptions, ECSqlSchemaLocater, ECSqlSchemaLocaterOptions, SchemaKey, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { QueryBinder, QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\n\n/**\n * A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.\n * @beta\n */\nexport class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {\n private readonly _iModel: IModelDb;\n\n /**\n * Constructs a new IModelIncrementalSchemaLocater instance.\n * @param iModel The [[IModelDb]] to query.\n * @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).\n */\n constructor(iModel: IModelDb, options?: ECSqlSchemaLocaterOptions) {\n super(options ?? { useMultipleQueries: true });\n this._iModel = iModel;\n }\n\n /**\n * Gets the [[IModelDb]] targeted by this schema loader.\n */\n public get iModelDb(): IModelDb {\n return this._iModel;\n }\n\n /**\n * Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).\n * This is the full schema json with all elements that are defined in the schema.\n * @param schemaKey The key of the schema to be resolved.\n */\n public async getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined> {\n // To keep the main thread from being blocked in sync loading cases the resolving\n // is triggered through a timeout. Even if there is no delay, it improves loading\n // time by ~3x.\n return new Promise((resolve, reject) => setTimeout(() => {\n try {\n resolve(this._iModel.getSchemaProps(schemaKey.name) as SchemaProps);\n }\n catch (error: any) {\n reject(error as Error);\n }\n }, 0));\n }\n\n /**\n * Executes an ECSql query against the IModelDb.\n * @param query The query to execute\n * @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.\n * @returns A promise that resolves to read-only array of type TRow.\n */\n protected async executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>> {\n const queryParameters = options && options.parameters ? QueryBinder.from(options.parameters) : undefined;\n\n return this._iModel\n .createQueryReader(query, queryParameters, {\n rowFormat: QueryRowFormat.UseECSqlPropertyNames,\n limit: { count: options?.limit },\n })\n .toArray();\n }\n}"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module iModels
|
|
3
|
+
*/
|
|
4
|
+
import { ECSqlQueryOptions, ECSqlSchemaLocater, ECSqlSchemaLocaterOptions, SchemaKey, SchemaProps } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { IModelDb } from "./IModelDb";
|
|
6
|
+
/**
|
|
7
|
+
* A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {
|
|
11
|
+
private readonly _iModel;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new IModelIncrementalSchemaLocater instance.
|
|
14
|
+
* @param iModel The [[IModelDb]] to query.
|
|
15
|
+
* @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).
|
|
16
|
+
*/
|
|
17
|
+
constructor(iModel: IModelDb, options?: ECSqlSchemaLocaterOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Gets the [[IModelDb]] targeted by this schema loader.
|
|
20
|
+
*/
|
|
21
|
+
get iModelDb(): IModelDb;
|
|
22
|
+
/**
|
|
23
|
+
* Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).
|
|
24
|
+
* This is the full schema json with all elements that are defined in the schema.
|
|
25
|
+
* @param schemaKey The key of the schema to be resolved.
|
|
26
|
+
*/
|
|
27
|
+
getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Executes an ECSql query against the IModelDb.
|
|
30
|
+
* @param query The query to execute
|
|
31
|
+
* @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.
|
|
32
|
+
* @returns A promise that resolves to read-only array of type TRow.
|
|
33
|
+
*/
|
|
34
|
+
protected executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=IModelIncrementalSchemaLocater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelIncrementalSchemaLocater.d.ts","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEpI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,qBAAa,8BAA+B,SAAQ,kBAAkB;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IAEnC;;;;OAIG;gBACS,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAKjE;;OAEG;IACH,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IAED;;;;OAIG;IACU,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAcnF;;;;;OAKG;cACa,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;CAU7G"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module iModels
|
|
7
|
+
*/
|
|
8
|
+
import { ECSqlSchemaLocater } from "@itwin/ecschema-metadata";
|
|
9
|
+
import { QueryBinder, QueryRowFormat } from "@itwin/core-common";
|
|
10
|
+
/**
|
|
11
|
+
* A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {
|
|
15
|
+
_iModel;
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new IModelIncrementalSchemaLocater instance.
|
|
18
|
+
* @param iModel The [[IModelDb]] to query.
|
|
19
|
+
* @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).
|
|
20
|
+
*/
|
|
21
|
+
constructor(iModel, options) {
|
|
22
|
+
super(options ?? { useMultipleQueries: true });
|
|
23
|
+
this._iModel = iModel;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the [[IModelDb]] targeted by this schema loader.
|
|
27
|
+
*/
|
|
28
|
+
get iModelDb() {
|
|
29
|
+
return this._iModel;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).
|
|
33
|
+
* This is the full schema json with all elements that are defined in the schema.
|
|
34
|
+
* @param schemaKey The key of the schema to be resolved.
|
|
35
|
+
*/
|
|
36
|
+
async getSchemaProps(schemaKey) {
|
|
37
|
+
// To keep the main thread from being blocked in sync loading cases the resolving
|
|
38
|
+
// is triggered through a timeout. Even if there is no delay, it improves loading
|
|
39
|
+
// time by ~3x.
|
|
40
|
+
return new Promise((resolve, reject) => setTimeout(() => {
|
|
41
|
+
try {
|
|
42
|
+
resolve(this._iModel.getSchemaProps(schemaKey.name));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
reject(error);
|
|
46
|
+
}
|
|
47
|
+
}, 0));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Executes an ECSql query against the IModelDb.
|
|
51
|
+
* @param query The query to execute
|
|
52
|
+
* @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.
|
|
53
|
+
* @returns A promise that resolves to read-only array of type TRow.
|
|
54
|
+
*/
|
|
55
|
+
async executeQuery(query, options) {
|
|
56
|
+
const queryParameters = options && options.parameters ? QueryBinder.from(options.parameters) : undefined;
|
|
57
|
+
return this._iModel
|
|
58
|
+
.createQueryReader(query, queryParameters, {
|
|
59
|
+
rowFormat: QueryRowFormat.UseECSqlPropertyNames,
|
|
60
|
+
limit: { count: options?.limit },
|
|
61
|
+
})
|
|
62
|
+
.toArray();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=IModelIncrementalSchemaLocater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelIncrementalSchemaLocater.js","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,EAAqB,kBAAkB,EAAqD,MAAM,0BAA0B,CAAC;AACpI,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;;GAGG;AACH,MAAM,OAAO,8BAA+B,SAAQ,kBAAkB;IACnD,OAAO,CAAW;IAEnC;;;;OAIG;IACH,YAAY,MAAgB,EAAE,OAAmC;QAC/D,KAAK,CAAC,OAAO,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,cAAc,CAAC,SAAoB;QAC9C,iFAAiF;QACjF,iFAAiF;QACjF,eAAe;QACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE;YACtD,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAgB,CAAC,CAAC;YACtE,CAAC;YACD,OAAO,KAAU,EAAE,CAAC;gBAClB,MAAM,CAAC,KAAc,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACT,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,YAAY,CAAO,KAAa,EAAE,OAA2B;QAC3E,MAAM,eAAe,GAAG,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEzG,OAAO,IAAI,CAAC,OAAO;aAChB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE;YACzC,SAAS,EAAE,cAAc,CAAC,qBAAqB;YAC/C,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;SACjC,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\nimport { ECSqlQueryOptions, ECSqlSchemaLocater, ECSqlSchemaLocaterOptions, SchemaKey, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { QueryBinder, QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\n\n/**\n * A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.\n * @beta\n */\nexport class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {\n private readonly _iModel: IModelDb;\n\n /**\n * Constructs a new IModelIncrementalSchemaLocater instance.\n * @param iModel The [[IModelDb]] to query.\n * @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).\n */\n constructor(iModel: IModelDb, options?: ECSqlSchemaLocaterOptions) {\n super(options ?? { useMultipleQueries: true });\n this._iModel = iModel;\n }\n\n /**\n * Gets the [[IModelDb]] targeted by this schema loader.\n */\n public get iModelDb(): IModelDb {\n return this._iModel;\n }\n\n /**\n * Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).\n * This is the full schema json with all elements that are defined in the schema.\n * @param schemaKey The key of the schema to be resolved.\n */\n public async getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined> {\n // To keep the main thread from being blocked in sync loading cases the resolving\n // is triggered through a timeout. Even if there is no delay, it improves loading\n // time by ~3x.\n return new Promise((resolve, reject) => setTimeout(() => {\n try {\n resolve(this._iModel.getSchemaProps(schemaKey.name) as SchemaProps);\n }\n catch (error: any) {\n reject(error as Error);\n }\n }, 0));\n }\n\n /**\n * Executes an ECSql query against the IModelDb.\n * @param query The query to execute\n * @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.\n * @returns A promise that resolves to read-only array of type TRow.\n */\n protected async executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>> {\n const queryParameters = options && options.parameters ? QueryBinder.from(options.parameters) : undefined;\n\n return this._iModel\n .createQueryReader(query, queryParameters, {\n rowFormat: QueryRowFormat.UseECSqlPropertyNames,\n limit: { count: options?.limit },\n })\n .toArray();\n }\n}"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
label: string;
|
|
3
|
+
bimFile: string;
|
|
4
|
+
schemas: {
|
|
5
|
+
name: string;
|
|
6
|
+
references: string[];
|
|
7
|
+
itemCount: number;
|
|
8
|
+
checkStubs: {
|
|
9
|
+
item: string;
|
|
10
|
+
properties: {
|
|
11
|
+
schemaItemType: string;
|
|
12
|
+
label: string;
|
|
13
|
+
description: string;
|
|
14
|
+
priority: number;
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
checkHierachy: {
|
|
18
|
+
derivedClass: string;
|
|
19
|
+
baseClass: string;
|
|
20
|
+
};
|
|
21
|
+
checkFullLoad: ({
|
|
22
|
+
item: string;
|
|
23
|
+
properties: {
|
|
24
|
+
description: string;
|
|
25
|
+
properties: {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
typeName: string;
|
|
30
|
+
}[];
|
|
31
|
+
appliesTo: string;
|
|
32
|
+
schemaItemType?: undefined;
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
item: string;
|
|
36
|
+
properties: {
|
|
37
|
+
schemaItemType: string;
|
|
38
|
+
properties: ({
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
label: string;
|
|
43
|
+
category: string;
|
|
44
|
+
typeName: string;
|
|
45
|
+
} | {
|
|
46
|
+
name: string;
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
label: string;
|
|
50
|
+
typeName: string;
|
|
51
|
+
category?: undefined;
|
|
52
|
+
})[];
|
|
53
|
+
description?: undefined;
|
|
54
|
+
appliesTo?: undefined;
|
|
55
|
+
};
|
|
56
|
+
})[];
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
export default _default;
|
|
60
|
+
//# sourceMappingURL=old.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"old.config.d.ts","sourceRoot":"","sources":["../../../../../../src/test/assets/IncrementalSchemaLocater/configs/old.config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAmEC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"label": "Old Profile iModel",
|
|
3
|
+
"bimFile": "OldProfile.bim",
|
|
4
|
+
"schemas": [
|
|
5
|
+
{
|
|
6
|
+
"name": "Schema_TestBase",
|
|
7
|
+
"references": [
|
|
8
|
+
"BisCore"
|
|
9
|
+
],
|
|
10
|
+
"itemCount": 5,
|
|
11
|
+
"checkStubs": [
|
|
12
|
+
{
|
|
13
|
+
"item": "Schema_TestBase.Category_TestBase",
|
|
14
|
+
"properties": {
|
|
15
|
+
"schemaItemType": "PropertyCategory",
|
|
16
|
+
"label": "Test1",
|
|
17
|
+
"description": "Category Test1",
|
|
18
|
+
"priority": 0
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"checkHierachy": {
|
|
23
|
+
"derivedClass": "Schema_TestBase.EntityClass_TestBase",
|
|
24
|
+
"baseClass": "BisCore.PhysicalElement"
|
|
25
|
+
},
|
|
26
|
+
"checkFullLoad": [
|
|
27
|
+
{
|
|
28
|
+
"item": "Schema_TestBase.CustomAttributeClass_Test2",
|
|
29
|
+
"properties": {
|
|
30
|
+
"description": "CustomAttributeClass Test2",
|
|
31
|
+
"properties": [
|
|
32
|
+
{
|
|
33
|
+
"name": "Property_Test1",
|
|
34
|
+
"type": "PrimitiveProperty",
|
|
35
|
+
"description": "Property Test1",
|
|
36
|
+
"typeName": "string"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"appliesTo": "AnyClass"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"item": "Schema_TestBase.StructClass_TestBase",
|
|
44
|
+
"properties": {
|
|
45
|
+
"schemaItemType": "StructClass",
|
|
46
|
+
"properties": [
|
|
47
|
+
{
|
|
48
|
+
"name": "Property_Test1",
|
|
49
|
+
"type": "PrimitiveProperty",
|
|
50
|
+
"description": "Property Test1",
|
|
51
|
+
"label": "Test1",
|
|
52
|
+
"category": "Schema_TestBase.Category_TestBase",
|
|
53
|
+
"typeName": "string"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "Property_Test2",
|
|
57
|
+
"type": "PrimitiveProperty",
|
|
58
|
+
"description": "Property Test2",
|
|
59
|
+
"label": "Test2",
|
|
60
|
+
"typeName": "string"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=old.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"old.config.js","sourceRoot":"","sources":["../../../../../../src/test/assets/IncrementalSchemaLocater/configs/old.config.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,OAAO,EAAE,oBAAoB;IAC7B,SAAS,EAAE,gBAAgB;IAC3B,SAAS,EAAE;QACT;YACE,MAAM,EAAE,iBAAiB;YACzB,YAAY,EAAE;gBACZ,SAAS;aACV;YACD,WAAW,EAAE,CAAC;YACd,YAAY,EAAE;gBACZ;oBACE,MAAM,EAAE,mCAAmC;oBAC3C,YAAY,EAAE;wBACZ,gBAAgB,EAAE,kBAAkB;wBACpC,OAAO,EAAE,OAAO;wBAChB,aAAa,EAAE,gBAAgB;wBAC/B,UAAU,EAAE,CAAC;qBACd;iBACF;aACF;YACD,eAAe,EAAE;gBACf,cAAc,EAAE,sCAAsC;gBACtD,WAAW,EAAE,yBAAyB;aACvC;YACD,eAAe,EAAE;gBACf;oBACE,MAAM,EAAE,4CAA4C;oBACpD,YAAY,EAAE;wBACZ,aAAa,EAAE,4BAA4B;wBAC3C,YAAY,EAAE;4BACZ;gCACE,MAAM,EAAE,gBAAgB;gCACxB,MAAM,EAAE,mBAAmB;gCAC3B,aAAa,EAAE,gBAAgB;gCAC/B,UAAU,EAAE,QAAQ;6BACrB;yBACF;wBACD,WAAW,EAAE,UAAU;qBACxB;iBACF;gBACD;oBACE,MAAM,EAAE,sCAAsC;oBAC9C,YAAY,EAAE;wBACZ,gBAAgB,EAAE,aAAa;wBAC/B,YAAY,EAAE;4BACZ;gCACE,MAAM,EAAE,gBAAgB;gCACxB,MAAM,EAAE,mBAAmB;gCAC3B,aAAa,EAAE,gBAAgB;gCAC/B,OAAO,EAAE,OAAO;gCAChB,UAAU,EAAE,mCAAmC;gCAC/C,UAAU,EAAE,QAAQ;6BACrB;4BACD;gCACE,MAAM,EAAE,gBAAgB;gCACxB,MAAM,EAAE,mBAAmB;gCAC3B,aAAa,EAAE,gBAAgB;gCAC/B,OAAO,EAAE,OAAO;gCAChB,UAAU,EAAE,QAAQ;6BACrB;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAA","sourcesContent":["export default {\n \"label\": \"Old Profile iModel\",\n \"bimFile\": \"OldProfile.bim\",\n \"schemas\": [\n {\n \"name\": \"Schema_TestBase\",\n \"references\": [\n \"BisCore\"\n ],\n \"itemCount\": 5,\n \"checkStubs\": [\n {\n \"item\": \"Schema_TestBase.Category_TestBase\",\n \"properties\": {\n \"schemaItemType\": \"PropertyCategory\",\n \"label\": \"Test1\",\n \"description\": \"Category Test1\",\n \"priority\": 0\n }\n }\n ],\n \"checkHierachy\": {\n \"derivedClass\": \"Schema_TestBase.EntityClass_TestBase\",\n \"baseClass\": \"BisCore.PhysicalElement\"\n },\n \"checkFullLoad\": [\n {\n \"item\": \"Schema_TestBase.CustomAttributeClass_Test2\",\n \"properties\": {\n \"description\": \"CustomAttributeClass Test2\",\n \"properties\": [\n {\n \"name\": \"Property_Test1\",\n \"type\": \"PrimitiveProperty\",\n \"description\": \"Property Test1\",\n \"typeName\": \"string\"\n }\n ],\n \"appliesTo\": \"AnyClass\"\n }\n },\n {\n \"item\": \"Schema_TestBase.StructClass_TestBase\",\n \"properties\": {\n \"schemaItemType\": \"StructClass\",\n \"properties\": [\n {\n \"name\": \"Property_Test1\",\n \"type\": \"PrimitiveProperty\",\n \"description\": \"Property Test1\",\n \"label\": \"Test1\",\n \"category\": \"Schema_TestBase.Category_TestBase\",\n \"typeName\": \"string\"\n },\n {\n \"name\": \"Property_Test2\",\n \"type\": \"PrimitiveProperty\",\n \"description\": \"Property Test2\",\n \"label\": \"Test2\",\n \"typeName\": \"string\"\n }\n ]\n }\n }\n ]\n }\n ]\n}"]}
|