@itwin/core-backend 5.3.0-dev.24 → 5.3.0-dev.25
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.
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +5 -0
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +7 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +3 -3
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/Relationship.d.ts +5 -0
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +7 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +3 -3
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +99 -1
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +39 -24
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +33 -5
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/package.json +14 -14
|
@@ -163,6 +163,7 @@ describe("Changeset Reader API", async () => {
|
|
|
163
163
|
expect(rwIModel[_nativeDb].executeSql("UPDATE ec_Table SET ExclusiveRootClassId=NULL WHERE Name='bis_GeometricElement2d_Overflow'")).to.be.eq(DbResult.BE_SQLITE_OK);
|
|
164
164
|
const adaptor = new ECChangesetAdaptor(reader);
|
|
165
165
|
let assertOnOverflowTable = false;
|
|
166
|
+
const classId = getClassIdByName(rwIModel, "GeometricElement2d");
|
|
166
167
|
while (adaptor.step()) {
|
|
167
168
|
if (adaptor.op === "Updated" && adaptor.inserted?.$meta?.tables[0] === "bis_GeometricElement2d_Overflow") {
|
|
168
169
|
assert.isUndefined(adaptor.inserted.ECClassId);
|
|
@@ -170,7 +171,7 @@ describe("Changeset Reader API", async () => {
|
|
|
170
171
|
assert.deepEqual(adaptor.inserted.$meta?.tables, ["bis_GeometricElement2d_Overflow"]);
|
|
171
172
|
assert.equal(adaptor.inserted.$meta?.op, "Updated");
|
|
172
173
|
assert.equal(adaptor.inserted.$meta?.classFullName, "BisCore:GeometricElement2d");
|
|
173
|
-
assert.
|
|
174
|
+
assert.equal(adaptor.inserted.$meta.fallbackClassId, classId);
|
|
174
175
|
assert.deepEqual(adaptor.inserted.$meta?.changeIndexes, [3]);
|
|
175
176
|
assert.equal(adaptor.inserted.$meta?.stage, "New");
|
|
176
177
|
assert.equal(adaptor.deleted.ECInstanceId, "");
|
|
@@ -178,7 +179,7 @@ describe("Changeset Reader API", async () => {
|
|
|
178
179
|
assert.deepEqual(adaptor.deleted.$meta?.tables, ["bis_GeometricElement2d_Overflow"]);
|
|
179
180
|
assert.equal(adaptor.deleted.$meta?.op, "Updated");
|
|
180
181
|
assert.equal(adaptor.deleted.$meta?.classFullName, "BisCore:GeometricElement2d");
|
|
181
|
-
assert.
|
|
182
|
+
assert.equal(adaptor.deleted.$meta.fallbackClassId, classId);
|
|
182
183
|
assert.deepEqual(adaptor.deleted.$meta?.changeIndexes, [3]);
|
|
183
184
|
assert.equal(adaptor.deleted.$meta?.stage, "Old");
|
|
184
185
|
assertOnOverflowTable = true;
|
|
@@ -195,6 +196,12 @@ describe("Changeset Reader API", async () => {
|
|
|
195
196
|
return stmt.getValue(0).getId();
|
|
196
197
|
});
|
|
197
198
|
}
|
|
199
|
+
async function getClassNameById(iModel, classId) {
|
|
200
|
+
const reader = iModel.createQueryReader(`select ec_classname(${classId});`);
|
|
201
|
+
if (await reader.step())
|
|
202
|
+
return reader.current[0];
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
198
205
|
it("Changeset reader / EC adaptor", async () => {
|
|
199
206
|
const adminToken = "super manager token";
|
|
200
207
|
const iModelName = "test";
|
|
@@ -278,7 +285,7 @@ describe("Changeset Reader API", async () => {
|
|
|
278
285
|
};
|
|
279
286
|
rwIModel.saveChanges("user 1: data");
|
|
280
287
|
if (true || "test local changes") {
|
|
281
|
-
const testChanges = (changes) => {
|
|
288
|
+
const testChanges = async (changes) => {
|
|
282
289
|
assert.equal(changes.length, 3);
|
|
283
290
|
assert.equal(changes[0].ECInstanceId, "0x20000000001");
|
|
284
291
|
assert.equal(changes[0].$meta?.classFullName, "BisCore:DrawingModel");
|
|
@@ -306,7 +313,9 @@ describe("Changeset Reader API", async () => {
|
|
|
306
313
|
assert.deepEqual(el.BBoxHigh, { X: 15, Y: 15 });
|
|
307
314
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
308
315
|
assert.equal(el.Category.Id, "0x20000000002");
|
|
309
|
-
assert.
|
|
316
|
+
assert.isNotEmpty(el.Category.RelECClassId);
|
|
317
|
+
const categoryRelClass = await getClassNameById(rwIModel, el.Category.RelECClassId);
|
|
318
|
+
assert.equal("BisCore:GeometricElement2dIsInCategory", categoryRelClass);
|
|
310
319
|
assert.equal(el.s, "xxxxxxxxx");
|
|
311
320
|
assert.isNull(el.CodeValue);
|
|
312
321
|
assert.isNull(el.UserLabel);
|
|
@@ -319,14 +328,15 @@ describe("Changeset Reader API", async () => {
|
|
|
319
328
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
320
329
|
assert.deepEqual(el.TypeDefinition, { Id: null, RelECClassId: null });
|
|
321
330
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
322
|
-
assert.equal(el.Category.Id, "0x20000000002");
|
|
323
|
-
assert.isTrue(el.Category.RelECClassId.startsWith("0x"));
|
|
324
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
325
331
|
assert.equal(el.CodeSpec.Id, "0x1");
|
|
326
|
-
assert.
|
|
332
|
+
assert.isNotEmpty(el.CodeSpec.RelECClassId);
|
|
333
|
+
const codeSpecRelClass = await getClassNameById(rwIModel, el.CodeSpec.RelECClassId);
|
|
334
|
+
assert.equal("BisCore:CodeSpecSpecifiesCode", codeSpecRelClass);
|
|
327
335
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
328
336
|
assert.equal(el.CodeScope.Id, "0x1");
|
|
329
|
-
assert.
|
|
337
|
+
assert.isNotEmpty(el.CodeScope.RelECClassId);
|
|
338
|
+
const codeScopeRelClass = await getClassNameById(rwIModel, el.CodeScope.RelECClassId);
|
|
339
|
+
assert.equal("BisCore:ElementScopesCode", codeScopeRelClass);
|
|
330
340
|
assert.deepEqual(el.$meta, {
|
|
331
341
|
tables: [
|
|
332
342
|
"bis_GeometricElement2d",
|
|
@@ -350,7 +360,7 @@ describe("Changeset Reader API", async () => {
|
|
|
350
360
|
while (adaptor.step()) {
|
|
351
361
|
pcu.appendFrom(adaptor);
|
|
352
362
|
}
|
|
353
|
-
testChanges(Array.from(pcu.instances));
|
|
363
|
+
await testChanges(Array.from(pcu.instances));
|
|
354
364
|
}
|
|
355
365
|
catch (e_1) {
|
|
356
366
|
env_1.error = e_1;
|
|
@@ -369,7 +379,7 @@ describe("Changeset Reader API", async () => {
|
|
|
369
379
|
while (adaptor.step()) {
|
|
370
380
|
pcu.appendFrom(adaptor);
|
|
371
381
|
}
|
|
372
|
-
testChanges(Array.from(pcu.instances));
|
|
382
|
+
await testChanges(Array.from(pcu.instances));
|
|
373
383
|
}
|
|
374
384
|
catch (e_2) {
|
|
375
385
|
env_2.error = e_2;
|
|
@@ -505,7 +515,7 @@ describe("Changeset Reader API", async () => {
|
|
|
505
515
|
}
|
|
506
516
|
}
|
|
507
517
|
if (true || "test changeset file") {
|
|
508
|
-
const testChanges = (changes) => {
|
|
518
|
+
const testChanges = async (changes) => {
|
|
509
519
|
assert.equal(changes.length, 3);
|
|
510
520
|
assert.equal(changes[0].ECInstanceId, "0x20000000001");
|
|
511
521
|
assert.equal(changes[0].$meta?.classFullName, "BisCore:DrawingModel");
|
|
@@ -533,7 +543,9 @@ describe("Changeset Reader API", async () => {
|
|
|
533
543
|
assert.deepEqual(el.BBoxHigh, { X: 15, Y: 15 });
|
|
534
544
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
535
545
|
assert.equal(el.Category.Id, "0x20000000002");
|
|
536
|
-
assert.
|
|
546
|
+
assert.isNotEmpty(el.Category.RelECClassId);
|
|
547
|
+
const categoryRelClass = await getClassNameById(rwIModel, el.Category.RelECClassId);
|
|
548
|
+
assert.equal("BisCore:GeometricElement2dIsInCategory", categoryRelClass);
|
|
537
549
|
assert.equal(el.s, "xxxxxxxxx");
|
|
538
550
|
assert.isNull(el.CodeValue);
|
|
539
551
|
assert.isNull(el.UserLabel);
|
|
@@ -546,14 +558,15 @@ describe("Changeset Reader API", async () => {
|
|
|
546
558
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
547
559
|
assert.deepEqual(el.TypeDefinition, { Id: null, RelECClassId: null });
|
|
548
560
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
549
|
-
assert.equal(el.Category.Id, "0x20000000002");
|
|
550
|
-
assert.isTrue(el.Category.RelECClassId.startsWith("0x"));
|
|
551
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
552
561
|
assert.equal(el.CodeSpec.Id, "0x1");
|
|
553
|
-
assert.
|
|
562
|
+
assert.isNotEmpty(el.CodeSpec.RelECClassId);
|
|
563
|
+
const codeSpecRelClass = await getClassNameById(rwIModel, el.CodeSpec.RelECClassId);
|
|
564
|
+
assert.equal("BisCore:CodeSpecSpecifiesCode", codeSpecRelClass);
|
|
554
565
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
555
566
|
assert.equal(el.CodeScope.Id, "0x1");
|
|
556
|
-
assert.
|
|
567
|
+
assert.isNotEmpty(el.CodeScope.RelECClassId);
|
|
568
|
+
const codeScopeRelClass = await getClassNameById(rwIModel, el.CodeScope.RelECClassId);
|
|
569
|
+
assert.equal("BisCore:ElementScopesCode", codeScopeRelClass);
|
|
557
570
|
assert.deepEqual(el.$meta, {
|
|
558
571
|
tables: [
|
|
559
572
|
"bis_GeometricElement2d",
|
|
@@ -577,7 +590,7 @@ describe("Changeset Reader API", async () => {
|
|
|
577
590
|
while (adaptor.step()) {
|
|
578
591
|
pcu.appendFrom(adaptor);
|
|
579
592
|
}
|
|
580
|
-
testChanges(Array.from(pcu.instances));
|
|
593
|
+
await testChanges(Array.from(pcu.instances));
|
|
581
594
|
}
|
|
582
595
|
catch (e_7) {
|
|
583
596
|
env_7.error = e_7;
|
|
@@ -596,7 +609,7 @@ describe("Changeset Reader API", async () => {
|
|
|
596
609
|
while (adaptor.step()) {
|
|
597
610
|
pcu.appendFrom(adaptor);
|
|
598
611
|
}
|
|
599
|
-
testChanges(Array.from(pcu.instances));
|
|
612
|
+
await testChanges(Array.from(pcu.instances));
|
|
600
613
|
}
|
|
601
614
|
catch (e_8) {
|
|
602
615
|
env_8.error = e_8;
|
|
@@ -1341,6 +1354,7 @@ describe("Changeset Reader API", async () => {
|
|
|
1341
1354
|
await rwIModel.locks.acquireLocks({ shared: drawingModelId });
|
|
1342
1355
|
const e1id = rwIModel.elements.insertElement(e1);
|
|
1343
1356
|
assert.isTrue(Id64.isValidId64(e1id), "insert worked");
|
|
1357
|
+
const testElClassId = getClassIdByName(rwIModel, "Test2dElement");
|
|
1344
1358
|
if (true) {
|
|
1345
1359
|
const reader = SqliteChangesetReader.openInMemory({ db: rwIModel, disableSchemaCheck: true });
|
|
1346
1360
|
const adaptor = new ChangesetECAdaptor(reader);
|
|
@@ -1356,7 +1370,7 @@ describe("Changeset Reader API", async () => {
|
|
|
1356
1370
|
expect(testEl.$meta?.op).to.equals("Inserted");
|
|
1357
1371
|
expect(testEl.$meta?.classFullName).to.equals("TestDomain:Test2dElement");
|
|
1358
1372
|
expect(testEl.$meta?.stage).to.equals("New");
|
|
1359
|
-
expect(testEl.ECClassId
|
|
1373
|
+
expect(testEl.ECClassId).to.equals(testElClassId);
|
|
1360
1374
|
expect(testEl.ECInstanceId).to.equals(e1id);
|
|
1361
1375
|
expect(testEl.Model.Id).to.equals(drawingModelId);
|
|
1362
1376
|
expect(testEl.Category.Id).to.equals(drawingCategoryId);
|
|
@@ -1384,12 +1398,13 @@ describe("Changeset Reader API", async () => {
|
|
|
1384
1398
|
// verify the inserted element's properties
|
|
1385
1399
|
const instances = Array.from(unifier.instances);
|
|
1386
1400
|
expect(instances.length).to.equals(3);
|
|
1401
|
+
const drawingModelClassId = getClassIdByName(rwIModel, "DrawingModel");
|
|
1387
1402
|
// DrawingModel new instance
|
|
1388
1403
|
const drawingModelElNew = instances[0];
|
|
1389
1404
|
expect(drawingModelElNew.$meta?.op).to.equals("Updated");
|
|
1390
1405
|
expect(drawingModelElNew.$meta?.classFullName).to.equals("BisCore:DrawingModel");
|
|
1391
1406
|
expect(drawingModelElNew.$meta?.stage).to.equals("New");
|
|
1392
|
-
expect(drawingModelElNew.ECClassId
|
|
1407
|
+
expect(drawingModelElNew.ECClassId).to.equals(drawingModelClassId);
|
|
1393
1408
|
expect(drawingModelElNew.ECInstanceId).to.equals(drawingModelId);
|
|
1394
1409
|
expect(drawingModelElNew.LastMod).to.exist;
|
|
1395
1410
|
expect(drawingModelElNew.GeometryGuid).to.exist;
|
|
@@ -1398,7 +1413,7 @@ describe("Changeset Reader API", async () => {
|
|
|
1398
1413
|
expect(drawingModelElOld.$meta?.op).to.equals("Updated");
|
|
1399
1414
|
expect(drawingModelElOld.$meta?.classFullName).to.equals("BisCore:DrawingModel");
|
|
1400
1415
|
expect(drawingModelElOld.$meta?.stage).to.equals("Old");
|
|
1401
|
-
expect(drawingModelElOld.ECClassId
|
|
1416
|
+
expect(drawingModelElOld.ECClassId).to.equals(drawingModelClassId);
|
|
1402
1417
|
expect(drawingModelElOld.ECInstanceId).to.equals(drawingModelId);
|
|
1403
1418
|
expect(drawingModelElOld.LastMod).to.null;
|
|
1404
1419
|
expect(drawingModelElOld.GeometryGuid).to.null;
|
|
@@ -1407,7 +1422,7 @@ describe("Changeset Reader API", async () => {
|
|
|
1407
1422
|
expect(testEl.$meta?.op).to.equals("Inserted");
|
|
1408
1423
|
expect(testEl.$meta?.classFullName).to.equals("TestDomain:Test2dElement");
|
|
1409
1424
|
expect(testEl.$meta?.stage).to.equals("New");
|
|
1410
|
-
expect(testEl.ECClassId
|
|
1425
|
+
expect(testEl.ECClassId).to.equals(testElClassId);
|
|
1411
1426
|
expect(testEl.ECInstanceId).to.equals(e1id);
|
|
1412
1427
|
expect(testEl.Model.Id).to.equals(drawingModelId);
|
|
1413
1428
|
expect(testEl.Category.Id).to.equals(drawingCategoryId);
|