@itwin/ecschema-metadata 5.1.0-dev.38 → 5.1.0-dev.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Context.d.ts +1 -1
- package/lib/cjs/Context.js +1 -1
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts +1 -1
- package/lib/cjs/ECObjects.js +2 -2
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Context.d.ts +1 -1
- package/lib/esm/Context.js +1 -1
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/ECObjects.d.ts +1 -1
- package/lib/esm/ECObjects.js +2 -2
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/package.json +6 -6
package/lib/cjs/Context.d.ts
CHANGED
|
@@ -146,7 +146,7 @@ export declare class SchemaContext {
|
|
|
146
146
|
/**
|
|
147
147
|
* Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
|
|
148
148
|
* @param schemaItem The SchemaItem to add
|
|
149
|
-
* @deprecated in 4.0 use ecschema-editing package
|
|
149
|
+
* @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package
|
|
150
150
|
*/
|
|
151
151
|
addSchemaItem(schemaItem: SchemaItem): Promise<void>;
|
|
152
152
|
/**
|
package/lib/cjs/Context.js
CHANGED
|
@@ -223,7 +223,7 @@ class SchemaContext {
|
|
|
223
223
|
/**
|
|
224
224
|
* Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
|
|
225
225
|
* @param schemaItem The SchemaItem to add
|
|
226
|
-
* @deprecated in 4.0 use ecschema-editing package
|
|
226
|
+
* @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package
|
|
227
227
|
*/
|
|
228
228
|
async addSchemaItem(schemaItem) {
|
|
229
229
|
const schema = await this.getSchema(schemaItem.key.schemaKey, ECObjects_1.SchemaMatchType.Exact);
|
package/lib/cjs/Context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,2CAA8C;AAC9C,2CAA4D;AAG5D,sDAAmD;AACnD,2CAAuD;AAEvD;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAgD9C;;GAEG;AACH,MAAa,WAAW;IACd,OAAO,CAAY;IAE3B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1C,kBAAkB,CAAC,SAAoB;QAC7C,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAChK,CAAC;IAEO,mBAAmB,CAAC,SAAoB;QAC9C,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,IAAI,SAAS,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7K,CAAC;IAEO,SAAS,CAAC,SAAoB,EAAE,SAA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CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAS,CAAC,UAAU,CAAC,CAAC;QAClF,CAAC;aAAM,CAAC;YACN,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC;QACxC,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM;YACT,OAAO,SAAS,CAAC;QAEnB,0EAA0E;QAC1E,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACpH,CAAC;QAED,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,wEAAwE;YAC/G,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAE1H,kDAAkD;QAClD,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9H,CAAC;IAED;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF;AA7RD,sCA6RC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @public @preview\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);\r\n }\r\n\r\n private schemaPromiseExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);\r\n }\r\n\r\n private findEntry(schemaKey: SchemaKey, matchType: SchemaMatchType): SchemaEntry | undefined {\r\n return this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));\r\n }\r\n\r\n private removeSchemaPromise(schemaKey: SchemaKey) {\r\n const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);\r\n if (entry)\r\n entry.schemaPromise = undefined;\r\n }\r\n\r\n private removeEntry(schemaKey: SchemaKey) {\r\n this._schema = this._schema.filter((entry: SchemaEntry) => !entry.schemaInfo.schemaKey.matches(schemaKey));\r\n }\r\n\r\n /**\r\n * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.\r\n * @param schemaKey The key to search for.\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (!entry)\r\n return undefined;\r\n\r\n if (entry.schemaPromise) {\r\n try {\r\n const schema = await entry.schemaPromise;\r\n return schema;\r\n } catch (e) {\r\n this.removeEntry(schemaKey);\r\n throw e;\r\n }\r\n }\r\n\r\n return entry.schema;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<SchemaInfo | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry)\r\n return entry.schemaInfo;\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): Iterable<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Iterable<Schema> {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @public @preview\r\n */\r\nexport class SchemaContext {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n private _fallbackLocaterDefined: boolean;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n this._fallbackLocaterDefined = false;\r\n }\r\n\r\n public get locaters(): ReadonlyArray<ISchemaLocater> { return this._locaters; }\r\n\r\n /**\r\n * Adds a locater to the context.\r\n *\r\n * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.\r\n * If a fallback locater is already defined, the new locater is inserted before the fallback locater.\r\n *\r\n * @param locater - The locater to be added.\r\n */\r\n public addLocater(locater: ISchemaLocater) {\r\n const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;\r\n this._locaters.splice(insertIndex, 0, locater);\r\n }\r\n\r\n /**\r\n * Adds a fallback locater to the context.\r\n *\r\n * If a fallback locater is already defined, it replaces the existing one.\r\n * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.\r\n *\r\n * @param locater - The locater to be added as a fallback.\r\n */\r\n public addFallbackLocater(locater: ISchemaLocater) {\r\n if (this._fallbackLocaterDefined) {\r\n this._locaters[this._locaters.length - 1] = locater;\r\n } else {\r\n this._locaters.push(locater);\r\n this._fallbackLocaterDefined = true;\r\n }\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this._knownSchemas.schemaExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.\r\n * Use this method over addSchema when asynchronously loading schemas\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = await locater.getSchema(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be gotten later from the context using [[getSchema]].\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined> {\r\n for (const locater of this._locaters) {\r\n const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);\r\n if (undefined !== schemaInfo)\r\n return schemaInfo;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = locater.getSchemaSync(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will await a partially loaded schema then return when it is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public async getCachedSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n return this._knownSchemas.getSchema(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public getCachedSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n return this._knownSchemas.getSchemaSync(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item.\r\n *\r\n * @param schemaNameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param itemNameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param itemConstructor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @examples\r\n * ```typescript\r\n * const schemaItem = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = await this.getSchema(schemaKey, SchemaMatchType.Latest);\r\n\r\n if (!schema)\r\n return undefined;\r\n\r\n if (typeof itemNameOrCtor === \"string\") // Separate schema and item name arguments with/without an itemConstructor\r\n return itemConstructor ? schema.getItem(itemNameOrCtor, itemConstructor) : schema.getItem(itemNameOrCtor);\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItem(schemaNameOrKey, itemNameOrCtor) : schema.lookupItem(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItem(schemaNameOrKey.name, itemNameOrCtor) : schema.getItem(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.\r\n *\r\n * @param nameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param nameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param ctor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @example\r\n * ```typescript\r\n * const schemaItem = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = this.getSchemaSync(schemaKey, SchemaMatchType.Latest);\r\n if (!schema)\r\n return undefined;\r\n\r\n // Separate schema and item name arguments with/without an itemConstructor\r\n if (typeof itemNameOrCtor === \"string\") {\r\n return itemConstructor ? schema.getItemSync(itemNameOrCtor, itemConstructor) : schema.getItemSync(itemNameOrCtor);\r\n }\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItemSync(schemaNameOrKey, itemNameOrCtor) : schema.lookupItemSync(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItemSync(schemaNameOrKey.name, itemNameOrCtor) : schema.getItemSync(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Iterates through the items of each schema known to the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public getSchemaItems(): Iterable<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas():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MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM;YACT,OAAO,SAAS,CAAC;QAEnB,0EAA0E;QAC1E,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACpH,CAAC;QAED,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,wEAAwE;YAC/G,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAE1H,kDAAkD;QAClD,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9H,CAAC;IAED;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF;AA7RD,sCA6RC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @public @preview\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);\r\n }\r\n\r\n private schemaPromiseExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);\r\n }\r\n\r\n private findEntry(schemaKey: SchemaKey, matchType: SchemaMatchType): SchemaEntry | undefined {\r\n return this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));\r\n }\r\n\r\n private removeSchemaPromise(schemaKey: SchemaKey) {\r\n const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);\r\n if (entry)\r\n entry.schemaPromise = undefined;\r\n }\r\n\r\n private removeEntry(schemaKey: SchemaKey) {\r\n this._schema = this._schema.filter((entry: SchemaEntry) => !entry.schemaInfo.schemaKey.matches(schemaKey));\r\n }\r\n\r\n /**\r\n * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.\r\n * @param schemaKey The key to search for.\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (!entry)\r\n return undefined;\r\n\r\n if (entry.schemaPromise) {\r\n try {\r\n const schema = await entry.schemaPromise;\r\n return schema;\r\n } catch (e) {\r\n this.removeEntry(schemaKey);\r\n throw e;\r\n }\r\n }\r\n\r\n return entry.schema;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<SchemaInfo | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry)\r\n return entry.schemaInfo;\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): Iterable<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Iterable<Schema> {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @public @preview\r\n */\r\nexport class SchemaContext {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n private _fallbackLocaterDefined: boolean;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n this._fallbackLocaterDefined = false;\r\n }\r\n\r\n public get locaters(): ReadonlyArray<ISchemaLocater> { return this._locaters; }\r\n\r\n /**\r\n * Adds a locater to the context.\r\n *\r\n * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.\r\n * If a fallback locater is already defined, the new locater is inserted before the fallback locater.\r\n *\r\n * @param locater - The locater to be added.\r\n */\r\n public addLocater(locater: ISchemaLocater) {\r\n const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;\r\n this._locaters.splice(insertIndex, 0, locater);\r\n }\r\n\r\n /**\r\n * Adds a fallback locater to the context.\r\n *\r\n * If a fallback locater is already defined, it replaces the existing one.\r\n * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.\r\n *\r\n * @param locater - The locater to be added as a fallback.\r\n */\r\n public addFallbackLocater(locater: ISchemaLocater) {\r\n if (this._fallbackLocaterDefined) {\r\n this._locaters[this._locaters.length - 1] = locater;\r\n } else {\r\n this._locaters.push(locater);\r\n this._fallbackLocaterDefined = true;\r\n }\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this._knownSchemas.schemaExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.\r\n * Use this method over addSchema when asynchronously loading schemas\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = await locater.getSchema(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be gotten later from the context using [[getSchema]].\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined> {\r\n for (const locater of this._locaters) {\r\n const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);\r\n if (undefined !== schemaInfo)\r\n return schemaInfo;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = locater.getSchemaSync(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will await a partially loaded schema then return when it is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public async getCachedSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n return this._knownSchemas.getSchema(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public getCachedSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n return this._knownSchemas.getSchemaSync(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item.\r\n *\r\n * @param schemaNameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param itemNameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param itemConstructor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @examples\r\n * ```typescript\r\n * const schemaItem = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = await this.getSchema(schemaKey, SchemaMatchType.Latest);\r\n\r\n if (!schema)\r\n return undefined;\r\n\r\n if (typeof itemNameOrCtor === \"string\") // Separate schema and item name arguments with/without an itemConstructor\r\n return itemConstructor ? schema.getItem(itemNameOrCtor, itemConstructor) : schema.getItem(itemNameOrCtor);\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItem(schemaNameOrKey, itemNameOrCtor) : schema.lookupItem(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItem(schemaNameOrKey.name, itemNameOrCtor) : schema.getItem(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.\r\n *\r\n * @param nameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param nameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param ctor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @example\r\n * ```typescript\r\n * const schemaItem = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = this.getSchemaSync(schemaKey, SchemaMatchType.Latest);\r\n if (!schema)\r\n return undefined;\r\n\r\n // Separate schema and item name arguments with/without an itemConstructor\r\n if (typeof itemNameOrCtor === \"string\") {\r\n return itemConstructor ? schema.getItemSync(itemNameOrCtor, itemConstructor) : schema.getItemSync(itemNameOrCtor);\r\n }\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItemSync(schemaNameOrKey, itemNameOrCtor) : schema.lookupItemSync(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItemSync(schemaNameOrKey.name, itemNameOrCtor) : schema.getItemSync(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Iterates through the items of each schema known to the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public getSchemaItems(): Iterable<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Iterable<Schema> {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
|
package/lib/cjs/ECObjects.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ export declare function parseSchemaItemType(type: string): SchemaItemType | unde
|
|
|
147
147
|
* @param value The SchemaItemType to stringify.
|
|
148
148
|
* @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.
|
|
149
149
|
* @beta
|
|
150
|
-
* @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly
|
|
150
|
+
* @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly
|
|
151
151
|
*/
|
|
152
152
|
export declare function schemaItemTypeToString(value: SchemaItemType): string;
|
|
153
153
|
/** @internal */
|
package/lib/cjs/ECObjects.js
CHANGED
|
@@ -129,7 +129,7 @@ var SchemaMatchType;
|
|
|
129
129
|
(function (SchemaMatchType) {
|
|
130
130
|
/*
|
|
131
131
|
* Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched
|
|
132
|
-
* @deprecated in 4.10 Use Exact instead.
|
|
132
|
+
* @deprecated in 4.10 - might be removed in next major version. Use Exact instead.
|
|
133
133
|
*/
|
|
134
134
|
SchemaMatchType[SchemaMatchType["Identical"] = 0] = "Identical";
|
|
135
135
|
/* Find exact VersionRead, VersionWrite, VersionMinor match. */
|
|
@@ -229,7 +229,7 @@ function parseSchemaItemType(type) {
|
|
|
229
229
|
* @param value The SchemaItemType to stringify.
|
|
230
230
|
* @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.
|
|
231
231
|
* @beta
|
|
232
|
-
* @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly
|
|
232
|
+
* @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly
|
|
233
233
|
*/
|
|
234
234
|
function schemaItemTypeToString(value) {
|
|
235
235
|
return value; // TODO: Remove
|
package/lib/cjs/ECObjects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECObjects.js","sourceRoot":"","sources":["../../src/ECObjects.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAoKH,gDAQC;AAMD,sDAQC;AAQD,kDAkBC;AASD,wDAEC;AAGD,8DAmBC;AAQD,gDAeC;AAGD,s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Ac,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,KAAK;QAC9B,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,oBAAoB;QAC7C,KAAK,KAAK,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { ECStringConstants } from \"./Constants\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nexport { PropertyType } from \"./PropertyTypes\";\n\n// NEEDSWORK: This shim is currently required to use async iterators. See https://github.com/Microsoft/TypeScript/issues/14151\nif (!(Symbol as any).asyncIterator) {\n (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n}\n\n/**\n * Identifies a class as abstract or sealed\n *\n * @public @preview\n */\nexport enum ECClassModifier {\n /* normal, instantiable class, can be subclassed */\n None,\n /* abstract class, cannot be instantiated, can be subclassed */\n Abstract,\n /* sealed class, instantiable class, cannot be subclassed */\n Sealed,\n}\n\n/**\n * An enumeration that has all the schema item type names as values\n *\n * @enum {string}\n * @public @preview\n */\nexport enum SchemaItemType {\n EntityClass = \"EntityClass\",\n Mixin = \"Mixin\",\n StructClass = \"StructClass\",\n CustomAttributeClass = \"CustomAttributeClass\",\n RelationshipClass = \"RelationshipClass\",\n Enumeration = \"Enumeration\",\n KindOfQuantity = \"KindOfQuantity\",\n PropertyCategory = \"PropertyCategory\",\n Unit = \"Unit\",\n InvertedUnit = \"InvertedUnit\",\n Constant = \"Constant\",\n Phenomenon = \"Phenomenon\",\n UnitSystem = \"UnitSystem\",\n Format = \"Format\",\n}\n\n/**\n * Additional Schema Item Types which define classes of item types\n * @public @preview\n */\nexport enum AbstractSchemaItemType {\n /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */\n Class = \"Class\",\n /* Any item type including the Class types */\n SchemaItem = \"SchemaItem\",\n}\n\n/**\n * Defines types of items that may be provided to identify supported items\n * @public @preview\n */\nexport type SupportedSchemaItemType = SchemaItemType | AbstractSchemaItemType;\n\n/**\n * Primitive data types for ECProperties.\n * @public @preview\n */\nexport enum PrimitiveType {\n Uninitialized = 0x00,\n Binary = 0x101,\n Boolean = 0x201,\n DateTime = 0x301,\n Double = 0x401,\n Integer = 0x501,\n Long = 0x601,\n Point2d = 0x701,\n Point3d = 0x801,\n String = 0x901,\n IGeometry = 0xa01,\n}\n\n/**\n * Defines the valid CustomAttribute container types.\n * @public @preview\n */\nexport enum CustomAttributeContainerType {\n Schema = 0x0001 << 0,\n EntityClass = 0x0001 << 1,\n CustomAttributeClass = 0x0001 << 2,\n StructClass = 0x0001 << 3,\n RelationshipClass = 0x0001 << 4,\n AnyClass = EntityClass | CustomAttributeClass | StructClass | RelationshipClass,\n PrimitiveProperty = 0x0001 << 5,\n StructProperty = 0x0001 << 6,\n PrimitiveArrayProperty = 0x0001 << 7,\n StructArrayProperty = 0x0001 << 8,\n NavigationProperty = 0x0001 << 9,\n AnyProperty = PrimitiveProperty | StructProperty | PrimitiveArrayProperty | StructArrayProperty | NavigationProperty,\n SourceRelationshipConstraint = 0x0001 << 10,\n TargetRelationshipConstraint = 0x0001 << 11,\n AnyRelationshipConstraint = SourceRelationshipConstraint | TargetRelationshipConstraint,\n Any = Schema | AnyClass | AnyProperty | AnyRelationshipConstraint,\n}\n\n/**\n * Defines what sort of match should be used when locating a schema.\n * @public @preview\n */\nexport enum SchemaMatchType {\n /*\n * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched\n * @deprecated in 4.10 Use Exact instead.\n */\n Identical,\n /* Find exact VersionRead, VersionWrite, VersionMinor match. */\n Exact,\n /* Find latest version with matching VersionRead and VersionWrite */\n LatestWriteCompatible,\n /* Find latest version. */\n Latest,\n /* Find latest version with matching VersionRead */\n LatestReadCompatible,\n}\n\n/**\n * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.\n * @public @preview\n */\nexport enum RelationshipEnd {\n Source = 0,\n Target = 1,\n}\n\n/**\n * Defines the how the lifetime of the source and target are related.\n *\n * @public @preview */\nexport enum StrengthType {\n Referencing,\n Holding,\n Embedding,\n}\n\n/**\n * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.\n *\n * @public @preview */\nexport enum StrengthDirection {\n /** The source is the starting point of the relationship. */\n Forward = 1,\n /** The target is the starting point of the relationship. */\n Backward = 2,\n}\n\n// Helper methods for going to/from string for the above Enumerations.\n\n/**\n * Parses the provided string into an ECClassModifier if the string is a valid modifier.\n * @param modifier The modifier string to parse.\n * @beta\n */\nexport function parseClassModifier(modifier: string): ECClassModifier | undefined {\n const lowerModifier = modifier.toLowerCase();\n switch (lowerModifier) {\n case \"abstract\": return ECClassModifier.Abstract;\n case \"none\": return ECClassModifier.None;\n case \"sealed\": return ECClassModifier.Sealed;\n }\n return undefined;\n}\n\n/**\n * @return A string representing the provided ECClassModifier. If the modifier is not valid, an empty string is returned.\n * @beta\n */\nexport function classModifierToString(modifier: ECClassModifier): string {\n switch (modifier) {\n case ECClassModifier.Abstract: return \"Abstract\";\n case ECClassModifier.None: return \"None\";\n case ECClassModifier.Sealed: return \"Sealed\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, \"An invalid ECClassModifier has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 8 schema item types.\n * @param type The schema item type string to parse.\n * @returns A valid SchemaItemType if successfully parsed. Otherwise, undefined if the provided string is not a valid SchemaItemType.\n * @beta\n */\nexport function parseSchemaItemType(type: string): SchemaItemType | undefined {\n switch (type.toLowerCase()) {\n case \"entityclass\": return SchemaItemType.EntityClass;\n case \"mixin\": return SchemaItemType.Mixin;\n case \"structclass\": return SchemaItemType.StructClass;\n case \"customattributeclass\": return SchemaItemType.CustomAttributeClass;\n case \"relationshipclass\": return SchemaItemType.RelationshipClass;\n case \"enumeration\": return SchemaItemType.Enumeration;\n case \"kindofquantity\": return SchemaItemType.KindOfQuantity;\n case \"propertycategory\": return SchemaItemType.PropertyCategory;\n case \"unit\": return SchemaItemType.Unit;\n case \"invertedunit\": return SchemaItemType.InvertedUnit;\n case \"constant\": return SchemaItemType.Constant;\n case \"phenomenon\": return SchemaItemType.Phenomenon;\n case \"unitsystem\": return SchemaItemType.UnitSystem;\n case \"format\": return SchemaItemType.Format;\n }\n return undefined;\n}\n\n/**\n * Converts a valid SchemaItemType to a display string.\n * @param value The SchemaItemType to stringify.\n * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.\n * @beta\n * @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly\n */\nexport function schemaItemTypeToString(value: SchemaItemType): string {\n return value; // TODO: Remove\n}\n\n/** @internal */\nexport function schemaItemTypeToXmlString(value: SchemaItemType): string {\n switch (value) {\n case SchemaItemType.EntityClass: return \"ECEntityClass\";\n case SchemaItemType.Mixin: return \"ECEntityClass\";\n case SchemaItemType.StructClass: return \"ECStructClass\";\n case SchemaItemType.CustomAttributeClass: return \"ECCustomAttributeClass\";\n case SchemaItemType.RelationshipClass: return \"ECRelationshipClass\";\n case SchemaItemType.Enumeration: return \"ECEnumeration\";\n case SchemaItemType.KindOfQuantity: return \"KindOfQuantity\";\n case SchemaItemType.PropertyCategory: return \"PropertyCategory\";\n case SchemaItemType.Unit: return \"Unit\";\n case SchemaItemType.InvertedUnit: return \"InvertedUnit\";\n case SchemaItemType.Constant: return \"Constant\";\n case SchemaItemType.Phenomenon: return \"Phenomenon\";\n case SchemaItemType.UnitSystem: return \"UnitSystem\";\n case SchemaItemType.Format: return \"Format\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, \"An invalid SchemaItemType has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 10 primitive types.\n * @param type The primitive type string to parse.\n * @returns A valid PrimitiveType if successfully parsed, or undefined if the provided string is not a valid PrimitiveType.\n * @beta\n */\nexport function parsePrimitiveType(type: string): PrimitiveType | undefined {\n switch (type.toLowerCase()) {\n case \"binary\": return PrimitiveType.Binary;\n case \"boolean\": case \"bool\": return PrimitiveType.Boolean;\n case \"datetime\": return PrimitiveType.DateTime;\n case \"double\": return PrimitiveType.Double;\n case \"int\": return PrimitiveType.Integer;\n case \"long\": return PrimitiveType.Long;\n case \"point2d\": return PrimitiveType.Point2d;\n case \"point3d\": return PrimitiveType.Point3d;\n case \"string\": return PrimitiveType.String;\n case \"bentley.geometry.common.igeometry\": return PrimitiveType.IGeometry;\n }\n\n return undefined;\n}\n\n/** @beta */\nexport function primitiveTypeToString(type: PrimitiveType): string {\n switch (type) {\n case PrimitiveType.Binary: return \"binary\";\n case PrimitiveType.Boolean: return \"boolean\";\n case PrimitiveType.DateTime: return \"dateTime\";\n case PrimitiveType.Double: return \"double\";\n case PrimitiveType.Integer: return \"int\";\n case PrimitiveType.IGeometry: return \"Bentley.Geometry.Common.IGeometry\";\n case PrimitiveType.Long: return \"long\";\n case PrimitiveType.Point2d: return \"point2d\";\n case PrimitiveType.Point3d: return \"point3d\";\n case PrimitiveType.String: return \"string\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, \"An invalid PrimitiveType has been provided.\");\n }\n}\n\n/**\n * Parses the given string into the appropriate CustomAttributeContainerType if the string is valid.\n * @param type The container type string to parse.\n * @beta\n */\nexport function parseCustomAttributeContainerType(type: string): CustomAttributeContainerType | undefined {\n const typeTokens = type.split(/[|,;]+/);\n\n let containerType = 0;\n\n typeTokens.forEach((typeToken) => {\n typeToken = typeToken.trim();\n if (typeToken.length === 0) return;\n\n typeToken = typeToken.toLowerCase();\n switch (typeToken) {\n case \"schema\":\n containerType = containerType | CustomAttributeContainerType.Schema;\n break;\n case \"entityclass\":\n containerType = containerType | CustomAttributeContainerType.EntityClass;\n break;\n case \"customattributeclass\":\n containerType = containerType | CustomAttributeContainerType.CustomAttributeClass;\n break;\n case \"structclass\":\n containerType = containerType | CustomAttributeContainerType.StructClass;\n break;\n case \"relationshipclass\":\n containerType = containerType | CustomAttributeContainerType.RelationshipClass;\n break;\n case \"anyclass\":\n containerType = containerType | CustomAttributeContainerType.AnyClass;\n break;\n case \"primitiveproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveProperty;\n break;\n case \"structproperty\":\n containerType = containerType | CustomAttributeContainerType.StructProperty;\n break;\n case \"arrayproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveArrayProperty;\n break;\n case \"structarrayproperty\":\n containerType = containerType | CustomAttributeContainerType.StructArrayProperty;\n break;\n case \"navigationproperty\":\n containerType = containerType | CustomAttributeContainerType.NavigationProperty;\n break;\n case \"anyproperty\":\n containerType = containerType | CustomAttributeContainerType.AnyProperty;\n break;\n case \"sourcerelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.SourceRelationshipConstraint;\n break;\n case \"targetrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.TargetRelationshipConstraint;\n break;\n case \"anyrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.AnyRelationshipConstraint;\n break;\n case \"any\":\n containerType = containerType | CustomAttributeContainerType.Any;\n break;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);\n }\n });\n\n return containerType as CustomAttributeContainerType;\n}\n\n/**\n * Creates a string representing a valid CustomAttributeContainerType.\n * @param value The CustomAttributeContainerType to stringify.\n * @return A string representing the provided CustomAttributeContainerType. If the type is not valid, an empty string is returned.\n * @beta\n */\nexport function containerTypeToString(type: CustomAttributeContainerType): string {\n const testContainerTypeValue = (compareType: CustomAttributeContainerType, otherType: CustomAttributeContainerType) => {\n return compareType === (compareType & otherType);\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Any, type))\n return ECStringConstants.CONTAINERTYPE_ANY;\n\n let containerType = \"\";\n const setOrAppend = (val: string) => {\n if (containerType.length === 0) containerType = val;\n else containerType = `${containerType}, ${val}`;\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Schema, type))\n setOrAppend(\"Schema\");\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyClass, type))\n setOrAppend(\"AnyClass\");\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.EntityClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ENTITYCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.CustomAttributeClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.StructClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.RelationshipClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYPROPERTY);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.NavigationProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.SourceRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT);\n if (testContainerTypeValue(CustomAttributeContainerType.TargetRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT);\n }\n\n return containerType;\n}\n\n/** @beta */\nexport function parseRelationshipEnd(end: string): RelationshipEnd | undefined {\n switch (end.toLowerCase()) {\n case \"source\": return RelationshipEnd.Source;\n case \"target\": return RelationshipEnd.Target;\n }\n return undefined;\n}\n\n/** @beta */\nexport function relationshipEndToString(end: RelationshipEnd): string {\n switch (end) {\n case RelationshipEnd.Source: return ECStringConstants.RELATIONSHIP_END_SOURCE;\n case RelationshipEnd.Target: return ECStringConstants.RELATIONSHIP_END_TARGET;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);\n }\n}\n\n/**\n * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.\n * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid\n * @param strength\n * @beta\n */\nexport function parseStrength(strength: string): StrengthType | undefined {\n switch (strength.toLowerCase()) {\n case \"referencing\": return StrengthType.Referencing;\n case \"holding\": return StrengthType.Holding;\n case \"embedding\": return StrengthType.Embedding;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthToString(strength: StrengthType): string {\n switch (strength) {\n case StrengthType.Embedding: return \"Embedding\";\n case StrengthType.Holding: return \"Holding\";\n case StrengthType.Referencing: return \"Referencing\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);\n }\n}\n\n/** @beta */\nexport function parseStrengthDirection(direction: string): StrengthDirection | undefined {\n switch (direction.toLowerCase()) {\n case \"forward\": return StrengthDirection.Forward;\n case \"backward\": return StrengthDirection.Backward;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthDirectionToString(direction: StrengthDirection): string {\n switch (direction) {\n case StrengthDirection.Forward: return \"Forward\";\n case StrengthDirection.Backward: return \"Backward\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);\n }\n}\n\n/** Compares a SchemaItemType against supported type.\n * @beta\n */\nexport function isSupportedSchemaItemType(value: SchemaItemType, supported: SupportedSchemaItemType): boolean {\n if (value === supported) return true;\n\n if (supported === AbstractSchemaItemType.Class && (\n value === SchemaItemType.EntityClass ||\n value === SchemaItemType.Mixin ||\n value === SchemaItemType.StructClass ||\n value === SchemaItemType.CustomAttributeClass ||\n value === SchemaItemType.RelationshipClass)) {\n return true;\n }\n\n if (supported === AbstractSchemaItemType.SchemaItem) {\n return true;\n }\n\n return false;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ECObjects.js","sourceRoot":"","sources":["../../src/ECObjects.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAoKH,gDAQC;AAMD,sDAQC;AAQD,kDAkBC;AASD,wDAEC;AAGD,8DAmBC;AAQD,gDAeC;AAGD,sDAeC;AAOD,8EAiEC;AAQD,sDAuDC;AAGD,oDAMC;AAGD,0DAOC;AAQD,sCAOC;AAGD,4CAQC;AAGD,wDAMC;AAGD,8DAOC;AAKD,8DAiBC;AAzfD,2CAAgD;AAChD,2CAA4D;AAE5D,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,+HAA+H;AAC/H,IAAI,CAAE,MAAc,CAAC,aAAa,EAAE,CAAC;IAClC,MAAc,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,IAAY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AM,IAAI,yBAAa,CAAC,0BAAc,CAAC,eAAe,EAAE,wCAAwC,CAAC,CAAC;IACtG,CAAC;AACH,CAAC;AAED,YAAY;AACZ,SAAgB,sBAAsB,CAAC,SAAiB;IACtD,QAAQ,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;QAChC,KAAK,SAAS,CAAC,CAAC,OAAO,iBAAiB,CAAC,OAAO,CAAC;QACjD,KAAK,UAAU,CAAC,CAAC,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACrD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,YAAY;AACZ,SAAgB,yBAAyB,CAAC,SAA4B;IACpE,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,iBAAiB,CAAC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;QACjD,KAAK,iBAAiB,CAAC,QAAQ,CAAC,CAAC,OAAO,UAAU,CAAC;QACnD;YACE,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,wBAAwB,EAAE,iDAAiD,CAAC,CAAC;IACxH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,KAAqB,EAAE,SAAkC;IACjG,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,SAAS,KAAK,sBAAsB,CAAC,KAAK,IAAI,CAChD,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,KAAK;QAC9B,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,oBAAoB;QAC7C,KAAK,KAAK,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { ECStringConstants } from \"./Constants\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nexport { PropertyType } from \"./PropertyTypes\";\n\n// NEEDSWORK: This shim is currently required to use async iterators. See https://github.com/Microsoft/TypeScript/issues/14151\nif (!(Symbol as any).asyncIterator) {\n (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n}\n\n/**\n * Identifies a class as abstract or sealed\n *\n * @public @preview\n */\nexport enum ECClassModifier {\n /* normal, instantiable class, can be subclassed */\n None,\n /* abstract class, cannot be instantiated, can be subclassed */\n Abstract,\n /* sealed class, instantiable class, cannot be subclassed */\n Sealed,\n}\n\n/**\n * An enumeration that has all the schema item type names as values\n *\n * @enum {string}\n * @public @preview\n */\nexport enum SchemaItemType {\n EntityClass = \"EntityClass\",\n Mixin = \"Mixin\",\n StructClass = \"StructClass\",\n CustomAttributeClass = \"CustomAttributeClass\",\n RelationshipClass = \"RelationshipClass\",\n Enumeration = \"Enumeration\",\n KindOfQuantity = \"KindOfQuantity\",\n PropertyCategory = \"PropertyCategory\",\n Unit = \"Unit\",\n InvertedUnit = \"InvertedUnit\",\n Constant = \"Constant\",\n Phenomenon = \"Phenomenon\",\n UnitSystem = \"UnitSystem\",\n Format = \"Format\",\n}\n\n/**\n * Additional Schema Item Types which define classes of item types\n * @public @preview\n */\nexport enum AbstractSchemaItemType {\n /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */\n Class = \"Class\",\n /* Any item type including the Class types */\n SchemaItem = \"SchemaItem\",\n}\n\n/**\n * Defines types of items that may be provided to identify supported items\n * @public @preview\n */\nexport type SupportedSchemaItemType = SchemaItemType | AbstractSchemaItemType;\n\n/**\n * Primitive data types for ECProperties.\n * @public @preview\n */\nexport enum PrimitiveType {\n Uninitialized = 0x00,\n Binary = 0x101,\n Boolean = 0x201,\n DateTime = 0x301,\n Double = 0x401,\n Integer = 0x501,\n Long = 0x601,\n Point2d = 0x701,\n Point3d = 0x801,\n String = 0x901,\n IGeometry = 0xa01,\n}\n\n/**\n * Defines the valid CustomAttribute container types.\n * @public @preview\n */\nexport enum CustomAttributeContainerType {\n Schema = 0x0001 << 0,\n EntityClass = 0x0001 << 1,\n CustomAttributeClass = 0x0001 << 2,\n StructClass = 0x0001 << 3,\n RelationshipClass = 0x0001 << 4,\n AnyClass = EntityClass | CustomAttributeClass | StructClass | RelationshipClass,\n PrimitiveProperty = 0x0001 << 5,\n StructProperty = 0x0001 << 6,\n PrimitiveArrayProperty = 0x0001 << 7,\n StructArrayProperty = 0x0001 << 8,\n NavigationProperty = 0x0001 << 9,\n AnyProperty = PrimitiveProperty | StructProperty | PrimitiveArrayProperty | StructArrayProperty | NavigationProperty,\n SourceRelationshipConstraint = 0x0001 << 10,\n TargetRelationshipConstraint = 0x0001 << 11,\n AnyRelationshipConstraint = SourceRelationshipConstraint | TargetRelationshipConstraint,\n Any = Schema | AnyClass | AnyProperty | AnyRelationshipConstraint,\n}\n\n/**\n * Defines what sort of match should be used when locating a schema.\n * @public @preview\n */\nexport enum SchemaMatchType {\n /*\n * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched\n * @deprecated in 4.10 - might be removed in next major version. Use Exact instead.\n */\n Identical,\n /* Find exact VersionRead, VersionWrite, VersionMinor match. */\n Exact,\n /* Find latest version with matching VersionRead and VersionWrite */\n LatestWriteCompatible,\n /* Find latest version. */\n Latest,\n /* Find latest version with matching VersionRead */\n LatestReadCompatible,\n}\n\n/**\n * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.\n * @public @preview\n */\nexport enum RelationshipEnd {\n Source = 0,\n Target = 1,\n}\n\n/**\n * Defines the how the lifetime of the source and target are related.\n *\n * @public @preview */\nexport enum StrengthType {\n Referencing,\n Holding,\n Embedding,\n}\n\n/**\n * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.\n *\n * @public @preview */\nexport enum StrengthDirection {\n /** The source is the starting point of the relationship. */\n Forward = 1,\n /** The target is the starting point of the relationship. */\n Backward = 2,\n}\n\n// Helper methods for going to/from string for the above Enumerations.\n\n/**\n * Parses the provided string into an ECClassModifier if the string is a valid modifier.\n * @param modifier The modifier string to parse.\n * @beta\n */\nexport function parseClassModifier(modifier: string): ECClassModifier | undefined {\n const lowerModifier = modifier.toLowerCase();\n switch (lowerModifier) {\n case \"abstract\": return ECClassModifier.Abstract;\n case \"none\": return ECClassModifier.None;\n case \"sealed\": return ECClassModifier.Sealed;\n }\n return undefined;\n}\n\n/**\n * @return A string representing the provided ECClassModifier. If the modifier is not valid, an empty string is returned.\n * @beta\n */\nexport function classModifierToString(modifier: ECClassModifier): string {\n switch (modifier) {\n case ECClassModifier.Abstract: return \"Abstract\";\n case ECClassModifier.None: return \"None\";\n case ECClassModifier.Sealed: return \"Sealed\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, \"An invalid ECClassModifier has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 8 schema item types.\n * @param type The schema item type string to parse.\n * @returns A valid SchemaItemType if successfully parsed. Otherwise, undefined if the provided string is not a valid SchemaItemType.\n * @beta\n */\nexport function parseSchemaItemType(type: string): SchemaItemType | undefined {\n switch (type.toLowerCase()) {\n case \"entityclass\": return SchemaItemType.EntityClass;\n case \"mixin\": return SchemaItemType.Mixin;\n case \"structclass\": return SchemaItemType.StructClass;\n case \"customattributeclass\": return SchemaItemType.CustomAttributeClass;\n case \"relationshipclass\": return SchemaItemType.RelationshipClass;\n case \"enumeration\": return SchemaItemType.Enumeration;\n case \"kindofquantity\": return SchemaItemType.KindOfQuantity;\n case \"propertycategory\": return SchemaItemType.PropertyCategory;\n case \"unit\": return SchemaItemType.Unit;\n case \"invertedunit\": return SchemaItemType.InvertedUnit;\n case \"constant\": return SchemaItemType.Constant;\n case \"phenomenon\": return SchemaItemType.Phenomenon;\n case \"unitsystem\": return SchemaItemType.UnitSystem;\n case \"format\": return SchemaItemType.Format;\n }\n return undefined;\n}\n\n/**\n * Converts a valid SchemaItemType to a display string.\n * @param value The SchemaItemType to stringify.\n * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.\n * @beta\n * @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly\n */\nexport function schemaItemTypeToString(value: SchemaItemType): string {\n return value; // TODO: Remove\n}\n\n/** @internal */\nexport function schemaItemTypeToXmlString(value: SchemaItemType): string {\n switch (value) {\n case SchemaItemType.EntityClass: return \"ECEntityClass\";\n case SchemaItemType.Mixin: return \"ECEntityClass\";\n case SchemaItemType.StructClass: return \"ECStructClass\";\n case SchemaItemType.CustomAttributeClass: return \"ECCustomAttributeClass\";\n case SchemaItemType.RelationshipClass: return \"ECRelationshipClass\";\n case SchemaItemType.Enumeration: return \"ECEnumeration\";\n case SchemaItemType.KindOfQuantity: return \"KindOfQuantity\";\n case SchemaItemType.PropertyCategory: return \"PropertyCategory\";\n case SchemaItemType.Unit: return \"Unit\";\n case SchemaItemType.InvertedUnit: return \"InvertedUnit\";\n case SchemaItemType.Constant: return \"Constant\";\n case SchemaItemType.Phenomenon: return \"Phenomenon\";\n case SchemaItemType.UnitSystem: return \"UnitSystem\";\n case SchemaItemType.Format: return \"Format\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, \"An invalid SchemaItemType has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 10 primitive types.\n * @param type The primitive type string to parse.\n * @returns A valid PrimitiveType if successfully parsed, or undefined if the provided string is not a valid PrimitiveType.\n * @beta\n */\nexport function parsePrimitiveType(type: string): PrimitiveType | undefined {\n switch (type.toLowerCase()) {\n case \"binary\": return PrimitiveType.Binary;\n case \"boolean\": case \"bool\": return PrimitiveType.Boolean;\n case \"datetime\": return PrimitiveType.DateTime;\n case \"double\": return PrimitiveType.Double;\n case \"int\": return PrimitiveType.Integer;\n case \"long\": return PrimitiveType.Long;\n case \"point2d\": return PrimitiveType.Point2d;\n case \"point3d\": return PrimitiveType.Point3d;\n case \"string\": return PrimitiveType.String;\n case \"bentley.geometry.common.igeometry\": return PrimitiveType.IGeometry;\n }\n\n return undefined;\n}\n\n/** @beta */\nexport function primitiveTypeToString(type: PrimitiveType): string {\n switch (type) {\n case PrimitiveType.Binary: return \"binary\";\n case PrimitiveType.Boolean: return \"boolean\";\n case PrimitiveType.DateTime: return \"dateTime\";\n case PrimitiveType.Double: return \"double\";\n case PrimitiveType.Integer: return \"int\";\n case PrimitiveType.IGeometry: return \"Bentley.Geometry.Common.IGeometry\";\n case PrimitiveType.Long: return \"long\";\n case PrimitiveType.Point2d: return \"point2d\";\n case PrimitiveType.Point3d: return \"point3d\";\n case PrimitiveType.String: return \"string\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, \"An invalid PrimitiveType has been provided.\");\n }\n}\n\n/**\n * Parses the given string into the appropriate CustomAttributeContainerType if the string is valid.\n * @param type The container type string to parse.\n * @beta\n */\nexport function parseCustomAttributeContainerType(type: string): CustomAttributeContainerType | undefined {\n const typeTokens = type.split(/[|,;]+/);\n\n let containerType = 0;\n\n typeTokens.forEach((typeToken) => {\n typeToken = typeToken.trim();\n if (typeToken.length === 0) return;\n\n typeToken = typeToken.toLowerCase();\n switch (typeToken) {\n case \"schema\":\n containerType = containerType | CustomAttributeContainerType.Schema;\n break;\n case \"entityclass\":\n containerType = containerType | CustomAttributeContainerType.EntityClass;\n break;\n case \"customattributeclass\":\n containerType = containerType | CustomAttributeContainerType.CustomAttributeClass;\n break;\n case \"structclass\":\n containerType = containerType | CustomAttributeContainerType.StructClass;\n break;\n case \"relationshipclass\":\n containerType = containerType | CustomAttributeContainerType.RelationshipClass;\n break;\n case \"anyclass\":\n containerType = containerType | CustomAttributeContainerType.AnyClass;\n break;\n case \"primitiveproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveProperty;\n break;\n case \"structproperty\":\n containerType = containerType | CustomAttributeContainerType.StructProperty;\n break;\n case \"arrayproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveArrayProperty;\n break;\n case \"structarrayproperty\":\n containerType = containerType | CustomAttributeContainerType.StructArrayProperty;\n break;\n case \"navigationproperty\":\n containerType = containerType | CustomAttributeContainerType.NavigationProperty;\n break;\n case \"anyproperty\":\n containerType = containerType | CustomAttributeContainerType.AnyProperty;\n break;\n case \"sourcerelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.SourceRelationshipConstraint;\n break;\n case \"targetrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.TargetRelationshipConstraint;\n break;\n case \"anyrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.AnyRelationshipConstraint;\n break;\n case \"any\":\n containerType = containerType | CustomAttributeContainerType.Any;\n break;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);\n }\n });\n\n return containerType as CustomAttributeContainerType;\n}\n\n/**\n * Creates a string representing a valid CustomAttributeContainerType.\n * @param value The CustomAttributeContainerType to stringify.\n * @return A string representing the provided CustomAttributeContainerType. If the type is not valid, an empty string is returned.\n * @beta\n */\nexport function containerTypeToString(type: CustomAttributeContainerType): string {\n const testContainerTypeValue = (compareType: CustomAttributeContainerType, otherType: CustomAttributeContainerType) => {\n return compareType === (compareType & otherType);\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Any, type))\n return ECStringConstants.CONTAINERTYPE_ANY;\n\n let containerType = \"\";\n const setOrAppend = (val: string) => {\n if (containerType.length === 0) containerType = val;\n else containerType = `${containerType}, ${val}`;\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Schema, type))\n setOrAppend(\"Schema\");\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyClass, type))\n setOrAppend(\"AnyClass\");\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.EntityClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ENTITYCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.CustomAttributeClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.StructClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.RelationshipClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYPROPERTY);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.NavigationProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.SourceRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT);\n if (testContainerTypeValue(CustomAttributeContainerType.TargetRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT);\n }\n\n return containerType;\n}\n\n/** @beta */\nexport function parseRelationshipEnd(end: string): RelationshipEnd | undefined {\n switch (end.toLowerCase()) {\n case \"source\": return RelationshipEnd.Source;\n case \"target\": return RelationshipEnd.Target;\n }\n return undefined;\n}\n\n/** @beta */\nexport function relationshipEndToString(end: RelationshipEnd): string {\n switch (end) {\n case RelationshipEnd.Source: return ECStringConstants.RELATIONSHIP_END_SOURCE;\n case RelationshipEnd.Target: return ECStringConstants.RELATIONSHIP_END_TARGET;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);\n }\n}\n\n/**\n * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.\n * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid\n * @param strength\n * @beta\n */\nexport function parseStrength(strength: string): StrengthType | undefined {\n switch (strength.toLowerCase()) {\n case \"referencing\": return StrengthType.Referencing;\n case \"holding\": return StrengthType.Holding;\n case \"embedding\": return StrengthType.Embedding;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthToString(strength: StrengthType): string {\n switch (strength) {\n case StrengthType.Embedding: return \"Embedding\";\n case StrengthType.Holding: return \"Holding\";\n case StrengthType.Referencing: return \"Referencing\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);\n }\n}\n\n/** @beta */\nexport function parseStrengthDirection(direction: string): StrengthDirection | undefined {\n switch (direction.toLowerCase()) {\n case \"forward\": return StrengthDirection.Forward;\n case \"backward\": return StrengthDirection.Backward;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthDirectionToString(direction: StrengthDirection): string {\n switch (direction) {\n case StrengthDirection.Forward: return \"Forward\";\n case StrengthDirection.Backward: return \"Backward\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);\n }\n}\n\n/** Compares a SchemaItemType against supported type.\n * @beta\n */\nexport function isSupportedSchemaItemType(value: SchemaItemType, supported: SupportedSchemaItemType): boolean {\n if (value === supported) return true;\n\n if (supported === AbstractSchemaItemType.Class && (\n value === SchemaItemType.EntityClass ||\n value === SchemaItemType.Mixin ||\n value === SchemaItemType.StructClass ||\n value === SchemaItemType.CustomAttributeClass ||\n value === SchemaItemType.RelationshipClass)) {\n return true;\n }\n\n if (supported === AbstractSchemaItemType.SchemaItem) {\n return true;\n }\n\n return false;\n}\n"]}
|
|
@@ -15,7 +15,7 @@ export declare class CustomAttributeClass extends ECClass {
|
|
|
15
15
|
static get schemaItemType(): SchemaItemType;
|
|
16
16
|
private _appliesTo?;
|
|
17
17
|
/**
|
|
18
|
-
* @deprecated in 4.8 use [[appliesTo]]
|
|
18
|
+
* @deprecated in 4.8 - might be removed in next major version. use [[appliesTo]]
|
|
19
19
|
* */
|
|
20
20
|
get containerType(): CustomAttributeContainerType;
|
|
21
21
|
get appliesTo(): CustomAttributeContainerType;
|
|
@@ -21,7 +21,7 @@ class CustomAttributeClass extends Class_1.ECClass {
|
|
|
21
21
|
static get schemaItemType() { return ECObjects_1.SchemaItemType.CustomAttributeClass; }
|
|
22
22
|
_appliesTo;
|
|
23
23
|
/**
|
|
24
|
-
* @deprecated in 4.8 use [[appliesTo]]
|
|
24
|
+
* @deprecated in 4.8 - might be removed in next major version. use [[appliesTo]]
|
|
25
25
|
* */
|
|
26
26
|
get containerType() {
|
|
27
27
|
return this.appliesTo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAttributeClass.js","sourceRoot":"","sources":["../../../src/Metadata/CustomAttributeClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAEsB;AACtB,4CAA6D;AAC7D,mCAAkC;AAGlC;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,eAAO;IACtB,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC;IAC9E,gBAAgB;IACT,MAAM,KAAc,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e,KAAK,CAAC,QAAQ,CAAC,oBAA+C;QAC5E,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACO,YAAY,CAAC,aAA2C;QAChE,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,oBAAoB;YACrE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAiB;QAC1D,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YACpC,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAC9I,CAAC;CACF;AA9ED,oDA8EC;AACD;;;GAGG;AACH,MAAsB,cAAe,SAAQ,oBAAoB;CAGhE;AAHD,wCAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\nimport {\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { ECClass } from \"./Class\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECCustomAttributeClass.\n * @public @preview\n */\nexport class CustomAttributeClass extends ECClass {\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\n private _appliesTo?: CustomAttributeContainerType;\n\n /**\n * @deprecated in 4.8 use [[appliesTo]]\n * */\n public get containerType(): CustomAttributeContainerType {\n return this.appliesTo;\n }\n\n public get appliesTo(): CustomAttributeContainerType {\n if (undefined === this._appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);\n return this._appliesTo;\n }\n\n /**\n * Save this CustomAttributeClasses properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): CustomAttributeClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.appliesTo = containerTypeToString(this.appliesTo);\n return schemaJson as CustomAttributeClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"appliesTo\", containerTypeToString(this.appliesTo));\n return itemElement;\n }\n\n public override fromJSONSync(customAttributeProps: CustomAttributeClassProps) {\n super.fromJSONSync(customAttributeProps);\n const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);\n if (undefined === appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);\n this._appliesTo = appliesTo;\n }\n\n public override async fromJSON(customAttributeProps: CustomAttributeClassProps) {\n this.fromJSONSync(customAttributeProps);\n }\n\n /**\n * @internal\n */\n protected setAppliesTo(containerType: CustomAttributeContainerType) {\n this._appliesTo = containerType;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a CustomAttributeClass, false otherwise.\n */\n public static isCustomAttributeClass(item?: SchemaItem): item is CustomAttributeClass {\n if (item && item.schemaItemType === SchemaItemType.CustomAttributeClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.\n * @internal\n */\n public static assertIsCustomAttributeClass(item?: SchemaItem): asserts item is CustomAttributeClass {\n if (!this.isCustomAttributeClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);\n }\n}\n/**\n * @internal\n * An abstract class used for Schema editing.\n */\nexport abstract class MutableCAClass extends CustomAttributeClass {\n public abstract override setAppliesTo(containerType: CustomAttributeContainerType): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CustomAttributeClass.js","sourceRoot":"","sources":["../../../src/Metadata/CustomAttributeClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAEsB;AACtB,4CAA6D;AAC7D,mCAAkC;AAGlC;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,eAAO;IACtB,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC;IAC9E,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACnF,UAAU,CAAgC;IAElD;;SAEK;IACL,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,SAAS;QAClB,IAAI,SAAS,KAAK,IAAI,CAAC,UAAU;YAC/B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,oBAAoB,EAAE,4BAA4B,IAAI,CAAC,IAAI,gDAAgD,CAAC,CAAC;QACtJ,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACa,MAAM,CAAC,aAAsB,KAAK,EAAE,uBAAgC,KAAK;QACvF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB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yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAC9I,CAAC;CACF;AA9ED,oDA8EC;AACD;;;GAGG;AACH,MAAsB,cAAe,SAAQ,oBAAoB;CAGhE;AAHD,wCAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\nimport {\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { ECClass } from \"./Class\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECCustomAttributeClass.\n * @public @preview\n */\nexport class CustomAttributeClass extends ECClass {\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\n private _appliesTo?: CustomAttributeContainerType;\n\n /**\n * @deprecated in 4.8 - might be removed in next major version. use [[appliesTo]]\n * */\n public get containerType(): CustomAttributeContainerType {\n return this.appliesTo;\n }\n\n public get appliesTo(): CustomAttributeContainerType {\n if (undefined === this._appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);\n return this._appliesTo;\n }\n\n /**\n * Save this CustomAttributeClasses properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): CustomAttributeClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.appliesTo = containerTypeToString(this.appliesTo);\n return schemaJson as CustomAttributeClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"appliesTo\", containerTypeToString(this.appliesTo));\n return itemElement;\n }\n\n public override fromJSONSync(customAttributeProps: CustomAttributeClassProps) {\n super.fromJSONSync(customAttributeProps);\n const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);\n if (undefined === appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);\n this._appliesTo = appliesTo;\n }\n\n public override async fromJSON(customAttributeProps: CustomAttributeClassProps) {\n this.fromJSONSync(customAttributeProps);\n }\n\n /**\n * @internal\n */\n protected setAppliesTo(containerType: CustomAttributeContainerType) {\n this._appliesTo = containerType;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a CustomAttributeClass, false otherwise.\n */\n public static isCustomAttributeClass(item?: SchemaItem): item is CustomAttributeClass {\n if (item && item.schemaItemType === SchemaItemType.CustomAttributeClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.\n * @internal\n */\n public static assertIsCustomAttributeClass(item?: SchemaItem): asserts item is CustomAttributeClass {\n if (!this.isCustomAttributeClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);\n }\n}\n/**\n * @internal\n * An abstract class used for Schema editing.\n */\nexport abstract class MutableCAClass extends CustomAttributeClass {\n public abstract override setAppliesTo(containerType: CustomAttributeContainerType): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
package/lib/esm/Context.d.ts
CHANGED
|
@@ -146,7 +146,7 @@ export declare class SchemaContext {
|
|
|
146
146
|
/**
|
|
147
147
|
* Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
|
|
148
148
|
* @param schemaItem The SchemaItem to add
|
|
149
|
-
* @deprecated in 4.0 use ecschema-editing package
|
|
149
|
+
* @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package
|
|
150
150
|
*/
|
|
151
151
|
addSchemaItem(schemaItem: SchemaItem): Promise<void>;
|
|
152
152
|
/**
|
package/lib/esm/Context.js
CHANGED
|
@@ -219,7 +219,7 @@ export class SchemaContext {
|
|
|
219
219
|
/**
|
|
220
220
|
* Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
|
|
221
221
|
* @param schemaItem The SchemaItem to add
|
|
222
|
-
* @deprecated in 4.0 use ecschema-editing package
|
|
222
|
+
* @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package
|
|
223
223
|
*/
|
|
224
224
|
async addSchemaItem(schemaItem) {
|
|
225
225
|
const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);
|
package/lib/esm/Context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAiB,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAgD9C;;GAEG;AACH,MAAM,OAAO,WAAW;IACd,OAAO,CAAY;IAE3B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,KAAK,KAAK,OAAO,IAAI,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C,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAE1H,kDAAkD;QAClD,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9H,CAAC;IAED;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @public @preview\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);\r\n }\r\n\r\n private schemaPromiseExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);\r\n }\r\n\r\n private findEntry(schemaKey: SchemaKey, matchType: SchemaMatchType): SchemaEntry | undefined {\r\n return this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));\r\n }\r\n\r\n private removeSchemaPromise(schemaKey: SchemaKey) {\r\n const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);\r\n if (entry)\r\n entry.schemaPromise = undefined;\r\n }\r\n\r\n private removeEntry(schemaKey: SchemaKey) {\r\n this._schema = this._schema.filter((entry: SchemaEntry) => !entry.schemaInfo.schemaKey.matches(schemaKey));\r\n }\r\n\r\n /**\r\n * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.\r\n * @param schemaKey The key to search for.\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (!entry)\r\n return undefined;\r\n\r\n if (entry.schemaPromise) {\r\n try {\r\n const schema = await entry.schemaPromise;\r\n return schema;\r\n } catch (e) {\r\n this.removeEntry(schemaKey);\r\n throw e;\r\n }\r\n }\r\n\r\n return entry.schema;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<SchemaInfo | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry)\r\n return entry.schemaInfo;\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): Iterable<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Iterable<Schema> {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @public @preview\r\n */\r\nexport class SchemaContext {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n private _fallbackLocaterDefined: boolean;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n this._fallbackLocaterDefined = false;\r\n }\r\n\r\n public get locaters(): ReadonlyArray<ISchemaLocater> { return this._locaters; }\r\n\r\n /**\r\n * Adds a locater to the context.\r\n *\r\n * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.\r\n * If a fallback locater is already defined, the new locater is inserted before the fallback locater.\r\n *\r\n * @param locater - The locater to be added.\r\n */\r\n public addLocater(locater: ISchemaLocater) {\r\n const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;\r\n this._locaters.splice(insertIndex, 0, locater);\r\n }\r\n\r\n /**\r\n * Adds a fallback locater to the context.\r\n *\r\n * If a fallback locater is already defined, it replaces the existing one.\r\n * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.\r\n *\r\n * @param locater - The locater to be added as a fallback.\r\n */\r\n public addFallbackLocater(locater: ISchemaLocater) {\r\n if (this._fallbackLocaterDefined) {\r\n this._locaters[this._locaters.length - 1] = locater;\r\n } else {\r\n this._locaters.push(locater);\r\n this._fallbackLocaterDefined = true;\r\n }\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this._knownSchemas.schemaExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.\r\n * Use this method over addSchema when asynchronously loading schemas\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = await locater.getSchema(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be gotten later from the context using [[getSchema]].\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined> {\r\n for (const locater of this._locaters) {\r\n const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);\r\n if (undefined !== schemaInfo)\r\n return schemaInfo;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = locater.getSchemaSync(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will await a partially loaded schema then return when it is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public async getCachedSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n return this._knownSchemas.getSchema(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public getCachedSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n return this._knownSchemas.getSchemaSync(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item.\r\n *\r\n * @param schemaNameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param itemNameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param itemConstructor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @examples\r\n * ```typescript\r\n * const schemaItem = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = await this.getSchema(schemaKey, SchemaMatchType.Latest);\r\n\r\n if (!schema)\r\n return undefined;\r\n\r\n if (typeof itemNameOrCtor === \"string\") // Separate schema and item name arguments with/without an itemConstructor\r\n return itemConstructor ? schema.getItem(itemNameOrCtor, itemConstructor) : schema.getItem(itemNameOrCtor);\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItem(schemaNameOrKey, itemNameOrCtor) : schema.lookupItem(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItem(schemaNameOrKey.name, itemNameOrCtor) : schema.getItem(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.\r\n *\r\n * @param nameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param nameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param ctor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @example\r\n * ```typescript\r\n * const schemaItem = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = this.getSchemaSync(schemaKey, SchemaMatchType.Latest);\r\n if (!schema)\r\n return undefined;\r\n\r\n // Separate schema and item name arguments with/without an itemConstructor\r\n if (typeof itemNameOrCtor === \"string\") {\r\n return itemConstructor ? schema.getItemSync(itemNameOrCtor, itemConstructor) : schema.getItemSync(itemNameOrCtor);\r\n }\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItemSync(schemaNameOrKey, itemNameOrCtor) : schema.lookupItemSync(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItemSync(schemaNameOrKey.name, itemNameOrCtor) : schema.getItemSync(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Iterates through the items of each schema known to the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public getSchemaItems(): Iterable<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Iterable<Schema> {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAiB,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAgD9C;;GAEG;AACH,MAAM,OAAO,WAAW;IACd,OAAO,CAAY;IAE3B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1C,kBAAkB,CAAC,SAAoB;QAC7C,OAAO,SAAS,KAAK,IAAI,CAAC,OA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AO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9H,CAAC;IAED;;;;;OAKG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @public @preview\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);\r\n }\r\n\r\n private schemaPromiseExists(schemaKey: SchemaKey): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);\r\n }\r\n\r\n private findEntry(schemaKey: SchemaKey, matchType: SchemaMatchType): SchemaEntry | undefined {\r\n return this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));\r\n }\r\n\r\n private removeSchemaPromise(schemaKey: SchemaKey) {\r\n const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);\r\n if (entry)\r\n entry.schemaPromise = undefined;\r\n }\r\n\r\n private removeEntry(schemaKey: SchemaKey) {\r\n this._schema = this._schema.filter((entry: SchemaEntry) => !entry.schemaInfo.schemaKey.matches(schemaKey));\r\n }\r\n\r\n /**\r\n * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.\r\n * @param schemaKey The key to search for.\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (!entry)\r\n return undefined;\r\n\r\n if (entry.schemaPromise) {\r\n try {\r\n const schema = await entry.schemaPromise;\r\n return schema;\r\n } catch (e) {\r\n this.removeEntry(schemaKey);\r\n throw e;\r\n }\r\n }\r\n\r\n return entry.schema;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<SchemaInfo | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry)\r\n return entry.schemaInfo;\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): Iterable<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Iterable<Schema> {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @public @preview\r\n */\r\nexport class SchemaContext {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n private _fallbackLocaterDefined: boolean;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n this._fallbackLocaterDefined = false;\r\n }\r\n\r\n public get locaters(): ReadonlyArray<ISchemaLocater> { return this._locaters; }\r\n\r\n /**\r\n * Adds a locater to the context.\r\n *\r\n * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.\r\n * If a fallback locater is already defined, the new locater is inserted before the fallback locater.\r\n *\r\n * @param locater - The locater to be added.\r\n */\r\n public addLocater(locater: ISchemaLocater) {\r\n const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;\r\n this._locaters.splice(insertIndex, 0, locater);\r\n }\r\n\r\n /**\r\n * Adds a fallback locater to the context.\r\n *\r\n * If a fallback locater is already defined, it replaces the existing one.\r\n * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.\r\n *\r\n * @param locater - The locater to be added as a fallback.\r\n */\r\n public addFallbackLocater(locater: ISchemaLocater) {\r\n if (this._fallbackLocaterDefined) {\r\n this._locaters[this._locaters.length - 1] = locater;\r\n } else {\r\n this._locaters.push(locater);\r\n this._fallbackLocaterDefined = true;\r\n }\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 - might be removed in next major version. use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: SchemaKey): boolean {\r\n return this._knownSchemas.schemaExists(schemaKey);\r\n }\r\n\r\n /**\r\n * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.\r\n * Use this method over addSchema when asynchronously loading schemas\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = await locater.getSchema(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be gotten later from the context using [[getSchema]].\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined> {\r\n for (const locater of this._locaters) {\r\n const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);\r\n if (undefined !== schemaInfo)\r\n return schemaInfo;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = locater.getSchemaSync(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will await a partially loaded schema then return when it is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public async getCachedSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<Schema | undefined> {\r\n return this._knownSchemas.getSchema(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public getCachedSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Schema | undefined {\r\n return this._knownSchemas.getSchemaSync(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item.\r\n *\r\n * @param schemaNameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param itemNameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param itemConstructor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @examples\r\n * ```typescript\r\n * const schemaItem = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = await schemaContext.getSchemaItem(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = await schemaContext.getSchemaItem(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = await schemaContext.getSchemaItem(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<InstanceType<T> | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<SchemaItem | undefined>\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = await this.getSchema(schemaKey, SchemaMatchType.Latest);\r\n\r\n if (!schema)\r\n return undefined;\r\n\r\n if (typeof itemNameOrCtor === \"string\") // Separate schema and item name arguments with/without an itemConstructor\r\n return itemConstructor ? schema.getItem(itemNameOrCtor, itemConstructor) : schema.getItem(itemNameOrCtor);\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItem(schemaNameOrKey, itemNameOrCtor) : schema.lookupItem(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItem(schemaNameOrKey.name, itemNameOrCtor) : schema.getItem(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.\r\n *\r\n * @param nameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.\r\n * @param nameOrCtor - The name of the item to return or the constructor of the item to return.\r\n * @param ctor - The constructor of the item to return.\r\n * @returns The requested schema item, or `undefined` if the item could not be found.\r\n *\r\n * @example\r\n * ```typescript\r\n * const schemaItem = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")));\r\n * const schemaItemWithCtor = schemaContext.getSchemaItemSync(new SchemaItemKey(\"TestElement\", new SchemaKey(\"TestSchema\")), EntityClass);\r\n * const schemaItemByName = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\");\r\n * const schemaItemByNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema\", \"TestElement\", EntityClass);\r\n * const schemaItemFullName = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameWithCtor = schemaContext.getSchemaItemSync(\"TestSchema:TestElement\", EntityClass);\r\n * const schemaItemFullNameSep = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * const schemaItemFullNameSepWithCtor = schemaContext.getSchemaItemSync(\"TestSchema.TestElement\", EntityClass);\r\n * ```\r\n */\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): InstanceType<T> | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): SchemaItem | undefined\r\n public getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T | string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\r\n let schemaKey: SchemaKey;\r\n if (typeof schemaNameOrKey === \"string\") {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);\r\n schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);\r\n } else {\r\n schemaKey = schemaNameOrKey.schemaKey;\r\n }\r\n\r\n const schema = this.getSchemaSync(schemaKey, SchemaMatchType.Latest);\r\n if (!schema)\r\n return undefined;\r\n\r\n // Separate schema and item name arguments with/without an itemConstructor\r\n if (typeof itemNameOrCtor === \"string\") {\r\n return itemConstructor ? schema.getItemSync(itemNameOrCtor, itemConstructor) : schema.getItemSync(itemNameOrCtor);\r\n }\r\n\r\n if (typeof schemaNameOrKey === \"string\") // Single schema item full name argument with/without an itemConstructor\r\n return itemNameOrCtor ? schema.lookupItemSync(schemaNameOrKey, itemNameOrCtor) : schema.lookupItemSync(schemaNameOrKey);\r\n\r\n // Schema Item Key with/without an itemConstructor\r\n return itemNameOrCtor ? schema.getItemSync(schemaNameOrKey.name, itemNameOrCtor) : schema.getItemSync(schemaNameOrKey.name);\r\n }\r\n\r\n /**\r\n * Iterates through the items of each schema known to the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public getSchemaItems(): Iterable<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Iterable<Schema> {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
|
package/lib/esm/ECObjects.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ export declare function parseSchemaItemType(type: string): SchemaItemType | unde
|
|
|
147
147
|
* @param value The SchemaItemType to stringify.
|
|
148
148
|
* @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.
|
|
149
149
|
* @beta
|
|
150
|
-
* @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly
|
|
150
|
+
* @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly
|
|
151
151
|
*/
|
|
152
152
|
export declare function schemaItemTypeToString(value: SchemaItemType): string;
|
|
153
153
|
/** @internal */
|
package/lib/esm/ECObjects.js
CHANGED
|
@@ -109,7 +109,7 @@ export var SchemaMatchType;
|
|
|
109
109
|
(function (SchemaMatchType) {
|
|
110
110
|
/*
|
|
111
111
|
* Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched
|
|
112
|
-
* @deprecated in 4.10 Use Exact instead.
|
|
112
|
+
* @deprecated in 4.10 - might be removed in next major version. Use Exact instead.
|
|
113
113
|
*/
|
|
114
114
|
SchemaMatchType[SchemaMatchType["Identical"] = 0] = "Identical";
|
|
115
115
|
/* Find exact VersionRead, VersionWrite, VersionMinor match. */
|
|
@@ -209,7 +209,7 @@ export function parseSchemaItemType(type) {
|
|
|
209
209
|
* @param value The SchemaItemType to stringify.
|
|
210
210
|
* @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.
|
|
211
211
|
* @beta
|
|
212
|
-
* @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly
|
|
212
|
+
* @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly
|
|
213
213
|
*/
|
|
214
214
|
export function schemaItemTypeToString(value) {
|
|
215
215
|
return value; // TODO: Remove
|
package/lib/esm/ECObjects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECObjects.js","sourceRoot":"","sources":["../../src/ECObjects.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,+HAA+H;AAC/H,IAAI,CAAE,MAAc,CAAC,aAAa,EAAE,CAAC;IAClC,MAAc,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,mDAAmD;IACnD,qDAAI,CAAA;IACJ,+DAA+D;IAC/D,6DAAQ,CAAA;IACR,4DAA4D;IAC5D,yDAAM,CAAA;AACR,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,cAeX;AAfD,WAAY,cAAc;IACxB,6CAA2B,CAAA;IAC3B,iCAAe,CAAA;IACf,6CAA2B,CAAA;IAC3B,+DAA6C,CAAA;IAC7C,yDAAuC,C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KAAK,SAAS,CAAC,CAAC,OAAO,iBAAiB,CAAC,OAAO,CAAC;QACjD,KAAK,UAAU,CAAC,CAAC,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACrD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,YAAY;AACZ,MAAM,UAAU,yBAAyB,CAAC,SAA4B;IACpE,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,iBAAiB,CAAC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;QACjD,KAAK,iBAAiB,CAAC,QAAQ,CAAC,CAAC,OAAO,UAAU,CAAC;QACnD;YACE,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,wBAAwB,EAAE,iDAAiD,CAAC,CAAC;IACxH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqB,EAAE,SAAkC;IACjG,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,SAAS,KAAK,sBAAsB,CAAC,KAAK,IAAI,CAC9C,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,KAAK;QAC9B,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,oBAAoB;QAC7C,KAAK,KAAK,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { ECStringConstants } from \"./Constants\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nexport { PropertyType } from \"./PropertyTypes\";\n\n// NEEDSWORK: This shim is currently required to use async iterators. See https://github.com/Microsoft/TypeScript/issues/14151\nif (!(Symbol as any).asyncIterator) {\n (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n}\n\n/**\n * Identifies a class as abstract or sealed\n *\n * @public @preview\n */\nexport enum ECClassModifier {\n /* normal, instantiable class, can be subclassed */\n None,\n /* abstract class, cannot be instantiated, can be subclassed */\n Abstract,\n /* sealed class, instantiable class, cannot be subclassed */\n Sealed,\n}\n\n/**\n * An enumeration that has all the schema item type names as values\n *\n * @enum {string}\n * @public @preview\n */\nexport enum SchemaItemType {\n EntityClass = \"EntityClass\",\n Mixin = \"Mixin\",\n StructClass = \"StructClass\",\n CustomAttributeClass = \"CustomAttributeClass\",\n RelationshipClass = \"RelationshipClass\",\n Enumeration = \"Enumeration\",\n KindOfQuantity = \"KindOfQuantity\",\n PropertyCategory = \"PropertyCategory\",\n Unit = \"Unit\",\n InvertedUnit = \"InvertedUnit\",\n Constant = \"Constant\",\n Phenomenon = \"Phenomenon\",\n UnitSystem = \"UnitSystem\",\n Format = \"Format\",\n}\n\n/**\n * Additional Schema Item Types which define classes of item types\n * @public @preview\n */\nexport enum AbstractSchemaItemType {\n /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */\n Class = \"Class\",\n /* Any item type including the Class types */\n SchemaItem = \"SchemaItem\",\n}\n\n/**\n * Defines types of items that may be provided to identify supported items\n * @public @preview\n */\nexport type SupportedSchemaItemType = SchemaItemType | AbstractSchemaItemType;\n\n/**\n * Primitive data types for ECProperties.\n * @public @preview\n */\nexport enum PrimitiveType {\n Uninitialized = 0x00,\n Binary = 0x101,\n Boolean = 0x201,\n DateTime = 0x301,\n Double = 0x401,\n Integer = 0x501,\n Long = 0x601,\n Point2d = 0x701,\n Point3d = 0x801,\n String = 0x901,\n IGeometry = 0xa01,\n}\n\n/**\n * Defines the valid CustomAttribute container types.\n * @public @preview\n */\nexport enum CustomAttributeContainerType {\n Schema = 0x0001 << 0,\n EntityClass = 0x0001 << 1,\n CustomAttributeClass = 0x0001 << 2,\n StructClass = 0x0001 << 3,\n RelationshipClass = 0x0001 << 4,\n AnyClass = EntityClass | CustomAttributeClass | StructClass | RelationshipClass,\n PrimitiveProperty = 0x0001 << 5,\n StructProperty = 0x0001 << 6,\n PrimitiveArrayProperty = 0x0001 << 7,\n StructArrayProperty = 0x0001 << 8,\n NavigationProperty = 0x0001 << 9,\n AnyProperty = PrimitiveProperty | StructProperty | PrimitiveArrayProperty | StructArrayProperty | NavigationProperty,\n SourceRelationshipConstraint = 0x0001 << 10,\n TargetRelationshipConstraint = 0x0001 << 11,\n AnyRelationshipConstraint = SourceRelationshipConstraint | TargetRelationshipConstraint,\n Any = Schema | AnyClass | AnyProperty | AnyRelationshipConstraint,\n}\n\n/**\n * Defines what sort of match should be used when locating a schema.\n * @public @preview\n */\nexport enum SchemaMatchType {\n /*\n * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched\n * @deprecated in 4.10 Use Exact instead.\n */\n Identical,\n /* Find exact VersionRead, VersionWrite, VersionMinor match. */\n Exact,\n /* Find latest version with matching VersionRead and VersionWrite */\n LatestWriteCompatible,\n /* Find latest version. */\n Latest,\n /* Find latest version with matching VersionRead */\n LatestReadCompatible,\n}\n\n/**\n * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.\n * @public @preview\n */\nexport enum RelationshipEnd {\n Source = 0,\n Target = 1,\n}\n\n/**\n * Defines the how the lifetime of the source and target are related.\n *\n * @public @preview */\nexport enum StrengthType {\n Referencing,\n Holding,\n Embedding,\n}\n\n/**\n * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.\n *\n * @public @preview */\nexport enum StrengthDirection {\n /** The source is the starting point of the relationship. */\n Forward = 1,\n /** The target is the starting point of the relationship. */\n Backward = 2,\n}\n\n// Helper methods for going to/from string for the above Enumerations.\n\n/**\n * Parses the provided string into an ECClassModifier if the string is a valid modifier.\n * @param modifier The modifier string to parse.\n * @beta\n */\nexport function parseClassModifier(modifier: string): ECClassModifier | undefined {\n const lowerModifier = modifier.toLowerCase();\n switch (lowerModifier) {\n case \"abstract\": return ECClassModifier.Abstract;\n case \"none\": return ECClassModifier.None;\n case \"sealed\": return ECClassModifier.Sealed;\n }\n return undefined;\n}\n\n/**\n * @return A string representing the provided ECClassModifier. If the modifier is not valid, an empty string is returned.\n * @beta\n */\nexport function classModifierToString(modifier: ECClassModifier): string {\n switch (modifier) {\n case ECClassModifier.Abstract: return \"Abstract\";\n case ECClassModifier.None: return \"None\";\n case ECClassModifier.Sealed: return \"Sealed\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, \"An invalid ECClassModifier has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 8 schema item types.\n * @param type The schema item type string to parse.\n * @returns A valid SchemaItemType if successfully parsed. Otherwise, undefined if the provided string is not a valid SchemaItemType.\n * @beta\n */\nexport function parseSchemaItemType(type: string): SchemaItemType | undefined {\n switch (type.toLowerCase()) {\n case \"entityclass\": return SchemaItemType.EntityClass;\n case \"mixin\": return SchemaItemType.Mixin;\n case \"structclass\": return SchemaItemType.StructClass;\n case \"customattributeclass\": return SchemaItemType.CustomAttributeClass;\n case \"relationshipclass\": return SchemaItemType.RelationshipClass;\n case \"enumeration\": return SchemaItemType.Enumeration;\n case \"kindofquantity\": return SchemaItemType.KindOfQuantity;\n case \"propertycategory\": return SchemaItemType.PropertyCategory;\n case \"unit\": return SchemaItemType.Unit;\n case \"invertedunit\": return SchemaItemType.InvertedUnit;\n case \"constant\": return SchemaItemType.Constant;\n case \"phenomenon\": return SchemaItemType.Phenomenon;\n case \"unitsystem\": return SchemaItemType.UnitSystem;\n case \"format\": return SchemaItemType.Format;\n }\n return undefined;\n}\n\n/**\n * Converts a valid SchemaItemType to a display string.\n * @param value The SchemaItemType to stringify.\n * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.\n * @beta\n * @deprecated in 4.6.0 SchemaItemType is a string enum so just use it directly\n */\nexport function schemaItemTypeToString(value: SchemaItemType): string {\n return value; // TODO: Remove\n}\n\n/** @internal */\nexport function schemaItemTypeToXmlString(value: SchemaItemType): string {\n switch (value) {\n case SchemaItemType.EntityClass: return \"ECEntityClass\";\n case SchemaItemType.Mixin: return \"ECEntityClass\";\n case SchemaItemType.StructClass: return \"ECStructClass\";\n case SchemaItemType.CustomAttributeClass: return \"ECCustomAttributeClass\";\n case SchemaItemType.RelationshipClass: return \"ECRelationshipClass\";\n case SchemaItemType.Enumeration: return \"ECEnumeration\";\n case SchemaItemType.KindOfQuantity: return \"KindOfQuantity\";\n case SchemaItemType.PropertyCategory: return \"PropertyCategory\";\n case SchemaItemType.Unit: return \"Unit\";\n case SchemaItemType.InvertedUnit: return \"InvertedUnit\";\n case SchemaItemType.Constant: return \"Constant\";\n case SchemaItemType.Phenomenon: return \"Phenomenon\";\n case SchemaItemType.UnitSystem: return \"UnitSystem\";\n case SchemaItemType.Format: return \"Format\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, \"An invalid SchemaItemType has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 10 primitive types.\n * @param type The primitive type string to parse.\n * @returns A valid PrimitiveType if successfully parsed, or undefined if the provided string is not a valid PrimitiveType.\n * @beta\n */\nexport function parsePrimitiveType(type: string): PrimitiveType | undefined {\n switch (type.toLowerCase()) {\n case \"binary\": return PrimitiveType.Binary;\n case \"boolean\": case \"bool\": return PrimitiveType.Boolean;\n case \"datetime\": return PrimitiveType.DateTime;\n case \"double\": return PrimitiveType.Double;\n case \"int\": return PrimitiveType.Integer;\n case \"long\": return PrimitiveType.Long;\n case \"point2d\": return PrimitiveType.Point2d;\n case \"point3d\": return PrimitiveType.Point3d;\n case \"string\": return PrimitiveType.String;\n case \"bentley.geometry.common.igeometry\": return PrimitiveType.IGeometry;\n }\n\n return undefined;\n}\n\n/** @beta */\nexport function primitiveTypeToString(type: PrimitiveType): string {\n switch (type) {\n case PrimitiveType.Binary: return \"binary\";\n case PrimitiveType.Boolean: return \"boolean\";\n case PrimitiveType.DateTime: return \"dateTime\";\n case PrimitiveType.Double: return \"double\";\n case PrimitiveType.Integer: return \"int\";\n case PrimitiveType.IGeometry: return \"Bentley.Geometry.Common.IGeometry\";\n case PrimitiveType.Long: return \"long\";\n case PrimitiveType.Point2d: return \"point2d\";\n case PrimitiveType.Point3d: return \"point3d\";\n case PrimitiveType.String: return \"string\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, \"An invalid PrimitiveType has been provided.\");\n }\n}\n\n/**\n * Parses the given string into the appropriate CustomAttributeContainerType if the string is valid.\n * @param type The container type string to parse.\n * @beta\n */\nexport function parseCustomAttributeContainerType(type: string): CustomAttributeContainerType | undefined {\n const typeTokens = type.split(/[|,;]+/);\n\n let containerType = 0;\n\n typeTokens.forEach((typeToken) => {\n typeToken = typeToken.trim();\n if (typeToken.length === 0) return;\n\n typeToken = typeToken.toLowerCase();\n switch (typeToken) {\n case \"schema\":\n containerType = containerType | CustomAttributeContainerType.Schema;\n break;\n case \"entityclass\":\n containerType = containerType | CustomAttributeContainerType.EntityClass;\n break;\n case \"customattributeclass\":\n containerType = containerType | CustomAttributeContainerType.CustomAttributeClass;\n break;\n case \"structclass\":\n containerType = containerType | CustomAttributeContainerType.StructClass;\n break;\n case \"relationshipclass\":\n containerType = containerType | CustomAttributeContainerType.RelationshipClass;\n break;\n case \"anyclass\":\n containerType = containerType | CustomAttributeContainerType.AnyClass;\n break;\n case \"primitiveproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveProperty;\n break;\n case \"structproperty\":\n containerType = containerType | CustomAttributeContainerType.StructProperty;\n break;\n case \"arrayproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveArrayProperty;\n break;\n case \"structarrayproperty\":\n containerType = containerType | CustomAttributeContainerType.StructArrayProperty;\n break;\n case \"navigationproperty\":\n containerType = containerType | CustomAttributeContainerType.NavigationProperty;\n break;\n case \"anyproperty\":\n containerType = containerType | CustomAttributeContainerType.AnyProperty;\n break;\n case \"sourcerelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.SourceRelationshipConstraint;\n break;\n case \"targetrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.TargetRelationshipConstraint;\n break;\n case \"anyrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.AnyRelationshipConstraint;\n break;\n case \"any\":\n containerType = containerType | CustomAttributeContainerType.Any;\n break;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);\n }\n });\n\n return containerType as CustomAttributeContainerType;\n}\n\n/**\n * Creates a string representing a valid CustomAttributeContainerType.\n * @param value The CustomAttributeContainerType to stringify.\n * @return A string representing the provided CustomAttributeContainerType. If the type is not valid, an empty string is returned.\n * @beta\n */\nexport function containerTypeToString(type: CustomAttributeContainerType): string {\n const testContainerTypeValue = (compareType: CustomAttributeContainerType, otherType: CustomAttributeContainerType) => {\n return compareType === (compareType & otherType);\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Any, type))\n return ECStringConstants.CONTAINERTYPE_ANY;\n\n let containerType = \"\";\n const setOrAppend = (val: string) => {\n if (containerType.length === 0) containerType = val;\n else containerType = `${containerType}, ${val}`;\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Schema, type))\n setOrAppend(\"Schema\");\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyClass, type))\n setOrAppend(\"AnyClass\");\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.EntityClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ENTITYCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.CustomAttributeClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.StructClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.RelationshipClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYPROPERTY);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.NavigationProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.SourceRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT);\n if (testContainerTypeValue(CustomAttributeContainerType.TargetRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT);\n }\n\n return containerType;\n}\n\n/** @beta */\nexport function parseRelationshipEnd(end: string): RelationshipEnd | undefined {\n switch (end.toLowerCase()) {\n case \"source\": return RelationshipEnd.Source;\n case \"target\": return RelationshipEnd.Target;\n }\n return undefined;\n}\n\n/** @beta */\nexport function relationshipEndToString(end: RelationshipEnd): string {\n switch (end) {\n case RelationshipEnd.Source: return ECStringConstants.RELATIONSHIP_END_SOURCE;\n case RelationshipEnd.Target: return ECStringConstants.RELATIONSHIP_END_TARGET;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);\n }\n}\n\n/**\n * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.\n * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid\n * @param strength\n * @beta\n */\nexport function parseStrength(strength: string): StrengthType | undefined {\n switch (strength.toLowerCase()) {\n case \"referencing\": return StrengthType.Referencing;\n case \"holding\": return StrengthType.Holding;\n case \"embedding\": return StrengthType.Embedding;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthToString(strength: StrengthType): string {\n switch (strength) {\n case StrengthType.Embedding: return \"Embedding\";\n case StrengthType.Holding: return \"Holding\";\n case StrengthType.Referencing: return \"Referencing\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);\n }\n}\n\n/** @beta */\nexport function parseStrengthDirection(direction: string): StrengthDirection | undefined {\n switch (direction.toLowerCase()) {\n case \"forward\": return StrengthDirection.Forward;\n case \"backward\": return StrengthDirection.Backward;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthDirectionToString(direction: StrengthDirection): string {\n switch (direction) {\n case StrengthDirection.Forward: return \"Forward\";\n case StrengthDirection.Backward: return \"Backward\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);\n }\n}\n\n/** Compares a SchemaItemType against supported type.\n * @beta\n */\nexport function isSupportedSchemaItemType(value: SchemaItemType, supported: SupportedSchemaItemType): boolean {\n if (value === supported) return true;\n\n if (supported === AbstractSchemaItemType.Class && (\n value === SchemaItemType.EntityClass ||\n value === SchemaItemType.Mixin ||\n value === SchemaItemType.StructClass ||\n value === SchemaItemType.CustomAttributeClass ||\n value === SchemaItemType.RelationshipClass)) {\n return true;\n }\n\n if (supported === AbstractSchemaItemType.SchemaItem) {\n return true;\n }\n\n return false;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ECObjects.js","sourceRoot":"","sources":["../../src/ECObjects.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,+HAA+H;AAC/H,IAAI,CAAE,MAAc,CAAC,aAAa,EAAE,CAAC;IAClC,MAAc,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,mDAAmD;IACnD,qDAAI,CAAA;IACJ,+DAA+D;IAC/D,6DAAQ,CAAA;IACR,4DAA4D;IAC5D,yDAAM,CAAA;AACR,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,cAeX;AAfD,WAAY,cAAc;IACxB,6CAA2B,CAAA;IAC3B,iCAAe,CAAA;IACf,6CAA2B,CAAA;IAC3B,+DAA6C,CAAA;IAC7C,yDAAuC,CAAA;IACvC,6CAA2B,CAAA;IAC3B,mDAAiC,CAAA;IACjC,uDAAqC,CAAA;IACrC,+BAAa,CAAA;IACb,+CAA6B,CAAA;IAC7B,uCAAqB,CAAA;IACrB,2CAAyB,CAAA;IACzB,2CAAyB,CAAA;IACzB,mCAAiB,CAAA;AACnB,CAAC,EAfW,cAAc,KAAd,cAAc,QAezB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,yFAAyF;IACzF,yCAAe,CAAA;IACf,6CAA6C;IAC7C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AC,CAAC,OAAO,UAAU,CAAC;QACnD;YACE,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,wBAAwB,EAAE,iDAAiD,CAAC,CAAC;IACxH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqB,EAAE,SAAkC;IACjG,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,SAAS,KAAK,sBAAsB,CAAC,KAAK,IAAI,CAChD,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,KAAK;QAC9B,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,oBAAoB;QAC7C,KAAK,KAAK,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { ECStringConstants } from \"./Constants\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nexport { PropertyType } from \"./PropertyTypes\";\n\n// NEEDSWORK: This shim is currently required to use async iterators. See https://github.com/Microsoft/TypeScript/issues/14151\nif (!(Symbol as any).asyncIterator) {\n (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n}\n\n/**\n * Identifies a class as abstract or sealed\n *\n * @public @preview\n */\nexport enum ECClassModifier {\n /* normal, instantiable class, can be subclassed */\n None,\n /* abstract class, cannot be instantiated, can be subclassed */\n Abstract,\n /* sealed class, instantiable class, cannot be subclassed */\n Sealed,\n}\n\n/**\n * An enumeration that has all the schema item type names as values\n *\n * @enum {string}\n * @public @preview\n */\nexport enum SchemaItemType {\n EntityClass = \"EntityClass\",\n Mixin = \"Mixin\",\n StructClass = \"StructClass\",\n CustomAttributeClass = \"CustomAttributeClass\",\n RelationshipClass = \"RelationshipClass\",\n Enumeration = \"Enumeration\",\n KindOfQuantity = \"KindOfQuantity\",\n PropertyCategory = \"PropertyCategory\",\n Unit = \"Unit\",\n InvertedUnit = \"InvertedUnit\",\n Constant = \"Constant\",\n Phenomenon = \"Phenomenon\",\n UnitSystem = \"UnitSystem\",\n Format = \"Format\",\n}\n\n/**\n * Additional Schema Item Types which define classes of item types\n * @public @preview\n */\nexport enum AbstractSchemaItemType {\n /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */\n Class = \"Class\",\n /* Any item type including the Class types */\n SchemaItem = \"SchemaItem\",\n}\n\n/**\n * Defines types of items that may be provided to identify supported items\n * @public @preview\n */\nexport type SupportedSchemaItemType = SchemaItemType | AbstractSchemaItemType;\n\n/**\n * Primitive data types for ECProperties.\n * @public @preview\n */\nexport enum PrimitiveType {\n Uninitialized = 0x00,\n Binary = 0x101,\n Boolean = 0x201,\n DateTime = 0x301,\n Double = 0x401,\n Integer = 0x501,\n Long = 0x601,\n Point2d = 0x701,\n Point3d = 0x801,\n String = 0x901,\n IGeometry = 0xa01,\n}\n\n/**\n * Defines the valid CustomAttribute container types.\n * @public @preview\n */\nexport enum CustomAttributeContainerType {\n Schema = 0x0001 << 0,\n EntityClass = 0x0001 << 1,\n CustomAttributeClass = 0x0001 << 2,\n StructClass = 0x0001 << 3,\n RelationshipClass = 0x0001 << 4,\n AnyClass = EntityClass | CustomAttributeClass | StructClass | RelationshipClass,\n PrimitiveProperty = 0x0001 << 5,\n StructProperty = 0x0001 << 6,\n PrimitiveArrayProperty = 0x0001 << 7,\n StructArrayProperty = 0x0001 << 8,\n NavigationProperty = 0x0001 << 9,\n AnyProperty = PrimitiveProperty | StructProperty | PrimitiveArrayProperty | StructArrayProperty | NavigationProperty,\n SourceRelationshipConstraint = 0x0001 << 10,\n TargetRelationshipConstraint = 0x0001 << 11,\n AnyRelationshipConstraint = SourceRelationshipConstraint | TargetRelationshipConstraint,\n Any = Schema | AnyClass | AnyProperty | AnyRelationshipConstraint,\n}\n\n/**\n * Defines what sort of match should be used when locating a schema.\n * @public @preview\n */\nexport enum SchemaMatchType {\n /*\n * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched\n * @deprecated in 4.10 - might be removed in next major version. Use Exact instead.\n */\n Identical,\n /* Find exact VersionRead, VersionWrite, VersionMinor match. */\n Exact,\n /* Find latest version with matching VersionRead and VersionWrite */\n LatestWriteCompatible,\n /* Find latest version. */\n Latest,\n /* Find latest version with matching VersionRead */\n LatestReadCompatible,\n}\n\n/**\n * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.\n * @public @preview\n */\nexport enum RelationshipEnd {\n Source = 0,\n Target = 1,\n}\n\n/**\n * Defines the how the lifetime of the source and target are related.\n *\n * @public @preview */\nexport enum StrengthType {\n Referencing,\n Holding,\n Embedding,\n}\n\n/**\n * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.\n *\n * @public @preview */\nexport enum StrengthDirection {\n /** The source is the starting point of the relationship. */\n Forward = 1,\n /** The target is the starting point of the relationship. */\n Backward = 2,\n}\n\n// Helper methods for going to/from string for the above Enumerations.\n\n/**\n * Parses the provided string into an ECClassModifier if the string is a valid modifier.\n * @param modifier The modifier string to parse.\n * @beta\n */\nexport function parseClassModifier(modifier: string): ECClassModifier | undefined {\n const lowerModifier = modifier.toLowerCase();\n switch (lowerModifier) {\n case \"abstract\": return ECClassModifier.Abstract;\n case \"none\": return ECClassModifier.None;\n case \"sealed\": return ECClassModifier.Sealed;\n }\n return undefined;\n}\n\n/**\n * @return A string representing the provided ECClassModifier. If the modifier is not valid, an empty string is returned.\n * @beta\n */\nexport function classModifierToString(modifier: ECClassModifier): string {\n switch (modifier) {\n case ECClassModifier.Abstract: return \"Abstract\";\n case ECClassModifier.None: return \"None\";\n case ECClassModifier.Sealed: return \"Sealed\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, \"An invalid ECClassModifier has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 8 schema item types.\n * @param type The schema item type string to parse.\n * @returns A valid SchemaItemType if successfully parsed. Otherwise, undefined if the provided string is not a valid SchemaItemType.\n * @beta\n */\nexport function parseSchemaItemType(type: string): SchemaItemType | undefined {\n switch (type.toLowerCase()) {\n case \"entityclass\": return SchemaItemType.EntityClass;\n case \"mixin\": return SchemaItemType.Mixin;\n case \"structclass\": return SchemaItemType.StructClass;\n case \"customattributeclass\": return SchemaItemType.CustomAttributeClass;\n case \"relationshipclass\": return SchemaItemType.RelationshipClass;\n case \"enumeration\": return SchemaItemType.Enumeration;\n case \"kindofquantity\": return SchemaItemType.KindOfQuantity;\n case \"propertycategory\": return SchemaItemType.PropertyCategory;\n case \"unit\": return SchemaItemType.Unit;\n case \"invertedunit\": return SchemaItemType.InvertedUnit;\n case \"constant\": return SchemaItemType.Constant;\n case \"phenomenon\": return SchemaItemType.Phenomenon;\n case \"unitsystem\": return SchemaItemType.UnitSystem;\n case \"format\": return SchemaItemType.Format;\n }\n return undefined;\n}\n\n/**\n * Converts a valid SchemaItemType to a display string.\n * @param value The SchemaItemType to stringify.\n * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.\n * @beta\n * @deprecated in 4.6.0 - might be removed in next major version. SchemaItemType is a string enum so just use it directly\n */\nexport function schemaItemTypeToString(value: SchemaItemType): string {\n return value; // TODO: Remove\n}\n\n/** @internal */\nexport function schemaItemTypeToXmlString(value: SchemaItemType): string {\n switch (value) {\n case SchemaItemType.EntityClass: return \"ECEntityClass\";\n case SchemaItemType.Mixin: return \"ECEntityClass\";\n case SchemaItemType.StructClass: return \"ECStructClass\";\n case SchemaItemType.CustomAttributeClass: return \"ECCustomAttributeClass\";\n case SchemaItemType.RelationshipClass: return \"ECRelationshipClass\";\n case SchemaItemType.Enumeration: return \"ECEnumeration\";\n case SchemaItemType.KindOfQuantity: return \"KindOfQuantity\";\n case SchemaItemType.PropertyCategory: return \"PropertyCategory\";\n case SchemaItemType.Unit: return \"Unit\";\n case SchemaItemType.InvertedUnit: return \"InvertedUnit\";\n case SchemaItemType.Constant: return \"Constant\";\n case SchemaItemType.Phenomenon: return \"Phenomenon\";\n case SchemaItemType.UnitSystem: return \"UnitSystem\";\n case SchemaItemType.Format: return \"Format\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, \"An invalid SchemaItemType has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 10 primitive types.\n * @param type The primitive type string to parse.\n * @returns A valid PrimitiveType if successfully parsed, or undefined if the provided string is not a valid PrimitiveType.\n * @beta\n */\nexport function parsePrimitiveType(type: string): PrimitiveType | undefined {\n switch (type.toLowerCase()) {\n case \"binary\": return PrimitiveType.Binary;\n case \"boolean\": case \"bool\": return PrimitiveType.Boolean;\n case \"datetime\": return PrimitiveType.DateTime;\n case \"double\": return PrimitiveType.Double;\n case \"int\": return PrimitiveType.Integer;\n case \"long\": return PrimitiveType.Long;\n case \"point2d\": return PrimitiveType.Point2d;\n case \"point3d\": return PrimitiveType.Point3d;\n case \"string\": return PrimitiveType.String;\n case \"bentley.geometry.common.igeometry\": return PrimitiveType.IGeometry;\n }\n\n return undefined;\n}\n\n/** @beta */\nexport function primitiveTypeToString(type: PrimitiveType): string {\n switch (type) {\n case PrimitiveType.Binary: return \"binary\";\n case PrimitiveType.Boolean: return \"boolean\";\n case PrimitiveType.DateTime: return \"dateTime\";\n case PrimitiveType.Double: return \"double\";\n case PrimitiveType.Integer: return \"int\";\n case PrimitiveType.IGeometry: return \"Bentley.Geometry.Common.IGeometry\";\n case PrimitiveType.Long: return \"long\";\n case PrimitiveType.Point2d: return \"point2d\";\n case PrimitiveType.Point3d: return \"point3d\";\n case PrimitiveType.String: return \"string\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, \"An invalid PrimitiveType has been provided.\");\n }\n}\n\n/**\n * Parses the given string into the appropriate CustomAttributeContainerType if the string is valid.\n * @param type The container type string to parse.\n * @beta\n */\nexport function parseCustomAttributeContainerType(type: string): CustomAttributeContainerType | undefined {\n const typeTokens = type.split(/[|,;]+/);\n\n let containerType = 0;\n\n typeTokens.forEach((typeToken) => {\n typeToken = typeToken.trim();\n if (typeToken.length === 0) return;\n\n typeToken = typeToken.toLowerCase();\n switch (typeToken) {\n case \"schema\":\n containerType = containerType | CustomAttributeContainerType.Schema;\n break;\n case \"entityclass\":\n containerType = containerType | CustomAttributeContainerType.EntityClass;\n break;\n case \"customattributeclass\":\n containerType = containerType | CustomAttributeContainerType.CustomAttributeClass;\n break;\n case \"structclass\":\n containerType = containerType | CustomAttributeContainerType.StructClass;\n break;\n case \"relationshipclass\":\n containerType = containerType | CustomAttributeContainerType.RelationshipClass;\n break;\n case \"anyclass\":\n containerType = containerType | CustomAttributeContainerType.AnyClass;\n break;\n case \"primitiveproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveProperty;\n break;\n case \"structproperty\":\n containerType = containerType | CustomAttributeContainerType.StructProperty;\n break;\n case \"arrayproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveArrayProperty;\n break;\n case \"structarrayproperty\":\n containerType = containerType | CustomAttributeContainerType.StructArrayProperty;\n break;\n case \"navigationproperty\":\n containerType = containerType | CustomAttributeContainerType.NavigationProperty;\n break;\n case \"anyproperty\":\n containerType = containerType | CustomAttributeContainerType.AnyProperty;\n break;\n case \"sourcerelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.SourceRelationshipConstraint;\n break;\n case \"targetrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.TargetRelationshipConstraint;\n break;\n case \"anyrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.AnyRelationshipConstraint;\n break;\n case \"any\":\n containerType = containerType | CustomAttributeContainerType.Any;\n break;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);\n }\n });\n\n return containerType as CustomAttributeContainerType;\n}\n\n/**\n * Creates a string representing a valid CustomAttributeContainerType.\n * @param value The CustomAttributeContainerType to stringify.\n * @return A string representing the provided CustomAttributeContainerType. If the type is not valid, an empty string is returned.\n * @beta\n */\nexport function containerTypeToString(type: CustomAttributeContainerType): string {\n const testContainerTypeValue = (compareType: CustomAttributeContainerType, otherType: CustomAttributeContainerType) => {\n return compareType === (compareType & otherType);\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Any, type))\n return ECStringConstants.CONTAINERTYPE_ANY;\n\n let containerType = \"\";\n const setOrAppend = (val: string) => {\n if (containerType.length === 0) containerType = val;\n else containerType = `${containerType}, ${val}`;\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Schema, type))\n setOrAppend(\"Schema\");\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyClass, type))\n setOrAppend(\"AnyClass\");\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.EntityClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ENTITYCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.CustomAttributeClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.StructClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.RelationshipClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYPROPERTY);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.NavigationProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.SourceRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT);\n if (testContainerTypeValue(CustomAttributeContainerType.TargetRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT);\n }\n\n return containerType;\n}\n\n/** @beta */\nexport function parseRelationshipEnd(end: string): RelationshipEnd | undefined {\n switch (end.toLowerCase()) {\n case \"source\": return RelationshipEnd.Source;\n case \"target\": return RelationshipEnd.Target;\n }\n return undefined;\n}\n\n/** @beta */\nexport function relationshipEndToString(end: RelationshipEnd): string {\n switch (end) {\n case RelationshipEnd.Source: return ECStringConstants.RELATIONSHIP_END_SOURCE;\n case RelationshipEnd.Target: return ECStringConstants.RELATIONSHIP_END_TARGET;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);\n }\n}\n\n/**\n * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.\n * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid\n * @param strength\n * @beta\n */\nexport function parseStrength(strength: string): StrengthType | undefined {\n switch (strength.toLowerCase()) {\n case \"referencing\": return StrengthType.Referencing;\n case \"holding\": return StrengthType.Holding;\n case \"embedding\": return StrengthType.Embedding;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthToString(strength: StrengthType): string {\n switch (strength) {\n case StrengthType.Embedding: return \"Embedding\";\n case StrengthType.Holding: return \"Holding\";\n case StrengthType.Referencing: return \"Referencing\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);\n }\n}\n\n/** @beta */\nexport function parseStrengthDirection(direction: string): StrengthDirection | undefined {\n switch (direction.toLowerCase()) {\n case \"forward\": return StrengthDirection.Forward;\n case \"backward\": return StrengthDirection.Backward;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthDirectionToString(direction: StrengthDirection): string {\n switch (direction) {\n case StrengthDirection.Forward: return \"Forward\";\n case StrengthDirection.Backward: return \"Backward\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);\n }\n}\n\n/** Compares a SchemaItemType against supported type.\n * @beta\n */\nexport function isSupportedSchemaItemType(value: SchemaItemType, supported: SupportedSchemaItemType): boolean {\n if (value === supported) return true;\n\n if (supported === AbstractSchemaItemType.Class && (\n value === SchemaItemType.EntityClass ||\n value === SchemaItemType.Mixin ||\n value === SchemaItemType.StructClass ||\n value === SchemaItemType.CustomAttributeClass ||\n value === SchemaItemType.RelationshipClass)) {\n return true;\n }\n\n if (supported === AbstractSchemaItemType.SchemaItem) {\n return true;\n }\n\n return false;\n}\n"]}
|
|
@@ -15,7 +15,7 @@ export declare class CustomAttributeClass extends ECClass {
|
|
|
15
15
|
static get schemaItemType(): SchemaItemType;
|
|
16
16
|
private _appliesTo?;
|
|
17
17
|
/**
|
|
18
|
-
* @deprecated in 4.8 use [[appliesTo]]
|
|
18
|
+
* @deprecated in 4.8 - might be removed in next major version. use [[appliesTo]]
|
|
19
19
|
* */
|
|
20
20
|
get containerType(): CustomAttributeContainerType;
|
|
21
21
|
get appliesTo(): CustomAttributeContainerType;
|
|
@@ -18,7 +18,7 @@ export class CustomAttributeClass extends ECClass {
|
|
|
18
18
|
static get schemaItemType() { return SchemaItemType.CustomAttributeClass; }
|
|
19
19
|
_appliesTo;
|
|
20
20
|
/**
|
|
21
|
-
* @deprecated in 4.8 use [[appliesTo]]
|
|
21
|
+
* @deprecated in 4.8 - might be removed in next major version. use [[appliesTo]]
|
|
22
22
|
* */
|
|
23
23
|
get containerType() {
|
|
24
24
|
return this.appliesTo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAttributeClass.js","sourceRoot":"","sources":["../../../src/Metadata/CustomAttributeClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACL,qBAAqB,EAAgC,iCAAiC,EAAE,cAAc,GACvG,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,OAAO;IACtB,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC;IAC9E,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACnF,UAAU,CAAgC;IAElD;;SAEK;IACL,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,SAAS;QAClB,IAAI,SAAS,KAAK,IAAI,CAAC,UAAU;YAC/B,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,oBAAoB,EAAE,4BAA4B,IAAI,CAAC,IAAI,gDAAgD,CAAC,CAAC;QACtJ,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACa,MAAM,CAAC,aAA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QAC1D,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YACpC,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,qBAAqB,EAAE,aAAa,cAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAC9I,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,cAAe,SAAQ,oBAAoB;CAGhE","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\nimport {\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { ECClass } from \"./Class\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECCustomAttributeClass.\n * @public @preview\n */\nexport class CustomAttributeClass extends ECClass {\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\n private _appliesTo?: CustomAttributeContainerType;\n\n /**\n * @deprecated in 4.8 use [[appliesTo]]\n * */\n public get containerType(): CustomAttributeContainerType {\n return this.appliesTo;\n }\n\n public get appliesTo(): CustomAttributeContainerType {\n if (undefined === this._appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);\n return this._appliesTo;\n }\n\n /**\n * Save this CustomAttributeClasses properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): CustomAttributeClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.appliesTo = containerTypeToString(this.appliesTo);\n return schemaJson as CustomAttributeClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"appliesTo\", containerTypeToString(this.appliesTo));\n return itemElement;\n }\n\n public override fromJSONSync(customAttributeProps: CustomAttributeClassProps) {\n super.fromJSONSync(customAttributeProps);\n const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);\n if (undefined === appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);\n this._appliesTo = appliesTo;\n }\n\n public override async fromJSON(customAttributeProps: CustomAttributeClassProps) {\n this.fromJSONSync(customAttributeProps);\n }\n\n /**\n * @internal\n */\n protected setAppliesTo(containerType: CustomAttributeContainerType) {\n this._appliesTo = containerType;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a CustomAttributeClass, false otherwise.\n */\n public static isCustomAttributeClass(item?: SchemaItem): item is CustomAttributeClass {\n if (item && item.schemaItemType === SchemaItemType.CustomAttributeClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.\n * @internal\n */\n public static assertIsCustomAttributeClass(item?: SchemaItem): asserts item is CustomAttributeClass {\n if (!this.isCustomAttributeClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);\n }\n}\n/**\n * @internal\n * An abstract class used for Schema editing.\n */\nexport abstract class MutableCAClass extends CustomAttributeClass {\n public abstract override setAppliesTo(containerType: CustomAttributeContainerType): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"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,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7E,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,YAAY,CAAC,oBAA+C;QAC1E,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;QACzC,MAAM,SAAS,GAAG,iCAAiC,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACpF,IAAI,SAAS,KAAK,SAAS;YACzB,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,oBAAoB,EAAE,GAAG,SAAS,+CAA+C,CAAC,CAAC;QAC5H,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,oBAA+C;QAC5E,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACO,YAAY,CAAC,aAA2C;QAChE,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC,oBAAoB;YACrE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAiB;QAC1D,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YACpC,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,qBAAqB,EAAE,aAAa,cAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAC9I,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,cAAe,SAAQ,oBAAoB;CAGhE","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\nimport {\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { ECClass } from \"./Class\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECCustomAttributeClass.\n * @public @preview\n */\nexport class CustomAttributeClass extends ECClass {\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\n private _appliesTo?: CustomAttributeContainerType;\n\n /**\n * @deprecated in 4.8 - might be removed in next major version. use [[appliesTo]]\n * */\n public get containerType(): CustomAttributeContainerType {\n return this.appliesTo;\n }\n\n public get appliesTo(): CustomAttributeContainerType {\n if (undefined === this._appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);\n return this._appliesTo;\n }\n\n /**\n * Save this CustomAttributeClasses properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): CustomAttributeClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.appliesTo = containerTypeToString(this.appliesTo);\n return schemaJson as CustomAttributeClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"appliesTo\", containerTypeToString(this.appliesTo));\n return itemElement;\n }\n\n public override fromJSONSync(customAttributeProps: CustomAttributeClassProps) {\n super.fromJSONSync(customAttributeProps);\n const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);\n if (undefined === appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);\n this._appliesTo = appliesTo;\n }\n\n public override async fromJSON(customAttributeProps: CustomAttributeClassProps) {\n this.fromJSONSync(customAttributeProps);\n }\n\n /**\n * @internal\n */\n protected setAppliesTo(containerType: CustomAttributeContainerType) {\n this._appliesTo = containerType;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a CustomAttributeClass, false otherwise.\n */\n public static isCustomAttributeClass(item?: SchemaItem): item is CustomAttributeClass {\n if (item && item.schemaItemType === SchemaItemType.CustomAttributeClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.\n * @internal\n */\n public static assertIsCustomAttributeClass(item?: SchemaItem): asserts item is CustomAttributeClass {\n if (!this.isCustomAttributeClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);\n }\n}\n/**\n * @internal\n * An abstract class used for Schema editing.\n */\nexport abstract class MutableCAClass extends CustomAttributeClass {\n public abstract override setAppliesTo(containerType: CustomAttributeContainerType): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-metadata",
|
|
3
|
-
"version": "5.1.0-dev.
|
|
3
|
+
"version": "5.1.0-dev.39",
|
|
4
4
|
"description": "ECObjects core concepts in typescript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/cjs/ecschema-metadata.js",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"rimraf": "^6.0.1",
|
|
49
49
|
"sinon": "^17.0.2",
|
|
50
50
|
"typescript": "~5.6.2",
|
|
51
|
-
"@itwin/build-tools": "5.1.0-dev.
|
|
52
|
-
"@itwin/core-bentley": "5.1.0-dev.
|
|
53
|
-
"@itwin/core-quantity": "5.1.0-dev.
|
|
51
|
+
"@itwin/build-tools": "5.1.0-dev.39",
|
|
52
|
+
"@itwin/core-bentley": "5.1.0-dev.39",
|
|
53
|
+
"@itwin/core-quantity": "5.1.0-dev.39"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@itwin/core-bentley": "5.1.0-dev.
|
|
57
|
-
"@itwin/core-quantity": "5.1.0-dev.
|
|
56
|
+
"@itwin/core-bentley": "5.1.0-dev.39",
|
|
57
|
+
"@itwin/core-quantity": "5.1.0-dev.39"
|
|
58
58
|
},
|
|
59
59
|
"nyc": {
|
|
60
60
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|