@itwin/core-backend 5.3.0-dev.24 → 5.3.0-dev.26

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 (83) hide show
  1. package/lib/cjs/Element.d.ts +29 -1
  2. package/lib/cjs/Element.d.ts.map +1 -1
  3. package/lib/cjs/Element.js +53 -1
  4. package/lib/cjs/Element.js.map +1 -1
  5. package/lib/cjs/ElementAspect.d.ts +24 -1
  6. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  7. package/lib/cjs/ElementAspect.js +102 -1
  8. package/lib/cjs/ElementAspect.js.map +1 -1
  9. package/lib/cjs/IModelDb.d.ts +11 -0
  10. package/lib/cjs/IModelDb.d.ts.map +1 -1
  11. package/lib/cjs/IModelDb.js +18 -0
  12. package/lib/cjs/IModelDb.js.map +1 -1
  13. package/lib/cjs/NavigationRelationship.d.ts +15 -0
  14. package/lib/cjs/NavigationRelationship.d.ts.map +1 -1
  15. package/lib/cjs/NavigationRelationship.js +22 -1
  16. package/lib/cjs/NavigationRelationship.js.map +1 -1
  17. package/lib/cjs/Relationship.d.ts +5 -0
  18. package/lib/cjs/Relationship.d.ts.map +1 -1
  19. package/lib/cjs/Relationship.js +7 -0
  20. package/lib/cjs/Relationship.js.map +1 -1
  21. package/lib/cjs/TxnManager.js.map +1 -1
  22. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  23. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +3 -3
  24. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  25. package/lib/cjs/annotations/LeaderGeometry.d.ts +13 -1
  26. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  27. package/lib/cjs/annotations/LeaderGeometry.js +88 -10
  28. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  29. package/lib/cjs/annotations/TextAnnotationElement.d.ts +1 -1
  30. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  31. package/lib/cjs/annotations/TextAnnotationElement.js +7 -3
  32. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  33. package/lib/esm/Element.d.ts +29 -1
  34. package/lib/esm/Element.d.ts.map +1 -1
  35. package/lib/esm/Element.js +53 -2
  36. package/lib/esm/Element.js.map +1 -1
  37. package/lib/esm/ElementAspect.d.ts +24 -1
  38. package/lib/esm/ElementAspect.d.ts.map +1 -1
  39. package/lib/esm/ElementAspect.js +101 -1
  40. package/lib/esm/ElementAspect.js.map +1 -1
  41. package/lib/esm/IModelDb.d.ts +11 -0
  42. package/lib/esm/IModelDb.d.ts.map +1 -1
  43. package/lib/esm/IModelDb.js +18 -0
  44. package/lib/esm/IModelDb.js.map +1 -1
  45. package/lib/esm/NavigationRelationship.d.ts +15 -0
  46. package/lib/esm/NavigationRelationship.d.ts.map +1 -1
  47. package/lib/esm/NavigationRelationship.js +19 -0
  48. package/lib/esm/NavigationRelationship.js.map +1 -1
  49. package/lib/esm/Relationship.d.ts +5 -0
  50. package/lib/esm/Relationship.d.ts.map +1 -1
  51. package/lib/esm/Relationship.js +7 -0
  52. package/lib/esm/Relationship.js.map +1 -1
  53. package/lib/esm/TxnManager.js.map +1 -1
  54. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  55. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +3 -3
  56. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  57. package/lib/esm/annotations/LeaderGeometry.d.ts +13 -1
  58. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  59. package/lib/esm/annotations/LeaderGeometry.js +89 -12
  60. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  61. package/lib/esm/annotations/TextAnnotationElement.d.ts +1 -1
  62. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  63. package/lib/esm/annotations/TextAnnotationElement.js +7 -3
  64. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  65. package/lib/esm/test/annotations/LeaderGeometry.test.js +47 -2
  66. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  67. package/lib/esm/test/annotations/TextAnnotation.test.js +46 -5
  68. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  69. package/lib/esm/test/element/ProjectInformationRecord.test.d.ts +2 -0
  70. package/lib/esm/test/element/ProjectInformationRecord.test.d.ts.map +1 -0
  71. package/lib/esm/test/element/ProjectInformationRecord.test.js +80 -0
  72. package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -0
  73. package/lib/esm/test/element/SheetInformationAspect.test.d.ts +2 -0
  74. package/lib/esm/test/element/SheetInformationAspect.test.d.ts.map +1 -0
  75. package/lib/esm/test/element/SheetInformationAspect.test.js +182 -0
  76. package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -0
  77. package/lib/esm/test/imodel/IModel.test.js +130 -2
  78. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  79. package/lib/esm/test/standalone/ChangesetReader.test.js +39 -30
  80. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  81. package/lib/esm/test/standalone/TxnManager.test.js +33 -5
  82. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  83. package/package.json +13 -13
@@ -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.isTrue(adaptor.inserted.$meta.fallbackClassId.startsWith("0x"));
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.isTrue(adaptor.deleted.$meta.fallbackClassId.startsWith("0x"));
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");
@@ -304,9 +311,10 @@ describe("Changeset Reader API", async () => {
304
311
  assert.deepEqual(el.BBoxLow, { X: -25, Y: -25 });
305
312
  // eslint-disable-next-line @typescript-eslint/naming-convention
306
313
  assert.deepEqual(el.BBoxHigh, { X: 15, Y: 15 });
307
- // eslint-disable-next-line @typescript-eslint/naming-convention
308
314
  assert.equal(el.Category.Id, "0x20000000002");
309
- assert.isTrue(el.Category.RelECClassId.startsWith("0x"));
315
+ assert.isNotEmpty(el.Category.RelECClassId);
316
+ const categoryRelClass = await getClassNameById(rwIModel, el.Category.RelECClassId);
317
+ assert.equal("BisCore:GeometricElement2dIsInCategory", categoryRelClass);
310
318
  assert.equal(el.s, "xxxxxxxxx");
311
319
  assert.isNull(el.CodeValue);
312
320
  assert.isNull(el.UserLabel);
@@ -318,15 +326,14 @@ describe("Changeset Reader API", async () => {
318
326
  assert.deepEqual(el.Parent, { Id: null, RelECClassId: null });
319
327
  // eslint-disable-next-line @typescript-eslint/naming-convention
320
328
  assert.deepEqual(el.TypeDefinition, { Id: null, RelECClassId: null });
321
- // 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
329
  assert.equal(el.CodeSpec.Id, "0x1");
326
- assert.isTrue(el.CodeSpec.RelECClassId.startsWith("0x"));
327
- // eslint-disable-next-line @typescript-eslint/naming-convention
330
+ assert.isNotEmpty(el.CodeSpec.RelECClassId);
331
+ const codeSpecRelClass = await getClassNameById(rwIModel, el.CodeSpec.RelECClassId);
332
+ assert.equal("BisCore:CodeSpecSpecifiesCode", codeSpecRelClass);
328
333
  assert.equal(el.CodeScope.Id, "0x1");
329
- assert.isTrue(el.CodeScope.RelECClassId.startsWith("0x"));
334
+ assert.isNotEmpty(el.CodeScope.RelECClassId);
335
+ const codeScopeRelClass = await getClassNameById(rwIModel, el.CodeScope.RelECClassId);
336
+ assert.equal("BisCore:ElementScopesCode", codeScopeRelClass);
330
337
  assert.deepEqual(el.$meta, {
331
338
  tables: [
332
339
  "bis_GeometricElement2d",
@@ -350,7 +357,7 @@ describe("Changeset Reader API", async () => {
350
357
  while (adaptor.step()) {
351
358
  pcu.appendFrom(adaptor);
352
359
  }
353
- testChanges(Array.from(pcu.instances));
360
+ await testChanges(Array.from(pcu.instances));
354
361
  }
355
362
  catch (e_1) {
356
363
  env_1.error = e_1;
@@ -369,7 +376,7 @@ describe("Changeset Reader API", async () => {
369
376
  while (adaptor.step()) {
370
377
  pcu.appendFrom(adaptor);
371
378
  }
372
- testChanges(Array.from(pcu.instances));
379
+ await testChanges(Array.from(pcu.instances));
373
380
  }
374
381
  catch (e_2) {
375
382
  env_2.error = e_2;
@@ -505,7 +512,7 @@ describe("Changeset Reader API", async () => {
505
512
  }
506
513
  }
507
514
  if (true || "test changeset file") {
508
- const testChanges = (changes) => {
515
+ const testChanges = async (changes) => {
509
516
  assert.equal(changes.length, 3);
510
517
  assert.equal(changes[0].ECInstanceId, "0x20000000001");
511
518
  assert.equal(changes[0].$meta?.classFullName, "BisCore:DrawingModel");
@@ -531,9 +538,10 @@ describe("Changeset Reader API", async () => {
531
538
  assert.deepEqual(el.BBoxLow, { X: -25, Y: -25 });
532
539
  // eslint-disable-next-line @typescript-eslint/naming-convention
533
540
  assert.deepEqual(el.BBoxHigh, { X: 15, Y: 15 });
534
- // eslint-disable-next-line @typescript-eslint/naming-convention
535
541
  assert.equal(el.Category.Id, "0x20000000002");
536
- assert.isTrue(el.Category.RelECClassId.startsWith("0x"));
542
+ assert.isNotEmpty(el.Category.RelECClassId);
543
+ const categoryRelClass = await getClassNameById(rwIModel, el.Category.RelECClassId);
544
+ assert.equal("BisCore:GeometricElement2dIsInCategory", categoryRelClass);
537
545
  assert.equal(el.s, "xxxxxxxxx");
538
546
  assert.isNull(el.CodeValue);
539
547
  assert.isNull(el.UserLabel);
@@ -545,15 +553,14 @@ describe("Changeset Reader API", async () => {
545
553
  assert.deepEqual(el.Parent, { Id: null, RelECClassId: null });
546
554
  // eslint-disable-next-line @typescript-eslint/naming-convention
547
555
  assert.deepEqual(el.TypeDefinition, { Id: null, RelECClassId: null });
548
- // 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
556
  assert.equal(el.CodeSpec.Id, "0x1");
553
- assert.isTrue(el.CodeSpec.RelECClassId.startsWith("0x"));
554
- // eslint-disable-next-line @typescript-eslint/naming-convention
557
+ assert.isNotEmpty(el.CodeSpec.RelECClassId);
558
+ const codeSpecRelClass = await getClassNameById(rwIModel, el.CodeSpec.RelECClassId);
559
+ assert.equal("BisCore:CodeSpecSpecifiesCode", codeSpecRelClass);
555
560
  assert.equal(el.CodeScope.Id, "0x1");
556
- assert.isTrue(el.CodeScope.RelECClassId.startsWith("0x"));
561
+ assert.isNotEmpty(el.CodeScope.RelECClassId);
562
+ const codeScopeRelClass = await getClassNameById(rwIModel, el.CodeScope.RelECClassId);
563
+ assert.equal("BisCore:ElementScopesCode", codeScopeRelClass);
557
564
  assert.deepEqual(el.$meta, {
558
565
  tables: [
559
566
  "bis_GeometricElement2d",
@@ -577,7 +584,7 @@ describe("Changeset Reader API", async () => {
577
584
  while (adaptor.step()) {
578
585
  pcu.appendFrom(adaptor);
579
586
  }
580
- testChanges(Array.from(pcu.instances));
587
+ await testChanges(Array.from(pcu.instances));
581
588
  }
582
589
  catch (e_7) {
583
590
  env_7.error = e_7;
@@ -596,7 +603,7 @@ describe("Changeset Reader API", async () => {
596
603
  while (adaptor.step()) {
597
604
  pcu.appendFrom(adaptor);
598
605
  }
599
- testChanges(Array.from(pcu.instances));
606
+ await testChanges(Array.from(pcu.instances));
600
607
  }
601
608
  catch (e_8) {
602
609
  env_8.error = e_8;
@@ -1341,6 +1348,7 @@ describe("Changeset Reader API", async () => {
1341
1348
  await rwIModel.locks.acquireLocks({ shared: drawingModelId });
1342
1349
  const e1id = rwIModel.elements.insertElement(e1);
1343
1350
  assert.isTrue(Id64.isValidId64(e1id), "insert worked");
1351
+ const testElClassId = getClassIdByName(rwIModel, "Test2dElement");
1344
1352
  if (true) {
1345
1353
  const reader = SqliteChangesetReader.openInMemory({ db: rwIModel, disableSchemaCheck: true });
1346
1354
  const adaptor = new ChangesetECAdaptor(reader);
@@ -1356,7 +1364,7 @@ describe("Changeset Reader API", async () => {
1356
1364
  expect(testEl.$meta?.op).to.equals("Inserted");
1357
1365
  expect(testEl.$meta?.classFullName).to.equals("TestDomain:Test2dElement");
1358
1366
  expect(testEl.$meta?.stage).to.equals("New");
1359
- expect(testEl.ECClassId.startsWith("0x")).to.be.true;
1367
+ expect(testEl.ECClassId).to.equals(testElClassId);
1360
1368
  expect(testEl.ECInstanceId).to.equals(e1id);
1361
1369
  expect(testEl.Model.Id).to.equals(drawingModelId);
1362
1370
  expect(testEl.Category.Id).to.equals(drawingCategoryId);
@@ -1384,12 +1392,13 @@ describe("Changeset Reader API", async () => {
1384
1392
  // verify the inserted element's properties
1385
1393
  const instances = Array.from(unifier.instances);
1386
1394
  expect(instances.length).to.equals(3);
1395
+ const drawingModelClassId = getClassIdByName(rwIModel, "DrawingModel");
1387
1396
  // DrawingModel new instance
1388
1397
  const drawingModelElNew = instances[0];
1389
1398
  expect(drawingModelElNew.$meta?.op).to.equals("Updated");
1390
1399
  expect(drawingModelElNew.$meta?.classFullName).to.equals("BisCore:DrawingModel");
1391
1400
  expect(drawingModelElNew.$meta?.stage).to.equals("New");
1392
- expect(drawingModelElNew.ECClassId.startsWith("0x")).to.be.true;
1401
+ expect(drawingModelElNew.ECClassId).to.equals(drawingModelClassId);
1393
1402
  expect(drawingModelElNew.ECInstanceId).to.equals(drawingModelId);
1394
1403
  expect(drawingModelElNew.LastMod).to.exist;
1395
1404
  expect(drawingModelElNew.GeometryGuid).to.exist;
@@ -1398,7 +1407,7 @@ describe("Changeset Reader API", async () => {
1398
1407
  expect(drawingModelElOld.$meta?.op).to.equals("Updated");
1399
1408
  expect(drawingModelElOld.$meta?.classFullName).to.equals("BisCore:DrawingModel");
1400
1409
  expect(drawingModelElOld.$meta?.stage).to.equals("Old");
1401
- expect(drawingModelElOld.ECClassId.startsWith("0x")).to.be.true;
1410
+ expect(drawingModelElOld.ECClassId).to.equals(drawingModelClassId);
1402
1411
  expect(drawingModelElOld.ECInstanceId).to.equals(drawingModelId);
1403
1412
  expect(drawingModelElOld.LastMod).to.null;
1404
1413
  expect(drawingModelElOld.GeometryGuid).to.null;
@@ -1407,7 +1416,7 @@ describe("Changeset Reader API", async () => {
1407
1416
  expect(testEl.$meta?.op).to.equals("Inserted");
1408
1417
  expect(testEl.$meta?.classFullName).to.equals("TestDomain:Test2dElement");
1409
1418
  expect(testEl.$meta?.stage).to.equals("New");
1410
- expect(testEl.ECClassId.startsWith("0x")).to.be.true;
1419
+ expect(testEl.ECClassId).to.equals(testElClassId);
1411
1420
  expect(testEl.ECInstanceId).to.equals(e1id);
1412
1421
  expect(testEl.Model.Id).to.equals(drawingModelId);
1413
1422
  expect(testEl.Category.Id).to.equals(drawingCategoryId);