arkormx 2.9.1 → 2.9.3

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.
@@ -601,8 +601,8 @@ var TableBuilder = class {
601
601
  }
602
602
  /**
603
603
  * Defines a boolean column in the table.
604
- *
605
- * @param name The name of the boolean column.
604
+ *
605
+ * @param name The name of the boolean column.
606
606
  * @param options Additional options for the boolean column.
607
607
  * @returns The current TableBuilder instance for chaining.
608
608
  */
@@ -611,29 +611,29 @@ var TableBuilder = class {
611
611
  }
612
612
  /**
613
613
  * Defines a JSON column in the table.
614
- *
614
+ *
615
615
  * @param name The name of the JSON column.
616
616
  * @param options Additional options for the JSON column.
617
- * @returns
617
+ * @returns
618
618
  */
619
619
  json(name, options = {}) {
620
620
  return this.column(name, "json", options);
621
621
  }
622
622
  /**
623
623
  * Defines a date column in the table.
624
- *
624
+ *
625
625
  * @param name The name of the date column.
626
626
  * @param options Additional options for the date column.
627
- * @returns
627
+ * @returns
628
628
  */
629
629
  date(name, options = {}) {
630
630
  return this.column(name, "date", options);
631
631
  }
632
632
  /**
633
633
  * Defines colonns for a polymorphic relationship in the table.
634
- *
634
+ *
635
635
  * @param name The base name for the polymorphic relationship columns.
636
- * @returns
636
+ * @returns
637
637
  */
638
638
  morphs(name, nullable = false) {
639
639
  this.string(`${name}Type`, { nullable });
@@ -642,9 +642,9 @@ var TableBuilder = class {
642
642
  }
643
643
  /**
644
644
  * Defines columns for a polymorphic relationship in the table with UUID ID.
645
- *
645
+ *
646
646
  * @param name The base name for the polymorphic relationship columns.
647
- * @returns
647
+ * @returns
648
648
  */
649
649
  uuidMorphs(name, nullable = false) {
650
650
  this.string(`${name}Type`, { nullable });
@@ -653,28 +653,28 @@ var TableBuilder = class {
653
653
  }
654
654
  /**
655
655
  * Defines nullable columns for a polymorphic relationship in the table.
656
- *
656
+ *
657
657
  * @param name The base name for the polymorphic relationship columns.
658
- * @returns
658
+ * @returns
659
659
  */
660
660
  nullableMorphs(name) {
661
661
  return this.morphs(name, true);
662
662
  }
663
663
  /**
664
664
  * Defines nullable columns for a polymorphic relationship in the table with UUID ID.
665
- *
665
+ *
666
666
  * @param name The base name for the polymorphic relationship columns.
667
- * @returns
667
+ * @returns
668
668
  */
669
669
  nullableUuidMorphs(name) {
670
670
  return this.uuidMorphs(name, true);
671
671
  }
672
672
  /**
673
673
  * Defines a timestamp column in the table.
674
- *
674
+ *
675
675
  * @param name The name of the timestamp column.
676
676
  * @param options Additional options for the timestamp column.
677
- * @returns
677
+ * @returns
678
678
  */
679
679
  timestamp(name, options = {}) {
680
680
  return this.column(name, "timestamp", options);
@@ -735,9 +735,9 @@ var TableBuilder = class {
735
735
  }
736
736
  /**
737
737
  * Defines a soft delete timestamp column in the table.
738
- *
738
+ *
739
739
  * @param column The name of the soft delete column.
740
- * @returns
740
+ * @returns
741
741
  */
742
742
  softDeletes(column = "deletedAt") {
743
743
  this.timestamp(column, { nullable: true });
@@ -745,9 +745,9 @@ var TableBuilder = class {
745
745
  }
746
746
  /**
747
747
  * Defines a column to be dropped from the table in an alterTable operation.
748
- *
748
+ *
749
749
  * @param name The name of the column to drop.
750
- * @returns
750
+ * @returns
751
751
  */
752
752
  dropColumn(name) {
753
753
  this.dropColumnNames.push(name);
@@ -755,7 +755,7 @@ var TableBuilder = class {
755
755
  }
756
756
  /**
757
757
  * Marks a column as nullable.
758
- *
758
+ *
759
759
  * @param columnName Optional explicit column name. When omitted, applies to the latest defined column.
760
760
  * @returns The current TableBuilder instance for chaining.
761
761
  */
@@ -793,7 +793,7 @@ var TableBuilder = class {
793
793
  }
794
794
  /**
795
795
  * Sets the column position to appear after another column when possible.
796
- *
796
+ *
797
797
  * @param referenceColumn The column that the target column should be placed after.
798
798
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
799
799
  * @returns The current TableBuilder instance for chaining.
@@ -805,7 +805,7 @@ var TableBuilder = class {
805
805
  }
806
806
  /**
807
807
  * Maps the column to a custom database column name.
808
- *
808
+ *
809
809
  * @param name The custom database column name.
810
810
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
811
811
  * @returns The current TableBuilder instance for chaining.
@@ -817,7 +817,7 @@ var TableBuilder = class {
817
817
  }
818
818
  /**
819
819
  * Defines an index on one or more columns.
820
- *
820
+ *
821
821
  * @param columns Optional target columns. When omitted, applies to the latest defined column.
822
822
  * @param name Optional index name.
823
823
  * @returns The current TableBuilder instance for chaining.
@@ -846,11 +846,11 @@ var TableBuilder = class {
846
846
  return new ForeignKeyBuilder(entry);
847
847
  }
848
848
  /**
849
- * Defines a foreign key relation for a column, using a
849
+ * Defines a foreign key relation for a column, using a
850
850
  * conventional naming pattern.
851
- *
852
- * @param column
853
- * @returns
851
+ *
852
+ * @param column
853
+ * @returns
854
854
  */
855
855
  foreign(column) {
856
856
  const columnName = this.resolveColumn(column).name;
@@ -858,8 +858,8 @@ var TableBuilder = class {
858
858
  }
859
859
  /**
860
860
  * Returns a deep copy of the defined columns for the table.
861
- *
862
- * @returns
861
+ *
862
+ * @returns
863
863
  */
864
864
  getColumns() {
865
865
  return this.columns.map((column) => ({
@@ -869,15 +869,15 @@ var TableBuilder = class {
869
869
  }
870
870
  /**
871
871
  * Returns a copy of the defined column names to be dropped from the table.
872
- *
873
- * @returns
872
+ *
873
+ * @returns
874
874
  */
875
875
  getDropColumns() {
876
876
  return [...this.dropColumnNames];
877
877
  }
878
878
  /**
879
879
  * Returns a deep copy of the defined indexes for the table.
880
- *
880
+ *
881
881
  * @returns
882
882
  */
883
883
  getIndexes() {
@@ -914,11 +914,11 @@ var TableBuilder = class {
914
914
  }
915
915
  /**
916
916
  * Defines a column in the table with the given name.
917
- *
917
+ *
918
918
  * @param name The name of the column.
919
919
  * @param type The type of the column.
920
920
  * @param options Additional options for the column.
921
- * @returns
921
+ * @returns
922
922
  */
923
923
  column(name, type, options) {
924
924
  this.columns.push({
@@ -943,9 +943,9 @@ var TableBuilder = class {
943
943
  }
944
944
  /**
945
945
  * Resolve a target column by name or fallback to the latest defined column.
946
- *
947
- * @param columnName
948
- * @returns
946
+ *
947
+ * @param columnName
948
+ * @returns
949
949
  */
950
950
  resolveColumn(columnName) {
951
951
  const targetName = columnName ?? this.latestColumnName;
@@ -966,19 +966,84 @@ var TableBuilder = class {
966
966
  //#endregion
967
967
  //#region src/database/SchemaBuilder.ts
968
968
  /**
969
- * The SchemaBuilder class provides methods for defining the operations to be
970
- * performed in a migration, such as creating, altering, or dropping tables.
969
+ * The SchemaBuilder class provides methods for defining the operations to be
970
+ * performed in a migration, such as creating, altering, or dropping tables.
971
971
  *
972
972
  * @author Legacy (3m1n3nc3)
973
973
  * @since 0.1.0
974
974
  */
975
- var SchemaBuilder = class {
975
+ var SchemaBuilder = class SchemaBuilder {
976
976
  constructor() {
977
977
  this.operations = [];
978
978
  }
979
979
  /**
980
+ * Disable foreign-key constraint enforcement on the active PostgreSQL
981
+ * connection by switching the session into replication mode, which
982
+ * suppresses the internal triggers that enforce foreign keys.
983
+ *
984
+ * The setting is connection-scoped, so the disable, the work that depends
985
+ * on it, and the matching {@link SchemaBuilder.enableForeignKeyConstraints}
986
+ * must run on the same connection. Prefer
987
+ * {@link SchemaBuilder.withoutForeignKeyConstraints}, which guarantees this
988
+ * by wrapping the work in a transaction. Requires a SQL-backed adapter and
989
+ * a database role permitted to set `session_replication_role`.
990
+ *
991
+ * @returns
992
+ */
993
+ static async disableForeignKeyConstraints() {
994
+ await SchemaBuilder.setSessionReplicationRole("replica");
995
+ }
996
+ /**
997
+ * Re-enable foreign-key constraint enforcement on the active PostgreSQL
998
+ * connection by restoring the default session replication role.
999
+ *
1000
+ * @returns
1001
+ */
1002
+ static async enableForeignKeyConstraints() {
1003
+ await SchemaBuilder.setSessionReplicationRole("origin");
1004
+ }
1005
+ /**
1006
+ * Run the given callback with foreign-key constraints disabled, then
1007
+ * restore them. The whole unit runs inside a transaction so the disable,
1008
+ * the callback, and the re-enable share a single connection (required for
1009
+ * the connection-scoped replication role to take effect) and roll back
1010
+ * together on failure.
1011
+ *
1012
+ * @example
1013
+ * await SchemaBuilder.withoutForeignKeyConstraints(async () => {
1014
+ * await User.factory()
1015
+ * .hasAttached(Tenant.factory().has(Project.factory(3)), { status: 'active' }, 'tenantMemberships')
1016
+ * .create()
1017
+ * })
1018
+ *
1019
+ * @param callback
1020
+ * @returns
1021
+ */
1022
+ static async withoutForeignKeyConstraints(callback) {
1023
+ return await runArkormTransaction(async () => {
1024
+ await SchemaBuilder.disableForeignKeyConstraints();
1025
+ try {
1026
+ return await callback();
1027
+ } finally {
1028
+ await SchemaBuilder.enableForeignKeyConstraints();
1029
+ }
1030
+ });
1031
+ }
1032
+ static async setSessionReplicationRole(role) {
1033
+ const adapter = getRuntimeAdapter();
1034
+ if (!adapter) throw new ArkormException("Toggling foreign-key constraints requires a configured database adapter.", {
1035
+ code: "ADAPTER_NOT_CONFIGURED",
1036
+ operation: "schema.foreignKeyConstraints"
1037
+ });
1038
+ if (!adapter.rawQuery) throw new UnsupportedAdapterFeatureException("Toggling foreign-key constraints requires an adapter that supports raw queries.", {
1039
+ operation: "schema.foreignKeyConstraints",
1040
+ meta: { feature: "rawQuery" }
1041
+ });
1042
+ await adapter.rawQuery({ sql: `SET session_replication_role = '${role}'` });
1043
+ }
1044
+ /**
980
1045
  * Defines a new table to be created in the migration.
981
- *
1046
+ *
982
1047
  * @param table The name of the table to create.
983
1048
  * @param callback A callback function to define the table's columns and structure.
984
1049
  * @returns The current SchemaBuilder instance for chaining.
@@ -1002,7 +1067,7 @@ var SchemaBuilder = class {
1002
1067
  }
1003
1068
  /**
1004
1069
  * Defines alterations to an existing table in the migration.
1005
- *
1070
+ *
1006
1071
  * @param table The name of the table to alter.
1007
1072
  * @param callback A callback function to define the alterations to the table's columns and structure.
1008
1073
  * @returns The current SchemaBuilder instance for chaining.
@@ -1027,7 +1092,7 @@ var SchemaBuilder = class {
1027
1092
  }
1028
1093
  /**
1029
1094
  * Defines a table to be dropped in the migration.
1030
- *
1095
+ *
1031
1096
  * @param table The name of the table to drop.
1032
1097
  * @returns The current SchemaBuilder instance for chaining.
1033
1098
  */
@@ -1040,7 +1105,7 @@ var SchemaBuilder = class {
1040
1105
  }
1041
1106
  /**
1042
1107
  * Returns a deep copy of the defined schema operations for the migration/
1043
- *
1108
+ *
1044
1109
  * @returns An array of schema operations for the migration.
1045
1110
  */
1046
1111
  getOperations() {
@@ -1116,7 +1181,7 @@ const PRISMA_ENUM_REGEX = /enum\s+(\w+)\s*\{[\s\S]*?\n\}/g;
1116
1181
  const PRISMA_ENUM_MEMBER_REGEX = /^[A-Za-z][A-Za-z0-9_]*$/;
1117
1182
  /**
1118
1183
  * Convert a table name to a PascalCase model name, with basic singularization.
1119
- *
1184
+ *
1120
1185
  * @param tableName The name of the table to convert.
1121
1186
  * @returns The corresponding PascalCase model name.
1122
1187
  */
@@ -1128,16 +1193,16 @@ const toModelName = (tableName) => {
1128
1193
  };
1129
1194
  /**
1130
1195
  * Escape special characters in a string for use in a regular expression.
1131
- *
1132
- * @param value
1133
- * @returns
1196
+ *
1197
+ * @param value
1198
+ * @returns
1134
1199
  */
1135
1200
  const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1136
1201
  /**
1137
1202
  * Convert a SchemaColumn definition to a Prisma field type string, including modifiers.
1138
- *
1139
- * @param column
1140
- * @returns
1203
+ *
1204
+ * @param column
1205
+ * @returns
1141
1206
  */
1142
1207
  const resolvePrismaType = (column) => {
1143
1208
  if (column.type === "id") return "Int";
@@ -1156,11 +1221,11 @@ const resolveEnumName = (column) => {
1156
1221
  if (column.enumName && column.enumName.trim().length > 0) return column.enumName.trim();
1157
1222
  throw new ArkormException(`Enum column [${column.name}] must define an enum name.`);
1158
1223
  };
1159
- /**
1224
+ /**
1160
1225
  * Format a default value for inclusion in a Prisma schema field definition, based on its type.
1161
- *
1162
- * @param value
1163
- * @returns
1226
+ *
1227
+ * @param value
1228
+ * @returns
1164
1229
  */
1165
1230
  const formatDefaultValue = (value) => {
1166
1231
  if (value == null) return void 0;
@@ -1171,9 +1236,9 @@ const formatDefaultValue = (value) => {
1171
1236
  };
1172
1237
  /**
1173
1238
  * 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
1239
+ *
1240
+ * @param value
1241
+ * @returns
1177
1242
  */
1178
1243
  const formatEnumDefaultValue = (value) => {
1179
1244
  if (value == null) return void 0;
@@ -1182,9 +1247,9 @@ const formatEnumDefaultValue = (value) => {
1182
1247
  };
1183
1248
  /**
1184
1249
  * Normalize an enum value by ensuring it is a non-empty string and trimming whitespace.
1185
- *
1186
- * @param value
1187
- * @returns
1250
+ *
1251
+ * @param value
1252
+ * @returns
1188
1253
  */
1189
1254
  const normalizeEnumValue = (value) => {
1190
1255
  if (typeof value !== "string" || value.trim().length === 0) throw new ArkormException("Enum values must be provided as non-empty strings.");
@@ -1194,9 +1259,9 @@ const normalizeEnumValue = (value) => {
1194
1259
  };
1195
1260
  /**
1196
1261
  * Extract the enum values from a Prisma enum block string.
1197
- *
1198
- * @param block
1199
- * @returns
1262
+ *
1263
+ * @param block
1264
+ * @returns
1200
1265
  */
1201
1266
  const extractEnumBlockValues = (block) => {
1202
1267
  return block.split("\n").slice(1, -1).map((line) => line.trim()).filter(Boolean);
@@ -1212,11 +1277,11 @@ const validateEnumValues = (column, enumName, enumValues) => {
1212
1277
  };
1213
1278
  /**
1214
1279
  * 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
1280
+ *
1281
+ * @param column
1282
+ * @param enumName
1283
+ * @param enumValues
1284
+ * @returns
1220
1285
  */
1221
1286
  const validateEnumDefaultValue = (column, enumName, enumValues) => {
1222
1287
  if (column.default == null) return;
@@ -1226,9 +1291,9 @@ const validateEnumDefaultValue = (column, enumName, enumValues) => {
1226
1291
  };
1227
1292
  /**
1228
1293
  * Build a single line of a Prisma model field definition based on a SchemaColumn, including type and modifiers.
1229
- *
1230
- * @param column
1231
- * @returns
1294
+ *
1295
+ * @param column
1296
+ * @returns
1232
1297
  */
1233
1298
  const buildFieldLine = (column) => {
1234
1299
  if (column.type === "id") {
@@ -1250,9 +1315,9 @@ const buildFieldLine = (column) => {
1250
1315
  return ` ${column.name} ${scalar}${nullable}${primary}${unique}${defaultSuffix}${updatedAt}${mapped}`;
1251
1316
  };
1252
1317
  /**
1253
- * Build a Prisma enum block string based on an enum name and its values, validating that
1318
+ * Build a Prisma enum block string based on an enum name and its values, validating that
1254
1319
  * at least one value is provided.
1255
- *
1320
+ *
1256
1321
  * @param enumName The name of the enum to create.
1257
1322
  * @param values The array of values for the enum.
1258
1323
  * @returns The Prisma enum block string.
@@ -1262,12 +1327,12 @@ const buildEnumBlock = (enumName, values) => {
1262
1327
  return `enum ${enumName} {\n${values.map((value) => ` ${value}`).join("\n")}\n}`;
1263
1328
  };
1264
1329
  /**
1265
- * Find the Prisma enum block in a schema string that corresponds to a given enum
1330
+ * Find the Prisma enum block in a schema string that corresponds to a given enum
1266
1331
  * name, returning its details if found.
1267
- *
1332
+ *
1268
1333
  * @param schema The Prisma schema string to search for the enum block.
1269
1334
  * @param enumName The name of the enum to find in the schema.
1270
- * @returns
1335
+ * @returns
1271
1336
  */
1272
1337
  const findEnumBlock = (schema, enumName) => {
1273
1338
  const candidates = [...schema.matchAll(PRISMA_ENUM_REGEX)];
@@ -1286,13 +1351,13 @@ const findEnumBlock = (schema, enumName) => {
1286
1351
  return null;
1287
1352
  };
1288
1353
  /**
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
1354
+ * Ensure that Prisma enum blocks exist in the schema for any enum columns defined in a
1355
+ * create or alter table operation, adding them if necessary and validating against
1291
1356
  * existing blocks.
1292
- *
1357
+ *
1293
1358
  * @param schema The current Prisma schema string to check and modify.
1294
1359
  * @param columns The array of schema column definitions to check for enum types and ensure corresponding blocks exist for.
1295
- * @returns
1360
+ * @returns
1296
1361
  */
1297
1362
  const ensureEnumBlocks = (schema, columns) => {
1298
1363
  let nextSchema = schema;
@@ -1322,9 +1387,9 @@ const ensureEnumBlocks = (schema, columns) => {
1322
1387
  };
1323
1388
  /**
1324
1389
  * Build a Prisma model-level @@index definition line.
1325
- *
1390
+ *
1326
1391
  * @param index The schema index definition to convert to a Prisma \@\@index line.
1327
- * @returns
1392
+ * @returns
1328
1393
  */
1329
1394
  const buildIndexLine = (index) => {
1330
1395
  return ` @@index([${index.columns.join(", ")}]${typeof index.name === "string" && index.name.trim().length > 0 ? `, name: "${index.name.replace(/"/g, "\\\"")}"` : ""})`;
@@ -1348,9 +1413,9 @@ const buildUniqueConstraintLine = (constraint) => {
1348
1413
  return ` @@unique([${constraint.columns.join(", ")}]${typeof constraint.name === "string" && constraint.name.trim().length > 0 ? `, name: "${constraint.name.replace(/"/g, "\\\"")}"` : ""})`;
1349
1414
  };
1350
1415
  /**
1351
- * Derive a relation field name from a foreign key column name by applying
1416
+ * Derive a relation field name from a foreign key column name by applying
1352
1417
  * common conventions, such as removing "Id" suffixes and converting to camelCase.
1353
- *
1418
+ *
1354
1419
  * @param columnName The name of the foreign key column.
1355
1420
  * @returns The derived relation field name.
1356
1421
  */
@@ -1365,10 +1430,10 @@ const deriveRelationFieldName = (columnName) => {
1365
1430
  return `${trimmed.charAt(0).toLowerCase()}${trimmed.slice(1)}`;
1366
1431
  };
1367
1432
  /**
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
1433
+ * Derive a relation name for both sides of a relation based on the
1434
+ * source and target model names, using an explicit alias if provided or a
1370
1435
  * convention of combining the full source model name with the target model name.
1371
- *
1436
+ *
1372
1437
  * @param sourceModelName The name of the source model in the relation.
1373
1438
  * @param targetModelName The name of the target model in the relation.
1374
1439
  * @param explicitAlias An optional explicit alias for the relation.
@@ -1394,9 +1459,9 @@ const resolveForeignKeyColumn = (columns, foreignKey) => {
1394
1459
  const isOneToOneForeignKey = (column) => {
1395
1460
  return Boolean(column?.unique || column?.primary);
1396
1461
  };
1397
- /**
1462
+ /**
1398
1463
  * Format a SchemaForeignKeyAction value as a Prisma onDelete action string.
1399
- *
1464
+ *
1400
1465
  * @param action The foreign key action to format.
1401
1466
  * @returns The corresponding Prisma onDelete action string.
1402
1467
  */
@@ -1408,9 +1473,9 @@ const formatRelationAction = (action) => {
1408
1473
  return "NoAction";
1409
1474
  };
1410
1475
  /**
1411
- * Build a Prisma relation field line based on a SchemaForeignKey
1476
+ * Build a Prisma relation field line based on a SchemaForeignKey
1412
1477
  * definition, including relation name and onDelete action.
1413
- *
1478
+ *
1414
1479
  * @param foreignKey The foreign key definition to convert to a relation line.
1415
1480
  * @returns The corresponding Prisma schema line for the relation field.
1416
1481
  */
@@ -1426,10 +1491,10 @@ const buildRelationLine = (sourceModelName, foreignKey, columns = []) => {
1426
1491
  return ` ${fieldName} ${targetModel}${optional} @relation("${relationName.replace(/"/g, "\\\"")}", fields: [${foreignKey.column}], references: [${foreignKey.referencesColumn}]${onDelete})`;
1427
1492
  };
1428
1493
  /**
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
1494
+ * Build a Prisma relation field line for the inverse side of a relation, based
1495
+ * on the source and target model names and the foreign key definition, using
1431
1496
  * naming conventions and any explicit inverse alias provided.
1432
- *
1497
+ *
1433
1498
  * @param sourceModelName The name of the source model in the relation.
1434
1499
  * @param targetModelName The name of the target model in the relation.
1435
1500
  * @param foreignKey The foreign key definition for the relation.
@@ -1442,14 +1507,14 @@ const buildInverseRelationLine = (sourceModelName, targetModelName, foreignKey,
1442
1507
  return ` ${fieldName} ${isOneToOneForeignKey(sourceColumn) ? `${sourceModelName}?` : `${sourceModelName}[]`} @relation("${relationName.replace(/"/g, "\\\"")}")`;
1443
1508
  };
1444
1509
  /**
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
1510
+ * Inject a line into the body of a Prisma model block if it does not already
1511
+ * exist, using a provided existence check function to determine if the line
1447
1512
  * is already present.
1448
- *
1513
+ *
1449
1514
  * @param bodyLines The lines of the model block body to modify.
1450
1515
  * @param line The line to inject if it does not already exist.
1451
1516
  * @param exists A function that checks if a given line already exists in the body.
1452
- * @returns
1517
+ * @returns
1453
1518
  */
1454
1519
  const injectLineIntoModelBody = (bodyLines, line, exists) => {
1455
1520
  if (bodyLines.some(exists)) return bodyLines;
@@ -1458,10 +1523,10 @@ const injectLineIntoModelBody = (bodyLines, line, exists) => {
1458
1523
  return bodyLines;
1459
1524
  };
1460
1525
  /**
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
1526
+ * Apply inverse relation definitions to a Prisma schema string based on the
1527
+ * foreign keys defined in a create or alter table operation, ensuring that
1463
1528
  * related models have corresponding relation fields for bi-directional navigation.
1464
- *
1529
+ *
1465
1530
  * @param schema The Prisma schema string to modify.
1466
1531
  * @param sourceModelName The name of the source model in the relation.
1467
1532
  * @param foreignKeys An array of foreign key definitions to process.
@@ -1484,9 +1549,9 @@ const applyInverseRelations = (schema, sourceModelName, foreignKeys, columns = [
1484
1549
  return nextSchema;
1485
1550
  };
1486
1551
  /**
1487
- * Build a Prisma model block string based on a SchemaTableCreateOperation, including
1552
+ * Build a Prisma model block string based on a SchemaTableCreateOperation, including
1488
1553
  * all fields and any necessary mapping.
1489
- *
1554
+ *
1490
1555
  * @param operation The schema table create operation to convert.
1491
1556
  * @returns The corresponding Prisma model block string.
1492
1557
  */
@@ -1511,12 +1576,12 @@ const buildModelBlock = (operation) => {
1511
1576
  ] : [...fields, ...relations]).join("\n")}\n}`;
1512
1577
  };
1513
1578
  /**
1514
- * Find the Prisma model block in a schema string that corresponds to a given
1579
+ * Find the Prisma model block in a schema string that corresponds to a given
1515
1580
  * table name, using both explicit mapping and naming conventions.
1516
- *
1517
- * @param schema
1518
- * @param table
1519
- * @returns
1581
+ *
1582
+ * @param schema
1583
+ * @param table
1584
+ * @returns
1520
1585
  */
1521
1586
  const findModelBlock = (schema, table) => {
1522
1587
  const candidates = [...schema.matchAll(PRISMA_MODEL_REGEX)];
@@ -1548,9 +1613,9 @@ const findModelBlock = (schema, table) => {
1548
1613
  return null;
1549
1614
  };
1550
1615
  /**
1551
- * Apply a create table operation to a Prisma schema string, adding a new model
1616
+ * Apply a create table operation to a Prisma schema string, adding a new model
1552
1617
  * block for the specified table and fields.
1553
- *
1618
+ *
1554
1619
  * @param schema The current Prisma schema string.
1555
1620
  * @param operation The schema table create operation to apply.
1556
1621
  * @returns The updated Prisma schema string with the new model block.
@@ -1562,9 +1627,9 @@ const applyCreateTableOperation = (schema, operation) => {
1562
1627
  return applyInverseRelations(`${schemaWithEnums.trimEnd()}\n\n${block}\n`, toModelName(operation.table), operation.foreignKeys ?? [], operation.columns);
1563
1628
  };
1564
1629
  /**
1565
- * Apply an alter table operation to a Prisma schema string, modifying the model
1630
+ * Apply an alter table operation to a Prisma schema string, modifying the model
1566
1631
  * block for the specified table by adding and removing fields as needed.
1567
- *
1632
+ *
1568
1633
  * @param schema The current Prisma schema string.
1569
1634
  * @param operation The schema table alter operation to apply.
1570
1635
  * @returns The updated Prisma schema string with the modified model block.
@@ -1631,10 +1696,10 @@ const applyDropTableOperation = (schema, operation) => {
1631
1696
  return `${before}${before && after ? "\n\n" : ""}${after}`;
1632
1697
  };
1633
1698
  /**
1634
- * The SchemaBuilder class provides a fluent interface for defining
1635
- * database schema operations in a migration, such as creating, altering, and
1699
+ * The SchemaBuilder class provides a fluent interface for defining
1700
+ * database schema operations in a migration, such as creating, altering, and
1636
1701
  * dropping tables.
1637
- *
1702
+ *
1638
1703
  * @param schema The current Prisma schema string.
1639
1704
  * @param operations The list of schema operations to apply.
1640
1705
  * @returns The updated Prisma schema string after applying all operations.
@@ -1648,7 +1713,7 @@ const applyOperationsToPrismaSchema = (schema, operations) => {
1648
1713
  };
1649
1714
  /**
1650
1715
  * Run a Prisma CLI command using npx, capturing and throwing any errors that occur.
1651
- *
1716
+ *
1652
1717
  * @param args The arguments to pass to the Prisma CLI command.
1653
1718
  * @param cwd The current working directory to run the command in.
1654
1719
  * @returns void
@@ -1663,11 +1728,11 @@ const runPrismaCommand = (args, cwd) => {
1663
1728
  throw new ArkormException(errorOutput ? `Prisma command failed: prisma ${args.join(" ")}\n${errorOutput}` : `Prisma command failed: prisma ${args.join(" ")}`);
1664
1729
  };
1665
1730
  /**
1666
- * Generate a new migration file with a given name and options, including
1731
+ * Generate a new migration file with a given name and options, including
1667
1732
  * writing the file to disk if specified.
1668
- *
1669
- * @param name
1670
- * @returns
1733
+ *
1734
+ * @param name
1735
+ * @returns
1671
1736
  */
1672
1737
  const resolveMigrationClassName = (name) => {
1673
1738
  const cleaned = name.replace(/[^a-zA-Z0-9]+/g, " ").trim();
@@ -1675,39 +1740,39 @@ const resolveMigrationClassName = (name) => {
1675
1740
  return `${cleaned.split(/\s+/g).map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join("")}Migration`;
1676
1741
  };
1677
1742
  /**
1678
- * Pad a number with leading zeros to ensure it is at least two digits, for
1743
+ * Pad a number with leading zeros to ensure it is at least two digits, for
1679
1744
  * use in migration timestamps.
1680
- *
1681
- * @param value
1682
- * @returns
1745
+ *
1746
+ * @param value
1747
+ * @returns
1683
1748
  */
1684
1749
  const pad = (value) => String(value).padStart(2, "0");
1685
1750
  /**
1686
- * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
1751
+ * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
1687
1752
  * file names, based on the current date and time or a provided date.
1688
- *
1689
- * @param date
1690
- * @returns
1753
+ *
1754
+ * @param date
1755
+ * @returns
1691
1756
  */
1692
1757
  const createMigrationTimestamp = (date = /* @__PURE__ */ new Date()) => {
1693
1758
  return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}`;
1694
1759
  };
1695
1760
  /**
1696
- * Convert a migration name to a slug suitable for use in a file name, by
1761
+ * Convert a migration name to a slug suitable for use in a file name, by
1697
1762
  * lowercasing and replacing non-alphanumeric characters with underscores.
1698
- *
1699
- * @param name
1700
- * @returns
1763
+ *
1764
+ * @param name
1765
+ * @returns
1701
1766
  */
1702
1767
  const toMigrationFileSlug = (name) => {
1703
1768
  return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "migration";
1704
1769
  };
1705
1770
  /**
1706
- * Build the source code for a new migration file based on a given class
1771
+ * Build the source code for a new migration file based on a given class
1707
1772
  * name, using a template with empty up and down methods.
1708
- *
1709
- * @param className
1710
- * @returns
1773
+ *
1774
+ * @param className
1775
+ * @returns
1711
1776
  */
1712
1777
  const buildMigrationSource = (className, extension = "ts") => {
1713
1778
  if (extension === "js") return [
@@ -1744,12 +1809,12 @@ const buildMigrationSource = (className, extension = "ts") => {
1744
1809
  ].join("\n");
1745
1810
  };
1746
1811
  /**
1747
- * Generate a new migration file with a given name and options, including
1812
+ * Generate a new migration file with a given name and options, including
1748
1813
  * writing the file to disk if specified, and return the details of the generated file.
1749
- *
1750
- * @param name
1751
- * @param options
1752
- * @returns
1814
+ *
1815
+ * @param name
1816
+ * @param options
1817
+ * @returns
1753
1818
  */
1754
1819
  const generateMigrationFile = (name, options = {}) => {
1755
1820
  const timestamp = createMigrationTimestamp(/* @__PURE__ */ new Date());
@@ -1774,10 +1839,10 @@ const generateMigrationFile = (name, options = {}) => {
1774
1839
  };
1775
1840
  /**
1776
1841
  * 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
- *
1842
+ *
1778
1843
  * @param migration The migration class or instance to analyze.
1779
1844
  * @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.
1845
+ * @returns A promise that resolves to an array of schema operations that would be performed.
1781
1846
  */
1782
1847
  const getMigrationPlan = async (migration, direction = "up") => {
1783
1848
  const instance = typeof migration === "function" ? new migration() : migration;
@@ -1812,10 +1877,10 @@ const applyMigrationRollbackToDatabase = async (adapter, migration) => {
1812
1877
  return { operations };
1813
1878
  };
1814
1879
  /**
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
1880
+ * Apply the schema operations defined in a migration to a Prisma schema
1881
+ * file, updating the file on disk if specified, and return the updated
1817
1882
  * schema and list of operations applied.
1818
- *
1883
+ *
1819
1884
  * @param migration The migration class or instance to apply.
1820
1885
  * @param options Options for applying the migration, including schema path and write flag.
1821
1886
  * @returns A promise that resolves to an object containing the updated schema, schema path, and list of operations applied.
@@ -2192,17 +2257,17 @@ const pushUnique = (items, values) => {
2192
2257
  const normalizeConstructors = (items) => items.flatMap((item) => Array.isArray(item) ? item : [item]).filter(Boolean);
2193
2258
  /**
2194
2259
  * Register model constructors directly without relying on runtime discovery.
2195
- *
2196
- * @param models
2260
+ *
2261
+ * @param models
2197
2262
  */
2198
2263
  const registerModels = (...models) => {
2199
2264
  pushUnique(registry.models, normalizeConstructors(models));
2200
2265
  };
2201
2266
  /**
2202
2267
  * Get registered runtime discovery paths or registered constructors for a specific type.
2203
- *
2204
- * @param key
2205
- * @returns
2268
+ *
2269
+ * @param key
2270
+ * @returns
2206
2271
  */
2207
2272
  const getRegisteredPaths = (key) => {
2208
2273
  if (key) return [...registry.paths[key]];
@@ -2215,14 +2280,14 @@ const getRegisteredPaths = (key) => {
2215
2280
  };
2216
2281
  /**
2217
2282
  * Get registered migration constructors instances.
2218
- *
2219
- * @returns
2283
+ *
2284
+ * @returns
2220
2285
  */
2221
2286
  const getRegisteredMigrations = () => [...registry.migrations];
2222
2287
  /**
2223
2288
  * Get registered seeder constructors instances.
2224
- *
2225
- * @returns
2289
+ *
2290
+ * @returns
2226
2291
  */
2227
2292
  const getRegisteredSeeders = () => [...registry.seeders];
2228
2293
 
@@ -2318,9 +2383,9 @@ const mergePathConfig = (paths) => {
2318
2383
  };
2319
2384
  /**
2320
2385
  * Merge the feature configuration from the base defaults, user configuration, and provided options.
2321
- *
2322
- * @param features
2323
- * @returns
2386
+ *
2387
+ * @param features
2388
+ * @returns
2324
2389
  */
2325
2390
  const mergeFeatureConfig = (features) => {
2326
2391
  const defaults = baseConfig.features ?? {};
@@ -2376,10 +2441,10 @@ const awaitConfiguredModelsRegistration = async () => {
2376
2441
  };
2377
2442
  /**
2378
2443
  * Bind a database adapter instance to an array of models that support adapter binding.
2379
- *
2380
- * @param adapter
2381
- * @param models
2382
- * @returns
2444
+ *
2445
+ * @param adapter
2446
+ * @param models
2447
+ * @returns
2383
2448
  */
2384
2449
  const bindAdapterToModels = (adapter, models) => {
2385
2450
  models.forEach((model) => {
@@ -2388,10 +2453,10 @@ const bindAdapterToModels = (adapter, models) => {
2388
2453
  return adapter;
2389
2454
  };
2390
2455
  /**
2391
- * Get the user-provided ArkORM configuration.
2392
- *
2456
+ * Get the user-provided ArkORM configuration.
2457
+ *
2393
2458
  * @param key Optional specific configuration key to retrieve. If omitted, the entire configuration object is returned.
2394
- * @returns The user-provided ArkORM configuration object.
2459
+ * @returns The user-provided ArkORM configuration object.
2395
2460
  */
2396
2461
  const getUserConfig = (key) => {
2397
2462
  if (key) return userConfig[key];
@@ -2400,8 +2465,8 @@ const getUserConfig = (key) => {
2400
2465
  /**
2401
2466
  * Configure the ArkORM runtime with the provided runtime client resolver and
2402
2467
  * adapter-first options.
2403
- *
2404
- * @param client
2468
+ *
2469
+ * @param client
2405
2470
  * @param options
2406
2471
  */
2407
2472
  const configureArkormRuntime = (client, options = {}) => {
@@ -2436,9 +2501,9 @@ const configureArkormRuntime = (client, options = {}) => {
2436
2501
  /**
2437
2502
  * Resolve a runtime client instance from the provided resolver, which can be either
2438
2503
  * a direct client instance or a function that returns a client instance.
2439
- *
2440
- * @param resolver
2441
- * @returns
2504
+ *
2505
+ * @param resolver
2506
+ * @returns
2442
2507
  */
2443
2508
  const resolveClient = (resolver) => {
2444
2509
  if (!resolver) return void 0;
@@ -2447,12 +2512,12 @@ const resolveClient = (resolver) => {
2447
2512
  return client;
2448
2513
  };
2449
2514
  /**
2450
- * Resolve and apply the ArkORM configuration from an imported module.
2515
+ * Resolve and apply the ArkORM configuration from an imported module.
2451
2516
  * This function checks for a default export and falls back to the module itself, then validates
2452
2517
  * the configuration object and applies it to the runtime if valid.
2453
- *
2454
- * @param imported
2455
- * @returns
2518
+ *
2519
+ * @param imported
2520
+ * @returns
2456
2521
  */
2457
2522
  const resolveAndApplyConfig = (imported) => {
2458
2523
  const config = imported?.default ?? imported;
@@ -2472,11 +2537,11 @@ const resolveAndApplyConfig = (imported) => {
2472
2537
  runtimeConfigLoaded = true;
2473
2538
  };
2474
2539
  /**
2475
- * Dynamically import a configuration file.
2540
+ * Dynamically import a configuration file.
2476
2541
  * 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.
2542
+ *
2543
+ * @param configPath
2544
+ * @returns A promise that resolves to the imported configuration module.
2480
2545
  */
2481
2546
  const importConfigFile = (configPath) => {
2482
2547
  return RuntimeModuleLoader.load(configPath);
@@ -2496,9 +2561,9 @@ const loadRuntimeConfigSync = () => {
2496
2561
  return false;
2497
2562
  };
2498
2563
  /**
2499
- * Load the ArkORM configuration by searching for configuration files in the
2564
+ * Load the ArkORM configuration by searching for configuration files in the
2500
2565
  * current working directory.
2501
- * @returns
2566
+ * @returns
2502
2567
  */
2503
2568
  const loadArkormConfig = async () => {
2504
2569
  if (runtimeConfigLoaded) {
@@ -2531,6 +2596,65 @@ const loadArkormConfig = async () => {
2531
2596
  const getDefaultStubsPath = () => {
2532
2597
  return resolveDefaultStubsPath();
2533
2598
  };
2599
+ /**
2600
+ * Get the runtime compatibility client.
2601
+ * This function will trigger the loading of the ArkORM configuration if
2602
+ * it hasn't already been loaded.
2603
+ *
2604
+ * @returns
2605
+ */
2606
+ const getRuntimeClient = () => {
2607
+ const activeTransactionClient = transactionClientStorage.getStore();
2608
+ if (activeTransactionClient) return activeTransactionClient;
2609
+ if (!runtimeConfigLoaded) loadRuntimeConfigSync();
2610
+ return resolveClient(runtimeClientResolver);
2611
+ };
2612
+ /**
2613
+ * Get the currently configured runtime adapter, if any.
2614
+ *
2615
+ * @returns
2616
+ */
2617
+ const getRuntimeAdapter = () => {
2618
+ const activeTransactionAdapter = transactionAdapterStorage.getStore();
2619
+ if (activeTransactionAdapter) return activeTransactionAdapter;
2620
+ if (!runtimeConfigLoaded) loadRuntimeConfigSync();
2621
+ return runtimeAdapter;
2622
+ };
2623
+ const isTransactionCapableClient = (value) => {
2624
+ if (!value || typeof value !== "object") return false;
2625
+ return typeof value.$transaction === "function";
2626
+ };
2627
+ const runArkormTransaction = async (callback, options = {}, preferredAdapter) => {
2628
+ const activeTransactionAdapter = transactionAdapterStorage.getStore();
2629
+ const activeTransactionClient = transactionClientStorage.getStore();
2630
+ if (activeTransactionAdapter || activeTransactionClient) return await callback({
2631
+ adapter: activeTransactionAdapter,
2632
+ client: activeTransactionClient
2633
+ });
2634
+ const adapter = preferredAdapter ?? getRuntimeAdapter();
2635
+ if (adapter) return await adapter.transaction(async (transactionAdapter) => {
2636
+ return await transactionAdapterStorage.run(transactionAdapter, async () => {
2637
+ return await callback({
2638
+ adapter: transactionAdapter,
2639
+ client: transactionClientStorage.getStore()
2640
+ });
2641
+ });
2642
+ }, options);
2643
+ const client = getRuntimeClient();
2644
+ if (!client) throw new ArkormException("Cannot start a transaction without a configured runtime client or adapter.", {
2645
+ code: "CLIENT_NOT_CONFIGURED",
2646
+ operation: "transaction"
2647
+ });
2648
+ if (!isTransactionCapableClient(client)) throw new UnsupportedAdapterFeatureException("Transactions are not supported by the current adapter.", {
2649
+ code: "TRANSACTION_NOT_SUPPORTED",
2650
+ operation: "transaction"
2651
+ });
2652
+ return await client.$transaction(async (transactionClient) => {
2653
+ return await transactionClientStorage.run(transactionClient, async () => {
2654
+ return await callback({ client: transactionClient });
2655
+ });
2656
+ }, options);
2657
+ };
2534
2658
  const getRuntimeDebugHandler = () => {
2535
2659
  if (!runtimeConfigLoaded) loadRuntimeConfigSync();
2536
2660
  return runtimeDebugHandler;
@@ -2541,7 +2665,7 @@ const emitRuntimeDebugEvent = (event) => {
2541
2665
  /**
2542
2666
  * Check if a given value matches Arkorm's query-schema contract
2543
2667
  * by verifying the presence of common delegate methods.
2544
- *
2668
+ *
2545
2669
  * @param value The value to check.
2546
2670
  * @returns True if the value matches the query-schema contract, false otherwise.
2547
2671
  */
@@ -2567,7 +2691,7 @@ loadArkormConfig();
2567
2691
  //#region src/helpers/prisma.ts
2568
2692
  /**
2569
2693
  * Infer the Prisma delegate name for a given model name using a simple convention.
2570
- *
2694
+ *
2571
2695
  * @param modelName The name of the model to infer the delegate name for.
2572
2696
  * @returns The inferred Prisma delegate name.
2573
2697
  */
@@ -2578,9 +2702,9 @@ function inferDelegateName(modelName) {
2578
2702
  //#endregion
2579
2703
  //#region src/adapters/PrismaDatabaseAdapter.ts
2580
2704
  /**
2581
- * Database adapter implementation for Prisma, allowing Arkorm to execute queries using Prisma
2705
+ * Database adapter implementation for Prisma, allowing Arkorm to execute queries using Prisma
2582
2706
  * as the underlying query builder and executor.
2583
- *
2707
+ *
2584
2708
  * @author Legacy (3m1n3nc3)
2585
2709
  * @since 2.0.0-next.0
2586
2710
  */
@@ -2849,9 +2973,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2849
2973
  * Prisma include/select arguments, but the adapter does not advertise the
2850
2974
  * adapter-owned batch relation load seam. QueryBuilder eager loads therefore stay
2851
2975
  * on Arkorm's generic relation loader on the Prisma compatibility path.
2852
- *
2853
- * @param spec
2854
- * @returns
2976
+ *
2977
+ * @param spec
2978
+ * @returns
2855
2979
  */
2856
2980
  async select(spec) {
2857
2981
  const delegate = this.resolveDelegate(spec.target);
@@ -2861,10 +2985,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2861
2985
  }, { args });
2862
2986
  }
2863
2987
  /**
2864
- * Selects a single record matching the specified criteria.
2865
- *
2866
- * @param spec
2867
- * @returns
2988
+ * Selects a single record matching the specified criteria.
2989
+ *
2990
+ * @param spec
2991
+ * @returns
2868
2992
  */
2869
2993
  async selectOne(spec) {
2870
2994
  const delegate = this.resolveDelegate(spec.target);
@@ -2875,9 +2999,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2875
2999
  }
2876
3000
  /**
2877
3001
  * Inserts a single record into the database and returns the created record.
2878
- *
2879
- * @param spec
2880
- * @returns
3002
+ *
3003
+ * @param spec
3004
+ * @returns
2881
3005
  */
2882
3006
  async insert(spec) {
2883
3007
  const delegate = this.resolveDelegate(spec.target);
@@ -2886,10 +3010,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2886
3010
  }, { values: spec.values });
2887
3011
  }
2888
3012
  /**
2889
- * Inserts multiple records into the database.
2890
- *
2891
- * @param spec
2892
- * @returns
3013
+ * Inserts multiple records into the database.
3014
+ *
3015
+ * @param spec
3016
+ * @returns
2893
3017
  */
2894
3018
  async insertMany(spec) {
2895
3019
  const delegate = this.resolveDelegate(spec.target);
@@ -2918,9 +3042,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2918
3042
  }
2919
3043
  /**
2920
3044
  * Updates a single record matching the specified criteria and returns the updated record.
2921
- *
2922
- * @param spec
2923
- * @returns
3045
+ *
3046
+ * @param spec
3047
+ * @returns
2924
3048
  */
2925
3049
  async update(spec) {
2926
3050
  const delegate = this.resolveDelegate(spec.target);
@@ -2937,10 +3061,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2937
3061
  });
2938
3062
  }
2939
3063
  /**
2940
- * Updates multiple records matching the specified criteria.
2941
- *
2942
- * @param spec
2943
- * @returns
3064
+ * Updates multiple records matching the specified criteria.
3065
+ *
3066
+ * @param spec
3067
+ * @returns
2944
3068
  */
2945
3069
  async updateMany(spec) {
2946
3070
  const delegate = this.resolveDelegate(spec.target);
@@ -2970,9 +3094,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2970
3094
  }
2971
3095
  /**
2972
3096
  * Deletes a single record matching the specified criteria and returns the deleted record.
2973
- *
2974
- * @param spec
2975
- * @returns
3097
+ *
3098
+ * @param spec
3099
+ * @returns
2976
3100
  */
2977
3101
  async delete(spec) {
2978
3102
  const delegate = this.resolveDelegate(spec.target);
@@ -2983,10 +3107,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2983
3107
  }, { where });
2984
3108
  }
2985
3109
  /**
2986
- * Deletes multiple records matching the specified criteria.
2987
- *
2988
- * @param spec
2989
- * @returns
3110
+ * Deletes multiple records matching the specified criteria.
3111
+ *
3112
+ * @param spec
3113
+ * @returns
2990
3114
  */
2991
3115
  async deleteMany(spec) {
2992
3116
  const delegate = this.resolveDelegate(spec.target);
@@ -3001,9 +3125,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3001
3125
  }
3002
3126
  /**
3003
3127
  * Counts the number of records matching the specified criteria.
3004
- *
3005
- * @param spec
3006
- * @returns
3128
+ *
3129
+ * @param spec
3130
+ * @returns
3007
3131
  */
3008
3132
  async count(spec) {
3009
3133
  const delegate = this.resolveDelegate(spec.target);
@@ -3014,9 +3138,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3014
3138
  }
3015
3139
  /**
3016
3140
  * Checks for the existence of records matching the specified criteria.
3017
- *
3018
- * @param spec
3019
- * @returns
3141
+ *
3142
+ * @param spec
3143
+ * @returns
3020
3144
  */
3021
3145
  async exists(spec) {
3022
3146
  return await this.selectOne({
@@ -3026,8 +3150,8 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3026
3150
  }
3027
3151
  /**
3028
3152
  * Loads related models for a batch of parent records based on the specified relation load plans.
3029
- *
3030
- * @param _spec
3153
+ *
3154
+ * @param _spec
3031
3155
  */
3032
3156
  async loadRelations(_spec) {
3033
3157
  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 +3160,12 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
3036
3160
  });
3037
3161
  }
3038
3162
  /**
3039
- * Executes a series of database operations within a transaction.
3163
+ * Executes a series of database operations within a transaction.
3040
3164
  * If the underlying Prisma client does not support transactions, an exception is thrown.
3041
- *
3042
- * @param callback
3043
- * @param context
3044
- * @returns
3165
+ *
3166
+ * @param callback
3167
+ * @param context
3168
+ * @returns
3045
3169
  */
3046
3170
  async transaction(callback, context = {}) {
3047
3171
  if (!this.hasTransactionSupport(this.prisma)) throw new UnsupportedAdapterFeatureException("Transactions are not supported by the Prisma compatibility adapter.", {
@@ -3097,12 +3221,12 @@ var CliApp = class {
3097
3221
  return relPath;
3098
3222
  }
3099
3223
  /**
3100
- * Utility to format a value for logging, converting absolute paths under current
3224
+ * Utility to format a value for logging, converting absolute paths under current
3101
3225
  * working directory into relative display paths.
3102
- *
3103
- * @param name
3104
- * @param value
3105
- * @returns
3226
+ *
3227
+ * @param name
3228
+ * @param value
3229
+ * @returns
3106
3230
  */
3107
3231
  splitLogger(name, value) {
3108
3232
  value = value.includes(process.cwd()) ? this.formatPathForLog(value) : value;
@@ -3191,7 +3315,7 @@ var CliApp = class {
3191
3315
  }
3192
3316
  /**
3193
3317
  * Resolve a configuration path with a fallback default
3194
- *
3318
+ *
3195
3319
  * @param key The configuration key to resolve
3196
3320
  * @param fallback The fallback value if the configuration key is not set
3197
3321
  * @returns The resolved configuration path
@@ -3203,19 +3327,19 @@ var CliApp = class {
3203
3327
  }
3204
3328
  /**
3205
3329
  * Resolve the path to a stub file based on configuration
3206
- *
3207
- * @param stubName
3208
- * @returns
3330
+ *
3331
+ * @param stubName
3332
+ * @returns
3209
3333
  */
3210
3334
  resolveStubPath(stubName) {
3211
3335
  return join$1(this.resolveConfigPath("stubs", getDefaultStubsPath()), stubName);
3212
3336
  }
3213
3337
  /**
3214
3338
  * Generate a factory file for a given model name.
3215
- *
3216
- * @param name
3217
- * @param options
3218
- * @returns
3339
+ *
3340
+ * @param name
3341
+ * @param options
3342
+ * @returns
3219
3343
  */
3220
3344
  makeFactory(name, options = {}) {
3221
3345
  const baseName = str(name.replace(/Factory$/, "")).pascal();
@@ -3237,10 +3361,10 @@ var CliApp = class {
3237
3361
  }
3238
3362
  /**
3239
3363
  * Generate a seeder file for a given name.
3240
- *
3241
- * @param name
3242
- * @param options
3243
- * @returns
3364
+ *
3365
+ * @param name
3366
+ * @param options
3367
+ * @returns
3244
3368
  */
3245
3369
  makeSeeder(name, options = {}) {
3246
3370
  const seederName = `${str(name.replace(/Seeder$/, "")).pascal()}Seeder`;
@@ -3254,7 +3378,7 @@ var CliApp = class {
3254
3378
  }
3255
3379
  /**
3256
3380
  * Generate a migration file for a given name.
3257
- *
3381
+ *
3258
3382
  * @param name The name of the migration.
3259
3383
  * @returns An object containing the name and path of the generated migration file.
3260
3384
  */
@@ -3270,10 +3394,10 @@ var CliApp = class {
3270
3394
  }
3271
3395
  /**
3272
3396
  * Generate a model file along with optional factory, seeder, and migration files.
3273
- *
3274
- * @param name
3275
- * @param options
3276
- * @returns
3397
+ *
3398
+ * @param name
3399
+ * @param options
3400
+ * @returns
3277
3401
  */
3278
3402
  makeModel(name, options = {}) {
3279
3403
  const baseName = str(name.replace(/Model$/, "")).pascal().toString();
@@ -3317,10 +3441,10 @@ var CliApp = class {
3317
3441
  return created;
3318
3442
  }
3319
3443
  /**
3320
- * Ensure that the Prisma schema has a model entry for the given model
3444
+ * Ensure that the Prisma schema has a model entry for the given model
3321
3445
  * and table names.
3322
3446
  * If the entry does not exist, it will be created with a default `id` field.
3323
- *
3447
+ *
3324
3448
  * @param modelName The name of the model to ensure in the Prisma schema.
3325
3449
  * @param tableName The table name to ensure in the Prisma schema.
3326
3450
  */
@@ -3352,7 +3476,7 @@ var CliApp = class {
3352
3476
  }
3353
3477
  /**
3354
3478
  * Convert a Prisma scalar type to its corresponding TypeScript type.
3355
- *
3479
+ *
3356
3480
  * @param value The Prisma scalar type.
3357
3481
  * @returns The corresponding TypeScript type.
3358
3482
  */
@@ -3645,9 +3769,9 @@ var CliApp = class {
3645
3769
  return isList ? `Array<${baseType}>` : baseType;
3646
3770
  }
3647
3771
  /**
3648
- * Parse the Prisma schema to extract model definitions and their fields, focusing
3772
+ * Parse the Prisma schema to extract model definitions and their fields, focusing
3649
3773
  * on scalar types.
3650
- *
3774
+ *
3651
3775
  * @param schema The Prisma schema as a string.
3652
3776
  * @returns An array of model definitions with their fields.
3653
3777
  */
@@ -3695,11 +3819,11 @@ var CliApp = class {
3695
3819
  return models;
3696
3820
  }
3697
3821
  /**
3698
- * Sync model attribute declarations in a model file based on the
3822
+ * Sync model attribute declarations in a model file based on the
3699
3823
  * provided declarations.
3700
- * This method takes the source code of a model file and a list of
3824
+ * This method takes the source code of a model file and a list of
3701
3825
  * attribute declarations,
3702
- *
3826
+ *
3703
3827
  * @param modelSource The source code of the model file.
3704
3828
  * @param declarations A list of attribute declarations to sync.
3705
3829
  * @returns An object containing the updated content and a flag indicating if it was updated.
@@ -3795,12 +3919,12 @@ var CliApp = class {
3795
3919
  }
3796
3920
  /**
3797
3921
  * 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`
3922
+ * This method reads the Prisma schema to extract model definitions and their
3923
+ * scalar fields, then updates the corresponding model files to include `declare`
3800
3924
  * 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
3925
+ * schema and models, the total number of model files processed, and lists of
3802
3926
  * updated and skipped files.
3803
- *
3927
+ *
3804
3928
  * @param options Optional parameters to specify custom paths for the Prisma schema and models directory.
3805
3929
  * @returns An object with details about the synchronization process, including updated and skipped files.
3806
3930
  */
@@ -3831,7 +3955,7 @@ var CliApp = class {
3831
3955
  //#endregion
3832
3956
  //#region src/cli/commands/InitCommand.ts
3833
3957
  /**
3834
- * The InitCommand class implements the CLI command for initializing Arkormˣ by creating
3958
+ * The InitCommand class implements the CLI command for initializing Arkormˣ by creating
3835
3959
  * a default config file in the current directory.
3836
3960
  *
3837
3961
  * @author Legacy (3m1n3nc3)
@@ -3890,8 +4014,8 @@ var MakeFactoryCommand = class extends Command {
3890
4014
  }
3891
4015
  /**
3892
4016
  * Command handler for the make:factory command.
3893
- *
3894
- * @returns
4017
+ *
4018
+ * @returns
3895
4019
  */
3896
4020
  async handle() {
3897
4021
  this.app.command = this;
@@ -3920,8 +4044,8 @@ var MakeMigrationCommand = class extends Command {
3920
4044
  }
3921
4045
  /**
3922
4046
  * Command handler for the make:migration command.
3923
- *
3924
- * @returns
4047
+ *
4048
+ * @returns
3925
4049
  */
3926
4050
  async handle() {
3927
4051
  this.app.command = this;
@@ -3935,7 +4059,7 @@ var MakeMigrationCommand = class extends Command {
3935
4059
  //#endregion
3936
4060
  //#region src/cli/commands/MakeModelCommand.ts
3937
4061
  /**
3938
- * The MakeModelCommand class implements the CLI command for creating new model
4062
+ * The MakeModelCommand class implements the CLI command for creating new model
3939
4063
  * classes along with optional linked resources such as factories, seeders, and migrations.
3940
4064
  *
3941
4065
  * @author Legacy (3m1n3nc3)
@@ -3957,8 +4081,8 @@ var MakeModelCommand = class extends Command {
3957
4081
  }
3958
4082
  /**
3959
4083
  * Command handler for the make:model command.
3960
- *
3961
- * @returns
4084
+ *
4085
+ * @returns
3962
4086
  */
3963
4087
  async handle() {
3964
4088
  this.app.command = this;
@@ -4008,8 +4132,8 @@ var MakeSeederCommand = class extends Command {
4008
4132
  //#region src/database/Migration.ts
4009
4133
  const MIGRATION_BRAND = Symbol.for("arkormx.migration");
4010
4134
  /**
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
4135
+ * The Migration class serves as a base for defining database migrations, requiring
4136
+ * the implementation of `up` and `down` methods to specify the changes to be
4013
4137
  * applied or reverted in the database schema.
4014
4138
  *
4015
4139
  * @author Legacy (3m1n3nc3)
@@ -4024,7 +4148,7 @@ var Migration = class {
4024
4148
  //#endregion
4025
4149
  //#region src/cli/commands/MigrateCommand.ts
4026
4150
  /**
4027
- * The MigrateCommand class implements the CLI command for applying migration
4151
+ * The MigrateCommand class implements the CLI command for applying migration
4028
4152
  * classes to the Prisma schema and running the Prisma workflow.
4029
4153
  *
4030
4154
  * @author Legacy (3m1n3nc3)
@@ -4048,12 +4172,12 @@ var MigrateCommand = class extends Command {
4048
4172
  }
4049
4173
  /**
4050
4174
  * 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
4175
+ * This method is responsible for orchestrating the migration
4176
+ * process, including loading migration classes, applying them to
4177
+ * the Prisma schema, and running the appropriate Prisma commands
4054
4178
  * based on the provided options.
4055
- *
4056
- * @returns
4179
+ *
4180
+ * @returns
4057
4181
  */
4058
4182
  async handle() {
4059
4183
  this.app.command = this;
@@ -4168,10 +4292,10 @@ var MigrateCommand = class extends Command {
4168
4292
  }
4169
4293
  /**
4170
4294
  * Load migration classes from a specific file or by class name.
4171
- *
4172
- * @param migrationsDir
4173
- * @param name
4174
- * @returns
4295
+ *
4296
+ * @param migrationsDir
4297
+ * @param name
4298
+ * @returns
4175
4299
  */
4176
4300
  async loadNamedMigration(migrationsDirs, name) {
4177
4301
  if (!name) return [[void 0, ""]];
@@ -4194,9 +4318,9 @@ var MigrateCommand = class extends Command {
4194
4318
  }
4195
4319
  /**
4196
4320
  * Load migration classes from a given file path.
4197
- *
4198
- * @param filePath
4199
- * @returns
4321
+ *
4322
+ * @param filePath
4323
+ * @returns
4200
4324
  */
4201
4325
  async loadMigrationClassesFromFile(filePath) {
4202
4326
  const imported = await RuntimeModuleLoader.load(filePath);
@@ -4615,7 +4739,7 @@ var ModelsSyncCommand = class extends Command {
4615
4739
  //#region src/database/Seeder.ts
4616
4740
  const SEEDER_BRAND = Symbol.for("arkormx.seeder");
4617
4741
  /**
4618
- * The Seeder class serves as a base for defining database seeders, which are
4742
+ * The Seeder class serves as a base for defining database seeders, which are
4619
4743
  * used to populate the database with initial or test data.
4620
4744
  *
4621
4745
  * @author Legacy (3m1n3nc3)
@@ -4630,7 +4754,7 @@ var Seeder = class Seeder {
4630
4754
  }
4631
4755
  /**
4632
4756
  * Runs one or more seeders.
4633
- *
4757
+ *
4634
4758
  * @param seeders The seeders to be run.
4635
4759
  */
4636
4760
  async call(...seeders) {
@@ -4638,9 +4762,9 @@ var Seeder = class Seeder {
4638
4762
  }
4639
4763
  /**
4640
4764
  * Run seeders and return every seeder class executed, including nested calls.
4641
- *
4642
- * @param seeders
4643
- * @returns
4765
+ *
4766
+ * @param seeders
4767
+ * @returns
4644
4768
  */
4645
4769
  static async runWithReport(...seeders) {
4646
4770
  const report = [];
@@ -4650,8 +4774,8 @@ var Seeder = class Seeder {
4650
4774
  return report;
4651
4775
  }
4652
4776
  /**
4653
- * Converts a SeederInput into a Seeder instance.
4654
- *
4777
+ * Converts a SeederInput into a Seeder instance.
4778
+ *
4655
4779
  * @param input The SeederInput to convert.
4656
4780
  * @returns A Seeder instance.
4657
4781
  */
@@ -4664,7 +4788,7 @@ var Seeder = class Seeder {
4664
4788
  }
4665
4789
  /**
4666
4790
  * Runs the given seeders in sequence.
4667
- *
4791
+ *
4668
4792
  * @param seeders The seeders to be run.
4669
4793
  */
4670
4794
  static async runSeeders(...seeders) {
@@ -4684,7 +4808,7 @@ var Seeder = class Seeder {
4684
4808
  //#endregion
4685
4809
  //#region src/cli/commands/SeedCommand.ts
4686
4810
  /**
4687
- * The SeedCommand class implements the CLI command for running seeder classes.
4811
+ * The SeedCommand class implements the CLI command for running seeder classes.
4688
4812
  *
4689
4813
  * @author Legacy (3m1n3nc3)
4690
4814
  * @since 0.1.0
@@ -4700,8 +4824,8 @@ var SeedCommand = class extends Command {
4700
4824
  }
4701
4825
  /**
4702
4826
  * Command handler for the seed command.
4703
- *
4704
- * @returns
4827
+ *
4828
+ * @returns
4705
4829
  */
4706
4830
  async handle() {
4707
4831
  this.app.command = this;
@@ -4717,9 +4841,9 @@ var SeedCommand = class extends Command {
4717
4841
  }
4718
4842
  /**
4719
4843
  * Load all seeder classes from the specified directory.
4720
- *
4721
- * @param seedersDir
4722
- * @returns
4844
+ *
4845
+ * @param seedersDir
4846
+ * @returns
4723
4847
  */
4724
4848
  resolveSeederDirectories(configuredSeedersDir) {
4725
4849
  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 +4854,10 @@ var SeedCommand = class extends Command {
4730
4854
  }
4731
4855
  /**
4732
4856
  * Load seeder classes from a specific file or by class name.
4733
- *
4734
- * @param seedersDir
4735
- * @param name
4736
- * @returns
4857
+ *
4858
+ * @param seedersDir
4859
+ * @param name
4860
+ * @returns
4737
4861
  */
4738
4862
  async loadNamedSeeder(seedersDirs, name) {
4739
4863
  const base = name.replace(/Seeder$/, "");
@@ -4755,7 +4879,7 @@ var SeedCommand = class extends Command {
4755
4879
  }
4756
4880
  /**
4757
4881
  * Load seeder classes from a given file path.
4758
- *
4882
+ *
4759
4883
  * @param filePath The path to the file containing seeder classes.
4760
4884
  * @returns An array of seeder classes.
4761
4885
  */