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

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 (26) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +5 -5
  3. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  4. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +432 -198
  5. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  6. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +272 -190
  7. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  8. package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts +27 -0
  9. package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts.map +1 -0
  10. package/lib/esm/test/incrementalSchemaLocater/TestContext.js +136 -0
  11. package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -0
  12. package/lib/esm/test/standalone/ChangesetReader.test.js +222 -3
  13. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  14. package/package.json +14 -14
  15. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +0 -11
  16. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +0 -1
  17. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +0 -36
  18. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +0 -1
  19. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +0 -20
  20. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +0 -1
  21. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +0 -126
  22. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +0 -1
  23. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +0 -24
  24. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +0 -1
  25. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +0 -67
  26. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +0 -1
@@ -1,11 +1,63 @@
1
- import { SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType, SchemaJsonLocater, SchemaKey, SchemaMatchType } from "@itwin/ecschema-metadata";
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
+ });
53
+ import { SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, SchemaMatchType } from "@itwin/ecschema-metadata";
2
54
  import { expect } from "chai";
3
- import * as chai from "chai";
4
- import * as chaiAsPromised from "chai-as-promised";
5
55
  import { IModelIncrementalSchemaLocater } from "../../IModelIncrementalSchemaLocater";
6
- import { IncrementalTestHelper } from "./utils/IncrementalTestHelper";
56
+ import { TestContext } from "./TestContext";
7
57
  import oldConfiguration from "../assets/IncrementalSchemaLocater/configs/old.config";
8
58
  import simpleConfiguration from "../assets/IncrementalSchemaLocater/configs/simple.config";
59
+ import * as chai from "chai";
60
+ import * as chaiAsPromised from "chai-as-promised";
9
61
  chai.use(chaiAsPromised);
10
62
  function parseSchemaItemKey(itemKey) {
11
63
  const [schemaName, itemName] = SchemaItem.parseFullName(itemKey);
@@ -14,212 +66,242 @@ function parseSchemaItemKey(itemKey) {
14
66
  }
15
67
  describe("Incremental Schema Loading", function () {
16
68
  describe("Simple iModel Incremental Loading Tests", () => {
17
- let testSchemaKey;
18
- let testSchemaConfiguration;
19
- before("Setup", async function () {
20
- await IncrementalTestHelper.setup();
21
- testSchemaConfiguration = simpleConfiguration.schemas[0];
22
- testSchemaKey = new SchemaKey(testSchemaConfiguration.name, 1, 0, 0);
23
- await IncrementalTestHelper.importSchema(testSchemaKey);
24
- });
25
- after(async () => {
26
- await IncrementalTestHelper.close();
27
- });
28
- const iModelSchemaJsonLocater = new SchemaJsonLocater((schemaName) => {
29
- return IncrementalTestHelper.iModel.getSchemaProps(schemaName);
30
- });
31
- it("Get SchemaInfo (json props - iModel)", async () => {
32
- const schemaContext = new SchemaContext();
33
- schemaContext.addLocater(iModelSchemaJsonLocater);
34
- const schemaInfo = await schemaContext.getSchemaInfo(testSchemaKey, SchemaMatchType.Exact);
35
- expect(schemaInfo).to.be.not.undefined;
36
- expect(schemaInfo).to.have.nested.property("schemaKey.name", testSchemaKey.name);
37
- expect(schemaInfo).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
38
- expect(schemaInfo).to.have.property("references").to.satisfy((refs) => {
39
- for (const ref of refs) {
40
- expect(testSchemaConfiguration.references, `Could not find referenced schema: ${ref.schemaKey.name}`).to.include(ref.schemaKey.name);
41
- }
42
- return true;
43
- });
69
+ const testSchemaConfiguration = simpleConfiguration.schemas[0];
70
+ const testSchemaKey = new SchemaKey(testSchemaConfiguration.name, 1, 0, 0);
71
+ it("should get schema info", async () => {
72
+ const env_1 = { stack: [], error: void 0, hasError: false };
73
+ try {
74
+ const env = __addDisposableResource(env_1, await TestContext.create(), true);
75
+ await env.importAssetSchema(testSchemaKey);
76
+ const schemaInfo = await env.schemaContext.getSchemaInfo(testSchemaKey, SchemaMatchType.Exact);
77
+ expect(schemaInfo).to.be.not.undefined;
78
+ expect(schemaInfo).to.have.nested.property("schemaKey.name", testSchemaKey.name);
79
+ expect(schemaInfo).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
80
+ expect(schemaInfo).to.have.property("references").to.satisfy((refs) => {
81
+ for (const ref of refs) {
82
+ expect(testSchemaConfiguration.references, `Could not find referenced schema: ${ref.schemaKey.name}`).to.include(ref.schemaKey.name);
83
+ }
84
+ return true;
85
+ });
86
+ }
87
+ catch (e_1) {
88
+ env_1.error = e_1;
89
+ env_1.hasError = true;
90
+ }
91
+ finally {
92
+ const result_1 = __disposeResources(env_1);
93
+ if (result_1)
94
+ await result_1;
95
+ }
44
96
  });
45
- it("Get SchemaInfo (incremental - backend)", async () => {
46
- const locater = new IModelIncrementalSchemaLocater(IncrementalTestHelper.iModel, { loadPartialSchemaOnly: true });
47
- const schemaContext = new SchemaContext();
48
- schemaContext.addLocater(locater);
49
- const schemaInfo = await schemaContext.getSchemaInfo(testSchemaKey, SchemaMatchType.Exact);
50
- expect(schemaInfo).to.be.not.undefined;
51
- expect(schemaInfo).to.have.nested.property("schemaKey.name", testSchemaKey.name);
52
- expect(schemaInfo).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
53
- expect(schemaInfo).to.have.property("references").to.satisfy((refs) => {
54
- for (const ref of refs) {
55
- expect(testSchemaConfiguration.references, `Could not find referenced schema: ${ref.schemaKey.name}`).to.include(ref.schemaKey.name);
97
+ it("should get schema with item stubs", async () => {
98
+ const env_2 = { stack: [], error: void 0, hasError: false };
99
+ try {
100
+ const env = __addDisposableResource(env_2, await TestContext.create(), true);
101
+ await env.importAssetSchema(testSchemaKey);
102
+ const schema = await env.schemaContext.getSchema(testSchemaKey);
103
+ expect(schema).to.be.not.undefined;
104
+ expect(schema).to.have.property("name", testSchemaKey.name);
105
+ expect(schema).to.have.property("description", testSchemaConfiguration.description);
106
+ expect(schema).to.have.property("label", testSchemaConfiguration.label);
107
+ expect(schema).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
108
+ for (const item of schema.getItems()) {
109
+ expect(item).to.have.property("name");
110
+ expect(item).to.have.property("schemaItemType").to.satisfy((type) => SchemaItemType[type] !== undefined);
56
111
  }
57
- return true;
58
- });
59
- });
60
- it("Get Schema with item stubs (incremental - backend)", async () => {
61
- const locater = new IModelIncrementalSchemaLocater(IncrementalTestHelper.iModel, { loadPartialSchemaOnly: true });
62
- const schemaContext = new SchemaContext();
63
- schemaContext.addLocater(locater);
64
- const schema = await schemaContext.getSchema(testSchemaKey);
65
- expect(schema).to.be.not.undefined;
66
- expect(schema).to.have.property("name", testSchemaKey.name);
67
- expect(schema).to.have.property("description", testSchemaConfiguration.description);
68
- expect(schema).to.have.property("label", testSchemaConfiguration.label);
69
- expect(schema).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
70
- for (const item of schema.getItems()) {
71
- expect(item).to.have.property("name");
72
- expect(item).to.have.property("schemaItemType").to.satisfy((type) => SchemaItemType[type] !== undefined);
73
- }
74
- expect(schema).to.be.not.undefined;
75
- expect(schema).to.have.property("name", testSchemaKey.name);
76
- const items = [...schema.getItems()];
77
- expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);
78
- for (const checkStub of testSchemaConfiguration.checkStubs) {
79
- const item = await schema.lookupItem(checkStub.item);
80
- expect(item).to.be.not.undefined;
81
- const props = item.toJSON();
82
- for (const [propertyName, propertyValue] of Object.entries(checkStub.properties)) {
83
- expect(props).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);
112
+ expect(schema).to.be.not.undefined;
113
+ expect(schema).to.have.property("name", testSchemaKey.name);
114
+ const items = [...schema.getItems()];
115
+ expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);
116
+ for (const checkStub of testSchemaConfiguration.checkStubs) {
117
+ const item = await schema.lookupItem(checkStub.item);
118
+ expect(item).to.be.not.undefined;
119
+ const props = item.toJSON();
120
+ for (const [propertyName, propertyValue] of Object.entries(checkStub.properties)) {
121
+ expect(props).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);
122
+ }
84
123
  }
85
124
  }
125
+ catch (e_2) {
126
+ env_2.error = e_2;
127
+ env_2.hasError = true;
128
+ }
129
+ finally {
130
+ const result_2 = __disposeResources(env_2);
131
+ if (result_2)
132
+ await result_2;
133
+ }
86
134
  });
87
- it("Get Schema with class hierarchy (json props - iModel)", async () => {
88
- const schemaContext = new SchemaContext();
89
- schemaContext.addLocater(iModelSchemaJsonLocater);
90
- const schema = await schemaContext.getSchema(testSchemaKey);
91
- expect(schema).to.be.not.undefined;
92
- expect(schema).to.have.property("name", testSchemaKey.name);
93
- const derivedClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.derivedClass);
94
- const derivedClass = await schemaContext.getSchemaItem(derivedClassKey);
95
- expect(derivedClass, `${derivedClassKey.fullName} was not found`).to.be.not.undefined;
96
- const baseClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.baseClass);
97
- const baseClass = await schemaContext.getSchemaItem(baseClassKey);
98
- expect(baseClass, `${baseClassKey.fullName} was not found`).to.be.not.undefined;
99
- const isDerivedFrom = await derivedClass.is(baseClass);
100
- expect(isDerivedFrom, `${derivedClass.name} is not derived from ${baseClass.name}`).to.be.true;
101
- });
102
- it("Get Schema with class hierarchy (incremental - backend)", async () => {
103
- const locater = new IModelIncrementalSchemaLocater(IncrementalTestHelper.iModel, { loadPartialSchemaOnly: true });
104
- const schemaContext = new SchemaContext();
105
- schemaContext.addLocater(locater);
106
- const schema = await schemaContext.getSchema(testSchemaKey);
107
- expect(schema).to.be.not.undefined;
108
- expect(schema).to.have.property("name", testSchemaKey.name);
109
- const derivedClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.derivedClass);
110
- const derivedClass = await schemaContext.getSchemaItem(derivedClassKey);
111
- expect(derivedClass, `${derivedClassKey.fullName} was not found`).to.be.not.undefined;
112
- const baseClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.baseClass);
113
- const baseClass = await schemaContext.getSchemaItem(baseClassKey);
114
- expect(baseClass, `${baseClassKey.fullName} was not found`).to.be.not.undefined;
115
- const isDerivedFrom = await derivedClass.is(baseClass);
116
- expect(isDerivedFrom, `${derivedClass.name} is not derived from ${baseClass.name}`).to.be.true;
117
- });
118
- it("Get Schema full schema stack (json props - iModel)", async () => {
119
- const schemaContext = new SchemaContext();
120
- schemaContext.addLocater(iModelSchemaJsonLocater);
121
- const schema = await schemaContext.getSchema(testSchemaKey);
122
- expect(schema).to.be.not.undefined;
123
- expect(schema).to.have.property("name", testSchemaKey.name);
124
- expect(schema).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
125
- for (const item of schema.getItems()) {
126
- expect(item).to.have.property("name");
127
- expect(item).to.have.property("schemaItemType").to.satisfy((type) => SchemaItemType[type] !== undefined);
135
+ it("should get schema with class stubs with hierarchy", async () => {
136
+ const env_3 = { stack: [], error: void 0, hasError: false };
137
+ try {
138
+ const env = __addDisposableResource(env_3, await TestContext.create(), true);
139
+ await env.importAssetSchema(testSchemaKey);
140
+ const schema = await env.schemaContext.getSchema(testSchemaKey);
141
+ expect(schema).to.be.not.undefined;
142
+ expect(schema).to.have.property("name", testSchemaKey.name);
143
+ const derivedClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.derivedClass);
144
+ const derivedClass = await env.schemaContext.getSchemaItem(derivedClassKey);
145
+ expect(derivedClass, `${derivedClassKey.fullName} was not found`).to.be.not.undefined;
146
+ const baseClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.baseClass);
147
+ const baseClass = await env.schemaContext.getSchemaItem(baseClassKey);
148
+ expect(baseClass, `${baseClassKey.fullName} was not found`).to.be.not.undefined;
149
+ const isDerivedFrom = await derivedClass.is(baseClass);
150
+ expect(isDerivedFrom, `${derivedClass.name} is not derived from ${baseClass.name}`).to.be.true;
151
+ }
152
+ catch (e_3) {
153
+ env_3.error = e_3;
154
+ env_3.hasError = true;
155
+ }
156
+ finally {
157
+ const result_3 = __disposeResources(env_3);
158
+ if (result_3)
159
+ await result_3;
128
160
  }
129
161
  });
130
- it("Get Schema full schema stack (incremental - backend)", async () => {
131
- const schemaContext = IncrementalTestHelper.iModel.schemaContext;
132
- const schema = await schemaContext.getSchema(testSchemaKey);
133
- expect(schema).to.be.not.undefined;
134
- expect(schema).to.have.property("name", testSchemaKey.name);
135
- expect(schema).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
136
- for (const item of schema.getItems()) {
137
- expect(item).to.have.property("name");
138
- expect(item).to.have.property("schemaItemType").to.satisfy((type) => SchemaItemType[type] !== undefined);
139
- }
140
- expect(schema).to.be.not.undefined;
141
- expect(schema).to.have.property("name", testSchemaKey.name);
142
- // Old meta profile fallback queries will not have a controller initialized.
143
- if (schema.loadingController)
144
- await schema.loadingController.wait();
145
- const items = [...schema.getItems()];
146
- expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);
147
- for (const checkItem of testSchemaConfiguration.checkFullLoad) {
148
- const item = await schema.lookupItem(checkItem.item);
149
- expect(item).to.be.not.undefined;
150
- const itemProps = item.toJSON();
151
- for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {
152
- expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);
162
+ it("should get schema full schema stack", async () => {
163
+ const env_4 = { stack: [], error: void 0, hasError: false };
164
+ try {
165
+ const env = __addDisposableResource(env_4, await TestContext.create(), true);
166
+ await env.importAssetSchema(testSchemaKey);
167
+ const schema = await env.schemaContext.getSchema(testSchemaKey);
168
+ expect(schema).to.be.not.undefined;
169
+ expect(schema).to.have.property("name", testSchemaKey.name);
170
+ expect(schema).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
171
+ for (const item of schema.getItems()) {
172
+ expect(item).to.have.property("name");
173
+ expect(item).to.have.property("schemaItemType").to.satisfy((type) => SchemaItemType[type] !== undefined);
153
174
  }
175
+ expect(schema).to.be.not.undefined;
176
+ expect(schema).to.have.property("name", testSchemaKey.name);
177
+ // Wait till schemas are fully loaded to be comparable.
178
+ // TODO: remove this check when issue #1763 is fixed.
179
+ if (schema.loadingController)
180
+ await schema.loadingController.wait();
181
+ const items = [...schema.getItems()];
182
+ expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);
183
+ for (const checkItem of testSchemaConfiguration.checkFullLoad) {
184
+ const item = await schema.lookupItem(checkItem.item);
185
+ expect(item).to.be.not.undefined;
186
+ const itemProps = item.toJSON();
187
+ for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {
188
+ expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);
189
+ }
190
+ }
191
+ }
192
+ catch (e_4) {
193
+ env_4.error = e_4;
194
+ env_4.hasError = true;
195
+ }
196
+ finally {
197
+ const result_4 = __disposeResources(env_4);
198
+ if (result_4)
199
+ await result_4;
154
200
  }
155
201
  });
156
202
  });
157
203
  describe("Old Schema profile in iModel Tests", () => {
158
- let testSchemaKey;
159
- let testSchemaConfiguration;
160
- const resolveSchemaKey = async (schemaName) => {
161
- const schemaFullName = (await IncrementalTestHelper.getSchemaNames()).find((name) => name.startsWith(schemaName));
162
- if (schemaFullName === undefined) {
163
- throw new Error(`Test schema '${schemaName}' not found`);
164
- }
165
- return SchemaKey.parseString(schemaFullName);
166
- };
167
- before("Setup", async function () {
168
- await IncrementalTestHelper.setup({ bimName: oldConfiguration.bimFile });
169
- testSchemaConfiguration = oldConfiguration.schemas[0];
170
- testSchemaKey = await resolveSchemaKey(testSchemaConfiguration.name);
171
- });
172
- after(async () => {
173
- await IncrementalTestHelper.close();
174
- });
175
- it("Incremental Loading still succeeds.", async () => {
176
- const schemaContext = IncrementalTestHelper.iModel.schemaContext;
177
- const schema = await schemaContext.getSchema(testSchemaKey);
178
- expect(schema).to.be.not.undefined;
179
- expect(schema).to.have.property("name", testSchemaKey.name);
180
- expect(schema).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
181
- for (const item of schema.getItems()) {
182
- expect(item).to.have.property("name");
183
- expect(item).to.have.property("schemaItemType").to.satisfy((type) => SchemaItemType[type] !== undefined);
184
- }
185
- expect(schema).to.be.not.undefined;
186
- expect(schema).to.have.property("name", testSchemaKey.name);
187
- // Old meta profile fallback queries will not have a controller initialized.
188
- if (schema.loadingController)
189
- await schema.loadingController.wait();
190
- const items = [...schema.getItems()];
191
- expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);
192
- for (const checkItem of testSchemaConfiguration.checkFullLoad) {
193
- const item = await schema.lookupItem(checkItem.item);
194
- expect(item).to.be.not.undefined;
195
- const itemProps = item.toJSON();
196
- for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {
197
- expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);
204
+ it("should succeed with incremental loading fallback.", async () => {
205
+ const env_5 = { stack: [], error: void 0, hasError: false };
206
+ try {
207
+ const env = __addDisposableResource(env_5, await TestContext.create({
208
+ bimFile: oldConfiguration.bimFile,
209
+ }), true);
210
+ const resolveSchemaKey = async (schemaName) => {
211
+ const schemaFullName = (await env.getSchemaNames()).find((name) => name.startsWith(schemaName));
212
+ if (schemaFullName === undefined) {
213
+ throw new Error(`Test schema '${schemaName}' not found`);
214
+ }
215
+ return SchemaKey.parseString(schemaFullName);
216
+ };
217
+ const testSchemaConfiguration = oldConfiguration.schemas[0];
218
+ const testSchemaKey = await resolveSchemaKey(testSchemaConfiguration.name);
219
+ const schema = await env.schemaContext.getSchema(testSchemaKey);
220
+ expect(schema).to.be.not.undefined;
221
+ expect(schema).to.have.property("name", testSchemaKey.name);
222
+ expect(schema).to.have.property("references").to.have.a.lengthOf(testSchemaConfiguration.references.length);
223
+ for (const item of schema.getItems()) {
224
+ expect(item).to.have.property("name");
225
+ expect(item).to.have.property("schemaItemType").to.satisfy((type) => SchemaItemType[type] !== undefined);
226
+ }
227
+ expect(schema).to.be.not.undefined;
228
+ expect(schema).to.have.property("name", testSchemaKey.name);
229
+ const items = [...schema.getItems()];
230
+ expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);
231
+ for (const checkItem of testSchemaConfiguration.checkFullLoad) {
232
+ const item = await schema.lookupItem(checkItem.item);
233
+ expect(item).to.be.not.undefined;
234
+ const itemProps = item.toJSON();
235
+ for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {
236
+ expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);
237
+ }
198
238
  }
199
239
  }
240
+ catch (e_5) {
241
+ env_5.error = e_5;
242
+ env_5.hasError = true;
243
+ }
244
+ finally {
245
+ const result_5 = __disposeResources(env_5);
246
+ if (result_5)
247
+ await result_5;
248
+ }
200
249
  });
201
250
  });
202
251
  describe("Test Incremental Loading setup", () => {
203
- afterEach(async () => {
204
- await IncrementalTestHelper.close();
205
- });
206
252
  it("schema context should not have an instance of incremental schema locater if loading is disabled", async () => {
207
- await IncrementalTestHelper.setup({ disableSchemaLoading: true });
208
- const locaters = IncrementalTestHelper.iModel.schemaContext.locaters;
209
- const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);
210
- expect(incrementalLocater).to.be.undefined;
211
- });
212
- it("schema context should not have an instance of incremental schema locater if loading is not specified", async () => {
213
- await IncrementalTestHelper.setup();
214
- const locaters = IncrementalTestHelper.iModel.schemaContext.locaters;
215
- const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);
216
- expect(incrementalLocater).to.be.undefined;
253
+ const env_6 = { stack: [], error: void 0, hasError: false };
254
+ try {
255
+ const env = __addDisposableResource(env_6, await TestContext.create({ incrementalSchemaLoading: "disabled" }), true);
256
+ const locaters = env.iModel.schemaContext.locaters;
257
+ const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);
258
+ expect(incrementalLocater).to.be.undefined;
259
+ }
260
+ catch (e_6) {
261
+ env_6.error = e_6;
262
+ env_6.hasError = true;
263
+ }
264
+ finally {
265
+ const result_6 = __disposeResources(env_6);
266
+ if (result_6)
267
+ await result_6;
268
+ }
217
269
  });
218
270
  it("schema context should have an instance of incremental schema locater if loading is enabled", async () => {
219
- await IncrementalTestHelper.setup({ disableSchemaLoading: false });
220
- const locaters = IncrementalTestHelper.iModel.schemaContext.locaters;
221
- const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);
222
- expect(incrementalLocater).to.be.not.undefined;
271
+ const env_7 = { stack: [], error: void 0, hasError: false };
272
+ try {
273
+ const env = __addDisposableResource(env_7, await TestContext.create({ incrementalSchemaLoading: "enabled" }), true);
274
+ const locaters = env.iModel.schemaContext.locaters;
275
+ const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);
276
+ expect(incrementalLocater).to.be.not.undefined;
277
+ }
278
+ catch (e_7) {
279
+ env_7.error = e_7;
280
+ env_7.hasError = true;
281
+ }
282
+ finally {
283
+ const result_7 = __disposeResources(env_7);
284
+ if (result_7)
285
+ await result_7;
286
+ }
287
+ });
288
+ it("schema context should not have an instance of incremental schema locater if loading is not specified", async () => {
289
+ const env_8 = { stack: [], error: void 0, hasError: false };
290
+ try {
291
+ const env = __addDisposableResource(env_8, await TestContext.create({ incrementalSchemaLoading: undefined }), true);
292
+ const locaters = env.iModel.schemaContext.locaters;
293
+ const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);
294
+ expect(incrementalLocater).to.be.undefined;
295
+ }
296
+ catch (e_8) {
297
+ env_8.error = e_8;
298
+ env_8.hasError = true;
299
+ }
300
+ finally {
301
+ const result_8 = __disposeResources(env_8);
302
+ if (result_8)
303
+ await result_8;
304
+ }
223
305
  });
224
306
  });
225
307
  });
@@ -1 +1 @@
1
- {"version":3,"file":"IncrementalLoading.test.js","sourceRoot":"","sources":["../../../../src/test/incrementalSchemaLocater/IncrementalLoading.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,aAAa,EAAc,UAAU,EAAE,aAAa,EAC5E,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAA8B,MACtF,0BAA0B,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,gBAAgB,MAAM,uDAAuD,CAAC;AACrF,OAAO,mBAAmB,MAAM,0DAA0D,CAAC;AAE3F,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAEzB,SAAS,kBAAkB,CAAC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AAE;YACpH,MAAM,qBAAqB,CAAC,KAAK,EAAE,CAAC;YACpC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;YACrE,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,YAAY,8BAA8B,CAAC,CAAC;YACzG,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4FAA4F,EAAE,KAAK,IAAI,EAAE;YAC1G,MAAM,qBAAqB,CAAC,KAAK,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;YACnE,MAAM,QAAQ,GAAG,qBAAqB,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;YACrE,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,YAAY,8BAA8B,CAAC,CAAC;YACzG,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { ECClass, Schema, SchemaContext, SchemaInfo, SchemaItem, SchemaItemKey,\r\n SchemaItemType, SchemaJsonLocater, SchemaKey, SchemaMatchType, SchemaProps, WithSchemaKey }\r\n from \"@itwin/ecschema-metadata\";\r\nimport { expect } from \"chai\";\r\nimport * as chai from \"chai\";\r\nimport * as chaiAsPromised from \"chai-as-promised\";\r\nimport { IModelIncrementalSchemaLocater } from \"../../IModelIncrementalSchemaLocater\";\r\nimport { IncrementalTestHelper } from \"./utils/IncrementalTestHelper\";\r\n\r\nimport oldConfiguration from \"../assets/IncrementalSchemaLocater/configs/old.config\";\r\nimport simpleConfiguration from \"../assets/IncrementalSchemaLocater/configs/simple.config\";\r\n\r\nchai.use(chaiAsPromised);\r\n\r\nfunction parseSchemaItemKey(itemKey: string): SchemaItemKey {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(itemKey);\r\n const schemaKey = SchemaKey.parseString(`${schemaName}.0.0.0`);\r\n return new SchemaItemKey(itemName, schemaKey);\r\n}\r\n\r\ndescribe(\"Incremental Schema Loading\", function () {\r\n describe (\"Simple iModel Incremental Loading Tests\", () => {\r\n let testSchemaKey: SchemaKey;\r\n let testSchemaConfiguration: any;\r\n\r\n before(\"Setup\", async function () {\r\n await IncrementalTestHelper.setup();\r\n testSchemaConfiguration = simpleConfiguration.schemas[0];\r\n testSchemaKey = new SchemaKey(testSchemaConfiguration.name, 1, 0, 0);\r\n await IncrementalTestHelper.importSchema(testSchemaKey);\r\n });\r\n\r\n after(async () => {\r\n await IncrementalTestHelper.close();\r\n });\r\n\r\n const iModelSchemaJsonLocater = new SchemaJsonLocater((schemaName) => {\r\n return IncrementalTestHelper.iModel.getSchemaProps(schemaName) as SchemaProps;\r\n });\r\n\r\n it(\"Get SchemaInfo (json props - iModel)\", async () => {\r\n const schemaContext = new SchemaContext();\r\n schemaContext.addLocater(iModelSchemaJsonLocater);\r\n\r\n const schemaInfo = await schemaContext.getSchemaInfo(testSchemaKey, SchemaMatchType.Exact) as SchemaInfo;\r\n expect(schemaInfo).to.be.not.undefined;\r\n expect(schemaInfo).to.have.nested.property(\"schemaKey.name\", testSchemaKey.name);\r\n\r\n expect(schemaInfo).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n expect(schemaInfo).to.have.property(\"references\").to.satisfy((refs: WithSchemaKey[]) => {\r\n for (const ref of refs) {\r\n expect(testSchemaConfiguration.references, `Could not find referenced schema: ${ref.schemaKey.name}`).to.include(ref.schemaKey.name);\r\n }\r\n return true;\r\n });\r\n });\r\n\r\n it(\"Get SchemaInfo (incremental - backend)\", async () => {\r\n const locater = new IModelIncrementalSchemaLocater(IncrementalTestHelper.iModel, { loadPartialSchemaOnly: true });\r\n\r\n const schemaContext = new SchemaContext();\r\n schemaContext.addLocater(locater);\r\n\r\n const schemaInfo = await schemaContext.getSchemaInfo(testSchemaKey, SchemaMatchType.Exact) as SchemaInfo;\r\n expect(schemaInfo).to.be.not.undefined;\r\n expect(schemaInfo).to.have.nested.property(\"schemaKey.name\", testSchemaKey.name);\r\n\r\n expect(schemaInfo).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n expect(schemaInfo).to.have.property(\"references\").to.satisfy((refs: WithSchemaKey[]) => {\r\n for (const ref of refs) {\r\n expect(testSchemaConfiguration.references, `Could not find referenced schema: ${ref.schemaKey.name}`).to.include(ref.schemaKey.name);\r\n }\r\n return true;\r\n });\r\n });\r\n\r\n it(\"Get Schema with item stubs (incremental - backend)\", async () => {\r\n const locater = new IModelIncrementalSchemaLocater(IncrementalTestHelper.iModel, { loadPartialSchemaOnly: true });\r\n const schemaContext = new SchemaContext();\r\n schemaContext.addLocater(locater);\r\n\r\n const schema = await schemaContext.getSchema(testSchemaKey) as Schema;\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n expect(schema).to.have.property(\"description\", testSchemaConfiguration.description);\r\n expect(schema).to.have.property(\"label\", testSchemaConfiguration.label);\r\n\r\n expect(schema).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n for (const item of schema.getItems()) {\r\n expect(item).to.have.property(\"name\");\r\n expect(item).to.have.property(\"schemaItemType\").to.satisfy((type: string) => SchemaItemType[type as keyof typeof SchemaItemType] !== undefined);\r\n }\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n const items = [...schema.getItems()];\r\n expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);\r\n\r\n for (const checkStub of testSchemaConfiguration.checkStubs) {\r\n const item = await schema.lookupItem(checkStub.item);\r\n expect(item).to.be.not.undefined;\r\n const props = item!.toJSON();\r\n for (const [propertyName, propertyValue] of Object.entries(checkStub.properties)) {\r\n expect(props).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);\r\n }\r\n }\r\n });\r\n\r\n it(\"Get Schema with class hierarchy (json props - iModel)\", async () => {\r\n const schemaContext = new SchemaContext();\r\n schemaContext.addLocater(iModelSchemaJsonLocater);\r\n\r\n const schema = await schemaContext.getSchema(testSchemaKey) as Schema;\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n const derivedClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.derivedClass);\r\n const derivedClass = await schemaContext.getSchemaItem(derivedClassKey) as ECClass;\r\n expect(derivedClass, `${derivedClassKey.fullName} was not found`).to.be.not.undefined;\r\n\r\n const baseClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.baseClass);\r\n const baseClass = await schemaContext.getSchemaItem(baseClassKey) as ECClass;\r\n expect(baseClass, `${baseClassKey.fullName} was not found`).to.be.not.undefined;\r\n\r\n const isDerivedFrom = await derivedClass.is(baseClass);\r\n expect(isDerivedFrom, `${derivedClass.name} is not derived from ${baseClass.name}`).to.be.true;\r\n });\r\n\r\n it(\"Get Schema with class hierarchy (incremental - backend)\", async () => {\r\n const locater = new IModelIncrementalSchemaLocater(IncrementalTestHelper.iModel, { loadPartialSchemaOnly: true });\r\n const schemaContext = new SchemaContext();\r\n schemaContext.addLocater(locater);\r\n\r\n const schema = await schemaContext.getSchema(testSchemaKey) as Schema;\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n const derivedClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.derivedClass);\r\n const derivedClass = await schemaContext.getSchemaItem(derivedClassKey) as ECClass;\r\n expect(derivedClass, `${derivedClassKey.fullName} was not found`).to.be.not.undefined;\r\n\r\n const baseClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.baseClass);\r\n const baseClass = await schemaContext.getSchemaItem(baseClassKey) as ECClass;\r\n expect(baseClass, `${baseClassKey.fullName} was not found`).to.be.not.undefined;\r\n\r\n const isDerivedFrom = await derivedClass.is(baseClass);\r\n expect(isDerivedFrom, `${derivedClass.name} is not derived from ${baseClass.name}`).to.be.true;\r\n });\r\n\r\n it(\"Get Schema full schema stack (json props - iModel)\", async () => {\r\n const schemaContext = new SchemaContext();\r\n schemaContext.addLocater(iModelSchemaJsonLocater);\r\n\r\n const schema = await schemaContext.getSchema(testSchemaKey) as Schema;\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n expect(schema).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n for (const item of schema.getItems()) {\r\n expect(item).to.have.property(\"name\");\r\n expect(item).to.have.property(\"schemaItemType\").to.satisfy((type: string) => SchemaItemType[type as keyof typeof SchemaItemType] !== undefined);\r\n }\r\n });\r\n\r\n it(\"Get Schema full schema stack (incremental - backend)\", async () => {\r\n const schemaContext = IncrementalTestHelper.iModel.schemaContext;\r\n const schema = await schemaContext.getSchema(testSchemaKey) as Schema;\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n expect(schema).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n for (const item of schema.getItems()) {\r\n expect(item).to.have.property(\"name\");\r\n expect(item).to.have.property(\"schemaItemType\").to.satisfy((type: string) => SchemaItemType[type as keyof typeof SchemaItemType] !== undefined);\r\n }\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n // Old meta profile fallback queries will not have a controller initialized.\r\n if (schema.loadingController)\r\n await schema.loadingController.wait();\r\n\r\n const items = [...schema.getItems()];\r\n expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);\r\n\r\n for (const checkItem of testSchemaConfiguration.checkFullLoad) {\r\n const item = await schema.lookupItem(checkItem.item);\r\n expect(item).to.be.not.undefined;\r\n\r\n const itemProps = item!.toJSON();\r\n for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {\r\n expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);\r\n }\r\n }\r\n });\r\n });\r\n\r\n describe(\"Old Schema profile in iModel Tests\", () => {\r\n let testSchemaKey: SchemaKey;\r\n let testSchemaConfiguration: any;\r\n\r\n const resolveSchemaKey = async (schemaName: string): Promise<SchemaKey> => {\r\n const schemaFullName = (await IncrementalTestHelper.getSchemaNames()).find((name) => name.startsWith(schemaName));\r\n if (schemaFullName === undefined) {\r\n throw new Error(`Test schema '${schemaName}' not found`);\r\n }\r\n return SchemaKey.parseString(schemaFullName);\r\n }\r\n\r\n before(\"Setup\", async function () {\r\n await IncrementalTestHelper.setup({ bimName: oldConfiguration.bimFile });\r\n testSchemaConfiguration = oldConfiguration.schemas[0];\r\n testSchemaKey = await resolveSchemaKey(testSchemaConfiguration.name);\r\n });\r\n\r\n after(async () => {\r\n await IncrementalTestHelper.close();\r\n });\r\n\r\n it(\"Incremental Loading still succeeds.\", async () => {\r\n const schemaContext = IncrementalTestHelper.iModel.schemaContext;\r\n const schema = await schemaContext.getSchema(testSchemaKey) as Schema;\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n expect(schema).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n for (const item of schema.getItems()) {\r\n expect(item).to.have.property(\"name\");\r\n expect(item).to.have.property(\"schemaItemType\").to.satisfy((type: string) => SchemaItemType[type as keyof typeof SchemaItemType] !== undefined);\r\n }\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n // Old meta profile fallback queries will not have a controller initialized.\r\n if (schema.loadingController)\r\n await schema.loadingController.wait();\r\n\r\n const items = [...schema.getItems()];\r\n expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);\r\n\r\n for (const checkItem of testSchemaConfiguration.checkFullLoad) {\r\n const item = await schema.lookupItem(checkItem.item);\r\n expect(item).to.be.not.undefined;\r\n\r\n const itemProps = item!.toJSON();\r\n for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {\r\n expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);\r\n }\r\n }\r\n });\r\n });\r\n\r\n describe(\"Test Incremental Loading setup\", () => {\r\n afterEach(async () => {\r\n await IncrementalTestHelper.close();\r\n });\r\n\r\n it(\"schema context should not have an instance of incremental schema locater if loading is disabled\", async () => {\r\n await IncrementalTestHelper.setup({ disableSchemaLoading: true });\r\n const locaters = IncrementalTestHelper.iModel.schemaContext.locaters;\r\n const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);\r\n expect(incrementalLocater).to.be.undefined;\r\n });\r\n\r\n it(\"schema context should not have an instance of incremental schema locater if loading is not specified\", async () => {\r\n await IncrementalTestHelper.setup();\r\n const locaters = IncrementalTestHelper.iModel.schemaContext.locaters;\r\n const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);\r\n expect(incrementalLocater).to.be.undefined;\r\n });\r\n\r\n it(\"schema context should have an instance of incremental schema locater if loading is enabled\", async () => {\r\n await IncrementalTestHelper.setup({ disableSchemaLoading: false });\r\n const locaters = IncrementalTestHelper.iModel.schemaContext.locaters;\r\n const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);\r\n expect(incrementalLocater).to.be.not.undefined;\r\n });\r\n });\r\n});\r\n"]}
1
+ {"version":3,"file":"IncrementalLoading.test.js","sourceRoot":"","sources":["../../../../src/test/incrementalSchemaLocater/IncrementalLoading.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAA+B,UAA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,IAAI,EAAE;;;gBAC1G,MAAY,GAAG,kCAAG,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE,wBAAwB,EAAE,SAAS,EAAE,CAAC,OAAA,CAAC;gBACpF,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;gBACnD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,YAAY,8BAA8B,CAAC,CAAC;gBACzG,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;;;;;;;;;;;SAChD,CAAC,CAAC;QAEH,EAAE,CAAC,sGAAsG,EAAE,KAAK,IAAI,EAAE;;;gBACpH,MAAY,GAAG,kCAAG,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE,wBAAwB,EAAE,SAAS,EAAE,CAAC,OAAA,CAAC;gBACpF,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;gBACnD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,YAAY,8BAA8B,CAAC,CAAC;gBACzG,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;;;;;;;;;;;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { ECClass, Schema, SchemaInfo, SchemaItem, SchemaItemKey,\r\n SchemaItemType, SchemaKey, SchemaMatchType, WithSchemaKey }\r\n from \"@itwin/ecschema-metadata\";\r\nimport { expect } from \"chai\";\r\nimport { IModelIncrementalSchemaLocater } from \"../../IModelIncrementalSchemaLocater\";\r\nimport { TestContext } from \"./TestContext\";\r\n\r\nimport oldConfiguration from \"../assets/IncrementalSchemaLocater/configs/old.config\";\r\nimport simpleConfiguration from \"../assets/IncrementalSchemaLocater/configs/simple.config\";\r\n\r\nimport * as chai from \"chai\";\r\nimport * as chaiAsPromised from \"chai-as-promised\";\r\n\r\nchai.use(chaiAsPromised);\r\n\r\nfunction parseSchemaItemKey(itemKey: string): SchemaItemKey {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(itemKey);\r\n const schemaKey = SchemaKey.parseString(`${schemaName}.0.0.0`);\r\n return new SchemaItemKey(itemName, schemaKey);\r\n}\r\n\r\ndescribe(\"Incremental Schema Loading\", function () {\r\n describe (\"Simple iModel Incremental Loading Tests\", () => {\r\n const testSchemaConfiguration = simpleConfiguration.schemas[0];\r\n const testSchemaKey = new SchemaKey(testSchemaConfiguration.name, 1, 0, 0);\r\n\r\n it(\"should get schema info\", async () => {\r\n await using env = await TestContext.create();\r\n await env.importAssetSchema(testSchemaKey);\r\n\r\n const schemaInfo = await env.schemaContext.getSchemaInfo(testSchemaKey, SchemaMatchType.Exact) as SchemaInfo;\r\n expect(schemaInfo).to.be.not.undefined;\r\n expect(schemaInfo).to.have.nested.property(\"schemaKey.name\", testSchemaKey.name);\r\n\r\n expect(schemaInfo).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n expect(schemaInfo).to.have.property(\"references\").to.satisfy((refs: WithSchemaKey[]) => {\r\n for (const ref of refs) {\r\n expect(testSchemaConfiguration.references, `Could not find referenced schema: ${ref.schemaKey.name}`).to.include(ref.schemaKey.name);\r\n }\r\n return true;\r\n });\r\n });\r\n\r\n it(\"should get schema with item stubs\", async () => {\r\n await using env = await TestContext.create();\r\n await env.importAssetSchema(testSchemaKey);\r\n\r\n const schema = await env.schemaContext.getSchema(testSchemaKey) as Schema;\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n expect(schema).to.have.property(\"description\", testSchemaConfiguration.description);\r\n expect(schema).to.have.property(\"label\", testSchemaConfiguration.label);\r\n\r\n expect(schema).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n for (const item of schema.getItems()) {\r\n expect(item).to.have.property(\"name\");\r\n expect(item).to.have.property(\"schemaItemType\").to.satisfy((type: string) => SchemaItemType[type as keyof typeof SchemaItemType] !== undefined);\r\n }\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n const items = [...schema.getItems()];\r\n expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);\r\n\r\n for (const checkStub of testSchemaConfiguration.checkStubs) {\r\n const item = await schema.lookupItem(checkStub.item);\r\n expect(item).to.be.not.undefined;\r\n const props = item!.toJSON();\r\n for (const [propertyName, propertyValue] of Object.entries(checkStub.properties)) {\r\n expect(props).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);\r\n }\r\n }\r\n });\r\n\r\n it(\"should get schema with class stubs with hierarchy\", async () => {\r\n await using env = await TestContext.create();\r\n await env.importAssetSchema(testSchemaKey);\r\n\r\n const schema = await env.schemaContext.getSchema(testSchemaKey) as Schema;\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n const derivedClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.derivedClass);\r\n const derivedClass = await env.schemaContext.getSchemaItem(derivedClassKey) as ECClass;\r\n expect(derivedClass, `${derivedClassKey.fullName} was not found`).to.be.not.undefined;\r\n\r\n const baseClassKey = parseSchemaItemKey(testSchemaConfiguration.checkHierachy.baseClass);\r\n const baseClass = await env.schemaContext.getSchemaItem(baseClassKey) as ECClass;\r\n expect(baseClass, `${baseClassKey.fullName} was not found`).to.be.not.undefined;\r\n\r\n const isDerivedFrom = await derivedClass.is(baseClass);\r\n expect(isDerivedFrom, `${derivedClass.name} is not derived from ${baseClass.name}`).to.be.true;\r\n });\r\n\r\n it(\"should get schema full schema stack\", async () => {\r\n await using env = await TestContext.create();\r\n await env.importAssetSchema(testSchemaKey);\r\n\r\n const schema = await env.schemaContext.getSchema(testSchemaKey) as Schema;\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n expect(schema).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n for (const item of schema.getItems()) {\r\n expect(item).to.have.property(\"name\");\r\n expect(item).to.have.property(\"schemaItemType\").to.satisfy((type: string) => SchemaItemType[type as keyof typeof SchemaItemType] !== undefined);\r\n }\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n // Wait till schemas are fully loaded to be comparable.\r\n // TODO: remove this check when issue #1763 is fixed.\r\n if (schema.loadingController)\r\n await schema.loadingController.wait();\r\n\r\n const items = [...schema.getItems()];\r\n expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);\r\n\r\n for (const checkItem of testSchemaConfiguration.checkFullLoad) {\r\n const item = await schema.lookupItem(checkItem.item);\r\n expect(item).to.be.not.undefined;\r\n\r\n const itemProps = item!.toJSON();\r\n for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {\r\n expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);\r\n }\r\n }\r\n });\r\n });\r\n\r\n describe(\"Old Schema profile in iModel Tests\", () => {\r\n it(\"should succeed with incremental loading fallback.\", async () => {\r\n await using env = await TestContext.create({\r\n bimFile: oldConfiguration.bimFile,\r\n });\r\n\r\n const resolveSchemaKey = async (schemaName: string): Promise<SchemaKey> => {\r\n const schemaFullName = (await env.getSchemaNames()).find((name) => name.startsWith(schemaName));\r\n if (schemaFullName === undefined) {\r\n throw new Error(`Test schema '${schemaName}' not found`);\r\n }\r\n return SchemaKey.parseString(schemaFullName);\r\n }\r\n\r\n const testSchemaConfiguration = oldConfiguration.schemas[0];\r\n const testSchemaKey = await resolveSchemaKey(testSchemaConfiguration.name);\r\n\r\n const schema = await env.schemaContext.getSchema(testSchemaKey) as Schema;\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n expect(schema).to.have.property(\"references\").to.have.a.lengthOf(testSchemaConfiguration.references.length);\r\n for (const item of schema.getItems()) {\r\n expect(item).to.have.property(\"name\");\r\n expect(item).to.have.property(\"schemaItemType\").to.satisfy((type: string) => SchemaItemType[type as keyof typeof SchemaItemType] !== undefined);\r\n }\r\n\r\n expect(schema).to.be.not.undefined;\r\n expect(schema).to.have.property(\"name\", testSchemaKey.name);\r\n\r\n const items = [...schema.getItems()];\r\n expect(items).to.have.a.lengthOf(testSchemaConfiguration.itemCount);\r\n\r\n for (const checkItem of testSchemaConfiguration.checkFullLoad) {\r\n const item = await schema.lookupItem(checkItem.item);\r\n expect(item).to.be.not.undefined;\r\n\r\n const itemProps = item!.toJSON();\r\n for (const [propertyName, propertyValue] of Object.entries(checkItem.properties)) {\r\n expect(itemProps).to.have.property(propertyName).deep.equalInAnyOrder(propertyValue);\r\n }\r\n }\r\n });\r\n });\r\n\r\n describe(\"Test Incremental Loading setup\", () => {\r\n it(\"schema context should not have an instance of incremental schema locater if loading is disabled\", async () => {\r\n await using env = await TestContext.create({ incrementalSchemaLoading: \"disabled\" });\r\n const locaters = env.iModel.schemaContext.locaters;\r\n const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);\r\n expect(incrementalLocater).to.be.undefined;\r\n });\r\n\r\n it(\"schema context should have an instance of incremental schema locater if loading is enabled\", async () => {\r\n await using env = await TestContext.create({ incrementalSchemaLoading: \"enabled\" });\r\n const locaters = env.iModel.schemaContext.locaters;\r\n const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);\r\n expect(incrementalLocater).to.be.not.undefined;\r\n });\r\n\r\n it(\"schema context should not have an instance of incremental schema locater if loading is not specified\", async () => {\r\n await using env = await TestContext.create({ incrementalSchemaLoading: undefined });\r\n const locaters = env.iModel.schemaContext.locaters;\r\n const incrementalLocater = locaters.find((locater) => locater instanceof IModelIncrementalSchemaLocater);\r\n expect(incrementalLocater).to.be.undefined;\r\n });\r\n });\r\n});\r\n"]}