@itwin/core-backend 5.5.0-dev.1 → 5.5.0-dev.11

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 (64) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  3. package/lib/cjs/ChangesetECAdaptor.js +0 -2
  4. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  5. package/lib/cjs/IModelDb.d.ts +15 -1
  6. package/lib/cjs/IModelDb.d.ts.map +1 -1
  7. package/lib/cjs/IModelDb.js +17 -15
  8. package/lib/cjs/IModelDb.js.map +1 -1
  9. package/lib/cjs/TxnManager.d.ts +2 -1
  10. package/lib/cjs/TxnManager.d.ts.map +1 -1
  11. package/lib/cjs/TxnManager.js +7 -2
  12. package/lib/cjs/TxnManager.js.map +1 -1
  13. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  14. package/lib/esm/ChangesetECAdaptor.js +0 -2
  15. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  16. package/lib/esm/IModelDb.d.ts +15 -1
  17. package/lib/esm/IModelDb.d.ts.map +1 -1
  18. package/lib/esm/IModelDb.js +17 -15
  19. package/lib/esm/IModelDb.js.map +1 -1
  20. package/lib/esm/TxnManager.d.ts +2 -1
  21. package/lib/esm/TxnManager.d.ts.map +1 -1
  22. package/lib/esm/TxnManager.js +7 -2
  23. package/lib/esm/TxnManager.js.map +1 -1
  24. package/lib/esm/test/annotations/Fields.test.js +2 -2
  25. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  26. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +5 -5
  27. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  28. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +43 -0
  29. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  30. package/lib/esm/test/hubaccess/Rebase.test.js +43 -0
  31. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  32. package/lib/esm/test/imodel/IModel.test.js +31 -2
  33. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  34. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +432 -198
  35. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  36. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +272 -190
  37. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  38. package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts +27 -0
  39. package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts.map +1 -0
  40. package/lib/esm/test/incrementalSchemaLocater/TestContext.js +136 -0
  41. package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -0
  42. package/lib/esm/test/standalone/ChangesetReader.test.js +222 -3
  43. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  44. package/lib/esm/test/standalone/RenderTimeline.test.js +1 -1
  45. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  46. package/lib/esm/test/standalone/StandaloneDb.test.d.ts +2 -0
  47. package/lib/esm/test/standalone/StandaloneDb.test.d.ts.map +1 -0
  48. package/lib/esm/test/standalone/StandaloneDb.test.js +103 -0
  49. package/lib/esm/test/standalone/StandaloneDb.test.js.map +1 -0
  50. package/lib/esm/test/standalone/TxnManager.test.js +43 -0
  51. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  52. package/package.json +13 -13
  53. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +0 -11
  54. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +0 -1
  55. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +0 -36
  56. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +0 -1
  57. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +0 -20
  58. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +0 -1
  59. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +0 -126
  60. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +0 -1
  61. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +0 -24
  62. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +0 -1
  63. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +0 -67
  64. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +0 -1
@@ -1,8 +1,60 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
1
53
  import { Schema, SchemaItemType, SchemaKey } from "@itwin/ecschema-metadata";
2
- import { IncrementalTestHelper } from "./utils/IncrementalTestHelper";
3
54
  import { expect, use } from "chai";
55
+ import { TestContext } from "./TestContext";
56
+ import { IModelIncrementalSchemaLocater } from "../../IModelIncrementalSchemaLocater";
4
57
  import * as deepEqualInAnyOrder from "deep-equal-in-any-order";
5
- import { TestSqlSchemaLocater } from "./utils/TestSqlSchemaLocater";
6
58
  use(deepEqualInAnyOrder);
7
59
  function findItem(name, rowData) {
8
60
  const item = rowData.find((i) => i.name === name);
@@ -20,8 +72,12 @@ function isECClass(item) {
20
72
  function isRelationshipClass(item) {
21
73
  return "source" in item && "target" in item;
22
74
  }
75
+ /**
76
+ * A test locater that exposes the protected methods of IModelIncrementalSchemaLocater for granular testing.
77
+ */
78
+ class TestSchemaLocater extends IModelIncrementalSchemaLocater {
79
+ }
23
80
  describe("ECSql query tests", function () {
24
- let schemaLocater;
25
81
  function validateItem(name, itemPropObjects, schema) {
26
82
  const actualJson = findItem(name, itemPropObjects);
27
83
  const expectedItem = schema.getItemSync(name);
@@ -104,239 +160,417 @@ describe("ECSql query tests", function () {
104
160
  }
105
161
  expect(actualJson).to.deep.equalInAnyOrder(expectedJson);
106
162
  }
107
- this.beforeEach(async () => {
108
- await IncrementalTestHelper.setup();
109
- schemaLocater = new TestSqlSchemaLocater(IncrementalTestHelper.iModel);
110
- });
111
- afterEach(async () => {
112
- await IncrementalTestHelper.close();
113
- });
163
+ async function createTestContext() {
164
+ const testEnv = await TestContext.create();
165
+ return testEnv;
166
+ }
114
167
  it("Schema query, props parsed successfully", async function () {
115
- const testKey = new SchemaKey("SchemaTest", 1, 0, 0);
116
- await IncrementalTestHelper.importSchema(testKey);
117
- const expectedSchema = await IncrementalTestHelper.context.getSchema(testKey);
118
- if (!expectedSchema)
119
- throw new Error(`Could not find schema ${testKey.name}`);
120
- const actualSchemaProps = await schemaLocater.getSchemaJson(testKey, IncrementalTestHelper.context);
121
- const actualSchema = await Schema.fromJson(actualSchemaProps, IncrementalTestHelper.context);
122
- expect(actualSchema.toJSON()).to.deep.equal(expectedSchema?.toJSON());
168
+ const env_1 = { stack: [], error: void 0, hasError: false };
169
+ try {
170
+ const testSchemaKey = new SchemaKey("SchemaTest", 1, 0, 0);
171
+ const env = __addDisposableResource(env_1, await createTestContext(), true);
172
+ const expectedSchema = await env.importAssetSchema(testSchemaKey);
173
+ const actualSchemaProps = await env.schemaLocater.getSchemaJson(testSchemaKey, env.schemaContext);
174
+ expect(actualSchemaProps).to.not.be.undefined;
175
+ const actualSchema = await Schema.fromJson(actualSchemaProps, env.schemaContext);
176
+ expect(actualSchema.toJSON()).to.deep.equal(expectedSchema?.toJSON());
177
+ }
178
+ catch (e_1) {
179
+ env_1.error = e_1;
180
+ env_1.hasError = true;
181
+ }
182
+ finally {
183
+ const result_1 = __disposeResources(env_1);
184
+ if (result_1)
185
+ await result_1;
186
+ }
123
187
  });
124
188
  it("Property query, props parsed successfully", async function () {
125
- const testKey = new SchemaKey("PropertyTest", 1, 0, 0);
126
- await IncrementalTestHelper.importSchema(testKey);
127
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
128
- if (!schema)
129
- throw new Error(`Could not find schema ${testKey.name}`);
130
- const classPropsObjects = await schemaLocater.getEntities(testKey.name, IncrementalTestHelper.context);
131
- const entityOneProps = findItem("EntityOne", classPropsObjects);
132
- const entityTwoProps = findItem("EntityTwo", classPropsObjects);
133
- const expectedEntityOne = await schema.getEntityClass("EntityOne");
134
- const expectedEntityTwo = await schema.getEntityClass("EntityTwo");
135
- const validateProperty = (propertyName, actualItem = entityOneProps, expectedItem = expectedEntityOne) => {
136
- const actualProperty = findProperty(propertyName, actualItem.properties);
137
- const expectedProperty = expectedItem?.getPropertySync(propertyName);
138
- // if maxOccurs is the maximum int value in the context Schema,
139
- // the property from the DB will not have a value
140
- if (expectedProperty.maxOccurs === 2147483647) {
141
- expect(actualProperty.maxOccurs).to.be.undefined;
142
- // set so comparison will pass
143
- actualProperty.maxOccurs = 2147483647;
189
+ const env_2 = { stack: [], error: void 0, hasError: false };
190
+ try {
191
+ const testKey = new SchemaKey("PropertyTest", 1, 0, 0);
192
+ const env = __addDisposableResource(env_2, await createTestContext(), true);
193
+ const schema = await env.importAssetSchema(testKey);
194
+ const classPropsObjects = await env.schemaLocater.getEntities(testKey.name, env.schemaContext);
195
+ const entityOneProps = findItem("EntityOne", classPropsObjects);
196
+ const entityTwoProps = findItem("EntityTwo", classPropsObjects);
197
+ const expectedEntityOne = await schema.getEntityClass("EntityOne");
198
+ const expectedEntityTwo = await schema.getEntityClass("EntityTwo");
199
+ const validateProperty = (propertyName, actualItem = entityOneProps, expectedItem = expectedEntityOne) => {
200
+ const actualProperty = findProperty(propertyName, actualItem.properties);
201
+ const expectedProperty = expectedItem?.getPropertySync(propertyName);
202
+ // if maxOccurs is the maximum int value in the context Schema,
203
+ // the property from the DB will not have a value
204
+ if (expectedProperty.maxOccurs === 2147483647) {
205
+ expect(actualProperty.maxOccurs).to.be.undefined;
206
+ // set so comparison will pass
207
+ actualProperty.maxOccurs = 2147483647;
208
+ }
209
+ expect(actualProperty).to.deep.equal(expectedProperty?.toJSON());
210
+ };
211
+ // All but one testable property is in EntityOne
212
+ for (const property of await expectedEntityOne.getProperties(true)) {
213
+ validateProperty(property.name);
144
214
  }
145
- expect(actualProperty).to.deep.equal(expectedProperty?.toJSON());
146
- };
147
- // All but one testable property is in EntityOne
148
- for (const property of await expectedEntityOne.getProperties(true)) {
149
- validateProperty(property.name);
150
- }
151
- // Backward direction Navigation property is in EntityTwo
152
- validateProperty("EntityTwoParent", entityTwoProps, expectedEntityTwo);
215
+ // Backward direction Navigation property is in EntityTwo
216
+ validateProperty("EntityTwoParent", entityTwoProps, expectedEntityTwo);
217
+ }
218
+ catch (e_2) {
219
+ env_2.error = e_2;
220
+ env_2.hasError = true;
221
+ }
222
+ finally {
223
+ const result_2 = __disposeResources(env_2);
224
+ if (result_2)
225
+ await result_2;
226
+ }
153
227
  });
154
228
  it("Entity query, props parsed successfully", async function () {
155
- const testKey = new SchemaKey("EntityTest", 1, 0, 0);
156
- await IncrementalTestHelper.importSchema(testKey);
157
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
158
- if (!schema)
159
- throw new Error(`Could not find schema ${testKey.name}`);
160
- const classPropsObjects = await schemaLocater.getEntities(testKey.name, IncrementalTestHelper.context);
161
- expect(classPropsObjects.length).to.be.greaterThan(0);
162
- validateItem("EntityModifierNone", classPropsObjects, schema);
163
- validateItem("EntityModifierAbstract", classPropsObjects, schema);
164
- validateItem("EntityModifierSealed", classPropsObjects, schema);
229
+ const env_3 = { stack: [], error: void 0, hasError: false };
230
+ try {
231
+ const testKey = new SchemaKey("EntityTest", 1, 0, 0);
232
+ const env = __addDisposableResource(env_3, await createTestContext(), true);
233
+ const schema = await env.importAssetSchema(testKey);
234
+ const classPropsObjects = await env.schemaLocater.getEntities(testKey.name, env.schemaContext);
235
+ expect(classPropsObjects.length).to.be.greaterThan(0);
236
+ validateItem("EntityModifierNone", classPropsObjects, schema);
237
+ validateItem("EntityModifierAbstract", classPropsObjects, schema);
238
+ validateItem("EntityModifierSealed", classPropsObjects, schema);
239
+ }
240
+ catch (e_3) {
241
+ env_3.error = e_3;
242
+ env_3.hasError = true;
243
+ }
244
+ finally {
245
+ const result_3 = __disposeResources(env_3);
246
+ if (result_3)
247
+ await result_3;
248
+ }
165
249
  });
166
250
  it("Struct query, props parsed successfully", async function () {
167
- const testKey = new SchemaKey("StructTest", 1, 0, 0);
168
- await IncrementalTestHelper.importSchema(testKey);
169
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
170
- if (!schema)
171
- throw new Error(`Could not find schema ${testKey.name}`);
172
- const classPropsObjects = await schemaLocater.getStructs(testKey.name, IncrementalTestHelper.context);
173
- expect(classPropsObjects.length).to.be.greaterThan(0);
174
- validateItem("StructModifierNone", classPropsObjects, schema);
175
- validateItem("StructModifierAbstract", classPropsObjects, schema);
176
- validateItem("StructModifierSealed", classPropsObjects, schema);
251
+ const env_4 = { stack: [], error: void 0, hasError: false };
252
+ try {
253
+ const testKey = new SchemaKey("StructTest", 1, 0, 0);
254
+ const env = __addDisposableResource(env_4, await createTestContext(), true);
255
+ const schema = await env.importAssetSchema(testKey);
256
+ const classPropsObjects = await env.schemaLocater.getStructs(testKey.name, env.schemaContext);
257
+ expect(classPropsObjects.length).to.be.greaterThan(0);
258
+ validateItem("StructModifierNone", classPropsObjects, schema);
259
+ validateItem("StructModifierAbstract", classPropsObjects, schema);
260
+ validateItem("StructModifierSealed", classPropsObjects, schema);
261
+ }
262
+ catch (e_4) {
263
+ env_4.error = e_4;
264
+ env_4.hasError = true;
265
+ }
266
+ finally {
267
+ const result_4 = __disposeResources(env_4);
268
+ if (result_4)
269
+ await result_4;
270
+ }
177
271
  });
178
272
  it("Mixin query, props parsed successfully", async function () {
179
- const testKey = new SchemaKey("MixinTest", 1, 0, 0);
180
- await IncrementalTestHelper.importSchema(testKey);
181
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
182
- if (!schema)
183
- throw new Error(`Could not find schema ${testKey.name}`);
184
- const classPropsObjects = await schemaLocater.getMixins(testKey.name, IncrementalTestHelper.context);
185
- expect(classPropsObjects.length).to.be.greaterThan(0);
186
- validateItem("IBaseMixin", classPropsObjects, schema);
187
- validateItem("ITestMixin", classPropsObjects, schema);
273
+ const env_5 = { stack: [], error: void 0, hasError: false };
274
+ try {
275
+ const testKey = new SchemaKey("MixinTest", 1, 0, 0);
276
+ const env = __addDisposableResource(env_5, await createTestContext(), true);
277
+ const schema = await env.importAssetSchema(testKey);
278
+ const classPropsObjects = await env.schemaLocater.getMixins(testKey.name, env.schemaContext);
279
+ expect(classPropsObjects.length).to.be.greaterThan(0);
280
+ validateItem("IBaseMixin", classPropsObjects, schema);
281
+ validateItem("ITestMixin", classPropsObjects, schema);
282
+ }
283
+ catch (e_5) {
284
+ env_5.error = e_5;
285
+ env_5.hasError = true;
286
+ }
287
+ finally {
288
+ const result_5 = __disposeResources(env_5);
289
+ if (result_5)
290
+ await result_5;
291
+ }
188
292
  });
189
293
  it("Relationship query, props parsed successfully", async function () {
190
- const testKey = new SchemaKey("RelationshipTest", 1, 0, 0);
191
- await IncrementalTestHelper.importSchema(testKey);
192
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
193
- if (!schema)
194
- throw new Error(`Could not find schema ${testKey.name}`);
195
- const classPropsObjects = await schemaLocater.getRelationships(testKey.name, IncrementalTestHelper.context);
196
- expect(classPropsObjects.length).to.be.greaterThan(0);
197
- validateItem("OwnerOwnsVehicles", classPropsObjects, schema);
198
- validateItem("OwnerOwnsCars", classPropsObjects, schema);
199
- validateItem("OwnerOwnsAmericanCars", classPropsObjects, schema);
200
- validateItem("PhysicalModelBreaksDownCarElement", classPropsObjects, schema);
294
+ const env_6 = { stack: [], error: void 0, hasError: false };
295
+ try {
296
+ const testKey = new SchemaKey("RelationshipTest", 1, 0, 0);
297
+ const env = __addDisposableResource(env_6, await createTestContext(), true);
298
+ const schema = await env.importAssetSchema(testKey);
299
+ const classPropsObjects = await env.schemaLocater.getRelationships(testKey.name, env.schemaContext);
300
+ expect(classPropsObjects.length).to.be.greaterThan(0);
301
+ validateItem("OwnerOwnsVehicles", classPropsObjects, schema);
302
+ validateItem("OwnerOwnsCars", classPropsObjects, schema);
303
+ validateItem("OwnerOwnsAmericanCars", classPropsObjects, schema);
304
+ validateItem("PhysicalModelBreaksDownCarElement", classPropsObjects, schema);
305
+ }
306
+ catch (e_6) {
307
+ env_6.error = e_6;
308
+ env_6.hasError = true;
309
+ }
310
+ finally {
311
+ const result_6 = __disposeResources(env_6);
312
+ if (result_6)
313
+ await result_6;
314
+ }
201
315
  });
202
316
  it("CustomAttributeClass query, props parsed successfully", async function () {
203
- const testKey = new SchemaKey("CustomAttributeClassTest", 1, 0, 0);
204
- await IncrementalTestHelper.importSchema(testKey);
205
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
206
- if (!schema)
207
- throw new Error(`Could not find schema ${testKey.name}`);
208
- const classPropsObjects = await schemaLocater.getCustomAttributeClasses(testKey.name, IncrementalTestHelper.context);
209
- expect(classPropsObjects.length).to.be.greaterThan(0);
210
- validateItem("CustomAttributeModifierNone", classPropsObjects, schema);
211
- validateItem("CustomAttributeModifierSealed", classPropsObjects, schema);
212
- validateItem("CustomAttributeModifierAbstract", classPropsObjects, schema);
317
+ const env_7 = { stack: [], error: void 0, hasError: false };
318
+ try {
319
+ const testKey = new SchemaKey("CustomAttributeClassTest", 1, 0, 0);
320
+ const env = __addDisposableResource(env_7, await createTestContext(), true);
321
+ const schema = await env.importAssetSchema(testKey);
322
+ const classPropsObjects = await env.schemaLocater.getCustomAttributeClasses(testKey.name, env.schemaContext);
323
+ expect(classPropsObjects.length).to.be.greaterThan(0);
324
+ validateItem("CustomAttributeModifierNone", classPropsObjects, schema);
325
+ validateItem("CustomAttributeModifierSealed", classPropsObjects, schema);
326
+ validateItem("CustomAttributeModifierAbstract", classPropsObjects, schema);
327
+ }
328
+ catch (e_7) {
329
+ env_7.error = e_7;
330
+ env_7.hasError = true;
331
+ }
332
+ finally {
333
+ const result_7 = __disposeResources(env_7);
334
+ if (result_7)
335
+ await result_7;
336
+ }
213
337
  });
214
338
  it("KindOfQuantity query, props parsed successfully", async function () {
215
- const testKey = new SchemaKey("KindOfQuantityTest", 1, 0, 0);
216
- await IncrementalTestHelper.importSchema(testKey);
217
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
218
- if (!schema)
219
- throw new Error(`Could not find schema ${testKey.name}`);
220
- const itemPropsObjects = await schemaLocater.getKindOfQuantities(testKey.name, IncrementalTestHelper.context);
221
- expect(itemPropsObjects.length).to.be.greaterThan(0);
222
- validateItem("ACCELERATION", itemPropsObjects, schema);
223
- validateItem("ANGLE", itemPropsObjects, schema);
339
+ const env_8 = { stack: [], error: void 0, hasError: false };
340
+ try {
341
+ const testKey = new SchemaKey("KindOfQuantityTest", 1, 0, 0);
342
+ const env = __addDisposableResource(env_8, await createTestContext(), true);
343
+ const schema = await env.importAssetSchema(testKey);
344
+ const itemPropsObjects = await env.schemaLocater.getKindOfQuantities(testKey.name, env.schemaContext);
345
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
346
+ validateItem("ACCELERATION", itemPropsObjects, schema);
347
+ validateItem("ANGLE", itemPropsObjects, schema);
348
+ }
349
+ catch (e_8) {
350
+ env_8.error = e_8;
351
+ env_8.hasError = true;
352
+ }
353
+ finally {
354
+ const result_8 = __disposeResources(env_8);
355
+ if (result_8)
356
+ await result_8;
357
+ }
224
358
  });
225
359
  it("PropertyCategory query, props parsed successfully", async function () {
226
- const testKey = new SchemaKey("PropertyCategoryTest", 1, 0, 0);
227
- await IncrementalTestHelper.importSchema(testKey);
228
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
229
- if (!schema)
230
- throw new Error(`Could not find schema ${testKey.name}`);
231
- const itemPropsObjects = await schemaLocater.getPropertyCategories(testKey.name, IncrementalTestHelper.context);
232
- expect(itemPropsObjects.length).to.be.greaterThan(0);
233
- validateItem("PropertyCategory1", itemPropsObjects, schema);
234
- validateItem("PropertyCategory2", itemPropsObjects, schema);
360
+ const env_9 = { stack: [], error: void 0, hasError: false };
361
+ try {
362
+ const testKey = new SchemaKey("PropertyCategoryTest", 1, 0, 0);
363
+ const env = __addDisposableResource(env_9, await createTestContext(), true);
364
+ const schema = await env.importAssetSchema(testKey);
365
+ const itemPropsObjects = await env.schemaLocater.getPropertyCategories(testKey.name, env.schemaContext);
366
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
367
+ validateItem("PropertyCategory1", itemPropsObjects, schema);
368
+ validateItem("PropertyCategory2", itemPropsObjects, schema);
369
+ }
370
+ catch (e_9) {
371
+ env_9.error = e_9;
372
+ env_9.hasError = true;
373
+ }
374
+ finally {
375
+ const result_9 = __disposeResources(env_9);
376
+ if (result_9)
377
+ await result_9;
378
+ }
235
379
  });
236
380
  it("Enumeration query, props parsed successfully", async function () {
237
- const testKey = new SchemaKey("EnumerationTest", 1, 0, 0);
238
- await IncrementalTestHelper.importSchema(testKey);
239
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
240
- if (!schema)
241
- throw new Error(`Could not find schema ${testKey.name}`);
242
- const itemPropsObjects = await schemaLocater.getEnumerations(testKey.name, IncrementalTestHelper.context);
243
- expect(itemPropsObjects.length).to.be.greaterThan(0);
244
- validateItem("IntEnumeration", itemPropsObjects, schema);
245
- validateItem("StringEnumeration", itemPropsObjects, schema);
381
+ const env_10 = { stack: [], error: void 0, hasError: false };
382
+ try {
383
+ const testKey = new SchemaKey("EnumerationTest", 1, 0, 0);
384
+ const env = __addDisposableResource(env_10, await createTestContext(), true);
385
+ const schema = await env.importAssetSchema(testKey);
386
+ const itemPropsObjects = await env.schemaLocater.getEnumerations(testKey.name, env.schemaContext);
387
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
388
+ validateItem("IntEnumeration", itemPropsObjects, schema);
389
+ validateItem("StringEnumeration", itemPropsObjects, schema);
390
+ }
391
+ catch (e_10) {
392
+ env_10.error = e_10;
393
+ env_10.hasError = true;
394
+ }
395
+ finally {
396
+ const result_10 = __disposeResources(env_10);
397
+ if (result_10)
398
+ await result_10;
399
+ }
246
400
  });
247
401
  it("Unit query, props parsed successfully", async function () {
248
- const testKey = new SchemaKey("UnitTest", 1, 0, 0);
249
- await IncrementalTestHelper.importSchema(testKey);
250
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
251
- if (!schema)
252
- throw new Error(`Could not find schema ${testKey.name}`);
253
- const itemPropsObjects = await schemaLocater.getUnits(testKey.name, IncrementalTestHelper.context);
254
- expect(itemPropsObjects.length).to.be.greaterThan(0);
255
- validateItem("LITRE", itemPropsObjects, schema);
256
- validateItem("GALLON", itemPropsObjects, schema);
257
- validateItem("ACRE", itemPropsObjects, schema);
258
- validateItem("FAHRENHEIT", itemPropsObjects, schema);
402
+ const env_11 = { stack: [], error: void 0, hasError: false };
403
+ try {
404
+ const testKey = new SchemaKey("UnitTest", 1, 0, 0);
405
+ const env = __addDisposableResource(env_11, await createTestContext(), true);
406
+ const schema = await env.importAssetSchema(testKey);
407
+ const itemPropsObjects = await env.schemaLocater.getUnits(testKey.name, env.schemaContext);
408
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
409
+ validateItem("LITRE", itemPropsObjects, schema);
410
+ validateItem("GALLON", itemPropsObjects, schema);
411
+ validateItem("ACRE", itemPropsObjects, schema);
412
+ validateItem("FAHRENHEIT", itemPropsObjects, schema);
413
+ }
414
+ catch (e_11) {
415
+ env_11.error = e_11;
416
+ env_11.hasError = true;
417
+ }
418
+ finally {
419
+ const result_11 = __disposeResources(env_11);
420
+ if (result_11)
421
+ await result_11;
422
+ }
259
423
  });
260
424
  it("InvertedUnit query, props parsed successfully", async function () {
261
- const testKey = new SchemaKey("InvertedUnitTest", 1, 0, 0);
262
- await IncrementalTestHelper.importSchema(testKey);
263
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
264
- if (!schema)
265
- throw new Error(`Could not find schema ${testKey.name}`);
266
- const itemPropsObjects = await schemaLocater.getInvertedUnits(testKey.name, IncrementalTestHelper.context);
267
- expect(itemPropsObjects.length).to.be.greaterThan(0);
268
- validateItem("FT_HORIZONTAL_PER_FT_VERTICAL", itemPropsObjects, schema);
425
+ const env_12 = { stack: [], error: void 0, hasError: false };
426
+ try {
427
+ const testKey = new SchemaKey("InvertedUnitTest", 1, 0, 0);
428
+ const env = __addDisposableResource(env_12, await createTestContext(), true);
429
+ const schema = await env.importAssetSchema(testKey);
430
+ const itemPropsObjects = await env.schemaLocater.getInvertedUnits(testKey.name, env.schemaContext);
431
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
432
+ validateItem("FT_HORIZONTAL_PER_FT_VERTICAL", itemPropsObjects, schema);
433
+ }
434
+ catch (e_12) {
435
+ env_12.error = e_12;
436
+ env_12.hasError = true;
437
+ }
438
+ finally {
439
+ const result_12 = __disposeResources(env_12);
440
+ if (result_12)
441
+ await result_12;
442
+ }
269
443
  });
270
444
  it("UnitSystem query, props parsed successfully", async function () {
271
- // There's a UnitSystem in there.
272
- const testKey = new SchemaKey("InvertedUnitTest", 1, 0, 0);
273
- await IncrementalTestHelper.importSchema(testKey);
274
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
275
- if (!schema)
276
- throw new Error(`Could not find schema ${testKey.name}`);
277
- const itemPropsObjects = await schemaLocater.getUnitSystems(testKey.name, IncrementalTestHelper.context);
278
- expect(itemPropsObjects.length).to.be.greaterThan(0);
279
- validateItem("USCUSTOM", itemPropsObjects, schema);
445
+ const env_13 = { stack: [], error: void 0, hasError: false };
446
+ try {
447
+ // There's a UnitSystem in there.
448
+ const testKey = new SchemaKey("InvertedUnitTest", 1, 0, 0);
449
+ const env = __addDisposableResource(env_13, await createTestContext(), true);
450
+ const schema = await env.importAssetSchema(testKey);
451
+ const itemPropsObjects = await env.schemaLocater.getUnitSystems(testKey.name, env.schemaContext);
452
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
453
+ validateItem("USCUSTOM", itemPropsObjects, schema);
454
+ }
455
+ catch (e_13) {
456
+ env_13.error = e_13;
457
+ env_13.hasError = true;
458
+ }
459
+ finally {
460
+ const result_13 = __disposeResources(env_13);
461
+ if (result_13)
462
+ await result_13;
463
+ }
280
464
  });
281
465
  it("Constant query, props parsed successfully", async function () {
282
- // There's a UnitSystem in there.
283
- const testKey = new SchemaKey("ConstantTest", 1, 0, 0);
284
- await IncrementalTestHelper.importSchema(testKey);
285
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
286
- if (!schema)
287
- throw new Error(`Could not find schema ${testKey.name}`);
288
- const itemPropsObjects = await schemaLocater.getConstants(testKey.name, IncrementalTestHelper.context);
289
- expect(itemPropsObjects.length).to.be.greaterThan(0);
290
- validateItem("KILO", itemPropsObjects, schema);
291
- validateItem("HALF_PI", itemPropsObjects, schema);
466
+ const env_14 = { stack: [], error: void 0, hasError: false };
467
+ try {
468
+ // There's a UnitSystem in there.
469
+ const testKey = new SchemaKey("ConstantTest", 1, 0, 0);
470
+ const env = __addDisposableResource(env_14, await createTestContext(), true);
471
+ const schema = await env.importAssetSchema(testKey);
472
+ const itemPropsObjects = await env.schemaLocater.getConstants(testKey.name, env.schemaContext);
473
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
474
+ validateItem("KILO", itemPropsObjects, schema);
475
+ validateItem("HALF_PI", itemPropsObjects, schema);
476
+ }
477
+ catch (e_14) {
478
+ env_14.error = e_14;
479
+ env_14.hasError = true;
480
+ }
481
+ finally {
482
+ const result_14 = __disposeResources(env_14);
483
+ if (result_14)
484
+ await result_14;
485
+ }
292
486
  });
293
487
  it("Phenomenon query, props parsed successfully", async function () {
294
- // There's a Phenomenon in there.
295
- const testKey = new SchemaKey("ConstantTest", 1, 0, 0);
296
- await IncrementalTestHelper.importSchema(testKey);
297
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
298
- if (!schema)
299
- throw new Error(`Could not find schema ${testKey.name}`);
300
- const itemPropsObjects = await schemaLocater.getPhenomenon(testKey.name, IncrementalTestHelper.context);
301
- expect(itemPropsObjects.length).to.be.greaterThan(0);
302
- validateItem("NUMBER", itemPropsObjects, schema);
303
- validateItem("LENGTH_RATIO", itemPropsObjects, schema);
488
+ const env_15 = { stack: [], error: void 0, hasError: false };
489
+ try {
490
+ // There's a Phenomenon in there.
491
+ const testKey = new SchemaKey("ConstantTest", 1, 0, 0);
492
+ const env = __addDisposableResource(env_15, await createTestContext(), true);
493
+ const schema = await env.importAssetSchema(testKey);
494
+ const itemPropsObjects = await env.schemaLocater.getPhenomenon(testKey.name, env.schemaContext);
495
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
496
+ validateItem("NUMBER", itemPropsObjects, schema);
497
+ validateItem("LENGTH_RATIO", itemPropsObjects, schema);
498
+ }
499
+ catch (e_15) {
500
+ env_15.error = e_15;
501
+ env_15.hasError = true;
502
+ }
503
+ finally {
504
+ const result_15 = __disposeResources(env_15);
505
+ if (result_15)
506
+ await result_15;
507
+ }
304
508
  });
305
509
  it("Format Schema parses successfully", async function () {
306
- // Using installed Formats schema
307
- const testKey = new SchemaKey("Formats", 1, 0, 0);
308
- await IncrementalTestHelper.importSchema(testKey);
309
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
310
- if (!schema)
311
- throw new Error(`Could not find schema ${testKey.name}`);
312
- const itemPropsObjects = await schemaLocater.getFormats(testKey.name, IncrementalTestHelper.context);
313
- expect(itemPropsObjects.length).to.be.greaterThan(0);
314
- for (const props of itemPropsObjects) {
315
- validateItem(props.name, itemPropsObjects, schema);
510
+ const env_16 = { stack: [], error: void 0, hasError: false };
511
+ try {
512
+ // Using installed Formats schema
513
+ const testKey = new SchemaKey("Formats", 1, 0, 0);
514
+ const env = __addDisposableResource(env_16, await createTestContext(), true);
515
+ const schema = await env.importAssetSchema(testKey);
516
+ const itemPropsObjects = await env.schemaLocater.getFormats(testKey.name, env.schemaContext);
517
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
518
+ for (const props of itemPropsObjects) {
519
+ validateItem(props.name, itemPropsObjects, schema);
520
+ }
521
+ }
522
+ catch (e_16) {
523
+ env_16.error = e_16;
524
+ env_16.hasError = true;
525
+ }
526
+ finally {
527
+ const result_16 = __disposeResources(env_16);
528
+ if (result_16)
529
+ await result_16;
316
530
  }
317
531
  });
318
532
  it("Comprehensive Format parses successfully", async function () {
319
- const testKey = new SchemaKey("FormatTest", 1, 0, 0);
320
- await IncrementalTestHelper.importSchema(testKey);
321
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
322
- if (!schema)
323
- throw new Error(`Could not find schema ${testKey.name}`);
324
- const itemPropsObjects = await schemaLocater.getFormats(testKey.name, IncrementalTestHelper.context);
325
- expect(itemPropsObjects.length).to.be.greaterThan(0);
326
- for (const props of itemPropsObjects) {
327
- validateItem(props.name, itemPropsObjects, schema);
533
+ const env_17 = { stack: [], error: void 0, hasError: false };
534
+ try {
535
+ const testKey = new SchemaKey("FormatTest", 1, 0, 0);
536
+ const env = __addDisposableResource(env_17, await createTestContext(), true);
537
+ const schema = await env.importAssetSchema(testKey);
538
+ const itemPropsObjects = await env.schemaLocater.getFormats(testKey.name, env.schemaContext);
539
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
540
+ for (const props of itemPropsObjects) {
541
+ validateItem(props.name, itemPropsObjects, schema);
542
+ }
543
+ }
544
+ catch (e_17) {
545
+ env_17.error = e_17;
546
+ env_17.hasError = true;
547
+ }
548
+ finally {
549
+ const result_17 = __disposeResources(env_17);
550
+ if (result_17)
551
+ await result_17;
328
552
  }
329
553
  });
330
554
  it("CustomAttribute instances parse successfully", async function () {
331
- const testKey = new SchemaKey("CustomAttributeInstanceTest", 1, 0, 0);
332
- await IncrementalTestHelper.importSchema(testKey);
333
- const schema = await IncrementalTestHelper.context.getSchema(testKey);
334
- if (!schema)
335
- throw new Error(`Could not find schema ${testKey.name}`);
336
- const itemPropsObjects = await schemaLocater.getStructs(testKey.name, IncrementalTestHelper.context);
337
- expect(itemPropsObjects.length).to.be.greaterThan(0);
338
- for (const props of itemPropsObjects) {
339
- validateItem(props.name, itemPropsObjects, schema);
555
+ const env_18 = { stack: [], error: void 0, hasError: false };
556
+ try {
557
+ const testKey = new SchemaKey("CustomAttributeInstanceTest", 1, 0, 0);
558
+ const env = __addDisposableResource(env_18, await createTestContext(), true);
559
+ const schema = await env.importAssetSchema(testKey);
560
+ const itemPropsObjects = await env.schemaLocater.getStructs(testKey.name, env.schemaContext);
561
+ expect(itemPropsObjects.length).to.be.greaterThan(0);
562
+ for (const props of itemPropsObjects) {
563
+ validateItem(props.name, itemPropsObjects, schema);
564
+ }
565
+ }
566
+ catch (e_18) {
567
+ env_18.error = e_18;
568
+ env_18.hasError = true;
569
+ }
570
+ finally {
571
+ const result_18 = __disposeResources(env_18);
572
+ if (result_18)
573
+ await result_18;
340
574
  }
341
575
  });
342
576
  });