@itwin/ecschema-metadata 5.10.0-dev.19 → 5.10.0-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -1
- package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +466 -466
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +235 -235
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +309 -309
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/SchemaView.d.ts +653 -0
- package/lib/cjs/SchemaView.d.ts.map +1 -0
- package/lib/cjs/SchemaView.js +1204 -0
- package/lib/cjs/SchemaView.js.map +1 -0
- package/lib/cjs/SchemaViewBinaryReader.d.ts +16 -0
- package/lib/cjs/SchemaViewBinaryReader.d.ts.map +1 -0
- package/lib/cjs/SchemaViewBinaryReader.js +610 -0
- package/lib/cjs/SchemaViewBinaryReader.js.map +1 -0
- package/lib/cjs/SchemaViewInterfaces.d.ts +220 -0
- package/lib/cjs/SchemaViewInterfaces.d.ts.map +1 -0
- package/lib/cjs/SchemaViewInterfaces.js +69 -0
- package/lib/cjs/SchemaViewInterfaces.js.map +1 -0
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +3 -0
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +3 -0
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/ECClassHierarchy.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -1
- package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js +466 -466
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js +235 -235
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js +309 -309
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/PropertyTypes.js.map +1 -1
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/SchemaView.d.ts +653 -0
- package/lib/esm/SchemaView.d.ts.map +1 -0
- package/lib/esm/SchemaView.js +1199 -0
- package/lib/esm/SchemaView.js.map +1 -0
- package/lib/esm/SchemaViewBinaryReader.d.ts +16 -0
- package/lib/esm/SchemaViewBinaryReader.d.ts.map +1 -0
- package/lib/esm/SchemaViewBinaryReader.js +607 -0
- package/lib/esm/SchemaViewBinaryReader.js.map +1 -0
- package/lib/esm/SchemaViewInterfaces.d.ts +220 -0
- package/lib/esm/SchemaViewInterfaces.d.ts.map +1 -0
- package/lib/esm/SchemaViewInterfaces.js +66 -0
- package/lib/esm/SchemaViewInterfaces.js.map +1 -0
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +3 -0
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +3 -0
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/ECClassHierarchy.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Schema
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.parseSchemaViewBlob = parseSchemaViewBlob;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const SchemaView_1 = require("./SchemaView");
|
|
13
|
+
const ECObjects_1 = require("./ECObjects");
|
|
14
|
+
const SchemaViewInterfaces_1 = require("./SchemaViewInterfaces");
|
|
15
|
+
/** Binary record tags for the SchemaView blob format.
|
|
16
|
+
* Each tag marks a flat, count-prefixed table. Must stay in sync with the C++ writer. */
|
|
17
|
+
var Tag;
|
|
18
|
+
(function (Tag) {
|
|
19
|
+
Tag[Tag["PropertyDefTable"] = 10] = "PropertyDefTable";
|
|
20
|
+
Tag[Tag["SchemaTable"] = 16] = "SchemaTable";
|
|
21
|
+
Tag[Tag["EnumTable"] = 32] = "EnumTable";
|
|
22
|
+
Tag[Tag["KoQTable"] = 48] = "KoQTable";
|
|
23
|
+
Tag[Tag["PropCatTable"] = 49] = "PropCatTable";
|
|
24
|
+
Tag[Tag["ClassTable"] = 64] = "ClassTable";
|
|
25
|
+
})(Tag || (Tag = {}));
|
|
26
|
+
const MAGIC = 0x43534348; // "CSCH"
|
|
27
|
+
/** Low-level binary reader for the SchemaView blob. */
|
|
28
|
+
class BinaryReader {
|
|
29
|
+
_view;
|
|
30
|
+
_bytes;
|
|
31
|
+
_pos;
|
|
32
|
+
_strings;
|
|
33
|
+
constructor(data) {
|
|
34
|
+
this._bytes = data;
|
|
35
|
+
this._view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
36
|
+
this._pos = 0;
|
|
37
|
+
this._strings = [];
|
|
38
|
+
}
|
|
39
|
+
readU8() {
|
|
40
|
+
if (this._pos >= this._bytes.length)
|
|
41
|
+
throw new Error(`SchemaView blob truncated: cannot read u8 at offset ${this._pos} (length ${this._bytes.length})`);
|
|
42
|
+
return this._bytes[this._pos++];
|
|
43
|
+
}
|
|
44
|
+
readU16() { const v = this._view.getUint16(this._pos, true); this._pos += 2; return v; }
|
|
45
|
+
readU32() { const v = this._view.getUint32(this._pos, true); this._pos += 4; return v; }
|
|
46
|
+
readI32() { const v = this._view.getInt32(this._pos, true); this._pos += 4; return v; }
|
|
47
|
+
readF64() { const v = this._view.getFloat64(this._pos, true); this._pos += 8; return v; }
|
|
48
|
+
get pos() { return this._pos; }
|
|
49
|
+
set pos(v) { this._pos = v; }
|
|
50
|
+
/** Read a string-table reference (U32 index) and return the original string. */
|
|
51
|
+
readSRef() {
|
|
52
|
+
const idx = this.readU32();
|
|
53
|
+
if (idx >= this._strings.length)
|
|
54
|
+
throw new Error(`SchemaView blob: string reference ${idx} out of range (string table size ${this._strings.length})`);
|
|
55
|
+
return this._strings[idx];
|
|
56
|
+
}
|
|
57
|
+
/** Validate a count-prefixed table header: the declared count cannot exceed what the remaining
|
|
58
|
+
* buffer could plausibly hold. Each entry consumes at least `minBytesPerEntry` bytes. */
|
|
59
|
+
validateCount(count, minBytesPerEntry, tableName) {
|
|
60
|
+
const remaining = this._bytes.length - this._pos;
|
|
61
|
+
if (count > remaining / Math.max(1, minBytesPerEntry))
|
|
62
|
+
throw new Error(`SchemaView blob: ${tableName} count ${count} exceeds remaining buffer (${remaining} bytes)`);
|
|
63
|
+
}
|
|
64
|
+
/** Parse the string table at the given offset. */
|
|
65
|
+
parseStringTable(offset) {
|
|
66
|
+
if (offset > this._bytes.length)
|
|
67
|
+
throw new Error(`SchemaView blob: stringTable offset ${offset} is past end of blob (length ${this._bytes.length})`);
|
|
68
|
+
const saved = this._pos;
|
|
69
|
+
this._pos = offset;
|
|
70
|
+
const count = this.readU32();
|
|
71
|
+
// Each entry is at minimum a 4-byte length prefix - a count larger than the remaining bytes
|
|
72
|
+
// cannot possibly be valid and would cause a huge `new Array` allocation on a malformed blob.
|
|
73
|
+
const remaining = this._bytes.length - this._pos;
|
|
74
|
+
if (count > remaining / 4)
|
|
75
|
+
throw new Error(`SchemaView blob: stringTable count ${count} exceeds remaining buffer (${remaining} bytes)`);
|
|
76
|
+
this._strings = new Array(count);
|
|
77
|
+
const decoder = new TextDecoder();
|
|
78
|
+
for (let i = 0; i < count; i++) {
|
|
79
|
+
const len = this.readU32();
|
|
80
|
+
if (len === 0) {
|
|
81
|
+
this._strings[i] = "";
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
if (len > this._bytes.length - this._pos)
|
|
85
|
+
throw new Error(`SchemaView blob: string entry ${i} has length ${len} but only ${this._bytes.length - this._pos} bytes remain`);
|
|
86
|
+
this._strings[i] = decoder.decode(this._bytes.subarray(this._pos, this._pos + len));
|
|
87
|
+
this._pos += len;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
this._pos = saved;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Read a U32 that uses 0xFFFFFFFF as a sentinel for "not set". */
|
|
94
|
+
function readOptionalU32(reader) {
|
|
95
|
+
const v = reader.readU32();
|
|
96
|
+
return v === 0xFFFFFFFF ? undefined : v;
|
|
97
|
+
}
|
|
98
|
+
/** Helper: read a tag byte and validate it matches the expected tag. */
|
|
99
|
+
function expectTag(reader, expected) {
|
|
100
|
+
const tag = reader.readU8();
|
|
101
|
+
if (tag !== expected)
|
|
102
|
+
throw new Error(`Expected tag 0x${expected.toString(16)} but found 0x${tag.toString(16)} at offset ${reader.pos - 1}`);
|
|
103
|
+
}
|
|
104
|
+
/** Parse a schema view blob (binary format) into a `SchemaView`.
|
|
105
|
+
*
|
|
106
|
+
* Layout: Header, PropertyDefTable, SchemaTable, EnumTable, KoQTable, PropCatTable, ClassTable, StringTable.
|
|
107
|
+
* Each table is count-prefixed. Schema items carry their schema's ecInstanceId for ownership resolution.
|
|
108
|
+
* Classes have count-prefixed inline sub-items (base classes, property refs, constraints).
|
|
109
|
+
*
|
|
110
|
+
* Consumers should call `SchemaView.fromBinary` instead - this function is the low-level
|
|
111
|
+
* implementation behind it.
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
function parseSchemaViewBlob(data, schemaToken) {
|
|
115
|
+
const reader = new BinaryReader(data);
|
|
116
|
+
// Header: magic(4) + version(1) + stringTableOffset(4)
|
|
117
|
+
const magic = reader.readU32();
|
|
118
|
+
if (magic !== MAGIC)
|
|
119
|
+
throw new Error(`Invalid SchemaView blob magic: 0x${magic.toString(16)}, expected 0x${MAGIC.toString(16)}`);
|
|
120
|
+
const version = reader.readU8();
|
|
121
|
+
if (version !== SchemaViewInterfaces_1.schemaViewFormatVersion)
|
|
122
|
+
throw new Error(`Unsupported schema view format version: ${version}, expected ${SchemaViewInterfaces_1.schemaViewFormatVersion}`);
|
|
123
|
+
const stOffset = reader.readU32();
|
|
124
|
+
reader.parseStringTable(stOffset);
|
|
125
|
+
const builder = new SchemaView_1.SchemaViewBuilder();
|
|
126
|
+
// Cross-reference maps (ecInstanceId -> builder array index)
|
|
127
|
+
const schemaEcIdToIdx = new Map();
|
|
128
|
+
const enumRowIdToIdx = new Map();
|
|
129
|
+
const koqRowIdToIdx = new Map();
|
|
130
|
+
const catRowIdToIdx = new Map();
|
|
131
|
+
const classRowIdToIdx = new Map();
|
|
132
|
+
// Per-schema metadata for name-based class resolution
|
|
133
|
+
const schemaInfos = [];
|
|
134
|
+
// Per-schema item range tracking (indexed by schemaIdx)
|
|
135
|
+
const schemaEnumStarts = [];
|
|
136
|
+
const schemaEnumCounts = [];
|
|
137
|
+
const schemaKoqStarts = [];
|
|
138
|
+
const schemaKoqCounts = [];
|
|
139
|
+
const schemaCatStarts = [];
|
|
140
|
+
const schemaCatCounts = [];
|
|
141
|
+
const schemaClassStarts = [];
|
|
142
|
+
const schemaClassCounts = [];
|
|
143
|
+
// Deferred class data for cross-reference resolution
|
|
144
|
+
const pendingClasses = [];
|
|
145
|
+
// ---- PropertyDefTable ----
|
|
146
|
+
expectTag(reader, Tag.PropertyDefTable);
|
|
147
|
+
const defCount = reader.readU32();
|
|
148
|
+
// Each PreParsedDef consumes at least ~30 bytes (mix of u8/u16/u32 fields + string refs).
|
|
149
|
+
// Use a conservative lower bound of 8 bytes to catch wildly oversized counts on malformed blobs.
|
|
150
|
+
reader.validateCount(defCount, 8, "PropertyDefTable");
|
|
151
|
+
const preParsedDefs = new Array(defCount);
|
|
152
|
+
for (let i = 0; i < defCount; i++) {
|
|
153
|
+
preParsedDefs[i] = {
|
|
154
|
+
name: reader.readSRef(),
|
|
155
|
+
kind: reader.readU8(),
|
|
156
|
+
primitiveType: reader.readU16(),
|
|
157
|
+
extType: reader.readSRef(),
|
|
158
|
+
enumRowId: reader.readU32(),
|
|
159
|
+
structClassRowId: reader.readU32(),
|
|
160
|
+
koqRowId: reader.readU32(),
|
|
161
|
+
catRowId: reader.readU32(),
|
|
162
|
+
arrayMinOccurs: readOptionalU32(reader),
|
|
163
|
+
arrayMaxOccurs: readOptionalU32(reader),
|
|
164
|
+
navRelClassRowId: reader.readU32(),
|
|
165
|
+
navDirection: reader.readU8(),
|
|
166
|
+
isReadonly: reader.readU8() !== 0,
|
|
167
|
+
isHidden: reader.readU8() !== 0,
|
|
168
|
+
description: reader.readSRef(),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// ---- SchemaTable ----
|
|
172
|
+
expectTag(reader, Tag.SchemaTable);
|
|
173
|
+
const schemaCount = reader.readU32();
|
|
174
|
+
reader.validateCount(schemaCount, 8, "SchemaTable");
|
|
175
|
+
for (let i = 0; i < schemaCount; i++) {
|
|
176
|
+
const name = reader.readSRef();
|
|
177
|
+
const vRead = reader.readU16();
|
|
178
|
+
const vWrite = reader.readU16();
|
|
179
|
+
const vMinor = reader.readU16();
|
|
180
|
+
const alias = reader.readSRef();
|
|
181
|
+
const label = reader.readSRef();
|
|
182
|
+
const description = reader.readSRef();
|
|
183
|
+
const ecInstanceId = reader.readU32();
|
|
184
|
+
const isHidden = reader.readU8() !== 0;
|
|
185
|
+
const schemaIdx = builder.addSchema({
|
|
186
|
+
ecInstanceId,
|
|
187
|
+
nameStringIdx: builder.internString(name),
|
|
188
|
+
aliasStringIdx: builder.internString(alias),
|
|
189
|
+
labelStringIdx: builder.internString(label),
|
|
190
|
+
descriptionStringIdx: builder.internString(description),
|
|
191
|
+
versionRead: vRead,
|
|
192
|
+
versionWrite: vWrite,
|
|
193
|
+
versionMinor: vMinor,
|
|
194
|
+
classRangeStart: 0, classCount: 0,
|
|
195
|
+
enumRangeStart: 0, enumCount: 0,
|
|
196
|
+
koqRangeStart: 0, koqCount: 0,
|
|
197
|
+
catRangeStart: 0, catCount: 0,
|
|
198
|
+
isHidden,
|
|
199
|
+
});
|
|
200
|
+
schemaEcIdToIdx.set(ecInstanceId, schemaIdx);
|
|
201
|
+
schemaInfos.push({ name, schemaIdx, classNameToIdx: new Map() });
|
|
202
|
+
schemaEnumStarts.push(0);
|
|
203
|
+
schemaEnumCounts.push(0);
|
|
204
|
+
schemaKoqStarts.push(0);
|
|
205
|
+
schemaKoqCounts.push(0);
|
|
206
|
+
schemaCatStarts.push(0);
|
|
207
|
+
schemaCatCounts.push(0);
|
|
208
|
+
schemaClassStarts.push(0);
|
|
209
|
+
schemaClassCounts.push(0);
|
|
210
|
+
}
|
|
211
|
+
/** Track an item's schema ownership and update range counters. */
|
|
212
|
+
function trackItem(schemaEcId, globalIdx, starts, counts) {
|
|
213
|
+
const schemaIdx = schemaEcIdToIdx.get(schemaEcId);
|
|
214
|
+
if (schemaIdx === undefined)
|
|
215
|
+
throw new Error(`SchemaView blob: unknown schema ecInstanceId ${schemaEcId}`);
|
|
216
|
+
if (counts[schemaIdx] === 0)
|
|
217
|
+
starts[schemaIdx] = globalIdx;
|
|
218
|
+
counts[schemaIdx]++;
|
|
219
|
+
return schemaIdx;
|
|
220
|
+
}
|
|
221
|
+
// ---- EnumTable ----
|
|
222
|
+
expectTag(reader, Tag.EnumTable);
|
|
223
|
+
const enumTotalCount = reader.readU32();
|
|
224
|
+
reader.validateCount(enumTotalCount, 8, "EnumTable");
|
|
225
|
+
for (let i = 0; i < enumTotalCount; i++) {
|
|
226
|
+
const schemaEcId = reader.readU32();
|
|
227
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaEnumStarts, schemaEnumCounts);
|
|
228
|
+
const eName = reader.readSRef();
|
|
229
|
+
const ePrimType = reader.readU8();
|
|
230
|
+
const eIsStrict = reader.readU8() !== 0;
|
|
231
|
+
const eLabel = reader.readSRef();
|
|
232
|
+
const eDesc = reader.readSRef();
|
|
233
|
+
const eValuesJson = reader.readSRef();
|
|
234
|
+
const eEcInstanceId = reader.readU32();
|
|
235
|
+
const enumeratorStart = builder.enumeratorCount;
|
|
236
|
+
let enumeratorCount = 0;
|
|
237
|
+
if (eValuesJson) {
|
|
238
|
+
try {
|
|
239
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
240
|
+
const values = JSON.parse(eValuesJson);
|
|
241
|
+
for (const v of values) {
|
|
242
|
+
const value = v.IntValue !== undefined ? v.IntValue : (v.StringValue ?? "");
|
|
243
|
+
const name = v.Name ?? (typeof value === "string" ? value : `${eName}${value}`);
|
|
244
|
+
builder.addEnumerator({
|
|
245
|
+
nameStringIdx: builder.internString(name),
|
|
246
|
+
labelStringIdx: builder.internString(v.DisplayLabel),
|
|
247
|
+
descriptionStringIdx: builder.internString(v.Description),
|
|
248
|
+
value,
|
|
249
|
+
});
|
|
250
|
+
enumeratorCount++;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch (e) {
|
|
254
|
+
core_bentley_1.Logger.logWarning("ecschema-metadata.SchemaView", `Malformed EnumValues JSON for enumeration "${eName}": ${core_bentley_1.BentleyError.getErrorMessage(e)}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const eIdx = builder.addEnumeration({
|
|
258
|
+
ecInstanceId: eEcInstanceId,
|
|
259
|
+
schemaIdx,
|
|
260
|
+
nameStringIdx: builder.internString(eName),
|
|
261
|
+
labelStringIdx: builder.internString(eLabel),
|
|
262
|
+
descriptionStringIdx: builder.internString(eDesc),
|
|
263
|
+
primitiveType: ePrimType,
|
|
264
|
+
isStrict: eIsStrict,
|
|
265
|
+
enumeratorStart,
|
|
266
|
+
enumeratorCount,
|
|
267
|
+
});
|
|
268
|
+
enumRowIdToIdx.set(eEcInstanceId, eIdx);
|
|
269
|
+
}
|
|
270
|
+
// ---- KoQTable ----
|
|
271
|
+
expectTag(reader, Tag.KoQTable);
|
|
272
|
+
const koqTotalCount = reader.readU32();
|
|
273
|
+
reader.validateCount(koqTotalCount, 8, "KoQTable");
|
|
274
|
+
for (let i = 0; i < koqTotalCount; i++) {
|
|
275
|
+
const schemaEcId = reader.readU32();
|
|
276
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaKoqStarts, schemaKoqCounts);
|
|
277
|
+
const kName = reader.readSRef();
|
|
278
|
+
const kLabel = reader.readSRef();
|
|
279
|
+
const kDesc = reader.readSRef();
|
|
280
|
+
const kPersUnit = reader.readSRef();
|
|
281
|
+
const kRelError = reader.readF64();
|
|
282
|
+
const kPresUnits = reader.readSRef();
|
|
283
|
+
const kEcInstanceId = reader.readU32();
|
|
284
|
+
const kIdx = builder.addKoq({
|
|
285
|
+
ecInstanceId: kEcInstanceId,
|
|
286
|
+
schemaIdx,
|
|
287
|
+
nameStringIdx: builder.internString(kName),
|
|
288
|
+
labelStringIdx: builder.internString(kLabel),
|
|
289
|
+
descriptionStringIdx: builder.internString(kDesc),
|
|
290
|
+
persistenceUnitStringIdx: builder.internString(kPersUnit),
|
|
291
|
+
presentationFormatsStringIdx: builder.internString(kPresUnits),
|
|
292
|
+
relativeError: kRelError,
|
|
293
|
+
});
|
|
294
|
+
koqRowIdToIdx.set(kEcInstanceId, kIdx);
|
|
295
|
+
}
|
|
296
|
+
// ---- PropCatTable ----
|
|
297
|
+
expectTag(reader, Tag.PropCatTable);
|
|
298
|
+
const catTotalCount = reader.readU32();
|
|
299
|
+
reader.validateCount(catTotalCount, 8, "PropCatTable");
|
|
300
|
+
for (let i = 0; i < catTotalCount; i++) {
|
|
301
|
+
const schemaEcId = reader.readU32();
|
|
302
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaCatStarts, schemaCatCounts);
|
|
303
|
+
const pcName = reader.readSRef();
|
|
304
|
+
const pcLabel = reader.readSRef();
|
|
305
|
+
const pcDesc = reader.readSRef();
|
|
306
|
+
const pcPriority = reader.readI32();
|
|
307
|
+
const pcEcInstanceId = reader.readU32();
|
|
308
|
+
const pcIdx = builder.addPropertyCategory({
|
|
309
|
+
ecInstanceId: pcEcInstanceId,
|
|
310
|
+
schemaIdx,
|
|
311
|
+
nameStringIdx: builder.internString(pcName),
|
|
312
|
+
labelStringIdx: builder.internString(pcLabel),
|
|
313
|
+
descriptionStringIdx: builder.internString(pcDesc),
|
|
314
|
+
priority: pcPriority,
|
|
315
|
+
});
|
|
316
|
+
catRowIdToIdx.set(pcEcInstanceId, pcIdx);
|
|
317
|
+
}
|
|
318
|
+
// ---- ClassTable ----
|
|
319
|
+
expectTag(reader, Tag.ClassTable);
|
|
320
|
+
const classTotalCount = reader.readU32();
|
|
321
|
+
reader.validateCount(classTotalCount, 8, "ClassTable");
|
|
322
|
+
for (let i = 0; i < classTotalCount; i++) {
|
|
323
|
+
const schemaEcId = reader.readU32();
|
|
324
|
+
const schemaIdx = trackItem(schemaEcId, i, schemaClassStarts, schemaClassCounts);
|
|
325
|
+
const schemaInfo = schemaInfos[schemaIdx];
|
|
326
|
+
const cName = reader.readSRef();
|
|
327
|
+
const cType = reader.readU8();
|
|
328
|
+
const cModifier = reader.readU8();
|
|
329
|
+
const cLabel = reader.readSRef();
|
|
330
|
+
const cDesc = reader.readSRef();
|
|
331
|
+
let relStrength = ECObjects_1.StrengthType.Referencing;
|
|
332
|
+
let relStrengthDir = ECObjects_1.StrengthDirection.Forward;
|
|
333
|
+
if (cType === SchemaViewInterfaces_1.ClassType.Relationship) {
|
|
334
|
+
relStrength = reader.readU8();
|
|
335
|
+
relStrengthDir = reader.readU8();
|
|
336
|
+
}
|
|
337
|
+
const cEcInstanceId = reader.readU32();
|
|
338
|
+
// Tri-state hidden: 0=undefined (no CA, schema doesn't hide), 1=true (hidden), 2=false (explicitly shown)
|
|
339
|
+
const cHiddenByte = reader.readU8();
|
|
340
|
+
const cIsHidden = cHiddenByte === 1 ? true : cHiddenByte === 2 ? false : undefined;
|
|
341
|
+
// Base classes (count-prefixed)
|
|
342
|
+
const baseCount = reader.readU16();
|
|
343
|
+
const baseClasses = [];
|
|
344
|
+
for (let b = 0; b < baseCount; b++) {
|
|
345
|
+
baseClasses.push({
|
|
346
|
+
schemaName: reader.readSRef(),
|
|
347
|
+
className: reader.readSRef(),
|
|
348
|
+
ordinal: reader.readU8(),
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
// Property refs (count-prefixed)
|
|
352
|
+
const propRefCount = reader.readU16();
|
|
353
|
+
const propRefs = [];
|
|
354
|
+
for (let p = 0; p < propRefCount; p++) {
|
|
355
|
+
propRefs.push({
|
|
356
|
+
preDefIdx: reader.readU32(),
|
|
357
|
+
labelStringIdx: builder.internString(reader.readSRef()),
|
|
358
|
+
priority: reader.readI32(),
|
|
359
|
+
ecInstanceId: reader.readU32(),
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
// Constraints (count-prefixed, only for relationships)
|
|
363
|
+
const constraints = [];
|
|
364
|
+
if (cType === SchemaViewInterfaces_1.ClassType.Relationship) {
|
|
365
|
+
const constrCount = reader.readU8();
|
|
366
|
+
for (let c = 0; c < constrCount; c++) {
|
|
367
|
+
const rcEnd = reader.readU8();
|
|
368
|
+
const rcMultLower = reader.readU32();
|
|
369
|
+
const rcMultUpper = reader.readU32();
|
|
370
|
+
const rcIsPoly = reader.readU8() !== 0;
|
|
371
|
+
const rcRoleLabel = reader.readSRef();
|
|
372
|
+
const rcAbsSchema = reader.readSRef();
|
|
373
|
+
const rcAbsClass = reader.readSRef();
|
|
374
|
+
// Constraint classes (count-prefixed)
|
|
375
|
+
const ccCount = reader.readU8();
|
|
376
|
+
const constraintClasses = [];
|
|
377
|
+
for (let cc = 0; cc < ccCount; cc++) {
|
|
378
|
+
constraintClasses.push({
|
|
379
|
+
schemaName: reader.readSRef(),
|
|
380
|
+
className: reader.readSRef(),
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
constraints.push({
|
|
384
|
+
relEnd: rcEnd,
|
|
385
|
+
isPolymorphic: rcIsPoly,
|
|
386
|
+
multiplicityLower: rcMultLower,
|
|
387
|
+
multiplicityUpper: rcMultUpper,
|
|
388
|
+
roleLabel: rcRoleLabel,
|
|
389
|
+
abstractSchemaName: rcAbsSchema,
|
|
390
|
+
abstractClassName: rcAbsClass,
|
|
391
|
+
constraintClasses,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
const nameStringIdx = builder.internString(cName);
|
|
396
|
+
const classIdx = builder.addClass({
|
|
397
|
+
ecInstanceId: cEcInstanceId,
|
|
398
|
+
schemaIdx,
|
|
399
|
+
nameStringIdx,
|
|
400
|
+
labelStringIdx: builder.internString(cLabel),
|
|
401
|
+
descriptionStringIdx: builder.internString(cDesc),
|
|
402
|
+
type: cType,
|
|
403
|
+
modifier: cModifier,
|
|
404
|
+
baseClassIdx: -1,
|
|
405
|
+
mixinStartIdx: -1,
|
|
406
|
+
mixinCount: 0,
|
|
407
|
+
ownPropStart: 0,
|
|
408
|
+
ownPropCount: 0,
|
|
409
|
+
strength: relStrength,
|
|
410
|
+
strengthDirection: relStrengthDir,
|
|
411
|
+
sourceConstraintIdx: -1,
|
|
412
|
+
targetConstraintIdx: -1,
|
|
413
|
+
isHidden: cIsHidden,
|
|
414
|
+
});
|
|
415
|
+
schemaInfo.classNameToIdx.set(cName.toLowerCase(), classIdx);
|
|
416
|
+
classRowIdToIdx.set(cEcInstanceId, classIdx);
|
|
417
|
+
pendingClasses.push({
|
|
418
|
+
schemaIdx,
|
|
419
|
+
classIdx,
|
|
420
|
+
ecInstanceId: cEcInstanceId,
|
|
421
|
+
nameStringIdx,
|
|
422
|
+
labelStringIdx: builder.internString(cLabel),
|
|
423
|
+
descriptionStringIdx: builder.internString(cDesc),
|
|
424
|
+
type: cType,
|
|
425
|
+
modifier: cModifier,
|
|
426
|
+
relStrength,
|
|
427
|
+
relStrengthDir,
|
|
428
|
+
baseClasses,
|
|
429
|
+
propRefs,
|
|
430
|
+
constraints,
|
|
431
|
+
schemaName: schemaInfo.name,
|
|
432
|
+
isHidden: cIsHidden,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
// ---- Finalize per-schema item ranges ----
|
|
436
|
+
for (let i = 0; i < schemaCount; i++) {
|
|
437
|
+
builder.updateSchemaRanges(i, {
|
|
438
|
+
classRangeStart: schemaClassStarts[i] ?? 0,
|
|
439
|
+
classCount: schemaClassCounts[i] ?? 0,
|
|
440
|
+
enumRangeStart: schemaEnumStarts[i] ?? 0,
|
|
441
|
+
enumCount: schemaEnumCounts[i] ?? 0,
|
|
442
|
+
koqRangeStart: schemaKoqStarts[i] ?? 0,
|
|
443
|
+
koqCount: schemaKoqCounts[i] ?? 0,
|
|
444
|
+
catRangeStart: schemaCatStarts[i] ?? 0,
|
|
445
|
+
catCount: schemaCatCounts[i] ?? 0,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
// Build a global name resolver: "SchemaName:ClassName" -> classIdx
|
|
449
|
+
const classResolver = new Map();
|
|
450
|
+
for (const s of schemaInfos) {
|
|
451
|
+
for (const [lowerName, idx] of s.classNameToIdx)
|
|
452
|
+
classResolver.set(`${s.name.toLowerCase()}:${lowerName}`, idx);
|
|
453
|
+
}
|
|
454
|
+
// Resolve pre-parsed defs to PropertyDef objects. Maps preParsedDef index -> builder defIdx.
|
|
455
|
+
const danglingRefs = [];
|
|
456
|
+
const resolvedDefMap = new Map();
|
|
457
|
+
const brokenDefs = new Set();
|
|
458
|
+
for (let i = 0; i < preParsedDefs.length; i++) {
|
|
459
|
+
const prDef = preParsedDefs[i];
|
|
460
|
+
let structClassIdx = -1;
|
|
461
|
+
if (prDef.structClassRowId !== 0) {
|
|
462
|
+
structClassIdx = classRowIdToIdx.get(prDef.structClassRowId) ?? -1;
|
|
463
|
+
if (structClassIdx === -1) {
|
|
464
|
+
brokenDefs.add(i);
|
|
465
|
+
danglingRefs.push(`Dropped properties with struct class rowId ${prDef.structClassRowId}`);
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
let navRelClassIdx = -1;
|
|
470
|
+
if (prDef.navRelClassRowId !== 0) {
|
|
471
|
+
navRelClassIdx = classRowIdToIdx.get(prDef.navRelClassRowId) ?? -1;
|
|
472
|
+
if (navRelClassIdx === -1) {
|
|
473
|
+
brokenDefs.add(i);
|
|
474
|
+
danglingRefs.push(`Dropped properties with nav relationship rowId ${prDef.navRelClassRowId}`);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
let enumIdx = -1;
|
|
479
|
+
if (prDef.enumRowId !== 0) {
|
|
480
|
+
enumIdx = enumRowIdToIdx.get(prDef.enumRowId) ?? -1;
|
|
481
|
+
if (enumIdx === -1)
|
|
482
|
+
danglingRefs.push(`Unresolved enum rowId ${prDef.enumRowId}`);
|
|
483
|
+
}
|
|
484
|
+
let koqIdx = -1;
|
|
485
|
+
if (prDef.koqRowId !== 0)
|
|
486
|
+
koqIdx = koqRowIdToIdx.get(prDef.koqRowId) ?? -1;
|
|
487
|
+
let categoryIdx = -1;
|
|
488
|
+
if (prDef.catRowId !== 0)
|
|
489
|
+
categoryIdx = catRowIdToIdx.get(prDef.catRowId) ?? -1;
|
|
490
|
+
const def = {
|
|
491
|
+
nameStringIdx: builder.internString(prDef.name),
|
|
492
|
+
descriptionStringIdx: builder.internString(prDef.description),
|
|
493
|
+
kind: prDef.kind,
|
|
494
|
+
primitiveType: prDef.primitiveType,
|
|
495
|
+
extTypeStringIdx: builder.internString(prDef.extType),
|
|
496
|
+
enumIdx,
|
|
497
|
+
koqIdx,
|
|
498
|
+
structClassIdx,
|
|
499
|
+
navRelClassIdx,
|
|
500
|
+
navDirection: prDef.navDirection,
|
|
501
|
+
categoryIdx,
|
|
502
|
+
isReadOnly: prDef.isReadonly,
|
|
503
|
+
isHidden: prDef.isHidden,
|
|
504
|
+
arrayMinOccurs: prDef.arrayMinOccurs,
|
|
505
|
+
arrayMaxOccurs: prDef.arrayMaxOccurs,
|
|
506
|
+
};
|
|
507
|
+
resolvedDefMap.set(i, builder.addPropertyDef(def));
|
|
508
|
+
}
|
|
509
|
+
// Resolve cross-references and finalize classes
|
|
510
|
+
for (const pc of pendingClasses) {
|
|
511
|
+
pc.baseClasses.sort((a, b) => a.ordinal - b.ordinal);
|
|
512
|
+
const classFullName = `${pc.schemaName}:${builder.getString(pc.nameStringIdx)}`;
|
|
513
|
+
let baseClassIdx = -1;
|
|
514
|
+
const mixinStartIdx = pc.baseClasses.length > 1 ? builder.classMixinCount : -1;
|
|
515
|
+
let mixinCount = 0;
|
|
516
|
+
for (const bc of pc.baseClasses) {
|
|
517
|
+
const bcKey = `${bc.schemaName.toLowerCase()}:${bc.className.toLowerCase()}`;
|
|
518
|
+
const bcIdx = classResolver.get(bcKey) ?? -1;
|
|
519
|
+
if (bc.ordinal === 0) {
|
|
520
|
+
if (bcIdx === -1 && bc.schemaName)
|
|
521
|
+
danglingRefs.push(`${classFullName} -> base class ${bc.schemaName}:${bc.className}`);
|
|
522
|
+
baseClassIdx = bcIdx;
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
if (bcIdx === -1) {
|
|
526
|
+
danglingRefs.push(`${classFullName} -> mixin ${bc.schemaName}:${bc.className}`);
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
builder.addClassMixin(bcIdx);
|
|
530
|
+
mixinCount++;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
const ownPropStart = builder.propertyRefCount;
|
|
534
|
+
for (const pr of pc.propRefs) {
|
|
535
|
+
if (brokenDefs.has(pr.preDefIdx))
|
|
536
|
+
continue;
|
|
537
|
+
const defIdx = resolvedDefMap.get(pr.preDefIdx);
|
|
538
|
+
if (defIdx === undefined)
|
|
539
|
+
continue;
|
|
540
|
+
builder.addPropertyRef({
|
|
541
|
+
ecInstanceId: pr.ecInstanceId,
|
|
542
|
+
defIdx,
|
|
543
|
+
labelStringIdx: pr.labelStringIdx,
|
|
544
|
+
priority: pr.priority,
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
let sourceConstraintIdx = -1;
|
|
548
|
+
let targetConstraintIdx = -1;
|
|
549
|
+
for (const con of pc.constraints) {
|
|
550
|
+
const absKey = con.abstractSchemaName && con.abstractClassName
|
|
551
|
+
? `${con.abstractSchemaName.toLowerCase()}:${con.abstractClassName.toLowerCase()}`
|
|
552
|
+
: "";
|
|
553
|
+
const absClassIdx = absKey ? (classResolver.get(absKey) ?? -1) : -1;
|
|
554
|
+
if (absClassIdx === -1 && absKey)
|
|
555
|
+
danglingRefs.push(`${classFullName} constraint -> abstract ${con.abstractSchemaName}:${con.abstractClassName}`);
|
|
556
|
+
const classRefStart = builder.constraintClassRefCount;
|
|
557
|
+
let classRefCount = 0;
|
|
558
|
+
for (const cc of con.constraintClasses) {
|
|
559
|
+
const ccKey = `${cc.schemaName.toLowerCase()}:${cc.className.toLowerCase()}`;
|
|
560
|
+
const ccIdx = classResolver.get(ccKey) ?? -1;
|
|
561
|
+
if (ccIdx === -1) {
|
|
562
|
+
danglingRefs.push(`${classFullName} constraint -> class ${cc.schemaName}:${cc.className}`);
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
builder.addConstraintClassRef(ccIdx);
|
|
566
|
+
classRefCount++;
|
|
567
|
+
}
|
|
568
|
+
const constraintIdx = builder.addRelConstraint({
|
|
569
|
+
abstractConstraintIdx: absClassIdx,
|
|
570
|
+
polymorphic: con.isPolymorphic,
|
|
571
|
+
multiplicityLower: con.multiplicityLower,
|
|
572
|
+
multiplicityUpper: con.multiplicityUpper,
|
|
573
|
+
roleLabelStringIdx: builder.internString(con.roleLabel),
|
|
574
|
+
classRefStart,
|
|
575
|
+
classRefCount,
|
|
576
|
+
});
|
|
577
|
+
if (con.relEnd === 0)
|
|
578
|
+
sourceConstraintIdx = constraintIdx;
|
|
579
|
+
else
|
|
580
|
+
targetConstraintIdx = constraintIdx;
|
|
581
|
+
}
|
|
582
|
+
const updatedClass = {
|
|
583
|
+
ecInstanceId: pc.ecInstanceId,
|
|
584
|
+
schemaIdx: pc.schemaIdx,
|
|
585
|
+
nameStringIdx: pc.nameStringIdx,
|
|
586
|
+
labelStringIdx: pc.labelStringIdx,
|
|
587
|
+
descriptionStringIdx: pc.descriptionStringIdx,
|
|
588
|
+
type: pc.type,
|
|
589
|
+
modifier: pc.modifier,
|
|
590
|
+
baseClassIdx,
|
|
591
|
+
mixinStartIdx,
|
|
592
|
+
mixinCount,
|
|
593
|
+
ownPropStart,
|
|
594
|
+
ownPropCount: builder.propertyRefCount - ownPropStart,
|
|
595
|
+
strength: pc.relStrength,
|
|
596
|
+
strengthDirection: pc.relStrengthDir,
|
|
597
|
+
sourceConstraintIdx,
|
|
598
|
+
targetConstraintIdx,
|
|
599
|
+
isHidden: pc.isHidden,
|
|
600
|
+
};
|
|
601
|
+
builder.updateClass(pc.classIdx, updatedClass);
|
|
602
|
+
}
|
|
603
|
+
if (danglingRefs.length > 0) {
|
|
604
|
+
const cap = 20;
|
|
605
|
+
const lines = danglingRefs.length <= cap ? danglingRefs : [...danglingRefs.slice(0, cap), `... and ${danglingRefs.length - cap} more`];
|
|
606
|
+
core_bentley_1.Logger.logWarning("ecschema-metadata.SchemaView", `${danglingRefs.length} unresolved cross-reference(s) in schema view blob (likely from excluded schemas):\n ${lines.join("\n ")}`);
|
|
607
|
+
}
|
|
608
|
+
return builder.build(schemaToken);
|
|
609
|
+
}
|
|
610
|
+
//# sourceMappingURL=SchemaViewBinaryReader.js.map
|