@itwin/ecschema-metadata 5.12.0-dev.9 → 5.13.0-dev.1

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.
Files changed (196) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Constants.js.map +1 -1
  3. package/lib/cjs/DelayedPromise.js.map +1 -1
  4. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  5. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  6. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  7. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  8. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  9. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  10. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  11. package/lib/cjs/ECName.js.map +1 -1
  12. package/lib/cjs/ECObjects.js.map +1 -1
  13. package/lib/cjs/Exception.js.map +1 -1
  14. package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -1
  15. package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -1
  16. package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -1
  17. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  18. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +466 -466
  19. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  20. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  21. package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  22. package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  23. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +235 -235
  24. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  25. package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
  26. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +309 -309
  27. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  28. package/lib/cjs/Interfaces.js.map +1 -1
  29. package/lib/cjs/Localization/LocalizationProvider.js.map +1 -1
  30. package/lib/cjs/Localization/LocalizationTypes.js.map +1 -1
  31. package/lib/cjs/Localization/SchemaLocalization.d.ts +1 -1
  32. package/lib/cjs/Localization/SchemaLocalization.d.ts.map +1 -1
  33. package/lib/cjs/Localization/SchemaLocalization.js.map +1 -1
  34. package/lib/cjs/Metadata/Class.js.map +1 -1
  35. package/lib/cjs/Metadata/Constant.js.map +1 -1
  36. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  37. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  38. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  39. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  40. package/lib/cjs/Metadata/Format.js.map +1 -1
  41. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  42. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  43. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  44. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  45. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  46. package/lib/cjs/Metadata/Property.js.map +1 -1
  47. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  48. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  49. package/lib/cjs/Metadata/Schema.js.map +1 -1
  50. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  51. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  52. package/lib/cjs/PropertyTypes.js.map +1 -1
  53. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  54. package/lib/cjs/SchemaKey.js.map +1 -1
  55. package/lib/cjs/SchemaLoader.js.map +1 -1
  56. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  57. package/lib/cjs/SchemaView/SchemaManifest.d.ts +81 -0
  58. package/lib/cjs/SchemaView/SchemaManifest.d.ts.map +1 -0
  59. package/lib/cjs/SchemaView/SchemaManifest.js +131 -0
  60. package/lib/cjs/SchemaView/SchemaManifest.js.map +1 -0
  61. package/lib/cjs/{SchemaView.d.ts → SchemaView/SchemaView.d.ts} +23 -90
  62. package/lib/cjs/SchemaView/SchemaView.d.ts.map +1 -0
  63. package/lib/cjs/{SchemaView.js → SchemaView/SchemaView.js} +32 -198
  64. package/lib/cjs/SchemaView/SchemaView.js.map +1 -0
  65. package/lib/cjs/SchemaView/SchemaViewBinaryReader.d.ts +37 -0
  66. package/lib/cjs/SchemaView/SchemaViewBinaryReader.d.ts.map +1 -0
  67. package/lib/cjs/{SchemaViewBinaryReader.js → SchemaView/SchemaViewBinaryReader.js} +84 -43
  68. package/lib/cjs/SchemaView/SchemaViewBinaryReader.js.map +1 -0
  69. package/lib/cjs/SchemaView/SchemaViewBuilder.d.ts +116 -0
  70. package/lib/cjs/SchemaView/SchemaViewBuilder.d.ts.map +1 -0
  71. package/lib/cjs/SchemaView/SchemaViewBuilder.js +230 -0
  72. package/lib/cjs/SchemaView/SchemaViewBuilder.js.map +1 -0
  73. package/lib/cjs/{SchemaViewInterfaces.d.ts → SchemaView/SchemaViewInterfaces.d.ts} +1 -1
  74. package/lib/cjs/SchemaView/SchemaViewInterfaces.d.ts.map +1 -0
  75. package/lib/cjs/SchemaView/SchemaViewInterfaces.js.map +1 -0
  76. package/lib/cjs/SchemaView/SchemaViewManager.d.ts +114 -0
  77. package/lib/cjs/SchemaView/SchemaViewManager.d.ts.map +1 -0
  78. package/lib/cjs/SchemaView/SchemaViewManager.js +184 -0
  79. package/lib/cjs/SchemaView/SchemaViewManager.js.map +1 -0
  80. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  81. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  82. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  83. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  84. package/lib/cjs/ecschema-metadata.d.ts +6 -3
  85. package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
  86. package/lib/cjs/ecschema-metadata.js +6 -3
  87. package/lib/cjs/ecschema-metadata.js.map +1 -1
  88. package/lib/cjs/utils/ECClassHierarchy.js.map +1 -1
  89. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  90. package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
  91. package/lib/esm/Constants.js.map +1 -1
  92. package/lib/esm/DelayedPromise.js.map +1 -1
  93. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  94. package/lib/esm/Deserialization/Helper.js.map +1 -1
  95. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  96. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  97. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  98. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  99. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  100. package/lib/esm/ECName.js.map +1 -1
  101. package/lib/esm/ECObjects.js.map +1 -1
  102. package/lib/esm/Exception.js.map +1 -1
  103. package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -1
  104. package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -1
  105. package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -1
  106. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  107. package/lib/esm/IncrementalLoading/FullSchemaQueries.js +466 -466
  108. package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  109. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  110. package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  111. package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  112. package/lib/esm/IncrementalLoading/SchemaItemQueries.js +235 -235
  113. package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  114. package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
  115. package/lib/esm/IncrementalLoading/SchemaStubQueries.js +309 -309
  116. package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  117. package/lib/esm/Interfaces.js.map +1 -1
  118. package/lib/esm/Localization/LocalizationProvider.js.map +1 -1
  119. package/lib/esm/Localization/LocalizationTypes.js.map +1 -1
  120. package/lib/esm/Localization/SchemaLocalization.d.ts +1 -1
  121. package/lib/esm/Localization/SchemaLocalization.d.ts.map +1 -1
  122. package/lib/esm/Localization/SchemaLocalization.js.map +1 -1
  123. package/lib/esm/Metadata/Class.js.map +1 -1
  124. package/lib/esm/Metadata/Constant.js.map +1 -1
  125. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  126. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  127. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  128. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  129. package/lib/esm/Metadata/Format.js.map +1 -1
  130. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  131. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  132. package/lib/esm/Metadata/Mixin.js.map +1 -1
  133. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  134. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  135. package/lib/esm/Metadata/Property.js.map +1 -1
  136. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  137. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  138. package/lib/esm/Metadata/Schema.js.map +1 -1
  139. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  140. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  141. package/lib/esm/PropertyTypes.js.map +1 -1
  142. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  143. package/lib/esm/SchemaKey.js.map +1 -1
  144. package/lib/esm/SchemaLoader.js.map +1 -1
  145. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  146. package/lib/esm/SchemaView/SchemaManifest.d.ts +81 -0
  147. package/lib/esm/SchemaView/SchemaManifest.d.ts.map +1 -0
  148. package/lib/esm/SchemaView/SchemaManifest.js +127 -0
  149. package/lib/esm/SchemaView/SchemaManifest.js.map +1 -0
  150. package/lib/esm/{SchemaView.d.ts → SchemaView/SchemaView.d.ts} +23 -90
  151. package/lib/esm/SchemaView/SchemaView.d.ts.map +1 -0
  152. package/lib/esm/{SchemaView.js → SchemaView/SchemaView.js} +32 -197
  153. package/lib/esm/SchemaView/SchemaView.js.map +1 -0
  154. package/lib/esm/SchemaView/SchemaViewBinaryReader.d.ts +37 -0
  155. package/lib/esm/SchemaView/SchemaViewBinaryReader.d.ts.map +1 -0
  156. package/lib/esm/{SchemaViewBinaryReader.js → SchemaView/SchemaViewBinaryReader.js} +82 -43
  157. package/lib/esm/SchemaView/SchemaViewBinaryReader.js.map +1 -0
  158. package/lib/esm/SchemaView/SchemaViewBuilder.d.ts +116 -0
  159. package/lib/esm/SchemaView/SchemaViewBuilder.d.ts.map +1 -0
  160. package/lib/esm/SchemaView/SchemaViewBuilder.js +226 -0
  161. package/lib/esm/SchemaView/SchemaViewBuilder.js.map +1 -0
  162. package/lib/esm/{SchemaViewInterfaces.d.ts → SchemaView/SchemaViewInterfaces.d.ts} +1 -1
  163. package/lib/esm/SchemaView/SchemaViewInterfaces.d.ts.map +1 -0
  164. package/lib/esm/SchemaView/SchemaViewInterfaces.js.map +1 -0
  165. package/lib/esm/SchemaView/SchemaViewManager.d.ts +114 -0
  166. package/lib/esm/SchemaView/SchemaViewManager.d.ts.map +1 -0
  167. package/lib/esm/SchemaView/SchemaViewManager.js +180 -0
  168. package/lib/esm/SchemaView/SchemaViewManager.js.map +1 -0
  169. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  170. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  171. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  172. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  173. package/lib/esm/ecschema-metadata.d.ts +6 -3
  174. package/lib/esm/ecschema-metadata.d.ts.map +1 -1
  175. package/lib/esm/ecschema-metadata.js +6 -3
  176. package/lib/esm/ecschema-metadata.js.map +1 -1
  177. package/lib/esm/utils/ECClassHierarchy.js.map +1 -1
  178. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  179. package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
  180. package/package.json +8 -8
  181. package/lib/cjs/SchemaView.d.ts.map +0 -1
  182. package/lib/cjs/SchemaView.js.map +0 -1
  183. package/lib/cjs/SchemaViewBinaryReader.d.ts +0 -16
  184. package/lib/cjs/SchemaViewBinaryReader.d.ts.map +0 -1
  185. package/lib/cjs/SchemaViewBinaryReader.js.map +0 -1
  186. package/lib/cjs/SchemaViewInterfaces.d.ts.map +0 -1
  187. package/lib/cjs/SchemaViewInterfaces.js.map +0 -1
  188. package/lib/esm/SchemaView.d.ts.map +0 -1
  189. package/lib/esm/SchemaView.js.map +0 -1
  190. package/lib/esm/SchemaViewBinaryReader.d.ts +0 -16
  191. package/lib/esm/SchemaViewBinaryReader.d.ts.map +0 -1
  192. package/lib/esm/SchemaViewBinaryReader.js.map +0 -1
  193. package/lib/esm/SchemaViewInterfaces.d.ts.map +0 -1
  194. package/lib/esm/SchemaViewInterfaces.js.map +0 -1
  195. /package/lib/cjs/{SchemaViewInterfaces.js → SchemaView/SchemaViewInterfaces.js} +0 -0
  196. /package/lib/esm/{SchemaViewInterfaces.js → SchemaView/SchemaViewInterfaces.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewBinaryReader.js","sourceRoot":"","sources":["../../../src/SchemaView/SchemaViewBinaryReader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA2MH,kDAIC;AA7MD,sDAA2D;AAE3D,2DAAwD;AACxD,4CAA+D;AAC/D,iEAA0J;AAE1J;yFACyF;AACzF,IAAK,GAOJ;AAPD,WAAK,GAAG;IACN,sDAAuB,CAAA;IACvB,4CAAkB,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Y,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,WAAW,YAAY,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC;QACvI,qBAAM,CAAC,UAAU,CAAC,8BAA8B,EAAE,GAAG,YAAY,CAAC,MAAM,yFAAyF,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzL,CAAC;IAED,6FAA6F;IAC7F,4EAA4E;IAC5E,OAAO,CAAC,gBAAgB,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\nimport { type SchemaView } from \"./SchemaView\";\nimport { SchemaViewBuilder } from \"./SchemaViewBuilder\";\nimport { StrengthDirection, StrengthType } from \"../ECObjects\";\nimport { ClassData, ClassModifier, ClassType, PropertyDef, PropertyKind, schemaViewFormatVersion, SchemaViewPrimitiveType } from \"./SchemaViewInterfaces\";\n\n/** Binary record tags for the SchemaView blob format.\n * Each tag marks a flat, count-prefixed table. Must stay in sync with the C++ writer. */\nenum Tag {\n PropertyDefTable = 0x0A,\n SchemaTable = 0x10,\n EnumTable = 0x20,\n KoQTable = 0x30,\n PropCatTable = 0x31,\n ClassTable = 0x40,\n}\n\nconst MAGIC = 0x43534348; // \"CSCH\"\n\n/** Low-level binary reader for the SchemaView blob. */\nclass BinaryReader {\n private _view: DataView;\n private _bytes: Uint8Array;\n private _pos: number;\n private _strings: string[];\n\n constructor(data: Uint8Array) {\n this._bytes = data;\n this._view = new DataView(data.buffer, data.byteOffset, data.byteLength);\n this._pos = 0;\n this._strings = [];\n }\n\n public readU8(): number {\n if (this._pos >= this._bytes.length)\n throw new Error(`SchemaView blob truncated: cannot read u8 at offset ${this._pos} (length ${this._bytes.length})`);\n return this._bytes[this._pos++];\n }\n public readU16(): number { const v = this._view.getUint16(this._pos, true); this._pos += 2; return v; }\n public readU32(): number { const v = this._view.getUint32(this._pos, true); this._pos += 4; return v; }\n public readI32(): number { const v = this._view.getInt32(this._pos, true); this._pos += 4; return v; }\n public readF64(): number { const v = this._view.getFloat64(this._pos, true); this._pos += 8; return v; }\n public get pos(): number { return this._pos; }\n public set pos(v: number) { this._pos = v; }\n\n /** Read a string-table reference (U32 index) and return the original string. */\n public readSRef(): string {\n const idx = this.readU32();\n if (idx >= this._strings.length)\n throw new Error(`SchemaView blob: string reference ${idx} out of range (string table size ${this._strings.length})`);\n return this._strings[idx];\n }\n\n /** Validate a count-prefixed table header: the declared count cannot exceed what the remaining\n * buffer could plausibly hold. Each entry consumes at least `minBytesPerEntry` bytes. */\n public validateCount(count: number, minBytesPerEntry: number, tableName: string): void {\n const remaining = this._bytes.length - this._pos;\n if (count > remaining / Math.max(1, minBytesPerEntry))\n throw new Error(`SchemaView blob: ${tableName} count ${count} exceeds remaining buffer (${remaining} bytes)`);\n }\n\n /** Parse the string table at the given offset. */\n public parseStringTable(offset: number): void {\n if (offset > this._bytes.length)\n throw new Error(`SchemaView blob: stringTable offset ${offset} is past end of blob (length ${this._bytes.length})`);\n const saved = this._pos;\n this._pos = offset;\n const count = this.readU32();\n // Each entry is at minimum a 4-byte length prefix - a count larger than the remaining bytes\n // cannot possibly be valid and would cause a huge `new Array` allocation on a malformed blob.\n const remaining = this._bytes.length - this._pos;\n if (count > remaining / 4)\n throw new Error(`SchemaView blob: stringTable count ${count} exceeds remaining buffer (${remaining} bytes)`);\n this._strings = new Array(count);\n const decoder = new TextDecoder();\n for (let i = 0; i < count; i++) {\n const len = this.readU32();\n if (len === 0) {\n this._strings[i] = \"\";\n } else {\n if (len > this._bytes.length - this._pos)\n throw new Error(`SchemaView blob: string entry ${i} has length ${len} but only ${this._bytes.length - this._pos} bytes remain`);\n this._strings[i] = decoder.decode(this._bytes.subarray(this._pos, this._pos + len));\n this._pos += len;\n }\n }\n this._pos = saved;\n }\n}\n\n/** Read a U32 that uses 0xFFFFFFFF as a sentinel for \"not set\". */\nfunction readOptionalU32(reader: BinaryReader): number | undefined {\n const v = reader.readU32();\n return v === 0xFFFFFFFF ? undefined : v;\n}\n\n/** Temporary per-class data collected during parsing, before cross-references are resolved. */\ninterface PendingClass {\n schemaIdx: number;\n classIdx: number;\n ecInstanceId: number;\n nameStringIdx: number;\n labelStringIdx: number;\n descriptionStringIdx: number;\n type: ClassType;\n modifier: ClassModifier;\n relStrength: StrengthType;\n relStrengthDir: StrengthDirection;\n baseClasses: Array<{ schemaName: string; className: string; ordinal: number }>;\n propRefs: PendingPropRef[];\n constraints: PendingConstraint[];\n schemaName: string;\n isHidden: boolean | undefined;\n}\n\n/** A property reference from the binary PropertyDefTable. During parsing, `preDefIdx` stores the\n * index into the pre-parsed def array; during resolution it's mapped to the builder's deduped defIdx. */\ninterface PendingPropRef {\n preDefIdx: number; // index into preParsedDefs (mapped to builder defIdx during resolution)\n ecInstanceId: number;\n labelStringIdx: number;\n priority: number;\n}\n\n/** Pre-parsed property definition from the binary PropertyDefTable, with row ID cross-refs. */\ninterface PreParsedDef {\n name: string;\n description: string;\n kind: PropertyKind;\n primitiveType: SchemaViewPrimitiveType;\n extType: string;\n enumRowId: number; // ec_Enumeration.Id (0 = none)\n structClassRowId: number; // ec_Class.Id for struct type (0 = none)\n koqRowId: number; // ec_KindOfQuantity.Id (0 = none)\n catRowId: number; // ec_PropertyCategory.Id (0 = none)\n arrayMinOccurs: number | undefined;\n arrayMaxOccurs: number | undefined;\n navRelClassRowId: number; // ec_Class.Id for nav relationship (0 = none)\n navDirection: StrengthDirection;\n isReadonly: boolean;\n isHidden: boolean;\n}\n\ninterface PendingConstraint {\n relEnd: number; // 0=source, 1=target\n isPolymorphic: boolean;\n multiplicityLower: number;\n multiplicityUpper: number;\n roleLabel: string;\n abstractSchemaName: string;\n abstractClassName: string;\n constraintClasses: Array<{ schemaName: string; className: string }>;\n}\n\n/** Helper: read a tag byte and validate it matches the expected tag. */\nfunction expectTag(reader: BinaryReader, expected: Tag): void {\n const tag = reader.readU8();\n if (tag !== expected)\n throw new Error(`Expected tag 0x${expected.toString(16)} but found 0x${tag.toString(16)} at offset ${reader.pos - 1}`);\n}\n\n/** Reusable parse/merge context for SchemaView blobs. Holds the live `SchemaViewBuilder` plus the\n * cross-reference maps that must persist across fragment merges. Each `mergeBlob` appends one blob's\n * schemas into the shared builder and resolves cross-references - including cross-fragment ones -\n * against the accumulated maps. A whole-iModel blob is the degenerate case of a single fragment.\n * @note Fragments must be merged in dependency order, so a fragment only references schemas already\n * merged by an earlier one (or excluded schemas, which resolve to \"not present\").\n * @internal\n */\nexport class SchemaViewMergeContext {\n public readonly builder = new SchemaViewBuilder();\n\n // Cross-reference maps. Persist across fragments: a row id / name from a later fragment resolves\n // against a class, enum, koq, or category merged by an earlier fragment.\n public readonly schemaECIdToIdx = new Map<number, number>();\n public readonly enumRowIdToIdx = new Map<number, number>();\n public readonly koqRowIdToIdx = new Map<number, number>();\n public readonly catRowIdToIdx = new Map<number, number>();\n public readonly classRowIdToIdx = new Map<number, number>();\n // \"schemaname:classname\" (both lowercased) -> global class index. Resolves base/mixin/constraint\n // refs, which the blob encodes as schema+class name pairs, across fragment boundaries.\n public readonly classResolver = new Map<string, number>();\n // global schemaIdx -> schema name, for building resolver keys and dangling-ref diagnostics.\n public readonly schemaNames: string[] = [];\n\n /** Parse one fragment blob and append its schemas into the shared builder. Synchronous. */\n public mergeBlob(data: Uint8Array): void {\n mergeFragmentBlob(this, data);\n }\n}\n\n/** Parse a schema view blob (binary format) into a fresh `SchemaView`.\n *\n * Layout: Header, PropertyDefTable, SchemaTable, EnumTable, KoQTable, PropCatTable, ClassTable, StringTable.\n * Each table is count-prefixed. Schema items carry their schema's ecInstanceId for ownership resolution.\n * Classes have count-prefixed inline sub-items (base classes, property refs, constraints).\n *\n * Consumers should call `SchemaView.fromBinary` instead - this function is the low-level\n * implementation behind it.\n * @internal\n */\nexport function parseSchemaViewBlob(data: Uint8Array, schemaToken?: string): SchemaView {\n const ctx = new SchemaViewMergeContext();\n ctx.mergeBlob(data);\n return ctx.builder.build(schemaToken);\n}\n\n/** Parse one fragment blob and append it into the context's builder, resolving cross-references\n * against the context's accumulated global maps. Per-fragment scratch state stays local; everything\n * that must outlive the fragment lives on `ctx`.\n */\nfunction mergeFragmentBlob(ctx: SchemaViewMergeContext, data: Uint8Array): void {\n const builder = ctx.builder;\n const reader = new BinaryReader(data);\n\n // Header: magic(4) + version(1) + stringTableOffset(4)\n const magic = reader.readU32();\n if (magic !== MAGIC)\n throw new Error(`Invalid SchemaView blob magic: 0x${magic.toString(16)}, expected 0x${MAGIC.toString(16)}`);\n const version = reader.readU8();\n if (version !== schemaViewFormatVersion)\n throw new Error(`Unsupported schema view format version: ${version}, expected ${schemaViewFormatVersion}`);\n const stOffset = reader.readU32();\n reader.parseStringTable(stOffset);\n\n // Global index of the first schema this fragment adds. Local schema index = global - base.\n const schemaBaseIdx = builder.schemaCount;\n\n const { schemaECIdToIdx: schemaEcIdToIdx, enumRowIdToIdx, koqRowIdToIdx, catRowIdToIdx, classRowIdToIdx, classResolver } = ctx;\n\n // Per-schema item range tracking, indexed by LOCAL schema index (0-based within this fragment).\n const schemaEnumStarts: number[] = [];\n const schemaEnumCounts: number[] = [];\n const schemaKoqStarts: number[] = [];\n const schemaKoqCounts: number[] = [];\n const schemaCatStarts: number[] = [];\n const schemaCatCounts: number[] = [];\n const schemaClassStarts: number[] = [];\n const schemaClassCounts: number[] = [];\n\n // Deferred class data for cross-reference resolution (local to this fragment).\n const pendingClasses: PendingClass[] = [];\n\n // ---- PropertyDefTable ----\n expectTag(reader, Tag.PropertyDefTable);\n const defCount = reader.readU32();\n // Each PreParsedDef is a fixed 46 bytes (10x u32 + 1x u16 + 4x u8). The bound is deliberately\n // about half that, so a valid blob never trips the check.\n reader.validateCount(defCount, 23, \"PropertyDefTable\");\n const preParsedDefs: PreParsedDef[] = new Array(defCount);\n for (let i = 0; i < defCount; i++) {\n preParsedDefs[i] = {\n name: reader.readSRef(),\n kind: reader.readU8(),\n primitiveType: reader.readU16(),\n extType: reader.readSRef(),\n enumRowId: reader.readU32(),\n structClassRowId: reader.readU32(),\n koqRowId: reader.readU32(),\n catRowId: reader.readU32(),\n arrayMinOccurs: readOptionalU32(reader),\n arrayMaxOccurs: readOptionalU32(reader),\n navRelClassRowId: reader.readU32(),\n navDirection: reader.readU8(),\n isReadonly: reader.readU8() !== 0,\n isHidden: reader.readU8() !== 0,\n description: reader.readSRef(),\n };\n }\n\n // ---- SchemaTable ----\n expectTag(reader, Tag.SchemaTable);\n const schemaCount = reader.readU32();\n // Fixed 27 bytes per record (4x SRef + 3x u16 + u32 + u8).\n reader.validateCount(schemaCount, 13, \"SchemaTable\");\n for (let i = 0; i < schemaCount; i++) {\n const name = reader.readSRef();\n const vRead = reader.readU16();\n const vWrite = reader.readU16();\n const vMinor = reader.readU16();\n const alias = reader.readSRef();\n const label = reader.readSRef();\n const description = reader.readSRef();\n const ecInstanceId = reader.readU32();\n const isHidden = reader.readU8() !== 0;\n\n const schemaIdx = builder.addSchema({\n ecInstanceId,\n nameStringIdx: builder.internString(name),\n aliasStringIdx: builder.internString(alias),\n labelStringIdx: builder.internString(label),\n descriptionStringIdx: builder.internString(description),\n versionRead: vRead,\n versionWrite: vWrite,\n versionMinor: vMinor,\n classRangeStart: 0, classCount: 0,\n enumRangeStart: 0, enumCount: 0,\n koqRangeStart: 0, koqCount: 0,\n catRangeStart: 0, catCount: 0,\n isHidden,\n });\n schemaEcIdToIdx.set(ecInstanceId, schemaIdx);\n ctx.schemaNames[schemaIdx] = name;\n schemaEnumStarts.push(0); schemaEnumCounts.push(0);\n schemaKoqStarts.push(0); schemaKoqCounts.push(0);\n schemaCatStarts.push(0); schemaCatCounts.push(0);\n schemaClassStarts.push(0); schemaClassCounts.push(0);\n }\n\n /** Track an item's schema ownership and update its owning schema's range counters. `globalIdx`\n * is the item's global index in the builder; `starts`/`counts` are indexed by LOCAL schema index.\n * An item must be owned by a schema in its own fragment, so a foreign owner is a malformed blob. */\n function trackItem(schemaEcId: number, globalIdx: number, starts: number[], counts: number[]): number {\n const schemaIdx = schemaEcIdToIdx.get(schemaEcId);\n if (schemaIdx === undefined)\n throw new Error(`SchemaView blob: unknown schema ecInstanceId ${schemaEcId}`);\n const localIdx = schemaIdx - schemaBaseIdx;\n if (localIdx < 0 || localIdx >= schemaCount)\n throw new Error(`SchemaView fragment: item references schema ecInstanceId ${schemaEcId} not present in this fragment`);\n if (counts[localIdx] === 0)\n starts[localIdx] = globalIdx;\n counts[localIdx]++;\n return schemaIdx;\n }\n\n // ---- EnumTable ----\n expectTag(reader, Tag.EnumTable);\n const enumTotalCount = reader.readU32();\n // Fixed 27 bytes per record (4x SRef + 2x u32 + u16 + u8); enumerators live inside a JSON SRef.\n reader.validateCount(enumTotalCount, 13, \"EnumTable\");\n for (let i = 0; i < enumTotalCount; i++) {\n const schemaEcId = reader.readU32();\n const schemaIdx = trackItem(schemaEcId, builder.enumerationCount, schemaEnumStarts, schemaEnumCounts);\n\n const eName = reader.readSRef();\n const ePrimType = reader.readU16();\n const eIsStrict = reader.readU8() !== 0;\n const eLabel = reader.readSRef();\n const eDesc = reader.readSRef();\n const eValuesJson = reader.readSRef();\n const eEcInstanceId = reader.readU32();\n\n const enumeratorStart = builder.enumeratorCount;\n let enumeratorCount = 0;\n if (eValuesJson) {\n try {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const values = JSON.parse(eValuesJson) as Array<{ Name?: string; IntValue?: number; StringValue?: string; DisplayLabel?: string; Description?: string }>;\n for (const v of values) {\n const value = v.IntValue !== undefined ? v.IntValue : (v.StringValue ?? \"\");\n const name = v.Name ?? (typeof value === \"string\" ? value : `${eName}${value}`);\n builder.addEnumerator({\n nameStringIdx: builder.internString(name),\n labelStringIdx: builder.internString(v.DisplayLabel),\n descriptionStringIdx: builder.internString(v.Description),\n value,\n });\n enumeratorCount++;\n }\n } catch (e) {\n Logger.logWarning(\"ecschema-metadata.SchemaView\", `Malformed EnumValues JSON for enumeration \"${eName}\": ${BentleyError.getErrorMessage(e)}`);\n }\n }\n\n const eIdx = builder.addEnumeration({\n ecInstanceId: eEcInstanceId,\n schemaIdx,\n nameStringIdx: builder.internString(eName),\n labelStringIdx: builder.internString(eLabel),\n descriptionStringIdx: builder.internString(eDesc),\n primitiveType: ePrimType,\n isStrict: eIsStrict,\n enumeratorStart,\n enumeratorCount,\n });\n enumRowIdToIdx.set(eEcInstanceId, eIdx);\n }\n\n // ---- KoQTable ----\n expectTag(reader, Tag.KoQTable);\n const koqTotalCount = reader.readU32();\n // Fixed 36 bytes per record (6x SRef + f64 + u32).\n reader.validateCount(koqTotalCount, 18, \"KoQTable\");\n for (let i = 0; i < koqTotalCount; i++) {\n const schemaEcId = reader.readU32();\n const schemaIdx = trackItem(schemaEcId, builder.koqCount, schemaKoqStarts, schemaKoqCounts);\n\n const kName = reader.readSRef();\n const kLabel = reader.readSRef();\n const kDesc = reader.readSRef();\n const kPersUnit = reader.readSRef();\n const kRelError = reader.readF64();\n const kPresUnits = reader.readSRef();\n const kEcInstanceId = reader.readU32();\n\n const kIdx = builder.addKoq({\n ecInstanceId: kEcInstanceId,\n schemaIdx,\n nameStringIdx: builder.internString(kName),\n labelStringIdx: builder.internString(kLabel),\n descriptionStringIdx: builder.internString(kDesc),\n persistenceUnitStringIdx: builder.internString(kPersUnit),\n presentationFormatsStringIdx: builder.internString(kPresUnits),\n relativeError: kRelError,\n });\n koqRowIdToIdx.set(kEcInstanceId, kIdx);\n }\n\n // ---- PropCatTable ----\n expectTag(reader, Tag.PropCatTable);\n const catTotalCount = reader.readU32();\n // Fixed 24 bytes per record (4x SRef + i32 + u32).\n reader.validateCount(catTotalCount, 12, \"PropCatTable\");\n for (let i = 0; i < catTotalCount; i++) {\n const schemaEcId = reader.readU32();\n const schemaIdx = trackItem(schemaEcId, builder.propCategoryCount, schemaCatStarts, schemaCatCounts);\n\n const pcName = reader.readSRef();\n const pcLabel = reader.readSRef();\n const pcDesc = reader.readSRef();\n const pcPriority = reader.readI32();\n const pcEcInstanceId = reader.readU32();\n\n const pcIdx = builder.addPropertyCategory({\n ecInstanceId: pcEcInstanceId,\n schemaIdx,\n nameStringIdx: builder.internString(pcName),\n labelStringIdx: builder.internString(pcLabel),\n descriptionStringIdx: builder.internString(pcDesc),\n priority: pcPriority,\n });\n catRowIdToIdx.set(pcEcInstanceId, pcIdx);\n }\n\n // ---- ClassTable ----\n expectTag(reader, Tag.ClassTable);\n const classTotalCount = reader.readU32();\n // Minimum 27 bytes per record (3x SRef + 3x u8 + u32 + 2x u16 count prefixes); records grow with\n // relationship strength/direction and the base-class, prop-ref, and constraint sub-lists.\n reader.validateCount(classTotalCount, 13, \"ClassTable\");\n for (let i = 0; i < classTotalCount; i++) {\n const schemaEcId = reader.readU32();\n const schemaIdx = trackItem(schemaEcId, builder.classCount, schemaClassStarts, schemaClassCounts);\n const schemaName = ctx.schemaNames[schemaIdx];\n\n const cName = reader.readSRef();\n const cType = reader.readU8();\n const cModifier = reader.readU8();\n const cLabel = reader.readSRef();\n const cDesc = reader.readSRef();\n let relStrength: StrengthType = StrengthType.Referencing;\n let relStrengthDir: StrengthDirection = StrengthDirection.Forward;\n if (cType === ClassType.Relationship) {\n relStrength = reader.readU8();\n relStrengthDir = reader.readU8();\n }\n const cEcInstanceId = reader.readU32();\n // Tri-state hidden: 0=undefined (no CA, schema doesn't hide), 1=true (hidden), 2=false (explicitly shown)\n const cHiddenByte = reader.readU8();\n const cIsHidden: boolean | undefined = cHiddenByte === 1 ? true : cHiddenByte === 2 ? false : undefined;\n\n // Base classes (count-prefixed)\n const baseCount = reader.readU16();\n const baseClasses: Array<{ schemaName: string; className: string; ordinal: number }> = [];\n for (let b = 0; b < baseCount; b++) {\n baseClasses.push({\n schemaName: reader.readSRef(),\n className: reader.readSRef(),\n ordinal: reader.readU8(),\n });\n }\n\n // Property refs (count-prefixed)\n const propRefCount = reader.readU16();\n const propRefs: PendingPropRef[] = [];\n for (let p = 0; p < propRefCount; p++) {\n propRefs.push({\n preDefIdx: reader.readU32(),\n labelStringIdx: builder.internString(reader.readSRef()),\n priority: reader.readI32(),\n ecInstanceId: reader.readU32(),\n });\n }\n\n // Constraints (count-prefixed, only for relationships)\n const constraints: PendingConstraint[] = [];\n if (cType === ClassType.Relationship) {\n const constrCount = reader.readU8();\n for (let c = 0; c < constrCount; c++) {\n const rcEnd = reader.readU8();\n const rcMultLower = reader.readU32();\n const rcMultUpper = reader.readU32();\n const rcIsPoly = reader.readU8() !== 0;\n const rcRoleLabel = reader.readSRef();\n const rcAbsSchema = reader.readSRef();\n const rcAbsClass = reader.readSRef();\n\n // Constraint classes (count-prefixed)\n const ccCount = reader.readU8();\n const constraintClasses: Array<{ schemaName: string; className: string }> = [];\n for (let cc = 0; cc < ccCount; cc++) {\n constraintClasses.push({\n schemaName: reader.readSRef(),\n className: reader.readSRef(),\n });\n }\n\n constraints.push({\n relEnd: rcEnd,\n isPolymorphic: rcIsPoly,\n multiplicityLower: rcMultLower,\n multiplicityUpper: rcMultUpper,\n roleLabel: rcRoleLabel,\n abstractSchemaName: rcAbsSchema,\n abstractClassName: rcAbsClass,\n constraintClasses,\n });\n }\n }\n\n const nameStringIdx = builder.internString(cName);\n const classIdx = builder.addClass({\n ecInstanceId: cEcInstanceId,\n schemaIdx,\n nameStringIdx,\n labelStringIdx: builder.internString(cLabel),\n descriptionStringIdx: builder.internString(cDesc),\n type: cType,\n modifier: cModifier,\n baseClassIdx: -1,\n mixinStartIdx: -1,\n mixinCount: 0,\n ownPropStart: 0,\n ownPropCount: 0,\n strength: relStrength,\n strengthDirection: relStrengthDir,\n sourceConstraintIdx: -1,\n targetConstraintIdx: -1,\n isHidden: cIsHidden,\n });\n classResolver.set(`${schemaName.toLowerCase()}:${cName.toLowerCase()}`, classIdx);\n classRowIdToIdx.set(cEcInstanceId, classIdx);\n\n pendingClasses.push({\n schemaIdx,\n classIdx,\n ecInstanceId: cEcInstanceId,\n nameStringIdx,\n labelStringIdx: builder.internString(cLabel),\n descriptionStringIdx: builder.internString(cDesc),\n type: cType,\n modifier: cModifier,\n relStrength,\n relStrengthDir,\n baseClasses,\n propRefs,\n constraints,\n schemaName,\n isHidden: cIsHidden,\n });\n }\n\n // ---- Finalize per-schema item ranges ----\n // Local index i maps to global schema index schemaBaseIdx + i; range starts are already global.\n for (let i = 0; i < schemaCount; i++) {\n builder.updateSchemaRanges(schemaBaseIdx + i, {\n classRangeStart: schemaClassStarts[i] ?? 0,\n classCount: schemaClassCounts[i] ?? 0,\n enumRangeStart: schemaEnumStarts[i] ?? 0,\n enumCount: schemaEnumCounts[i] ?? 0,\n koqRangeStart: schemaKoqStarts[i] ?? 0,\n koqCount: schemaKoqCounts[i] ?? 0,\n catRangeStart: schemaCatStarts[i] ?? 0,\n catCount: schemaCatCounts[i] ?? 0,\n });\n }\n\n // Resolve pre-parsed defs to PropertyDef objects. Maps preParsedDef index -> builder defIdx.\n const danglingRefs: string[] = [];\n const resolvedDefMap = new Map<number, number>();\n const brokenDefs = new Set<number>();\n\n for (let i = 0; i < preParsedDefs.length; i++) {\n const prDef = preParsedDefs[i];\n\n let structClassIdx = -1;\n if (prDef.structClassRowId !== 0) {\n structClassIdx = classRowIdToIdx.get(prDef.structClassRowId) ?? -1;\n if (structClassIdx === -1) {\n brokenDefs.add(i);\n danglingRefs.push(`Dropped properties with struct class rowId ${prDef.structClassRowId}`);\n continue;\n }\n }\n\n let navRelClassIdx = -1;\n if (prDef.navRelClassRowId !== 0) {\n navRelClassIdx = classRowIdToIdx.get(prDef.navRelClassRowId) ?? -1;\n if (navRelClassIdx === -1) {\n brokenDefs.add(i);\n danglingRefs.push(`Dropped properties with nav relationship rowId ${prDef.navRelClassRowId}`);\n continue;\n }\n }\n\n let enumIdx = -1;\n if (prDef.enumRowId !== 0) {\n enumIdx = enumRowIdToIdx.get(prDef.enumRowId) ?? -1;\n if (enumIdx === -1)\n danglingRefs.push(`Unresolved enum rowId ${prDef.enumRowId}`);\n }\n\n let koqIdx = -1;\n if (prDef.koqRowId !== 0)\n koqIdx = koqRowIdToIdx.get(prDef.koqRowId) ?? -1;\n\n let categoryIdx = -1;\n if (prDef.catRowId !== 0)\n categoryIdx = catRowIdToIdx.get(prDef.catRowId) ?? -1;\n\n const def: PropertyDef = {\n nameStringIdx: builder.internString(prDef.name),\n descriptionStringIdx: builder.internString(prDef.description),\n kind: prDef.kind,\n primitiveType: prDef.primitiveType,\n extTypeStringIdx: builder.internString(prDef.extType),\n enumIdx,\n koqIdx,\n structClassIdx,\n navRelClassIdx,\n navDirection: prDef.navDirection,\n categoryIdx,\n isReadOnly: prDef.isReadonly,\n isHidden: prDef.isHidden,\n arrayMinOccurs: prDef.arrayMinOccurs,\n arrayMaxOccurs: prDef.arrayMaxOccurs,\n };\n\n resolvedDefMap.set(i, builder.addPropertyDef(def));\n }\n\n // Resolve cross-references and finalize classes\n for (const pc of pendingClasses) {\n pc.baseClasses.sort((a, b) => a.ordinal - b.ordinal);\n const classFullName = `${pc.schemaName}:${builder.getString(pc.nameStringIdx)}`;\n\n let baseClassIdx = -1;\n const mixinStartIdx = pc.baseClasses.length > 1 ? builder.classMixinCount : -1;\n let mixinCount = 0;\n\n for (const bc of pc.baseClasses) {\n const bcKey = `${bc.schemaName.toLowerCase()}:${bc.className.toLowerCase()}`;\n const bcIdx = classResolver.get(bcKey) ?? -1;\n if (bc.ordinal === 0) {\n if (bcIdx === -1 && bc.schemaName)\n danglingRefs.push(`${classFullName} -> base class ${bc.schemaName}:${bc.className}`);\n baseClassIdx = bcIdx;\n } else {\n if (bcIdx === -1) {\n danglingRefs.push(`${classFullName} -> mixin ${bc.schemaName}:${bc.className}`);\n continue;\n }\n builder.addClassMixin(bcIdx);\n mixinCount++;\n }\n }\n\n const ownPropStart = builder.propertyRefCount;\n for (const pr of pc.propRefs) {\n if (brokenDefs.has(pr.preDefIdx))\n continue;\n const defIdx = resolvedDefMap.get(pr.preDefIdx);\n if (defIdx === undefined)\n continue;\n builder.addPropertyRef({\n ecInstanceId: pr.ecInstanceId,\n defIdx,\n labelStringIdx: pr.labelStringIdx,\n priority: pr.priority,\n });\n }\n\n let sourceConstraintIdx = -1;\n let targetConstraintIdx = -1;\n for (const con of pc.constraints) {\n const absKey = con.abstractSchemaName && con.abstractClassName\n ? `${con.abstractSchemaName.toLowerCase()}:${con.abstractClassName.toLowerCase()}`\n : \"\";\n const absClassIdx = absKey ? (classResolver.get(absKey) ?? -1) : -1;\n if (absClassIdx === -1 && absKey)\n danglingRefs.push(`${classFullName} constraint -> abstract ${con.abstractSchemaName}:${con.abstractClassName}`);\n\n const classRefStart = builder.constraintClassRefCount;\n let classRefCount = 0;\n for (const cc of con.constraintClasses) {\n const ccKey = `${cc.schemaName.toLowerCase()}:${cc.className.toLowerCase()}`;\n const ccIdx = classResolver.get(ccKey) ?? -1;\n if (ccIdx === -1) {\n danglingRefs.push(`${classFullName} constraint -> class ${cc.schemaName}:${cc.className}`);\n continue;\n }\n builder.addConstraintClassRef(ccIdx);\n classRefCount++;\n }\n\n const constraintIdx = builder.addRelConstraint({\n abstractConstraintIdx: absClassIdx,\n polymorphic: con.isPolymorphic,\n multiplicityLower: con.multiplicityLower,\n multiplicityUpper: con.multiplicityUpper,\n roleLabelStringIdx: builder.internString(con.roleLabel),\n classRefStart,\n classRefCount,\n });\n\n if (con.relEnd === 0)\n sourceConstraintIdx = constraintIdx;\n else\n targetConstraintIdx = constraintIdx;\n }\n\n const updatedClass: ClassData = {\n ecInstanceId: pc.ecInstanceId,\n schemaIdx: pc.schemaIdx,\n nameStringIdx: pc.nameStringIdx,\n labelStringIdx: pc.labelStringIdx,\n descriptionStringIdx: pc.descriptionStringIdx,\n type: pc.type,\n modifier: pc.modifier,\n baseClassIdx,\n mixinStartIdx,\n mixinCount,\n ownPropStart,\n ownPropCount: builder.propertyRefCount - ownPropStart,\n strength: pc.relStrength,\n strengthDirection: pc.relStrengthDir,\n sourceConstraintIdx,\n targetConstraintIdx,\n isHidden: pc.isHidden,\n };\n builder.updateClass(pc.classIdx, updatedClass);\n }\n\n if (danglingRefs.length > 0) {\n const cap = 20;\n const lines = danglingRefs.length <= cap ? danglingRefs : [...danglingRefs.slice(0, cap), `... and ${danglingRefs.length - cap} more`];\n Logger.logWarning(\"ecschema-metadata.SchemaView\", `${danglingRefs.length} unresolved cross-reference(s) in schema view blob (likely from excluded schemas):\\n ${lines.join(\"\\n \")}`);\n }\n\n // Bring the builder's lookup maps up to date for the schemas this fragment added. Their item\n // ranges were finalized above, so the per-schema name maps build correctly.\n builder.extendLookupMaps();\n}\n\n"]}
@@ -0,0 +1,116 @@
1
+ /** @packageDocumentation
2
+ * @module Schema
3
+ */
4
+ import type { ClassData, EnumerationData, EnumeratorData, KoqData, PropCategoryData, PropertyDef, PropertyRef, RelConstraintData, SchemaData } from "./SchemaViewInterfaces";
5
+ import { SchemaView, type SchemaViewData } from "./SchemaView";
6
+ /** Builder for constructing an immutable `SchemaView`.
7
+ *
8
+ * Collects data during binary blob parsing, then freezes it into a view.
9
+ * Handles string interning and property definition deduplication.
10
+ *
11
+ * Consumers should not use this directly - read views via `IModelDb.getSchemaView`
12
+ * / `IModelConnection.getSchemaView` (or `SchemaView.fromBinary` if you have a raw blob).
13
+ * @internal
14
+ */
15
+ export declare class SchemaViewBuilder {
16
+ private readonly _strings;
17
+ private readonly _lowerStrings;
18
+ private readonly _stringMap;
19
+ private readonly _schemas;
20
+ private readonly _classes;
21
+ private readonly _classMixins;
22
+ private readonly _propDefs;
23
+ private readonly _propertyRefs;
24
+ private readonly _relConstraints;
25
+ private readonly _constraintClassRefs;
26
+ private readonly _enumerations;
27
+ private readonly _enumerators;
28
+ private readonly _koqs;
29
+ private readonly _propCategories;
30
+ private readonly _propDefMap;
31
+ private readonly _schemaByName;
32
+ private readonly _schemaByAlias;
33
+ private readonly _classByName;
34
+ private readonly _enumByName;
35
+ private readonly _koqByName;
36
+ private readonly _catByName;
37
+ private _lookupMapsBuiltUpto;
38
+ /** Intern a string, returning its SID. Empty/undefined strings return 0.
39
+ * Interning is case-sensitive - "MyLabel" and "MYLABEL" get distinct SIDs.
40
+ * The `lowerStrings` array provides case-insensitive lookup without mutating display values.
41
+ */
42
+ internString(value: string | undefined): number;
43
+ /** Add a schema. Returns its index. */
44
+ addSchema(data: SchemaData): number;
45
+ /** Add a class. Returns its index. Must be called after the owning schema. */
46
+ addClass(data: ClassData): number;
47
+ /** Add a property definition with deduplication. Returns the def index (possibly existing). */
48
+ addPropertyDef(data: PropertyDef): number;
49
+ /** Append a property reference to the flat refs array. */
50
+ addPropertyRef(ref: PropertyRef): void;
51
+ /** Add an enumeration. Returns its index. */
52
+ addEnumeration(data: EnumerationData): number;
53
+ /** Append an enumerator to the flat enumerators array. */
54
+ addEnumerator(data: EnumeratorData): void;
55
+ /** Add a KindOfQuantity. Returns its index. */
56
+ addKoq(data: KoqData): number;
57
+ /** Add a PropertyCategory. Returns its index. */
58
+ addPropertyCategory(data: PropCategoryData): number;
59
+ /** Add a relationship constraint. Returns its index. */
60
+ addRelConstraint(data: RelConstraintData): number;
61
+ /** Append a constraint class reference to the flat array. */
62
+ addConstraintClassRef(classIdx: number): void;
63
+ /** Append a mixin class reference to the flat array. */
64
+ addClassMixin(classIdx: number): void;
65
+ /** The current count of property refs (used to set ownPropStart on ClassData). */
66
+ get propertyRefCount(): number;
67
+ /** The current count of enumerators (used to set enumeratorStart on EnumerationData). */
68
+ get enumeratorCount(): number;
69
+ /** The current count of constraint class refs (used to set classRefStart). */
70
+ get constraintClassRefCount(): number;
71
+ /** The current count of class mixins (used to set mixinStartIdx). */
72
+ get classMixinCount(): number;
73
+ /** The current count of schemas. @internal */
74
+ get schemaCount(): number;
75
+ /** The current count of classes. @internal */
76
+ get classCount(): number;
77
+ /** The current count of enumerations. @internal */
78
+ get enumerationCount(): number;
79
+ /** The current count of KindOfQuantities. @internal */
80
+ get koqCount(): number;
81
+ /** The current count of property categories. @internal */
82
+ get propCategoryCount(): number;
83
+ /** Get a string by SID. @internal */
84
+ getString(sid: number): string;
85
+ /** Replace class data at the given index (used during deferred cross-ref resolution). @internal */
86
+ updateClass(classIdx: number, data: ClassData): void;
87
+ /** Update range fields on a schema (used after all items for a schema are collected). @internal */
88
+ updateSchemaRanges(schemaIdx: number, ranges: {
89
+ classRangeStart: number;
90
+ classCount: number;
91
+ enumRangeStart: number;
92
+ enumCount: number;
93
+ koqRangeStart: number;
94
+ koqCount: number;
95
+ catRangeStart: number;
96
+ catCount: number;
97
+ }): void;
98
+ /** Freeze all data and produce an immutable SchemaView. */
99
+ build(schemaToken?: string): SchemaView;
100
+ /** Build lookup-map entries for any schemas added since the last call. Idempotent and
101
+ * append-only, so it is safe to call after each fragment merge. A schema's item ranges must
102
+ * already be finalized (via `updateSchemaRanges`) before it is processed.
103
+ * @internal */
104
+ extendLookupMaps(): void;
105
+ /** Assemble a {@link SchemaViewData} bag that references this builder's live arrays and lookup
106
+ * maps. Continued building - fragment merges that append to the arrays and extend the maps in
107
+ * place - is visible through the shared references, so a husk holding this data sees merged
108
+ * schemas without rebuilding. @internal */
109
+ assembleData(): SchemaViewData;
110
+ /** Produce a dedup signature for a PropertyDef. Label and priority are excluded because
111
+ * they are per-PropertyRef overrides, not part of the structural definition.
112
+ * Uses SIDs (not lowercase strings) for name/description so that case-preserving names
113
+ * stay distinct - matching the C++ writer's dedup behavior. */
114
+ private _propDefSignature;
115
+ }
116
+ //# sourceMappingURL=SchemaViewBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewBuilder.d.ts","sourceRoot":"","sources":["../../../src/SchemaView/SchemaViewBuilder.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,iBA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,EAAE,MAAM,GAAG,MAAM;IAErC,mGAAmG;IAC5F,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAE3D,mGAAmG;IAC5F,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAKxO,2DAA2D;IACpD,KAAK,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU;IAK9C;;;mBAGe;IACR,gBAAgB,IAAI,IAAI;IAkC/B;;;+CAG2C;IACpC,YAAY,IAAI,cAAc;IAwBrC;;;mEAG+D;IAC/D,OAAO,CAAC,iBAAiB;CAG1B"}
@@ -0,0 +1,230 @@
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.SchemaViewBuilder = void 0;
11
+ const SchemaView_1 = require("./SchemaView");
12
+ /** Builder for constructing an immutable `SchemaView`.
13
+ *
14
+ * Collects data during binary blob parsing, then freezes it into a view.
15
+ * Handles string interning and property definition deduplication.
16
+ *
17
+ * Consumers should not use this directly - read views via `IModelDb.getSchemaView`
18
+ * / `IModelConnection.getSchemaView` (or `SchemaView.fromBinary` if you have a raw blob).
19
+ * @internal
20
+ */
21
+ class SchemaViewBuilder {
22
+ _strings = [""]; // SID 0 = empty string
23
+ _lowerStrings = [""];
24
+ _stringMap = new Map(); // original value -> SID
25
+ _schemas = [];
26
+ _classes = [];
27
+ _classMixins = [];
28
+ _propDefs = [];
29
+ _propertyRefs = [];
30
+ _relConstraints = [];
31
+ _constraintClassRefs = [];
32
+ _enumerations = [];
33
+ _enumerators = [];
34
+ _koqs = [];
35
+ _propCategories = [];
36
+ // For PropertyDef dedup
37
+ _propDefMap = new Map(); // signature string -> defIdx
38
+ // Lookup maps - owned by the builder so a husk can share and extend them across fragment merges.
39
+ // `build()` and each merge call `extendLookupMaps()`; the view receives these same Map objects
40
+ // via `assembleData()`, so in-place growth is visible.
41
+ _schemaByName = new Map();
42
+ _schemaByAlias = new Map();
43
+ _classByName = new Map();
44
+ _enumByName = new Map();
45
+ _koqByName = new Map();
46
+ _catByName = new Map();
47
+ _lookupMapsBuiltUpto = 0; // number of schemas whose lookup entries are already built
48
+ /** Intern a string, returning its SID. Empty/undefined strings return 0.
49
+ * Interning is case-sensitive - "MyLabel" and "MYLABEL" get distinct SIDs.
50
+ * The `lowerStrings` array provides case-insensitive lookup without mutating display values.
51
+ */
52
+ internString(value) {
53
+ if (value === undefined || value === "")
54
+ return 0;
55
+ const existing = this._stringMap.get(value);
56
+ if (existing !== undefined)
57
+ return existing;
58
+ const sid = this._strings.length;
59
+ this._strings.push(value);
60
+ this._lowerStrings.push(value.toLowerCase());
61
+ this._stringMap.set(value, sid);
62
+ return sid;
63
+ }
64
+ /** Add a schema. Returns its index. */
65
+ addSchema(data) {
66
+ const idx = this._schemas.length;
67
+ this._schemas.push(data);
68
+ return idx;
69
+ }
70
+ /** Add a class. Returns its index. Must be called after the owning schema. */
71
+ addClass(data) {
72
+ const idx = this._classes.length;
73
+ this._classes.push(data);
74
+ return idx;
75
+ }
76
+ /** Add a property definition with deduplication. Returns the def index (possibly existing). */
77
+ addPropertyDef(data) {
78
+ const sig = this._propDefSignature(data);
79
+ const existing = this._propDefMap.get(sig);
80
+ if (existing !== undefined)
81
+ return existing;
82
+ const idx = this._propDefs.length;
83
+ this._propDefs.push(data);
84
+ this._propDefMap.set(sig, idx);
85
+ return idx;
86
+ }
87
+ /** Append a property reference to the flat refs array. */
88
+ addPropertyRef(ref) {
89
+ this._propertyRefs.push(ref);
90
+ }
91
+ /** Add an enumeration. Returns its index. */
92
+ addEnumeration(data) {
93
+ const idx = this._enumerations.length;
94
+ this._enumerations.push(data);
95
+ return idx;
96
+ }
97
+ /** Append an enumerator to the flat enumerators array. */
98
+ addEnumerator(data) {
99
+ this._enumerators.push(data);
100
+ }
101
+ /** Add a KindOfQuantity. Returns its index. */
102
+ addKoq(data) {
103
+ const idx = this._koqs.length;
104
+ this._koqs.push(data);
105
+ return idx;
106
+ }
107
+ /** Add a PropertyCategory. Returns its index. */
108
+ addPropertyCategory(data) {
109
+ const idx = this._propCategories.length;
110
+ this._propCategories.push(data);
111
+ return idx;
112
+ }
113
+ /** Add a relationship constraint. Returns its index. */
114
+ addRelConstraint(data) {
115
+ const idx = this._relConstraints.length;
116
+ this._relConstraints.push(data);
117
+ return idx;
118
+ }
119
+ /** Append a constraint class reference to the flat array. */
120
+ addConstraintClassRef(classIdx) {
121
+ this._constraintClassRefs.push(classIdx);
122
+ }
123
+ /** Append a mixin class reference to the flat array. */
124
+ addClassMixin(classIdx) {
125
+ this._classMixins.push(classIdx);
126
+ }
127
+ /** The current count of property refs (used to set ownPropStart on ClassData). */
128
+ get propertyRefCount() { return this._propertyRefs.length; }
129
+ /** The current count of enumerators (used to set enumeratorStart on EnumerationData). */
130
+ get enumeratorCount() { return this._enumerators.length; }
131
+ /** The current count of constraint class refs (used to set classRefStart). */
132
+ get constraintClassRefCount() { return this._constraintClassRefs.length; }
133
+ /** The current count of class mixins (used to set mixinStartIdx). */
134
+ get classMixinCount() { return this._classMixins.length; }
135
+ // The counts below are the base indices fragment merging uses to translate a fragment's local
136
+ // indices into global ones.
137
+ /** The current count of schemas. @internal */
138
+ get schemaCount() { return this._schemas.length; }
139
+ /** The current count of classes. @internal */
140
+ get classCount() { return this._classes.length; }
141
+ /** The current count of enumerations. @internal */
142
+ get enumerationCount() { return this._enumerations.length; }
143
+ /** The current count of KindOfQuantities. @internal */
144
+ get koqCount() { return this._koqs.length; }
145
+ /** The current count of property categories. @internal */
146
+ get propCategoryCount() { return this._propCategories.length; }
147
+ /** Get a string by SID. @internal */
148
+ getString(sid) { return this._strings[sid]; }
149
+ /** Replace class data at the given index (used during deferred cross-ref resolution). @internal */
150
+ updateClass(classIdx, data) { this._classes[classIdx] = data; }
151
+ /** Update range fields on a schema (used after all items for a schema are collected). @internal */
152
+ updateSchemaRanges(schemaIdx, ranges) {
153
+ const s = this._schemas[schemaIdx];
154
+ this._schemas[schemaIdx] = { ...s, ...ranges };
155
+ }
156
+ /** Freeze all data and produce an immutable SchemaView. */
157
+ build(schemaToken) {
158
+ this.extendLookupMaps();
159
+ return new SchemaView_1.SchemaView(this.assembleData(), schemaToken);
160
+ }
161
+ /** Build lookup-map entries for any schemas added since the last call. Idempotent and
162
+ * append-only, so it is safe to call after each fragment merge. A schema's item ranges must
163
+ * already be finalized (via `updateSchemaRanges`) before it is processed.
164
+ * @internal */
165
+ extendLookupMaps() {
166
+ for (let i = this._lookupMapsBuiltUpto; i < this._schemas.length; i++) {
167
+ const s = this._schemas[i];
168
+ this._schemaByName.set(this._lowerStrings[s.nameStringIdx], i);
169
+ if (s.aliasStringIdx !== 0)
170
+ this._schemaByAlias.set(this._lowerStrings[s.aliasStringIdx], i);
171
+ // Build class-by-name map for this schema
172
+ const classMap = new Map();
173
+ for (let c = s.classRangeStart; c < s.classRangeStart + s.classCount; c++)
174
+ classMap.set(this._lowerStrings[this._classes[c].nameStringIdx], c);
175
+ this._classByName.set(i, classMap);
176
+ // Build enum-by-name map for this schema
177
+ const eMap = new Map();
178
+ for (let e = s.enumRangeStart; e < s.enumRangeStart + s.enumCount; e++)
179
+ eMap.set(this._lowerStrings[this._enumerations[e].nameStringIdx], e);
180
+ this._enumByName.set(i, eMap);
181
+ // Build koq-by-name map for this schema
182
+ const kMap = new Map();
183
+ for (let k = s.koqRangeStart; k < s.koqRangeStart + s.koqCount; k++)
184
+ kMap.set(this._lowerStrings[this._koqs[k].nameStringIdx], k);
185
+ this._koqByName.set(i, kMap);
186
+ // Build category-by-name map for this schema
187
+ const cMap = new Map();
188
+ for (let p = s.catRangeStart; p < s.catRangeStart + s.catCount; p++)
189
+ cMap.set(this._lowerStrings[this._propCategories[p].nameStringIdx], p);
190
+ this._catByName.set(i, cMap);
191
+ }
192
+ this._lookupMapsBuiltUpto = this._schemas.length;
193
+ }
194
+ /** Assemble a {@link SchemaViewData} bag that references this builder's live arrays and lookup
195
+ * maps. Continued building - fragment merges that append to the arrays and extend the maps in
196
+ * place - is visible through the shared references, so a husk holding this data sees merged
197
+ * schemas without rebuilding. @internal */
198
+ assembleData() {
199
+ return {
200
+ strings: this._strings,
201
+ lowerStrings: this._lowerStrings,
202
+ schemas: this._schemas,
203
+ classes: this._classes,
204
+ classMixins: this._classMixins,
205
+ propDefs: this._propDefs,
206
+ propertyRefs: this._propertyRefs,
207
+ relConstraints: this._relConstraints,
208
+ constraintClassRefs: this._constraintClassRefs,
209
+ enumerations: this._enumerations,
210
+ enumerators: this._enumerators,
211
+ koqs: this._koqs,
212
+ propCategories: this._propCategories,
213
+ schemaByName: this._schemaByName,
214
+ schemaByAlias: this._schemaByAlias,
215
+ classByName: this._classByName,
216
+ enumByName: this._enumByName,
217
+ koqByName: this._koqByName,
218
+ catByName: this._catByName,
219
+ };
220
+ }
221
+ /** Produce a dedup signature for a PropertyDef. Label and priority are excluded because
222
+ * they are per-PropertyRef overrides, not part of the structural definition.
223
+ * Uses SIDs (not lowercase strings) for name/description so that case-preserving names
224
+ * stay distinct - matching the C++ writer's dedup behavior. */
225
+ _propDefSignature(def) {
226
+ 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}`;
227
+ }
228
+ }
229
+ exports.SchemaViewBuilder = SchemaViewBuilder;
230
+ //# sourceMappingURL=SchemaViewBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewBuilder.js","sourceRoot":"","sources":["../../../src/SchemaView/SchemaViewBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,6CAA+D;AAE/D;;;;;;;;GAQG;AACH,MAAa,iBAAiB;IACX,QAAQ,GAAa,CAAC,EAAE,CAAC,CAAC,CAAC,uBAAuB;IAClD,aAAa,GAAa,CAAC,EAAE,CAAC,CAAC;IAC/B,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,wBAAwB;IAEhE,QAAQ,GAAiB,EAAE,CAAC;IAC5B,QAAQ,GAAgB,EAAE,CAAC;IAC3B,YAAY,GAAa,EAAE,CAAC;IAC5B,SAAS,GAAkB,EAAE,CAAC;IAC9B,aAAa,GAAkB,EAAE,CAAC;IAClC,eAAe,GAAwB,EAAE,CAAC;IAC1C,oBAAoB,GAAa,EAAE,CAAC;IACpC,aAAa,GAAsB,EAAE,CAAC;IACtC,YAAY,GAAqB,EAAE,CAAC;IACpC,KAAK,GAAc,EAAE,CAAC;IACtB,eAAe,GAAuB,EAAE,CAAC;IAE1D,wBAAwB;IACP,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,6BAA6B;IAEvF,iGAAiG;IACjG,+FAA+F;IAC/F,uDAAuD;IACtC,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,YAAY,GAAG,IAAI,GAAG,EAA+B,CAAC;IACtD,WAAW,GAAG,IAAI,GAAG,EAA+B,CAAC;IACrD,UAAU,GAAG,IAAI,GAAG,EAA+B,CA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AAa,IAAI,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,oBAAoB,EAAE,CAAC;IACnU,CAAC;CACF;AAjPD,8CAiPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport type { ClassData, EnumerationData, EnumeratorData, KoqData, PropCategoryData, PropertyDef, PropertyRef, RelConstraintData, SchemaData } from \"./SchemaViewInterfaces\";\nimport { SchemaView, type SchemaViewData } from \"./SchemaView\";\n\n/** Builder for constructing an immutable `SchemaView`.\n *\n * Collects data during binary blob parsing, then freezes it into a view.\n * Handles string interning and property definition deduplication.\n *\n * Consumers should not use this directly - read views via `IModelDb.getSchemaView`\n * / `IModelConnection.getSchemaView` (or `SchemaView.fromBinary` if you have a raw blob).\n * @internal\n */\nexport class SchemaViewBuilder {\n private readonly _strings: string[] = [\"\"]; // SID 0 = empty string\n private readonly _lowerStrings: string[] = [\"\"];\n private readonly _stringMap = new Map<string, number>(); // original value -> SID\n\n private readonly _schemas: SchemaData[] = [];\n private readonly _classes: ClassData[] = [];\n private readonly _classMixins: number[] = [];\n private readonly _propDefs: PropertyDef[] = [];\n private readonly _propertyRefs: PropertyRef[] = [];\n private readonly _relConstraints: RelConstraintData[] = [];\n private readonly _constraintClassRefs: number[] = [];\n private readonly _enumerations: EnumerationData[] = [];\n private readonly _enumerators: EnumeratorData[] = [];\n private readonly _koqs: KoqData[] = [];\n private readonly _propCategories: PropCategoryData[] = [];\n\n // For PropertyDef dedup\n private readonly _propDefMap = new Map<string, number>(); // signature string -> defIdx\n\n // Lookup maps - owned by the builder so a husk can share and extend them across fragment merges.\n // `build()` and each merge call `extendLookupMaps()`; the view receives these same Map objects\n // via `assembleData()`, so in-place growth is visible.\n private readonly _schemaByName = new Map<string, number>();\n private readonly _schemaByAlias = new Map<string, number>();\n private readonly _classByName = new Map<number, Map<string, number>>();\n private readonly _enumByName = new Map<number, Map<string, number>>();\n private readonly _koqByName = new Map<number, Map<string, number>>();\n private readonly _catByName = new Map<number, Map<string, number>>();\n private _lookupMapsBuiltUpto = 0; // number of schemas whose lookup entries are already built\n\n /** Intern a string, returning its SID. Empty/undefined strings return 0.\n * Interning is case-sensitive - \"MyLabel\" and \"MYLABEL\" get distinct SIDs.\n * The `lowerStrings` array provides case-insensitive lookup without mutating display values.\n */\n public internString(value: string | undefined): number {\n if (value === undefined || value === \"\") return 0;\n const existing = this._stringMap.get(value);\n if (existing !== undefined) return existing;\n const sid = this._strings.length;\n this._strings.push(value);\n this._lowerStrings.push(value.toLowerCase());\n this._stringMap.set(value, sid);\n return sid;\n }\n\n /** Add a schema. Returns its index. */\n public addSchema(data: SchemaData): number {\n const idx = this._schemas.length;\n this._schemas.push(data);\n return idx;\n }\n\n /** Add a class. Returns its index. Must be called after the owning schema. */\n public addClass(data: ClassData): number {\n const idx = this._classes.length;\n this._classes.push(data);\n return idx;\n }\n\n /** Add a property definition with deduplication. Returns the def index (possibly existing). */\n public addPropertyDef(data: PropertyDef): number {\n const sig = this._propDefSignature(data);\n const existing = this._propDefMap.get(sig);\n if (existing !== undefined) return existing;\n\n const idx = this._propDefs.length;\n this._propDefs.push(data);\n this._propDefMap.set(sig, idx);\n return idx;\n }\n\n /** Append a property reference to the flat refs array. */\n public addPropertyRef(ref: PropertyRef): void {\n this._propertyRefs.push(ref);\n }\n\n /** Add an enumeration. Returns its index. */\n public addEnumeration(data: EnumerationData): number {\n const idx = this._enumerations.length;\n this._enumerations.push(data);\n return idx;\n }\n\n /** Append an enumerator to the flat enumerators array. */\n public addEnumerator(data: EnumeratorData): void {\n this._enumerators.push(data);\n }\n\n /** Add a KindOfQuantity. Returns its index. */\n public addKoq(data: KoqData): number {\n const idx = this._koqs.length;\n this._koqs.push(data);\n return idx;\n }\n\n /** Add a PropertyCategory. Returns its index. */\n public addPropertyCategory(data: PropCategoryData): number {\n const idx = this._propCategories.length;\n this._propCategories.push(data);\n return idx;\n }\n\n /** Add a relationship constraint. Returns its index. */\n public addRelConstraint(data: RelConstraintData): number {\n const idx = this._relConstraints.length;\n this._relConstraints.push(data);\n return idx;\n }\n\n /** Append a constraint class reference to the flat array. */\n public addConstraintClassRef(classIdx: number): void {\n this._constraintClassRefs.push(classIdx);\n }\n\n /** Append a mixin class reference to the flat array. */\n public addClassMixin(classIdx: number): void {\n this._classMixins.push(classIdx);\n }\n\n /** The current count of property refs (used to set ownPropStart on ClassData). */\n public get propertyRefCount(): number { return this._propertyRefs.length; }\n\n /** The current count of enumerators (used to set enumeratorStart on EnumerationData). */\n public get enumeratorCount(): number { return this._enumerators.length; }\n\n /** The current count of constraint class refs (used to set classRefStart). */\n public get constraintClassRefCount(): number { return this._constraintClassRefs.length; }\n\n /** The current count of class mixins (used to set mixinStartIdx). */\n public get classMixinCount(): number { return this._classMixins.length; }\n\n // The counts below are the base indices fragment merging uses to translate a fragment's local\n // indices into global ones.\n\n /** The current count of schemas. @internal */\n public get schemaCount(): number { return this._schemas.length; }\n\n /** The current count of classes. @internal */\n public get classCount(): number { return this._classes.length; }\n\n /** The current count of enumerations. @internal */\n public get enumerationCount(): number { return this._enumerations.length; }\n\n /** The current count of KindOfQuantities. @internal */\n public get koqCount(): number { return this._koqs.length; }\n\n /** The current count of property categories. @internal */\n public get propCategoryCount(): number { return this._propCategories.length; }\n\n /** Get a string by SID. @internal */\n public getString(sid: number): string { return this._strings[sid]; }\n\n /** Replace class data at the given index (used during deferred cross-ref resolution). @internal */\n public updateClass(classIdx: number, data: ClassData): void { this._classes[classIdx] = data; }\n\n /** Update range fields on a schema (used after all items for a schema are collected). @internal */\n public updateSchemaRanges(schemaIdx: number, ranges: { classRangeStart: number; classCount: number; enumRangeStart: number; enumCount: number; koqRangeStart: number; koqCount: number; catRangeStart: number; catCount: number }): void {\n const s = this._schemas[schemaIdx];\n this._schemas[schemaIdx] = { ...s, ...ranges };\n }\n\n /** Freeze all data and produce an immutable SchemaView. */\n public build(schemaToken?: string): SchemaView {\n this.extendLookupMaps();\n return new SchemaView(this.assembleData(), schemaToken);\n }\n\n /** Build lookup-map entries for any schemas added since the last call. Idempotent and\n * append-only, so it is safe to call after each fragment merge. A schema's item ranges must\n * already be finalized (via `updateSchemaRanges`) before it is processed.\n * @internal */\n public extendLookupMaps(): void {\n for (let i = this._lookupMapsBuiltUpto; i < this._schemas.length; i++) {\n const s = this._schemas[i];\n this._schemaByName.set(this._lowerStrings[s.nameStringIdx], i);\n if (s.aliasStringIdx !== 0)\n this._schemaByAlias.set(this._lowerStrings[s.aliasStringIdx], i);\n\n // Build class-by-name map for this schema\n const classMap = new Map<string, number>();\n for (let c = s.classRangeStart; c < s.classRangeStart + s.classCount; c++)\n classMap.set(this._lowerStrings[this._classes[c].nameStringIdx], c);\n this._classByName.set(i, classMap);\n\n // Build enum-by-name map for this schema\n const eMap = new Map<string, number>();\n for (let e = s.enumRangeStart; e < s.enumRangeStart + s.enumCount; e++)\n eMap.set(this._lowerStrings[this._enumerations[e].nameStringIdx], e);\n this._enumByName.set(i, eMap);\n\n // Build koq-by-name map for this schema\n const kMap = new Map<string, number>();\n for (let k = s.koqRangeStart; k < s.koqRangeStart + s.koqCount; k++)\n kMap.set(this._lowerStrings[this._koqs[k].nameStringIdx], k);\n this._koqByName.set(i, kMap);\n\n // Build category-by-name map for this schema\n const cMap = new Map<string, number>();\n for (let p = s.catRangeStart; p < s.catRangeStart + s.catCount; p++)\n cMap.set(this._lowerStrings[this._propCategories[p].nameStringIdx], p);\n this._catByName.set(i, cMap);\n }\n this._lookupMapsBuiltUpto = this._schemas.length;\n }\n\n /** Assemble a {@link SchemaViewData} bag that references this builder's live arrays and lookup\n * maps. Continued building - fragment merges that append to the arrays and extend the maps in\n * place - is visible through the shared references, so a husk holding this data sees merged\n * schemas without rebuilding. @internal */\n public assembleData(): SchemaViewData {\n return {\n strings: this._strings,\n lowerStrings: this._lowerStrings,\n schemas: this._schemas,\n classes: this._classes,\n classMixins: this._classMixins,\n propDefs: this._propDefs,\n propertyRefs: this._propertyRefs,\n relConstraints: this._relConstraints,\n constraintClassRefs: this._constraintClassRefs,\n enumerations: this._enumerations,\n enumerators: this._enumerators,\n koqs: this._koqs,\n propCategories: this._propCategories,\n schemaByName: this._schemaByName,\n schemaByAlias: this._schemaByAlias,\n classByName: this._classByName,\n enumByName: this._enumByName,\n koqByName: this._koqByName,\n catByName: this._catByName,\n };\n }\n\n /** Produce a dedup signature for a PropertyDef. Label and priority are excluded because\n * they are per-PropertyRef overrides, not part of the structural definition.\n * Uses SIDs (not lowercase strings) for name/description so that case-preserving names\n * stay distinct - matching the C++ writer's dedup behavior. */\n private _propDefSignature(def: PropertyDef): string {\n 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}`;\n }\n}\n"]}
@@ -55,7 +55,7 @@ export declare enum SchemaViewPrimitiveType {
55
55
  String = 2305,
56
56
  IGeometry = 2561
57
57
  }
58
- import { StrengthDirection, StrengthType } from "./ECObjects";
58
+ import { StrengthDirection, StrengthType } from "../ECObjects";
59
59
  /** Internal storage for a schema. Schemas own contiguous ranges of classes, enums, KoQs, and categories.
60
60
  * @internal
61
61
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewInterfaces.d.ts","sourceRoot":"","sources":["../../../src/SchemaView/SchemaViewInterfaces.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;GAEG;AACH,oBAAY,SAAS;IACnB,MAAM,IAAI;IACV,YAAY,IAAI;IAChB,MAAM,IAAI;IACV,eAAe,IAAI;IACnB,yFAAyF;IACzF,KAAK,IAAI;IACT,uDAAuD;IACvD,IAAI,IAAI;CACT;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,IAAI,IAAI;IACR,QAAQ,IAAI;IACZ,MAAM,IAAI;CACX;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,SAAS,IAAI;IACb,MAAM,IAAI;IACV,cAAc,IAAI;IAClB,WAAW,IAAI;IACf,UAAU,IAAI;CACf;AAED;;GAEG;AACH,oBAAY,uBAAuB;IACjC,aAAa,IAAO;IACpB,MAAM,MAAQ;IACd,OAAO,MAAQ;IACf,QAAQ,MAAQ;IAChB,MAAM,OAAQ;IACd,OAAO,OAAQ;IACf,IAAI,OAAQ;IACZ,OAAO,OAAQ;IACf,OAAO,OAAQ;IACf,MAAM,OAAQ;IACd,SAAS,OAAQ;CAClB;AAED,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,uHAAuH;IACvH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IA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AY,uBAAuB;IACjC,uFAAoB,CAAA;IACpB,2EAAc,CAAA;IACd,6EAAe,CAAA;IACf,+EAAgB,CAAA;IAChB,4EAAc,CAAA;IACd,8EAAe,CAAA;IACf,wEAAY,CAAA;IACZ,8EAAe,CAAA;IACf,8EAAe,CAAA;IACf,4EAAc,CAAA;IACd,kFAAiB,CAAA;AACnB,CAAC,EAZW,uBAAuB,uCAAvB,uBAAuB,QAYlC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\n/** The binary format version that this TS reader supports.\n * The C++ writer in imodel-native must produce this version (or negotiate down to it).\n * Frontend callers should always request this version explicitly via `PRAGMA schema_view(N)`.\n * Backend callers may omit it since native and backend are bundled together.\n * @beta\n */\nexport const schemaViewFormatVersion = 1;\n\n/** Matches ec_Class.Type values in ECDb.\n * @beta\n */\nexport enum ClassType {\n Entity = 0,\n Relationship = 1,\n Struct = 2,\n CustomAttribute = 3,\n /** Not stored in ec_Class.Type - synthesized from IsMixin CA during cache population. */\n Mixin = 4,\n /** Synthesized from the QueryView custom attribute. */\n View = 5,\n}\n\n/** Matches ec_Class.Modifier values.\n * @beta\n */\nexport enum ClassModifier {\n None = 0,\n Abstract = 1,\n Sealed = 2,\n}\n\n/** Matches ec_Property.Kind values.\n * @beta\n */\nexport enum PropertyKind {\n Primitive = 0,\n Struct = 1,\n PrimitiveArray = 2,\n StructArray = 3,\n Navigation = 4,\n}\n\n/** Matches ec_ PrimitiveType values.\n * @beta\n */\nexport enum SchemaViewPrimitiveType {\n Uninitialized = 0x00,\n Binary = 0x101,\n Boolean = 0x201,\n DateTime = 0x301,\n Double = 0x401,\n Integer = 0x501,\n Long = 0x601,\n Point2d = 0x701,\n Point3d = 0x801,\n String = 0x901,\n IGeometry = 0xa01,\n}\n\nimport { StrengthDirection, StrengthType } from \"../ECObjects\";\n\n/** Internal storage for a schema. Schemas own contiguous ranges of classes, enums, KoQs, and categories.\n * @internal\n */\nexport interface SchemaData {\n /** Row ID from ec_Schema - use with ECDbMeta queries, e.g. `SELECT * FROM meta.ECSchemaDef WHERE ECInstanceId = ?`. */\n readonly ecInstanceId: number;\n readonly nameStringIdx: number;\n readonly aliasStringIdx: number;\n readonly labelStringIdx: number;\n readonly descriptionStringIdx: number;\n readonly versionRead: number;\n readonly versionWrite: number;\n readonly versionMinor: number;\n readonly classRangeStart: number;\n readonly classCount: number;\n readonly enumRangeStart: number;\n readonly enumCount: number;\n readonly koqRangeStart: number;\n readonly koqCount: number;\n readonly catRangeStart: number;\n readonly catCount: number;\n readonly isHidden: boolean;\n}\n\n/** Internal storage for a class.\n * @internal\n */\nexport interface ClassData {\n /** Row ID from ec_Class - use with ECDbMeta queries, e.g. `SELECT * FROM meta.ECClassDef WHERE ECInstanceId = ?`. */\n readonly ecInstanceId: number;\n readonly schemaIdx: number;\n readonly nameStringIdx: number;\n readonly labelStringIdx: number;\n readonly descriptionStringIdx: number;\n readonly type: ClassType;\n readonly modifier: ClassModifier;\n readonly baseClassIdx: number;\n readonly mixinStartIdx: number;\n readonly mixinCount: number;\n readonly ownPropStart: number;\n readonly ownPropCount: number;\n readonly strength: StrengthType;\n readonly strengthDirection: StrengthDirection;\n readonly sourceConstraintIdx: number;\n readonly targetConstraintIdx: number;\n /** Tri-state hidden status from the `HiddenClass` / `HiddenSchema` custom attributes.\n *\n * This is the *direct* status of this class. It does NOT propagate through class\n * inheritance. Use `SchemaView.Class.isEffectivelyHidden` for hierarchy-aware checks.\n *\n * - `true`: `HiddenClass(Show!=true)` is applied, OR the owning schema has\n * `HiddenSchema(ShowClasses!=true)` and this class does not override with `HiddenClass(Show=true)`.\n * - `false`: `HiddenClass(Show=true)` is explicitly applied. This overrides schema-level\n * hiding and breaks the inheritance chain for `isEffectivelyHidden` on derived classes.\n * - `undefined`: No `HiddenClass` CA and the schema does not hide its classes. Neutral -\n * `isEffectivelyHidden` will look up the base class chain to decide.\n *\n * Binary encoding: 0 = undefined, 1 = true, 2 = false.\n */\n readonly isHidden: boolean | undefined;\n}\n\n/** Shared, deduplicated property definition. Many properties may reference the same def.\n * The definition holds the structural shape of a property - name, kind, type, cross-references.\n * Per-class overrides (label, priority) live in `PropertyRef`, not here, so that properties\n * with identical shape but different labels still share a single definition.\n * @internal\n */\nexport interface PropertyDef {\n readonly nameStringIdx: number;\n readonly descriptionStringIdx: number;\n readonly kind: PropertyKind;\n readonly primitiveType: SchemaViewPrimitiveType;\n readonly extTypeStringIdx: number;\n readonly enumIdx: number;\n readonly koqIdx: number;\n readonly structClassIdx: number;\n readonly navRelClassIdx: number;\n readonly navDirection: StrengthDirection;\n readonly categoryIdx: number;\n readonly isReadOnly: boolean;\n readonly isHidden: boolean;\n readonly arrayMinOccurs: number | undefined;\n readonly arrayMaxOccurs: number | undefined;\n}\n\n/** A reference from a specific class to a shared property definition.\n * Label and priority are per-reference (not per-definition) because EC allows class overrides\n * of these attributes. A property displayed in ClassA may have a different label than in ClassB\n * even though the underlying definition (name, type, etc.) is identical.\n *\n * `ecInstanceId` is the ec_Property.Id row ID, stored here (not on PropertyDef) because each\n * class-property pair has a unique row even when the structural definition is deduplicated.\n * @internal\n */\nexport interface PropertyRef {\n /** Row ID from ec_Property - use with ECDbMeta queries, e.g. `SELECT * FROM meta.ECPropertyDef WHERE ECInstanceId = ?`. */\n readonly ecInstanceId: number;\n readonly defIdx: number;\n readonly labelStringIdx: number;\n readonly priority: number;\n}\n\n/** Internal storage for a relationship constraint.\n * @internal\n */\nexport interface RelConstraintData {\n readonly abstractConstraintIdx: number;\n readonly polymorphic: boolean;\n readonly multiplicityLower: number;\n readonly multiplicityUpper: number;\n readonly roleLabelStringIdx: number;\n readonly classRefStart: number;\n readonly classRefCount: number;\n}\n\n/** Internal storage for an enumeration.\n * @internal\n */\nexport interface EnumerationData {\n /** Row ID from ec_Enumeration - use with ECDbMeta queries, e.g. `SELECT * FROM meta.ECEnumerationDef WHERE ECInstanceId = ?`. */\n readonly ecInstanceId: number;\n readonly schemaIdx: number;\n readonly nameStringIdx: number;\n readonly labelStringIdx: number;\n readonly descriptionStringIdx: number;\n readonly primitiveType: SchemaViewPrimitiveType;\n readonly isStrict: boolean;\n readonly enumeratorStart: number;\n readonly enumeratorCount: number;\n}\n\n/** Internal storage for an enumerator.\n * @internal\n */\nexport interface EnumeratorData {\n readonly nameStringIdx: number;\n readonly labelStringIdx: number;\n readonly descriptionStringIdx: number;\n readonly value: number | string;\n}\n\n/** Internal storage for a KindOfQuantity.\n * @internal\n */\nexport interface KoqData {\n /** Row ID from ec_KindOfQuantity - use with ECDbMeta queries, e.g. `SELECT * FROM meta.ECKindOfQuantityDef WHERE ECInstanceId = ?`. */\n readonly ecInstanceId: number;\n readonly schemaIdx: number;\n readonly nameStringIdx: number;\n readonly labelStringIdx: number;\n readonly descriptionStringIdx: number;\n readonly persistenceUnitStringIdx: number;\n readonly presentationFormatsStringIdx: number;\n readonly relativeError: number;\n}\n\n/** Internal storage for a PropertyCategory.\n * @internal\n */\nexport interface PropCategoryData {\n /** Row ID from ec_PropertyCategory - use with ECDbMeta queries, e.g. `SELECT * FROM meta.ECPropertyCategoryDef WHERE ECInstanceId = ?`. */\n readonly ecInstanceId: number;\n readonly schemaIdx: number;\n readonly nameStringIdx: number;\n readonly labelStringIdx: number;\n readonly descriptionStringIdx: number;\n readonly priority: number;\n}\n"]}