@itwin/ecschema-metadata 5.1.0-dev.4 → 5.1.0-dev.40

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/lib/cjs/Context.d.ts +1 -1
  3. package/lib/cjs/Context.js +1 -1
  4. package/lib/cjs/Context.js.map +1 -1
  5. package/lib/cjs/Deserialization/SchemaGraphUtil.d.ts +12 -3
  6. package/lib/cjs/Deserialization/SchemaGraphUtil.d.ts.map +1 -1
  7. package/lib/cjs/Deserialization/SchemaGraphUtil.js +36 -23
  8. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  9. package/lib/cjs/Deserialization/XmlSerializationUtils.js +1 -1
  10. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  11. package/lib/cjs/ECObjects.d.ts +1 -1
  12. package/lib/cjs/ECObjects.js +2 -2
  13. package/lib/cjs/ECObjects.js.map +1 -1
  14. package/lib/cjs/Metadata/Class.d.ts +4 -16
  15. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  16. package/lib/cjs/Metadata/Class.js +51 -60
  17. package/lib/cjs/Metadata/Class.js.map +1 -1
  18. package/lib/cjs/Metadata/CustomAttribute.d.ts +7 -1
  19. package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
  20. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  21. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +1 -1
  22. package/lib/cjs/Metadata/CustomAttributeClass.js +1 -1
  23. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  24. package/lib/cjs/Metadata/EntityClass.d.ts +6 -6
  25. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  26. package/lib/cjs/Metadata/EntityClass.js +40 -20
  27. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  28. package/lib/cjs/Metadata/Format.js.map +1 -1
  29. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  30. package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -1
  31. package/lib/cjs/SchemaFormatsProvider.js +40 -14
  32. package/lib/cjs/SchemaFormatsProvider.js.map +1 -1
  33. package/lib/cjs/SchemaLoader.d.ts +4 -1
  34. package/lib/cjs/SchemaLoader.d.ts.map +1 -1
  35. package/lib/cjs/SchemaLoader.js +4 -1
  36. package/lib/cjs/SchemaLoader.js.map +1 -1
  37. package/lib/esm/Context.d.ts +1 -1
  38. package/lib/esm/Context.js +1 -1
  39. package/lib/esm/Context.js.map +1 -1
  40. package/lib/esm/Deserialization/SchemaGraphUtil.d.ts +12 -3
  41. package/lib/esm/Deserialization/SchemaGraphUtil.d.ts.map +1 -1
  42. package/lib/esm/Deserialization/SchemaGraphUtil.js +36 -23
  43. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  44. package/lib/esm/Deserialization/XmlSerializationUtils.js +1 -1
  45. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  46. package/lib/esm/ECObjects.d.ts +1 -1
  47. package/lib/esm/ECObjects.js +2 -2
  48. package/lib/esm/ECObjects.js.map +1 -1
  49. package/lib/esm/Metadata/Class.d.ts +4 -16
  50. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  51. package/lib/esm/Metadata/Class.js +51 -60
  52. package/lib/esm/Metadata/Class.js.map +1 -1
  53. package/lib/esm/Metadata/CustomAttribute.d.ts +7 -1
  54. package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
  55. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  56. package/lib/esm/Metadata/CustomAttributeClass.d.ts +1 -1
  57. package/lib/esm/Metadata/CustomAttributeClass.js +1 -1
  58. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  59. package/lib/esm/Metadata/EntityClass.d.ts +6 -6
  60. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  61. package/lib/esm/Metadata/EntityClass.js +40 -20
  62. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  63. package/lib/esm/Metadata/Format.js.map +1 -1
  64. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  65. package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -1
  66. package/lib/esm/SchemaFormatsProvider.js +41 -15
  67. package/lib/esm/SchemaFormatsProvider.js.map +1 -1
  68. package/lib/esm/SchemaLoader.d.ts +4 -1
  69. package/lib/esm/SchemaLoader.d.ts.map +1 -1
  70. package/lib/esm/SchemaLoader.js +4 -1
  71. package/lib/esm/SchemaLoader.js.map +1 -1
  72. package/package.json +12 -8
package/CHANGELOG.md CHANGED
@@ -1,6 +1,38 @@
1
1
  # Change Log - @itwin/ecschema-metadata
2
2
 
3
- This log was last generated on Thu, 10 Apr 2025 17:50:15 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 06 Jun 2025 13:44:02 GMT and should not be manually modified.
4
+
5
+ ## 4.11.5
6
+ Fri, 06 Jun 2025 13:41:18 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.11.4
11
+ Tue, 03 Jun 2025 16:15:19 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 4.11.3
16
+ Wed, 28 May 2025 13:56:23 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 4.11.2
21
+ Tue, 20 May 2025 20:14:46 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 4.11.1
26
+ Wed, 30 Apr 2025 13:13:21 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 4.11.0
31
+ Wed, 16 Apr 2025 15:50:28 GMT
32
+
33
+ ### Updates
34
+
35
+ - **BREAKING:** The signature of protected method `ECClass.buildPropertyCache()` has been changed to take less arguments and return a `Promise<Property[]>`.
4
36
 
5
37
  ## 4.10.13
6
38
  Thu, 10 Apr 2025 17:47:21 GMT
@@ -146,7 +146,7 @@ export declare class SchemaContext {
146
146
  /**
147
147
  * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
148
148
  * @param schemaItem The SchemaItem to add
149
- * @deprecated in 4.0 use ecschema-editing package
149
+ * @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package
150
150
  */
151
151
  addSchemaItem(schemaItem: SchemaItem): Promise<void>;
152
152
  /**
@@ -223,7 +223,7 @@ class SchemaContext {
223
223
  /**
224
224
  * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
225
225
  * @param schemaItem The SchemaItem to add
226
- * @deprecated in 4.0 use ecschema-editing package
226
+ * @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package
227
227
  */
228
228
  async addSchemaItem(schemaItem) {
229
229
  const schema = await this.getSchema(schemaItem.key.schemaKey, ECObjects_1.SchemaMatchType.Exact);
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,2CAA8C;AAC9C,2CAA4D;AAG5D,sDAAmD;AACnD,2CAAuD;AAEvD;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAgD9C;;GAEG;AACH,MAAa,WAAW;IACd,OAAO,CAAY;IAE3B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1C,kBAAkB,CAAC,SAAoB;QAC7C,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAChK,CAAC;IAEO,mBAAmB,CAAC,SAAoB;QAC9C,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAk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AAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF;AA7RD,sCA6RC","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 { ECSchemaError, ECSchemaStatus } 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 * @public @preview\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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 * @public @preview\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(): ReadonlyArray<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 ECSchemaError(ECSchemaStatus.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
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,2CAA8C;AAC9C,2CAA4D;AAG5D,sDAAmD;AACnD,2CAAuD;AAEvD;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAgD9C;;GAEG;AACH,MAAa,WAAW;IACd,OAAO,CAAY;IAE3B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1C,kBAAkB,CAAC,SAAoB;QAC7C,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAChK,CAAC;IAEO,mBAAmB,CAAC,SAAoB;QAC9C,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,IAAI,SAAS,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7K,CAAC;IAEO,SAAS,CAAC,SAAoB,EAAE,SAA0B;QAChE,O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,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAS,CAAC,UAAU,CAAC,CAAC;QAClF,CAAC;aAAM,CAAC;YACN,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC;QACxC,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,2BAAe,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;IAC9H,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;AA7RD,sCA6RC","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 { ECSchemaError, ECSchemaStatus } 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 * @public @preview\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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 * @public @preview\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(): ReadonlyArray<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 - might be removed in next major version. 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 ECSchemaError(ECSchemaStatus.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,4 +1,5 @@
1
- import { Schema } from "../Metadata/Schema";
1
+ import type { SchemaInfo } from "../Interfaces";
2
+ import type { Schema } from "../Metadata/Schema";
2
3
  /**
3
4
  * Utility class for working with Schema graphs.
4
5
  * @internal
@@ -12,6 +13,14 @@ export declare class SchemaGraphUtil {
12
13
  * will be created internally and passed along during recursive calls.
13
14
  */
14
15
  static buildDependencyOrderedSchemaList(insertSchema: Schema, schemas?: Schema[]): Schema[];
16
+ /**
17
+ * Returns a flat list of schemas in topological order, typically used before schema import
18
+ * so that dependent schemas are processed after their references. This method does not alter
19
+ * the original schemaInfos array.
20
+ * @param schemaInfos The schema collection that will hold the ordered schemas.
21
+ * @returns A list of schemas in topological order.
22
+ */
23
+ static buildDependencyOrderedSchemaInfoList(schemaInfos: ReadonlyArray<SchemaInfo>): ReadonlyArray<SchemaInfo>;
15
24
  /**
16
25
  * Indicates if the given Schema references the possibleDependency Schema.
17
26
  * @param schema The possible dependent schema.
@@ -27,8 +36,8 @@ export declare class SchemaGraphUtil {
27
36
  /**
28
37
  * Helper method that manages the insertion of a Schema into the schemas collection
29
38
  * based on the topological ordering algorithm.
30
- * @param schemas The ordered Schema collection.
31
- * @param insertSchema The Schema to insert.
39
+ * @param schemas The ordered collection.
40
+ * @param insert The instance to insert.
32
41
  */
33
42
  private static insertSchemaInDependencyOrderedList;
34
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaGraphUtil.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/SchemaGraphUtil.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;GAGG;AACH,qBAAa,eAAe;IAC1B;;;;;;OAMG;WACW,gCAAgC,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAWlG;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IAaxB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IASjC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,mCAAmC;CAgBnD"}
1
+ {"version":3,"file":"SchemaGraphUtil.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/SchemaGraphUtil.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD;;;GAGG;AACH,qBAAa,eAAe;IAC1B;;;;;;OAMG;WACW,gCAAgC,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAelG;;;;;;OAMG;WACW,oCAAoC,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC;IAarH;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IAcxB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAIjC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,mCAAmC;CAgBnD"}
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
3
  exports.SchemaGraphUtil = void 0;
8
4
  /**
@@ -20,23 +16,44 @@ class SchemaGraphUtil {
20
16
  static buildDependencyOrderedSchemaList(insertSchema, schemas) {
21
17
  if (!schemas)
22
18
  schemas = [];
23
- this.insertSchemaInDependencyOrderedList(schemas, insertSchema);
19
+ const lookupFn = (schema, referenceKey) => {
20
+ return schema.references.find((s) => s.schemaKey.name === referenceKey.name);
21
+ };
22
+ this.insertSchemaInDependencyOrderedList(schemas, insertSchema, lookupFn);
24
23
  for (const reference of insertSchema.references) {
25
24
  this.buildDependencyOrderedSchemaList(reference, schemas);
26
25
  }
27
26
  return schemas;
28
27
  }
28
+ /**
29
+ * Returns a flat list of schemas in topological order, typically used before schema import
30
+ * so that dependent schemas are processed after their references. This method does not alter
31
+ * the original schemaInfos array.
32
+ * @param schemaInfos The schema collection that will hold the ordered schemas.
33
+ * @returns A list of schemas in topological order.
34
+ */
35
+ static buildDependencyOrderedSchemaInfoList(schemaInfos) {
36
+ const sortedList = [];
37
+ const lookupFn = (_schema, reference) => {
38
+ return schemaInfos.find((s) => s.schemaKey.name === reference.name);
39
+ };
40
+ for (const schemaInfo of schemaInfos) {
41
+ this.insertSchemaInDependencyOrderedList(sortedList, schemaInfo, lookupFn);
42
+ }
43
+ return sortedList;
44
+ }
29
45
  /**
30
46
  * Indicates if the given Schema references the possibleDependency Schema.
31
47
  * @param schema The possible dependent schema.
32
48
  * @param possibleDependency The possible Schema dependency.
33
49
  */
34
- static dependsOn(schema, possibleDependency) {
50
+ static dependsOn(schema, possibleDependency, lookup) {
35
51
  if (this.directlyReferences(schema, possibleDependency))
36
52
  return true;
37
53
  // search for dependencies in indirect references
38
- for (const reference of schema.references) {
39
- if (this.dependsOn(reference, possibleDependency))
54
+ for (const referenceInfo of schema.references) {
55
+ const reference = lookup(schema, referenceInfo.schemaKey);
56
+ if (reference && this.dependsOn(reference, possibleDependency, lookup))
40
57
  return true;
41
58
  }
42
59
  return false;
@@ -47,31 +64,27 @@ class SchemaGraphUtil {
47
64
  * @param possibleDependency The Schema that may be referenced.
48
65
  */
49
66
  static directlyReferences(schema, possiblyReferencedSchema) {
50
- for (const reference of schema.references) {
51
- if (reference === possiblyReferencedSchema)
52
- return true;
53
- }
54
- return false;
67
+ return schema.references.some((ref) => ref.schemaKey.name === possiblyReferencedSchema.schemaKey.name);
55
68
  }
56
69
  /**
57
70
  * Helper method that manages the insertion of a Schema into the schemas collection
58
71
  * based on the topological ordering algorithm.
59
- * @param schemas The ordered Schema collection.
60
- * @param insertSchema The Schema to insert.
72
+ * @param schemas The ordered collection.
73
+ * @param insert The instance to insert.
61
74
  */
62
- static insertSchemaInDependencyOrderedList(schemas, insertSchema) {
63
- if (schemas.includes(insertSchema))
75
+ static insertSchemaInDependencyOrderedList(orderedList, insert, lookup) {
76
+ if (orderedList.includes(insert))
64
77
  return;
65
- for (let i = schemas.length - 1; i >= 0; --i) {
66
- const schema = schemas[i];
67
- if (this.dependsOn(insertSchema, schema)) {
78
+ for (let i = orderedList.length - 1; i >= 0; --i) {
79
+ const schema = orderedList[i];
80
+ if (this.dependsOn(insert, schema, lookup)) {
68
81
  // insert right after the referenced schema in the list
69
- const index = schemas.indexOf(schema);
70
- schemas.splice(index + 1, 0, insertSchema);
82
+ const index = orderedList.indexOf(schema);
83
+ orderedList.splice(index + 1, 0, insert);
71
84
  return;
72
85
  }
73
86
  }
74
- schemas.splice(0, 0, insertSchema);
87
+ orderedList.splice(0, 0, insert);
75
88
  }
76
89
  }
77
90
  exports.SchemaGraphUtil = SchemaGraphUtil;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaGraphUtil.js","sourceRoot":"","sources":["../../../src/Deserialization/SchemaGraphUtil.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAI/F;;;GAGG;AACH,MAAa,eAAe;IAC1B;;;;;;OAMG;IACI,MAAM,CAAC,gCAAgC,CAAC,YAAoB,EAAE,OAAkB;QACrF,IAAI,CAAC,OAAO;YACV,OAAO,GAAG,EAAE,CAAC;QAEf,IAAI,CAAC,mCAAmC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAChE,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;YAChD,IAAI,CAAC,gCAAgC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACK,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;CACF;AAzED,0CAyEC","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 { Schema } from \"../Metadata/Schema\";\n\n/**\n * Utility class for working with Schema graphs.\n * @internal\n */\nexport class SchemaGraphUtil {\n /**\n * Creates a flattened list of schemas in topological order, typically used before schema import\n * so that dependent schemas are processed after their references.\n * @param insertSchema The schema to be imported.\n * @param schemas The schema collection that will hold the ordered schemas. If null, the collection\n * will be created internally and passed along during recursive calls.\n */\n public static buildDependencyOrderedSchemaList(insertSchema: Schema, schemas?: Schema[]): Schema[] {\n if (!schemas)\n schemas = [];\n\n this.insertSchemaInDependencyOrderedList(schemas, insertSchema);\n for (const reference of insertSchema.references) {\n this.buildDependencyOrderedSchemaList(reference, schemas);\n }\n return schemas;\n }\n\n /**\n * Indicates if the given Schema references the possibleDependency Schema.\n * @param schema The possible dependent schema.\n * @param possibleDependency The possible Schema dependency.\n */\n private static dependsOn(schema: Schema, possibleDependency: Schema): boolean {\n if (this.directlyReferences(schema, possibleDependency))\n return true;\n\n // search for dependencies in indirect references\n for (const reference of schema.references) {\n if (this.dependsOn(reference, possibleDependency))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if the given Schema directly references the possiblyReferencedSchema Schema.\n * @param schema The possible parent schema.\n * @param possibleDependency The Schema that may be referenced.\n */\n private static directlyReferences(schema: Schema, possiblyReferencedSchema: Schema): boolean {\n for (const reference of schema.references) {\n if (reference === possiblyReferencedSchema)\n return true;\n }\n\n return false;\n }\n\n /**\n * Helper method that manages the insertion of a Schema into the schemas collection\n * based on the topological ordering algorithm.\n * @param schemas The ordered Schema collection.\n * @param insertSchema The Schema to insert.\n */\n private static insertSchemaInDependencyOrderedList(schemas: Schema[], insertSchema: Schema) {\n if (schemas.includes(insertSchema))\n return;\n\n for (let i = schemas.length - 1; i >= 0; --i) {\n const schema = schemas[i];\n if (this.dependsOn(insertSchema, schema)) {\n // insert right after the referenced schema in the list\n const index = schemas.indexOf(schema);\n schemas.splice(index + 1, 0, insertSchema);\n return;\n }\n }\n\n schemas.splice(0, 0, insertSchema);\n }\n}\n"]}
1
+ {"version":3,"file":"SchemaGraphUtil.js","sourceRoot":"","sources":["../../../src/Deserialization/SchemaGraphUtil.ts"],"names":[],"mappings":";;;AAUA;;;GAGG;AACH,MAAa,eAAe;IAC1B;;;;;;OAMG;IACI,MAAM,CAAC,gCAAgC,CAAC,YAAoB,EAAE,OAAkB;QACrF,IAAI,CAAC,OAAO;YACV,OAAO,GAAG,EAAE,CAAC;QAEf,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,YAAuB,EAAE,EAAE;YAC3D,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;QAC/E,CAAC,CAAC;QAEF,IAAI,CAAC,mCAAmC,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC1E,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;YAChD,IAAI,CAAC,gCAAgC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,oCAAoC,CAAC,WAAsC;QACvF,MAAM,UAAU,GAAsB,EAAE,CAAC;QACzC,MAAM,QAAQ,GAAG,CAAC,OAAmB,EAAE,SAAoB,EAAE,EAAE;YAC7D,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;QACtE,CAAC,CAAC;QAEF,KAAI,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;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E,CAAC;gBAC3C,uDAAuD;gBACvD,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC1C,WAAW,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;gBACzC,OAAO;YACT,CAAC;QACH,CAAC;QAED,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;CACF;AA7FD,0CA6FC","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 type { SchemaInfo } from \"../Interfaces\";\nimport type { SchemaKey } from \"../SchemaKey\";\nimport type { Schema } from \"../Metadata/Schema\";\n\ntype SchemaReferenceLookup<T extends SchemaInfo> = (input: T, reference: SchemaKey) => T | undefined;\n\n/**\n * Utility class for working with Schema graphs.\n * @internal\n */\nexport class SchemaGraphUtil {\n /**\n * Creates a flattened list of schemas in topological order, typically used before schema import\n * so that dependent schemas are processed after their references.\n * @param insertSchema The schema to be imported.\n * @param schemas The schema collection that will hold the ordered schemas. If null, the collection\n * will be created internally and passed along during recursive calls.\n */\n public static buildDependencyOrderedSchemaList(insertSchema: Schema, schemas?: Schema[]): Schema[] {\n if (!schemas)\n schemas = [];\n\n const lookupFn = (schema: Schema, referenceKey: SchemaKey) => {\n return schema.references.find((s) => s.schemaKey.name === referenceKey.name);\n };\n\n this.insertSchemaInDependencyOrderedList(schemas, insertSchema, lookupFn);\n for (const reference of insertSchema.references) {\n this.buildDependencyOrderedSchemaList(reference, schemas);\n }\n return schemas;\n }\n\n /**\n * Returns a flat list of schemas in topological order, typically used before schema import\n * so that dependent schemas are processed after their references. This method does not alter\n * the original schemaInfos array.\n * @param schemaInfos The schema collection that will hold the ordered schemas.\n * @returns A list of schemas in topological order.\n */\n public static buildDependencyOrderedSchemaInfoList(schemaInfos: ReadonlyArray<SchemaInfo>): ReadonlyArray<SchemaInfo> {\n const sortedList: Array<SchemaInfo> = [];\n const lookupFn = (_schema: SchemaInfo, reference: SchemaKey) => {\n return schemaInfos.find((s) => s.schemaKey.name === reference.name);\n };\n\n for(const schemaInfo of schemaInfos) {\n this.insertSchemaInDependencyOrderedList(sortedList, schemaInfo, lookupFn);\n }\n\n return sortedList;\n }\n\n /**\n * Indicates if the given Schema references the possibleDependency Schema.\n * @param schema The possible dependent schema.\n * @param possibleDependency The possible Schema dependency.\n */\n private static dependsOn<T extends SchemaInfo>(schema: T, possibleDependency: T, lookup: SchemaReferenceLookup<T>): boolean {\n if (this.directlyReferences(schema, possibleDependency))\n return true;\n\n // search for dependencies in indirect references\n for (const referenceInfo of schema.references) {\n const reference = lookup(schema, referenceInfo.schemaKey);\n if (reference && this.dependsOn(reference, possibleDependency, lookup))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if the given Schema directly references the possiblyReferencedSchema Schema.\n * @param schema The possible parent schema.\n * @param possibleDependency The Schema that may be referenced.\n */\n private static directlyReferences<T extends SchemaInfo>(schema: T, possiblyReferencedSchema: T): boolean {\n return schema.references.some((ref) => ref.schemaKey.name === possiblyReferencedSchema.schemaKey.name);\n }\n\n /**\n * Helper method that manages the insertion of a Schema into the schemas collection\n * based on the topological ordering algorithm.\n * @param schemas The ordered collection.\n * @param insert The instance to insert.\n */\n private static insertSchemaInDependencyOrderedList<T extends SchemaInfo>(orderedList: T[], insert: T, lookup: SchemaReferenceLookup<T>) {\n if (orderedList.includes(insert))\n return;\n\n for (let i = orderedList.length - 1; i >= 0; --i) {\n const schema = orderedList[i];\n if (this.dependsOn(insert, schema, lookup)) {\n // insert right after the referenced schema in the list\n const index = orderedList.indexOf(schema);\n orderedList.splice(index + 1, 0, insert);\n return;\n }\n }\n\n orderedList.splice(0, 0, insert);\n }\n}\n"]}
@@ -91,7 +91,7 @@ var XmlSerializationUtils;
91
91
  */
92
92
  async function writeStructProperty(propertyClass, propertyValue, structElement, schemaDoc) {
93
93
  const structClass = propertyClass.structClass;
94
- for (const propertyMetadata of structClass.getPropertiesSync(true))
94
+ for (const propertyMetadata of structClass.getPropertiesSync())
95
95
  await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);
96
96
  }
97
97
  XmlSerializationUtils.writeStructProperty = writeStructProperty;
@@ -1 +1 @@
1
- {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAAoE;AACpE,4CAA6D;AAM7D;;;GAGG;AACH,IAAiB,qBAAqB,CAiKrC;AAjKD,WAAiB,qBAAqB;IACpC;;;;;;OAMG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAAE,SAAmB,EAAE,MAAc;QAChI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAyB,CAAC;QAC1E,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,aAAa,EAAE,cAAc,QAAQ,qDAAqD,CAAC,CAAC;QAErI,MAAM,gBAAgB,GAAG,MAAM,+BAA+B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/D,IAAI,gBAAgB,CAAC,CAAC,CAAC;YACrB,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvD,KAAK,MAAM,QAAQ,IAAI,MAAM,OAAO,CAAC,aAAa,EAAE;YAClD,MAAM,qBAAqB,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAE/E,OAAO,SAAS,CAAC;IACnB,CAAC;IAfqB,0CAAoB,uBAezC,C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;IAC3F,CAAC;AACH,CAAC,EAjKgB,qBAAqB,qCAArB,qBAAqB,QAiKrC","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 { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\nimport { Schema } from \"../Metadata/Schema\";\n\n/**\n * Namespace holding utility functions for serializing EC types to the EC XML format.\n * @internal\n */\nexport namespace XmlSerializationUtils {\n /**\n * Serializes a CustomAttribute instance to the EC XML format.\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\n * @param customAttribute The CustomAttribute instance to serialize.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n * @param schema The Schema object being serialized.\n */\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\n if (!caClass)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\n\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\n\n if (nameAndNamespace[1])\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\n\n for (const property of await caClass.getProperties())\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\n\n return caElement;\n }\n\n /**\n * Serializes an EC Property instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param instance The Property instance.\n * @param instanceElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\n const propertyValue = instance[propertyClass.name];\n if (propertyValue === undefined)\n return;\n\n const propertyElement = schemaDoc.createElement(propertyClass.name);\n instanceElement.appendChild(propertyElement);\n\n if (propertyClass.isArray()) {\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n } else if (propertyClass.isPrimitive()) {\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\n } else if (propertyClass.isStruct()) {\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n }\n }\n\n /**\n * Serializes an EC ArrayProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue An array holding the property values.\n * @param arrayElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\n if (propertyClass.isPrimitive()) {\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\n for (const value of propertyValue) {\n const entryElement = schemaDoc.createElement(typeString);\n await writePrimitiveProperty(propertyClass, value, entryElement);\n arrayElement.appendChild(entryElement);\n }\n }\n\n if (propertyClass.isStruct()) {\n for (const value of propertyValue) {\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\n arrayElement.appendChild(structElement);\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\n }\n }\n }\n\n /**\n * Serializes an EC StructProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param structElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\n const structClass = propertyClass.structClass;\n for (const propertyMetadata of structClass.getPropertiesSync(true))\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\n }\n\n /**\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param propertyElement The XML Element that will contain the serialized property instance.\n */\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\n let primitiveType: PrimitiveType;\n if (propertyClass.isEnumeration()) {\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\n if (!enumeration)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\n\n if (enumeration.type === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\n\n primitiveType = enumeration.type;\n } else\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\n\n switch (primitiveType) {\n case PrimitiveType.String:\n propertyElement.textContent = propertyValue;\n return;\n case PrimitiveType.Boolean:\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\n return;\n case PrimitiveType.Integer:\n case PrimitiveType.Double:\n case PrimitiveType.Long:\n propertyElement.textContent = propertyValue.toString();\n return;\n case PrimitiveType.DateTime:\n propertyElement.textContent = new Date(propertyValue).getTime().toString();\n return;\n case PrimitiveType.Point2d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\n return;\n case PrimitiveType.Point3d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\n return;\n case PrimitiveType.IGeometry:\n case PrimitiveType.Binary:\n propertyElement.textContent = propertyValue;\n return;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\n }\n }\n\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\n return typeName;\n\n // Alias is required in Spec. It could be undefined (technically), so\n // throw until fixed.\n if (typeSchema.alias === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\n\n return `${typeSchema.alias}:${typeName}`;\n }\n\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\n const nameParts = caName.split(\".\");\n if (nameParts.length === 1)\n return [caName, undefined];\n\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\n if (!attributeSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\n\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\n }\n}\n"]}
1
+ {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAAoE;AACpE,4CAA6D;AAM7D;;;GAGG;AACH,IAAiB,qBAAqB,CAiKrC;AAjKD,WAAiB,qBAAqB;IACpC;;;;;;OAMG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAAE,SAAmB,EAAE,MAAc;QAChI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAyB,CAAC;QAC1E,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,aAAa,EAAE,cAAc,QAAQ,qDAAqD,CAAC,CAAC;QAErI,MAAM,gBAAgB,GAAG,MAAM,+BAA+B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/D,IAAI,gBAAgB,CAAC,CAAC,CAAC;YACrB,SAAS,CAAC,YAAY,CA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AC,0BAAc,CAAC,oBAAoB,EAAE,wDAAwD,MAAM,oCAAoC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QAExM,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC,EAjKgB,qBAAqB,qCAArB,qBAAqB,QAiKrC","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 { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\nimport { Schema } from \"../Metadata/Schema\";\n\n/**\n * Namespace holding utility functions for serializing EC types to the EC XML format.\n * @internal\n */\nexport namespace XmlSerializationUtils {\n /**\n * Serializes a CustomAttribute instance to the EC XML format.\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\n * @param customAttribute The CustomAttribute instance to serialize.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n * @param schema The Schema object being serialized.\n */\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\n if (!caClass)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\n\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\n\n if (nameAndNamespace[1])\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\n\n for (const property of await caClass.getProperties())\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\n\n return caElement;\n }\n\n /**\n * Serializes an EC Property instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param instance The Property instance.\n * @param instanceElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\n const propertyValue = instance[propertyClass.name];\n if (propertyValue === undefined)\n return;\n\n const propertyElement = schemaDoc.createElement(propertyClass.name);\n instanceElement.appendChild(propertyElement);\n\n if (propertyClass.isArray()) {\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n } else if (propertyClass.isPrimitive()) {\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\n } else if (propertyClass.isStruct()) {\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n }\n }\n\n /**\n * Serializes an EC ArrayProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue An array holding the property values.\n * @param arrayElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\n if (propertyClass.isPrimitive()) {\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\n for (const value of propertyValue) {\n const entryElement = schemaDoc.createElement(typeString);\n await writePrimitiveProperty(propertyClass, value, entryElement);\n arrayElement.appendChild(entryElement);\n }\n }\n\n if (propertyClass.isStruct()) {\n for (const value of propertyValue) {\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\n arrayElement.appendChild(structElement);\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\n }\n }\n }\n\n /**\n * Serializes an EC StructProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param structElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\n const structClass = propertyClass.structClass;\n for (const propertyMetadata of structClass.getPropertiesSync())\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\n }\n\n /**\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param propertyElement The XML Element that will contain the serialized property instance.\n */\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\n let primitiveType: PrimitiveType;\n if (propertyClass.isEnumeration()) {\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\n if (!enumeration)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\n\n if (enumeration.type === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\n\n primitiveType = enumeration.type;\n } else\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\n\n switch (primitiveType) {\n case PrimitiveType.String:\n propertyElement.textContent = propertyValue;\n return;\n case PrimitiveType.Boolean:\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\n return;\n case PrimitiveType.Integer:\n case PrimitiveType.Double:\n case PrimitiveType.Long:\n propertyElement.textContent = propertyValue.toString();\n return;\n case PrimitiveType.DateTime:\n propertyElement.textContent = new Date(propertyValue).getTime().toString();\n return;\n case PrimitiveType.Point2d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\n return;\n case PrimitiveType.Point3d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\n return;\n case PrimitiveType.IGeometry:\n case PrimitiveType.Binary:\n propertyElement.textContent = propertyValue;\n return;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\n }\n }\n\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\n return typeName;\n\n // Alias is required in Spec. It could be undefined (technically), so\n // throw until fixed.\n if (typeSchema.alias === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\n\n return `${typeSchema.alias}:${typeName}`;\n }\n\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\n const nameParts = caName.split(\".\");\n if (nameParts.length === 1)\n return [caName, undefined];\n\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\n if (!attributeSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\n\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\n }\n}\n"]}
@@ -147,7 +147,7 @@ export declare function parseSchemaItemType(type: string): SchemaItemType | unde
147
147
  * @param value The SchemaItemType to stringify.
148
148
  * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.
149
149
  * @beta
150
- * @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly
150
+ * @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly
151
151
  */
152
152
  export declare function schemaItemTypeToString(value: SchemaItemType): string;
153
153
  /** @internal */
@@ -129,7 +129,7 @@ var SchemaMatchType;
129
129
  (function (SchemaMatchType) {
130
130
  /*
131
131
  * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched
132
- * @deprecated in 4.10 Use Exact instead.
132
+ * @deprecated in 4.10 - might be removed in next major version. Use Exact instead.
133
133
  */
134
134
  SchemaMatchType[SchemaMatchType["Identical"] = 0] = "Identical";
135
135
  /* Find exact VersionRead, VersionWrite, VersionMinor match. */
@@ -229,7 +229,7 @@ function parseSchemaItemType(type) {
229
229
  * @param value The SchemaItemType to stringify.
230
230
  * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.
231
231
  * @beta
232
- * @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly
232
+ * @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly
233
233
  */
234
234
  function schemaItemTypeToString(value) {
235
235
  return value; // TODO: Remove