@itwin/ecschema-rpcinterface-tests 5.12.0-dev.16 → 5.12.0-dev.18
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/backend/BackendInit.js.map +1 -1
- package/lib/common/Settings.js +4 -4
- package/lib/common/Settings.js.map +1 -1
- package/lib/common/SideChannels.js.map +1 -1
- package/lib/dist/bundled-tests.js +799 -349
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/frontend/SchemaRpcInterface.test.js.map +1 -1
- package/lib/frontend/setup/IModelSession.js.map +1 -1
- package/lib/frontend/setup/TestContext.js.map +1 -1
- package/package.json +17 -17
|
@@ -75576,20 +75576,160 @@ class SchemaPartVisitorDelegate {
|
|
|
75576
75576
|
|
|
75577
75577
|
/***/ },
|
|
75578
75578
|
|
|
75579
|
-
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView.js"
|
|
75580
|
-
|
|
75581
|
-
!*** ../../core/ecschema-metadata/lib/esm/SchemaView.js ***!
|
|
75582
|
-
|
|
75579
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaManifest.js"
|
|
75580
|
+
/*!*************************************************************************!*\
|
|
75581
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaView/SchemaManifest.js ***!
|
|
75582
|
+
\*************************************************************************/
|
|
75583
75583
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
75584
75584
|
|
|
75585
75585
|
"use strict";
|
|
75586
75586
|
__webpack_require__.r(__webpack_exports__);
|
|
75587
75587
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
75588
|
-
/* harmony export */
|
|
75589
|
-
/* harmony export */ SchemaViewBuilder: () => (/* binding */ SchemaViewBuilder)
|
|
75588
|
+
/* harmony export */ SchemaManifest: () => (/* binding */ SchemaManifest)
|
|
75590
75589
|
/* harmony export */ });
|
|
75591
|
-
|
|
75592
|
-
|
|
75590
|
+
/*---------------------------------------------------------------------------------------------
|
|
75591
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
75592
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
75593
|
+
*--------------------------------------------------------------------------------------------*/
|
|
75594
|
+
/** @packageDocumentation
|
|
75595
|
+
* @module Schema
|
|
75596
|
+
*/
|
|
75597
|
+
/** The reference graph of every schema in one iModel - names, versions and reference edges, without
|
|
75598
|
+
* any schema data. A {@link (SchemaView:class)} husk loads it up front to answer which schemas exist
|
|
75599
|
+
* and which dependency-ordered set it must load to satisfy a request.
|
|
75600
|
+
*
|
|
75601
|
+
* A `SchemaViewDataProvider` builds the manifest from ECDbMeta rows via {@link SchemaManifest.fromRows}.
|
|
75602
|
+
* The entries are a flat array with no iModel or platform dependency; even the largest iModels hold
|
|
75603
|
+
* on the order of a hundred schemas, so the closure and topological walks are plain recursion.
|
|
75604
|
+
* @note The manifest does not track which schemas are already loaded. `SchemaViewManager` does that
|
|
75605
|
+
* and filters the result of {@link SchemaManifest.getSchemaClosure} itself.
|
|
75606
|
+
* @internal
|
|
75607
|
+
*/
|
|
75608
|
+
class SchemaManifest {
|
|
75609
|
+
_entries;
|
|
75610
|
+
_byLowerName;
|
|
75611
|
+
/** Wraps a set of entries whose references are already wired to one another. */
|
|
75612
|
+
constructor(entries) {
|
|
75613
|
+
this._entries = entries;
|
|
75614
|
+
const byLowerName = new Map();
|
|
75615
|
+
for (const entry of entries)
|
|
75616
|
+
byLowerName.set(entry.name.toLowerCase(), entry);
|
|
75617
|
+
this._byLowerName = byLowerName;
|
|
75618
|
+
}
|
|
75619
|
+
/** Build a manifest from raw ECDbMeta query rows, so a `SchemaViewDataProvider` only has to run
|
|
75620
|
+
* the two queries and hand the rows over. Reference rows whose endpoints are unknown or
|
|
75621
|
+
* self-referential are skipped; that cannot happen for a well-formed iModel.
|
|
75622
|
+
* @internal
|
|
75623
|
+
*/
|
|
75624
|
+
static fromRows(schemaRows, referenceRows) {
|
|
75625
|
+
const entries = [];
|
|
75626
|
+
const entryByECInstanceId = new Map();
|
|
75627
|
+
for (const row of schemaRows) {
|
|
75628
|
+
const entry = {
|
|
75629
|
+
name: row.name,
|
|
75630
|
+
readVersion: row.versionMajor,
|
|
75631
|
+
writeVersion: row.versionWrite,
|
|
75632
|
+
minorVersion: row.versionMinor,
|
|
75633
|
+
references: [],
|
|
75634
|
+
};
|
|
75635
|
+
entries.push(entry);
|
|
75636
|
+
entryByECInstanceId.set(row.ecInstanceId, entry);
|
|
75637
|
+
}
|
|
75638
|
+
for (const row of referenceRows) {
|
|
75639
|
+
const source = entryByECInstanceId.get(row.sourceECInstanceId);
|
|
75640
|
+
const target = entryByECInstanceId.get(row.targetECInstanceId);
|
|
75641
|
+
if (source === undefined || target === undefined || source === target || source.references.includes(target))
|
|
75642
|
+
continue;
|
|
75643
|
+
source.references.push(target);
|
|
75644
|
+
}
|
|
75645
|
+
return new SchemaManifest(entries);
|
|
75646
|
+
}
|
|
75647
|
+
/** The number of schemas in the iModel. */
|
|
75648
|
+
get schemaCount() { return this._entries.length; }
|
|
75649
|
+
/** The names of every schema in the iModel, in manifest order. */
|
|
75650
|
+
getAvailableSchemaNames() {
|
|
75651
|
+
return this._entries.map((entry) => entry.name);
|
|
75652
|
+
}
|
|
75653
|
+
get entries() {
|
|
75654
|
+
return this._entries;
|
|
75655
|
+
}
|
|
75656
|
+
/** The entry for a schema by name (case-insensitive), or `undefined` if the iModel has no such schema. */
|
|
75657
|
+
findByName(name) {
|
|
75658
|
+
return this._byLowerName.get(name.toLowerCase());
|
|
75659
|
+
}
|
|
75660
|
+
/** The transitive reference closure of the requested schemas, as a flat, duplicate-free list of
|
|
75661
|
+
* names: the full set that must be present to use them. The order is unspecified - run
|
|
75662
|
+
* {@link SchemaManifest.sortInDependencyOrder} on the result when a load order is needed.
|
|
75663
|
+
* @note Requested names the iModel does not contain are ignored; check
|
|
75664
|
+
* {@link SchemaManifest.findByName} first to detect them.
|
|
75665
|
+
*/
|
|
75666
|
+
getSchemaClosure(requestedNames) {
|
|
75667
|
+
const result = [];
|
|
75668
|
+
const visited = new Set();
|
|
75669
|
+
const visit = (entry) => {
|
|
75670
|
+
if (visited.has(entry))
|
|
75671
|
+
return;
|
|
75672
|
+
visited.add(entry);
|
|
75673
|
+
result.push(entry.name);
|
|
75674
|
+
for (const reference of entry.references)
|
|
75675
|
+
visit(reference);
|
|
75676
|
+
};
|
|
75677
|
+
for (const name of requestedNames) {
|
|
75678
|
+
const entry = this._byLowerName.get(name.toLowerCase());
|
|
75679
|
+
if (entry !== undefined)
|
|
75680
|
+
visit(entry);
|
|
75681
|
+
}
|
|
75682
|
+
return result;
|
|
75683
|
+
}
|
|
75684
|
+
/** Orders the given schema names so each appears after every schema it references, directly or
|
|
75685
|
+
* transitively. References through schemas not in `schemaNames` are still honored, so the order is
|
|
75686
|
+
* correct even when an intermediate schema is left out. Names the iModel does not contain are
|
|
75687
|
+
* ignored, and reference cycles - which EC forbids - are broken arbitrarily rather than looping.
|
|
75688
|
+
* @internal
|
|
75689
|
+
*/
|
|
75690
|
+
sortInDependencyOrder(schemaNames) {
|
|
75691
|
+
const requested = new Set();
|
|
75692
|
+
for (const name of schemaNames) {
|
|
75693
|
+
const entry = this._byLowerName.get(name.toLowerCase());
|
|
75694
|
+
if (entry !== undefined)
|
|
75695
|
+
requested.add(entry);
|
|
75696
|
+
}
|
|
75697
|
+
const result = [];
|
|
75698
|
+
const visited = new Set();
|
|
75699
|
+
const visiting = new Set();
|
|
75700
|
+
const visit = (entry) => {
|
|
75701
|
+
if (visited.has(entry) || visiting.has(entry))
|
|
75702
|
+
return;
|
|
75703
|
+
visiting.add(entry);
|
|
75704
|
+
for (const reference of entry.references)
|
|
75705
|
+
visit(reference);
|
|
75706
|
+
visiting.delete(entry);
|
|
75707
|
+
visited.add(entry);
|
|
75708
|
+
if (requested.has(entry))
|
|
75709
|
+
result.push(entry.name);
|
|
75710
|
+
};
|
|
75711
|
+
for (const entry of requested)
|
|
75712
|
+
visit(entry);
|
|
75713
|
+
return result;
|
|
75714
|
+
}
|
|
75715
|
+
}
|
|
75716
|
+
|
|
75717
|
+
|
|
75718
|
+
/***/ },
|
|
75719
|
+
|
|
75720
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaView.js"
|
|
75721
|
+
/*!*********************************************************************!*\
|
|
75722
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaView/SchemaView.js ***!
|
|
75723
|
+
\*********************************************************************/
|
|
75724
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
75725
|
+
|
|
75726
|
+
"use strict";
|
|
75727
|
+
__webpack_require__.r(__webpack_exports__);
|
|
75728
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
75729
|
+
/* harmony export */ SchemaView: () => (/* binding */ SchemaView)
|
|
75730
|
+
/* harmony export */ });
|
|
75731
|
+
/* harmony import */ var _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SchemaViewInterfaces */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewInterfaces.js");
|
|
75732
|
+
/* harmony import */ var _SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaViewBinaryReader */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBinaryReader.js");
|
|
75593
75733
|
/*---------------------------------------------------------------------------------------------
|
|
75594
75734
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
75595
75735
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -75620,16 +75760,21 @@ class SchemaView {
|
|
|
75620
75760
|
[_storage];
|
|
75621
75761
|
_schemaToken;
|
|
75622
75762
|
_outdated = false;
|
|
75763
|
+
/** When present, this view is a *husk*: it retains the live builder and cross-reference maps, so
|
|
75764
|
+
* `mergeFragment` can append further fragment blobs. Undefined for one-shot views from `fromBinary`. */
|
|
75765
|
+
_mergeContext;
|
|
75623
75766
|
/** @internal */
|
|
75624
|
-
constructor(data, schemaToken) {
|
|
75767
|
+
constructor(data, schemaToken, mergeContext) {
|
|
75625
75768
|
this[_storage] = {
|
|
75626
75769
|
...data,
|
|
75627
75770
|
transitiveBaseCache: new Map(),
|
|
75628
75771
|
derivedClassMap: undefined,
|
|
75629
75772
|
};
|
|
75630
75773
|
this._schemaToken = schemaToken ?? "";
|
|
75774
|
+
this._mergeContext = mergeContext;
|
|
75631
75775
|
}
|
|
75632
|
-
/**
|
|
75776
|
+
/** Cache-invalidation token identifying the schemas this view was built from: a hash of every
|
|
75777
|
+
* schema's name and version (see `PRAGMA checksum(schema_token)`), not of their full contents.
|
|
75633
75778
|
* Empty string if not set (e.g., when built from a builder without a token).
|
|
75634
75779
|
* @beta
|
|
75635
75780
|
*/
|
|
@@ -75693,17 +75838,37 @@ class SchemaView {
|
|
|
75693
75838
|
}
|
|
75694
75839
|
/** Parse a binary blob into a SchemaView. Synchronous.
|
|
75695
75840
|
* @param blob - The binary blob from `PRAGMA schema_view`.
|
|
75696
|
-
* @param schemaToken - Optional
|
|
75841
|
+
* @param schemaToken - Optional cache-invalidation token (schema name+version hash; see `PRAGMA checksum(schema_token)`).
|
|
75697
75842
|
* @beta
|
|
75698
75843
|
*/
|
|
75699
75844
|
static fromBinary(blob, schemaToken) {
|
|
75700
75845
|
return (0,_SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_1__.parseSchemaViewBlob)(blob, schemaToken);
|
|
75701
75846
|
}
|
|
75702
|
-
/**
|
|
75847
|
+
/** Create an empty, *mergeable* view (a "husk"). It contains no schemas until `mergeFragment` is
|
|
75848
|
+
* called. Each merged fragment is appended into the same instance, so flyweights and cached
|
|
75849
|
+
* cross-references obtained earlier stay valid - indices are append-only and never reordered.
|
|
75850
|
+
* @note Fragments must be merged in dependency order: a fragment may only reference schemas from
|
|
75851
|
+
* fragments already merged.
|
|
75852
|
+
* @internal
|
|
75853
|
+
*/
|
|
75854
|
+
static createMergeable(schemaToken) {
|
|
75855
|
+
const ctx = new _SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_1__.SchemaViewMergeContext();
|
|
75856
|
+
return new SchemaView(ctx.builder.assembleData(), schemaToken, ctx);
|
|
75857
|
+
}
|
|
75858
|
+
/** Merge one fragment blob into this view. Only valid on a view created via `createMergeable`.
|
|
75859
|
+
* Synchronous. Any flyweight or cached index obtained before the call remains valid.
|
|
75860
|
+
* @note If the merge throws (e.g. on a malformed blob), the view may be left partially extended
|
|
75861
|
+
* and must be discarded by the host.
|
|
75703
75862
|
* @internal
|
|
75704
75863
|
*/
|
|
75705
|
-
|
|
75706
|
-
|
|
75864
|
+
mergeFragment(blob) {
|
|
75865
|
+
if (this._mergeContext === undefined)
|
|
75866
|
+
throw new Error("SchemaView is not mergeable: create it via SchemaView.createMergeable to merge fragments.");
|
|
75867
|
+
this._mergeContext.mergeBlob(blob);
|
|
75868
|
+
// A new fragment can add subclasses to an already-present base class, so the derived-class map
|
|
75869
|
+
// must be rebuilt. transitiveBaseCache stays valid: a class's ancestors are always merged
|
|
75870
|
+
// before it (dependency order), so an append never adds an ancestor to an already-cached class.
|
|
75871
|
+
this[_storage].derivedClassMap = undefined;
|
|
75707
75872
|
}
|
|
75708
75873
|
// --- Internal helpers used by view objects ---
|
|
75709
75874
|
/** Resolve a qualified "SchemaName:ItemName" (or dot-separated) to an index using the given
|
|
@@ -76598,215 +76763,26 @@ class SchemaView {
|
|
|
76598
76763
|
}
|
|
76599
76764
|
SchemaView.RelConstraint = RelConstraint;
|
|
76600
76765
|
})(SchemaView || (SchemaView = {}));
|
|
76601
|
-
// =====================================================================================
|
|
76602
|
-
// SchemaViewBuilder
|
|
76603
|
-
// =====================================================================================
|
|
76604
|
-
/** Builder for constructing an immutable `SchemaView`.
|
|
76605
|
-
*
|
|
76606
|
-
* Collects data during binary blob parsing, then freezes it into a view.
|
|
76607
|
-
* Handles string interning and property definition deduplication.
|
|
76608
|
-
*
|
|
76609
|
-
* Consumers should not use this directly - read views via `IModelDb.getSchemaView`
|
|
76610
|
-
* / `IModelConnection.getSchemaView` (or `SchemaView.fromBinary` if you have a raw blob).
|
|
76611
|
-
* @internal
|
|
76612
|
-
*/
|
|
76613
|
-
class SchemaViewBuilder {
|
|
76614
|
-
_strings = [""]; // SID 0 = empty string
|
|
76615
|
-
_lowerStrings = [""];
|
|
76616
|
-
_stringMap = new Map(); // original value -> SID
|
|
76617
|
-
_schemas = [];
|
|
76618
|
-
_classes = [];
|
|
76619
|
-
_classMixins = [];
|
|
76620
|
-
_propDefs = [];
|
|
76621
|
-
_propertyRefs = [];
|
|
76622
|
-
_relConstraints = [];
|
|
76623
|
-
_constraintClassRefs = [];
|
|
76624
|
-
_enumerations = [];
|
|
76625
|
-
_enumerators = [];
|
|
76626
|
-
_koqs = [];
|
|
76627
|
-
_propCategories = [];
|
|
76628
|
-
// For PropertyDef dedup
|
|
76629
|
-
_propDefMap = new Map(); // signature string -> defIdx
|
|
76630
|
-
/** Intern a string, returning its SID. Empty/undefined strings return 0.
|
|
76631
|
-
* Interning is case-sensitive - "MyLabel" and "MYLABEL" get distinct SIDs.
|
|
76632
|
-
* The `lowerStrings` array provides case-insensitive lookup without mutating display values.
|
|
76633
|
-
*/
|
|
76634
|
-
internString(value) {
|
|
76635
|
-
if (value === undefined || value === "")
|
|
76636
|
-
return 0;
|
|
76637
|
-
const existing = this._stringMap.get(value);
|
|
76638
|
-
if (existing !== undefined)
|
|
76639
|
-
return existing;
|
|
76640
|
-
const sid = this._strings.length;
|
|
76641
|
-
this._strings.push(value);
|
|
76642
|
-
this._lowerStrings.push(value.toLowerCase());
|
|
76643
|
-
this._stringMap.set(value, sid);
|
|
76644
|
-
return sid;
|
|
76645
|
-
}
|
|
76646
|
-
/** Add a schema. Returns its index. */
|
|
76647
|
-
addSchema(data) {
|
|
76648
|
-
const idx = this._schemas.length;
|
|
76649
|
-
this._schemas.push(data);
|
|
76650
|
-
return idx;
|
|
76651
|
-
}
|
|
76652
|
-
/** Add a class. Returns its index. Must be called after the owning schema. */
|
|
76653
|
-
addClass(data) {
|
|
76654
|
-
const idx = this._classes.length;
|
|
76655
|
-
this._classes.push(data);
|
|
76656
|
-
return idx;
|
|
76657
|
-
}
|
|
76658
|
-
/** Add a property definition with deduplication. Returns the def index (possibly existing). */
|
|
76659
|
-
addPropertyDef(data) {
|
|
76660
|
-
const sig = this._propDefSignature(data);
|
|
76661
|
-
const existing = this._propDefMap.get(sig);
|
|
76662
|
-
if (existing !== undefined)
|
|
76663
|
-
return existing;
|
|
76664
|
-
const idx = this._propDefs.length;
|
|
76665
|
-
this._propDefs.push(data);
|
|
76666
|
-
this._propDefMap.set(sig, idx);
|
|
76667
|
-
return idx;
|
|
76668
|
-
}
|
|
76669
|
-
/** Append a property reference to the flat refs array. */
|
|
76670
|
-
addPropertyRef(ref) {
|
|
76671
|
-
this._propertyRefs.push(ref);
|
|
76672
|
-
}
|
|
76673
|
-
/** Add an enumeration. Returns its index. */
|
|
76674
|
-
addEnumeration(data) {
|
|
76675
|
-
const idx = this._enumerations.length;
|
|
76676
|
-
this._enumerations.push(data);
|
|
76677
|
-
return idx;
|
|
76678
|
-
}
|
|
76679
|
-
/** Append an enumerator to the flat enumerators array. */
|
|
76680
|
-
addEnumerator(data) {
|
|
76681
|
-
this._enumerators.push(data);
|
|
76682
|
-
}
|
|
76683
|
-
/** Add a KindOfQuantity. Returns its index. */
|
|
76684
|
-
addKoq(data) {
|
|
76685
|
-
const idx = this._koqs.length;
|
|
76686
|
-
this._koqs.push(data);
|
|
76687
|
-
return idx;
|
|
76688
|
-
}
|
|
76689
|
-
/** Add a PropertyCategory. Returns its index. */
|
|
76690
|
-
addPropertyCategory(data) {
|
|
76691
|
-
const idx = this._propCategories.length;
|
|
76692
|
-
this._propCategories.push(data);
|
|
76693
|
-
return idx;
|
|
76694
|
-
}
|
|
76695
|
-
/** Add a relationship constraint. Returns its index. */
|
|
76696
|
-
addRelConstraint(data) {
|
|
76697
|
-
const idx = this._relConstraints.length;
|
|
76698
|
-
this._relConstraints.push(data);
|
|
76699
|
-
return idx;
|
|
76700
|
-
}
|
|
76701
|
-
/** Append a constraint class reference to the flat array. */
|
|
76702
|
-
addConstraintClassRef(classIdx) {
|
|
76703
|
-
this._constraintClassRefs.push(classIdx);
|
|
76704
|
-
}
|
|
76705
|
-
/** Append a mixin class reference to the flat array. */
|
|
76706
|
-
addClassMixin(classIdx) {
|
|
76707
|
-
this._classMixins.push(classIdx);
|
|
76708
|
-
}
|
|
76709
|
-
/** The current count of property refs (used to set ownPropStart on ClassData). */
|
|
76710
|
-
get propertyRefCount() { return this._propertyRefs.length; }
|
|
76711
|
-
/** The current count of enumerators (used to set enumeratorStart on EnumerationData). */
|
|
76712
|
-
get enumeratorCount() { return this._enumerators.length; }
|
|
76713
|
-
/** The current count of constraint class refs (used to set classRefStart). */
|
|
76714
|
-
get constraintClassRefCount() { return this._constraintClassRefs.length; }
|
|
76715
|
-
/** The current count of class mixins (used to set mixinStartIdx). */
|
|
76716
|
-
get classMixinCount() { return this._classMixins.length; }
|
|
76717
|
-
/** Get a string by SID. @internal */
|
|
76718
|
-
getString(sid) { return this._strings[sid]; }
|
|
76719
|
-
/** Replace class data at the given index (used during deferred cross-ref resolution). @internal */
|
|
76720
|
-
updateClass(classIdx, data) { this._classes[classIdx] = data; }
|
|
76721
|
-
/** Update range fields on a schema (used after all items for a schema are collected). @internal */
|
|
76722
|
-
updateSchemaRanges(schemaIdx, ranges) {
|
|
76723
|
-
const s = this._schemas[schemaIdx];
|
|
76724
|
-
this._schemas[schemaIdx] = { ...s, ...ranges };
|
|
76725
|
-
}
|
|
76726
|
-
/** Freeze all data and produce an immutable SchemaView. */
|
|
76727
|
-
build(schemaToken) {
|
|
76728
|
-
const schemaByName = new Map();
|
|
76729
|
-
const schemaByAlias = new Map();
|
|
76730
|
-
const classByName = new Map();
|
|
76731
|
-
const enumByName = new Map();
|
|
76732
|
-
const koqByName = new Map();
|
|
76733
|
-
const catByName = new Map();
|
|
76734
|
-
// Build schema lookup maps
|
|
76735
|
-
for (let i = 0; i < this._schemas.length; i++) {
|
|
76736
|
-
const s = this._schemas[i];
|
|
76737
|
-
schemaByName.set(this._lowerStrings[s.nameStringIdx], i);
|
|
76738
|
-
if (s.aliasStringIdx !== 0)
|
|
76739
|
-
schemaByAlias.set(this._lowerStrings[s.aliasStringIdx], i);
|
|
76740
|
-
// Build class-by-name map for this schema
|
|
76741
|
-
const classMap = new Map();
|
|
76742
|
-
for (let c = s.classRangeStart; c < s.classRangeStart + s.classCount; c++)
|
|
76743
|
-
classMap.set(this._lowerStrings[this._classes[c].nameStringIdx], c);
|
|
76744
|
-
classByName.set(i, classMap);
|
|
76745
|
-
// Build enum-by-name map for this schema
|
|
76746
|
-
const eMap = new Map();
|
|
76747
|
-
for (let e = s.enumRangeStart; e < s.enumRangeStart + s.enumCount; e++)
|
|
76748
|
-
eMap.set(this._lowerStrings[this._enumerations[e].nameStringIdx], e);
|
|
76749
|
-
enumByName.set(i, eMap);
|
|
76750
|
-
// Build koq-by-name map for this schema
|
|
76751
|
-
const kMap = new Map();
|
|
76752
|
-
for (let k = s.koqRangeStart; k < s.koqRangeStart + s.koqCount; k++)
|
|
76753
|
-
kMap.set(this._lowerStrings[this._koqs[k].nameStringIdx], k);
|
|
76754
|
-
koqByName.set(i, kMap);
|
|
76755
|
-
// Build category-by-name map for this schema
|
|
76756
|
-
const cMap = new Map();
|
|
76757
|
-
for (let p = s.catRangeStart; p < s.catRangeStart + s.catCount; p++)
|
|
76758
|
-
cMap.set(this._lowerStrings[this._propCategories[p].nameStringIdx], p);
|
|
76759
|
-
catByName.set(i, cMap);
|
|
76760
|
-
}
|
|
76761
|
-
return new SchemaView({
|
|
76762
|
-
strings: this._strings,
|
|
76763
|
-
lowerStrings: this._lowerStrings,
|
|
76764
|
-
schemas: this._schemas,
|
|
76765
|
-
classes: this._classes,
|
|
76766
|
-
classMixins: this._classMixins,
|
|
76767
|
-
propDefs: this._propDefs,
|
|
76768
|
-
propertyRefs: this._propertyRefs,
|
|
76769
|
-
relConstraints: this._relConstraints,
|
|
76770
|
-
constraintClassRefs: this._constraintClassRefs,
|
|
76771
|
-
enumerations: this._enumerations,
|
|
76772
|
-
enumerators: this._enumerators,
|
|
76773
|
-
koqs: this._koqs,
|
|
76774
|
-
propCategories: this._propCategories,
|
|
76775
|
-
schemaByName,
|
|
76776
|
-
schemaByAlias,
|
|
76777
|
-
classByName,
|
|
76778
|
-
enumByName,
|
|
76779
|
-
koqByName,
|
|
76780
|
-
catByName,
|
|
76781
|
-
}, schemaToken);
|
|
76782
|
-
}
|
|
76783
|
-
/** Produce a dedup signature for a PropertyDef. Label and priority are excluded because
|
|
76784
|
-
* they are per-PropertyRef overrides, not part of the structural definition.
|
|
76785
|
-
* Uses SIDs (not lowercase strings) for name/description so that case-preserving names
|
|
76786
|
-
* stay distinct - matching the C++ writer's dedup behavior. */
|
|
76787
|
-
_propDefSignature(def) {
|
|
76788
|
-
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}`;
|
|
76789
|
-
}
|
|
76790
|
-
}
|
|
76791
76766
|
|
|
76792
76767
|
|
|
76793
76768
|
/***/ },
|
|
76794
76769
|
|
|
76795
|
-
/***/ "../../core/ecschema-metadata/lib/esm/SchemaViewBinaryReader.js"
|
|
76796
|
-
|
|
76797
|
-
!*** ../../core/ecschema-metadata/lib/esm/SchemaViewBinaryReader.js ***!
|
|
76798
|
-
|
|
76770
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBinaryReader.js"
|
|
76771
|
+
/*!*********************************************************************************!*\
|
|
76772
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBinaryReader.js ***!
|
|
76773
|
+
\*********************************************************************************/
|
|
76799
76774
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
76800
76775
|
|
|
76801
76776
|
"use strict";
|
|
76802
76777
|
__webpack_require__.r(__webpack_exports__);
|
|
76803
76778
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
76779
|
+
/* harmony export */ SchemaViewMergeContext: () => (/* binding */ SchemaViewMergeContext),
|
|
76804
76780
|
/* harmony export */ parseSchemaViewBlob: () => (/* binding */ parseSchemaViewBlob)
|
|
76805
76781
|
/* harmony export */ });
|
|
76806
76782
|
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
76807
|
-
/* harmony import */ var
|
|
76808
|
-
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*!
|
|
76809
|
-
/* harmony import */ var _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SchemaViewInterfaces */ "../../core/ecschema-metadata/lib/esm/SchemaViewInterfaces.js");
|
|
76783
|
+
/* harmony import */ var _SchemaViewBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SchemaViewBuilder */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBuilder.js");
|
|
76784
|
+
/* harmony import */ var _ECObjects__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ECObjects */ "../../core/ecschema-metadata/lib/esm/ECObjects.js");
|
|
76785
|
+
/* harmony import */ var _SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SchemaViewInterfaces */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewInterfaces.js");
|
|
76810
76786
|
/*---------------------------------------------------------------------------------------------
|
|
76811
76787
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
76812
76788
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -76907,7 +76883,34 @@ function expectTag(reader, expected) {
|
|
|
76907
76883
|
if (tag !== expected)
|
|
76908
76884
|
throw new Error(`Expected tag 0x${expected.toString(16)} but found 0x${tag.toString(16)} at offset ${reader.pos - 1}`);
|
|
76909
76885
|
}
|
|
76910
|
-
/**
|
|
76886
|
+
/** Reusable parse/merge context for SchemaView blobs. Holds the live `SchemaViewBuilder` plus the
|
|
76887
|
+
* cross-reference maps that must persist across fragment merges. Each `mergeBlob` appends one blob's
|
|
76888
|
+
* schemas into the shared builder and resolves cross-references - including cross-fragment ones -
|
|
76889
|
+
* against the accumulated maps. A whole-iModel blob is the degenerate case of a single fragment.
|
|
76890
|
+
* @note Fragments must be merged in dependency order, so a fragment only references schemas already
|
|
76891
|
+
* merged by an earlier one (or excluded schemas, which resolve to "not present").
|
|
76892
|
+
* @internal
|
|
76893
|
+
*/
|
|
76894
|
+
class SchemaViewMergeContext {
|
|
76895
|
+
builder = new _SchemaViewBuilder__WEBPACK_IMPORTED_MODULE_1__.SchemaViewBuilder();
|
|
76896
|
+
// Cross-reference maps. Persist across fragments: a row id / name from a later fragment resolves
|
|
76897
|
+
// against a class, enum, koq, or category merged by an earlier fragment.
|
|
76898
|
+
schemaECIdToIdx = new Map();
|
|
76899
|
+
enumRowIdToIdx = new Map();
|
|
76900
|
+
koqRowIdToIdx = new Map();
|
|
76901
|
+
catRowIdToIdx = new Map();
|
|
76902
|
+
classRowIdToIdx = new Map();
|
|
76903
|
+
// "schemaname:classname" (both lowercased) -> global class index. Resolves base/mixin/constraint
|
|
76904
|
+
// refs, which the blob encodes as schema+class name pairs, across fragment boundaries.
|
|
76905
|
+
classResolver = new Map();
|
|
76906
|
+
// global schemaIdx -> schema name, for building resolver keys and dangling-ref diagnostics.
|
|
76907
|
+
schemaNames = [];
|
|
76908
|
+
/** Parse one fragment blob and append its schemas into the shared builder. Synchronous. */
|
|
76909
|
+
mergeBlob(data) {
|
|
76910
|
+
mergeFragmentBlob(this, data);
|
|
76911
|
+
}
|
|
76912
|
+
}
|
|
76913
|
+
/** Parse a schema view blob (binary format) into a fresh `SchemaView`.
|
|
76911
76914
|
*
|
|
76912
76915
|
* Layout: Header, PropertyDefTable, SchemaTable, EnumTable, KoQTable, PropCatTable, ClassTable, StringTable.
|
|
76913
76916
|
* Each table is count-prefixed. Schema items carry their schema's ecInstanceId for ownership resolution.
|
|
@@ -76918,6 +76921,16 @@ function expectTag(reader, expected) {
|
|
|
76918
76921
|
* @internal
|
|
76919
76922
|
*/
|
|
76920
76923
|
function parseSchemaViewBlob(data, schemaToken) {
|
|
76924
|
+
const ctx = new SchemaViewMergeContext();
|
|
76925
|
+
ctx.mergeBlob(data);
|
|
76926
|
+
return ctx.builder.build(schemaToken);
|
|
76927
|
+
}
|
|
76928
|
+
/** Parse one fragment blob and append it into the context's builder, resolving cross-references
|
|
76929
|
+
* against the context's accumulated global maps. Per-fragment scratch state stays local; everything
|
|
76930
|
+
* that must outlive the fragment lives on `ctx`.
|
|
76931
|
+
*/
|
|
76932
|
+
function mergeFragmentBlob(ctx, data) {
|
|
76933
|
+
const builder = ctx.builder;
|
|
76921
76934
|
const reader = new BinaryReader(data);
|
|
76922
76935
|
// Header: magic(4) + version(1) + stringTableOffset(4)
|
|
76923
76936
|
const magic = reader.readU32();
|
|
@@ -76928,16 +76941,10 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
76928
76941
|
throw new Error(`Unsupported schema view format version: ${version}, expected ${_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_3__.schemaViewFormatVersion}`);
|
|
76929
76942
|
const stOffset = reader.readU32();
|
|
76930
76943
|
reader.parseStringTable(stOffset);
|
|
76931
|
-
|
|
76932
|
-
|
|
76933
|
-
const schemaEcIdToIdx =
|
|
76934
|
-
|
|
76935
|
-
const koqRowIdToIdx = new Map();
|
|
76936
|
-
const catRowIdToIdx = new Map();
|
|
76937
|
-
const classRowIdToIdx = new Map();
|
|
76938
|
-
// Per-schema metadata for name-based class resolution
|
|
76939
|
-
const schemaInfos = [];
|
|
76940
|
-
// Per-schema item range tracking (indexed by schemaIdx)
|
|
76944
|
+
// Global index of the first schema this fragment adds. Local schema index = global - base.
|
|
76945
|
+
const schemaBaseIdx = builder.schemaCount;
|
|
76946
|
+
const { schemaECIdToIdx: schemaEcIdToIdx, enumRowIdToIdx, koqRowIdToIdx, catRowIdToIdx, classRowIdToIdx, classResolver } = ctx;
|
|
76947
|
+
// Per-schema item range tracking, indexed by LOCAL schema index (0-based within this fragment).
|
|
76941
76948
|
const schemaEnumStarts = [];
|
|
76942
76949
|
const schemaEnumCounts = [];
|
|
76943
76950
|
const schemaKoqStarts = [];
|
|
@@ -76946,14 +76953,14 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
76946
76953
|
const schemaCatCounts = [];
|
|
76947
76954
|
const schemaClassStarts = [];
|
|
76948
76955
|
const schemaClassCounts = [];
|
|
76949
|
-
// Deferred class data for cross-reference resolution
|
|
76956
|
+
// Deferred class data for cross-reference resolution (local to this fragment).
|
|
76950
76957
|
const pendingClasses = [];
|
|
76951
76958
|
// ---- PropertyDefTable ----
|
|
76952
76959
|
expectTag(reader, Tag.PropertyDefTable);
|
|
76953
76960
|
const defCount = reader.readU32();
|
|
76954
|
-
// Each PreParsedDef
|
|
76955
|
-
//
|
|
76956
|
-
reader.validateCount(defCount,
|
|
76961
|
+
// Each PreParsedDef is a fixed 46 bytes (10x u32 + 1x u16 + 4x u8). The bound is deliberately
|
|
76962
|
+
// about half that, so a valid blob never trips the check.
|
|
76963
|
+
reader.validateCount(defCount, 23, "PropertyDefTable");
|
|
76957
76964
|
const preParsedDefs = new Array(defCount);
|
|
76958
76965
|
for (let i = 0; i < defCount; i++) {
|
|
76959
76966
|
preParsedDefs[i] = {
|
|
@@ -76977,7 +76984,8 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
76977
76984
|
// ---- SchemaTable ----
|
|
76978
76985
|
expectTag(reader, Tag.SchemaTable);
|
|
76979
76986
|
const schemaCount = reader.readU32();
|
|
76980
|
-
|
|
76987
|
+
// Fixed 27 bytes per record (4x SRef + 3x u16 + u32 + u8).
|
|
76988
|
+
reader.validateCount(schemaCount, 13, "SchemaTable");
|
|
76981
76989
|
for (let i = 0; i < schemaCount; i++) {
|
|
76982
76990
|
const name = reader.readSRef();
|
|
76983
76991
|
const vRead = reader.readU16();
|
|
@@ -77004,7 +77012,7 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77004
77012
|
isHidden,
|
|
77005
77013
|
});
|
|
77006
77014
|
schemaEcIdToIdx.set(ecInstanceId, schemaIdx);
|
|
77007
|
-
|
|
77015
|
+
ctx.schemaNames[schemaIdx] = name;
|
|
77008
77016
|
schemaEnumStarts.push(0);
|
|
77009
77017
|
schemaEnumCounts.push(0);
|
|
77010
77018
|
schemaKoqStarts.push(0);
|
|
@@ -77014,25 +77022,31 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77014
77022
|
schemaClassStarts.push(0);
|
|
77015
77023
|
schemaClassCounts.push(0);
|
|
77016
77024
|
}
|
|
77017
|
-
/** Track an item's schema ownership and update range counters.
|
|
77025
|
+
/** Track an item's schema ownership and update its owning schema's range counters. `globalIdx`
|
|
77026
|
+
* is the item's global index in the builder; `starts`/`counts` are indexed by LOCAL schema index.
|
|
77027
|
+
* An item must be owned by a schema in its own fragment, so a foreign owner is a malformed blob. */
|
|
77018
77028
|
function trackItem(schemaEcId, globalIdx, starts, counts) {
|
|
77019
77029
|
const schemaIdx = schemaEcIdToIdx.get(schemaEcId);
|
|
77020
77030
|
if (schemaIdx === undefined)
|
|
77021
77031
|
throw new Error(`SchemaView blob: unknown schema ecInstanceId ${schemaEcId}`);
|
|
77022
|
-
|
|
77023
|
-
|
|
77024
|
-
|
|
77032
|
+
const localIdx = schemaIdx - schemaBaseIdx;
|
|
77033
|
+
if (localIdx < 0 || localIdx >= schemaCount)
|
|
77034
|
+
throw new Error(`SchemaView fragment: item references schema ecInstanceId ${schemaEcId} not present in this fragment`);
|
|
77035
|
+
if (counts[localIdx] === 0)
|
|
77036
|
+
starts[localIdx] = globalIdx;
|
|
77037
|
+
counts[localIdx]++;
|
|
77025
77038
|
return schemaIdx;
|
|
77026
77039
|
}
|
|
77027
77040
|
// ---- EnumTable ----
|
|
77028
77041
|
expectTag(reader, Tag.EnumTable);
|
|
77029
77042
|
const enumTotalCount = reader.readU32();
|
|
77030
|
-
|
|
77043
|
+
// Fixed 27 bytes per record (4x SRef + 2x u32 + u16 + u8); enumerators live inside a JSON SRef.
|
|
77044
|
+
reader.validateCount(enumTotalCount, 13, "EnumTable");
|
|
77031
77045
|
for (let i = 0; i < enumTotalCount; i++) {
|
|
77032
77046
|
const schemaEcId = reader.readU32();
|
|
77033
|
-
const schemaIdx = trackItem(schemaEcId,
|
|
77047
|
+
const schemaIdx = trackItem(schemaEcId, builder.enumerationCount, schemaEnumStarts, schemaEnumCounts);
|
|
77034
77048
|
const eName = reader.readSRef();
|
|
77035
|
-
const ePrimType = reader.
|
|
77049
|
+
const ePrimType = reader.readU16();
|
|
77036
77050
|
const eIsStrict = reader.readU8() !== 0;
|
|
77037
77051
|
const eLabel = reader.readSRef();
|
|
77038
77052
|
const eDesc = reader.readSRef();
|
|
@@ -77076,10 +77090,11 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77076
77090
|
// ---- KoQTable ----
|
|
77077
77091
|
expectTag(reader, Tag.KoQTable);
|
|
77078
77092
|
const koqTotalCount = reader.readU32();
|
|
77079
|
-
|
|
77093
|
+
// Fixed 36 bytes per record (6x SRef + f64 + u32).
|
|
77094
|
+
reader.validateCount(koqTotalCount, 18, "KoQTable");
|
|
77080
77095
|
for (let i = 0; i < koqTotalCount; i++) {
|
|
77081
77096
|
const schemaEcId = reader.readU32();
|
|
77082
|
-
const schemaIdx = trackItem(schemaEcId,
|
|
77097
|
+
const schemaIdx = trackItem(schemaEcId, builder.koqCount, schemaKoqStarts, schemaKoqCounts);
|
|
77083
77098
|
const kName = reader.readSRef();
|
|
77084
77099
|
const kLabel = reader.readSRef();
|
|
77085
77100
|
const kDesc = reader.readSRef();
|
|
@@ -77102,10 +77117,11 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77102
77117
|
// ---- PropCatTable ----
|
|
77103
77118
|
expectTag(reader, Tag.PropCatTable);
|
|
77104
77119
|
const catTotalCount = reader.readU32();
|
|
77105
|
-
|
|
77120
|
+
// Fixed 24 bytes per record (4x SRef + i32 + u32).
|
|
77121
|
+
reader.validateCount(catTotalCount, 12, "PropCatTable");
|
|
77106
77122
|
for (let i = 0; i < catTotalCount; i++) {
|
|
77107
77123
|
const schemaEcId = reader.readU32();
|
|
77108
|
-
const schemaIdx = trackItem(schemaEcId,
|
|
77124
|
+
const schemaIdx = trackItem(schemaEcId, builder.propCategoryCount, schemaCatStarts, schemaCatCounts);
|
|
77109
77125
|
const pcName = reader.readSRef();
|
|
77110
77126
|
const pcLabel = reader.readSRef();
|
|
77111
77127
|
const pcDesc = reader.readSRef();
|
|
@@ -77124,11 +77140,13 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77124
77140
|
// ---- ClassTable ----
|
|
77125
77141
|
expectTag(reader, Tag.ClassTable);
|
|
77126
77142
|
const classTotalCount = reader.readU32();
|
|
77127
|
-
|
|
77143
|
+
// Minimum 27 bytes per record (3x SRef + 3x u8 + u32 + 2x u16 count prefixes); records grow with
|
|
77144
|
+
// relationship strength/direction and the base-class, prop-ref, and constraint sub-lists.
|
|
77145
|
+
reader.validateCount(classTotalCount, 13, "ClassTable");
|
|
77128
77146
|
for (let i = 0; i < classTotalCount; i++) {
|
|
77129
77147
|
const schemaEcId = reader.readU32();
|
|
77130
|
-
const schemaIdx = trackItem(schemaEcId,
|
|
77131
|
-
const
|
|
77148
|
+
const schemaIdx = trackItem(schemaEcId, builder.classCount, schemaClassStarts, schemaClassCounts);
|
|
77149
|
+
const schemaName = ctx.schemaNames[schemaIdx];
|
|
77132
77150
|
const cName = reader.readSRef();
|
|
77133
77151
|
const cType = reader.readU8();
|
|
77134
77152
|
const cModifier = reader.readU8();
|
|
@@ -77218,7 +77236,7 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77218
77236
|
targetConstraintIdx: -1,
|
|
77219
77237
|
isHidden: cIsHidden,
|
|
77220
77238
|
});
|
|
77221
|
-
|
|
77239
|
+
classResolver.set(`${schemaName.toLowerCase()}:${cName.toLowerCase()}`, classIdx);
|
|
77222
77240
|
classRowIdToIdx.set(cEcInstanceId, classIdx);
|
|
77223
77241
|
pendingClasses.push({
|
|
77224
77242
|
schemaIdx,
|
|
@@ -77234,13 +77252,14 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77234
77252
|
baseClasses,
|
|
77235
77253
|
propRefs,
|
|
77236
77254
|
constraints,
|
|
77237
|
-
schemaName
|
|
77255
|
+
schemaName,
|
|
77238
77256
|
isHidden: cIsHidden,
|
|
77239
77257
|
});
|
|
77240
77258
|
}
|
|
77241
77259
|
// ---- Finalize per-schema item ranges ----
|
|
77260
|
+
// Local index i maps to global schema index schemaBaseIdx + i; range starts are already global.
|
|
77242
77261
|
for (let i = 0; i < schemaCount; i++) {
|
|
77243
|
-
builder.updateSchemaRanges(i, {
|
|
77262
|
+
builder.updateSchemaRanges(schemaBaseIdx + i, {
|
|
77244
77263
|
classRangeStart: schemaClassStarts[i] ?? 0,
|
|
77245
77264
|
classCount: schemaClassCounts[i] ?? 0,
|
|
77246
77265
|
enumRangeStart: schemaEnumStarts[i] ?? 0,
|
|
@@ -77251,12 +77270,6 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77251
77270
|
catCount: schemaCatCounts[i] ?? 0,
|
|
77252
77271
|
});
|
|
77253
77272
|
}
|
|
77254
|
-
// Build a global name resolver: "SchemaName:ClassName" -> classIdx
|
|
77255
|
-
const classResolver = new Map();
|
|
77256
|
-
for (const s of schemaInfos) {
|
|
77257
|
-
for (const [lowerName, idx] of s.classNameToIdx)
|
|
77258
|
-
classResolver.set(`${s.name.toLowerCase()}:${lowerName}`, idx);
|
|
77259
|
-
}
|
|
77260
77273
|
// Resolve pre-parsed defs to PropertyDef objects. Maps preParsedDef index -> builder defIdx.
|
|
77261
77274
|
const danglingRefs = [];
|
|
77262
77275
|
const resolvedDefMap = new Map();
|
|
@@ -77411,16 +77424,259 @@ function parseSchemaViewBlob(data, schemaToken) {
|
|
|
77411
77424
|
const lines = danglingRefs.length <= cap ? danglingRefs : [...danglingRefs.slice(0, cap), `... and ${danglingRefs.length - cap} more`];
|
|
77412
77425
|
_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 ")}`);
|
|
77413
77426
|
}
|
|
77414
|
-
|
|
77427
|
+
// Bring the builder's lookup maps up to date for the schemas this fragment added. Their item
|
|
77428
|
+
// ranges were finalized above, so the per-schema name maps build correctly.
|
|
77429
|
+
builder.extendLookupMaps();
|
|
77415
77430
|
}
|
|
77416
77431
|
|
|
77417
77432
|
|
|
77418
77433
|
/***/ },
|
|
77419
77434
|
|
|
77420
|
-
/***/ "../../core/ecschema-metadata/lib/esm/
|
|
77421
|
-
|
|
77422
|
-
!*** ../../core/ecschema-metadata/lib/esm/
|
|
77423
|
-
|
|
77435
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBuilder.js"
|
|
77436
|
+
/*!****************************************************************************!*\
|
|
77437
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBuilder.js ***!
|
|
77438
|
+
\****************************************************************************/
|
|
77439
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
77440
|
+
|
|
77441
|
+
"use strict";
|
|
77442
|
+
__webpack_require__.r(__webpack_exports__);
|
|
77443
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
77444
|
+
/* harmony export */ SchemaViewBuilder: () => (/* binding */ SchemaViewBuilder)
|
|
77445
|
+
/* harmony export */ });
|
|
77446
|
+
/* harmony import */ var _SchemaView__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SchemaView */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaView.js");
|
|
77447
|
+
/*---------------------------------------------------------------------------------------------
|
|
77448
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
77449
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
77450
|
+
*--------------------------------------------------------------------------------------------*/
|
|
77451
|
+
/** @packageDocumentation
|
|
77452
|
+
* @module Schema
|
|
77453
|
+
*/
|
|
77454
|
+
|
|
77455
|
+
/** Builder for constructing an immutable `SchemaView`.
|
|
77456
|
+
*
|
|
77457
|
+
* Collects data during binary blob parsing, then freezes it into a view.
|
|
77458
|
+
* Handles string interning and property definition deduplication.
|
|
77459
|
+
*
|
|
77460
|
+
* Consumers should not use this directly - read views via `IModelDb.getSchemaView`
|
|
77461
|
+
* / `IModelConnection.getSchemaView` (or `SchemaView.fromBinary` if you have a raw blob).
|
|
77462
|
+
* @internal
|
|
77463
|
+
*/
|
|
77464
|
+
class SchemaViewBuilder {
|
|
77465
|
+
_strings = [""]; // SID 0 = empty string
|
|
77466
|
+
_lowerStrings = [""];
|
|
77467
|
+
_stringMap = new Map(); // original value -> SID
|
|
77468
|
+
_schemas = [];
|
|
77469
|
+
_classes = [];
|
|
77470
|
+
_classMixins = [];
|
|
77471
|
+
_propDefs = [];
|
|
77472
|
+
_propertyRefs = [];
|
|
77473
|
+
_relConstraints = [];
|
|
77474
|
+
_constraintClassRefs = [];
|
|
77475
|
+
_enumerations = [];
|
|
77476
|
+
_enumerators = [];
|
|
77477
|
+
_koqs = [];
|
|
77478
|
+
_propCategories = [];
|
|
77479
|
+
// For PropertyDef dedup
|
|
77480
|
+
_propDefMap = new Map(); // signature string -> defIdx
|
|
77481
|
+
// Lookup maps - owned by the builder so a husk can share and extend them across fragment merges.
|
|
77482
|
+
// `build()` and each merge call `extendLookupMaps()`; the view receives these same Map objects
|
|
77483
|
+
// via `assembleData()`, so in-place growth is visible.
|
|
77484
|
+
_schemaByName = new Map();
|
|
77485
|
+
_schemaByAlias = new Map();
|
|
77486
|
+
_classByName = new Map();
|
|
77487
|
+
_enumByName = new Map();
|
|
77488
|
+
_koqByName = new Map();
|
|
77489
|
+
_catByName = new Map();
|
|
77490
|
+
_lookupMapsBuiltUpto = 0; // number of schemas whose lookup entries are already built
|
|
77491
|
+
/** Intern a string, returning its SID. Empty/undefined strings return 0.
|
|
77492
|
+
* Interning is case-sensitive - "MyLabel" and "MYLABEL" get distinct SIDs.
|
|
77493
|
+
* The `lowerStrings` array provides case-insensitive lookup without mutating display values.
|
|
77494
|
+
*/
|
|
77495
|
+
internString(value) {
|
|
77496
|
+
if (value === undefined || value === "")
|
|
77497
|
+
return 0;
|
|
77498
|
+
const existing = this._stringMap.get(value);
|
|
77499
|
+
if (existing !== undefined)
|
|
77500
|
+
return existing;
|
|
77501
|
+
const sid = this._strings.length;
|
|
77502
|
+
this._strings.push(value);
|
|
77503
|
+
this._lowerStrings.push(value.toLowerCase());
|
|
77504
|
+
this._stringMap.set(value, sid);
|
|
77505
|
+
return sid;
|
|
77506
|
+
}
|
|
77507
|
+
/** Add a schema. Returns its index. */
|
|
77508
|
+
addSchema(data) {
|
|
77509
|
+
const idx = this._schemas.length;
|
|
77510
|
+
this._schemas.push(data);
|
|
77511
|
+
return idx;
|
|
77512
|
+
}
|
|
77513
|
+
/** Add a class. Returns its index. Must be called after the owning schema. */
|
|
77514
|
+
addClass(data) {
|
|
77515
|
+
const idx = this._classes.length;
|
|
77516
|
+
this._classes.push(data);
|
|
77517
|
+
return idx;
|
|
77518
|
+
}
|
|
77519
|
+
/** Add a property definition with deduplication. Returns the def index (possibly existing). */
|
|
77520
|
+
addPropertyDef(data) {
|
|
77521
|
+
const sig = this._propDefSignature(data);
|
|
77522
|
+
const existing = this._propDefMap.get(sig);
|
|
77523
|
+
if (existing !== undefined)
|
|
77524
|
+
return existing;
|
|
77525
|
+
const idx = this._propDefs.length;
|
|
77526
|
+
this._propDefs.push(data);
|
|
77527
|
+
this._propDefMap.set(sig, idx);
|
|
77528
|
+
return idx;
|
|
77529
|
+
}
|
|
77530
|
+
/** Append a property reference to the flat refs array. */
|
|
77531
|
+
addPropertyRef(ref) {
|
|
77532
|
+
this._propertyRefs.push(ref);
|
|
77533
|
+
}
|
|
77534
|
+
/** Add an enumeration. Returns its index. */
|
|
77535
|
+
addEnumeration(data) {
|
|
77536
|
+
const idx = this._enumerations.length;
|
|
77537
|
+
this._enumerations.push(data);
|
|
77538
|
+
return idx;
|
|
77539
|
+
}
|
|
77540
|
+
/** Append an enumerator to the flat enumerators array. */
|
|
77541
|
+
addEnumerator(data) {
|
|
77542
|
+
this._enumerators.push(data);
|
|
77543
|
+
}
|
|
77544
|
+
/** Add a KindOfQuantity. Returns its index. */
|
|
77545
|
+
addKoq(data) {
|
|
77546
|
+
const idx = this._koqs.length;
|
|
77547
|
+
this._koqs.push(data);
|
|
77548
|
+
return idx;
|
|
77549
|
+
}
|
|
77550
|
+
/** Add a PropertyCategory. Returns its index. */
|
|
77551
|
+
addPropertyCategory(data) {
|
|
77552
|
+
const idx = this._propCategories.length;
|
|
77553
|
+
this._propCategories.push(data);
|
|
77554
|
+
return idx;
|
|
77555
|
+
}
|
|
77556
|
+
/** Add a relationship constraint. Returns its index. */
|
|
77557
|
+
addRelConstraint(data) {
|
|
77558
|
+
const idx = this._relConstraints.length;
|
|
77559
|
+
this._relConstraints.push(data);
|
|
77560
|
+
return idx;
|
|
77561
|
+
}
|
|
77562
|
+
/** Append a constraint class reference to the flat array. */
|
|
77563
|
+
addConstraintClassRef(classIdx) {
|
|
77564
|
+
this._constraintClassRefs.push(classIdx);
|
|
77565
|
+
}
|
|
77566
|
+
/** Append a mixin class reference to the flat array. */
|
|
77567
|
+
addClassMixin(classIdx) {
|
|
77568
|
+
this._classMixins.push(classIdx);
|
|
77569
|
+
}
|
|
77570
|
+
/** The current count of property refs (used to set ownPropStart on ClassData). */
|
|
77571
|
+
get propertyRefCount() { return this._propertyRefs.length; }
|
|
77572
|
+
/** The current count of enumerators (used to set enumeratorStart on EnumerationData). */
|
|
77573
|
+
get enumeratorCount() { return this._enumerators.length; }
|
|
77574
|
+
/** The current count of constraint class refs (used to set classRefStart). */
|
|
77575
|
+
get constraintClassRefCount() { return this._constraintClassRefs.length; }
|
|
77576
|
+
/** The current count of class mixins (used to set mixinStartIdx). */
|
|
77577
|
+
get classMixinCount() { return this._classMixins.length; }
|
|
77578
|
+
// The counts below are the base indices fragment merging uses to translate a fragment's local
|
|
77579
|
+
// indices into global ones.
|
|
77580
|
+
/** The current count of schemas. @internal */
|
|
77581
|
+
get schemaCount() { return this._schemas.length; }
|
|
77582
|
+
/** The current count of classes. @internal */
|
|
77583
|
+
get classCount() { return this._classes.length; }
|
|
77584
|
+
/** The current count of enumerations. @internal */
|
|
77585
|
+
get enumerationCount() { return this._enumerations.length; }
|
|
77586
|
+
/** The current count of KindOfQuantities. @internal */
|
|
77587
|
+
get koqCount() { return this._koqs.length; }
|
|
77588
|
+
/** The current count of property categories. @internal */
|
|
77589
|
+
get propCategoryCount() { return this._propCategories.length; }
|
|
77590
|
+
/** Get a string by SID. @internal */
|
|
77591
|
+
getString(sid) { return this._strings[sid]; }
|
|
77592
|
+
/** Replace class data at the given index (used during deferred cross-ref resolution). @internal */
|
|
77593
|
+
updateClass(classIdx, data) { this._classes[classIdx] = data; }
|
|
77594
|
+
/** Update range fields on a schema (used after all items for a schema are collected). @internal */
|
|
77595
|
+
updateSchemaRanges(schemaIdx, ranges) {
|
|
77596
|
+
const s = this._schemas[schemaIdx];
|
|
77597
|
+
this._schemas[schemaIdx] = { ...s, ...ranges };
|
|
77598
|
+
}
|
|
77599
|
+
/** Freeze all data and produce an immutable SchemaView. */
|
|
77600
|
+
build(schemaToken) {
|
|
77601
|
+
this.extendLookupMaps();
|
|
77602
|
+
return new _SchemaView__WEBPACK_IMPORTED_MODULE_0__.SchemaView(this.assembleData(), schemaToken);
|
|
77603
|
+
}
|
|
77604
|
+
/** Build lookup-map entries for any schemas added since the last call. Idempotent and
|
|
77605
|
+
* append-only, so it is safe to call after each fragment merge. A schema's item ranges must
|
|
77606
|
+
* already be finalized (via `updateSchemaRanges`) before it is processed.
|
|
77607
|
+
* @internal */
|
|
77608
|
+
extendLookupMaps() {
|
|
77609
|
+
for (let i = this._lookupMapsBuiltUpto; i < this._schemas.length; i++) {
|
|
77610
|
+
const s = this._schemas[i];
|
|
77611
|
+
this._schemaByName.set(this._lowerStrings[s.nameStringIdx], i);
|
|
77612
|
+
if (s.aliasStringIdx !== 0)
|
|
77613
|
+
this._schemaByAlias.set(this._lowerStrings[s.aliasStringIdx], i);
|
|
77614
|
+
// Build class-by-name map for this schema
|
|
77615
|
+
const classMap = new Map();
|
|
77616
|
+
for (let c = s.classRangeStart; c < s.classRangeStart + s.classCount; c++)
|
|
77617
|
+
classMap.set(this._lowerStrings[this._classes[c].nameStringIdx], c);
|
|
77618
|
+
this._classByName.set(i, classMap);
|
|
77619
|
+
// Build enum-by-name map for this schema
|
|
77620
|
+
const eMap = new Map();
|
|
77621
|
+
for (let e = s.enumRangeStart; e < s.enumRangeStart + s.enumCount; e++)
|
|
77622
|
+
eMap.set(this._lowerStrings[this._enumerations[e].nameStringIdx], e);
|
|
77623
|
+
this._enumByName.set(i, eMap);
|
|
77624
|
+
// Build koq-by-name map for this schema
|
|
77625
|
+
const kMap = new Map();
|
|
77626
|
+
for (let k = s.koqRangeStart; k < s.koqRangeStart + s.koqCount; k++)
|
|
77627
|
+
kMap.set(this._lowerStrings[this._koqs[k].nameStringIdx], k);
|
|
77628
|
+
this._koqByName.set(i, kMap);
|
|
77629
|
+
// Build category-by-name map for this schema
|
|
77630
|
+
const cMap = new Map();
|
|
77631
|
+
for (let p = s.catRangeStart; p < s.catRangeStart + s.catCount; p++)
|
|
77632
|
+
cMap.set(this._lowerStrings[this._propCategories[p].nameStringIdx], p);
|
|
77633
|
+
this._catByName.set(i, cMap);
|
|
77634
|
+
}
|
|
77635
|
+
this._lookupMapsBuiltUpto = this._schemas.length;
|
|
77636
|
+
}
|
|
77637
|
+
/** Assemble a {@link SchemaViewData} bag that references this builder's live arrays and lookup
|
|
77638
|
+
* maps. Continued building - fragment merges that append to the arrays and extend the maps in
|
|
77639
|
+
* place - is visible through the shared references, so a husk holding this data sees merged
|
|
77640
|
+
* schemas without rebuilding. @internal */
|
|
77641
|
+
assembleData() {
|
|
77642
|
+
return {
|
|
77643
|
+
strings: this._strings,
|
|
77644
|
+
lowerStrings: this._lowerStrings,
|
|
77645
|
+
schemas: this._schemas,
|
|
77646
|
+
classes: this._classes,
|
|
77647
|
+
classMixins: this._classMixins,
|
|
77648
|
+
propDefs: this._propDefs,
|
|
77649
|
+
propertyRefs: this._propertyRefs,
|
|
77650
|
+
relConstraints: this._relConstraints,
|
|
77651
|
+
constraintClassRefs: this._constraintClassRefs,
|
|
77652
|
+
enumerations: this._enumerations,
|
|
77653
|
+
enumerators: this._enumerators,
|
|
77654
|
+
koqs: this._koqs,
|
|
77655
|
+
propCategories: this._propCategories,
|
|
77656
|
+
schemaByName: this._schemaByName,
|
|
77657
|
+
schemaByAlias: this._schemaByAlias,
|
|
77658
|
+
classByName: this._classByName,
|
|
77659
|
+
enumByName: this._enumByName,
|
|
77660
|
+
koqByName: this._koqByName,
|
|
77661
|
+
catByName: this._catByName,
|
|
77662
|
+
};
|
|
77663
|
+
}
|
|
77664
|
+
/** Produce a dedup signature for a PropertyDef. Label and priority are excluded because
|
|
77665
|
+
* they are per-PropertyRef overrides, not part of the structural definition.
|
|
77666
|
+
* Uses SIDs (not lowercase strings) for name/description so that case-preserving names
|
|
77667
|
+
* stay distinct - matching the C++ writer's dedup behavior. */
|
|
77668
|
+
_propDefSignature(def) {
|
|
77669
|
+
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}`;
|
|
77670
|
+
}
|
|
77671
|
+
}
|
|
77672
|
+
|
|
77673
|
+
|
|
77674
|
+
/***/ },
|
|
77675
|
+
|
|
77676
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewInterfaces.js"
|
|
77677
|
+
/*!*******************************************************************************!*\
|
|
77678
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewInterfaces.js ***!
|
|
77679
|
+
\*******************************************************************************/
|
|
77424
77680
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
77425
77681
|
|
|
77426
77682
|
"use strict";
|
|
@@ -77499,6 +77755,201 @@ var SchemaViewPrimitiveType;
|
|
|
77499
77755
|
})(SchemaViewPrimitiveType || (SchemaViewPrimitiveType = {}));
|
|
77500
77756
|
|
|
77501
77757
|
|
|
77758
|
+
/***/ },
|
|
77759
|
+
|
|
77760
|
+
/***/ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewManager.js"
|
|
77761
|
+
/*!****************************************************************************!*\
|
|
77762
|
+
!*** ../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewManager.js ***!
|
|
77763
|
+
\****************************************************************************/
|
|
77764
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
77765
|
+
|
|
77766
|
+
"use strict";
|
|
77767
|
+
__webpack_require__.r(__webpack_exports__);
|
|
77768
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
77769
|
+
/* harmony export */ SchemaViewManager: () => (/* binding */ SchemaViewManager)
|
|
77770
|
+
/* harmony export */ });
|
|
77771
|
+
/* harmony import */ var _SchemaView__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SchemaView */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaView.js");
|
|
77772
|
+
/*---------------------------------------------------------------------------------------------
|
|
77773
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
77774
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
77775
|
+
*--------------------------------------------------------------------------------------------*/
|
|
77776
|
+
/** @packageDocumentation
|
|
77777
|
+
* @module Schema
|
|
77778
|
+
*/
|
|
77779
|
+
|
|
77780
|
+
/** Owns the lifetime of one iModel's {@link (SchemaView:class)}: lazy loading, incremental (filtered)
|
|
77781
|
+
* hydration, serialization of concurrent requests, and invalidation. Hosts (`IModelDb`,
|
|
77782
|
+
* `IModelConnection`) hold one instance and delegate to it; all data access goes through the
|
|
77783
|
+
* host-implemented {@link SchemaViewDataProvider}.
|
|
77784
|
+
* @internal
|
|
77785
|
+
*/
|
|
77786
|
+
class SchemaViewManager {
|
|
77787
|
+
_dataProvider;
|
|
77788
|
+
/** The single accumulating view, held as a promise so all requests chain onto it and never overlap.
|
|
77789
|
+
* Undefined (or resolving to undefined) means nothing is loaded. */
|
|
77790
|
+
_viewPromise;
|
|
77791
|
+
/** Reference graph for incremental loading; undefined when the view is (or will be) fully loaded. */
|
|
77792
|
+
_manifest;
|
|
77793
|
+
/** Schema-identity token the manifest - and thus every fragment merged under it - belongs to. */
|
|
77794
|
+
_manifestToken;
|
|
77795
|
+
/** Lower-cased names already merged into the view (incremental mode only). */
|
|
77796
|
+
_loadedSchemaNames = new Set();
|
|
77797
|
+
constructor(dataProvider) {
|
|
77798
|
+
this._dataProvider = dataProvider;
|
|
77799
|
+
}
|
|
77800
|
+
/** Get the schema view, loading whatever the request needs that is not present yet. See
|
|
77801
|
+
* {@link GetSchemaViewArgs} for filtering and reload semantics; hosts document the full
|
|
77802
|
+
* user-facing contract on their `getSchemaView` methods.
|
|
77803
|
+
*/
|
|
77804
|
+
async getSchemaView(args) {
|
|
77805
|
+
const previous = this._viewPromise;
|
|
77806
|
+
const next = this._loadSchemaView(previous, args?.schemas, args?.forceReload === true);
|
|
77807
|
+
this._viewPromise = next;
|
|
77808
|
+
return next;
|
|
77809
|
+
}
|
|
77810
|
+
/** Throw away the current schema view. Called by the host when schemas may have changed (e.g.
|
|
77811
|
+
* `IModelDb.clearCaches` after a schema import). Chains behind any in-flight load and marks the
|
|
77812
|
+
* discarded view outdated; the next getSchemaView starts over.
|
|
77813
|
+
*/
|
|
77814
|
+
reset() {
|
|
77815
|
+
if (this._viewPromise) {
|
|
77816
|
+
this._viewPromise = this._viewPromise.then((view) => { view?.markOutdated(); this._resetIncrementalState(); return undefined; }, () => { this._resetIncrementalState(); return undefined; });
|
|
77817
|
+
}
|
|
77818
|
+
}
|
|
77819
|
+
/** Check whether the iModel's schemas have changed since the current view was built, and discard
|
|
77820
|
+
* the view only if they have. For hosts that *cannot* determine whether an operation actually
|
|
77821
|
+
* modified schemas - e.g. `BriefcaseConnection.pullChanges` on the frontend, whose IPC response
|
|
77822
|
+
* carries only the new changeset id, not the applied changesets' types. Discarding after every
|
|
77823
|
+
* such operation would reload unnecessarily in the common case where schemas are unchanged, so
|
|
77824
|
+
* this compares the cheap schema-identity token instead.
|
|
77825
|
+
* @note If the token cannot be fetched, the view is discarded rather than risking stale metadata.
|
|
77826
|
+
*/
|
|
77827
|
+
async invalidateIfChanged() {
|
|
77828
|
+
const previous = this._viewPromise;
|
|
77829
|
+
if (previous === undefined)
|
|
77830
|
+
return;
|
|
77831
|
+
// Queue the check on the same chain as loading, so a getSchemaView arriving while the token is
|
|
77832
|
+
// in flight cannot swap in a new promise for the same stale view and hide the schema change.
|
|
77833
|
+
const next = this._invalidateIfChanged(previous);
|
|
77834
|
+
this._viewPromise = next;
|
|
77835
|
+
await next;
|
|
77836
|
+
}
|
|
77837
|
+
/** Serialized body of {@link SchemaViewManager.invalidateIfChanged}. Resolves to the view to keep,
|
|
77838
|
+
* or to `undefined` when it was discarded and the next getSchemaView has to start over.
|
|
77839
|
+
*/
|
|
77840
|
+
async _invalidateIfChanged(previous) {
|
|
77841
|
+
let existing;
|
|
77842
|
+
try {
|
|
77843
|
+
existing = await previous;
|
|
77844
|
+
}
|
|
77845
|
+
catch {
|
|
77846
|
+
return undefined;
|
|
77847
|
+
}
|
|
77848
|
+
if (existing === undefined)
|
|
77849
|
+
return undefined;
|
|
77850
|
+
// A view without a token (e.g. built directly from a SchemaViewBuilder) cannot be verified by
|
|
77851
|
+
// token; views loaded through this manager always carry one.
|
|
77852
|
+
if (existing.schemaToken === "")
|
|
77853
|
+
return existing;
|
|
77854
|
+
try {
|
|
77855
|
+
if (await this._dataProvider.fetchSchemaToken() === existing.schemaToken)
|
|
77856
|
+
return existing;
|
|
77857
|
+
}
|
|
77858
|
+
catch {
|
|
77859
|
+
// Cannot verify the cached view: drop it rather than risk stale metadata.
|
|
77860
|
+
}
|
|
77861
|
+
existing.markOutdated();
|
|
77862
|
+
this._resetIncrementalState();
|
|
77863
|
+
return undefined;
|
|
77864
|
+
}
|
|
77865
|
+
/** Serialized body of {@link SchemaViewManager.getSchemaView}. On failure it resets and rejects,
|
|
77866
|
+
* so the next call starts over.
|
|
77867
|
+
*/
|
|
77868
|
+
async _loadSchemaView(previous, schemas, forceReload) {
|
|
77869
|
+
let currentView;
|
|
77870
|
+
if (previous !== undefined) {
|
|
77871
|
+
try {
|
|
77872
|
+
currentView = await previous;
|
|
77873
|
+
}
|
|
77874
|
+
catch {
|
|
77875
|
+
currentView = undefined; // the failed load already reset; start over
|
|
77876
|
+
}
|
|
77877
|
+
}
|
|
77878
|
+
if (forceReload) {
|
|
77879
|
+
currentView?.markOutdated();
|
|
77880
|
+
currentView = undefined;
|
|
77881
|
+
this._resetIncrementalState();
|
|
77882
|
+
}
|
|
77883
|
+
try {
|
|
77884
|
+
return await this._ensureSchemasLoaded(currentView, schemas);
|
|
77885
|
+
}
|
|
77886
|
+
catch (err) {
|
|
77887
|
+
// A failed merge may have left the view partially extended - discard everything.
|
|
77888
|
+
currentView?.markOutdated();
|
|
77889
|
+
this._resetIncrementalState();
|
|
77890
|
+
throw err;
|
|
77891
|
+
}
|
|
77892
|
+
}
|
|
77893
|
+
/** Clear the incremental schema-view bookkeeping. */
|
|
77894
|
+
_resetIncrementalState() {
|
|
77895
|
+
this._manifest = undefined;
|
|
77896
|
+
this._manifestToken = undefined;
|
|
77897
|
+
this._loadedSchemaNames.clear();
|
|
77898
|
+
}
|
|
77899
|
+
/** Ensures the requested schemas (or all schemas, when no filter is given) are present in
|
|
77900
|
+
* `currentView` (or a freshly created view) and returns it. The first load fixes the strategy:
|
|
77901
|
+
* no filter fetches everything as one full blob; a filter fetches fragments and keeps the
|
|
77902
|
+
* manifest and loaded-name set so later calls extend the same view. Once every schema is loaded
|
|
77903
|
+
* the incremental state is dropped, collapsing back to full mode.
|
|
77904
|
+
*/
|
|
77905
|
+
async _ensureSchemasLoaded(currentView, schemas, isRetry = false) {
|
|
77906
|
+
const isFirstLoad = currentView === undefined;
|
|
77907
|
+
// No manifest means everything is loaded; in incremental mode a filtered request is satisfied as
|
|
77908
|
+
// soon as every requested name is present.
|
|
77909
|
+
if (!isFirstLoad &&
|
|
77910
|
+
(this._manifest === undefined ||
|
|
77911
|
+
(schemas !== undefined && schemas.every((name) => this._loadedSchemaNames.has(name.toLowerCase())))))
|
|
77912
|
+
return currentView;
|
|
77913
|
+
if (isFirstLoad && schemas === undefined) {
|
|
77914
|
+
const blob = await this._dataProvider.fetchFullBlob();
|
|
77915
|
+
const schemaView = _SchemaView__WEBPACK_IMPORTED_MODULE_0__.SchemaView.fromBinary(blob.data, blob.schemaToken);
|
|
77916
|
+
this._resetIncrementalState();
|
|
77917
|
+
return schemaView;
|
|
77918
|
+
}
|
|
77919
|
+
if (this._manifest === undefined) {
|
|
77920
|
+
// Token first: any schema change after this point shows up as a token mismatch below.
|
|
77921
|
+
this._manifestToken = await this._dataProvider.fetchSchemaToken();
|
|
77922
|
+
this._manifest = await this._dataProvider.fetchManifest();
|
|
77923
|
+
}
|
|
77924
|
+
const manifest = this._manifest;
|
|
77925
|
+
const requested = schemas ?? manifest.getAvailableSchemaNames();
|
|
77926
|
+
const namesToLoad = manifest.getSchemaClosure(requested).filter((name) => !this._loadedSchemaNames.has(name.toLowerCase()));
|
|
77927
|
+
const husk = currentView ?? _SchemaView__WEBPACK_IMPORTED_MODULE_0__.SchemaView.createMergeable(this._manifestToken);
|
|
77928
|
+
if (namesToLoad.length > 0) {
|
|
77929
|
+
const blob = await this._dataProvider.fetchFragmentBlob(namesToLoad);
|
|
77930
|
+
if (blob.schemaToken !== this._manifestToken) {
|
|
77931
|
+
// Schemas changed between the manifest and fragment fetches. Everything loaded so far
|
|
77932
|
+
// belongs to the old revision - discard it and start over, once.
|
|
77933
|
+
currentView?.markOutdated();
|
|
77934
|
+
this._resetIncrementalState();
|
|
77935
|
+
if (isRetry)
|
|
77936
|
+
throw new Error("The iModel's schemas changed while the schema view was loading.");
|
|
77937
|
+
return this._ensureSchemasLoaded(undefined, schemas, true);
|
|
77938
|
+
}
|
|
77939
|
+
husk.mergeFragment(blob.data);
|
|
77940
|
+
// Record the whole closure as loaded, including *excluded* schemas (e.g. CoreCustomAttributes)
|
|
77941
|
+
// the writer emits no rows for, so later requests prune them instead of re-fetching.
|
|
77942
|
+
for (const name of namesToLoad)
|
|
77943
|
+
this._loadedSchemaNames.add(name.toLowerCase());
|
|
77944
|
+
}
|
|
77945
|
+
// Once every schema is loaded, collapse back to full mode (the size check is just a fast path).
|
|
77946
|
+
if (schemas === undefined || (this._loadedSchemaNames.size >= manifest.schemaCount && manifest.entries.every((entry) => this._loadedSchemaNames.has(entry.name.toLowerCase()))))
|
|
77947
|
+
this._resetIncrementalState();
|
|
77948
|
+
return husk;
|
|
77949
|
+
}
|
|
77950
|
+
}
|
|
77951
|
+
|
|
77952
|
+
|
|
77502
77953
|
/***/ },
|
|
77503
77954
|
|
|
77504
77955
|
/***/ "../../core/ecschema-metadata/lib/esm/UnitConversion/UnitConverter.js"
|
|
@@ -78209,8 +78660,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78209
78660
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
78210
78661
|
/* harmony export */ AbstractSchemaItemType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.AbstractSchemaItemType),
|
|
78211
78662
|
/* harmony export */ ArrayProperty: () => (/* reexport safe */ _Metadata_Property__WEBPACK_IMPORTED_MODULE_22__.ArrayProperty),
|
|
78212
|
-
/* harmony export */ ClassModifier: () => (/* reexport safe */
|
|
78213
|
-
/* harmony export */ ClassType: () => (/* reexport safe */
|
|
78663
|
+
/* harmony export */ ClassModifier: () => (/* reexport safe */ _SchemaView_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_45__.ClassModifier),
|
|
78664
|
+
/* harmony export */ ClassType: () => (/* reexport safe */ _SchemaView_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_45__.ClassType),
|
|
78214
78665
|
/* harmony export */ Constant: () => (/* reexport safe */ _Metadata_Constant__WEBPACK_IMPORTED_MODULE_12__.Constant),
|
|
78215
78666
|
/* harmony export */ CustomAttributeClass: () => (/* reexport safe */ _Metadata_CustomAttributeClass__WEBPACK_IMPORTED_MODULE_13__.CustomAttributeClass),
|
|
78216
78667
|
/* harmony export */ CustomAttributeContainerType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.CustomAttributeContainerType),
|
|
@@ -78234,7 +78685,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78234
78685
|
/* harmony export */ IncrementalSchemaLocater: () => (/* reexport safe */ _IncrementalLoading_IncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_40__.IncrementalSchemaLocater),
|
|
78235
78686
|
/* harmony export */ InvertedUnit: () => (/* reexport safe */ _Metadata_InvertedUnit__WEBPACK_IMPORTED_MODULE_17__.InvertedUnit),
|
|
78236
78687
|
/* harmony export */ KindOfQuantity: () => (/* reexport safe */ _Metadata_KindOfQuantity__WEBPACK_IMPORTED_MODULE_18__.KindOfQuantity),
|
|
78237
|
-
/* harmony export */ LocalizationProvider: () => (/* reexport safe */
|
|
78688
|
+
/* harmony export */ LocalizationProvider: () => (/* reexport safe */ _Localization_LocalizationProvider__WEBPACK_IMPORTED_MODULE_49__.LocalizationProvider),
|
|
78238
78689
|
/* harmony export */ Mixin: () => (/* reexport safe */ _Metadata_Mixin__WEBPACK_IMPORTED_MODULE_19__.Mixin),
|
|
78239
78690
|
/* harmony export */ NavigationProperty: () => (/* reexport safe */ _Metadata_Property__WEBPACK_IMPORTED_MODULE_22__.NavigationProperty),
|
|
78240
78691
|
/* harmony export */ OverrideFormat: () => (/* reexport safe */ _Metadata_OverrideFormat__WEBPACK_IMPORTED_MODULE_20__.OverrideFormat),
|
|
@@ -78245,7 +78696,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78245
78696
|
/* harmony export */ PrimitiveType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.PrimitiveType),
|
|
78246
78697
|
/* harmony export */ Property: () => (/* reexport safe */ _Metadata_Property__WEBPACK_IMPORTED_MODULE_22__.Property),
|
|
78247
78698
|
/* harmony export */ PropertyCategory: () => (/* reexport safe */ _Metadata_PropertyCategory__WEBPACK_IMPORTED_MODULE_23__.PropertyCategory),
|
|
78248
|
-
/* harmony export */ PropertyKind: () => (/* reexport safe */
|
|
78699
|
+
/* harmony export */ PropertyKind: () => (/* reexport safe */ _SchemaView_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_45__.PropertyKind),
|
|
78249
78700
|
/* harmony export */ PropertyType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.PropertyType),
|
|
78250
78701
|
/* harmony export */ PropertyTypeUtils: () => (/* reexport safe */ _PropertyTypes__WEBPACK_IMPORTED_MODULE_29__.PropertyTypeUtils),
|
|
78251
78702
|
/* harmony export */ RelationshipClass: () => (/* reexport safe */ _Metadata_RelationshipClass__WEBPACK_IMPORTED_MODULE_24__.RelationshipClass),
|
|
@@ -78264,14 +78715,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78264
78715
|
/* harmony export */ SchemaJsonLocater: () => (/* reexport safe */ _SchemaJsonLocater__WEBPACK_IMPORTED_MODULE_30__.SchemaJsonLocater),
|
|
78265
78716
|
/* harmony export */ SchemaKey: () => (/* reexport safe */ _SchemaKey__WEBPACK_IMPORTED_MODULE_31__.SchemaKey),
|
|
78266
78717
|
/* harmony export */ SchemaLoader: () => (/* reexport safe */ _SchemaLoader__WEBPACK_IMPORTED_MODULE_32__.SchemaLoader),
|
|
78267
|
-
/* harmony export */ SchemaLocalization: () => (/* reexport safe */
|
|
78718
|
+
/* harmony export */ SchemaLocalization: () => (/* reexport safe */ _Localization_SchemaLocalization__WEBPACK_IMPORTED_MODULE_50__.SchemaLocalization),
|
|
78719
|
+
/* harmony export */ SchemaManifest: () => (/* reexport safe */ _SchemaView_SchemaManifest__WEBPACK_IMPORTED_MODULE_46__.SchemaManifest),
|
|
78268
78720
|
/* harmony export */ SchemaMatchType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.SchemaMatchType),
|
|
78269
78721
|
/* harmony export */ SchemaPartVisitorDelegate: () => (/* reexport safe */ _SchemaPartVisitorDelegate__WEBPACK_IMPORTED_MODULE_36__.SchemaPartVisitorDelegate),
|
|
78270
78722
|
/* harmony export */ SchemaReadHelper: () => (/* reexport safe */ _Deserialization_Helper__WEBPACK_IMPORTED_MODULE_5__.SchemaReadHelper),
|
|
78271
78723
|
/* harmony export */ SchemaUnitProvider: () => (/* reexport safe */ _UnitProvider_SchemaUnitProvider__WEBPACK_IMPORTED_MODULE_34__.SchemaUnitProvider),
|
|
78272
|
-
/* harmony export */ SchemaView: () => (/* reexport safe */
|
|
78273
|
-
/* harmony export */ SchemaViewBuilder: () => (/* reexport safe */
|
|
78274
|
-
/* harmony export */
|
|
78724
|
+
/* harmony export */ SchemaView: () => (/* reexport safe */ _SchemaView_SchemaView__WEBPACK_IMPORTED_MODULE_43__.SchemaView),
|
|
78725
|
+
/* harmony export */ SchemaViewBuilder: () => (/* reexport safe */ _SchemaView_SchemaViewBuilder__WEBPACK_IMPORTED_MODULE_44__.SchemaViewBuilder),
|
|
78726
|
+
/* harmony export */ SchemaViewManager: () => (/* reexport safe */ _SchemaView_SchemaViewManager__WEBPACK_IMPORTED_MODULE_47__.SchemaViewManager),
|
|
78727
|
+
/* harmony export */ SchemaViewMergeContext: () => (/* reexport safe */ _SchemaView_SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_42__.SchemaViewMergeContext),
|
|
78728
|
+
/* harmony export */ SchemaViewPrimitiveType: () => (/* reexport safe */ _SchemaView_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_45__.SchemaViewPrimitiveType),
|
|
78275
78729
|
/* harmony export */ SchemaWalker: () => (/* reexport safe */ _Validation_SchemaWalker__WEBPACK_IMPORTED_MODULE_35__.SchemaWalker),
|
|
78276
78730
|
/* harmony export */ StrengthDirection: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.StrengthDirection),
|
|
78277
78731
|
/* harmony export */ StrengthType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.StrengthType),
|
|
@@ -78291,7 +78745,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78291
78745
|
/* harmony export */ parsePrimitiveType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parsePrimitiveType),
|
|
78292
78746
|
/* harmony export */ parseRelationshipEnd: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseRelationshipEnd),
|
|
78293
78747
|
/* harmony export */ parseSchemaItemType: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseSchemaItemType),
|
|
78294
|
-
/* harmony export */ parseSchemaViewBlob: () => (/* reexport safe */
|
|
78748
|
+
/* harmony export */ parseSchemaViewBlob: () => (/* reexport safe */ _SchemaView_SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_42__.parseSchemaViewBlob),
|
|
78295
78749
|
/* harmony export */ parseStrength: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseStrength),
|
|
78296
78750
|
/* harmony export */ parseStrengthDirection: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.parseStrengthDirection),
|
|
78297
78751
|
/* harmony export */ primitiveTypeToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.primitiveTypeToString),
|
|
@@ -78299,7 +78753,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78299
78753
|
/* harmony export */ relationshipEndToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.relationshipEndToString),
|
|
78300
78754
|
/* harmony export */ schemaItemTypeToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.schemaItemTypeToString),
|
|
78301
78755
|
/* harmony export */ schemaItemTypeToXmlString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.schemaItemTypeToXmlString),
|
|
78302
|
-
/* harmony export */ schemaViewFormatVersion: () => (/* reexport safe */
|
|
78756
|
+
/* harmony export */ schemaViewFormatVersion: () => (/* reexport safe */ _SchemaView_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_45__.schemaViewFormatVersion),
|
|
78303
78757
|
/* harmony export */ strengthDirectionToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.strengthDirectionToString),
|
|
78304
78758
|
/* harmony export */ strengthToString: () => (/* reexport safe */ _ECObjects__WEBPACK_IMPORTED_MODULE_8__.strengthToString)
|
|
78305
78759
|
/* harmony export */ });
|
|
@@ -78345,12 +78799,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78345
78799
|
/* harmony import */ var _IncrementalLoading_ECSqlSchemaLocater__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./IncrementalLoading/ECSqlSchemaLocater */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js");
|
|
78346
78800
|
/* harmony import */ var _IncrementalLoading_IncrementalSchemaLocater__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./IncrementalLoading/IncrementalSchemaLocater */ "../../core/ecschema-metadata/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js");
|
|
78347
78801
|
/* harmony import */ var _utils_SchemaGraph__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./utils/SchemaGraph */ "../../core/ecschema-metadata/lib/esm/utils/SchemaGraph.js");
|
|
78348
|
-
/* harmony import */ var
|
|
78349
|
-
/* harmony import */ var
|
|
78350
|
-
/* harmony import */ var
|
|
78351
|
-
/* harmony import */ var
|
|
78352
|
-
/* harmony import */ var
|
|
78353
|
-
/* harmony import */ var
|
|
78802
|
+
/* harmony import */ var _SchemaView_SchemaViewBinaryReader__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./SchemaView/SchemaViewBinaryReader */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBinaryReader.js");
|
|
78803
|
+
/* harmony import */ var _SchemaView_SchemaView__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./SchemaView/SchemaView */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaView.js");
|
|
78804
|
+
/* harmony import */ var _SchemaView_SchemaViewBuilder__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./SchemaView/SchemaViewBuilder */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewBuilder.js");
|
|
78805
|
+
/* harmony import */ var _SchemaView_SchemaViewInterfaces__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./SchemaView/SchemaViewInterfaces */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewInterfaces.js");
|
|
78806
|
+
/* harmony import */ var _SchemaView_SchemaManifest__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./SchemaView/SchemaManifest */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaManifest.js");
|
|
78807
|
+
/* harmony import */ var _SchemaView_SchemaViewManager__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./SchemaView/SchemaViewManager */ "../../core/ecschema-metadata/lib/esm/SchemaView/SchemaViewManager.js");
|
|
78808
|
+
/* harmony import */ var _Localization_LocalizationTypes__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./Localization/LocalizationTypes */ "../../core/ecschema-metadata/lib/esm/Localization/LocalizationTypes.js");
|
|
78809
|
+
/* harmony import */ var _Localization_LocalizationProvider__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./Localization/LocalizationProvider */ "../../core/ecschema-metadata/lib/esm/Localization/LocalizationProvider.js");
|
|
78810
|
+
/* harmony import */ var _Localization_SchemaLocalization__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./Localization/SchemaLocalization */ "../../core/ecschema-metadata/lib/esm/Localization/SchemaLocalization.js");
|
|
78354
78811
|
/*---------------------------------------------------------------------------------------------
|
|
78355
78812
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
78356
78813
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -78399,6 +78856,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
78399
78856
|
|
|
78400
78857
|
|
|
78401
78858
|
|
|
78859
|
+
|
|
78860
|
+
|
|
78861
|
+
|
|
78402
78862
|
|
|
78403
78863
|
|
|
78404
78864
|
|
|
@@ -84866,7 +85326,7 @@ class BriefcaseConnection extends _IModelConnection__WEBPACK_IMPORTED_MODULE_5__
|
|
|
84866
85326
|
*/
|
|
84867
85327
|
async pushChanges(description) {
|
|
84868
85328
|
this.requireTimeline();
|
|
84869
|
-
return _IpcApp__WEBPACK_IMPORTED_MODULE_6__.IpcApp.appFunctionIpc.pushChanges(this.key, description);
|
|
85329
|
+
return this.changeset = await _IpcApp__WEBPACK_IMPORTED_MODULE_6__.IpcApp.appFunctionIpc.pushChanges(this.key, description);
|
|
84870
85330
|
}
|
|
84871
85331
|
/** The current graphical editing scope, if one is in progress.
|
|
84872
85332
|
* @see [[enterEditingScope]] to begin graphical editing.
|
|
@@ -91663,7 +92123,9 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
91663
92123
|
*/
|
|
91664
92124
|
fontMap; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
91665
92125
|
_schemaContext;
|
|
91666
|
-
|
|
92126
|
+
// Created lazily on the first getSchemaView call. Owns the SchemaView's lifetime and does all its
|
|
92127
|
+
// data access through the SchemaViewDataProvider implemented below.
|
|
92128
|
+
_schemaViewManager;
|
|
91667
92129
|
/** Load the FontMap for this IModelConnection.
|
|
91668
92130
|
* @returns Returns a Promise<FontMap> that is fulfilled when the FontMap member of this IModelConnection is valid.
|
|
91669
92131
|
* @deprecated in 5.0.0 - might be removed in next major version. If you need font Ids on the front-end for some reason, write an Ipc method that queries [IModelDb.fonts]($backend).
|
|
@@ -92091,33 +92553,23 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
92091
92553
|
}
|
|
92092
92554
|
/** Get the schema view for this iModel. The view is built lazily on
|
|
92093
92555
|
* first call by fetching compact binary schema data via `PRAGMA schema_view` through
|
|
92094
|
-
* the existing queryRows RPC (ConcurrentQuery).
|
|
92095
|
-
* Multiple concurrent callers share a single in-flight fetch.
|
|
92556
|
+
* the existing queryRows RPC (ConcurrentQuery).
|
|
92096
92557
|
*
|
|
92097
92558
|
* The returned `SchemaView` is a lightweight, read-only, synchronous API for
|
|
92098
92559
|
* navigating schema metadata - classes, properties, relationships, enumerations, etc.
|
|
92099
92560
|
* It is the recommended default for runtime read-only metadata access and is significantly
|
|
92100
92561
|
* faster and lower-memory than [[schemaContext]]. Use [[schemaContext]] for custom-attribute
|
|
92101
92562
|
* deserialization or anywhere you need the full ecschema-metadata object graph.
|
|
92563
|
+
*
|
|
92564
|
+
* Every call shares one accumulating view instance and concurrent calls are serialized, so a
|
|
92565
|
+
* caller never observes a partially loaded view. The instance is discarded once the connection
|
|
92566
|
+
* detects that schemas changed, for example after [[BriefcaseConnection.pullChanges]]; the next
|
|
92567
|
+
* call builds a new one. See [GetSchemaViewArgs]($ecschema-metadata) for the arguments.
|
|
92102
92568
|
* @beta
|
|
92103
92569
|
*/
|
|
92104
|
-
async getSchemaView() {
|
|
92105
|
-
|
|
92106
|
-
|
|
92107
|
-
if (!ctx.isOutdated)
|
|
92108
|
-
return ctx;
|
|
92109
|
-
}
|
|
92110
|
-
// Capture the in-flight promise locally so the rejection handler only clears
|
|
92111
|
-
// `_schemasPromise` if it still points at this build. A concurrent invalidation +
|
|
92112
|
-
// re-fetch could otherwise replace the field before our fetch fails, and a naive
|
|
92113
|
-
// `_schemasPromise = undefined` would clobber that newer reference.
|
|
92114
|
-
const inflight = this._fetchSchemas();
|
|
92115
|
-
this._schemasPromise = inflight;
|
|
92116
|
-
inflight.catch(() => {
|
|
92117
|
-
if (this._schemasPromise === inflight)
|
|
92118
|
-
this._schemasPromise = undefined;
|
|
92119
|
-
});
|
|
92120
|
-
return inflight;
|
|
92570
|
+
async getSchemaView(args) {
|
|
92571
|
+
this._schemaViewManager ??= new _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_14__.SchemaViewManager(this._createSchemaViewDataProvider());
|
|
92572
|
+
return this._schemaViewManager.getSchemaView(args);
|
|
92121
92573
|
}
|
|
92122
92574
|
/**
|
|
92123
92575
|
* Checks whether the iModel's schemas have changed since the current cached [[SchemaView]] was
|
|
@@ -92129,7 +92581,7 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
92129
92581
|
* returns only the new changeset id, not the list of applied changesets with their types.
|
|
92130
92582
|
* Unconditionally discarding the cached [[SchemaView]] after every such operation would cause
|
|
92131
92583
|
* unnecessary reloads in the common case where schemas are unchanged. This method avoids that
|
|
92132
|
-
* cost by fetching a lightweight schema
|
|
92584
|
+
* cost by fetching a lightweight schema token via `PRAGMA checksum(schema_token)` and
|
|
92133
92585
|
* comparing it against the token stored in the cached view. Only when the token differs is the
|
|
92134
92586
|
* cache discarded.
|
|
92135
92587
|
*
|
|
@@ -92138,61 +92590,59 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
92138
92590
|
* @internal
|
|
92139
92591
|
*/
|
|
92140
92592
|
async invalidateSchemaViewIfChanged() {
|
|
92141
|
-
|
|
92142
|
-
|
|
92143
|
-
|
|
92144
|
-
|
|
92145
|
-
|
|
92146
|
-
|
|
92147
|
-
|
|
92148
|
-
|
|
92149
|
-
|
|
92150
|
-
|
|
92151
|
-
|
|
92152
|
-
|
|
92153
|
-
|
|
92154
|
-
|
|
92155
|
-
|
|
92156
|
-
|
|
92157
|
-
|
|
92158
|
-
|
|
92159
|
-
|
|
92160
|
-
|
|
92161
|
-
|
|
92162
|
-
|
|
92163
|
-
|
|
92164
|
-
|
|
92165
|
-
|
|
92166
|
-
|
|
92167
|
-
|
|
92168
|
-
|
|
92169
|
-
|
|
92170
|
-
|
|
92171
|
-
|
|
92172
|
-
|
|
92173
|
-
|
|
92174
|
-
|
|
92175
|
-
|
|
92176
|
-
|
|
92177
|
-
|
|
92178
|
-
|
|
92179
|
-
|
|
92180
|
-
async
|
|
92181
|
-
//
|
|
92182
|
-
//
|
|
92183
|
-
//
|
|
92184
|
-
//
|
|
92185
|
-
|
|
92186
|
-
// don't support OFFSET-based pagination.
|
|
92187
|
-
const reader = this.createQueryReader(`PRAGMA schema_view(${_itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_14__.schemaViewFormatVersion})`);
|
|
92593
|
+
await this._schemaViewManager?.invalidateIfChanged();
|
|
92594
|
+
}
|
|
92595
|
+
/** The [SchemaViewDataProvider]($ecschema-metadata) backing this iModel's [[getSchemaView]]: the
|
|
92596
|
+
* transport-specific half of schema-view loading, issued through the queryRows RPC
|
|
92597
|
+
* (ConcurrentQuery). The frontend *pins* the blob format version in both pragmas, because the
|
|
92598
|
+
* backend it talks to can be older or newer; the pin makes it return a blob this code can parse,
|
|
92599
|
+
* or fail cleanly.
|
|
92600
|
+
*/
|
|
92601
|
+
_createSchemaViewDataProvider() {
|
|
92602
|
+
return {
|
|
92603
|
+
fetchFullBlob: async () => this._fetchSchemaBlob(`PRAGMA schema_view(${_itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_14__.schemaViewFormatVersion})`),
|
|
92604
|
+
// Names are ECNames, so a comma can never occur in one. Native re-validates each token as an
|
|
92605
|
+
// ECName and fails the pragma on an unknown name. The `v<N>;` prefix pins the format version.
|
|
92606
|
+
fetchFragmentBlob: async (schemaNames) => this._fetchSchemaBlob(`PRAGMA schema_view_fragment('v${_itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_14__.schemaViewFormatVersion};${schemaNames.join(",")}')`),
|
|
92607
|
+
fetchManifest: async () => {
|
|
92608
|
+
const schemaRows = [];
|
|
92609
|
+
const schemaSql = "SELECT ECInstanceId, Name, VersionMajor, VersionWrite, VersionMinor FROM meta.ECSchemaDef";
|
|
92610
|
+
for await (const row of this.createQueryReader(schemaSql)) {
|
|
92611
|
+
// ECInstanceId arrives as a hex Id64String. `ec_` metadata rowids carry no briefcase
|
|
92612
|
+
// prefix, so the local id is the full value.
|
|
92613
|
+
schemaRows.push({ ecInstanceId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getLocalId(row[0]), name: row[1], versionMajor: row[2], versionWrite: row[3], versionMinor: row[4] });
|
|
92614
|
+
}
|
|
92615
|
+
const referenceRows = [];
|
|
92616
|
+
const referenceSql = "SELECT SourceECInstanceId, TargetECInstanceId FROM meta.SchemaHasSchemaReferences";
|
|
92617
|
+
for await (const row of this.createQueryReader(referenceSql))
|
|
92618
|
+
referenceRows.push({ sourceECInstanceId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getLocalId(row[0]), targetECInstanceId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getLocalId(row[1]) });
|
|
92619
|
+
return _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_14__.SchemaManifest.fromRows(schemaRows, referenceRows);
|
|
92620
|
+
},
|
|
92621
|
+
fetchSchemaToken: async () => {
|
|
92622
|
+
const reader = this.createQueryReader("PRAGMA checksum(schema_token)");
|
|
92623
|
+
const result = await reader.next();
|
|
92624
|
+
if (result.done)
|
|
92625
|
+
throw new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.IModelError(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.BadRequest, "PRAGMA checksum(schema_token) returned no rows");
|
|
92626
|
+
return result.value.sha3_256;
|
|
92627
|
+
},
|
|
92628
|
+
};
|
|
92629
|
+
}
|
|
92630
|
+
/** Fetch one schema-view blob (full or fragment). Both `PRAGMA schema_view` and
|
|
92631
|
+
* `PRAGMA schema_view_fragment` return a single row with the same columns. */
|
|
92632
|
+
async _fetchSchemaBlob(pragma) {
|
|
92633
|
+
// Only call reader.next() once - do NOT use `for await` on PRAGMA results. ConcurrentQuery wraps
|
|
92634
|
+
// regular ECSQL in LIMIT/OFFSET for pagination but skips this for PRAGMAs; if the serialized
|
|
92635
|
+
// result exceeds the memory threshold, the response is marked "Partial", and a `for await` loop
|
|
92636
|
+
// would re-issue the same PRAGMA forever since PRAGMAs don't support OFFSET-based pagination.
|
|
92637
|
+
const reader = this.createQueryReader(pragma);
|
|
92188
92638
|
const result = await reader.next();
|
|
92189
92639
|
if (result.done)
|
|
92190
|
-
throw new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.IModelError(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.BadRequest,
|
|
92640
|
+
throw new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.IModelError(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.BadRequest, `${pragma} returned no rows`);
|
|
92191
92641
|
const data = result.value.data;
|
|
92192
92642
|
const token = result.value.schemaToken;
|
|
92193
92643
|
if (data === undefined || data === null)
|
|
92194
|
-
throw new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.IModelError(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.BadRequest,
|
|
92195
|
-
return
|
|
92644
|
+
throw new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.IModelError(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.IModelStatus.BadRequest, `${pragma} returned null data column`);
|
|
92645
|
+
return { data, schemaToken: token ?? "" };
|
|
92196
92646
|
}
|
|
92197
92647
|
}
|
|
92198
92648
|
/** A connection that exists without an iModel. Useful for connecting to Reality Data services.
|
|
@@ -321418,10 +321868,10 @@ class Settings {
|
|
|
321418
321868
|
});
|
|
321419
321869
|
}
|
|
321420
321870
|
toString() {
|
|
321421
|
-
return `Configurations:
|
|
321422
|
-
oidc client id: ${this.oidcClientId},
|
|
321423
|
-
oidc scopes: ${this.oidcScopes},
|
|
321424
|
-
applicationId: ${this.gprid},
|
|
321871
|
+
return `Configurations:
|
|
321872
|
+
oidc client id: ${this.oidcClientId},
|
|
321873
|
+
oidc scopes: ${this.oidcScopes},
|
|
321874
|
+
applicationId: ${this.gprid},
|
|
321425
321875
|
log level: ${this.logLevel}`;
|
|
321426
321876
|
}
|
|
321427
321877
|
}
|
|
@@ -333379,7 +333829,7 @@ var loadLanguages = instance.loadLanguages;
|
|
|
333379
333829
|
(module) {
|
|
333380
333830
|
|
|
333381
333831
|
"use strict";
|
|
333382
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.12.0-dev.
|
|
333832
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.12.0-dev.18","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/node":"~20.17.0","@types/sinon":"^17.0.2","@vitest/browser-playwright":"^4.1.10","@vitest/coverage-v8":"^4.1.10","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^13.0.6","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","vitest":"^4.1.10","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"}}');
|
|
333383
333833
|
|
|
333384
333834
|
/***/ }
|
|
333385
333835
|
|