@itwin/ecschema-metadata 5.0.0-dev.89 → 5.0.0-dev.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Context.d.ts +48 -39
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +39 -13
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +0 -2
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +2 -6
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECObjects.js +0 -1
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +22 -11
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +50 -27
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +2 -2
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +13 -13
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts +4 -0
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +3 -3
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +2 -6
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js +2 -4
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +1 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/esm/Context.d.ts +48 -39
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +39 -13
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +0 -2
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +2 -6
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECObjects.js +0 -1
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +22 -11
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +50 -27
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +2 -2
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +13 -13
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts +4 -0
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +3 -3
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +2 -6
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js +2 -4
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +1 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/package.json +6 -6
package/lib/esm/Context.d.ts
CHANGED
|
@@ -36,29 +36,6 @@ export interface ISchemaLocater {
|
|
|
36
36
|
*/
|
|
37
37
|
getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Base interface for types that allow location of items inside a schema
|
|
41
|
-
* @beta
|
|
42
|
-
*/
|
|
43
|
-
export interface ISchemaItemLocater {
|
|
44
|
-
/**
|
|
45
|
-
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
46
|
-
* Will await a partially loaded schema then look in it for the requested item.
|
|
47
|
-
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
48
|
-
* @returns The requested schema item.
|
|
49
|
-
*/
|
|
50
|
-
getSchemaItem(schemaItemKey: SchemaItemKey): Promise<SchemaItem | undefined>;
|
|
51
|
-
getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T> | undefined>;
|
|
52
|
-
/**
|
|
53
|
-
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
54
|
-
* Will skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.
|
|
55
|
-
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
56
|
-
* @param itemConstructor The constructor of the item to return.
|
|
57
|
-
* @returns The requested schema item.
|
|
58
|
-
*/
|
|
59
|
-
getSchemaItemSync(schemaItemKey: SchemaItemKey): SchemaItem | undefined;
|
|
60
|
-
getSchemaItemSync<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): InstanceType<T> | undefined;
|
|
61
|
-
}
|
|
62
39
|
/**
|
|
63
40
|
* @internal
|
|
64
41
|
*/
|
|
@@ -116,13 +93,13 @@ export declare class SchemaCache implements ISchemaLocater {
|
|
|
116
93
|
* Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.
|
|
117
94
|
* Does not include schema items from schemas that are not completely loaded yet.
|
|
118
95
|
*/
|
|
119
|
-
getSchemaItems():
|
|
96
|
+
getSchemaItems(): Iterable<SchemaItem>;
|
|
120
97
|
/**
|
|
121
98
|
* Gets all the schemas from the schema cache.
|
|
122
99
|
* Does not include schemas from schemas that are not completely loaded yet.
|
|
123
100
|
* @returns An array of Schema objects.
|
|
124
101
|
*/
|
|
125
|
-
getAllSchemas(): Schema
|
|
102
|
+
getAllSchemas(): Iterable<Schema>;
|
|
126
103
|
}
|
|
127
104
|
/**
|
|
128
105
|
* The SchemaContext, context object is used to facilitate schema and schema item location.
|
|
@@ -132,7 +109,7 @@ export declare class SchemaCache implements ISchemaLocater {
|
|
|
132
109
|
* The context is made up of a group of Schema Locators.
|
|
133
110
|
* @beta
|
|
134
111
|
*/
|
|
135
|
-
export declare class SchemaContext
|
|
112
|
+
export declare class SchemaContext {
|
|
136
113
|
private _locaters;
|
|
137
114
|
private _knownSchemas;
|
|
138
115
|
private _fallbackLocaterDefined;
|
|
@@ -224,29 +201,61 @@ export declare class SchemaContext implements ISchemaItemLocater {
|
|
|
224
201
|
getCachedSchemaSync(schemaKey: SchemaKey, matchType?: SchemaMatchType): Schema | undefined;
|
|
225
202
|
/**
|
|
226
203
|
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
227
|
-
* Will await a partially loaded schema then look in it for the requested item
|
|
228
|
-
*
|
|
229
|
-
* @param
|
|
230
|
-
* @
|
|
204
|
+
* Will await a partially loaded schema then look in it for the requested item.
|
|
205
|
+
*
|
|
206
|
+
* @param schemaNameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.
|
|
207
|
+
* @param itemNameOrCtor - The name of the item to return or the constructor of the item to return.
|
|
208
|
+
* @param itemConstructor - The constructor of the item to return.
|
|
209
|
+
* @returns The requested schema item, or `undefined` if the item could not be found.
|
|
210
|
+
*
|
|
211
|
+
* @examples
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const schemaItem = await schemaContext.getSchemaItem(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")));
|
|
214
|
+
* const schemaItemWithCtor = await schemaContext.getSchemaItem(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")), EntityClass);
|
|
215
|
+
* const schemaItemByName = await schemaContext.getSchemaItem("TestSchema", "TestElement");
|
|
216
|
+
* const schemaItemByNameWithCtor = await schemaContext.getSchemaItem("TestSchema", "TestElement", EntityClass);
|
|
217
|
+
* const schemaItemFullName = await schemaContext.getSchemaItem("TestSchema:TestElement", EntityClass);
|
|
218
|
+
* const schemaItemFullNameWithCtor = await schemaContext.getSchemaItem("TestSchema:TestElement", EntityClass);
|
|
219
|
+
* const schemaItemFullNameSep = await schemaContext.getSchemaItem("TestSchema.TestElement", EntityClass);
|
|
220
|
+
* const schemaItemFullNameSepWithCtor = await schemaContext.getSchemaItem("TestSchema.TestElement", EntityClass);
|
|
221
|
+
* ```
|
|
231
222
|
*/
|
|
232
|
-
getSchemaItem(
|
|
233
|
-
getSchemaItem<T extends typeof SchemaItem>(
|
|
223
|
+
getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<InstanceType<T> | undefined>;
|
|
224
|
+
getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<SchemaItem | undefined>;
|
|
225
|
+
getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<InstanceType<T> | undefined>;
|
|
226
|
+
getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<SchemaItem | undefined>;
|
|
234
227
|
/**
|
|
235
228
|
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
236
229
|
* Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.
|
|
237
|
-
*
|
|
238
|
-
* @param
|
|
239
|
-
* @
|
|
230
|
+
*
|
|
231
|
+
* @param nameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.
|
|
232
|
+
* @param nameOrCtor - The name of the item to return or the constructor of the item to return.
|
|
233
|
+
* @param ctor - The constructor of the item to return.
|
|
234
|
+
* @returns The requested schema item, or `undefined` if the item could not be found.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const schemaItem = schemaContext.getSchemaItemSync(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")));
|
|
239
|
+
* const schemaItemWithCtor = schemaContext.getSchemaItemSync(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")), EntityClass);
|
|
240
|
+
* const schemaItemByName = schemaContext.getSchemaItemSync("TestSchema", "TestElement");
|
|
241
|
+
* const schemaItemByNameWithCtor = schemaContext.getSchemaItemSync("TestSchema", "TestElement", EntityClass);
|
|
242
|
+
* const schemaItemFullName = schemaContext.getSchemaItemSync("TestSchema:TestElement", EntityClass);
|
|
243
|
+
* const schemaItemFullNameWithCtor = schemaContext.getSchemaItemSync("TestSchema:TestElement", EntityClass);
|
|
244
|
+
* const schemaItemFullNameSep = schemaContext.getSchemaItemSync("TestSchema.TestElement", EntityClass);
|
|
245
|
+
* const schemaItemFullNameSepWithCtor = schemaContext.getSchemaItemSync("TestSchema.TestElement", EntityClass);
|
|
246
|
+
* ```
|
|
240
247
|
*/
|
|
241
|
-
getSchemaItemSync(
|
|
242
|
-
getSchemaItemSync<T extends typeof SchemaItem>(
|
|
248
|
+
getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): InstanceType<T> | undefined;
|
|
249
|
+
getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): SchemaItem | undefined;
|
|
250
|
+
getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): InstanceType<T> | undefined;
|
|
251
|
+
getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): SchemaItem | undefined;
|
|
243
252
|
/**
|
|
244
253
|
* Iterates through the items of each schema known to the context. This includes schemas added to the
|
|
245
254
|
* context using [[SchemaContext.addSchema]]. This does not include schemas that
|
|
246
255
|
* can be located by an ISchemaLocater instance added to the context.
|
|
247
256
|
* Does not include schema items from schemas that are not completely loaded yet.
|
|
248
257
|
*/
|
|
249
|
-
getSchemaItems():
|
|
258
|
+
getSchemaItems(): Iterable<SchemaItem>;
|
|
250
259
|
/**
|
|
251
260
|
* Gets all the Schemas known by the context. This includes schemas added to the
|
|
252
261
|
* context using [[SchemaContext.addSchema]]. This does not include schemas that
|
|
@@ -254,6 +263,6 @@ export declare class SchemaContext implements ISchemaItemLocater {
|
|
|
254
263
|
* include schemas that are partially loaded.
|
|
255
264
|
* @returns An array of Schema objects.
|
|
256
265
|
*/
|
|
257
|
-
getKnownSchemas(): Schema
|
|
266
|
+
getKnownSchemas(): Iterable<Schema>;
|
|
258
267
|
}
|
|
259
268
|
//# sourceMappingURL=Context.d.ts.map
|
package/lib/esm/Context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAiB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aA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7C;;;;;;OAMG;IACI,eAAe,IAAI,QAAQ,CAAC,MAAM,CAAC;CAG3C"}
|
package/lib/esm/Context.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { SchemaMatchType } from "./ECObjects";
|
|
6
6
|
import { ECObjectsError, ECObjectsStatus } from "./Exception";
|
|
7
|
+
import { SchemaItem } from "./Metadata/SchemaItem";
|
|
8
|
+
import { SchemaKey } from "./SchemaKey";
|
|
7
9
|
/**
|
|
8
10
|
* @internal
|
|
9
11
|
*/
|
|
@@ -306,21 +308,45 @@ export class SchemaContext {
|
|
|
306
308
|
getCachedSchemaSync(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
307
309
|
return this._knownSchemas.getSchemaSync(schemaKey, matchType);
|
|
308
310
|
}
|
|
309
|
-
async getSchemaItem(
|
|
310
|
-
|
|
311
|
-
if (
|
|
311
|
+
async getSchemaItem(schemaNameOrKey, itemNameOrCtor, itemConstructor) {
|
|
312
|
+
let schemaKey;
|
|
313
|
+
if (typeof schemaNameOrKey === "string") {
|
|
314
|
+
const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);
|
|
315
|
+
schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
schemaKey = schemaNameOrKey.schemaKey;
|
|
319
|
+
}
|
|
320
|
+
const schema = await this.getSchema(schemaKey, SchemaMatchType.Latest);
|
|
321
|
+
if (!schema)
|
|
312
322
|
return undefined;
|
|
313
|
-
if (
|
|
314
|
-
return schema.getItem(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
323
|
+
if (typeof itemNameOrCtor === "string") // Separate schema and item name arguments with/without an itemConstructor
|
|
324
|
+
return itemConstructor ? schema.getItem(itemNameOrCtor, itemConstructor) : schema.getItem(itemNameOrCtor);
|
|
325
|
+
if (typeof schemaNameOrKey === "string") // Single schema item full name argument with/without an itemConstructor
|
|
326
|
+
return itemNameOrCtor ? schema.lookupItem(schemaNameOrKey, itemNameOrCtor) : schema.lookupItem(schemaNameOrKey);
|
|
327
|
+
// Schema Item Key with/without an itemConstructor
|
|
328
|
+
return itemNameOrCtor ? schema.getItem(schemaNameOrKey.name, itemNameOrCtor) : schema.getItem(schemaNameOrKey.name);
|
|
329
|
+
}
|
|
330
|
+
getSchemaItemSync(schemaNameOrKey, itemNameOrCtor, itemConstructor) {
|
|
331
|
+
let schemaKey;
|
|
332
|
+
if (typeof schemaNameOrKey === "string") {
|
|
333
|
+
const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);
|
|
334
|
+
schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
schemaKey = schemaNameOrKey.schemaKey;
|
|
338
|
+
}
|
|
339
|
+
const schema = this.getSchemaSync(schemaKey, SchemaMatchType.Latest);
|
|
340
|
+
if (!schema)
|
|
320
341
|
return undefined;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
342
|
+
// Separate schema and item name arguments with/without an itemConstructor
|
|
343
|
+
if (typeof itemNameOrCtor === "string") {
|
|
344
|
+
return itemConstructor ? schema.getItemSync(itemNameOrCtor, itemConstructor) : schema.getItemSync(itemNameOrCtor);
|
|
345
|
+
}
|
|
346
|
+
if (typeof schemaNameOrKey === "string") // Single schema item full name argument with/without an itemConstructor
|
|
347
|
+
return itemNameOrCtor ? schema.lookupItemSync(schemaNameOrKey, itemNameOrCtor) : schema.lookupItemSync(schemaNameOrKey);
|
|
348
|
+
// Schema Item Key with/without an itemConstructor
|
|
349
|
+
return itemNameOrCtor ? schema.getItemSync(schemaNameOrKey.name, itemNameOrCtor) : schema.getItemSync(schemaNameOrKey.name);
|
|
324
350
|
}
|
|
325
351
|
/**
|
|
326
352
|
* Iterates through the items of each schema known to the context. This includes schemas added to the
|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AAiB,CAA8B,aAA4B,EAAE,eAAmB;QACrG,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QACnF,IAAI,SAAS,KAAK,MAAM;YACtB,OAAO,SAAS,CAAC;QAEnB,IAAG,SAAS,KAAK,eAAe;YAC9B,OAAO,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAEhD,OAAO,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @beta\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;\r\n}\r\n\r\n/**\r\n * Base interface for types that allow location of items inside a schema\r\n * @beta\r\n */\r\nexport interface ISchemaItemLocater {\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item.\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @returns The requested schema item.\r\n */\r\n getSchemaItem(schemaItemKey: SchemaItemKey): Promise<SchemaItem | undefined>;\r\n getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T> | undefined>;\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @param itemConstructor The constructor of the item to return.\r\n * @returns The requested schema item.\r\n */\r\n getSchemaItemSync(schemaItemKey: SchemaItemKey): SchemaItem | undefined;\r\n getSchemaItemSync<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): InstanceType<T> | undefined;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);\r\n }\r\n\r\n private schemaPromiseExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);\r\n }\r\n\r\n private findEntry(schemaKey: SchemaKey, matchType: SchemaMatchType): SchemaEntry | undefined {\r\n return this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));\r\n }\r\n\r\n private removeSchemaPromise(schemaKey: SchemaKey) {\r\n const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);\r\n if (entry)\r\n entry.schemaPromise = undefined;\r\n }\r\n\r\n private removeEntry(schemaKey: SchemaKey) {\r\n this._schema = this._schema.filter((entry: SchemaEntry) => !entry.schemaInfo.schemaKey.matches(schemaKey));\r\n }\r\n\r\n /**\r\n * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.\r\n * @param schemaKey The key to search for.\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (!entry)\r\n return undefined;\r\n\r\n if (entry.schemaPromise) {\r\n try {\r\n const schema = await entry.schemaPromise;\r\n return schema;\r\n } catch (e) {\r\n this.removeEntry(schemaKey);\r\n throw e;\r\n }\r\n }\r\n\r\n return entry.schema;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<SchemaInfo | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry)\r\n return entry.schemaInfo;\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): IterableIterator<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Schema[] {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @beta\r\n */\r\nexport class SchemaContext implements ISchemaItemLocater {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n private _fallbackLocaterDefined: boolean;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n this._fallbackLocaterDefined = false;\r\n }\r\n\r\n public get locaters(): ISchemaLocater[] { return this._locaters; }\r\n\r\n /**\r\n * Adds a locater to the context.\r\n *\r\n * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.\r\n * If a fallback locater is already defined, the new locater is inserted before the fallback locater.\r\n *\r\n * @param locater - The locater to be added.\r\n */\r\n public addLocater(locater: ISchemaLocater) {\r\n const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;\r\n this._locaters.splice(insertIndex, 0, locater);\r\n }\r\n\r\n /**\r\n * Adds a fallback locater to the context.\r\n *\r\n * If a fallback locater is already defined, it replaces the existing one.\r\n * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.\r\n *\r\n * @param locater - The locater to be added as a fallback.\r\n */\r\n public addFallbackLocater(locater: ISchemaLocater) {\r\n if (this._fallbackLocaterDefined) {\r\n this._locaters[this._locaters.length - 1] = locater;\r\n } else {\r\n this._locaters.push(locater);\r\n this._fallbackLocaterDefined = true;\r\n }\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this._knownSchemas.schemaExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.\r\n * Use this method over addSchema when asynchronously loading schemas\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = await locater.getSchema(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be gotten later from the context using [[getSchema]].\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined> {\r\n for (const locater of this._locaters) {\r\n const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);\r\n if (undefined !== schemaInfo)\r\n return schemaInfo;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = locater.getSchemaSync(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will await a partially loaded schema then return when it is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public async getCachedSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n return this._knownSchemas.getSchema(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public getCachedSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n return this._knownSchemas.getSchemaSync(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @param itemConstructor The constructor of the item to return.\r\n * @returns The requested schema item\r\n */\r\n public async getSchemaItem(schemaItemKey: SchemaItemKey): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\r\n const schema = await this.getSchema(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n\r\n if(undefined === itemConstructor)\r\n return schema.getItem(schemaItemKey.name);\r\n\r\n return schema.getItem(schemaItemKey.name, itemConstructor);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @param itemConstructor The constructor of the item to return.\r\n * @returns The requested schema item\r\n */\r\n public getSchemaItemSync(schemaItemKey: SchemaItemKey): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\r\n const schema = this.getSchemaSync(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n\r\n if(undefined === itemConstructor)\r\n return schema.getItemSync(schemaItemKey.name);\r\n\r\n return schema.getItemSync(schemaItemKey.name, itemConstructor);\r\n }\r\n\r\n /**\r\n * Iterates through the items of each schema known to the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public getSchemaItems(): IterableIterator<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Schema[] {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,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E,eAAe,CAAC,MAAM,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM;YACT,OAAO,SAAS,CAAC;QAEnB,0EAA0E;QAC1E,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACpH,CAAC;QAED,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,wEAAwE;YAC/G,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAE1H,kDAAkD;QAClD,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC5H,CAAC;IAEH;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @beta\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);\r\n }\r\n\r\n private schemaPromiseExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);\r\n }\r\n\r\n private findEntry(schemaKey: SchemaKey, matchType: SchemaMatchType): SchemaEntry | undefined {\r\n return this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));\r\n }\r\n\r\n private removeSchemaPromise(schemaKey: SchemaKey) {\r\n const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);\r\n if (entry)\r\n entry.schemaPromise = undefined;\r\n }\r\n\r\n private removeEntry(schemaKey: SchemaKey) {\r\n this._schema = this._schema.filter((entry: SchemaEntry) => !entry.schemaInfo.schemaKey.matches(schemaKey));\r\n }\r\n\r\n /**\r\n * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.\r\n * @param schemaKey The key to search for.\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (!entry)\r\n return undefined;\r\n\r\n if (entry.schemaPromise) {\r\n try {\r\n const schema = await entry.schemaPromise;\r\n return schema;\r\n } catch (e) {\r\n this.removeEntry(schemaKey);\r\n throw e;\r\n }\r\n }\r\n\r\n return entry.schema;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<SchemaInfo | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry)\r\n return entry.schemaInfo;\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): Iterable<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Iterable<Schema> {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @beta\r\n */\r\nexport class SchemaContext {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n private _fallbackLocaterDefined: boolean;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n this._fallbackLocaterDefined = false;\r\n }\r\n\r\n public get locaters(): ISchemaLocater[] { return this._locaters; }\r\n\r\n /**\r\n * Adds a locater to the context.\r\n *\r\n * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.\r\n * If a fallback locater is already defined, the new locater is inserted before the fallback locater.\r\n *\r\n * @param locater - The locater to be added.\r\n */\r\n public addLocater(locater: ISchemaLocater) {\r\n const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;\r\n this._locaters.splice(insertIndex, 0, locater);\r\n }\r\n\r\n /**\r\n * Adds a fallback locater to the context.\r\n *\r\n * If a fallback locater is already defined, it replaces the existing one.\r\n * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.\r\n *\r\n * @param locater - The locater to be added as a fallback.\r\n */\r\n public addFallbackLocater(locater: ISchemaLocater) {\r\n if (this._fallbackLocaterDefined) {\r\n this._locaters[this._locaters.length - 1] = locater;\r\n } else {\r\n this._locaters.push(locater);\r\n this._fallbackLocaterDefined = true;\r\n }\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this._knownSchemas.schemaExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.\r\n * Use this method over addSchema when asynchronously loading schemas\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = await locater.getSchema(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be gotten later from the context using [[getSchema]].\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined> {\r\n for (const locater of this._locaters) {\r\n const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);\r\n if (undefined !== schemaInfo)\r\n return schemaInfo;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = locater.getSchemaSync(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will await a partially loaded schema then return when it is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public async getCachedSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n return this._knownSchemas.getSchema(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public getCachedSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n return this._knownSchemas.getSchemaSync(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item.\r\n *\r\n * @param schemaNameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param itemNameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param itemConstructor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @examples\r\n * ```typescript\r\n * const schemaItem = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = await this.getSchema(schemaKey, SchemaMatchType.Latest);\r\n\r\n if (!schema)\r\n return undefined;\r\n\r\n if (typeof itemNameOrCtor === \"string\") // Separate schema and item name arguments with/without an itemConstructor\r\n return itemConstructor ? schema.getItem(itemNameOrCtor, itemConstructor) : schema.getItem(itemNameOrCtor);\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItem(schemaNameOrKey, itemNameOrCtor) : schema.lookupItem(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItem(schemaNameOrKey.name, itemNameOrCtor) : schema.getItem(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.\r\n *\r\n * @param nameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param nameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param ctor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @example\r\n * ```typescript\r\n * const schemaItem = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = this.getSchemaSync(schemaKey, SchemaMatchType.Latest);\r\n if (!schema)\r\n return undefined;\r\n\r\n // Separate schema and item name arguments with/without an itemConstructor\r\n if (typeof itemNameOrCtor === \"string\") {\r\n return itemConstructor ? schema.getItemSync(itemNameOrCtor, itemConstructor) : schema.getItemSync(itemNameOrCtor);\r\n }\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItemSync(schemaNameOrKey, itemNameOrCtor) : schema.lookupItemSync(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItemSync(schemaNameOrKey.name, itemNameOrCtor) : schema.getItemSync(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Iterates through the items of each schema known to the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public getSchemaItems(): Iterable<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Iterable<Schema> {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XmlParser.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/XmlParser.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACO,aAAa,EAAE,yBAAyB,EAAE,gBAAgB,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,aAAa;IAuBrB,OAAO,CAAC,8BAA8B;IAwCtC,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAiDxB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,mCAAmC;IAuB3C,OAAO,CAAC,0BAA0B;IAkBlC,OAAO,CAAE,2BAA2B;IAcpC,OAAO,CAAC,0BAA0B;IAwBlC,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,0BAA0B;IAgClC,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,+BAA+B;WAazB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAWhF,OAAO,CAAC,oBAAoB;IAa5B;;OAEG;IACH,OAAO,CAAC,6BAA6B;CAwBtC"}
|
|
@@ -793,8 +793,6 @@ export class XmlParser extends AbstractParser {
|
|
|
793
793
|
}
|
|
794
794
|
addCAPropertyValues(caClass, propertyElements) {
|
|
795
795
|
const instance = { className: caClass.fullName };
|
|
796
|
-
if (!caClass.properties)
|
|
797
|
-
return instance;
|
|
798
796
|
for (const propertyElement of propertyElements) {
|
|
799
797
|
const value = this.readPropertyValue(propertyElement, caClass);
|
|
800
798
|
if (value !== undefined)
|