arkormx 2.9.2 → 2.9.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.
package/dist/cli.mjs CHANGED
@@ -117,10 +117,10 @@ var RuntimeModuleLoader = class {
117
117
  *
118
118
  * Each returned entry carries either the loaded module or the last error,
119
119
  * so callers can surface genuine failures instead of silently dropping them.
120
- *
121
- * @param filePaths
122
- * @param useDefault
123
- * @returns
120
+ *
121
+ * @param filePaths
122
+ * @param useDefault
123
+ * @returns
124
124
  */
125
125
  static async loadAll(filePaths, useDefault = false) {
126
126
  const jiti = createJiti(`${pathToFileURL(resolve(".")).href}/`, {
@@ -277,9 +277,9 @@ const getLatestAppliedMigrations = (state, steps) => {
277
277
  //#endregion
278
278
  //#region src/database/ForeignKeyBuilder.ts
279
279
  /**
280
- * The ForeignKeyBuilder class provides a fluent interface for defining
281
- * foreign key constraints in a migration. It allows you to specify
282
- * the referenced table and column, as well as actions to take on
280
+ * The ForeignKeyBuilder class provides a fluent interface for defining
281
+ * foreign key constraints in a migration. It allows you to specify
282
+ * the referenced table and column, as well as actions to take on
283
283
  * delete and aliases for the relation.
284
284
  *
285
285
  * @author Legacy (3m1n3nc3)
@@ -291,10 +291,10 @@ var ForeignKeyBuilder = class {
291
291
  }
292
292
  /**
293
293
  * Defines the referenced table and column for this foreign key constraint.
294
- *
295
- * @param table
296
- * @param column
297
- * @returns
294
+ *
295
+ * @param table
296
+ * @param column
297
+ * @returns
298
298
  */
299
299
  references(table, column) {
300
300
  this.foreignKey.referencesTable = table;
@@ -302,22 +302,22 @@ var ForeignKeyBuilder = class {
302
302
  return this;
303
303
  }
304
304
  /**
305
- * Defines the action to take when a referenced record is deleted, such
305
+ * Defines the action to take when a referenced record is deleted, such
306
306
  * as "CASCADE", "SET NULL", or "RESTRICT".
307
- *
308
- * @param action
309
- * @returns
307
+ *
308
+ * @param action
309
+ * @returns
310
310
  */
311
311
  onDelete(action) {
312
312
  this.foreignKey.onDelete = action;
313
313
  return this;
314
314
  }
315
315
  /**
316
- * Defines an alias for the relation represented by this foreign key, which
316
+ * Defines an alias for the relation represented by this foreign key, which
317
317
  * can be used in the ORM for more intuitive access to related models.
318
- *
319
- * @param name
320
- * @returns
318
+ *
319
+ * @param name
320
+ * @returns
321
321
  */
322
322
  alias(name) {
323
323
  this.foreignKey.relationAlias = name;
@@ -325,20 +325,20 @@ var ForeignKeyBuilder = class {
325
325
  }
326
326
  /**
327
327
  * Defines an alias for the inverse relation represented by this foreign key.
328
- *
329
- * @param name
330
- * @returns
328
+ *
329
+ * @param name
330
+ * @returns
331
331
  */
332
332
  inverseAlias(name) {
333
333
  this.foreignKey.inverseRelationAlias = name;
334
334
  return this;
335
335
  }
336
336
  /**
337
- * Defines an alias for the foreign key field itself, which can be
337
+ * Defines an alias for the foreign key field itself, which can be
338
338
  * used in the ORM for more intuitive access to the foreign key value.
339
- *
340
- * @param fieldName
341
- * @returns
339
+ *
340
+ * @param fieldName
341
+ * @returns
342
342
  */
343
343
  as(fieldName) {
344
344
  this.foreignKey.fieldAlias = fieldName;
@@ -457,7 +457,7 @@ var EnumBuilder = class {
457
457
  }
458
458
  };
459
459
  /**
460
- * The TableBuilder class provides a fluent interface for defining
460
+ * The TableBuilder class provides a fluent interface for defining
461
461
  * the structure of a database table in a migration, including columns to add or drop.
462
462
  *
463
463
  * @author Legacy (3m1n3nc3)
@@ -494,7 +494,7 @@ var TableBuilder = class {
494
494
  }
495
495
  /**
496
496
  * Defines an auto-incrementing primary key column.
497
- *
497
+ *
498
498
  * @param name The name of the primary key column.
499
499
  * @default 'id'
500
500
  * @returns The current TableBuilder instance for chaining.
@@ -504,7 +504,7 @@ var TableBuilder = class {
504
504
  }
505
505
  /**
506
506
  * Defines a UUID column in the table.
507
- *
507
+ *
508
508
  * @param name The name of the UUID column.
509
509
  * @param options Additional options for the UUID column.
510
510
  * @returns The current TableBuilder instance for chaining.
@@ -535,7 +535,7 @@ var TableBuilder = class {
535
535
  }
536
536
  /**
537
537
  * Defines a string column in the table.
538
- *
538
+ *
539
539
  * @param name The name of the string column.
540
540
  * @param options Additional options for the string column.
541
541
  * @returns The current TableBuilder instance for chaining.
@@ -545,7 +545,7 @@ var TableBuilder = class {
545
545
  }
546
546
  /**
547
547
  * Defines a text column in the table.
548
- *
548
+ *
549
549
  * @param name The name of the text column.
550
550
  * @param options Additional options for the text column.
551
551
  * @returns The current TableBuilder instance for chaining.
@@ -555,7 +555,7 @@ var TableBuilder = class {
555
555
  }
556
556
  /**
557
557
  * Defines an integer column in the table.
558
- *
558
+ *
559
559
  * @param name The name of the integer column.
560
560
  * @param options Additional options for the integer column.
561
561
  * @returns The current TableBuilder instance for chaining.
@@ -565,7 +565,7 @@ var TableBuilder = class {
565
565
  }
566
566
  /**
567
567
  * Defines a big integer column in the table.
568
- *
568
+ *
569
569
  * @param name The name of the big integer column.
570
570
  * @param options Additional options for the big integer column.
571
571
  * @returns The current TableBuilder instance for chaining.
@@ -575,7 +575,7 @@ var TableBuilder = class {
575
575
  }
576
576
  /**
577
577
  * Defines a float column in the table.
578
- *
578
+ *
579
579
  * @param name The name of the float column.
580
580
  * @param options Additional options for the float column.
581
581
  * @returns The current TableBuilder instance for chaining.
@@ -583,6 +583,22 @@ var TableBuilder = class {
583
583
  float(name, options = {}) {
584
584
  return this.column(name, "float", options);
585
585
  }
586
+ /**
587
+ * Defines a fixed-precision decimal column in the table.
588
+ *
589
+ * @param name The name of the decimal column.
590
+ * @param precision The total number of digits. Defaults to 8.
591
+ * @param scale The number of digits to the right of the point. Defaults to 2.
592
+ * @param options Additional options for the decimal column.
593
+ * @returns The current TableBuilder instance for chaining.
594
+ */
595
+ decimal(name, precision = 8, scale = 2, options = {}) {
596
+ return this.column(name, "decimal", {
597
+ precision,
598
+ scale,
599
+ ...options
600
+ });
601
+ }
586
602
  unique(columnsOrName, name) {
587
603
  if (Array.isArray(columnsOrName)) {
588
604
  const columns = this.normalizeCompositeColumns(columnsOrName, "unique constraint");
@@ -601,8 +617,8 @@ var TableBuilder = class {
601
617
  }
602
618
  /**
603
619
  * Defines a boolean column in the table.
604
- *
605
- * @param name The name of the boolean column.
620
+ *
621
+ * @param name The name of the boolean column.
606
622
  * @param options Additional options for the boolean column.
607
623
  * @returns The current TableBuilder instance for chaining.
608
624
  */
@@ -611,29 +627,39 @@ var TableBuilder = class {
611
627
  }
612
628
  /**
613
629
  * Defines a JSON column in the table.
614
- *
630
+ *
615
631
  * @param name The name of the JSON column.
616
632
  * @param options Additional options for the JSON column.
617
- * @returns
633
+ * @returns
618
634
  */
619
635
  json(name, options = {}) {
620
636
  return this.column(name, "json", options);
621
637
  }
622
638
  /**
623
639
  * Defines a date column in the table.
624
- *
640
+ *
625
641
  * @param name The name of the date column.
626
642
  * @param options Additional options for the date column.
627
- * @returns
643
+ * @returns
628
644
  */
629
645
  date(name, options = {}) {
630
646
  return this.column(name, "date", options);
631
647
  }
632
648
  /**
649
+ * Defines a date-time column in the table (timestamp without time zone).
650
+ *
651
+ * @param name The name of the date-time column.
652
+ * @param options Additional options for the date-time column.
653
+ * @returns The current TableBuilder instance for chaining.
654
+ */
655
+ dateTime(name, options = {}) {
656
+ return this.column(name, "dateTime", options);
657
+ }
658
+ /**
633
659
  * Defines colonns for a polymorphic relationship in the table.
634
- *
660
+ *
635
661
  * @param name The base name for the polymorphic relationship columns.
636
- * @returns
662
+ * @returns
637
663
  */
638
664
  morphs(name, nullable = false) {
639
665
  this.string(`${name}Type`, { nullable });
@@ -642,9 +668,9 @@ var TableBuilder = class {
642
668
  }
643
669
  /**
644
670
  * Defines columns for a polymorphic relationship in the table with UUID ID.
645
- *
671
+ *
646
672
  * @param name The base name for the polymorphic relationship columns.
647
- * @returns
673
+ * @returns
648
674
  */
649
675
  uuidMorphs(name, nullable = false) {
650
676
  this.string(`${name}Type`, { nullable });
@@ -653,28 +679,28 @@ var TableBuilder = class {
653
679
  }
654
680
  /**
655
681
  * Defines nullable columns for a polymorphic relationship in the table.
656
- *
682
+ *
657
683
  * @param name The base name for the polymorphic relationship columns.
658
- * @returns
684
+ * @returns
659
685
  */
660
686
  nullableMorphs(name) {
661
687
  return this.morphs(name, true);
662
688
  }
663
689
  /**
664
690
  * Defines nullable columns for a polymorphic relationship in the table with UUID ID.
665
- *
691
+ *
666
692
  * @param name The base name for the polymorphic relationship columns.
667
- * @returns
693
+ * @returns
668
694
  */
669
695
  nullableUuidMorphs(name) {
670
696
  return this.uuidMorphs(name, true);
671
697
  }
672
698
  /**
673
699
  * Defines a timestamp column in the table.
674
- *
700
+ *
675
701
  * @param name The name of the timestamp column.
676
702
  * @param options Additional options for the timestamp column.
677
- * @returns
703
+ * @returns
678
704
  */
679
705
  timestamp(name, options = {}) {
680
706
  return this.column(name, "timestamp", options);
@@ -735,9 +761,9 @@ var TableBuilder = class {
735
761
  }
736
762
  /**
737
763
  * Defines a soft delete timestamp column in the table.
738
- *
764
+ *
739
765
  * @param column The name of the soft delete column.
740
- * @returns
766
+ * @returns
741
767
  */
742
768
  softDeletes(column = "deletedAt") {
743
769
  this.timestamp(column, { nullable: true });
@@ -745,9 +771,9 @@ var TableBuilder = class {
745
771
  }
746
772
  /**
747
773
  * Defines a column to be dropped from the table in an alterTable operation.
748
- *
774
+ *
749
775
  * @param name The name of the column to drop.
750
- * @returns
776
+ * @returns
751
777
  */
752
778
  dropColumn(name) {
753
779
  this.dropColumnNames.push(name);
@@ -755,7 +781,7 @@ var TableBuilder = class {
755
781
  }
756
782
  /**
757
783
  * Marks a column as nullable.
758
- *
784
+ *
759
785
  * @param columnName Optional explicit column name. When omitted, applies to the latest defined column.
760
786
  * @returns The current TableBuilder instance for chaining.
761
787
  */
@@ -793,7 +819,7 @@ var TableBuilder = class {
793
819
  }
794
820
  /**
795
821
  * Sets the column position to appear after another column when possible.
796
- *
822
+ *
797
823
  * @param referenceColumn The column that the target column should be placed after.
798
824
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
799
825
  * @returns The current TableBuilder instance for chaining.
@@ -805,7 +831,7 @@ var TableBuilder = class {
805
831
  }
806
832
  /**
807
833
  * Maps the column to a custom database column name.
808
- *
834
+ *
809
835
  * @param name The custom database column name.
810
836
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
811
837
  * @returns The current TableBuilder instance for chaining.
@@ -817,7 +843,7 @@ var TableBuilder = class {
817
843
  }
818
844
  /**
819
845
  * Defines an index on one or more columns.
820
- *
846
+ *
821
847
  * @param columns Optional target columns. When omitted, applies to the latest defined column.
822
848
  * @param name Optional index name.
823
849
  * @returns The current TableBuilder instance for chaining.
@@ -846,11 +872,11 @@ var TableBuilder = class {
846
872
  return new ForeignKeyBuilder(entry);
847
873
  }
848
874
  /**
849
- * Defines a foreign key relation for a column, using a
875
+ * Defines a foreign key relation for a column, using a
850
876
  * conventional naming pattern.
851
- *
852
- * @param column
853
- * @returns
877
+ *
878
+ * @param column
879
+ * @returns
854
880
  */
855
881
  foreign(column) {
856
882
  const columnName = this.resolveColumn(column).name;
@@ -858,8 +884,8 @@ var TableBuilder = class {
858
884
  }
859
885
  /**
860
886
  * Returns a deep copy of the defined columns for the table.
861
- *
862
- * @returns
887
+ *
888
+ * @returns
863
889
  */
864
890
  getColumns() {
865
891
  return this.columns.map((column) => ({
@@ -869,15 +895,15 @@ var TableBuilder = class {
869
895
  }
870
896
  /**
871
897
  * Returns a copy of the defined column names to be dropped from the table.
872
- *
873
- * @returns
898
+ *
899
+ * @returns
874
900
  */
875
901
  getDropColumns() {
876
902
  return [...this.dropColumnNames];
877
903
  }
878
904
  /**
879
905
  * Returns a deep copy of the defined indexes for the table.
880
- *
906
+ *
881
907
  * @returns
882
908
  */
883
909
  getIndexes() {
@@ -914,11 +940,11 @@ var TableBuilder = class {
914
940
  }
915
941
  /**
916
942
  * Defines a column in the table with the given name.
917
- *
943
+ *
918
944
  * @param name The name of the column.
919
945
  * @param type The type of the column.
920
946
  * @param options Additional options for the column.
921
- * @returns
947
+ * @returns
922
948
  */
923
949
  column(name, type, options) {
924
950
  this.columns.push({
@@ -934,6 +960,8 @@ var TableBuilder = class {
934
960
  after: options.after,
935
961
  default: options.default,
936
962
  updatedAt: options.updatedAt,
963
+ precision: options.precision,
964
+ scale: options.scale,
937
965
  primaryKeyGeneration: options.primaryKeyGeneration
938
966
  });
939
967
  const column = this.columns[this.columns.length - 1];
@@ -943,9 +971,9 @@ var TableBuilder = class {
943
971
  }
944
972
  /**
945
973
  * Resolve a target column by name or fallback to the latest defined column.
946
- *
947
- * @param columnName
948
- * @returns
974
+ *
975
+ * @param columnName
976
+ * @returns
949
977
  */
950
978
  resolveColumn(columnName) {
951
979
  const targetName = columnName ?? this.latestColumnName;
@@ -966,19 +994,84 @@ var TableBuilder = class {
966
994
  //#endregion
967
995
  //#region src/database/SchemaBuilder.ts
968
996
  /**
969
- * The SchemaBuilder class provides methods for defining the operations to be
970
- * performed in a migration, such as creating, altering, or dropping tables.
997
+ * The SchemaBuilder class provides methods for defining the operations to be
998
+ * performed in a migration, such as creating, altering, or dropping tables.
971
999
  *
972
1000
  * @author Legacy (3m1n3nc3)
973
1001
  * @since 0.1.0
974
1002
  */
975
- var SchemaBuilder = class {
1003
+ var SchemaBuilder = class SchemaBuilder {
976
1004
  constructor() {
977
1005
  this.operations = [];
978
1006
  }
979
1007
  /**
1008
+ * Disable foreign-key constraint enforcement on the active PostgreSQL
1009
+ * connection by switching the session into replication mode, which
1010
+ * suppresses the internal triggers that enforce foreign keys.
1011
+ *
1012
+ * The setting is connection-scoped, so the disable, the work that depends
1013
+ * on it, and the matching {@link SchemaBuilder.enableForeignKeyConstraints}
1014
+ * must run on the same connection. Prefer
1015
+ * {@link SchemaBuilder.withoutForeignKeyConstraints}, which guarantees this
1016
+ * by wrapping the work in a transaction. Requires a SQL-backed adapter and
1017
+ * a database role permitted to set `session_replication_role`.
1018
+ *
1019
+ * @returns
1020
+ */
1021
+ static async disableForeignKeyConstraints() {
1022
+ await SchemaBuilder.setSessionReplicationRole("replica");
1023
+ }
1024
+ /**
1025
+ * Re-enable foreign-key constraint enforcement on the active PostgreSQL
1026
+ * connection by restoring the default session replication role.
1027
+ *
1028
+ * @returns
1029
+ */
1030
+ static async enableForeignKeyConstraints() {
1031
+ await SchemaBuilder.setSessionReplicationRole("origin");
1032
+ }
1033
+ /**
1034
+ * Run the given callback with foreign-key constraints disabled, then
1035
+ * restore them. The whole unit runs inside a transaction so the disable,
1036
+ * the callback, and the re-enable share a single connection (required for
1037
+ * the connection-scoped replication role to take effect) and roll back
1038
+ * together on failure.
1039
+ *
1040
+ * @example
1041
+ * await SchemaBuilder.withoutForeignKeyConstraints(async () => {
1042
+ * await User.factory()
1043
+ * .hasAttached(Tenant.factory().has(Project.factory(3)), { status: 'active' }, 'tenantMemberships')
1044
+ * .create()
1045
+ * })
1046
+ *
1047
+ * @param callback
1048
+ * @returns
1049
+ */
1050
+ static async withoutForeignKeyConstraints(callback) {
1051
+ return await runArkormTransaction(async () => {
1052
+ await SchemaBuilder.disableForeignKeyConstraints();
1053
+ try {
1054
+ return await callback();
1055
+ } finally {
1056
+ await SchemaBuilder.enableForeignKeyConstraints();
1057
+ }
1058
+ });
1059
+ }
1060
+ static async setSessionReplicationRole(role) {
1061
+ const adapter = getRuntimeAdapter();
1062
+ if (!adapter) throw new ArkormException("Toggling foreign-key constraints requires a configured database adapter.", {
1063
+ code: "ADAPTER_NOT_CONFIGURED",
1064
+ operation: "schema.foreignKeyConstraints"
1065
+ });
1066
+ if (!adapter.rawQuery) throw new UnsupportedAdapterFeatureException("Toggling foreign-key constraints requires an adapter that supports raw queries.", {
1067
+ operation: "schema.foreignKeyConstraints",
1068
+ meta: { feature: "rawQuery" }
1069
+ });
1070
+ await adapter.rawQuery({ sql: `SET session_replication_role = '${role}'` });
1071
+ }
1072
+ /**
980
1073
  * Defines a new table to be created in the migration.
981
- *
1074
+ *
982
1075
  * @param table The name of the table to create.
983
1076
  * @param callback A callback function to define the table's columns and structure.
984
1077
  * @returns The current SchemaBuilder instance for chaining.
@@ -1002,7 +1095,7 @@ var SchemaBuilder = class {
1002
1095
  }
1003
1096
  /**
1004
1097
  * Defines alterations to an existing table in the migration.
1005
- *
1098
+ *
1006
1099
  * @param table The name of the table to alter.
1007
1100
  * @param callback A callback function to define the alterations to the table's columns and structure.
1008
1101
  * @returns The current SchemaBuilder instance for chaining.
@@ -1027,7 +1120,7 @@ var SchemaBuilder = class {
1027
1120
  }
1028
1121
  /**
1029
1122
  * Defines a table to be dropped in the migration.
1030
- *
1123
+ *
1031
1124
  * @param table The name of the table to drop.
1032
1125
  * @returns The current SchemaBuilder instance for chaining.
1033
1126
  */
@@ -1040,7 +1133,7 @@ var SchemaBuilder = class {
1040
1133
  }
1041
1134
  /**
1042
1135
  * Returns a deep copy of the defined schema operations for the migration/
1043
- *
1136
+ *
1044
1137
  * @returns An array of schema operations for the migration.
1045
1138
  */
1046
1139
  getOperations() {
@@ -1116,7 +1209,7 @@ const PRISMA_ENUM_REGEX = /enum\s+(\w+)\s*\{[\s\S]*?\n\}/g;
1116
1209
  const PRISMA_ENUM_MEMBER_REGEX = /^[A-Za-z][A-Za-z0-9_]*$/;
1117
1210
  /**
1118
1211
  * Convert a table name to a PascalCase model name, with basic singularization.
1119
- *
1212
+ *
1120
1213
  * @param tableName The name of the table to convert.
1121
1214
  * @returns The corresponding PascalCase model name.
1122
1215
  */
@@ -1128,16 +1221,16 @@ const toModelName = (tableName) => {
1128
1221
  };
1129
1222
  /**
1130
1223
  * Escape special characters in a string for use in a regular expression.
1131
- *
1132
- * @param value
1133
- * @returns
1224
+ *
1225
+ * @param value
1226
+ * @returns
1134
1227
  */
1135
1228
  const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1136
1229
  /**
1137
1230
  * Convert a SchemaColumn definition to a Prisma field type string, including modifiers.
1138
- *
1139
- * @param column
1140
- * @returns
1231
+ *
1232
+ * @param column
1233
+ * @returns
1141
1234
  */
1142
1235
  const resolvePrismaType = (column) => {
1143
1236
  if (column.type === "id") return "Int";
@@ -1147,6 +1240,7 @@ const resolvePrismaType = (column) => {
1147
1240
  if (column.type === "integer") return "Int";
1148
1241
  if (column.type === "bigInteger") return "BigInt";
1149
1242
  if (column.type === "float") return "Float";
1243
+ if (column.type === "decimal") return "Decimal";
1150
1244
  if (column.type === "boolean") return "Boolean";
1151
1245
  if (column.type === "json") return "Json";
1152
1246
  return "DateTime";
@@ -1156,11 +1250,11 @@ const resolveEnumName = (column) => {
1156
1250
  if (column.enumName && column.enumName.trim().length > 0) return column.enumName.trim();
1157
1251
  throw new ArkormException(`Enum column [${column.name}] must define an enum name.`);
1158
1252
  };
1159
- /**
1253
+ /**
1160
1254
  * Format a default value for inclusion in a Prisma schema field definition, based on its type.
1161
- *
1162
- * @param value
1163
- * @returns
1255
+ *
1256
+ * @param value
1257
+ * @returns
1164
1258
  */
1165
1259
  const formatDefaultValue = (value) => {
1166
1260
  if (value == null) return void 0;
@@ -1171,9 +1265,9 @@ const formatDefaultValue = (value) => {
1171
1265
  };
1172
1266
  /**
1173
1267
  * Format a default value for an enum column as a Prisma @default attribute, validating that it is a non-empty string.
1174
- *
1175
- * @param value
1176
- * @returns
1268
+ *
1269
+ * @param value
1270
+ * @returns
1177
1271
  */
1178
1272
  const formatEnumDefaultValue = (value) => {
1179
1273
  if (value == null) return void 0;
@@ -1182,9 +1276,9 @@ const formatEnumDefaultValue = (value) => {
1182
1276
  };
1183
1277
  /**
1184
1278
  * Normalize an enum value by ensuring it is a non-empty string and trimming whitespace.
1185
- *
1186
- * @param value
1187
- * @returns
1279
+ *
1280
+ * @param value
1281
+ * @returns
1188
1282
  */
1189
1283
  const normalizeEnumValue = (value) => {
1190
1284
  if (typeof value !== "string" || value.trim().length === 0) throw new ArkormException("Enum values must be provided as non-empty strings.");
@@ -1194,9 +1288,9 @@ const normalizeEnumValue = (value) => {
1194
1288
  };
1195
1289
  /**
1196
1290
  * Extract the enum values from a Prisma enum block string.
1197
- *
1198
- * @param block
1199
- * @returns
1291
+ *
1292
+ * @param block
1293
+ * @returns
1200
1294
  */
1201
1295
  const extractEnumBlockValues = (block) => {
1202
1296
  return block.split("\n").slice(1, -1).map((line) => line.trim()).filter(Boolean);
@@ -1212,11 +1306,11 @@ const validateEnumValues = (column, enumName, enumValues) => {
1212
1306
  };
1213
1307
  /**
1214
1308
  * Validate that a default value for an enum column is included in the defined enum values.
1215
- *
1216
- * @param column
1217
- * @param enumName
1218
- * @param enumValues
1219
- * @returns
1309
+ *
1310
+ * @param column
1311
+ * @param enumName
1312
+ * @param enumValues
1313
+ * @returns
1220
1314
  */
1221
1315
  const validateEnumDefaultValue = (column, enumName, enumValues) => {
1222
1316
  if (column.default == null) return;
@@ -1226,9 +1320,9 @@ const validateEnumDefaultValue = (column, enumName, enumValues) => {
1226
1320
  };
1227
1321
  /**
1228
1322
  * Build a single line of a Prisma model field definition based on a SchemaColumn, including type and modifiers.
1229
- *
1230
- * @param column
1231
- * @returns
1323
+ *
1324
+ * @param column
1325
+ * @returns
1232
1326
  */
1233
1327
  const buildFieldLine = (column) => {
1234
1328
  if (column.type === "id") {
@@ -1245,14 +1339,15 @@ const buildFieldLine = (column) => {
1245
1339
  const primary = column.primary ? " @id" : "";
1246
1340
  const mapped = typeof column.map === "string" && column.map.trim().length > 0 ? ` @map("${column.map.replace(/"/g, "\\\"")}")` : "";
1247
1341
  const updatedAt = column.updatedAt ? " @updatedAt" : "";
1342
+ const nativeType = column.type === "decimal" ? ` @db.Decimal(${column.precision ?? 8}, ${column.scale ?? 2})` : "";
1248
1343
  const defaultValue = column.type === "enum" ? formatEnumDefaultValue(column.default) : column.primaryKeyGeneration?.prismaDefault ?? formatDefaultValue(column.default);
1249
1344
  const defaultSuffix = defaultValue ? ` ${defaultValue}` : "";
1250
- return ` ${column.name} ${scalar}${nullable}${primary}${unique}${defaultSuffix}${updatedAt}${mapped}`;
1345
+ return ` ${column.name} ${scalar}${nullable}${primary}${unique}${defaultSuffix}${updatedAt}${mapped}${nativeType}`;
1251
1346
  };
1252
1347
  /**
1253
- * Build a Prisma enum block string based on an enum name and its values, validating that
1348
+ * Build a Prisma enum block string based on an enum name and its values, validating that
1254
1349
  * at least one value is provided.
1255
- *
1350
+ *
1256
1351
  * @param enumName The name of the enum to create.
1257
1352
  * @param values The array of values for the enum.
1258
1353
  * @returns The Prisma enum block string.
@@ -1262,12 +1357,12 @@ const buildEnumBlock = (enumName, values) => {
1262
1357
  return `enum ${enumName} {\n${values.map((value) => ` ${value}`).join("\n")}\n}`;
1263
1358
  };
1264
1359
  /**
1265
- * Find the Prisma enum block in a schema string that corresponds to a given enum
1360
+ * Find the Prisma enum block in a schema string that corresponds to a given enum
1266
1361
  * name, returning its details if found.
1267
- *
1362
+ *
1268
1363
  * @param schema The Prisma schema string to search for the enum block.
1269
1364
  * @param enumName The name of the enum to find in the schema.
1270
- * @returns
1365
+ * @returns
1271
1366
  */
1272
1367
  const findEnumBlock = (schema, enumName) => {
1273
1368
  const candidates = [...schema.matchAll(PRISMA_ENUM_REGEX)];
@@ -1286,13 +1381,13 @@ const findEnumBlock = (schema, enumName) => {
1286
1381
  return null;
1287
1382
  };
1288
1383
  /**
1289
- * Ensure that Prisma enum blocks exist in the schema for any enum columns defined in a
1290
- * create or alter table operation, adding them if necessary and validating against
1384
+ * Ensure that Prisma enum blocks exist in the schema for any enum columns defined in a
1385
+ * create or alter table operation, adding them if necessary and validating against
1291
1386
  * existing blocks.
1292
- *
1387
+ *
1293
1388
  * @param schema The current Prisma schema string to check and modify.
1294
1389
  * @param columns The array of schema column definitions to check for enum types and ensure corresponding blocks exist for.
1295
- * @returns
1390
+ * @returns
1296
1391
  */
1297
1392
  const ensureEnumBlocks = (schema, columns) => {
1298
1393
  let nextSchema = schema;
@@ -1322,9 +1417,9 @@ const ensureEnumBlocks = (schema, columns) => {
1322
1417
  };
1323
1418
  /**
1324
1419
  * Build a Prisma model-level @@index definition line.
1325
- *
1420
+ *
1326
1421
  * @param index The schema index definition to convert to a Prisma \@\@index line.
1327
- * @returns
1422
+ * @returns
1328
1423
  */
1329
1424
  const buildIndexLine = (index) => {
1330
1425
  return ` @@index([${index.columns.join(", ")}]${typeof index.name === "string" && index.name.trim().length > 0 ? `, name: "${index.name.replace(/"/g, "\\\"")}"` : ""})`;
@@ -1348,9 +1443,9 @@ const buildUniqueConstraintLine = (constraint) => {
1348
1443
  return ` @@unique([${constraint.columns.join(", ")}]${typeof constraint.name === "string" && constraint.name.trim().length > 0 ? `, name: "${constraint.name.replace(/"/g, "\\\"")}"` : ""})`;
1349
1444
  };
1350
1445
  /**
1351
- * Derive a relation field name from a foreign key column name by applying
1446
+ * Derive a relation field name from a foreign key column name by applying
1352
1447
  * common conventions, such as removing "Id" suffixes and converting to camelCase.
1353
- *
1448
+ *
1354
1449
  * @param columnName The name of the foreign key column.
1355
1450
  * @returns The derived relation field name.
1356
1451
  */
@@ -1365,10 +1460,10 @@ const deriveRelationFieldName = (columnName) => {
1365
1460
  return `${trimmed.charAt(0).toLowerCase()}${trimmed.slice(1)}`;
1366
1461
  };
1367
1462
  /**
1368
- * Derive a relation name for both sides of a relation based on the
1369
- * source and target model names, using an explicit alias if provided or a
1463
+ * Derive a relation name for both sides of a relation based on the
1464
+ * source and target model names, using an explicit alias if provided or a
1370
1465
  * convention of combining the full source model name with the target model name.
1371
- *
1466
+ *
1372
1467
  * @param sourceModelName The name of the source model in the relation.
1373
1468
  * @param targetModelName The name of the target model in the relation.
1374
1469
  * @param explicitAlias An optional explicit alias for the relation.
@@ -1394,9 +1489,9 @@ const resolveForeignKeyColumn = (columns, foreignKey) => {
1394
1489
  const isOneToOneForeignKey = (column) => {
1395
1490
  return Boolean(column?.unique || column?.primary);
1396
1491
  };
1397
- /**
1492
+ /**
1398
1493
  * Format a SchemaForeignKeyAction value as a Prisma onDelete action string.
1399
- *
1494
+ *
1400
1495
  * @param action The foreign key action to format.
1401
1496
  * @returns The corresponding Prisma onDelete action string.
1402
1497
  */
@@ -1408,9 +1503,9 @@ const formatRelationAction = (action) => {
1408
1503
  return "NoAction";
1409
1504
  };
1410
1505
  /**
1411
- * Build a Prisma relation field line based on a SchemaForeignKey
1506
+ * Build a Prisma relation field line based on a SchemaForeignKey
1412
1507
  * definition, including relation name and onDelete action.
1413
- *
1508
+ *
1414
1509
  * @param foreignKey The foreign key definition to convert to a relation line.
1415
1510
  * @returns The corresponding Prisma schema line for the relation field.
1416
1511
  */
@@ -1426,10 +1521,10 @@ const buildRelationLine = (sourceModelName, foreignKey, columns = []) => {
1426
1521
  return ` ${fieldName} ${targetModel}${optional} @relation("${relationName.replace(/"/g, "\\\"")}", fields: [${foreignKey.column}], references: [${foreignKey.referencesColumn}]${onDelete})`;
1427
1522
  };
1428
1523
  /**
1429
- * Build a Prisma relation field line for the inverse side of a relation, based
1430
- * on the source and target model names and the foreign key definition, using
1524
+ * Build a Prisma relation field line for the inverse side of a relation, based
1525
+ * on the source and target model names and the foreign key definition, using
1431
1526
  * naming conventions and any explicit inverse alias provided.
1432
- *
1527
+ *
1433
1528
  * @param sourceModelName The name of the source model in the relation.
1434
1529
  * @param targetModelName The name of the target model in the relation.
1435
1530
  * @param foreignKey The foreign key definition for the relation.
@@ -1442,14 +1537,14 @@ const buildInverseRelationLine = (sourceModelName, targetModelName, foreignKey,
1442
1537
  return ` ${fieldName} ${isOneToOneForeignKey(sourceColumn) ? `${sourceModelName}?` : `${sourceModelName}[]`} @relation("${relationName.replace(/"/g, "\\\"")}")`;
1443
1538
  };
1444
1539
  /**
1445
- * Inject a line into the body of a Prisma model block if it does not already
1446
- * exist, using a provided existence check function to determine if the line
1540
+ * Inject a line into the body of a Prisma model block if it does not already
1541
+ * exist, using a provided existence check function to determine if the line
1447
1542
  * is already present.
1448
- *
1543
+ *
1449
1544
  * @param bodyLines The lines of the model block body to modify.
1450
1545
  * @param line The line to inject if it does not already exist.
1451
1546
  * @param exists A function that checks if a given line already exists in the body.
1452
- * @returns
1547
+ * @returns
1453
1548
  */
1454
1549
  const injectLineIntoModelBody = (bodyLines, line, exists) => {
1455
1550
  if (bodyLines.some(exists)) return bodyLines;
@@ -1458,10 +1553,10 @@ const injectLineIntoModelBody = (bodyLines, line, exists) => {
1458
1553
  return bodyLines;
1459
1554
  };
1460
1555
  /**
1461
- * Apply inverse relation definitions to a Prisma schema string based on the
1462
- * foreign keys defined in a create or alter table operation, ensuring that
1556
+ * Apply inverse relation definitions to a Prisma schema string based on the
1557
+ * foreign keys defined in a create or alter table operation, ensuring that
1463
1558
  * related models have corresponding relation fields for bi-directional navigation.
1464
- *
1559
+ *
1465
1560
  * @param schema The Prisma schema string to modify.
1466
1561
  * @param sourceModelName The name of the source model in the relation.
1467
1562
  * @param foreignKeys An array of foreign key definitions to process.
@@ -1484,9 +1579,9 @@ const applyInverseRelations = (schema, sourceModelName, foreignKeys, columns = [
1484
1579
  return nextSchema;
1485
1580
  };
1486
1581
  /**
1487
- * Build a Prisma model block string based on a SchemaTableCreateOperation, including
1582
+ * Build a Prisma model block string based on a SchemaTableCreateOperation, including
1488
1583
  * all fields and any necessary mapping.
1489
- *
1584
+ *
1490
1585
  * @param operation The schema table create operation to convert.
1491
1586
  * @returns The corresponding Prisma model block string.
1492
1587
  */
@@ -1511,12 +1606,12 @@ const buildModelBlock = (operation) => {
1511
1606
  ] : [...fields, ...relations]).join("\n")}\n}`;
1512
1607
  };
1513
1608
  /**
1514
- * Find the Prisma model block in a schema string that corresponds to a given
1609
+ * Find the Prisma model block in a schema string that corresponds to a given
1515
1610
  * table name, using both explicit mapping and naming conventions.
1516
- *
1517
- * @param schema
1518
- * @param table
1519
- * @returns
1611
+ *
1612
+ * @param schema
1613
+ * @param table
1614
+ * @returns
1520
1615
  */
1521
1616
  const findModelBlock = (schema, table) => {
1522
1617
  const candidates = [...schema.matchAll(PRISMA_MODEL_REGEX)];
@@ -1548,9 +1643,9 @@ const findModelBlock = (schema, table) => {
1548
1643
  return null;
1549
1644
  };
1550
1645
  /**
1551
- * Apply a create table operation to a Prisma schema string, adding a new model
1646
+ * Apply a create table operation to a Prisma schema string, adding a new model
1552
1647
  * block for the specified table and fields.
1553
- *
1648
+ *
1554
1649
  * @param schema The current Prisma schema string.
1555
1650
  * @param operation The schema table create operation to apply.
1556
1651
  * @returns The updated Prisma schema string with the new model block.
@@ -1562,9 +1657,9 @@ const applyCreateTableOperation = (schema, operation) => {
1562
1657
  return applyInverseRelations(`${schemaWithEnums.trimEnd()}\n\n${block}\n`, toModelName(operation.table), operation.foreignKeys ?? [], operation.columns);
1563
1658
  };
1564
1659
  /**
1565
- * Apply an alter table operation to a Prisma schema string, modifying the model
1660
+ * Apply an alter table operation to a Prisma schema string, modifying the model
1566
1661
  * block for the specified table by adding and removing fields as needed.
1567
- *
1662
+ *
1568
1663
  * @param schema The current Prisma schema string.
1569
1664
  * @param operation The schema table alter operation to apply.
1570
1665
  * @returns The updated Prisma schema string with the modified model block.
@@ -1631,10 +1726,10 @@ const applyDropTableOperation = (schema, operation) => {
1631
1726
  return `${before}${before && after ? "\n\n" : ""}${after}`;
1632
1727
  };
1633
1728
  /**
1634
- * The SchemaBuilder class provides a fluent interface for defining
1635
- * database schema operations in a migration, such as creating, altering, and
1729
+ * The SchemaBuilder class provides a fluent interface for defining
1730
+ * database schema operations in a migration, such as creating, altering, and
1636
1731
  * dropping tables.
1637
- *
1732
+ *
1638
1733
  * @param schema The current Prisma schema string.
1639
1734
  * @param operations The list of schema operations to apply.
1640
1735
  * @returns The updated Prisma schema string after applying all operations.
@@ -1648,7 +1743,7 @@ const applyOperationsToPrismaSchema = (schema, operations) => {
1648
1743
  };
1649
1744
  /**
1650
1745
  * Run a Prisma CLI command using npx, capturing and throwing any errors that occur.
1651
- *
1746
+ *
1652
1747
  * @param args The arguments to pass to the Prisma CLI command.
1653
1748
  * @param cwd The current working directory to run the command in.
1654
1749
  * @returns void
@@ -1663,11 +1758,11 @@ const runPrismaCommand = (args, cwd) => {
1663
1758
  throw new ArkormException(errorOutput ? `Prisma command failed: prisma ${args.join(" ")}\n${errorOutput}` : `Prisma command failed: prisma ${args.join(" ")}`);
1664
1759
  };
1665
1760
  /**
1666
- * Generate a new migration file with a given name and options, including
1761
+ * Generate a new migration file with a given name and options, including
1667
1762
  * writing the file to disk if specified.
1668
- *
1669
- * @param name
1670
- * @returns
1763
+ *
1764
+ * @param name
1765
+ * @returns
1671
1766
  */
1672
1767
  const resolveMigrationClassName = (name) => {
1673
1768
  const cleaned = name.replace(/[^a-zA-Z0-9]+/g, " ").trim();
@@ -1675,39 +1770,39 @@ const resolveMigrationClassName = (name) => {
1675
1770
  return `${cleaned.split(/\s+/g).map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join("")}Migration`;
1676
1771
  };
1677
1772
  /**
1678
- * Pad a number with leading zeros to ensure it is at least two digits, for
1773
+ * Pad a number with leading zeros to ensure it is at least two digits, for
1679
1774
  * use in migration timestamps.
1680
- *
1681
- * @param value
1682
- * @returns
1775
+ *
1776
+ * @param value
1777
+ * @returns
1683
1778
  */
1684
1779
  const pad = (value) => String(value).padStart(2, "0");
1685
1780
  /**
1686
- * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
1781
+ * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
1687
1782
  * file names, based on the current date and time or a provided date.
1688
- *
1689
- * @param date
1690
- * @returns
1783
+ *
1784
+ * @param date
1785
+ * @returns
1691
1786
  */
1692
1787
  const createMigrationTimestamp = (date = /* @__PURE__ */ new Date()) => {
1693
1788
  return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}`;
1694
1789
  };
1695
1790
  /**
1696
- * Convert a migration name to a slug suitable for use in a file name, by
1791
+ * Convert a migration name to a slug suitable for use in a file name, by
1697
1792
  * lowercasing and replacing non-alphanumeric characters with underscores.
1698
- *
1699
- * @param name
1700
- * @returns
1793
+ *
1794
+ * @param name
1795
+ * @returns
1701
1796
  */
1702
1797
  const toMigrationFileSlug = (name) => {
1703
1798
  return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "migration";
1704
1799
  };
1705
1800
  /**
1706
- * Build the source code for a new migration file based on a given class
1801
+ * Build the source code for a new migration file based on a given class
1707
1802
  * name, using a template with empty up and down methods.
1708
- *
1709
- * @param className
1710
- * @returns
1803
+ *
1804
+ * @param className
1805
+ * @returns
1711
1806
  */
1712
1807
  const buildMigrationSource = (className, extension = "ts") => {
1713
1808
  if (extension === "js") return [
@@ -1744,12 +1839,12 @@ const buildMigrationSource = (className, extension = "ts") => {
1744
1839
  ].join("\n");
1745
1840
  };
1746
1841
  /**
1747
- * Generate a new migration file with a given name and options, including
1842
+ * Generate a new migration file with a given name and options, including
1748
1843
  * writing the file to disk if specified, and return the details of the generated file.
1749
- *
1750
- * @param name
1751
- * @param options
1752
- * @returns
1844
+ *
1845
+ * @param name
1846
+ * @param options
1847
+ * @returns
1753
1848
  */
1754
1849
  const generateMigrationFile = (name, options = {}) => {
1755
1850
  const timestamp = createMigrationTimestamp(/* @__PURE__ */ new Date());
@@ -1774,10 +1869,10 @@ const generateMigrationFile = (name, options = {}) => {
1774
1869
  };
1775
1870
  /**
1776
1871
  * Get the list of schema operations that would be performed by a given migration class when run in a specified direction (up or down), without actually applying them.
1777
- *
1872
+ *
1778
1873
  * @param migration The migration class or instance to analyze.
1779
1874
  * @param direction The direction of the migration to plan for ('up' or 'down').
1780
- * @returns A promise that resolves to an array of schema operations that would be performed.
1875
+ * @returns A promise that resolves to an array of schema operations that would be performed.
1781
1876
  */
1782
1877
  const getMigrationPlan = async (migration, direction = "up") => {
1783
1878
  const instance = typeof migration === "function" ? new migration() : migration;
@@ -1812,10 +1907,10 @@ const applyMigrationRollbackToDatabase = async (adapter, migration) => {
1812
1907
  return { operations };
1813
1908
  };
1814
1909
  /**
1815
- * Apply the schema operations defined in a migration to a Prisma schema
1816
- * file, updating the file on disk if specified, and return the updated
1910
+ * Apply the schema operations defined in a migration to a Prisma schema
1911
+ * file, updating the file on disk if specified, and return the updated
1817
1912
  * schema and list of operations applied.
1818
- *
1913
+ *
1819
1914
  * @param migration The migration class or instance to apply.
1820
1915
  * @param options Options for applying the migration, including schema path and write flag.
1821
1916
  * @returns A promise that resolves to an object containing the updated schema, schema path, and list of operations applied.
@@ -2192,17 +2287,17 @@ const pushUnique = (items, values) => {
2192
2287
  const normalizeConstructors = (items) => items.flatMap((item) => Array.isArray(item) ? item : [item]).filter(Boolean);
2193
2288
  /**
2194
2289
  * Register model constructors directly without relying on runtime discovery.
2195
- *
2196
- * @param models
2290
+ *
2291
+ * @param models
2197
2292
  */
2198
2293
  const registerModels = (...models) => {
2199
2294
  pushUnique(registry.models, normalizeConstructors(models));
2200
2295
  };
2201
2296
  /**
2202
2297
  * Get registered runtime discovery paths or registered constructors for a specific type.
2203
- *
2204
- * @param key
2205
- * @returns
2298
+ *
2299
+ * @param key
2300
+ * @returns
2206
2301
  */
2207
2302
  const getRegisteredPaths = (key) => {
2208
2303
  if (key) return [...registry.paths[key]];
@@ -2215,14 +2310,14 @@ const getRegisteredPaths = (key) => {
2215
2310
  };
2216
2311
  /**
2217
2312
  * Get registered migration constructors instances.
2218
- *
2219
- * @returns
2313
+ *
2314
+ * @returns
2220
2315
  */
2221
2316
  const getRegisteredMigrations = () => [...registry.migrations];
2222
2317
  /**
2223
2318
  * Get registered seeder constructors instances.
2224
- *
2225
- * @returns
2319
+ *
2320
+ * @returns
2226
2321
  */
2227
2322
  const getRegisteredSeeders = () => [...registry.seeders];
2228
2323
 
@@ -2318,9 +2413,9 @@ const mergePathConfig = (paths) => {
2318
2413
  };
2319
2414
  /**
2320
2415
  * Merge the feature configuration from the base defaults, user configuration, and provided options.
2321
- *
2322
- * @param features
2323
- * @returns
2416
+ *
2417
+ * @param features
2418
+ * @returns
2324
2419
  */
2325
2420
  const mergeFeatureConfig = (features) => {
2326
2421
  const defaults = baseConfig.features ?? {};
@@ -2376,10 +2471,10 @@ const awaitConfiguredModelsRegistration = async () => {
2376
2471
  };
2377
2472
  /**
2378
2473
  * Bind a database adapter instance to an array of models that support adapter binding.
2379
- *
2380
- * @param adapter
2381
- * @param models
2382
- * @returns
2474
+ *
2475
+ * @param adapter
2476
+ * @param models
2477
+ * @returns
2383
2478
  */
2384
2479
  const bindAdapterToModels = (adapter, models) => {
2385
2480
  models.forEach((model) => {
@@ -2388,10 +2483,10 @@ const bindAdapterToModels = (adapter, models) => {
2388
2483
  return adapter;
2389
2484
  };
2390
2485
  /**
2391
- * Get the user-provided ArkORM configuration.
2392
- *
2486
+ * Get the user-provided ArkORM configuration.
2487
+ *
2393
2488
  * @param key Optional specific configuration key to retrieve. If omitted, the entire configuration object is returned.
2394
- * @returns The user-provided ArkORM configuration object.
2489
+ * @returns The user-provided ArkORM configuration object.
2395
2490
  */
2396
2491
  const getUserConfig = (key) => {
2397
2492
  if (key) return userConfig[key];
@@ -2400,8 +2495,8 @@ const getUserConfig = (key) => {
2400
2495
  /**
2401
2496
  * Configure the ArkORM runtime with the provided runtime client resolver and
2402
2497
  * adapter-first options.
2403
- *
2404
- * @param client
2498
+ *
2499
+ * @param client
2405
2500
  * @param options
2406
2501
  */
2407
2502
  const configureArkormRuntime = (client, options = {}) => {
@@ -2436,9 +2531,9 @@ const configureArkormRuntime = (client, options = {}) => {
2436
2531
  /**
2437
2532
  * Resolve a runtime client instance from the provided resolver, which can be either
2438
2533
  * a direct client instance or a function that returns a client instance.
2439
- *
2440
- * @param resolver
2441
- * @returns
2534
+ *
2535
+ * @param resolver
2536
+ * @returns
2442
2537
  */
2443
2538
  const resolveClient = (resolver) => {
2444
2539
  if (!resolver) return void 0;
@@ -2447,12 +2542,12 @@ const resolveClient = (resolver) => {
2447
2542
  return client;
2448
2543
  };
2449
2544
  /**
2450
- * Resolve and apply the ArkORM configuration from an imported module.
2545
+ * Resolve and apply the ArkORM configuration from an imported module.
2451
2546
  * This function checks for a default export and falls back to the module itself, then validates
2452
2547
  * the configuration object and applies it to the runtime if valid.
2453
- *
2454
- * @param imported
2455
- * @returns
2548
+ *
2549
+ * @param imported
2550
+ * @returns
2456
2551
  */
2457
2552
  const resolveAndApplyConfig = (imported) => {
2458
2553
  const config = imported?.default ?? imported;
@@ -2472,11 +2567,11 @@ const resolveAndApplyConfig = (imported) => {
2472
2567
  runtimeConfigLoaded = true;
2473
2568
  };
2474
2569
  /**
2475
- * Dynamically import a configuration file.
2570
+ * Dynamically import a configuration file.
2476
2571
  * A cache-busting query parameter is appended to ensure the latest version is loaded.
2477
- *
2478
- * @param configPath
2479
- * @returns A promise that resolves to the imported configuration module.
2572
+ *
2573
+ * @param configPath
2574
+ * @returns A promise that resolves to the imported configuration module.
2480
2575
  */
2481
2576
  const importConfigFile = (configPath) => {
2482
2577
  return RuntimeModuleLoader.load(configPath);
@@ -2496,9 +2591,9 @@ const loadRuntimeConfigSync = () => {
2496
2591
  return false;
2497
2592
  };
2498
2593
  /**
2499
- * Load the ArkORM configuration by searching for configuration files in the
2594
+ * Load the ArkORM configuration by searching for configuration files in the
2500
2595
  * current working directory.
2501
- * @returns
2596
+ * @returns
2502
2597
  */
2503
2598
  const loadArkormConfig = async () => {
2504
2599
  if (runtimeConfigLoaded) {
@@ -2531,6 +2626,65 @@ const loadArkormConfig = async () => {
2531
2626
  const getDefaultStubsPath = () => {
2532
2627
  return resolveDefaultStubsPath();
2533
2628
  };
2629
+ /**
2630
+ * Get the runtime compatibility client.
2631
+ * This function will trigger the loading of the ArkORM configuration if
2632
+ * it hasn't already been loaded.
2633
+ *
2634
+ * @returns
2635
+ */
2636
+ const getRuntimeClient = () => {
2637
+ const activeTransactionClient = transactionClientStorage.getStore();
2638
+ if (activeTransactionClient) return activeTransactionClient;
2639
+ if (!runtimeConfigLoaded) loadRuntimeConfigSync();
2640
+ return resolveClient(runtimeClientResolver);
2641
+ };
2642
+ /**
2643
+ * Get the currently configured runtime adapter, if any.
2644
+ *
2645
+ * @returns
2646
+ */
2647
+ const getRuntimeAdapter = () => {
2648
+ const activeTransactionAdapter = transactionAdapterStorage.getStore();
2649
+ if (activeTransactionAdapter) return activeTransactionAdapter;
2650
+ if (!runtimeConfigLoaded) loadRuntimeConfigSync();
2651
+ return runtimeAdapter;
2652
+ };
2653
+ const isTransactionCapableClient = (value) => {
2654
+ if (!value || typeof value !== "object") return false;
2655
+ return typeof value.$transaction === "function";
2656
+ };
2657
+ const runArkormTransaction = async (callback, options = {}, preferredAdapter) => {
2658
+ const activeTransactionAdapter = transactionAdapterStorage.getStore();
2659
+ const activeTransactionClient = transactionClientStorage.getStore();
2660
+ if (activeTransactionAdapter || activeTransactionClient) return await callback({
2661
+ adapter: activeTransactionAdapter,
2662
+ client: activeTransactionClient
2663
+ });
2664
+ const adapter = preferredAdapter ?? getRuntimeAdapter();
2665
+ if (adapter) return await adapter.transaction(async (transactionAdapter) => {
2666
+ return await transactionAdapterStorage.run(transactionAdapter, async () => {
2667
+ return await callback({
2668
+ adapter: transactionAdapter,
2669
+ client: transactionClientStorage.getStore()
2670
+ });
2671
+ });
2672
+ }, options);
2673
+ const client = getRuntimeClient();
2674
+ if (!client) throw new ArkormException("Cannot start a transaction without a configured runtime client or adapter.", {
2675
+ code: "CLIENT_NOT_CONFIGURED",
2676
+ operation: "transaction"
2677
+ });
2678
+ if (!isTransactionCapableClient(client)) throw new UnsupportedAdapterFeatureException("Transactions are not supported by the current adapter.", {
2679
+ code: "TRANSACTION_NOT_SUPPORTED",
2680
+ operation: "transaction"
2681
+ });
2682
+ return await client.$transaction(async (transactionClient) => {
2683
+ return await transactionClientStorage.run(transactionClient, async () => {
2684
+ return await callback({ client: transactionClient });
2685
+ });
2686
+ }, options);
2687
+ };
2534
2688
  const getRuntimeDebugHandler = () => {
2535
2689
  if (!runtimeConfigLoaded) loadRuntimeConfigSync();
2536
2690
  return runtimeDebugHandler;
@@ -2541,7 +2695,7 @@ const emitRuntimeDebugEvent = (event) => {
2541
2695
  /**
2542
2696
  * Check if a given value matches Arkorm's query-schema contract
2543
2697
  * by verifying the presence of common delegate methods.
2544
- *
2698
+ *
2545
2699
  * @param value The value to check.
2546
2700
  * @returns True if the value matches the query-schema contract, false otherwise.
2547
2701
  */
@@ -2567,7 +2721,7 @@ loadArkormConfig();
2567
2721
  //#region src/helpers/prisma.ts
2568
2722
  /**
2569
2723
  * Infer the Prisma delegate name for a given model name using a simple convention.
2570
- *
2724
+ *
2571
2725
  * @param modelName The name of the model to infer the delegate name for.
2572
2726
  * @returns The inferred Prisma delegate name.
2573
2727
  */
@@ -2578,9 +2732,9 @@ function inferDelegateName(modelName) {
2578
2732
  //#endregion
2579
2733
  //#region src/adapters/PrismaDatabaseAdapter.ts
2580
2734
  /**
2581
- * Database adapter implementation for Prisma, allowing Arkorm to execute queries using Prisma
2735
+ * Database adapter implementation for Prisma, allowing Arkorm to execute queries using Prisma
2582
2736
  * as the underlying query builder and executor.
2583
- *
2737
+ *
2584
2738
  * @author Legacy (3m1n3nc3)
2585
2739
  * @since 2.0.0-next.0
2586
2740
  */
@@ -2849,9 +3003,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2849
3003
  * Prisma include/select arguments, but the adapter does not advertise the
2850
3004
  * adapter-owned batch relation load seam. QueryBuilder eager loads therefore stay
2851
3005
  * on Arkorm's generic relation loader on the Prisma compatibility path.
2852
- *
2853
- * @param spec
2854
- * @returns
3006
+ *
3007
+ * @param spec
3008
+ * @returns
2855
3009
  */
2856
3010
  async select(spec) {
2857
3011
  const delegate = this.resolveDelegate(spec.target);
@@ -2861,10 +3015,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2861
3015
  }, { args });
2862
3016
  }
2863
3017
  /**
2864
- * Selects a single record matching the specified criteria.
2865
- *
2866
- * @param spec
2867
- * @returns
3018
+ * Selects a single record matching the specified criteria.
3019
+ *
3020
+ * @param spec
3021
+ * @returns
2868
3022
  */
2869
3023
  async selectOne(spec) {
2870
3024
  const delegate = this.resolveDelegate(spec.target);
@@ -2875,9 +3029,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2875
3029
  }
2876
3030
  /**
2877
3031
  * Inserts a single record into the database and returns the created record.
2878
- *
2879
- * @param spec
2880
- * @returns
3032
+ *
3033
+ * @param spec
3034
+ * @returns
2881
3035
  */
2882
3036
  async insert(spec) {
2883
3037
  const delegate = this.resolveDelegate(spec.target);
@@ -2886,10 +3040,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2886
3040
  }, { values: spec.values });
2887
3041
  }
2888
3042
  /**
2889
- * Inserts multiple records into the database.
2890
- *
2891
- * @param spec
2892
- * @returns
3043
+ * Inserts multiple records into the database.
3044
+ *
3045
+ * @param spec
3046
+ * @returns
2893
3047
  */
2894
3048
  async insertMany(spec) {
2895
3049
  const delegate = this.resolveDelegate(spec.target);
@@ -2918,9 +3072,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2918
3072
  }
2919
3073
  /**
2920
3074
  * Updates a single record matching the specified criteria and returns the updated record.
2921
- *
2922
- * @param spec
2923
- * @returns
3075
+ *
3076
+ * @param spec
3077
+ * @returns
2924
3078
  */
2925
3079
  async update(spec) {
2926
3080
  const delegate = this.resolveDelegate(spec.target);
@@ -2937,10 +3091,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2937
3091
  });
2938
3092
  }
2939
3093
  /**
2940
- * Updates multiple records matching the specified criteria.
2941
- *
2942
- * @param spec
2943
- * @returns
3094
+ * Updates multiple records matching the specified criteria.
3095
+ *
3096
+ * @param spec
3097
+ * @returns
2944
3098
  */
2945
3099
  async updateMany(spec) {
2946
3100
  const delegate = this.resolveDelegate(spec.target);
@@ -2970,9 +3124,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2970
3124
  }
2971
3125
  /**
2972
3126
  * Deletes a single record matching the specified criteria and returns the deleted record.
2973
- *
2974
- * @param spec
2975
- * @returns
3127
+ *
3128
+ * @param spec
3129
+ * @returns
2976
3130
  */
2977
3131
  async delete(spec) {
2978
3132
  const delegate = this.resolveDelegate(spec.target);
@@ -2983,10 +3137,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2983
3137
  }, { where });
2984
3138
  }
2985
3139
  /**
2986
- * Deletes multiple records matching the specified criteria.
2987
- *
2988
- * @param spec
2989
- * @returns
3140
+ * Deletes multiple records matching the specified criteria.
3141
+ *
3142
+ * @param spec
3143
+ * @returns
2990
3144
  */
2991
3145
  async deleteMany(spec) {
2992
3146
  const delegate = this.resolveDelegate(spec.target);
@@ -3001,9 +3155,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3001
3155
  }
3002
3156
  /**
3003
3157
  * Counts the number of records matching the specified criteria.
3004
- *
3005
- * @param spec
3006
- * @returns
3158
+ *
3159
+ * @param spec
3160
+ * @returns
3007
3161
  */
3008
3162
  async count(spec) {
3009
3163
  const delegate = this.resolveDelegate(spec.target);
@@ -3014,9 +3168,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3014
3168
  }
3015
3169
  /**
3016
3170
  * Checks for the existence of records matching the specified criteria.
3017
- *
3018
- * @param spec
3019
- * @returns
3171
+ *
3172
+ * @param spec
3173
+ * @returns
3020
3174
  */
3021
3175
  async exists(spec) {
3022
3176
  return await this.selectOne({
@@ -3026,8 +3180,8 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3026
3180
  }
3027
3181
  /**
3028
3182
  * Loads related models for a batch of parent records based on the specified relation load plans.
3029
- *
3030
- * @param _spec
3183
+ *
3184
+ * @param _spec
3031
3185
  */
3032
3186
  async loadRelations(_spec) {
3033
3187
  throw new UnsupportedAdapterFeatureException("Adapter-owned relation batch loading is intentionally unavailable on the Prisma compatibility adapter; eager loading stays on Arkorm's generic loader for this path.", {
@@ -3036,12 +3190,12 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3036
3190
  });
3037
3191
  }
3038
3192
  /**
3039
- * Executes a series of database operations within a transaction.
3193
+ * Executes a series of database operations within a transaction.
3040
3194
  * If the underlying Prisma client does not support transactions, an exception is thrown.
3041
- *
3042
- * @param callback
3043
- * @param context
3044
- * @returns
3195
+ *
3196
+ * @param callback
3197
+ * @param context
3198
+ * @returns
3045
3199
  */
3046
3200
  async transaction(callback, context = {}) {
3047
3201
  if (!this.hasTransactionSupport(this.prisma)) throw new UnsupportedAdapterFeatureException("Transactions are not supported by the Prisma compatibility adapter.", {
@@ -3097,12 +3251,12 @@ var CliApp = class {
3097
3251
  return relPath;
3098
3252
  }
3099
3253
  /**
3100
- * Utility to format a value for logging, converting absolute paths under current
3254
+ * Utility to format a value for logging, converting absolute paths under current
3101
3255
  * working directory into relative display paths.
3102
- *
3103
- * @param name
3104
- * @param value
3105
- * @returns
3256
+ *
3257
+ * @param name
3258
+ * @param value
3259
+ * @returns
3106
3260
  */
3107
3261
  splitLogger(name, value) {
3108
3262
  value = value.includes(process.cwd()) ? this.formatPathForLog(value) : value;
@@ -3191,7 +3345,7 @@ var CliApp = class {
3191
3345
  }
3192
3346
  /**
3193
3347
  * Resolve a configuration path with a fallback default
3194
- *
3348
+ *
3195
3349
  * @param key The configuration key to resolve
3196
3350
  * @param fallback The fallback value if the configuration key is not set
3197
3351
  * @returns The resolved configuration path
@@ -3203,19 +3357,19 @@ var CliApp = class {
3203
3357
  }
3204
3358
  /**
3205
3359
  * Resolve the path to a stub file based on configuration
3206
- *
3207
- * @param stubName
3208
- * @returns
3360
+ *
3361
+ * @param stubName
3362
+ * @returns
3209
3363
  */
3210
3364
  resolveStubPath(stubName) {
3211
3365
  return join$1(this.resolveConfigPath("stubs", getDefaultStubsPath()), stubName);
3212
3366
  }
3213
3367
  /**
3214
3368
  * Generate a factory file for a given model name.
3215
- *
3216
- * @param name
3217
- * @param options
3218
- * @returns
3369
+ *
3370
+ * @param name
3371
+ * @param options
3372
+ * @returns
3219
3373
  */
3220
3374
  makeFactory(name, options = {}) {
3221
3375
  const baseName = str(name.replace(/Factory$/, "")).pascal();
@@ -3237,10 +3391,10 @@ var CliApp = class {
3237
3391
  }
3238
3392
  /**
3239
3393
  * Generate a seeder file for a given name.
3240
- *
3241
- * @param name
3242
- * @param options
3243
- * @returns
3394
+ *
3395
+ * @param name
3396
+ * @param options
3397
+ * @returns
3244
3398
  */
3245
3399
  makeSeeder(name, options = {}) {
3246
3400
  const seederName = `${str(name.replace(/Seeder$/, "")).pascal()}Seeder`;
@@ -3254,7 +3408,7 @@ var CliApp = class {
3254
3408
  }
3255
3409
  /**
3256
3410
  * Generate a migration file for a given name.
3257
- *
3411
+ *
3258
3412
  * @param name The name of the migration.
3259
3413
  * @returns An object containing the name and path of the generated migration file.
3260
3414
  */
@@ -3270,10 +3424,10 @@ var CliApp = class {
3270
3424
  }
3271
3425
  /**
3272
3426
  * Generate a model file along with optional factory, seeder, and migration files.
3273
- *
3274
- * @param name
3275
- * @param options
3276
- * @returns
3427
+ *
3428
+ * @param name
3429
+ * @param options
3430
+ * @returns
3277
3431
  */
3278
3432
  makeModel(name, options = {}) {
3279
3433
  const baseName = str(name.replace(/Model$/, "")).pascal().toString();
@@ -3317,10 +3471,10 @@ var CliApp = class {
3317
3471
  return created;
3318
3472
  }
3319
3473
  /**
3320
- * Ensure that the Prisma schema has a model entry for the given model
3474
+ * Ensure that the Prisma schema has a model entry for the given model
3321
3475
  * and table names.
3322
3476
  * If the entry does not exist, it will be created with a default `id` field.
3323
- *
3477
+ *
3324
3478
  * @param modelName The name of the model to ensure in the Prisma schema.
3325
3479
  * @param tableName The table name to ensure in the Prisma schema.
3326
3480
  */
@@ -3352,7 +3506,7 @@ var CliApp = class {
3352
3506
  }
3353
3507
  /**
3354
3508
  * Convert a Prisma scalar type to its corresponding TypeScript type.
3355
- *
3509
+ *
3356
3510
  * @param value The Prisma scalar type.
3357
3511
  * @returns The corresponding TypeScript type.
3358
3512
  */
@@ -3645,9 +3799,9 @@ var CliApp = class {
3645
3799
  return isList ? `Array<${baseType}>` : baseType;
3646
3800
  }
3647
3801
  /**
3648
- * Parse the Prisma schema to extract model definitions and their fields, focusing
3802
+ * Parse the Prisma schema to extract model definitions and their fields, focusing
3649
3803
  * on scalar types.
3650
- *
3804
+ *
3651
3805
  * @param schema The Prisma schema as a string.
3652
3806
  * @returns An array of model definitions with their fields.
3653
3807
  */
@@ -3695,11 +3849,11 @@ var CliApp = class {
3695
3849
  return models;
3696
3850
  }
3697
3851
  /**
3698
- * Sync model attribute declarations in a model file based on the
3852
+ * Sync model attribute declarations in a model file based on the
3699
3853
  * provided declarations.
3700
- * This method takes the source code of a model file and a list of
3854
+ * This method takes the source code of a model file and a list of
3701
3855
  * attribute declarations,
3702
- *
3856
+ *
3703
3857
  * @param modelSource The source code of the model file.
3704
3858
  * @param declarations A list of attribute declarations to sync.
3705
3859
  * @returns An object containing the updated content and a flag indicating if it was updated.
@@ -3795,12 +3949,12 @@ var CliApp = class {
3795
3949
  }
3796
3950
  /**
3797
3951
  * Sync model attribute declarations in model files based on the Prisma schema.
3798
- * This method reads the Prisma schema to extract model definitions and their
3799
- * scalar fields, then updates the corresponding model files to include `declare`
3952
+ * This method reads the Prisma schema to extract model definitions and their
3953
+ * scalar fields, then updates the corresponding model files to include `declare`
3800
3954
  * statements for these fields. It returns an object containing the paths of the
3801
- * schema and models, the total number of model files processed, and lists of
3955
+ * schema and models, the total number of model files processed, and lists of
3802
3956
  * updated and skipped files.
3803
- *
3957
+ *
3804
3958
  * @param options Optional parameters to specify custom paths for the Prisma schema and models directory.
3805
3959
  * @returns An object with details about the synchronization process, including updated and skipped files.
3806
3960
  */
@@ -3831,7 +3985,7 @@ var CliApp = class {
3831
3985
  //#endregion
3832
3986
  //#region src/cli/commands/InitCommand.ts
3833
3987
  /**
3834
- * The InitCommand class implements the CLI command for initializing Arkormˣ by creating
3988
+ * The InitCommand class implements the CLI command for initializing Arkormˣ by creating
3835
3989
  * a default config file in the current directory.
3836
3990
  *
3837
3991
  * @author Legacy (3m1n3nc3)
@@ -3890,8 +4044,8 @@ var MakeFactoryCommand = class extends Command {
3890
4044
  }
3891
4045
  /**
3892
4046
  * Command handler for the make:factory command.
3893
- *
3894
- * @returns
4047
+ *
4048
+ * @returns
3895
4049
  */
3896
4050
  async handle() {
3897
4051
  this.app.command = this;
@@ -3920,8 +4074,8 @@ var MakeMigrationCommand = class extends Command {
3920
4074
  }
3921
4075
  /**
3922
4076
  * Command handler for the make:migration command.
3923
- *
3924
- * @returns
4077
+ *
4078
+ * @returns
3925
4079
  */
3926
4080
  async handle() {
3927
4081
  this.app.command = this;
@@ -3935,7 +4089,7 @@ var MakeMigrationCommand = class extends Command {
3935
4089
  //#endregion
3936
4090
  //#region src/cli/commands/MakeModelCommand.ts
3937
4091
  /**
3938
- * The MakeModelCommand class implements the CLI command for creating new model
4092
+ * The MakeModelCommand class implements the CLI command for creating new model
3939
4093
  * classes along with optional linked resources such as factories, seeders, and migrations.
3940
4094
  *
3941
4095
  * @author Legacy (3m1n3nc3)
@@ -3957,8 +4111,8 @@ var MakeModelCommand = class extends Command {
3957
4111
  }
3958
4112
  /**
3959
4113
  * Command handler for the make:model command.
3960
- *
3961
- * @returns
4114
+ *
4115
+ * @returns
3962
4116
  */
3963
4117
  async handle() {
3964
4118
  this.app.command = this;
@@ -4008,8 +4162,8 @@ var MakeSeederCommand = class extends Command {
4008
4162
  //#region src/database/Migration.ts
4009
4163
  const MIGRATION_BRAND = Symbol.for("arkormx.migration");
4010
4164
  /**
4011
- * The Migration class serves as a base for defining database migrations, requiring
4012
- * the implementation of `up` and `down` methods to specify the changes to be
4165
+ * The Migration class serves as a base for defining database migrations, requiring
4166
+ * the implementation of `up` and `down` methods to specify the changes to be
4013
4167
  * applied or reverted in the database schema.
4014
4168
  *
4015
4169
  * @author Legacy (3m1n3nc3)
@@ -4024,7 +4178,7 @@ var Migration = class {
4024
4178
  //#endregion
4025
4179
  //#region src/cli/commands/MigrateCommand.ts
4026
4180
  /**
4027
- * The MigrateCommand class implements the CLI command for applying migration
4181
+ * The MigrateCommand class implements the CLI command for applying migration
4028
4182
  * classes to the Prisma schema and running the Prisma workflow.
4029
4183
  *
4030
4184
  * @author Legacy (3m1n3nc3)
@@ -4048,12 +4202,12 @@ var MigrateCommand = class extends Command {
4048
4202
  }
4049
4203
  /**
4050
4204
  * Command handler for the migrate command.
4051
- * This method is responsible for orchestrating the migration
4052
- * process, including loading migration classes, applying them to
4053
- * the Prisma schema, and running the appropriate Prisma commands
4205
+ * This method is responsible for orchestrating the migration
4206
+ * process, including loading migration classes, applying them to
4207
+ * the Prisma schema, and running the appropriate Prisma commands
4054
4208
  * based on the provided options.
4055
- *
4056
- * @returns
4209
+ *
4210
+ * @returns
4057
4211
  */
4058
4212
  async handle() {
4059
4213
  this.app.command = this;
@@ -4168,10 +4322,10 @@ var MigrateCommand = class extends Command {
4168
4322
  }
4169
4323
  /**
4170
4324
  * Load migration classes from a specific file or by class name.
4171
- *
4172
- * @param migrationsDir
4173
- * @param name
4174
- * @returns
4325
+ *
4326
+ * @param migrationsDir
4327
+ * @param name
4328
+ * @returns
4175
4329
  */
4176
4330
  async loadNamedMigration(migrationsDirs, name) {
4177
4331
  if (!name) return [[void 0, ""]];
@@ -4194,9 +4348,9 @@ var MigrateCommand = class extends Command {
4194
4348
  }
4195
4349
  /**
4196
4350
  * Load migration classes from a given file path.
4197
- *
4198
- * @param filePath
4199
- * @returns
4351
+ *
4352
+ * @param filePath
4353
+ * @returns
4200
4354
  */
4201
4355
  async loadMigrationClassesFromFile(filePath) {
4202
4356
  const imported = await RuntimeModuleLoader.load(filePath);
@@ -4615,7 +4769,7 @@ var ModelsSyncCommand = class extends Command {
4615
4769
  //#region src/database/Seeder.ts
4616
4770
  const SEEDER_BRAND = Symbol.for("arkormx.seeder");
4617
4771
  /**
4618
- * The Seeder class serves as a base for defining database seeders, which are
4772
+ * The Seeder class serves as a base for defining database seeders, which are
4619
4773
  * used to populate the database with initial or test data.
4620
4774
  *
4621
4775
  * @author Legacy (3m1n3nc3)
@@ -4630,7 +4784,7 @@ var Seeder = class Seeder {
4630
4784
  }
4631
4785
  /**
4632
4786
  * Runs one or more seeders.
4633
- *
4787
+ *
4634
4788
  * @param seeders The seeders to be run.
4635
4789
  */
4636
4790
  async call(...seeders) {
@@ -4638,9 +4792,9 @@ var Seeder = class Seeder {
4638
4792
  }
4639
4793
  /**
4640
4794
  * Run seeders and return every seeder class executed, including nested calls.
4641
- *
4642
- * @param seeders
4643
- * @returns
4795
+ *
4796
+ * @param seeders
4797
+ * @returns
4644
4798
  */
4645
4799
  static async runWithReport(...seeders) {
4646
4800
  const report = [];
@@ -4650,8 +4804,8 @@ var Seeder = class Seeder {
4650
4804
  return report;
4651
4805
  }
4652
4806
  /**
4653
- * Converts a SeederInput into a Seeder instance.
4654
- *
4807
+ * Converts a SeederInput into a Seeder instance.
4808
+ *
4655
4809
  * @param input The SeederInput to convert.
4656
4810
  * @returns A Seeder instance.
4657
4811
  */
@@ -4664,7 +4818,7 @@ var Seeder = class Seeder {
4664
4818
  }
4665
4819
  /**
4666
4820
  * Runs the given seeders in sequence.
4667
- *
4821
+ *
4668
4822
  * @param seeders The seeders to be run.
4669
4823
  */
4670
4824
  static async runSeeders(...seeders) {
@@ -4684,7 +4838,7 @@ var Seeder = class Seeder {
4684
4838
  //#endregion
4685
4839
  //#region src/cli/commands/SeedCommand.ts
4686
4840
  /**
4687
- * The SeedCommand class implements the CLI command for running seeder classes.
4841
+ * The SeedCommand class implements the CLI command for running seeder classes.
4688
4842
  *
4689
4843
  * @author Legacy (3m1n3nc3)
4690
4844
  * @since 0.1.0
@@ -4700,8 +4854,8 @@ var SeedCommand = class extends Command {
4700
4854
  }
4701
4855
  /**
4702
4856
  * Command handler for the seed command.
4703
- *
4704
- * @returns
4857
+ *
4858
+ * @returns
4705
4859
  */
4706
4860
  async handle() {
4707
4861
  this.app.command = this;
@@ -4717,9 +4871,9 @@ var SeedCommand = class extends Command {
4717
4871
  }
4718
4872
  /**
4719
4873
  * Load all seeder classes from the specified directory.
4720
- *
4721
- * @param seedersDir
4722
- * @returns
4874
+ *
4875
+ * @param seedersDir
4876
+ * @returns
4723
4877
  */
4724
4878
  resolveSeederDirectories(configuredSeedersDir) {
4725
4879
  return [this.app.resolveRuntimeDirectoryPath(configuredSeedersDir), ...getRegisteredPaths("seeders").map((directory) => this.app.resolveRuntimeDirectoryPath(directory))].filter((directory, index, all) => existsSync$1(directory) && all.indexOf(directory) === index);
@@ -4730,10 +4884,10 @@ var SeedCommand = class extends Command {
4730
4884
  }
4731
4885
  /**
4732
4886
  * Load seeder classes from a specific file or by class name.
4733
- *
4734
- * @param seedersDir
4735
- * @param name
4736
- * @returns
4887
+ *
4888
+ * @param seedersDir
4889
+ * @param name
4890
+ * @returns
4737
4891
  */
4738
4892
  async loadNamedSeeder(seedersDirs, name) {
4739
4893
  const base = name.replace(/Seeder$/, "");
@@ -4755,7 +4909,7 @@ var SeedCommand = class extends Command {
4755
4909
  }
4756
4910
  /**
4757
4911
  * Load seeder classes from a given file path.
4758
- *
4912
+ *
4759
4913
  * @param filePath The path to the file containing seeder classes.
4760
4914
  * @returns An array of seeder classes.
4761
4915
  */