@itwin/ecschema-metadata 5.0.0-dev.24 → 5.0.0-dev.28

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.
@@ -118,8 +118,27 @@ export declare class SchemaCache implements ISchemaLocater {
118
118
  export declare class SchemaContext implements ISchemaItemLocater {
119
119
  private _locaters;
120
120
  private _knownSchemas;
121
+ private _fallbackLocaterDefined;
121
122
  constructor();
123
+ get locaters(): ISchemaLocater[];
124
+ /**
125
+ * Adds a locater to the context.
126
+ *
127
+ * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.
128
+ * If a fallback locater is already defined, the new locater is inserted before the fallback locater.
129
+ *
130
+ * @param locater - The locater to be added.
131
+ */
122
132
  addLocater(locater: ISchemaLocater): void;
133
+ /**
134
+ * Adds a fallback locater to the context.
135
+ *
136
+ * If a fallback locater is already defined, it replaces the existing one.
137
+ * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.
138
+ *
139
+ * @param locater - The locater to be added as a fallback.
140
+ */
141
+ addFallbackLocater(locater: ISchemaLocater): void;
123
142
  /**
124
143
  * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.
125
144
  * @param schema The schema to add to this context
@@ -1 +1 @@
1
- {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAiB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgBvD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAE7B;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE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Cache();
166
166
  this._locaters.push(this._knownSchemas);
167
+ this._fallbackLocaterDefined = false;
167
168
  }
169
+ get locaters() { return this._locaters; }
170
+ /**
171
+ * Adds a locater to the context.
172
+ *
173
+ * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.
174
+ * If a fallback locater is already defined, the new locater is inserted before the fallback locater.
175
+ *
176
+ * @param locater - The locater to be added.
177
+ */
168
178
  addLocater(locater) {
169
- this._locaters.push(locater);
179
+ const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;
180
+ this._locaters.splice(insertIndex, 0, locater);
181
+ }
182
+ /**
183
+ * Adds a fallback locater to the context.
184
+ *
185
+ * If a fallback locater is already defined, it replaces the existing one.
186
+ * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.
187
+ *
188
+ * @param locater - The locater to be added as a fallback.
189
+ */
190
+ addFallbackLocater(locater) {
191
+ if (this._fallbackLocaterDefined) {
192
+ this._locaters[this._locaters.length - 1] = locater;
193
+ }
194
+ else {
195
+ this._locaters.push(locater);
196
+ this._fallbackLocaterDefined = true;
197
+ }
170
198
  }
171
199
  /**
172
200
  * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAM9D;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAuD9C;;GAEG;AACH,MAAM,OAAO,WAAW;IAGtB;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,kBA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AAS,KAAK,MAAM;YACtB,OAAO,SAAS,CAAC;QACnB,OAAO,MAAM,CAAC,WAAW,CAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @beta\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | 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: Readonly<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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface ISchemaItemLocater {\r\n getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined>;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: Readonly<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: Readonly<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: Readonly<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: Readonly<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: Readonly<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: Readonly<SchemaKey>): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema<T extends Schema>(schema: T) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync<T extends Schema>(schema: T) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | 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 as T;\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 as T;\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: Readonly<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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): T | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema as T;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): IterableIterator<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Schema[] {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @beta\r\n */\r\nexport class SchemaContext implements ISchemaItemLocater {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n }\r\n\r\n public addLocater(locater: ISchemaLocater) {\r\n this._locaters.push(locater);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: Readonly<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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | 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<T>(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: Readonly<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<T extends Schema>(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): T | 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<T>(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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | undefined> {\r\n return this._knownSchemas.getSchema<T>(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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): T | undefined {\r\n return this._knownSchemas.getSchemaSync<T>(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @returns The requested schema item\r\n */\r\n public async getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined> {\r\n const schema = await this.getSchema(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n return schema.getItem<T>(schemaItemKey.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 skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @returns The requested schema item\r\n */\r\n public getSchemaItemSync<T extends SchemaItem>(schemaItemKey: SchemaItemKey): T | undefined {\r\n const schema = this.getSchemaSync(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n return schema.getItemSync<T>(schemaItemKey.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(): IterableIterator<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Schema[] {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAM9D;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAuD9C;;GAEG;AACH,MAAM,OAAO,WAAW;IAGtB;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,SAA8B;QACvD,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAChK,CAAC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;IACnE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAuB,aAA4B;QAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QACrF,IAAI,SAAS,KAAK,MAAM;YACtB,OAAO,SAAS,CAAC;QACnB,OAAO,MAAM,CAAC,OAAO,CAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAuB,aAA4B;QACzE,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QACnF,IAAI,SAAS,KAAK,MAAM;YACtB,OAAO,SAAS,CAAC;QACnB,OAAO,MAAM,CAAC,WAAW,CAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @beta\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | 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: Readonly<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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface ISchemaItemLocater {\r\n getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined>;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: Readonly<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: Readonly<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: Readonly<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: Readonly<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: Readonly<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: Readonly<SchemaKey>): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema<T extends Schema>(schema: T) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync<T extends Schema>(schema: T) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | 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 as T;\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 as T;\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: Readonly<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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): T | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema as T;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): IterableIterator<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Schema[] {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @beta\r\n */\r\nexport class SchemaContext implements ISchemaItemLocater {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n private _fallbackLocaterDefined: boolean;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n this._fallbackLocaterDefined = false;\r\n }\r\n\r\n public get locaters(): ISchemaLocater[] { return this._locaters; }\r\n\r\n /**\r\n * Adds a locater to the context.\r\n *\r\n * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.\r\n * If a fallback locater is already defined, the new locater is inserted before the fallback locater.\r\n *\r\n * @param locater - The locater to be added.\r\n */\r\n public addLocater(locater: ISchemaLocater) {\r\n const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;\r\n this._locaters.splice(insertIndex, 0, locater);\r\n }\r\n\r\n /**\r\n * Adds a fallback locater to the context.\r\n *\r\n * If a fallback locater is already defined, it replaces the existing one.\r\n * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.\r\n *\r\n * @param locater - The locater to be added as a fallback.\r\n */\r\n public addFallbackLocater(locater: ISchemaLocater) {\r\n if (this._fallbackLocaterDefined) {\r\n this._locaters[this._locaters.length - 1] = locater;\r\n } else {\r\n this._locaters.push(locater);\r\n this._fallbackLocaterDefined = true;\r\n }\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: Readonly<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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | 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<T>(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: Readonly<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<T extends Schema>(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): T | 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<T>(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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | undefined> {\r\n return this._knownSchemas.getSchema<T>(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<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): T | undefined {\r\n return this._knownSchemas.getSchemaSync<T>(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @returns The requested schema item\r\n */\r\n public async getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined> {\r\n const schema = await this.getSchema(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n return schema.getItem<T>(schemaItemKey.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 skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @returns The requested schema item\r\n */\r\n public getSchemaItemSync<T extends SchemaItem>(schemaItemKey: SchemaItemKey): T | undefined {\r\n const schema = this.getSchemaSync(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n return schema.getItemSync<T>(schemaItemKey.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(): IterableIterator<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Schema[] {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Property.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACe,wBAAwB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,gCAAgC,EACpI,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAC3D,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAsB,aAAa,EAAyB,iBAAiB,EAA6B,MAAM,cAAc,CAAC;AAEtI,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACnJ,OAAO,EAAE,YAAY,EAA2C,MAAM,kBAAkB,CAAC;AAEzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CAAC;AAElI,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;A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this._label; }
33
33
  get description() { return this._description; }
34
34
  get isReadOnly() { return this._isReadOnly || false; }
35
- get priority() { return this._priority || 0; }
36
- get category() { return this._category; }
37
- get kindOfQuantity() { return this._kindOfQuantity; }
35
+ get priority() {
36
+ if (this._priority === undefined) {
37
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
38
+ if (undefined !== baseProperty) {
39
+ return baseProperty.priority;
40
+ }
41
+ }
42
+ return this._priority || 0;
43
+ }
44
+ get category() {
45
+ if (this._category === undefined) {
46
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
47
+ if (undefined !== baseProperty) {
48
+ return baseProperty.category;
49
+ }
50
+ }
51
+ return this._category;
52
+ }
53
+ get kindOfQuantity() {
54
+ if (this._kindOfQuantity === undefined) {
55
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
56
+ if (undefined !== baseProperty) {
57
+ return baseProperty.kindOfQuantity;
58
+ }
59
+ }
60
+ return this._kindOfQuantity;
61
+ }
38
62
  get propertyType() { return this._type; }
39
63
  get customAttributes() { return this._customAttributes; }
40
64
  /** Returns the name in the format 'ClassName.PropertyName'. */
@@ -42,13 +66,23 @@ export class Property {
42
66
  /** Returns the schema of the class holding the property. */
43
67
  get schema() { return this._class.schema; }
44
68
  getCategorySync() {
45
- if (!this._category)
69
+ if (!this._category) {
70
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
71
+ if (undefined !== baseProperty) {
72
+ return baseProperty.getCategorySync();
73
+ }
46
74
  return undefined;
75
+ }
47
76
  return this.class.schema.lookupItemSync(this._category);
48
77
  }
49
78
  getKindOfQuantitySync() {
50
- if (!this._kindOfQuantity)
79
+ if (!this._kindOfQuantity) {
80
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
81
+ if (undefined !== baseProperty) {
82
+ return baseProperty.getKindOfQuantitySync();
83
+ }
51
84
  return undefined;
85
+ }
52
86
  return this.class.schema.lookupItemSync(this._kindOfQuantity);
53
87
  }
54
88
  /**
@@ -64,12 +98,12 @@ export class Property {
64
98
  schemaJson.label = this.label;
65
99
  if (this._isReadOnly !== undefined)
66
100
  schemaJson.isReadOnly = this._isReadOnly;
67
- if (this.category !== undefined)
68
- schemaJson.category = this.category.fullName; // needs to be fully qualified name
101
+ if (this._category !== undefined)
102
+ schemaJson.category = this._category.fullName; // needs to be fully qualified name
69
103
  if (this._priority !== undefined)
70
104
  schemaJson.priority = this._priority;
71
- if (this.kindOfQuantity !== undefined)
72
- schemaJson.kindOfQuantity = this.kindOfQuantity.fullName;
105
+ if (this._kindOfQuantity !== undefined)
106
+ schemaJson.kindOfQuantity = this._kindOfQuantity.fullName;
73
107
  const customAttributes = serializeCustomAttributes(this.customAttributes);
74
108
  if (customAttributes !== undefined)
75
109
  schemaJson.customAttributes = customAttributes;
@@ -86,15 +120,15 @@ export class Property {
86
120
  itemElement.setAttribute("displayLabel", this.label);
87
121
  if (undefined !== this.isReadOnly)
88
122
  itemElement.setAttribute("readOnly", String(this.isReadOnly));
89
- if (undefined !== this.category) {
90
- const category = await this.category;
123
+ if (undefined !== this._category) {
124
+ const category = await this._category;
91
125
  const categoryName = XmlSerializationUtils.createXmlTypedName(this.schema, category.schema, category.name);
92
126
  itemElement.setAttribute("category", categoryName);
93
127
  }
94
- if (undefined !== this.priority)
95
- itemElement.setAttribute("priority", this.priority.toString());
96
- if (undefined !== this.kindOfQuantity) {
97
- const kindOfQuantity = await this.kindOfQuantity;
128
+ if (undefined !== this._priority)
129
+ itemElement.setAttribute("priority", this._priority.toString());
130
+ if (undefined !== this._kindOfQuantity) {
131
+ const kindOfQuantity = await this._kindOfQuantity;
98
132
  const kindOfQuantityName = XmlSerializationUtils.createXmlTypedName(this.schema, kindOfQuantity.schema, kindOfQuantity.name);
99
133
  itemElement.setAttribute("kindOfQuantity", kindOfQuantityName);
100
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../src/Metadata/Property.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,O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,CAAC;IACtC,CAAC;IAED;;OAEG;IACa,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;CAEF;AAED,YAAY;AACZ,MAAM,OAAO,wBAAyB,SAAQ,kBAAkB,CAAC,mBAAmB,CAAC;IACnF,YAAY,OAAgB,EAAE,IAAY,EAAE,IAA2B;QACrE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAED,YAAY;AACZ,MAAM,OAAO,mBAAoB,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IACzE,YAAY,OAAgB,EAAE,IAAY,EAAE,IAAiB;QAC3D,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAaD;;;GAGG;AACH,MAAM,OAAgB,eAAgB,SAAQ,QAAQ;CAErD","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\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport {\r\n ArrayPropertyProps, EnumerationPropertyProps, NavigationPropertyProps, PrimitiveArrayPropertyProps, PrimitiveOrEnumPropertyBaseProps,\r\n PrimitivePropertyProps, PropertyProps, StructPropertyProps,\r\n} from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { parsePrimitiveType, PrimitiveType, primitiveTypeToString, StrengthDirection, strengthDirectionToString } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { AnyClass, LazyLoadedEnumeration, LazyLoadedKindOfQuantity, LazyLoadedPropertyCategory, LazyLoadedRelationshipClass } from \"../Interfaces\";\r\nimport { PropertyType, propertyTypeToString, PropertyTypeUtils } from \"../PropertyTypes\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECName } from \"../ECName\";\r\nimport { ECClass, StructClass } from \"./Class\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport { KindOfQuantity } from \"./KindOfQuantity\";\r\nimport { PropertyCategory } from \"./PropertyCategory\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { Schema } from \"./Schema\";\r\n\r\n/**\r\n * A common abstract class for all ECProperty types.\r\n * @beta\r\n */\r\nexport abstract class Property implements CustomAttributeContainerProps {\r\n protected _name: ECName;\r\n protected _type: PropertyType;\r\n\r\n protected _class: AnyClass; // TODO: class seems to be unused?\r\n protected _description?: string;\r\n protected _label?: string;\r\n protected _isReadOnly?: boolean;\r\n protected _priority?: number;\r\n protected _category?: LazyLoadedPropertyCategory;\r\n protected _kindOfQuantity?: LazyLoadedKindOfQuantity;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n\r\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\r\n this._class = ecClass as AnyClass;\r\n this._name = new ECName(name);\r\n this._type = type;\r\n }\r\n\r\n public isArray(): this is AnyArrayProperty { return PropertyTypeUtils.isArray(this._type); }\r\n public isPrimitive(): this is AnyPrimitiveProperty { return PropertyTypeUtils.isPrimitive(this._type); }\r\n public isStruct(): this is AnyStructProperty { return PropertyTypeUtils.isStruct(this._type); }\r\n public isEnumeration(): this is AnyEnumerationProperty { return PropertyTypeUtils.isEnumeration(this._type); }\r\n public isNavigation(): this is NavigationProperty { return PropertyTypeUtils.isNavigation(this._type); }\r\n\r\n public get name() { return this._name.name; }\r\n\r\n public get class() { return this._class; }\r\n\r\n public get label() { return this._label; }\r\n\r\n public get description() { return this._description; }\r\n\r\n public get isReadOnly() { return this._isReadOnly || false; }\r\n\r\n public get priority() { return this._priority || 0; }\r\n\r\n public get category(): LazyLoadedPropertyCategory | undefined { return this._category; }\r\n\r\n public get kindOfQuantity(): LazyLoadedKindOfQuantity | undefined { return this._kindOfQuantity; }\r\n\r\n public get propertyType() { return this._type; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the name in the format 'ClassName.PropertyName'. */\r\n public get fullName(): string { return `${this._class.name}.${this.name}`; }\r\n\r\n /** Returns the schema of the class holding the property. */\r\n public get schema(): Schema { return this._class.schema; }\r\n\r\n public getCategorySync(): PropertyCategory | undefined {\r\n if (!this._category)\r\n return undefined;\r\n\r\n return this.class.schema.lookupItemSync(this._category);\r\n }\r\n\r\n public getKindOfQuantitySync(): KindOfQuantity | undefined {\r\n if (!this._kindOfQuantity)\r\n return undefined;\r\n\r\n return this.class.schema.lookupItemSync(this._kindOfQuantity);\r\n }\r\n\r\n /**\r\n * Save this Property's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): PropertyProps {\r\n const schemaJson: any = {};\r\n schemaJson.name = this.name;\r\n schemaJson.type = propertyTypeToString(this._type);\r\n if (this.description !== undefined)\r\n schemaJson.description = this.description;\r\n if (this.label !== undefined)\r\n schemaJson.label = this.label;\r\n if (this._isReadOnly !== undefined)\r\n schemaJson.isReadOnly = this._isReadOnly;\r\n if (this.category !== undefined)\r\n schemaJson.category = this.category.fullName; // needs to be fully qualified name\r\n if (this._priority !== undefined)\r\n schemaJson.priority = this._priority;\r\n if (this.kindOfQuantity !== undefined)\r\n schemaJson.kindOfQuantity = this.kindOfQuantity.fullName;\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (customAttributes !== undefined)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const propType = `EC${propertyTypeToString(this._type)}`.replace(\"Primitive\", \"\");\r\n const itemElement = schemaXml.createElement(propType);\r\n itemElement.setAttribute(\"propertyName\", this.name);\r\n if (undefined !== this.description)\r\n itemElement.setAttribute(\"description\", this.description);\r\n if (undefined !== this.label)\r\n itemElement.setAttribute(\"displayLabel\", this.label);\r\n if (undefined !== this.isReadOnly)\r\n itemElement.setAttribute(\"readOnly\", String(this.isReadOnly));\r\n\r\n if (undefined !== this.category) {\r\n const category = await this.category;\r\n const categoryName = XmlSerializationUtils.createXmlTypedName(this.schema, category.schema, category.name);\r\n itemElement.setAttribute(\"category\", categoryName);\r\n }\r\n\r\n if (undefined !== this.priority)\r\n itemElement.setAttribute(\"priority\", this.priority.toString());\r\n\r\n if (undefined !== this.kindOfQuantity) {\r\n const kindOfQuantity = await this.kindOfQuantity;\r\n const kindOfQuantityName = XmlSerializationUtils.createXmlTypedName(this.schema, kindOfQuantity.schema, kindOfQuantity.name);\r\n itemElement.setAttribute(\"kindOfQuantity\", kindOfQuantityName);\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(propertyProps: PropertyProps) {\r\n if (undefined !== propertyProps.label) {\r\n this._label = propertyProps.label;\r\n }\r\n\r\n if (undefined !== propertyProps.description) {\r\n this._description = propertyProps.description;\r\n }\r\n\r\n if (undefined !== propertyProps.priority) {\r\n this._priority = propertyProps.priority;\r\n }\r\n\r\n if (undefined !== propertyProps.isReadOnly) {\r\n this._isReadOnly = propertyProps.isReadOnly;\r\n }\r\n\r\n if (undefined !== propertyProps.category) {\r\n const propertyCategorySchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.category);\r\n if (!propertyCategorySchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\r\n this._category = new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(propertyCategorySchemaItemKey,\r\n async () => {\r\n const category = await this.class.schema.lookupItem<PropertyCategory>(propertyCategorySchemaItemKey);\r\n if (undefined === category)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\r\n return category;\r\n });\r\n }\r\n\r\n if (undefined !== propertyProps.kindOfQuantity) {\r\n const koqSchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.kindOfQuantity);\r\n if (!koqSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\r\n this._kindOfQuantity = new DelayedPromiseWithProps<SchemaItemKey, KindOfQuantity>(koqSchemaItemKey,\r\n async () => {\r\n const koq = await this.class.schema.lookupItem<KindOfQuantity>(koqSchemaItemKey);\r\n if (undefined === koq)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\r\n return koq;\r\n });\r\n }\r\n }\r\n\r\n public async fromJSON(propertyProps: PropertyProps) {\r\n this.fromJSONSync(propertyProps);\r\n }\r\n\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n protected setName(name: ECName) {\r\n this._name = name;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setDescription(description: string) {\r\n this._description = description;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setLabel(label: string) {\r\n this._label = label;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setIsReadOnly(isReadOnly: boolean) {\r\n this._isReadOnly = isReadOnly;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setPriority(priority: number) {\r\n this._priority = priority;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setCategory(category: LazyLoadedPropertyCategory) {\r\n this._category = category;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setKindOfQuantity(kindOfQuantity: LazyLoadedKindOfQuantity) {\r\n this._kindOfQuantity = kindOfQuantity;\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current property and its base\r\n * This is the async version of getCustomAttributesSync()\r\n */\r\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\r\n return this.getCustomAttributesSync();\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current property and its base.\r\n */\r\n public getCustomAttributesSync(): CustomAttributeSet {\r\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\r\n if (undefined === customAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>();\r\n }\r\n\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n let baseCustomAttributes;\r\n if (undefined !== baseProperty)\r\n baseCustomAttributes = baseProperty.getCustomAttributesSync();\r\n if (undefined !== baseCustomAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>([...baseCustomAttributes, ...customAttributes]);\r\n }\r\n\r\n return customAttributes;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public static isProperty(object: any): object is AnyProperty {\r\n const property = object as Property;\r\n\r\n return property !== undefined && property.class !== undefined && property.name !== undefined\r\n && property.propertyType !== undefined;\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport abstract class PrimitiveOrEnumPropertyBase extends Property {\r\n protected _extendedTypeName?: string;\r\n protected _minLength?: number;\r\n protected _maxLength?: number;\r\n protected _minValue?: number;\r\n protected _maxValue?: number;\r\n\r\n public get extendedTypeName() { return this._extendedTypeName; }\r\n public get minLength() { return this._minLength; }\r\n public get maxLength() { return this._maxLength; }\r\n public get minValue() { return this._minValue; }\r\n public get maxValue() { return this._maxValue; }\r\n\r\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\r\n super(ecClass, name, type);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveOrEnumPropertyBase's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitiveOrEnumPropertyBaseProps {\r\n const schemaJson = super.toJSON() as any;\r\n if (this.extendedTypeName !== undefined)\r\n schemaJson.extendedTypeName = this.extendedTypeName;\r\n if (this._minLength !== undefined)\r\n schemaJson.minLength = this.minLength;\r\n if (this._maxLength !== undefined)\r\n schemaJson.maxLength = this.maxLength;\r\n if (this._minValue !== undefined)\r\n schemaJson.minValue = this.minValue;\r\n if (this._maxValue !== undefined)\r\n schemaJson.maxValue = this.maxValue;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n if (undefined !== this.extendedTypeName)\r\n itemElement.setAttribute(\"extendedTypeName\", this.extendedTypeName);\r\n if (undefined !== this.minValue)\r\n itemElement.setAttribute(\"minimumValue\", this.minValue.toString());\r\n if (undefined !== this.maxValue)\r\n itemElement.setAttribute(\"maximumValue\", this.maxValue.toString());\r\n if (undefined !== this.minLength)\r\n itemElement.setAttribute(\"minimumLength\", this.minLength.toString());\r\n if (undefined !== this.maxLength)\r\n itemElement.setAttribute(\"maximumLength\", this.maxLength.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\r\n super.fromJSONSync(propertyBaseProps);\r\n\r\n if (undefined !== propertyBaseProps.minLength) {\r\n this._minLength = propertyBaseProps.minLength;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.maxLength) {\r\n this._maxLength = propertyBaseProps.maxLength;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.minValue) {\r\n this._minValue = propertyBaseProps.minValue;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.maxValue) {\r\n this._maxValue = propertyBaseProps.maxValue;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.extendedTypeName) {\r\n this._extendedTypeName = propertyBaseProps.extendedTypeName;\r\n }\r\n }\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setExtendedTypeName(extendedTypeName: string) {\r\n this._extendedTypeName = extendedTypeName;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinLength(minLength: number) {\r\n this._minLength = minLength;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxLength(maxLength: number) {\r\n this._maxLength = maxLength;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinValue(minValue: number) {\r\n this._minValue = minValue;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxValue(maxValue: number) {\r\n this._maxValue = maxValue;\r\n }\r\n\r\n public override async fromJSON(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\r\n this.fromJSONSync(propertyBaseProps);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class PrimitiveProperty extends PrimitiveOrEnumPropertyBase {\r\n public get primitiveType(): PrimitiveType { return PropertyTypeUtils.getPrimitiveType(this._type); }\r\n\r\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\r\n super(ecClass, name, PropertyTypeUtils.fromPrimitiveType(primitiveType));\r\n }\r\n\r\n public override fromJSONSync(primitivePropertyProps: PrimitivePropertyProps) {\r\n super.fromJSONSync(primitivePropertyProps);\r\n if (undefined !== primitivePropertyProps.typeName) {\r\n if (this.primitiveType !== parsePrimitiveType(primitivePropertyProps.typeName))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n }\r\n }\r\n\r\n public override async fromJSON(primitivePropertyProps: PrimitivePropertyProps) {\r\n this.fromJSONSync(primitivePropertyProps);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitivePropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = primitiveTypeToString(this.primitiveType);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"typeName\", primitiveTypeToString(this.primitiveType));\r\n return itemElement;\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class EnumerationProperty extends PrimitiveOrEnumPropertyBase {\r\n protected _enumeration?: LazyLoadedEnumeration;\r\n\r\n public get enumeration(): LazyLoadedEnumeration | undefined { return this._enumeration; }\r\n\r\n /**\r\n * Save this EnumerationProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): EnumerationPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = this.enumeration!.fullName;\r\n return schemaJson;\r\n }\r\n\r\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\r\n // TODO: Should we allow specifying the backing type?\r\n super(ecClass, name, PropertyType.Integer_Enumeration);\r\n this._enumeration = type;\r\n }\r\n\r\n public override fromJSONSync(enumerationPropertyProps: EnumerationPropertyProps) {\r\n super.fromJSONSync(enumerationPropertyProps);\r\n if (undefined !== enumerationPropertyProps.typeName) {\r\n if (!(this.enumeration!.fullName).match(enumerationPropertyProps.typeName)) // need to match {schema}.{version}.{itemName} on typeName\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n const enumSchemaItemKey = this.class.schema.getSchemaItemKey(this.enumeration!.fullName);\r\n if (!enumSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\r\n this._enumeration = new DelayedPromiseWithProps<SchemaItemKey, Enumeration>(enumSchemaItemKey,\r\n async () => {\r\n const enumeration = await this.class.schema.lookupItem<Enumeration>(enumSchemaItemKey);\r\n if (undefined === enumeration)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\r\n return enumeration;\r\n });\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const enumeration = await this.enumeration;\r\n const enumerationName = XmlSerializationUtils.createXmlTypedName(this.schema, enumeration!.schema, enumeration!.name);\r\n itemElement.setAttribute(\"typeName\", enumerationName);\r\n return itemElement;\r\n }\r\n\r\n public override async fromJSON(enumerationPropertyProps: EnumerationPropertyProps) {\r\n this.fromJSONSync(enumerationPropertyProps);\r\n }\r\n\r\n}\r\n\r\n/** @beta */\r\nexport class StructProperty extends Property {\r\n protected _structClass: StructClass;\r\n\r\n public get structClass(): StructClass { return this._structClass; }\r\n\r\n constructor(ecClass: ECClass, name: string, type: StructClass) {\r\n super(ecClass, name, PropertyType.Struct);\r\n this._structClass = type;\r\n }\r\n\r\n /**\r\n * Save this StructProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): StructPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = this.structClass.fullName;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const structClassName = XmlSerializationUtils.createXmlTypedName(this.schema, this.structClass.schema, this.structClass.name);\r\n itemElement.setAttribute(\"typeName\", structClassName);\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(structPropertyProps: StructPropertyProps) {\r\n super.fromJSONSync(structPropertyProps);\r\n if (undefined !== structPropertyProps.typeName) {\r\n if (!this.structClass.key.matchesFullName(structPropertyProps.typeName))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n }\r\n }\r\n\r\n public override async fromJSON(structPropertyProps: StructPropertyProps) {\r\n this.fromJSONSync(structPropertyProps);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class NavigationProperty extends Property {\r\n protected _relationshipClass: LazyLoadedRelationshipClass;\r\n protected _direction: StrengthDirection;\r\n\r\n public get relationshipClass(): LazyLoadedRelationshipClass { return this._relationshipClass; }\r\n\r\n public getRelationshipClassSync(): RelationshipClass | undefined {\r\n if (!this._relationshipClass) // eslint-disable-line @typescript-eslint/no-misused-promises\r\n return undefined;\r\n\r\n return this.class.schema.lookupItemSync(this._relationshipClass);\r\n }\r\n\r\n public get direction() { return this._direction; }\r\n\r\n /**\r\n * Save this NavigationProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): NavigationPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.relationshipName = this.relationshipClass.fullName;\r\n schemaJson.direction = strengthDirectionToString(this.direction);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const relationshipClass = await this.relationshipClass;\r\n const relationshipClassName = XmlSerializationUtils.createXmlTypedName(this.schema, relationshipClass.schema, relationshipClass.name);\r\n itemElement.setAttribute(\"relationshipName\", relationshipClassName);\r\n itemElement.setAttribute(\"direction\", strengthDirectionToString(this.direction));\r\n\r\n return itemElement;\r\n }\r\n\r\n constructor(ecClass: ECClass, name: string, relationship: LazyLoadedRelationshipClass, direction?: StrengthDirection) {\r\n super(ecClass, name, PropertyType.Navigation);\r\n this._relationshipClass = relationship;\r\n\r\n this._direction = (direction !== undefined) ? direction : StrengthDirection.Forward;\r\n }\r\n}\r\n\r\ntype Constructor<T> = new (...args: any[]) => T;\r\n\r\n// TODO: Consolidate all of the INT32_MAX variables.\r\nconst INT32_MAX = 2147483647;\r\n\r\n/** @beta */\r\nexport abstract class ArrayProperty extends Property {\r\n protected _minOccurs: number = 0;\r\n protected _maxOccurs?: number = INT32_MAX;\r\n\r\n public get minOccurs() { return this._minOccurs; }\r\n public get maxOccurs() { return this._maxOccurs; }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinOccurs(minOccurs: number) {\r\n this._minOccurs = minOccurs;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxOccurs(maxOccurs: number) {\r\n this._maxOccurs = maxOccurs;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst ArrayPropertyMixin = <T extends Constructor<Property>>(Base: T) => {\r\n return class extends Base {\r\n protected _minOccurs: number = 0;\r\n protected _maxOccurs: number = INT32_MAX;\r\n\r\n public get minOccurs() { return this._minOccurs; }\r\n public get maxOccurs() { return this._maxOccurs; }\r\n\r\n constructor(...args: any[]) {\r\n super(...args);\r\n this._type = PropertyTypeUtils.asArray(this._type);\r\n }\r\n\r\n public override fromJSONSync(arrayPropertyProps: PrimitiveArrayPropertyProps) {\r\n super.fromJSONSync(arrayPropertyProps);\r\n if (undefined !== arrayPropertyProps.minOccurs) {\r\n this._minOccurs = arrayPropertyProps.minOccurs;\r\n }\r\n\r\n if (undefined !== arrayPropertyProps.maxOccurs) {\r\n this._maxOccurs = arrayPropertyProps.maxOccurs;\r\n }\r\n }\r\n\r\n public override async fromJSON(arrayPropertyProps: PrimitiveArrayPropertyProps) {\r\n this.fromJSONSync(arrayPropertyProps);\r\n }\r\n\r\n /**\r\n * Save this ArrayProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): ArrayPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.minOccurs = this.minOccurs;\r\n if (this.maxOccurs !== undefined)\r\n schemaJson.maxOccurs = this.maxOccurs;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"minOccurs\", this.minOccurs.toString());\r\n if (this.maxOccurs)\r\n itemElement.setAttribute(\"maxOccurs\", this.maxOccurs.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinOccurs(minOccurs: number) {\r\n this._minOccurs = minOccurs;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxOccurs(maxOccurs: number) {\r\n this._maxOccurs = maxOccurs;\r\n }\r\n } as Constructor<Property> as typeof Base & Constructor<ArrayProperty>;\r\n};\r\n\r\n/** @beta */\r\nexport class PrimitiveArrayProperty extends ArrayPropertyMixin(PrimitiveProperty) {\r\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\r\n super(ecClass, name, primitiveType);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveArrayProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitiveArrayPropertyProps {\r\n return super.toJSON();\r\n }\r\n\r\n}\r\n\r\n/** @beta */\r\nexport class EnumerationArrayProperty extends ArrayPropertyMixin(EnumerationProperty) {\r\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\r\n super(ecClass, name, type);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class StructArrayProperty extends ArrayPropertyMixin(StructProperty) {\r\n constructor(ecClass: ECClass, name: string, type: StructClass) {\r\n super(ecClass, name, type);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport type AnyArrayProperty = PrimitiveArrayProperty | EnumerationArrayProperty | StructArrayProperty;\r\n/** @beta */\r\nexport type AnyPrimitiveProperty = PrimitiveProperty | PrimitiveArrayProperty;\r\n/** @beta */\r\nexport type AnyEnumerationProperty = EnumerationProperty | EnumerationArrayProperty;\r\n/** @beta */\r\nexport type AnyStructProperty = StructProperty | StructArrayProperty;\r\n/** @beta */\r\nexport type AnyProperty = AnyPrimitiveProperty | AnyEnumerationProperty | AnyStructProperty | NavigationProperty;\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableProperty extends Property {\r\n public abstract override addCustomAttribute(customAttribute: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,aAAa,CAAC,OAAO;QAC9F,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACa,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;CAEF;AAED,YAAY;AACZ,MAAM,OAAO,wBAAyB,SAAQ,kBAAkB,CAAC,mBAAmB,CAAC;IACnF,YAAY,OAAgB,EAAE,IAAY,EAAE,IAA2B;QACrE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAED,YAAY;AACZ,MAAM,OAAO,mBAAoB,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IACzE,YAAY,OAAgB,EAAE,IAAY,EAAE,IAAiB;QAC3D,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAaD;;;GAGG;AACH,MAAM,OAAgB,eAAgB,SAAQ,QAAQ;CAErD","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\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport {\r\n ArrayPropertyProps, EnumerationPropertyProps, NavigationPropertyProps, PrimitiveArrayPropertyProps, PrimitiveOrEnumPropertyBaseProps,\r\n PrimitivePropertyProps, PropertyProps, StructPropertyProps,\r\n} from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { parsePrimitiveType, PrimitiveType, primitiveTypeToString, StrengthDirection, strengthDirectionToString } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { AnyClass, LazyLoadedEnumeration, LazyLoadedKindOfQuantity, LazyLoadedPropertyCategory, LazyLoadedRelationshipClass } from \"../Interfaces\";\r\nimport { PropertyType, propertyTypeToString, PropertyTypeUtils } from \"../PropertyTypes\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECName } from \"../ECName\";\r\nimport { ECClass, StructClass } from \"./Class\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport { KindOfQuantity } from \"./KindOfQuantity\";\r\nimport { PropertyCategory } from \"./PropertyCategory\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { Schema } from \"./Schema\";\r\n\r\n/**\r\n * A common abstract class for all ECProperty types.\r\n * @beta\r\n */\r\nexport abstract class Property implements CustomAttributeContainerProps {\r\n protected _name: ECName;\r\n protected _type: PropertyType;\r\n\r\n protected _class: AnyClass; // TODO: class seems to be unused?\r\n protected _description?: string;\r\n protected _label?: string;\r\n protected _isReadOnly?: boolean;\r\n protected _priority?: number;\r\n protected _category?: LazyLoadedPropertyCategory;\r\n protected _kindOfQuantity?: LazyLoadedKindOfQuantity;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n\r\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\r\n this._class = ecClass as AnyClass;\r\n this._name = new ECName(name);\r\n this._type = type;\r\n }\r\n\r\n public isArray(): this is AnyArrayProperty { return PropertyTypeUtils.isArray(this._type); }\r\n public isPrimitive(): this is AnyPrimitiveProperty { return PropertyTypeUtils.isPrimitive(this._type); }\r\n public isStruct(): this is AnyStructProperty { return PropertyTypeUtils.isStruct(this._type); }\r\n public isEnumeration(): this is AnyEnumerationProperty { return PropertyTypeUtils.isEnumeration(this._type); }\r\n public isNavigation(): this is NavigationProperty { return PropertyTypeUtils.isNavigation(this._type); }\r\n\r\n public get name() { return this._name.name; }\r\n\r\n public get class() { return this._class; }\r\n\r\n public get label() { return this._label; }\r\n\r\n public get description() { return this._description; }\r\n\r\n public get isReadOnly() { return this._isReadOnly || false; }\r\n\r\n public get priority(): number {\r\n if (this._priority === undefined) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.priority;\r\n }\r\n }\r\n\r\n return this._priority || 0;\r\n }\r\n\r\n public get category(): LazyLoadedPropertyCategory | undefined {\r\n if (this._category === undefined) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.category;\r\n }\r\n }\r\n\r\n return this._category;\r\n }\r\n\r\n public get kindOfQuantity(): LazyLoadedKindOfQuantity | undefined {\r\n if (this._kindOfQuantity === undefined) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.kindOfQuantity;\r\n }\r\n }\r\n\r\n return this._kindOfQuantity;\r\n }\r\n\r\n public get propertyType() { return this._type; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the name in the format 'ClassName.PropertyName'. */\r\n public get fullName(): string { return `${this._class.name}.${this.name}`; }\r\n\r\n /** Returns the schema of the class holding the property. */\r\n public get schema(): Schema { return this._class.schema; }\r\n\r\n public getCategorySync(): PropertyCategory | undefined {\r\n if (!this._category){\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty){\r\n return baseProperty.getCategorySync();\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n return this.class.schema.lookupItemSync(this._category);\r\n }\r\n\r\n public getKindOfQuantitySync(): KindOfQuantity | undefined {\r\n if (!this._kindOfQuantity){\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty){\r\n return baseProperty.getKindOfQuantitySync();\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n return this.class.schema.lookupItemSync(this._kindOfQuantity);\r\n }\r\n\r\n /**\r\n * Save this Property's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): PropertyProps {\r\n const schemaJson: any = {};\r\n schemaJson.name = this.name;\r\n schemaJson.type = propertyTypeToString(this._type);\r\n if (this.description !== undefined)\r\n schemaJson.description = this.description;\r\n if (this.label !== undefined)\r\n schemaJson.label = this.label;\r\n if (this._isReadOnly !== undefined)\r\n schemaJson.isReadOnly = this._isReadOnly;\r\n if (this._category !== undefined)\r\n schemaJson.category = this._category.fullName; // needs to be fully qualified name\r\n if (this._priority !== undefined)\r\n schemaJson.priority = this._priority;\r\n if (this._kindOfQuantity !== undefined)\r\n schemaJson.kindOfQuantity = this._kindOfQuantity.fullName;\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (customAttributes !== undefined)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const propType = `EC${propertyTypeToString(this._type)}`.replace(\"Primitive\", \"\");\r\n const itemElement = schemaXml.createElement(propType);\r\n itemElement.setAttribute(\"propertyName\", this.name);\r\n if (undefined !== this.description)\r\n itemElement.setAttribute(\"description\", this.description);\r\n if (undefined !== this.label)\r\n itemElement.setAttribute(\"displayLabel\", this.label);\r\n if (undefined !== this.isReadOnly)\r\n itemElement.setAttribute(\"readOnly\", String(this.isReadOnly));\r\n\r\n if (undefined !== this._category) {\r\n const category = await this._category;\r\n const categoryName = XmlSerializationUtils.createXmlTypedName(this.schema, category.schema, category.name);\r\n itemElement.setAttribute(\"category\", categoryName);\r\n }\r\n\r\n if (undefined !== this._priority)\r\n itemElement.setAttribute(\"priority\", this._priority.toString());\r\n\r\n if (undefined !== this._kindOfQuantity) {\r\n const kindOfQuantity = await this._kindOfQuantity;\r\n const kindOfQuantityName = XmlSerializationUtils.createXmlTypedName(this.schema, kindOfQuantity.schema, kindOfQuantity.name);\r\n itemElement.setAttribute(\"kindOfQuantity\", kindOfQuantityName);\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(propertyProps: PropertyProps) {\r\n if (undefined !== propertyProps.label) {\r\n this._label = propertyProps.label;\r\n }\r\n\r\n if (undefined !== propertyProps.description) {\r\n this._description = propertyProps.description;\r\n }\r\n\r\n if (undefined !== propertyProps.priority) {\r\n this._priority = propertyProps.priority;\r\n }\r\n\r\n if (undefined !== propertyProps.isReadOnly) {\r\n this._isReadOnly = propertyProps.isReadOnly;\r\n }\r\n\r\n if (undefined !== propertyProps.category) {\r\n const propertyCategorySchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.category);\r\n if (!propertyCategorySchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\r\n this._category = new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(propertyCategorySchemaItemKey,\r\n async () => {\r\n const category = await this.class.schema.lookupItem<PropertyCategory>(propertyCategorySchemaItemKey);\r\n if (undefined === category)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\r\n return category;\r\n });\r\n }\r\n\r\n if (undefined !== propertyProps.kindOfQuantity) {\r\n const koqSchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.kindOfQuantity);\r\n if (!koqSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\r\n this._kindOfQuantity = new DelayedPromiseWithProps<SchemaItemKey, KindOfQuantity>(koqSchemaItemKey,\r\n async () => {\r\n const koq = await this.class.schema.lookupItem<KindOfQuantity>(koqSchemaItemKey);\r\n if (undefined === koq)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\r\n return koq;\r\n });\r\n }\r\n }\r\n\r\n public async fromJSON(propertyProps: PropertyProps) {\r\n this.fromJSONSync(propertyProps);\r\n }\r\n\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n protected setName(name: ECName) {\r\n this._name = name;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setDescription(description: string) {\r\n this._description = description;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setLabel(label: string) {\r\n this._label = label;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setIsReadOnly(isReadOnly: boolean) {\r\n this._isReadOnly = isReadOnly;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setPriority(priority: number) {\r\n this._priority = priority;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setCategory(category: LazyLoadedPropertyCategory) {\r\n this._category = category;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setKindOfQuantity(kindOfQuantity: LazyLoadedKindOfQuantity) {\r\n this._kindOfQuantity = kindOfQuantity;\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current property and its base\r\n * This is the async version of getCustomAttributesSync()\r\n */\r\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\r\n return this.getCustomAttributesSync();\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current property and its base.\r\n */\r\n public getCustomAttributesSync(): CustomAttributeSet {\r\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\r\n if (undefined === customAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>();\r\n }\r\n\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n let baseCustomAttributes;\r\n if (undefined !== baseProperty)\r\n baseCustomAttributes = baseProperty.getCustomAttributesSync();\r\n if (undefined !== baseCustomAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>([...baseCustomAttributes, ...customAttributes]);\r\n }\r\n\r\n return customAttributes;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public static isProperty(object: any): object is AnyProperty {\r\n const property = object as Property;\r\n\r\n return property !== undefined && property.class !== undefined && property.name !== undefined\r\n && property.propertyType !== undefined;\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport abstract class PrimitiveOrEnumPropertyBase extends Property {\r\n protected _extendedTypeName?: string;\r\n protected _minLength?: number;\r\n protected _maxLength?: number;\r\n protected _minValue?: number;\r\n protected _maxValue?: number;\r\n\r\n public get extendedTypeName() { return this._extendedTypeName; }\r\n public get minLength() { return this._minLength; }\r\n public get maxLength() { return this._maxLength; }\r\n public get minValue() { return this._minValue; }\r\n public get maxValue() { return this._maxValue; }\r\n\r\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\r\n super(ecClass, name, type);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveOrEnumPropertyBase's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitiveOrEnumPropertyBaseProps {\r\n const schemaJson = super.toJSON() as any;\r\n if (this.extendedTypeName !== undefined)\r\n schemaJson.extendedTypeName = this.extendedTypeName;\r\n if (this._minLength !== undefined)\r\n schemaJson.minLength = this.minLength;\r\n if (this._maxLength !== undefined)\r\n schemaJson.maxLength = this.maxLength;\r\n if (this._minValue !== undefined)\r\n schemaJson.minValue = this.minValue;\r\n if (this._maxValue !== undefined)\r\n schemaJson.maxValue = this.maxValue;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n if (undefined !== this.extendedTypeName)\r\n itemElement.setAttribute(\"extendedTypeName\", this.extendedTypeName);\r\n if (undefined !== this.minValue)\r\n itemElement.setAttribute(\"minimumValue\", this.minValue.toString());\r\n if (undefined !== this.maxValue)\r\n itemElement.setAttribute(\"maximumValue\", this.maxValue.toString());\r\n if (undefined !== this.minLength)\r\n itemElement.setAttribute(\"minimumLength\", this.minLength.toString());\r\n if (undefined !== this.maxLength)\r\n itemElement.setAttribute(\"maximumLength\", this.maxLength.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\r\n super.fromJSONSync(propertyBaseProps);\r\n\r\n if (undefined !== propertyBaseProps.minLength) {\r\n this._minLength = propertyBaseProps.minLength;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.maxLength) {\r\n this._maxLength = propertyBaseProps.maxLength;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.minValue) {\r\n this._minValue = propertyBaseProps.minValue;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.maxValue) {\r\n this._maxValue = propertyBaseProps.maxValue;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.extendedTypeName) {\r\n this._extendedTypeName = propertyBaseProps.extendedTypeName;\r\n }\r\n }\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setExtendedTypeName(extendedTypeName: string) {\r\n this._extendedTypeName = extendedTypeName;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinLength(minLength: number) {\r\n this._minLength = minLength;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxLength(maxLength: number) {\r\n this._maxLength = maxLength;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinValue(minValue: number) {\r\n this._minValue = minValue;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxValue(maxValue: number) {\r\n this._maxValue = maxValue;\r\n }\r\n\r\n public override async fromJSON(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\r\n this.fromJSONSync(propertyBaseProps);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class PrimitiveProperty extends PrimitiveOrEnumPropertyBase {\r\n public get primitiveType(): PrimitiveType { return PropertyTypeUtils.getPrimitiveType(this._type); }\r\n\r\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\r\n super(ecClass, name, PropertyTypeUtils.fromPrimitiveType(primitiveType));\r\n }\r\n\r\n public override fromJSONSync(primitivePropertyProps: PrimitivePropertyProps) {\r\n super.fromJSONSync(primitivePropertyProps);\r\n if (undefined !== primitivePropertyProps.typeName) {\r\n if (this.primitiveType !== parsePrimitiveType(primitivePropertyProps.typeName))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n }\r\n }\r\n\r\n public override async fromJSON(primitivePropertyProps: PrimitivePropertyProps) {\r\n this.fromJSONSync(primitivePropertyProps);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitivePropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = primitiveTypeToString(this.primitiveType);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"typeName\", primitiveTypeToString(this.primitiveType));\r\n return itemElement;\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class EnumerationProperty extends PrimitiveOrEnumPropertyBase {\r\n protected _enumeration?: LazyLoadedEnumeration;\r\n\r\n public get enumeration(): LazyLoadedEnumeration | undefined { return this._enumeration; }\r\n\r\n /**\r\n * Save this EnumerationProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): EnumerationPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = this.enumeration!.fullName;\r\n return schemaJson;\r\n }\r\n\r\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\r\n // TODO: Should we allow specifying the backing type?\r\n super(ecClass, name, PropertyType.Integer_Enumeration);\r\n this._enumeration = type;\r\n }\r\n\r\n public override fromJSONSync(enumerationPropertyProps: EnumerationPropertyProps) {\r\n super.fromJSONSync(enumerationPropertyProps);\r\n if (undefined !== enumerationPropertyProps.typeName) {\r\n if (!(this.enumeration!.fullName).match(enumerationPropertyProps.typeName)) // need to match {schema}.{version}.{itemName} on typeName\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n const enumSchemaItemKey = this.class.schema.getSchemaItemKey(this.enumeration!.fullName);\r\n if (!enumSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\r\n this._enumeration = new DelayedPromiseWithProps<SchemaItemKey, Enumeration>(enumSchemaItemKey,\r\n async () => {\r\n const enumeration = await this.class.schema.lookupItem<Enumeration>(enumSchemaItemKey);\r\n if (undefined === enumeration)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\r\n return enumeration;\r\n });\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const enumeration = await this.enumeration;\r\n const enumerationName = XmlSerializationUtils.createXmlTypedName(this.schema, enumeration!.schema, enumeration!.name);\r\n itemElement.setAttribute(\"typeName\", enumerationName);\r\n return itemElement;\r\n }\r\n\r\n public override async fromJSON(enumerationPropertyProps: EnumerationPropertyProps) {\r\n this.fromJSONSync(enumerationPropertyProps);\r\n }\r\n\r\n}\r\n\r\n/** @beta */\r\nexport class StructProperty extends Property {\r\n protected _structClass: StructClass;\r\n\r\n public get structClass(): StructClass { return this._structClass; }\r\n\r\n constructor(ecClass: ECClass, name: string, type: StructClass) {\r\n super(ecClass, name, PropertyType.Struct);\r\n this._structClass = type;\r\n }\r\n\r\n /**\r\n * Save this StructProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): StructPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = this.structClass.fullName;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const structClassName = XmlSerializationUtils.createXmlTypedName(this.schema, this.structClass.schema, this.structClass.name);\r\n itemElement.setAttribute(\"typeName\", structClassName);\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(structPropertyProps: StructPropertyProps) {\r\n super.fromJSONSync(structPropertyProps);\r\n if (undefined !== structPropertyProps.typeName) {\r\n if (!this.structClass.key.matchesFullName(structPropertyProps.typeName))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n }\r\n }\r\n\r\n public override async fromJSON(structPropertyProps: StructPropertyProps) {\r\n this.fromJSONSync(structPropertyProps);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class NavigationProperty extends Property {\r\n protected _relationshipClass: LazyLoadedRelationshipClass;\r\n protected _direction: StrengthDirection;\r\n\r\n public get relationshipClass(): LazyLoadedRelationshipClass { return this._relationshipClass; }\r\n\r\n public getRelationshipClassSync(): RelationshipClass | undefined {\r\n if (!this._relationshipClass) // eslint-disable-line @typescript-eslint/no-misused-promises\r\n return undefined;\r\n\r\n return this.class.schema.lookupItemSync(this._relationshipClass);\r\n }\r\n\r\n public get direction() { return this._direction; }\r\n\r\n /**\r\n * Save this NavigationProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): NavigationPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.relationshipName = this.relationshipClass.fullName;\r\n schemaJson.direction = strengthDirectionToString(this.direction);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const relationshipClass = await this.relationshipClass;\r\n const relationshipClassName = XmlSerializationUtils.createXmlTypedName(this.schema, relationshipClass.schema, relationshipClass.name);\r\n itemElement.setAttribute(\"relationshipName\", relationshipClassName);\r\n itemElement.setAttribute(\"direction\", strengthDirectionToString(this.direction));\r\n\r\n return itemElement;\r\n }\r\n\r\n constructor(ecClass: ECClass, name: string, relationship: LazyLoadedRelationshipClass, direction?: StrengthDirection) {\r\n super(ecClass, name, PropertyType.Navigation);\r\n this._relationshipClass = relationship;\r\n\r\n this._direction = (direction !== undefined) ? direction : StrengthDirection.Forward;\r\n }\r\n}\r\n\r\ntype Constructor<T> = new (...args: any[]) => T;\r\n\r\n// TODO: Consolidate all of the INT32_MAX variables.\r\nconst INT32_MAX = 2147483647;\r\n\r\n/** @beta */\r\nexport abstract class ArrayProperty extends Property {\r\n protected _minOccurs: number = 0;\r\n protected _maxOccurs?: number = INT32_MAX;\r\n\r\n public get minOccurs() { return this._minOccurs; }\r\n public get maxOccurs() { return this._maxOccurs; }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinOccurs(minOccurs: number) {\r\n this._minOccurs = minOccurs;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxOccurs(maxOccurs: number) {\r\n this._maxOccurs = maxOccurs;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst ArrayPropertyMixin = <T extends Constructor<Property>>(Base: T) => {\r\n return class extends Base {\r\n protected _minOccurs: number = 0;\r\n protected _maxOccurs: number = INT32_MAX;\r\n\r\n public get minOccurs() { return this._minOccurs; }\r\n public get maxOccurs() { return this._maxOccurs; }\r\n\r\n constructor(...args: any[]) {\r\n super(...args);\r\n this._type = PropertyTypeUtils.asArray(this._type);\r\n }\r\n\r\n public override fromJSONSync(arrayPropertyProps: PrimitiveArrayPropertyProps) {\r\n super.fromJSONSync(arrayPropertyProps);\r\n if (undefined !== arrayPropertyProps.minOccurs) {\r\n this._minOccurs = arrayPropertyProps.minOccurs;\r\n }\r\n\r\n if (undefined !== arrayPropertyProps.maxOccurs) {\r\n this._maxOccurs = arrayPropertyProps.maxOccurs;\r\n }\r\n }\r\n\r\n public override async fromJSON(arrayPropertyProps: PrimitiveArrayPropertyProps) {\r\n this.fromJSONSync(arrayPropertyProps);\r\n }\r\n\r\n /**\r\n * Save this ArrayProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): ArrayPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.minOccurs = this.minOccurs;\r\n if (this.maxOccurs !== undefined)\r\n schemaJson.maxOccurs = this.maxOccurs;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"minOccurs\", this.minOccurs.toString());\r\n if (this.maxOccurs)\r\n itemElement.setAttribute(\"maxOccurs\", this.maxOccurs.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinOccurs(minOccurs: number) {\r\n this._minOccurs = minOccurs;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxOccurs(maxOccurs: number) {\r\n this._maxOccurs = maxOccurs;\r\n }\r\n } as Constructor<Property> as typeof Base & Constructor<ArrayProperty>;\r\n};\r\n\r\n/** @beta */\r\nexport class PrimitiveArrayProperty extends ArrayPropertyMixin(PrimitiveProperty) {\r\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\r\n super(ecClass, name, primitiveType);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveArrayProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitiveArrayPropertyProps {\r\n return super.toJSON();\r\n }\r\n\r\n}\r\n\r\n/** @beta */\r\nexport class EnumerationArrayProperty extends ArrayPropertyMixin(EnumerationProperty) {\r\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\r\n super(ecClass, name, type);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport class StructArrayProperty extends ArrayPropertyMixin(StructProperty) {\r\n constructor(ecClass: ECClass, name: string, type: StructClass) {\r\n super(ecClass, name, type);\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport type AnyArrayProperty = PrimitiveArrayProperty | EnumerationArrayProperty | StructArrayProperty;\r\n/** @beta */\r\nexport type AnyPrimitiveProperty = PrimitiveProperty | PrimitiveArrayProperty;\r\n/** @beta */\r\nexport type AnyEnumerationProperty = EnumerationProperty | EnumerationArrayProperty;\r\n/** @beta */\r\nexport type AnyStructProperty = StructProperty | StructArrayProperty;\r\n/** @beta */\r\nexport type AnyProperty = AnyPrimitiveProperty | AnyEnumerationProperty | AnyStructProperty | NavigationProperty;\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableProperty extends Property {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n}\r\n"]}