@itwin/core-backend 5.10.0-dev.19 → 5.10.0-dev.21

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 (81) hide show
  1. package/lib/cjs/BriefcaseManager.d.ts +8 -1
  2. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  3. package/lib/cjs/BriefcaseManager.js.map +1 -1
  4. package/lib/cjs/ClassRegistry.d.ts +3 -3
  5. package/lib/cjs/ClassRegistry.js +3 -3
  6. package/lib/cjs/ClassRegistry.js.map +1 -1
  7. package/lib/cjs/Element.d.ts +6 -3
  8. package/lib/cjs/Element.d.ts.map +1 -1
  9. package/lib/cjs/Element.js +6 -3
  10. package/lib/cjs/Element.js.map +1 -1
  11. package/lib/cjs/Entity.d.ts +13 -5
  12. package/lib/cjs/Entity.d.ts.map +1 -1
  13. package/lib/cjs/Entity.js +13 -5
  14. package/lib/cjs/Entity.js.map +1 -1
  15. package/lib/cjs/IModelDb.d.ts +79 -17
  16. package/lib/cjs/IModelDb.d.ts.map +1 -1
  17. package/lib/cjs/IModelDb.js +181 -22
  18. package/lib/cjs/IModelDb.js.map +1 -1
  19. package/lib/cjs/Relationship.d.ts +3 -1
  20. package/lib/cjs/Relationship.d.ts.map +1 -1
  21. package/lib/cjs/Relationship.js +3 -1
  22. package/lib/cjs/Relationship.js.map +1 -1
  23. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  24. package/lib/cjs/internal/workspace/WorkspaceImpl.js +7 -11
  25. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  26. package/lib/cjs/workspace/Workspace.d.ts +3 -1
  27. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  28. package/lib/cjs/workspace/Workspace.js.map +1 -1
  29. package/lib/esm/BriefcaseManager.d.ts +8 -1
  30. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  31. package/lib/esm/BriefcaseManager.js.map +1 -1
  32. package/lib/esm/ClassRegistry.d.ts +3 -3
  33. package/lib/esm/ClassRegistry.js +3 -3
  34. package/lib/esm/ClassRegistry.js.map +1 -1
  35. package/lib/esm/Element.d.ts +6 -3
  36. package/lib/esm/Element.d.ts.map +1 -1
  37. package/lib/esm/Element.js +6 -3
  38. package/lib/esm/Element.js.map +1 -1
  39. package/lib/esm/Entity.d.ts +13 -5
  40. package/lib/esm/Entity.d.ts.map +1 -1
  41. package/lib/esm/Entity.js +13 -5
  42. package/lib/esm/Entity.js.map +1 -1
  43. package/lib/esm/IModelDb.d.ts +79 -17
  44. package/lib/esm/IModelDb.d.ts.map +1 -1
  45. package/lib/esm/IModelDb.js +182 -23
  46. package/lib/esm/IModelDb.js.map +1 -1
  47. package/lib/esm/Relationship.d.ts +3 -1
  48. package/lib/esm/Relationship.d.ts.map +1 -1
  49. package/lib/esm/Relationship.js +3 -1
  50. package/lib/esm/Relationship.js.map +1 -1
  51. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  52. package/lib/esm/internal/workspace/WorkspaceImpl.js +7 -11
  53. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  54. package/lib/esm/test/imodel/IModel.test.js +2 -0
  55. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  56. package/lib/esm/test/schema/ClassRegistry.test.js +3 -0
  57. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  58. package/lib/esm/test/schema/IModelSchemaContext.test.js +2 -0
  59. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  60. package/lib/esm/test/schema/SchemaViewHidden.test.d.ts +2 -0
  61. package/lib/esm/test/schema/SchemaViewHidden.test.d.ts.map +1 -0
  62. package/lib/esm/test/schema/SchemaViewHidden.test.js +275 -0
  63. package/lib/esm/test/schema/SchemaViewHidden.test.js.map +1 -0
  64. package/lib/esm/test/schema/SchemaViewKoQ.test.d.ts +2 -0
  65. package/lib/esm/test/schema/SchemaViewKoQ.test.d.ts.map +1 -0
  66. package/lib/esm/test/schema/SchemaViewKoQ.test.js +175 -0
  67. package/lib/esm/test/schema/SchemaViewKoQ.test.js.map +1 -0
  68. package/lib/esm/test/schema/SchemaViewLifecycle.test.d.ts +2 -0
  69. package/lib/esm/test/schema/SchemaViewLifecycle.test.d.ts.map +1 -0
  70. package/lib/esm/test/schema/SchemaViewLifecycle.test.js +141 -0
  71. package/lib/esm/test/schema/SchemaViewLifecycle.test.js.map +1 -0
  72. package/lib/esm/test/schema/SchemaViewValidation.test.d.ts +2 -0
  73. package/lib/esm/test/schema/SchemaViewValidation.test.d.ts.map +1 -0
  74. package/lib/esm/test/schema/SchemaViewValidation.test.js +475 -0
  75. package/lib/esm/test/schema/SchemaViewValidation.test.js.map +1 -0
  76. package/lib/esm/test/standalone/Workspace.test.js +23 -0
  77. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  78. package/lib/esm/workspace/Workspace.d.ts +3 -1
  79. package/lib/esm/workspace/Workspace.d.ts.map +1 -1
  80. package/lib/esm/workspace/Workspace.js.map +1 -1
  81. package/package.json +14 -14
@@ -0,0 +1,275 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { IModelHost, SnapshotDb } from "../../core-backend";
6
+ import { expect } from "chai";
7
+ import { IModelTestUtils } from "../IModelTestUtils";
8
+ import { TestUtils } from "../TestUtils";
9
+ /**
10
+ * Tests for the Hidden* custom attributes from CoreCustomAttributes, verifying that SchemaView
11
+ * correctly exposes the tri-state `isHidden` (true/false/undefined) on classes and the boolean
12
+ * `isHidden` on schemas and properties. Also tests `isEffectivelyHidden` which walks the base
13
+ * class chain (not mixins) and stops at explicit `isHidden === false` overrides.
14
+ *
15
+ * Class `isHidden` values:
16
+ * - `true`: hidden via `HiddenClass(Show!=true)` or schema-level `HiddenSchema(ShowClasses!=true)`
17
+ * - `false`: explicitly shown via `HiddenClass(Show=true)` - breaks inheritance chain
18
+ * - `undefined`: no `HiddenClass` CA, schema doesn't hide classes - neutral, defers to base class
19
+ *
20
+ * Binary format: classes serialize this as a single byte (0=undefined, 1=true, 2=false).
21
+ * Schema-level class propagation from `HiddenSchema(ShowClasses!=true)` is pre-resolved
22
+ * into each class's isHidden at serialization time.
23
+ */
24
+ describe("SchemaView hidden flags", () => {
25
+ before(async () => {
26
+ if (!IModelHost.isValid)
27
+ await TestUtils.startBackend();
28
+ });
29
+ // Schema with HiddenSchema(ShowClasses=false) - schema AND all classes should be hidden
30
+ const hiddenSchemaDefault = `<?xml version="1.0" encoding="UTF-8"?>
31
+ <ECSchema schemaName="HiddenSchemaDefault" alias="hsd" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
32
+ <ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
33
+ <ECSchemaReference name="CoreCustomAttributes" version="01.00.00" alias="CoreCA"/>
34
+ <ECCustomAttributes>
35
+ <HiddenSchema xmlns="CoreCustomAttributes.01.00.00">
36
+ <ShowClasses>false</ShowClasses>
37
+ </HiddenSchema>
38
+ </ECCustomAttributes>
39
+ <ECEntityClass typeName="InheritedHiddenElement" modifier="Sealed">
40
+ <BaseClass>bis:PhysicalElement</BaseClass>
41
+ <ECProperty propertyName="SomeProp" typeName="string"/>
42
+ </ECEntityClass>
43
+ </ECSchema>`;
44
+ // Schema with HiddenSchema(ShowClasses=true) - schema hidden, classes are NOT
45
+ const hiddenSchemaShowClasses = `<?xml version="1.0" encoding="UTF-8"?>
46
+ <ECSchema schemaName="HiddenSchemaShowClasses" alias="hssc" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
47
+ <ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
48
+ <ECSchemaReference name="CoreCustomAttributes" version="01.00.00" alias="CoreCA"/>
49
+ <ECCustomAttributes>
50
+ <HiddenSchema xmlns="CoreCustomAttributes.01.00.00">
51
+ <ShowClasses>true</ShowClasses>
52
+ </HiddenSchema>
53
+ </ECCustomAttributes>
54
+ <ECEntityClass typeName="ShownElement" modifier="Sealed">
55
+ <BaseClass>bis:PhysicalElement</BaseClass>
56
+ <ECProperty propertyName="SomeProp" typeName="string"/>
57
+ </ECEntityClass>
58
+ </ECSchema>`;
59
+ // Schema with HiddenSchema(ShowClasses=false) + class with HiddenClass(Show=true) override
60
+ const hiddenSchemaWithClassOverride = `<?xml version="1.0" encoding="UTF-8"?>
61
+ <ECSchema schemaName="HiddenSchemaClassOverride" alias="hsco" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
62
+ <ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
63
+ <ECSchemaReference name="CoreCustomAttributes" version="01.00.00" alias="CoreCA"/>
64
+ <ECCustomAttributes>
65
+ <HiddenSchema xmlns="CoreCustomAttributes.01.00.00">
66
+ <ShowClasses>false</ShowClasses>
67
+ </HiddenSchema>
68
+ </ECCustomAttributes>
69
+ <ECEntityClass typeName="OverriddenShownElement" modifier="Sealed">
70
+ <BaseClass>bis:PhysicalElement</BaseClass>
71
+ <ECCustomAttributes>
72
+ <HiddenClass xmlns="CoreCustomAttributes.01.00.00">
73
+ <Show>true</Show>
74
+ </HiddenClass>
75
+ </ECCustomAttributes>
76
+ <ECProperty propertyName="SomeProp" typeName="string"/>
77
+ </ECEntityClass>
78
+ <ECEntityClass typeName="StillHiddenElement" modifier="Sealed">
79
+ <BaseClass>bis:PhysicalElement</BaseClass>
80
+ <ECProperty propertyName="SomeProp" typeName="string"/>
81
+ </ECEntityClass>
82
+ </ECSchema>`;
83
+ // Schema with class-level and property-level hidden flags and Show overrides.
84
+ // Also includes a non-sealed hidden base class to test derived class inheritance.
85
+ const hiddenClassAndPropertySchema = `<?xml version="1.0" encoding="UTF-8"?>
86
+ <ECSchema schemaName="HiddenClassPropSchema" alias="hcps" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
87
+ <ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
88
+ <ECSchemaReference name="CoreCustomAttributes" version="01.00.00" alias="CoreCA"/>
89
+ <ECEntityClass typeName="HiddenBase" modifier="Abstract">
90
+ <BaseClass>bis:PhysicalElement</BaseClass>
91
+ <ECCustomAttributes>
92
+ <HiddenClass xmlns="CoreCustomAttributes.01.00.00">
93
+ <Show>false</Show>
94
+ </HiddenClass>
95
+ </ECCustomAttributes>
96
+ <ECProperty propertyName="HiddenProp" typeName="string">
97
+ <ECCustomAttributes>
98
+ <HiddenProperty xmlns="CoreCustomAttributes.01.00.00">
99
+ <Show>false</Show>
100
+ </HiddenProperty>
101
+ </ECCustomAttributes>
102
+ </ECProperty>
103
+ <ECProperty propertyName="ShownProp" typeName="string">
104
+ <ECCustomAttributes>
105
+ <HiddenProperty xmlns="CoreCustomAttributes.01.00.00">
106
+ <Show>true</Show>
107
+ </HiddenProperty>
108
+ </ECCustomAttributes>
109
+ </ECProperty>
110
+ <ECProperty propertyName="NormalProp" typeName="string"/>
111
+ </ECEntityClass>
112
+ <ECEntityClass typeName="DerivedNoCA" modifier="Sealed" description="Derived from hidden base, no HiddenClass CA - should inherit hidden via isEffectivelyHidden">
113
+ <BaseClass>HiddenBase</BaseClass>
114
+ </ECEntityClass>
115
+ <ECEntityClass typeName="DerivedShown" description="Derived from hidden base, HiddenClass(Show=true) breaks the chain">
116
+ <BaseClass>HiddenBase</BaseClass>
117
+ <ECCustomAttributes>
118
+ <HiddenClass xmlns="CoreCustomAttributes.01.00.00">
119
+ <Show>true</Show>
120
+ </HiddenClass>
121
+ </ECCustomAttributes>
122
+ </ECEntityClass>
123
+ <ECEntityClass typeName="DerivedFromShown" modifier="Sealed" description="Derived from explicitly shown class, no CA - should NOT be effectively hidden">
124
+ <BaseClass>DerivedShown</BaseClass>
125
+ </ECEntityClass>
126
+ <ECEntityClass typeName="ShownClassElement" modifier="Sealed">
127
+ <BaseClass>bis:PhysicalElement</BaseClass>
128
+ <ECCustomAttributes>
129
+ <HiddenClass xmlns="CoreCustomAttributes.01.00.00">
130
+ <Show>true</Show>
131
+ </HiddenClass>
132
+ </ECCustomAttributes>
133
+ <ECProperty propertyName="SomeProp" typeName="int"/>
134
+ </ECEntityClass>
135
+ <ECEntityClass typeName="VisibleElement" modifier="Sealed">
136
+ <BaseClass>bis:PhysicalElement</BaseClass>
137
+ <ECProperty propertyName="SomeProp" typeName="int"/>
138
+ </ECEntityClass>
139
+ </ECSchema>`;
140
+ // Visible schema for baseline comparison
141
+ const visibleTestSchema = `<?xml version="1.0" encoding="UTF-8"?>
142
+ <ECSchema schemaName="VisibleTestSchema" alias="vts" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
143
+ <ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
144
+ <ECEntityClass typeName="NormalElement" modifier="Sealed">
145
+ <BaseClass>bis:PhysicalElement</BaseClass>
146
+ <ECProperty propertyName="NormalProp" typeName="string"/>
147
+ </ECEntityClass>
148
+ </ECSchema>`;
149
+ let iModel;
150
+ let view;
151
+ before(async () => {
152
+ const testFileName = IModelTestUtils.prepareOutputFile("SchemaViewHidden", "HiddenFlags.bim");
153
+ iModel = SnapshotDb.createEmpty(testFileName, { rootSubject: { name: "HiddenFlagsTest" } });
154
+ await iModel.importSchemaStrings([
155
+ hiddenSchemaDefault,
156
+ hiddenSchemaShowClasses,
157
+ hiddenSchemaWithClassOverride,
158
+ hiddenClassAndPropertySchema,
159
+ visibleTestSchema,
160
+ ]);
161
+ view = await iModel.getSchemaView();
162
+ });
163
+ after(() => {
164
+ if (iModel?.isOpen)
165
+ iModel.close();
166
+ });
167
+ describe("HiddenSchema", () => {
168
+ it("schema without HiddenSchema CA is not hidden", () => {
169
+ const schema = view.getSchema("VisibleTestSchema");
170
+ expect(schema).to.not.be.undefined;
171
+ expect(schema.isHidden).to.equal(false);
172
+ const bisCore = view.getSchema("BisCore");
173
+ expect(bisCore).to.not.be.undefined;
174
+ expect(bisCore.isHidden).to.equal(false);
175
+ });
176
+ it("schema with HiddenSchema(ShowClasses=false) is hidden", () => {
177
+ const schema = view.getSchema("HiddenSchemaDefault");
178
+ expect(schema).to.not.be.undefined;
179
+ expect(schema.isHidden).to.equal(true);
180
+ });
181
+ it("schema with HiddenSchema(ShowClasses=true) is still hidden", () => {
182
+ const schema = view.getSchema("HiddenSchemaShowClasses");
183
+ expect(schema).to.not.be.undefined;
184
+ expect(schema.isHidden).to.equal(true, "ShowClasses does not affect the schema's own isHidden");
185
+ });
186
+ });
187
+ describe("HiddenClass - tri-state isHidden", () => {
188
+ it("class in HiddenSchema(ShowClasses=false) without own CA has isHidden=true", () => {
189
+ const cls = view.findClass("HiddenSchemaDefault:InheritedHiddenElement");
190
+ expect(cls).to.not.be.undefined;
191
+ expect(cls.isHidden).to.equal(true, "schema-level propagation bakes into true");
192
+ expect(cls.isEffectivelyHidden).to.equal(true);
193
+ });
194
+ it("class in HiddenSchema(ShowClasses=true) without own CA has isHidden=undefined", () => {
195
+ const cls = view.findClass("HiddenSchemaShowClasses:ShownElement");
196
+ expect(cls).to.not.be.undefined;
197
+ expect(cls.isHidden).to.equal(undefined, "ShowClasses=true means no schema propagation");
198
+ expect(cls.isEffectivelyHidden).to.equal(false);
199
+ });
200
+ it("class with HiddenClass(Show=false) has isHidden=true", () => {
201
+ const cls = view.findClass("HiddenClassPropSchema:HiddenBase");
202
+ expect(cls).to.not.be.undefined;
203
+ expect(cls.isHidden).to.equal(true);
204
+ expect(cls.isEffectivelyHidden).to.equal(true);
205
+ });
206
+ it("class with HiddenClass(Show=true) has isHidden=false (explicitly shown)", () => {
207
+ const cls = view.findClass("HiddenClassPropSchema:ShownClassElement");
208
+ expect(cls).to.not.be.undefined;
209
+ expect(cls.isHidden).to.equal(false, "explicit Show=true produces false");
210
+ expect(cls.isEffectivelyHidden).to.equal(false);
211
+ });
212
+ it("class without any HiddenClass CA in visible schema has isHidden=undefined", () => {
213
+ const cls = view.findClass("HiddenClassPropSchema:VisibleElement");
214
+ expect(cls).to.not.be.undefined;
215
+ expect(cls.isHidden).to.equal(undefined);
216
+ expect(cls.isEffectivelyHidden).to.equal(false);
217
+ });
218
+ it("HiddenClass(Show=true) in HiddenSchema(ShowClasses=false) produces isHidden=false", () => {
219
+ const cls = view.findClass("HiddenSchemaClassOverride:OverriddenShownElement");
220
+ expect(cls).to.not.be.undefined;
221
+ expect(cls.isHidden).to.equal(false, "explicit Show=true overrides schema propagation");
222
+ expect(cls.isEffectivelyHidden).to.equal(false);
223
+ });
224
+ it("class without HiddenClass in HiddenSchema(ShowClasses=false) has isHidden=true", () => {
225
+ const cls = view.findClass("HiddenSchemaClassOverride:StillHiddenElement");
226
+ expect(cls).to.not.be.undefined;
227
+ expect(cls.isHidden).to.equal(true);
228
+ expect(cls.isEffectivelyHidden).to.equal(true);
229
+ });
230
+ });
231
+ describe("isEffectivelyHidden - base class inheritance", () => {
232
+ it("derived class with no CA inherits effectively hidden from hidden base", () => {
233
+ const cls = view.findClass("HiddenClassPropSchema:DerivedNoCA");
234
+ expect(cls).to.not.be.undefined;
235
+ expect(cls.isHidden).to.equal(undefined, "no own CA");
236
+ expect(cls.isEffectivelyHidden).to.equal(true, "walks up to hidden base");
237
+ });
238
+ it("derived class with HiddenClass(Show=true) breaks the inheritance chain", () => {
239
+ const cls = view.findClass("HiddenClassPropSchema:DerivedShown");
240
+ expect(cls).to.not.be.undefined;
241
+ expect(cls.isHidden).to.equal(false);
242
+ expect(cls.isEffectivelyHidden).to.equal(false, "Show=true breaks the chain");
243
+ });
244
+ it("class derived from explicitly shown class is NOT effectively hidden", () => {
245
+ const cls = view.findClass("HiddenClassPropSchema:DerivedFromShown");
246
+ expect(cls).to.not.be.undefined;
247
+ expect(cls.isHidden).to.equal(undefined, "no own CA");
248
+ expect(cls.isEffectivelyHidden).to.equal(false, "Show=true on ancestor breaks the chain");
249
+ });
250
+ });
251
+ describe("HiddenProperty", () => {
252
+ it("property with HiddenProperty(Show=false) is hidden", () => {
253
+ const cls = view.findClass("HiddenClassPropSchema:HiddenBase");
254
+ expect(cls).to.not.be.undefined;
255
+ const prop = cls.getProperty("HiddenProp");
256
+ expect(prop).to.not.be.undefined;
257
+ expect(prop.isHidden).to.equal(true);
258
+ });
259
+ it("property with HiddenProperty(Show=true) is NOT hidden", () => {
260
+ const cls = view.findClass("HiddenClassPropSchema:HiddenBase");
261
+ expect(cls).to.not.be.undefined;
262
+ const prop = cls.getProperty("ShownProp");
263
+ expect(prop).to.not.be.undefined;
264
+ expect(prop.isHidden).to.equal(false, "HiddenProperty with Show=true should override");
265
+ });
266
+ it("property without HiddenProperty CA is not hidden", () => {
267
+ const cls = view.findClass("HiddenClassPropSchema:HiddenBase");
268
+ expect(cls).to.not.be.undefined;
269
+ const prop = cls.getProperty("NormalProp");
270
+ expect(prop).to.not.be.undefined;
271
+ expect(prop.isHidden).to.equal(false);
272
+ });
273
+ });
274
+ });
275
+ //# sourceMappingURL=SchemaViewHidden.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewHidden.test.js","sourceRoot":"","sources":["../../../../src/test/schema/SchemaViewHidden.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC,UAAU,CAAC,OAAO;YACrB,MAAM,SAAS,CAAC,YAAY,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,wFAAwF;IACxF,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;gBAad,CAAC;IAE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EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;YACjC,MAAM,CAAC,IAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,+CAA+C,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;YAC/D,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;YAChC,MAAM,IAAI,GAAG,GAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAC5C,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;YACjC,MAAM,CAAC,IAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { IModelHost, SnapshotDb } from \"../../core-backend\";\r\nimport type { SchemaView } from \"@itwin/ecschema-metadata\";\r\nimport { expect } from \"chai\";\r\nimport { IModelTestUtils } from \"../IModelTestUtils\";\r\nimport { TestUtils } from \"../TestUtils\";\r\n\r\n/**\r\n * Tests for the Hidden* custom attributes from CoreCustomAttributes, verifying that SchemaView\r\n * correctly exposes the tri-state `isHidden` (true/false/undefined) on classes and the boolean\r\n * `isHidden` on schemas and properties. Also tests `isEffectivelyHidden` which walks the base\r\n * class chain (not mixins) and stops at explicit `isHidden === false` overrides.\r\n *\r\n * Class `isHidden` values:\r\n * - `true`: hidden via `HiddenClass(Show!=true)` or schema-level `HiddenSchema(ShowClasses!=true)`\r\n * - `false`: explicitly shown via `HiddenClass(Show=true)` - breaks inheritance chain\r\n * - `undefined`: no `HiddenClass` CA, schema doesn't hide classes - neutral, defers to base class\r\n *\r\n * Binary format: classes serialize this as a single byte (0=undefined, 1=true, 2=false).\r\n * Schema-level class propagation from `HiddenSchema(ShowClasses!=true)` is pre-resolved\r\n * into each class's isHidden at serialization time.\r\n */\r\ndescribe(\"SchemaView hidden flags\", () => {\r\n before(async () => {\r\n if (!IModelHost.isValid)\r\n await TestUtils.startBackend();\r\n });\r\n\r\n // Schema with HiddenSchema(ShowClasses=false) - schema AND all classes should be hidden\r\n const hiddenSchemaDefault = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n <ECSchema schemaName=\"HiddenSchemaDefault\" alias=\"hsd\" version=\"01.00.00\" xmlns=\"http://www.bentley.com/schemas/Bentley.ECXML.3.2\">\r\n <ECSchemaReference name=\"BisCore\" version=\"01.00.00\" alias=\"bis\"/>\r\n <ECSchemaReference name=\"CoreCustomAttributes\" version=\"01.00.00\" alias=\"CoreCA\"/>\r\n <ECCustomAttributes>\r\n <HiddenSchema xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <ShowClasses>false</ShowClasses>\r\n </HiddenSchema>\r\n </ECCustomAttributes>\r\n <ECEntityClass typeName=\"InheritedHiddenElement\" modifier=\"Sealed\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECProperty propertyName=\"SomeProp\" typeName=\"string\"/>\r\n </ECEntityClass>\r\n </ECSchema>`;\r\n\r\n // Schema with HiddenSchema(ShowClasses=true) - schema hidden, classes are NOT\r\n const hiddenSchemaShowClasses = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n <ECSchema schemaName=\"HiddenSchemaShowClasses\" alias=\"hssc\" version=\"01.00.00\" xmlns=\"http://www.bentley.com/schemas/Bentley.ECXML.3.2\">\r\n <ECSchemaReference name=\"BisCore\" version=\"01.00.00\" alias=\"bis\"/>\r\n <ECSchemaReference name=\"CoreCustomAttributes\" version=\"01.00.00\" alias=\"CoreCA\"/>\r\n <ECCustomAttributes>\r\n <HiddenSchema xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <ShowClasses>true</ShowClasses>\r\n </HiddenSchema>\r\n </ECCustomAttributes>\r\n <ECEntityClass typeName=\"ShownElement\" modifier=\"Sealed\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECProperty propertyName=\"SomeProp\" typeName=\"string\"/>\r\n </ECEntityClass>\r\n </ECSchema>`;\r\n\r\n // Schema with HiddenSchema(ShowClasses=false) + class with HiddenClass(Show=true) override\r\n const hiddenSchemaWithClassOverride = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n <ECSchema schemaName=\"HiddenSchemaClassOverride\" alias=\"hsco\" version=\"01.00.00\" xmlns=\"http://www.bentley.com/schemas/Bentley.ECXML.3.2\">\r\n <ECSchemaReference name=\"BisCore\" version=\"01.00.00\" alias=\"bis\"/>\r\n <ECSchemaReference name=\"CoreCustomAttributes\" version=\"01.00.00\" alias=\"CoreCA\"/>\r\n <ECCustomAttributes>\r\n <HiddenSchema xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <ShowClasses>false</ShowClasses>\r\n </HiddenSchema>\r\n </ECCustomAttributes>\r\n <ECEntityClass typeName=\"OverriddenShownElement\" modifier=\"Sealed\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECCustomAttributes>\r\n <HiddenClass xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <Show>true</Show>\r\n </HiddenClass>\r\n </ECCustomAttributes>\r\n <ECProperty propertyName=\"SomeProp\" typeName=\"string\"/>\r\n </ECEntityClass>\r\n <ECEntityClass typeName=\"StillHiddenElement\" modifier=\"Sealed\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECProperty propertyName=\"SomeProp\" typeName=\"string\"/>\r\n </ECEntityClass>\r\n </ECSchema>`;\r\n\r\n // Schema with class-level and property-level hidden flags and Show overrides.\r\n // Also includes a non-sealed hidden base class to test derived class inheritance.\r\n const hiddenClassAndPropertySchema = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n <ECSchema schemaName=\"HiddenClassPropSchema\" alias=\"hcps\" version=\"01.00.00\" xmlns=\"http://www.bentley.com/schemas/Bentley.ECXML.3.2\">\r\n <ECSchemaReference name=\"BisCore\" version=\"01.00.00\" alias=\"bis\"/>\r\n <ECSchemaReference name=\"CoreCustomAttributes\" version=\"01.00.00\" alias=\"CoreCA\"/>\r\n <ECEntityClass typeName=\"HiddenBase\" modifier=\"Abstract\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECCustomAttributes>\r\n <HiddenClass xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <Show>false</Show>\r\n </HiddenClass>\r\n </ECCustomAttributes>\r\n <ECProperty propertyName=\"HiddenProp\" typeName=\"string\">\r\n <ECCustomAttributes>\r\n <HiddenProperty xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <Show>false</Show>\r\n </HiddenProperty>\r\n </ECCustomAttributes>\r\n </ECProperty>\r\n <ECProperty propertyName=\"ShownProp\" typeName=\"string\">\r\n <ECCustomAttributes>\r\n <HiddenProperty xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <Show>true</Show>\r\n </HiddenProperty>\r\n </ECCustomAttributes>\r\n </ECProperty>\r\n <ECProperty propertyName=\"NormalProp\" typeName=\"string\"/>\r\n </ECEntityClass>\r\n <ECEntityClass typeName=\"DerivedNoCA\" modifier=\"Sealed\" description=\"Derived from hidden base, no HiddenClass CA - should inherit hidden via isEffectivelyHidden\">\r\n <BaseClass>HiddenBase</BaseClass>\r\n </ECEntityClass>\r\n <ECEntityClass typeName=\"DerivedShown\" description=\"Derived from hidden base, HiddenClass(Show=true) breaks the chain\">\r\n <BaseClass>HiddenBase</BaseClass>\r\n <ECCustomAttributes>\r\n <HiddenClass xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <Show>true</Show>\r\n </HiddenClass>\r\n </ECCustomAttributes>\r\n </ECEntityClass>\r\n <ECEntityClass typeName=\"DerivedFromShown\" modifier=\"Sealed\" description=\"Derived from explicitly shown class, no CA - should NOT be effectively hidden\">\r\n <BaseClass>DerivedShown</BaseClass>\r\n </ECEntityClass>\r\n <ECEntityClass typeName=\"ShownClassElement\" modifier=\"Sealed\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECCustomAttributes>\r\n <HiddenClass xmlns=\"CoreCustomAttributes.01.00.00\">\r\n <Show>true</Show>\r\n </HiddenClass>\r\n </ECCustomAttributes>\r\n <ECProperty propertyName=\"SomeProp\" typeName=\"int\"/>\r\n </ECEntityClass>\r\n <ECEntityClass typeName=\"VisibleElement\" modifier=\"Sealed\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECProperty propertyName=\"SomeProp\" typeName=\"int\"/>\r\n </ECEntityClass>\r\n </ECSchema>`;\r\n\r\n // Visible schema for baseline comparison\r\n const visibleTestSchema = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n <ECSchema schemaName=\"VisibleTestSchema\" alias=\"vts\" version=\"01.00.00\" xmlns=\"http://www.bentley.com/schemas/Bentley.ECXML.3.2\">\r\n <ECSchemaReference name=\"BisCore\" version=\"01.00.00\" alias=\"bis\"/>\r\n <ECEntityClass typeName=\"NormalElement\" modifier=\"Sealed\">\r\n <BaseClass>bis:PhysicalElement</BaseClass>\r\n <ECProperty propertyName=\"NormalProp\" typeName=\"string\"/>\r\n </ECEntityClass>\r\n </ECSchema>`;\r\n\r\n let iModel: SnapshotDb;\r\n let view: SchemaView;\r\n\r\n before(async () => {\r\n const testFileName = IModelTestUtils.prepareOutputFile(\"SchemaViewHidden\", \"HiddenFlags.bim\");\r\n iModel = SnapshotDb.createEmpty(testFileName, { rootSubject: { name: \"HiddenFlagsTest\" } });\r\n await iModel.importSchemaStrings([\r\n hiddenSchemaDefault,\r\n hiddenSchemaShowClasses,\r\n hiddenSchemaWithClassOverride,\r\n hiddenClassAndPropertySchema,\r\n visibleTestSchema,\r\n ]);\r\n view = await iModel.getSchemaView();\r\n });\r\n\r\n after(() => {\r\n if (iModel?.isOpen)\r\n iModel.close();\r\n });\r\n\r\n describe(\"HiddenSchema\", () => {\r\n it(\"schema without HiddenSchema CA is not hidden\", () => {\r\n const schema = view.getSchema(\"VisibleTestSchema\");\r\n expect(schema).to.not.be.undefined;\r\n expect(schema!.isHidden).to.equal(false);\r\n\r\n const bisCore = view.getSchema(\"BisCore\");\r\n expect(bisCore).to.not.be.undefined;\r\n expect(bisCore!.isHidden).to.equal(false);\r\n });\r\n\r\n it(\"schema with HiddenSchema(ShowClasses=false) is hidden\", () => {\r\n const schema = view.getSchema(\"HiddenSchemaDefault\");\r\n expect(schema).to.not.be.undefined;\r\n expect(schema!.isHidden).to.equal(true);\r\n });\r\n\r\n it(\"schema with HiddenSchema(ShowClasses=true) is still hidden\", () => {\r\n const schema = view.getSchema(\"HiddenSchemaShowClasses\");\r\n expect(schema).to.not.be.undefined;\r\n expect(schema!.isHidden).to.equal(true, \"ShowClasses does not affect the schema's own isHidden\");\r\n });\r\n });\r\n\r\n describe(\"HiddenClass - tri-state isHidden\", () => {\r\n it(\"class in HiddenSchema(ShowClasses=false) without own CA has isHidden=true\", () => {\r\n const cls = view.findClass(\"HiddenSchemaDefault:InheritedHiddenElement\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(true, \"schema-level propagation bakes into true\");\r\n expect(cls!.isEffectivelyHidden).to.equal(true);\r\n });\r\n\r\n it(\"class in HiddenSchema(ShowClasses=true) without own CA has isHidden=undefined\", () => {\r\n const cls = view.findClass(\"HiddenSchemaShowClasses:ShownElement\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(undefined, \"ShowClasses=true means no schema propagation\");\r\n expect(cls!.isEffectivelyHidden).to.equal(false);\r\n });\r\n\r\n it(\"class with HiddenClass(Show=false) has isHidden=true\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:HiddenBase\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(true);\r\n expect(cls!.isEffectivelyHidden).to.equal(true);\r\n });\r\n\r\n it(\"class with HiddenClass(Show=true) has isHidden=false (explicitly shown)\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:ShownClassElement\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(false, \"explicit Show=true produces false\");\r\n expect(cls!.isEffectivelyHidden).to.equal(false);\r\n });\r\n\r\n it(\"class without any HiddenClass CA in visible schema has isHidden=undefined\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:VisibleElement\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(undefined);\r\n expect(cls!.isEffectivelyHidden).to.equal(false);\r\n });\r\n\r\n it(\"HiddenClass(Show=true) in HiddenSchema(ShowClasses=false) produces isHidden=false\", () => {\r\n const cls = view.findClass(\"HiddenSchemaClassOverride:OverriddenShownElement\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(false, \"explicit Show=true overrides schema propagation\");\r\n expect(cls!.isEffectivelyHidden).to.equal(false);\r\n });\r\n\r\n it(\"class without HiddenClass in HiddenSchema(ShowClasses=false) has isHidden=true\", () => {\r\n const cls = view.findClass(\"HiddenSchemaClassOverride:StillHiddenElement\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(true);\r\n expect(cls!.isEffectivelyHidden).to.equal(true);\r\n });\r\n });\r\n\r\n describe(\"isEffectivelyHidden - base class inheritance\", () => {\r\n it(\"derived class with no CA inherits effectively hidden from hidden base\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:DerivedNoCA\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(undefined, \"no own CA\");\r\n expect(cls!.isEffectivelyHidden).to.equal(true, \"walks up to hidden base\");\r\n });\r\n\r\n it(\"derived class with HiddenClass(Show=true) breaks the inheritance chain\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:DerivedShown\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(false);\r\n expect(cls!.isEffectivelyHidden).to.equal(false, \"Show=true breaks the chain\");\r\n });\r\n\r\n it(\"class derived from explicitly shown class is NOT effectively hidden\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:DerivedFromShown\");\r\n expect(cls).to.not.be.undefined;\r\n expect(cls!.isHidden).to.equal(undefined, \"no own CA\");\r\n expect(cls!.isEffectivelyHidden).to.equal(false, \"Show=true on ancestor breaks the chain\");\r\n });\r\n });\r\n\r\n describe(\"HiddenProperty\", () => {\r\n it(\"property with HiddenProperty(Show=false) is hidden\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:HiddenBase\");\r\n expect(cls).to.not.be.undefined;\r\n const prop = cls!.getProperty(\"HiddenProp\");\r\n expect(prop).to.not.be.undefined;\r\n expect(prop!.isHidden).to.equal(true);\r\n });\r\n\r\n it(\"property with HiddenProperty(Show=true) is NOT hidden\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:HiddenBase\");\r\n expect(cls).to.not.be.undefined;\r\n const prop = cls!.getProperty(\"ShownProp\");\r\n expect(prop).to.not.be.undefined;\r\n expect(prop!.isHidden).to.equal(false, \"HiddenProperty with Show=true should override\");\r\n });\r\n\r\n it(\"property without HiddenProperty CA is not hidden\", () => {\r\n const cls = view.findClass(\"HiddenClassPropSchema:HiddenBase\");\r\n expect(cls).to.not.be.undefined;\r\n const prop = cls!.getProperty(\"NormalProp\");\r\n expect(prop).to.not.be.undefined;\r\n expect(prop!.isHidden).to.equal(false);\r\n });\r\n });\r\n});\r\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SchemaViewKoQ.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewKoQ.test.d.ts","sourceRoot":"","sources":["../../../../src/test/schema/SchemaViewKoQ.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,175 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { IModelHost, SnapshotDb } from "../../core-backend";
6
+ import { Format, KindOfQuantity, SchemaUnitProvider, Unit } from "@itwin/ecschema-metadata";
7
+ import { QueryBinder, QueryRowFormat } from "@itwin/core-common";
8
+ import { assert, expect } from "chai";
9
+ import * as path from "path";
10
+ import { KnownTestLocations } from "../KnownTestLocations";
11
+ import { TestUtils } from "../TestUtils";
12
+ /**
13
+ * Example-style tests showing how to access KindOfQuantity presentation formats
14
+ * through SchemaView and resolve the alias-qualified format/unit names
15
+ * into full schema items via ecschema-metadata or ECSQL.
16
+ *
17
+ * Uses sim-master.bim which contains schemas with rich KoQ definitions
18
+ * (AecUnits, RoadRailUnits, LinearReferencing, etc.).
19
+ */
20
+ describe("SchemaView KindOfQuantity presentation formats", () => {
21
+ let iModel;
22
+ let schemaView;
23
+ before(async () => {
24
+ if (!IModelHost.isValid)
25
+ await TestUtils.startBackend();
26
+ iModel = SnapshotDb.openFile(path.join(KnownTestLocations.assetsDir, "sim-master.bim"));
27
+ schemaView = await iModel.getSchemaView();
28
+ });
29
+ after(() => {
30
+ iModel.close();
31
+ });
32
+ /**
33
+ * Example: get a property's KoQ from SchemaView, then resolve the
34
+ * alias-qualified format and unit names to full ecschema-metadata objects via
35
+ * IModelDb.schemaContext.
36
+ *
37
+ * SchemaView uses alias-qualified names (e.g. "f:DefaultRealU", "u:M")
38
+ * because the Units and Formats schemas are excluded from the SchemaView blob.
39
+ * The alias ("f" -> "Formats", "u" -> "Units") is stored in ec_Schema, so we
40
+ * can resolve it using the schema context that has the full schema set.
41
+ */
42
+ it("should resolve KoQ format and unit names via ecschema-metadata", async () => {
43
+ // --- Step 1: find a property with a KoQ via SchemaView ---
44
+ const rClass = schemaView.findClass("LinearReferencing:DistanceExpression");
45
+ assert.isDefined(rClass, "DistanceExpression class not found");
46
+ const rProp = rClass.getProperty("DistanceAlongFromStart");
47
+ assert.isDefined(rProp, "DistanceAlongFromStart property not found");
48
+ const prop = rProp;
49
+ if (!prop.isPrimitive())
50
+ throw new Error("expected primitive");
51
+ const rKoq = prop.kindOfQuantity;
52
+ assert.isDefined(rKoq, "property should have a KoQ");
53
+ // --- Step 2: inspect parsed presentation formats ---
54
+ const formats = rKoq.presentationFormats;
55
+ expect(formats.length).to.be.greaterThan(0, "KoQ should have presentation formats");
56
+ // LinearReferencing:LENGTH has: f:DefaultRealU(2)[u:M], f:DefaultRealU(2)[u:FT]
57
+ const first = formats[0];
58
+ expect(first.name).to.equal("f:DefaultRealU");
59
+ expect(first.precision).to.equal(2);
60
+ expect(first.unitAndLabels).to.have.length(1);
61
+ expect(first.unitAndLabels[0][0]).to.equal("u:M");
62
+ // --- Step 3: resolve alias names to full schema items via schemaContext ---
63
+ // The Formats and Units schemas are excluded from SchemaView,
64
+ // but IModelDb.schemaContext (ecschema-metadata) has the full set.
65
+ // Alias "f" -> "Formats", alias "u" -> "Units" - these are standard BIS aliases.
66
+ // Resolve the format: "f:DefaultRealU" -> "Formats.DefaultRealU"
67
+ const formatFullName = `Formats.${first.name.split(":")[1]}`;
68
+ const metaFormat = iModel.schemaContext.getSchemaItemSync(formatFullName, Format);
69
+ assert.isDefined(metaFormat, `Format '${formatFullName}' not found in ecschema-metadata`);
70
+ expect(metaFormat.precision).to.be.a("number");
71
+ // Resolve the unit: "u:M" -> "Units.M"
72
+ const unitFullName = `Units.${first.unitAndLabels[0][0].split(":")[1]}`;
73
+ const metaUnit = iModel.schemaContext.getSchemaItemSync(unitFullName, Unit);
74
+ assert.isDefined(metaUnit, `Unit '${unitFullName}' not found in ecschema-metadata`);
75
+ expect(metaUnit.fullName).to.equal("Units.M");
76
+ // Access unit details like label and unit system
77
+ const unitSystem = await metaUnit.unitSystem;
78
+ assert.isDefined(unitSystem, "unit should have a unit system");
79
+ expect(unitSystem.name).to.equal("SI");
80
+ // --- Step 4: cross-validate against the KoQ in ecschema-metadata ---
81
+ const metaKoq = iModel.schemaContext.getSchemaItemSync("LinearReferencing", "LENGTH", KindOfQuantity);
82
+ assert.isDefined(metaKoq, "KoQ not found in ecschema-metadata");
83
+ expect(metaKoq.relativeError).to.equal(rKoq.relativeError);
84
+ const metaFormats = metaKoq.presentationFormats;
85
+ expect(metaFormats.length).to.equal(formats.length);
86
+ // ecschema-metadata resolves the formats fully - cross-check the format names.
87
+ // OverrideFormat.fullName includes override syntax (e.g. "Formats.DefaultRealU(2)[Units.M]"),
88
+ // so strip the override portion before extracting the base name.
89
+ for (let i = 0; i < formats.length; i++) {
90
+ const rtItemName = formats[i].name.split(":")[1];
91
+ const metaBaseFullName = metaFormats[i].fullName.split(/[([]/)[0];
92
+ const metaItemName = metaBaseFullName.split(".").pop();
93
+ expect(rtItemName).to.equal(metaItemName, `format name mismatch at index ${i}`);
94
+ }
95
+ // The SchemaUnitProvider bridges ecschema-metadata units to the @itwin/core-quantity package.
96
+ // Use it to build a FormatterSpec for quantity formatting:
97
+ const unitsProvider = new SchemaUnitProvider(iModel.schemaContext);
98
+ const persistenceUnitProps = await unitsProvider.findUnitByName("Units.M");
99
+ expect(persistenceUnitProps.name).to.equal("Units.M");
100
+ });
101
+ /**
102
+ * Example: get a KoQ from SchemaView, then query ECDbMeta via ECSQL
103
+ * to resolve the referenced format and unit definitions.
104
+ *
105
+ * This approach avoids loading the full ecschema-metadata schema set and works
106
+ * well for targeted lookups - e.g. "I have a format name, give me its NumericSpec."
107
+ */
108
+ it("should resolve KoQ format and unit names via ECSQL", async () => {
109
+ // --- Step 1: find a KoQ via SchemaView ---
110
+ const rKoq = schemaView.findKindOfQuantity("LinearReferencing:LENGTH");
111
+ assert.isDefined(rKoq, "KoQ not found in SchemaView");
112
+ const formats = rKoq.presentationFormats;
113
+ expect(formats.length).to.be.greaterThan(0);
114
+ // --- Step 2: resolve the format name via meta.FormatDef ---
115
+ // "f:DefaultRealU" -> format name is "DefaultRealU" in the "Formats" schema
116
+ const first = formats[0];
117
+ const formatItemName = first.name.split(":")[1]; // "DefaultRealU"
118
+ // Query FormatDef to get the format's NumericSpec (= FormatProps JSON)
119
+ let formatNumericSpec;
120
+ for await (const row of iModel.createQueryReader(`SELECT f.NumericSpec, f.CompositeSpec
121
+ FROM meta.FormatDef f
122
+ JOIN meta.ECSchemaDef s USING meta.SchemaOwnsFormats
123
+ WHERE f.Name = ? AND s.Name = 'Formats'`, QueryBinder.from([formatItemName]), { rowFormat: QueryRowFormat.UseJsPropertyNames })) {
124
+ formatNumericSpec = row.toRow();
125
+ }
126
+ assert.isDefined(formatNumericSpec, `FormatDef '${formatItemName}' not found via ECSQL`);
127
+ // NumericSpec is a JSON string with the format properties (type, precision, traits, etc.)
128
+ const numericSpec = JSON.parse(formatNumericSpec.numericSpec);
129
+ expect(numericSpec.type).to.equal("Decimal");
130
+ expect(numericSpec.precision).to.be.a("number");
131
+ // The presentation format can override precision - e.g. the override "(2)" means precision 2
132
+ if (first.precision !== undefined)
133
+ expect(first.precision).to.equal(2); // our override
134
+ // --- Step 3: resolve the unit name via meta.UnitDef ---
135
+ // "u:M" -> unit name is "M" in the "Units" schema
136
+ const unitItemName = first.unitAndLabels[0][0].split(":")[1]; // "M"
137
+ let unitRow;
138
+ for await (const row of iModel.createQueryReader(`SELECT u.Name, u.DisplayLabel, us.Name AS unitSystemName
139
+ FROM meta.UnitDef u
140
+ JOIN meta.ECSchemaDef s USING meta.SchemaOwnsUnits
141
+ JOIN meta.UnitSystemDef us USING meta.UnitSystemHasUnits
142
+ WHERE u.Name = ? AND s.Name = 'Units'`, QueryBinder.from([unitItemName]), { rowFormat: QueryRowFormat.UseJsPropertyNames })) {
143
+ unitRow = row.toRow();
144
+ }
145
+ assert.isDefined(unitRow, `UnitDef '${unitItemName}' not found via ECSQL`);
146
+ expect(unitRow.name).to.equal("M");
147
+ expect(unitRow.unitSystemName).to.equal("SI");
148
+ // --- Step 4: query the format's composite units (base format units, before overrides) ---
149
+ // DefaultRealU has no composite units (it's a single-unit format), but AngleDMS does.
150
+ // Let's also check the second KoQ format which might have composite units.
151
+ const angleKoq = schemaView.findKindOfQuantity("RoadRailUnits:ANGLE");
152
+ if (angleKoq) {
153
+ const angleFormats = angleKoq.presentationFormats;
154
+ // The AngleDMS format has composite units: ARC_DEG, ARC_MINUTE, ARC_SECOND
155
+ const dmsFormat = angleFormats.find((f) => f.name.split(":")[1] === "AngleDMS");
156
+ if (dmsFormat) {
157
+ const compositeUnits = [];
158
+ for await (const row of iModel.createQueryReader(`SELECT cu.Ordinal, u.Name AS unitName, cu.Label
159
+ FROM meta.FormatCompositeUnitDef cu
160
+ JOIN meta.FormatDef f USING meta.FormatOwnsCompositeUnits
161
+ JOIN meta.ECSchemaDef s USING meta.SchemaOwnsFormats
162
+ JOIN meta.UnitDef u USING meta.CompositeUnitRefersToUnit
163
+ WHERE f.Name = 'AngleDMS' AND s.Name = 'Formats'
164
+ ORDER BY cu.Ordinal`, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {
165
+ compositeUnits.push(row.toRow());
166
+ }
167
+ expect(compositeUnits.length).to.equal(3, "AngleDMS should have 3 composite units");
168
+ expect(compositeUnits[0].unitName).to.equal("ARC_DEG");
169
+ expect(compositeUnits[1].unitName).to.equal("ARC_MINUTE");
170
+ expect(compositeUnits[2].unitName).to.equal("ARC_SECOND");
171
+ }
172
+ }
173
+ });
174
+ });
175
+ //# sourceMappingURL=SchemaViewKoQ.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewKoQ.test.js","sourceRoot":"","sources":["../../../../src/test/schema/SchemaViewKoQ.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,MAA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c,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,wCAAwC,CAAC,CAAC;gBACpF,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACvD,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBAC1D,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { IModelHost, SnapshotDb } from \"../../core-backend\";\r\nimport { Format, KindOfQuantity, SchemaUnitProvider, type SchemaView, Unit } from \"@itwin/ecschema-metadata\";\r\nimport { QueryBinder, QueryRowFormat } from \"@itwin/core-common\";\r\nimport { assert, expect } from \"chai\";\r\nimport * as path from \"path\";\r\nimport { KnownTestLocations } from \"../KnownTestLocations\";\r\nimport { TestUtils } from \"../TestUtils\";\r\n\r\n/**\r\n * Example-style tests showing how to access KindOfQuantity presentation formats\r\n * through SchemaView and resolve the alias-qualified format/unit names\r\n * into full schema items via ecschema-metadata or ECSQL.\r\n *\r\n * Uses sim-master.bim which contains schemas with rich KoQ definitions\r\n * (AecUnits, RoadRailUnits, LinearReferencing, etc.).\r\n */\r\ndescribe(\"SchemaView KindOfQuantity presentation formats\", () => {\r\n let iModel: SnapshotDb;\r\n let schemaView: SchemaView;\r\n\r\n before(async () => {\r\n if (!IModelHost.isValid)\r\n await TestUtils.startBackend();\r\n iModel = SnapshotDb.openFile(path.join(KnownTestLocations.assetsDir, \"sim-master.bim\"));\r\n schemaView = await iModel.getSchemaView();\r\n });\r\n\r\n after(() => {\r\n iModel.close();\r\n });\r\n\r\n /**\r\n * Example: get a property's KoQ from SchemaView, then resolve the\r\n * alias-qualified format and unit names to full ecschema-metadata objects via\r\n * IModelDb.schemaContext.\r\n *\r\n * SchemaView uses alias-qualified names (e.g. \"f:DefaultRealU\", \"u:M\")\r\n * because the Units and Formats schemas are excluded from the SchemaView blob.\r\n * The alias (\"f\" -> \"Formats\", \"u\" -> \"Units\") is stored in ec_Schema, so we\r\n * can resolve it using the schema context that has the full schema set.\r\n */\r\n it(\"should resolve KoQ format and unit names via ecschema-metadata\", async () => {\r\n // --- Step 1: find a property with a KoQ via SchemaView ---\r\n const rClass = schemaView.findClass(\"LinearReferencing:DistanceExpression\");\r\n assert.isDefined(rClass, \"DistanceExpression class not found\");\r\n\r\n const rProp = rClass!.getProperty(\"DistanceAlongFromStart\");\r\n assert.isDefined(rProp, \"DistanceAlongFromStart property not found\");\r\n\r\n const prop = rProp!;\r\n if (!prop.isPrimitive())\r\n throw new Error(\"expected primitive\");\r\n const rKoq = prop.kindOfQuantity;\r\n assert.isDefined(rKoq, \"property should have a KoQ\");\r\n\r\n // --- Step 2: inspect parsed presentation formats ---\r\n const formats: readonly SchemaView.PresentationFormat[] = rKoq!.presentationFormats;\r\n expect(formats.length).to.be.greaterThan(0, \"KoQ should have presentation formats\");\r\n\r\n // LinearReferencing:LENGTH has: f:DefaultRealU(2)[u:M], f:DefaultRealU(2)[u:FT]\r\n const first = formats[0];\r\n expect(first.name).to.equal(\"f:DefaultRealU\");\r\n expect(first.precision).to.equal(2);\r\n expect(first.unitAndLabels).to.have.length(1);\r\n expect(first.unitAndLabels![0][0]).to.equal(\"u:M\");\r\n\r\n // --- Step 3: resolve alias names to full schema items via schemaContext ---\r\n // The Formats and Units schemas are excluded from SchemaView,\r\n // but IModelDb.schemaContext (ecschema-metadata) has the full set.\r\n // Alias \"f\" -> \"Formats\", alias \"u\" -> \"Units\" - these are standard BIS aliases.\r\n\r\n // Resolve the format: \"f:DefaultRealU\" -> \"Formats.DefaultRealU\"\r\n const formatFullName = `Formats.${first.name.split(\":\")[1]}`;\r\n const metaFormat = iModel.schemaContext.getSchemaItemSync(formatFullName, Format);\r\n assert.isDefined(metaFormat, `Format '${formatFullName}' not found in ecschema-metadata`);\r\n expect(metaFormat!.precision).to.be.a(\"number\");\r\n\r\n // Resolve the unit: \"u:M\" -> \"Units.M\"\r\n const unitFullName = `Units.${first.unitAndLabels![0][0].split(\":\")[1]}`;\r\n const metaUnit = iModel.schemaContext.getSchemaItemSync(unitFullName, Unit);\r\n assert.isDefined(metaUnit, `Unit '${unitFullName}' not found in ecschema-metadata`);\r\n expect(metaUnit!.fullName).to.equal(\"Units.M\");\r\n\r\n // Access unit details like label and unit system\r\n const unitSystem = await metaUnit!.unitSystem;\r\n assert.isDefined(unitSystem, \"unit should have a unit system\");\r\n expect(unitSystem!.name).to.equal(\"SI\");\r\n\r\n // --- Step 4: cross-validate against the KoQ in ecschema-metadata ---\r\n const metaKoq = iModel.schemaContext.getSchemaItemSync(\"LinearReferencing\", \"LENGTH\", KindOfQuantity);\r\n assert.isDefined(metaKoq, \"KoQ not found in ecschema-metadata\");\r\n expect(metaKoq!.relativeError).to.equal(rKoq!.relativeError);\r\n\r\n const metaFormats = metaKoq!.presentationFormats;\r\n expect(metaFormats.length).to.equal(formats.length);\r\n\r\n // ecschema-metadata resolves the formats fully - cross-check the format names.\r\n // OverrideFormat.fullName includes override syntax (e.g. \"Formats.DefaultRealU(2)[Units.M]\"),\r\n // so strip the override portion before extracting the base name.\r\n for (let i = 0; i < formats.length; i++) {\r\n const rtItemName = formats[i].name.split(\":\")[1];\r\n const metaBaseFullName = metaFormats[i].fullName.split(/[([]/)[0];\r\n const metaItemName = metaBaseFullName.split(\".\").pop();\r\n expect(rtItemName).to.equal(metaItemName, `format name mismatch at index ${i}`);\r\n }\r\n\r\n // The SchemaUnitProvider bridges ecschema-metadata units to the @itwin/core-quantity package.\r\n // Use it to build a FormatterSpec for quantity formatting:\r\n const unitsProvider = new SchemaUnitProvider(iModel.schemaContext);\r\n const persistenceUnitProps = await unitsProvider.findUnitByName(\"Units.M\");\r\n expect(persistenceUnitProps.name).to.equal(\"Units.M\");\r\n });\r\n\r\n /**\r\n * Example: get a KoQ from SchemaView, then query ECDbMeta via ECSQL\r\n * to resolve the referenced format and unit definitions.\r\n *\r\n * This approach avoids loading the full ecschema-metadata schema set and works\r\n * well for targeted lookups - e.g. \"I have a format name, give me its NumericSpec.\"\r\n */\r\n it(\"should resolve KoQ format and unit names via ECSQL\", async () => {\r\n // --- Step 1: find a KoQ via SchemaView ---\r\n const rKoq = schemaView.findKindOfQuantity(\"LinearReferencing:LENGTH\");\r\n assert.isDefined(rKoq, \"KoQ not found in SchemaView\");\r\n\r\n const formats = rKoq!.presentationFormats;\r\n expect(formats.length).to.be.greaterThan(0);\r\n\r\n // --- Step 2: resolve the format name via meta.FormatDef ---\r\n // \"f:DefaultRealU\" -> format name is \"DefaultRealU\" in the \"Formats\" schema\r\n const first = formats[0];\r\n const formatItemName = first.name.split(\":\")[1]; // \"DefaultRealU\"\r\n\r\n // Query FormatDef to get the format's NumericSpec (= FormatProps JSON)\r\n let formatNumericSpec: any;\r\n for await (const row of iModel.createQueryReader(\r\n `SELECT f.NumericSpec, f.CompositeSpec\r\n FROM meta.FormatDef f\r\n JOIN meta.ECSchemaDef s USING meta.SchemaOwnsFormats\r\n WHERE f.Name = ? AND s.Name = 'Formats'`,\r\n QueryBinder.from([formatItemName]),\r\n { rowFormat: QueryRowFormat.UseJsPropertyNames },\r\n )) {\r\n formatNumericSpec = row.toRow();\r\n }\r\n assert.isDefined(formatNumericSpec, `FormatDef '${formatItemName}' not found via ECSQL`);\r\n\r\n // NumericSpec is a JSON string with the format properties (type, precision, traits, etc.)\r\n const numericSpec = JSON.parse(formatNumericSpec.numericSpec);\r\n expect(numericSpec.type).to.equal(\"Decimal\");\r\n expect(numericSpec.precision).to.be.a(\"number\");\r\n\r\n // The presentation format can override precision - e.g. the override \"(2)\" means precision 2\r\n if (first.precision !== undefined)\r\n expect(first.precision).to.equal(2); // our override\r\n\r\n // --- Step 3: resolve the unit name via meta.UnitDef ---\r\n // \"u:M\" -> unit name is \"M\" in the \"Units\" schema\r\n const unitItemName = first.unitAndLabels![0][0].split(\":\")[1]; // \"M\"\r\n\r\n let unitRow: any;\r\n for await (const row of iModel.createQueryReader(\r\n `SELECT u.Name, u.DisplayLabel, us.Name AS unitSystemName\r\n FROM meta.UnitDef u\r\n JOIN meta.ECSchemaDef s USING meta.SchemaOwnsUnits\r\n JOIN meta.UnitSystemDef us USING meta.UnitSystemHasUnits\r\n WHERE u.Name = ? AND s.Name = 'Units'`,\r\n QueryBinder.from([unitItemName]),\r\n { rowFormat: QueryRowFormat.UseJsPropertyNames },\r\n )) {\r\n unitRow = row.toRow();\r\n }\r\n assert.isDefined(unitRow, `UnitDef '${unitItemName}' not found via ECSQL`);\r\n expect(unitRow.name).to.equal(\"M\");\r\n expect(unitRow.unitSystemName).to.equal(\"SI\");\r\n\r\n // --- Step 4: query the format's composite units (base format units, before overrides) ---\r\n // DefaultRealU has no composite units (it's a single-unit format), but AngleDMS does.\r\n // Let's also check the second KoQ format which might have composite units.\r\n const angleKoq = schemaView.findKindOfQuantity(\"RoadRailUnits:ANGLE\");\r\n if (angleKoq) {\r\n const angleFormats = angleKoq.presentationFormats;\r\n // The AngleDMS format has composite units: ARC_DEG, ARC_MINUTE, ARC_SECOND\r\n const dmsFormat = angleFormats.find((f) => f.name.split(\":\")[1] === \"AngleDMS\");\r\n if (dmsFormat) {\r\n const compositeUnits: Array<{ ordinal: number; unitName: string; label: string }> = [];\r\n for await (const row of iModel.createQueryReader(\r\n `SELECT cu.Ordinal, u.Name AS unitName, cu.Label\r\n FROM meta.FormatCompositeUnitDef cu\r\n JOIN meta.FormatDef f USING meta.FormatOwnsCompositeUnits\r\n JOIN meta.ECSchemaDef s USING meta.SchemaOwnsFormats\r\n JOIN meta.UnitDef u USING meta.CompositeUnitRefersToUnit\r\n WHERE f.Name = 'AngleDMS' AND s.Name = 'Formats'\r\n ORDER BY cu.Ordinal`,\r\n undefined,\r\n { rowFormat: QueryRowFormat.UseJsPropertyNames },\r\n )) {\r\n compositeUnits.push(row.toRow());\r\n }\r\n expect(compositeUnits.length).to.equal(3, \"AngleDMS should have 3 composite units\");\r\n expect(compositeUnits[0].unitName).to.equal(\"ARC_DEG\");\r\n expect(compositeUnits[1].unitName).to.equal(\"ARC_MINUTE\");\r\n expect(compositeUnits[2].unitName).to.equal(\"ARC_SECOND\");\r\n }\r\n }\r\n });\r\n});\r\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SchemaViewLifecycle.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaViewLifecycle.test.d.ts","sourceRoot":"","sources":["../../../../src/test/schema/SchemaViewLifecycle.test.ts"],"names":[],"mappings":""}