@itwin/ecschema-metadata 5.2.0-dev.2 → 5.2.0-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +7 -2
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts +37 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js +58 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -0
- package/lib/cjs/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
- package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -0
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js +52 -26
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts +16 -3
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js +5 -4
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js +2 -7
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js +16 -16
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +3 -3
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts +10 -4
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.js +19 -19
- package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +1 -1
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +9 -22
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +2 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +2 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +7 -2
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts +37 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.js +54 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -0
- package/lib/esm/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/esm/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
- package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -0
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js +51 -25
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts +16 -3
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js +5 -4
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js +2 -7
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js +16 -16
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js +3 -3
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts +10 -4
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.js +19 -19
- package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +1 -1
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +9 -22
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +2 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +2 -1
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/package.json +6 -6
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js +0 -82
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js.map +0 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +0 -1
- package/lib/cjs/SchemaFormatsProvider.js.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.js +0 -78
- package/lib/esm/IncrementalLoading/PerformanceLogger.js.map +0 -1
- package/lib/esm/SchemaFormatsProvider.d.ts.map +0 -1
- package/lib/esm/SchemaFormatsProvider.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ECSqlSchemaLocater = void 0;
|
|
2
4
|
/*---------------------------------------------------------------------------------------------
|
|
3
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
7
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
|
|
7
|
-
exports.ECSqlSchemaLocater = void 0;
|
|
8
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
8
9
|
const ECObjects_1 = require("../ECObjects");
|
|
9
10
|
const SchemaKey_1 = require("../SchemaKey");
|
|
10
11
|
const FullSchemaQueries_1 = require("./FullSchemaQueries");
|
|
@@ -12,6 +13,7 @@ const IncrementalSchemaLocater_1 = require("./IncrementalSchemaLocater");
|
|
|
12
13
|
const SchemaItemQueries_1 = require("./SchemaItemQueries");
|
|
13
14
|
const SchemaParser_1 = require("./SchemaParser");
|
|
14
15
|
const SchemaStubQueries_1 = require("./SchemaStubQueries");
|
|
16
|
+
const LOGGER_CATEGORY = "IncrementalSchemaLoading.Performance";
|
|
15
17
|
/**
|
|
16
18
|
* An abstract [[IncrementalSchemaLocater]] implementation for loading
|
|
17
19
|
* EC [Schema] instances from an iModelDb using ECSql queries.
|
|
@@ -44,17 +46,19 @@ class ECSqlSchemaLocater extends IncrementalSchemaLocater_1.IncrementalSchemaLoc
|
|
|
44
46
|
// to fetch the whole schema json.
|
|
45
47
|
if (!await this.supportPartialSchemaLoading(context))
|
|
46
48
|
return this.getSchemaProps(schemaKey);
|
|
47
|
-
const
|
|
49
|
+
const queryStart = Date.now();
|
|
48
50
|
const schemaProps = this.options.useMultipleQueries
|
|
49
51
|
? await this.getFullSchemaMultipleQueries(schemaKey, context)
|
|
50
52
|
: await this.getFullSchema(schemaKey, context);
|
|
51
|
-
|
|
53
|
+
const queryDuration = Date.now() - queryStart;
|
|
54
|
+
core_bentley_1.Logger.logTrace(LOGGER_CATEGORY, `Recieved SchemaProps for ${schemaKey.name} in ${queryDuration}ms`, {
|
|
55
|
+
schemaName: schemaKey.name,
|
|
56
|
+
queryMode: this.options.useMultipleQueries ? "parallel" : "single",
|
|
57
|
+
duration: queryDuration,
|
|
58
|
+
});
|
|
52
59
|
return schemaProps;
|
|
53
60
|
}
|
|
54
61
|
;
|
|
55
|
-
/**
|
|
56
|
-
* Gets the [[SchemaProps]] without schemaItems.
|
|
57
|
-
*/
|
|
58
62
|
/**
|
|
59
63
|
* Gets the [[SchemaProps]] without schemaItems for the given schema name.
|
|
60
64
|
* @param schemaName The name of the Schema.
|
|
@@ -68,7 +72,8 @@ class ECSqlSchemaLocater extends IncrementalSchemaLocater_1.IncrementalSchemaLoc
|
|
|
68
72
|
if (schemaRow === undefined)
|
|
69
73
|
return undefined;
|
|
70
74
|
const schema = JSON.parse(schemaRow.schema);
|
|
71
|
-
|
|
75
|
+
const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
|
|
76
|
+
return SchemaParser_1.SchemaParser.parse(schema, schemaInfos);
|
|
72
77
|
}
|
|
73
78
|
/**
|
|
74
79
|
* Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.
|
|
@@ -246,10 +251,16 @@ class ECSqlSchemaLocater extends IncrementalSchemaLocater_1.IncrementalSchemaLoc
|
|
|
246
251
|
* @internal
|
|
247
252
|
*/
|
|
248
253
|
async getSchemaPartials(schemaKey, context) {
|
|
254
|
+
const queryStart = Date.now();
|
|
249
255
|
const [schemaRow] = await this.executeQuery(SchemaStubQueries_1.ecsqlQueries.schemaStubQuery, {
|
|
250
256
|
parameters: { schemaName: schemaKey.name },
|
|
251
257
|
limit: 1
|
|
252
258
|
});
|
|
259
|
+
const queryDuration = Date.now() - queryStart;
|
|
260
|
+
core_bentley_1.Logger.logTrace(LOGGER_CATEGORY, `Recieved PartialSchema for ${schemaKey.name} in ${queryDuration}ms`, {
|
|
261
|
+
schemaName: schemaKey.name,
|
|
262
|
+
duration: queryDuration,
|
|
263
|
+
});
|
|
253
264
|
if (!schemaRow)
|
|
254
265
|
return undefined;
|
|
255
266
|
const schemaPartials = [];
|
|
@@ -270,11 +281,12 @@ class ECSqlSchemaLocater extends IncrementalSchemaLocater_1.IncrementalSchemaLoc
|
|
|
270
281
|
if (!schemaStub) {
|
|
271
282
|
schemaStub = await addSchema(SchemaKey_1.SchemaKey.parseString(`${schemaName}.0.0.0`));
|
|
272
283
|
}
|
|
273
|
-
|
|
274
|
-
|
|
284
|
+
let items = schemaStub.items;
|
|
285
|
+
if (!items) {
|
|
286
|
+
Object.assign(schemaStub, items = { items: {} });
|
|
275
287
|
}
|
|
276
|
-
const existingItem =
|
|
277
|
-
Object.assign(
|
|
288
|
+
const existingItem = items[itemInfo.name] || {};
|
|
289
|
+
Object.assign(items, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });
|
|
278
290
|
};
|
|
279
291
|
const reviver = (_key, value) => {
|
|
280
292
|
if (value === null) {
|
|
@@ -283,19 +295,27 @@ class ECSqlSchemaLocater extends IncrementalSchemaLocater_1.IncrementalSchemaLoc
|
|
|
283
295
|
return value;
|
|
284
296
|
};
|
|
285
297
|
await addSchema(schemaKey);
|
|
286
|
-
|
|
298
|
+
const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
|
|
299
|
+
await parseSchemaItemStubs(schemaKey.name, JSON.parse(schemaRow.items, reviver), addItems, schemaInfos);
|
|
287
300
|
return schemaPartials;
|
|
288
301
|
}
|
|
289
302
|
async querySchemaItem(context, schemaName, query, schemaType) {
|
|
290
303
|
const start = Date.now();
|
|
291
304
|
const itemRows = await this.executeQuery(query, { parameters: { schemaName } });
|
|
292
|
-
|
|
305
|
+
const queryDuration = Date.now() - start;
|
|
306
|
+
core_bentley_1.Logger.logTrace(LOGGER_CATEGORY, `Recieved rows of ${schemaType} items for ${schemaName} in ${queryDuration}ms`, {
|
|
307
|
+
schemaName,
|
|
308
|
+
itemCount: itemRows.length,
|
|
309
|
+
itemType: schemaType,
|
|
310
|
+
duration: queryDuration,
|
|
311
|
+
});
|
|
293
312
|
if (itemRows.length === 0)
|
|
294
313
|
return [];
|
|
295
314
|
const items = itemRows.map((itemRow) => {
|
|
296
315
|
return "string" === typeof itemRow.item ? JSON.parse(itemRow.item) : itemRow.item;
|
|
297
316
|
});
|
|
298
|
-
|
|
317
|
+
const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
|
|
318
|
+
return await SchemaParser_1.SchemaParser.parseSchemaItems(items, schemaName, schemaInfos) ?? [];
|
|
299
319
|
}
|
|
300
320
|
async getFullSchema(schemaKey, context) {
|
|
301
321
|
const schemaRows = await this.executeQuery(FullSchemaQueries_1.FullSchemaQueries.schemaQuery, { parameters: { schemaName: schemaKey.name } });
|
|
@@ -307,13 +327,14 @@ class ECSqlSchemaLocater extends IncrementalSchemaLocater_1.IncrementalSchemaLoc
|
|
|
307
327
|
if (schema.items) {
|
|
308
328
|
schema.items = schema.items.map((itemRow) => { return itemRow.item; });
|
|
309
329
|
}
|
|
310
|
-
|
|
330
|
+
const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
|
|
331
|
+
return SchemaParser_1.SchemaParser.parse(schema, schemaInfos);
|
|
311
332
|
}
|
|
312
333
|
async getFullSchemaMultipleQueries(schemaKey, context) {
|
|
313
334
|
const schema = await this.getSchemaNoItems(schemaKey.name, context);
|
|
314
335
|
if (!schema)
|
|
315
336
|
return undefined;
|
|
316
|
-
schema.items = {};
|
|
337
|
+
const items = schema.items || (schema.items = {});
|
|
317
338
|
await Promise.all([
|
|
318
339
|
this.getEntities(schemaKey.name, context),
|
|
319
340
|
this.getMixins(schemaKey.name, context),
|
|
@@ -330,9 +351,14 @@ class ECSqlSchemaLocater extends IncrementalSchemaLocater_1.IncrementalSchemaLoc
|
|
|
330
351
|
this.getPhenomenon(schemaKey.name, context),
|
|
331
352
|
this.getFormats(schemaKey.name, context)
|
|
332
353
|
]).then((itemResults) => {
|
|
333
|
-
const flatItemList = itemResults.reduce((acc,
|
|
354
|
+
const flatItemList = itemResults.reduce((acc, result) => acc.concat(result));
|
|
334
355
|
flatItemList.forEach((schemaItem) => {
|
|
335
|
-
|
|
356
|
+
if (!schemaItem.name) {
|
|
357
|
+
// This should never be happen, as we query the schema items by name from the database, but since the SchemaProps
|
|
358
|
+
// have name optional, we need the check here to make the compiler happy.
|
|
359
|
+
throw new Error(`SchemaItem with no name encountered in schema ${schemaKey.name}`);
|
|
360
|
+
}
|
|
361
|
+
items[schemaItem.name] = schemaItem;
|
|
336
362
|
});
|
|
337
363
|
});
|
|
338
364
|
return schema;
|
|
@@ -342,7 +368,7 @@ exports.ECSqlSchemaLocater = ECSqlSchemaLocater;
|
|
|
342
368
|
function parseSchemaReference(referenceName) {
|
|
343
369
|
return { schemaKey: SchemaKey_1.SchemaKey.parseString(referenceName) };
|
|
344
370
|
}
|
|
345
|
-
async function parseSchemaItemStubs(schemaName,
|
|
371
|
+
async function parseSchemaItemStubs(schemaName, itemRows, addItemsHandler, schemaInfos) {
|
|
346
372
|
if (!itemRows || itemRows.length === 0) {
|
|
347
373
|
return;
|
|
348
374
|
}
|
|
@@ -353,32 +379,32 @@ async function parseSchemaItemStubs(schemaName, context, itemRows, addItemsHandl
|
|
|
353
379
|
const currentItem = baseClasses[index--];
|
|
354
380
|
const baseClassItem = baseClasses[index];
|
|
355
381
|
const baseClassName = baseClassItem ? `${baseClassItem.schema}.${baseClassItem.name}` : undefined;
|
|
356
|
-
const schemaItem = await SchemaParser_1.SchemaParser.parseItem(currentItem, currentItem.schema,
|
|
382
|
+
const schemaItem = await SchemaParser_1.SchemaParser.parseItem(currentItem, currentItem.schema, schemaInfos);
|
|
357
383
|
await addItemsHandler(currentItem.schema, {
|
|
358
384
|
...schemaItem,
|
|
359
385
|
name: schemaItem.name,
|
|
360
|
-
schemaItemType:
|
|
386
|
+
schemaItemType: schemaItem.schemaItemType,
|
|
361
387
|
baseClass: baseClassName,
|
|
362
388
|
});
|
|
363
389
|
}
|
|
364
390
|
};
|
|
365
391
|
for (const itemRow of itemRows) {
|
|
366
|
-
const schemaItem = await SchemaParser_1.SchemaParser.parseItem(itemRow, schemaName,
|
|
392
|
+
const schemaItem = await SchemaParser_1.SchemaParser.parseItem(itemRow, schemaName, schemaInfos);
|
|
367
393
|
await addItemsHandler(schemaName, {
|
|
368
394
|
...schemaItem,
|
|
369
395
|
name: schemaItem.name,
|
|
370
|
-
schemaItemType:
|
|
396
|
+
schemaItemType: schemaItem.schemaItemType,
|
|
371
397
|
mixins: itemRow.mixins
|
|
372
398
|
? itemRow.mixins.map(mixin => { return `${mixin.schema}.${mixin.name}`; })
|
|
373
399
|
: undefined,
|
|
374
400
|
});
|
|
375
401
|
await parseBaseClasses(itemRow.baseClasses);
|
|
376
402
|
for (const mixinRow of itemRow.mixins || []) {
|
|
377
|
-
const mixinItem = await SchemaParser_1.SchemaParser.parseItem(mixinRow, mixinRow.schema,
|
|
403
|
+
const mixinItem = await SchemaParser_1.SchemaParser.parseItem(mixinRow, mixinRow.schema, schemaInfos);
|
|
378
404
|
await addItemsHandler(mixinRow.schema, {
|
|
379
405
|
...mixinItem,
|
|
380
406
|
name: mixinItem.name,
|
|
381
|
-
schemaItemType:
|
|
407
|
+
schemaItemType: mixinItem.schemaItemType,
|
|
382
408
|
});
|
|
383
409
|
await parseBaseClasses(mixinRow.baseClasses);
|
|
384
410
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSqlSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/ECSqlSchemaLocater.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAMhG,4CAAoF;AAEpF,4CAAyC;AACzC,2DAAwD;AACxD,yEAA4F;AAE5F,2DAAwD;AACxD,iDAA8C;AAC9C,2DAAmD;AAoFnD;;;;GAIG;AACH,MAAsB,kBAAmB,SAAQ,mDAAwB;IACvE;;OAEG;IACH,IAAuB,OAAO;QAC5B,OAAO,KAAK,CAAC,OAAoC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,YAAY,OAAmC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAgBD;;;;;;OAMG;IACI,KAAK,CAAC,aAAa,CAAC,SAAoB,EAAE,OAAsB;QACrE,gHAAgH;QAChH,gHAAgH;QAChH,kCAAkC;QAClC,IAAI,CAAC,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC;YAClD,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAExC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB;YACjD,CAAC,CAAC,MAAM,IAAI,CAAC,4BAA4B,CAAC,SAAS,EAAE,OAAO,CAAC;YAC7D,CAAC,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC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E,OAAO,CAAC,CAAC;QAC9E,MAAM,eAAe,CAAC,UAAU,EAAE;YAChC,GAAG,UAAU;YACb,IAAI,EAAE,UAAU,CAAC,IAAK;YACtB,cAAc,EAAE,IAAA,+BAAmB,EAAC,UAAU,CAAC,cAAe,CAAE;YAChE,MAAM,EAAE,OAAO,CAAC,MAAM;gBACpB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC,CAAC,SAAS;SACd,CAAC,CAAC;QAEH,MAAM,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE5C,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC5C,MAAM,SAAS,GAAG,MAAM,2BAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACnF,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACrC,GAAG,SAAS;gBACZ,IAAI,EAAE,SAAS,CAAC,IAAK;gBACrB,cAAc,EAAE,IAAA,+BAAmB,EAAC,SAAS,CAAC,cAAe,CAAE;aAChE,CAAC,CAAC;YACH,MAAM,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC;IACH,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 { SchemaContext } from \"../Context\";\nimport { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\n PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemProps, SchemaItemUnitProps, SchemaProps,\n StructClassProps, UnitSystemProps } from \"../Deserialization/JsonProps\";\nimport { parseSchemaItemType, SchemaItemType, SchemaMatchType } from \"../ECObjects\";\nimport { SchemaInfo, WithSchemaKey } from \"../Interfaces\";\nimport { SchemaKey } from \"../SchemaKey\";\nimport { FullSchemaQueries } from \"./FullSchemaQueries\";\nimport { IncrementalSchemaLocater, SchemaLocaterOptions } from \"./IncrementalSchemaLocater\";\nimport { PerformanceLogger } from \"./PerformanceLogger\";\nimport { SchemaItemQueries } from \"./SchemaItemQueries\";\nimport { SchemaParser } from \"./SchemaParser\";\nimport { ecsqlQueries } from \"./SchemaStubQueries\";\n\ninterface SchemaItemInfo {\n readonly name: string;\n readonly schemaItemType: SchemaItemType;\n}\n\ninterface SchemaInfoRow {\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly references: string;\n}\n\ninterface SchemaStubRow {\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly displayLabel: string;\n readonly description: string;\n readonly references: string;\n readonly items: string;\n}\n\ninterface BaseClassStubRow {\n readonly schema: string;\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier: number;\n}\n\ninterface SchemaItemStubRow {\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier?: number;\n readonly baseClasses?: Array<BaseClassStubRow>;\n readonly mixins?: Array<{\n readonly schema: string,\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier: number;\n readonly baseClasses?: Array<BaseClassStubRow>\n }>;\n}\n\ninterface SchemaRow {\n schema: string\n}\n\ninterface SchemaItemRow {\n item: string | SchemaItemProps;\n}\n\ntype AddSchemaItemHandler = <T extends SchemaItemInfo>(schemaName: string, itemStub: T) => Promise<void>;\n\ntype MutableSchemaProps = {\n -readonly [K in keyof SchemaProps]: SchemaProps[K]\n};\n\ninterface QueryParameters {\n [parameterName: string]: string | number;\n}\n\n/**\n * Query options used by the ECSqlSchemaLocater.\n * @internal\n */\nexport interface ECSqlQueryOptions {\n parameters?: QueryParameters;\n limit?: number;\n}\n\n/**\n * Defines the [[ECSqlSchemaLocater]] options which determine how each\n * schema is to be loaded. All options are optional.\n * @internal\n */\nexport interface ECSqlSchemaLocaterOptions extends SchemaLocaterOptions {\n /** Query for Schemas using multiple queries. Defaults to false. */\n readonly useMultipleQueries?: boolean;\n /** Collects query execution performance data. Defaults to false. */\n readonly performanceLogger?: PerformanceLogger;\n}\n\n/**\n * An abstract [[IncrementalSchemaLocater]] implementation for loading\n * EC [Schema] instances from an iModelDb using ECSql queries.\n * @internal\n */\nexport abstract class ECSqlSchemaLocater extends IncrementalSchemaLocater {\n /**\n * Gets the [[ECSqlSchemaLocaterOptions]] used by this locater.\n */\n protected override get options(): ECSqlSchemaLocaterOptions {\n return super.options as ECSqlSchemaLocaterOptions;\n }\n\n /**\n * Initializes a new ECSqlSchemaLocater instance.\n * @param options The options used by this Schema locater.\n */\n constructor(options?: ECSqlSchemaLocaterOptions) {\n super(options);\n }\n\n /**\n * Executes the given ECSql query and returns the resulting rows.\n * @param query The ECSql query to execute.\n * @param options Optional arguments to control the query result.\n * @returns A promise that resolves to the resulting rows.\n */\n protected abstract executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>>;\n\n /**\n * Gets the [[SchemaProps]] for the given schema key.\n * @param schemaKey The schema key of the schema to be resolved.\n */\n protected abstract getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined>\n\n /**\n * Gets the [[SchemaProps]] for the given schema key. This is the full schema json with all elements that are defined\n * in the schema. The schema locater calls this after the stub has been loaded to fully load the schema in the background.\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\n * @param context The [[SchemaContext]] to use for resolving references.\n * @internal\n */\n public async getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n // If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema\n // information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface\n // to fetch the whole schema json.\n if (!await this.supportPartialSchemaLoading(context))\n return this.getSchemaProps(schemaKey);\n\n const start = Date.now();\n const schemaProps = this.options.useMultipleQueries\n ? await this.getFullSchemaMultipleQueries(schemaKey, context)\n : await this.getFullSchema(schemaKey, context);\n\n this.options.performanceLogger?.logSchema(start, schemaKey.name);\n\n return schemaProps;\n };\n\n /**\n * Gets the [[SchemaProps]] without schemaItems.\n */\n /**\n * Gets the [[SchemaProps]] without schemaItems for the given schema name.\n * @param schemaName The name of the Schema.\n * @param context The [[SchemaContext]] to use for resolving references.\n * @returns\n * @internal\n */\n public async getSchemaNoItems(schemaName: string, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaNoItemsQuery, { parameters: { schemaName } });\n const schemaRow = schemaRows[0];\n if (schemaRow === undefined)\n return undefined;\n\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\n return SchemaParser.parse(schema, context);\n }\n\n /**\n * Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.\n * @param context The schema context to lookup the meta schema.\n * @returns true if the context has a supported meta schema version, false otherwise.\n */\n protected async supportPartialSchemaLoading(context: SchemaContext): Promise<boolean> {\n const metaSchemaKey = new SchemaKey(\"ECDbMeta\", 4, 0, 3);\n const metaSchemaInfo = await context.getSchemaInfo(metaSchemaKey, SchemaMatchType.LatestWriteCompatible);\n return metaSchemaInfo !== undefined;\n };\n\n /**\n * Gets all the Schema's Entity classes as [[EntityClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The [[SchemaContext]] to which the schema belongs.\n * @returns A promise that resolves to a EntityClassProps array. Maybe empty of no entities are found.\n * @internal\n */\n public async getEntities(schema: string, context: SchemaContext, queryOverride?: string): Promise<EntityClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.entityQuery;\n return this.querySchemaItem<EntityClassProps>(context, schema, query, \"EntityClass\");\n }\n\n /**\n * Gets all the Schema's Mixin classes as [[MixinProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a MixinProps array. Maybe empty of no entities are found.\n * @internal\n */\n public async getMixins(schema: string, context: SchemaContext, queryOverride?: string): Promise<MixinProps[]> {\n const query = queryOverride ?? FullSchemaQueries.mixinQuery;\n return this.querySchemaItem<MixinProps>(context, schema, query, \"Mixin\");\n }\n\n /**\n * Gets all the Schema's Relationship classes as [[RelationshipClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a RelationshipClassProps array. Maybe empty if no items are found.\n * @internal\n */\n public async getRelationships(schema: string, context: SchemaContext, queryOverride?: string): Promise<RelationshipClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.relationshipClassQuery;\n return this.querySchemaItem<RelationshipClassProps>(context, schema, query, \"RelationshipClass\");\n }\n\n /**\n * Gets all the Schema's CustomAttributeClass items as [[CustomAttributeClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a CustomAttributeClassProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getCustomAttributeClasses(schema: string, context: SchemaContext, queryOverride?: string): Promise<CustomAttributeClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.customAttributeQuery;\n return this.querySchemaItem<CustomAttributeClassProps>(context, schema, query, \"CustomAttributeClass\");\n }\n\n\n /**\n * Gets all the Schema's StructClass items as [[StructClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a StructClassProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getStructs(schema: string, context: SchemaContext, queryOverride?: string): Promise<StructClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.structQuery;\n return this.querySchemaItem<StructClassProps>(context, schema, query, \"StructClass\");\n }\n\n /**\n * Gets all the Schema's KindOfQuantity items as [[KindOfQuantityProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a KindOfQuantityProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getKindOfQuantities(schema: string, context: SchemaContext): Promise<KindOfQuantityProps[]> {\n return this.querySchemaItem<KindOfQuantityProps>(context, schema, SchemaItemQueries.kindOfQuantity(true), \"KindOfQuantity\");\n }\n\n /**\n * Gets all the Schema's PropertyCategory items as [[PropertyCategoryProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a PropertyCategoryProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getPropertyCategories(schema: string, context: SchemaContext): Promise<PropertyCategoryProps[]> {\n return this.querySchemaItem<PropertyCategoryProps>(context, schema, SchemaItemQueries.propertyCategory(true), \"PropertyCategory\");\n }\n\n /**\n * Gets all the Schema's Enumeration items as [[EnumerationProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a EnumerationProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getEnumerations(schema: string, context: SchemaContext): Promise<EnumerationProps[]> {\n return this.querySchemaItem<EnumerationProps>(context, schema, SchemaItemQueries.enumeration(true), \"Enumeration\");\n }\n\n /**\n * Gets all the Schema's Unit items as [[SchemaItemUnitProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a SchemaItemUnitProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getUnits(schema: string, context: SchemaContext): Promise<SchemaItemUnitProps[]> {\n return this.querySchemaItem<SchemaItemUnitProps>(context, schema, SchemaItemQueries.unit(true), \"Unit\");\n }\n\n /**\n * Gets all the Schema's InvertedUnit items as [[InvertedUnitProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a InvertedUnitProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getInvertedUnits(schema: string, context: SchemaContext): Promise<InvertedUnitProps[]> {\n return this.querySchemaItem<InvertedUnitProps>(context, schema, SchemaItemQueries.invertedUnit(true), \"InvertedUnit\");\n }\n\n /**\n * Gets all the Schema's Constant items as [[ConstantProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a ConstantProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getConstants(schema: string, context: SchemaContext): Promise<ConstantProps[]> {\n return this.querySchemaItem<ConstantProps>(context, schema, SchemaItemQueries.constant(true), \"Constant\");\n }\n\n /**\n * Gets all the Schema's UnitSystem items as [[UnitSystemProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a UnitSystemProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getUnitSystems(schema: string, context: SchemaContext): Promise<UnitSystemProps[]> {\n return this.querySchemaItem<UnitSystemProps>(context, schema, SchemaItemQueries.unitSystem(true), \"UnitSystem\");\n }\n\n /**\n * Gets all the Schema's Phenomenon items as [[PhenomenonProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a PhenomenonProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getPhenomenon(schema: string, context: SchemaContext): Promise<PhenomenonProps[]> {\n return this.querySchemaItem<PhenomenonProps>(context, schema, SchemaItemQueries.phenomenon(true), \"Phenomenon\");\n }\n\n /**\n * Gets all the Schema's Format items as [[SchemaItemFormatProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a SchemaItemFormatProps array. Maybe empty if not items are found.\n * @internal\n */\n public async getFormats(schema: string, context: SchemaContext): Promise<SchemaItemFormatProps[]> {\n return this.querySchemaItem<SchemaItemFormatProps>(context, schema, SchemaItemQueries.format(true), \"Format\");\n }\n\n /**\n * Gets [[SchemaInfo]] objects for all schemas including their direct schema references.\n * @internal\n */\n public async loadSchemaInfos(): Promise<ReadonlyArray<SchemaInfo>> {\n const schemaRows = await this.executeQuery<SchemaInfoRow>(ecsqlQueries.schemaInfoQuery);\n return schemaRows.map((schemaRow) => (\n {\n alias: schemaRow.alias,\n schemaKey: SchemaKey.parseString(`${schemaRow.name}.${schemaRow.version}`),\n references: Array.from(JSON.parse(schemaRow.references), parseSchemaReference),\n }\n ));\n }\n\n /**\n * Gets the [[SchemaProps]] to create the basic schema skeleton. Depending on which options are set, the schema items or class hierarchy\n * can be included in the initial fetch.\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\n * @returns A promise that resolves to the schema partials, which is an array of [[SchemaProps]].\n * @internal\n */\n public async getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined> {\n const [schemaRow] = await this.executeQuery<SchemaStubRow>(ecsqlQueries.schemaStubQuery, {\n parameters: { schemaName: schemaKey.name },\n limit: 1\n });\n\n if (!schemaRow)\n return undefined;\n\n const schemaPartials: Array<SchemaProps> = [];\n const addSchema = async (key: SchemaKey) => {\n const stub = await this.createSchemaProps(key, context);\n schemaPartials.push(stub);\n\n if (stub.references) {\n for (const referenceProps of stub.references) {\n if (!schemaPartials.some((schema) => schema.name === referenceProps.name)) {\n await addSchema(SchemaKey.parseString(`${referenceProps.name}.${referenceProps.version}`));\n }\n }\n }\n\n return stub;\n };\n\n const addItems = async (schemaName: string, itemInfo: SchemaItemInfo) => {\n let schemaStub = schemaPartials.find((schema) => schema.name === schemaName);\n if (!schemaStub) {\n schemaStub = await addSchema(SchemaKey.parseString(`${schemaName}.0.0.0`));\n }\n\n if (!schemaStub.items) {\n Object.assign(schemaStub, { items: {} });\n }\n\n const existingItem = schemaStub.items![itemInfo.name] || {};\n Object.assign(schemaStub.items!, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });\n };\n\n const reviver = (_key: string, value: any) => {\n if (value === null) {\n return undefined;\n }\n return value;\n };\n\n await addSchema(schemaKey);\n\n await parseSchemaItemStubs(schemaKey.name, context, JSON.parse(schemaRow.items, reviver), addItems);\n\n return schemaPartials;\n }\n\n private async querySchemaItem<TRow extends SchemaItemProps>(context: SchemaContext, schemaName: string, query: string, schemaType: string): Promise<Array<TRow>> {\n const start = Date.now();\n const itemRows = await this.executeQuery<SchemaItemRow>(query, { parameters: { schemaName } });\n this.options.performanceLogger?.logSchemaItem(start, schemaName, schemaType, itemRows.length);\n\n if (itemRows.length === 0)\n return [];\n\n const items = itemRows.map((itemRow: SchemaItemRow) => {\n return \"string\" === typeof itemRow.item ? JSON.parse(itemRow.item) : itemRow.item;\n });\n\n return await SchemaParser.parseSchemaItems(items, schemaName, context) as Array<TRow> ?? []\n }\n\n private async getFullSchema(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaQuery, { parameters: { schemaName: schemaKey.name } });\n const schemaRow = schemaRows[0];\n if (schemaRow === undefined)\n return undefined;\n\n // Map SchemaItemRow array, [{item: SchemaItemProps}], to array of SchemaItemProps.\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\n if (schema.items) {\n (schema as any).items = (schema.items as any).map((itemRow: SchemaItemRow) => { return itemRow.item; });\n }\n\n return SchemaParser.parse(schema, context);\n }\n\n private async getFullSchemaMultipleQueries(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schema = await this.getSchemaNoItems(schemaKey.name, context) as MutableSchemaProps;\n if (!schema)\n return undefined;\n\n schema.items = {};\n await Promise.all([\n this.getEntities(schemaKey.name, context),\n this.getMixins(schemaKey.name, context),\n this.getStructs(schemaKey.name, context),\n this.getRelationships(schemaKey.name, context),\n this.getCustomAttributeClasses(schemaKey.name, context),\n this.getKindOfQuantities(schemaKey.name, context),\n this.getPropertyCategories(schemaKey.name, context),\n this.getEnumerations(schemaKey.name, context),\n this.getUnits(schemaKey.name, context),\n this.getInvertedUnits(schemaKey.name, context),\n this.getUnitSystems(schemaKey.name, context),\n this.getConstants(schemaKey.name, context),\n this.getPhenomenon(schemaKey.name, context),\n this.getFormats(schemaKey.name, context)\n ]).then((itemResults) => {\n const flatItemList = itemResults.reduce((acc, item) => acc.concat(item));\n flatItemList.forEach((schemaItem) => {\n schema.items![schemaItem.name!] = schemaItem;\n });\n });\n\n return schema;\n }\n}\n\nfunction parseSchemaReference(referenceName: string): WithSchemaKey {\n return { schemaKey: SchemaKey.parseString(referenceName) };\n}\n\nasync function parseSchemaItemStubs(schemaName: string, context: SchemaContext, itemRows: Array<SchemaItemStubRow>, addItemsHandler: AddSchemaItemHandler) {\n if (!itemRows || itemRows.length === 0) {\n return;\n }\n\n const parseBaseClasses = async (baseClasses: Array<BaseClassStubRow> | undefined) => {\n if (!baseClasses || baseClasses.length < 2)\n return;\n\n for (let index = baseClasses.length - 1; index >= 0;) {\n const currentItem = baseClasses[index--];\n const baseClassItem = baseClasses[index];\n const baseClassName = baseClassItem ? `${baseClassItem.schema}.${baseClassItem.name}` : undefined;\n\n const schemaItem = await SchemaParser.parseItem(currentItem, currentItem.schema, context);\n await addItemsHandler(currentItem.schema, {\n ...schemaItem,\n name: schemaItem.name!,\n schemaItemType: parseSchemaItemType(schemaItem.schemaItemType!)!,\n baseClass: baseClassName,\n });\n }\n };\n\n for (const itemRow of itemRows) {\n const schemaItem = await SchemaParser.parseItem(itemRow, schemaName, context);\n await addItemsHandler(schemaName, {\n ...schemaItem,\n name: schemaItem.name!,\n schemaItemType: parseSchemaItemType(schemaItem.schemaItemType!)!,\n mixins: itemRow.mixins\n ? itemRow.mixins.map(mixin => { return `${mixin.schema}.${mixin.name}`; })\n : undefined,\n });\n\n await parseBaseClasses(itemRow.baseClasses);\n\n for (const mixinRow of itemRow.mixins || []) {\n const mixinItem = await SchemaParser.parseItem(mixinRow, mixinRow.schema, context);\n await addItemsHandler(mixinRow.schema, {\n ...mixinItem,\n name: mixinItem.name!,\n schemaItemType: parseSchemaItemType(mixinItem.schemaItemType!)!,\n });\n await parseBaseClasses(mixinRow.baseClasses);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ECSqlSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/ECSqlSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,sDAA6C;AAK7C,4CAA+D;AAE/D,4CAAyC;AACzC,2DAAwD;AACxD,yEAA4F;AAC5F,2DAAwD;AACxD,iDAA8C;AAC9C,2DAAmD;AA+DnD,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAqB/D;;;;GAIG;AACH,MAAsB,kBAAmB,SAAQ,mDAAwB;IACvE;;OAEG;IACH,IAAuB,OAAO;QAC5B,OAAO,KAAK,CAAC,OAAoC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,YAAY,OAAmC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAgBD;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,SAAoB,EAAE,OAAsB;QACxE,gHAAgH;QAChH,gHAAgH;QAChH,kCAAkC;QAClC,IAAI,CAAC,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC;YAClD,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAExC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB;YACjD,CAAC,CAAC,MAAM,IAAI,CAAC,4BAA4B,CAAC,SAAS,EAAE,OAAO,CAAC;YAC7D,CAAC,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEjD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;QAC9C,qBAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,4BAA4B,SAAS,CAAC,IAAI,OAAO,aAAa,IAAI,EAAE;YACnG,UAAU,E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AAU,CAAC,cAAc;YACzC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACpB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC,CAAC,SAAS;SACd,CAAC,CAAC;QAEH,MAAM,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE5C,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC5C,MAAM,SAAS,GAAG,MAAM,2BAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACvF,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACrC,GAAG,SAAS;gBACZ,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,cAAc,EAAE,SAAS,CAAC,cAAc;aACzC,CAAC,CAAC;YACH,MAAM,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC;IACH,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 *--------------------------------------------------------------------------------------------*/\nimport { Logger } from \"@itwin/core-bentley\";\nimport { SchemaContext } from \"../Context\";\nimport { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\n PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemProps, SchemaItemUnitProps, SchemaProps,\n StructClassProps, UnitSystemProps } from \"../Deserialization/JsonProps\";\nimport { SchemaItemType, SchemaMatchType } from \"../ECObjects\";\nimport { SchemaInfo, WithSchemaKey } from \"../Interfaces\";\nimport { SchemaKey } from \"../SchemaKey\";\nimport { FullSchemaQueries } from \"./FullSchemaQueries\";\nimport { IncrementalSchemaLocater, SchemaLocaterOptions } from \"./IncrementalSchemaLocater\";\nimport { SchemaItemQueries } from \"./SchemaItemQueries\";\nimport { SchemaParser } from \"./SchemaParser\";\nimport { ecsqlQueries } from \"./SchemaStubQueries\";\n\ninterface SchemaItemInfo {\n readonly name: string;\n readonly schemaItemType: SchemaItemType;\n}\n\ninterface SchemaInfoRow {\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly references: string;\n}\n\ninterface SchemaStubRow {\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly displayLabel: string;\n readonly description: string;\n readonly references: string;\n readonly items: string;\n}\n\ninterface BaseClassStubRow {\n readonly schema: string;\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier: number;\n}\n\ninterface SchemaItemStubRow {\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier?: number;\n readonly baseClasses?: Array<BaseClassStubRow>;\n readonly mixins?: Array<{\n readonly schema: string,\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier: number;\n readonly baseClasses?: Array<BaseClassStubRow>\n }>;\n}\n\ninterface SchemaRow {\n schema: string\n}\n\ninterface SchemaItemRow {\n item: string | SchemaItemProps;\n}\n\ntype AddSchemaItemHandler = <T extends SchemaItemInfo>(schemaName: string, itemStub: T) => Promise<void>;\n\ntype MutableSchemaProps = {\n -readonly [K in keyof SchemaProps]: SchemaProps[K];\n};\n\ninterface QueryParameters {\n [parameterName: string]: string | number;\n}\n\nconst LOGGER_CATEGORY = \"IncrementalSchemaLoading.Performance\";\n\n/**\n * Query options used by the ECSqlSchemaLocater.\n * @internal\n */\nexport interface ECSqlQueryOptions {\n parameters?: QueryParameters;\n limit?: number;\n}\n\n/**\n * Defines the [[ECSqlSchemaLocater]] options which determine how each\n * schema is to be loaded. All options are optional.\n * @internal\n */\nexport interface ECSqlSchemaLocaterOptions extends SchemaLocaterOptions {\n /** Query for Schemas using multiple queries. Defaults to false. */\n readonly useMultipleQueries?: boolean;\n}\n\n/**\n * An abstract [[IncrementalSchemaLocater]] implementation for loading\n * EC [Schema] instances from an iModelDb using ECSql queries.\n * @internal\n */\nexport abstract class ECSqlSchemaLocater extends IncrementalSchemaLocater {\n /**\n * Gets the [[ECSqlSchemaLocaterOptions]] used by this locater.\n */\n protected override get options(): ECSqlSchemaLocaterOptions {\n return super.options as ECSqlSchemaLocaterOptions;\n }\n\n /**\n * Initializes a new ECSqlSchemaLocater instance.\n * @param options The options used by this Schema locater.\n */\n constructor(options?: ECSqlSchemaLocaterOptions) {\n super(options);\n }\n\n /**\n * Executes the given ECSql query and returns the resulting rows.\n * @param query The ECSql query to execute.\n * @param options Optional arguments to control the query result.\n * @returns A promise that resolves to the resulting rows.\n */\n protected abstract executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>>;\n\n /**\n * Gets the [[SchemaProps]] for the given schema key.\n * @param schemaKey The schema key of the schema to be resolved.\n */\n protected abstract getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined>\n\n /**\n * Gets the [[SchemaProps]] for the given schema key. This is the full schema json with all elements that are defined\n * in the schema. The schema locater calls this after the stub has been loaded to fully load the schema in the background.\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\n * @param context The [[SchemaContext]] to use for resolving references.\n * @internal\n */\n protected async getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n // If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema\n // information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface\n // to fetch the whole schema json.\n if (!await this.supportPartialSchemaLoading(context))\n return this.getSchemaProps(schemaKey);\n\n const queryStart = Date.now();\n const schemaProps = this.options.useMultipleQueries\n ? await this.getFullSchemaMultipleQueries(schemaKey, context)\n : await this.getFullSchema(schemaKey, context);\n\n const queryDuration = Date.now() - queryStart;\n Logger.logTrace(LOGGER_CATEGORY, `Recieved SchemaProps for ${schemaKey.name} in ${queryDuration}ms`, {\n schemaName: schemaKey.name,\n queryMode: this.options.useMultipleQueries ? \"parallel\" : \"single\",\n duration: queryDuration,\n });\n\n return schemaProps;\n };\n\n /**\n * Gets the [[SchemaProps]] without schemaItems for the given schema name.\n * @param schemaName The name of the Schema.\n * @param context The [[SchemaContext]] to use for resolving references.\n * @returns\n * @internal\n */\n private async getSchemaNoItems(schemaName: string, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaNoItemsQuery, { parameters: { schemaName } });\n const schemaRow = schemaRows[0];\n if (schemaRow === undefined)\n return undefined;\n\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n return SchemaParser.parse(schema, schemaInfos);\n }\n\n /**\n * Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.\n * @param context The schema context to lookup the meta schema.\n * @returns true if the context has a supported meta schema version, false otherwise.\n */\n protected async supportPartialSchemaLoading(context: SchemaContext): Promise<boolean> {\n const metaSchemaKey = new SchemaKey(\"ECDbMeta\", 4, 0, 3);\n const metaSchemaInfo = await context.getSchemaInfo(metaSchemaKey, SchemaMatchType.LatestWriteCompatible);\n return metaSchemaInfo !== undefined;\n };\n\n /**\n * Gets all the Schema's Entity classes as [[EntityClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The [[SchemaContext]] to which the schema belongs.\n * @returns A promise that resolves to a EntityClassProps array. Maybe empty of no entities are found.\n * @internal\n */\n protected async getEntities(schema: string, context: SchemaContext, queryOverride?: string): Promise<EntityClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.entityQuery;\n return this.querySchemaItem<EntityClassProps>(context, schema, query, \"EntityClass\");\n }\n\n /**\n * Gets all the Schema's Mixin classes as [[MixinProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a MixinProps array. Maybe empty of no entities are found.\n * @internal\n */\n protected async getMixins(schema: string, context: SchemaContext, queryOverride?: string): Promise<MixinProps[]> {\n const query = queryOverride ?? FullSchemaQueries.mixinQuery;\n return this.querySchemaItem<MixinProps>(context, schema, query, \"Mixin\");\n }\n\n /**\n * Gets all the Schema's Relationship classes as [[RelationshipClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a RelationshipClassProps array. Maybe empty if no items are found.\n * @internal\n */\n protected async getRelationships(schema: string, context: SchemaContext, queryOverride?: string): Promise<RelationshipClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.relationshipClassQuery;\n return this.querySchemaItem<RelationshipClassProps>(context, schema, query, \"RelationshipClass\");\n }\n\n /**\n * Gets all the Schema's CustomAttributeClass items as [[CustomAttributeClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a CustomAttributeClassProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getCustomAttributeClasses(schema: string, context: SchemaContext, queryOverride?: string): Promise<CustomAttributeClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.customAttributeQuery;\n return this.querySchemaItem<CustomAttributeClassProps>(context, schema, query, \"CustomAttributeClass\");\n }\n\n\n /**\n * Gets all the Schema's StructClass items as [[StructClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a StructClassProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getStructs(schema: string, context: SchemaContext, queryOverride?: string): Promise<StructClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.structQuery;\n return this.querySchemaItem<StructClassProps>(context, schema, query, \"StructClass\");\n }\n\n /**\n * Gets all the Schema's KindOfQuantity items as [[KindOfQuantityProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a KindOfQuantityProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getKindOfQuantities(schema: string, context: SchemaContext): Promise<KindOfQuantityProps[]> {\n return this.querySchemaItem<KindOfQuantityProps>(context, schema, SchemaItemQueries.kindOfQuantity(true), \"KindOfQuantity\");\n }\n\n /**\n * Gets all the Schema's PropertyCategory items as [[PropertyCategoryProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a PropertyCategoryProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getPropertyCategories(schema: string, context: SchemaContext): Promise<PropertyCategoryProps[]> {\n return this.querySchemaItem<PropertyCategoryProps>(context, schema, SchemaItemQueries.propertyCategory(true), \"PropertyCategory\");\n }\n\n /**\n * Gets all the Schema's Enumeration items as [[EnumerationProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a EnumerationProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getEnumerations(schema: string, context: SchemaContext): Promise<EnumerationProps[]> {\n return this.querySchemaItem<EnumerationProps>(context, schema, SchemaItemQueries.enumeration(true), \"Enumeration\");\n }\n\n /**\n * Gets all the Schema's Unit items as [[SchemaItemUnitProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a SchemaItemUnitProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getUnits(schema: string, context: SchemaContext): Promise<SchemaItemUnitProps[]> {\n return this.querySchemaItem<SchemaItemUnitProps>(context, schema, SchemaItemQueries.unit(true), \"Unit\");\n }\n\n /**\n * Gets all the Schema's InvertedUnit items as [[InvertedUnitProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a InvertedUnitProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getInvertedUnits(schema: string, context: SchemaContext): Promise<InvertedUnitProps[]> {\n return this.querySchemaItem<InvertedUnitProps>(context, schema, SchemaItemQueries.invertedUnit(true), \"InvertedUnit\");\n }\n\n /**\n * Gets all the Schema's Constant items as [[ConstantProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a ConstantProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getConstants(schema: string, context: SchemaContext): Promise<ConstantProps[]> {\n return this.querySchemaItem<ConstantProps>(context, schema, SchemaItemQueries.constant(true), \"Constant\");\n }\n\n /**\n * Gets all the Schema's UnitSystem items as [[UnitSystemProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a UnitSystemProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getUnitSystems(schema: string, context: SchemaContext): Promise<UnitSystemProps[]> {\n return this.querySchemaItem<UnitSystemProps>(context, schema, SchemaItemQueries.unitSystem(true), \"UnitSystem\");\n }\n\n /**\n * Gets all the Schema's Phenomenon items as [[PhenomenonProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a PhenomenonProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getPhenomenon(schema: string, context: SchemaContext): Promise<PhenomenonProps[]> {\n return this.querySchemaItem<PhenomenonProps>(context, schema, SchemaItemQueries.phenomenon(true), \"Phenomenon\");\n }\n\n /**\n * Gets all the Schema's Format items as [[SchemaItemFormatProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a SchemaItemFormatProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getFormats(schema: string, context: SchemaContext): Promise<SchemaItemFormatProps[]> {\n return this.querySchemaItem<SchemaItemFormatProps>(context, schema, SchemaItemQueries.format(true), \"Format\");\n }\n\n /**\n * Gets [[SchemaInfo]] objects for all schemas including their direct schema references.\n * @internal\n */\n protected async loadSchemaInfos(): Promise<ReadonlyArray<SchemaInfo>> {\n const schemaRows = await this.executeQuery<SchemaInfoRow>(ecsqlQueries.schemaInfoQuery);\n return schemaRows.map((schemaRow) => (\n {\n alias: schemaRow.alias,\n schemaKey: SchemaKey.parseString(`${schemaRow.name}.${schemaRow.version}`),\n references: Array.from(JSON.parse(schemaRow.references), parseSchemaReference),\n }\n ));\n }\n\n /**\n * Gets the [[SchemaProps]] to create the basic schema skeleton. Depending on which options are set, the schema items or class hierarchy\n * can be included in the initial fetch.\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\n * @returns A promise that resolves to the schema partials, which is an array of [[SchemaProps]].\n * @internal\n */\n protected async getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined> {\n const queryStart = Date.now();\n const [schemaRow] = await this.executeQuery<SchemaStubRow>(ecsqlQueries.schemaStubQuery, {\n parameters: { schemaName: schemaKey.name },\n limit: 1\n });\n\n const queryDuration = Date.now() - queryStart;\n Logger.logTrace(LOGGER_CATEGORY, `Recieved PartialSchema for ${schemaKey.name} in ${queryDuration}ms`, {\n schemaName: schemaKey.name,\n duration: queryDuration,\n });\n\n if (!schemaRow)\n return undefined;\n\n const schemaPartials: Array<SchemaProps> = [];\n const addSchema = async (key: SchemaKey) => {\n const stub = await this.createSchemaProps(key, context);\n schemaPartials.push(stub);\n\n if (stub.references) {\n for (const referenceProps of stub.references) {\n if (!schemaPartials.some((schema) => schema.name === referenceProps.name)) {\n await addSchema(SchemaKey.parseString(`${referenceProps.name}.${referenceProps.version}`));\n }\n }\n }\n\n return stub;\n };\n\n const addItems = async (schemaName: string, itemInfo: SchemaItemInfo) => {\n let schemaStub = schemaPartials.find((schema) => schema.name === schemaName);\n if (!schemaStub) {\n schemaStub = await addSchema(SchemaKey.parseString(`${schemaName}.0.0.0`));\n }\n\n let items = schemaStub.items;\n if (!items) {\n Object.assign(schemaStub, items = { items: {} });\n }\n\n const existingItem = items[itemInfo.name] || {};\n Object.assign(items, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });\n };\n\n const reviver = (_key: string, value: any) => {\n if (value === null) {\n return undefined;\n }\n return value;\n };\n\n await addSchema(schemaKey);\n\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n await parseSchemaItemStubs(schemaKey.name, JSON.parse(schemaRow.items, reviver), addItems, schemaInfos);\n\n return schemaPartials;\n }\n\n private async querySchemaItem<TRow extends SchemaItemProps>(context: SchemaContext, schemaName: string, query: string, schemaType: string): Promise<Array<TRow>> {\n const start = Date.now();\n const itemRows = await this.executeQuery<SchemaItemRow>(query, { parameters: { schemaName } });\n\n const queryDuration = Date.now() - start;\n Logger.logTrace(LOGGER_CATEGORY, `Recieved rows of ${schemaType} items for ${schemaName} in ${queryDuration}ms`, {\n schemaName,\n itemCount: itemRows.length,\n itemType: schemaType,\n duration: queryDuration,\n });\n\n if (itemRows.length === 0)\n return [];\n\n const items = itemRows.map((itemRow: SchemaItemRow) => {\n return \"string\" === typeof itemRow.item ? JSON.parse(itemRow.item) : itemRow.item;\n });\n\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n return await SchemaParser.parseSchemaItems(items, schemaName, schemaInfos) as Array<TRow> ?? []\n }\n\n private async getFullSchema(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaQuery, { parameters: { schemaName: schemaKey.name } });\n const schemaRow = schemaRows[0];\n if (schemaRow === undefined)\n return undefined;\n\n // Map SchemaItemRow array, [{item: SchemaItemProps}], to array of SchemaItemProps.\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\n if (schema.items) {\n (schema as any).items = (schema.items as any).map((itemRow: SchemaItemRow) => { return itemRow.item; });\n }\n\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n return SchemaParser.parse(schema, schemaInfos);\n }\n\n private async getFullSchemaMultipleQueries(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schema = await this.getSchemaNoItems(schemaKey.name, context) as MutableSchemaProps;\n if (!schema)\n return undefined;\n\n const items = schema.items || (schema.items = {});\n await Promise.all([\n this.getEntities(schemaKey.name, context),\n this.getMixins(schemaKey.name, context),\n this.getStructs(schemaKey.name, context),\n this.getRelationships(schemaKey.name, context),\n this.getCustomAttributeClasses(schemaKey.name, context),\n this.getKindOfQuantities(schemaKey.name, context),\n this.getPropertyCategories(schemaKey.name, context),\n this.getEnumerations(schemaKey.name, context),\n this.getUnits(schemaKey.name, context),\n this.getInvertedUnits(schemaKey.name, context),\n this.getUnitSystems(schemaKey.name, context),\n this.getConstants(schemaKey.name, context),\n this.getPhenomenon(schemaKey.name, context),\n this.getFormats(schemaKey.name, context)\n ]).then((itemResults) => {\n const flatItemList = itemResults.reduce((acc, result) => acc.concat(result));\n flatItemList.forEach((schemaItem) => {\n if(!schemaItem.name) {\n // This should never be happen, as we query the schema items by name from the database, but since the SchemaProps\n // have name optional, we need the check here to make the compiler happy.\n throw new Error(`SchemaItem with no name encountered in schema ${schemaKey.name}`);\n }\n items[schemaItem.name] = schemaItem;\n });\n });\n\n return schema;\n }\n}\n\nfunction parseSchemaReference(referenceName: string): WithSchemaKey {\n return { schemaKey: SchemaKey.parseString(referenceName) };\n}\n\nasync function parseSchemaItemStubs(schemaName: string, itemRows: Array<SchemaItemStubRow>, addItemsHandler: AddSchemaItemHandler, schemaInfos: Iterable<SchemaInfo>) {\n if (!itemRows || itemRows.length === 0) {\n return;\n }\n\n const parseBaseClasses = async (baseClasses: Array<BaseClassStubRow> | undefined) => {\n if (!baseClasses || baseClasses.length < 2)\n return;\n\n for (let index = baseClasses.length - 1; index >= 0;) {\n const currentItem = baseClasses[index--];\n const baseClassItem = baseClasses[index];\n const baseClassName = baseClassItem ? `${baseClassItem.schema}.${baseClassItem.name}` : undefined;\n\n const schemaItem = await SchemaParser.parseItem(currentItem, currentItem.schema, schemaInfos);\n await addItemsHandler(currentItem.schema, {\n ...schemaItem,\n name: schemaItem.name,\n schemaItemType: schemaItem.schemaItemType,\n baseClass: baseClassName,\n });\n }\n };\n\n for (const itemRow of itemRows) {\n const schemaItem = await SchemaParser.parseItem(itemRow, schemaName, schemaInfos);\n await addItemsHandler(schemaName, {\n ...schemaItem,\n name: schemaItem.name,\n schemaItemType: schemaItem.schemaItemType,\n mixins: itemRow.mixins\n ? itemRow.mixins.map(mixin => { return `${mixin.schema}.${mixin.name}`; })\n : undefined,\n });\n\n await parseBaseClasses(itemRow.baseClasses);\n\n for (const mixinRow of itemRow.mixins || []) {\n const mixinItem = await SchemaParser.parseItem(mixinRow, mixinRow.schema, schemaInfos);\n await addItemsHandler(mixinRow.schema, {\n ...mixinItem,\n name: mixinItem.name,\n schemaItemType: mixinItem.schemaItemType,\n });\n await parseBaseClasses(mixinRow.baseClasses);\n }\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { SchemaMatchType } from "../ECObjects";
|
|
|
4
4
|
import { SchemaInfo } from "../Interfaces";
|
|
5
5
|
import { Schema } from "../Metadata/Schema";
|
|
6
6
|
import { SchemaKey } from "../SchemaKey";
|
|
7
|
+
type LoadSchemaInfoHandler = (context: SchemaContext) => Promise<Iterable<SchemaInfo>>;
|
|
7
8
|
/**
|
|
8
9
|
* Defines the SchemaLocater Options which determine how each schema is to be loaded.
|
|
9
10
|
* All options are optional.
|
|
@@ -24,7 +25,7 @@ export interface SchemaLocaterOptions {
|
|
|
24
25
|
*/
|
|
25
26
|
export declare abstract class IncrementalSchemaLocater implements ISchemaLocater {
|
|
26
27
|
private readonly _options;
|
|
27
|
-
|
|
28
|
+
protected readonly _schemaInfoCache: SchemaInfoCache;
|
|
28
29
|
/**
|
|
29
30
|
* Initializes a new instance of the IncrementalSchemaLocater class.
|
|
30
31
|
* @param options The [[SchemaLocaterOptions]] that control the loading of the schema.
|
|
@@ -78,7 +79,7 @@ export declare abstract class IncrementalSchemaLocater implements ISchemaLocater
|
|
|
78
79
|
* @param context The schema context to load the schema infos for.
|
|
79
80
|
* @returns A promise that resolves to an iterable of schema infos.
|
|
80
81
|
*/
|
|
81
|
-
abstract loadSchemaInfos(context: SchemaContext): Promise<Iterable<SchemaInfo>>;
|
|
82
|
+
protected abstract loadSchemaInfos(context: SchemaContext): Promise<Iterable<SchemaInfo>>;
|
|
82
83
|
/**
|
|
83
84
|
* Checks if the context contains the right schemas to support incremental schema loading.
|
|
84
85
|
* @param context The schema context to check.
|
|
@@ -93,7 +94,7 @@ export declare abstract class IncrementalSchemaLocater implements ISchemaLocater
|
|
|
93
94
|
* @param schemaInfo The schema info of the schema to load.
|
|
94
95
|
* @param schemaContext The schema context to load the schema into.
|
|
95
96
|
*/
|
|
96
|
-
loadSchema(schemaInfo: SchemaInfo, schemaContext: SchemaContext): Promise<Schema>;
|
|
97
|
+
protected loadSchema(schemaInfo: SchemaInfo, schemaContext: SchemaContext): Promise<Schema>;
|
|
97
98
|
/**
|
|
98
99
|
* Creates a SchemaProps object by loading the Schema information from the given SchemaContext.
|
|
99
100
|
* @param schemaKey The SchemaKey of the Schema whose props are to be retrieved.
|
|
@@ -106,4 +107,16 @@ export declare abstract class IncrementalSchemaLocater implements ISchemaLocater
|
|
|
106
107
|
private startLoadingFullSchema;
|
|
107
108
|
private sortSchemaPartials;
|
|
108
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Helper class to manage schema infos for a schema context.
|
|
112
|
+
*/
|
|
113
|
+
declare class SchemaInfoCache {
|
|
114
|
+
private readonly _schemaInfoCache;
|
|
115
|
+
private readonly _schemaInfoLoader;
|
|
116
|
+
constructor(schemaInfoLoader: LoadSchemaInfoHandler);
|
|
117
|
+
getSchemasByContext(context: SchemaContext): Promise<SchemaInfo[] | undefined>;
|
|
118
|
+
lookup(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
|
|
119
|
+
remove(schemaKey: SchemaKey, context: SchemaContext): void;
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
109
122
|
//# sourceMappingURL=IncrementalSchemaLocater.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncrementalSchemaLocater.d.ts","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaLocater.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"IncrementalSchemaLocater.d.ts","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaLocater.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAwB,MAAM,8BAA8B,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,KAAK,qBAAqB,GAAG,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAEvF;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,mGAAmG;IACnG,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;;;;GAQG;AACH,8BAAsB,wBAAyB,YAAW,cAAc;IACtE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,eAAe,CAAC;IAErD;;;OAGG;gBACS,OAAO,CAAC,EAAE,oBAAoB;IAQ1C,gEAAgE;IAChE,SAAS,KAAK,OAAO,IAAI,oBAAoB,CAE5C;IAED;;;;;;;OAOG;IACU,aAAa,CAAC,SAAS,EAAE,SAAS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ACH,cAAM,eAAe;IACnB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA4C;IAC7E,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAwB;gBAE9C,gBAAgB,EAAE,qBAAqB;IAKtC,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC;IAQ9E,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAOvH,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;CAUlE"}
|
|
@@ -89,6 +89,8 @@ class IncrementalSchemaLocater {
|
|
|
89
89
|
// to fetch the whole schema json.
|
|
90
90
|
if (!await this.supportPartialSchemaLoading(schemaContext)) {
|
|
91
91
|
const schemaJson = await this.getSchemaJson(schemaInfo.schemaKey, schemaContext);
|
|
92
|
+
if (schemaJson === undefined)
|
|
93
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);
|
|
92
94
|
return Schema_1.Schema.fromJson(schemaJson, schemaContext);
|
|
93
95
|
}
|
|
94
96
|
// Fetches the schema partials for the given schema key. The first item in the array is the
|
|
@@ -119,18 +121,17 @@ class IncrementalSchemaLocater {
|
|
|
119
121
|
const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, ECObjects_1.SchemaMatchType.Latest);
|
|
120
122
|
if (!schemaInfo)
|
|
121
123
|
throw new Error(`Schema ${schemaKey.name} could not be found.`);
|
|
124
|
+
const schemaReferences = [];
|
|
122
125
|
const schemaProps = {
|
|
123
126
|
$schema: Constants_1.ECSchemaNamespaceUris.SCHEMAURL3_2_JSON,
|
|
124
127
|
name: schemaKey.name,
|
|
125
128
|
alias: schemaInfo.alias,
|
|
126
129
|
version: schemaInfo.schemaKey.version.toString(),
|
|
127
|
-
references:
|
|
130
|
+
references: schemaReferences,
|
|
128
131
|
items: {}
|
|
129
132
|
};
|
|
130
|
-
if (!schemaProps.references)
|
|
131
|
-
throw new Error(`Schema references is undefined for the Schema ${schemaInfo.schemaKey.name}`);
|
|
132
133
|
schemaInfo.references.forEach((ref) => {
|
|
133
|
-
|
|
134
|
+
schemaReferences.push({ name: ref.schemaKey.name, version: ref.schemaKey.version.toString() });
|
|
134
135
|
});
|
|
135
136
|
return schemaProps;
|
|
136
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncrementalSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,4CAAqD;AAGrD,wEAAqE;AACrE,4CAA+C;AAC/C,4CAA6D;AAE7D,+CAA4C;AAC5C,4CAAyC;AACzC,8EAA2E;AAC3E,uEAAoE;AAcpE;;;;;;;;GAQG;AACH,MAAsB,wBAAwB;IAC3B,QAAQ,CAAuB;IAC/B,gBAAgB,CAAkB;IAEnD;;;OAGG;IACH,YAAY,OAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,EAAE,CAAC;QAE9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC5D,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IAChE,IAAc,OAAO;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,aAAa,CAAC,SAAoB,EAAE,SAA0B,EAAE,OAAsB;QACjG,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACrE,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AAU,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;QACzG,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,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 *--------------------------------------------------------------------------------------------*/\nimport { ECSchemaNamespaceUris } from \"../Constants\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaProps } from \"../Deserialization/JsonProps\";\nimport { SchemaGraphUtil } from \"../Deserialization/SchemaGraphUtil\";\nimport { SchemaMatchType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { SchemaInfo } from \"../Interfaces\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaKey } from \"../SchemaKey\";\nimport { SchemaLoadingController } from \"../utils/SchemaLoadingController\";\nimport { IncrementalSchemaReader } from \"./IncrementalSchemaReader\";\n\ntype LoadSchemaInfoHandler = (context: SchemaContext) => Promise<Iterable<SchemaInfo>>;\n\n/**\n * Defines the SchemaLocater Options which determine how each schema is to be loaded.\n * All options are optional.\n * @beta\n */\nexport interface SchemaLocaterOptions {\n /** Only load partial schemas. Full schema information will not be retrieved. Defaults to false. */\n readonly loadPartialSchemaOnly?: boolean;\n}\n\n/**\n * A [[ISchemaLocater]] implementation for locating and retrieving EC [[Schema]]\n * objects incrementally instead of the full schema and it's references at once. This is useful for large schemas that\n * take a long time to load, but clients need a rough skeleton of the schema as fast as possible.\n *\n * The IncrementalSchemaLocater is a locater around the [[IncrementalSchemaLocater]] to be used in a\n * [[SchemaContext]].\n * @internal\n */\nexport abstract class IncrementalSchemaLocater implements ISchemaLocater {\n private readonly _options: SchemaLocaterOptions;\n private readonly _schemaInfoCache: SchemaInfoCache;\n\n /**\n * Initializes a new instance of the IncrementalSchemaLocater class.\n * @param options The [[SchemaLocaterOptions]] that control the loading of the schema.\n */\n constructor(options?: SchemaLocaterOptions) {\n this._options = options || {};\n\n this._schemaInfoCache = new SchemaInfoCache(async (context) => {\n return this.loadSchemaInfos(context);\n });\n }\n\n /** Gets the options how the schema locater load the schemas. */\n protected get options(): SchemaLocaterOptions {\n return this._options;\n }\n\n /**\n * Gets the [[SchemaInfo]] which matches the provided SchemaKey. The SchemaInfo may be returned\n * before the schema is fully loaded. May return the entire Schema so long as it is completely loaded as it satisfies\n * the SchemaInfo interface.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n return this._schemaInfoCache.lookup(schemaKey, matchType, context);\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined> {\n const schemaInfo = await this.getSchemaInfo(schemaKey, matchType, context);\n return schemaInfo\n ? this.loadSchema(schemaInfo, context)\n : undefined;\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * NOT IMPLEMENTED IN THIS LOCATER - ALWAYS RETURNS UNDEFINED.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n * @returns Incremental schema loading does not work synchronously, this will always return undefined.\n */\n public getSchemaSync(_schemaKey: Readonly<SchemaKey>, _matchType: SchemaMatchType, _context: SchemaContext): Schema | undefined {\n return undefined;\n }\n\n /**\n * Gets the schema partials for the given schema key. The first item in the array is the\n * actual schema props of the schema to load, the following items are partial schema props\n * of referenced schemas.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined>;\n\n /**\n * Gets the full schema json for the requested schema key.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined>;\n\n /**\n * Loads the schema info objects for the given context.\n * @param context The schema context to load the schema infos for.\n * @returns A promise that resolves to an iterable of schema infos.\n */\n public abstract loadSchemaInfos(context: SchemaContext): Promise<Iterable<SchemaInfo>>;\n\n /**\n * Checks if the context contains the right schemas to support incremental schema loading.\n * @param context The schema context to check.\n * @returns true if incremental schema loading is supported, false otherwise.\n */\n protected abstract supportPartialSchemaLoading(context: SchemaContext): Promise<boolean>;\n\n /**\n * Start loading the schema for the given schema info incrementally. The schema is returned\n * as soon as the schema stub is loaded while the schema fully resolves in the background. It should\n * only be called by the IncrementalSchemaLocater if a schema has not been loaded or started to\n * load yet.\n * @param schemaInfo The schema info of the schema to load.\n * @param schemaContext The schema context to load the schema into.\n */\n public async loadSchema(schemaInfo: SchemaInfo, schemaContext: SchemaContext): Promise<Schema> {\n // If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema\n // information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface\n // to fetch the whole schema json.\n if (!await this.supportPartialSchemaLoading(schemaContext)) {\n const schemaJson = await this.getSchemaJson(schemaInfo.schemaKey, schemaContext);\n return Schema.fromJson(schemaJson!, schemaContext);\n }\n\n // Fetches the schema partials for the given schema key. The first item in the array is the\n // actual schema props of the schema to load, the following items are schema props of referenced\n // schema items that are needed to resolve the schema properly.\n const schemaPartials = await this.getSchemaPartials(schemaInfo.schemaKey, schemaContext);\n if (schemaPartials === undefined)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);\n\n // Sort the partials in dependency order to ensure referenced schemas exist in the schema context\n // when they get requested. Otherwise the context would call this method again and for referenced\n // schemas, we would not want to request the whole schema props.\n const sortedPartials = await this.sortSchemaPartials(schemaPartials, schemaContext);\n for (const schemaProps of sortedPartials) {\n await this.startLoadingPartialSchema(schemaProps, schemaContext);\n }\n\n const schema = await schemaContext.getCachedSchema(schemaInfo.schemaKey);\n if (!schema)\n throw new Error(`Schema ${schemaInfo.schemaKey.name} could not be found.`);\n\n return schema;\n }\n\n /**\n * Creates a SchemaProps object by loading the Schema information from the given SchemaContext.\n * @param schemaKey The SchemaKey of the Schema whose props are to be retrieved.\n * @param schemaContext The SchemaContext holding the Schema.\n * @returns The SchemaProps object.\n */\n protected async createSchemaProps(schemaKey: SchemaKey, schemaContext: SchemaContext): Promise<SchemaProps> {\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest);\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n const schemaProps: SchemaProps = {\n $schema: ECSchemaNamespaceUris.SCHEMAURL3_2_JSON,\n name: schemaKey.name,\n alias: schemaInfo.alias,\n version: schemaInfo.schemaKey.version.toString(),\n references: [],\n items: {}\n };\n\n if (!schemaProps.references)\n throw new Error(`Schema references is undefined for the Schema ${schemaInfo.schemaKey.name}`);\n\n schemaInfo.references.forEach((ref) => {\n schemaProps.references!.push({ name: ref.schemaKey.name, version: ref.schemaKey.version.toString() });\n });\n\n return schemaProps;\n }\n\n private async startLoadingPartialSchema(schemaProps: SchemaProps, schemaContext: SchemaContext): Promise<void> {\n if (schemaContext.schemaExists(SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`))) {\n return;\n }\n\n const controller = new SchemaLoadingController();\n const schemaReader = new IncrementalSchemaReader(schemaContext, true);\n const schema = new Schema(schemaContext);\n schema.setLoadingController(controller);\n\n await schemaReader.readSchema(schema, schemaProps);\n\n if (!this._options.loadPartialSchemaOnly)\n controller.start(this.startLoadingFullSchema(schema));\n }\n\n private async loadFullSchema(schema: Schema): Promise<void> {\n const fullSchemaProps = await this.getSchemaJson(schema.schemaKey, schema.context)\n const reader = new IncrementalSchemaReader(schema.context, false);\n await reader.readSchema(schema, fullSchemaProps, false);\n }\n\n private async startLoadingFullSchema(schema: Schema): Promise<void> {\n if (!schema.loadingController)\n return;\n\n // If the schema is already resolved, return it directly.\n if (schema.loadingController.isComplete || schema.loadingController.inProgress) {\n return;\n }\n\n // Since the schema relies on it's references, they get triggered to be resolved\n // first by recursively calling this method. After all references has been resolved\n // the schema itself gets resolved.\n await Promise.all(schema.references.map(async (referenceSchema) => {\n if (referenceSchema.loadingController && referenceSchema.loadingController.inProgress)\n return referenceSchema.loadingController.wait();\n else\n return this.startLoadingFullSchema(referenceSchema);\n }));\n\n return this.loadFullSchema(schema);\n }\n\n private async sortSchemaPartials(schemaPartials: ReadonlyArray<SchemaProps>, schemaContext: SchemaContext): Promise<ReadonlyArray<SchemaProps>> {\n const schemaInfos: Array<SchemaInfo & { props: SchemaProps }> = [];\n for (const schemaProps of schemaPartials) {\n const schemaKey = SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`);\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest);\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n\n schemaInfos.push({ ...schemaInfo, props: schemaProps });\n }\n\n const orderedSchemaInfos = SchemaGraphUtil.buildDependencyOrderedSchemaInfoList(schemaInfos) as Array<SchemaInfo & { props: SchemaProps }>;\n return orderedSchemaInfos.map((schemaInfo) => schemaInfo.props);\n }\n}\n\n/**\n * Helper class to manage schema infos for a schema context.\n */\nclass SchemaInfoCache {\n private readonly _schemaInfoCache: WeakMap<SchemaContext, Array<SchemaInfo>>;\n private readonly _schemaInfoLoader: LoadSchemaInfoHandler;\n\n constructor(schemaInfoLoader: LoadSchemaInfoHandler) {\n this._schemaInfoCache = new WeakMap<SchemaContext, Array<SchemaInfo>>();\n this._schemaInfoLoader = schemaInfoLoader;\n }\n\n public async getSchemasByContext(context: SchemaContext): Promise<SchemaInfo[] | undefined> {\n if (!this._schemaInfoCache.has(context)) {\n const schemaInfos = await this._schemaInfoLoader(context);\n this._schemaInfoCache.set(context, Array.from(schemaInfos));\n }\n return this._schemaInfoCache.get(context);\n }\n\n public async lookup(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n const contextSchemaInfos = await this.getSchemasByContext(context);\n return contextSchemaInfos\n ? contextSchemaInfos.find((schemaInfo) => schemaInfo.schemaKey.matches(schemaKey, matchType))\n : undefined;\n }\n\n public remove(schemaKey: SchemaKey, context: SchemaContext): void {\n const contextSchemaInfos = this._schemaInfoCache.get(context);\n if (!contextSchemaInfos)\n return;\n\n const index = contextSchemaInfos.findIndex((schemaInfo) => schemaInfo.schemaKey.name === schemaKey.name);\n if (index !== -1) {\n contextSchemaInfos.splice(index, 1);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IncrementalSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,4CAAqD;AAGrD,wEAAqE;AACrE,4CAA+C;AAC/C,4CAA6D;AAE7D,+CAA4C;AAC5C,4CAAyC;AACzC,8EAA2E;AAC3E,uEAAoE;AAcpE;;;;;;;;GAQG;AACH,MAAsB,wBAAwB;IAC3B,QAAQ,CAAuB;IAC7B,gBAAgB,CAAkB;IAErD;;;OAGG;IACH,YAAY,OAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,EAAE,CAAC;QAE9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,eAAe,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AAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACnE,OAAO,kBAAkB;YACvB,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YAC7F,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,SAAoB,EAAE,OAAsB;QACxD,MAAM,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,kBAAkB;YACrB,OAAO;QAET,MAAM,KAAK,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;QACzG,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,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 *--------------------------------------------------------------------------------------------*/\nimport { ECSchemaNamespaceUris } from \"../Constants\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaProps, SchemaReferenceProps } from \"../Deserialization/JsonProps\";\nimport { SchemaGraphUtil } from \"../Deserialization/SchemaGraphUtil\";\nimport { SchemaMatchType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { SchemaInfo } from \"../Interfaces\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaKey } from \"../SchemaKey\";\nimport { SchemaLoadingController } from \"../utils/SchemaLoadingController\";\nimport { IncrementalSchemaReader } from \"./IncrementalSchemaReader\";\n\ntype LoadSchemaInfoHandler = (context: SchemaContext) => Promise<Iterable<SchemaInfo>>;\n\n/**\n * Defines the SchemaLocater Options which determine how each schema is to be loaded.\n * All options are optional.\n * @beta\n */\nexport interface SchemaLocaterOptions {\n /** Only load partial schemas. Full schema information will not be retrieved. Defaults to false. */\n readonly loadPartialSchemaOnly?: boolean;\n}\n\n/**\n * A [[ISchemaLocater]] implementation for locating and retrieving EC [[Schema]]\n * objects incrementally instead of the full schema and it's references at once. This is useful for large schemas that\n * take a long time to load, but clients need a rough skeleton of the schema as fast as possible.\n *\n * The IncrementalSchemaLocater is a locater around the [[IncrementalSchemaLocater]] to be used in a\n * [[SchemaContext]].\n * @internal\n */\nexport abstract class IncrementalSchemaLocater implements ISchemaLocater {\n private readonly _options: SchemaLocaterOptions;\n protected readonly _schemaInfoCache: SchemaInfoCache;\n\n /**\n * Initializes a new instance of the IncrementalSchemaLocater class.\n * @param options The [[SchemaLocaterOptions]] that control the loading of the schema.\n */\n constructor(options?: SchemaLocaterOptions) {\n this._options = options || {};\n\n this._schemaInfoCache = new SchemaInfoCache(async (context) => {\n return this.loadSchemaInfos(context);\n });\n }\n\n /** Gets the options how the schema locater load the schemas. */\n protected get options(): SchemaLocaterOptions {\n return this._options;\n }\n\n /**\n * Gets the [[SchemaInfo]] which matches the provided SchemaKey. The SchemaInfo may be returned\n * before the schema is fully loaded. May return the entire Schema so long as it is completely loaded as it satisfies\n * the SchemaInfo interface.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n return this._schemaInfoCache.lookup(schemaKey, matchType, context);\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined> {\n const schemaInfo = await this.getSchemaInfo(schemaKey, matchType, context);\n return schemaInfo\n ? this.loadSchema(schemaInfo, context)\n : undefined;\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * NOT IMPLEMENTED IN THIS LOCATER - ALWAYS RETURNS UNDEFINED.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n * @returns Incremental schema loading does not work synchronously, this will always return undefined.\n */\n public getSchemaSync(_schemaKey: Readonly<SchemaKey>, _matchType: SchemaMatchType, _context: SchemaContext): Schema | undefined {\n return undefined;\n }\n\n /**\n * Gets the schema partials for the given schema key. The first item in the array is the\n * actual schema props of the schema to load, the following items are partial schema props\n * of referenced schemas.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined>;\n\n /**\n * Gets the full schema json for the requested schema key.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined>;\n\n /**\n * Loads the schema info objects for the given context.\n * @param context The schema context to load the schema infos for.\n * @returns A promise that resolves to an iterable of schema infos.\n */\n protected abstract loadSchemaInfos(context: SchemaContext): Promise<Iterable<SchemaInfo>>;\n\n /**\n * Checks if the context contains the right schemas to support incremental schema loading.\n * @param context The schema context to check.\n * @returns true if incremental schema loading is supported, false otherwise.\n */\n protected abstract supportPartialSchemaLoading(context: SchemaContext): Promise<boolean>;\n\n /**\n * Start loading the schema for the given schema info incrementally. The schema is returned\n * as soon as the schema stub is loaded while the schema fully resolves in the background. It should\n * only be called by the IncrementalSchemaLocater if a schema has not been loaded or started to\n * load yet.\n * @param schemaInfo The schema info of the schema to load.\n * @param schemaContext The schema context to load the schema into.\n */\n protected async loadSchema(schemaInfo: SchemaInfo, schemaContext: SchemaContext): Promise<Schema> {\n // If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema\n // information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface\n // to fetch the whole schema json.\n if (!await this.supportPartialSchemaLoading(schemaContext)) {\n const schemaJson = await this.getSchemaJson(schemaInfo.schemaKey, schemaContext);\n if(schemaJson === undefined)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);\n\n return Schema.fromJson(schemaJson, schemaContext);\n }\n\n // Fetches the schema partials for the given schema key. The first item in the array is the\n // actual schema props of the schema to load, the following items are schema props of referenced\n // schema items that are needed to resolve the schema properly.\n const schemaPartials = await this.getSchemaPartials(schemaInfo.schemaKey, schemaContext);\n if (schemaPartials === undefined)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);\n\n // Sort the partials in dependency order to ensure referenced schemas exist in the schema context\n // when they get requested. Otherwise the context would call this method again and for referenced\n // schemas, we would not want to request the whole schema props.\n const sortedPartials = await this.sortSchemaPartials(schemaPartials, schemaContext);\n for (const schemaProps of sortedPartials) {\n await this.startLoadingPartialSchema(schemaProps, schemaContext);\n }\n\n const schema = await schemaContext.getCachedSchema(schemaInfo.schemaKey);\n if (!schema)\n throw new Error(`Schema ${schemaInfo.schemaKey.name} could not be found.`);\n\n return schema;\n }\n\n /**\n * Creates a SchemaProps object by loading the Schema information from the given SchemaContext.\n * @param schemaKey The SchemaKey of the Schema whose props are to be retrieved.\n * @param schemaContext The SchemaContext holding the Schema.\n * @returns The SchemaProps object.\n */\n protected async createSchemaProps(schemaKey: SchemaKey, schemaContext: SchemaContext): Promise<SchemaProps> {\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest);\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n\n const schemaReferences: Array<SchemaReferenceProps> = [];\n const schemaProps: SchemaProps = {\n $schema: ECSchemaNamespaceUris.SCHEMAURL3_2_JSON,\n name: schemaKey.name,\n alias: schemaInfo.alias,\n version: schemaInfo.schemaKey.version.toString(),\n references: schemaReferences,\n items: {}\n };\n\n schemaInfo.references.forEach((ref) => {\n schemaReferences.push({ name: ref.schemaKey.name, version: ref.schemaKey.version.toString() });\n });\n\n return schemaProps;\n }\n\n private async startLoadingPartialSchema(schemaProps: SchemaProps, schemaContext: SchemaContext): Promise<void> {\n if (schemaContext.schemaExists(SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`))) {\n return;\n }\n\n const controller = new SchemaLoadingController();\n const schemaReader = new IncrementalSchemaReader(schemaContext, true);\n const schema = new Schema(schemaContext);\n schema.setLoadingController(controller);\n\n await schemaReader.readSchema(schema, schemaProps);\n\n if (!this._options.loadPartialSchemaOnly)\n controller.start(this.startLoadingFullSchema(schema));\n }\n\n private async loadFullSchema(schema: Schema): Promise<void> {\n const fullSchemaProps = await this.getSchemaJson(schema.schemaKey, schema.context)\n const reader = new IncrementalSchemaReader(schema.context, false);\n await reader.readSchema(schema, fullSchemaProps, false);\n }\n\n private async startLoadingFullSchema(schema: Schema): Promise<void> {\n if (!schema.loadingController)\n return;\n\n // If the schema is already resolved, return it directly.\n if (schema.loadingController.isComplete || schema.loadingController.inProgress) {\n return;\n }\n\n // Since the schema relies on it's references, they get triggered to be resolved\n // first by recursively calling this method. After all references has been resolved\n // the schema itself gets resolved.\n await Promise.all(schema.references.map(async (referenceSchema) => {\n if (referenceSchema.loadingController && referenceSchema.loadingController.inProgress)\n return referenceSchema.loadingController.wait();\n else\n return this.startLoadingFullSchema(referenceSchema);\n }));\n\n return this.loadFullSchema(schema);\n }\n\n private async sortSchemaPartials(schemaPartials: ReadonlyArray<SchemaProps>, schemaContext: SchemaContext): Promise<ReadonlyArray<SchemaProps>> {\n const schemaInfos: Array<SchemaInfo & { props: SchemaProps }> = [];\n for (const schemaProps of schemaPartials) {\n const schemaKey = SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`);\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest);\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n\n schemaInfos.push({ ...schemaInfo, props: schemaProps });\n }\n\n const orderedSchemaInfos = SchemaGraphUtil.buildDependencyOrderedSchemaInfoList(schemaInfos) as Array<SchemaInfo & { props: SchemaProps }>;\n return orderedSchemaInfos.map((schemaInfo) => schemaInfo.props);\n }\n}\n\n/**\n * Helper class to manage schema infos for a schema context.\n */\nclass SchemaInfoCache {\n private readonly _schemaInfoCache: WeakMap<SchemaContext, Array<SchemaInfo>>;\n private readonly _schemaInfoLoader: LoadSchemaInfoHandler;\n\n constructor(schemaInfoLoader: LoadSchemaInfoHandler) {\n this._schemaInfoCache = new WeakMap<SchemaContext, Array<SchemaInfo>>();\n this._schemaInfoLoader = schemaInfoLoader;\n }\n\n public async getSchemasByContext(context: SchemaContext): Promise<SchemaInfo[] | undefined> {\n if (!this._schemaInfoCache.has(context)) {\n const schemaInfos = await this._schemaInfoLoader(context);\n this._schemaInfoCache.set(context, Array.from(schemaInfos));\n }\n return this._schemaInfoCache.get(context);\n }\n\n public async lookup(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n const contextSchemaInfos = await this.getSchemasByContext(context);\n return contextSchemaInfos\n ? contextSchemaInfos.find((schemaInfo) => schemaInfo.schemaKey.matches(schemaKey, matchType))\n : undefined;\n }\n\n public remove(schemaKey: SchemaKey, context: SchemaContext): void {\n const contextSchemaInfos = this._schemaInfoCache.get(context);\n if (!contextSchemaInfos)\n return;\n\n const index = contextSchemaInfos.findIndex((schemaInfo) => schemaInfo.schemaKey.name === schemaKey.name);\n if (index !== -1) {\n contextSchemaInfos.splice(index, 1);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncrementalSchemaReader.d.ts","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaReader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAI7D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,gBAAgB;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;;;;OAKG;gBACS,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO;IAK9D;;;;OAIG;cACgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO;IAMlF;;;;;;;OAOG;IACmB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"IncrementalSchemaReader.d.ts","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaReader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAI7D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,gBAAgB;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;;;;OAKG;gBACS,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO;IAK9D;;;;OAIG;cACgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO;IAMlF;;;;;;;OAOG;IACmB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAc1J,OAAO,CAAC,iBAAiB;CAkB1B"}
|
|
@@ -5,7 +5,6 @@ const Helper_1 = require("../Deserialization/Helper");
|
|
|
5
5
|
const JsonParser_1 = require("../Deserialization/JsonParser");
|
|
6
6
|
const ECObjects_1 = require("../ECObjects");
|
|
7
7
|
const Class_1 = require("../Metadata/Class");
|
|
8
|
-
const SchemaItem_1 = require("../Metadata/SchemaItem");
|
|
9
8
|
const SchemaLoadingController_1 = require("../utils/SchemaLoadingController");
|
|
10
9
|
/**
|
|
11
10
|
* Internal helper class to read schema information incrementally. It's based on the [[SchemaReadHelper]]
|
|
@@ -48,12 +47,7 @@ class IncrementalSchemaReader extends Helper_1.SchemaReadHelper {
|
|
|
48
47
|
// The fromJSON method of the actual class instances may complain about missing properties in the props, so
|
|
49
48
|
// calling the fromJSON on the ECClass ensures only the bare minimum is loaded.
|
|
50
49
|
if (this._incremental && schemaItemObject && schemaItem) {
|
|
51
|
-
|
|
52
|
-
SchemaItem_1.SchemaItem.prototype.fromJSONSync.call(schemaItem, schemaItemObject);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
schemaItem.fromJSONSync(schemaItemObject);
|
|
56
|
-
}
|
|
50
|
+
await schemaItem.fromJSON(schemaItemObject);
|
|
57
51
|
}
|
|
58
52
|
this.schemaItemLoading(schemaItem);
|
|
59
53
|
return schemaItem;
|
|
@@ -64,6 +58,7 @@ class IncrementalSchemaReader extends Helper_1.SchemaReadHelper {
|
|
|
64
58
|
if (schemaItem.loadingController === undefined) {
|
|
65
59
|
const controller = new SchemaLoadingController_1.SchemaLoadingController();
|
|
66
60
|
schemaItem.setLoadingController(controller);
|
|
61
|
+
return this.schemaItemLoading(schemaItem);
|
|
67
62
|
}
|
|
68
63
|
if (Class_1.ECClass.isECClass(schemaItem)
|
|
69
64
|
|| schemaItem.schemaItemType === ECObjects_1.SchemaItemType.KindOfQuantity
|