@itwin/ecschema-rpcinterface-tests 5.10.0-dev.18 → 5.10.0-dev.20
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 +2100 -26
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +16 -16
|
@@ -75423,6 +75423,1931 @@ class SchemaPartVisitorDelegate {
|
|
|
75423
75423
|
}
|
|
75424
75424
|
|
|
75425
75425
|
|
|
75426
|
+
/***/ }),
|
|
75427
|
+
|
|
75428
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView.js":
|
|
75429
|
+
/*!**********************************************************!*\
|
|
75430
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaView.js ***!
|
|
75431
|
+
\**********************************************************/
|
|
75432
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
75433
|
+
|
|
75434
|
+
"use strict";
|
|
75435
|
+
__webpack_require__.r(__webpack_exports__);
|
|
75436
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
75437
|
+
/* harmony export */ SchemaView: () => (/* binding */ SchemaView),
|
|
75438
|
+
/* harmony export */ SchemaViewBuilder: () => (/* binding */ SchemaViewBuilder)
|
|
75439
|
+
/* harmony export */ });
|
|
75440
|
+
/* harmony import */ var _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SchemaViewInterfaces */ "../../core/ecschema-metadata/lib/esm/SchemaViewInterfaces.js");
|
|
75441
|
+
/* harmony import */ var _SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaViewBinaryReader */ "../../core/ecschema-metadata/lib/esm/SchemaViewBinaryReader.js");
|
|
75442
|
+
/*---------------------------------------------------------------------------------------------
|
|
75443
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
75444
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
75445
|
+
*--------------------------------------------------------------------------------------------*/
|
|
75446
|
+
/** @packageDocumentation
|
|
75447
|
+
* @module Schema
|
|
75448
|
+
*/
|
|
75449
|
+
|
|
75450
|
+
|
|
75451
|
+
// Module-local symbol used as the storage key on SchemaView instances. Mirrors the pattern in
|
|
75452
|
+
// core-backend/src/internal/Symbols.ts (e.g. `_nativeDb` on IModelDb): the data is reachable
|
|
75453
|
+
// only by code in this module, since the symbol is not exported and not registered globally.
|
|
75454
|
+
// The flyweight view classes (SchemaView.Schema, SchemaView.Class, etc.) live in the same file
|
|
75455
|
+
// and access the storage through this symbol.
|
|
75456
|
+
const _storage = Symbol("SchemaView.storage");
|
|
75457
|
+
/** Read-only schema metadata view. Optimized for fast lookup and low memory usage.
|
|
75458
|
+
*
|
|
75459
|
+
* All data is stored in flat arrays. View objects (`SchemaView.Schema`, `SchemaView.Class`, etc.) are
|
|
75460
|
+
* stateless wrappers that hold a reference to this view plus an index. They allocate nothing
|
|
75461
|
+
* and cache nothing.
|
|
75462
|
+
*
|
|
75463
|
+
* The view is immutable after construction. Build it via `SchemaViewBuilder` or parse
|
|
75464
|
+
* from a binary blob via `fromBinary`.
|
|
75465
|
+
* @beta
|
|
75466
|
+
*/
|
|
75467
|
+
class SchemaView {
|
|
75468
|
+
/** @internal */
|
|
75469
|
+
[_storage];
|
|
75470
|
+
_schemaToken;
|
|
75471
|
+
_outdated = false;
|
|
75472
|
+
/** @internal */
|
|
75473
|
+
constructor(data, schemaToken) {
|
|
75474
|
+
this[_storage] = {
|
|
75475
|
+
...data,
|
|
75476
|
+
transitiveBaseCache: new Map(),
|
|
75477
|
+
derivedClassMap: undefined,
|
|
75478
|
+
};
|
|
75479
|
+
this._schemaToken = schemaToken ?? "";
|
|
75480
|
+
}
|
|
75481
|
+
/** SHA3-256 content hash of the ec_ schema tables at the time this view was built.
|
|
75482
|
+
* Empty string if not set (e.g., when built from a builder without a token).
|
|
75483
|
+
* @beta
|
|
75484
|
+
*/
|
|
75485
|
+
get schemaToken() { return this._schemaToken; }
|
|
75486
|
+
/** True if the host (`IModelDb` / `IModelConnection`) has replaced this view with a newer one.
|
|
75487
|
+
* The view remains fully functional - it returns stale data rather than throwing.
|
|
75488
|
+
* Consumers who stored a reference can check this flag for diagnostics.
|
|
75489
|
+
* @beta
|
|
75490
|
+
*/
|
|
75491
|
+
get isOutdated() { return this._outdated; }
|
|
75492
|
+
/** Mark this view as outdated. Called by the host when a newer view replaces it.
|
|
75493
|
+
* @internal
|
|
75494
|
+
*/
|
|
75495
|
+
markOutdated() { this._outdated = true; }
|
|
75496
|
+
/** Number of schemas in the view. */
|
|
75497
|
+
get schemaCount() { return this[_storage].schemas.length; }
|
|
75498
|
+
/** Number of classes across all schemas. */
|
|
75499
|
+
get classCount() { return this[_storage].classes.length; }
|
|
75500
|
+
/** Get a schema by name (case-insensitive). */
|
|
75501
|
+
getSchema(name) {
|
|
75502
|
+
const idx = this[_storage].schemaByName.get(name.toLowerCase());
|
|
75503
|
+
return idx !== undefined ? new SchemaView.Schema(this, idx) : undefined;
|
|
75504
|
+
}
|
|
75505
|
+
/** Get a schema by alias (case-insensitive). */
|
|
75506
|
+
getSchemaByAlias(alias) {
|
|
75507
|
+
const idx = this[_storage].schemaByAlias.get(alias.toLowerCase());
|
|
75508
|
+
return idx !== undefined ? new SchemaView.Schema(this, idx) : undefined;
|
|
75509
|
+
}
|
|
75510
|
+
/** Iterate all schemas. */
|
|
75511
|
+
*getSchemas() {
|
|
75512
|
+
for (let i = 0; i < this[_storage].schemas.length; i++)
|
|
75513
|
+
yield new SchemaView.Schema(this, i);
|
|
75514
|
+
}
|
|
75515
|
+
/** Find a class by qualified name ("SchemaName:ClassName" or "SchemaName.ClassName").
|
|
75516
|
+
* The namespace part matches schema name first, then alias. Case-insensitive.
|
|
75517
|
+
*/
|
|
75518
|
+
findClass(qualifiedName) {
|
|
75519
|
+
const idx = this.resolveClassIdx(qualifiedName);
|
|
75520
|
+
return idx !== -1 ? SchemaView.createClass(this, idx) : undefined;
|
|
75521
|
+
}
|
|
75522
|
+
/** Find an enumeration by qualified name ("SchemaName:EnumName" or "SchemaName.EnumName").
|
|
75523
|
+
* The namespace part matches schema name first, then alias. Case-insensitive.
|
|
75524
|
+
*/
|
|
75525
|
+
findEnumeration(qualifiedName) {
|
|
75526
|
+
const idx = this._resolveSchemaItemIdx(qualifiedName, this[_storage].enumByName);
|
|
75527
|
+
return idx !== undefined ? new SchemaView.Enumeration(this, idx) : undefined;
|
|
75528
|
+
}
|
|
75529
|
+
/** Find a KindOfQuantity by qualified name ("SchemaName:KoqName" or "SchemaName.KoqName").
|
|
75530
|
+
* The namespace part matches schema name first, then alias. Case-insensitive.
|
|
75531
|
+
*/
|
|
75532
|
+
findKindOfQuantity(qualifiedName) {
|
|
75533
|
+
const idx = this._resolveSchemaItemIdx(qualifiedName, this[_storage].koqByName);
|
|
75534
|
+
return idx !== undefined ? new SchemaView.KindOfQuantity(this, idx) : undefined;
|
|
75535
|
+
}
|
|
75536
|
+
/** Find a PropertyCategory by qualified name ("SchemaName:CategoryName" or "SchemaName.CategoryName").
|
|
75537
|
+
* The namespace part matches schema name first, then alias. Case-insensitive.
|
|
75538
|
+
*/
|
|
75539
|
+
findPropertyCategory(qualifiedName) {
|
|
75540
|
+
const idx = this._resolveSchemaItemIdx(qualifiedName, this[_storage].catByName);
|
|
75541
|
+
return idx !== undefined ? new SchemaView.PropertyCategory(this, idx) : undefined;
|
|
75542
|
+
}
|
|
75543
|
+
/** Parse a binary blob into a SchemaView. Synchronous.
|
|
75544
|
+
* @param blob - The binary blob from `PRAGMA schema_view`.
|
|
75545
|
+
* @param schemaToken - Optional SHA3-256 content hash for cache invalidation.
|
|
75546
|
+
* @beta
|
|
75547
|
+
*/
|
|
75548
|
+
static fromBinary(blob, schemaToken) {
|
|
75549
|
+
return (0,_SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_1__.parseSchemaViewBlob)(blob, schemaToken);
|
|
75550
|
+
}
|
|
75551
|
+
/** Build from a pre-populated builder (used by the binary parser).
|
|
75552
|
+
* @internal
|
|
75553
|
+
*/
|
|
75554
|
+
static fromBuilder(builder, schemaToken) {
|
|
75555
|
+
return builder.build(schemaToken);
|
|
75556
|
+
}
|
|
75557
|
+
// --- Internal helpers used by view objects ---
|
|
75558
|
+
/** Resolve a qualified "SchemaName:ItemName" (or dot-separated) to an index using the given
|
|
75559
|
+
* per-schema name map. Returns undefined if not found. @internal */
|
|
75560
|
+
_resolveSchemaItemIdx(qualifiedName, itemByName) {
|
|
75561
|
+
const sep = qualifiedName.indexOf(":");
|
|
75562
|
+
const dotSep = sep === -1 ? qualifiedName.indexOf(".") : -1;
|
|
75563
|
+
const splitAt = sep !== -1 ? sep : dotSep;
|
|
75564
|
+
if (splitAt === -1)
|
|
75565
|
+
return undefined;
|
|
75566
|
+
const ns = qualifiedName.substring(0, splitAt).toLowerCase();
|
|
75567
|
+
const itemName = qualifiedName.substring(splitAt + 1).toLowerCase();
|
|
75568
|
+
let schemaIdx = this[_storage].schemaByName.get(ns);
|
|
75569
|
+
if (schemaIdx === undefined)
|
|
75570
|
+
schemaIdx = this[_storage].schemaByAlias.get(ns);
|
|
75571
|
+
if (schemaIdx === undefined)
|
|
75572
|
+
return undefined;
|
|
75573
|
+
return itemByName.get(schemaIdx)?.get(itemName);
|
|
75574
|
+
}
|
|
75575
|
+
/** @internal */
|
|
75576
|
+
resolveClassIdx(qualifiedName) {
|
|
75577
|
+
const sep = qualifiedName.indexOf(":");
|
|
75578
|
+
const dotSep = sep === -1 ? qualifiedName.indexOf(".") : -1;
|
|
75579
|
+
const splitAt = sep !== -1 ? sep : dotSep;
|
|
75580
|
+
if (splitAt === -1)
|
|
75581
|
+
return -1;
|
|
75582
|
+
const ns = qualifiedName.substring(0, splitAt).toLowerCase();
|
|
75583
|
+
const cn = qualifiedName.substring(splitAt + 1).toLowerCase();
|
|
75584
|
+
let schemaIdx = this[_storage].schemaByName.get(ns);
|
|
75585
|
+
if (schemaIdx === undefined)
|
|
75586
|
+
schemaIdx = this[_storage].schemaByAlias.get(ns);
|
|
75587
|
+
if (schemaIdx === undefined)
|
|
75588
|
+
return -1;
|
|
75589
|
+
const classMap = this[_storage].classByName.get(schemaIdx);
|
|
75590
|
+
const classIdx = classMap?.get(cn);
|
|
75591
|
+
return classIdx ?? -1;
|
|
75592
|
+
}
|
|
75593
|
+
/** @internal */
|
|
75594
|
+
getTransitiveBases(classIdx) {
|
|
75595
|
+
const cached = this[_storage].transitiveBaseCache.get(classIdx);
|
|
75596
|
+
if (cached !== undefined)
|
|
75597
|
+
return cached;
|
|
75598
|
+
const result = new Set();
|
|
75599
|
+
this._buildTransitiveBases(classIdx, result);
|
|
75600
|
+
this[_storage].transitiveBaseCache.set(classIdx, result);
|
|
75601
|
+
return result;
|
|
75602
|
+
}
|
|
75603
|
+
_buildTransitiveBases(classIdx, result) {
|
|
75604
|
+
const cls = this[_storage].classes[classIdx];
|
|
75605
|
+
if (cls === undefined)
|
|
75606
|
+
return; // safety: dangling index from excluded schema
|
|
75607
|
+
if (cls.baseClassIdx !== -1 && !result.has(cls.baseClassIdx)) {
|
|
75608
|
+
result.add(cls.baseClassIdx);
|
|
75609
|
+
this._buildTransitiveBases(cls.baseClassIdx, result);
|
|
75610
|
+
}
|
|
75611
|
+
for (let i = 0; i < cls.mixinCount; i++) {
|
|
75612
|
+
const mixinIdx = this[_storage].classMixins[cls.mixinStartIdx + i];
|
|
75613
|
+
if (mixinIdx === -1 || mixinIdx === undefined)
|
|
75614
|
+
continue; // safety: dangling mixin ref
|
|
75615
|
+
if (!result.has(mixinIdx)) {
|
|
75616
|
+
result.add(mixinIdx);
|
|
75617
|
+
this._buildTransitiveBases(mixinIdx, result);
|
|
75618
|
+
}
|
|
75619
|
+
}
|
|
75620
|
+
}
|
|
75621
|
+
/** @internal */
|
|
75622
|
+
resolveAllProperties(classIdx) {
|
|
75623
|
+
const cls = this[_storage].classes[classIdx];
|
|
75624
|
+
if (cls.type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.View) {
|
|
75625
|
+
// Views don't participate in property inheritance - own properties only
|
|
75626
|
+
const result = [];
|
|
75627
|
+
for (let i = 0; i < cls.ownPropCount; i++) {
|
|
75628
|
+
const ref = this[_storage].propertyRefs[cls.ownPropStart + i];
|
|
75629
|
+
result.push({ ref, classIdx: -1 });
|
|
75630
|
+
}
|
|
75631
|
+
return result;
|
|
75632
|
+
}
|
|
75633
|
+
const merged = new Map();
|
|
75634
|
+
this._collectProperties(classIdx, merged);
|
|
75635
|
+
return Array.from(merged.values());
|
|
75636
|
+
}
|
|
75637
|
+
_collectProperties(classIdx, merged) {
|
|
75638
|
+
const cls = this[_storage].classes[classIdx];
|
|
75639
|
+
if (cls === undefined)
|
|
75640
|
+
return; // safety: dangling index from excluded schema
|
|
75641
|
+
// 1. Base class (recursive, depth-first)
|
|
75642
|
+
if (cls.baseClassIdx !== -1)
|
|
75643
|
+
this._collectProperties(cls.baseClassIdx, merged);
|
|
75644
|
+
// 2. Mixins in declaration order
|
|
75645
|
+
for (let i = 0; i < cls.mixinCount; i++) {
|
|
75646
|
+
const mixinIdx = this[_storage].classMixins[cls.mixinStartIdx + i];
|
|
75647
|
+
if (mixinIdx === -1 || mixinIdx === undefined)
|
|
75648
|
+
continue; // safety: dangling mixin ref
|
|
75649
|
+
this._collectMixinProperties(mixinIdx, merged);
|
|
75650
|
+
}
|
|
75651
|
+
// 3. Own properties - always override
|
|
75652
|
+
for (let i = 0; i < cls.ownPropCount; i++) {
|
|
75653
|
+
const ref = this[_storage].propertyRefs[cls.ownPropStart + i];
|
|
75654
|
+
const nameKey = this[_storage].lowerStrings[this[_storage].propDefs[ref.defIdx].nameStringIdx];
|
|
75655
|
+
merged.set(nameKey, { ref, classIdx });
|
|
75656
|
+
}
|
|
75657
|
+
}
|
|
75658
|
+
_collectMixinProperties(mixinIdx, merged) {
|
|
75659
|
+
const mixin = this[_storage].classes[mixinIdx];
|
|
75660
|
+
if (mixin === undefined)
|
|
75661
|
+
return; // safety: dangling index from excluded schema
|
|
75662
|
+
// Walk mixin's own base chain (mixins can extend other mixins)
|
|
75663
|
+
if (mixin.baseClassIdx !== -1)
|
|
75664
|
+
this._collectMixinProperties(mixin.baseClassIdx, merged);
|
|
75665
|
+
// Mixin's own mixins
|
|
75666
|
+
for (let i = 0; i < mixin.mixinCount; i++) {
|
|
75667
|
+
const subMixinIdx = this[_storage].classMixins[mixin.mixinStartIdx + i];
|
|
75668
|
+
if (subMixinIdx === -1 || subMixinIdx === undefined)
|
|
75669
|
+
continue; // safety: dangling mixin ref
|
|
75670
|
+
this._collectMixinProperties(subMixinIdx, merged);
|
|
75671
|
+
}
|
|
75672
|
+
// Mixin's own properties - only set if not already present (first mixin wins)
|
|
75673
|
+
for (let i = 0; i < mixin.ownPropCount; i++) {
|
|
75674
|
+
const ref = this[_storage].propertyRefs[mixin.ownPropStart + i];
|
|
75675
|
+
const nameKey = this[_storage].lowerStrings[this[_storage].propDefs[ref.defIdx].nameStringIdx];
|
|
75676
|
+
if (!merged.has(nameKey))
|
|
75677
|
+
merged.set(nameKey, { ref, classIdx: mixinIdx });
|
|
75678
|
+
}
|
|
75679
|
+
}
|
|
75680
|
+
/** @internal */
|
|
75681
|
+
buildDerivedClassMap() {
|
|
75682
|
+
if (this[_storage].derivedClassMap !== undefined)
|
|
75683
|
+
return this[_storage].derivedClassMap;
|
|
75684
|
+
const map = new Map();
|
|
75685
|
+
for (let i = 0; i < this[_storage].classes.length; i++) {
|
|
75686
|
+
const baseIdx = this[_storage].classes[i].baseClassIdx;
|
|
75687
|
+
if (baseIdx !== -1) {
|
|
75688
|
+
let arr = map.get(baseIdx);
|
|
75689
|
+
if (arr === undefined) {
|
|
75690
|
+
arr = [];
|
|
75691
|
+
map.set(baseIdx, arr);
|
|
75692
|
+
}
|
|
75693
|
+
arr.push(i);
|
|
75694
|
+
}
|
|
75695
|
+
}
|
|
75696
|
+
this[_storage].derivedClassMap = map;
|
|
75697
|
+
return map;
|
|
75698
|
+
}
|
|
75699
|
+
}
|
|
75700
|
+
// =====================================================================================
|
|
75701
|
+
// SchemaView namespace - flyweight view types
|
|
75702
|
+
// =====================================================================================
|
|
75703
|
+
/** @beta */
|
|
75704
|
+
(function (SchemaView) {
|
|
75705
|
+
/** Lightweight view over a schema in a `SchemaView`. Holds only a view reference and
|
|
75706
|
+
* an index - no data duplication, no mutable state.
|
|
75707
|
+
* @beta
|
|
75708
|
+
*/
|
|
75709
|
+
class Schema {
|
|
75710
|
+
_ctx;
|
|
75711
|
+
idx;
|
|
75712
|
+
/** @internal */
|
|
75713
|
+
constructor(_ctx,
|
|
75714
|
+
/** @internal */ idx) {
|
|
75715
|
+
this._ctx = _ctx;
|
|
75716
|
+
this.idx = idx;
|
|
75717
|
+
}
|
|
75718
|
+
get _data() { return this._ctx[_storage].schemas[this.idx]; }
|
|
75719
|
+
/** Row ID from ec_Schema. Matches `ECInstanceId` in ECDbMeta views, e.g.
|
|
75720
|
+
* `SELECT * FROM meta.ECSchemaDef WHERE ECInstanceId = ?`.
|
|
75721
|
+
*
|
|
75722
|
+
* This is not an array index or internal handle - it is the database row ID from the ec_Schema
|
|
75723
|
+
* table, carried through the binary blob so consumers can fall back to ECSQL meta-queries for
|
|
75724
|
+
* data not included in the schema view (custom attributes, schema references, etc.).
|
|
75725
|
+
*/
|
|
75726
|
+
get ecInstanceId() { return this._data.ecInstanceId; }
|
|
75727
|
+
get name() { return this._ctx[_storage].strings[this._data.nameStringIdx]; }
|
|
75728
|
+
get alias() { return this._ctx[_storage].strings[this._data.aliasStringIdx]; }
|
|
75729
|
+
get label() {
|
|
75730
|
+
const sid = this._data.labelStringIdx;
|
|
75731
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : this.name;
|
|
75732
|
+
}
|
|
75733
|
+
get description() {
|
|
75734
|
+
const sid = this._data.descriptionStringIdx;
|
|
75735
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
75736
|
+
}
|
|
75737
|
+
get readVersion() { return this._data.versionRead; }
|
|
75738
|
+
get writeVersion() { return this._data.versionWrite; }
|
|
75739
|
+
get minorVersion() { return this._data.versionMinor; }
|
|
75740
|
+
/** Reflects the `HiddenSchema` custom attribute from `CoreCustomAttributes`.
|
|
75741
|
+
* Schemas marked hidden are typically excluded from UI display but remain accessible programmatically. */
|
|
75742
|
+
get isHidden() { return this._data.isHidden; }
|
|
75743
|
+
/** "SchemaName.RR.WW.mm" - dot-separated, matching the EC schema versioning convention. */
|
|
75744
|
+
get fullName() {
|
|
75745
|
+
const d = this._data;
|
|
75746
|
+
return `${this._ctx[_storage].strings[d.nameStringIdx]}.${String(d.versionRead).padStart(2, "0")}.${String(d.versionWrite).padStart(2, "0")}.${String(d.versionMinor).padStart(2, "0")}`;
|
|
75747
|
+
}
|
|
75748
|
+
/** Find a class by name within this schema (case-insensitive). */
|
|
75749
|
+
getClass(name) {
|
|
75750
|
+
const classMap = this._ctx[_storage].classByName.get(this.idx);
|
|
75751
|
+
const classIdx = classMap?.get(name.toLowerCase());
|
|
75752
|
+
return classIdx !== undefined ? createClass(this._ctx, classIdx) : undefined;
|
|
75753
|
+
}
|
|
75754
|
+
/** Iterate classes in this schema. Pass a `ClassType` to filter to a single kind
|
|
75755
|
+
* (e.g. `getClasses(ClassType.View)`). Omit the argument to iterate every class
|
|
75756
|
+
* regardless of type.
|
|
75757
|
+
*/
|
|
75758
|
+
*getClasses(filter) {
|
|
75759
|
+
const d = this._data;
|
|
75760
|
+
const classes = this._ctx[_storage].classes;
|
|
75761
|
+
for (let i = d.classRangeStart; i < d.classRangeStart + d.classCount; i++) {
|
|
75762
|
+
if (filter === undefined || classes[i].type === filter)
|
|
75763
|
+
yield createClass(this._ctx, i);
|
|
75764
|
+
}
|
|
75765
|
+
}
|
|
75766
|
+
/** Find an enumeration by name within this schema (case-insensitive). */
|
|
75767
|
+
getEnumeration(name) {
|
|
75768
|
+
const map = this._ctx[_storage].enumByName.get(this.idx);
|
|
75769
|
+
const idx = map?.get(name.toLowerCase());
|
|
75770
|
+
return idx !== undefined ? new Enumeration(this._ctx, idx) : undefined;
|
|
75771
|
+
}
|
|
75772
|
+
/** Find a KindOfQuantity by name within this schema (case-insensitive). */
|
|
75773
|
+
getKindOfQuantity(name) {
|
|
75774
|
+
const map = this._ctx[_storage].koqByName.get(this.idx);
|
|
75775
|
+
const idx = map?.get(name.toLowerCase());
|
|
75776
|
+
return idx !== undefined ? new KindOfQuantity(this._ctx, idx) : undefined;
|
|
75777
|
+
}
|
|
75778
|
+
/** Find a PropertyCategory by name within this schema (case-insensitive). */
|
|
75779
|
+
getPropertyCategory(name) {
|
|
75780
|
+
const map = this._ctx[_storage].catByName.get(this.idx);
|
|
75781
|
+
const idx = map?.get(name.toLowerCase());
|
|
75782
|
+
return idx !== undefined ? new PropertyCategory(this._ctx, idx) : undefined;
|
|
75783
|
+
}
|
|
75784
|
+
/** Iterate all enumerations in this schema. */
|
|
75785
|
+
*getEnumerations() {
|
|
75786
|
+
const d = this._data;
|
|
75787
|
+
for (let i = d.enumRangeStart; i < d.enumRangeStart + d.enumCount; i++)
|
|
75788
|
+
yield new Enumeration(this._ctx, i);
|
|
75789
|
+
}
|
|
75790
|
+
/** Iterate all KindOfQuantity items in this schema. */
|
|
75791
|
+
*getKindOfQuantities() {
|
|
75792
|
+
const d = this._data;
|
|
75793
|
+
for (let i = d.koqRangeStart; i < d.koqRangeStart + d.koqCount; i++)
|
|
75794
|
+
yield new KindOfQuantity(this._ctx, i);
|
|
75795
|
+
}
|
|
75796
|
+
/** Iterate all PropertyCategory items in this schema. */
|
|
75797
|
+
*getPropertyCategories() {
|
|
75798
|
+
const d = this._data;
|
|
75799
|
+
for (let i = d.catRangeStart; i < d.catRangeStart + d.catCount; i++)
|
|
75800
|
+
yield new PropertyCategory(this._ctx, i);
|
|
75801
|
+
}
|
|
75802
|
+
}
|
|
75803
|
+
SchemaView.Schema = Schema;
|
|
75804
|
+
/** Lightweight view over a class in a `SchemaView`. For relationship-specific
|
|
75805
|
+
* fields (strength, direction, source/target constraints), narrow via `isRelationship()`
|
|
75806
|
+
* or `assertRelationship()` to get a `SchemaView.RelationshipClass`.
|
|
75807
|
+
* @beta
|
|
75808
|
+
*/
|
|
75809
|
+
class Class {
|
|
75810
|
+
_ctx;
|
|
75811
|
+
idx;
|
|
75812
|
+
/** @internal */
|
|
75813
|
+
constructor(_ctx,
|
|
75814
|
+
/** @internal */ idx) {
|
|
75815
|
+
this._ctx = _ctx;
|
|
75816
|
+
this.idx = idx;
|
|
75817
|
+
}
|
|
75818
|
+
/** @internal */
|
|
75819
|
+
get _data() { return this._ctx[_storage].classes[this.idx]; }
|
|
75820
|
+
/** Row ID from ec_Class. Matches `ECInstanceId` in ECDbMeta views, e.g.
|
|
75821
|
+
* `SELECT * FROM meta.ECClassDef WHERE ECInstanceId = ?`.
|
|
75822
|
+
*/
|
|
75823
|
+
get ecInstanceId() { return this._data.ecInstanceId; }
|
|
75824
|
+
get name() { return this._ctx[_storage].strings[this._data.nameStringIdx]; }
|
|
75825
|
+
get label() {
|
|
75826
|
+
const sid = this._data.labelStringIdx;
|
|
75827
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : this.name;
|
|
75828
|
+
}
|
|
75829
|
+
get description() {
|
|
75830
|
+
const sid = this._data.descriptionStringIdx;
|
|
75831
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
75832
|
+
}
|
|
75833
|
+
/** "SchemaName:ClassName" - colon-separated, matching the EC class full name convention.
|
|
75834
|
+
* Use either ":" or "." as separator when passing to `findClass()`. */
|
|
75835
|
+
get fullName() {
|
|
75836
|
+
const d = this._data;
|
|
75837
|
+
return `${this._ctx[_storage].strings[this._ctx[_storage].schemas[d.schemaIdx].nameStringIdx]}:${this._ctx[_storage].strings[d.nameStringIdx]}`;
|
|
75838
|
+
}
|
|
75839
|
+
get schema() { return new Schema(this._ctx, this._data.schemaIdx); }
|
|
75840
|
+
get type() { return this._data.type; }
|
|
75841
|
+
get modifier() { return this._data.modifier; }
|
|
75842
|
+
// Type check methods
|
|
75843
|
+
// disabling lint rule for these because we explicitly want them to mirror same methods in ecschema-metadata, to make the APIs more compatible
|
|
75844
|
+
// eslint-disable-next-line @itwin/prefer-get
|
|
75845
|
+
isEntity() { return this._data.type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.Entity; }
|
|
75846
|
+
/** Type predicate - narrows to `SchemaView.RelationshipClass` for access to strength, direction,
|
|
75847
|
+
* source, and target constraint fields. */
|
|
75848
|
+
isRelationship() { return this._data.type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.Relationship; }
|
|
75849
|
+
// eslint-disable-next-line @itwin/prefer-get
|
|
75850
|
+
isStruct() { return this._data.type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.Struct; }
|
|
75851
|
+
// eslint-disable-next-line @itwin/prefer-get
|
|
75852
|
+
isMixin() { return this._data.type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.Mixin; }
|
|
75853
|
+
// eslint-disable-next-line @itwin/prefer-get
|
|
75854
|
+
isCustomAttribute() { return this._data.type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.CustomAttribute; }
|
|
75855
|
+
// eslint-disable-next-line @itwin/prefer-get
|
|
75856
|
+
isView() { return this._data.type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.View; }
|
|
75857
|
+
/** @see isRelationship */
|
|
75858
|
+
assertRelationship() {
|
|
75859
|
+
if (!this.isRelationship())
|
|
75860
|
+
throw new Error(`Expected a relationship class, got type ${this.type} for "${this.fullName}"`);
|
|
75861
|
+
}
|
|
75862
|
+
// Modifier checks
|
|
75863
|
+
get isAbstract() { return this._data.modifier === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassModifier.Abstract; }
|
|
75864
|
+
get isSealed() { return this._data.modifier === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassModifier.Sealed; }
|
|
75865
|
+
/** Reflects the `HiddenClass` custom attribute from `CoreCustomAttributes`.
|
|
75866
|
+
* Returns `true` when this class is directly hidden (via `HiddenClass(Show!=true)` or
|
|
75867
|
+
* schema-level `HiddenSchema(ShowClasses!=true)`). Does NOT consider base class inheritance -
|
|
75868
|
+
* use `isEffectivelyHidden` for that.
|
|
75869
|
+
*
|
|
75870
|
+
* Note: `false` means explicitly shown via `HiddenClass(Show=true)`. `undefined` means
|
|
75871
|
+
* no `HiddenClass` CA and the schema does not hide its classes. Both are "not hidden" for
|
|
75872
|
+
* this property, but `isEffectivelyHidden` distinguishes them when walking the hierarchy. */
|
|
75873
|
+
get isHidden() { return this._data.isHidden; }
|
|
75874
|
+
/** Computed hidden status that walks the base class chain (not mixins).
|
|
75875
|
+
*
|
|
75876
|
+
* Returns `true` if this class is hidden or any ancestor in the base class chain is hidden,
|
|
75877
|
+
* unless this class or an intermediate class explicitly breaks the chain with
|
|
75878
|
+
* `HiddenClass(Show=true)` (i.e. `isHidden === false`).
|
|
75879
|
+
*
|
|
75880
|
+
* Mixins are intentionally excluded - a hidden mixin represents a hidden capability,
|
|
75881
|
+
* not a hidden identity. */
|
|
75882
|
+
get isEffectivelyHidden() {
|
|
75883
|
+
let data = this._data;
|
|
75884
|
+
while (data !== undefined) {
|
|
75885
|
+
if (data.isHidden === false)
|
|
75886
|
+
return false; // explicit Show=true breaks the chain
|
|
75887
|
+
if (data.isHidden === true)
|
|
75888
|
+
return true;
|
|
75889
|
+
// undefined: walk to base class via internal array (avoids allocating Class objects)
|
|
75890
|
+
data = data.baseClassIdx !== -1 ? this._ctx[_storage].classes[data.baseClassIdx] : undefined;
|
|
75891
|
+
}
|
|
75892
|
+
return false;
|
|
75893
|
+
}
|
|
75894
|
+
// Hierarchy
|
|
75895
|
+
/** Single base class. undefined for root classes. */
|
|
75896
|
+
get baseClass() {
|
|
75897
|
+
const idx = this._data.baseClassIdx;
|
|
75898
|
+
return idx !== -1 ? createClass(this._ctx, idx) : undefined;
|
|
75899
|
+
}
|
|
75900
|
+
/** Applied mixins in declaration order. Only meaningful for entity classes. */
|
|
75901
|
+
get mixins() {
|
|
75902
|
+
const d = this._data;
|
|
75903
|
+
if (d.mixinCount === 0)
|
|
75904
|
+
return [];
|
|
75905
|
+
const result = [];
|
|
75906
|
+
for (let i = 0; i < d.mixinCount; i++) {
|
|
75907
|
+
const mixinIdx = this._ctx[_storage].classMixins[d.mixinStartIdx + i];
|
|
75908
|
+
if (mixinIdx === -1 || mixinIdx === undefined)
|
|
75909
|
+
continue; // safety: dangling mixin ref from excluded schema
|
|
75910
|
+
result.push(createClass(this._ctx, mixinIdx));
|
|
75911
|
+
}
|
|
75912
|
+
return result;
|
|
75913
|
+
}
|
|
75914
|
+
/** IS-A check. Returns true if this class is, or derives from, `other` (transitively, including mixins).
|
|
75915
|
+
* Accepts a `SchemaView.Class` or a qualified name string ("SchemaName:ClassName").
|
|
75916
|
+
*/
|
|
75917
|
+
is(classOrName) {
|
|
75918
|
+
let targetIdx;
|
|
75919
|
+
if (typeof classOrName === "string") {
|
|
75920
|
+
targetIdx = this._ctx.resolveClassIdx(classOrName);
|
|
75921
|
+
}
|
|
75922
|
+
else if (classOrName._ctx === this._ctx) {
|
|
75923
|
+
targetIdx = classOrName.idx;
|
|
75924
|
+
}
|
|
75925
|
+
else {
|
|
75926
|
+
// Cross-view input: indices are not comparable across SchemaView instances.
|
|
75927
|
+
// Resolve by qualified name against this view.
|
|
75928
|
+
targetIdx = this._ctx.resolveClassIdx(classOrName.fullName);
|
|
75929
|
+
}
|
|
75930
|
+
if (targetIdx === -1)
|
|
75931
|
+
return false;
|
|
75932
|
+
if (this.idx === targetIdx)
|
|
75933
|
+
return true;
|
|
75934
|
+
return this._ctx.getTransitiveBases(this.idx).has(targetIdx);
|
|
75935
|
+
}
|
|
75936
|
+
/** Direct derived classes. Expensive on first call (builds reverse map across all classes). */
|
|
75937
|
+
get derivedClasses() {
|
|
75938
|
+
const map = this._ctx.buildDerivedClassMap();
|
|
75939
|
+
const indices = map.get(this.idx);
|
|
75940
|
+
if (indices === undefined)
|
|
75941
|
+
return [];
|
|
75942
|
+
return indices.map((i) => createClass(this._ctx, i));
|
|
75943
|
+
}
|
|
75944
|
+
// Properties
|
|
75945
|
+
/** Find a property by name (case-insensitive). Searches own + inherited.
|
|
75946
|
+
*
|
|
75947
|
+
* Note: this resolves the full property list and linear-scans it on every call. For workloads
|
|
75948
|
+
* that hit `getProperty` repeatedly on the same class with different names, a per-class
|
|
75949
|
+
* resolved-property map cache could be added on the view. Not done now - measure before
|
|
75950
|
+
* optimizing. */
|
|
75951
|
+
getProperty(name) {
|
|
75952
|
+
const allProps = this._ctx.resolveAllProperties(this.idx);
|
|
75953
|
+
const lowerName = name.toLowerCase();
|
|
75954
|
+
for (const rp of allProps) {
|
|
75955
|
+
if (this._ctx[_storage].lowerStrings[this._ctx[_storage].propDefs[rp.ref.defIdx].nameStringIdx] === lowerName)
|
|
75956
|
+
return createProperty(this._ctx, rp.ref, rp.classIdx);
|
|
75957
|
+
}
|
|
75958
|
+
return undefined;
|
|
75959
|
+
}
|
|
75960
|
+
/** All properties including inherited, in inheritance order (base first, then mixins, then own). */
|
|
75961
|
+
getProperties() {
|
|
75962
|
+
const allRefs = this._ctx.resolveAllProperties(this.idx);
|
|
75963
|
+
return allRefs.map((rp) => createProperty(this._ctx, rp.ref, rp.classIdx));
|
|
75964
|
+
}
|
|
75965
|
+
/** Own properties only (not inherited), in ordinal order. */
|
|
75966
|
+
getOwnProperties() {
|
|
75967
|
+
const d = this._data;
|
|
75968
|
+
const result = [];
|
|
75969
|
+
for (let i = 0; i < d.ownPropCount; i++) {
|
|
75970
|
+
const ref = this._ctx[_storage].propertyRefs[d.ownPropStart + i];
|
|
75971
|
+
result.push(createProperty(this._ctx, ref, this.idx));
|
|
75972
|
+
}
|
|
75973
|
+
return result;
|
|
75974
|
+
}
|
|
75975
|
+
}
|
|
75976
|
+
SchemaView.Class = Class;
|
|
75977
|
+
/** A relationship class with constraint and strength metadata. Created by `createClass()`
|
|
75978
|
+
* when the underlying `ClassType` is `Relationship`. Use `cls.isRelationship()` to narrow a
|
|
75979
|
+
* `SchemaView.Class` to this type.
|
|
75980
|
+
* @beta
|
|
75981
|
+
*/
|
|
75982
|
+
class RelationshipClass extends Class {
|
|
75983
|
+
get strength() { return this._data.strength; }
|
|
75984
|
+
get strengthDirection() { return this._data.strengthDirection; }
|
|
75985
|
+
get source() {
|
|
75986
|
+
const idx = this._data.sourceConstraintIdx;
|
|
75987
|
+
return idx !== -1 ? new RelConstraint(this._ctx, idx) : undefined;
|
|
75988
|
+
}
|
|
75989
|
+
get target() {
|
|
75990
|
+
const idx = this._data.targetConstraintIdx;
|
|
75991
|
+
return idx !== -1 ? new RelConstraint(this._ctx, idx) : undefined;
|
|
75992
|
+
}
|
|
75993
|
+
}
|
|
75994
|
+
SchemaView.RelationshipClass = RelationshipClass;
|
|
75995
|
+
/** @internal */
|
|
75996
|
+
function createClass(ctx, idx) {
|
|
75997
|
+
if (ctx[_storage].classes[idx].type === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.ClassType.Relationship)
|
|
75998
|
+
return new RelationshipClass(ctx, idx);
|
|
75999
|
+
return new Class(ctx, idx);
|
|
76000
|
+
}
|
|
76001
|
+
SchemaView.createClass = createClass;
|
|
76002
|
+
/** Lightweight view over a property in a `SchemaView`. Subclasses provide
|
|
76003
|
+
* type-safe access to kind-specific fields. Use `isPrimitive()`, `isStruct()`,
|
|
76004
|
+
* `isArray()`, or `isNavigation()` to narrow, or the corresponding `assert*()` methods.
|
|
76005
|
+
* @beta
|
|
76006
|
+
*/
|
|
76007
|
+
class Property {
|
|
76008
|
+
_ctx;
|
|
76009
|
+
_ref;
|
|
76010
|
+
_classIdx;
|
|
76011
|
+
/** @internal */
|
|
76012
|
+
constructor(_ctx, _ref,
|
|
76013
|
+
/** Index of the class that declared or contributed this property through inheritance.
|
|
76014
|
+
* For own properties, this is the class itself. For inherited properties, this is the
|
|
76015
|
+
* base class or mixin that introduced it. -1 for view properties. */
|
|
76016
|
+
_classIdx) {
|
|
76017
|
+
this._ctx = _ctx;
|
|
76018
|
+
this._ref = _ref;
|
|
76019
|
+
this._classIdx = _classIdx;
|
|
76020
|
+
}
|
|
76021
|
+
/** @internal */
|
|
76022
|
+
get _def() { return this._ctx[_storage].propDefs[this._ref.defIdx]; }
|
|
76023
|
+
/** Row ID from ec_Property. Matches `ECInstanceId` in ECDbMeta views, e.g.
|
|
76024
|
+
* `SELECT * FROM meta.ECPropertyDef WHERE ECInstanceId = ?`.
|
|
76025
|
+
*
|
|
76026
|
+
* Stored per-reference (not per-definition) because each class-property pair has a unique
|
|
76027
|
+
* ec_Property row even when the structural definition is deduplicated.
|
|
76028
|
+
*/
|
|
76029
|
+
get ecInstanceId() { return this._ref.ecInstanceId; }
|
|
76030
|
+
get name() { return this._ctx[_storage].strings[this._def.nameStringIdx]; }
|
|
76031
|
+
/** Display label. Falls back to the property name if no explicit label is set.
|
|
76032
|
+
* Labels are stored per-reference (not per-definition) because EC allows class overrides. */
|
|
76033
|
+
get label() {
|
|
76034
|
+
const labelStringIdx = this._ref.labelStringIdx;
|
|
76035
|
+
return labelStringIdx !== 0 ? this._ctx[_storage].strings[labelStringIdx] : this.name;
|
|
76036
|
+
}
|
|
76037
|
+
get description() {
|
|
76038
|
+
const sid = this._def.descriptionStringIdx;
|
|
76039
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76040
|
+
}
|
|
76041
|
+
get kind() { return this._def.kind; }
|
|
76042
|
+
get isReadOnly() { return this._def.isReadOnly; }
|
|
76043
|
+
/** Reflects the `HiddenProperty` custom attribute from `CoreCustomAttributes`.
|
|
76044
|
+
* Properties marked hidden are typically excluded from UI display but remain accessible programmatically. */
|
|
76045
|
+
get isHidden() { return this._def.isHidden; }
|
|
76046
|
+
/** Display priority. Higher values should be displayed more prominently. 0 means default. */
|
|
76047
|
+
get priority() { return this._ref.priority; }
|
|
76048
|
+
/** The class that declared or contributed this property through inheritance.
|
|
76049
|
+
* For own properties, returns the class itself. For inherited properties, returns the
|
|
76050
|
+
* base class or mixin that introduced it. Returns `undefined` for view properties.
|
|
76051
|
+
* This is the class array index, not the ec_Class.Id from the database.
|
|
76052
|
+
* @beta
|
|
76053
|
+
*/
|
|
76054
|
+
get declaringClass() {
|
|
76055
|
+
return this._classIdx !== -1 ? createClass(this._ctx, this._classIdx) : undefined;
|
|
76056
|
+
}
|
|
76057
|
+
/** Property category, or undefined if none assigned. Available on all property kinds. */
|
|
76058
|
+
get category() {
|
|
76059
|
+
const idx = this._def.categoryIdx;
|
|
76060
|
+
return idx !== -1 ? new PropertyCategory(this._ctx, idx) : undefined;
|
|
76061
|
+
}
|
|
76062
|
+
// Type guards - real type predicates that narrow `this`
|
|
76063
|
+
/** True for `SchemaView.PrimitiveProperty` and `SchemaView.PrimitiveArrayProperty`.
|
|
76064
|
+
* Matches ecschema-metadata behavior where `isPrimitive()` includes primitive arrays. */
|
|
76065
|
+
isPrimitive() {
|
|
76066
|
+
return this._def.kind === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.Primitive || this._def.kind === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.PrimitiveArray;
|
|
76067
|
+
}
|
|
76068
|
+
/** True for `SchemaView.StructProperty` and `SchemaView.StructArrayProperty`. */
|
|
76069
|
+
isStruct() {
|
|
76070
|
+
return this._def.kind === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.Struct || this._def.kind === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.StructArray;
|
|
76071
|
+
}
|
|
76072
|
+
/** True for `SchemaView.PrimitiveArrayProperty` and `SchemaView.StructArrayProperty`. */
|
|
76073
|
+
isArray() {
|
|
76074
|
+
return this._def.kind === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.PrimitiveArray || this._def.kind === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.StructArray;
|
|
76075
|
+
}
|
|
76076
|
+
/** True for `SchemaView.NavigationProperty`. */
|
|
76077
|
+
isNavigation() {
|
|
76078
|
+
return this._def.kind === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.Navigation;
|
|
76079
|
+
}
|
|
76080
|
+
/** True if this property is backed by an enumeration. Enumerations are a facet of primitive
|
|
76081
|
+
* properties - an enum property IS a primitive property with an enum binding. Narrows to
|
|
76082
|
+
* `AnyPrimitiveProperty` so you can access `enumeration`, `primitiveType`, etc. */
|
|
76083
|
+
isEnumeration() {
|
|
76084
|
+
return this._def.enumIdx !== -1;
|
|
76085
|
+
}
|
|
76086
|
+
// Assert methods - throw on mismatch, narrow `this`
|
|
76087
|
+
/** @see isPrimitive */
|
|
76088
|
+
assertPrimitive() {
|
|
76089
|
+
if (!this.isPrimitive())
|
|
76090
|
+
throw new Error(`Expected a primitive property, got ${_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind[this.kind]}`);
|
|
76091
|
+
}
|
|
76092
|
+
/** @see isStruct */
|
|
76093
|
+
assertStruct() {
|
|
76094
|
+
if (!this.isStruct())
|
|
76095
|
+
throw new Error(`Expected a struct property, got ${_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind[this.kind]}`);
|
|
76096
|
+
}
|
|
76097
|
+
/** @see isArray */
|
|
76098
|
+
assertArray() {
|
|
76099
|
+
if (!this.isArray())
|
|
76100
|
+
throw new Error(`Expected an array property, got ${_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind[this.kind]}`);
|
|
76101
|
+
}
|
|
76102
|
+
/** @see isNavigation */
|
|
76103
|
+
assertNavigation() {
|
|
76104
|
+
if (!this.isNavigation())
|
|
76105
|
+
throw new Error(`Expected a navigation property, got ${_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind[this.kind]}`);
|
|
76106
|
+
}
|
|
76107
|
+
}
|
|
76108
|
+
SchemaView.Property = Property;
|
|
76109
|
+
/** A scalar primitive property. May optionally be backed by an enumeration -
|
|
76110
|
+
* check `isEnumeration()` or `enumeration`.
|
|
76111
|
+
* @beta
|
|
76112
|
+
*/
|
|
76113
|
+
class PrimitiveProperty extends Property {
|
|
76114
|
+
get primitiveType() { return this._def.primitiveType; }
|
|
76115
|
+
get extendedTypeName() {
|
|
76116
|
+
const sid = this._def.extTypeStringIdx;
|
|
76117
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : undefined;
|
|
76118
|
+
}
|
|
76119
|
+
get enumeration() {
|
|
76120
|
+
const idx = this._def.enumIdx;
|
|
76121
|
+
return idx !== -1 ? new Enumeration(this._ctx, idx) : undefined;
|
|
76122
|
+
}
|
|
76123
|
+
get kindOfQuantity() {
|
|
76124
|
+
const idx = this._def.koqIdx;
|
|
76125
|
+
return idx !== -1 ? new KindOfQuantity(this._ctx, idx) : undefined;
|
|
76126
|
+
}
|
|
76127
|
+
}
|
|
76128
|
+
SchemaView.PrimitiveProperty = PrimitiveProperty;
|
|
76129
|
+
/** An array of primitive values. Same primitive/enum fields as `PrimitiveProperty`,
|
|
76130
|
+
* plus array bounds.
|
|
76131
|
+
* @beta
|
|
76132
|
+
*/
|
|
76133
|
+
class PrimitiveArrayProperty extends Property {
|
|
76134
|
+
get primitiveType() { return this._def.primitiveType; }
|
|
76135
|
+
get extendedTypeName() {
|
|
76136
|
+
const sid = this._def.extTypeStringIdx;
|
|
76137
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : undefined;
|
|
76138
|
+
}
|
|
76139
|
+
get enumeration() {
|
|
76140
|
+
const idx = this._def.enumIdx;
|
|
76141
|
+
return idx !== -1 ? new Enumeration(this._ctx, idx) : undefined;
|
|
76142
|
+
}
|
|
76143
|
+
get kindOfQuantity() {
|
|
76144
|
+
const idx = this._def.koqIdx;
|
|
76145
|
+
return idx !== -1 ? new KindOfQuantity(this._ctx, idx) : undefined;
|
|
76146
|
+
}
|
|
76147
|
+
get arrayMinOccurs() { return this._def.arrayMinOccurs; }
|
|
76148
|
+
get arrayMaxOccurs() { return this._def.arrayMaxOccurs; }
|
|
76149
|
+
}
|
|
76150
|
+
SchemaView.PrimitiveArrayProperty = PrimitiveArrayProperty;
|
|
76151
|
+
/** A scalar struct property. `structClass` is non-nullable - the binary parser drops
|
|
76152
|
+
* properties whose struct class can't be resolved (e.g. from excluded schemas).
|
|
76153
|
+
* @beta
|
|
76154
|
+
*/
|
|
76155
|
+
class StructProperty extends Property {
|
|
76156
|
+
get structClass() {
|
|
76157
|
+
return createClass(this._ctx, this._def.structClassIdx);
|
|
76158
|
+
}
|
|
76159
|
+
}
|
|
76160
|
+
SchemaView.StructProperty = StructProperty;
|
|
76161
|
+
/** An array of struct values. Same struct field as `StructProperty`, plus array bounds.
|
|
76162
|
+
* @beta
|
|
76163
|
+
*/
|
|
76164
|
+
class StructArrayProperty extends Property {
|
|
76165
|
+
get structClass() {
|
|
76166
|
+
return createClass(this._ctx, this._def.structClassIdx);
|
|
76167
|
+
}
|
|
76168
|
+
get arrayMinOccurs() { return this._def.arrayMinOccurs; }
|
|
76169
|
+
get arrayMaxOccurs() { return this._def.arrayMaxOccurs; }
|
|
76170
|
+
}
|
|
76171
|
+
SchemaView.StructArrayProperty = StructArrayProperty;
|
|
76172
|
+
/** A navigation property. `relationshipClass` is non-nullable - the binary parser drops
|
|
76173
|
+
* properties whose relationship class can't be resolved.
|
|
76174
|
+
* @beta
|
|
76175
|
+
*/
|
|
76176
|
+
class NavigationProperty extends Property {
|
|
76177
|
+
get direction() { return this._def.navDirection; }
|
|
76178
|
+
get relationshipClass() {
|
|
76179
|
+
return createClass(this._ctx, this._def.navRelClassIdx);
|
|
76180
|
+
}
|
|
76181
|
+
}
|
|
76182
|
+
SchemaView.NavigationProperty = NavigationProperty;
|
|
76183
|
+
/** @internal */
|
|
76184
|
+
function createProperty(ctx, ref, classIdx) {
|
|
76185
|
+
const kind = ctx[_storage].propDefs[ref.defIdx].kind;
|
|
76186
|
+
switch (kind) {
|
|
76187
|
+
case _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.Primitive: return new PrimitiveProperty(ctx, ref, classIdx);
|
|
76188
|
+
case _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.PrimitiveArray: return new PrimitiveArrayProperty(ctx, ref, classIdx);
|
|
76189
|
+
case _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.Struct: return new StructProperty(ctx, ref, classIdx);
|
|
76190
|
+
case _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.StructArray: return new StructArrayProperty(ctx, ref, classIdx);
|
|
76191
|
+
case _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__.PropertyKind.Navigation: return new NavigationProperty(ctx, ref, classIdx);
|
|
76192
|
+
default: throw new Error(`Unknown PropertyKind ${kind} for property "${ctx[_storage].strings[ctx[_storage].propDefs[ref.defIdx].nameStringIdx]}"`);
|
|
76193
|
+
}
|
|
76194
|
+
}
|
|
76195
|
+
SchemaView.createProperty = createProperty;
|
|
76196
|
+
/** Lightweight view over an enumeration in a `SchemaView`.
|
|
76197
|
+
* @beta
|
|
76198
|
+
*/
|
|
76199
|
+
class Enumeration {
|
|
76200
|
+
_ctx;
|
|
76201
|
+
idx;
|
|
76202
|
+
/** @internal */
|
|
76203
|
+
constructor(_ctx,
|
|
76204
|
+
/** @internal */ idx) {
|
|
76205
|
+
this._ctx = _ctx;
|
|
76206
|
+
this.idx = idx;
|
|
76207
|
+
}
|
|
76208
|
+
get _data() { return this._ctx[_storage].enumerations[this.idx]; }
|
|
76209
|
+
/** Row ID from ec_Enumeration. Matches `ECInstanceId` in ECDbMeta views, e.g.
|
|
76210
|
+
* `SELECT * FROM meta.ECEnumerationDef WHERE ECInstanceId = ?`.
|
|
76211
|
+
*/
|
|
76212
|
+
get ecInstanceId() { return this._data.ecInstanceId; }
|
|
76213
|
+
get name() { return this._ctx[_storage].strings[this._data.nameStringIdx]; }
|
|
76214
|
+
get label() {
|
|
76215
|
+
const sid = this._data.labelStringIdx;
|
|
76216
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : this.name;
|
|
76217
|
+
}
|
|
76218
|
+
get description() {
|
|
76219
|
+
const sid = this._data.descriptionStringIdx;
|
|
76220
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76221
|
+
}
|
|
76222
|
+
/** "SchemaName:EnumName" - colon-separated. */
|
|
76223
|
+
get fullName() {
|
|
76224
|
+
const d = this._data;
|
|
76225
|
+
return `${this._ctx[_storage].strings[this._ctx[_storage].schemas[d.schemaIdx].nameStringIdx]}:${this._ctx[_storage].strings[d.nameStringIdx]}`;
|
|
76226
|
+
}
|
|
76227
|
+
get schema() { return new Schema(this._ctx, this._data.schemaIdx); }
|
|
76228
|
+
get primitiveType() { return this._data.primitiveType; }
|
|
76229
|
+
get isStrict() { return this._data.isStrict; }
|
|
76230
|
+
/** Iterate enumerators in declaration order. */
|
|
76231
|
+
*getEnumerators() {
|
|
76232
|
+
const d = this._data;
|
|
76233
|
+
for (let i = d.enumeratorStart; i < d.enumeratorStart + d.enumeratorCount; i++)
|
|
76234
|
+
yield new Enumerator(this._ctx, i);
|
|
76235
|
+
}
|
|
76236
|
+
/** Find enumerator by name (case-insensitive). */
|
|
76237
|
+
getEnumeratorByName(name) {
|
|
76238
|
+
const lower = name.toLowerCase();
|
|
76239
|
+
const d = this._data;
|
|
76240
|
+
for (let i = d.enumeratorStart; i < d.enumeratorStart + d.enumeratorCount; i++) {
|
|
76241
|
+
if (this._ctx[_storage].lowerStrings[this._ctx[_storage].enumerators[i].nameStringIdx] === lower)
|
|
76242
|
+
return new Enumerator(this._ctx, i);
|
|
76243
|
+
}
|
|
76244
|
+
return undefined;
|
|
76245
|
+
}
|
|
76246
|
+
/** Find enumerator by value. */
|
|
76247
|
+
getEnumerator(value) {
|
|
76248
|
+
const d = this._data;
|
|
76249
|
+
for (let i = d.enumeratorStart; i < d.enumeratorStart + d.enumeratorCount; i++) {
|
|
76250
|
+
if (this._ctx[_storage].enumerators[i].value === value)
|
|
76251
|
+
return new Enumerator(this._ctx, i);
|
|
76252
|
+
}
|
|
76253
|
+
return undefined;
|
|
76254
|
+
}
|
|
76255
|
+
}
|
|
76256
|
+
SchemaView.Enumeration = Enumeration;
|
|
76257
|
+
/** Thin view over an enumerator.
|
|
76258
|
+
* @beta
|
|
76259
|
+
*/
|
|
76260
|
+
class Enumerator {
|
|
76261
|
+
_ctx;
|
|
76262
|
+
idx;
|
|
76263
|
+
/** @internal */
|
|
76264
|
+
constructor(_ctx,
|
|
76265
|
+
/** @internal */ idx) {
|
|
76266
|
+
this._ctx = _ctx;
|
|
76267
|
+
this.idx = idx;
|
|
76268
|
+
}
|
|
76269
|
+
get _data() { return this._ctx[_storage].enumerators[this.idx]; }
|
|
76270
|
+
get name() { return this._ctx[_storage].strings[this._data.nameStringIdx]; }
|
|
76271
|
+
get label() {
|
|
76272
|
+
const sid = this._data.labelStringIdx;
|
|
76273
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : this.name;
|
|
76274
|
+
}
|
|
76275
|
+
get description() {
|
|
76276
|
+
const sid = this._data.descriptionStringIdx;
|
|
76277
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76278
|
+
}
|
|
76279
|
+
get value() { return this._data.value; }
|
|
76280
|
+
}
|
|
76281
|
+
SchemaView.Enumerator = Enumerator;
|
|
76282
|
+
/** Parse a single format override string into a `PresentationFormat`.
|
|
76283
|
+
* @internal
|
|
76284
|
+
*/
|
|
76285
|
+
function parseFormatString(formatString) {
|
|
76286
|
+
const nameMatch = /^([\w.:]+)/.exec(formatString);
|
|
76287
|
+
if (!nameMatch)
|
|
76288
|
+
return { name: formatString };
|
|
76289
|
+
const name = nameMatch[1];
|
|
76290
|
+
const precMatch = /\((\d+)\)/.exec(formatString);
|
|
76291
|
+
const precision = precMatch ? parseInt(precMatch[1], 10) : undefined;
|
|
76292
|
+
const bracketRgx = /\[([^\]]+)\]/g;
|
|
76293
|
+
const units = [];
|
|
76294
|
+
let m;
|
|
76295
|
+
while ((m = bracketRgx.exec(formatString)) !== null) {
|
|
76296
|
+
const pipeIdx = m[1].indexOf("|");
|
|
76297
|
+
units.push(pipeIdx < 0 ? [m[1], undefined] : [m[1].substring(0, pipeIdx), m[1].substring(pipeIdx + 1)]);
|
|
76298
|
+
}
|
|
76299
|
+
return { name, precision, unitAndLabels: units.length > 0 ? units : undefined };
|
|
76300
|
+
}
|
|
76301
|
+
SchemaView.parseFormatString = parseFormatString;
|
|
76302
|
+
/** Lightweight view over a KindOfQuantity in a `SchemaView`.
|
|
76303
|
+
* @beta
|
|
76304
|
+
*/
|
|
76305
|
+
class KindOfQuantity {
|
|
76306
|
+
_ctx;
|
|
76307
|
+
idx;
|
|
76308
|
+
/** @internal */
|
|
76309
|
+
constructor(_ctx,
|
|
76310
|
+
/** @internal */ idx) {
|
|
76311
|
+
this._ctx = _ctx;
|
|
76312
|
+
this.idx = idx;
|
|
76313
|
+
}
|
|
76314
|
+
get _data() { return this._ctx[_storage].koqs[this.idx]; }
|
|
76315
|
+
/** Row ID from ec_KindOfQuantity. Matches `ECInstanceId` in ECDbMeta views, e.g.
|
|
76316
|
+
* `SELECT * FROM meta.ECKindOfQuantityDef WHERE ECInstanceId = ?`.
|
|
76317
|
+
*/
|
|
76318
|
+
get ecInstanceId() { return this._data.ecInstanceId; }
|
|
76319
|
+
get name() { return this._ctx[_storage].strings[this._data.nameStringIdx]; }
|
|
76320
|
+
get label() {
|
|
76321
|
+
const sid = this._data.labelStringIdx;
|
|
76322
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : this.name;
|
|
76323
|
+
}
|
|
76324
|
+
get description() {
|
|
76325
|
+
const sid = this._data.descriptionStringIdx;
|
|
76326
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76327
|
+
}
|
|
76328
|
+
/** "SchemaName:KoqName" - colon-separated. */
|
|
76329
|
+
get fullName() {
|
|
76330
|
+
const d = this._data;
|
|
76331
|
+
return `${this._ctx[_storage].strings[this._ctx[_storage].schemas[d.schemaIdx].nameStringIdx]}:${this._ctx[_storage].strings[d.nameStringIdx]}`;
|
|
76332
|
+
}
|
|
76333
|
+
get schema() { return new Schema(this._ctx, this._data.schemaIdx); }
|
|
76334
|
+
get relativeError() { return this._data.relativeError; }
|
|
76335
|
+
/** Persistence unit as a full name string, e.g. "Units:M".
|
|
76336
|
+
*
|
|
76337
|
+
* On iModels still on ECDb profile `4.0.0.1` (predates the 2018 EC3.2 Units/Formats migration)
|
|
76338
|
+
* this string is in legacy FUS format rather than the EC3.2 alias-qualified form.
|
|
76339
|
+
* Upgrade the iModel's ECDb profile to get EC3.2 strings.
|
|
76340
|
+
*/
|
|
76341
|
+
get persistenceUnit() {
|
|
76342
|
+
const sid = this._data.persistenceUnitStringIdx;
|
|
76343
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76344
|
+
}
|
|
76345
|
+
// EC XML serializes this as "presentationUnits"; we use "presentationFormats" to align with KindOfQuantity.presentationFormats in ecschema-metadata.
|
|
76346
|
+
/** Raw presentation format string as stored in ECDb (`ec_KindOfQuantity.PresentationUnits`).
|
|
76347
|
+
* This is a JSON array of format override strings. Empty string if none are defined.
|
|
76348
|
+
* Prefer `presentationFormats` for structured access.
|
|
76349
|
+
*
|
|
76350
|
+
* On iModels still on ECDb profile `4.0.0.1` (predates the 2018 EC3.2 Units/Formats migration)
|
|
76351
|
+
* the strings are in legacy FUS format and will not parse via `presentationFormats`.
|
|
76352
|
+
* Upgrade the iModel's ECDb profile to get EC3.2 strings.
|
|
76353
|
+
*/
|
|
76354
|
+
get presentationFormatsRaw() {
|
|
76355
|
+
const sid = this._data.presentationFormatsStringIdx;
|
|
76356
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76357
|
+
}
|
|
76358
|
+
/** Presentation formats parsed into structured overrides. Each entry has the format name
|
|
76359
|
+
* (alias-qualified, e.g. `"f:DefaultRealU"`), optional precision override, and optional
|
|
76360
|
+
* unit-and-label overrides. Returns an empty array if no presentation formats are defined.
|
|
76361
|
+
*
|
|
76362
|
+
* Example - given a raw string of `["f:DefaultRealU(4)[u:M_PER_SEC_SQ]","f:DefaultRealU(4)[u:CM_PER_SEC_SQ]"]`:
|
|
76363
|
+
* ```ts
|
|
76364
|
+
* // [
|
|
76365
|
+
* // { name: "f:DefaultRealU", precision: 4, unitAndLabels: [["u:M_PER_SEC_SQ", undefined]] },
|
|
76366
|
+
* // { name: "f:DefaultRealU", precision: 4, unitAndLabels: [["u:CM_PER_SEC_SQ", undefined]] },
|
|
76367
|
+
* // ]
|
|
76368
|
+
* ```
|
|
76369
|
+
*/
|
|
76370
|
+
get presentationFormats() {
|
|
76371
|
+
const raw = this.presentationFormatsRaw;
|
|
76372
|
+
if (raw === "")
|
|
76373
|
+
return [];
|
|
76374
|
+
const formats = JSON.parse(raw);
|
|
76375
|
+
return formats.map((f) => parseFormatString(f));
|
|
76376
|
+
}
|
|
76377
|
+
}
|
|
76378
|
+
SchemaView.KindOfQuantity = KindOfQuantity;
|
|
76379
|
+
/** Lightweight view over a PropertyCategory in a `SchemaView`.
|
|
76380
|
+
* @beta
|
|
76381
|
+
*/
|
|
76382
|
+
class PropertyCategory {
|
|
76383
|
+
_ctx;
|
|
76384
|
+
idx;
|
|
76385
|
+
/** @internal */
|
|
76386
|
+
constructor(_ctx,
|
|
76387
|
+
/** @internal */ idx) {
|
|
76388
|
+
this._ctx = _ctx;
|
|
76389
|
+
this.idx = idx;
|
|
76390
|
+
}
|
|
76391
|
+
get _data() { return this._ctx[_storage].propCategories[this.idx]; }
|
|
76392
|
+
/** Row ID from ec_PropertyCategory. Matches `ECInstanceId` in ECDbMeta views, e.g.
|
|
76393
|
+
* `SELECT * FROM meta.ECPropertyCategoryDef WHERE ECInstanceId = ?`.
|
|
76394
|
+
*/
|
|
76395
|
+
get ecInstanceId() { return this._data.ecInstanceId; }
|
|
76396
|
+
get name() { return this._ctx[_storage].strings[this._data.nameStringIdx]; }
|
|
76397
|
+
get label() {
|
|
76398
|
+
const sid = this._data.labelStringIdx;
|
|
76399
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : this.name;
|
|
76400
|
+
}
|
|
76401
|
+
get description() {
|
|
76402
|
+
const sid = this._data.descriptionStringIdx;
|
|
76403
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76404
|
+
}
|
|
76405
|
+
/** "SchemaName:CategoryName" - colon-separated. */
|
|
76406
|
+
get fullName() {
|
|
76407
|
+
const d = this._data;
|
|
76408
|
+
return `${this._ctx[_storage].strings[this._ctx[_storage].schemas[d.schemaIdx].nameStringIdx]}:${this._ctx[_storage].strings[d.nameStringIdx]}`;
|
|
76409
|
+
}
|
|
76410
|
+
get schema() { return new Schema(this._ctx, this._data.schemaIdx); }
|
|
76411
|
+
get priority() { return this._data.priority; }
|
|
76412
|
+
}
|
|
76413
|
+
SchemaView.PropertyCategory = PropertyCategory;
|
|
76414
|
+
/** Lightweight view over a relationship constraint in a `SchemaView`.
|
|
76415
|
+
* @beta
|
|
76416
|
+
*/
|
|
76417
|
+
class RelConstraint {
|
|
76418
|
+
_ctx;
|
|
76419
|
+
_idx;
|
|
76420
|
+
/** @internal */
|
|
76421
|
+
constructor(_ctx, _idx) {
|
|
76422
|
+
this._ctx = _ctx;
|
|
76423
|
+
this._idx = _idx;
|
|
76424
|
+
}
|
|
76425
|
+
get _data() { return this._ctx[_storage].relConstraints[this._idx]; }
|
|
76426
|
+
get abstractConstraint() {
|
|
76427
|
+
const idx = this._data.abstractConstraintIdx;
|
|
76428
|
+
return idx !== -1 ? createClass(this._ctx, idx) : undefined;
|
|
76429
|
+
}
|
|
76430
|
+
get polymorphic() { return this._data.polymorphic; }
|
|
76431
|
+
/** Multiplicity lower bound (0 = unbounded). */
|
|
76432
|
+
get multiplicityLower() { return this._data.multiplicityLower; }
|
|
76433
|
+
/** Multiplicity upper bound (0 = unbounded). */
|
|
76434
|
+
get multiplicityUpper() { return this._data.multiplicityUpper; }
|
|
76435
|
+
/** Role label string, or empty if not set. */
|
|
76436
|
+
get roleLabel() {
|
|
76437
|
+
const sid = this._data.roleLabelStringIdx;
|
|
76438
|
+
return sid !== 0 ? this._ctx[_storage].strings[sid] : "";
|
|
76439
|
+
}
|
|
76440
|
+
get constraintClasses() {
|
|
76441
|
+
const d = this._data;
|
|
76442
|
+
const result = [];
|
|
76443
|
+
for (let i = 0; i < d.classRefCount; i++)
|
|
76444
|
+
result.push(createClass(this._ctx, this._ctx[_storage].constraintClassRefs[d.classRefStart + i]));
|
|
76445
|
+
return result;
|
|
76446
|
+
}
|
|
76447
|
+
}
|
|
76448
|
+
SchemaView.RelConstraint = RelConstraint;
|
|
76449
|
+
})(SchemaView || (SchemaView = {}));
|
|
76450
|
+
// =====================================================================================
|
|
76451
|
+
// SchemaViewBuilder
|
|
76452
|
+
// =====================================================================================
|
|
76453
|
+
/** Builder for constructing an immutable `SchemaView`.
|
|
76454
|
+
*
|
|
76455
|
+
* Collects data during binary blob parsing, then freezes it into a view.
|
|
76456
|
+
* Handles string interning and property definition deduplication.
|
|
76457
|
+
*
|
|
76458
|
+
* Consumers should not use this directly - read views via `IModelDb.getSchemaView`
|
|
76459
|
+
* / `IModelConnection.getSchemaView` (or `SchemaView.fromBinary` if you have a raw blob).
|
|
76460
|
+
* @internal
|
|
76461
|
+
*/
|
|
76462
|
+
class SchemaViewBuilder {
|
|
76463
|
+
_strings = [""]; // SID 0 = empty string
|
|
76464
|
+
_lowerStrings = [""];
|
|
76465
|
+
_stringMap = new Map(); // original value -> SID
|
|
76466
|
+
_schemas = [];
|
|
76467
|
+
_classes = [];
|
|
76468
|
+
_classMixins = [];
|
|
76469
|
+
_propDefs = [];
|
|
76470
|
+
_propertyRefs = [];
|
|
76471
|
+
_relConstraints = [];
|
|
76472
|
+
_constraintClassRefs = [];
|
|
76473
|
+
_enumerations = [];
|
|
76474
|
+
_enumerators = [];
|
|
76475
|
+
_koqs = [];
|
|
76476
|
+
_propCategories = [];
|
|
76477
|
+
// For PropertyDef dedup
|
|
76478
|
+
_propDefMap = new Map(); // signature string -> defIdx
|
|
76479
|
+
/** Intern a string, returning its SID. Empty/undefined strings return 0.
|
|
76480
|
+
* Interning is case-sensitive - "MyLabel" and "MYLABEL" get distinct SIDs.
|
|
76481
|
+
* The `lowerStrings` array provides case-insensitive lookup without mutating display values.
|
|
76482
|
+
*/
|
|
76483
|
+
internString(value) {
|
|
76484
|
+
if (value === undefined || value === "")
|
|
76485
|
+
return 0;
|
|
76486
|
+
const existing = this._stringMap.get(value);
|
|
76487
|
+
if (existing !== undefined)
|
|
76488
|
+
return existing;
|
|
76489
|
+
const sid = this._strings.length;
|
|
76490
|
+
this._strings.push(value);
|
|
76491
|
+
this._lowerStrings.push(value.toLowerCase());
|
|
76492
|
+
this._stringMap.set(value, sid);
|
|
76493
|
+
return sid;
|
|
76494
|
+
}
|
|
76495
|
+
/** Add a schema. Returns its index. */
|
|
76496
|
+
addSchema(data) {
|
|
76497
|
+
const idx = this._schemas.length;
|
|
76498
|
+
this._schemas.push(data);
|
|
76499
|
+
return idx;
|
|
76500
|
+
}
|
|
76501
|
+
/** Add a class. Returns its index. Must be called after the owning schema. */
|
|
76502
|
+
addClass(data) {
|
|
76503
|
+
const idx = this._classes.length;
|
|
76504
|
+
this._classes.push(data);
|
|
76505
|
+
return idx;
|
|
76506
|
+
}
|
|
76507
|
+
/** Add a property definition with deduplication. Returns the def index (possibly existing). */
|
|
76508
|
+
addPropertyDef(data) {
|
|
76509
|
+
const sig = this._propDefSignature(data);
|
|
76510
|
+
const existing = this._propDefMap.get(sig);
|
|
76511
|
+
if (existing !== undefined)
|
|
76512
|
+
return existing;
|
|
76513
|
+
const idx = this._propDefs.length;
|
|
76514
|
+
this._propDefs.push(data);
|
|
76515
|
+
this._propDefMap.set(sig, idx);
|
|
76516
|
+
return idx;
|
|
76517
|
+
}
|
|
76518
|
+
/** Append a property reference to the flat refs array. */
|
|
76519
|
+
addPropertyRef(ref) {
|
|
76520
|
+
this._propertyRefs.push(ref);
|
|
76521
|
+
}
|
|
76522
|
+
/** Add an enumeration. Returns its index. */
|
|
76523
|
+
addEnumeration(data) {
|
|
76524
|
+
const idx = this._enumerations.length;
|
|
76525
|
+
this._enumerations.push(data);
|
|
76526
|
+
return idx;
|
|
76527
|
+
}
|
|
76528
|
+
/** Append an enumerator to the flat enumerators array. */
|
|
76529
|
+
addEnumerator(data) {
|
|
76530
|
+
this._enumerators.push(data);
|
|
76531
|
+
}
|
|
76532
|
+
/** Add a KindOfQuantity. Returns its index. */
|
|
76533
|
+
addKoq(data) {
|
|
76534
|
+
const idx = this._koqs.length;
|
|
76535
|
+
this._koqs.push(data);
|
|
76536
|
+
return idx;
|
|
76537
|
+
}
|
|
76538
|
+
/** Add a PropertyCategory. Returns its index. */
|
|
76539
|
+
addPropertyCategory(data) {
|
|
76540
|
+
const idx = this._propCategories.length;
|
|
76541
|
+
this._propCategories.push(data);
|
|
76542
|
+
return idx;
|
|
76543
|
+
}
|
|
76544
|
+
/** Add a relationship constraint. Returns its index. */
|
|
76545
|
+
addRelConstraint(data) {
|
|
76546
|
+
const idx = this._relConstraints.length;
|
|
76547
|
+
this._relConstraints.push(data);
|
|
76548
|
+
return idx;
|
|
76549
|
+
}
|
|
76550
|
+
/** Append a constraint class reference to the flat array. */
|
|
76551
|
+
addConstraintClassRef(classIdx) {
|
|
76552
|
+
this._constraintClassRefs.push(classIdx);
|
|
76553
|
+
}
|
|
76554
|
+
/** Append a mixin class reference to the flat array. */
|
|
76555
|
+
addClassMixin(classIdx) {
|
|
76556
|
+
this._classMixins.push(classIdx);
|
|
76557
|
+
}
|
|
76558
|
+
/** The current count of property refs (used to set ownPropStart on ClassData). */
|
|
76559
|
+
get propertyRefCount() { return this._propertyRefs.length; }
|
|
76560
|
+
/** The current count of enumerators (used to set enumeratorStart on EnumerationData). */
|
|
76561
|
+
get enumeratorCount() { return this._enumerators.length; }
|
|
76562
|
+
/** The current count of constraint class refs (used to set classRefStart). */
|
|
76563
|
+
get constraintClassRefCount() { return this._constraintClassRefs.length; }
|
|
76564
|
+
/** The current count of class mixins (used to set mixinStartIdx). */
|
|
76565
|
+
get classMixinCount() { return this._classMixins.length; }
|
|
76566
|
+
/** Get a string by SID. @internal */
|
|
76567
|
+
getString(sid) { return this._strings[sid]; }
|
|
76568
|
+
/** Replace class data at the given index (used during deferred cross-ref resolution). @internal */
|
|
76569
|
+
updateClass(classIdx, data) { this._classes[classIdx] = data; }
|
|
76570
|
+
/** Update range fields on a schema (used after all items for a schema are collected). @internal */
|
|
76571
|
+
updateSchemaRanges(schemaIdx, ranges) {
|
|
76572
|
+
const s = this._schemas[schemaIdx];
|
|
76573
|
+
this._schemas[schemaIdx] = { ...s, ...ranges };
|
|
76574
|
+
}
|
|
76575
|
+
/** Freeze all data and produce an immutable SchemaView. */
|
|
76576
|
+
build(schemaToken) {
|
|
76577
|
+
const schemaByName = new Map();
|
|
76578
|
+
const schemaByAlias = new Map();
|
|
76579
|
+
const classByName = new Map();
|
|
76580
|
+
const enumByName = new Map();
|
|
76581
|
+
const koqByName = new Map();
|
|
76582
|
+
const catByName = new Map();
|
|
76583
|
+
// Build schema lookup maps
|
|
76584
|
+
for (let i = 0; i < this._schemas.length; i++) {
|
|
76585
|
+
const s = this._schemas[i];
|
|
76586
|
+
schemaByName.set(this._lowerStrings[s.nameStringIdx], i);
|
|
76587
|
+
if (s.aliasStringIdx !== 0)
|
|
76588
|
+
schemaByAlias.set(this._lowerStrings[s.aliasStringIdx], i);
|
|
76589
|
+
// Build class-by-name map for this schema
|
|
76590
|
+
const classMap = new Map();
|
|
76591
|
+
for (let c = s.classRangeStart; c < s.classRangeStart + s.classCount; c++)
|
|
76592
|
+
classMap.set(this._lowerStrings[this._classes[c].nameStringIdx], c);
|
|
76593
|
+
classByName.set(i, classMap);
|
|
76594
|
+
// Build enum-by-name map for this schema
|
|
76595
|
+
const eMap = new Map();
|
|
76596
|
+
for (let e = s.enumRangeStart; e < s.enumRangeStart + s.enumCount; e++)
|
|
76597
|
+
eMap.set(this._lowerStrings[this._enumerations[e].nameStringIdx], e);
|
|
76598
|
+
enumByName.set(i, eMap);
|
|
76599
|
+
// Build koq-by-name map for this schema
|
|
76600
|
+
const kMap = new Map();
|
|
76601
|
+
for (let k = s.koqRangeStart; k < s.koqRangeStart + s.koqCount; k++)
|
|
76602
|
+
kMap.set(this._lowerStrings[this._koqs[k].nameStringIdx], k);
|
|
76603
|
+
koqByName.set(i, kMap);
|
|
76604
|
+
// Build category-by-name map for this schema
|
|
76605
|
+
const cMap = new Map();
|
|
76606
|
+
for (let p = s.catRangeStart; p < s.catRangeStart + s.catCount; p++)
|
|
76607
|
+
cMap.set(this._lowerStrings[this._propCategories[p].nameStringIdx], p);
|
|
76608
|
+
catByName.set(i, cMap);
|
|
76609
|
+
}
|
|
76610
|
+
return new SchemaView({
|
|
76611
|
+
strings: this._strings,
|
|
76612
|
+
lowerStrings: this._lowerStrings,
|
|
76613
|
+
schemas: this._schemas,
|
|
76614
|
+
classes: this._classes,
|
|
76615
|
+
classMixins: this._classMixins,
|
|
76616
|
+
propDefs: this._propDefs,
|
|
76617
|
+
propertyRefs: this._propertyRefs,
|
|
76618
|
+
relConstraints: this._relConstraints,
|
|
76619
|
+
constraintClassRefs: this._constraintClassRefs,
|
|
76620
|
+
enumerations: this._enumerations,
|
|
76621
|
+
enumerators: this._enumerators,
|
|
76622
|
+
koqs: this._koqs,
|
|
76623
|
+
propCategories: this._propCategories,
|
|
76624
|
+
schemaByName,
|
|
76625
|
+
schemaByAlias,
|
|
76626
|
+
classByName,
|
|
76627
|
+
enumByName,
|
|
76628
|
+
koqByName,
|
|
76629
|
+
catByName,
|
|
76630
|
+
}, schemaToken);
|
|
76631
|
+
}
|
|
76632
|
+
/** Produce a dedup signature for a PropertyDef. Label and priority are excluded because
|
|
76633
|
+
* they are per-PropertyRef overrides, not part of the structural definition.
|
|
76634
|
+
* Uses SIDs (not lowercase strings) for name/description so that case-preserving names
|
|
76635
|
+
* stay distinct - matching the C++ writer's dedup behavior. */
|
|
76636
|
+
_propDefSignature(def) {
|
|
76637
|
+
return `${def.nameStringIdx}|${def.kind}|${def.primitiveType}|${def.extTypeStringIdx}|${def.enumIdx}|${def.koqIdx}|${def.structClassIdx}|${def.navRelClassIdx}|${def.navDirection}|${def.categoryIdx}|${def.isReadOnly ? 1 : 0}|${def.isHidden ? 1 : 0}|${def.arrayMinOccurs}|${def.arrayMaxOccurs}|${def.descriptionStringIdx}`;
|
|
76638
|
+
}
|
|
76639
|
+
}
|
|
76640
|
+
|
|
76641
|
+
|
|
76642
|
+
/***/ }),
|
|
76643
|
+
|
|
76644
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaViewBinaryReader.js":
|
|
76645
|
+
/*!**********************************************************************!*\
|
|
76646
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaViewBinaryReader.js ***!
|
|
76647
|
+
\**********************************************************************/
|
|
76648
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
76649
|
+
|
|
76650
|
+
"use strict";
|
|
76651
|
+
__webpack_require__.r(__webpack_exports__);
|
|
76652
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
76653
|
+
/* harmony export */ parseSchemaViewBlob: () => (/* binding */ parseSchemaViewBlob)
|
|
76654
|
+
/* harmony export */ });
|
|
76655
|
+
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
76656
|
+
/* harmony import */ var _SchemaView__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaView */ "../../core/ecschema-metadata/lib/esm/SchemaView.js");
|
|
76657
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
76658
|
+
/* harmony import */ var _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SchemaViewInterfaces */ "../../core/ecschema-metadata/lib/esm/SchemaViewInterfaces.js");
|
|
76659
|
+
/*---------------------------------------------------------------------------------------------
|
|
76660
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
76661
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
76662
|
+
*--------------------------------------------------------------------------------------------*/
|
|
76663
|
+
/** @packageDocumentation
|
|
76664
|
+
* @module Schema
|
|
76665
|
+
*/
|
|
76666
|
+
|
|
76667
|
+
|
|
76668
|
+
|
|
76669
|
+
|
|
76670
|
+
/** Binary record tags for the SchemaView blob format.
|
|
76671
|
+
* Each tag marks a flat, count-prefixed table. Must stay in sync with the C++ writer. */
|
|
76672
|
+
var Tag;
|
|
76673
|
+
(function (Tag) {
|
|
76674
|
+
Tag[Tag["PropertyDefTable"] = 10] = "PropertyDefTable";
|
|
76675
|
+
Tag[Tag["SchemaTable"] = 16] = "SchemaTable";
|
|
76676
|
+
Tag[Tag["EnumTable"] = 32] = "EnumTable";
|
|
76677
|
+
Tag[Tag["KoQTable"] = 48] = "KoQTable";
|
|
76678
|
+
Tag[Tag["PropCatTable"] = 49] = "PropCatTable";
|
|
76679
|
+
Tag[Tag["ClassTable"] = 64] = "ClassTable";
|
|
76680
|
+
})(Tag || (Tag = {}));
|
|
76681
|
+
const MAGIC = 0x43534348; // "CSCH"
|
|
76682
|
+
/** Low-level binary reader for the SchemaView blob. */
|
|
76683
|
+
class BinaryReader {
|
|
76684
|
+
_view;
|
|
76685
|
+
_bytes;
|
|
76686
|
+
_pos;
|
|
76687
|
+
_strings;
|
|
76688
|
+
constructor(data) {
|
|
76689
|
+
this._bytes = data;
|
|
76690
|
+
this._view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
76691
|
+
this._pos = 0;
|
|
76692
|
+
this._strings = [];
|
|
76693
|
+
}
|
|
76694
|
+
readU8() {
|
|
76695
|
+
if (this._pos >= this._bytes.length)
|
|
76696
|
+
throw new Error(`SchemaView blob truncated: cannot read u8 at offset ${this._pos} (length ${this._bytes.length})`);
|
|
76697
|
+
return this._bytes[this._pos++];
|
|
76698
|
+
}
|
|
76699
|
+
readU16() { const v = this._view.getUint16(this._pos, true); this._pos += 2; return v; }
|
|
76700
|
+
readU32() { const v = this._view.getUint32(this._pos, true); this._pos += 4; return v; }
|
|
76701
|
+
readI32() { const v = this._view.getInt32(this._pos, true); this._pos += 4; return v; }
|
|
76702
|
+
readF64() { const v = this._view.getFloat64(this._pos, true); this._pos += 8; return v; }
|
|
76703
|
+
get pos() { return this._pos; }
|
|
76704
|
+
set pos(v) { this._pos = v; }
|
|
76705
|
+
/** Read a string-table reference (U32 index) and return the original string. */
|
|
76706
|
+
readSRef() {
|
|
76707
|
+
const idx = this.readU32();
|
|
76708
|
+
if (idx >= this._strings.length)
|
|
76709
|
+
throw new Error(`SchemaView blob: string reference ${idx} out of range (string table size ${this._strings.length})`);
|
|
76710
|
+
return this._strings[idx];
|
|
76711
|
+
}
|
|
76712
|
+
/** Validate a count-prefixed table header: the declared count cannot exceed what the remaining
|
|
76713
|
+
* buffer could plausibly hold. Each entry consumes at least `minBytesPerEntry` bytes. */
|
|
76714
|
+
validateCount(count, minBytesPerEntry, tableName) {
|
|
76715
|
+
const remaining = this._bytes.length - this._pos;
|
|
76716
|
+
if (count > remaining / Math.max(1, minBytesPerEntry))
|
|
76717
|
+
throw new Error(`SchemaView blob: ${tableName} count ${count} exceeds remaining buffer (${remaining} bytes)`);
|
|
76718
|
+
}
|
|
76719
|
+
/** Parse the string table at the given offset. */
|
|
76720
|
+
parseStringTable(offset) {
|
|
76721
|
+
if (offset > this._bytes.length)
|
|
76722
|
+
throw new Error(`SchemaView blob: stringTable offset ${offset} is past end of blob (length ${this._bytes.length})`);
|
|
76723
|
+
const saved = this._pos;
|
|
76724
|
+
this._pos = offset;
|
|
76725
|
+
const count = this.readU32();
|
|
76726
|
+
// Each entry is at minimum a 4-byte length prefix - a count larger than the remaining bytes
|
|
76727
|
+
// cannot possibly be valid and would cause a huge `new Array` allocation on a malformed blob.
|
|
76728
|
+
const remaining = this._bytes.length - this._pos;
|
|
76729
|
+
if (count > remaining / 4)
|
|
76730
|
+
throw new Error(`SchemaView blob: stringTable count ${count} exceeds remaining buffer (${remaining} bytes)`);
|
|
76731
|
+
this._strings = new Array(count);
|
|
76732
|
+
const decoder = new TextDecoder();
|
|
76733
|
+
for (let i = 0; i < count; i++) {
|
|
76734
|
+
const len = this.readU32();
|
|
76735
|
+
if (len === 0) {
|
|
76736
|
+
this._strings[i] = "";
|
|
76737
|
+
}
|
|
76738
|
+
else {
|
|
76739
|
+
if (len > this._bytes.length - this._pos)
|
|
76740
|
+
throw new Error(`SchemaView blob: string entry ${i} has length ${len} but only ${this._bytes.length - this._pos} bytes remain`);
|
|
76741
|
+
this._strings[i] = decoder.decode(this._bytes.subarray(this._pos, this._pos + len));
|
|
76742
|
+
this._pos += len;
|
|
76743
|
+
}
|
|
76744
|
+
}
|
|
76745
|
+
this._pos = saved;
|
|
76746
|
+
}
|
|
76747
|
+
}
|
|
76748
|
+
/** Read a U32 that uses 0xFFFFFFFF as a sentinel for "not set". */
|
|
76749
|
+
function readOptionalU32(reader) {
|
|
76750
|
+
const v = reader.readU32();
|
|
76751
|
+
return v === 0xFFFFFFFF ? undefined : v;
|
|
76752
|
+
}
|
|
76753
|
+
/** Helper: read a tag byte and validate it matches the expected tag. */
|
|
76754
|
+
function expectTag(reader, expected) {
|
|
76755
|
+
const tag = reader.readU8();
|
|
76756
|
+
if (tag !== expected)
|
|
76757
|
+
throw new Error(`Expected tag 0x${expected.toString(16)} but found 0x${tag.toString(16)} at offset ${reader.pos - 1}`);
|
|
76758
|
+
}
|
|
76759
|
+
/** Parse a schema view blob (binary format) into a `SchemaView`.
|
|
76760
|
+
*
|
|
76761
|
+
* Layout: Header, PropertyDefTable, SchemaTable, EnumTable, KoQTable, PropCatTable, ClassTable, StringTable.
|
|
76762
|
+
* Each table is count-prefixed. Schema items carry their schema's ecInstanceId for ownership resolution.
|
|
76763
|
+
* Classes have count-prefixed inline sub-items (base classes, property refs, constraints).
|
|
76764
|
+
*
|
|
76765
|
+
* Consumers should call `SchemaView.fromBinary` instead - this function is the low-level
|
|
76766
|
+
* implementation behind it.
|
|
76767
|
+
* @internal
|
|
76768
|
+
*/
|
|
76769
|
+
function parseSchemaViewBlob(data, schemaToken) {
|
|
76770
|
+
const reader = new BinaryReader(data);
|
|
76771
|
+
// Header: magic(4) + version(1) + stringTableOffset(4)
|
|
76772
|
+
const magic = reader.readU32();
|
|
76773
|
+
if (magic !== MAGIC)
|
|
76774
|
+
throw new Error(`Invalid SchemaView blob magic: 0x${magic.toString(16)}, expected 0x${MAGIC.toString(16)}`);
|
|
76775
|
+
const version = reader.readU8();
|
|
76776
|
+
if (version !== _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__.schemaViewFormatVersion)
|
|
76777
|
+
throw new Error(`Unsupported schema view format version: ${version}, expected ${_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__.schemaViewFormatVersion}`);
|
|
76778
|
+
const stOffset = reader.readU32();
|
|
76779
|
+
reader.parseStringTable(stOffset);
|
|
76780
|
+
const builder = new _SchemaView__WEBPACK_IMPORTED_MODULE_1__.SchemaViewBuilder();
|
|
76781
|
+
// Cross-reference maps (ecInstanceId -> builder array index)
|
|
76782
|
+
const schemaEcIdToIdx = new Map();
|
|
76783
|
+
const enumRowIdToIdx = new Map();
|
|
76784
|
+
const koqRowIdToIdx = new Map();
|
|
76785
|
+
const catRowIdToIdx = new Map();
|
|
76786
|
+
const classRowIdToIdx = new Map();
|
|
76787
|
+
// Per-schema metadata for name-based class resolution
|
|
76788
|
+
const schemaInfos = [];
|
|
76789
|
+
// Per-schema item range tracking (indexed by schemaIdx)
|
|
76790
|
+
const schemaEnumStarts = [];
|
|
76791
|
+
const schemaEnumCounts = [];
|
|
76792
|
+
const schemaKoqStarts = [];
|
|
76793
|
+
const schemaKoqCounts = [];
|
|
76794
|
+
const schemaCatStarts = [];
|
|
76795
|
+
const schemaCatCounts = [];
|
|
76796
|
+
const schemaClassStarts = [];
|
|
76797
|
+
const schemaClassCounts = [];
|
|
76798
|
+
// Deferred class data for cross-reference resolution
|
|
76799
|
+
const pendingClasses = [];
|
|
76800
|
+
// ---- PropertyDefTable ----
|
|
76801
|
+
expectTag(reader, Tag.PropertyDefTable);
|
|
76802
|
+
const defCount = reader.readU32();
|
|
76803
|
+
// Each PreParsedDef consumes at least ~30 bytes (mix of u8/u16/u32 fields + string refs).
|
|
76804
|
+
// Use a conservative lower bound of 8 bytes to catch wildly oversized counts on malformed blobs.
|
|
76805
|
+
reader.validateCount(defCount, 8, "PropertyDefTable");
|
|
76806
|
+
const preParsedDefs = new Array(defCount);
|
|
76807
|
+
for (let i = 0; i < defCount; i++) {
|
|
76808
|
+
preParsedDefs[i] = {
|
|
76809
|
+
name: reader.readSRef(),
|
|
76810
|
+
kind: reader.readU8(),
|
|
76811
|
+
primitiveType: reader.readU16(),
|
|
76812
|
+
extType: reader.readSRef(),
|
|
76813
|
+
enumRowId: reader.readU32(),
|
|
76814
|
+
structClassRowId: reader.readU32(),
|
|
76815
|
+
koqRowId: reader.readU32(),
|
|
76816
|
+
catRowId: reader.readU32(),
|
|
76817
|
+
arrayMinOccurs: readOptionalU32(reader),
|
|
76818
|
+
arrayMaxOccurs: readOptionalU32(reader),
|
|
76819
|
+
navRelClassRowId: reader.readU32(),
|
|
76820
|
+
navDirection: reader.readU8(),
|
|
76821
|
+
isReadonly: reader.readU8() !== 0,
|
|
76822
|
+
isHidden: reader.readU8() !== 0,
|
|
76823
|
+
description: reader.readSRef(),
|
|
76824
|
+
};
|
|
76825
|
+
}
|
|
76826
|
+
// ---- SchemaTable ----
|
|
76827
|
+
expectTag(reader, Tag.SchemaTable);
|
|
76828
|
+
const schemaCount = reader.readU32();
|
|
76829
|
+
reader.validateCount(schemaCount, 8, "SchemaTable");
|
|
76830
|
+
for (let i = 0; i < schemaCount; i++) {
|
|
76831
|
+
const name = reader.readSRef();
|
|
76832
|
+
const vRead = reader.readU16();
|
|
76833
|
+
const vWrite = reader.readU16();
|
|
76834
|
+
const vMinor = reader.readU16();
|
|
76835
|
+
const alias = reader.readSRef();
|
|
76836
|
+
const label = reader.readSRef();
|
|
76837
|
+
const description = reader.readSRef();
|
|
76838
|
+
const ecInstanceId = reader.readU32();
|
|
76839
|
+
const isHidden = reader.readU8() !== 0;
|
|
76840
|
+
const schemaIdx = builder.addSchema({
|
|
76841
|
+
ecInstanceId,
|
|
76842
|
+
nameStringIdx: builder.internString(name),
|
|
76843
|
+
aliasStringIdx: builder.internString(alias),
|
|
76844
|
+
labelStringIdx: builder.internString(label),
|
|
76845
|
+
descriptionStringIdx: builder.internString(description),
|
|
76846
|
+
versionRead: vRead,
|
|
76847
|
+
versionWrite: vWrite,
|
|
76848
|
+
versionMinor: vMinor,
|
|
76849
|
+
classRangeStart: 0, classCount: 0,
|
|
76850
|
+
enumRangeStart: 0, enumCount: 0,
|
|
76851
|
+
koqRangeStart: 0, koqCount: 0,
|
|
76852
|
+
catRangeStart: 0, catCount: 0,
|
|
76853
|
+
isHidden,
|
|
76854
|
+
});
|
|
76855
|
+
schemaEcIdToIdx.set(ecInstanceId, schemaIdx);
|
|
76856
|
+
schemaInfos.push({ name, schemaIdx, classNameToIdx: new Map() });
|
|
76857
|
+
schemaEnumStarts.push(0);
|
|
76858
|
+
schemaEnumCounts.push(0);
|
|
76859
|
+
schemaKoqStarts.push(0);
|
|
76860
|
+
schemaKoqCounts.push(0);
|
|
76861
|
+
schemaCatStarts.push(0);
|
|
76862
|
+
schemaCatCounts.push(0);
|
|
76863
|
+
schemaClassStarts.push(0);
|
|
76864
|
+
schemaClassCounts.push(0);
|
|
76865
|
+
}
|
|
76866
|
+
/** Track an item's schema ownership and update range counters. */
|
|
76867
|
+
function trackItem(schemaEcId, globalIdx, starts, counts) {
|
|
76868
|
+
const schemaIdx = schemaEcIdToIdx.get(schemaEcId);
|
|
76869
|
+
if (schemaIdx === undefined)
|
|
76870
|
+
throw new Error(`SchemaView blob: unknown schema ecInstanceId ${schemaEcId}`);
|
|
76871
|
+
if (counts[schemaIdx] === 0)
|
|
76872
|
+
starts[schemaIdx] = globalIdx;
|
|
76873
|
+
counts[schemaIdx]++;
|
|
76874
|
+
return schemaIdx;
|
|
76875
|
+
}
|
|
76876
|
+
// ---- EnumTable ----
|
|
76877
|
+
expectTag(reader, Tag.EnumTable);
|
|
76878
|
+
const enumTotalCount = reader.readU32();
|
|
76879
|
+
reader.validateCount(enumTotalCount, 8, "EnumTable");
|
|
76880
|
+
for (let i = 0; i < enumTotalCount; i++) {
|
|
76881
|
+
const schemaEcId = reader.readU32();
|
|
76882
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaEnumStarts, schemaEnumCounts);
|
|
76883
|
+
const eName = reader.readSRef();
|
|
76884
|
+
const ePrimType = reader.readU8();
|
|
76885
|
+
const eIsStrict = reader.readU8() !== 0;
|
|
76886
|
+
const eLabel = reader.readSRef();
|
|
76887
|
+
const eDesc = reader.readSRef();
|
|
76888
|
+
const eValuesJson = reader.readSRef();
|
|
76889
|
+
const eEcInstanceId = reader.readU32();
|
|
76890
|
+
const enumeratorStart = builder.enumeratorCount;
|
|
76891
|
+
let enumeratorCount = 0;
|
|
76892
|
+
if (eValuesJson) {
|
|
76893
|
+
try {
|
|
76894
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
76895
|
+
const values = JSON.parse(eValuesJson);
|
|
76896
|
+
for (const v of values) {
|
|
76897
|
+
const value = v.IntValue !== undefined ? v.IntValue : (v.StringValue ?? "");
|
|
76898
|
+
const name = v.Name ?? (typeof value === "string" ? value : `${eName}${value}`);
|
|
76899
|
+
builder.addEnumerator({
|
|
76900
|
+
nameStringIdx: builder.internString(name),
|
|
76901
|
+
labelStringIdx: builder.internString(v.DisplayLabel),
|
|
76902
|
+
descriptionStringIdx: builder.internString(v.Description),
|
|
76903
|
+
value,
|
|
76904
|
+
});
|
|
76905
|
+
enumeratorCount++;
|
|
76906
|
+
}
|
|
76907
|
+
}
|
|
76908
|
+
catch (e) {
|
|
76909
|
+
_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Logger.logWarning("ecschema-metadata.SchemaView", `Malformed EnumValues JSON for enumeration "${eName}": ${_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BentleyError.getErrorMessage(e)}`);
|
|
76910
|
+
}
|
|
76911
|
+
}
|
|
76912
|
+
const eIdx = builder.addEnumeration({
|
|
76913
|
+
ecInstanceId: eEcInstanceId,
|
|
76914
|
+
schemaIdx,
|
|
76915
|
+
nameStringIdx: builder.internString(eName),
|
|
76916
|
+
labelStringIdx: builder.internString(eLabel),
|
|
76917
|
+
descriptionStringIdx: builder.internString(eDesc),
|
|
76918
|
+
primitiveType: ePrimType,
|
|
76919
|
+
isStrict: eIsStrict,
|
|
76920
|
+
enumeratorStart,
|
|
76921
|
+
enumeratorCount,
|
|
76922
|
+
});
|
|
76923
|
+
enumRowIdToIdx.set(eEcInstanceId, eIdx);
|
|
76924
|
+
}
|
|
76925
|
+
// ---- KoQTable ----
|
|
76926
|
+
expectTag(reader, Tag.KoQTable);
|
|
76927
|
+
const koqTotalCount = reader.readU32();
|
|
76928
|
+
reader.validateCount(koqTotalCount, 8, "KoQTable");
|
|
76929
|
+
for (let i = 0; i < koqTotalCount; i++) {
|
|
76930
|
+
const schemaEcId = reader.readU32();
|
|
76931
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaKoqStarts, schemaKoqCounts);
|
|
76932
|
+
const kName = reader.readSRef();
|
|
76933
|
+
const kLabel = reader.readSRef();
|
|
76934
|
+
const kDesc = reader.readSRef();
|
|
76935
|
+
const kPersUnit = reader.readSRef();
|
|
76936
|
+
const kRelError = reader.readF64();
|
|
76937
|
+
const kPresUnits = reader.readSRef();
|
|
76938
|
+
const kEcInstanceId = reader.readU32();
|
|
76939
|
+
const kIdx = builder.addKoq({
|
|
76940
|
+
ecInstanceId: kEcInstanceId,
|
|
76941
|
+
schemaIdx,
|
|
76942
|
+
nameStringIdx: builder.internString(kName),
|
|
76943
|
+
labelStringIdx: builder.internString(kLabel),
|
|
76944
|
+
descriptionStringIdx: builder.internString(kDesc),
|
|
76945
|
+
persistenceUnitStringIdx: builder.internString(kPersUnit),
|
|
76946
|
+
presentationFormatsStringIdx: builder.internString(kPresUnits),
|
|
76947
|
+
relativeError: kRelError,
|
|
76948
|
+
});
|
|
76949
|
+
koqRowIdToIdx.set(kEcInstanceId, kIdx);
|
|
76950
|
+
}
|
|
76951
|
+
// ---- PropCatTable ----
|
|
76952
|
+
expectTag(reader, Tag.PropCatTable);
|
|
76953
|
+
const catTotalCount = reader.readU32();
|
|
76954
|
+
reader.validateCount(catTotalCount, 8, "PropCatTable");
|
|
76955
|
+
for (let i = 0; i < catTotalCount; i++) {
|
|
76956
|
+
const schemaEcId = reader.readU32();
|
|
76957
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaCatStarts, schemaCatCounts);
|
|
76958
|
+
const pcName = reader.readSRef();
|
|
76959
|
+
const pcLabel = reader.readSRef();
|
|
76960
|
+
const pcDesc = reader.readSRef();
|
|
76961
|
+
const pcPriority = reader.readI32();
|
|
76962
|
+
const pcEcInstanceId = reader.readU32();
|
|
76963
|
+
const pcIdx = builder.addPropertyCategory({
|
|
76964
|
+
ecInstanceId: pcEcInstanceId,
|
|
76965
|
+
schemaIdx,
|
|
76966
|
+
nameStringIdx: builder.internString(pcName),
|
|
76967
|
+
labelStringIdx: builder.internString(pcLabel),
|
|
76968
|
+
descriptionStringIdx: builder.internString(pcDesc),
|
|
76969
|
+
priority: pcPriority,
|
|
76970
|
+
});
|
|
76971
|
+
catRowIdToIdx.set(pcEcInstanceId, pcIdx);
|
|
76972
|
+
}
|
|
76973
|
+
// ---- ClassTable ----
|
|
76974
|
+
expectTag(reader, Tag.ClassTable);
|
|
76975
|
+
const classTotalCount = reader.readU32();
|
|
76976
|
+
reader.validateCount(classTotalCount, 8, "ClassTable");
|
|
76977
|
+
for (let i = 0; i < classTotalCount; i++) {
|
|
76978
|
+
const schemaEcId = reader.readU32();
|
|
76979
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaClassStarts, schemaClassCounts);
|
|
76980
|
+
const schemaInfo = schemaInfos[schemaIdx];
|
|
76981
|
+
const cName = reader.readSRef();
|
|
76982
|
+
const cType = reader.readU8();
|
|
76983
|
+
const cModifier = reader.readU8();
|
|
76984
|
+
const cLabel = reader.readSRef();
|
|
76985
|
+
const cDesc = reader.readSRef();
|
|
76986
|
+
let relStrength = _ECObjects__WEBPACK_IMPORTED_MODULE_2__.StrengthType.Referencing;
|
|
76987
|
+
let relStrengthDir = _ECObjects__WEBPACK_IMPORTED_MODULE_2__.StrengthDirection.Forward;
|
|
76988
|
+
if (cType === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__.ClassType.Relationship) {
|
|
76989
|
+
relStrength = reader.readU8();
|
|
76990
|
+
relStrengthDir = reader.readU8();
|
|
76991
|
+
}
|
|
76992
|
+
const cEcInstanceId = reader.readU32();
|
|
76993
|
+
// Tri-state hidden: 0=undefined (no CA, schema doesn't hide), 1=true (hidden), 2=false (explicitly shown)
|
|
76994
|
+
const cHiddenByte = reader.readU8();
|
|
76995
|
+
const cIsHidden = cHiddenByte === 1 ? true : cHiddenByte === 2 ? false : undefined;
|
|
76996
|
+
// Base classes (count-prefixed)
|
|
76997
|
+
const baseCount = reader.readU16();
|
|
76998
|
+
const baseClasses = [];
|
|
76999
|
+
for (let b = 0; b < baseCount; b++) {
|
|
77000
|
+
baseClasses.push({
|
|
77001
|
+
schemaName: reader.readSRef(),
|
|
77002
|
+
className: reader.readSRef(),
|
|
77003
|
+
ordinal: reader.readU8(),
|
|
77004
|
+
});
|
|
77005
|
+
}
|
|
77006
|
+
// Property refs (count-prefixed)
|
|
77007
|
+
const propRefCount = reader.readU16();
|
|
77008
|
+
const propRefs = [];
|
|
77009
|
+
for (let p = 0; p < propRefCount; p++) {
|
|
77010
|
+
propRefs.push({
|
|
77011
|
+
preDefIdx: reader.readU32(),
|
|
77012
|
+
labelStringIdx: builder.internString(reader.readSRef()),
|
|
77013
|
+
priority: reader.readI32(),
|
|
77014
|
+
ecInstanceId: reader.readU32(),
|
|
77015
|
+
});
|
|
77016
|
+
}
|
|
77017
|
+
// Constraints (count-prefixed, only for relationships)
|
|
77018
|
+
const constraints = [];
|
|
77019
|
+
if (cType === _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__.ClassType.Relationship) {
|
|
77020
|
+
const constrCount = reader.readU8();
|
|
77021
|
+
for (let c = 0; c < constrCount; c++) {
|
|
77022
|
+
const rcEnd = reader.readU8();
|
|
77023
|
+
const rcMultLower = reader.readU32();
|
|
77024
|
+
const rcMultUpper = reader.readU32();
|
|
77025
|
+
const rcIsPoly = reader.readU8() !== 0;
|
|
77026
|
+
const rcRoleLabel = reader.readSRef();
|
|
77027
|
+
const rcAbsSchema = reader.readSRef();
|
|
77028
|
+
const rcAbsClass = reader.readSRef();
|
|
77029
|
+
// Constraint classes (count-prefixed)
|
|
77030
|
+
const ccCount = reader.readU8();
|
|
77031
|
+
const constraintClasses = [];
|
|
77032
|
+
for (let cc = 0; cc < ccCount; cc++) {
|
|
77033
|
+
constraintClasses.push({
|
|
77034
|
+
schemaName: reader.readSRef(),
|
|
77035
|
+
className: reader.readSRef(),
|
|
77036
|
+
});
|
|
77037
|
+
}
|
|
77038
|
+
constraints.push({
|
|
77039
|
+
relEnd: rcEnd,
|
|
77040
|
+
isPolymorphic: rcIsPoly,
|
|
77041
|
+
multiplicityLower: rcMultLower,
|
|
77042
|
+
multiplicityUpper: rcMultUpper,
|
|
77043
|
+
roleLabel: rcRoleLabel,
|
|
77044
|
+
abstractSchemaName: rcAbsSchema,
|
|
77045
|
+
abstractClassName: rcAbsClass,
|
|
77046
|
+
constraintClasses,
|
|
77047
|
+
});
|
|
77048
|
+
}
|
|
77049
|
+
}
|
|
77050
|
+
const nameStringIdx = builder.internString(cName);
|
|
77051
|
+
const classIdx = builder.addClass({
|
|
77052
|
+
ecInstanceId: cEcInstanceId,
|
|
77053
|
+
schemaIdx,
|
|
77054
|
+
nameStringIdx,
|
|
77055
|
+
labelStringIdx: builder.internString(cLabel),
|
|
77056
|
+
descriptionStringIdx: builder.internString(cDesc),
|
|
77057
|
+
type: cType,
|
|
77058
|
+
modifier: cModifier,
|
|
77059
|
+
baseClassIdx: -1,
|
|
77060
|
+
mixinStartIdx: -1,
|
|
77061
|
+
mixinCount: 0,
|
|
77062
|
+
ownPropStart: 0,
|
|
77063
|
+
ownPropCount: 0,
|
|
77064
|
+
strength: relStrength,
|
|
77065
|
+
strengthDirection: relStrengthDir,
|
|
77066
|
+
sourceConstraintIdx: -1,
|
|
77067
|
+
targetConstraintIdx: -1,
|
|
77068
|
+
isHidden: cIsHidden,
|
|
77069
|
+
});
|
|
77070
|
+
schemaInfo.classNameToIdx.set(cName.toLowerCase(), classIdx);
|
|
77071
|
+
classRowIdToIdx.set(cEcInstanceId, classIdx);
|
|
77072
|
+
pendingClasses.push({
|
|
77073
|
+
schemaIdx,
|
|
77074
|
+
classIdx,
|
|
77075
|
+
ecInstanceId: cEcInstanceId,
|
|
77076
|
+
nameStringIdx,
|
|
77077
|
+
labelStringIdx: builder.internString(cLabel),
|
|
77078
|
+
descriptionStringIdx: builder.internString(cDesc),
|
|
77079
|
+
type: cType,
|
|
77080
|
+
modifier: cModifier,
|
|
77081
|
+
relStrength,
|
|
77082
|
+
relStrengthDir,
|
|
77083
|
+
baseClasses,
|
|
77084
|
+
propRefs,
|
|
77085
|
+
constraints,
|
|
77086
|
+
schemaName: schemaInfo.name,
|
|
77087
|
+
isHidden: cIsHidden,
|
|
77088
|
+
});
|
|
77089
|
+
}
|
|
77090
|
+
// ---- Finalize per-schema item ranges ----
|
|
77091
|
+
for (let i = 0; i < schemaCount; i++) {
|
|
77092
|
+
builder.updateSchemaRanges(i, {
|
|
77093
|
+
classRangeStart: schemaClassStarts[i] ?? 0,
|
|
77094
|
+
classCount: schemaClassCounts[i] ?? 0,
|
|
77095
|
+
enumRangeStart: schemaEnumStarts[i] ?? 0,
|
|
77096
|
+
enumCount: schemaEnumCounts[i] ?? 0,
|
|
77097
|
+
koqRangeStart: schemaKoqStarts[i] ?? 0,
|
|
77098
|
+
koqCount: schemaKoqCounts[i] ?? 0,
|
|
77099
|
+
catRangeStart: schemaCatStarts[i] ?? 0,
|
|
77100
|
+
catCount: schemaCatCounts[i] ?? 0,
|
|
77101
|
+
});
|
|
77102
|
+
}
|
|
77103
|
+
// Build a global name resolver: "SchemaName:ClassName" -> classIdx
|
|
77104
|
+
const classResolver = new Map();
|
|
77105
|
+
for (const s of schemaInfos) {
|
|
77106
|
+
for (const [lowerName, idx] of s.classNameToIdx)
|
|
77107
|
+
classResolver.set(`${s.name.toLowerCase()}:${lowerName}`, idx);
|
|
77108
|
+
}
|
|
77109
|
+
// Resolve pre-parsed defs to PropertyDef objects. Maps preParsedDef index -> builder defIdx.
|
|
77110
|
+
const danglingRefs = [];
|
|
77111
|
+
const resolvedDefMap = new Map();
|
|
77112
|
+
const brokenDefs = new Set();
|
|
77113
|
+
for (let i = 0; i < preParsedDefs.length; i++) {
|
|
77114
|
+
const prDef = preParsedDefs[i];
|
|
77115
|
+
let structClassIdx = -1;
|
|
77116
|
+
if (prDef.structClassRowId !== 0) {
|
|
77117
|
+
structClassIdx = classRowIdToIdx.get(prDef.structClassRowId) ?? -1;
|
|
77118
|
+
if (structClassIdx === -1) {
|
|
77119
|
+
brokenDefs.add(i);
|
|
77120
|
+
danglingRefs.push(`Dropped properties with struct class rowId ${prDef.structClassRowId}`);
|
|
77121
|
+
continue;
|
|
77122
|
+
}
|
|
77123
|
+
}
|
|
77124
|
+
let navRelClassIdx = -1;
|
|
77125
|
+
if (prDef.navRelClassRowId !== 0) {
|
|
77126
|
+
navRelClassIdx = classRowIdToIdx.get(prDef.navRelClassRowId) ?? -1;
|
|
77127
|
+
if (navRelClassIdx === -1) {
|
|
77128
|
+
brokenDefs.add(i);
|
|
77129
|
+
danglingRefs.push(`Dropped properties with nav relationship rowId ${prDef.navRelClassRowId}`);
|
|
77130
|
+
continue;
|
|
77131
|
+
}
|
|
77132
|
+
}
|
|
77133
|
+
let enumIdx = -1;
|
|
77134
|
+
if (prDef.enumRowId !== 0) {
|
|
77135
|
+
enumIdx = enumRowIdToIdx.get(prDef.enumRowId) ?? -1;
|
|
77136
|
+
if (enumIdx === -1)
|
|
77137
|
+
danglingRefs.push(`Unresolved enum rowId ${prDef.enumRowId}`);
|
|
77138
|
+
}
|
|
77139
|
+
let koqIdx = -1;
|
|
77140
|
+
if (prDef.koqRowId !== 0)
|
|
77141
|
+
koqIdx = koqRowIdToIdx.get(prDef.koqRowId) ?? -1;
|
|
77142
|
+
let categoryIdx = -1;
|
|
77143
|
+
if (prDef.catRowId !== 0)
|
|
77144
|
+
categoryIdx = catRowIdToIdx.get(prDef.catRowId) ?? -1;
|
|
77145
|
+
const def = {
|
|
77146
|
+
nameStringIdx: builder.internString(prDef.name),
|
|
77147
|
+
descriptionStringIdx: builder.internString(prDef.description),
|
|
77148
|
+
kind: prDef.kind,
|
|
77149
|
+
primitiveType: prDef.primitiveType,
|
|
77150
|
+
extTypeStringIdx: builder.internString(prDef.extType),
|
|
77151
|
+
enumIdx,
|
|
77152
|
+
koqIdx,
|
|
77153
|
+
structClassIdx,
|
|
77154
|
+
navRelClassIdx,
|
|
77155
|
+
navDirection: prDef.navDirection,
|
|
77156
|
+
categoryIdx,
|
|
77157
|
+
isReadOnly: prDef.isReadonly,
|
|
77158
|
+
isHidden: prDef.isHidden,
|
|
77159
|
+
arrayMinOccurs: prDef.arrayMinOccurs,
|
|
77160
|
+
arrayMaxOccurs: prDef.arrayMaxOccurs,
|
|
77161
|
+
};
|
|
77162
|
+
resolvedDefMap.set(i, builder.addPropertyDef(def));
|
|
77163
|
+
}
|
|
77164
|
+
// Resolve cross-references and finalize classes
|
|
77165
|
+
for (const pc of pendingClasses) {
|
|
77166
|
+
pc.baseClasses.sort((a, b) => a.ordinal - b.ordinal);
|
|
77167
|
+
const classFullName = `${pc.schemaName}:${builder.getString(pc.nameStringIdx)}`;
|
|
77168
|
+
let baseClassIdx = -1;
|
|
77169
|
+
const mixinStartIdx = pc.baseClasses.length > 1 ? builder.classMixinCount : -1;
|
|
77170
|
+
let mixinCount = 0;
|
|
77171
|
+
for (const bc of pc.baseClasses) {
|
|
77172
|
+
const bcKey = `${bc.schemaName.toLowerCase()}:${bc.className.toLowerCase()}`;
|
|
77173
|
+
const bcIdx = classResolver.get(bcKey) ?? -1;
|
|
77174
|
+
if (bc.ordinal === 0) {
|
|
77175
|
+
if (bcIdx === -1 && bc.schemaName)
|
|
77176
|
+
danglingRefs.push(`${classFullName} -> base class ${bc.schemaName}:${bc.className}`);
|
|
77177
|
+
baseClassIdx = bcIdx;
|
|
77178
|
+
}
|
|
77179
|
+
else {
|
|
77180
|
+
if (bcIdx === -1) {
|
|
77181
|
+
danglingRefs.push(`${classFullName} -> mixin ${bc.schemaName}:${bc.className}`);
|
|
77182
|
+
continue;
|
|
77183
|
+
}
|
|
77184
|
+
builder.addClassMixin(bcIdx);
|
|
77185
|
+
mixinCount++;
|
|
77186
|
+
}
|
|
77187
|
+
}
|
|
77188
|
+
const ownPropStart = builder.propertyRefCount;
|
|
77189
|
+
for (const pr of pc.propRefs) {
|
|
77190
|
+
if (brokenDefs.has(pr.preDefIdx))
|
|
77191
|
+
continue;
|
|
77192
|
+
const defIdx = resolvedDefMap.get(pr.preDefIdx);
|
|
77193
|
+
if (defIdx === undefined)
|
|
77194
|
+
continue;
|
|
77195
|
+
builder.addPropertyRef({
|
|
77196
|
+
ecInstanceId: pr.ecInstanceId,
|
|
77197
|
+
defIdx,
|
|
77198
|
+
labelStringIdx: pr.labelStringIdx,
|
|
77199
|
+
priority: pr.priority,
|
|
77200
|
+
});
|
|
77201
|
+
}
|
|
77202
|
+
let sourceConstraintIdx = -1;
|
|
77203
|
+
let targetConstraintIdx = -1;
|
|
77204
|
+
for (const con of pc.constraints) {
|
|
77205
|
+
const absKey = con.abstractSchemaName && con.abstractClassName
|
|
77206
|
+
? `${con.abstractSchemaName.toLowerCase()}:${con.abstractClassName.toLowerCase()}`
|
|
77207
|
+
: "";
|
|
77208
|
+
const absClassIdx = absKey ? (classResolver.get(absKey) ?? -1) : -1;
|
|
77209
|
+
if (absClassIdx === -1 && absKey)
|
|
77210
|
+
danglingRefs.push(`${classFullName} constraint -> abstract ${con.abstractSchemaName}:${con.abstractClassName}`);
|
|
77211
|
+
const classRefStart = builder.constraintClassRefCount;
|
|
77212
|
+
let classRefCount = 0;
|
|
77213
|
+
for (const cc of con.constraintClasses) {
|
|
77214
|
+
const ccKey = `${cc.schemaName.toLowerCase()}:${cc.className.toLowerCase()}`;
|
|
77215
|
+
const ccIdx = classResolver.get(ccKey) ?? -1;
|
|
77216
|
+
if (ccIdx === -1) {
|
|
77217
|
+
danglingRefs.push(`${classFullName} constraint -> class ${cc.schemaName}:${cc.className}`);
|
|
77218
|
+
continue;
|
|
77219
|
+
}
|
|
77220
|
+
builder.addConstraintClassRef(ccIdx);
|
|
77221
|
+
classRefCount++;
|
|
77222
|
+
}
|
|
77223
|
+
const constraintIdx = builder.addRelConstraint({
|
|
77224
|
+
abstractConstraintIdx: absClassIdx,
|
|
77225
|
+
polymorphic: con.isPolymorphic,
|
|
77226
|
+
multiplicityLower: con.multiplicityLower,
|
|
77227
|
+
multiplicityUpper: con.multiplicityUpper,
|
|
77228
|
+
roleLabelStringIdx: builder.internString(con.roleLabel),
|
|
77229
|
+
classRefStart,
|
|
77230
|
+
classRefCount,
|
|
77231
|
+
});
|
|
77232
|
+
if (con.relEnd === 0)
|
|
77233
|
+
sourceConstraintIdx = constraintIdx;
|
|
77234
|
+
else
|
|
77235
|
+
targetConstraintIdx = constraintIdx;
|
|
77236
|
+
}
|
|
77237
|
+
const updatedClass = {
|
|
77238
|
+
ecInstanceId: pc.ecInstanceId,
|
|
77239
|
+
schemaIdx: pc.schemaIdx,
|
|
77240
|
+
nameStringIdx: pc.nameStringIdx,
|
|
77241
|
+
labelStringIdx: pc.labelStringIdx,
|
|
77242
|
+
descriptionStringIdx: pc.descriptionStringIdx,
|
|
77243
|
+
type: pc.type,
|
|
77244
|
+
modifier: pc.modifier,
|
|
77245
|
+
baseClassIdx,
|
|
77246
|
+
mixinStartIdx,
|
|
77247
|
+
mixinCount,
|
|
77248
|
+
ownPropStart,
|
|
77249
|
+
ownPropCount: builder.propertyRefCount - ownPropStart,
|
|
77250
|
+
strength: pc.relStrength,
|
|
77251
|
+
strengthDirection: pc.relStrengthDir,
|
|
77252
|
+
sourceConstraintIdx,
|
|
77253
|
+
targetConstraintIdx,
|
|
77254
|
+
isHidden: pc.isHidden,
|
|
77255
|
+
};
|
|
77256
|
+
builder.updateClass(pc.classIdx, updatedClass);
|
|
77257
|
+
}
|
|
77258
|
+
if (danglingRefs.length > 0) {
|
|
77259
|
+
const cap = 20;
|
|
77260
|
+
const lines = danglingRefs.length <= cap ? danglingRefs : [...danglingRefs.slice(0, cap), `... and ${danglingRefs.length - cap} more`];
|
|
77261
|
+
_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Logger.logWarning("ecschema-metadata.SchemaView", `${danglingRefs.length} unresolved cross-reference(s) in schema view blob (likely from excluded schemas):\n ${lines.join("\n ")}`);
|
|
77262
|
+
}
|
|
77263
|
+
return builder.build(schemaToken);
|
|
77264
|
+
}
|
|
77265
|
+
|
|
77266
|
+
|
|
77267
|
+
/***/ }),
|
|
77268
|
+
|
|
77269
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaViewInterfaces.js":
|
|
77270
|
+
/*!********************************************************************!*\
|
|
77271
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaViewInterfaces.js ***!
|
|
77272
|
+
\********************************************************************/
|
|
77273
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
77274
|
+
|
|
77275
|
+
"use strict";
|
|
77276
|
+
__webpack_require__.r(__webpack_exports__);
|
|
77277
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
77278
|
+
/* harmony export */ ClassModifier: () => (/* binding */ ClassModifier),
|
|
77279
|
+
/* harmony export */ ClassType: () => (/* binding */ ClassType),
|
|
77280
|
+
/* harmony export */ PropertyKind: () => (/* binding */ PropertyKind),
|
|
77281
|
+
/* harmony export */ SchemaViewPrimitiveType: () => (/* binding */ SchemaViewPrimitiveType),
|
|
77282
|
+
/* harmony export */ schemaViewFormatVersion: () => (/* binding */ schemaViewFormatVersion)
|
|
77283
|
+
/* harmony export */ });
|
|
77284
|
+
/*---------------------------------------------------------------------------------------------
|
|
77285
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
77286
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
77287
|
+
*--------------------------------------------------------------------------------------------*/
|
|
77288
|
+
/** @packageDocumentation
|
|
77289
|
+
* @module Schema
|
|
77290
|
+
*/
|
|
77291
|
+
/** The binary format version that this TS reader supports.
|
|
77292
|
+
* The C++ writer in imodel-native must produce this version (or negotiate down to it).
|
|
77293
|
+
* Frontend callers should always request this version explicitly via `PRAGMA schema_view(N)`.
|
|
77294
|
+
* Backend callers may omit it since native and backend are bundled together.
|
|
77295
|
+
* @beta
|
|
77296
|
+
*/
|
|
77297
|
+
const schemaViewFormatVersion = 1;
|
|
77298
|
+
/** Matches ec_Class.Type values in ECDb.
|
|
77299
|
+
* @beta
|
|
77300
|
+
*/
|
|
77301
|
+
var ClassType;
|
|
77302
|
+
(function (ClassType) {
|
|
77303
|
+
ClassType[ClassType["Entity"] = 0] = "Entity";
|
|
77304
|
+
ClassType[ClassType["Relationship"] = 1] = "Relationship";
|
|
77305
|
+
ClassType[ClassType["Struct"] = 2] = "Struct";
|
|
77306
|
+
ClassType[ClassType["CustomAttribute"] = 3] = "CustomAttribute";
|
|
77307
|
+
/** Not stored in ec_Class.Type - synthesized from IsMixin CA during cache population. */
|
|
77308
|
+
ClassType[ClassType["Mixin"] = 4] = "Mixin";
|
|
77309
|
+
/** Synthesized from the QueryView custom attribute. */
|
|
77310
|
+
ClassType[ClassType["View"] = 5] = "View";
|
|
77311
|
+
})(ClassType || (ClassType = {}));
|
|
77312
|
+
/** Matches ec_Class.Modifier values.
|
|
77313
|
+
* @beta
|
|
77314
|
+
*/
|
|
77315
|
+
var ClassModifier;
|
|
77316
|
+
(function (ClassModifier) {
|
|
77317
|
+
ClassModifier[ClassModifier["None"] = 0] = "None";
|
|
77318
|
+
ClassModifier[ClassModifier["Abstract"] = 1] = "Abstract";
|
|
77319
|
+
ClassModifier[ClassModifier["Sealed"] = 2] = "Sealed";
|
|
77320
|
+
})(ClassModifier || (ClassModifier = {}));
|
|
77321
|
+
/** Matches ec_Property.Kind values.
|
|
77322
|
+
* @beta
|
|
77323
|
+
*/
|
|
77324
|
+
var PropertyKind;
|
|
77325
|
+
(function (PropertyKind) {
|
|
77326
|
+
PropertyKind[PropertyKind["Primitive"] = 0] = "Primitive";
|
|
77327
|
+
PropertyKind[PropertyKind["Struct"] = 1] = "Struct";
|
|
77328
|
+
PropertyKind[PropertyKind["PrimitiveArray"] = 2] = "PrimitiveArray";
|
|
77329
|
+
PropertyKind[PropertyKind["StructArray"] = 3] = "StructArray";
|
|
77330
|
+
PropertyKind[PropertyKind["Navigation"] = 4] = "Navigation";
|
|
77331
|
+
})(PropertyKind || (PropertyKind = {}));
|
|
77332
|
+
/** Matches ec_ PrimitiveType values.
|
|
77333
|
+
* @beta
|
|
77334
|
+
*/
|
|
77335
|
+
var SchemaViewPrimitiveType;
|
|
77336
|
+
(function (SchemaViewPrimitiveType) {
|
|
77337
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Uninitialized"] = 0] = "Uninitialized";
|
|
77338
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Binary"] = 257] = "Binary";
|
|
77339
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Boolean"] = 513] = "Boolean";
|
|
77340
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["DateTime"] = 769] = "DateTime";
|
|
77341
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Double"] = 1025] = "Double";
|
|
77342
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Integer"] = 1281] = "Integer";
|
|
77343
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Long"] = 1537] = "Long";
|
|
77344
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Point2d"] = 1793] = "Point2d";
|
|
77345
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["Point3d"] = 2049] = "Point3d";
|
|
77346
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["String"] = 2305] = "String";
|
|
77347
|
+
SchemaViewPrimitiveType[SchemaViewPrimitiveType["IGeometry"] = 2561] = "IGeometry";
|
|
77348
|
+
})(SchemaViewPrimitiveType || (SchemaViewPrimitiveType = {}));
|
|
77349
|
+
|
|
77350
|
+
|
|
75426
77351
|
/***/ }),
|
|
75427
77352
|
|
|
75428
77353
|
/***/ "../../core/ecschema-metadata/lib/esm/UnitConversion/UnitConverter.js":
|
|
@@ -76133,6 +78058,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76133
78058
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
76134
78059
|
/* harmony export */ AbstractSchemaItemType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.AbstractSchemaItemType),
|
|
76135
78060
|
/* harmony export */ ArrayProperty: () => (/* reexport safe */ _Metadata_Property__WEBPACK_IMPORTED_MODULE_22__.ArrayProperty),
|
|
78061
|
+
/* harmony export */ ClassModifier: () => (/* reexport safe */ _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_44__.ClassModifier),
|
|
78062
|
+
/* harmony export */ ClassType: () => (/* reexport safe */ _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_44__.ClassType),
|
|
76136
78063
|
/* harmony export */ Constant: () => (/* reexport safe */ _Metadata_Constant__WEBPACK_IMPORTED_MODULE_12__.Constant),
|
|
76137
78064
|
/* harmony export */ CustomAttributeClass: () => (/* reexport safe */ _Metadata_CustomAttributeClass__WEBPACK_IMPORTED_MODULE_13__.CustomAttributeClass),
|
|
76138
78065
|
/* harmony export */ CustomAttributeContainerType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.CustomAttributeContainerType),
|
|
@@ -76166,6 +78093,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76166
78093
|
/* harmony export */ PrimitiveType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.PrimitiveType),
|
|
76167
78094
|
/* harmony export */ Property: () => (/* reexport safe */ _Metadata_Property__WEBPACK_IMPORTED_MODULE_22__.Property),
|
|
76168
78095
|
/* harmony export */ PropertyCategory: () => (/* reexport safe */ _Metadata_PropertyCategory__WEBPACK_IMPORTED_MODULE_23__.PropertyCategory),
|
|
78096
|
+
/* harmony export */ PropertyKind: () => (/* reexport safe */ _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_44__.PropertyKind),
|
|
76169
78097
|
/* harmony export */ PropertyType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.PropertyType),
|
|
76170
78098
|
/* harmony export */ PropertyTypeUtils: () => (/* reexport safe */ _PropertyTypes__WEBPACK_IMPORTED_MODULE_29__.PropertyTypeUtils),
|
|
76171
78099
|
/* harmony export */ RelationshipClass: () => (/* reexport safe */ _Metadata_RelationshipClass__WEBPACK_IMPORTED_MODULE_24__.RelationshipClass),
|
|
@@ -76188,6 +78116,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76188
78116
|
/* harmony export */ SchemaPartVisitorDelegate: () => (/* reexport safe */ _SchemaPartVisitorDelegate__WEBPACK_IMPORTED_MODULE_36__.SchemaPartVisitorDelegate),
|
|
76189
78117
|
/* harmony export */ SchemaReadHelper: () => (/* reexport safe */ _Deserialization_Helper__WEBPACK_IMPORTED_MODULE_5__.SchemaReadHelper),
|
|
76190
78118
|
/* harmony export */ SchemaUnitProvider: () => (/* reexport safe */ _UnitProvider_SchemaUnitProvider__WEBPACK_IMPORTED_MODULE_34__.SchemaUnitProvider),
|
|
78119
|
+
/* harmony export */ SchemaView: () => (/* reexport safe */ _SchemaView__WEBPACK_IMPORTED_MODULE_43__.SchemaView),
|
|
78120
|
+
/* harmony export */ SchemaViewBuilder: () => (/* reexport safe */ _SchemaView__WEBPACK_IMPORTED_MODULE_43__.SchemaViewBuilder),
|
|
78121
|
+
/* harmony export */ SchemaViewPrimitiveType: () => (/* reexport safe */ _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_44__.SchemaViewPrimitiveType),
|
|
76191
78122
|
/* harmony export */ SchemaWalker: () => (/* reexport safe */ _Validation_SchemaWalker__WEBPACK_IMPORTED_MODULE_35__.SchemaWalker),
|
|
76192
78123
|
/* harmony export */ StrengthDirection: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.StrengthDirection),
|
|
76193
78124
|
/* harmony export */ StrengthType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.StrengthType),
|
|
@@ -76207,6 +78138,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76207
78138
|
/* harmony export */ parsePrimitiveType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parsePrimitiveType),
|
|
76208
78139
|
/* harmony export */ parseRelationshipEnd: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseRelationshipEnd),
|
|
76209
78140
|
/* harmony export */ parseSchemaItemType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseSchemaItemType),
|
|
78141
|
+
/* harmony export */ parseSchemaViewBlob: () => (/* reexport safe */ _SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_42__.parseSchemaViewBlob),
|
|
76210
78142
|
/* harmony export */ parseStrength: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseStrength),
|
|
76211
78143
|
/* harmony export */ parseStrengthDirection: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseStrengthDirection),
|
|
76212
78144
|
/* harmony export */ primitiveTypeToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.primitiveTypeToString),
|
|
@@ -76214,6 +78146,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76214
78146
|
/* harmony export */ relationshipEndToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.relationshipEndToString),
|
|
76215
78147
|
/* harmony export */ schemaItemTypeToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.schemaItemTypeToString),
|
|
76216
78148
|
/* harmony export */ schemaItemTypeToXmlString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.schemaItemTypeToXmlString),
|
|
78149
|
+
/* harmony export */ schemaViewFormatVersion: () => (/* reexport safe */ _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_44__.schemaViewFormatVersion),
|
|
76217
78150
|
/* harmony export */ strengthDirectionToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.strengthDirectionToString),
|
|
76218
78151
|
/* harmony export */ strengthToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.strengthToString)
|
|
76219
78152
|
/* harmony export */ });
|
|
@@ -76259,6 +78192,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76259
78192
|
/* harmony import */ var _IncrementalLoading_ECSqlSchemaLocater__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./IncrementalLoading/ECSqlSchemaLocater */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js");
|
|
76260
78193
|
/* harmony import */ var _IncrementalLoading_IncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./IncrementalLoading/IncrementalSchemaLocater */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js");
|
|
76261
78194
|
/* harmony import */ var _utils_SchemaGraph__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./utils/SchemaGraph */ "../../core/ecschema-metadata/lib/esm/utils/SchemaGraph.js");
|
|
78195
|
+
/* harmony import */ var _SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./SchemaViewBinaryReader */ "../../core/ecschema-metadata/lib/esm/SchemaViewBinaryReader.js");
|
|
78196
|
+
/* harmony import */ var _SchemaView__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./SchemaView */ "../../core/ecschema-metadata/lib/esm/SchemaView.js");
|
|
78197
|
+
/* harmony import */ var _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./SchemaViewInterfaces */ "../../core/ecschema-metadata/lib/esm/SchemaViewInterfaces.js");
|
|
76262
78198
|
/*---------------------------------------------------------------------------------------------
|
|
76263
78199
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
76264
78200
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -76301,6 +78237,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76301
78237
|
|
|
76302
78238
|
|
|
76303
78239
|
|
|
78240
|
+
|
|
78241
|
+
|
|
78242
|
+
|
|
76304
78243
|
|
|
76305
78244
|
|
|
76306
78245
|
|
|
@@ -82739,6 +84678,7 @@ class BriefcaseConnection extends _IModelConnection__WEBPACK_IMPORTED_MODULE_5__
|
|
|
82739
84678
|
finally {
|
|
82740
84679
|
removeListeners.forEach((remove) => remove());
|
|
82741
84680
|
}
|
|
84681
|
+
await this.invalidateSchemaViewIfChanged();
|
|
82742
84682
|
}
|
|
82743
84683
|
/** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.
|
|
82744
84684
|
* @param description The description for the changeset
|
|
@@ -89399,6 +91339,7 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
89399
91339
|
*/
|
|
89400
91340
|
fontMap; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
89401
91341
|
_schemaContext;
|
|
91342
|
+
_schemasPromise;
|
|
89402
91343
|
/** Load the FontMap for this IModelConnection.
|
|
89403
91344
|
* @returns Returns a Promise<FontMap> that is fulfilled when the FontMap member of this IModelConnection is valid.
|
|
89404
91345
|
* @deprecated in 5.0.0 - will not be removed until after 2026-06-13. If you need font Ids on the front-end for some reason, write an Ipc method that queries [IModelDb.fonts]($backend).
|
|
@@ -89792,6 +91733,10 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
89792
91733
|
* This means to correctly access schema context, client-side applications must register `ECSchemaRpcInterface` following instructions for [RPC configuration]($docs/learning/rpcinterface/#client-side-configuration).
|
|
89793
91734
|
* Server-side applications would also [configure RPC]($docs/learning/rpcinterface/#server-side-configuration) as needed.
|
|
89794
91735
|
*
|
|
91736
|
+
* For runtime read-only access - class/property iteration, IS-A checks, navigating relationships, KOQ lookups -
|
|
91737
|
+
* prefer [[getSchemaView]]. `schemaContext` remains the right choice when you need custom-attribute deserialization
|
|
91738
|
+
* or the full ecschema-metadata object graph.
|
|
91739
|
+
*
|
|
89795
91740
|
* @note While a `BlankConnection` returns a valid `schemaContext`, it has an invalid locater registered by default, and will throw an error when trying to call it's methods.
|
|
89796
91741
|
* @beta
|
|
89797
91742
|
*/
|
|
@@ -89808,6 +91753,111 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
89808
91753
|
}
|
|
89809
91754
|
return this._schemaContext;
|
|
89810
91755
|
}
|
|
91756
|
+
/** Get the schema view for this iModel. The view is built lazily on
|
|
91757
|
+
* first call by fetching compact binary schema data via `PRAGMA schema_view` through
|
|
91758
|
+
* the existing queryRows RPC (ConcurrentQuery). Subsequent calls return the cached view.
|
|
91759
|
+
* Multiple concurrent callers share a single in-flight fetch.
|
|
91760
|
+
*
|
|
91761
|
+
* The returned `SchemaView` is a lightweight, read-only, synchronous API for
|
|
91762
|
+
* navigating schema metadata - classes, properties, relationships, enumerations, etc.
|
|
91763
|
+
* It is the recommended default for runtime read-only metadata access and is significantly
|
|
91764
|
+
* faster and lower-memory than [[schemaContext]]. Use [[schemaContext]] for custom-attribute
|
|
91765
|
+
* deserialization or anywhere you need the full ecschema-metadata object graph.
|
|
91766
|
+
* @beta
|
|
91767
|
+
*/
|
|
91768
|
+
async getSchemaView() {
|
|
91769
|
+
if (this._schemasPromise) {
|
|
91770
|
+
const ctx = await this._schemasPromise;
|
|
91771
|
+
if (!ctx.isOutdated)
|
|
91772
|
+
return ctx;
|
|
91773
|
+
}
|
|
91774
|
+
// Capture the in-flight promise locally so the rejection handler only clears
|
|
91775
|
+
// `_schemasPromise` if it still points at this build. A concurrent invalidation +
|
|
91776
|
+
// re-fetch could otherwise replace the field before our fetch fails, and a naive
|
|
91777
|
+
// `_schemasPromise = undefined` would clobber that newer reference.
|
|
91778
|
+
const inflight = this._fetchSchemas();
|
|
91779
|
+
this._schemasPromise = inflight;
|
|
91780
|
+
inflight.catch(() => {
|
|
91781
|
+
if (this._schemasPromise === inflight)
|
|
91782
|
+
this._schemasPromise = undefined;
|
|
91783
|
+
});
|
|
91784
|
+
return inflight;
|
|
91785
|
+
}
|
|
91786
|
+
/**
|
|
91787
|
+
* Checks whether the iModel's schemas have changed since the current cached [[SchemaView]] was
|
|
91788
|
+
* built, and discards the cache only if they have.
|
|
91789
|
+
*
|
|
91790
|
+
* Frontend code paths that may affect schemas - such as [[BriefcaseConnection.pullChanges]], or
|
|
91791
|
+
* application-specific IPC calls that import or upgrade schemas - cannot reliably determine
|
|
91792
|
+
* whether the operation actually modified any schemas. The IPC response for a pull, for example,
|
|
91793
|
+
* returns only the new changeset id, not the list of applied changesets with their types.
|
|
91794
|
+
* Unconditionally discarding the cached [[SchemaView]] after every such operation would cause
|
|
91795
|
+
* unnecessary reloads in the common case where schemas are unchanged. This method avoids that
|
|
91796
|
+
* cost by fetching a lightweight schema checksum via `PRAGMA checksum(ecdb_schema)` and
|
|
91797
|
+
* comparing it against the token stored in the cached view. Only when the token differs is the
|
|
91798
|
+
* cache discarded.
|
|
91799
|
+
*
|
|
91800
|
+
* Subclasses that expose operations which may modify schemas should await this method after the
|
|
91801
|
+
* operation completes to ensure [[getSchemaView]] returns a fresh view if needed.
|
|
91802
|
+
* @internal
|
|
91803
|
+
*/
|
|
91804
|
+
async invalidateSchemaViewIfChanged() {
|
|
91805
|
+
if (!this._schemasPromise)
|
|
91806
|
+
return;
|
|
91807
|
+
const existingPromise = this._schemasPromise;
|
|
91808
|
+
let existing;
|
|
91809
|
+
try {
|
|
91810
|
+
existing = await existingPromise;
|
|
91811
|
+
}
|
|
91812
|
+
catch {
|
|
91813
|
+
// The cached promise itself failed; drop it so the next getSchemaView() retries.
|
|
91814
|
+
if (this._schemasPromise === existingPromise)
|
|
91815
|
+
this._schemasPromise = undefined;
|
|
91816
|
+
return;
|
|
91817
|
+
}
|
|
91818
|
+
if (!existing.schemaToken)
|
|
91819
|
+
return;
|
|
91820
|
+
try {
|
|
91821
|
+
const reader = this.createQueryReader("PRAGMA checksum(ecdb_schema)");
|
|
91822
|
+
const result = await reader.next();
|
|
91823
|
+
if (result.done)
|
|
91824
|
+
throw new Error("PRAGMA checksum(ecdb_schema) returned no rows");
|
|
91825
|
+
const liveToken = result.value.sha3_256;
|
|
91826
|
+
if (liveToken !== existing.schemaToken) {
|
|
91827
|
+
if (this._schemasPromise === existingPromise)
|
|
91828
|
+
this._schemasPromise = undefined;
|
|
91829
|
+
existing.markOutdated();
|
|
91830
|
+
}
|
|
91831
|
+
}
|
|
91832
|
+
catch {
|
|
91833
|
+
// The checksum check is called right after operations that may have changed schemas
|
|
91834
|
+
// (e.g., pullChanges). If we cannot verify the cached view is still current, drop it
|
|
91835
|
+
// rather than risk returning stale metadata indefinitely. The next getSchemaView() call
|
|
91836
|
+
// will reload. We also mark the existing view outdated so any retained references can
|
|
91837
|
+
// observe the invalidation.
|
|
91838
|
+
if (this._schemasPromise === existingPromise) {
|
|
91839
|
+
this._schemasPromise = undefined;
|
|
91840
|
+
existing.markOutdated();
|
|
91841
|
+
}
|
|
91842
|
+
}
|
|
91843
|
+
}
|
|
91844
|
+
async _fetchSchemas() {
|
|
91845
|
+
// PRAGMA returns exactly one row with format, formatVersion, data (binary), schemaToken.
|
|
91846
|
+
// Important: only call reader.next() once - do NOT use `for await` on PRAGMA results.
|
|
91847
|
+
// ConcurrentQuery wraps regular ECSQL in LIMIT/OFFSET for pagination but skips this for
|
|
91848
|
+
// PRAGMAs. If the serialized result exceeds the memory threshold, the response is marked
|
|
91849
|
+
// "Partial", and a `for await` loop would re-issue the same PRAGMA forever since PRAGMAs
|
|
91850
|
+
// don't support OFFSET-based pagination.
|
|
91851
|
+
const reader = this.createQueryReader(`PRAGMA schema_view(${_itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_15__.schemaViewFormatVersion})`);
|
|
91852
|
+
const result = await reader.next();
|
|
91853
|
+
if (result.done)
|
|
91854
|
+
throw new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.IModelError(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.BadRequest, "PRAGMA schema_view returned no rows");
|
|
91855
|
+
const data = result.value.data;
|
|
91856
|
+
const token = result.value.schemaToken;
|
|
91857
|
+
if (data === undefined || data === null)
|
|
91858
|
+
throw new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.IModelError(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.BadRequest, "PRAGMA schema_view returned null data column");
|
|
91859
|
+
return _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_15__.SchemaView.fromBinary(data, token ?? "");
|
|
91860
|
+
}
|
|
89811
91861
|
}
|
|
89812
91862
|
/** A connection that exists without an iModel. Useful for connecting to Reality Data services.
|
|
89813
91863
|
* @note This class exists because our display system requires an IModelConnection type even if only reality data is drawn.
|
|
@@ -190311,6 +192361,13 @@ class Geometry {
|
|
|
190311
192361
|
// Line equation is fTarget-f0 = (f1-f0)*x so x = (fTarget-f0)/(f1-f0)
|
|
190312
192362
|
return Geometry.conditionalDivideFraction(fTarget - f0, f1 - f0);
|
|
190313
192363
|
}
|
|
192364
|
+
/**
|
|
192365
|
+
* Return `true` if `a` is a finite number.
|
|
192366
|
+
* @param a value to test
|
|
192367
|
+
*/
|
|
192368
|
+
static isNumber(a) {
|
|
192369
|
+
return Number.isFinite(a);
|
|
192370
|
+
}
|
|
190314
192371
|
/**
|
|
190315
192372
|
* Return `true` if `json` is an array with at least `minEntries` entries and all entries are numbers (including
|
|
190316
192373
|
* those beyond minEntries).
|
|
@@ -206200,11 +208257,18 @@ class CurveCurve {
|
|
|
206200
208257
|
* an `AnyRegion`, then close approaches are computed only to the defining curves, not to the area they enclose.
|
|
206201
208258
|
* @param curveA first curve
|
|
206202
208259
|
* @param curveB second curve
|
|
206203
|
-
* @param
|
|
208260
|
+
* @param maxDistanceOrOptions maximum xy-distance to consider between the curves, or a list of extended options.
|
|
206204
208261
|
* Close approaches further than this xy-distance are not returned.
|
|
206205
|
-
|
|
206206
|
-
|
|
206207
|
-
|
|
208262
|
+
* @return array of detail pairs of close xy-approaches. XY-length of the returned close approach is set in `detailA.a`
|
|
208263
|
+
* and `detailB.a`.
|
|
208264
|
+
*/
|
|
208265
|
+
static closeApproachProjectedXYPairs(curveA, curveB, maxDistanceOrOptions = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.largeCoordinateResult) {
|
|
208266
|
+
const optionIsNumber = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isNumber(maxDistanceOrOptions);
|
|
208267
|
+
const maxDistance = optionIsNumber ? maxDistanceOrOptions : maxDistanceOrOptions.maxDistance ?? _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.largeCoordinateResult;
|
|
208268
|
+
const xyTolerance = optionIsNumber ? undefined : maxDistanceOrOptions.xyTolerance;
|
|
208269
|
+
const newtonTolerance = optionIsNumber ? undefined : maxDistanceOrOptions.newtonTolerance;
|
|
208270
|
+
const maxIterations = optionIsNumber ? undefined : maxDistanceOrOptions.maxIterations;
|
|
208271
|
+
const handler = new _internalContexts_CurveCurveCloseApproachXY__WEBPACK_IMPORTED_MODULE_3__.CurveCurveCloseApproachXY(curveB, xyTolerance, newtonTolerance, maxIterations);
|
|
206208
208272
|
handler.maxDistanceToAccept = maxDistance;
|
|
206209
208273
|
curveA.dispatchToGeometryHandler(handler);
|
|
206210
208274
|
return handler.grabPairedResults();
|
|
@@ -206218,20 +208282,20 @@ class CurveCurve {
|
|
|
206218
208282
|
* found among the pairs.
|
|
206219
208283
|
* @param curveA first curve
|
|
206220
208284
|
* @param curveB second curve
|
|
206221
|
-
* @
|
|
208285
|
+
* @param options optional parameters for close approach calculation
|
|
208286
|
+
* @return detail pair of closest xy-approach, undefined if not found. XY-length of the returned close approach is
|
|
208287
|
+
* set in `detailA.a` and `detailB.a`.
|
|
206222
208288
|
*/
|
|
206223
|
-
static closestApproachProjectedXYPair(curveA, curveB) {
|
|
206224
|
-
|
|
206225
|
-
|
|
206226
|
-
const
|
|
206227
|
-
const closeApproaches = this.closeApproachProjectedXYPairs(curveA, curveB, maxDistance);
|
|
208289
|
+
static closestApproachProjectedXYPair(curveA, curveB, options) {
|
|
208290
|
+
if (options === undefined)
|
|
208291
|
+
options = { maxDistance: _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.largeCoordinateResult };
|
|
208292
|
+
const closeApproaches = this.closeApproachProjectedXYPairs(curveA, curveB, options);
|
|
206228
208293
|
if (!closeApproaches.length)
|
|
206229
208294
|
return undefined;
|
|
206230
208295
|
let iMin = 0;
|
|
206231
|
-
let minDistXY =
|
|
208296
|
+
let minDistXY = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.largeCoordinateResult;
|
|
206232
208297
|
for (let i = 0; i < closeApproaches.length; ++i) {
|
|
206233
|
-
|
|
206234
|
-
const distXY = closeApproaches[i].detailA.point.distanceXY(closeApproaches[i].detailB.point);
|
|
208298
|
+
const distXY = closeApproaches[i].detailA.a;
|
|
206235
208299
|
if (distXY < minDistXY) {
|
|
206236
208300
|
iMin = i;
|
|
206237
208301
|
minDistXY = distXY;
|
|
@@ -217377,6 +219441,7 @@ class CurveCurveCloseApproachXY extends _geometry3d_GeometryHandler__WEBPACK_IMP
|
|
|
217377
219441
|
_maxDistanceSquared;
|
|
217378
219442
|
_xyTolerance;
|
|
217379
219443
|
_newtonTolerance;
|
|
219444
|
+
_maxIterations;
|
|
217380
219445
|
/**
|
|
217381
219446
|
* Start and end points of line segments that meet closest approach criteria, i.e., they are perpendicular to
|
|
217382
219447
|
* both curves and their length is smaller than _maxDistanceToAccept.
|
|
@@ -217392,13 +219457,16 @@ class CurveCurveCloseApproachXY extends _geometry3d_GeometryHandler__WEBPACK_IMP
|
|
|
217392
219457
|
* @param geometryB second curve for intersection. Saved for reference by specific handler methods.
|
|
217393
219458
|
* @param xyTolerance optional tolerance for comparing xy points (default [[Geometry.smallMetricDistance]]).
|
|
217394
219459
|
* @param newtonTolerance optional relative fraction tolerance for Newton iteration (default [[Geometry.smallNewtonStep]]).
|
|
219460
|
+
* @param maxIterations optional max iterations for Newton iteration (default 50).
|
|
217395
219461
|
*/
|
|
217396
|
-
constructor(geometryB, xyTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.smallMetricDistance, newtonTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.smallNewtonStep
|
|
219462
|
+
constructor(geometryB, xyTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.smallMetricDistance, newtonTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.smallNewtonStep, maxIterations = 50 // seen: 47
|
|
219463
|
+
) {
|
|
217397
219464
|
super();
|
|
217398
219465
|
this._geometryB = geometryB instanceof _ProxyCurve__WEBPACK_IMPORTED_MODULE_4__.ProxyCurve ? geometryB.proxyCurve : geometryB;
|
|
217399
219466
|
this._maxDistanceSquared = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.smallMetricDistanceSquared;
|
|
217400
219467
|
this._xyTolerance = xyTolerance;
|
|
217401
219468
|
this._newtonTolerance = newtonTolerance;
|
|
219469
|
+
this._maxIterations = maxIterations;
|
|
217402
219470
|
const compare = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_5__.CurveLocationDetailPair.comparePairsByPoints(xyTolerance, true);
|
|
217403
219471
|
this._results = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.SortedArray(compare, _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.DuplicatePolicy.Retain);
|
|
217404
219472
|
}
|
|
@@ -217917,21 +219985,27 @@ class CurveCurveCloseApproachXY extends _geometry3d_GeometryHandler__WEBPACK_IMP
|
|
|
217917
219985
|
return curve instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_15__.BSplineCurve3dBase || curve instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_16__.TransitionSpiral3d;
|
|
217918
219986
|
}
|
|
217919
219987
|
/**
|
|
217920
|
-
* Process seeds for xy close approach between one curve and another curve
|
|
219988
|
+
* Process seeds for xy close approach between one curve and another curve.
|
|
219989
|
+
* * Seeds typically result from solving a discrete close approach problem, where one or both curves have been stroked.
|
|
217921
219990
|
* * Refine each result via Newton iteration. If it doesn't converge, remove it.
|
|
217922
219991
|
* @param seeds the initial seed results to refine.
|
|
217923
219992
|
* @param curveA curve to find its XY close approach with curveB.
|
|
217924
|
-
* @param
|
|
219993
|
+
* @param curveAIsStroked whether `seeds` contains results from a linestring approximation to `curveA`
|
|
219994
|
+
* @param curveB the other curve.
|
|
219995
|
+
* @param curveBIsStroked whether `seeds` contains results from a linestring approximation to `curveB`
|
|
217925
219996
|
* @param reversed whether `curveB` data is in `detailA` of each recorded pair, and `curveA` data in `detailB`.
|
|
217926
219997
|
*/
|
|
217927
|
-
refineStrokedResultsByNewton(seeds, curveA, curveB, reversed = false) {
|
|
219998
|
+
refineStrokedResultsByNewton(seeds, curveA, curveAIsStroked, curveB, curveBIsStroked, reversed = false) {
|
|
217928
219999
|
const xyMatchingFunction = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_10__.CurveCurveCloseApproachXYRRtoRRD(curveA, curveB);
|
|
217929
|
-
const newtonSearcher = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_10__.Newton2dUnboundedWithDerivative(xyMatchingFunction,
|
|
220000
|
+
const newtonSearcher = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_10__.Newton2dUnboundedWithDerivative(xyMatchingFunction, this._maxIterations, this._newtonTolerance);
|
|
217930
220001
|
for (const seed of seeds) {
|
|
217931
220002
|
const detailA = reversed ? seed.detailB : seed.detailA;
|
|
217932
220003
|
const detailB = reversed ? seed.detailA : seed.detailB;
|
|
217933
220004
|
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(detailB.curve instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_17__.LineString3d, "Caller has discretized the curve");
|
|
217934
|
-
|
|
220005
|
+
// when the curve is stroked, project the discrete seed to compute a fraction in the original curve's parameter space
|
|
220006
|
+
const u = curveAIsStroked ? curveA.closestPointXY(detailA.point)?.fraction ?? detailA.fraction : detailA.fraction;
|
|
220007
|
+
const v = curveBIsStroked ? curveB.closestPointXY(detailB.point)?.fraction ?? detailB.fraction : detailB.fraction;
|
|
220008
|
+
newtonSearcher.setUV(u, v);
|
|
217935
220009
|
if (newtonSearcher.runIterations()) {
|
|
217936
220010
|
const fractionA = newtonSearcher.getU();
|
|
217937
220011
|
const fractionB = newtonSearcher.getV();
|
|
@@ -217974,7 +220048,7 @@ class CurveCurveCloseApproachXY extends _geometry3d_GeometryHandler__WEBPACK_IMP
|
|
|
217974
220048
|
/**
|
|
217975
220049
|
* Compute the XY close approach of a curve and another curve to be stroked.
|
|
217976
220050
|
* @param curveA curve to find its XY close approach with curveB.
|
|
217977
|
-
* @param curveB the other curve to be stroked.
|
|
220051
|
+
* @param curveB the other curve, to be stroked.
|
|
217978
220052
|
* @param reversed whether `curveB` data will be recorded in `detailA` of each result, and `curveA` data in `detailB`.
|
|
217979
220053
|
*/
|
|
217980
220054
|
dispatchCurveStrokedCurve(curveA, curveB, reversed) {
|
|
@@ -217983,12 +220057,11 @@ class CurveCurveCloseApproachXY extends _geometry3d_GeometryHandler__WEBPACK_IMP
|
|
|
217983
220057
|
for (const intersection of intersections)
|
|
217984
220058
|
this.testAndRecordPair(intersection, reversed);
|
|
217985
220059
|
// append seeds computed by solving the discretized spiral close approach problem, then refine the seeds via Newton
|
|
217986
|
-
|
|
217987
|
-
|
|
217988
|
-
cpA = this.strokeCurve(curveA);
|
|
220060
|
+
const curveAIsStroked = this.needsStroking(curveA);
|
|
220061
|
+
const cpA = curveAIsStroked ? this.strokeCurve(curveA) : curveA;
|
|
217989
220062
|
const cpB = this.strokeCurve(curveB);
|
|
217990
220063
|
const seeds = this.computeDiscreteCloseApproachResults(cpA, cpB, reversed);
|
|
217991
|
-
this.refineStrokedResultsByNewton(seeds, curveA, curveB, reversed);
|
|
220064
|
+
this.refineStrokedResultsByNewton(seeds, curveA, curveAIsStroked, curveB, true, reversed);
|
|
217992
220065
|
if (curveA instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_17__.LineString3d) { // explicitly test corners (where Newton converges too slowly)
|
|
217993
220066
|
const fStep = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.safeDivideFraction(1.0, curveA.numEdges(), 0);
|
|
217994
220067
|
const v0 = CurveCurveCloseApproachXY._workPointBB0;
|
|
@@ -253351,7 +255424,8 @@ class UnivariateBezier extends BezierCoffs {
|
|
|
253351
255424
|
const order = this.order;
|
|
253352
255425
|
const coffs = this.coffs;
|
|
253353
255426
|
const orderD = order - 1;
|
|
253354
|
-
|
|
255427
|
+
const maxIterations = 20;
|
|
255428
|
+
for (let iterations = 0; iterations < maxIterations; iterations++) {
|
|
253355
255429
|
UnivariateBezier._basisBuffer = _PascalCoefficients__WEBPACK_IMPORTED_MODULE_1__.PascalCoefficients.getBezierBasisValues(order, u, UnivariateBezier._basisBuffer);
|
|
253356
255430
|
f = 0;
|
|
253357
255431
|
for (let i = 0; i < order; i++)
|
|
@@ -329265,7 +331339,7 @@ var loadLanguages = instance.loadLanguages;
|
|
|
329265
331339
|
/***/ ((module) => {
|
|
329266
331340
|
|
|
329267
331341
|
"use strict";
|
|
329268
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.10.0-dev.
|
|
331342
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.10.0-dev.20","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 && npm run -s copy:draco","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","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./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 && npm run -s extract","extract":"betools extract --fileExt=ts --extractFrom=./src/test/example-code --recursive --out=../../generated-docs/extract","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","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","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":{"@bentley/aec-units-schema":"^1.0.3","@bentley/formats-schema":"^1.0.0","@bentley/units-schema":"^1.0.10","@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/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"^6.0.0","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.5.0","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","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/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"~4.3.4","@loaders.gl/draco":"~4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
|
|
329269
331343
|
|
|
329270
331344
|
/***/ })
|
|
329271
331345
|
|