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

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 (41) hide show
  1. package/lib/cjs/ChangesetReader.d.ts +84 -1
  2. package/lib/cjs/ChangesetReader.d.ts.map +1 -1
  3. package/lib/cjs/ChangesetReader.js +108 -12
  4. package/lib/cjs/ChangesetReader.js.map +1 -1
  5. package/lib/cjs/TxnManager.d.ts.map +1 -1
  6. package/lib/cjs/TxnManager.js +7 -0
  7. package/lib/cjs/TxnManager.js.map +1 -1
  8. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
  9. package/lib/cjs/internal/ElementLRUCache.js +23 -4
  10. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  11. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -1
  12. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +54 -9
  13. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  14. package/lib/cjs/workspace/SettingsSchemas.d.ts +15 -1
  15. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
  16. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  17. package/lib/esm/ChangesetReader.d.ts +84 -1
  18. package/lib/esm/ChangesetReader.d.ts.map +1 -1
  19. package/lib/esm/ChangesetReader.js +108 -12
  20. package/lib/esm/ChangesetReader.js.map +1 -1
  21. package/lib/esm/TxnManager.d.ts.map +1 -1
  22. package/lib/esm/TxnManager.js +7 -0
  23. package/lib/esm/TxnManager.js.map +1 -1
  24. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
  25. package/lib/esm/internal/ElementLRUCache.js +23 -4
  26. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  27. package/lib/esm/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -1
  28. package/lib/esm/internal/workspace/SettingsSchemasImpl.js +54 -9
  29. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  30. package/lib/esm/test/ElementLRUCache.test.js +60 -0
  31. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  32. package/lib/esm/test/imodel/IModel.test.js +29 -0
  33. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  34. package/lib/esm/test/standalone/ChangesetReader.test.js +945 -337
  35. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  36. package/lib/esm/test/standalone/SettingsSchemas.test.js +382 -0
  37. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  38. package/lib/esm/workspace/SettingsSchemas.d.ts +15 -1
  39. package/lib/esm/workspace/SettingsSchemas.d.ts.map +1 -1
  40. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  41. package/package.json +14 -14
@@ -43,5 +43,387 @@ describe("SettingsSchemas", () => {
43
43
  expect(schemas.settingDefs.get("testApp/list/openMode").default).equals("singleClick");
44
44
  expect(schemas.settingDefs.get("testApp/tree/blah").default).equals(true);
45
45
  });
46
+ it("resolveSchema resolves object extends chains recursively", () => {
47
+ const schemas = IModelHost.settingsSchemas;
48
+ const prefix = "resolve-schema-object";
49
+ schemas.removeGroup(prefix);
50
+ schemas.addGroup({
51
+ schemaPrefix: prefix,
52
+ description: "schema used to test object resolution",
53
+ typeDefs: {
54
+ nestedBase: {
55
+ type: "object",
56
+ required: ["nestedReq"],
57
+ properties: {
58
+ nestedReq: { type: "integer" },
59
+ nestedBaseOnly: { type: "string" },
60
+ },
61
+ },
62
+ baseThing: {
63
+ type: "object",
64
+ required: ["baseReq"],
65
+ properties: {
66
+ baseReq: { type: "string" },
67
+ overridden: { type: "string" },
68
+ baseOnly: { type: "number" },
69
+ nested: {
70
+ type: "object",
71
+ extends: `${prefix}/nestedBase`,
72
+ properties: {
73
+ nestedChildOnly: { type: "boolean" },
74
+ },
75
+ },
76
+ },
77
+ },
78
+ },
79
+ settingDefs: {
80
+ thing: {
81
+ type: "object",
82
+ extends: `${prefix}/baseThing`,
83
+ required: ["derivedReq"],
84
+ properties: {
85
+ derivedReq: { type: "boolean" },
86
+ overridden: { type: "number" },
87
+ },
88
+ },
89
+ },
90
+ });
91
+ try {
92
+ const resolved = schemas.getResolvedSettingDef(`${prefix}/thing`);
93
+ expect(resolved.type).to.equal("object");
94
+ expect(resolved).to.not.have.property("extends");
95
+ expect(resolved.required).to.have.members(["baseReq", "derivedReq"]);
96
+ expect(resolved.properties).to.include.keys("baseReq", "baseOnly", "derivedReq", "overridden", "nested");
97
+ expect(resolved.properties?.overridden.type).to.equal("number");
98
+ expect(resolved.properties?.baseOnly.type).to.equal("number");
99
+ const nested = resolved.properties?.nested;
100
+ expect(nested?.type).to.equal("object");
101
+ expect(nested).to.not.have.property("extends");
102
+ expect(nested?.required).to.have.members(["nestedReq"]);
103
+ expect(nested?.properties).to.include.keys("nestedReq", "nestedBaseOnly", "nestedChildOnly");
104
+ }
105
+ finally {
106
+ schemas.removeGroup(prefix);
107
+ }
108
+ });
109
+ it("resolveSchema includes inherited properties from object typedefs", () => {
110
+ const schemas = IModelHost.settingsSchemas;
111
+ const prefix = "resolve-schema-object-inherited-props";
112
+ schemas.removeGroup(prefix);
113
+ schemas.addGroup({
114
+ schemaPrefix: prefix,
115
+ description: "schema used to test inherited object properties",
116
+ typeDefs: {
117
+ baseThing: {
118
+ type: "object",
119
+ properties: {
120
+ inheritedName: { type: "string" },
121
+ inheritedEnabled: { type: "boolean" },
122
+ },
123
+ },
124
+ },
125
+ settingDefs: {
126
+ thing: {
127
+ type: "object",
128
+ extends: `${prefix}/baseThing`,
129
+ properties: {
130
+ localCount: { type: "integer" },
131
+ },
132
+ },
133
+ },
134
+ });
135
+ try {
136
+ const resolved = schemas.getResolvedSettingDef(`${prefix}/thing`);
137
+ expect(resolved.properties).to.include.keys("inheritedName", "inheritedEnabled", "localCount");
138
+ expect(resolved.properties?.inheritedName.type).to.equal("string");
139
+ expect(resolved.properties?.inheritedEnabled.type).to.equal("boolean");
140
+ expect(resolved.properties?.localCount.type).to.equal("integer");
141
+ }
142
+ finally {
143
+ schemas.removeGroup(prefix);
144
+ }
145
+ });
146
+ it("resolveSchema deduplicates required properties inherited from object typedefs", () => {
147
+ const schemas = IModelHost.settingsSchemas;
148
+ const prefix = "resolve-schema-object-required";
149
+ schemas.removeGroup(prefix);
150
+ schemas.addGroup({
151
+ schemaPrefix: prefix,
152
+ description: "schema used to test required property deduplication",
153
+ typeDefs: {
154
+ baseThing: {
155
+ type: "object",
156
+ required: ["sharedReq", "baseReq"],
157
+ properties: {
158
+ sharedReq: { type: "string" },
159
+ baseReq: { type: "boolean" },
160
+ derivedReq: { type: "integer" },
161
+ },
162
+ },
163
+ },
164
+ settingDefs: {
165
+ thing: {
166
+ type: "object",
167
+ extends: `${prefix}/baseThing`,
168
+ required: ["sharedReq", "derivedReq"],
169
+ properties: {
170
+ sharedReq: { type: "string" },
171
+ derivedReq: { type: "integer" },
172
+ },
173
+ },
174
+ },
175
+ });
176
+ try {
177
+ const resolved = schemas.getResolvedSettingDef(`${prefix}/thing`);
178
+ expect(resolved.required).to.have.members(["sharedReq", "baseReq", "derivedReq"]);
179
+ expect(resolved.required?.filter((name) => name === "sharedReq")).to.have.lengthOf(1);
180
+ }
181
+ finally {
182
+ schemas.removeGroup(prefix);
183
+ }
184
+ });
185
+ it("resolveSchema resolves array items through extends", () => {
186
+ const schemas = IModelHost.settingsSchemas;
187
+ const prefix = "resolve-schema-array";
188
+ schemas.removeGroup(prefix);
189
+ schemas.addGroup({
190
+ schemaPrefix: prefix,
191
+ description: "schema used to test array resolution",
192
+ typeDefs: {
193
+ stringList: {
194
+ type: "array",
195
+ combineArray: true,
196
+ minItems: 1,
197
+ description: "base array typedef",
198
+ items: { type: "string" },
199
+ },
200
+ },
201
+ settingDefs: {
202
+ names: {
203
+ type: "array",
204
+ extends: `${prefix}/stringList`,
205
+ },
206
+ },
207
+ });
208
+ try {
209
+ const resolved = schemas.getResolvedSettingDef(`${prefix}/names`);
210
+ expect(resolved.type).to.equal("array");
211
+ expect(resolved).to.not.have.property("extends");
212
+ expect(resolved.combineArray).to.equal(true);
213
+ expect(resolved.minItems).to.equal(1);
214
+ expect(resolved.description).to.equal("base array typedef");
215
+ expect(resolved.items?.type).to.equal("string");
216
+ expect(resolved.items).to.not.have.property("extends");
217
+ }
218
+ finally {
219
+ schemas.removeGroup(prefix);
220
+ }
221
+ });
222
+ it("resolveSchema lets derived array schema properties override inherited typedef properties", () => {
223
+ const schemas = IModelHost.settingsSchemas;
224
+ const prefix = "resolve-schema-array-overrides";
225
+ schemas.removeGroup(prefix);
226
+ schemas.addGroup({
227
+ schemaPrefix: prefix,
228
+ description: "schema used to test array override precedence",
229
+ typeDefs: {
230
+ stringList: {
231
+ type: "array",
232
+ combineArray: true,
233
+ minItems: 1,
234
+ description: "base array typedef",
235
+ items: { type: "string" },
236
+ },
237
+ },
238
+ settingDefs: {
239
+ names: {
240
+ type: "array",
241
+ extends: `${prefix}/stringList`,
242
+ combineArray: false,
243
+ minItems: 3,
244
+ description: "derived array schema",
245
+ },
246
+ },
247
+ });
248
+ try {
249
+ const resolved = schemas.getResolvedSettingDef(`${prefix}/names`);
250
+ expect(resolved.combineArray).to.equal(false);
251
+ expect(resolved.minItems).to.equal(3);
252
+ expect(resolved.description).to.equal("derived array schema");
253
+ expect(resolved.items?.type).to.equal("string");
254
+ }
255
+ finally {
256
+ schemas.removeGroup(prefix);
257
+ }
258
+ });
259
+ it("resolveSchema resolves array items through multi-level typedef inheritance", () => {
260
+ const schemas = IModelHost.settingsSchemas;
261
+ const prefix = "resolve-schema-array-multilevel";
262
+ schemas.removeGroup(prefix);
263
+ schemas.addGroup({
264
+ schemaPrefix: prefix,
265
+ description: "schema used to test multi-level array typedef inheritance",
266
+ typeDefs: {
267
+ c: {
268
+ type: "array",
269
+ combineArray: true,
270
+ items: { type: "string" },
271
+ },
272
+ b: {
273
+ type: "array",
274
+ extends: `${prefix}/c`,
275
+ },
276
+ },
277
+ settingDefs: {
278
+ names: {
279
+ type: "array",
280
+ extends: `${prefix}/b`,
281
+ },
282
+ },
283
+ });
284
+ try {
285
+ const resolved = schemas.getResolvedSettingDef(`${prefix}/names`);
286
+ expect(resolved.combineArray).to.equal(true);
287
+ expect(resolved.items?.type).to.equal("string");
288
+ }
289
+ finally {
290
+ schemas.removeGroup(prefix);
291
+ }
292
+ });
293
+ it("getResolvedSettingDef returns a resolved setting schema by name", () => {
294
+ const schemas = IModelHost.settingsSchemas;
295
+ const prefix = "resolve-setting-schema";
296
+ schemas.removeGroup(prefix);
297
+ schemas.addGroup({
298
+ schemaPrefix: prefix,
299
+ description: "schema used to test resolved setting schema lookup",
300
+ typeDefs: {
301
+ stringList: {
302
+ type: "array",
303
+ combineArray: true,
304
+ items: { type: "string" },
305
+ },
306
+ },
307
+ settingDefs: {
308
+ names: {
309
+ type: "array",
310
+ extends: `${prefix}/stringList`,
311
+ },
312
+ },
313
+ });
314
+ try {
315
+ const resolved = schemas.getResolvedSettingDef(`${prefix}/names`);
316
+ expect(resolved).to.not.be.undefined;
317
+ expect(resolved?.type).to.equal("array");
318
+ expect(resolved).to.not.have.property("extends");
319
+ expect(resolved?.combineArray).to.equal(true);
320
+ expect(resolved?.items?.type).to.equal("string");
321
+ expect(schemas.getResolvedSettingDef(`${prefix}/missing`)).to.be.undefined;
322
+ }
323
+ finally {
324
+ schemas.removeGroup(prefix);
325
+ }
326
+ });
327
+ it("getResolvedSettingDef resolves built-in workspace settings schemas", () => {
328
+ const schemas = IModelHost.settingsSchemas;
329
+ const resolved = schemas.getResolvedSettingDef("itwin/core/workspace/settingsWorkspaces");
330
+ expect(resolved).to.not.be.undefined;
331
+ expect(resolved?.type).to.equal("array");
332
+ expect(resolved?.items?.type).to.equal("object");
333
+ expect(resolved?.items).to.not.have.property("extends");
334
+ expect(resolved?.items?.required).to.have.members(["containerId", "baseUri"]);
335
+ expect(resolved?.items?.properties).to.include.keys("dbName", "baseUri", "containerId", "storageType", "resourceName", "priority");
336
+ expect(resolved?.items?.properties?.storageType.default).to.equal("azure");
337
+ });
338
+ it("getResolvedSettingDef throws on circular typedef references", () => {
339
+ const schemas = IModelHost.settingsSchemas;
340
+ const prefix = "resolve-schema-cycle";
341
+ schemas.removeGroup(prefix);
342
+ schemas.addGroup({
343
+ schemaPrefix: prefix,
344
+ description: "schema used to test circular typedef resolution",
345
+ typeDefs: {
346
+ a: {
347
+ type: "object",
348
+ extends: `${prefix}/b`,
349
+ properties: {
350
+ aOnly: { type: "string" },
351
+ },
352
+ },
353
+ b: {
354
+ type: "object",
355
+ extends: `${prefix}/a`,
356
+ properties: {
357
+ bOnly: { type: "string" },
358
+ },
359
+ },
360
+ },
361
+ settingDefs: {
362
+ thing: {
363
+ type: "object",
364
+ extends: `${prefix}/a`,
365
+ },
366
+ },
367
+ });
368
+ try {
369
+ expect(() => schemas.getResolvedSettingDef(`${prefix}/thing`)).to.throw("circular typeDef reference detected");
370
+ }
371
+ finally {
372
+ schemas.removeGroup(prefix);
373
+ }
374
+ });
375
+ it("getResolvedSettingDef throws on nested recursive typedef references", () => {
376
+ const schemas = IModelHost.settingsSchemas;
377
+ const prefix = "resolve-schema-nested-cycle";
378
+ schemas.removeGroup(prefix);
379
+ schemas.addGroup({
380
+ schemaPrefix: prefix,
381
+ description: "schema used to test nested recursive typedef resolution",
382
+ typeDefs: {
383
+ node: {
384
+ type: "object",
385
+ properties: {
386
+ child: {
387
+ type: "object",
388
+ extends: `${prefix}/node`,
389
+ },
390
+ },
391
+ },
392
+ },
393
+ settingDefs: {
394
+ root: {
395
+ type: "object",
396
+ extends: `${prefix}/node`,
397
+ },
398
+ },
399
+ });
400
+ try {
401
+ expect(() => schemas.getResolvedSettingDef(`${prefix}/root`)).to.throw("circular typeDef reference detected");
402
+ }
403
+ finally {
404
+ schemas.removeGroup(prefix);
405
+ }
406
+ });
407
+ it("getResolvedSettingDef throws when an extends target cannot be found", () => {
408
+ const schemas = IModelHost.settingsSchemas;
409
+ const prefix = "resolve-schema-missing-typedef";
410
+ schemas.removeGroup(prefix);
411
+ schemas.addGroup({
412
+ schemaPrefix: prefix,
413
+ description: "schema used to test missing typedef resolution",
414
+ settingDefs: {
415
+ thing: {
416
+ type: "object",
417
+ extends: `${prefix}/missingType`,
418
+ },
419
+ },
420
+ });
421
+ try {
422
+ expect(() => schemas.getResolvedSettingDef(`${prefix}/thing`)).to.throw(`typeDef ${prefix}/missingType does not exist`);
423
+ }
424
+ finally {
425
+ schemas.removeGroup(prefix);
426
+ }
427
+ });
46
428
  });
47
429
  //# sourceMappingURL=SettingsSchemas.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsSchemas.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/SettingsSchemas.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAE/B,2FAA2F;IAC3F,kIAAkI;IAClI,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;QAChC,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC5B,MAAM,SAAS,CAAC,YAAY,EAAE,CAAC;IACjC,CAAC,CAAC;IACF,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC;QAC3C,iCAAiC;QACjC,MAAM,CAAC,GAAG,EAAE,CAAC,OA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AC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAE,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AAEL,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 { expect } from \"chai\";\r\nimport { IModelTestUtils } from \"../IModelTestUtils\";\r\nimport { IModelHost } from \"../../IModelHost\";\r\nimport { TestUtils } from \"../TestUtils\";\r\n\r\ndescribe(\"SettingsSchemas\", () => {\r\n\r\n // SettingsSchema tests change the state of the IModelHost object. They should always clear\r\n // the current state before and after they run so they're not affected by, nor influence, other tests running in the same process.\r\n const restartSession = async () => {\r\n await IModelHost.shutdown();\r\n await TestUtils.startBackend();\r\n };\r\n before(async () => {\r\n await restartSession();\r\n });\r\n after(async () => {\r\n await restartSession();\r\n });\r\n\r\n it(\"add groups\", async () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n // can't add a group with no name\r\n expect(() => schemas.addGroup({} as any)).throws(`has no \"schemaPrefix\" member`);\r\n\r\n schemas.addGroup({\r\n schemaPrefix: \"title-test\",\r\n title: \"Title Test\",\r\n description: \"schema with a user-facing title\",\r\n settingDefs: {\r\n setting: {\r\n type: \"string\",\r\n },\r\n },\r\n });\r\n expect(schemas.groups.get(\"title-test\")?.title).equals(\"Title Test\");\r\n expect(schemas.groups.get(\"title-test\")?.description).equals(\"schema with a user-facing title\");\r\n expect(schemas.settingDefs.get(\"title-test/setting\")!.type).equals(\"string\");\r\n\r\n schemas.addFile(IModelTestUtils.resolveAssetFile(\"TestSettings.schema.json\"));\r\n expect(schemas.groups.get(\"testApp\")?.title).equals(\"Test App\");\r\n expect(schemas.groups.get(\"testApp\")?.description).equals(\"the settings for test application 1\");\r\n expect(schemas.settingDefs.get(\"testApp/list/openMode\")!.type).equals(\"string\");\r\n expect(schemas.settingDefs.get(\"testApp/list/openMode\")!.default).equals(\"singleClick\");\r\n expect(schemas.settingDefs.get(\"testApp/tree/blah\")!.default).equals(true);\r\n });\r\n\r\n});\r\n"]}
1
+ {"version":3,"file":"SettingsSchemas.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/SettingsSchemas.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAE/B,2FAA2F;IAC3F,kIAAkI;IAClI,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;QAChC,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC5B,MAAM,SAAS,CAAC,YAAY,EAAE,CAAC;IACjC,CAAC,CAAC;IACF,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC;QAC3C,iCAAiC;QACjC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAS,CAAC,CAAC,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC;QAEjF,OAAO,CAAC,QAAQ,CAAC;YACf,YAAY,EAAE,YAAY;YAC1B,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,iCAAiC;YAC9C,WAAW,EAAE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;YACf,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,gDAAgD;YAC7D,WAAW,EAAE;gBACX,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,GAAG,MAAM,cAAc;iBACjC;aACF;SACF,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,MAAM,6BAA6B,CAAC,CAAC;QAC1H,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AAEL,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 { expect } from \"chai\";\r\nimport { IModelTestUtils } from \"../IModelTestUtils\";\r\nimport { IModelHost } from \"../../IModelHost\";\r\nimport { TestUtils } from \"../TestUtils\";\r\n\r\ndescribe(\"SettingsSchemas\", () => {\r\n\r\n // SettingsSchema tests change the state of the IModelHost object. They should always clear\r\n // the current state before and after they run so they're not affected by, nor influence, other tests running in the same process.\r\n const restartSession = async () => {\r\n await IModelHost.shutdown();\r\n await TestUtils.startBackend();\r\n };\r\n before(async () => {\r\n await restartSession();\r\n });\r\n after(async () => {\r\n await restartSession();\r\n });\r\n\r\n it(\"add groups\", async () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n // can't add a group with no name\r\n expect(() => schemas.addGroup({} as any)).throws(`has no \"schemaPrefix\" member`);\r\n\r\n schemas.addGroup({\r\n schemaPrefix: \"title-test\",\r\n title: \"Title Test\",\r\n description: \"schema with a user-facing title\",\r\n settingDefs: {\r\n setting: {\r\n type: \"string\",\r\n },\r\n },\r\n });\r\n expect(schemas.groups.get(\"title-test\")?.title).equals(\"Title Test\");\r\n expect(schemas.groups.get(\"title-test\")?.description).equals(\"schema with a user-facing title\");\r\n expect(schemas.settingDefs.get(\"title-test/setting\")!.type).equals(\"string\");\r\n\r\n schemas.addFile(IModelTestUtils.resolveAssetFile(\"TestSettings.schema.json\"));\r\n expect(schemas.groups.get(\"testApp\")?.title).equals(\"Test App\");\r\n expect(schemas.groups.get(\"testApp\")?.description).equals(\"the settings for test application 1\");\r\n expect(schemas.settingDefs.get(\"testApp/list/openMode\")!.type).equals(\"string\");\r\n expect(schemas.settingDefs.get(\"testApp/list/openMode\")!.default).equals(\"singleClick\");\r\n expect(schemas.settingDefs.get(\"testApp/tree/blah\")!.default).equals(true);\r\n });\r\n\r\n it(\"resolveSchema resolves object extends chains recursively\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-object\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test object resolution\",\r\n typeDefs: {\r\n nestedBase: {\r\n type: \"object\",\r\n required: [\"nestedReq\"],\r\n properties: {\r\n nestedReq: { type: \"integer\" },\r\n nestedBaseOnly: { type: \"string\" },\r\n },\r\n },\r\n baseThing: {\r\n type: \"object\",\r\n required: [\"baseReq\"],\r\n properties: {\r\n baseReq: { type: \"string\" },\r\n overridden: { type: \"string\" },\r\n baseOnly: { type: \"number\" },\r\n nested: {\r\n type: \"object\",\r\n extends: `${prefix}/nestedBase`,\r\n properties: {\r\n nestedChildOnly: { type: \"boolean\" },\r\n },\r\n },\r\n },\r\n },\r\n },\r\n settingDefs: {\r\n thing: {\r\n type: \"object\",\r\n extends: `${prefix}/baseThing`,\r\n required: [\"derivedReq\"],\r\n properties: {\r\n derivedReq: { type: \"boolean\" },\r\n overridden: { type: \"number\" },\r\n },\r\n },\r\n },\r\n });\r\n\r\n try {\r\n const resolved = schemas.getResolvedSettingDef(`${prefix}/thing`)!;\r\n expect(resolved.type).to.equal(\"object\");\r\n expect(resolved).to.not.have.property(\"extends\");\r\n expect(resolved.required).to.have.members([\"baseReq\", \"derivedReq\"]);\r\n expect(resolved.properties).to.include.keys(\"baseReq\", \"baseOnly\", \"derivedReq\", \"overridden\", \"nested\");\r\n expect(resolved.properties?.overridden.type).to.equal(\"number\");\r\n expect(resolved.properties?.baseOnly.type).to.equal(\"number\");\r\n\r\n const nested = resolved.properties?.nested;\r\n expect(nested?.type).to.equal(\"object\");\r\n expect(nested).to.not.have.property(\"extends\");\r\n expect(nested?.required).to.have.members([\"nestedReq\"]);\r\n expect(nested?.properties).to.include.keys(\"nestedReq\", \"nestedBaseOnly\", \"nestedChildOnly\");\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"resolveSchema includes inherited properties from object typedefs\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-object-inherited-props\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test inherited object properties\",\r\n typeDefs: {\r\n baseThing: {\r\n type: \"object\",\r\n properties: {\r\n inheritedName: { type: \"string\" },\r\n inheritedEnabled: { type: \"boolean\" },\r\n },\r\n },\r\n },\r\n settingDefs: {\r\n thing: {\r\n type: \"object\",\r\n extends: `${prefix}/baseThing`,\r\n properties: {\r\n localCount: { type: \"integer\" },\r\n },\r\n },\r\n },\r\n });\r\n\r\n try {\r\n const resolved = schemas.getResolvedSettingDef(`${prefix}/thing`)!;\r\n expect(resolved.properties).to.include.keys(\"inheritedName\", \"inheritedEnabled\", \"localCount\");\r\n expect(resolved.properties?.inheritedName.type).to.equal(\"string\");\r\n expect(resolved.properties?.inheritedEnabled.type).to.equal(\"boolean\");\r\n expect(resolved.properties?.localCount.type).to.equal(\"integer\");\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"resolveSchema deduplicates required properties inherited from object typedefs\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-object-required\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test required property deduplication\",\r\n typeDefs: {\r\n baseThing: {\r\n type: \"object\",\r\n required: [\"sharedReq\", \"baseReq\"],\r\n properties: {\r\n sharedReq: { type: \"string\" },\r\n baseReq: { type: \"boolean\" },\r\n derivedReq: { type: \"integer\" },\r\n },\r\n },\r\n },\r\n settingDefs: {\r\n thing: {\r\n type: \"object\",\r\n extends: `${prefix}/baseThing`,\r\n required: [\"sharedReq\", \"derivedReq\"],\r\n properties: {\r\n sharedReq: { type: \"string\" },\r\n derivedReq: { type: \"integer\" },\r\n },\r\n },\r\n },\r\n });\r\n\r\n try {\r\n const resolved = schemas.getResolvedSettingDef(`${prefix}/thing`)!;\r\n expect(resolved.required).to.have.members([\"sharedReq\", \"baseReq\", \"derivedReq\"]);\r\n expect(resolved.required?.filter((name) => name === \"sharedReq\")).to.have.lengthOf(1);\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"resolveSchema resolves array items through extends\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-array\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test array resolution\",\r\n typeDefs: {\r\n stringList: {\r\n type: \"array\",\r\n combineArray: true,\r\n minItems: 1,\r\n description: \"base array typedef\",\r\n items: { type: \"string\" },\r\n },\r\n },\r\n settingDefs: {\r\n names: {\r\n type: \"array\",\r\n extends: `${prefix}/stringList`,\r\n },\r\n },\r\n });\r\n\r\n try {\r\n const resolved = schemas.getResolvedSettingDef(`${prefix}/names`)!;\r\n expect(resolved.type).to.equal(\"array\");\r\n expect(resolved).to.not.have.property(\"extends\");\r\n expect(resolved.combineArray).to.equal(true);\r\n expect(resolved.minItems).to.equal(1);\r\n expect(resolved.description).to.equal(\"base array typedef\");\r\n expect(resolved.items?.type).to.equal(\"string\");\r\n expect(resolved.items).to.not.have.property(\"extends\");\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"resolveSchema lets derived array schema properties override inherited typedef properties\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-array-overrides\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test array override precedence\",\r\n typeDefs: {\r\n stringList: {\r\n type: \"array\",\r\n combineArray: true,\r\n minItems: 1,\r\n description: \"base array typedef\",\r\n items: { type: \"string\" },\r\n },\r\n },\r\n settingDefs: {\r\n names: {\r\n type: \"array\",\r\n extends: `${prefix}/stringList`,\r\n combineArray: false,\r\n minItems: 3,\r\n description: \"derived array schema\",\r\n },\r\n },\r\n });\r\n\r\n try {\r\n const resolved = schemas.getResolvedSettingDef(`${prefix}/names`)!;\r\n expect(resolved.combineArray).to.equal(false);\r\n expect(resolved.minItems).to.equal(3);\r\n expect(resolved.description).to.equal(\"derived array schema\");\r\n expect(resolved.items?.type).to.equal(\"string\");\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"resolveSchema resolves array items through multi-level typedef inheritance\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-array-multilevel\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test multi-level array typedef inheritance\",\r\n typeDefs: {\r\n c: {\r\n type: \"array\",\r\n combineArray: true,\r\n items: { type: \"string\" },\r\n },\r\n b: {\r\n type: \"array\",\r\n extends: `${prefix}/c`,\r\n },\r\n },\r\n settingDefs: {\r\n names: {\r\n type: \"array\",\r\n extends: `${prefix}/b`,\r\n },\r\n },\r\n });\r\n\r\n try {\r\n const resolved = schemas.getResolvedSettingDef(`${prefix}/names`)!;\r\n expect(resolved.combineArray).to.equal(true);\r\n expect(resolved.items?.type).to.equal(\"string\");\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"getResolvedSettingDef returns a resolved setting schema by name\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-setting-schema\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test resolved setting schema lookup\",\r\n typeDefs: {\r\n stringList: {\r\n type: \"array\",\r\n combineArray: true,\r\n items: { type: \"string\" },\r\n },\r\n },\r\n settingDefs: {\r\n names: {\r\n type: \"array\",\r\n extends: `${prefix}/stringList`,\r\n },\r\n },\r\n });\r\n\r\n try {\r\n const resolved = schemas.getResolvedSettingDef(`${prefix}/names`);\r\n expect(resolved).to.not.be.undefined;\r\n expect(resolved?.type).to.equal(\"array\");\r\n expect(resolved).to.not.have.property(\"extends\");\r\n expect(resolved?.combineArray).to.equal(true);\r\n expect(resolved?.items?.type).to.equal(\"string\");\r\n expect(schemas.getResolvedSettingDef(`${prefix}/missing`)).to.be.undefined;\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"getResolvedSettingDef resolves built-in workspace settings schemas\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n\r\n const resolved = schemas.getResolvedSettingDef(\"itwin/core/workspace/settingsWorkspaces\");\r\n expect(resolved).to.not.be.undefined;\r\n expect(resolved?.type).to.equal(\"array\");\r\n expect(resolved?.items?.type).to.equal(\"object\");\r\n expect(resolved?.items).to.not.have.property(\"extends\");\r\n expect(resolved?.items?.required).to.have.members([\"containerId\", \"baseUri\"]);\r\n expect(resolved?.items?.properties).to.include.keys(\"dbName\", \"baseUri\", \"containerId\", \"storageType\", \"resourceName\", \"priority\");\r\n expect(resolved?.items?.properties?.storageType.default).to.equal(\"azure\");\r\n });\r\n\r\n it(\"getResolvedSettingDef throws on circular typedef references\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-cycle\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test circular typedef resolution\",\r\n typeDefs: {\r\n a: {\r\n type: \"object\",\r\n extends: `${prefix}/b`,\r\n properties: {\r\n aOnly: { type: \"string\" },\r\n },\r\n },\r\n b: {\r\n type: \"object\",\r\n extends: `${prefix}/a`,\r\n properties: {\r\n bOnly: { type: \"string\" },\r\n },\r\n },\r\n },\r\n settingDefs: {\r\n thing: {\r\n type: \"object\",\r\n extends: `${prefix}/a`,\r\n },\r\n },\r\n });\r\n\r\n try {\r\n expect(() => schemas.getResolvedSettingDef(`${prefix}/thing`)).to.throw(\"circular typeDef reference detected\");\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"getResolvedSettingDef throws on nested recursive typedef references\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-nested-cycle\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test nested recursive typedef resolution\",\r\n typeDefs: {\r\n node: {\r\n type: \"object\",\r\n properties: {\r\n child: {\r\n type: \"object\",\r\n extends: `${prefix}/node`,\r\n },\r\n },\r\n },\r\n },\r\n settingDefs: {\r\n root: {\r\n type: \"object\",\r\n extends: `${prefix}/node`,\r\n },\r\n },\r\n });\r\n\r\n try {\r\n expect(() => schemas.getResolvedSettingDef(`${prefix}/root`)).to.throw(\"circular typeDef reference detected\");\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n it(\"getResolvedSettingDef throws when an extends target cannot be found\", () => {\r\n const schemas = IModelHost.settingsSchemas;\r\n const prefix = \"resolve-schema-missing-typedef\";\r\n schemas.removeGroup(prefix);\r\n schemas.addGroup({\r\n schemaPrefix: prefix,\r\n description: \"schema used to test missing typedef resolution\",\r\n settingDefs: {\r\n thing: {\r\n type: \"object\",\r\n extends: `${prefix}/missingType`,\r\n },\r\n },\r\n });\r\n\r\n try {\r\n expect(() => schemas.getResolvedSettingDef(`${prefix}/thing`)).to.throw(`typeDef ${prefix}/missingType does not exist`);\r\n } finally {\r\n schemas.removeGroup(prefix);\r\n }\r\n });\r\n\r\n});\r\n"]}
@@ -104,7 +104,10 @@ export interface SettingsSchemas {
104
104
  readonly [_implementationProhibited]: unknown;
105
105
  /** The map of each registered [[SettingGroupSchema]], accessed by its [[SettingGroupSchema.schemaPrefix]]. */
106
106
  readonly groups: ReadonlyMap<string, SettingGroupSchema>;
107
- /** The map of each individual registered [[SettingSchema]] defining a [[Setting]], accessed by its fully-qualified name (including its [[SettingGroupSchema.schemaPrefix]]). */
107
+ /** The map of each individual registered [[SettingSchema]] defining a [[Setting]], accessed by its fully-qualified name (including its [[SettingGroupSchema.schemaPrefix]]).
108
+ * Schemas in this map may include an [[SettingSchema.extends]] property referring to a registered type definition.
109
+ * Use [[resolveSchema]] to obtain the fully expanded schema.
110
+ */
108
111
  readonly settingDefs: ReadonlyMap<SettingName, SettingSchema>;
109
112
  /** The map of each individual registered [[SettingSchema]] defining a type that can be extended by other [[SettingSchema]]s via [[SettingSchema.extends]],
110
113
  * accessed by its fully-qualified name (including its [[SettingGroupSchema.schemaPrefix]]).
@@ -134,5 +137,16 @@ export interface SettingsSchemas {
134
137
  addDirectory(dirName: LocalDirName): void;
135
138
  /** Unregisters all [[settingDefs]] and [[typeDefs]] with the specified [[SettingGroupSchema.schemaPrefix]]. */
136
139
  removeGroup(schemaPrefix: string): void;
140
+ /**
141
+ * Looks up a setting schema in [[settingDefs]] and returns its resolved form.
142
+ * Resolution uses the [[typeDefs]] currently registered with this [[SettingsSchemas]] instance.
143
+ * @returns The resolved schema for `settingName`, or `undefined` if no schema has been registered for that setting.
144
+ * @throws Error if a registered setting schema cannot be resolved because a referenced type definition is missing or circular.
145
+ * @example
146
+ * ```ts
147
+ * const resolved = IModelHost.settingsSchemas.getResolvedSettingDef("app/font");
148
+ * ```
149
+ */
150
+ getResolvedSettingDef(settingName: SettingName): SettingSchema | undefined;
137
151
  }
138
152
  //# sourceMappingURL=SettingsSchemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsSchemas.d.ts","sourceRoot":"","sources":["../../../src/workspace/SettingsSchemas.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;;;IAQI;AACJ,MAAM,WAAW,aAAc,SAAQ,QAAQ,CAAC,UAAU,CAAC;IACzD,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,CAAA;KAAE,CAAC;IAC7D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;IAoBI;AACJ,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAA;KAAE,CAAC;IACrE,mGAAmG;IACnG,QAAQ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ceRoot":"","sources":["../../../src/workspace/SettingsSchemas.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,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/** @packageDocumentation\r\n * @module Workspace\r\n */\r\n\r\nimport { BeEvent, JSONSchema, JSONSchemaTypeName } from \"@itwin/core-bentley\";\r\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\nimport { SettingName } from \"./Settings\";\r\n\r\n/** Metadata describing a single [[Setting]] as part of a [[SettingGroupSchema]].\r\n * Every setting has a [[type]], which can be one of the following:\r\n * - A primitive type like `string` or `number`;\r\n * - An object containing any number of named properties, each with their own types; or\r\n * - An array of elements, all of the same type.\r\n * This metadata is used to validate setting values against the schema, and to enable user interfaces by which\r\n * users can view and modify their settings.\r\n * @beta\r\n */\r\nexport interface SettingSchema extends Readonly<JSONSchema> {\r\n /** For arrays only, the metadata describing every element in the array. */\r\n readonly items?: SettingSchema;\r\n /** The name of the [[Setting]]'s data type. */\r\n readonly type: JSONSchemaTypeName;\r\n /** For objects and arrays only, the name of a [[SettingSchema]] that provides a base definition for this type.\r\n * The name is expected to refer to a type definition registered with [[SettingsSchema.typeDefs]].\r\n * Therefore, it must be the full name, including the [[SettingGroupSchema.schemaPrefix]].\r\n */\r\n readonly extends?: string;\r\n /** For objects only, the name and metadata of each of the object's properties. */\r\n readonly properties?: { [name: SettingName]: SettingSchema };\r\n /** For arrays only, specifies how [[SettingsDictionary.getArray]] resolves the value of the setting.\r\n * By default, like other types of settings, the setting uses the value of the setting from the highest-priority dictionary.\r\n * If `combineArray` is `true`, then the value of the setting is computed by combining the elements of every array from every dictionary,\r\n * ordered by priority and eliminating duplicate elements.\r\n * Two elements are considered duplicates of one another if [[Setting.areEqual]] returns `true`.\r\n */\r\n readonly combineArray?: boolean;\r\n}\r\n\r\n/** Metadata describing a group of related [[SettingSchema]]s. You can register setting schema groups via [[SettingsSchemas.addGroup]] and\r\n * remove them via [[SettingsSchemas.removeGroup]].\r\n *\r\n * All of the settings share the same [[schemaPrefix]], which must be unique amongst all other groups.\r\n * The prefix is a stable identifier combined with the name of each [[SettingSchema]] in the group to form the fully-qualified name used to refer\r\n * to the setting outside of the group, e.g., when accessing [[SettingsSchemas.settingDefs]] or in [[SettingSchema.extends]].\r\n * In the following example, the fully-qualified name of the setting named \"metric\" is \"format/units/metric\".\r\n *\r\n * ```json\r\n * {\r\n * \"schemaPrefix\": \"format/units\",\r\n * \"settingDefs\": {\r\n * \"metric\": { \"type\": \"boolean\" }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * A group can also define [[SettingSchema]]s that, rather than describing actual [[Setting]]s, instead describe types that can be extended by [[Setting]]s via\r\n * [[SettingSchema.extends]]. A [[SettingSchema]] can refer to type definitions defined in its own group or any other group.\r\n * @beta\r\n */\r\nexport interface SettingGroupSchema {\r\n /** Uniquely identifies this group amongst all other groups.\r\n * The prefix can use forward-slashes to define logical subgroups - for example, two related groups with the prefixes \"units/metric\" and \"units/imperial\".\r\n *\r\n * @note Schema prefixes beginning with \"itwin\" are reserved for use by iTwin.js.\r\n */\r\n readonly schemaPrefix: string;\r\n /** A title of this group suitable for displaying to a user. */\r\n readonly title?: string;\r\n /** Metadata for each [[Setting]] in this group. */\r\n readonly settingDefs?: { [name: string]: SettingSchema | undefined };\r\n /** Metadata for types that can be extended by other [[Setting]]s via [[SettingSchema.extends]]. */\r\n readonly typeDefs?: { [name: string]: SettingSchema | undefined };\r\n /** An integer used when displaying a list of schemas in a user interface, to sort schemas with a lower `order` before those with a `higher` order. */\r\n readonly order?: number;\r\n /** A description of this group suitable for displaying to a user. */\r\n readonly description: string;\r\n}\r\n\r\n/**\r\n * The registry of available [[SettingGroupSchema]]s.\r\n * The registry is used for editing Settings files and for finding default values for settings.\r\n * @beta\r\n */\r\n\r\n/** The registry of metadata describing groups of [[SettingSchema]]s available to the current session.\r\n * The schemas are used to look up the default values of [[Setting]]s, validate that their values are of the type dictated by the schema, and\r\n * query metadata like [[SettingsSchema.combineArray]] that modify their behavior.\r\n * They can also be used to drive a user interface that enables end users to edit [[Settings]].\r\n *\r\n * When [[IModelHost.startup]] is invoked at the beginning of a session, schemas delivered with the application - like those describing\r\n * [[Workspace]]s - are automatically loaded.\r\n * The application can manually register additional schemas using methods like [[addGroup]], [[addFile]], [[addDirectory]], and [[addJson]].\r\n * When [[IModelHost.shutdown]] is invoked at the end of a session, all registered schemas are unregistered.\r\n *\r\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\r\n *\r\n * @see [[IModelHost.settingsSchemas]] to access the registry for the current session.\r\n * @beta\r\n */\r\nexport interface SettingsSchemas {\r\n /** @internal */\r\n readonly [_implementationProhibited]: unknown;\r\n\r\n /** The map of each registered [[SettingGroupSchema]], accessed by its [[SettingGroupSchema.schemaPrefix]]. */\r\n readonly groups: ReadonlyMap<string, SettingGroupSchema>;\r\n\r\n /** The map of each individual registered [[SettingSchema]] defining a [[Setting]], accessed by its fully-qualified name (including its [[SettingGroupSchema.schemaPrefix]]). */\r\n readonly settingDefs: ReadonlyMap<SettingName, SettingSchema>;\r\n\r\n /** The map of each individual registered [[SettingSchema]] defining a type that can be extended by other [[SettingSchema]]s via [[SettingSchema.extends]],\r\n * accessed by its fully-qualified name (including its [[SettingGroupSchema.schemaPrefix]]).\r\n */\r\n readonly typeDefs: ReadonlyMap<SettingName, SettingSchema>;\r\n\r\n /** An event raised whenever schemas are added or removed. */\r\n readonly onSchemaChanged: BeEvent<() => void>;\r\n\r\n /**\r\n * Ensure that the setting value supplied is valid according to its [[SettingSchema]].\r\n * If no schema has been registered for the setting, no validation is performed.\r\n * @param value The value of the setting to validate against the schema.\r\n * @param settingName The fully-qualified setting name.\r\n * @returns `value` if `value` matches the schema corresponding to `settingName`, or if no such schema has been registered.\r\n * @throws Error if `value` is invalid according to the schema.\r\n */\r\n validateSetting<T>(value: T, settingName: SettingName): T;\r\n\r\n /** Register one or more [[SettingGroupSchema]]s.\r\n * If a group with the same [[SettingGroupSchema.prefix]] was previously registered, it will be replaced.\r\n * Each [[SettingSchema]] in the group will be added to [[settingDefs]] or [[typeDefs]].\r\n */\r\n addGroup(settingsGroup: SettingGroupSchema | SettingGroupSchema[]): void;\r\n\r\n /** Invokes [[addGroup]] for a [[SettingGroupSchema]] supplied as stringified json5. */\r\n addJson(settingSchema: string): void;\r\n\r\n /** Invokes [[addGroup]] for a json5 file containiner a [[SettingGroupSchema]]. */\r\n addFile(fileName: LocalFileName): void;\r\n\r\n /** Invokes [[addFile]] for every json and json5 file in the specified directory. */\r\n addDirectory(dirName: LocalDirName): void;\r\n\r\n /** Unregisters all [[settingDefs]] and [[typeDefs]] with the specified [[SettingGroupSchema.schemaPrefix]]. */\r\n removeGroup(schemaPrefix: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"SettingsSchemas.js","sourceRoot":"","sources":["../../../src/workspace/SettingsSchemas.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,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/** @packageDocumentation\r\n * @module Workspace\r\n */\r\n\r\nimport { BeEvent, JSONSchema, JSONSchemaTypeName } from \"@itwin/core-bentley\";\r\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\nimport { SettingName } from \"./Settings\";\r\n\r\n/** Metadata describing a single [[Setting]] as part of a [[SettingGroupSchema]].\r\n * Every setting has a [[type]], which can be one of the following:\r\n * - A primitive type like `string` or `number`;\r\n * - An object containing any number of named properties, each with their own types; or\r\n * - An array of elements, all of the same type.\r\n * This metadata is used to validate setting values against the schema, and to enable user interfaces by which\r\n * users can view and modify their settings.\r\n * @beta\r\n */\r\nexport interface SettingSchema extends Readonly<JSONSchema> {\r\n /** For arrays only, the metadata describing every element in the array. */\r\n readonly items?: SettingSchema;\r\n /** The name of the [[Setting]]'s data type. */\r\n readonly type: JSONSchemaTypeName;\r\n /** For objects and arrays only, the name of a [[SettingSchema]] that provides a base definition for this type.\r\n * The name is expected to refer to a type definition registered with [[SettingsSchema.typeDefs]].\r\n * Therefore, it must be the full name, including the [[SettingGroupSchema.schemaPrefix]].\r\n */\r\n readonly extends?: string;\r\n /** For objects only, the name and metadata of each of the object's properties. */\r\n readonly properties?: { [name: SettingName]: SettingSchema };\r\n /** For arrays only, specifies how [[SettingsDictionary.getArray]] resolves the value of the setting.\r\n * By default, like other types of settings, the setting uses the value of the setting from the highest-priority dictionary.\r\n * If `combineArray` is `true`, then the value of the setting is computed by combining the elements of every array from every dictionary,\r\n * ordered by priority and eliminating duplicate elements.\r\n * Two elements are considered duplicates of one another if [[Setting.areEqual]] returns `true`.\r\n */\r\n readonly combineArray?: boolean;\r\n}\r\n\r\n/** Metadata describing a group of related [[SettingSchema]]s. You can register setting schema groups via [[SettingsSchemas.addGroup]] and\r\n * remove them via [[SettingsSchemas.removeGroup]].\r\n *\r\n * All of the settings share the same [[schemaPrefix]], which must be unique amongst all other groups.\r\n * The prefix is a stable identifier combined with the name of each [[SettingSchema]] in the group to form the fully-qualified name used to refer\r\n * to the setting outside of the group, e.g., when accessing [[SettingsSchemas.settingDefs]] or in [[SettingSchema.extends]].\r\n * In the following example, the fully-qualified name of the setting named \"metric\" is \"format/units/metric\".\r\n *\r\n * ```json\r\n * {\r\n * \"schemaPrefix\": \"format/units\",\r\n * \"settingDefs\": {\r\n * \"metric\": { \"type\": \"boolean\" }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * A group can also define [[SettingSchema]]s that, rather than describing actual [[Setting]]s, instead describe types that can be extended by [[Setting]]s via\r\n * [[SettingSchema.extends]]. A [[SettingSchema]] can refer to type definitions defined in its own group or any other group.\r\n * @beta\r\n */\r\nexport interface SettingGroupSchema {\r\n /** Uniquely identifies this group amongst all other groups.\r\n * The prefix can use forward-slashes to define logical subgroups - for example, two related groups with the prefixes \"units/metric\" and \"units/imperial\".\r\n *\r\n * @note Schema prefixes beginning with \"itwin\" are reserved for use by iTwin.js.\r\n */\r\n readonly schemaPrefix: string;\r\n /** A title of this group suitable for displaying to a user. */\r\n readonly title?: string;\r\n /** Metadata for each [[Setting]] in this group. */\r\n readonly settingDefs?: { [name: string]: SettingSchema | undefined };\r\n /** Metadata for types that can be extended by other [[Setting]]s via [[SettingSchema.extends]]. */\r\n readonly typeDefs?: { [name: string]: SettingSchema | undefined };\r\n /** An integer used when displaying a list of schemas in a user interface, to sort schemas with a lower `order` before those with a `higher` order. */\r\n readonly order?: number;\r\n /** A description of this group suitable for displaying to a user. */\r\n readonly description: string;\r\n}\r\n\r\n/**\r\n * The registry of available [[SettingGroupSchema]]s.\r\n * The registry is used for editing Settings files and for finding default values for settings.\r\n * @beta\r\n */\r\n\r\n/** The registry of metadata describing groups of [[SettingSchema]]s available to the current session.\r\n * The schemas are used to look up the default values of [[Setting]]s, validate that their values are of the type dictated by the schema, and\r\n * query metadata like [[SettingsSchema.combineArray]] that modify their behavior.\r\n * They can also be used to drive a user interface that enables end users to edit [[Settings]].\r\n *\r\n * When [[IModelHost.startup]] is invoked at the beginning of a session, schemas delivered with the application - like those describing\r\n * [[Workspace]]s - are automatically loaded.\r\n * The application can manually register additional schemas using methods like [[addGroup]], [[addFile]], [[addDirectory]], and [[addJson]].\r\n * When [[IModelHost.shutdown]] is invoked at the end of a session, all registered schemas are unregistered.\r\n *\r\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\r\n *\r\n * @see [[IModelHost.settingsSchemas]] to access the registry for the current session.\r\n * @beta\r\n */\r\nexport interface SettingsSchemas {\r\n /** @internal */\r\n readonly [_implementationProhibited]: unknown;\r\n\r\n /** The map of each registered [[SettingGroupSchema]], accessed by its [[SettingGroupSchema.schemaPrefix]]. */\r\n readonly groups: ReadonlyMap<string, SettingGroupSchema>;\r\n\r\n /** The map of each individual registered [[SettingSchema]] defining a [[Setting]], accessed by its fully-qualified name (including its [[SettingGroupSchema.schemaPrefix]]).\r\n * Schemas in this map may include an [[SettingSchema.extends]] property referring to a registered type definition.\r\n * Use [[resolveSchema]] to obtain the fully expanded schema.\r\n */\r\n readonly settingDefs: ReadonlyMap<SettingName, SettingSchema>;\r\n\r\n /** The map of each individual registered [[SettingSchema]] defining a type that can be extended by other [[SettingSchema]]s via [[SettingSchema.extends]],\r\n * accessed by its fully-qualified name (including its [[SettingGroupSchema.schemaPrefix]]).\r\n */\r\n readonly typeDefs: ReadonlyMap<SettingName, SettingSchema>;\r\n\r\n /** An event raised whenever schemas are added or removed. */\r\n readonly onSchemaChanged: BeEvent<() => void>;\r\n\r\n /**\r\n * Ensure that the setting value supplied is valid according to its [[SettingSchema]].\r\n * If no schema has been registered for the setting, no validation is performed.\r\n * @param value The value of the setting to validate against the schema.\r\n * @param settingName The fully-qualified setting name.\r\n * @returns `value` if `value` matches the schema corresponding to `settingName`, or if no such schema has been registered.\r\n * @throws Error if `value` is invalid according to the schema.\r\n */\r\n validateSetting<T>(value: T, settingName: SettingName): T;\r\n\r\n /** Register one or more [[SettingGroupSchema]]s.\r\n * If a group with the same [[SettingGroupSchema.prefix]] was previously registered, it will be replaced.\r\n * Each [[SettingSchema]] in the group will be added to [[settingDefs]] or [[typeDefs]].\r\n */\r\n addGroup(settingsGroup: SettingGroupSchema | SettingGroupSchema[]): void;\r\n\r\n /** Invokes [[addGroup]] for a [[SettingGroupSchema]] supplied as stringified json5. */\r\n addJson(settingSchema: string): void;\r\n\r\n /** Invokes [[addGroup]] for a json5 file containiner a [[SettingGroupSchema]]. */\r\n addFile(fileName: LocalFileName): void;\r\n\r\n /** Invokes [[addFile]] for every json and json5 file in the specified directory. */\r\n addDirectory(dirName: LocalDirName): void;\r\n\r\n /** Unregisters all [[settingDefs]] and [[typeDefs]] with the specified [[SettingGroupSchema.schemaPrefix]]. */\r\n removeGroup(schemaPrefix: string): void;\r\n\r\n /**\r\n * Looks up a setting schema in [[settingDefs]] and returns its resolved form.\r\n * Resolution uses the [[typeDefs]] currently registered with this [[SettingsSchemas]] instance.\r\n * @returns The resolved schema for `settingName`, or `undefined` if no schema has been registered for that setting.\r\n * @throws Error if a registered setting schema cannot be resolved because a referenced type definition is missing or circular.\r\n * @example\r\n * ```ts\r\n * const resolved = IModelHost.settingsSchemas.getResolvedSettingDef(\"app/font\");\r\n * ```\r\n */\r\n getResolvedSettingDef(settingName: SettingName): SettingSchema | undefined;\r\n\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-backend",
3
- "version": "5.10.0-dev.16",
3
+ "version": "5.10.0-dev.19",
4
4
  "description": "iTwin.js backend components",
5
5
  "main": "lib/cjs/core-backend.js",
6
6
  "module": "lib/esm/core-backend.js",
@@ -27,10 +27,10 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@opentelemetry/api": "^1.0.4",
30
- "@itwin/core-bentley": "5.10.0-dev.16",
31
- "@itwin/core-common": "5.10.0-dev.16",
32
- "@itwin/core-geometry": "5.10.0-dev.16",
33
- "@itwin/ecschema-metadata": "5.10.0-dev.16"
30
+ "@itwin/core-bentley": "5.10.0-dev.19",
31
+ "@itwin/core-geometry": "5.10.0-dev.19",
32
+ "@itwin/core-common": "5.10.0-dev.19",
33
+ "@itwin/ecschema-metadata": "5.10.0-dev.19"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@opentelemetry/api": {
@@ -77,17 +77,17 @@
77
77
  "marked": "^14.1.3",
78
78
  "sql-formatter": "^15.4.6",
79
79
  "webpack": "^5.97.1",
80
- "@itwin/ecschema-locaters": "5.10.0-dev.16",
81
- "@itwin/core-common": "5.10.0-dev.16",
82
- "@itwin/ecsql-common": "5.10.0-dev.16",
83
- "@itwin/core-bentley": "5.10.0-dev.16",
84
- "@itwin/build-tools": "5.10.0-dev.16",
85
- "@itwin/ecschema-metadata": "5.10.0-dev.16",
86
- "@itwin/core-geometry": "5.10.0-dev.16",
87
- "internal-tools": "3.0.0-dev.69"
80
+ "@itwin/build-tools": "5.10.0-dev.19",
81
+ "@itwin/core-bentley": "5.10.0-dev.19",
82
+ "@itwin/core-geometry": "5.10.0-dev.19",
83
+ "@itwin/ecschema-locaters": "5.10.0-dev.19",
84
+ "@itwin/core-common": "5.10.0-dev.19",
85
+ "@itwin/ecschema-metadata": "5.10.0-dev.19",
86
+ "internal-tools": "3.0.0-dev.69",
87
+ "@itwin/ecsql-common": "5.10.0-dev.19"
88
88
  },
89
89
  "dependencies": {
90
- "@bentley/imodeljs-native": "5.10.22",
90
+ "@bentley/imodeljs-native": "5.10.27",
91
91
  "@itwin/object-storage-azure": "^3.0.4",
92
92
  "@azure/storage-blob": "^12.28.0",
93
93
  "form-data": "^4.0.4",