@itwin/ecschema-rpcinterface-tests 5.1.0-dev.58 → 5.1.0-dev.60
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/dist/bundled-tests.js +2756 -106
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +16 -16
|
@@ -60987,8 +60987,11 @@ class SchemaReadHelper {
|
|
|
60987
60987
|
* calling getCachedSchema on the context.
|
|
60988
60988
|
* @param schema The Schema to populate
|
|
60989
60989
|
* @param rawSchema The serialized data to use to populate the Schema.
|
|
60990
|
+
* @param addSchemaToCache Optional parameter that indicates if the schema should be added to the SchemaContext.
|
|
60991
|
+
* The default is true. If false, the schema loading will not begin asynchronously in the background because the
|
|
60992
|
+
* schema promise must be added to the context. In this case, only the SchemaInfo is returned.
|
|
60990
60993
|
*/
|
|
60991
|
-
async readSchemaInfo(schema, rawSchema) {
|
|
60994
|
+
async readSchemaInfo(schema, rawSchema, addSchemaToCache = true) {
|
|
60992
60995
|
// Ensure context matches schema context
|
|
60993
60996
|
if (schema.context) {
|
|
60994
60997
|
if (this._context !== schema.context)
|
|
@@ -61001,15 +61004,15 @@ class SchemaReadHelper {
|
|
|
61001
61004
|
// Loads all of the properties on the Schema object
|
|
61002
61005
|
await schema.fromJSON(this._parser.parseSchema());
|
|
61003
61006
|
this._schema = schema;
|
|
61004
|
-
const
|
|
61005
|
-
const schemaInfo = { schemaKey: schema.schemaKey, alias: schema.alias, references:
|
|
61007
|
+
const schemaReferences = [];
|
|
61008
|
+
const schemaInfo = { schemaKey: schema.schemaKey, alias: schema.alias, references: schemaReferences };
|
|
61006
61009
|
for (const reference of this._parser.getReferences()) {
|
|
61007
61010
|
const refKey = new _SchemaKey__WEBPACK_IMPORTED_MODULE_5__.SchemaKey(reference.name, _SchemaKey__WEBPACK_IMPORTED_MODULE_5__.ECVersion.fromString(reference.version));
|
|
61008
|
-
|
|
61011
|
+
schemaReferences.push({ schemaKey: refKey });
|
|
61009
61012
|
}
|
|
61010
61013
|
this._schemaInfo = schemaInfo;
|
|
61011
61014
|
// Need to add this schema to the context to be able to locate schemaItems within the context.
|
|
61012
|
-
if (!this._context.schemaExists(schema.schemaKey)) {
|
|
61015
|
+
if (addSchemaToCache && !this._context.schemaExists(schema.schemaKey)) {
|
|
61013
61016
|
await this._context.addSchemaPromise(schemaInfo, schema, this.loadSchema(schemaInfo, schema));
|
|
61014
61017
|
}
|
|
61015
61018
|
return schemaInfo;
|
|
@@ -61018,33 +61021,53 @@ class SchemaReadHelper {
|
|
|
61018
61021
|
* Populates the given Schema from a serialized representation.
|
|
61019
61022
|
* @param schema The Schema to populate
|
|
61020
61023
|
* @param rawSchema The serialized data to use to populate the Schema.
|
|
61024
|
+
* @param addSchemaToCache Optional parameter that indicates if the schema should be added to the SchemaContext.
|
|
61025
|
+
* The default is true. If false, the schema will be loaded directly by this method and not from the context's schema cache.
|
|
61021
61026
|
*/
|
|
61022
|
-
async readSchema(schema, rawSchema) {
|
|
61027
|
+
async readSchema(schema, rawSchema, addSchemaToCache = true) {
|
|
61023
61028
|
if (!this._schemaInfo) {
|
|
61024
|
-
await this.readSchemaInfo(schema, rawSchema);
|
|
61029
|
+
await this.readSchemaInfo(schema, rawSchema, addSchemaToCache);
|
|
61030
|
+
}
|
|
61031
|
+
// If not adding schema to cache (occurs in readSchemaInfo), we must load the schema here
|
|
61032
|
+
if (!addSchemaToCache) {
|
|
61033
|
+
const loadedSchema = await this.loadSchema(this._schemaInfo, schema);
|
|
61034
|
+
if (undefined === loadedSchema)
|
|
61035
|
+
throw new _Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaStatus.UnableToLoadSchema, `Could not load schema ${schema.schemaKey.toString()}`);
|
|
61036
|
+
return loadedSchema;
|
|
61025
61037
|
}
|
|
61026
61038
|
const cachedSchema = await this._context.getCachedSchema(this._schemaInfo.schemaKey, _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaMatchType.Latest);
|
|
61027
61039
|
if (undefined === cachedSchema)
|
|
61028
61040
|
throw new _Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaStatus.UnableToLoadSchema, `Could not load schema ${schema.schemaKey.toString()}`);
|
|
61029
61041
|
return cachedSchema;
|
|
61030
61042
|
}
|
|
61043
|
+
/**
|
|
61044
|
+
* Called when a SchemaItem has been successfully loaded by the Helper. The default implementation simply
|
|
61045
|
+
* checks if the schema item is undefined. An implementation of the helper may choose to partially load
|
|
61046
|
+
* a schema item in which case this method would indicate if the item has been fully loaded.
|
|
61047
|
+
* @param schemaItem The SchemaItem to check.
|
|
61048
|
+
* @returns True if the SchemaItem has been fully loaded, false otherwise.
|
|
61049
|
+
*/
|
|
61050
|
+
isSchemaItemLoaded(schemaItem) {
|
|
61051
|
+
return schemaItem !== undefined;
|
|
61052
|
+
}
|
|
61031
61053
|
/* Finish loading the rest of the schema */
|
|
61032
61054
|
async loadSchema(schemaInfo, schema) {
|
|
61033
61055
|
// Verify that there are no schema reference cycles, this will start schema loading by loading their headers
|
|
61034
61056
|
(await _utils_SchemaGraph__WEBPACK_IMPORTED_MODULE_8__.SchemaGraph.generateGraph(schemaInfo, this._context)).throwIfCycles();
|
|
61035
61057
|
for (const reference of schemaInfo.references) {
|
|
61036
|
-
await this.loadSchemaReference(
|
|
61058
|
+
await this.loadSchemaReference(schema, reference.schemaKey);
|
|
61037
61059
|
}
|
|
61038
61060
|
if (this._visitorHelper)
|
|
61039
61061
|
await this._visitorHelper.visitSchema(schema, false);
|
|
61040
61062
|
// Load all schema items
|
|
61041
61063
|
for (const [itemName, itemType, rawItem] of this._parser.getItems()) {
|
|
61042
|
-
// Make sure the item has not already been
|
|
61064
|
+
// Make sure the item has not already been loaded. No need to check the SchemaContext because all SchemaItems are added to a Schema,
|
|
61043
61065
|
// which would be found when adding to the context.
|
|
61044
|
-
|
|
61066
|
+
const schemaItem = await schema.getItem(itemName);
|
|
61067
|
+
if (this.isSchemaItemLoaded(schemaItem))
|
|
61045
61068
|
continue;
|
|
61046
61069
|
const loadedItem = await this.loadSchemaItem(schema, itemName, itemType, rawItem);
|
|
61047
|
-
if (loadedItem && this._visitorHelper) {
|
|
61070
|
+
if (this.isSchemaItemLoaded(loadedItem) && this._visitorHelper) {
|
|
61048
61071
|
await this._visitorHelper.visitSchemaPart(loadedItem);
|
|
61049
61072
|
}
|
|
61050
61073
|
}
|
|
@@ -61075,12 +61098,8 @@ class SchemaReadHelper {
|
|
|
61075
61098
|
this._visitorHelper.visitSchemaSync(schema, false);
|
|
61076
61099
|
// Load all schema items
|
|
61077
61100
|
for (const [itemName, itemType, rawItem] of this._parser.getItems()) {
|
|
61078
|
-
// Make sure the item has not already been read. No need to check the SchemaContext because all SchemaItems are added to a Schema,
|
|
61079
|
-
// which would be found when adding to the context.
|
|
61080
|
-
if (schema.getItemSync(itemName) !== undefined)
|
|
61081
|
-
continue;
|
|
61082
61101
|
const loadedItem = this.loadSchemaItemSync(schema, itemName, itemType, rawItem);
|
|
61083
|
-
if (loadedItem && this._visitorHelper) {
|
|
61102
|
+
if (this.isSchemaItemLoaded(loadedItem) && this._visitorHelper) {
|
|
61084
61103
|
this._visitorHelper.visitSchemaPartSync(loadedItem);
|
|
61085
61104
|
}
|
|
61086
61105
|
}
|
|
@@ -61093,12 +61112,14 @@ class SchemaReadHelper {
|
|
|
61093
61112
|
* Ensures that the schema references can be located and adds them to the schema.
|
|
61094
61113
|
* @param ref The object to read the SchemaReference's props from.
|
|
61095
61114
|
*/
|
|
61096
|
-
async loadSchemaReference(
|
|
61115
|
+
async loadSchemaReference(schema, refKey) {
|
|
61097
61116
|
const refSchema = await this._context.getSchema(refKey, _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaMatchType.LatestWriteCompatible);
|
|
61098
61117
|
if (undefined === refSchema)
|
|
61099
|
-
throw new _Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${refKey.name}.${refKey.version.toString()}, of ${
|
|
61100
|
-
|
|
61101
|
-
|
|
61118
|
+
throw new _Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${refKey.name}.${refKey.version.toString()}, of ${schema.schemaKey.name}`);
|
|
61119
|
+
if (schema.references.find((ref) => ref.schemaKey.matches(refSchema.schemaKey)))
|
|
61120
|
+
return refSchema;
|
|
61121
|
+
await schema.addReference(refSchema);
|
|
61122
|
+
const results = this.validateSchemaReferences(schema);
|
|
61102
61123
|
let errorMessage = "";
|
|
61103
61124
|
for (const result of results) {
|
|
61104
61125
|
errorMessage += `${result}\r\n`;
|
|
@@ -61106,6 +61127,7 @@ class SchemaReadHelper {
|
|
|
61106
61127
|
if (errorMessage) {
|
|
61107
61128
|
throw new _Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaStatus.InvalidECJson, `${errorMessage}`);
|
|
61108
61129
|
}
|
|
61130
|
+
return refSchema;
|
|
61109
61131
|
}
|
|
61110
61132
|
/**
|
|
61111
61133
|
* Ensures that the schema references can be located and adds them to the schema.
|
|
@@ -61155,73 +61177,97 @@ class SchemaReadHelper {
|
|
|
61155
61177
|
* @param schemaItemObject The Object to populate the SchemaItem with.
|
|
61156
61178
|
*/
|
|
61157
61179
|
async loadSchemaItem(schema, name, itemType, schemaItemObject) {
|
|
61158
|
-
let schemaItem;
|
|
61180
|
+
let schemaItem = await schema.getItem(name);
|
|
61181
|
+
if (this.isSchemaItemLoaded(schemaItem)) {
|
|
61182
|
+
return schemaItem;
|
|
61183
|
+
}
|
|
61159
61184
|
switch ((0,_ECObjects__WEBPACK_IMPORTED_MODULE_1__.parseSchemaItemType)(itemType)) {
|
|
61160
61185
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.EntityClass:
|
|
61161
|
-
schemaItem = await schema.createEntityClass(name);
|
|
61162
|
-
await this.loadEntityClass(schemaItem, schemaItemObject);
|
|
61186
|
+
schemaItem = schemaItem || await schema.createEntityClass(name);
|
|
61187
|
+
schemaItemObject && await this.loadEntityClass(schemaItem, schemaItemObject);
|
|
61163
61188
|
break;
|
|
61164
61189
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.StructClass:
|
|
61165
|
-
schemaItem = await schema.createStructClass(name);
|
|
61166
|
-
const structProps = this._parser.parseStructClass(schemaItemObject);
|
|
61167
|
-
await this.loadClass(schemaItem, structProps, schemaItemObject);
|
|
61190
|
+
schemaItem = schemaItem || await schema.createStructClass(name);
|
|
61191
|
+
const structProps = schemaItemObject && this._parser.parseStructClass(schemaItemObject);
|
|
61192
|
+
structProps && await this.loadClass(schemaItem, structProps, schemaItemObject);
|
|
61168
61193
|
break;
|
|
61169
61194
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Mixin:
|
|
61170
|
-
schemaItem = await schema.createMixinClass(name);
|
|
61171
|
-
await this.loadMixin(schemaItem, schemaItemObject);
|
|
61195
|
+
schemaItem = schemaItem || await schema.createMixinClass(name);
|
|
61196
|
+
schemaItemObject && await this.loadMixin(schemaItem, schemaItemObject);
|
|
61172
61197
|
break;
|
|
61173
61198
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.CustomAttributeClass:
|
|
61174
|
-
schemaItem = await schema.createCustomAttributeClass(name);
|
|
61175
|
-
const caClassProps = this._parser.parseCustomAttributeClass(schemaItemObject);
|
|
61176
|
-
await this.loadClass(schemaItem, caClassProps, schemaItemObject);
|
|
61199
|
+
schemaItem = schemaItem || await schema.createCustomAttributeClass(name);
|
|
61200
|
+
const caClassProps = schemaItemObject && this._parser.parseCustomAttributeClass(schemaItemObject);
|
|
61201
|
+
caClassProps && await this.loadClass(schemaItem, caClassProps, schemaItemObject);
|
|
61177
61202
|
break;
|
|
61178
61203
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.RelationshipClass:
|
|
61179
|
-
schemaItem = await schema.createRelationshipClass(name);
|
|
61180
|
-
await this.loadRelationshipClass(schemaItem, schemaItemObject);
|
|
61204
|
+
schemaItem = schemaItem || await schema.createRelationshipClass(name);
|
|
61205
|
+
schemaItemObject && await this.loadRelationshipClass(schemaItem, schemaItemObject);
|
|
61181
61206
|
break;
|
|
61182
61207
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.KindOfQuantity:
|
|
61183
|
-
schemaItem = await schema.createKindOfQuantity(name);
|
|
61184
|
-
await this.loadKindOfQuantity(schemaItem, schemaItemObject);
|
|
61208
|
+
schemaItem = schemaItem || await schema.createKindOfQuantity(name);
|
|
61209
|
+
schemaItemObject && await this.loadKindOfQuantity(schemaItem, schemaItemObject);
|
|
61185
61210
|
break;
|
|
61186
61211
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Unit:
|
|
61187
|
-
schemaItem = await schema.createUnit(name);
|
|
61188
|
-
await this.loadUnit(schemaItem, schemaItemObject);
|
|
61212
|
+
schemaItem = schemaItem || await schema.createUnit(name);
|
|
61213
|
+
schemaItemObject && await this.loadUnit(schemaItem, schemaItemObject);
|
|
61189
61214
|
break;
|
|
61190
61215
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Constant:
|
|
61191
|
-
schemaItem = await schema.createConstant(name);
|
|
61192
|
-
await this.loadConstant(schemaItem, schemaItemObject);
|
|
61216
|
+
schemaItem = schemaItem || await schema.createConstant(name);
|
|
61217
|
+
schemaItemObject && await this.loadConstant(schemaItem, schemaItemObject);
|
|
61193
61218
|
break;
|
|
61194
61219
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.InvertedUnit:
|
|
61195
|
-
schemaItem = await schema.createInvertedUnit(name);
|
|
61196
|
-
await this.loadInvertedUnit(schemaItem, schemaItemObject);
|
|
61220
|
+
schemaItem = schemaItem || await schema.createInvertedUnit(name);
|
|
61221
|
+
schemaItemObject && await this.loadInvertedUnit(schemaItem, schemaItemObject);
|
|
61197
61222
|
break;
|
|
61198
61223
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Format:
|
|
61199
|
-
schemaItem = await schema.createFormat(name);
|
|
61200
|
-
await this.loadFormat(schemaItem, schemaItemObject);
|
|
61224
|
+
schemaItem = schemaItem || await schema.createFormat(name);
|
|
61225
|
+
schemaItemObject && await this.loadFormat(schemaItem, schemaItemObject);
|
|
61201
61226
|
break;
|
|
61202
61227
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Phenomenon:
|
|
61203
|
-
schemaItem = await schema.createPhenomenon(name);
|
|
61204
|
-
const phenomenonProps = this._parser.parsePhenomenon(schemaItemObject);
|
|
61205
|
-
await schemaItem.fromJSON(phenomenonProps);
|
|
61228
|
+
schemaItem = schemaItem || await schema.createPhenomenon(name);
|
|
61229
|
+
const phenomenonProps = schemaItemObject && this._parser.parsePhenomenon(schemaItemObject);
|
|
61230
|
+
phenomenonProps && await schemaItem.fromJSON(phenomenonProps);
|
|
61206
61231
|
break;
|
|
61207
61232
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.UnitSystem:
|
|
61208
|
-
schemaItem = await schema.createUnitSystem(name);
|
|
61209
|
-
await schemaItem.fromJSON(this._parser.parseUnitSystem(schemaItemObject));
|
|
61233
|
+
schemaItem = schemaItem || await schema.createUnitSystem(name);
|
|
61234
|
+
schemaItemObject && await schemaItem.fromJSON(this._parser.parseUnitSystem(schemaItemObject));
|
|
61210
61235
|
break;
|
|
61211
61236
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.PropertyCategory:
|
|
61212
|
-
schemaItem = await schema.createPropertyCategory(name);
|
|
61213
|
-
const propertyCategoryProps = this._parser.parsePropertyCategory(schemaItemObject);
|
|
61214
|
-
await schemaItem.fromJSON(propertyCategoryProps);
|
|
61237
|
+
schemaItem = schemaItem || await schema.createPropertyCategory(name);
|
|
61238
|
+
const propertyCategoryProps = schemaItemObject && this._parser.parsePropertyCategory(schemaItemObject);
|
|
61239
|
+
propertyCategoryProps && schemaItemObject && await schemaItem.fromJSON(propertyCategoryProps);
|
|
61215
61240
|
break;
|
|
61216
61241
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Enumeration:
|
|
61217
|
-
schemaItem = await schema.createEnumeration(name);
|
|
61218
|
-
const enumerationProps = this._parser.parseEnumeration(schemaItemObject);
|
|
61219
|
-
await schemaItem.fromJSON(enumerationProps);
|
|
61242
|
+
schemaItem = schemaItem || await schema.createEnumeration(name);
|
|
61243
|
+
const enumerationProps = schemaItemObject && this._parser.parseEnumeration(schemaItemObject);
|
|
61244
|
+
enumerationProps && await schemaItem.fromJSON(enumerationProps);
|
|
61220
61245
|
break;
|
|
61221
61246
|
// NOTE: we are being permissive here and allowing unknown types to silently fail. Not sure if we want to hard fail or just do a basic deserialization
|
|
61222
61247
|
}
|
|
61223
61248
|
return schemaItem;
|
|
61224
61249
|
}
|
|
61250
|
+
/**
|
|
61251
|
+
* Load the customAttribute class dependencies for a set of CustomAttribute objects and add
|
|
61252
|
+
* them to a given custom attribute container.
|
|
61253
|
+
* @param container The CustomAttributeContainer that each CustomAttribute will be added to.
|
|
61254
|
+
* @param customAttributes An iterable set of parsed CustomAttribute objects.
|
|
61255
|
+
*/
|
|
61256
|
+
async loadCustomAttributes(container, caProviders) {
|
|
61257
|
+
for (const providerTuple of caProviders) {
|
|
61258
|
+
// First tuple entry is the CA class name.
|
|
61259
|
+
const caClass = await this.findSchemaItem(providerTuple[0]);
|
|
61260
|
+
// If custom attribute exist within the context and is referenced, validate the reference is defined in the container's schema
|
|
61261
|
+
if (caClass && caClass.key.schemaName !== container.schema.name &&
|
|
61262
|
+
!container.schema.getReferenceSync(caClass.key.schemaName)) {
|
|
61263
|
+
throw new _Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaStatus.InvalidECJson, `Unable to load custom attribute ${caClass.fullName} from container ${container.fullName}, ${caClass.key.schemaName} reference not defined`);
|
|
61264
|
+
}
|
|
61265
|
+
// Second tuple entry ia a function that provides the CA instance.
|
|
61266
|
+
const provider = providerTuple[1];
|
|
61267
|
+
const customAttribute = provider(caClass);
|
|
61268
|
+
container.addCustomAttribute(customAttribute);
|
|
61269
|
+
}
|
|
61270
|
+
}
|
|
61225
61271
|
/**
|
|
61226
61272
|
* Given the schema item object, the anticipated type and the name a schema item is created and loaded into the schema provided.
|
|
61227
61273
|
* @param schema The Schema the SchemaItem to.
|
|
@@ -61230,66 +61276,69 @@ class SchemaReadHelper {
|
|
|
61230
61276
|
* @param schemaItemObject The Object to populate the SchemaItem with.
|
|
61231
61277
|
*/
|
|
61232
61278
|
loadSchemaItemSync(schema, name, itemType, schemaItemObject) {
|
|
61233
|
-
let schemaItem;
|
|
61279
|
+
let schemaItem = schema.getItemSync(name);
|
|
61280
|
+
if (this.isSchemaItemLoaded(schemaItem)) {
|
|
61281
|
+
return schemaItem;
|
|
61282
|
+
}
|
|
61234
61283
|
switch ((0,_ECObjects__WEBPACK_IMPORTED_MODULE_1__.parseSchemaItemType)(itemType)) {
|
|
61235
61284
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.EntityClass:
|
|
61236
|
-
schemaItem = schema.createEntityClassSync(name);
|
|
61285
|
+
schemaItem = schemaItem || schema.createEntityClassSync(name);
|
|
61237
61286
|
this.loadEntityClassSync(schemaItem, schemaItemObject);
|
|
61238
61287
|
break;
|
|
61239
61288
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.StructClass:
|
|
61240
|
-
schemaItem = schema.createStructClassSync(name);
|
|
61289
|
+
schemaItem = schemaItem || schema.createStructClassSync(name);
|
|
61241
61290
|
const structProps = this._parser.parseStructClass(schemaItemObject);
|
|
61242
61291
|
this.loadClassSync(schemaItem, structProps, schemaItemObject);
|
|
61243
61292
|
break;
|
|
61244
61293
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Mixin:
|
|
61245
|
-
schemaItem = schema.createMixinClassSync(name);
|
|
61294
|
+
schemaItem = schemaItem || schema.createMixinClassSync(name);
|
|
61246
61295
|
this.loadMixinSync(schemaItem, schemaItemObject);
|
|
61247
61296
|
break;
|
|
61248
61297
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.CustomAttributeClass:
|
|
61249
|
-
schemaItem = schema.createCustomAttributeClassSync(name);
|
|
61298
|
+
schemaItem = schemaItem || schema.createCustomAttributeClassSync(name);
|
|
61250
61299
|
const caClassProps = this._parser.parseCustomAttributeClass(schemaItemObject);
|
|
61251
61300
|
this.loadClassSync(schemaItem, caClassProps, schemaItemObject);
|
|
61252
61301
|
break;
|
|
61253
61302
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.RelationshipClass:
|
|
61254
|
-
schemaItem = schema.createRelationshipClassSync(name);
|
|
61303
|
+
schemaItem = schemaItem || schema.createRelationshipClassSync(name);
|
|
61255
61304
|
this.loadRelationshipClassSync(schemaItem, schemaItemObject);
|
|
61256
61305
|
break;
|
|
61257
61306
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.KindOfQuantity:
|
|
61258
|
-
schemaItem = schema.createKindOfQuantitySync(name);
|
|
61307
|
+
schemaItem = schemaItem || schema.createKindOfQuantitySync(name);
|
|
61259
61308
|
this.loadKindOfQuantitySync(schemaItem, schemaItemObject);
|
|
61260
61309
|
break;
|
|
61261
61310
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Unit:
|
|
61262
|
-
schemaItem = schema.createUnitSync(name);
|
|
61311
|
+
schemaItem = schemaItem || schema.createUnitSync(name);
|
|
61263
61312
|
this.loadUnitSync(schemaItem, schemaItemObject);
|
|
61264
61313
|
break;
|
|
61265
61314
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Constant:
|
|
61266
|
-
schemaItem = schema.createConstantSync(name);
|
|
61315
|
+
schemaItem = schemaItem || schema.createConstantSync(name);
|
|
61267
61316
|
this.loadConstantSync(schemaItem, schemaItemObject);
|
|
61268
61317
|
break;
|
|
61269
61318
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.InvertedUnit:
|
|
61270
|
-
schemaItem = schema.createInvertedUnitSync(name);
|
|
61319
|
+
schemaItem = schemaItem || schema.createInvertedUnitSync(name);
|
|
61271
61320
|
this.loadInvertedUnitSync(schemaItem, schemaItemObject);
|
|
61272
61321
|
break;
|
|
61273
61322
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Format:
|
|
61274
|
-
schemaItem = schema.createFormatSync(name);
|
|
61323
|
+
schemaItem = schemaItem || schema.createFormatSync(name);
|
|
61275
61324
|
this.loadFormatSync(schemaItem, schemaItemObject);
|
|
61276
61325
|
break;
|
|
61277
61326
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Phenomenon:
|
|
61278
|
-
schemaItem = schema.createPhenomenonSync(name);
|
|
61327
|
+
schemaItem = schemaItem || schema.createPhenomenonSync(name);
|
|
61279
61328
|
const phenomenonProps = this._parser.parsePhenomenon(schemaItemObject);
|
|
61280
61329
|
schemaItem.fromJSONSync(phenomenonProps);
|
|
61281
61330
|
break;
|
|
61282
61331
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.UnitSystem:
|
|
61283
|
-
schemaItem = schema.createUnitSystemSync(name);
|
|
61332
|
+
schemaItem = schemaItem || schema.createUnitSystemSync(name);
|
|
61284
61333
|
schemaItem.fromJSONSync(this._parser.parseUnitSystem(schemaItemObject));
|
|
61285
61334
|
break;
|
|
61286
61335
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.PropertyCategory:
|
|
61287
|
-
schemaItem = schema.createPropertyCategorySync(name);
|
|
61336
|
+
schemaItem = schemaItem || schema.createPropertyCategorySync(name);
|
|
61288
61337
|
const propertyCategoryProps = this._parser.parsePropertyCategory(schemaItemObject);
|
|
61289
61338
|
schemaItem.fromJSONSync(propertyCategoryProps);
|
|
61290
61339
|
break;
|
|
61291
61340
|
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Enumeration:
|
|
61292
|
-
schemaItem = schema.createEnumerationSync(name);
|
|
61341
|
+
schemaItem = schemaItem || schema.createEnumerationSync(name);
|
|
61293
61342
|
const enumerationProps = this._parser.parseEnumeration(schemaItemObject);
|
|
61294
61343
|
schemaItem.fromJSONSync(enumerationProps);
|
|
61295
61344
|
break;
|
|
@@ -61337,7 +61386,7 @@ class SchemaReadHelper {
|
|
|
61337
61386
|
const foundItem = this._parser.findItem(itemName);
|
|
61338
61387
|
if (foundItem) {
|
|
61339
61388
|
schemaItem = await this.loadSchemaItem(this._schema, ...foundItem);
|
|
61340
|
-
if (!skipVisitor && schemaItem && this._visitorHelper) {
|
|
61389
|
+
if (!skipVisitor && this.isSchemaItemLoaded(schemaItem) && this._visitorHelper) {
|
|
61341
61390
|
await this._visitorHelper.visitSchemaPart(schemaItem);
|
|
61342
61391
|
}
|
|
61343
61392
|
if (loadCallBack && schemaItem)
|
|
@@ -61370,7 +61419,7 @@ class SchemaReadHelper {
|
|
|
61370
61419
|
const foundItem = this._parser.findItem(itemName);
|
|
61371
61420
|
if (foundItem) {
|
|
61372
61421
|
schemaItem = this.loadSchemaItemSync(this._schema, ...foundItem);
|
|
61373
|
-
if (!skipVisitor && schemaItem && this._visitorHelper) {
|
|
61422
|
+
if (!skipVisitor && this.isSchemaItemLoaded(schemaItem) && this._visitorHelper) {
|
|
61374
61423
|
this._visitorHelper.visitSchemaPartSync(schemaItem);
|
|
61375
61424
|
}
|
|
61376
61425
|
if (loadCallBack && schemaItem)
|
|
@@ -61520,7 +61569,7 @@ class SchemaReadHelper {
|
|
|
61520
61569
|
*/
|
|
61521
61570
|
async loadClass(classObj, classProps, rawClass) {
|
|
61522
61571
|
const baseClassLoaded = async (baseClass) => {
|
|
61523
|
-
if (this._visitorHelper)
|
|
61572
|
+
if (this._visitorHelper && this.isSchemaItemLoaded(baseClass))
|
|
61524
61573
|
await this._visitorHelper.visitSchemaPart(baseClass);
|
|
61525
61574
|
};
|
|
61526
61575
|
// Load base class first
|
|
@@ -61543,7 +61592,7 @@ class SchemaReadHelper {
|
|
|
61543
61592
|
*/
|
|
61544
61593
|
loadClassSync(classObj, classProps, rawClass) {
|
|
61545
61594
|
const baseClassLoaded = async (baseClass) => {
|
|
61546
|
-
if (this._visitorHelper)
|
|
61595
|
+
if (this._visitorHelper && this.isSchemaItemLoaded(baseClass))
|
|
61547
61596
|
this._visitorHelper.visitSchemaPartSync(baseClass);
|
|
61548
61597
|
};
|
|
61549
61598
|
// Load base class first
|
|
@@ -61594,7 +61643,7 @@ class SchemaReadHelper {
|
|
|
61594
61643
|
async loadMixin(mixin, rawMixin) {
|
|
61595
61644
|
const mixinProps = this._parser.parseMixin(rawMixin);
|
|
61596
61645
|
const appliesToLoaded = async (appliesToClass) => {
|
|
61597
|
-
if (this._visitorHelper)
|
|
61646
|
+
if (this._visitorHelper && this.isSchemaItemLoaded(appliesToClass))
|
|
61598
61647
|
await this._visitorHelper.visitSchemaPart(appliesToClass);
|
|
61599
61648
|
};
|
|
61600
61649
|
await this.findSchemaItem(mixinProps.appliesTo, true, appliesToLoaded);
|
|
@@ -61608,7 +61657,7 @@ class SchemaReadHelper {
|
|
|
61608
61657
|
loadMixinSync(mixin, rawMixin) {
|
|
61609
61658
|
const mixinProps = this._parser.parseMixin(rawMixin);
|
|
61610
61659
|
const appliesToLoaded = async (appliesToClass) => {
|
|
61611
|
-
if (this._visitorHelper)
|
|
61660
|
+
if (this._visitorHelper && this.isSchemaItemLoaded(appliesToClass))
|
|
61612
61661
|
await this._visitorHelper.visitSchemaPart(appliesToClass);
|
|
61613
61662
|
};
|
|
61614
61663
|
this.findSchemaItemSync(mixinProps.appliesTo, true, appliesToLoaded);
|
|
@@ -61804,27 +61853,6 @@ class SchemaReadHelper {
|
|
|
61804
61853
|
propertyObj.fromJSONSync(props);
|
|
61805
61854
|
this.loadCustomAttributesSync(propertyObj, this._parser.getPropertyCustomAttributeProviders(rawProperty));
|
|
61806
61855
|
}
|
|
61807
|
-
/**
|
|
61808
|
-
* Load the customAttribute class dependencies for a set of CustomAttribute objects and add
|
|
61809
|
-
* them to a given custom attribute container.
|
|
61810
|
-
* @param container The CustomAttributeContainer that each CustomAttribute will be added to.
|
|
61811
|
-
* @param customAttributes An iterable set of parsed CustomAttribute objects.
|
|
61812
|
-
*/
|
|
61813
|
-
async loadCustomAttributes(container, caProviders) {
|
|
61814
|
-
for (const providerTuple of caProviders) {
|
|
61815
|
-
// First tuple entry is the CA class name.
|
|
61816
|
-
const caClass = await this.findSchemaItem(providerTuple[0]);
|
|
61817
|
-
// If custom attribute exist within the context and is referenced, validate the reference is defined in the container's schema
|
|
61818
|
-
if (caClass && caClass.key.schemaName !== container.schema.name &&
|
|
61819
|
-
!container.schema.getReferenceSync(caClass.key.schemaName)) {
|
|
61820
|
-
throw new _Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_2__.ECSchemaStatus.InvalidECJson, `Unable to load custom attribute ${caClass.fullName} from container ${container.fullName}, ${caClass.key.schemaName} reference not defined`);
|
|
61821
|
-
}
|
|
61822
|
-
// Second tuple entry ia a function that provides the CA instance.
|
|
61823
|
-
const provider = providerTuple[1];
|
|
61824
|
-
const customAttribute = provider(caClass);
|
|
61825
|
-
container.addCustomAttribute(customAttribute);
|
|
61826
|
-
}
|
|
61827
|
-
}
|
|
61828
61856
|
/**
|
|
61829
61857
|
* Load the customAttribute class dependencies for a set of CustomAttribute objects and add them to a given custom attribute container.
|
|
61830
61858
|
* @param container The CustomAttributeContainer that each CustomAttribute will be added to.
|
|
@@ -63178,8 +63206,8 @@ class XmlParser extends _AbstractParser__WEBPACK_IMPORTED_MODULE_5__.AbstractPar
|
|
|
63178
63206
|
}
|
|
63179
63207
|
}
|
|
63180
63208
|
parsePrimitiveProperty(xmlElement) {
|
|
63181
|
-
const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement);
|
|
63182
63209
|
const typeName = this.getPropertyTypeName(xmlElement);
|
|
63210
|
+
const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement, typeName);
|
|
63183
63211
|
const primitivePropertyProps = { ...propertyProps, typeName };
|
|
63184
63212
|
return primitivePropertyProps;
|
|
63185
63213
|
}
|
|
@@ -63191,7 +63219,7 @@ class XmlParser extends _AbstractParser__WEBPACK_IMPORTED_MODULE_5__.AbstractPar
|
|
|
63191
63219
|
}
|
|
63192
63220
|
parsePrimitiveArrayProperty(xmlElement) {
|
|
63193
63221
|
const typeName = this.getPropertyTypeName(xmlElement);
|
|
63194
|
-
const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement);
|
|
63222
|
+
const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement, typeName);
|
|
63195
63223
|
const minAndMaxOccurs = this.getPropertyMinAndMaxOccurs(xmlElement);
|
|
63196
63224
|
return {
|
|
63197
63225
|
...propertyProps,
|
|
@@ -63466,14 +63494,23 @@ class XmlParser extends _AbstractParser__WEBPACK_IMPORTED_MODULE_5__.AbstractPar
|
|
|
63466
63494
|
return rawTypeName;
|
|
63467
63495
|
return this.getQualifiedTypeName(rawTypeName);
|
|
63468
63496
|
}
|
|
63469
|
-
getPrimitiveOrEnumPropertyBaseProps(xmlElement) {
|
|
63497
|
+
getPrimitiveOrEnumPropertyBaseProps(xmlElement, typeName) {
|
|
63498
|
+
const primitiveType = (0,_ECObjects__WEBPACK_IMPORTED_MODULE_1__.parsePrimitiveType)(typeName);
|
|
63470
63499
|
const propertyProps = this.getPropertyProps(xmlElement);
|
|
63471
63500
|
const propName = propertyProps.name;
|
|
63472
63501
|
const extendedTypeName = this.getOptionalAttribute(xmlElement, "extendedTypeName");
|
|
63473
63502
|
const minLength = this.getOptionalIntAttribute(xmlElement, "minimumLength", `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumLength' attribute. It should be a numeric value.`);
|
|
63474
63503
|
const maxLength = this.getOptionalIntAttribute(xmlElement, "maximumLength", `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumLength' attribute. It should be a numeric value.`);
|
|
63475
|
-
|
|
63476
|
-
|
|
63504
|
+
let minValue;
|
|
63505
|
+
let maxValue;
|
|
63506
|
+
if (primitiveType === _ECObjects__WEBPACK_IMPORTED_MODULE_1__.PrimitiveType.Double || primitiveType === _ECObjects__WEBPACK_IMPORTED_MODULE_1__.PrimitiveType.Long) {
|
|
63507
|
+
minValue = this.getOptionalFloatAttribute(xmlElement, "minimumValue", `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumValue' attribute. It should be a numeric value.`);
|
|
63508
|
+
maxValue = this.getOptionalFloatAttribute(xmlElement, "maximumValue", `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumValue' attribute. It should be a numeric value.`);
|
|
63509
|
+
}
|
|
63510
|
+
else {
|
|
63511
|
+
minValue = this.getOptionalIntAttribute(xmlElement, "minimumValue", `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumValue' attribute. It should be a numeric value.`);
|
|
63512
|
+
maxValue = this.getOptionalIntAttribute(xmlElement, "maximumValue", `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumValue' attribute. It should be a numeric value.`);
|
|
63513
|
+
}
|
|
63477
63514
|
return {
|
|
63478
63515
|
...propertyProps,
|
|
63479
63516
|
extendedTypeName,
|
|
@@ -64629,6 +64666,2441 @@ class ECSchemaError extends _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Ben
|
|
|
64629
64666
|
}
|
|
64630
64667
|
|
|
64631
64668
|
|
|
64669
|
+
/***/ }),
|
|
64670
|
+
|
|
64671
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/ClassParsers.js":
|
|
64672
|
+
/*!*******************************************************************************!*\
|
|
64673
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/ClassParsers.js ***!
|
|
64674
|
+
\*******************************************************************************/
|
|
64675
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
64676
|
+
|
|
64677
|
+
"use strict";
|
|
64678
|
+
__webpack_require__.r(__webpack_exports__);
|
|
64679
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
64680
|
+
/* harmony export */ ClassParser: () => (/* binding */ ClassParser),
|
|
64681
|
+
/* harmony export */ CustomAttributeClassParser: () => (/* binding */ CustomAttributeClassParser),
|
|
64682
|
+
/* harmony export */ MixinParser: () => (/* binding */ MixinParser),
|
|
64683
|
+
/* harmony export */ RelationshipClassParser: () => (/* binding */ RelationshipClassParser)
|
|
64684
|
+
/* harmony export */ });
|
|
64685
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
64686
|
+
/* harmony import */ var _SchemaItemParsers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaItemParsers */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemParsers.js");
|
|
64687
|
+
/* harmony import */ var _SchemaParser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SchemaParser */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaParser.js");
|
|
64688
|
+
/*---------------------------------------------------------------------------------------------
|
|
64689
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
64690
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
64691
|
+
*--------------------------------------------------------------------------------------------*/
|
|
64692
|
+
|
|
64693
|
+
|
|
64694
|
+
|
|
64695
|
+
/**
|
|
64696
|
+
* Parses ClassProps JSON returned from an ECSql query and returns the correct ClassProps JSON.
|
|
64697
|
+
* This is necessary as a small amount information (ie. CustomAttribute data) returned from the
|
|
64698
|
+
* iModelDb is in a different format than is required for a ClassProps JSON object.
|
|
64699
|
+
* @internal
|
|
64700
|
+
*/
|
|
64701
|
+
class ClassParser extends _SchemaItemParsers__WEBPACK_IMPORTED_MODULE_1__.SchemaItemParser {
|
|
64702
|
+
/**
|
|
64703
|
+
* Parses the given ClassProps JSON returned from an ECSql query.
|
|
64704
|
+
* @param data The ClassProps JSON as returned from an iModelDb.
|
|
64705
|
+
* @returns The corrected ClassProps Json.
|
|
64706
|
+
*/
|
|
64707
|
+
async parse(data) {
|
|
64708
|
+
const props = await super.parse(data);
|
|
64709
|
+
if (props.properties) {
|
|
64710
|
+
if (props.properties.length === 0)
|
|
64711
|
+
delete props.properties;
|
|
64712
|
+
else
|
|
64713
|
+
this.parseProperties(props.properties);
|
|
64714
|
+
}
|
|
64715
|
+
return props;
|
|
64716
|
+
}
|
|
64717
|
+
parseProperties(propertyProps) {
|
|
64718
|
+
for (const props of propertyProps) {
|
|
64719
|
+
props.customAttributes = props.customAttributes && props.customAttributes.length > 0 ? props.customAttributes.map((attr) => { return (0,_SchemaParser__WEBPACK_IMPORTED_MODULE_2__.parseCustomAttribute)(attr); }) : undefined;
|
|
64720
|
+
if (!props.customAttributes)
|
|
64721
|
+
delete props.customAttributes;
|
|
64722
|
+
}
|
|
64723
|
+
}
|
|
64724
|
+
}
|
|
64725
|
+
/**
|
|
64726
|
+
* Parses the given MixinProps JSON returned from an ECSql query.
|
|
64727
|
+
* @param data The MixinProps JSON as returned from an iModelDb.
|
|
64728
|
+
* @returns The corrected MixinProps Json.
|
|
64729
|
+
* @internal
|
|
64730
|
+
*/
|
|
64731
|
+
class MixinParser extends ClassParser {
|
|
64732
|
+
/**
|
|
64733
|
+
* Parses the given MixinProps JSON returned from an ECSql query.
|
|
64734
|
+
* @param data The MixinProps JSON as returned from an iModelDb.
|
|
64735
|
+
* @returns The corrected MixinProps Json.
|
|
64736
|
+
*/
|
|
64737
|
+
async parse(data) {
|
|
64738
|
+
const props = await super.parse(data);
|
|
64739
|
+
if (!props.customAttributes)
|
|
64740
|
+
delete props.customAttributes;
|
|
64741
|
+
return props;
|
|
64742
|
+
}
|
|
64743
|
+
}
|
|
64744
|
+
/**
|
|
64745
|
+
* Parses the given CustomAttributeClassProps JSON returned from an ECSql query.
|
|
64746
|
+
* @param data The CustomAttributeClassProps JSON as returned from an iModelDb.
|
|
64747
|
+
* @returns The corrected CustomAttributeClassProps Json.
|
|
64748
|
+
* @internal
|
|
64749
|
+
*/
|
|
64750
|
+
class CustomAttributeClassParser extends ClassParser {
|
|
64751
|
+
/**
|
|
64752
|
+
* Parses the given CustomAttributeClassProps JSON returned from an ECSql query.
|
|
64753
|
+
* @param data The CustomAttributeClassProps JSON as returned from an iModelDb.
|
|
64754
|
+
* @returns The corrected CustomAttributeClassProps Json.
|
|
64755
|
+
*/
|
|
64756
|
+
async parse(data) {
|
|
64757
|
+
const props = await super.parse(data);
|
|
64758
|
+
props.appliesTo = props.appliesTo ? (0,_ECObjects__WEBPACK_IMPORTED_MODULE_0__.containerTypeToString)(props.appliesTo) : _ECObjects__WEBPACK_IMPORTED_MODULE_0__.CustomAttributeContainerType[_ECObjects__WEBPACK_IMPORTED_MODULE_0__.CustomAttributeContainerType.Any];
|
|
64759
|
+
return props;
|
|
64760
|
+
}
|
|
64761
|
+
}
|
|
64762
|
+
/**
|
|
64763
|
+
* Parses the given RelationshipClassProps JSON returned from an ECSql query.
|
|
64764
|
+
* @param data The RelationshipClassProps JSON as returned from an iModelDb.
|
|
64765
|
+
* @returns The corrected RelationshipClassProps Json.
|
|
64766
|
+
* @internal
|
|
64767
|
+
*/
|
|
64768
|
+
class RelationshipClassParser extends ClassParser {
|
|
64769
|
+
/**
|
|
64770
|
+
* Parses the given RelationshipClassProps JSON returned from an ECSql query.
|
|
64771
|
+
* @param data The RelationshipClassProps JSON as returned from an iModelDb.
|
|
64772
|
+
* @returns The corrected RelationshipClassProps Json.
|
|
64773
|
+
*/
|
|
64774
|
+
async parse(data) {
|
|
64775
|
+
const props = await super.parse(data);
|
|
64776
|
+
const source = props.source;
|
|
64777
|
+
const target = props.target;
|
|
64778
|
+
if (source) {
|
|
64779
|
+
source.customAttributes = source.customAttributes ? source.customAttributes.map((attr) => { return (0,_SchemaParser__WEBPACK_IMPORTED_MODULE_2__.parseCustomAttribute)(attr); }) : undefined;
|
|
64780
|
+
if (!source.customAttributes)
|
|
64781
|
+
delete source.customAttributes;
|
|
64782
|
+
}
|
|
64783
|
+
if (target) {
|
|
64784
|
+
target.customAttributes = target.customAttributes ? target.customAttributes.map((attr) => { return (0,_SchemaParser__WEBPACK_IMPORTED_MODULE_2__.parseCustomAttribute)(attr); }) : undefined;
|
|
64785
|
+
if (!target.customAttributes)
|
|
64786
|
+
delete target.customAttributes;
|
|
64787
|
+
}
|
|
64788
|
+
return props;
|
|
64789
|
+
}
|
|
64790
|
+
}
|
|
64791
|
+
|
|
64792
|
+
|
|
64793
|
+
/***/ }),
|
|
64794
|
+
|
|
64795
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js":
|
|
64796
|
+
/*!*************************************************************************************!*\
|
|
64797
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js ***!
|
|
64798
|
+
\*************************************************************************************/
|
|
64799
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
64800
|
+
|
|
64801
|
+
"use strict";
|
|
64802
|
+
__webpack_require__.r(__webpack_exports__);
|
|
64803
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
64804
|
+
/* harmony export */ ECSqlSchemaLocater: () => (/* binding */ ECSqlSchemaLocater)
|
|
64805
|
+
/* harmony export */ });
|
|
64806
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
64807
|
+
/* harmony import */ var _SchemaKey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../SchemaKey */ "../../core/ecschema-metadata/lib/esm/SchemaKey.js");
|
|
64808
|
+
/* harmony import */ var _FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FullSchemaQueries */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/FullSchemaQueries.js");
|
|
64809
|
+
/* harmony import */ var _IncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./IncrementalSchemaLocater */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js");
|
|
64810
|
+
/* harmony import */ var _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SchemaItemQueries */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemQueries.js");
|
|
64811
|
+
/* harmony import */ var _SchemaParser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SchemaParser */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaParser.js");
|
|
64812
|
+
/* harmony import */ var _SchemaStubQueries__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SchemaStubQueries */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaStubQueries.js");
|
|
64813
|
+
/*---------------------------------------------------------------------------------------------
|
|
64814
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
64815
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
64816
|
+
*--------------------------------------------------------------------------------------------*/
|
|
64817
|
+
|
|
64818
|
+
|
|
64819
|
+
|
|
64820
|
+
|
|
64821
|
+
|
|
64822
|
+
|
|
64823
|
+
|
|
64824
|
+
/**
|
|
64825
|
+
* An abstract [[IncrementalSchemaLocater]] implementation for loading
|
|
64826
|
+
* EC [Schema] instances from an iModelDb using ECSql queries.
|
|
64827
|
+
* @internal
|
|
64828
|
+
*/
|
|
64829
|
+
class ECSqlSchemaLocater extends _IncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_3__.IncrementalSchemaLocater {
|
|
64830
|
+
/**
|
|
64831
|
+
* Gets the [[ECSqlSchemaLocaterOptions]] used by this locater.
|
|
64832
|
+
*/
|
|
64833
|
+
get options() {
|
|
64834
|
+
return super.options;
|
|
64835
|
+
}
|
|
64836
|
+
/**
|
|
64837
|
+
* Initializes a new ECSqlSchemaLocater instance.
|
|
64838
|
+
* @param options The options used by this Schema locater.
|
|
64839
|
+
*/
|
|
64840
|
+
constructor(options) {
|
|
64841
|
+
super(options);
|
|
64842
|
+
}
|
|
64843
|
+
/**
|
|
64844
|
+
* Gets the [[SchemaProps]] for the given schema key. This is the full schema json with all elements that are defined
|
|
64845
|
+
* in the schema. The schema locater calls this after the stub has been loaded to fully load the schema in the background.
|
|
64846
|
+
* @param schemaKey The [[SchemaKey]] of the schema to be resolved.
|
|
64847
|
+
* @param context The [[SchemaContext]] to use for resolving references.
|
|
64848
|
+
* @internal
|
|
64849
|
+
*/
|
|
64850
|
+
async getSchemaJson(schemaKey, context) {
|
|
64851
|
+
// If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema
|
|
64852
|
+
// information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface
|
|
64853
|
+
// to fetch the whole schema json.
|
|
64854
|
+
if (!await this.supportPartialSchemaLoading(context))
|
|
64855
|
+
return this.getSchemaProps(schemaKey);
|
|
64856
|
+
const start = Date.now();
|
|
64857
|
+
const schemaProps = this.options.useMultipleQueries
|
|
64858
|
+
? await this.getFullSchemaMultipleQueries(schemaKey, context)
|
|
64859
|
+
: await this.getFullSchema(schemaKey, context);
|
|
64860
|
+
this.options.performanceLogger?.logSchema(start, schemaKey.name);
|
|
64861
|
+
return schemaProps;
|
|
64862
|
+
}
|
|
64863
|
+
;
|
|
64864
|
+
/**
|
|
64865
|
+
* Gets the [[SchemaProps]] without schemaItems.
|
|
64866
|
+
*/
|
|
64867
|
+
/**
|
|
64868
|
+
* Gets the [[SchemaProps]] without schemaItems for the given schema name.
|
|
64869
|
+
* @param schemaName The name of the Schema.
|
|
64870
|
+
* @param context The [[SchemaContext]] to use for resolving references.
|
|
64871
|
+
* @returns
|
|
64872
|
+
* @internal
|
|
64873
|
+
*/
|
|
64874
|
+
async getSchemaNoItems(schemaName, context) {
|
|
64875
|
+
const schemaRows = await this.executeQuery(_FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__.FullSchemaQueries.schemaNoItemsQuery, { parameters: { schemaName } });
|
|
64876
|
+
const schemaRow = schemaRows[0];
|
|
64877
|
+
if (schemaRow === undefined)
|
|
64878
|
+
return undefined;
|
|
64879
|
+
const schema = JSON.parse(schemaRow.schema);
|
|
64880
|
+
return _SchemaParser__WEBPACK_IMPORTED_MODULE_5__.SchemaParser.parse(schema, context);
|
|
64881
|
+
}
|
|
64882
|
+
/**
|
|
64883
|
+
* Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.
|
|
64884
|
+
* @param context The schema context to lookup the meta schema.
|
|
64885
|
+
* @returns true if the context has a supported meta schema version, false otherwise.
|
|
64886
|
+
*/
|
|
64887
|
+
async supportPartialSchemaLoading(context) {
|
|
64888
|
+
const metaSchemaKey = new _SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey("ECDbMeta", 4, 0, 3);
|
|
64889
|
+
const metaSchemaInfo = await context.getSchemaInfo(metaSchemaKey, _ECObjects__WEBPACK_IMPORTED_MODULE_0__.SchemaMatchType.LatestWriteCompatible);
|
|
64890
|
+
return metaSchemaInfo !== undefined;
|
|
64891
|
+
}
|
|
64892
|
+
;
|
|
64893
|
+
/**
|
|
64894
|
+
* Gets all the Schema's Entity classes as [[EntityClassProps]] JSON objects.
|
|
64895
|
+
* @param schemaName The name of the Schema.
|
|
64896
|
+
* @param context The [[SchemaContext]] to which the schema belongs.
|
|
64897
|
+
* @returns A promise that resolves to a EntityClassProps array. Maybe empty of no entities are found.
|
|
64898
|
+
* @internal
|
|
64899
|
+
*/
|
|
64900
|
+
async getEntities(schema, context, queryOverride) {
|
|
64901
|
+
const query = queryOverride ?? _FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__.FullSchemaQueries.entityQuery;
|
|
64902
|
+
return this.querySchemaItem(context, schema, query, "EntityClass");
|
|
64903
|
+
}
|
|
64904
|
+
/**
|
|
64905
|
+
* Gets all the Schema's Mixin classes as [[MixinProps]] JSON objects.
|
|
64906
|
+
* @param schemaName The name of the Schema.
|
|
64907
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64908
|
+
* @returns A promise that resolves to a MixinProps array. Maybe empty of no entities are found.
|
|
64909
|
+
* @internal
|
|
64910
|
+
*/
|
|
64911
|
+
async getMixins(schema, context, queryOverride) {
|
|
64912
|
+
const query = queryOverride ?? _FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__.FullSchemaQueries.mixinQuery;
|
|
64913
|
+
return this.querySchemaItem(context, schema, query, "Mixin");
|
|
64914
|
+
}
|
|
64915
|
+
/**
|
|
64916
|
+
* Gets all the Schema's Relationship classes as [[RelationshipClassProps]] JSON objects.
|
|
64917
|
+
* @param schemaName The name of the Schema.
|
|
64918
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64919
|
+
* @returns A promise that resolves to a RelationshipClassProps array. Maybe empty if no items are found.
|
|
64920
|
+
* @internal
|
|
64921
|
+
*/
|
|
64922
|
+
async getRelationships(schema, context, queryOverride) {
|
|
64923
|
+
const query = queryOverride ?? _FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__.FullSchemaQueries.relationshipClassQuery;
|
|
64924
|
+
return this.querySchemaItem(context, schema, query, "RelationshipClass");
|
|
64925
|
+
}
|
|
64926
|
+
/**
|
|
64927
|
+
* Gets all the Schema's CustomAttributeClass items as [[CustomAttributeClassProps]] JSON objects.
|
|
64928
|
+
* @param schemaName The name of the Schema.
|
|
64929
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64930
|
+
* @returns A promise that resolves to a CustomAttributeClassProps array. Maybe empty if not items are found.
|
|
64931
|
+
* @internal
|
|
64932
|
+
*/
|
|
64933
|
+
async getCustomAttributeClasses(schema, context, queryOverride) {
|
|
64934
|
+
const query = queryOverride ?? _FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__.FullSchemaQueries.customAttributeQuery;
|
|
64935
|
+
return this.querySchemaItem(context, schema, query, "CustomAttributeClass");
|
|
64936
|
+
}
|
|
64937
|
+
/**
|
|
64938
|
+
* Gets all the Schema's StructClass items as [[StructClassProps]] JSON objects.
|
|
64939
|
+
* @param schemaName The name of the Schema.
|
|
64940
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64941
|
+
* @returns A promise that resolves to a StructClassProps array. Maybe empty if not items are found.
|
|
64942
|
+
* @internal
|
|
64943
|
+
*/
|
|
64944
|
+
async getStructs(schema, context, queryOverride) {
|
|
64945
|
+
const query = queryOverride ?? _FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__.FullSchemaQueries.structQuery;
|
|
64946
|
+
return this.querySchemaItem(context, schema, query, "StructClass");
|
|
64947
|
+
}
|
|
64948
|
+
/**
|
|
64949
|
+
* Gets all the Schema's KindOfQuantity items as [[KindOfQuantityProps]] JSON objects.
|
|
64950
|
+
* @param schema The name of the Schema.
|
|
64951
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64952
|
+
* @returns A promise that resolves to a KindOfQuantityProps array. Maybe empty if not items are found.
|
|
64953
|
+
* @internal
|
|
64954
|
+
*/
|
|
64955
|
+
async getKindOfQuantities(schema, context) {
|
|
64956
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.kindOfQuantity(true), "KindOfQuantity");
|
|
64957
|
+
}
|
|
64958
|
+
/**
|
|
64959
|
+
* Gets all the Schema's PropertyCategory items as [[PropertyCategoryProps]] JSON objects.
|
|
64960
|
+
* @param schema The name of the Schema.
|
|
64961
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64962
|
+
* @returns A promise that resolves to a PropertyCategoryProps array. Maybe empty if not items are found.
|
|
64963
|
+
* @internal
|
|
64964
|
+
*/
|
|
64965
|
+
async getPropertyCategories(schema, context) {
|
|
64966
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.propertyCategory(true), "PropertyCategory");
|
|
64967
|
+
}
|
|
64968
|
+
/**
|
|
64969
|
+
* Gets all the Schema's Enumeration items as [[EnumerationProps]] JSON objects.
|
|
64970
|
+
* @param schema The name of the Schema.
|
|
64971
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64972
|
+
* @returns A promise that resolves to a EnumerationProps array. Maybe empty if not items are found.
|
|
64973
|
+
* @internal
|
|
64974
|
+
*/
|
|
64975
|
+
async getEnumerations(schema, context) {
|
|
64976
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.enumeration(true), "Enumeration");
|
|
64977
|
+
}
|
|
64978
|
+
/**
|
|
64979
|
+
* Gets all the Schema's Unit items as [[SchemaItemUnitProps]] JSON objects.
|
|
64980
|
+
* @param schema The name of the Schema.
|
|
64981
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64982
|
+
* @returns A promise that resolves to a SchemaItemUnitProps array. Maybe empty if not items are found.
|
|
64983
|
+
* @internal
|
|
64984
|
+
*/
|
|
64985
|
+
async getUnits(schema, context) {
|
|
64986
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.unit(true), "Unit");
|
|
64987
|
+
}
|
|
64988
|
+
/**
|
|
64989
|
+
* Gets all the Schema's InvertedUnit items as [[InvertedUnitProps]] JSON objects.
|
|
64990
|
+
* @param schema The name of the Schema.
|
|
64991
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
64992
|
+
* @returns A promise that resolves to a InvertedUnitProps array. Maybe empty if not items are found.
|
|
64993
|
+
* @internal
|
|
64994
|
+
*/
|
|
64995
|
+
async getInvertedUnits(schema, context) {
|
|
64996
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.invertedUnit(true), "InvertedUnit");
|
|
64997
|
+
}
|
|
64998
|
+
/**
|
|
64999
|
+
* Gets all the Schema's Constant items as [[ConstantProps]] JSON objects.
|
|
65000
|
+
* @param schema The name of the Schema.
|
|
65001
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
65002
|
+
* @returns A promise that resolves to a ConstantProps array. Maybe empty if not items are found.
|
|
65003
|
+
* @internal
|
|
65004
|
+
*/
|
|
65005
|
+
async getConstants(schema, context) {
|
|
65006
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.constant(true), "Constant");
|
|
65007
|
+
}
|
|
65008
|
+
/**
|
|
65009
|
+
* Gets all the Schema's UnitSystem items as [[UnitSystemProps]] JSON objects.
|
|
65010
|
+
* @param schema The name of the Schema.
|
|
65011
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
65012
|
+
* @returns A promise that resolves to a UnitSystemProps array. Maybe empty if not items are found.
|
|
65013
|
+
* @internal
|
|
65014
|
+
*/
|
|
65015
|
+
async getUnitSystems(schema, context) {
|
|
65016
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.unitSystem(true), "UnitSystem");
|
|
65017
|
+
}
|
|
65018
|
+
/**
|
|
65019
|
+
* Gets all the Schema's Phenomenon items as [[PhenomenonProps]] JSON objects.
|
|
65020
|
+
* @param schema The name of the Schema.
|
|
65021
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
65022
|
+
* @returns A promise that resolves to a PhenomenonProps array. Maybe empty if not items are found.
|
|
65023
|
+
* @internal
|
|
65024
|
+
*/
|
|
65025
|
+
async getPhenomenon(schema, context) {
|
|
65026
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.phenomenon(true), "Phenomenon");
|
|
65027
|
+
}
|
|
65028
|
+
/**
|
|
65029
|
+
* Gets all the Schema's Format items as [[SchemaItemFormatProps]] JSON objects.
|
|
65030
|
+
* @param schema The name of the Schema.
|
|
65031
|
+
* @param context The SchemaContext to which the schema belongs.
|
|
65032
|
+
* @returns A promise that resolves to a SchemaItemFormatProps array. Maybe empty if not items are found.
|
|
65033
|
+
* @internal
|
|
65034
|
+
*/
|
|
65035
|
+
async getFormats(schema, context) {
|
|
65036
|
+
return this.querySchemaItem(context, schema, _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_4__.SchemaItemQueries.format(true), "Format");
|
|
65037
|
+
}
|
|
65038
|
+
/**
|
|
65039
|
+
* Gets [[SchemaInfo]] objects for all schemas including their direct schema references.
|
|
65040
|
+
* @internal
|
|
65041
|
+
*/
|
|
65042
|
+
async loadSchemaInfos() {
|
|
65043
|
+
const schemaRows = await this.executeQuery(_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_6__.ecsqlQueries.schemaInfoQuery);
|
|
65044
|
+
return schemaRows.map((schemaRow) => ({
|
|
65045
|
+
alias: schemaRow.alias,
|
|
65046
|
+
schemaKey: _SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey.parseString(`${schemaRow.name}.${schemaRow.version}`),
|
|
65047
|
+
references: Array.from(JSON.parse(schemaRow.references), parseSchemaReference),
|
|
65048
|
+
}));
|
|
65049
|
+
}
|
|
65050
|
+
/**
|
|
65051
|
+
* Gets the [[SchemaProps]] to create the basic schema skeleton. Depending on which options are set, the schema items or class hierarchy
|
|
65052
|
+
* can be included in the initial fetch.
|
|
65053
|
+
* @param schemaKey The [[SchemaKey]] of the schema to be resolved.
|
|
65054
|
+
* @returns A promise that resolves to the schema partials, which is an array of [[SchemaProps]].
|
|
65055
|
+
* @internal
|
|
65056
|
+
*/
|
|
65057
|
+
async getSchemaPartials(schemaKey, context) {
|
|
65058
|
+
const [schemaRow] = await this.executeQuery(_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_6__.ecsqlQueries.schemaStubQuery, {
|
|
65059
|
+
parameters: { schemaName: schemaKey.name },
|
|
65060
|
+
limit: 1
|
|
65061
|
+
});
|
|
65062
|
+
if (!schemaRow)
|
|
65063
|
+
return undefined;
|
|
65064
|
+
const schemaPartials = [];
|
|
65065
|
+
const addSchema = async (key) => {
|
|
65066
|
+
const stub = await this.createSchemaProps(key, context);
|
|
65067
|
+
schemaPartials.push(stub);
|
|
65068
|
+
if (stub.references) {
|
|
65069
|
+
for (const referenceProps of stub.references) {
|
|
65070
|
+
if (!schemaPartials.some((schema) => schema.name === referenceProps.name)) {
|
|
65071
|
+
await addSchema(_SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey.parseString(`${referenceProps.name}.${referenceProps.version}`));
|
|
65072
|
+
}
|
|
65073
|
+
}
|
|
65074
|
+
}
|
|
65075
|
+
return stub;
|
|
65076
|
+
};
|
|
65077
|
+
const addItems = async (schemaName, itemInfo) => {
|
|
65078
|
+
let schemaStub = schemaPartials.find((schema) => schema.name === schemaName);
|
|
65079
|
+
if (!schemaStub) {
|
|
65080
|
+
schemaStub = await addSchema(_SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey.parseString(`${schemaName}.0.0.0`));
|
|
65081
|
+
}
|
|
65082
|
+
if (!schemaStub.items) {
|
|
65083
|
+
Object.assign(schemaStub, { items: {} });
|
|
65084
|
+
}
|
|
65085
|
+
const existingItem = schemaStub.items[itemInfo.name] || {};
|
|
65086
|
+
Object.assign(schemaStub.items, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });
|
|
65087
|
+
};
|
|
65088
|
+
const reviver = (_key, value) => {
|
|
65089
|
+
if (value === null) {
|
|
65090
|
+
return undefined;
|
|
65091
|
+
}
|
|
65092
|
+
return value;
|
|
65093
|
+
};
|
|
65094
|
+
await addSchema(schemaKey);
|
|
65095
|
+
await parseSchemaItemStubs(schemaKey.name, context, JSON.parse(schemaRow.items, reviver), addItems);
|
|
65096
|
+
return schemaPartials;
|
|
65097
|
+
}
|
|
65098
|
+
async querySchemaItem(context, schemaName, query, schemaType) {
|
|
65099
|
+
const start = Date.now();
|
|
65100
|
+
const itemRows = await this.executeQuery(query, { parameters: { schemaName } });
|
|
65101
|
+
this.options.performanceLogger?.logSchemaItem(start, schemaName, schemaType, itemRows.length);
|
|
65102
|
+
if (itemRows.length === 0)
|
|
65103
|
+
return [];
|
|
65104
|
+
const items = itemRows.map((itemRow) => {
|
|
65105
|
+
return "string" === typeof itemRow.item ? JSON.parse(itemRow.item) : itemRow.item;
|
|
65106
|
+
});
|
|
65107
|
+
return await _SchemaParser__WEBPACK_IMPORTED_MODULE_5__.SchemaParser.parseSchemaItems(items, schemaName, context) ?? [];
|
|
65108
|
+
}
|
|
65109
|
+
async getFullSchema(schemaKey, context) {
|
|
65110
|
+
const schemaRows = await this.executeQuery(_FullSchemaQueries__WEBPACK_IMPORTED_MODULE_2__.FullSchemaQueries.schemaQuery, { parameters: { schemaName: schemaKey.name } });
|
|
65111
|
+
const schemaRow = schemaRows[0];
|
|
65112
|
+
if (schemaRow === undefined)
|
|
65113
|
+
return undefined;
|
|
65114
|
+
// Map SchemaItemRow array, [{item: SchemaItemProps}], to array of SchemaItemProps.
|
|
65115
|
+
const schema = JSON.parse(schemaRow.schema);
|
|
65116
|
+
if (schema.items) {
|
|
65117
|
+
schema.items = schema.items.map((itemRow) => { return itemRow.item; });
|
|
65118
|
+
}
|
|
65119
|
+
return _SchemaParser__WEBPACK_IMPORTED_MODULE_5__.SchemaParser.parse(schema, context);
|
|
65120
|
+
}
|
|
65121
|
+
async getFullSchemaMultipleQueries(schemaKey, context) {
|
|
65122
|
+
const schema = await this.getSchemaNoItems(schemaKey.name, context);
|
|
65123
|
+
if (!schema)
|
|
65124
|
+
return undefined;
|
|
65125
|
+
schema.items = {};
|
|
65126
|
+
await Promise.all([
|
|
65127
|
+
this.getEntities(schemaKey.name, context),
|
|
65128
|
+
this.getMixins(schemaKey.name, context),
|
|
65129
|
+
this.getStructs(schemaKey.name, context),
|
|
65130
|
+
this.getRelationships(schemaKey.name, context),
|
|
65131
|
+
this.getCustomAttributeClasses(schemaKey.name, context),
|
|
65132
|
+
this.getKindOfQuantities(schemaKey.name, context),
|
|
65133
|
+
this.getPropertyCategories(schemaKey.name, context),
|
|
65134
|
+
this.getEnumerations(schemaKey.name, context),
|
|
65135
|
+
this.getUnits(schemaKey.name, context),
|
|
65136
|
+
this.getInvertedUnits(schemaKey.name, context),
|
|
65137
|
+
this.getUnitSystems(schemaKey.name, context),
|
|
65138
|
+
this.getConstants(schemaKey.name, context),
|
|
65139
|
+
this.getPhenomenon(schemaKey.name, context),
|
|
65140
|
+
this.getFormats(schemaKey.name, context)
|
|
65141
|
+
]).then((itemResults) => {
|
|
65142
|
+
const flatItemList = itemResults.reduce((acc, item) => acc.concat(item));
|
|
65143
|
+
flatItemList.forEach((schemaItem) => {
|
|
65144
|
+
schema.items[schemaItem.name] = schemaItem;
|
|
65145
|
+
});
|
|
65146
|
+
});
|
|
65147
|
+
return schema;
|
|
65148
|
+
}
|
|
65149
|
+
}
|
|
65150
|
+
function parseSchemaReference(referenceName) {
|
|
65151
|
+
return { schemaKey: _SchemaKey__WEBPACK_IMPORTED_MODULE_1__.SchemaKey.parseString(referenceName) };
|
|
65152
|
+
}
|
|
65153
|
+
async function parseSchemaItemStubs(schemaName, context, itemRows, addItemsHandler) {
|
|
65154
|
+
if (!itemRows || itemRows.length === 0) {
|
|
65155
|
+
return;
|
|
65156
|
+
}
|
|
65157
|
+
const parseBaseClasses = async (baseClasses) => {
|
|
65158
|
+
if (!baseClasses || baseClasses.length < 2)
|
|
65159
|
+
return;
|
|
65160
|
+
for (let index = baseClasses.length - 1; index >= 0;) {
|
|
65161
|
+
const currentItem = baseClasses[index--];
|
|
65162
|
+
const baseClassItem = baseClasses[index];
|
|
65163
|
+
const baseClassName = baseClassItem ? `${baseClassItem.schema}.${baseClassItem.name}` : undefined;
|
|
65164
|
+
const schemaItem = await _SchemaParser__WEBPACK_IMPORTED_MODULE_5__.SchemaParser.parseItem(currentItem, currentItem.schema, context);
|
|
65165
|
+
await addItemsHandler(currentItem.schema, {
|
|
65166
|
+
...schemaItem,
|
|
65167
|
+
name: schemaItem.name,
|
|
65168
|
+
schemaItemType: (0,_ECObjects__WEBPACK_IMPORTED_MODULE_0__.parseSchemaItemType)(schemaItem.schemaItemType),
|
|
65169
|
+
baseClass: baseClassName,
|
|
65170
|
+
});
|
|
65171
|
+
}
|
|
65172
|
+
};
|
|
65173
|
+
for (const itemRow of itemRows) {
|
|
65174
|
+
const schemaItem = await _SchemaParser__WEBPACK_IMPORTED_MODULE_5__.SchemaParser.parseItem(itemRow, schemaName, context);
|
|
65175
|
+
await addItemsHandler(schemaName, {
|
|
65176
|
+
...schemaItem,
|
|
65177
|
+
name: schemaItem.name,
|
|
65178
|
+
schemaItemType: (0,_ECObjects__WEBPACK_IMPORTED_MODULE_0__.parseSchemaItemType)(schemaItem.schemaItemType),
|
|
65179
|
+
mixins: itemRow.mixins
|
|
65180
|
+
? itemRow.mixins.map(mixin => { return `${mixin.schema}.${mixin.name}`; })
|
|
65181
|
+
: undefined,
|
|
65182
|
+
});
|
|
65183
|
+
await parseBaseClasses(itemRow.baseClasses);
|
|
65184
|
+
for (const mixinRow of itemRow.mixins || []) {
|
|
65185
|
+
const mixinItem = await _SchemaParser__WEBPACK_IMPORTED_MODULE_5__.SchemaParser.parseItem(mixinRow, mixinRow.schema, context);
|
|
65186
|
+
await addItemsHandler(mixinRow.schema, {
|
|
65187
|
+
...mixinItem,
|
|
65188
|
+
name: mixinItem.name,
|
|
65189
|
+
schemaItemType: (0,_ECObjects__WEBPACK_IMPORTED_MODULE_0__.parseSchemaItemType)(mixinItem.schemaItemType),
|
|
65190
|
+
});
|
|
65191
|
+
await parseBaseClasses(mixinRow.baseClasses);
|
|
65192
|
+
}
|
|
65193
|
+
}
|
|
65194
|
+
}
|
|
65195
|
+
|
|
65196
|
+
|
|
65197
|
+
/***/ }),
|
|
65198
|
+
|
|
65199
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/FullSchemaQueries.js":
|
|
65200
|
+
/*!************************************************************************************!*\
|
|
65201
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/FullSchemaQueries.js ***!
|
|
65202
|
+
\************************************************************************************/
|
|
65203
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
65204
|
+
|
|
65205
|
+
"use strict";
|
|
65206
|
+
__webpack_require__.r(__webpack_exports__);
|
|
65207
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65208
|
+
/* harmony export */ FullSchemaQueries: () => (/* binding */ FullSchemaQueries)
|
|
65209
|
+
/* harmony export */ });
|
|
65210
|
+
/* harmony import */ var _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SchemaItemQueries */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemQueries.js");
|
|
65211
|
+
/* harmony import */ var _SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaStubQueries */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaStubQueries.js");
|
|
65212
|
+
/*---------------------------------------------------------------------------------------------
|
|
65213
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
65214
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
65215
|
+
*--------------------------------------------------------------------------------------------*/
|
|
65216
|
+
|
|
65217
|
+
|
|
65218
|
+
/**
|
|
65219
|
+
* Queries that return full Schema JSON data are found here. Shared SELECTS and
|
|
65220
|
+
* WITH clauses are broken down into individual variables.
|
|
65221
|
+
*/
|
|
65222
|
+
const propertyType = (alias) => {
|
|
65223
|
+
return `
|
|
65224
|
+
CASE
|
|
65225
|
+
WHEN [${alias}].[Kind] = 0 THEN 'PrimitiveProperty'
|
|
65226
|
+
WHEN [${alias}].[Kind] = 1 THEN 'StructProperty'
|
|
65227
|
+
WHEN [${alias}].[Kind] = 2 THEN 'PrimitiveArrayProperty'
|
|
65228
|
+
WHEN [${alias}].[Kind] = 3 THEN 'StructArrayProperty'
|
|
65229
|
+
WHEN [${alias}].[Kind] = 4 THEN 'NavigationProperty'
|
|
65230
|
+
ELSE NULL
|
|
65231
|
+
END
|
|
65232
|
+
`;
|
|
65233
|
+
};
|
|
65234
|
+
const navigationDirection = (alias) => {
|
|
65235
|
+
return `
|
|
65236
|
+
CASE
|
|
65237
|
+
WHEN [${alias}].[NavigationDirection] = 1 THEN 'Forward'
|
|
65238
|
+
WHEN [${alias}].[NavigationDirection] = 2 THEN 'Backward'
|
|
65239
|
+
ELSE NULL
|
|
65240
|
+
END
|
|
65241
|
+
`;
|
|
65242
|
+
};
|
|
65243
|
+
const schemaCustomAttribute = (alias) => {
|
|
65244
|
+
return `
|
|
65245
|
+
SELECT
|
|
65246
|
+
json_group_array(json(XmlCAToJson([ca].[Class].[Id], [ca].[Instance])))
|
|
65247
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
65248
|
+
WHERE [ca].[ContainerId] = [${alias}].[ECInstanceId] AND [ca].[ContainerType] = 1
|
|
65249
|
+
ORDER BY [ca].[Ordinal]
|
|
65250
|
+
`;
|
|
65251
|
+
};
|
|
65252
|
+
/**
|
|
65253
|
+
* Selects customAttribute data for each class type.
|
|
65254
|
+
*/
|
|
65255
|
+
const classCustomAttribute = (alias) => {
|
|
65256
|
+
return `
|
|
65257
|
+
SELECT
|
|
65258
|
+
json_group_array(json(XmlCAToJson([ca].[Class].[Id], [ca].[Instance])))
|
|
65259
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
65260
|
+
WHERE [ca].[ContainerId] = [${alias}].[ECInstanceId] AND [ca].[ContainerType] = 30
|
|
65261
|
+
ORDER BY [ca].[Ordinal]
|
|
65262
|
+
`;
|
|
65263
|
+
};
|
|
65264
|
+
const propertyCustomAttribute = (alias) => {
|
|
65265
|
+
return `
|
|
65266
|
+
SELECT
|
|
65267
|
+
json_group_array(json(XmlCAToJson([ca].[Class].[Id], [ca].[Instance])))
|
|
65268
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
65269
|
+
WHERE [ca].[ContainerId] = [${alias}].[ECInstanceId] AND [ca].[ContainerType] = 992
|
|
65270
|
+
ORDER BY [ca].[Ordinal]
|
|
65271
|
+
`;
|
|
65272
|
+
};
|
|
65273
|
+
/**
|
|
65274
|
+
* Selects base class data for each class type.
|
|
65275
|
+
*/
|
|
65276
|
+
const selectBaseClasses = `
|
|
65277
|
+
SELECT
|
|
65278
|
+
ec_classname([baseClass].[ECInstanceId], 's.c')
|
|
65279
|
+
FROM
|
|
65280
|
+
[meta].[ECClassDef] [baseClass]
|
|
65281
|
+
INNER JOIN [meta].[ClassHasBaseClasses] [baseClassMap]
|
|
65282
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseClass].[ECInstanceId]
|
|
65283
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
65284
|
+
LIMIT 1
|
|
65285
|
+
`;
|
|
65286
|
+
/**
|
|
65287
|
+
* Selects class property data for each class type. ClassProperties
|
|
65288
|
+
* is a common table expression (CTE or WITH clause) defined below.
|
|
65289
|
+
*/
|
|
65290
|
+
const selectProperties = `
|
|
65291
|
+
SELECT
|
|
65292
|
+
json_group_array(json([classProperties].[property]))
|
|
65293
|
+
FROM
|
|
65294
|
+
[ClassProperties] [classProperties]
|
|
65295
|
+
WHERE
|
|
65296
|
+
[classProperties].[ClassId] = [class].[ECInstanceId]
|
|
65297
|
+
`;
|
|
65298
|
+
/**
|
|
65299
|
+
* A CTE used to select AppliesTo from IsMixin CustomAttributes for a given Mixin.
|
|
65300
|
+
*/
|
|
65301
|
+
const withAppliesTo = `
|
|
65302
|
+
AppliesToCTE AS (
|
|
65303
|
+
SELECT
|
|
65304
|
+
[mixinAppliesTo].[ECInstanceId] AS [AppliesToId],
|
|
65305
|
+
[appliesToSchema].[name] as [AppliesToSchema],
|
|
65306
|
+
json_extract(XmlCAToJson([ca].[Class].[Id], [ca].[Instance]), '$.IsMixin.AppliesToEntityClass') AS [AppliesTo]
|
|
65307
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
65308
|
+
JOIN [meta].[ECClassDef] [mixinAppliesTo]
|
|
65309
|
+
ON [mixinAppliesTo].[ECInstanceId] = [ca].[ContainerId]
|
|
65310
|
+
JOIN [meta].[ECSchemaDef] [appliesToSchema]
|
|
65311
|
+
ON [appliesToSchema].[ECInstanceId] = [mixinAppliesTo].[Schema].[Id]
|
|
65312
|
+
WHERE [ca].[ContainerType] = 30
|
|
65313
|
+
AND json_extract(XmlCAToJson([ca].[Class].[Id], [ca].[Instance]), '$.ecClass') = 'IsMixin'
|
|
65314
|
+
)
|
|
65315
|
+
`;
|
|
65316
|
+
/**
|
|
65317
|
+
* A CTE used to select Schema reference data for a given Schema.
|
|
65318
|
+
*/
|
|
65319
|
+
const withSchemaReferences = `
|
|
65320
|
+
SchemaReferences as (
|
|
65321
|
+
SELECT
|
|
65322
|
+
[ref].[SourceECInstanceId] as [SchemaId],
|
|
65323
|
+
json_object(
|
|
65324
|
+
'name', [Name],
|
|
65325
|
+
'version', CONCAT(printf('%02d', [VersionMajor]), '.', printf('%02d', [VersionWrite]), '.', printf('%02d', [VersionMinor]))
|
|
65326
|
+
) as [reference]
|
|
65327
|
+
FROM
|
|
65328
|
+
[meta].[ECSchemaDef] as [refSchema]
|
|
65329
|
+
INNER JOIN [meta].[SchemaHasSchemaReferences] [ref]
|
|
65330
|
+
ON [ref].[TargetECInstanceId] = [refSchema].[ECInstanceId]
|
|
65331
|
+
)
|
|
65332
|
+
`;
|
|
65333
|
+
/**
|
|
65334
|
+
* A CTE used to select Relationship constraints for a given RelationshipClass.
|
|
65335
|
+
*/
|
|
65336
|
+
const withRelationshipConstraints = `
|
|
65337
|
+
ClassRelationshipConstraints as (
|
|
65338
|
+
SELECT
|
|
65339
|
+
[rhc].[SourceECInstanceId] as [ClassId],
|
|
65340
|
+
[constraintDef].[ECInstanceId] as [ConstraintId],
|
|
65341
|
+
[RelationshipEnd],
|
|
65342
|
+
CONCAT('(', [MultiplicityLowerLimit], '..', IIF([MultiplicityUpperLimit] IS NULL, '*', [MultiplicityUpperLimit]), ')') as [Multiplicity],
|
|
65343
|
+
[IsPolyMorphic],
|
|
65344
|
+
[RoleLabel],
|
|
65345
|
+
IIF([constraintDef].[AbstractConstraintClass] IS NOT NULL, ec_classname([constraintDef].[AbstractConstraintClass].[Id], 's.c'), null) as [AbstractConstraint],
|
|
65346
|
+
IIF ([rchc].[TargetECInstanceId] IS NOT NULL, JSON_GROUP_ARRAY(ec_classname([rchc].[TargetECInstanceId], 's.c')), null) as [ConstraintClasses]
|
|
65347
|
+
FROM
|
|
65348
|
+
[meta].[ECRelationshipConstraintDef] [constraintDef]
|
|
65349
|
+
JOIN [meta].[RelationshipHasConstraints] [rhc]
|
|
65350
|
+
ON [rhc].[TargetECInstanceId] = [constraintDef].[ECInstanceId]
|
|
65351
|
+
JOIN [meta].[RelationshipConstraintHasClasses] [rchc]
|
|
65352
|
+
ON [rchc].[SourceECInstanceId] = [constraintDef].[ECInstanceId]
|
|
65353
|
+
GROUP BY [constraintDef].[ECInstanceId]
|
|
65354
|
+
)
|
|
65355
|
+
`;
|
|
65356
|
+
/**
|
|
65357
|
+
* A CTE used to select Class property data for a given Class.
|
|
65358
|
+
*/
|
|
65359
|
+
const withClassProperties = `
|
|
65360
|
+
ClassProperties as (
|
|
65361
|
+
SELECT
|
|
65362
|
+
[cop].[SourceECInstanceId] as [ClassId],
|
|
65363
|
+
json_object(
|
|
65364
|
+
'name', [pd].[Name],
|
|
65365
|
+
'label', [pd].[DisplayLabel],
|
|
65366
|
+
'description', [pd].[Description],
|
|
65367
|
+
'isReadOnly', IIF([pd].[IsReadOnly] = 1, json('true'), NULL),
|
|
65368
|
+
'priority', [pd].[Priority],
|
|
65369
|
+
'category', IIF([categoryDef].[Name] IS NULL, NULL, CONCAT([categorySchemaDef].[Name], '.', [categoryDef].[Name])),
|
|
65370
|
+
'kindOfQuantity', IIF([koqDef].[Name] IS NULL, NULL, CONCAT([koqSchemaDef].[Name], '.', [koqDef].[Name])),
|
|
65371
|
+
'typeName',
|
|
65372
|
+
CASE
|
|
65373
|
+
WHEN [pd].[Kind] = 0 OR [pd].[Kind] = 2 Then
|
|
65374
|
+
CASE
|
|
65375
|
+
WHEN [enumDef].[Name] IS NOT NULL Then CONCAT([enumSchemaDef].[Name], '.', [enumDef].[Name])
|
|
65376
|
+
WHEN [pd].[PrimitiveType] = 257 Then 'binary'
|
|
65377
|
+
WHEN [pd].[PrimitiveType] = 513 Then 'boolean'
|
|
65378
|
+
WHEN [pd].[PrimitiveType] = 769 Then 'dateTime'
|
|
65379
|
+
WHEN [pd].[PrimitiveType] = 1025 Then 'double'
|
|
65380
|
+
WHEN [pd].[PrimitiveType] = 1281 Then 'int'
|
|
65381
|
+
WHEN [pd].[PrimitiveType] = 1537 Then 'long'
|
|
65382
|
+
WHEN [pd].[PrimitiveType] = 1793 Then 'point2d'
|
|
65383
|
+
WHEN [pd].[PrimitiveType] = 2049 Then 'point3d'
|
|
65384
|
+
WHEN [pd].[PrimitiveType] = 2305 Then 'string'
|
|
65385
|
+
WHEN [pd].[PrimitiveType] = 2561 Then 'Bentley.Geometry.Common.IGeometry'
|
|
65386
|
+
ELSE null
|
|
65387
|
+
END
|
|
65388
|
+
WHEN [pd].[Kind] = 1 OR [pd].[Kind] = 3 Then
|
|
65389
|
+
CONCAT([structSchemaDef].[Name], '.', [structDef].[Name])
|
|
65390
|
+
ELSE null
|
|
65391
|
+
END,
|
|
65392
|
+
'type', ${propertyType("pd")},
|
|
65393
|
+
'minLength', [pd].[PrimitiveTypeMinLength],
|
|
65394
|
+
'maxLength', [pd].[PrimitiveTypeMaxLength],
|
|
65395
|
+
'minValue', [pd].[PrimitiveTypeMinValue],
|
|
65396
|
+
'maxValue', [pd].[PrimitiveTypeMaxValue],
|
|
65397
|
+
'extendedTypeName', [pd].[ExtendedTypeName],
|
|
65398
|
+
'minOccurs', [pd].[ArrayMinOccurs],
|
|
65399
|
+
'maxOccurs', [pd].[ArrayMaxOccurs],
|
|
65400
|
+
'direction', ${navigationDirection("pd")},
|
|
65401
|
+
'relationshipName', IIF([navRelDef].[Name] IS NULL, NULL, CONCAT([navSchemaDef].[Name], '.', [navRelDef].[Name])),
|
|
65402
|
+
'customAttributes', (${propertyCustomAttribute("pd")})
|
|
65403
|
+
) as [property]
|
|
65404
|
+
FROM
|
|
65405
|
+
[meta].[ECPropertyDef] as [pd]
|
|
65406
|
+
JOIN [meta].[ClassOwnsLocalProperties] [cop]
|
|
65407
|
+
ON cop.[TargetECInstanceId] = [pd].[ECInstanceId]
|
|
65408
|
+
LEFT JOIN [meta].[ECEnumerationDef] [enumDef]
|
|
65409
|
+
ON [enumDef].[ECInstanceId] = [pd].[Enumeration].[Id]
|
|
65410
|
+
LEFT JOIN [meta].[ECSchemaDef] enumSchemaDef
|
|
65411
|
+
ON [enumSchemaDef].[ECInstanceId] = [enumDef].[Schema].[Id]
|
|
65412
|
+
LEFT JOIN [meta].[PropertyCategoryDef] [categoryDef]
|
|
65413
|
+
ON [categoryDef].[ECInstanceId] = [pd].[Category].[Id]
|
|
65414
|
+
LEFT JOIN [meta].[ECSchemaDef] [categorySchemaDef]
|
|
65415
|
+
ON [categorySchemaDef].[ECInstanceId] = [categoryDef].[Schema].[Id]
|
|
65416
|
+
LEFT JOIN [meta].[KindOfQuantityDef] [koqDef]
|
|
65417
|
+
ON [koqDef].[ECInstanceId] = [pd].[KindOfQuantity].[Id]
|
|
65418
|
+
LEFT JOIN [meta].[ECSchemaDef] [koqSchemaDef]
|
|
65419
|
+
ON [koqSchemaDef].[ECInstanceId] = [koqDef].[Schema].[Id]
|
|
65420
|
+
LEFT JOIN [meta].[ECClassDef] [structDef]
|
|
65421
|
+
ON structDef.[ECInstanceId] = [pd].[StructClass].[Id]
|
|
65422
|
+
LEFT JOIN [meta].[ECSchemaDef] [structSchemaDef]
|
|
65423
|
+
ON [structSchemaDef].[ECInstanceId] = [structDef].[Schema].[Id]
|
|
65424
|
+
LEFT JOIN [meta].[ECClassDef] [navRelDef]
|
|
65425
|
+
ON [navRelDef].[ECInstanceId] = [pd].[NavigationRelationshipClass].[Id]
|
|
65426
|
+
LEFT JOIN [meta].[ECSchemaDef] [navSchemaDef]
|
|
65427
|
+
ON [navSchemaDef].[ECInstanceId] = [navRelDef].[Schema].[Id]
|
|
65428
|
+
)
|
|
65429
|
+
`;
|
|
65430
|
+
/**
|
|
65431
|
+
* Query that provides EntityClass data and is shared by two cases:
|
|
65432
|
+
* 1. A single query to return a full schema.
|
|
65433
|
+
* 2. When querying a full schema with multiple schema item queries or
|
|
65434
|
+
* when just querying for Entity classes.
|
|
65435
|
+
*/
|
|
65436
|
+
const baseEntityQuery = `
|
|
65437
|
+
SELECT
|
|
65438
|
+
[sd].[Name] as [schema],
|
|
65439
|
+
json_object (
|
|
65440
|
+
'schemaItemType', 'EntityClass',
|
|
65441
|
+
'name', [class].[Name],
|
|
65442
|
+
'label', [class].[DisplayLabel],
|
|
65443
|
+
'description', [class].[Description],
|
|
65444
|
+
'modifier', ${(0,_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__.modifier)("class")},
|
|
65445
|
+
'baseClass', (
|
|
65446
|
+
${selectBaseClasses}
|
|
65447
|
+
),
|
|
65448
|
+
'mixins', (
|
|
65449
|
+
SELECT
|
|
65450
|
+
json_group_array(
|
|
65451
|
+
ec_classname([baseClass].[ECInstanceId], 's.c')
|
|
65452
|
+
)
|
|
65453
|
+
FROM
|
|
65454
|
+
[meta].[ECClassDef] [baseClass]
|
|
65455
|
+
INNER JOIN [meta].[ClassHasBaseClasses] [baseClassMap]
|
|
65456
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseClass].[ECInstanceId]
|
|
65457
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
65458
|
+
AND EXISTS(SELECT 1 FROM [meta].[ClassCustomAttribute] [ca] WHERE [baseClass].[ECInstanceId] = [ca].[Class].[Id]
|
|
65459
|
+
AND [ca].[CustomAttributeClass].[Id] Is ([CoreCA].[IsMixin]))
|
|
65460
|
+
),
|
|
65461
|
+
'customAttributes', (${classCustomAttribute("class")}),
|
|
65462
|
+
'properties', (
|
|
65463
|
+
${selectProperties}
|
|
65464
|
+
)
|
|
65465
|
+
) AS [item]
|
|
65466
|
+
FROM [meta].[ECClassDef] [class]
|
|
65467
|
+
JOIN
|
|
65468
|
+
[meta].[ECSchemaDef] [sd] ON [sd].[ECInstanceId] = [class].[Schema].[Id]
|
|
65469
|
+
WHERE [class].[Type] = 0 AND
|
|
65470
|
+
[sd].[Name] = :schemaName
|
|
65471
|
+
AND NOT EXISTS(SELECT 1 FROM [meta].[ClassCustomAttribute] [ca] WHERE [class].[ECInstanceId] = [ca].[Class].[Id]
|
|
65472
|
+
AND [ca].[CustomAttributeClass].Id Is ([CoreCA].[IsMixin]))
|
|
65473
|
+
`;
|
|
65474
|
+
/**
|
|
65475
|
+
* EntityClass query used to when querying for EntityClass data only. Not used
|
|
65476
|
+
* for full Schema load via single query.
|
|
65477
|
+
*/
|
|
65478
|
+
const entityQuery = `
|
|
65479
|
+
WITH
|
|
65480
|
+
${withClassProperties}
|
|
65481
|
+
${baseEntityQuery}
|
|
65482
|
+
`;
|
|
65483
|
+
/**
|
|
65484
|
+
* Query that provides Mixin data and is shared by two cases:
|
|
65485
|
+
* 1. A single query to return a full schema.
|
|
65486
|
+
* 2. When querying a full schema with multiple schema item queries or
|
|
65487
|
+
* when just querying for Mixin classes.
|
|
65488
|
+
*/
|
|
65489
|
+
const baseMixinQuery = `
|
|
65490
|
+
SELECT
|
|
65491
|
+
[sd].[Name] as [schema],
|
|
65492
|
+
json_object (
|
|
65493
|
+
'schemaItemType', 'Mixin',
|
|
65494
|
+
'name', [class].[Name],
|
|
65495
|
+
'label', [class].[DisplayLabel],
|
|
65496
|
+
'description', [class].[Description],
|
|
65497
|
+
'modifier', ${(0,_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__.modifier)("class")},
|
|
65498
|
+
'baseClass', (
|
|
65499
|
+
${selectBaseClasses}
|
|
65500
|
+
),
|
|
65501
|
+
'appliesTo', (
|
|
65502
|
+
SELECT IIF(instr([atCTE].[AppliesTo], ':') > 1, ec_classname(ec_classId([atCTE].[AppliesTo]), 's.c'), CONCAT([atCTE].[AppliesToSchema], '.', [atCTE].[AppliesTo]))
|
|
65503
|
+
FROM [AppliesToCTE] [atCTE]
|
|
65504
|
+
WHERE [atCTE].[AppliesToId] = [class].[ECInstanceId]
|
|
65505
|
+
),
|
|
65506
|
+
'customAttributes', (
|
|
65507
|
+
SELECT
|
|
65508
|
+
json_group_array(json(XmlCAToJson([ca].[Class].[Id], [ca].[Instance])))
|
|
65509
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
65510
|
+
WHERE [ca].[ContainerId] = [class].[ECInstanceId] AND [ca].[ContainerType] = 30
|
|
65511
|
+
AND json_extract(XmlCAToJson([ca].[Class].[Id], [ca].[Instance]), '$.ecClass') <> 'IsMixin'
|
|
65512
|
+
),
|
|
65513
|
+
'properties', (
|
|
65514
|
+
SELECT
|
|
65515
|
+
json_group_array(json([classProperties].[property]))
|
|
65516
|
+
FROM
|
|
65517
|
+
[ClassProperties] [classProperties]
|
|
65518
|
+
WHERE
|
|
65519
|
+
[classProperties].[ClassId] = [class].[ECInstanceId]
|
|
65520
|
+
)
|
|
65521
|
+
) AS [item]
|
|
65522
|
+
FROM [meta].[ECClassDef] [class]
|
|
65523
|
+
JOIN
|
|
65524
|
+
[meta].[ECSchemaDef] [sd] ON [sd].[ECInstanceId] = [class].[Schema].[Id]
|
|
65525
|
+
WHERE [class].[Type] = 0 AND
|
|
65526
|
+
[sd].[Name] = :schemaName
|
|
65527
|
+
AND EXISTS(SELECT 1 FROM [meta].[ClassCustomAttribute] [ca] WHERE [class].[ECInstanceId] = [ca].[Class].[Id]
|
|
65528
|
+
AND [ca].[CustomAttributeClass].[Id] Is ([CoreCA].[IsMixin]))
|
|
65529
|
+
`;
|
|
65530
|
+
/**
|
|
65531
|
+
* Mixin query used to when querying for Mixin data only. Not used
|
|
65532
|
+
* for full Schema load via single query.
|
|
65533
|
+
*/
|
|
65534
|
+
const mixinQuery = `
|
|
65535
|
+
WITH
|
|
65536
|
+
${withAppliesTo},
|
|
65537
|
+
${withClassProperties}
|
|
65538
|
+
${baseMixinQuery}
|
|
65539
|
+
`;
|
|
65540
|
+
/**
|
|
65541
|
+
* Query that provides RelationshipClass data and is shared by two cases:
|
|
65542
|
+
* 1. A single query to return a full schema.
|
|
65543
|
+
* 2. When querying a full schema with multiple schema item queries or
|
|
65544
|
+
* when just querying for Relationship classes.
|
|
65545
|
+
*/
|
|
65546
|
+
const baseRelationshipClassQuery = `
|
|
65547
|
+
SELECT
|
|
65548
|
+
[sd].Name as schema,
|
|
65549
|
+
json_object (
|
|
65550
|
+
'schemaItemType', 'RelationshipClass',
|
|
65551
|
+
'name', [class].[Name],
|
|
65552
|
+
'label', [class].[DisplayLabel],
|
|
65553
|
+
'description', [class].[Description],
|
|
65554
|
+
'strength', ${(0,_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__.strength)("class")},
|
|
65555
|
+
'strengthDirection', ${(0,_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__.strengthDirection)("class")},
|
|
65556
|
+
'modifier', ${(0,_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__.modifier)("class")},
|
|
65557
|
+
'baseClass', (
|
|
65558
|
+
${selectBaseClasses}
|
|
65559
|
+
),
|
|
65560
|
+
'customAttributes', (${classCustomAttribute("class")}),
|
|
65561
|
+
'properties', (
|
|
65562
|
+
${selectProperties}
|
|
65563
|
+
),
|
|
65564
|
+
'source', (
|
|
65565
|
+
SELECT
|
|
65566
|
+
json_object (
|
|
65567
|
+
'multiplicity', [sourceConst].[Multiplicity],
|
|
65568
|
+
'roleLabel', [sourceConst].[RoleLabel],
|
|
65569
|
+
'polymorphic', IIF([sourceConst].[IsPolyMorphic] = 1, json('true'), json('false')),
|
|
65570
|
+
'abstractConstraint', [sourceConst].[AbstractConstraint],
|
|
65571
|
+
'constraintClasses', json([sourceConst].[ConstraintClasses]),
|
|
65572
|
+
'customAttributes', (
|
|
65573
|
+
SELECT
|
|
65574
|
+
json_group_array(json(XmlCAToJson([ca].[Class].[Id], [ca].[Instance])))
|
|
65575
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
65576
|
+
WHERE [ca].[ContainerId] = [sourceConst].[ConstraintId] AND [ca].[ContainerType] = 1024
|
|
65577
|
+
ORDER BY [ca].[Ordinal]
|
|
65578
|
+
)
|
|
65579
|
+
)
|
|
65580
|
+
FROM
|
|
65581
|
+
[ClassRelationshipConstraints] [sourceConst]
|
|
65582
|
+
WHERE [sourceConst].[relationshipEnd] = 0
|
|
65583
|
+
AND [sourceConst].[ClassId] = [class].[ECInstanceId]
|
|
65584
|
+
),
|
|
65585
|
+
'target', (
|
|
65586
|
+
SELECT
|
|
65587
|
+
json_object (
|
|
65588
|
+
'multiplicity', [targetConst].[Multiplicity],
|
|
65589
|
+
'roleLabel', [targetConst].[RoleLabel],
|
|
65590
|
+
'polymorphic', IIF([targetConst].[IsPolyMorphic] = 1, json('true'), json('false')),
|
|
65591
|
+
'abstractConstraint', [targetConst].[AbstractConstraint],
|
|
65592
|
+
'constraintClasses', json([targetConst].[ConstraintClasses]),
|
|
65593
|
+
'customAttributes', (
|
|
65594
|
+
SELECT
|
|
65595
|
+
json_group_array(json(XmlCAToJson([ca].[Class].[Id], [ca].[Instance])))
|
|
65596
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
65597
|
+
WHERE [ca].[ContainerId] = [targetConst].[ConstraintId] AND [ca].[ContainerType] = 2048
|
|
65598
|
+
ORDER BY [ca].[Ordinal]
|
|
65599
|
+
)
|
|
65600
|
+
)
|
|
65601
|
+
FROM
|
|
65602
|
+
[ClassRelationshipConstraints] [targetConst]
|
|
65603
|
+
WHERE [targetConst].[relationshipEnd] = 1
|
|
65604
|
+
AND [targetConst].[ClassId] = [class].[ECInstanceId]
|
|
65605
|
+
)
|
|
65606
|
+
) AS [item]
|
|
65607
|
+
FROM [meta].[ECClassDef] [class]
|
|
65608
|
+
JOIN
|
|
65609
|
+
[meta].[ECSchemaDef] [sd] ON [sd].[ECInstanceId] = [class].[Schema].[Id]
|
|
65610
|
+
WHERE [class].[Type] = 1 AND
|
|
65611
|
+
[sd].[Name] = :schemaName
|
|
65612
|
+
`;
|
|
65613
|
+
/**
|
|
65614
|
+
* RelationshipClass query used to when querying for RelationshipClass data only. Not used
|
|
65615
|
+
* for full Schema load via single query.
|
|
65616
|
+
*/
|
|
65617
|
+
const relationshipClassQuery = `
|
|
65618
|
+
WITH
|
|
65619
|
+
${withClassProperties},
|
|
65620
|
+
${withRelationshipConstraints}
|
|
65621
|
+
${baseRelationshipClassQuery}
|
|
65622
|
+
`;
|
|
65623
|
+
/**
|
|
65624
|
+
* Query that provides StructClass data and is shared by two cases:
|
|
65625
|
+
* 1. A single query to return a full schema.
|
|
65626
|
+
* 2. When querying a full schema with multiple schema item queries or
|
|
65627
|
+
* when just querying for Struct classes.
|
|
65628
|
+
*/
|
|
65629
|
+
const baseStructQuery = `
|
|
65630
|
+
SELECT
|
|
65631
|
+
[sd].Name as schema,
|
|
65632
|
+
json_object (
|
|
65633
|
+
'schemaItemType', 'StructClass',
|
|
65634
|
+
'name', [class].[Name],
|
|
65635
|
+
'label', [class].[DisplayLabel],
|
|
65636
|
+
'description', [class].[Description],
|
|
65637
|
+
'modifier', ${(0,_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__.modifier)("class")},
|
|
65638
|
+
'baseClass', (
|
|
65639
|
+
${selectBaseClasses}
|
|
65640
|
+
),
|
|
65641
|
+
'customAttributes', (${classCustomAttribute("class")}),
|
|
65642
|
+
'properties', (
|
|
65643
|
+
${selectProperties}
|
|
65644
|
+
)
|
|
65645
|
+
) AS item
|
|
65646
|
+
FROM [meta].[ECClassDef] [class]
|
|
65647
|
+
JOIN
|
|
65648
|
+
[meta].[ECSchemaDef] [sd] ON [sd].[ECInstanceId] = [class].[Schema].[Id]
|
|
65649
|
+
WHERE [class].[Type] = 2 AND
|
|
65650
|
+
[sd].[Name] = :schemaName
|
|
65651
|
+
`;
|
|
65652
|
+
/**
|
|
65653
|
+
* StructClass query used to when querying for StructClass data only. Not used
|
|
65654
|
+
* for full Schema load via single query.
|
|
65655
|
+
*/
|
|
65656
|
+
const structQuery = `
|
|
65657
|
+
WITH
|
|
65658
|
+
${withClassProperties}
|
|
65659
|
+
${baseStructQuery}
|
|
65660
|
+
`;
|
|
65661
|
+
/**
|
|
65662
|
+
* Query that provides CustomAttributeClass data and is shared by two cases:
|
|
65663
|
+
* 1. A single query to return a full schema.
|
|
65664
|
+
* 2. When querying a full schema with multiple schema item queries or
|
|
65665
|
+
* when just querying for CustomAttribute classes.
|
|
65666
|
+
*/
|
|
65667
|
+
const baseCustomAttributeQuery = `
|
|
65668
|
+
SELECT
|
|
65669
|
+
[sd].Name as schema,
|
|
65670
|
+
json_object (
|
|
65671
|
+
'schemaItemType', 'CustomAttributeClass',
|
|
65672
|
+
'name', [class].[Name],
|
|
65673
|
+
'label', [class].[DisplayLabel],
|
|
65674
|
+
'description', [class].[Description],
|
|
65675
|
+
'appliesTo', [class].[CustomAttributeContainerType],
|
|
65676
|
+
'modifier', ${(0,_SchemaStubQueries__WEBPACK_IMPORTED_MODULE_1__.modifier)("class")},
|
|
65677
|
+
'baseClass', (
|
|
65678
|
+
${selectBaseClasses}
|
|
65679
|
+
),
|
|
65680
|
+
'customAttributes', (${classCustomAttribute("class")}),
|
|
65681
|
+
'properties', (
|
|
65682
|
+
${selectProperties}
|
|
65683
|
+
)
|
|
65684
|
+
) AS [item]
|
|
65685
|
+
FROM [meta].[ECClassDef] [class]
|
|
65686
|
+
JOIN
|
|
65687
|
+
[meta].[ECSchemaDef] sd ON [sd].[ECInstanceId] = [class].[Schema].[Id]
|
|
65688
|
+
WHERE [class].[Type] = 3 AND
|
|
65689
|
+
[sd].[Name] = :schemaName
|
|
65690
|
+
`;
|
|
65691
|
+
/**
|
|
65692
|
+
* CustomAttributeClass query used to when querying for CustomAttributeClass data only. Not used
|
|
65693
|
+
* for full Schema load via single query.
|
|
65694
|
+
*/
|
|
65695
|
+
const customAttributeQuery = `
|
|
65696
|
+
WITH
|
|
65697
|
+
${withClassProperties}
|
|
65698
|
+
${baseCustomAttributeQuery}
|
|
65699
|
+
`;
|
|
65700
|
+
/**
|
|
65701
|
+
* Used by full schema load query via single query. Allows
|
|
65702
|
+
* all SchemaItemTypes to be queried at once.
|
|
65703
|
+
*/
|
|
65704
|
+
const withSchemaItems = `
|
|
65705
|
+
SchemaItems AS (
|
|
65706
|
+
${baseEntityQuery}
|
|
65707
|
+
UNION ALL
|
|
65708
|
+
${baseRelationshipClassQuery}
|
|
65709
|
+
UNION ALL
|
|
65710
|
+
${baseStructQuery}
|
|
65711
|
+
UNION ALL
|
|
65712
|
+
${baseMixinQuery}
|
|
65713
|
+
UNION ALL
|
|
65714
|
+
${baseCustomAttributeQuery}
|
|
65715
|
+
UNION ALL
|
|
65716
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.kindOfQuantity(true)}
|
|
65717
|
+
UNION ALL
|
|
65718
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.enumeration(true)}
|
|
65719
|
+
UNION ALL
|
|
65720
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.propertyCategory(true)}
|
|
65721
|
+
UNION ALL
|
|
65722
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.unit(true)}
|
|
65723
|
+
UNION ALL
|
|
65724
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.invertedUnit(true)}
|
|
65725
|
+
UNION ALL
|
|
65726
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.unitSystem(true)}
|
|
65727
|
+
UNION ALL
|
|
65728
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.constant(true)}
|
|
65729
|
+
UNION ALL
|
|
65730
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.phenomenon(true)}
|
|
65731
|
+
UNION ALL
|
|
65732
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.format(true)}
|
|
65733
|
+
)
|
|
65734
|
+
`;
|
|
65735
|
+
/**
|
|
65736
|
+
* Query for Schema data without SchemaItems
|
|
65737
|
+
*/
|
|
65738
|
+
const schemaNoItemsQuery = `
|
|
65739
|
+
WITH
|
|
65740
|
+
${withSchemaReferences}
|
|
65741
|
+
SELECT
|
|
65742
|
+
json_object (
|
|
65743
|
+
'name', [schemaDef].[Name],
|
|
65744
|
+
'version', CONCAT(printf('%02d', [VersionMajor]), '.', printf('%02d', [VersionWrite]), '.', printf('%02d', [VersionMinor])),
|
|
65745
|
+
'alias', [schemaDef].[Alias],
|
|
65746
|
+
'label', [schemaDef].[DisplayLabel],
|
|
65747
|
+
'description', [schemaDef].[Description],
|
|
65748
|
+
'ecSpecMajorVersion', [schemaDef].[OriginalECXmlVersionMajor],
|
|
65749
|
+
'ecSpecMinorVersion', [schemaDef].[OriginalECXmlVersionMinor],
|
|
65750
|
+
'customAttributes', (${schemaCustomAttribute("schemaDef")}),
|
|
65751
|
+
'references', (
|
|
65752
|
+
SELECT
|
|
65753
|
+
json_group_array(json([schemaReferences].[reference]))
|
|
65754
|
+
FROM
|
|
65755
|
+
[SchemaReferences] [schemaReferences]
|
|
65756
|
+
WHERE
|
|
65757
|
+
[schemaReferences].[SchemaId] = [schemaDef].[ECInstanceId]
|
|
65758
|
+
)
|
|
65759
|
+
) as [schema]
|
|
65760
|
+
FROM
|
|
65761
|
+
[meta].[ECSchemaDef] [schemaDef] WHERE [Name] = :schemaName
|
|
65762
|
+
`;
|
|
65763
|
+
/**
|
|
65764
|
+
* Query to load a full Schema via a single query.
|
|
65765
|
+
*/
|
|
65766
|
+
const schemaQuery = `
|
|
65767
|
+
WITH
|
|
65768
|
+
${withAppliesTo},
|
|
65769
|
+
${withSchemaReferences},
|
|
65770
|
+
${withClassProperties},
|
|
65771
|
+
${withRelationshipConstraints},
|
|
65772
|
+
${withSchemaItems}
|
|
65773
|
+
SELECT
|
|
65774
|
+
json_object (
|
|
65775
|
+
'name', [schemaDef].[Name],
|
|
65776
|
+
'version', CONCAT(printf('%02d', [VersionMajor]), '.', printf('%02d', [VersionWrite]), '.', printf('%02d', [VersionMinor])),
|
|
65777
|
+
'alias', [schemaDef].[Alias],
|
|
65778
|
+
'label', [schemaDef].[DisplayLabel],
|
|
65779
|
+
'description', [schemaDef].[Description],
|
|
65780
|
+
'ecSpecMajorVersion', [schemaDef].[OriginalECXmlVersionMajor],
|
|
65781
|
+
'ecSpecMinorVersion', [schemaDef].[OriginalECXmlVersionMinor],
|
|
65782
|
+
'customAttributes', (${schemaCustomAttribute("schemaDef")}),
|
|
65783
|
+
'references', (
|
|
65784
|
+
SELECT
|
|
65785
|
+
json_group_array(json([schemaReferences].[reference]))
|
|
65786
|
+
FROM
|
|
65787
|
+
[SchemaReferences] [schemaReferences]
|
|
65788
|
+
WHERE
|
|
65789
|
+
[schemaReferences].[SchemaId] = [schemaDef].[ECInstanceId]
|
|
65790
|
+
),
|
|
65791
|
+
'items', (
|
|
65792
|
+
SELECT
|
|
65793
|
+
json_group_array(json(json_object(
|
|
65794
|
+
'item', json([items].[item])
|
|
65795
|
+
)))
|
|
65796
|
+
FROM
|
|
65797
|
+
[SchemaItems] [items]
|
|
65798
|
+
)
|
|
65799
|
+
) as [schema]
|
|
65800
|
+
FROM
|
|
65801
|
+
[meta].[ECSchemaDef] [schemaDef] WHERE [Name] = :schemaName
|
|
65802
|
+
`;
|
|
65803
|
+
/**
|
|
65804
|
+
* Queries for loading full Schema JSON.
|
|
65805
|
+
* @internal
|
|
65806
|
+
*/
|
|
65807
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
65808
|
+
const FullSchemaQueries = {
|
|
65809
|
+
schemaQuery,
|
|
65810
|
+
schemaNoItemsQuery,
|
|
65811
|
+
entityQuery,
|
|
65812
|
+
relationshipClassQuery,
|
|
65813
|
+
mixinQuery,
|
|
65814
|
+
structQuery,
|
|
65815
|
+
customAttributeQuery
|
|
65816
|
+
};
|
|
65817
|
+
|
|
65818
|
+
|
|
65819
|
+
/***/ }),
|
|
65820
|
+
|
|
65821
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js":
|
|
65822
|
+
/*!*******************************************************************************************!*\
|
|
65823
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js ***!
|
|
65824
|
+
\*******************************************************************************************/
|
|
65825
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
65826
|
+
|
|
65827
|
+
"use strict";
|
|
65828
|
+
__webpack_require__.r(__webpack_exports__);
|
|
65829
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65830
|
+
/* harmony export */ IncrementalSchemaLocater: () => (/* binding */ IncrementalSchemaLocater)
|
|
65831
|
+
/* harmony export */ });
|
|
65832
|
+
/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Constants */ "../../core/ecschema-metadata/lib/esm/Constants.js");
|
|
65833
|
+
/* harmony import */ var _Deserialization_SchemaGraphUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Deserialization/SchemaGraphUtil */ "../../core/ecschema-metadata/lib/esm/Deserialization/SchemaGraphUtil.js");
|
|
65834
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
65835
|
+
/* harmony import */ var _Exception__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Exception */ "../../core/ecschema-metadata/lib/esm/Exception.js");
|
|
65836
|
+
/* harmony import */ var _Metadata_Schema__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Metadata/Schema */ "../../core/ecschema-metadata/lib/esm/Metadata/Schema.js");
|
|
65837
|
+
/* harmony import */ var _SchemaKey__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../SchemaKey */ "../../core/ecschema-metadata/lib/esm/SchemaKey.js");
|
|
65838
|
+
/* harmony import */ var _utils_SchemaLoadingController__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/SchemaLoadingController */ "../../core/ecschema-metadata/lib/esm/utils/SchemaLoadingController.js");
|
|
65839
|
+
/* harmony import */ var _IncrementalSchemaReader__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./IncrementalSchemaReader */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaReader.js");
|
|
65840
|
+
/*---------------------------------------------------------------------------------------------
|
|
65841
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
65842
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
65843
|
+
*--------------------------------------------------------------------------------------------*/
|
|
65844
|
+
|
|
65845
|
+
|
|
65846
|
+
|
|
65847
|
+
|
|
65848
|
+
|
|
65849
|
+
|
|
65850
|
+
|
|
65851
|
+
|
|
65852
|
+
/**
|
|
65853
|
+
* A [[ISchemaLocater]] implementation for locating and retrieving EC [[Schema]]
|
|
65854
|
+
* objects incrementally instead of the full schema and it's references at once. This is useful for large schemas that
|
|
65855
|
+
* take a long time to load, but clients need a rough skeleton of the schema as fast as possible.
|
|
65856
|
+
*
|
|
65857
|
+
* The IncrementalSchemaLocater is a locater around the [[IncrementalSchemaLocater]] to be used in a
|
|
65858
|
+
* [[SchemaContext]].
|
|
65859
|
+
* @internal
|
|
65860
|
+
*/
|
|
65861
|
+
class IncrementalSchemaLocater {
|
|
65862
|
+
_options;
|
|
65863
|
+
_schemaInfoCache;
|
|
65864
|
+
/**
|
|
65865
|
+
* Initializes a new instance of the IncrementalSchemaLocater class.
|
|
65866
|
+
* @param options The [[SchemaLocaterOptions]] that control the loading of the schema.
|
|
65867
|
+
*/
|
|
65868
|
+
constructor(options) {
|
|
65869
|
+
this._options = options || {};
|
|
65870
|
+
this._schemaInfoCache = new SchemaInfoCache(async (context) => {
|
|
65871
|
+
return this.loadSchemaInfos(context);
|
|
65872
|
+
});
|
|
65873
|
+
}
|
|
65874
|
+
/** Gets the options how the schema locater load the schemas. */
|
|
65875
|
+
get options() {
|
|
65876
|
+
return this._options;
|
|
65877
|
+
}
|
|
65878
|
+
/**
|
|
65879
|
+
* Gets the [[SchemaInfo]] which matches the provided SchemaKey. The SchemaInfo may be returned
|
|
65880
|
+
* before the schema is fully loaded. May return the entire Schema so long as it is completely loaded as it satisfies
|
|
65881
|
+
* the SchemaInfo interface.
|
|
65882
|
+
* @param schemaKey The [[SchemaKey]] to look up.
|
|
65883
|
+
* @param matchType The [[SchemaMatchType]] to use against candidate schemas.
|
|
65884
|
+
* @param context The [[SchemaContext]] for loading schema references.
|
|
65885
|
+
*/
|
|
65886
|
+
async getSchemaInfo(schemaKey, matchType, context) {
|
|
65887
|
+
return this._schemaInfoCache.lookup(schemaKey, matchType, context);
|
|
65888
|
+
}
|
|
65889
|
+
/**
|
|
65890
|
+
* Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.
|
|
65891
|
+
* For schemas that may have references, construct and call through a SchemaContext instead.
|
|
65892
|
+
* @param schemaKey The [[SchemaKey]] to look up.
|
|
65893
|
+
* @param matchType The [[SchemaMatchType]] to use against candidate schemas.
|
|
65894
|
+
* @param context The [[SchemaContext]] for loading schema references.
|
|
65895
|
+
*/
|
|
65896
|
+
async getSchema(schemaKey, matchType, context) {
|
|
65897
|
+
const schemaInfo = await this.getSchemaInfo(schemaKey, matchType, context);
|
|
65898
|
+
return schemaInfo
|
|
65899
|
+
? this.loadSchema(schemaInfo, context)
|
|
65900
|
+
: undefined;
|
|
65901
|
+
}
|
|
65902
|
+
/**
|
|
65903
|
+
* Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.
|
|
65904
|
+
* For schemas that may have references, construct and call through a SchemaContext instead.
|
|
65905
|
+
* NOT IMPLEMENTED IN THIS LOCATER - ALWAYS RETURNS UNDEFINED.
|
|
65906
|
+
* @param schemaKey The [[SchemaKey]] to look up.
|
|
65907
|
+
* @param matchType The [[SchemaMatchType]] to use against candidate schemas.
|
|
65908
|
+
* @param context The [[SchemaContext]] for loading schema references.
|
|
65909
|
+
* @returns Incremental schema loading does not work synchronously, this will always return undefined.
|
|
65910
|
+
*/
|
|
65911
|
+
getSchemaSync(_schemaKey, _matchType, _context) {
|
|
65912
|
+
return undefined;
|
|
65913
|
+
}
|
|
65914
|
+
/**
|
|
65915
|
+
* Start loading the schema for the given schema info incrementally. The schema is returned
|
|
65916
|
+
* as soon as the schema stub is loaded while the schema fully resolves in the background. It should
|
|
65917
|
+
* only be called by the IncrementalSchemaLocater if a schema has not been loaded or started to
|
|
65918
|
+
* load yet.
|
|
65919
|
+
* @param schemaInfo The schema info of the schema to load.
|
|
65920
|
+
* @param schemaContext The schema context to load the schema into.
|
|
65921
|
+
*/
|
|
65922
|
+
async loadSchema(schemaInfo, schemaContext) {
|
|
65923
|
+
// If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema
|
|
65924
|
+
// information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface
|
|
65925
|
+
// to fetch the whole schema json.
|
|
65926
|
+
if (!await this.supportPartialSchemaLoading(schemaContext)) {
|
|
65927
|
+
const schemaJson = await this.getSchemaJson(schemaInfo.schemaKey, schemaContext);
|
|
65928
|
+
return _Metadata_Schema__WEBPACK_IMPORTED_MODULE_4__.Schema.fromJson(schemaJson, schemaContext);
|
|
65929
|
+
}
|
|
65930
|
+
// Fetches the schema partials for the given schema key. The first item in the array is the
|
|
65931
|
+
// actual schema props of the schema to load, the following items are schema props of referenced
|
|
65932
|
+
// schema items that are needed to resolve the schema properly.
|
|
65933
|
+
const schemaPartials = await this.getSchemaPartials(schemaInfo.schemaKey, schemaContext);
|
|
65934
|
+
if (schemaPartials === undefined)
|
|
65935
|
+
throw new _Exception__WEBPACK_IMPORTED_MODULE_3__.ECSchemaError(_Exception__WEBPACK_IMPORTED_MODULE_3__.ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);
|
|
65936
|
+
// Sort the partials in dependency order to ensure referenced schemas exist in the schema context
|
|
65937
|
+
// when they get requested. Otherwise the context would call this method again and for referenced
|
|
65938
|
+
// schemas, we would not want to request the whole schema props.
|
|
65939
|
+
const sortedPartials = await this.sortSchemaPartials(schemaPartials, schemaContext);
|
|
65940
|
+
for (const schemaProps of sortedPartials) {
|
|
65941
|
+
await this.startLoadingPartialSchema(schemaProps, schemaContext);
|
|
65942
|
+
}
|
|
65943
|
+
const schema = await schemaContext.getCachedSchema(schemaInfo.schemaKey);
|
|
65944
|
+
if (!schema)
|
|
65945
|
+
throw new Error(`Schema ${schemaInfo.schemaKey.name} could not be found.`);
|
|
65946
|
+
return schema;
|
|
65947
|
+
}
|
|
65948
|
+
/**
|
|
65949
|
+
* Creates a SchemaProps object by loading the Schema information from the given SchemaContext.
|
|
65950
|
+
* @param schemaKey The SchemaKey of the Schema whose props are to be retrieved.
|
|
65951
|
+
* @param schemaContext The SchemaContext holding the Schema.
|
|
65952
|
+
* @returns The SchemaProps object.
|
|
65953
|
+
*/
|
|
65954
|
+
async createSchemaProps(schemaKey, schemaContext) {
|
|
65955
|
+
const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, _ECObjects__WEBPACK_IMPORTED_MODULE_2__.SchemaMatchType.Latest);
|
|
65956
|
+
if (!schemaInfo)
|
|
65957
|
+
throw new Error(`Schema ${schemaKey.name} could not be found.`);
|
|
65958
|
+
const schemaProps = {
|
|
65959
|
+
$schema: _Constants__WEBPACK_IMPORTED_MODULE_0__.ECSchemaNamespaceUris.SCHEMAURL3_2_JSON,
|
|
65960
|
+
name: schemaKey.name,
|
|
65961
|
+
alias: schemaInfo.alias,
|
|
65962
|
+
version: schemaInfo.schemaKey.version.toString(),
|
|
65963
|
+
references: [],
|
|
65964
|
+
items: {}
|
|
65965
|
+
};
|
|
65966
|
+
if (!schemaProps.references)
|
|
65967
|
+
throw new Error(`Schema references is undefined for the Schema ${schemaInfo.schemaKey.name}`);
|
|
65968
|
+
schemaInfo.references.forEach((ref) => {
|
|
65969
|
+
schemaProps.references.push({ name: ref.schemaKey.name, version: ref.schemaKey.version.toString() });
|
|
65970
|
+
});
|
|
65971
|
+
return schemaProps;
|
|
65972
|
+
}
|
|
65973
|
+
async startLoadingPartialSchema(schemaProps, schemaContext) {
|
|
65974
|
+
if (schemaContext.schemaExists(_SchemaKey__WEBPACK_IMPORTED_MODULE_5__.SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`))) {
|
|
65975
|
+
return;
|
|
65976
|
+
}
|
|
65977
|
+
const controller = new _utils_SchemaLoadingController__WEBPACK_IMPORTED_MODULE_6__.SchemaLoadingController();
|
|
65978
|
+
const schemaReader = new _IncrementalSchemaReader__WEBPACK_IMPORTED_MODULE_7__.IncrementalSchemaReader(schemaContext, true);
|
|
65979
|
+
const schema = new _Metadata_Schema__WEBPACK_IMPORTED_MODULE_4__.Schema(schemaContext);
|
|
65980
|
+
schema.setLoadingController(controller);
|
|
65981
|
+
await schemaReader.readSchema(schema, schemaProps);
|
|
65982
|
+
if (!this._options.loadPartialSchemaOnly)
|
|
65983
|
+
controller.start(this.startLoadingFullSchema(schema));
|
|
65984
|
+
}
|
|
65985
|
+
async loadFullSchema(schema) {
|
|
65986
|
+
const fullSchemaProps = await this.getSchemaJson(schema.schemaKey, schema.context);
|
|
65987
|
+
const reader = new _IncrementalSchemaReader__WEBPACK_IMPORTED_MODULE_7__.IncrementalSchemaReader(schema.context, false);
|
|
65988
|
+
await reader.readSchema(schema, fullSchemaProps, false);
|
|
65989
|
+
}
|
|
65990
|
+
async startLoadingFullSchema(schema) {
|
|
65991
|
+
if (!schema.loadingController)
|
|
65992
|
+
return;
|
|
65993
|
+
// If the schema is already resolved, return it directly.
|
|
65994
|
+
if (schema.loadingController.isComplete || schema.loadingController.inProgress) {
|
|
65995
|
+
return;
|
|
65996
|
+
}
|
|
65997
|
+
// Since the schema relies on it's references, they get triggered to be resolved
|
|
65998
|
+
// first by recursively calling this method. After all references has been resolved
|
|
65999
|
+
// the schema itself gets resolved.
|
|
66000
|
+
await Promise.all(schema.references.map(async (referenceSchema) => {
|
|
66001
|
+
if (referenceSchema.loadingController && referenceSchema.loadingController.inProgress)
|
|
66002
|
+
return referenceSchema.loadingController.wait();
|
|
66003
|
+
else
|
|
66004
|
+
return this.startLoadingFullSchema(referenceSchema);
|
|
66005
|
+
}));
|
|
66006
|
+
return this.loadFullSchema(schema);
|
|
66007
|
+
}
|
|
66008
|
+
async sortSchemaPartials(schemaPartials, schemaContext) {
|
|
66009
|
+
const schemaInfos = [];
|
|
66010
|
+
for (const schemaProps of schemaPartials) {
|
|
66011
|
+
const schemaKey = _SchemaKey__WEBPACK_IMPORTED_MODULE_5__.SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`);
|
|
66012
|
+
const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, _ECObjects__WEBPACK_IMPORTED_MODULE_2__.SchemaMatchType.Latest);
|
|
66013
|
+
if (!schemaInfo)
|
|
66014
|
+
throw new Error(`Schema ${schemaKey.name} could not be found.`);
|
|
66015
|
+
schemaInfos.push({ ...schemaInfo, props: schemaProps });
|
|
66016
|
+
}
|
|
66017
|
+
const orderedSchemaInfos = _Deserialization_SchemaGraphUtil__WEBPACK_IMPORTED_MODULE_1__.SchemaGraphUtil.buildDependencyOrderedSchemaInfoList(schemaInfos);
|
|
66018
|
+
return orderedSchemaInfos.map((schemaInfo) => schemaInfo.props);
|
|
66019
|
+
}
|
|
66020
|
+
}
|
|
66021
|
+
/**
|
|
66022
|
+
* Helper class to manage schema infos for a schema context.
|
|
66023
|
+
*/
|
|
66024
|
+
class SchemaInfoCache {
|
|
66025
|
+
_schemaInfoCache;
|
|
66026
|
+
_schemaInfoLoader;
|
|
66027
|
+
constructor(schemaInfoLoader) {
|
|
66028
|
+
this._schemaInfoCache = new WeakMap();
|
|
66029
|
+
this._schemaInfoLoader = schemaInfoLoader;
|
|
66030
|
+
}
|
|
66031
|
+
async getSchemasByContext(context) {
|
|
66032
|
+
if (!this._schemaInfoCache.has(context)) {
|
|
66033
|
+
const schemaInfos = await this._schemaInfoLoader(context);
|
|
66034
|
+
this._schemaInfoCache.set(context, Array.from(schemaInfos));
|
|
66035
|
+
}
|
|
66036
|
+
return this._schemaInfoCache.get(context);
|
|
66037
|
+
}
|
|
66038
|
+
async lookup(schemaKey, matchType, context) {
|
|
66039
|
+
const contextSchemaInfos = await this.getSchemasByContext(context);
|
|
66040
|
+
return contextSchemaInfos
|
|
66041
|
+
? contextSchemaInfos.find((schemaInfo) => schemaInfo.schemaKey.matches(schemaKey, matchType))
|
|
66042
|
+
: undefined;
|
|
66043
|
+
}
|
|
66044
|
+
remove(schemaKey, context) {
|
|
66045
|
+
const contextSchemaInfos = this._schemaInfoCache.get(context);
|
|
66046
|
+
if (!contextSchemaInfos)
|
|
66047
|
+
return;
|
|
66048
|
+
const index = contextSchemaInfos.findIndex((schemaInfo) => schemaInfo.schemaKey.name === schemaKey.name);
|
|
66049
|
+
if (index !== -1) {
|
|
66050
|
+
contextSchemaInfos.splice(index, 1);
|
|
66051
|
+
}
|
|
66052
|
+
}
|
|
66053
|
+
}
|
|
66054
|
+
|
|
66055
|
+
|
|
66056
|
+
/***/ }),
|
|
66057
|
+
|
|
66058
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaReader.js":
|
|
66059
|
+
/*!******************************************************************************************!*\
|
|
66060
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaReader.js ***!
|
|
66061
|
+
\******************************************************************************************/
|
|
66062
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66063
|
+
|
|
66064
|
+
"use strict";
|
|
66065
|
+
__webpack_require__.r(__webpack_exports__);
|
|
66066
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
66067
|
+
/* harmony export */ IncrementalSchemaReader: () => (/* binding */ IncrementalSchemaReader)
|
|
66068
|
+
/* harmony export */ });
|
|
66069
|
+
/* harmony import */ var _Deserialization_Helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Deserialization/Helper */ "../../core/ecschema-metadata/lib/esm/Deserialization/Helper.js");
|
|
66070
|
+
/* harmony import */ var _Deserialization_JsonParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Deserialization/JsonParser */ "../../core/ecschema-metadata/lib/esm/Deserialization/JsonParser.js");
|
|
66071
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
66072
|
+
/* harmony import */ var _Metadata_Class__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Metadata/Class */ "../../core/ecschema-metadata/lib/esm/Metadata/Class.js");
|
|
66073
|
+
/* harmony import */ var _Metadata_SchemaItem__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Metadata/SchemaItem */ "../../core/ecschema-metadata/lib/esm/Metadata/SchemaItem.js");
|
|
66074
|
+
/* harmony import */ var _utils_SchemaLoadingController__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/SchemaLoadingController */ "../../core/ecschema-metadata/lib/esm/utils/SchemaLoadingController.js");
|
|
66075
|
+
|
|
66076
|
+
|
|
66077
|
+
|
|
66078
|
+
|
|
66079
|
+
|
|
66080
|
+
|
|
66081
|
+
/**
|
|
66082
|
+
* Internal helper class to read schema information incrementally. It's based on the [[SchemaReadHelper]]
|
|
66083
|
+
* but overrides a few methods to support the incremental schema loading case.
|
|
66084
|
+
* @internal
|
|
66085
|
+
*/
|
|
66086
|
+
class IncrementalSchemaReader extends _Deserialization_Helper__WEBPACK_IMPORTED_MODULE_0__.SchemaReadHelper {
|
|
66087
|
+
_incremental;
|
|
66088
|
+
/**
|
|
66089
|
+
* Initializes a new [[IncrementalSchemaReader]] instance.
|
|
66090
|
+
* @param schemaContext The [[SchemaContext]] used to load the schemas.
|
|
66091
|
+
* @param incremental Indicates that the Schema should be read incrementally.
|
|
66092
|
+
* Pass false to load the full schema without an incremental/partial load.
|
|
66093
|
+
*/
|
|
66094
|
+
constructor(schemaContext, incremental) {
|
|
66095
|
+
super(_Deserialization_JsonParser__WEBPACK_IMPORTED_MODULE_1__.JsonParser, schemaContext);
|
|
66096
|
+
this._incremental = incremental;
|
|
66097
|
+
}
|
|
66098
|
+
/**
|
|
66099
|
+
* Indicates that a given [[SchemaItem]] has been fully loaded.
|
|
66100
|
+
* @param schemaItem The SchemaItem to check.
|
|
66101
|
+
* @returns True if the item has been loaded, false if still in progress.
|
|
66102
|
+
*/
|
|
66103
|
+
isSchemaItemLoaded(schemaItem) {
|
|
66104
|
+
return schemaItem !== undefined
|
|
66105
|
+
&& schemaItem.loadingController !== undefined
|
|
66106
|
+
&& schemaItem.loadingController.isComplete;
|
|
66107
|
+
}
|
|
66108
|
+
/**
|
|
66109
|
+
* Starts loading the [[SchemaItem]] identified by the given name and itemType.
|
|
66110
|
+
* @param schema The [[Schema]] that contains the SchemaItem.
|
|
66111
|
+
* @param name The name of the SchemaItem to load.
|
|
66112
|
+
* @param itemType The SchemaItem type name of the item to load.
|
|
66113
|
+
* @param schemaItemObject The object accepting the SchemaItem data.
|
|
66114
|
+
* @returns A promise that resolves to the loaded SchemaItem instance. Can be undefined.
|
|
66115
|
+
*/
|
|
66116
|
+
async loadSchemaItem(schema, name, itemType, schemaItemObject) {
|
|
66117
|
+
const schemaItem = await super.loadSchemaItem(schema, name, itemType, this._incremental ? undefined : schemaItemObject);
|
|
66118
|
+
// In incremental mode, we only load the stubs of the classes. These include the modifier and base classes.
|
|
66119
|
+
// The fromJSON method of the actual class instances may complain about missing properties in the props, so
|
|
66120
|
+
// calling the fromJSON on the ECClass ensures only the bare minimum is loaded.
|
|
66121
|
+
if (this._incremental && schemaItemObject && schemaItem) {
|
|
66122
|
+
if (schemaItem.schemaItemType === _ECObjects__WEBPACK_IMPORTED_MODULE_2__.SchemaItemType.KindOfQuantity) {
|
|
66123
|
+
_Metadata_SchemaItem__WEBPACK_IMPORTED_MODULE_4__.SchemaItem.prototype.fromJSONSync.call(schemaItem, schemaItemObject);
|
|
66124
|
+
}
|
|
66125
|
+
else {
|
|
66126
|
+
schemaItem.fromJSONSync(schemaItemObject);
|
|
66127
|
+
}
|
|
66128
|
+
}
|
|
66129
|
+
this.schemaItemLoading(schemaItem);
|
|
66130
|
+
return schemaItem;
|
|
66131
|
+
}
|
|
66132
|
+
schemaItemLoading(schemaItem) {
|
|
66133
|
+
if (schemaItem === undefined)
|
|
66134
|
+
return;
|
|
66135
|
+
if (schemaItem.loadingController === undefined) {
|
|
66136
|
+
const controller = new _utils_SchemaLoadingController__WEBPACK_IMPORTED_MODULE_5__.SchemaLoadingController();
|
|
66137
|
+
schemaItem.setLoadingController(controller);
|
|
66138
|
+
}
|
|
66139
|
+
if (_Metadata_Class__WEBPACK_IMPORTED_MODULE_3__.ECClass.isECClass(schemaItem)
|
|
66140
|
+
|| schemaItem.schemaItemType === _ECObjects__WEBPACK_IMPORTED_MODULE_2__.SchemaItemType.KindOfQuantity
|
|
66141
|
+
|| schemaItem.schemaItemType === _ECObjects__WEBPACK_IMPORTED_MODULE_2__.SchemaItemType.Format)
|
|
66142
|
+
schemaItem.loadingController.isComplete = !this._incremental;
|
|
66143
|
+
else
|
|
66144
|
+
schemaItem.loadingController.isComplete = true;
|
|
66145
|
+
}
|
|
66146
|
+
}
|
|
66147
|
+
|
|
66148
|
+
|
|
66149
|
+
/***/ }),
|
|
66150
|
+
|
|
66151
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemParsers.js":
|
|
66152
|
+
/*!************************************************************************************!*\
|
|
66153
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemParsers.js ***!
|
|
66154
|
+
\************************************************************************************/
|
|
66155
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66156
|
+
|
|
66157
|
+
"use strict";
|
|
66158
|
+
__webpack_require__.r(__webpack_exports__);
|
|
66159
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
66160
|
+
/* harmony export */ KindOfQuantityParser: () => (/* binding */ KindOfQuantityParser),
|
|
66161
|
+
/* harmony export */ SchemaItemParser: () => (/* binding */ SchemaItemParser)
|
|
66162
|
+
/* harmony export */ });
|
|
66163
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
66164
|
+
/* harmony import */ var _Metadata_OverrideFormat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Metadata/OverrideFormat */ "../../core/ecschema-metadata/lib/esm/Metadata/OverrideFormat.js");
|
|
66165
|
+
/* harmony import */ var _Metadata_SchemaItem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Metadata/SchemaItem */ "../../core/ecschema-metadata/lib/esm/Metadata/SchemaItem.js");
|
|
66166
|
+
/* harmony import */ var _SchemaParser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SchemaParser */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaParser.js");
|
|
66167
|
+
/*---------------------------------------------------------------------------------------------
|
|
66168
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
66169
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
66170
|
+
*--------------------------------------------------------------------------------------------*/
|
|
66171
|
+
|
|
66172
|
+
|
|
66173
|
+
|
|
66174
|
+
|
|
66175
|
+
/**
|
|
66176
|
+
* Parses SchemaItemProps JSON returned from an ECSql query and returns the correct SchemaItemProps JSON.
|
|
66177
|
+
* This is necessary as a small amount information (ie. CustomAttribute data) returned from the iModelDb
|
|
66178
|
+
* is in a different format than is required for a SchemaItemProps JSON object.
|
|
66179
|
+
* @internal
|
|
66180
|
+
*/
|
|
66181
|
+
class SchemaItemParser {
|
|
66182
|
+
_schema;
|
|
66183
|
+
_context;
|
|
66184
|
+
/**
|
|
66185
|
+
* Initializes a new SchemaItemParser.
|
|
66186
|
+
* @param schemaName The name the Schema containing the SchemaItems.
|
|
66187
|
+
* @param context The SchemaContext containing the Schema.
|
|
66188
|
+
*/
|
|
66189
|
+
constructor(schemaName, context) {
|
|
66190
|
+
this._schema = schemaName;
|
|
66191
|
+
this._context = context;
|
|
66192
|
+
}
|
|
66193
|
+
/**
|
|
66194
|
+
* Parses the given SchemaItemProps JSON returned from an ECSql query.
|
|
66195
|
+
* @param data The SchemaItemProps JSON as returned from an iModelDb.
|
|
66196
|
+
* @returns The corrected SchemaItemProps Json.
|
|
66197
|
+
*/
|
|
66198
|
+
async parse(data) {
|
|
66199
|
+
const props = data;
|
|
66200
|
+
props.schemaItemType = (0,_ECObjects__WEBPACK_IMPORTED_MODULE_0__.parseSchemaItemType)(data.schemaItemType);
|
|
66201
|
+
props.customAttributes = props.customAttributes ? props.customAttributes.map((attr) => { return (0,_SchemaParser__WEBPACK_IMPORTED_MODULE_3__.parseCustomAttribute)(attr); }) : undefined;
|
|
66202
|
+
if (!props.customAttributes || props.customAttributes.length === 0)
|
|
66203
|
+
delete props.customAttributes;
|
|
66204
|
+
return props;
|
|
66205
|
+
}
|
|
66206
|
+
/**
|
|
66207
|
+
* Helper method to resolve the SchemaItem's full name from the given rawTypeName.
|
|
66208
|
+
* If the SchemaItem is defined in the same Schema from which it is referenced,
|
|
66209
|
+
* the rawTypeName will be SchemaItem name ('PhysicalElement'). Otherwise,
|
|
66210
|
+
* the rawTypeName will have the schema alias ('bis:PhysicalElement').
|
|
66211
|
+
* @param rawTypeName The name or aliased name of the SchemaItem.
|
|
66212
|
+
* @returns The full name of the SchemaItem, ie. 'BisCore.PhysicalElement'
|
|
66213
|
+
*/
|
|
66214
|
+
async getQualifiedTypeName(rawTypeName) {
|
|
66215
|
+
const nameParts = rawTypeName.split(":");
|
|
66216
|
+
if (nameParts.length !== 2) {
|
|
66217
|
+
const [schemaName, itemName] = _Metadata_SchemaItem__WEBPACK_IMPORTED_MODULE_2__.SchemaItem.parseFullName(rawTypeName);
|
|
66218
|
+
if (!schemaName || schemaName === '')
|
|
66219
|
+
return `${this._schema}.${itemName}`;
|
|
66220
|
+
return rawTypeName;
|
|
66221
|
+
}
|
|
66222
|
+
const resolvedName = await this.resolveNameFromAlias(nameParts[0].toLocaleLowerCase());
|
|
66223
|
+
if (!resolvedName)
|
|
66224
|
+
throw new Error(`No valid schema found for alias '${nameParts[0]}'`);
|
|
66225
|
+
return `${resolvedName}.${nameParts[1]}`;
|
|
66226
|
+
}
|
|
66227
|
+
async resolveNameFromAlias(alias) {
|
|
66228
|
+
for (const schema of this._context.getKnownSchemas()) {
|
|
66229
|
+
if (schema.alias === alias)
|
|
66230
|
+
return schema.schemaKey.name;
|
|
66231
|
+
}
|
|
66232
|
+
return undefined;
|
|
66233
|
+
}
|
|
66234
|
+
}
|
|
66235
|
+
/**
|
|
66236
|
+
* Parses KindOfQuantityProps JSON returned from an ECSql query and returns the correct KindOfQuantityProps JSON.
|
|
66237
|
+
* This is necessary as a small amount information (ie. unqualified type names of presentationUnits) returned from
|
|
66238
|
+
* the iModelDb is in a different format than is required for a KindOfQuantityProps JSON object.
|
|
66239
|
+
* @internal
|
|
66240
|
+
*/
|
|
66241
|
+
class KindOfQuantityParser extends SchemaItemParser {
|
|
66242
|
+
/**
|
|
66243
|
+
* Parses the given KindOfQuantityProps JSON returned from an ECSql query.
|
|
66244
|
+
* @param data The KindOfQuantityProps JSON as returned from an iModelDb.
|
|
66245
|
+
* @returns The corrected KindOfQuantityProps Json.
|
|
66246
|
+
*/
|
|
66247
|
+
async parse(data) {
|
|
66248
|
+
const mutableProps = await super.parse(data);
|
|
66249
|
+
if (mutableProps.persistenceUnit) {
|
|
66250
|
+
mutableProps.persistenceUnit = await this.getQualifiedTypeName(mutableProps.persistenceUnit);
|
|
66251
|
+
}
|
|
66252
|
+
mutableProps.presentationUnits = await this.parsePresentationUnits(mutableProps);
|
|
66253
|
+
return mutableProps;
|
|
66254
|
+
}
|
|
66255
|
+
async parsePresentationUnits(props) {
|
|
66256
|
+
const presentationUnits = [];
|
|
66257
|
+
if (!props.presentationUnits)
|
|
66258
|
+
return [];
|
|
66259
|
+
for (const presentationUnit of props.presentationUnits) {
|
|
66260
|
+
const presFormatOverride = _Metadata_OverrideFormat__WEBPACK_IMPORTED_MODULE_1__.OverrideFormat.parseFormatString(presentationUnit);
|
|
66261
|
+
const formatString = await this.createOverrideFormatString(presFormatOverride);
|
|
66262
|
+
presentationUnits.push(formatString);
|
|
66263
|
+
}
|
|
66264
|
+
;
|
|
66265
|
+
return presentationUnits;
|
|
66266
|
+
}
|
|
66267
|
+
async createOverrideFormatString(overrideFormatProps) {
|
|
66268
|
+
let formatFullName = await this.getQualifiedTypeName(overrideFormatProps.name);
|
|
66269
|
+
if (overrideFormatProps.precision)
|
|
66270
|
+
formatFullName += `(${overrideFormatProps.precision.toString()})`;
|
|
66271
|
+
if (undefined === overrideFormatProps.unitAndLabels)
|
|
66272
|
+
return formatFullName;
|
|
66273
|
+
for (const [unit, unitLabel] of overrideFormatProps.unitAndLabels) {
|
|
66274
|
+
const unitFullName = await this.getQualifiedTypeName(unit);
|
|
66275
|
+
if (undefined === unitLabel)
|
|
66276
|
+
formatFullName += `[${unitFullName}]`;
|
|
66277
|
+
else
|
|
66278
|
+
formatFullName += `[${unitFullName}|${unitLabel}]`;
|
|
66279
|
+
}
|
|
66280
|
+
return formatFullName;
|
|
66281
|
+
}
|
|
66282
|
+
}
|
|
66283
|
+
|
|
66284
|
+
|
|
66285
|
+
/***/ }),
|
|
66286
|
+
|
|
66287
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemQueries.js":
|
|
66288
|
+
/*!************************************************************************************!*\
|
|
66289
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemQueries.js ***!
|
|
66290
|
+
\************************************************************************************/
|
|
66291
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66292
|
+
|
|
66293
|
+
"use strict";
|
|
66294
|
+
__webpack_require__.r(__webpack_exports__);
|
|
66295
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
66296
|
+
/* harmony export */ SchemaItemQueries: () => (/* binding */ SchemaItemQueries)
|
|
66297
|
+
/* harmony export */ });
|
|
66298
|
+
/*---------------------------------------------------------------------------------------------
|
|
66299
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
66300
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
66301
|
+
*--------------------------------------------------------------------------------------------*/
|
|
66302
|
+
/************************************************************************************
|
|
66303
|
+
* All SchemaItem queries for each SchemaItemType are defined here. These queries
|
|
66304
|
+
* are shared for both 'partial schema' and 'full schema' queries.
|
|
66305
|
+
***********************************************************************************/
|
|
66306
|
+
/**
|
|
66307
|
+
* Query for SchemaItemType KindOfQuantity data.
|
|
66308
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66309
|
+
*/
|
|
66310
|
+
const kindOfQuantity = (singleSchema) => `
|
|
66311
|
+
SELECT
|
|
66312
|
+
[koq].[Schema].[Id] AS [SchemaId],
|
|
66313
|
+
json_object (
|
|
66314
|
+
'schemaItemType', 'KindOfQuantity',
|
|
66315
|
+
'name', [koq].[Name],
|
|
66316
|
+
'label', [koq].[DisplayLabel],
|
|
66317
|
+
'description', [koq].[Description]
|
|
66318
|
+
${singleSchema ? `
|
|
66319
|
+
,'relativeError', [koq].[RelativeError],
|
|
66320
|
+
'persistenceUnit', [koq].[PersistenceUnit],
|
|
66321
|
+
'presentationUnits', (
|
|
66322
|
+
SELECT json_group_array(js."value")
|
|
66323
|
+
FROM [meta].[KindOfQuantityDef] [koq1], json1.json_each([PresentationUnits]) js
|
|
66324
|
+
WHERE [koq1].[ECInstanceId] = [koq].[ECInstanceId]
|
|
66325
|
+
) ` : ""}
|
|
66326
|
+
) as [item]
|
|
66327
|
+
FROM
|
|
66328
|
+
[meta].[KindOfQuantityDef] [koq]
|
|
66329
|
+
${singleSchema ? `
|
|
66330
|
+
JOIN
|
|
66331
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [koq].[Schema].[Id]
|
|
66332
|
+
WHERE [schema].[Name] = :schemaName
|
|
66333
|
+
` : ""}
|
|
66334
|
+
`;
|
|
66335
|
+
/**
|
|
66336
|
+
* Query for SchemaItemType PropertyCategory data.
|
|
66337
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66338
|
+
*/
|
|
66339
|
+
const propertyCategory = (singleSchema) => `
|
|
66340
|
+
SELECT
|
|
66341
|
+
[pc].[Schema].[Id] AS [SchemaId],
|
|
66342
|
+
json_object (
|
|
66343
|
+
'schemaItemType', 'PropertyCategory',
|
|
66344
|
+
'name', [pc].[Name],
|
|
66345
|
+
'label', [pc].[DisplayLabel],
|
|
66346
|
+
'description', [pc].[Description],
|
|
66347
|
+
'priority', [pc].[Priority]
|
|
66348
|
+
) as [item]
|
|
66349
|
+
FROM
|
|
66350
|
+
[meta].[PropertyCategoryDef] [pc]
|
|
66351
|
+
${singleSchema ? `
|
|
66352
|
+
JOIN
|
|
66353
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [pc].[Schema].[Id]
|
|
66354
|
+
WHERE [schema].[Name] = :schemaName
|
|
66355
|
+
` : ""}
|
|
66356
|
+
`;
|
|
66357
|
+
/**
|
|
66358
|
+
* Query for SchemaItemType Enumeration data.
|
|
66359
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66360
|
+
*/
|
|
66361
|
+
const enumeration = (singleSchema) => `
|
|
66362
|
+
SELECT
|
|
66363
|
+
[ed].[Schema].[Id] AS [SchemaId],
|
|
66364
|
+
json_object (
|
|
66365
|
+
'schemaItemType', 'Enumeration',
|
|
66366
|
+
'name', [ed].[Name],
|
|
66367
|
+
'label', [ed].[DisplayLabel],
|
|
66368
|
+
'description', [ed].[Description],
|
|
66369
|
+
'type', IIF([ed].[Type] = 1281, 'int', IIF([ed].[Type] = 2305, 'string', null)),
|
|
66370
|
+
'isStrict', IIF([ed].[IsStrict] = 1, json('true'), json('false')),
|
|
66371
|
+
'enumerators', (
|
|
66372
|
+
SELECT json_group_array(json(json_object(
|
|
66373
|
+
'name', json_extract(js."value", '$.Name'),
|
|
66374
|
+
'value', IFNULL(json_extract(js."value", '$.StringValue'), (json_extract(js."value", '$.IntValue'))),
|
|
66375
|
+
'label', json_extract(js."value", '$.DisplayLabel'),
|
|
66376
|
+
'description', json_extract(js."value", '$.Description')
|
|
66377
|
+
)))
|
|
66378
|
+
FROM [meta].[ECEnumerationDef] [enumerationDef], json1.json_each([EnumValues]) js
|
|
66379
|
+
WHERE [enumerationDef].[ECInstanceId] = [ed].[ECInstanceId]
|
|
66380
|
+
)
|
|
66381
|
+
) as [item]
|
|
66382
|
+
FROM
|
|
66383
|
+
[meta].[ECEnumerationDef] [ed]
|
|
66384
|
+
${singleSchema ? `
|
|
66385
|
+
JOIN
|
|
66386
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [ed].[Schema].[Id]
|
|
66387
|
+
WHERE [schema].[Name] = :schemaName` : ""}
|
|
66388
|
+
`;
|
|
66389
|
+
/**
|
|
66390
|
+
* Query for SchemaItemType Unit data.
|
|
66391
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66392
|
+
*/
|
|
66393
|
+
const unit = (singleSchema) => `
|
|
66394
|
+
SELECT
|
|
66395
|
+
[ud].[Schema].[Id] AS [SchemaId],
|
|
66396
|
+
json_object (
|
|
66397
|
+
'schemaItemType', 'Unit',
|
|
66398
|
+
'name', [ud].[Name],
|
|
66399
|
+
'label', [ud].[DisplayLabel],
|
|
66400
|
+
'description', [ud].[Description],
|
|
66401
|
+
'definition', [ud].[Definition],
|
|
66402
|
+
'numerator', IIF([ud].[Numerator] IS NULL, NULL, json(format('%.16g', [ud].[Numerator]))),
|
|
66403
|
+
'denominator', IIF([ud].[Denominator] IS NULL, NULL, json(format('%.16g', [ud].[Denominator]))),
|
|
66404
|
+
'offset', IIF([ud].[Offset] IS NULL, NULL, json(format('%!.15f', [ud].[Offset]))),
|
|
66405
|
+
'unitSystem', CONCAT([uss].[Name],'.', [usd].[Name]),
|
|
66406
|
+
'phenomenon', CONCAT([ps].[Name],'.', [pd].[Name])
|
|
66407
|
+
) as item
|
|
66408
|
+
FROM
|
|
66409
|
+
[meta].[UnitDef] [ud]
|
|
66410
|
+
${singleSchema ? `
|
|
66411
|
+
JOIN
|
|
66412
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [ud].[Schema].[Id]` : ""}
|
|
66413
|
+
JOIN [meta].[UnitSystemDef] [usd]
|
|
66414
|
+
ON [usd].[ECInstanceId] = [ud].[UnitSystem].[Id]
|
|
66415
|
+
JOIN [meta].[ECSchemaDef] [uss]
|
|
66416
|
+
ON [uss].[ECInstanceId] = [usd].[Schema].[Id]
|
|
66417
|
+
JOIN [meta].[PhenomenonDef] [pd]
|
|
66418
|
+
ON [pd].[ECInstanceId] = [ud].[Phenomenon].[Id]
|
|
66419
|
+
JOIN [meta].[ECSchemaDef] [ps]
|
|
66420
|
+
ON [ps].[ECInstanceId] = [pd].[Schema].[Id]
|
|
66421
|
+
WHERE
|
|
66422
|
+
${singleSchema ? `
|
|
66423
|
+
[schema].[Name] = :schemaName AND` : ""}
|
|
66424
|
+
[ud].[IsConstant] = 0 AND
|
|
66425
|
+
[ud].[InvertingUnit] IS NULL
|
|
66426
|
+
`;
|
|
66427
|
+
/**
|
|
66428
|
+
* Query for SchemaItemType InvertedUnit data.
|
|
66429
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66430
|
+
*/
|
|
66431
|
+
const invertedUnit = (singleSchema) => `
|
|
66432
|
+
SELECT
|
|
66433
|
+
[ud].[Schema].[Id] AS [SchemaId],
|
|
66434
|
+
json_object (
|
|
66435
|
+
'schemaItemType', 'InvertedUnit',
|
|
66436
|
+
'name', [ud].[Name],
|
|
66437
|
+
'label', [ud].[DisplayLabel],
|
|
66438
|
+
'description', [ud].[Description],
|
|
66439
|
+
'unitSystem', CONCAT([systemSchema].[Name],'.', [usd].[Name]),
|
|
66440
|
+
'invertsUnit', IIF([iud].[Name] IS NULL, null, CONCAT([ius].[Name],'.', [iud].[Name]))
|
|
66441
|
+
) as [item]
|
|
66442
|
+
FROM
|
|
66443
|
+
[meta].[UnitDef] [ud]
|
|
66444
|
+
${singleSchema ? `
|
|
66445
|
+
JOIN
|
|
66446
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [ud].[Schema].[Id]` : ""}
|
|
66447
|
+
JOIN [meta].[UnitSystemDef] [usd]
|
|
66448
|
+
ON [usd].[ECInstanceId] = [ud].[UnitSystem].[Id]
|
|
66449
|
+
JOIN [meta].[ECSchemaDef] [systemSchema]
|
|
66450
|
+
ON [systemSchema].[ECInstanceId] = [usd].[Schema].[Id]
|
|
66451
|
+
LEFT JOIN [meta].[UnitDef] [iud]
|
|
66452
|
+
ON [iud].[ECInstanceId] = [ud].[InvertingUnit].[Id]
|
|
66453
|
+
LEFT JOIN [meta].[ECSchemaDef] [ius]
|
|
66454
|
+
ON [ius].[ECInstanceId] = [iud].[Schema].[Id]
|
|
66455
|
+
WHERE
|
|
66456
|
+
${singleSchema ? `
|
|
66457
|
+
[schema].[Name] = :schemaName AND` : ""}
|
|
66458
|
+
[ud].[IsConstant] = 0 AND
|
|
66459
|
+
[ud].[InvertingUnit] IS NOT NULL
|
|
66460
|
+
`;
|
|
66461
|
+
/**
|
|
66462
|
+
* Query for SchemaItemType Constant data.
|
|
66463
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66464
|
+
*/
|
|
66465
|
+
const constant = (singleSchema) => `
|
|
66466
|
+
SELECT
|
|
66467
|
+
[cd].[Schema].[Id] AS [SchemaId],
|
|
66468
|
+
json_object(
|
|
66469
|
+
'schemaItemType', 'Constant',
|
|
66470
|
+
'name', [cd].[Name],
|
|
66471
|
+
'label', [cd].[DisplayLabel],
|
|
66472
|
+
'description', [cd].[Description],
|
|
66473
|
+
'definition', [cd].[Definition],
|
|
66474
|
+
'numerator', IIF([cd].[Numerator] IS NULL, NULL, json(format('%.16g', [cd].[Numerator]))),
|
|
66475
|
+
'denominator', IIF([cd].[Denominator] IS NULL, NULL, json(format('%.16g', [cd].[Denominator]))),
|
|
66476
|
+
'phenomenon', CONCAT([phenomSchema].[Name],'.', [phenomDef].[Name])
|
|
66477
|
+
) as item
|
|
66478
|
+
FROM
|
|
66479
|
+
[meta].[UnitDef] [cd]
|
|
66480
|
+
${singleSchema ? `
|
|
66481
|
+
JOIN
|
|
66482
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [cd].[Schema].[Id]` : ""}
|
|
66483
|
+
JOIN [meta].[PhenomenonDef] [phenomDef]
|
|
66484
|
+
ON [phenomDef].[ECInstanceId] = [cd].[Phenomenon].[Id]
|
|
66485
|
+
JOIN [meta].[ECSchemaDef] [phenomSchema]
|
|
66486
|
+
ON [phenomSchema].[ECInstanceId] = [phenomDef].[Schema].[Id]
|
|
66487
|
+
WHERE
|
|
66488
|
+
${singleSchema ? `
|
|
66489
|
+
[schema].[Name] = :schemaName AND` : ""}
|
|
66490
|
+
[cd].[IsConstant] = 1
|
|
66491
|
+
`;
|
|
66492
|
+
/**
|
|
66493
|
+
* Query for SchemaItemType UnitSystem data.
|
|
66494
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66495
|
+
*/
|
|
66496
|
+
const unitSystem = (singleSchema) => `
|
|
66497
|
+
SELECT
|
|
66498
|
+
[us].[Schema].[Id] AS [SchemaId],
|
|
66499
|
+
json_object (
|
|
66500
|
+
'schemaItemType', 'UnitSystem',
|
|
66501
|
+
'name', [us].[Name],
|
|
66502
|
+
'label', [us].[DisplayLabel],
|
|
66503
|
+
'description', [us].[Description]
|
|
66504
|
+
) as [item]
|
|
66505
|
+
FROM
|
|
66506
|
+
[meta].[UnitSystemDef] [us]
|
|
66507
|
+
${singleSchema ? `
|
|
66508
|
+
JOIN
|
|
66509
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [us].[Schema].[Id]
|
|
66510
|
+
WHERE [schema].[Name] = :schemaName` : ""}
|
|
66511
|
+
`;
|
|
66512
|
+
/**
|
|
66513
|
+
* Query for SchemaItemType Phenomenon data.
|
|
66514
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66515
|
+
*/
|
|
66516
|
+
const phenomenon = (singleSchema) => `
|
|
66517
|
+
SELECT
|
|
66518
|
+
[pd].[Schema].[Id] AS [SchemaId],
|
|
66519
|
+
json_object(
|
|
66520
|
+
'schemaItemType', 'Phenomenon',
|
|
66521
|
+
'name', [pd].[Name],
|
|
66522
|
+
'label', [pd].[DisplayLabel],
|
|
66523
|
+
'description', [pd].[Description],
|
|
66524
|
+
'definition', [pd].[Definition]
|
|
66525
|
+
) as [item]
|
|
66526
|
+
FROM
|
|
66527
|
+
[meta].[PhenomenonDef] [pd]
|
|
66528
|
+
${singleSchema ? `
|
|
66529
|
+
JOIN
|
|
66530
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [pd].[Schema].[Id]
|
|
66531
|
+
WHERE [schema].[Name] = :schemaName` : ""}
|
|
66532
|
+
`;
|
|
66533
|
+
/**
|
|
66534
|
+
* Query for SchemaItemType Format data.
|
|
66535
|
+
* @param singleSchema Indicates if a filter and join for a single Schema should be applied.
|
|
66536
|
+
*/
|
|
66537
|
+
const format = (singleSchema) => `
|
|
66538
|
+
SELECT
|
|
66539
|
+
[fd].[Schema].[Id] AS [SchemaId],
|
|
66540
|
+
json_object(
|
|
66541
|
+
'schemaItemType', 'Format',
|
|
66542
|
+
'name', [fd].[Name],
|
|
66543
|
+
'label', [fd].[DisplayLabel],
|
|
66544
|
+
'description', [fd].[Description],
|
|
66545
|
+
'type', json_extract([fd].[NumericSpec], '$.type'),
|
|
66546
|
+
'precision', json_extract([fd].[NumericSpec], '$.precision'),
|
|
66547
|
+
'roundFactor', json_extract([fd].[NumericSpec], '$.roundFactor'),
|
|
66548
|
+
'minWidth', json_extract([fd].[NumericSpec], '$.minWidth'),
|
|
66549
|
+
'showSignOption', json_extract([fd].[NumericSpec], '$.showSignOption'),
|
|
66550
|
+
'decimalSeparator', json_extract([fd].[NumericSpec], '$.decimalSeparator'),
|
|
66551
|
+
'thousandSeparator', json_extract([fd].[NumericSpec], '$.thousandSeparator'),
|
|
66552
|
+
'uomSeparator', json_extract([fd].[NumericSpec], '$.uomSeparator'),
|
|
66553
|
+
'scientificType', json_extract([fd].[NumericSpec], '$.scientificType'),
|
|
66554
|
+
'stationOffsetSize', json_extract([fd].[NumericSpec], '$.stationOffsetSize'),
|
|
66555
|
+
'stationSeparator', json_extract([fd].[NumericSpec], '$.stationSeparator'),
|
|
66556
|
+
'formatTraits', json_extract([fd].[NumericSpec], '$.formatTraits')
|
|
66557
|
+
${singleSchema ? `
|
|
66558
|
+
,'composite', (
|
|
66559
|
+
SELECT
|
|
66560
|
+
json_object(
|
|
66561
|
+
'spacer', json_extract([fd1].[CompositeSpec], '$.spacer'),
|
|
66562
|
+
'includeZero', json(IIF(json_extract([fd1].[CompositeSpec], '$.includeZero') = 1, 'true', IIF(json_extract([fd1].[CompositeSpec], '$.includeZero') = 0, 'false', null))),
|
|
66563
|
+
'units', (
|
|
66564
|
+
SELECT json_group_array(json(json_object(
|
|
66565
|
+
'name', CONCAT([sd].[Name], '.', [ud].[Name]),
|
|
66566
|
+
'label', [fud].[Label]
|
|
66567
|
+
)))
|
|
66568
|
+
FROM [meta].[FormatDef] [fd2]
|
|
66569
|
+
LEFT JOIN [meta].[FormatCompositeUnitDef] [fud] ON [fud].[Format].[Id] = [fd2].[ECInstanceId]
|
|
66570
|
+
LEFT JOIN [meta].[UnitDef] [ud] ON [ud].[ECInstanceId] = [fud].[Unit].[Id]
|
|
66571
|
+
INNER JOIN [meta].[ECSchemaDef] [sd] ON [sd].[ECInstanceId] = [ud].[Schema].[Id]
|
|
66572
|
+
WHERE [fd2].[ECInstanceId] = [fd1].[ECInstanceId]
|
|
66573
|
+
)
|
|
66574
|
+
)
|
|
66575
|
+
FROM [meta].[FormatDef] [fd1]
|
|
66576
|
+
WHERE [fd1].[ECInstanceId]= [fd].[ECInstanceId] AND [fd1].[CompositeSpec] IS NOT NULL
|
|
66577
|
+
)` : ""}
|
|
66578
|
+
) AS item
|
|
66579
|
+
FROM
|
|
66580
|
+
[meta].[FormatDef] [fd]
|
|
66581
|
+
${singleSchema ? `
|
|
66582
|
+
JOIN
|
|
66583
|
+
[meta].[ECSchemaDef] [schema] ON [schema].[ECInstanceId] = [fd].[Schema].[Id]
|
|
66584
|
+
WHERE [schema].[Name] = :schemaName` : ""}
|
|
66585
|
+
`;
|
|
66586
|
+
/**
|
|
66587
|
+
* Queries for each SchemaItemType
|
|
66588
|
+
* @internal
|
|
66589
|
+
*/
|
|
66590
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
66591
|
+
const SchemaItemQueries = {
|
|
66592
|
+
kindOfQuantity,
|
|
66593
|
+
propertyCategory,
|
|
66594
|
+
enumeration,
|
|
66595
|
+
unit,
|
|
66596
|
+
invertedUnit,
|
|
66597
|
+
constant,
|
|
66598
|
+
unitSystem,
|
|
66599
|
+
phenomenon,
|
|
66600
|
+
format
|
|
66601
|
+
};
|
|
66602
|
+
|
|
66603
|
+
|
|
66604
|
+
/***/ }),
|
|
66605
|
+
|
|
66606
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaParser.js":
|
|
66607
|
+
/*!*******************************************************************************!*\
|
|
66608
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaParser.js ***!
|
|
66609
|
+
\*******************************************************************************/
|
|
66610
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66611
|
+
|
|
66612
|
+
"use strict";
|
|
66613
|
+
__webpack_require__.r(__webpack_exports__);
|
|
66614
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
66615
|
+
/* harmony export */ SchemaParser: () => (/* binding */ SchemaParser),
|
|
66616
|
+
/* harmony export */ parseCustomAttribute: () => (/* binding */ parseCustomAttribute)
|
|
66617
|
+
/* harmony export */ });
|
|
66618
|
+
/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Constants */ "../../core/ecschema-metadata/lib/esm/Constants.js");
|
|
66619
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
66620
|
+
/* harmony import */ var _ClassParsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ClassParsers */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/ClassParsers.js");
|
|
66621
|
+
/* harmony import */ var _SchemaItemParsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SchemaItemParsers */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemParsers.js");
|
|
66622
|
+
/*---------------------------------------------------------------------------------------------
|
|
66623
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
66624
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
66625
|
+
*--------------------------------------------------------------------------------------------*/
|
|
66626
|
+
|
|
66627
|
+
|
|
66628
|
+
|
|
66629
|
+
|
|
66630
|
+
function clean(_key, value) {
|
|
66631
|
+
return value === null ? undefined : value;
|
|
66632
|
+
}
|
|
66633
|
+
/**
|
|
66634
|
+
* Parses SchemaProps JSON returned from an ECSql query and returns the correct SchemaProps JSON object.
|
|
66635
|
+
* This is necessary as a small amount information (ie. CustomAttributes, unqualified type names, etc.)
|
|
66636
|
+
* returned from the iModelDb is in a different format than is required for a given Schema or
|
|
66637
|
+
* SchemaItemProps JSON object.
|
|
66638
|
+
* @internal
|
|
66639
|
+
*/
|
|
66640
|
+
class SchemaParser {
|
|
66641
|
+
/**
|
|
66642
|
+
* Corrects the SchemaProps JSON returned from the query to a proper SchemaProps
|
|
66643
|
+
* JSON object.
|
|
66644
|
+
* @param schema The SchemaProps JSON object to parse.
|
|
66645
|
+
* @param context The SchemaContext that will contain the schema and it's references.
|
|
66646
|
+
* @returns The corrected SchemaProps JSON.
|
|
66647
|
+
*/
|
|
66648
|
+
static async parse(schema, context) {
|
|
66649
|
+
const props = schema;
|
|
66650
|
+
props.$schema = _Constants__WEBPACK_IMPORTED_MODULE_0__.ECSchemaNamespaceUris.SCHEMAURL3_2_JSON,
|
|
66651
|
+
props.customAttributes = props.customAttributes ? props.customAttributes.map((attr) => { return parseCustomAttribute(attr); }) : undefined;
|
|
66652
|
+
props.label = props.label === null ? undefined : props.label;
|
|
66653
|
+
props.description = props.description === null ? undefined : props.description;
|
|
66654
|
+
if (props.items) {
|
|
66655
|
+
props.items = await this.parseItems(props.items, props.name, context);
|
|
66656
|
+
}
|
|
66657
|
+
if (!props.customAttributes || props.customAttributes.length === 0)
|
|
66658
|
+
delete props.customAttributes;
|
|
66659
|
+
const cleaned = JSON.parse(JSON.stringify(props, clean));
|
|
66660
|
+
return cleaned;
|
|
66661
|
+
}
|
|
66662
|
+
/**
|
|
66663
|
+
* Parse the given SchemaItemProps array, as returned from an ECSql query, and returns the corrected SchemaItemProps.
|
|
66664
|
+
* @param schemaItems The SchemaItemProps array returned from an iModelDb.
|
|
66665
|
+
* @param schemaName The name of the Schema to which the SchemaItemProps belong.
|
|
66666
|
+
* @param context The SchemaContext containing the Schema.
|
|
66667
|
+
* @returns The corrected SchemaItemProps.
|
|
66668
|
+
*/
|
|
66669
|
+
static async parseSchemaItems(schemaItems, schemaName, context) {
|
|
66670
|
+
const items = [];
|
|
66671
|
+
for (const item of schemaItems) {
|
|
66672
|
+
const props = await this.parseItem(item, schemaName, context);
|
|
66673
|
+
const cleaned = JSON.parse(JSON.stringify(props, clean));
|
|
66674
|
+
items.push(cleaned);
|
|
66675
|
+
}
|
|
66676
|
+
return items.length > 0 ? items : undefined;
|
|
66677
|
+
}
|
|
66678
|
+
static async parseItems(schemaItemProps, schemaName, context) {
|
|
66679
|
+
const items = {};
|
|
66680
|
+
for (const itemProps of schemaItemProps) {
|
|
66681
|
+
const props = await this.parseItem(itemProps, schemaName, context);
|
|
66682
|
+
items[props.name] = props;
|
|
66683
|
+
delete props.name;
|
|
66684
|
+
}
|
|
66685
|
+
return Object.keys(items).length > 0 ? items : undefined;
|
|
66686
|
+
}
|
|
66687
|
+
static async parseItem(props, schemaName, context) {
|
|
66688
|
+
const schemaItem = "string" === typeof (props) ? JSON.parse(props) : props;
|
|
66689
|
+
const type = (0,_ECObjects__WEBPACK_IMPORTED_MODULE_1__.parseSchemaItemType)(schemaItem.schemaItemType);
|
|
66690
|
+
switch (type) {
|
|
66691
|
+
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.KindOfQuantity:
|
|
66692
|
+
const koqParser = new _SchemaItemParsers__WEBPACK_IMPORTED_MODULE_3__.KindOfQuantityParser(schemaName, context);
|
|
66693
|
+
return koqParser.parse(schemaItem);
|
|
66694
|
+
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.EntityClass:
|
|
66695
|
+
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.StructClass:
|
|
66696
|
+
const classParser = new _ClassParsers__WEBPACK_IMPORTED_MODULE_2__.ClassParser(schemaName, context);
|
|
66697
|
+
return classParser.parse(schemaItem);
|
|
66698
|
+
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.RelationshipClass:
|
|
66699
|
+
const relationshipParser = new _ClassParsers__WEBPACK_IMPORTED_MODULE_2__.RelationshipClassParser(schemaName, context);
|
|
66700
|
+
return relationshipParser.parse(schemaItem);
|
|
66701
|
+
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.Mixin:
|
|
66702
|
+
const mixinParser = new _ClassParsers__WEBPACK_IMPORTED_MODULE_2__.MixinParser(schemaName, context);
|
|
66703
|
+
return mixinParser.parse(schemaItem);
|
|
66704
|
+
case _ECObjects__WEBPACK_IMPORTED_MODULE_1__.SchemaItemType.CustomAttributeClass:
|
|
66705
|
+
const caParser = new _ClassParsers__WEBPACK_IMPORTED_MODULE_2__.CustomAttributeClassParser(schemaName, context);
|
|
66706
|
+
return caParser.parse(schemaItem);
|
|
66707
|
+
default:
|
|
66708
|
+
const itemParser = new _SchemaItemParsers__WEBPACK_IMPORTED_MODULE_3__.SchemaItemParser(schemaName, context);
|
|
66709
|
+
return itemParser.parse(schemaItem);
|
|
66710
|
+
}
|
|
66711
|
+
}
|
|
66712
|
+
}
|
|
66713
|
+
/**
|
|
66714
|
+
* Utility method to parse CustomAttribute data retrieved from a ECSql query.
|
|
66715
|
+
* @param customAttribute CustomAttribute data as retrieved from an iModel query.
|
|
66716
|
+
* @returns The CustomAttribute instance.
|
|
66717
|
+
* @internal
|
|
66718
|
+
*/
|
|
66719
|
+
function parseCustomAttribute(customAttribute) {
|
|
66720
|
+
return {
|
|
66721
|
+
...customAttribute[customAttribute.ecClass],
|
|
66722
|
+
className: `${(customAttribute.ecSchema).split('.')[0]}.${customAttribute.ecClass}`,
|
|
66723
|
+
};
|
|
66724
|
+
}
|
|
66725
|
+
|
|
66726
|
+
|
|
66727
|
+
/***/ }),
|
|
66728
|
+
|
|
66729
|
+
/***/ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaStubQueries.js":
|
|
66730
|
+
/*!************************************************************************************!*\
|
|
66731
|
+
!*** ../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaStubQueries.js ***!
|
|
66732
|
+
\************************************************************************************/
|
|
66733
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66734
|
+
|
|
66735
|
+
"use strict";
|
|
66736
|
+
__webpack_require__.r(__webpack_exports__);
|
|
66737
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
66738
|
+
/* harmony export */ ecsqlQueries: () => (/* binding */ ecsqlQueries),
|
|
66739
|
+
/* harmony export */ modifier: () => (/* binding */ modifier),
|
|
66740
|
+
/* harmony export */ strength: () => (/* binding */ strength),
|
|
66741
|
+
/* harmony export */ strengthDirection: () => (/* binding */ strengthDirection)
|
|
66742
|
+
/* harmony export */ });
|
|
66743
|
+
/* harmony import */ var _SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SchemaItemQueries */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/SchemaItemQueries.js");
|
|
66744
|
+
/*---------------------------------------------------------------------------------------------
|
|
66745
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
66746
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
66747
|
+
*--------------------------------------------------------------------------------------------*/
|
|
66748
|
+
|
|
66749
|
+
const modifier = (alias) => {
|
|
66750
|
+
return `
|
|
66751
|
+
CASE
|
|
66752
|
+
WHEN [${alias}].[modifier] = 0 THEN 'None'
|
|
66753
|
+
WHEN [${alias}].[modifier] = 1 THEN 'Abstract'
|
|
66754
|
+
WHEN [${alias}].[modifier] = 2 THEN 'Sealed'
|
|
66755
|
+
ELSE NULL
|
|
66756
|
+
END
|
|
66757
|
+
`;
|
|
66758
|
+
};
|
|
66759
|
+
const strength = (alias) => {
|
|
66760
|
+
return `
|
|
66761
|
+
CASE
|
|
66762
|
+
WHEN [${alias}].[RelationshipStrength] = 0 THEN 'Referencing'
|
|
66763
|
+
WHEN [${alias}].[RelationshipStrength] = 1 THEN 'Holding'
|
|
66764
|
+
WHEN [${alias}].[RelationshipStrength] = 2 THEN 'Embedding'
|
|
66765
|
+
ELSE NULL
|
|
66766
|
+
END
|
|
66767
|
+
`;
|
|
66768
|
+
};
|
|
66769
|
+
const strengthDirection = (alias) => {
|
|
66770
|
+
return `
|
|
66771
|
+
CASE
|
|
66772
|
+
WHEN [${alias}].[RelationshipStrengthDirection] = 1 THEN 'Forward'
|
|
66773
|
+
WHEN [${alias}].[RelationshipStrengthDirection] = 2 THEN 'Backward'
|
|
66774
|
+
ELSE NULL
|
|
66775
|
+
END
|
|
66776
|
+
`;
|
|
66777
|
+
};
|
|
66778
|
+
const withAppliesTo = `
|
|
66779
|
+
AppliesToCTE AS (
|
|
66780
|
+
SELECT
|
|
66781
|
+
[mixinAppliesTo].[ECInstanceId] AS [AppliesToId],
|
|
66782
|
+
[appliesToSchema].[name] as [AppliesToSchema],
|
|
66783
|
+
json_extract(XmlCAToJson([ca].[Class].[Id], [ca].[Instance]), '$.IsMixin.AppliesToEntityClass') AS [AppliesTo]
|
|
66784
|
+
FROM [meta].[CustomAttribute] [ca]
|
|
66785
|
+
JOIN [meta].[ECClassDef] [mixinAppliesTo]
|
|
66786
|
+
ON [mixinAppliesTo].[ECInstanceId] = [ca].[ContainerId]
|
|
66787
|
+
JOIN [meta].[ECSchemaDef] [appliesToSchema]
|
|
66788
|
+
ON [appliesToSchema].[ECInstanceId] = [mixinAppliesTo].[Schema].[Id]
|
|
66789
|
+
WHERE [ca].[ContainerType] = 30
|
|
66790
|
+
AND json_extract(XmlCAToJson([ca].[Class].[Id], [ca].[Instance]), '$.ecClass') = 'IsMixin'
|
|
66791
|
+
)
|
|
66792
|
+
`;
|
|
66793
|
+
const withSchemaReferences = `
|
|
66794
|
+
SchemaReferences AS (
|
|
66795
|
+
SELECT
|
|
66796
|
+
[ref].[SourceECInstanceId] AS [SchemaId],
|
|
66797
|
+
CONCAT([Name],'.',[VersionMajor],'.',[VersionWrite],'.',[VersionMinor]) AS [fullName]
|
|
66798
|
+
FROM
|
|
66799
|
+
[meta].[ECSchemaDef] AS [refSchema]
|
|
66800
|
+
INNER JOIN [meta].[SchemaHasSchemaReferences] [ref]
|
|
66801
|
+
ON [ref].[TargetECInstanceId] = [refSchema].[ECInstanceId]
|
|
66802
|
+
)
|
|
66803
|
+
`;
|
|
66804
|
+
const customAttributeQuery = `
|
|
66805
|
+
SELECT
|
|
66806
|
+
[Schema].[Id] AS [SchemaId],
|
|
66807
|
+
json_object(
|
|
66808
|
+
'name', [class].[Name],
|
|
66809
|
+
'schemaItemType', 'CustomAttributeClass',
|
|
66810
|
+
'modifier', ${modifier("class")},
|
|
66811
|
+
'label', [class].[DisplayLabel],
|
|
66812
|
+
'description', [class].[Description],
|
|
66813
|
+
'appliesTo', [class].[CustomAttributeContainerType],
|
|
66814
|
+
'baseClasses', (
|
|
66815
|
+
SELECT
|
|
66816
|
+
json_group_array(json(json_object(
|
|
66817
|
+
'schema', ec_classname([baseClass].[ECInstanceId], 's'),
|
|
66818
|
+
'name', [baseClass].[Name],
|
|
66819
|
+
'schemaItemType', 'CustomAttributeClass',
|
|
66820
|
+
'modifier', ${modifier("baseClass")},
|
|
66821
|
+
'label', [baseClass].[DisplayLabel],
|
|
66822
|
+
'description', [baseClass].[Description],
|
|
66823
|
+
'appliesTo', [baseClass].[CustomAttributeContainerType]
|
|
66824
|
+
)))
|
|
66825
|
+
FROM
|
|
66826
|
+
[meta].[ECClassDef] [baseClass]
|
|
66827
|
+
INNER JOIN [meta].[ClassHasAllBaseClasses] [baseClassMap]
|
|
66828
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseclass].[ECInstanceId]
|
|
66829
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
66830
|
+
)
|
|
66831
|
+
) AS [item]
|
|
66832
|
+
FROM [meta].[ECClassDef] [class]
|
|
66833
|
+
WHERE [class].[Type] = 3
|
|
66834
|
+
`;
|
|
66835
|
+
const structQuery = `
|
|
66836
|
+
SELECT
|
|
66837
|
+
[Schema].[Id] AS [SchemaId],
|
|
66838
|
+
json_object(
|
|
66839
|
+
'name', [class].[Name],
|
|
66840
|
+
'schemaItemType', 'StructClass',
|
|
66841
|
+
'modifier', ${modifier("class")},
|
|
66842
|
+
'label', [class].[DisplayLabel],
|
|
66843
|
+
'description', [class].[Description],
|
|
66844
|
+
'baseClasses', (
|
|
66845
|
+
SELECT
|
|
66846
|
+
json_group_array(json(json_object(
|
|
66847
|
+
'schema', ec_classname([baseClass].[ECInstanceId], 's'),
|
|
66848
|
+
'name', [baseClass].[Name],
|
|
66849
|
+
'schemaItemType', 'StructClass',
|
|
66850
|
+
'modifier', ${modifier("baseClass")},
|
|
66851
|
+
'label', [baseClass].[DisplayLabel],
|
|
66852
|
+
'description', [baseClass].[Description]
|
|
66853
|
+
)))
|
|
66854
|
+
FROM
|
|
66855
|
+
[meta].[ECClassDef] [baseClass]
|
|
66856
|
+
INNER JOIN [meta].[ClassHasAllBaseClasses] [baseClassMap]
|
|
66857
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseclass].[ECInstanceId]
|
|
66858
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
66859
|
+
)
|
|
66860
|
+
) AS [item]
|
|
66861
|
+
FROM [meta].[ECClassDef] [class]
|
|
66862
|
+
WHERE [class].[Type] = 2
|
|
66863
|
+
`;
|
|
66864
|
+
const relationshipQuery = `
|
|
66865
|
+
SELECT
|
|
66866
|
+
[Schema].[Id] AS [SchemaId],
|
|
66867
|
+
json_object(
|
|
66868
|
+
'name', [class].[Name],
|
|
66869
|
+
'schemaItemType', 'RelationshipClass',
|
|
66870
|
+
'modifier', ${modifier("class")},
|
|
66871
|
+
'label', [class].[DisplayLabel],
|
|
66872
|
+
'description', [class].[Description],
|
|
66873
|
+
'strength', ${strength("class")},
|
|
66874
|
+
'strengthDirection', ${strengthDirection("class")},
|
|
66875
|
+
'baseClasses', (
|
|
66876
|
+
SELECT
|
|
66877
|
+
json_group_array(json(json_object(
|
|
66878
|
+
'schema', ec_classname([baseClass].[ECInstanceId], 's'),
|
|
66879
|
+
'name', [baseClass].[Name],
|
|
66880
|
+
'schemaItemType', 'RelationshipClass',
|
|
66881
|
+
'modifier', ${modifier("baseClass")},
|
|
66882
|
+
'label', [baseClass].[DisplayLabel],
|
|
66883
|
+
'description', [baseClass].[Description],
|
|
66884
|
+
'strength', ${strength("baseClass")},
|
|
66885
|
+
'strengthDirection', ${strengthDirection("baseClass")}
|
|
66886
|
+
)))
|
|
66887
|
+
FROM
|
|
66888
|
+
[meta].[ECClassDef] [baseClass]
|
|
66889
|
+
INNER JOIN [meta].[ClassHasAllBaseClasses] [baseClassMap]
|
|
66890
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseclass].[ECInstanceId]
|
|
66891
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
66892
|
+
)
|
|
66893
|
+
) AS [item]
|
|
66894
|
+
FROM [meta].[ECClassDef] [class]
|
|
66895
|
+
WHERE [class].[Type] = 1
|
|
66896
|
+
`;
|
|
66897
|
+
const entityQuery = `
|
|
66898
|
+
SELECT
|
|
66899
|
+
[Schema].[Id] AS [SchemaId],
|
|
66900
|
+
json_object(
|
|
66901
|
+
'name', [class].[Name],
|
|
66902
|
+
'schemaItemType', 'EntityClass',
|
|
66903
|
+
'modifier', ${modifier("class")},
|
|
66904
|
+
'label', [class].[DisplayLabel],
|
|
66905
|
+
'description', [class].[Description],
|
|
66906
|
+
'baseClasses', (
|
|
66907
|
+
SELECT
|
|
66908
|
+
json_group_array(json(json_object(
|
|
66909
|
+
'schema', ec_classname([baseClass].[ECInstanceId], 's'),
|
|
66910
|
+
'name', [baseClass].[Name],
|
|
66911
|
+
'schemaItemType', 'EntityClass',
|
|
66912
|
+
'modifier', ${modifier("baseClass")},
|
|
66913
|
+
'label', [baseClass].[DisplayLabel],
|
|
66914
|
+
'description', [baseClass].[Description]
|
|
66915
|
+
)))
|
|
66916
|
+
FROM
|
|
66917
|
+
[meta].[ECClassDef] [baseClass]
|
|
66918
|
+
INNER JOIN [meta].[ClassHasAllBaseClasses] [baseClassMap]
|
|
66919
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseclass].[ECInstanceId]
|
|
66920
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
66921
|
+
AND NOT EXISTS(SELECT 1 FROM [meta].[ClassCustomAttribute] [ca] WHERE [baseClass].[ECInstanceId] = [ca].[Class].[Id]
|
|
66922
|
+
AND [ca].[CustomAttributeClass].[Id] Is ([CoreCA].[IsMixin]))
|
|
66923
|
+
),
|
|
66924
|
+
'mixins', (
|
|
66925
|
+
SELECT
|
|
66926
|
+
json_group_array(json(json_object(
|
|
66927
|
+
'schema', ec_classname([baseClass].[ECInstanceId], 's'),
|
|
66928
|
+
'name', [baseClass].[Name],
|
|
66929
|
+
'schemaItemType', 'Mixin',
|
|
66930
|
+
'modifier', ${modifier("baseClass")},
|
|
66931
|
+
'label', [baseClass].[DisplayLabel],
|
|
66932
|
+
'description', [baseClass].[Description],
|
|
66933
|
+
'appliesTo', (
|
|
66934
|
+
SELECT IIF(instr([atCTE].[AppliesTo], ':') > 1, ec_classname(ec_classId([atCTE].[AppliesTo]), 's.c'), CONCAT([atCTE].[AppliesToSchema], '.', [atCTE].[AppliesTo]))
|
|
66935
|
+
FROM [AppliesToCTE] [atCTE]
|
|
66936
|
+
WHERE [atCTE].[AppliesToId] = [baseClass].[ECInstanceId]
|
|
66937
|
+
),
|
|
66938
|
+
'baseClasses', (
|
|
66939
|
+
SELECT
|
|
66940
|
+
json_group_array(json(json_object(
|
|
66941
|
+
'schema', ec_classname([mixinBaseClass].[ECInstanceId], 's'),
|
|
66942
|
+
'name', [mixinBaseClass].[Name],
|
|
66943
|
+
'schemaItemType', 'Mixin',
|
|
66944
|
+
'modifier', ${modifier("mixinBaseClass")},
|
|
66945
|
+
'label', [mixinBaseClass].[DisplayLabel],
|
|
66946
|
+
'description', [mixinBaseClass].[Description],
|
|
66947
|
+
'appliesTo', (
|
|
66948
|
+
SELECT IIF(instr([atCTE].[AppliesTo], ':') > 1, ec_classname(ec_classId([atCTE].[AppliesTo]), 's.c'), CONCAT([atCTE].[AppliesToSchema], '.', [atCTE].[AppliesTo]))
|
|
66949
|
+
FROM [AppliesToCTE] [atCTE]
|
|
66950
|
+
WHERE [atCTE].[AppliesToId] = [mixinBaseClass].[ECInstanceId]
|
|
66951
|
+
)
|
|
66952
|
+
)))
|
|
66953
|
+
FROM
|
|
66954
|
+
[meta].[ECClassDef] [mixinBaseClass]
|
|
66955
|
+
INNER JOIN [meta].[ClassHasAllBaseClasses] [mixinBaseClassMap]
|
|
66956
|
+
ON [mixinBaseClassMap].[TargetECInstanceId] = [mixinBaseClass].[ECInstanceId]
|
|
66957
|
+
WHERE [mixinBaseClassMap].[SourceECInstanceId] = [baseClass].[ECInstanceId]
|
|
66958
|
+
)
|
|
66959
|
+
)))
|
|
66960
|
+
FROM
|
|
66961
|
+
[meta].[ECClassDef] [baseClass]
|
|
66962
|
+
INNER JOIN [meta].[ClassHasBaseClasses] [baseClassMap]
|
|
66963
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseclass].[ECInstanceId]
|
|
66964
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
66965
|
+
AND EXISTS(SELECT 1 FROM [meta].[ClassCustomAttribute] [ca] WHERE [baseClass].[ECInstanceId] = [ca].[Class].[Id]
|
|
66966
|
+
AND [ca].[CustomAttributeClass].[Id] Is ([CoreCA].[IsMixin]))
|
|
66967
|
+
)
|
|
66968
|
+
) AS [item]
|
|
66969
|
+
FROM [meta].[ECClassDef] [class]
|
|
66970
|
+
WHERE [class].[Type] = 0
|
|
66971
|
+
AND NOT EXISTS(SELECT 1 FROM [meta].[ClassCustomAttribute] [ca] WHERE [class].[ECInstanceId] = [ca].[Class].[Id]
|
|
66972
|
+
AND [ca].[CustomAttributeClass].[Id] Is ([CoreCA].[IsMixin]))
|
|
66973
|
+
`;
|
|
66974
|
+
const mixinQuery = `
|
|
66975
|
+
SELECT
|
|
66976
|
+
[Schema].[Id] AS [SchemaId],
|
|
66977
|
+
json_object(
|
|
66978
|
+
'name', [class].[Name],
|
|
66979
|
+
'schemaItemType', 'Mixin',
|
|
66980
|
+
'modifier', ${modifier("class")},
|
|
66981
|
+
'label', [class].[DisplayLabel],
|
|
66982
|
+
'description', [class].[Description],
|
|
66983
|
+
'appliesTo', (
|
|
66984
|
+
SELECT IIF(instr([atCTE].[AppliesTo], ':') > 1, ec_classname(ec_classId([atCTE].[AppliesTo]), 's.c'), CONCAT([atCTE].[AppliesToSchema], '.', [atCTE].[AppliesTo]))
|
|
66985
|
+
FROM [AppliesToCTE] [atCTE]
|
|
66986
|
+
WHERE [atCTE].[AppliesToId] = [class].[ECInstanceId]
|
|
66987
|
+
),
|
|
66988
|
+
'baseClasses', (
|
|
66989
|
+
SELECT
|
|
66990
|
+
json_group_array(json(json_object(
|
|
66991
|
+
'schema', ec_classname([baseClass].[ECInstanceId], 's'),
|
|
66992
|
+
'name', [baseClass].[Name],
|
|
66993
|
+
'schemaItemType', 'Mixin',
|
|
66994
|
+
'modifier', ${modifier("baseClass")},
|
|
66995
|
+
'label', [baseClass].[DisplayLabel],
|
|
66996
|
+
'description', [baseClass].[Description],
|
|
66997
|
+
'appliesTo', (
|
|
66998
|
+
SELECT IIF(instr([atCTE].[AppliesTo], ':') > 1, ec_classname(ec_classId([atCTE].[AppliesTo]), 's.c'), CONCAT([atCTE].[AppliesToSchema], '.', [atCTE].[AppliesTo]))
|
|
66999
|
+
FROM [AppliesToCTE] [atCTE]
|
|
67000
|
+
WHERE [atCTE].[AppliesToId] = [baseClass].[ECInstanceId]
|
|
67001
|
+
)
|
|
67002
|
+
)))
|
|
67003
|
+
FROM
|
|
67004
|
+
[meta].[ECClassDef] [baseClass]
|
|
67005
|
+
INNER JOIN [meta].[ClassHasAllBaseClasses] [baseClassMap]
|
|
67006
|
+
ON [baseClassMap].[TargetECInstanceId] = [baseclass].[ECInstanceId]
|
|
67007
|
+
WHERE [baseClassMap].[SourceECInstanceId] = [class].[ECInstanceId]
|
|
67008
|
+
)
|
|
67009
|
+
) AS [item]
|
|
67010
|
+
FROM [meta].[ECClassDef] [class]
|
|
67011
|
+
WHERE [class].[Type] = 0 AND EXISTS (SELECT 1 FROM [meta].[ClassCustomAttribute] [ca] WHERE [class].[ECInstanceId] = [ca].[Class].[Id]
|
|
67012
|
+
AND [ca].[CustomAttributeClass].[Id] Is ([CoreCA].[IsMixin]))
|
|
67013
|
+
`;
|
|
67014
|
+
const withSchemaItems = `
|
|
67015
|
+
SchemaItems AS (
|
|
67016
|
+
${customAttributeQuery}
|
|
67017
|
+
UNION ALL
|
|
67018
|
+
${structQuery}
|
|
67019
|
+
UNION ALL
|
|
67020
|
+
${relationshipQuery}
|
|
67021
|
+
UNION ALL
|
|
67022
|
+
${entityQuery}
|
|
67023
|
+
UNION ALL
|
|
67024
|
+
${mixinQuery}
|
|
67025
|
+
UNION ALL
|
|
67026
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.enumeration()}
|
|
67027
|
+
UNION ALL
|
|
67028
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.kindOfQuantity()}
|
|
67029
|
+
UNION ALL
|
|
67030
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.propertyCategory()}
|
|
67031
|
+
UNION ALL
|
|
67032
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.unit()}
|
|
67033
|
+
UNION ALL
|
|
67034
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.invertedUnit()}
|
|
67035
|
+
UNION ALL
|
|
67036
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.constant()}
|
|
67037
|
+
UNION ALL
|
|
67038
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.phenomenon()}
|
|
67039
|
+
UNION ALL
|
|
67040
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.unitSystem()}
|
|
67041
|
+
UNION ALL
|
|
67042
|
+
${_SchemaItemQueries__WEBPACK_IMPORTED_MODULE_0__.SchemaItemQueries.format()}
|
|
67043
|
+
)
|
|
67044
|
+
`;
|
|
67045
|
+
const schemaStubQuery = `
|
|
67046
|
+
WITH
|
|
67047
|
+
${withSchemaReferences},
|
|
67048
|
+
${withAppliesTo},
|
|
67049
|
+
${withSchemaItems}
|
|
67050
|
+
SELECT
|
|
67051
|
+
[Name] as [name],
|
|
67052
|
+
CONCAT('',[VersionMajor],'.',[VersionWrite],'.',[VersionMinor]) AS [version],
|
|
67053
|
+
[Alias] as [alias],
|
|
67054
|
+
[DisplayLabel] as [displayLabel],
|
|
67055
|
+
[Description] as [description],
|
|
67056
|
+
(
|
|
67057
|
+
SELECT
|
|
67058
|
+
json_group_array([schemaReferences].[fullName])
|
|
67059
|
+
FROM
|
|
67060
|
+
[SchemaReferences] [schemaReferences]
|
|
67061
|
+
WHERE
|
|
67062
|
+
[schemaReferences].[SchemaId] = [schemaDef].[ECInstanceId]
|
|
67063
|
+
) AS [references],
|
|
67064
|
+
(
|
|
67065
|
+
SELECT
|
|
67066
|
+
json_group_array(json([items].[item]))
|
|
67067
|
+
FROM
|
|
67068
|
+
[SchemaItems] [items]
|
|
67069
|
+
WHERE
|
|
67070
|
+
[items].[SchemaId] = [schemaDef].[ECInstanceId]
|
|
67071
|
+
) AS [items]
|
|
67072
|
+
FROM
|
|
67073
|
+
[meta].[ECSchemaDef] [schemaDef]
|
|
67074
|
+
WHERE [Name] = :schemaName
|
|
67075
|
+
`;
|
|
67076
|
+
const schemaInfoQuery = `
|
|
67077
|
+
WITH
|
|
67078
|
+
${withSchemaReferences}
|
|
67079
|
+
SELECT
|
|
67080
|
+
[Name] as [name],
|
|
67081
|
+
CONCAT('',[VersionMajor],'.',[VersionWrite],'.',[VersionMinor]) AS [version],
|
|
67082
|
+
[Alias] as [alias],
|
|
67083
|
+
(
|
|
67084
|
+
SELECT
|
|
67085
|
+
json_group_array([schemaReferences].[fullName])
|
|
67086
|
+
FROM
|
|
67087
|
+
[SchemaReferences] [schemaReferences]
|
|
67088
|
+
WHERE
|
|
67089
|
+
[schemaReferences].[SchemaId] = [schemaDef].[ECInstanceId]
|
|
67090
|
+
) AS [references]
|
|
67091
|
+
FROM
|
|
67092
|
+
[meta].[ECSchemaDef] [schemaDef]
|
|
67093
|
+
`;
|
|
67094
|
+
/**
|
|
67095
|
+
* Partial Schema queries.
|
|
67096
|
+
* @internal
|
|
67097
|
+
*/
|
|
67098
|
+
const ecsqlQueries = {
|
|
67099
|
+
schemaStubQuery,
|
|
67100
|
+
schemaInfoQuery,
|
|
67101
|
+
};
|
|
67102
|
+
|
|
67103
|
+
|
|
64632
67104
|
/***/ }),
|
|
64633
67105
|
|
|
64634
67106
|
/***/ "../../core/ecschema-metadata/lib/esm/Interfaces.js":
|
|
@@ -68818,6 +71290,7 @@ class Schema {
|
|
|
68818
71290
|
_customAttributes;
|
|
68819
71291
|
_originalECSpecMajorVersion;
|
|
68820
71292
|
_originalECSpecMinorVersion;
|
|
71293
|
+
_loadingController;
|
|
68821
71294
|
/** @internal */
|
|
68822
71295
|
constructor(context, nameOrKey, alias, readVer, writeVer, minorVer) {
|
|
68823
71296
|
this._schemaKey = (typeof (nameOrKey) === "string") ? new _SchemaKey__WEBPACK_IMPORTED_MODULE_6__.SchemaKey(nameOrKey, new _SchemaKey__WEBPACK_IMPORTED_MODULE_6__.ECVersion(readVer, writeVer, minorVer)) : nameOrKey;
|
|
@@ -68883,6 +71356,14 @@ class Schema {
|
|
|
68883
71356
|
get schema() { return this; }
|
|
68884
71357
|
/** Returns the schema context this schema is within. */
|
|
68885
71358
|
get context() { return this._context; }
|
|
71359
|
+
/**
|
|
71360
|
+
* Returns the SchemaLoadingController for this Schema. This would only be set if the schema is
|
|
71361
|
+
* loaded incrementally.
|
|
71362
|
+
* @internal
|
|
71363
|
+
*/
|
|
71364
|
+
get loadingController() {
|
|
71365
|
+
return this._loadingController;
|
|
71366
|
+
}
|
|
68886
71367
|
/**
|
|
68887
71368
|
* Returns a SchemaItemKey given the item name and the schema it belongs to
|
|
68888
71369
|
* @param fullName fully qualified name {Schema name}.{Item Name}
|
|
@@ -69508,6 +71989,10 @@ class Schema {
|
|
|
69508
71989
|
}
|
|
69509
71990
|
this._alias = alias;
|
|
69510
71991
|
}
|
|
71992
|
+
/** @internal */
|
|
71993
|
+
setLoadingController(controller) {
|
|
71994
|
+
this._loadingController = controller;
|
|
71995
|
+
}
|
|
69511
71996
|
}
|
|
69512
71997
|
/**
|
|
69513
71998
|
* Hackish approach that works like a "friend class" so we can access protected members without making them public.
|
|
@@ -69561,6 +72046,7 @@ class SchemaItem {
|
|
|
69561
72046
|
_key;
|
|
69562
72047
|
_description;
|
|
69563
72048
|
_label;
|
|
72049
|
+
_loadingController;
|
|
69564
72050
|
/** @internal */
|
|
69565
72051
|
constructor(schema, name) {
|
|
69566
72052
|
this._key = new _SchemaKey__WEBPACK_IMPORTED_MODULE_3__.SchemaItemKey(name, schema.schemaKey);
|
|
@@ -69571,6 +72057,14 @@ class SchemaItem {
|
|
|
69571
72057
|
get key() { return this._key; }
|
|
69572
72058
|
get label() { return this._label; }
|
|
69573
72059
|
get description() { return this._description; }
|
|
72060
|
+
/**
|
|
72061
|
+
* Returns the SchemaLoadingController for this Schema. This would only be set if the schema is
|
|
72062
|
+
* loaded incrementally.
|
|
72063
|
+
* @internal
|
|
72064
|
+
*/
|
|
72065
|
+
get loadingController() {
|
|
72066
|
+
return this._loadingController;
|
|
72067
|
+
}
|
|
69574
72068
|
// Proposal: Create protected setter methods for description and label? For UnitSystems as an example, where using createFromProps isn't that necessary and can just use basic create().
|
|
69575
72069
|
/**
|
|
69576
72070
|
* Save this SchemaItem's properties to an object for serializing to JSON.
|
|
@@ -69676,6 +72170,10 @@ class SchemaItem {
|
|
|
69676
72170
|
setDescription(description) {
|
|
69677
72171
|
this._description = description;
|
|
69678
72172
|
}
|
|
72173
|
+
/** @internal */
|
|
72174
|
+
setLoadingController(controller) {
|
|
72175
|
+
this._loadingController = controller;
|
|
72176
|
+
}
|
|
69679
72177
|
}
|
|
69680
72178
|
|
|
69681
72179
|
|
|
@@ -71830,6 +74328,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
71830
74328
|
/* harmony export */ ECSchemaError: () => (/* reexport safe */ _Exception__WEBPACK_IMPORTED_MODULE_9__.ECSchemaError),
|
|
71831
74329
|
/* harmony export */ ECSchemaNamespaceUris: () => (/* reexport safe */ _Constants__WEBPACK_IMPORTED_MODULE_0__.ECSchemaNamespaceUris),
|
|
71832
74330
|
/* harmony export */ ECSchemaStatus: () => (/* reexport safe */ _Exception__WEBPACK_IMPORTED_MODULE_9__.ECSchemaStatus),
|
|
74331
|
+
/* harmony export */ ECSqlSchemaLocater: () => (/* reexport safe */ _IncrementalLoading_ECSqlSchemaLocater__WEBPACK_IMPORTED_MODULE_39__.ECSqlSchemaLocater),
|
|
71833
74332
|
/* harmony export */ ECStringConstants: () => (/* reexport safe */ _Constants__WEBPACK_IMPORTED_MODULE_0__.ECStringConstants),
|
|
71834
74333
|
/* harmony export */ ECVersion: () => (/* reexport safe */ _SchemaKey__WEBPACK_IMPORTED_MODULE_31__.ECVersion),
|
|
71835
74334
|
/* harmony export */ EntityClass: () => (/* reexport safe */ _Metadata_EntityClass__WEBPACK_IMPORTED_MODULE_14__.EntityClass),
|
|
@@ -71837,6 +74336,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
71837
74336
|
/* harmony export */ EnumerationArrayProperty: () => (/* reexport safe */ _Metadata_Property__WEBPACK_IMPORTED_MODULE_22__.EnumerationArrayProperty),
|
|
71838
74337
|
/* harmony export */ EnumerationProperty: () => (/* reexport safe */ _Metadata_Property__WEBPACK_IMPORTED_MODULE_22__.EnumerationProperty),
|
|
71839
74338
|
/* harmony export */ Format: () => (/* reexport safe */ _Metadata_Format__WEBPACK_IMPORTED_MODULE_16__.Format),
|
|
74339
|
+
/* harmony export */ IncrementalSchemaLocater: () => (/* reexport safe */ _IncrementalLoading_IncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_40__.IncrementalSchemaLocater),
|
|
71840
74340
|
/* harmony export */ InvertedUnit: () => (/* reexport safe */ _Metadata_InvertedUnit__WEBPACK_IMPORTED_MODULE_17__.InvertedUnit),
|
|
71841
74341
|
/* harmony export */ KindOfQuantity: () => (/* reexport safe */ _Metadata_KindOfQuantity__WEBPACK_IMPORTED_MODULE_18__.KindOfQuantity),
|
|
71842
74342
|
/* harmony export */ Mixin: () => (/* reexport safe */ _Metadata_Mixin__WEBPACK_IMPORTED_MODULE_19__.Mixin),
|
|
@@ -71859,7 +74359,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
71859
74359
|
/* harmony export */ SchemaCache: () => (/* reexport safe */ _Context__WEBPACK_IMPORTED_MODULE_1__.SchemaCache),
|
|
71860
74360
|
/* harmony export */ SchemaContext: () => (/* reexport safe */ _Context__WEBPACK_IMPORTED_MODULE_1__.SchemaContext),
|
|
71861
74361
|
/* harmony export */ SchemaFormatsProvider: () => (/* reexport safe */ _SchemaFormatsProvider__WEBPACK_IMPORTED_MODULE_38__.SchemaFormatsProvider),
|
|
71862
|
-
/* harmony export */ SchemaGraph: () => (/* reexport safe */
|
|
74362
|
+
/* harmony export */ SchemaGraph: () => (/* reexport safe */ _utils_SchemaGraph__WEBPACK_IMPORTED_MODULE_41__.SchemaGraph),
|
|
71863
74363
|
/* harmony export */ SchemaGraphUtil: () => (/* reexport safe */ _Deserialization_SchemaGraphUtil__WEBPACK_IMPORTED_MODULE_3__.SchemaGraphUtil),
|
|
71864
74364
|
/* harmony export */ SchemaItem: () => (/* reexport safe */ _Metadata_SchemaItem__WEBPACK_IMPORTED_MODULE_26__.SchemaItem),
|
|
71865
74365
|
/* harmony export */ SchemaItemKey: () => (/* reexport safe */ _SchemaKey__WEBPACK_IMPORTED_MODULE_31__.SchemaItemKey),
|
|
@@ -71940,7 +74440,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
71940
74440
|
/* harmony import */ var _Validation_SchemaWalker__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./Validation/SchemaWalker */ "../../core/ecschema-metadata/lib/esm/Validation/SchemaWalker.js");
|
|
71941
74441
|
/* harmony import */ var _SchemaPartVisitorDelegate__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./SchemaPartVisitorDelegate */ "../../core/ecschema-metadata/lib/esm/SchemaPartVisitorDelegate.js");
|
|
71942
74442
|
/* harmony import */ var _SchemaFormatsProvider__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./SchemaFormatsProvider */ "../../core/ecschema-metadata/lib/esm/SchemaFormatsProvider.js");
|
|
71943
|
-
/* harmony import */ var
|
|
74443
|
+
/* harmony import */ var _IncrementalLoading_ECSqlSchemaLocater__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./IncrementalLoading/ECSqlSchemaLocater */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js");
|
|
74444
|
+
/* harmony import */ var _IncrementalLoading_IncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./IncrementalLoading/IncrementalSchemaLocater */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js");
|
|
74445
|
+
/* harmony import */ var _utils_SchemaGraph__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./utils/SchemaGraph */ "../../core/ecschema-metadata/lib/esm/utils/SchemaGraph.js");
|
|
71944
74446
|
/*---------------------------------------------------------------------------------------------
|
|
71945
74447
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
71946
74448
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -71982,6 +74484,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
71982
74484
|
|
|
71983
74485
|
|
|
71984
74486
|
|
|
74487
|
+
|
|
74488
|
+
|
|
71985
74489
|
|
|
71986
74490
|
|
|
71987
74491
|
|
|
@@ -72124,6 +74628,81 @@ class SchemaGraph {
|
|
|
72124
74628
|
}
|
|
72125
74629
|
|
|
72126
74630
|
|
|
74631
|
+
/***/ }),
|
|
74632
|
+
|
|
74633
|
+
/***/ "../../core/ecschema-metadata/lib/esm/utils/SchemaLoadingController.js":
|
|
74634
|
+
/*!*****************************************************************************!*\
|
|
74635
|
+
!*** ../../core/ecschema-metadata/lib/esm/utils/SchemaLoadingController.js ***!
|
|
74636
|
+
\*****************************************************************************/
|
|
74637
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
74638
|
+
|
|
74639
|
+
"use strict";
|
|
74640
|
+
__webpack_require__.r(__webpack_exports__);
|
|
74641
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
74642
|
+
/* harmony export */ SchemaLoadingController: () => (/* binding */ SchemaLoadingController)
|
|
74643
|
+
/* harmony export */ });
|
|
74644
|
+
/*---------------------------------------------------------------------------------------------
|
|
74645
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
74646
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
74647
|
+
*--------------------------------------------------------------------------------------------*/
|
|
74648
|
+
/**
|
|
74649
|
+
* Assists in tracking the loading progress of Schemas and SchemaItems. An instance of this
|
|
74650
|
+
* class is set in Schema and SchemaItem instances.
|
|
74651
|
+
* @internal
|
|
74652
|
+
*/
|
|
74653
|
+
class SchemaLoadingController {
|
|
74654
|
+
_complete;
|
|
74655
|
+
_inProgress;
|
|
74656
|
+
_promise;
|
|
74657
|
+
/**
|
|
74658
|
+
* Indicates of the Schema or SchemaItem has been fully loaded.
|
|
74659
|
+
*/
|
|
74660
|
+
get isComplete() {
|
|
74661
|
+
return this._complete;
|
|
74662
|
+
}
|
|
74663
|
+
/**
|
|
74664
|
+
* Marks that a Schema or SchemaItem has been fully loaded.
|
|
74665
|
+
*/
|
|
74666
|
+
set isComplete(value) {
|
|
74667
|
+
this._complete = value;
|
|
74668
|
+
}
|
|
74669
|
+
/**
|
|
74670
|
+
* Indicates that the loading of a Schema or SchemaItem is still in progress
|
|
74671
|
+
*/
|
|
74672
|
+
get inProgress() {
|
|
74673
|
+
return this._inProgress;
|
|
74674
|
+
}
|
|
74675
|
+
/**
|
|
74676
|
+
* Initializes a new SchemaLoadingController instance.
|
|
74677
|
+
*/
|
|
74678
|
+
constructor() {
|
|
74679
|
+
this._complete = false;
|
|
74680
|
+
this._inProgress = false;
|
|
74681
|
+
}
|
|
74682
|
+
/**
|
|
74683
|
+
* Call this method when starting to load a Schema or SchemaItem
|
|
74684
|
+
* @param promise The promise used to update the controller state when the promise is resolved.
|
|
74685
|
+
*/
|
|
74686
|
+
start(promise) {
|
|
74687
|
+
this._inProgress = true;
|
|
74688
|
+
void promise.then(() => {
|
|
74689
|
+
this._complete = true;
|
|
74690
|
+
this._inProgress = false;
|
|
74691
|
+
});
|
|
74692
|
+
this._promise = promise;
|
|
74693
|
+
}
|
|
74694
|
+
/**
|
|
74695
|
+
* Waits on the Promise given in SchemaLoadingController.start().
|
|
74696
|
+
* @returns A Promised that can be awaited while the Schema or SchemaItem is being loaded.
|
|
74697
|
+
*/
|
|
74698
|
+
async wait() {
|
|
74699
|
+
if (!this._promise)
|
|
74700
|
+
throw new Error("LoadingController 'start' must be called before 'wait'");
|
|
74701
|
+
return this._promise;
|
|
74702
|
+
}
|
|
74703
|
+
}
|
|
74704
|
+
|
|
74705
|
+
|
|
72127
74706
|
/***/ }),
|
|
72128
74707
|
|
|
72129
74708
|
/***/ "../../core/ecschema-rpc/common/lib/esm/ECSchemaRpcInterface.js":
|
|
@@ -72272,6 +74851,74 @@ class ECSchemaRpcLocater {
|
|
|
72272
74851
|
}
|
|
72273
74852
|
|
|
72274
74853
|
|
|
74854
|
+
/***/ }),
|
|
74855
|
+
|
|
74856
|
+
/***/ "../../core/ecschema-rpc/common/lib/esm/RpcIncrementalSchemaLocater.js":
|
|
74857
|
+
/*!*****************************************************************************!*\
|
|
74858
|
+
!*** ../../core/ecschema-rpc/common/lib/esm/RpcIncrementalSchemaLocater.js ***!
|
|
74859
|
+
\*****************************************************************************/
|
|
74860
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
74861
|
+
|
|
74862
|
+
"use strict";
|
|
74863
|
+
__webpack_require__.r(__webpack_exports__);
|
|
74864
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
74865
|
+
/* harmony export */ RpcIncrementalSchemaLocater: () => (/* binding */ RpcIncrementalSchemaLocater)
|
|
74866
|
+
/* harmony export */ });
|
|
74867
|
+
/* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
74868
|
+
/* harmony import */ var _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/ecschema-metadata */ "../../core/ecschema-metadata/lib/esm/ecschema-metadata.js");
|
|
74869
|
+
/* harmony import */ var _ECSchemaRpcInterface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ECSchemaRpcInterface */ "../../core/ecschema-rpc/common/lib/esm/ECSchemaRpcInterface.js");
|
|
74870
|
+
/*---------------------------------------------------------------------------------------------
|
|
74871
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
74872
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
74873
|
+
*--------------------------------------------------------------------------------------------*/
|
|
74874
|
+
|
|
74875
|
+
|
|
74876
|
+
|
|
74877
|
+
/**
|
|
74878
|
+
* A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the ECSchema RPC interfaces to load schemas incrementally.
|
|
74879
|
+
* @beta
|
|
74880
|
+
*/
|
|
74881
|
+
class RpcIncrementalSchemaLocater extends _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_1__.ECSqlSchemaLocater {
|
|
74882
|
+
_iModelProps;
|
|
74883
|
+
/**
|
|
74884
|
+
* Initializes a new instance of the RpcIncrementalSchemaLocater class.
|
|
74885
|
+
*/
|
|
74886
|
+
constructor(iModelProps, options) {
|
|
74887
|
+
super(options);
|
|
74888
|
+
this._iModelProps = iModelProps;
|
|
74889
|
+
}
|
|
74890
|
+
/**
|
|
74891
|
+
* Executes the given ECSql query and returns the resulting rows.
|
|
74892
|
+
* @param query The ECSql query to execute.
|
|
74893
|
+
* @param options Optional arguments to control the query result.
|
|
74894
|
+
* @returns A promise that resolves to the resulting rows.
|
|
74895
|
+
*/
|
|
74896
|
+
async executeQuery(query, options) {
|
|
74897
|
+
const ecSqlQueryClient = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.IModelReadRpcInterface.getClient();
|
|
74898
|
+
const queryExecutor = {
|
|
74899
|
+
execute: async (request) => ecSqlQueryClient.queryRows(this._iModelProps, request),
|
|
74900
|
+
};
|
|
74901
|
+
const queryOptions = {
|
|
74902
|
+
limit: { count: options?.limit },
|
|
74903
|
+
rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.QueryRowFormat.UseECSqlPropertyNames,
|
|
74904
|
+
};
|
|
74905
|
+
const queryParameters = options && options.parameters ? _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.QueryBinder.from(options.parameters) : undefined;
|
|
74906
|
+
const queryReader = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ECSqlReader(queryExecutor, query, queryParameters, queryOptions);
|
|
74907
|
+
return queryReader.toArray();
|
|
74908
|
+
}
|
|
74909
|
+
/**
|
|
74910
|
+
* Gets the [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).
|
|
74911
|
+
* This is the full schema json with all elements that are defined in the schema.
|
|
74912
|
+
* @param schemaKey The schema key of the schema to be resolved.
|
|
74913
|
+
*/
|
|
74914
|
+
async getSchemaProps(schemaKey) {
|
|
74915
|
+
const rpcSchemaClient = _ECSchemaRpcInterface__WEBPACK_IMPORTED_MODULE_2__.ECSchemaRpcInterface.getClient();
|
|
74916
|
+
return rpcSchemaClient.getSchemaJSON(this._iModelProps, schemaKey.name);
|
|
74917
|
+
}
|
|
74918
|
+
;
|
|
74919
|
+
}
|
|
74920
|
+
|
|
74921
|
+
|
|
72275
74922
|
/***/ }),
|
|
72276
74923
|
|
|
72277
74924
|
/***/ "../../core/ecschema-rpc/common/lib/esm/ecschema-rpc-interface.js":
|
|
@@ -72284,10 +74931,12 @@ class ECSchemaRpcLocater {
|
|
|
72284
74931
|
__webpack_require__.r(__webpack_exports__);
|
|
72285
74932
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
72286
74933
|
/* harmony export */ ECSchemaRpcInterface: () => (/* reexport safe */ _ECSchemaRpcInterface__WEBPACK_IMPORTED_MODULE_0__.ECSchemaRpcInterface),
|
|
72287
|
-
/* harmony export */ ECSchemaRpcLocater: () => (/* reexport safe */ _ECSchemaRpcLocater__WEBPACK_IMPORTED_MODULE_1__.ECSchemaRpcLocater)
|
|
74934
|
+
/* harmony export */ ECSchemaRpcLocater: () => (/* reexport safe */ _ECSchemaRpcLocater__WEBPACK_IMPORTED_MODULE_1__.ECSchemaRpcLocater),
|
|
74935
|
+
/* harmony export */ RpcIncrementalSchemaLocater: () => (/* reexport safe */ _RpcIncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_2__.RpcIncrementalSchemaLocater)
|
|
72288
74936
|
/* harmony export */ });
|
|
72289
74937
|
/* harmony import */ var _ECSchemaRpcInterface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ECSchemaRpcInterface */ "../../core/ecschema-rpc/common/lib/esm/ECSchemaRpcInterface.js");
|
|
72290
74938
|
/* harmony import */ var _ECSchemaRpcLocater__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ECSchemaRpcLocater */ "../../core/ecschema-rpc/common/lib/esm/ECSchemaRpcLocater.js");
|
|
74939
|
+
/* harmony import */ var _RpcIncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./RpcIncrementalSchemaLocater */ "../../core/ecschema-rpc/common/lib/esm/RpcIncrementalSchemaLocater.js");
|
|
72291
74940
|
/*---------------------------------------------------------------------------------------------
|
|
72292
74941
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
72293
74942
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -72296,6 +74945,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
72296
74945
|
|
|
72297
74946
|
|
|
72298
74947
|
|
|
74948
|
+
|
|
72299
74949
|
/***/ }),
|
|
72300
74950
|
|
|
72301
74951
|
/***/ "../../core/frontend/lib/esm/AccuDraw.js":
|
|
@@ -298784,7 +301434,7 @@ class QuantityConstants {
|
|
|
298784
301434
|
return QuantityConstants._LOCALE_THOUSAND_SEPARATOR;
|
|
298785
301435
|
QuantityConstants._LOCALE_THOUSAND_SEPARATOR = ",";
|
|
298786
301436
|
const matches = (12345.6789).toLocaleString().match(/12(.*)345/);
|
|
298787
|
-
if (matches && matches.length >
|
|
301437
|
+
if (matches && matches.length > 1 && matches[1] !== "")
|
|
298788
301438
|
QuantityConstants._LOCALE_THOUSAND_SEPARATOR = matches[1];
|
|
298789
301439
|
return QuantityConstants._LOCALE_THOUSAND_SEPARATOR;
|
|
298790
301440
|
}
|
|
@@ -315117,7 +317767,7 @@ var loadLanguages = instance.loadLanguages;
|
|
|
315117
317767
|
/***/ ((module) => {
|
|
315118
317768
|
|
|
315119
317769
|
"use strict";
|
|
315120
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.1.0-dev.
|
|
317770
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.1.0-dev.60","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/eslint-plugin":"5.0.0-dev.1","@types/chai-as-promised":"^7","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.13.0","glob":"^10.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
|
|
315121
317771
|
|
|
315122
317772
|
/***/ })
|
|
315123
317773
|
|