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.
@@ -65,9 +65,9 @@ var RelationResolutionException = class extends ArkormException {
65
65
  //#endregion
66
66
  //#region src/relationship/RelationTableLoader.ts
67
67
  /**
68
- * Utility class responsible for loading data from relation tables, which are used to
69
- * manage relationships between models in Arkorm.
70
- *
68
+ * Utility class responsible for loading data from relation tables, which are used to
69
+ * manage relationships between models in Arkorm.
70
+ *
71
71
  * @author Legacy (3m1n3nc3)
72
72
  * @since 2.0.0-next.0
73
73
  */
@@ -113,9 +113,9 @@ var RelationTableLoader = class {
113
113
  //#endregion
114
114
  //#region src/relationship/SetBasedEagerLoader.ts
115
115
  /**
116
- * Utility class responsible for performing set-based eager loading of relationships for
116
+ * Utility class responsible for performing set-based eager loading of relationships for
117
117
  * a collection of models.
118
- *
118
+ *
119
119
  * @author Legacy (3m1n3nc3)
120
120
  * @since 2.0.0-next.2
121
121
  */
@@ -125,9 +125,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
125
125
  this.relations = relations;
126
126
  }
127
127
  /**
128
- * Performs eager loading of all specified relationships for the set of models.
129
- *
130
- * @returns
128
+ * Performs eager loading of all specified relationships for the set of models.
129
+ *
130
+ * @returns
131
131
  */
132
132
  async load() {
133
133
  if (this.models.length === 0) return;
@@ -144,9 +144,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
144
144
  await new SetBasedEagerLoader(relatedModels, this.relationTreeToMap(node.children)).load();
145
145
  }
146
146
  /**
147
- * Loads a specific relationship for the set of models based on the relationship name
147
+ * Loads a specific relationship for the set of models based on the relationship name
148
148
  * and an optional constraint.
149
- *
149
+ *
150
150
  * @param name The name of the relationship to load.
151
151
  * @param constraint An optional constraint to apply to the query.
152
152
  * @returns A promise that resolves when the relationship is loaded.
@@ -187,9 +187,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
187
187
  }
188
188
  }
189
189
  /**
190
- * Resolves the relation resolver function for a given relationship name by inspecting
190
+ * Resolves the relation resolver function for a given relationship name by inspecting
191
191
  * the first model in the set.
192
- *
192
+ *
193
193
  * @param name The name of the relationship to resolve.
194
194
  * @returns The relation resolver function or null if not found.
195
195
  */
@@ -249,7 +249,7 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
249
249
  }
250
250
  /**
251
251
  * Loads a "belongs to" relationship for the set of models.
252
- *
252
+ *
253
253
  * @param name The name of the relationship to load.
254
254
  * @param resolver The relation resolver function.
255
255
  * @param metadata The metadata for the relationship.
@@ -281,12 +281,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
281
281
  });
282
282
  }
283
283
  /**
284
- * Loads a "has many" relationship for the set of models.
285
- *
286
- * @param name
287
- * @param metadata
288
- * @param constraint
289
- * @returns
284
+ * Loads a "has many" relationship for the set of models.
285
+ *
286
+ * @param name
287
+ * @param metadata
288
+ * @param constraint
289
+ * @returns
290
290
  */
291
291
  async loadHasMany(name, metadata, constraint) {
292
292
  const keys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -315,12 +315,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
315
315
  });
316
316
  }
317
317
  /**
318
- * Loads a "belongs to many" relationship for the set of models.
319
- *
320
- * @param name
321
- * @param metadata
322
- * @param constraint
323
- * @returns
318
+ * Loads a "belongs to many" relationship for the set of models.
319
+ *
320
+ * @param name
321
+ * @param metadata
322
+ * @param constraint
323
+ * @returns
324
324
  */
325
325
  async loadBelongsToMany(name, metadata, constraint) {
326
326
  const parentKeys = this.collectUniqueKeys((model) => model.getAttribute(metadata.parentKey));
@@ -415,12 +415,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
415
415
  }
416
416
  /**
417
417
  * Loads a "belongs to many" relationship for the set of models.
418
- *
419
- * @param name
420
- * @param resolver
421
- * @param metadata
422
- * @param constraint
423
- * @returns
418
+ *
419
+ * @param name
420
+ * @param resolver
421
+ * @param metadata
422
+ * @param constraint
423
+ * @returns
424
424
  */
425
425
  async loadHasOne(name, resolver, metadata, constraint) {
426
426
  const keys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -448,11 +448,11 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
448
448
  }
449
449
  /**
450
450
  * Loads a "has many through" relationship for the set of models.
451
- *
452
- * @param name
453
- * @param metadata
454
- * @param constraint
455
- * @returns
451
+ *
452
+ * @param name
453
+ * @param metadata
454
+ * @param constraint
455
+ * @returns
456
456
  */
457
457
  async loadHasManyThrough(name, metadata, constraint) {
458
458
  const parentKeys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -506,12 +506,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
506
506
  }
507
507
  /**
508
508
  * Loads a "has one through" relationship for the set of models.
509
- *
510
- * @param name
511
- * @param resolver
512
- * @param metadata
513
- * @param constraint
514
- * @returns
509
+ *
510
+ * @param name
511
+ * @param resolver
512
+ * @param metadata
513
+ * @param constraint
514
+ * @returns
515
515
  */
516
516
  async loadHasOneThrough(name, resolver, metadata, constraint) {
517
517
  const parentKeys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -705,19 +705,19 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
705
705
  }
706
706
  /**
707
707
  * Applies an eager load constraint to a query if provided.
708
- *
709
- * @param query
710
- * @param constraint
711
- * @returns
708
+ *
709
+ * @param query
710
+ * @param constraint
711
+ * @returns
712
712
  */
713
713
  applyConstraint(query, constraint) {
714
714
  if (!constraint) return query;
715
715
  return constraint(query) ?? query;
716
716
  }
717
717
  /**
718
- * Collects unique values from the set of models based on a resolver function, which
718
+ * Collects unique values from the set of models based on a resolver function, which
719
719
  * is used to extract the value from each model.
720
- *
720
+ *
721
721
  * @param resolve A function that takes a model and returns the value to be collected.
722
722
  * @returns An array of unique values.
723
723
  */
@@ -735,9 +735,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
735
735
  return values;
736
736
  }
737
737
  /**
738
- * Collects unique values from an array of database rows based on a specified key, which
738
+ * Collects unique values from an array of database rows based on a specified key, which
739
739
  * is used to extract the value from each row.
740
- *
740
+ *
741
741
  * @param rows An array of database rows.
742
742
  * @param key The key to extract values from each row.
743
743
  * @returns An array of unique values.
@@ -757,16 +757,16 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
757
757
  }
758
758
  /**
759
759
  * Loads a "belongs to many" relationship for the set of models.
760
- *
761
- * @returns
760
+ *
761
+ * @returns
762
762
  */
763
763
  createRelationTableLoader() {
764
764
  return new RelationTableLoader(this.resolveAdapter());
765
765
  }
766
766
  /**
767
767
  * Loads a "belongs to many" relationship for the set of models.
768
- *
769
- * @returns
768
+ *
769
+ * @returns
770
770
  */
771
771
  resolveAdapter() {
772
772
  const adapter = this.models[0].constructor.getAdapter?.();
@@ -774,30 +774,30 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
774
774
  return adapter;
775
775
  }
776
776
  /**
777
- * Reads an attribute value from a model using the getAttribute method, which is used
777
+ * Reads an attribute value from a model using the getAttribute method, which is used
778
778
  * to access model attributes in a way that is compatible with Arkorm's internal model structure.
779
- *
779
+ *
780
780
  * @param model The model to read the attribute from.
781
781
  * @param key The name of the attribute to read.
782
- * @returns
782
+ * @returns
783
783
  */
784
784
  readModelAttribute(model, key) {
785
785
  return model.getAttribute?.(key);
786
786
  }
787
787
  /**
788
- * Resolves the default result for a relationship when no related models are found.
789
- *
790
- * @param resolver
791
- * @param model
792
- * @returns
788
+ * Resolves the default result for a relationship when no related models are found.
789
+ *
790
+ * @param resolver
791
+ * @param model
792
+ * @returns
793
793
  */
794
794
  resolveSingleDefault(resolver, model) {
795
795
  return resolver.call(model).resolveDefaultResult?.() ?? null;
796
796
  }
797
797
  /**
798
- * Generates a unique lookup key for a given value, which is used to store and retrieve
798
+ * Generates a unique lookup key for a given value, which is used to store and retrieve
799
799
  * values in maps during the eager loading process.
800
- *
800
+ *
801
801
  * @param value The value to generate a lookup key for.
802
802
  * @returns A unique string representing the value.
803
803
  */
@@ -843,10 +843,10 @@ var RuntimeModuleLoader = class {
843
843
  *
844
844
  * Each returned entry carries either the loaded module or the last error,
845
845
  * so callers can surface genuine failures instead of silently dropping them.
846
- *
847
- * @param filePaths
848
- * @param useDefault
849
- * @returns
846
+ *
847
+ * @param filePaths
848
+ * @param useDefault
849
+ * @returns
850
850
  */
851
851
  static async loadAll(filePaths, useDefault = false) {
852
852
  const jiti = createJiti(`${pathToFileURL(resolve(".")).href}/`, {
@@ -1012,9 +1012,9 @@ const getLatestAppliedMigrations = (state, steps) => {
1012
1012
  //#endregion
1013
1013
  //#region src/database/ForeignKeyBuilder.ts
1014
1014
  /**
1015
- * The ForeignKeyBuilder class provides a fluent interface for defining
1016
- * foreign key constraints in a migration. It allows you to specify
1017
- * the referenced table and column, as well as actions to take on
1015
+ * The ForeignKeyBuilder class provides a fluent interface for defining
1016
+ * foreign key constraints in a migration. It allows you to specify
1017
+ * the referenced table and column, as well as actions to take on
1018
1018
  * delete and aliases for the relation.
1019
1019
  *
1020
1020
  * @author Legacy (3m1n3nc3)
@@ -1026,10 +1026,10 @@ var ForeignKeyBuilder = class {
1026
1026
  }
1027
1027
  /**
1028
1028
  * Defines the referenced table and column for this foreign key constraint.
1029
- *
1030
- * @param table
1031
- * @param column
1032
- * @returns
1029
+ *
1030
+ * @param table
1031
+ * @param column
1032
+ * @returns
1033
1033
  */
1034
1034
  references(table, column) {
1035
1035
  this.foreignKey.referencesTable = table;
@@ -1037,22 +1037,22 @@ var ForeignKeyBuilder = class {
1037
1037
  return this;
1038
1038
  }
1039
1039
  /**
1040
- * Defines the action to take when a referenced record is deleted, such
1040
+ * Defines the action to take when a referenced record is deleted, such
1041
1041
  * as "CASCADE", "SET NULL", or "RESTRICT".
1042
- *
1043
- * @param action
1044
- * @returns
1042
+ *
1043
+ * @param action
1044
+ * @returns
1045
1045
  */
1046
1046
  onDelete(action) {
1047
1047
  this.foreignKey.onDelete = action;
1048
1048
  return this;
1049
1049
  }
1050
1050
  /**
1051
- * Defines an alias for the relation represented by this foreign key, which
1051
+ * Defines an alias for the relation represented by this foreign key, which
1052
1052
  * can be used in the ORM for more intuitive access to related models.
1053
- *
1054
- * @param name
1055
- * @returns
1053
+ *
1054
+ * @param name
1055
+ * @returns
1056
1056
  */
1057
1057
  alias(name) {
1058
1058
  this.foreignKey.relationAlias = name;
@@ -1060,20 +1060,20 @@ var ForeignKeyBuilder = class {
1060
1060
  }
1061
1061
  /**
1062
1062
  * Defines an alias for the inverse relation represented by this foreign key.
1063
- *
1064
- * @param name
1065
- * @returns
1063
+ *
1064
+ * @param name
1065
+ * @returns
1066
1066
  */
1067
1067
  inverseAlias(name) {
1068
1068
  this.foreignKey.inverseRelationAlias = name;
1069
1069
  return this;
1070
1070
  }
1071
1071
  /**
1072
- * Defines an alias for the foreign key field itself, which can be
1072
+ * Defines an alias for the foreign key field itself, which can be
1073
1073
  * used in the ORM for more intuitive access to the foreign key value.
1074
- *
1075
- * @param fieldName
1076
- * @returns
1074
+ *
1075
+ * @param fieldName
1076
+ * @returns
1077
1077
  */
1078
1078
  as(fieldName) {
1079
1079
  this.foreignKey.fieldAlias = fieldName;
@@ -1192,7 +1192,7 @@ var EnumBuilder = class {
1192
1192
  }
1193
1193
  };
1194
1194
  /**
1195
- * The TableBuilder class provides a fluent interface for defining
1195
+ * The TableBuilder class provides a fluent interface for defining
1196
1196
  * the structure of a database table in a migration, including columns to add or drop.
1197
1197
  *
1198
1198
  * @author Legacy (3m1n3nc3)
@@ -1229,7 +1229,7 @@ var TableBuilder = class {
1229
1229
  }
1230
1230
  /**
1231
1231
  * Defines an auto-incrementing primary key column.
1232
- *
1232
+ *
1233
1233
  * @param name The name of the primary key column.
1234
1234
  * @default 'id'
1235
1235
  * @returns The current TableBuilder instance for chaining.
@@ -1239,7 +1239,7 @@ var TableBuilder = class {
1239
1239
  }
1240
1240
  /**
1241
1241
  * Defines a UUID column in the table.
1242
- *
1242
+ *
1243
1243
  * @param name The name of the UUID column.
1244
1244
  * @param options Additional options for the UUID column.
1245
1245
  * @returns The current TableBuilder instance for chaining.
@@ -1270,7 +1270,7 @@ var TableBuilder = class {
1270
1270
  }
1271
1271
  /**
1272
1272
  * Defines a string column in the table.
1273
- *
1273
+ *
1274
1274
  * @param name The name of the string column.
1275
1275
  * @param options Additional options for the string column.
1276
1276
  * @returns The current TableBuilder instance for chaining.
@@ -1280,7 +1280,7 @@ var TableBuilder = class {
1280
1280
  }
1281
1281
  /**
1282
1282
  * Defines a text column in the table.
1283
- *
1283
+ *
1284
1284
  * @param name The name of the text column.
1285
1285
  * @param options Additional options for the text column.
1286
1286
  * @returns The current TableBuilder instance for chaining.
@@ -1290,7 +1290,7 @@ var TableBuilder = class {
1290
1290
  }
1291
1291
  /**
1292
1292
  * Defines an integer column in the table.
1293
- *
1293
+ *
1294
1294
  * @param name The name of the integer column.
1295
1295
  * @param options Additional options for the integer column.
1296
1296
  * @returns The current TableBuilder instance for chaining.
@@ -1300,7 +1300,7 @@ var TableBuilder = class {
1300
1300
  }
1301
1301
  /**
1302
1302
  * Defines a big integer column in the table.
1303
- *
1303
+ *
1304
1304
  * @param name The name of the big integer column.
1305
1305
  * @param options Additional options for the big integer column.
1306
1306
  * @returns The current TableBuilder instance for chaining.
@@ -1310,7 +1310,7 @@ var TableBuilder = class {
1310
1310
  }
1311
1311
  /**
1312
1312
  * Defines a float column in the table.
1313
- *
1313
+ *
1314
1314
  * @param name The name of the float column.
1315
1315
  * @param options Additional options for the float column.
1316
1316
  * @returns The current TableBuilder instance for chaining.
@@ -1336,8 +1336,8 @@ var TableBuilder = class {
1336
1336
  }
1337
1337
  /**
1338
1338
  * Defines a boolean column in the table.
1339
- *
1340
- * @param name The name of the boolean column.
1339
+ *
1340
+ * @param name The name of the boolean column.
1341
1341
  * @param options Additional options for the boolean column.
1342
1342
  * @returns The current TableBuilder instance for chaining.
1343
1343
  */
@@ -1346,29 +1346,29 @@ var TableBuilder = class {
1346
1346
  }
1347
1347
  /**
1348
1348
  * Defines a JSON column in the table.
1349
- *
1349
+ *
1350
1350
  * @param name The name of the JSON column.
1351
1351
  * @param options Additional options for the JSON column.
1352
- * @returns
1352
+ * @returns
1353
1353
  */
1354
1354
  json(name, options = {}) {
1355
1355
  return this.column(name, "json", options);
1356
1356
  }
1357
1357
  /**
1358
1358
  * Defines a date column in the table.
1359
- *
1359
+ *
1360
1360
  * @param name The name of the date column.
1361
1361
  * @param options Additional options for the date column.
1362
- * @returns
1362
+ * @returns
1363
1363
  */
1364
1364
  date(name, options = {}) {
1365
1365
  return this.column(name, "date", options);
1366
1366
  }
1367
1367
  /**
1368
1368
  * Defines colonns for a polymorphic relationship in the table.
1369
- *
1369
+ *
1370
1370
  * @param name The base name for the polymorphic relationship columns.
1371
- * @returns
1371
+ * @returns
1372
1372
  */
1373
1373
  morphs(name, nullable = false) {
1374
1374
  this.string(`${name}Type`, { nullable });
@@ -1377,9 +1377,9 @@ var TableBuilder = class {
1377
1377
  }
1378
1378
  /**
1379
1379
  * Defines columns for a polymorphic relationship in the table with UUID ID.
1380
- *
1380
+ *
1381
1381
  * @param name The base name for the polymorphic relationship columns.
1382
- * @returns
1382
+ * @returns
1383
1383
  */
1384
1384
  uuidMorphs(name, nullable = false) {
1385
1385
  this.string(`${name}Type`, { nullable });
@@ -1388,28 +1388,28 @@ var TableBuilder = class {
1388
1388
  }
1389
1389
  /**
1390
1390
  * Defines nullable columns for a polymorphic relationship in the table.
1391
- *
1391
+ *
1392
1392
  * @param name The base name for the polymorphic relationship columns.
1393
- * @returns
1393
+ * @returns
1394
1394
  */
1395
1395
  nullableMorphs(name) {
1396
1396
  return this.morphs(name, true);
1397
1397
  }
1398
1398
  /**
1399
1399
  * Defines nullable columns for a polymorphic relationship in the table with UUID ID.
1400
- *
1400
+ *
1401
1401
  * @param name The base name for the polymorphic relationship columns.
1402
- * @returns
1402
+ * @returns
1403
1403
  */
1404
1404
  nullableUuidMorphs(name) {
1405
1405
  return this.uuidMorphs(name, true);
1406
1406
  }
1407
1407
  /**
1408
1408
  * Defines a timestamp column in the table.
1409
- *
1409
+ *
1410
1410
  * @param name The name of the timestamp column.
1411
1411
  * @param options Additional options for the timestamp column.
1412
- * @returns
1412
+ * @returns
1413
1413
  */
1414
1414
  timestamp(name, options = {}) {
1415
1415
  return this.column(name, "timestamp", options);
@@ -1470,9 +1470,9 @@ var TableBuilder = class {
1470
1470
  }
1471
1471
  /**
1472
1472
  * Defines a soft delete timestamp column in the table.
1473
- *
1473
+ *
1474
1474
  * @param column The name of the soft delete column.
1475
- * @returns
1475
+ * @returns
1476
1476
  */
1477
1477
  softDeletes(column = "deletedAt") {
1478
1478
  this.timestamp(column, { nullable: true });
@@ -1480,9 +1480,9 @@ var TableBuilder = class {
1480
1480
  }
1481
1481
  /**
1482
1482
  * Defines a column to be dropped from the table in an alterTable operation.
1483
- *
1483
+ *
1484
1484
  * @param name The name of the column to drop.
1485
- * @returns
1485
+ * @returns
1486
1486
  */
1487
1487
  dropColumn(name) {
1488
1488
  this.dropColumnNames.push(name);
@@ -1490,7 +1490,7 @@ var TableBuilder = class {
1490
1490
  }
1491
1491
  /**
1492
1492
  * Marks a column as nullable.
1493
- *
1493
+ *
1494
1494
  * @param columnName Optional explicit column name. When omitted, applies to the latest defined column.
1495
1495
  * @returns The current TableBuilder instance for chaining.
1496
1496
  */
@@ -1528,7 +1528,7 @@ var TableBuilder = class {
1528
1528
  }
1529
1529
  /**
1530
1530
  * Sets the column position to appear after another column when possible.
1531
- *
1531
+ *
1532
1532
  * @param referenceColumn The column that the target column should be placed after.
1533
1533
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
1534
1534
  * @returns The current TableBuilder instance for chaining.
@@ -1540,7 +1540,7 @@ var TableBuilder = class {
1540
1540
  }
1541
1541
  /**
1542
1542
  * Maps the column to a custom database column name.
1543
- *
1543
+ *
1544
1544
  * @param name The custom database column name.
1545
1545
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
1546
1546
  * @returns The current TableBuilder instance for chaining.
@@ -1552,7 +1552,7 @@ var TableBuilder = class {
1552
1552
  }
1553
1553
  /**
1554
1554
  * Defines an index on one or more columns.
1555
- *
1555
+ *
1556
1556
  * @param columns Optional target columns. When omitted, applies to the latest defined column.
1557
1557
  * @param name Optional index name.
1558
1558
  * @returns The current TableBuilder instance for chaining.
@@ -1581,11 +1581,11 @@ var TableBuilder = class {
1581
1581
  return new ForeignKeyBuilder(entry);
1582
1582
  }
1583
1583
  /**
1584
- * Defines a foreign key relation for a column, using a
1584
+ * Defines a foreign key relation for a column, using a
1585
1585
  * conventional naming pattern.
1586
- *
1587
- * @param column
1588
- * @returns
1586
+ *
1587
+ * @param column
1588
+ * @returns
1589
1589
  */
1590
1590
  foreign(column) {
1591
1591
  const columnName = this.resolveColumn(column).name;
@@ -1593,8 +1593,8 @@ var TableBuilder = class {
1593
1593
  }
1594
1594
  /**
1595
1595
  * Returns a deep copy of the defined columns for the table.
1596
- *
1597
- * @returns
1596
+ *
1597
+ * @returns
1598
1598
  */
1599
1599
  getColumns() {
1600
1600
  return this.columns.map((column) => ({
@@ -1604,15 +1604,15 @@ var TableBuilder = class {
1604
1604
  }
1605
1605
  /**
1606
1606
  * Returns a copy of the defined column names to be dropped from the table.
1607
- *
1608
- * @returns
1607
+ *
1608
+ * @returns
1609
1609
  */
1610
1610
  getDropColumns() {
1611
1611
  return [...this.dropColumnNames];
1612
1612
  }
1613
1613
  /**
1614
1614
  * Returns a deep copy of the defined indexes for the table.
1615
- *
1615
+ *
1616
1616
  * @returns
1617
1617
  */
1618
1618
  getIndexes() {
@@ -1649,11 +1649,11 @@ var TableBuilder = class {
1649
1649
  }
1650
1650
  /**
1651
1651
  * Defines a column in the table with the given name.
1652
- *
1652
+ *
1653
1653
  * @param name The name of the column.
1654
1654
  * @param type The type of the column.
1655
1655
  * @param options Additional options for the column.
1656
- * @returns
1656
+ * @returns
1657
1657
  */
1658
1658
  column(name, type, options) {
1659
1659
  this.columns.push({
@@ -1678,9 +1678,9 @@ var TableBuilder = class {
1678
1678
  }
1679
1679
  /**
1680
1680
  * Resolve a target column by name or fallback to the latest defined column.
1681
- *
1682
- * @param columnName
1683
- * @returns
1681
+ *
1682
+ * @param columnName
1683
+ * @returns
1684
1684
  */
1685
1685
  resolveColumn(columnName) {
1686
1686
  const targetName = columnName ?? this.latestColumnName;
@@ -1701,19 +1701,84 @@ var TableBuilder = class {
1701
1701
  //#endregion
1702
1702
  //#region src/database/SchemaBuilder.ts
1703
1703
  /**
1704
- * The SchemaBuilder class provides methods for defining the operations to be
1705
- * performed in a migration, such as creating, altering, or dropping tables.
1704
+ * The SchemaBuilder class provides methods for defining the operations to be
1705
+ * performed in a migration, such as creating, altering, or dropping tables.
1706
1706
  *
1707
1707
  * @author Legacy (3m1n3nc3)
1708
1708
  * @since 0.1.0
1709
1709
  */
1710
- var SchemaBuilder = class {
1710
+ var SchemaBuilder = class SchemaBuilder {
1711
1711
  constructor() {
1712
1712
  this.operations = [];
1713
1713
  }
1714
1714
  /**
1715
+ * Disable foreign-key constraint enforcement on the active PostgreSQL
1716
+ * connection by switching the session into replication mode, which
1717
+ * suppresses the internal triggers that enforce foreign keys.
1718
+ *
1719
+ * The setting is connection-scoped, so the disable, the work that depends
1720
+ * on it, and the matching {@link SchemaBuilder.enableForeignKeyConstraints}
1721
+ * must run on the same connection. Prefer
1722
+ * {@link SchemaBuilder.withoutForeignKeyConstraints}, which guarantees this
1723
+ * by wrapping the work in a transaction. Requires a SQL-backed adapter and
1724
+ * a database role permitted to set `session_replication_role`.
1725
+ *
1726
+ * @returns
1727
+ */
1728
+ static async disableForeignKeyConstraints() {
1729
+ await SchemaBuilder.setSessionReplicationRole("replica");
1730
+ }
1731
+ /**
1732
+ * Re-enable foreign-key constraint enforcement on the active PostgreSQL
1733
+ * connection by restoring the default session replication role.
1734
+ *
1735
+ * @returns
1736
+ */
1737
+ static async enableForeignKeyConstraints() {
1738
+ await SchemaBuilder.setSessionReplicationRole("origin");
1739
+ }
1740
+ /**
1741
+ * Run the given callback with foreign-key constraints disabled, then
1742
+ * restore them. The whole unit runs inside a transaction so the disable,
1743
+ * the callback, and the re-enable share a single connection (required for
1744
+ * the connection-scoped replication role to take effect) and roll back
1745
+ * together on failure.
1746
+ *
1747
+ * @example
1748
+ * await SchemaBuilder.withoutForeignKeyConstraints(async () => {
1749
+ * await User.factory()
1750
+ * .hasAttached(Tenant.factory().has(Project.factory(3)), { status: 'active' }, 'tenantMemberships')
1751
+ * .create()
1752
+ * })
1753
+ *
1754
+ * @param callback
1755
+ * @returns
1756
+ */
1757
+ static async withoutForeignKeyConstraints(callback) {
1758
+ return await runArkormTransaction(async () => {
1759
+ await SchemaBuilder.disableForeignKeyConstraints();
1760
+ try {
1761
+ return await callback();
1762
+ } finally {
1763
+ await SchemaBuilder.enableForeignKeyConstraints();
1764
+ }
1765
+ });
1766
+ }
1767
+ static async setSessionReplicationRole(role) {
1768
+ const adapter = getRuntimeAdapter();
1769
+ if (!adapter) throw new ArkormException("Toggling foreign-key constraints requires a configured database adapter.", {
1770
+ code: "ADAPTER_NOT_CONFIGURED",
1771
+ operation: "schema.foreignKeyConstraints"
1772
+ });
1773
+ if (!adapter.rawQuery) throw new UnsupportedAdapterFeatureException("Toggling foreign-key constraints requires an adapter that supports raw queries.", {
1774
+ operation: "schema.foreignKeyConstraints",
1775
+ meta: { feature: "rawQuery" }
1776
+ });
1777
+ await adapter.rawQuery({ sql: `SET session_replication_role = '${role}'` });
1778
+ }
1779
+ /**
1715
1780
  * Defines a new table to be created in the migration.
1716
- *
1781
+ *
1717
1782
  * @param table The name of the table to create.
1718
1783
  * @param callback A callback function to define the table's columns and structure.
1719
1784
  * @returns The current SchemaBuilder instance for chaining.
@@ -1737,7 +1802,7 @@ var SchemaBuilder = class {
1737
1802
  }
1738
1803
  /**
1739
1804
  * Defines alterations to an existing table in the migration.
1740
- *
1805
+ *
1741
1806
  * @param table The name of the table to alter.
1742
1807
  * @param callback A callback function to define the alterations to the table's columns and structure.
1743
1808
  * @returns The current SchemaBuilder instance for chaining.
@@ -1762,7 +1827,7 @@ var SchemaBuilder = class {
1762
1827
  }
1763
1828
  /**
1764
1829
  * Defines a table to be dropped in the migration.
1765
- *
1830
+ *
1766
1831
  * @param table The name of the table to drop.
1767
1832
  * @returns The current SchemaBuilder instance for chaining.
1768
1833
  */
@@ -1775,7 +1840,7 @@ var SchemaBuilder = class {
1775
1840
  }
1776
1841
  /**
1777
1842
  * Returns a deep copy of the defined schema operations for the migration/
1778
- *
1843
+ *
1779
1844
  * @returns An array of schema operations for the migration.
1780
1845
  */
1781
1846
  getOperations() {
@@ -1851,7 +1916,7 @@ const PRISMA_ENUM_REGEX = /enum\s+(\w+)\s*\{[\s\S]*?\n\}/g;
1851
1916
  const PRISMA_ENUM_MEMBER_REGEX = /^[A-Za-z][A-Za-z0-9_]*$/;
1852
1917
  /**
1853
1918
  * Convert a table name to a PascalCase model name, with basic singularization.
1854
- *
1919
+ *
1855
1920
  * @param tableName The name of the table to convert.
1856
1921
  * @returns The corresponding PascalCase model name.
1857
1922
  */
@@ -1863,16 +1928,16 @@ const toModelName = (tableName) => {
1863
1928
  };
1864
1929
  /**
1865
1930
  * Escape special characters in a string for use in a regular expression.
1866
- *
1867
- * @param value
1868
- * @returns
1931
+ *
1932
+ * @param value
1933
+ * @returns
1869
1934
  */
1870
1935
  const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1871
1936
  /**
1872
1937
  * Convert a SchemaColumn definition to a Prisma field type string, including modifiers.
1873
- *
1874
- * @param column
1875
- * @returns
1938
+ *
1939
+ * @param column
1940
+ * @returns
1876
1941
  */
1877
1942
  const resolvePrismaType = (column) => {
1878
1943
  if (column.type === "id") return "Int";
@@ -1891,11 +1956,11 @@ const resolveEnumName = (column) => {
1891
1956
  if (column.enumName && column.enumName.trim().length > 0) return column.enumName.trim();
1892
1957
  throw new ArkormException(`Enum column [${column.name}] must define an enum name.`);
1893
1958
  };
1894
- /**
1959
+ /**
1895
1960
  * Format a default value for inclusion in a Prisma schema field definition, based on its type.
1896
- *
1897
- * @param value
1898
- * @returns
1961
+ *
1962
+ * @param value
1963
+ * @returns
1899
1964
  */
1900
1965
  const formatDefaultValue = (value) => {
1901
1966
  if (value == null) return void 0;
@@ -1906,9 +1971,9 @@ const formatDefaultValue = (value) => {
1906
1971
  };
1907
1972
  /**
1908
1973
  * Format a default value for an enum column as a Prisma @default attribute, validating that it is a non-empty string.
1909
- *
1910
- * @param value
1911
- * @returns
1974
+ *
1975
+ * @param value
1976
+ * @returns
1912
1977
  */
1913
1978
  const formatEnumDefaultValue = (value) => {
1914
1979
  if (value == null) return void 0;
@@ -1917,9 +1982,9 @@ const formatEnumDefaultValue = (value) => {
1917
1982
  };
1918
1983
  /**
1919
1984
  * Normalize an enum value by ensuring it is a non-empty string and trimming whitespace.
1920
- *
1921
- * @param value
1922
- * @returns
1985
+ *
1986
+ * @param value
1987
+ * @returns
1923
1988
  */
1924
1989
  const normalizeEnumValue = (value) => {
1925
1990
  if (typeof value !== "string" || value.trim().length === 0) throw new ArkormException("Enum values must be provided as non-empty strings.");
@@ -1929,9 +1994,9 @@ const normalizeEnumValue = (value) => {
1929
1994
  };
1930
1995
  /**
1931
1996
  * Extract the enum values from a Prisma enum block string.
1932
- *
1933
- * @param block
1934
- * @returns
1997
+ *
1998
+ * @param block
1999
+ * @returns
1935
2000
  */
1936
2001
  const extractEnumBlockValues = (block) => {
1937
2002
  return block.split("\n").slice(1, -1).map((line) => line.trim()).filter(Boolean);
@@ -1947,11 +2012,11 @@ const validateEnumValues = (column, enumName, enumValues) => {
1947
2012
  };
1948
2013
  /**
1949
2014
  * Validate that a default value for an enum column is included in the defined enum values.
1950
- *
1951
- * @param column
1952
- * @param enumName
1953
- * @param enumValues
1954
- * @returns
2015
+ *
2016
+ * @param column
2017
+ * @param enumName
2018
+ * @param enumValues
2019
+ * @returns
1955
2020
  */
1956
2021
  const validateEnumDefaultValue = (column, enumName, enumValues) => {
1957
2022
  if (column.default == null) return;
@@ -1961,9 +2026,9 @@ const validateEnumDefaultValue = (column, enumName, enumValues) => {
1961
2026
  };
1962
2027
  /**
1963
2028
  * Build a single line of a Prisma model field definition based on a SchemaColumn, including type and modifiers.
1964
- *
1965
- * @param column
1966
- * @returns
2029
+ *
2030
+ * @param column
2031
+ * @returns
1967
2032
  */
1968
2033
  const buildFieldLine = (column) => {
1969
2034
  if (column.type === "id") {
@@ -1985,9 +2050,9 @@ const buildFieldLine = (column) => {
1985
2050
  return ` ${column.name} ${scalar}${nullable}${primary}${unique}${defaultSuffix}${updatedAt}${mapped}`;
1986
2051
  };
1987
2052
  /**
1988
- * Build a Prisma enum block string based on an enum name and its values, validating that
2053
+ * Build a Prisma enum block string based on an enum name and its values, validating that
1989
2054
  * at least one value is provided.
1990
- *
2055
+ *
1991
2056
  * @param enumName The name of the enum to create.
1992
2057
  * @param values The array of values for the enum.
1993
2058
  * @returns The Prisma enum block string.
@@ -1997,12 +2062,12 @@ const buildEnumBlock = (enumName, values) => {
1997
2062
  return `enum ${enumName} {\n${values.map((value) => ` ${value}`).join("\n")}\n}`;
1998
2063
  };
1999
2064
  /**
2000
- * Find the Prisma enum block in a schema string that corresponds to a given enum
2065
+ * Find the Prisma enum block in a schema string that corresponds to a given enum
2001
2066
  * name, returning its details if found.
2002
- *
2067
+ *
2003
2068
  * @param schema The Prisma schema string to search for the enum block.
2004
2069
  * @param enumName The name of the enum to find in the schema.
2005
- * @returns
2070
+ * @returns
2006
2071
  */
2007
2072
  const findEnumBlock = (schema, enumName) => {
2008
2073
  const candidates = [...schema.matchAll(PRISMA_ENUM_REGEX)];
@@ -2021,13 +2086,13 @@ const findEnumBlock = (schema, enumName) => {
2021
2086
  return null;
2022
2087
  };
2023
2088
  /**
2024
- * Ensure that Prisma enum blocks exist in the schema for any enum columns defined in a
2025
- * create or alter table operation, adding them if necessary and validating against
2089
+ * Ensure that Prisma enum blocks exist in the schema for any enum columns defined in a
2090
+ * create or alter table operation, adding them if necessary and validating against
2026
2091
  * existing blocks.
2027
- *
2092
+ *
2028
2093
  * @param schema The current Prisma schema string to check and modify.
2029
2094
  * @param columns The array of schema column definitions to check for enum types and ensure corresponding blocks exist for.
2030
- * @returns
2095
+ * @returns
2031
2096
  */
2032
2097
  const ensureEnumBlocks = (schema, columns) => {
2033
2098
  let nextSchema = schema;
@@ -2057,9 +2122,9 @@ const ensureEnumBlocks = (schema, columns) => {
2057
2122
  };
2058
2123
  /**
2059
2124
  * Build a Prisma model-level @@index definition line.
2060
- *
2125
+ *
2061
2126
  * @param index The schema index definition to convert to a Prisma \@\@index line.
2062
- * @returns
2127
+ * @returns
2063
2128
  */
2064
2129
  const buildIndexLine = (index) => {
2065
2130
  return ` @@index([${index.columns.join(", ")}]${typeof index.name === "string" && index.name.trim().length > 0 ? `, name: "${index.name.replace(/"/g, "\\\"")}"` : ""})`;
@@ -2083,9 +2148,9 @@ const buildUniqueConstraintLine = (constraint) => {
2083
2148
  return ` @@unique([${constraint.columns.join(", ")}]${typeof constraint.name === "string" && constraint.name.trim().length > 0 ? `, name: "${constraint.name.replace(/"/g, "\\\"")}"` : ""})`;
2084
2149
  };
2085
2150
  /**
2086
- * Derive a relation field name from a foreign key column name by applying
2151
+ * Derive a relation field name from a foreign key column name by applying
2087
2152
  * common conventions, such as removing "Id" suffixes and converting to camelCase.
2088
- *
2153
+ *
2089
2154
  * @param columnName The name of the foreign key column.
2090
2155
  * @returns The derived relation field name.
2091
2156
  */
@@ -2100,10 +2165,10 @@ const deriveRelationFieldName = (columnName) => {
2100
2165
  return `${trimmed.charAt(0).toLowerCase()}${trimmed.slice(1)}`;
2101
2166
  };
2102
2167
  /**
2103
- * Derive a relation name for both sides of a relation based on the
2104
- * source and target model names, using an explicit alias if provided or a
2168
+ * Derive a relation name for both sides of a relation based on the
2169
+ * source and target model names, using an explicit alias if provided or a
2105
2170
  * convention of combining the full source model name with the target model name.
2106
- *
2171
+ *
2107
2172
  * @param sourceModelName The name of the source model in the relation.
2108
2173
  * @param targetModelName The name of the target model in the relation.
2109
2174
  * @param explicitAlias An optional explicit alias for the relation.
@@ -2130,9 +2195,9 @@ const resolveForeignKeyColumn = (columns, foreignKey) => {
2130
2195
  const isOneToOneForeignKey = (column) => {
2131
2196
  return Boolean(column?.unique || column?.primary);
2132
2197
  };
2133
- /**
2198
+ /**
2134
2199
  * Format a SchemaForeignKeyAction value as a Prisma onDelete action string.
2135
- *
2200
+ *
2136
2201
  * @param action The foreign key action to format.
2137
2202
  * @returns The corresponding Prisma onDelete action string.
2138
2203
  */
@@ -2144,9 +2209,9 @@ const formatRelationAction = (action) => {
2144
2209
  return "NoAction";
2145
2210
  };
2146
2211
  /**
2147
- * Build a Prisma relation field line based on a SchemaForeignKey
2212
+ * Build a Prisma relation field line based on a SchemaForeignKey
2148
2213
  * definition, including relation name and onDelete action.
2149
- *
2214
+ *
2150
2215
  * @param foreignKey The foreign key definition to convert to a relation line.
2151
2216
  * @returns The corresponding Prisma schema line for the relation field.
2152
2217
  */
@@ -2162,10 +2227,10 @@ const buildRelationLine = (sourceModelName, foreignKey, columns = []) => {
2162
2227
  return ` ${fieldName} ${targetModel}${optional} @relation("${relationName.replace(/"/g, "\\\"")}", fields: [${foreignKey.column}], references: [${foreignKey.referencesColumn}]${onDelete})`;
2163
2228
  };
2164
2229
  /**
2165
- * Build a Prisma relation field line for the inverse side of a relation, based
2166
- * on the source and target model names and the foreign key definition, using
2230
+ * Build a Prisma relation field line for the inverse side of a relation, based
2231
+ * on the source and target model names and the foreign key definition, using
2167
2232
  * naming conventions and any explicit inverse alias provided.
2168
- *
2233
+ *
2169
2234
  * @param sourceModelName The name of the source model in the relation.
2170
2235
  * @param targetModelName The name of the target model in the relation.
2171
2236
  * @param foreignKey The foreign key definition for the relation.
@@ -2178,14 +2243,14 @@ const buildInverseRelationLine = (sourceModelName, targetModelName, foreignKey,
2178
2243
  return ` ${fieldName} ${isOneToOneForeignKey(sourceColumn) ? `${sourceModelName}?` : `${sourceModelName}[]`} @relation("${relationName.replace(/"/g, "\\\"")}")`;
2179
2244
  };
2180
2245
  /**
2181
- * Inject a line into the body of a Prisma model block if it does not already
2182
- * exist, using a provided existence check function to determine if the line
2246
+ * Inject a line into the body of a Prisma model block if it does not already
2247
+ * exist, using a provided existence check function to determine if the line
2183
2248
  * is already present.
2184
- *
2249
+ *
2185
2250
  * @param bodyLines The lines of the model block body to modify.
2186
2251
  * @param line The line to inject if it does not already exist.
2187
2252
  * @param exists A function that checks if a given line already exists in the body.
2188
- * @returns
2253
+ * @returns
2189
2254
  */
2190
2255
  const injectLineIntoModelBody = (bodyLines, line, exists) => {
2191
2256
  if (bodyLines.some(exists)) return bodyLines;
@@ -2194,10 +2259,10 @@ const injectLineIntoModelBody = (bodyLines, line, exists) => {
2194
2259
  return bodyLines;
2195
2260
  };
2196
2261
  /**
2197
- * Apply inverse relation definitions to a Prisma schema string based on the
2198
- * foreign keys defined in a create or alter table operation, ensuring that
2262
+ * Apply inverse relation definitions to a Prisma schema string based on the
2263
+ * foreign keys defined in a create or alter table operation, ensuring that
2199
2264
  * related models have corresponding relation fields for bi-directional navigation.
2200
- *
2265
+ *
2201
2266
  * @param schema The Prisma schema string to modify.
2202
2267
  * @param sourceModelName The name of the source model in the relation.
2203
2268
  * @param foreignKeys An array of foreign key definitions to process.
@@ -2220,9 +2285,9 @@ const applyInverseRelations = (schema, sourceModelName, foreignKeys, columns = [
2220
2285
  return nextSchema;
2221
2286
  };
2222
2287
  /**
2223
- * Build a Prisma model block string based on a SchemaTableCreateOperation, including
2288
+ * Build a Prisma model block string based on a SchemaTableCreateOperation, including
2224
2289
  * all fields and any necessary mapping.
2225
- *
2290
+ *
2226
2291
  * @param operation The schema table create operation to convert.
2227
2292
  * @returns The corresponding Prisma model block string.
2228
2293
  */
@@ -2247,12 +2312,12 @@ const buildModelBlock = (operation) => {
2247
2312
  ] : [...fields, ...relations]).join("\n")}\n}`;
2248
2313
  };
2249
2314
  /**
2250
- * Find the Prisma model block in a schema string that corresponds to a given
2315
+ * Find the Prisma model block in a schema string that corresponds to a given
2251
2316
  * table name, using both explicit mapping and naming conventions.
2252
- *
2253
- * @param schema
2254
- * @param table
2255
- * @returns
2317
+ *
2318
+ * @param schema
2319
+ * @param table
2320
+ * @returns
2256
2321
  */
2257
2322
  const findModelBlock = (schema, table) => {
2258
2323
  const candidates = [...schema.matchAll(PRISMA_MODEL_REGEX)];
@@ -2284,9 +2349,9 @@ const findModelBlock = (schema, table) => {
2284
2349
  return null;
2285
2350
  };
2286
2351
  /**
2287
- * Apply a create table operation to a Prisma schema string, adding a new model
2352
+ * Apply a create table operation to a Prisma schema string, adding a new model
2288
2353
  * block for the specified table and fields.
2289
- *
2354
+ *
2290
2355
  * @param schema The current Prisma schema string.
2291
2356
  * @param operation The schema table create operation to apply.
2292
2357
  * @returns The updated Prisma schema string with the new model block.
@@ -2298,9 +2363,9 @@ const applyCreateTableOperation = (schema, operation) => {
2298
2363
  return applyInverseRelations(`${schemaWithEnums.trimEnd()}\n\n${block}\n`, toModelName(operation.table), operation.foreignKeys ?? [], operation.columns);
2299
2364
  };
2300
2365
  /**
2301
- * Apply an alter table operation to a Prisma schema string, modifying the model
2366
+ * Apply an alter table operation to a Prisma schema string, modifying the model
2302
2367
  * block for the specified table by adding and removing fields as needed.
2303
- *
2368
+ *
2304
2369
  * @param schema The current Prisma schema string.
2305
2370
  * @param operation The schema table alter operation to apply.
2306
2371
  * @returns The updated Prisma schema string with the modified model block.
@@ -2367,10 +2432,10 @@ const applyDropTableOperation = (schema, operation) => {
2367
2432
  return `${before}${before && after ? "\n\n" : ""}${after}`;
2368
2433
  };
2369
2434
  /**
2370
- * The SchemaBuilder class provides a fluent interface for defining
2371
- * database schema operations in a migration, such as creating, altering, and
2435
+ * The SchemaBuilder class provides a fluent interface for defining
2436
+ * database schema operations in a migration, such as creating, altering, and
2372
2437
  * dropping tables.
2373
- *
2438
+ *
2374
2439
  * @param schema The current Prisma schema string.
2375
2440
  * @param operations The list of schema operations to apply.
2376
2441
  * @returns The updated Prisma schema string after applying all operations.
@@ -2384,7 +2449,7 @@ const applyOperationsToPrismaSchema = (schema, operations) => {
2384
2449
  };
2385
2450
  /**
2386
2451
  * Run a Prisma CLI command using npx, capturing and throwing any errors that occur.
2387
- *
2452
+ *
2388
2453
  * @param args The arguments to pass to the Prisma CLI command.
2389
2454
  * @param cwd The current working directory to run the command in.
2390
2455
  * @returns void
@@ -2399,11 +2464,11 @@ const runPrismaCommand = (args, cwd) => {
2399
2464
  throw new ArkormException(errorOutput ? `Prisma command failed: prisma ${args.join(" ")}\n${errorOutput}` : `Prisma command failed: prisma ${args.join(" ")}`);
2400
2465
  };
2401
2466
  /**
2402
- * Generate a new migration file with a given name and options, including
2467
+ * Generate a new migration file with a given name and options, including
2403
2468
  * writing the file to disk if specified.
2404
- *
2405
- * @param name
2406
- * @returns
2469
+ *
2470
+ * @param name
2471
+ * @returns
2407
2472
  */
2408
2473
  const resolveMigrationClassName = (name) => {
2409
2474
  const cleaned = name.replace(/[^a-zA-Z0-9]+/g, " ").trim();
@@ -2411,39 +2476,39 @@ const resolveMigrationClassName = (name) => {
2411
2476
  return `${cleaned.split(/\s+/g).map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join("")}Migration`;
2412
2477
  };
2413
2478
  /**
2414
- * Pad a number with leading zeros to ensure it is at least two digits, for
2479
+ * Pad a number with leading zeros to ensure it is at least two digits, for
2415
2480
  * use in migration timestamps.
2416
- *
2417
- * @param value
2418
- * @returns
2481
+ *
2482
+ * @param value
2483
+ * @returns
2419
2484
  */
2420
2485
  const pad = (value) => String(value).padStart(2, "0");
2421
2486
  /**
2422
- * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
2487
+ * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
2423
2488
  * file names, based on the current date and time or a provided date.
2424
- *
2425
- * @param date
2426
- * @returns
2489
+ *
2490
+ * @param date
2491
+ * @returns
2427
2492
  */
2428
2493
  const createMigrationTimestamp = (date = /* @__PURE__ */ new Date()) => {
2429
2494
  return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}`;
2430
2495
  };
2431
2496
  /**
2432
- * Convert a migration name to a slug suitable for use in a file name, by
2497
+ * Convert a migration name to a slug suitable for use in a file name, by
2433
2498
  * lowercasing and replacing non-alphanumeric characters with underscores.
2434
- *
2435
- * @param name
2436
- * @returns
2499
+ *
2500
+ * @param name
2501
+ * @returns
2437
2502
  */
2438
2503
  const toMigrationFileSlug = (name) => {
2439
2504
  return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "migration";
2440
2505
  };
2441
2506
  /**
2442
- * Build the source code for a new migration file based on a given class
2507
+ * Build the source code for a new migration file based on a given class
2443
2508
  * name, using a template with empty up and down methods.
2444
- *
2445
- * @param className
2446
- * @returns
2509
+ *
2510
+ * @param className
2511
+ * @returns
2447
2512
  */
2448
2513
  const buildMigrationSource = (className, extension = "ts") => {
2449
2514
  if (extension === "js") return [
@@ -2480,12 +2545,12 @@ const buildMigrationSource = (className, extension = "ts") => {
2480
2545
  ].join("\n");
2481
2546
  };
2482
2547
  /**
2483
- * Generate a new migration file with a given name and options, including
2548
+ * Generate a new migration file with a given name and options, including
2484
2549
  * writing the file to disk if specified, and return the details of the generated file.
2485
- *
2486
- * @param name
2487
- * @param options
2488
- * @returns
2550
+ *
2551
+ * @param name
2552
+ * @param options
2553
+ * @returns
2489
2554
  */
2490
2555
  const generateMigrationFile = (name, options = {}) => {
2491
2556
  const timestamp = createMigrationTimestamp(/* @__PURE__ */ new Date());
@@ -2510,10 +2575,10 @@ const generateMigrationFile = (name, options = {}) => {
2510
2575
  };
2511
2576
  /**
2512
2577
  * 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.
2513
- *
2578
+ *
2514
2579
  * @param migration The migration class or instance to analyze.
2515
2580
  * @param direction The direction of the migration to plan for ('up' or 'down').
2516
- * @returns A promise that resolves to an array of schema operations that would be performed.
2581
+ * @returns A promise that resolves to an array of schema operations that would be performed.
2517
2582
  */
2518
2583
  const getMigrationPlan = async (migration, direction = "up") => {
2519
2584
  const instance = typeof migration === "function" ? new migration() : migration;
@@ -2548,10 +2613,10 @@ const applyMigrationRollbackToDatabase = async (adapter, migration) => {
2548
2613
  return { operations };
2549
2614
  };
2550
2615
  /**
2551
- * Apply the schema operations defined in a migration to a Prisma schema
2552
- * file, updating the file on disk if specified, and return the updated
2616
+ * Apply the schema operations defined in a migration to a Prisma schema
2617
+ * file, updating the file on disk if specified, and return the updated
2553
2618
  * schema and list of operations applied.
2554
- *
2619
+ *
2555
2620
  * @param migration The migration class or instance to apply.
2556
2621
  * @param options Options for applying the migration, including schema path and write flag.
2557
2622
  * @returns A promise that resolves to an object containing the updated schema, schema path, and list of operations applied.
@@ -2590,10 +2655,10 @@ const applyMigrationRollbackToPrismaSchema = async (migration, options = {}) =>
2590
2655
  };
2591
2656
  };
2592
2657
  /**
2593
- * Run a migration by applying its schema operations to a Prisma schema
2594
- * file, optionally generating Prisma client code and running migrations after
2658
+ * Run a migration by applying its schema operations to a Prisma schema
2659
+ * file, optionally generating Prisma client code and running migrations after
2595
2660
  * applying the schema changes.
2596
- *
2661
+ *
2597
2662
  * @param migration The migration class or instance to run.
2598
2663
  * @param options Options for running the migration, including schema path, write flag, and Prisma commands.
2599
2664
  * @returns A promise that resolves to an object containing the schema path and list of operations applied.
@@ -2975,8 +3040,8 @@ const normalizePathInput = (paths) => {
2975
3040
  const normalizeConstructors = (items) => items.flatMap((item) => Array.isArray(item) ? item : [item]).filter(Boolean);
2976
3041
  /**
2977
3042
  * Register additional runtime discovery paths without replacing configured paths.
2978
- *
2979
- * @param paths
3043
+ *
3044
+ * @param paths
2980
3045
  */
2981
3046
  const registerPaths = (paths) => {
2982
3047
  Object.entries(paths).forEach(([key, value]) => {
@@ -2985,69 +3050,69 @@ const registerPaths = (paths) => {
2985
3050
  };
2986
3051
  /**
2987
3052
  * Register additional runtime discovery paths for migrations without replacing configured paths.
2988
- *
2989
- * @param paths
2990
- * @returns
3053
+ *
3054
+ * @param paths
3055
+ * @returns
2991
3056
  */
2992
3057
  const loadMigrationsFrom = (paths) => registerPaths({ migrations: paths });
2993
3058
  /**
2994
3059
  * Register additional runtime discovery paths for seeders without replacing configured paths.
2995
- *
2996
- * @param paths
2997
- * @returns
3060
+ *
3061
+ * @param paths
3062
+ * @returns
2998
3063
  */
2999
3064
  const loadSeedersFrom = (paths) => registerPaths({ seeders: paths });
3000
3065
  /**
3001
3066
  * Register additional runtime discovery paths for models without replacing configured paths.
3002
- *
3003
- * @param paths
3004
- * @returns
3067
+ *
3068
+ * @param paths
3069
+ * @returns
3005
3070
  */
3006
3071
  const loadModelsFrom = (paths) => registerPaths({ models: paths });
3007
3072
  /**
3008
3073
  * Register additional runtime discovery paths for factories without replacing configured paths.
3009
- *
3010
- * @param paths
3011
- * @returns
3074
+ *
3075
+ * @param paths
3076
+ * @returns
3012
3077
  */
3013
3078
  const loadFactoriesFrom = (paths) => registerPaths({ factories: paths });
3014
3079
  /**
3015
3080
  * Register migration constructors directly without relying on runtime discovery.
3016
- *
3017
- * @param migrations
3081
+ *
3082
+ * @param migrations
3018
3083
  */
3019
3084
  const registerMigrations = (...migrations) => {
3020
3085
  pushUnique(registry.migrations, normalizeConstructors(migrations));
3021
3086
  };
3022
3087
  /**
3023
3088
  * Register seeder constructors directly without relying on runtime discovery.
3024
- *
3025
- * @param seeders
3089
+ *
3090
+ * @param seeders
3026
3091
  */
3027
3092
  const registerSeeders = (...seeders) => {
3028
3093
  pushUnique(registry.seeders, normalizeConstructors(seeders));
3029
3094
  };
3030
3095
  /**
3031
3096
  * Register model constructors directly without relying on runtime discovery.
3032
- *
3033
- * @param models
3097
+ *
3098
+ * @param models
3034
3099
  */
3035
3100
  const registerModels = (...models) => {
3036
3101
  pushUnique(registry.models, normalizeConstructors(models));
3037
3102
  };
3038
3103
  /**
3039
3104
  * Register factory constructors or instances directly without relying on runtime discovery.
3040
- *
3041
- * @param factories
3105
+ *
3106
+ * @param factories
3042
3107
  */
3043
3108
  const registerFactories = (...factories) => {
3044
3109
  pushUnique(registry.factories, normalizeConstructors(factories));
3045
3110
  };
3046
3111
  /**
3047
3112
  * Get registered runtime discovery paths or registered constructors for a specific type.
3048
- *
3049
- * @param key
3050
- * @returns
3113
+ *
3114
+ * @param key
3115
+ * @returns
3051
3116
  */
3052
3117
  const getRegisteredPaths = (key) => {
3053
3118
  if (key) return [...registry.paths[key]];
@@ -3060,26 +3125,26 @@ const getRegisteredPaths = (key) => {
3060
3125
  };
3061
3126
  /**
3062
3127
  * Get registered migration constructors instances.
3063
- *
3064
- * @returns
3128
+ *
3129
+ * @returns
3065
3130
  */
3066
3131
  const getRegisteredMigrations = () => [...registry.migrations];
3067
3132
  /**
3068
3133
  * Get registered seeder constructors instances.
3069
- *
3070
- * @returns
3134
+ *
3135
+ * @returns
3071
3136
  */
3072
3137
  const getRegisteredSeeders = () => [...registry.seeders];
3073
3138
  /**
3074
3139
  * Get registered model constructors instances.
3075
- *
3076
- * @returns
3140
+ *
3141
+ * @returns
3077
3142
  */
3078
3143
  const getRegisteredModels = () => [...registry.models];
3079
3144
  /**
3080
3145
  * Get registered factory constructors or instances.
3081
- *
3082
- * @returns
3146
+ *
3147
+ * @returns
3083
3148
  */
3084
3149
  const getRegisteredFactories = () => [...registry.factories];
3085
3150
  const resetRuntimeRegistryForTests = () => {
@@ -3183,9 +3248,9 @@ const mergePathConfig = (paths) => {
3183
3248
  };
3184
3249
  /**
3185
3250
  * Merge the feature configuration from the base defaults, user configuration, and provided options.
3186
- *
3187
- * @param features
3188
- * @returns
3251
+ *
3252
+ * @param features
3253
+ * @returns
3189
3254
  */
3190
3255
  const mergeFeatureConfig = (features) => {
3191
3256
  const defaults = baseConfig.features ?? {};
@@ -3241,7 +3306,7 @@ const awaitConfiguredModelsRegistration = async () => {
3241
3306
  };
3242
3307
  /**
3243
3308
  * Define the ArkORM runtime configuration. This function can be used to provide.
3244
- *
3309
+ *
3245
3310
  * @param config The ArkORM configuration object.
3246
3311
  * @returns The same configuration object.
3247
3312
  */
@@ -3250,10 +3315,10 @@ const defineConfig = (config) => {
3250
3315
  };
3251
3316
  /**
3252
3317
  * Bind a database adapter instance to an array of models that support adapter binding.
3253
- *
3254
- * @param adapter
3255
- * @param models
3256
- * @returns
3318
+ *
3319
+ * @param adapter
3320
+ * @param models
3321
+ * @returns
3257
3322
  */
3258
3323
  const bindAdapterToModels = (adapter, models) => {
3259
3324
  models.forEach((model) => {
@@ -3262,10 +3327,10 @@ const bindAdapterToModels = (adapter, models) => {
3262
3327
  return adapter;
3263
3328
  };
3264
3329
  /**
3265
- * Get the user-provided ArkORM configuration.
3266
- *
3330
+ * Get the user-provided ArkORM configuration.
3331
+ *
3267
3332
  * @param key Optional specific configuration key to retrieve. If omitted, the entire configuration object is returned.
3268
- * @returns The user-provided ArkORM configuration object.
3333
+ * @returns The user-provided ArkORM configuration object.
3269
3334
  */
3270
3335
  const getUserConfig = (key) => {
3271
3336
  if (key) return userConfig[key];
@@ -3274,8 +3339,8 @@ const getUserConfig = (key) => {
3274
3339
  /**
3275
3340
  * Configure the ArkORM runtime with the provided runtime client resolver and
3276
3341
  * adapter-first options.
3277
- *
3278
- * @param client
3342
+ *
3343
+ * @param client
3279
3344
  * @param options
3280
3345
  */
3281
3346
  const configureArkormRuntime = (client, options = {}) => {
@@ -3308,7 +3373,7 @@ const configureArkormRuntime = (client, options = {}) => {
3308
3373
  });
3309
3374
  };
3310
3375
  /**
3311
- * Reset the ArkORM runtime configuration.
3376
+ * Reset the ArkORM runtime configuration.
3312
3377
  * This is primarily intended for testing purposes.
3313
3378
  */
3314
3379
  const resetArkormRuntimeForTests = () => {
@@ -3333,9 +3398,9 @@ const resetArkormRuntimeForTests = () => {
3333
3398
  /**
3334
3399
  * Resolve a runtime client instance from the provided resolver, which can be either
3335
3400
  * a direct client instance or a function that returns a client instance.
3336
- *
3337
- * @param resolver
3338
- * @returns
3401
+ *
3402
+ * @param resolver
3403
+ * @returns
3339
3404
  */
3340
3405
  const resolveClient = (resolver) => {
3341
3406
  if (!resolver) return void 0;
@@ -3344,12 +3409,12 @@ const resolveClient = (resolver) => {
3344
3409
  return client;
3345
3410
  };
3346
3411
  /**
3347
- * Resolve and apply the ArkORM configuration from an imported module.
3412
+ * Resolve and apply the ArkORM configuration from an imported module.
3348
3413
  * This function checks for a default export and falls back to the module itself, then validates
3349
3414
  * the configuration object and applies it to the runtime if valid.
3350
- *
3351
- * @param imported
3352
- * @returns
3415
+ *
3416
+ * @param imported
3417
+ * @returns
3353
3418
  */
3354
3419
  const resolveAndApplyConfig = (imported) => {
3355
3420
  const config = imported?.default ?? imported;
@@ -3369,11 +3434,11 @@ const resolveAndApplyConfig = (imported) => {
3369
3434
  runtimeConfigLoaded = true;
3370
3435
  };
3371
3436
  /**
3372
- * Dynamically import a configuration file.
3437
+ * Dynamically import a configuration file.
3373
3438
  * A cache-busting query parameter is appended to ensure the latest version is loaded.
3374
- *
3375
- * @param configPath
3376
- * @returns A promise that resolves to the imported configuration module.
3439
+ *
3440
+ * @param configPath
3441
+ * @returns A promise that resolves to the imported configuration module.
3377
3442
  */
3378
3443
  const importConfigFile = (configPath) => {
3379
3444
  return RuntimeModuleLoader.load(configPath);
@@ -3393,9 +3458,9 @@ const loadRuntimeConfigSync = () => {
3393
3458
  return false;
3394
3459
  };
3395
3460
  /**
3396
- * Load the ArkORM configuration by searching for configuration files in the
3461
+ * Load the ArkORM configuration by searching for configuration files in the
3397
3462
  * current working directory.
3398
- * @returns
3463
+ * @returns
3399
3464
  */
3400
3465
  const loadArkormConfig = async () => {
3401
3466
  if (runtimeConfigLoaded) {
@@ -3426,11 +3491,11 @@ const loadArkormConfig = async () => {
3426
3491
  await runtimeConfigLoadingPromise;
3427
3492
  };
3428
3493
  /**
3429
- * Ensure that the ArkORM configuration is loaded.
3494
+ * Ensure that the ArkORM configuration is loaded.
3430
3495
  * This function can be called to trigger the loading process if it hasn't already been initiated.
3431
3496
  * If the configuration is already loaded, it will return immediately.
3432
- *
3433
- * @returns
3497
+ *
3498
+ * @returns
3434
3499
  */
3435
3500
  const ensureArkormConfigLoading = () => {
3436
3501
  if (runtimeConfigLoaded) return;
@@ -3441,10 +3506,10 @@ const getDefaultStubsPath = () => {
3441
3506
  };
3442
3507
  /**
3443
3508
  * Get the runtime compatibility client.
3444
- * This function will trigger the loading of the ArkORM configuration if
3509
+ * This function will trigger the loading of the ArkORM configuration if
3445
3510
  * it hasn't already been loaded.
3446
- *
3447
- * @returns
3511
+ *
3512
+ * @returns
3448
3513
  */
3449
3514
  const getRuntimeClient = () => {
3450
3515
  const activeTransactionClient = transactionClientStorage.getStore();
@@ -3458,8 +3523,8 @@ const getRuntimeClient = () => {
3458
3523
  const getRuntimePrismaClient = getRuntimeClient;
3459
3524
  /**
3460
3525
  * Get the currently configured runtime adapter, if any.
3461
- *
3462
- * @returns
3526
+ *
3527
+ * @returns
3463
3528
  */
3464
3529
  const getRuntimeAdapter = () => {
3465
3530
  const activeTransactionAdapter = transactionAdapterStorage.getStore();
@@ -3536,7 +3601,7 @@ const emitRuntimeDebugEvent = (event) => {
3536
3601
  /**
3537
3602
  * Check if a given value matches Arkorm's query-schema contract
3538
3603
  * by verifying the presence of common delegate methods.
3539
- *
3604
+ *
3540
3605
  * @param value The value to check.
3541
3606
  * @returns True if the value matches the query-schema contract, false otherwise.
3542
3607
  */
@@ -3562,7 +3627,7 @@ loadArkormConfig();
3562
3627
  //#region src/URLDriver.ts
3563
3628
  /**
3564
3629
  * URLDriver builds pagination URLs from paginator options.
3565
- *
3630
+ *
3566
3631
  * @author Legacy (3m1n3nc3)
3567
3632
  * @since 0.1.0
3568
3633
  */
@@ -3605,7 +3670,7 @@ var URLDriver = class URLDriver {
3605
3670
  /**
3606
3671
  * The LengthAwarePaginator class encapsulates paginated results with full
3607
3672
  * metadata including the total result count and last page.
3608
- *
3673
+ *
3609
3674
  * @template T The type of the data being paginated.
3610
3675
  * @author Legacy (3m1n3nc3)
3611
3676
  * @since 0.1.0
@@ -3613,7 +3678,7 @@ var URLDriver = class URLDriver {
3613
3678
  var LengthAwarePaginator = class {
3614
3679
  /**
3615
3680
  * Creates a new LengthAwarePaginator instance.
3616
- *
3681
+ *
3617
3682
  * @param data The collection of data being paginated.
3618
3683
  * @param total The total number of items.
3619
3684
  * @param perPage The number of items per page.
@@ -3658,8 +3723,8 @@ var LengthAwarePaginator = class {
3658
3723
  }
3659
3724
  /**
3660
3725
  * Converts the paginator instance to a JSON-serializable object.
3661
- *
3662
- * @returns
3726
+ *
3727
+ * @returns
3663
3728
  */
3664
3729
  toJSON() {
3665
3730
  return {
@@ -3734,7 +3799,7 @@ var Paginator = class {
3734
3799
  //#region src/relationship/Relation.ts
3735
3800
  /**
3736
3801
  * Base class for all relationship types. Not meant to be used directly.
3737
- *
3802
+ *
3738
3803
  * @author Legacy (3m1n3nc3)
3739
3804
  * @since 0.1.0
3740
3805
  */
@@ -3780,7 +3845,7 @@ var Relation = class {
3780
3845
  }
3781
3846
  /**
3782
3847
  * Apply a constraint to the relationship query.
3783
- *
3848
+ *
3784
3849
  * @param constraint The constraint function to apply to the query.
3785
3850
  * @returns The current relation instance.
3786
3851
  */
@@ -3884,81 +3949,81 @@ var Relation = class {
3884
3949
  }
3885
3950
  /**
3886
3951
  * Adds clause to determine if a column's value is in the past
3887
- *
3888
- * @param key
3889
- * @returns
3952
+ *
3953
+ * @param key
3954
+ * @returns
3890
3955
  */
3891
3956
  wherePast(key) {
3892
3957
  return this.constrain((query) => query.wherePast(key));
3893
3958
  }
3894
3959
  /**
3895
3960
  * Adds clause to determine if a column's value is in the future
3896
- *
3897
- * @param key
3898
- * @returns
3961
+ *
3962
+ * @param key
3963
+ * @returns
3899
3964
  */
3900
3965
  whereFuture(key) {
3901
3966
  return this.constrain((query) => query.whereFuture(key));
3902
3967
  }
3903
3968
  /**
3904
3969
  * Adds clause to determine if a column's value is in the past, inclusive of the current date and time
3905
- *
3906
- * @param key
3907
- * @returns
3970
+ *
3971
+ * @param key
3972
+ * @returns
3908
3973
  */
3909
3974
  whereNowOrPast(key) {
3910
3975
  return this.constrain((query) => query.whereNowOrPast(key));
3911
3976
  }
3912
3977
  /**
3913
3978
  * Adds clause to determine if a column's value is in the future, inclusive of the current date and time
3914
- *
3915
- * @param key
3916
- * @returns
3979
+ *
3980
+ * @param key
3981
+ * @returns
3917
3982
  */
3918
3983
  whereNowOrFuture(key) {
3919
3984
  return this.constrain((query) => query.whereNowOrFuture(key));
3920
3985
  }
3921
3986
  /**
3922
3987
  * Adds clause to determine if a column's value is today
3923
- *
3924
- * @param key
3925
- * @returns
3988
+ *
3989
+ * @param key
3990
+ * @returns
3926
3991
  */
3927
3992
  whereToday(key) {
3928
3993
  return this.constrain((query) => query.whereToday(key));
3929
3994
  }
3930
3995
  /**
3931
3996
  * Adds clause to determine if a column's value is before today
3932
- *
3933
- * @param key
3934
- * @returns
3997
+ *
3998
+ * @param key
3999
+ * @returns
3935
4000
  */
3936
4001
  whereBeforeToday(key) {
3937
4002
  return this.constrain((query) => query.whereBeforeToday(key));
3938
4003
  }
3939
4004
  /**
3940
4005
  * Adds clause to determine if a column's value is after today
3941
- *
3942
- * @param key
3943
- * @returns
4006
+ *
4007
+ * @param key
4008
+ * @returns
3944
4009
  */
3945
4010
  whereAfterToday(key) {
3946
4011
  return this.constrain((query) => query.whereAfterToday(key));
3947
4012
  }
3948
4013
  /**
3949
4014
  * Adds clause to determine if a column's value is today or before today
3950
- *
3951
- * @param key
3952
- * @returns
4015
+ *
4016
+ * @param key
4017
+ * @returns
3953
4018
  */
3954
4019
  whereTodayOrBefore(key) {
3955
4020
  return this.constrain((query) => query.whereTodayOrBefore(key));
3956
4021
  }
3957
4022
  /**
3958
4023
  * Adds clause to determine if a column's value is today or after today
3959
- *
3960
- * @param key
3961
- * @returns
4024
+ *
4025
+ * @param key
4026
+ * @returns
3962
4027
  */
3963
4028
  whereTodayOrAfter(key) {
3964
4029
  return this.constrain((query) => query.whereTodayOrAfter(key));
@@ -3968,9 +4033,9 @@ var Relation = class {
3968
4033
  }
3969
4034
  /**
3970
4035
  * Adds "where exists" SQL clauses.
3971
- *
3972
- * @param queryOrCallback
3973
- * @returns
4036
+ *
4037
+ * @param queryOrCallback
4038
+ * @returns
3974
4039
  */
3975
4040
  whereExists(queryOrCallback) {
3976
4041
  return this.constrain((query) => query.whereExists(queryOrCallback));
@@ -4069,107 +4134,107 @@ var Relation = class {
4069
4134
  }
4070
4135
  /**
4071
4136
  * Add an OR string contains clause to the relationship query.
4072
- *
4073
- * @param key
4074
- * @param value
4075
- * @returns
4137
+ *
4138
+ * @param key
4139
+ * @param value
4140
+ * @returns
4076
4141
  */
4077
4142
  orWhereLike(key, value) {
4078
4143
  return this.constrain((query) => query.orWhereLike(key, value));
4079
4144
  }
4080
4145
  /**
4081
4146
  * Add a negated string contains (NOT LIKE) clause to the relationship query.
4082
- *
4083
- * @param key
4084
- * @param value
4085
- * @returns
4147
+ *
4148
+ * @param key
4149
+ * @param value
4150
+ * @returns
4086
4151
  */
4087
4152
  whereNotLike(key, value) {
4088
4153
  return this.constrain((query) => query.whereNotLike(key, value));
4089
4154
  }
4090
4155
  /**
4091
4156
  * Add an OR negated string contains (NOT LIKE) clause to the relationship query.
4092
- *
4093
- * @param key
4094
- * @param value
4095
- * @returns
4157
+ *
4158
+ * @param key
4159
+ * @param value
4160
+ * @returns
4096
4161
  */
4097
4162
  orWhereNotLike(key, value) {
4098
4163
  return this.constrain((query) => query.orWhereNotLike(key, value));
4099
4164
  }
4100
4165
  /**
4101
4166
  * Add a JSON containment clause to the relationship query.
4102
- *
4103
- * @param key
4104
- * @param value
4105
- * @returns
4167
+ *
4168
+ * @param key
4169
+ * @param value
4170
+ * @returns
4106
4171
  */
4107
4172
  whereJsonContains(column, value) {
4108
4173
  return this.constrain((query) => query.whereJsonContains(column, value));
4109
4174
  }
4110
4175
  /**
4111
4176
  * OR variant of whereJsonContains().
4112
- *
4113
- * @param column
4114
- * @param value
4115
- * @returns
4177
+ *
4178
+ * @param column
4179
+ * @param value
4180
+ * @returns
4116
4181
  */
4117
4182
  orWhereJsonContains(column, value) {
4118
4183
  return this.constrain((query) => query.orWhereJsonContains(column, value));
4119
4184
  }
4120
4185
  /**
4121
4186
  * Add a negated JSON containment clause to the relationship query.
4122
- *
4123
- * @param column
4124
- * @param value
4125
- * @returns
4187
+ *
4188
+ * @param column
4189
+ * @param value
4190
+ * @returns
4126
4191
  */
4127
4192
  whereJsonDoesntContain(column, value) {
4128
4193
  return this.constrain((query) => query.whereJsonDoesntContain(column, value));
4129
4194
  }
4130
4195
  /**
4131
4196
  * OR variant of whereJsonDoesntContain().
4132
- *
4133
- * @param column
4134
- * @param value
4135
- * @returns
4197
+ *
4198
+ * @param column
4199
+ * @param value
4200
+ * @returns
4136
4201
  */
4137
4202
  orWhereJsonDoesntContain(column, value) {
4138
4203
  return this.constrain((query) => query.orWhereJsonDoesntContain(column, value));
4139
4204
  }
4140
4205
  /**
4141
4206
  * Add a JSON key-existence clause to the relationship query.
4142
- *
4143
- * @param column
4144
- * @param value
4145
- * @returns
4207
+ *
4208
+ * @param column
4209
+ * @param value
4210
+ * @returns
4146
4211
  */
4147
4212
  whereJsonContainsKey(column) {
4148
4213
  return this.constrain((query) => query.whereJsonContainsKey(column));
4149
4214
  }
4150
4215
  /**
4151
4216
  * OR variant of whereJsonContainsKey().
4152
- *
4153
- * @param column
4154
- * @returns
4217
+ *
4218
+ * @param column
4219
+ * @returns
4155
4220
  */
4156
4221
  orWhereJsonContainsKey(column) {
4157
4222
  return this.constrain((query) => query.orWhereJsonContainsKey(column));
4158
4223
  }
4159
4224
  /**
4160
4225
  * Add a negated JSON key-existence clause to the relationship query.
4161
- *
4162
- * @param column
4163
- * @returns
4226
+ *
4227
+ * @param column
4228
+ * @returns
4164
4229
  */
4165
4230
  whereJsonDoesntContainKey(column) {
4166
4231
  return this.constrain((query) => query.whereJsonDoesntContainKey(column));
4167
4232
  }
4168
4233
  /**
4169
4234
  * OR variant of whereJsonDoesntContainKey().
4170
- *
4171
- * @param column
4172
- * @returns
4235
+ *
4236
+ * @param column
4237
+ * @returns
4173
4238
  */
4174
4239
  orWhereJsonDoesntContainKey(column) {
4175
4240
  return this.constrain((query) => query.orWhereJsonDoesntContainKey(column));
@@ -4182,18 +4247,18 @@ var Relation = class {
4182
4247
  }
4183
4248
  /**
4184
4249
  * Add a JSON array overlap clause to the relationship query.
4185
- *
4186
- * @param column
4187
- * @param value
4250
+ *
4251
+ * @param column
4252
+ * @param value
4188
4253
  */
4189
4254
  whereJsonOverlaps(column, value) {
4190
4255
  return this.constrain((query) => query.whereJsonOverlaps(column, value));
4191
4256
  }
4192
4257
  /**
4193
4258
  * OR variant of whereJsonOverlaps().
4194
- *
4195
- * @param column
4196
- * @param value
4259
+ *
4260
+ * @param column
4261
+ * @param value
4197
4262
  */
4198
4263
  orWhereJsonOverlaps(column, value) {
4199
4264
  return this.constrain((query) => query.orWhereJsonOverlaps(column, value));
@@ -4420,9 +4485,9 @@ var Relation = class {
4420
4485
  }
4421
4486
  /**
4422
4487
  * Apply the defined constraint to the given query, if any.
4423
- *
4488
+ *
4424
4489
  * @param query The query builder instance to apply the constraint to.
4425
- *
4490
+ *
4426
4491
  * @returns The query builder instance with the constraint applied, if any.
4427
4492
  */
4428
4493
  applyConstraint(query) {
@@ -4449,18 +4514,18 @@ var Relation = class {
4449
4514
  }
4450
4515
  /**
4451
4516
  * Execute the relationship query and return the first related model or throw an error if not found.
4452
- *
4453
- * @returns
4517
+ *
4518
+ * @returns
4454
4519
  */
4455
4520
  async firstOrFail() {
4456
4521
  return (await this.getQuery()).firstOrFail();
4457
4522
  }
4458
4523
  /**
4459
- * Execute the relationship query and return the first related model or the result of
4524
+ * Execute the relationship query and return the first related model or the result of
4460
4525
  * the callback if not found.
4461
- *
4462
- * @param callback
4463
- * @returns
4526
+ *
4527
+ * @param callback
4528
+ * @returns
4464
4529
  */
4465
4530
  async firstOr(callback) {
4466
4531
  const result = await this.first();
@@ -4496,11 +4561,11 @@ var Relation = class {
4496
4561
  return !await this.exists();
4497
4562
  }
4498
4563
  /**
4499
- * Create a new instance of the related model with the given attributes and
4564
+ * Create a new instance of the related model with the given attributes and
4500
4565
  * relationship creation attributes applied, but do not save it.
4501
- *
4502
- * @param attributes
4503
- * @returns
4566
+ *
4567
+ * @param attributes
4568
+ * @returns
4504
4569
  */
4505
4570
  make(attributes = {}) {
4506
4571
  const model = this.getRelatedModelConstructor().hydrate(this.mergeCreationAttributes(attributes));
@@ -4508,31 +4573,31 @@ var Relation = class {
4508
4573
  return model;
4509
4574
  }
4510
4575
  /**
4511
- * Create new instances of the related model with the given attributes and relationship
4576
+ * Create new instances of the related model with the given attributes and relationship
4512
4577
  * creation attributes applied, but do not save them.
4513
- *
4514
- * @param attributes
4515
- * @returns
4578
+ *
4579
+ * @param attributes
4580
+ * @returns
4516
4581
  */
4517
4582
  makeMany(attributes = []) {
4518
4583
  return attributes.map((item) => this.make(item));
4519
4584
  }
4520
4585
  /**
4521
- * Create a new instance of the related model with the given attributes and relationship
4586
+ * Create a new instance of the related model with the given attributes and relationship
4522
4587
  * creation attributes applied, and save it to the database.
4523
- *
4524
- * @param attributes
4525
- * @returns
4588
+ *
4589
+ * @param attributes
4590
+ * @returns
4526
4591
  */
4527
4592
  async create(attributes = {}) {
4528
4593
  return await this.getRelatedModelConstructor().query().create(this.mergeCreationAttributes(attributes));
4529
4594
  }
4530
4595
  /**
4531
- * Create new instances of the related model with the given attributes and relationship
4596
+ * Create new instances of the related model with the given attributes and relationship
4532
4597
  * creation attributes applied, and save them to the database.
4533
- *
4534
- * @param values
4535
- * @returns
4598
+ *
4599
+ * @param values
4600
+ * @returns
4536
4601
  */
4537
4602
  async createMany(values = []) {
4538
4603
  if (values.length === 0) return [];
@@ -4540,9 +4605,9 @@ var Relation = class {
4540
4605
  }
4541
4606
  /**
4542
4607
  * Save the given model instance by applying relationship creation attributes and calling save() on it.
4543
- *
4544
- * @param model
4545
- * @returns
4608
+ *
4609
+ * @param model
4610
+ * @returns
4546
4611
  */
4547
4612
  async save(model) {
4548
4613
  const saveable = this.applyCreationAttributesToModel(model);
@@ -4556,11 +4621,11 @@ var Relation = class {
4556
4621
  }
4557
4622
  }
4558
4623
  /**
4559
- * Save the given model instance by applying relationship creation attributes and
4624
+ * Save the given model instance by applying relationship creation attributes and
4560
4625
  * calling saveQuietly() on it if supported, otherwise falling back to save().
4561
- *
4562
- * @param model
4563
- * @returns
4626
+ *
4627
+ * @param model
4628
+ * @returns
4564
4629
  */
4565
4630
  async saveQuietly(model) {
4566
4631
  const saveable = this.applyCreationAttributesToModel(model);
@@ -4578,21 +4643,21 @@ var Relation = class {
4578
4643
  return error instanceof Error && (error.name === "ModelNotFoundException" || error.message.includes("Record not found"));
4579
4644
  }
4580
4645
  /**
4581
- * Create new instances of the related model with the given attributes and
4646
+ * Create new instances of the related model with the given attributes and
4582
4647
  * relationship * creation attributes applied, and save them to the database.
4583
- *
4584
- * @param models
4585
- * @returns
4648
+ *
4649
+ * @param models
4650
+ * @returns
4586
4651
  */
4587
4652
  async saveMany(models = []) {
4588
4653
  return await Promise.all(models.map(async (model) => await this.save(model)));
4589
4654
  }
4590
4655
  /**
4591
- * Create new instances of the related model with the given attributes and relationship
4656
+ * Create new instances of the related model with the given attributes and relationship
4592
4657
  * creation attributes applied, and save them to the database.
4593
- *
4594
- * @param models
4595
- * @returns
4658
+ *
4659
+ * @param models
4660
+ * @returns
4596
4661
  */
4597
4662
  async saveManyQuietly(models = []) {
4598
4663
  return await Promise.all(models.map(async (model) => await this.saveQuietly(model)));
@@ -4616,10 +4681,10 @@ var Relation = class {
4616
4681
  }
4617
4682
  /**
4618
4683
  * Find the first related model by a specific key and value, or create a new instance if not found.
4619
- *
4620
- * @param attributes
4621
- * @param values
4622
- * @returns
4684
+ *
4685
+ * @param attributes
4686
+ * @param values
4687
+ * @returns
4623
4688
  */
4624
4689
  async firstOrNew(attributes, values = {}) {
4625
4690
  const found = await (await this.getQuery()).clone().where(attributes).first();
@@ -4630,12 +4695,12 @@ var Relation = class {
4630
4695
  });
4631
4696
  }
4632
4697
  /**
4633
- * Find the first related model by a specific key and value, or create and save a new instance
4698
+ * Find the first related model by a specific key and value, or create and save a new instance
4634
4699
  * if not found.
4635
- *
4636
- * @param attributes
4637
- * @param values
4638
- * @returns
4700
+ *
4701
+ * @param attributes
4702
+ * @param values
4703
+ * @returns
4639
4704
  */
4640
4705
  async firstOrCreate(attributes, values = {}) {
4641
4706
  const found = await (await this.getQuery()).clone().where(attributes).first();
@@ -4646,12 +4711,12 @@ var Relation = class {
4646
4711
  });
4647
4712
  }
4648
4713
  /**
4649
- * Find the first related model by a specific key and value, update the first matching record with
4714
+ * Find the first related model by a specific key and value, update the first matching record with
4650
4715
  * the given values, or create and save a new instance if no matching record is found.
4651
- *
4652
- * @param attributes
4653
- * @param values
4654
- * @returns
4716
+ *
4717
+ * @param attributes
4718
+ * @param values
4719
+ * @returns
4655
4720
  */
4656
4721
  async updateOrCreate(attributes, values = {}) {
4657
4722
  const query = await this.getQuery();
@@ -4665,35 +4730,35 @@ var Relation = class {
4665
4730
  return await query.clone().where(attributes).update(values);
4666
4731
  }
4667
4732
  /**
4668
- * Find related models by specific attributes, update matching records with the given values, or
4733
+ * Find related models by specific attributes, update matching records with the given values, or
4669
4734
  * create and save new instances if no matching records are found.
4670
- *
4671
- * @param values
4672
- * @param uniqueBy
4673
- * @param update
4674
- * @returns
4735
+ *
4736
+ * @param values
4737
+ * @param uniqueBy
4738
+ * @param update
4739
+ * @returns
4675
4740
  */
4676
4741
  async upsert(values, uniqueBy, update = null) {
4677
4742
  return await (await this.getQuery()).upsert(values.map((value) => this.mergeCreationAttributes(value)), uniqueBy, update);
4678
4743
  }
4679
4744
  /**
4680
4745
  * Paginate the relationship query results.
4681
- *
4682
- * @param perPage
4683
- * @param page
4684
- * @param options
4685
- * @returns
4746
+ *
4747
+ * @param perPage
4748
+ * @param page
4749
+ * @param options
4750
+ * @returns
4686
4751
  */
4687
4752
  async paginate(perPage = 15, page, options = {}) {
4688
4753
  return (await this.getQuery()).paginate(perPage, page, options);
4689
4754
  }
4690
4755
  /**
4691
4756
  * Paginate the relationship query results without total count optimization.
4692
- *
4693
- * @param perPage
4694
- * @param page
4695
- * @param options
4696
- * @returns
4757
+ *
4758
+ * @param perPage
4759
+ * @param page
4760
+ * @param options
4761
+ * @returns
4697
4762
  */
4698
4763
  async simplePaginate(perPage = 15, page, options = {}) {
4699
4764
  return (await this.getQuery()).simplePaginate(perPage, page, options);
@@ -4704,7 +4769,7 @@ var Relation = class {
4704
4769
  //#region src/relationship/BelongsToManyRelation.ts
4705
4770
  /**
4706
4771
  * Defines a many-to-many relationship.
4707
- *
4772
+ *
4708
4773
  * @author Legacy (3m1n3nc3)
4709
4774
  * @since 0.1.0
4710
4775
  */
@@ -4727,9 +4792,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4727
4792
  }
4728
4793
  /**
4729
4794
  * Specifies additional pivot columns to include on the related models.
4730
- *
4731
- * @param columns The pivot columns to include on the related models.
4732
- * @returns
4795
+ *
4796
+ * @param columns The pivot columns to include on the related models.
4797
+ * @returns
4733
4798
  */
4734
4799
  withPivot(...columns) {
4735
4800
  columns.flat().forEach((column) => {
@@ -4740,9 +4805,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4740
4805
  return this;
4741
4806
  }
4742
4807
  /**
4743
- * Specifies that the pivot table contains timestamp columns and optionally
4808
+ * Specifies that the pivot table contains timestamp columns and optionally
4744
4809
  * allows customizing the names of those columns.
4745
- *
4810
+ *
4746
4811
  * @param createdAtColumn The name of the "created at" timestamp column.
4747
4812
  * @param updatedAtColumn The name of the "updated at" timestamp column.
4748
4813
  * @returns The current instance of the relationship.
@@ -4753,10 +4818,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4753
4818
  return this.withPivot(createdAtColumn, updatedAtColumn);
4754
4819
  }
4755
4820
  /**
4756
- * Specifies a custom accessor name for the pivot attributes on the related models.
4757
- * By default, pivot attributes are accessible via the `pivot` property on the
4821
+ * Specifies a custom accessor name for the pivot attributes on the related models.
4822
+ * By default, pivot attributes are accessible via the `pivot` property on the
4758
4823
  * related models.
4759
- *
4824
+ *
4760
4825
  * @param accessor The custom accessor name for the pivot attributes.
4761
4826
  * @returns The current instance of the relationship.
4762
4827
  */
@@ -4768,10 +4833,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4768
4833
  return this;
4769
4834
  }
4770
4835
  /**
4771
- * Specifies a custom pivot model to use for the pivot records. The pivot model can
4772
- * be used to define custom behavior or methods on the pivot records, as well as to
4836
+ * Specifies a custom pivot model to use for the pivot records. The pivot model can
4837
+ * be used to define custom behavior or methods on the pivot records, as well as to
4773
4838
  * specify a custom hydration method for the pivot records.
4774
- *
4839
+ *
4775
4840
  * @param pivotModel The custom pivot model to use.
4776
4841
  * @returns The current instance of the relationship.
4777
4842
  */
@@ -4788,20 +4853,20 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4788
4853
  }
4789
4854
  /**
4790
4855
  * Adds a "pivot column in" condition to the relationship query.
4791
- *
4792
- * @param column
4793
- * @param values
4794
- * @returns
4856
+ *
4857
+ * @param column
4858
+ * @param values
4859
+ * @returns
4795
4860
  */
4796
4861
  wherePivotNotIn(column, values) {
4797
4862
  return this.addPivotWhere(this.makePivotComparison(column, "not-in", values));
4798
4863
  }
4799
4864
  /**
4800
4865
  * Adds a "pivot column between" condition to the relationship query.
4801
- *
4802
- * @param column
4803
- * @param range
4804
- * @returns
4866
+ *
4867
+ * @param column
4868
+ * @param range
4869
+ * @returns
4805
4870
  */
4806
4871
  wherePivotBetween(column, range) {
4807
4872
  return this.addPivotWhere({
@@ -4812,10 +4877,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4812
4877
  }
4813
4878
  /**
4814
4879
  * Adds a "pivot column not between" condition to the relationship query.
4815
- *
4816
- * @param column
4817
- * @param range
4818
- * @returns
4880
+ *
4881
+ * @param column
4882
+ * @param range
4883
+ * @returns
4819
4884
  */
4820
4885
  wherePivotNotBetween(column, range) {
4821
4886
  return this.addPivotWhere({
@@ -4829,18 +4894,18 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4829
4894
  }
4830
4895
  /**
4831
4896
  * Adds a "pivot column is null" condition to the relationship query.
4832
- *
4833
- * @param column
4834
- * @returns
4897
+ *
4898
+ * @param column
4899
+ * @returns
4835
4900
  */
4836
4901
  wherePivotNull(column) {
4837
4902
  return this.addPivotWhere(this.makePivotComparison(column, "is-null"));
4838
4903
  }
4839
4904
  /**
4840
4905
  * Adds a "pivot column is not null" condition to the relationship query.
4841
- *
4842
- * @param column
4843
- * @returns
4906
+ *
4907
+ * @param column
4908
+ * @returns
4844
4909
  */
4845
4910
  wherePivotNotNull(column) {
4846
4911
  return this.addPivotWhere(this.makePivotComparison(column, "is-not-null"));
@@ -5040,9 +5105,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5040
5105
  return rows.length;
5041
5106
  }
5042
5107
  /**
5043
- * Creates a new instance of the related model with the given attributes and attaches
5108
+ * Creates a new instance of the related model with the given attributes and attaches
5044
5109
  * pivot attributes if pivot attributes should be included.
5045
- *
5110
+ *
5046
5111
  * @param attributes The attributes to initialize the related model with.
5047
5112
  * @returns A new instance of the related model.
5048
5113
  */
@@ -5050,10 +5115,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5050
5115
  return this.related.hydrate(attributes);
5051
5116
  }
5052
5117
  /**
5053
- * Creates a new related model record with the given attributes, creates a pivot record
5054
- * with the given pivot attributes, and attaches pivot attributes if pivot attributes
5118
+ * Creates a new related model record with the given attributes, creates a pivot record
5119
+ * with the given pivot attributes, and attaches pivot attributes if pivot attributes
5055
5120
  * should be included.
5056
- *
5121
+ *
5057
5122
  * @param attributes The attributes to initialize the related model with.
5058
5123
  * @param pivotAttributes The attributes to initialize the pivot record with.
5059
5124
  * @returns A new instance of the related model with pivot attributes attached.
@@ -5065,10 +5130,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5065
5130
  return this.attachPivotToSingleResult(related, pivotRow);
5066
5131
  }
5067
5132
  /**
5068
- * Saves a related model record, creates a pivot record with the given pivot attributes
5069
- * if the related model was not previously persisted, and attaches pivot attributes if
5133
+ * Saves a related model record, creates a pivot record with the given pivot attributes
5134
+ * if the related model was not previously persisted, and attaches pivot attributes if
5070
5135
  * pivot attributes should be included.
5071
- *
5136
+ *
5072
5137
  * @param related The related model instance to save.
5073
5138
  * @param pivotAttributes The attributes to initialize the pivot record with.
5074
5139
  * @returns A new instance of the related model with pivot attributes attached.
@@ -5088,9 +5153,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5088
5153
  return this.attachPivotToSingleResult(persisted, pivotRow);
5089
5154
  }
5090
5155
  /**
5091
- * Attaches one or more related model records to the parent model by creating pivot
5156
+ * Attaches one or more related model records to the parent model by creating pivot
5092
5157
  * records with the given pivot attributes if pivot attributes should be included.
5093
- *
5158
+ *
5094
5159
  * @param related The related model instance(s) to attach.
5095
5160
  * @param pivotAttributes The attributes to initialize the pivot record with.
5096
5161
  * @returns The number of related model records attached.
@@ -5173,7 +5238,7 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5173
5238
  }
5174
5239
  /**
5175
5240
  * Creates a pivot record from a row of data.
5176
- *
5241
+ *
5177
5242
  * @param row The row of data containing pivot attributes.
5178
5243
  * @returns The pivot record.
5179
5244
  */
@@ -5188,10 +5253,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5188
5253
  }
5189
5254
  /**
5190
5255
  * Attaches pivot attributes to the related models if pivot attributes should be included.
5191
- *
5192
- * @param results
5193
- * @param pivotRows
5194
- * @returns
5256
+ *
5257
+ * @param results
5258
+ * @param pivotRows
5259
+ * @returns
5195
5260
  */
5196
5261
  attachPivotToResults(results, pivotRows) {
5197
5262
  if (!this.shouldAttachPivotAttributes()) return results;
@@ -5283,8 +5348,8 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5283
5348
  }
5284
5349
  /**
5285
5350
  * Fetches the related models for this relationship.
5286
- *
5287
- * @returns
5351
+ *
5352
+ * @returns
5288
5353
  */
5289
5354
  async getResults() {
5290
5355
  return (await this.getQuery()).get();
@@ -5295,7 +5360,7 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5295
5360
  //#region src/relationship/SingleResultRelation.ts
5296
5361
  /**
5297
5362
  * Base class for relationships that resolve to a single related model.
5298
- *
5363
+ *
5299
5364
  * @author Legacy (3m1n3nc3)
5300
5365
  * @since 1.3.0
5301
5366
  */
@@ -5307,7 +5372,7 @@ var SingleResultRelation = class extends Relation {
5307
5372
  }
5308
5373
  /**
5309
5374
  * Defines a default value to return when the relationship does not find a related model.
5310
- *
5375
+ *
5311
5376
  * @param value The default value or a callback that returns the default value.
5312
5377
  * @returns The current instance for method chaining.
5313
5378
  */
@@ -5327,7 +5392,7 @@ var SingleResultRelation = class extends Relation {
5327
5392
  //#region src/relationship/BelongsToRelation.ts
5328
5393
  /**
5329
5394
  * Defines an inverse one-to-one or many relationship.
5330
- *
5395
+ *
5331
5396
  * @author Legacy (3m1n3nc3)
5332
5397
  * @since 0.1.0
5333
5398
  */
@@ -5356,8 +5421,8 @@ var BelongsToRelation = class extends SingleResultRelation {
5356
5421
  }
5357
5422
  /**
5358
5423
  * Fetches the related models for this relationship.
5359
- *
5360
- * @returns
5424
+ *
5425
+ * @returns
5361
5426
  */
5362
5427
  async getResults() {
5363
5428
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5368,7 +5433,7 @@ var BelongsToRelation = class extends SingleResultRelation {
5368
5433
  //#region src/relationship/HasManyRelation.ts
5369
5434
  /**
5370
5435
  * Defines a one-to-many relationship.
5371
- *
5436
+ *
5372
5437
  * @author Legacy (3m1n3nc3)
5373
5438
  * @since 0.1.0
5374
5439
  */
@@ -5402,8 +5467,8 @@ var HasManyRelation = class extends Relation {
5402
5467
  }
5403
5468
  /**
5404
5469
  * Fetches the related models for this relationship.
5405
- *
5406
- * @returns
5470
+ *
5471
+ * @returns
5407
5472
  */
5408
5473
  async getResults() {
5409
5474
  return (await this.getQuery()).get();
@@ -5413,9 +5478,9 @@ var HasManyRelation = class extends Relation {
5413
5478
  //#endregion
5414
5479
  //#region src/relationship/HasManyThroughRelation.ts
5415
5480
  /**
5416
- * Defines a has-many-through relationship, which provides a convenient way to access
5417
- * distant relations via an intermediate relation.
5418
- *
5481
+ * Defines a has-many-through relationship, which provides a convenient way to access
5482
+ * distant relations via an intermediate relation.
5483
+ *
5419
5484
  * @author Legacy (3m1n3nc3)
5420
5485
  * @since 0.1.0
5421
5486
  */
@@ -5464,8 +5529,8 @@ var HasManyThroughRelation = class extends Relation {
5464
5529
  }
5465
5530
  /**
5466
5531
  * Fetches the related models for this relationship.
5467
- *
5468
- * @returns
5532
+ *
5533
+ * @returns
5469
5534
  */
5470
5535
  async getResults() {
5471
5536
  return (await this.getQuery()).get();
@@ -5476,7 +5541,7 @@ var HasManyThroughRelation = class extends Relation {
5476
5541
  //#region src/relationship/HasOneRelation.ts
5477
5542
  /**
5478
5543
  * Represents a "has one" relationship between two models.
5479
- *
5544
+ *
5480
5545
  * @author Legacy (3m1n3nc3)
5481
5546
  * @since 0.1.0
5482
5547
  */
@@ -5508,8 +5573,8 @@ var HasOneRelation = class extends SingleResultRelation {
5508
5573
  }
5509
5574
  /**
5510
5575
  * Fetches the related models for this relationship.
5511
- *
5512
- * @returns
5576
+ *
5577
+ * @returns
5513
5578
  */
5514
5579
  async getResults() {
5515
5580
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5519,9 +5584,9 @@ var HasOneRelation = class extends SingleResultRelation {
5519
5584
  //#endregion
5520
5585
  //#region src/relationship/HasOneThroughRelation.ts
5521
5586
  /**
5522
- * Represents a "has one through" relationship, where the parent model is related
5587
+ * Represents a "has one through" relationship, where the parent model is related
5523
5588
  * to exactly one instance of the related model through an intermediate model.
5524
- *
5589
+ *
5525
5590
  * @author Legacy (3m1n3nc3)
5526
5591
  * @since 0.1.0
5527
5592
  */
@@ -5569,8 +5634,8 @@ var HasOneThroughRelation = class extends SingleResultRelation {
5569
5634
  }
5570
5635
  /**
5571
5636
  * Fetches the related models for this relationship.
5572
- *
5573
- * @returns
5637
+ *
5638
+ * @returns
5574
5639
  */
5575
5640
  async getResults() {
5576
5641
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5580,8 +5645,8 @@ var HasOneThroughRelation = class extends SingleResultRelation {
5580
5645
  //#endregion
5581
5646
  //#region src/relationship/MorphManyRelation.ts
5582
5647
  /**
5583
- * Defines a polymorphic one-to-many relationship.
5584
- *
5648
+ * Defines a polymorphic one-to-many relationship.
5649
+ *
5585
5650
  * @author Legacy (3m1n3nc3)
5586
5651
  * @since 0.1.0
5587
5652
  */
@@ -5626,8 +5691,8 @@ var MorphManyRelation = class extends Relation {
5626
5691
  }
5627
5692
  /**
5628
5693
  * Fetches the related models for this relationship.
5629
- *
5630
- * @returns
5694
+ *
5695
+ * @returns
5631
5696
  */
5632
5697
  async getResults() {
5633
5698
  return (await this.getQuery()).get();
@@ -5638,7 +5703,7 @@ var MorphManyRelation = class extends Relation {
5638
5703
  //#region src/relationship/MorphOneRelation.ts
5639
5704
  /**
5640
5705
  * Defines a polymorphic one-to-one relationship.
5641
- *
5706
+ *
5642
5707
  * @author Legacy (3m1n3nc3)
5643
5708
  * @since 0.1.0
5644
5709
  */
@@ -5681,8 +5746,8 @@ var MorphOneRelation = class extends SingleResultRelation {
5681
5746
  }
5682
5747
  /**
5683
5748
  * Fetches the related models for this relationship.
5684
- *
5685
- * @returns
5749
+ *
5750
+ * @returns
5686
5751
  */
5687
5752
  async getResults() {
5688
5753
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5692,8 +5757,8 @@ var MorphOneRelation = class extends SingleResultRelation {
5692
5757
  //#endregion
5693
5758
  //#region src/relationship/MorphToManyRelation.ts
5694
5759
  /**
5695
- * Defines a polymorphic many-to-many relationship.
5696
- *
5760
+ * Defines a polymorphic many-to-many relationship.
5761
+ *
5697
5762
  * @author Legacy (3m1n3nc3)
5698
5763
  * @since 0.1.0
5699
5764
  */
@@ -5756,8 +5821,8 @@ var MorphToManyRelation = class extends Relation {
5756
5821
  }
5757
5822
  /**
5758
5823
  * Fetches the related models for this relationship.
5759
- *
5760
- * @returns
5824
+ *
5825
+ * @returns
5761
5826
  */
5762
5827
  async getResults() {
5763
5828
  return (await this.getQuery()).get();