imodel 0.14.0 → 0.15.0

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * imodel v0.14.0
2
+ * imodel v0.15.0
3
3
  * (c) 2019-2026 undefined
4
4
  * @license undefined
5
5
  */
@@ -684,7 +684,7 @@ type FieldValue<T extends Fields> = {
684
684
  interface IndexOptions {
685
685
  unique?: boolean;
686
686
  name?: string;
687
- include?: string[];
687
+ includes?: string[];
688
688
  }
689
689
  interface IndexInfo extends IndexOptions {
690
690
  fields: string[];
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * imodel v0.14.0
2
+ * imodel v0.15.0
3
3
  * (c) 2019-2026 undefined
4
4
  * @license undefined
5
5
  */
@@ -2324,7 +2324,7 @@ async function pseudoDeleteMany(conn, queryable, update, env) {
2324
2324
  return list.length;
2325
2325
  }
2326
2326
 
2327
- /** @import { TableDefine } from '../types/table' */
2327
+ /** @import { TableDefine, FieldDefine } from '../types/table' */
2328
2328
  /** @import { DBIndex, DBTable } from '../types/connection' */
2329
2329
  /**
2330
2330
  *
@@ -2414,8 +2414,32 @@ function table2db(tables) {
2414
2414
  old.nullable = nullable ?? old.nullable;
2415
2415
  }
2416
2416
  }
2417
+ /**
2418
+ *
2419
+ * @param {string} f
2420
+ */
2421
+ function toColumn(f) {
2422
+ const field = Object.hasOwn(fields, f) && fields[f];
2423
+ if (!field) {
2424
+ return f;
2425
+ }
2426
+ if (!Object.hasOwn(field, 'column')) {
2427
+ return f;
2428
+ }
2429
+ const {
2430
+ column
2431
+ } = /** @type {FieldDefine} */field;
2432
+ if (!column || typeof column !== 'string') {
2433
+ return f;
2434
+ }
2435
+ return column;
2436
+ }
2417
2437
  for (const index of indexes || []) {
2418
- t.indexes.push(index);
2438
+ t.indexes.push({
2439
+ ...index,
2440
+ fields: index.fields.map(toColumn),
2441
+ includes: index.includes?.map(toColumn)
2442
+ });
2419
2443
  }
2420
2444
  }
2421
2445
  for (const {
package/migrate.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * imodel v0.14.0
2
+ * imodel v0.15.0
3
3
  * (c) 2019-2026 undefined
4
4
  * @license undefined
5
5
  */
package/migrate.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * imodel v0.14.0
2
+ * imodel v0.15.0
3
3
  * (c) 2019-2026 undefined
4
4
  * @license undefined
5
5
  */
@@ -438,13 +438,13 @@ class TableDrop {
438
438
  })));
439
439
  for (const {
440
440
  unique,
441
- include,
441
+ includes,
442
442
  fields,
443
443
  name
444
444
  } of _indexes.map(c => indexes[c])) {
445
445
  await connection.addIndex(table, name, fields, {
446
446
  unique,
447
- include
447
+ includes
448
448
  });
449
449
  }
450
450
  }
@@ -726,11 +726,11 @@ class TableModifier extends TableAdder {
726
726
  const [, name, {
727
727
  fields,
728
728
  unique,
729
- include
729
+ includes
730
730
  }] = t;
731
731
  await connection.addIndex(table, name, fields, {
732
732
  unique,
733
- include
733
+ includes
734
734
  });
735
735
  break;
736
736
  }
@@ -795,11 +795,11 @@ class TableModifier extends TableAdder {
795
795
  const {
796
796
  fields,
797
797
  unique,
798
- include
798
+ includes
799
799
  } = index;
800
800
  await connection.addIndex(table, t[1], fields, {
801
801
  unique,
802
- include
802
+ includes
803
803
  });
804
804
  break;
805
805
  }
@@ -943,13 +943,13 @@ class TableCreator extends TableAdder {
943
943
  await connection.createTable(table, fields);
944
944
  for (const {
945
945
  unique,
946
- include,
946
+ includes,
947
947
  fields,
948
948
  name
949
949
  } of indexes) {
950
950
  await connection.addIndex(table, name, fields, {
951
951
  unique,
952
- include
952
+ includes
953
953
  });
954
954
  }
955
955
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imodel",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "main": "index.mjs",
5
5
  "type": "module",
6
6
  "repository": {