arkormx 2.9.2 → 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.
@@ -93,9 +93,9 @@ var RelationResolutionException = class extends ArkormException {
93
93
  //#endregion
94
94
  //#region src/relationship/RelationTableLoader.ts
95
95
  /**
96
- * Utility class responsible for loading data from relation tables, which are used to
97
- * manage relationships between models in Arkorm.
98
- *
96
+ * Utility class responsible for loading data from relation tables, which are used to
97
+ * manage relationships between models in Arkorm.
98
+ *
99
99
  * @author Legacy (3m1n3nc3)
100
100
  * @since 2.0.0-next.0
101
101
  */
@@ -141,9 +141,9 @@ var RelationTableLoader = class {
141
141
  //#endregion
142
142
  //#region src/relationship/SetBasedEagerLoader.ts
143
143
  /**
144
- * Utility class responsible for performing set-based eager loading of relationships for
144
+ * Utility class responsible for performing set-based eager loading of relationships for
145
145
  * a collection of models.
146
- *
146
+ *
147
147
  * @author Legacy (3m1n3nc3)
148
148
  * @since 2.0.0-next.2
149
149
  */
@@ -153,9 +153,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
153
153
  this.relations = relations;
154
154
  }
155
155
  /**
156
- * Performs eager loading of all specified relationships for the set of models.
157
- *
158
- * @returns
156
+ * Performs eager loading of all specified relationships for the set of models.
157
+ *
158
+ * @returns
159
159
  */
160
160
  async load() {
161
161
  if (this.models.length === 0) return;
@@ -172,9 +172,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
172
172
  await new SetBasedEagerLoader(relatedModels, this.relationTreeToMap(node.children)).load();
173
173
  }
174
174
  /**
175
- * Loads a specific relationship for the set of models based on the relationship name
175
+ * Loads a specific relationship for the set of models based on the relationship name
176
176
  * and an optional constraint.
177
- *
177
+ *
178
178
  * @param name The name of the relationship to load.
179
179
  * @param constraint An optional constraint to apply to the query.
180
180
  * @returns A promise that resolves when the relationship is loaded.
@@ -215,9 +215,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
215
215
  }
216
216
  }
217
217
  /**
218
- * Resolves the relation resolver function for a given relationship name by inspecting
218
+ * Resolves the relation resolver function for a given relationship name by inspecting
219
219
  * the first model in the set.
220
- *
220
+ *
221
221
  * @param name The name of the relationship to resolve.
222
222
  * @returns The relation resolver function or null if not found.
223
223
  */
@@ -277,7 +277,7 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
277
277
  }
278
278
  /**
279
279
  * Loads a "belongs to" relationship for the set of models.
280
- *
280
+ *
281
281
  * @param name The name of the relationship to load.
282
282
  * @param resolver The relation resolver function.
283
283
  * @param metadata The metadata for the relationship.
@@ -309,12 +309,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
309
309
  });
310
310
  }
311
311
  /**
312
- * Loads a "has many" relationship for the set of models.
313
- *
314
- * @param name
315
- * @param metadata
316
- * @param constraint
317
- * @returns
312
+ * Loads a "has many" relationship for the set of models.
313
+ *
314
+ * @param name
315
+ * @param metadata
316
+ * @param constraint
317
+ * @returns
318
318
  */
319
319
  async loadHasMany(name, metadata, constraint) {
320
320
  const keys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -343,12 +343,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
343
343
  });
344
344
  }
345
345
  /**
346
- * Loads a "belongs to many" relationship for the set of models.
347
- *
348
- * @param name
349
- * @param metadata
350
- * @param constraint
351
- * @returns
346
+ * Loads a "belongs to many" relationship for the set of models.
347
+ *
348
+ * @param name
349
+ * @param metadata
350
+ * @param constraint
351
+ * @returns
352
352
  */
353
353
  async loadBelongsToMany(name, metadata, constraint) {
354
354
  const parentKeys = this.collectUniqueKeys((model) => model.getAttribute(metadata.parentKey));
@@ -443,12 +443,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
443
443
  }
444
444
  /**
445
445
  * Loads a "belongs to many" relationship for the set of models.
446
- *
447
- * @param name
448
- * @param resolver
449
- * @param metadata
450
- * @param constraint
451
- * @returns
446
+ *
447
+ * @param name
448
+ * @param resolver
449
+ * @param metadata
450
+ * @param constraint
451
+ * @returns
452
452
  */
453
453
  async loadHasOne(name, resolver, metadata, constraint) {
454
454
  const keys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -476,11 +476,11 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
476
476
  }
477
477
  /**
478
478
  * Loads a "has many through" relationship for the set of models.
479
- *
480
- * @param name
481
- * @param metadata
482
- * @param constraint
483
- * @returns
479
+ *
480
+ * @param name
481
+ * @param metadata
482
+ * @param constraint
483
+ * @returns
484
484
  */
485
485
  async loadHasManyThrough(name, metadata, constraint) {
486
486
  const parentKeys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -534,12 +534,12 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
534
534
  }
535
535
  /**
536
536
  * Loads a "has one through" relationship for the set of models.
537
- *
538
- * @param name
539
- * @param resolver
540
- * @param metadata
541
- * @param constraint
542
- * @returns
537
+ *
538
+ * @param name
539
+ * @param resolver
540
+ * @param metadata
541
+ * @param constraint
542
+ * @returns
543
543
  */
544
544
  async loadHasOneThrough(name, resolver, metadata, constraint) {
545
545
  const parentKeys = this.collectUniqueKeys((model) => model.getAttribute(metadata.localKey));
@@ -733,19 +733,19 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
733
733
  }
734
734
  /**
735
735
  * Applies an eager load constraint to a query if provided.
736
- *
737
- * @param query
738
- * @param constraint
739
- * @returns
736
+ *
737
+ * @param query
738
+ * @param constraint
739
+ * @returns
740
740
  */
741
741
  applyConstraint(query, constraint) {
742
742
  if (!constraint) return query;
743
743
  return constraint(query) ?? query;
744
744
  }
745
745
  /**
746
- * Collects unique values from the set of models based on a resolver function, which
746
+ * Collects unique values from the set of models based on a resolver function, which
747
747
  * is used to extract the value from each model.
748
- *
748
+ *
749
749
  * @param resolve A function that takes a model and returns the value to be collected.
750
750
  * @returns An array of unique values.
751
751
  */
@@ -763,9 +763,9 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
763
763
  return values;
764
764
  }
765
765
  /**
766
- * Collects unique values from an array of database rows based on a specified key, which
766
+ * Collects unique values from an array of database rows based on a specified key, which
767
767
  * is used to extract the value from each row.
768
- *
768
+ *
769
769
  * @param rows An array of database rows.
770
770
  * @param key The key to extract values from each row.
771
771
  * @returns An array of unique values.
@@ -785,16 +785,16 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
785
785
  }
786
786
  /**
787
787
  * Loads a "belongs to many" relationship for the set of models.
788
- *
789
- * @returns
788
+ *
789
+ * @returns
790
790
  */
791
791
  createRelationTableLoader() {
792
792
  return new RelationTableLoader(this.resolveAdapter());
793
793
  }
794
794
  /**
795
795
  * Loads a "belongs to many" relationship for the set of models.
796
- *
797
- * @returns
796
+ *
797
+ * @returns
798
798
  */
799
799
  resolveAdapter() {
800
800
  const adapter = this.models[0].constructor.getAdapter?.();
@@ -802,30 +802,30 @@ var SetBasedEagerLoader = class SetBasedEagerLoader {
802
802
  return adapter;
803
803
  }
804
804
  /**
805
- * Reads an attribute value from a model using the getAttribute method, which is used
805
+ * Reads an attribute value from a model using the getAttribute method, which is used
806
806
  * to access model attributes in a way that is compatible with Arkorm's internal model structure.
807
- *
807
+ *
808
808
  * @param model The model to read the attribute from.
809
809
  * @param key The name of the attribute to read.
810
- * @returns
810
+ * @returns
811
811
  */
812
812
  readModelAttribute(model, key) {
813
813
  return model.getAttribute?.(key);
814
814
  }
815
815
  /**
816
- * Resolves the default result for a relationship when no related models are found.
817
- *
818
- * @param resolver
819
- * @param model
820
- * @returns
816
+ * Resolves the default result for a relationship when no related models are found.
817
+ *
818
+ * @param resolver
819
+ * @param model
820
+ * @returns
821
821
  */
822
822
  resolveSingleDefault(resolver, model) {
823
823
  return resolver.call(model).resolveDefaultResult?.() ?? null;
824
824
  }
825
825
  /**
826
- * Generates a unique lookup key for a given value, which is used to store and retrieve
826
+ * Generates a unique lookup key for a given value, which is used to store and retrieve
827
827
  * values in maps during the eager loading process.
828
- *
828
+ *
829
829
  * @param value The value to generate a lookup key for.
830
830
  * @returns A unique string representing the value.
831
831
  */
@@ -871,10 +871,10 @@ var RuntimeModuleLoader = class {
871
871
  *
872
872
  * Each returned entry carries either the loaded module or the last error,
873
873
  * so callers can surface genuine failures instead of silently dropping them.
874
- *
875
- * @param filePaths
876
- * @param useDefault
877
- * @returns
874
+ *
875
+ * @param filePaths
876
+ * @param useDefault
877
+ * @returns
878
878
  */
879
879
  static async loadAll(filePaths, useDefault = false) {
880
880
  const jiti$1 = (0, jiti.createJiti)(`${(0, node_url.pathToFileURL)((0, node_path.resolve)(".")).href}/`, {
@@ -1040,9 +1040,9 @@ const getLatestAppliedMigrations = (state, steps) => {
1040
1040
  //#endregion
1041
1041
  //#region src/database/ForeignKeyBuilder.ts
1042
1042
  /**
1043
- * The ForeignKeyBuilder class provides a fluent interface for defining
1044
- * foreign key constraints in a migration. It allows you to specify
1045
- * the referenced table and column, as well as actions to take on
1043
+ * The ForeignKeyBuilder class provides a fluent interface for defining
1044
+ * foreign key constraints in a migration. It allows you to specify
1045
+ * the referenced table and column, as well as actions to take on
1046
1046
  * delete and aliases for the relation.
1047
1047
  *
1048
1048
  * @author Legacy (3m1n3nc3)
@@ -1054,10 +1054,10 @@ var ForeignKeyBuilder = class {
1054
1054
  }
1055
1055
  /**
1056
1056
  * Defines the referenced table and column for this foreign key constraint.
1057
- *
1058
- * @param table
1059
- * @param column
1060
- * @returns
1057
+ *
1058
+ * @param table
1059
+ * @param column
1060
+ * @returns
1061
1061
  */
1062
1062
  references(table, column) {
1063
1063
  this.foreignKey.referencesTable = table;
@@ -1065,22 +1065,22 @@ var ForeignKeyBuilder = class {
1065
1065
  return this;
1066
1066
  }
1067
1067
  /**
1068
- * Defines the action to take when a referenced record is deleted, such
1068
+ * Defines the action to take when a referenced record is deleted, such
1069
1069
  * as "CASCADE", "SET NULL", or "RESTRICT".
1070
- *
1071
- * @param action
1072
- * @returns
1070
+ *
1071
+ * @param action
1072
+ * @returns
1073
1073
  */
1074
1074
  onDelete(action) {
1075
1075
  this.foreignKey.onDelete = action;
1076
1076
  return this;
1077
1077
  }
1078
1078
  /**
1079
- * Defines an alias for the relation represented by this foreign key, which
1079
+ * Defines an alias for the relation represented by this foreign key, which
1080
1080
  * can be used in the ORM for more intuitive access to related models.
1081
- *
1082
- * @param name
1083
- * @returns
1081
+ *
1082
+ * @param name
1083
+ * @returns
1084
1084
  */
1085
1085
  alias(name) {
1086
1086
  this.foreignKey.relationAlias = name;
@@ -1088,20 +1088,20 @@ var ForeignKeyBuilder = class {
1088
1088
  }
1089
1089
  /**
1090
1090
  * Defines an alias for the inverse relation represented by this foreign key.
1091
- *
1092
- * @param name
1093
- * @returns
1091
+ *
1092
+ * @param name
1093
+ * @returns
1094
1094
  */
1095
1095
  inverseAlias(name) {
1096
1096
  this.foreignKey.inverseRelationAlias = name;
1097
1097
  return this;
1098
1098
  }
1099
1099
  /**
1100
- * Defines an alias for the foreign key field itself, which can be
1100
+ * Defines an alias for the foreign key field itself, which can be
1101
1101
  * used in the ORM for more intuitive access to the foreign key value.
1102
- *
1103
- * @param fieldName
1104
- * @returns
1102
+ *
1103
+ * @param fieldName
1104
+ * @returns
1105
1105
  */
1106
1106
  as(fieldName) {
1107
1107
  this.foreignKey.fieldAlias = fieldName;
@@ -1220,7 +1220,7 @@ var EnumBuilder = class {
1220
1220
  }
1221
1221
  };
1222
1222
  /**
1223
- * The TableBuilder class provides a fluent interface for defining
1223
+ * The TableBuilder class provides a fluent interface for defining
1224
1224
  * the structure of a database table in a migration, including columns to add or drop.
1225
1225
  *
1226
1226
  * @author Legacy (3m1n3nc3)
@@ -1257,7 +1257,7 @@ var TableBuilder = class {
1257
1257
  }
1258
1258
  /**
1259
1259
  * Defines an auto-incrementing primary key column.
1260
- *
1260
+ *
1261
1261
  * @param name The name of the primary key column.
1262
1262
  * @default 'id'
1263
1263
  * @returns The current TableBuilder instance for chaining.
@@ -1267,7 +1267,7 @@ var TableBuilder = class {
1267
1267
  }
1268
1268
  /**
1269
1269
  * Defines a UUID column in the table.
1270
- *
1270
+ *
1271
1271
  * @param name The name of the UUID column.
1272
1272
  * @param options Additional options for the UUID column.
1273
1273
  * @returns The current TableBuilder instance for chaining.
@@ -1298,7 +1298,7 @@ var TableBuilder = class {
1298
1298
  }
1299
1299
  /**
1300
1300
  * Defines a string column in the table.
1301
- *
1301
+ *
1302
1302
  * @param name The name of the string column.
1303
1303
  * @param options Additional options for the string column.
1304
1304
  * @returns The current TableBuilder instance for chaining.
@@ -1308,7 +1308,7 @@ var TableBuilder = class {
1308
1308
  }
1309
1309
  /**
1310
1310
  * Defines a text column in the table.
1311
- *
1311
+ *
1312
1312
  * @param name The name of the text column.
1313
1313
  * @param options Additional options for the text column.
1314
1314
  * @returns The current TableBuilder instance for chaining.
@@ -1318,7 +1318,7 @@ var TableBuilder = class {
1318
1318
  }
1319
1319
  /**
1320
1320
  * Defines an integer column in the table.
1321
- *
1321
+ *
1322
1322
  * @param name The name of the integer column.
1323
1323
  * @param options Additional options for the integer column.
1324
1324
  * @returns The current TableBuilder instance for chaining.
@@ -1328,7 +1328,7 @@ var TableBuilder = class {
1328
1328
  }
1329
1329
  /**
1330
1330
  * Defines a big integer column in the table.
1331
- *
1331
+ *
1332
1332
  * @param name The name of the big integer column.
1333
1333
  * @param options Additional options for the big integer column.
1334
1334
  * @returns The current TableBuilder instance for chaining.
@@ -1338,7 +1338,7 @@ var TableBuilder = class {
1338
1338
  }
1339
1339
  /**
1340
1340
  * Defines a float column in the table.
1341
- *
1341
+ *
1342
1342
  * @param name The name of the float column.
1343
1343
  * @param options Additional options for the float column.
1344
1344
  * @returns The current TableBuilder instance for chaining.
@@ -1364,8 +1364,8 @@ var TableBuilder = class {
1364
1364
  }
1365
1365
  /**
1366
1366
  * Defines a boolean column in the table.
1367
- *
1368
- * @param name The name of the boolean column.
1367
+ *
1368
+ * @param name The name of the boolean column.
1369
1369
  * @param options Additional options for the boolean column.
1370
1370
  * @returns The current TableBuilder instance for chaining.
1371
1371
  */
@@ -1374,29 +1374,29 @@ var TableBuilder = class {
1374
1374
  }
1375
1375
  /**
1376
1376
  * Defines a JSON column in the table.
1377
- *
1377
+ *
1378
1378
  * @param name The name of the JSON column.
1379
1379
  * @param options Additional options for the JSON column.
1380
- * @returns
1380
+ * @returns
1381
1381
  */
1382
1382
  json(name, options = {}) {
1383
1383
  return this.column(name, "json", options);
1384
1384
  }
1385
1385
  /**
1386
1386
  * Defines a date column in the table.
1387
- *
1387
+ *
1388
1388
  * @param name The name of the date column.
1389
1389
  * @param options Additional options for the date column.
1390
- * @returns
1390
+ * @returns
1391
1391
  */
1392
1392
  date(name, options = {}) {
1393
1393
  return this.column(name, "date", options);
1394
1394
  }
1395
1395
  /**
1396
1396
  * Defines colonns for a polymorphic relationship in the table.
1397
- *
1397
+ *
1398
1398
  * @param name The base name for the polymorphic relationship columns.
1399
- * @returns
1399
+ * @returns
1400
1400
  */
1401
1401
  morphs(name, nullable = false) {
1402
1402
  this.string(`${name}Type`, { nullable });
@@ -1405,9 +1405,9 @@ var TableBuilder = class {
1405
1405
  }
1406
1406
  /**
1407
1407
  * Defines columns for a polymorphic relationship in the table with UUID ID.
1408
- *
1408
+ *
1409
1409
  * @param name The base name for the polymorphic relationship columns.
1410
- * @returns
1410
+ * @returns
1411
1411
  */
1412
1412
  uuidMorphs(name, nullable = false) {
1413
1413
  this.string(`${name}Type`, { nullable });
@@ -1416,28 +1416,28 @@ var TableBuilder = class {
1416
1416
  }
1417
1417
  /**
1418
1418
  * Defines nullable columns for a polymorphic relationship in the table.
1419
- *
1419
+ *
1420
1420
  * @param name The base name for the polymorphic relationship columns.
1421
- * @returns
1421
+ * @returns
1422
1422
  */
1423
1423
  nullableMorphs(name) {
1424
1424
  return this.morphs(name, true);
1425
1425
  }
1426
1426
  /**
1427
1427
  * Defines nullable columns for a polymorphic relationship in the table with UUID ID.
1428
- *
1428
+ *
1429
1429
  * @param name The base name for the polymorphic relationship columns.
1430
- * @returns
1430
+ * @returns
1431
1431
  */
1432
1432
  nullableUuidMorphs(name) {
1433
1433
  return this.uuidMorphs(name, true);
1434
1434
  }
1435
1435
  /**
1436
1436
  * Defines a timestamp column in the table.
1437
- *
1437
+ *
1438
1438
  * @param name The name of the timestamp column.
1439
1439
  * @param options Additional options for the timestamp column.
1440
- * @returns
1440
+ * @returns
1441
1441
  */
1442
1442
  timestamp(name, options = {}) {
1443
1443
  return this.column(name, "timestamp", options);
@@ -1498,9 +1498,9 @@ var TableBuilder = class {
1498
1498
  }
1499
1499
  /**
1500
1500
  * Defines a soft delete timestamp column in the table.
1501
- *
1501
+ *
1502
1502
  * @param column The name of the soft delete column.
1503
- * @returns
1503
+ * @returns
1504
1504
  */
1505
1505
  softDeletes(column = "deletedAt") {
1506
1506
  this.timestamp(column, { nullable: true });
@@ -1508,9 +1508,9 @@ var TableBuilder = class {
1508
1508
  }
1509
1509
  /**
1510
1510
  * Defines a column to be dropped from the table in an alterTable operation.
1511
- *
1511
+ *
1512
1512
  * @param name The name of the column to drop.
1513
- * @returns
1513
+ * @returns
1514
1514
  */
1515
1515
  dropColumn(name) {
1516
1516
  this.dropColumnNames.push(name);
@@ -1518,7 +1518,7 @@ var TableBuilder = class {
1518
1518
  }
1519
1519
  /**
1520
1520
  * Marks a column as nullable.
1521
- *
1521
+ *
1522
1522
  * @param columnName Optional explicit column name. When omitted, applies to the latest defined column.
1523
1523
  * @returns The current TableBuilder instance for chaining.
1524
1524
  */
@@ -1556,7 +1556,7 @@ var TableBuilder = class {
1556
1556
  }
1557
1557
  /**
1558
1558
  * Sets the column position to appear after another column when possible.
1559
- *
1559
+ *
1560
1560
  * @param referenceColumn The column that the target column should be placed after.
1561
1561
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
1562
1562
  * @returns The current TableBuilder instance for chaining.
@@ -1568,7 +1568,7 @@ var TableBuilder = class {
1568
1568
  }
1569
1569
  /**
1570
1570
  * Maps the column to a custom database column name.
1571
- *
1571
+ *
1572
1572
  * @param name The custom database column name.
1573
1573
  * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
1574
1574
  * @returns The current TableBuilder instance for chaining.
@@ -1580,7 +1580,7 @@ var TableBuilder = class {
1580
1580
  }
1581
1581
  /**
1582
1582
  * Defines an index on one or more columns.
1583
- *
1583
+ *
1584
1584
  * @param columns Optional target columns. When omitted, applies to the latest defined column.
1585
1585
  * @param name Optional index name.
1586
1586
  * @returns The current TableBuilder instance for chaining.
@@ -1609,11 +1609,11 @@ var TableBuilder = class {
1609
1609
  return new ForeignKeyBuilder(entry);
1610
1610
  }
1611
1611
  /**
1612
- * Defines a foreign key relation for a column, using a
1612
+ * Defines a foreign key relation for a column, using a
1613
1613
  * conventional naming pattern.
1614
- *
1615
- * @param column
1616
- * @returns
1614
+ *
1615
+ * @param column
1616
+ * @returns
1617
1617
  */
1618
1618
  foreign(column) {
1619
1619
  const columnName = this.resolveColumn(column).name;
@@ -1621,8 +1621,8 @@ var TableBuilder = class {
1621
1621
  }
1622
1622
  /**
1623
1623
  * Returns a deep copy of the defined columns for the table.
1624
- *
1625
- * @returns
1624
+ *
1625
+ * @returns
1626
1626
  */
1627
1627
  getColumns() {
1628
1628
  return this.columns.map((column) => ({
@@ -1632,15 +1632,15 @@ var TableBuilder = class {
1632
1632
  }
1633
1633
  /**
1634
1634
  * Returns a copy of the defined column names to be dropped from the table.
1635
- *
1636
- * @returns
1635
+ *
1636
+ * @returns
1637
1637
  */
1638
1638
  getDropColumns() {
1639
1639
  return [...this.dropColumnNames];
1640
1640
  }
1641
1641
  /**
1642
1642
  * Returns a deep copy of the defined indexes for the table.
1643
- *
1643
+ *
1644
1644
  * @returns
1645
1645
  */
1646
1646
  getIndexes() {
@@ -1677,11 +1677,11 @@ var TableBuilder = class {
1677
1677
  }
1678
1678
  /**
1679
1679
  * Defines a column in the table with the given name.
1680
- *
1680
+ *
1681
1681
  * @param name The name of the column.
1682
1682
  * @param type The type of the column.
1683
1683
  * @param options Additional options for the column.
1684
- * @returns
1684
+ * @returns
1685
1685
  */
1686
1686
  column(name, type, options) {
1687
1687
  this.columns.push({
@@ -1706,9 +1706,9 @@ var TableBuilder = class {
1706
1706
  }
1707
1707
  /**
1708
1708
  * Resolve a target column by name or fallback to the latest defined column.
1709
- *
1710
- * @param columnName
1711
- * @returns
1709
+ *
1710
+ * @param columnName
1711
+ * @returns
1712
1712
  */
1713
1713
  resolveColumn(columnName) {
1714
1714
  const targetName = columnName ?? this.latestColumnName;
@@ -1729,19 +1729,84 @@ var TableBuilder = class {
1729
1729
  //#endregion
1730
1730
  //#region src/database/SchemaBuilder.ts
1731
1731
  /**
1732
- * The SchemaBuilder class provides methods for defining the operations to be
1733
- * performed in a migration, such as creating, altering, or dropping tables.
1732
+ * The SchemaBuilder class provides methods for defining the operations to be
1733
+ * performed in a migration, such as creating, altering, or dropping tables.
1734
1734
  *
1735
1735
  * @author Legacy (3m1n3nc3)
1736
1736
  * @since 0.1.0
1737
1737
  */
1738
- var SchemaBuilder = class {
1738
+ var SchemaBuilder = class SchemaBuilder {
1739
1739
  constructor() {
1740
1740
  this.operations = [];
1741
1741
  }
1742
1742
  /**
1743
+ * Disable foreign-key constraint enforcement on the active PostgreSQL
1744
+ * connection by switching the session into replication mode, which
1745
+ * suppresses the internal triggers that enforce foreign keys.
1746
+ *
1747
+ * The setting is connection-scoped, so the disable, the work that depends
1748
+ * on it, and the matching {@link SchemaBuilder.enableForeignKeyConstraints}
1749
+ * must run on the same connection. Prefer
1750
+ * {@link SchemaBuilder.withoutForeignKeyConstraints}, which guarantees this
1751
+ * by wrapping the work in a transaction. Requires a SQL-backed adapter and
1752
+ * a database role permitted to set `session_replication_role`.
1753
+ *
1754
+ * @returns
1755
+ */
1756
+ static async disableForeignKeyConstraints() {
1757
+ await SchemaBuilder.setSessionReplicationRole("replica");
1758
+ }
1759
+ /**
1760
+ * Re-enable foreign-key constraint enforcement on the active PostgreSQL
1761
+ * connection by restoring the default session replication role.
1762
+ *
1763
+ * @returns
1764
+ */
1765
+ static async enableForeignKeyConstraints() {
1766
+ await SchemaBuilder.setSessionReplicationRole("origin");
1767
+ }
1768
+ /**
1769
+ * Run the given callback with foreign-key constraints disabled, then
1770
+ * restore them. The whole unit runs inside a transaction so the disable,
1771
+ * the callback, and the re-enable share a single connection (required for
1772
+ * the connection-scoped replication role to take effect) and roll back
1773
+ * together on failure.
1774
+ *
1775
+ * @example
1776
+ * await SchemaBuilder.withoutForeignKeyConstraints(async () => {
1777
+ * await User.factory()
1778
+ * .hasAttached(Tenant.factory().has(Project.factory(3)), { status: 'active' }, 'tenantMemberships')
1779
+ * .create()
1780
+ * })
1781
+ *
1782
+ * @param callback
1783
+ * @returns
1784
+ */
1785
+ static async withoutForeignKeyConstraints(callback) {
1786
+ return await runArkormTransaction(async () => {
1787
+ await SchemaBuilder.disableForeignKeyConstraints();
1788
+ try {
1789
+ return await callback();
1790
+ } finally {
1791
+ await SchemaBuilder.enableForeignKeyConstraints();
1792
+ }
1793
+ });
1794
+ }
1795
+ static async setSessionReplicationRole(role) {
1796
+ const adapter = getRuntimeAdapter();
1797
+ if (!adapter) throw new ArkormException("Toggling foreign-key constraints requires a configured database adapter.", {
1798
+ code: "ADAPTER_NOT_CONFIGURED",
1799
+ operation: "schema.foreignKeyConstraints"
1800
+ });
1801
+ if (!adapter.rawQuery) throw new UnsupportedAdapterFeatureException("Toggling foreign-key constraints requires an adapter that supports raw queries.", {
1802
+ operation: "schema.foreignKeyConstraints",
1803
+ meta: { feature: "rawQuery" }
1804
+ });
1805
+ await adapter.rawQuery({ sql: `SET session_replication_role = '${role}'` });
1806
+ }
1807
+ /**
1743
1808
  * Defines a new table to be created in the migration.
1744
- *
1809
+ *
1745
1810
  * @param table The name of the table to create.
1746
1811
  * @param callback A callback function to define the table's columns and structure.
1747
1812
  * @returns The current SchemaBuilder instance for chaining.
@@ -1765,7 +1830,7 @@ var SchemaBuilder = class {
1765
1830
  }
1766
1831
  /**
1767
1832
  * Defines alterations to an existing table in the migration.
1768
- *
1833
+ *
1769
1834
  * @param table The name of the table to alter.
1770
1835
  * @param callback A callback function to define the alterations to the table's columns and structure.
1771
1836
  * @returns The current SchemaBuilder instance for chaining.
@@ -1790,7 +1855,7 @@ var SchemaBuilder = class {
1790
1855
  }
1791
1856
  /**
1792
1857
  * Defines a table to be dropped in the migration.
1793
- *
1858
+ *
1794
1859
  * @param table The name of the table to drop.
1795
1860
  * @returns The current SchemaBuilder instance for chaining.
1796
1861
  */
@@ -1803,7 +1868,7 @@ var SchemaBuilder = class {
1803
1868
  }
1804
1869
  /**
1805
1870
  * Returns a deep copy of the defined schema operations for the migration/
1806
- *
1871
+ *
1807
1872
  * @returns An array of schema operations for the migration.
1808
1873
  */
1809
1874
  getOperations() {
@@ -1879,7 +1944,7 @@ const PRISMA_ENUM_REGEX = /enum\s+(\w+)\s*\{[\s\S]*?\n\}/g;
1879
1944
  const PRISMA_ENUM_MEMBER_REGEX = /^[A-Za-z][A-Za-z0-9_]*$/;
1880
1945
  /**
1881
1946
  * Convert a table name to a PascalCase model name, with basic singularization.
1882
- *
1947
+ *
1883
1948
  * @param tableName The name of the table to convert.
1884
1949
  * @returns The corresponding PascalCase model name.
1885
1950
  */
@@ -1891,16 +1956,16 @@ const toModelName = (tableName) => {
1891
1956
  };
1892
1957
  /**
1893
1958
  * Escape special characters in a string for use in a regular expression.
1894
- *
1895
- * @param value
1896
- * @returns
1959
+ *
1960
+ * @param value
1961
+ * @returns
1897
1962
  */
1898
1963
  const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1899
1964
  /**
1900
1965
  * Convert a SchemaColumn definition to a Prisma field type string, including modifiers.
1901
- *
1902
- * @param column
1903
- * @returns
1966
+ *
1967
+ * @param column
1968
+ * @returns
1904
1969
  */
1905
1970
  const resolvePrismaType = (column) => {
1906
1971
  if (column.type === "id") return "Int";
@@ -1919,11 +1984,11 @@ const resolveEnumName = (column) => {
1919
1984
  if (column.enumName && column.enumName.trim().length > 0) return column.enumName.trim();
1920
1985
  throw new ArkormException(`Enum column [${column.name}] must define an enum name.`);
1921
1986
  };
1922
- /**
1987
+ /**
1923
1988
  * Format a default value for inclusion in a Prisma schema field definition, based on its type.
1924
- *
1925
- * @param value
1926
- * @returns
1989
+ *
1990
+ * @param value
1991
+ * @returns
1927
1992
  */
1928
1993
  const formatDefaultValue = (value) => {
1929
1994
  if (value == null) return void 0;
@@ -1934,9 +1999,9 @@ const formatDefaultValue = (value) => {
1934
1999
  };
1935
2000
  /**
1936
2001
  * Format a default value for an enum column as a Prisma @default attribute, validating that it is a non-empty string.
1937
- *
1938
- * @param value
1939
- * @returns
2002
+ *
2003
+ * @param value
2004
+ * @returns
1940
2005
  */
1941
2006
  const formatEnumDefaultValue = (value) => {
1942
2007
  if (value == null) return void 0;
@@ -1945,9 +2010,9 @@ const formatEnumDefaultValue = (value) => {
1945
2010
  };
1946
2011
  /**
1947
2012
  * Normalize an enum value by ensuring it is a non-empty string and trimming whitespace.
1948
- *
1949
- * @param value
1950
- * @returns
2013
+ *
2014
+ * @param value
2015
+ * @returns
1951
2016
  */
1952
2017
  const normalizeEnumValue = (value) => {
1953
2018
  if (typeof value !== "string" || value.trim().length === 0) throw new ArkormException("Enum values must be provided as non-empty strings.");
@@ -1957,9 +2022,9 @@ const normalizeEnumValue = (value) => {
1957
2022
  };
1958
2023
  /**
1959
2024
  * Extract the enum values from a Prisma enum block string.
1960
- *
1961
- * @param block
1962
- * @returns
2025
+ *
2026
+ * @param block
2027
+ * @returns
1963
2028
  */
1964
2029
  const extractEnumBlockValues = (block) => {
1965
2030
  return block.split("\n").slice(1, -1).map((line) => line.trim()).filter(Boolean);
@@ -1975,11 +2040,11 @@ const validateEnumValues = (column, enumName, enumValues) => {
1975
2040
  };
1976
2041
  /**
1977
2042
  * Validate that a default value for an enum column is included in the defined enum values.
1978
- *
1979
- * @param column
1980
- * @param enumName
1981
- * @param enumValues
1982
- * @returns
2043
+ *
2044
+ * @param column
2045
+ * @param enumName
2046
+ * @param enumValues
2047
+ * @returns
1983
2048
  */
1984
2049
  const validateEnumDefaultValue = (column, enumName, enumValues) => {
1985
2050
  if (column.default == null) return;
@@ -1989,9 +2054,9 @@ const validateEnumDefaultValue = (column, enumName, enumValues) => {
1989
2054
  };
1990
2055
  /**
1991
2056
  * Build a single line of a Prisma model field definition based on a SchemaColumn, including type and modifiers.
1992
- *
1993
- * @param column
1994
- * @returns
2057
+ *
2058
+ * @param column
2059
+ * @returns
1995
2060
  */
1996
2061
  const buildFieldLine = (column) => {
1997
2062
  if (column.type === "id") {
@@ -2013,9 +2078,9 @@ const buildFieldLine = (column) => {
2013
2078
  return ` ${column.name} ${scalar}${nullable}${primary}${unique}${defaultSuffix}${updatedAt}${mapped}`;
2014
2079
  };
2015
2080
  /**
2016
- * Build a Prisma enum block string based on an enum name and its values, validating that
2081
+ * Build a Prisma enum block string based on an enum name and its values, validating that
2017
2082
  * at least one value is provided.
2018
- *
2083
+ *
2019
2084
  * @param enumName The name of the enum to create.
2020
2085
  * @param values The array of values for the enum.
2021
2086
  * @returns The Prisma enum block string.
@@ -2025,12 +2090,12 @@ const buildEnumBlock = (enumName, values) => {
2025
2090
  return `enum ${enumName} {\n${values.map((value) => ` ${value}`).join("\n")}\n}`;
2026
2091
  };
2027
2092
  /**
2028
- * Find the Prisma enum block in a schema string that corresponds to a given enum
2093
+ * Find the Prisma enum block in a schema string that corresponds to a given enum
2029
2094
  * name, returning its details if found.
2030
- *
2095
+ *
2031
2096
  * @param schema The Prisma schema string to search for the enum block.
2032
2097
  * @param enumName The name of the enum to find in the schema.
2033
- * @returns
2098
+ * @returns
2034
2099
  */
2035
2100
  const findEnumBlock = (schema, enumName) => {
2036
2101
  const candidates = [...schema.matchAll(PRISMA_ENUM_REGEX)];
@@ -2049,13 +2114,13 @@ const findEnumBlock = (schema, enumName) => {
2049
2114
  return null;
2050
2115
  };
2051
2116
  /**
2052
- * Ensure that Prisma enum blocks exist in the schema for any enum columns defined in a
2053
- * create or alter table operation, adding them if necessary and validating against
2117
+ * Ensure that Prisma enum blocks exist in the schema for any enum columns defined in a
2118
+ * create or alter table operation, adding them if necessary and validating against
2054
2119
  * existing blocks.
2055
- *
2120
+ *
2056
2121
  * @param schema The current Prisma schema string to check and modify.
2057
2122
  * @param columns The array of schema column definitions to check for enum types and ensure corresponding blocks exist for.
2058
- * @returns
2123
+ * @returns
2059
2124
  */
2060
2125
  const ensureEnumBlocks = (schema, columns) => {
2061
2126
  let nextSchema = schema;
@@ -2085,9 +2150,9 @@ const ensureEnumBlocks = (schema, columns) => {
2085
2150
  };
2086
2151
  /**
2087
2152
  * Build a Prisma model-level @@index definition line.
2088
- *
2153
+ *
2089
2154
  * @param index The schema index definition to convert to a Prisma \@\@index line.
2090
- * @returns
2155
+ * @returns
2091
2156
  */
2092
2157
  const buildIndexLine = (index) => {
2093
2158
  return ` @@index([${index.columns.join(", ")}]${typeof index.name === "string" && index.name.trim().length > 0 ? `, name: "${index.name.replace(/"/g, "\\\"")}"` : ""})`;
@@ -2111,9 +2176,9 @@ const buildUniqueConstraintLine = (constraint) => {
2111
2176
  return ` @@unique([${constraint.columns.join(", ")}]${typeof constraint.name === "string" && constraint.name.trim().length > 0 ? `, name: "${constraint.name.replace(/"/g, "\\\"")}"` : ""})`;
2112
2177
  };
2113
2178
  /**
2114
- * Derive a relation field name from a foreign key column name by applying
2179
+ * Derive a relation field name from a foreign key column name by applying
2115
2180
  * common conventions, such as removing "Id" suffixes and converting to camelCase.
2116
- *
2181
+ *
2117
2182
  * @param columnName The name of the foreign key column.
2118
2183
  * @returns The derived relation field name.
2119
2184
  */
@@ -2128,10 +2193,10 @@ const deriveRelationFieldName = (columnName) => {
2128
2193
  return `${trimmed.charAt(0).toLowerCase()}${trimmed.slice(1)}`;
2129
2194
  };
2130
2195
  /**
2131
- * Derive a relation name for both sides of a relation based on the
2132
- * source and target model names, using an explicit alias if provided or a
2196
+ * Derive a relation name for both sides of a relation based on the
2197
+ * source and target model names, using an explicit alias if provided or a
2133
2198
  * convention of combining the full source model name with the target model name.
2134
- *
2199
+ *
2135
2200
  * @param sourceModelName The name of the source model in the relation.
2136
2201
  * @param targetModelName The name of the target model in the relation.
2137
2202
  * @param explicitAlias An optional explicit alias for the relation.
@@ -2158,9 +2223,9 @@ const resolveForeignKeyColumn = (columns, foreignKey) => {
2158
2223
  const isOneToOneForeignKey = (column) => {
2159
2224
  return Boolean(column?.unique || column?.primary);
2160
2225
  };
2161
- /**
2226
+ /**
2162
2227
  * Format a SchemaForeignKeyAction value as a Prisma onDelete action string.
2163
- *
2228
+ *
2164
2229
  * @param action The foreign key action to format.
2165
2230
  * @returns The corresponding Prisma onDelete action string.
2166
2231
  */
@@ -2172,9 +2237,9 @@ const formatRelationAction = (action) => {
2172
2237
  return "NoAction";
2173
2238
  };
2174
2239
  /**
2175
- * Build a Prisma relation field line based on a SchemaForeignKey
2240
+ * Build a Prisma relation field line based on a SchemaForeignKey
2176
2241
  * definition, including relation name and onDelete action.
2177
- *
2242
+ *
2178
2243
  * @param foreignKey The foreign key definition to convert to a relation line.
2179
2244
  * @returns The corresponding Prisma schema line for the relation field.
2180
2245
  */
@@ -2190,10 +2255,10 @@ const buildRelationLine = (sourceModelName, foreignKey, columns = []) => {
2190
2255
  return ` ${fieldName} ${targetModel}${optional} @relation("${relationName.replace(/"/g, "\\\"")}", fields: [${foreignKey.column}], references: [${foreignKey.referencesColumn}]${onDelete})`;
2191
2256
  };
2192
2257
  /**
2193
- * Build a Prisma relation field line for the inverse side of a relation, based
2194
- * on the source and target model names and the foreign key definition, using
2258
+ * Build a Prisma relation field line for the inverse side of a relation, based
2259
+ * on the source and target model names and the foreign key definition, using
2195
2260
  * naming conventions and any explicit inverse alias provided.
2196
- *
2261
+ *
2197
2262
  * @param sourceModelName The name of the source model in the relation.
2198
2263
  * @param targetModelName The name of the target model in the relation.
2199
2264
  * @param foreignKey The foreign key definition for the relation.
@@ -2206,14 +2271,14 @@ const buildInverseRelationLine = (sourceModelName, targetModelName, foreignKey,
2206
2271
  return ` ${fieldName} ${isOneToOneForeignKey(sourceColumn) ? `${sourceModelName}?` : `${sourceModelName}[]`} @relation("${relationName.replace(/"/g, "\\\"")}")`;
2207
2272
  };
2208
2273
  /**
2209
- * Inject a line into the body of a Prisma model block if it does not already
2210
- * exist, using a provided existence check function to determine if the line
2274
+ * Inject a line into the body of a Prisma model block if it does not already
2275
+ * exist, using a provided existence check function to determine if the line
2211
2276
  * is already present.
2212
- *
2277
+ *
2213
2278
  * @param bodyLines The lines of the model block body to modify.
2214
2279
  * @param line The line to inject if it does not already exist.
2215
2280
  * @param exists A function that checks if a given line already exists in the body.
2216
- * @returns
2281
+ * @returns
2217
2282
  */
2218
2283
  const injectLineIntoModelBody = (bodyLines, line, exists) => {
2219
2284
  if (bodyLines.some(exists)) return bodyLines;
@@ -2222,10 +2287,10 @@ const injectLineIntoModelBody = (bodyLines, line, exists) => {
2222
2287
  return bodyLines;
2223
2288
  };
2224
2289
  /**
2225
- * Apply inverse relation definitions to a Prisma schema string based on the
2226
- * foreign keys defined in a create or alter table operation, ensuring that
2290
+ * Apply inverse relation definitions to a Prisma schema string based on the
2291
+ * foreign keys defined in a create or alter table operation, ensuring that
2227
2292
  * related models have corresponding relation fields for bi-directional navigation.
2228
- *
2293
+ *
2229
2294
  * @param schema The Prisma schema string to modify.
2230
2295
  * @param sourceModelName The name of the source model in the relation.
2231
2296
  * @param foreignKeys An array of foreign key definitions to process.
@@ -2248,9 +2313,9 @@ const applyInverseRelations = (schema, sourceModelName, foreignKeys, columns = [
2248
2313
  return nextSchema;
2249
2314
  };
2250
2315
  /**
2251
- * Build a Prisma model block string based on a SchemaTableCreateOperation, including
2316
+ * Build a Prisma model block string based on a SchemaTableCreateOperation, including
2252
2317
  * all fields and any necessary mapping.
2253
- *
2318
+ *
2254
2319
  * @param operation The schema table create operation to convert.
2255
2320
  * @returns The corresponding Prisma model block string.
2256
2321
  */
@@ -2275,12 +2340,12 @@ const buildModelBlock = (operation) => {
2275
2340
  ] : [...fields, ...relations]).join("\n")}\n}`;
2276
2341
  };
2277
2342
  /**
2278
- * Find the Prisma model block in a schema string that corresponds to a given
2343
+ * Find the Prisma model block in a schema string that corresponds to a given
2279
2344
  * table name, using both explicit mapping and naming conventions.
2280
- *
2281
- * @param schema
2282
- * @param table
2283
- * @returns
2345
+ *
2346
+ * @param schema
2347
+ * @param table
2348
+ * @returns
2284
2349
  */
2285
2350
  const findModelBlock = (schema, table) => {
2286
2351
  const candidates = [...schema.matchAll(PRISMA_MODEL_REGEX)];
@@ -2312,9 +2377,9 @@ const findModelBlock = (schema, table) => {
2312
2377
  return null;
2313
2378
  };
2314
2379
  /**
2315
- * Apply a create table operation to a Prisma schema string, adding a new model
2380
+ * Apply a create table operation to a Prisma schema string, adding a new model
2316
2381
  * block for the specified table and fields.
2317
- *
2382
+ *
2318
2383
  * @param schema The current Prisma schema string.
2319
2384
  * @param operation The schema table create operation to apply.
2320
2385
  * @returns The updated Prisma schema string with the new model block.
@@ -2326,9 +2391,9 @@ const applyCreateTableOperation = (schema, operation) => {
2326
2391
  return applyInverseRelations(`${schemaWithEnums.trimEnd()}\n\n${block}\n`, toModelName(operation.table), operation.foreignKeys ?? [], operation.columns);
2327
2392
  };
2328
2393
  /**
2329
- * Apply an alter table operation to a Prisma schema string, modifying the model
2394
+ * Apply an alter table operation to a Prisma schema string, modifying the model
2330
2395
  * block for the specified table by adding and removing fields as needed.
2331
- *
2396
+ *
2332
2397
  * @param schema The current Prisma schema string.
2333
2398
  * @param operation The schema table alter operation to apply.
2334
2399
  * @returns The updated Prisma schema string with the modified model block.
@@ -2395,10 +2460,10 @@ const applyDropTableOperation = (schema, operation) => {
2395
2460
  return `${before}${before && after ? "\n\n" : ""}${after}`;
2396
2461
  };
2397
2462
  /**
2398
- * The SchemaBuilder class provides a fluent interface for defining
2399
- * database schema operations in a migration, such as creating, altering, and
2463
+ * The SchemaBuilder class provides a fluent interface for defining
2464
+ * database schema operations in a migration, such as creating, altering, and
2400
2465
  * dropping tables.
2401
- *
2466
+ *
2402
2467
  * @param schema The current Prisma schema string.
2403
2468
  * @param operations The list of schema operations to apply.
2404
2469
  * @returns The updated Prisma schema string after applying all operations.
@@ -2412,7 +2477,7 @@ const applyOperationsToPrismaSchema = (schema, operations) => {
2412
2477
  };
2413
2478
  /**
2414
2479
  * Run a Prisma CLI command using npx, capturing and throwing any errors that occur.
2415
- *
2480
+ *
2416
2481
  * @param args The arguments to pass to the Prisma CLI command.
2417
2482
  * @param cwd The current working directory to run the command in.
2418
2483
  * @returns void
@@ -2427,11 +2492,11 @@ const runPrismaCommand = (args, cwd) => {
2427
2492
  throw new ArkormException(errorOutput ? `Prisma command failed: prisma ${args.join(" ")}\n${errorOutput}` : `Prisma command failed: prisma ${args.join(" ")}`);
2428
2493
  };
2429
2494
  /**
2430
- * Generate a new migration file with a given name and options, including
2495
+ * Generate a new migration file with a given name and options, including
2431
2496
  * writing the file to disk if specified.
2432
- *
2433
- * @param name
2434
- * @returns
2497
+ *
2498
+ * @param name
2499
+ * @returns
2435
2500
  */
2436
2501
  const resolveMigrationClassName = (name) => {
2437
2502
  const cleaned = name.replace(/[^a-zA-Z0-9]+/g, " ").trim();
@@ -2439,39 +2504,39 @@ const resolveMigrationClassName = (name) => {
2439
2504
  return `${cleaned.split(/\s+/g).map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join("")}Migration`;
2440
2505
  };
2441
2506
  /**
2442
- * Pad a number with leading zeros to ensure it is at least two digits, for
2507
+ * Pad a number with leading zeros to ensure it is at least two digits, for
2443
2508
  * use in migration timestamps.
2444
- *
2445
- * @param value
2446
- * @returns
2509
+ *
2510
+ * @param value
2511
+ * @returns
2447
2512
  */
2448
2513
  const pad = (value) => String(value).padStart(2, "0");
2449
2514
  /**
2450
- * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
2515
+ * Create a timestamp string in the format YYYYMMDDHHMMSS for use in migration
2451
2516
  * file names, based on the current date and time or a provided date.
2452
- *
2453
- * @param date
2454
- * @returns
2517
+ *
2518
+ * @param date
2519
+ * @returns
2455
2520
  */
2456
2521
  const createMigrationTimestamp = (date = /* @__PURE__ */ new Date()) => {
2457
2522
  return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}`;
2458
2523
  };
2459
2524
  /**
2460
- * Convert a migration name to a slug suitable for use in a file name, by
2525
+ * Convert a migration name to a slug suitable for use in a file name, by
2461
2526
  * lowercasing and replacing non-alphanumeric characters with underscores.
2462
- *
2463
- * @param name
2464
- * @returns
2527
+ *
2528
+ * @param name
2529
+ * @returns
2465
2530
  */
2466
2531
  const toMigrationFileSlug = (name) => {
2467
2532
  return name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "migration";
2468
2533
  };
2469
2534
  /**
2470
- * Build the source code for a new migration file based on a given class
2535
+ * Build the source code for a new migration file based on a given class
2471
2536
  * name, using a template with empty up and down methods.
2472
- *
2473
- * @param className
2474
- * @returns
2537
+ *
2538
+ * @param className
2539
+ * @returns
2475
2540
  */
2476
2541
  const buildMigrationSource = (className, extension = "ts") => {
2477
2542
  if (extension === "js") return [
@@ -2508,12 +2573,12 @@ const buildMigrationSource = (className, extension = "ts") => {
2508
2573
  ].join("\n");
2509
2574
  };
2510
2575
  /**
2511
- * Generate a new migration file with a given name and options, including
2576
+ * Generate a new migration file with a given name and options, including
2512
2577
  * writing the file to disk if specified, and return the details of the generated file.
2513
- *
2514
- * @param name
2515
- * @param options
2516
- * @returns
2578
+ *
2579
+ * @param name
2580
+ * @param options
2581
+ * @returns
2517
2582
  */
2518
2583
  const generateMigrationFile = (name, options = {}) => {
2519
2584
  const timestamp = createMigrationTimestamp(/* @__PURE__ */ new Date());
@@ -2538,10 +2603,10 @@ const generateMigrationFile = (name, options = {}) => {
2538
2603
  };
2539
2604
  /**
2540
2605
  * 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.
2541
- *
2606
+ *
2542
2607
  * @param migration The migration class or instance to analyze.
2543
2608
  * @param direction The direction of the migration to plan for ('up' or 'down').
2544
- * @returns A promise that resolves to an array of schema operations that would be performed.
2609
+ * @returns A promise that resolves to an array of schema operations that would be performed.
2545
2610
  */
2546
2611
  const getMigrationPlan = async (migration, direction = "up") => {
2547
2612
  const instance = typeof migration === "function" ? new migration() : migration;
@@ -2576,10 +2641,10 @@ const applyMigrationRollbackToDatabase = async (adapter, migration) => {
2576
2641
  return { operations };
2577
2642
  };
2578
2643
  /**
2579
- * Apply the schema operations defined in a migration to a Prisma schema
2580
- * file, updating the file on disk if specified, and return the updated
2644
+ * Apply the schema operations defined in a migration to a Prisma schema
2645
+ * file, updating the file on disk if specified, and return the updated
2581
2646
  * schema and list of operations applied.
2582
- *
2647
+ *
2583
2648
  * @param migration The migration class or instance to apply.
2584
2649
  * @param options Options for applying the migration, including schema path and write flag.
2585
2650
  * @returns A promise that resolves to an object containing the updated schema, schema path, and list of operations applied.
@@ -2618,10 +2683,10 @@ const applyMigrationRollbackToPrismaSchema = async (migration, options = {}) =>
2618
2683
  };
2619
2684
  };
2620
2685
  /**
2621
- * Run a migration by applying its schema operations to a Prisma schema
2622
- * file, optionally generating Prisma client code and running migrations after
2686
+ * Run a migration by applying its schema operations to a Prisma schema
2687
+ * file, optionally generating Prisma client code and running migrations after
2623
2688
  * applying the schema changes.
2624
- *
2689
+ *
2625
2690
  * @param migration The migration class or instance to run.
2626
2691
  * @param options Options for running the migration, including schema path, write flag, and Prisma commands.
2627
2692
  * @returns A promise that resolves to an object containing the schema path and list of operations applied.
@@ -3003,8 +3068,8 @@ const normalizePathInput = (paths) => {
3003
3068
  const normalizeConstructors = (items) => items.flatMap((item) => Array.isArray(item) ? item : [item]).filter(Boolean);
3004
3069
  /**
3005
3070
  * Register additional runtime discovery paths without replacing configured paths.
3006
- *
3007
- * @param paths
3071
+ *
3072
+ * @param paths
3008
3073
  */
3009
3074
  const registerPaths = (paths) => {
3010
3075
  Object.entries(paths).forEach(([key, value]) => {
@@ -3013,69 +3078,69 @@ const registerPaths = (paths) => {
3013
3078
  };
3014
3079
  /**
3015
3080
  * Register additional runtime discovery paths for migrations without replacing configured paths.
3016
- *
3017
- * @param paths
3018
- * @returns
3081
+ *
3082
+ * @param paths
3083
+ * @returns
3019
3084
  */
3020
3085
  const loadMigrationsFrom = (paths) => registerPaths({ migrations: paths });
3021
3086
  /**
3022
3087
  * Register additional runtime discovery paths for seeders without replacing configured paths.
3023
- *
3024
- * @param paths
3025
- * @returns
3088
+ *
3089
+ * @param paths
3090
+ * @returns
3026
3091
  */
3027
3092
  const loadSeedersFrom = (paths) => registerPaths({ seeders: paths });
3028
3093
  /**
3029
3094
  * Register additional runtime discovery paths for models without replacing configured paths.
3030
- *
3031
- * @param paths
3032
- * @returns
3095
+ *
3096
+ * @param paths
3097
+ * @returns
3033
3098
  */
3034
3099
  const loadModelsFrom = (paths) => registerPaths({ models: paths });
3035
3100
  /**
3036
3101
  * Register additional runtime discovery paths for factories without replacing configured paths.
3037
- *
3038
- * @param paths
3039
- * @returns
3102
+ *
3103
+ * @param paths
3104
+ * @returns
3040
3105
  */
3041
3106
  const loadFactoriesFrom = (paths) => registerPaths({ factories: paths });
3042
3107
  /**
3043
3108
  * Register migration constructors directly without relying on runtime discovery.
3044
- *
3045
- * @param migrations
3109
+ *
3110
+ * @param migrations
3046
3111
  */
3047
3112
  const registerMigrations = (...migrations) => {
3048
3113
  pushUnique(registry.migrations, normalizeConstructors(migrations));
3049
3114
  };
3050
3115
  /**
3051
3116
  * Register seeder constructors directly without relying on runtime discovery.
3052
- *
3053
- * @param seeders
3117
+ *
3118
+ * @param seeders
3054
3119
  */
3055
3120
  const registerSeeders = (...seeders) => {
3056
3121
  pushUnique(registry.seeders, normalizeConstructors(seeders));
3057
3122
  };
3058
3123
  /**
3059
3124
  * Register model constructors directly without relying on runtime discovery.
3060
- *
3061
- * @param models
3125
+ *
3126
+ * @param models
3062
3127
  */
3063
3128
  const registerModels = (...models) => {
3064
3129
  pushUnique(registry.models, normalizeConstructors(models));
3065
3130
  };
3066
3131
  /**
3067
3132
  * Register factory constructors or instances directly without relying on runtime discovery.
3068
- *
3069
- * @param factories
3133
+ *
3134
+ * @param factories
3070
3135
  */
3071
3136
  const registerFactories = (...factories) => {
3072
3137
  pushUnique(registry.factories, normalizeConstructors(factories));
3073
3138
  };
3074
3139
  /**
3075
3140
  * Get registered runtime discovery paths or registered constructors for a specific type.
3076
- *
3077
- * @param key
3078
- * @returns
3141
+ *
3142
+ * @param key
3143
+ * @returns
3079
3144
  */
3080
3145
  const getRegisteredPaths = (key) => {
3081
3146
  if (key) return [...registry.paths[key]];
@@ -3088,26 +3153,26 @@ const getRegisteredPaths = (key) => {
3088
3153
  };
3089
3154
  /**
3090
3155
  * Get registered migration constructors instances.
3091
- *
3092
- * @returns
3156
+ *
3157
+ * @returns
3093
3158
  */
3094
3159
  const getRegisteredMigrations = () => [...registry.migrations];
3095
3160
  /**
3096
3161
  * Get registered seeder constructors instances.
3097
- *
3098
- * @returns
3162
+ *
3163
+ * @returns
3099
3164
  */
3100
3165
  const getRegisteredSeeders = () => [...registry.seeders];
3101
3166
  /**
3102
3167
  * Get registered model constructors instances.
3103
- *
3104
- * @returns
3168
+ *
3169
+ * @returns
3105
3170
  */
3106
3171
  const getRegisteredModels = () => [...registry.models];
3107
3172
  /**
3108
3173
  * Get registered factory constructors or instances.
3109
- *
3110
- * @returns
3174
+ *
3175
+ * @returns
3111
3176
  */
3112
3177
  const getRegisteredFactories = () => [...registry.factories];
3113
3178
  const resetRuntimeRegistryForTests = () => {
@@ -3211,9 +3276,9 @@ const mergePathConfig = (paths) => {
3211
3276
  };
3212
3277
  /**
3213
3278
  * Merge the feature configuration from the base defaults, user configuration, and provided options.
3214
- *
3215
- * @param features
3216
- * @returns
3279
+ *
3280
+ * @param features
3281
+ * @returns
3217
3282
  */
3218
3283
  const mergeFeatureConfig = (features) => {
3219
3284
  const defaults = baseConfig.features ?? {};
@@ -3269,7 +3334,7 @@ const awaitConfiguredModelsRegistration = async () => {
3269
3334
  };
3270
3335
  /**
3271
3336
  * Define the ArkORM runtime configuration. This function can be used to provide.
3272
- *
3337
+ *
3273
3338
  * @param config The ArkORM configuration object.
3274
3339
  * @returns The same configuration object.
3275
3340
  */
@@ -3278,10 +3343,10 @@ const defineConfig = (config) => {
3278
3343
  };
3279
3344
  /**
3280
3345
  * Bind a database adapter instance to an array of models that support adapter binding.
3281
- *
3282
- * @param adapter
3283
- * @param models
3284
- * @returns
3346
+ *
3347
+ * @param adapter
3348
+ * @param models
3349
+ * @returns
3285
3350
  */
3286
3351
  const bindAdapterToModels = (adapter, models) => {
3287
3352
  models.forEach((model) => {
@@ -3290,10 +3355,10 @@ const bindAdapterToModels = (adapter, models) => {
3290
3355
  return adapter;
3291
3356
  };
3292
3357
  /**
3293
- * Get the user-provided ArkORM configuration.
3294
- *
3358
+ * Get the user-provided ArkORM configuration.
3359
+ *
3295
3360
  * @param key Optional specific configuration key to retrieve. If omitted, the entire configuration object is returned.
3296
- * @returns The user-provided ArkORM configuration object.
3361
+ * @returns The user-provided ArkORM configuration object.
3297
3362
  */
3298
3363
  const getUserConfig = (key) => {
3299
3364
  if (key) return userConfig[key];
@@ -3302,8 +3367,8 @@ const getUserConfig = (key) => {
3302
3367
  /**
3303
3368
  * Configure the ArkORM runtime with the provided runtime client resolver and
3304
3369
  * adapter-first options.
3305
- *
3306
- * @param client
3370
+ *
3371
+ * @param client
3307
3372
  * @param options
3308
3373
  */
3309
3374
  const configureArkormRuntime = (client, options = {}) => {
@@ -3336,7 +3401,7 @@ const configureArkormRuntime = (client, options = {}) => {
3336
3401
  });
3337
3402
  };
3338
3403
  /**
3339
- * Reset the ArkORM runtime configuration.
3404
+ * Reset the ArkORM runtime configuration.
3340
3405
  * This is primarily intended for testing purposes.
3341
3406
  */
3342
3407
  const resetArkormRuntimeForTests = () => {
@@ -3361,9 +3426,9 @@ const resetArkormRuntimeForTests = () => {
3361
3426
  /**
3362
3427
  * Resolve a runtime client instance from the provided resolver, which can be either
3363
3428
  * a direct client instance or a function that returns a client instance.
3364
- *
3365
- * @param resolver
3366
- * @returns
3429
+ *
3430
+ * @param resolver
3431
+ * @returns
3367
3432
  */
3368
3433
  const resolveClient = (resolver) => {
3369
3434
  if (!resolver) return void 0;
@@ -3372,12 +3437,12 @@ const resolveClient = (resolver) => {
3372
3437
  return client;
3373
3438
  };
3374
3439
  /**
3375
- * Resolve and apply the ArkORM configuration from an imported module.
3440
+ * Resolve and apply the ArkORM configuration from an imported module.
3376
3441
  * This function checks for a default export and falls back to the module itself, then validates
3377
3442
  * the configuration object and applies it to the runtime if valid.
3378
- *
3379
- * @param imported
3380
- * @returns
3443
+ *
3444
+ * @param imported
3445
+ * @returns
3381
3446
  */
3382
3447
  const resolveAndApplyConfig = (imported) => {
3383
3448
  const config = imported?.default ?? imported;
@@ -3397,11 +3462,11 @@ const resolveAndApplyConfig = (imported) => {
3397
3462
  runtimeConfigLoaded = true;
3398
3463
  };
3399
3464
  /**
3400
- * Dynamically import a configuration file.
3465
+ * Dynamically import a configuration file.
3401
3466
  * A cache-busting query parameter is appended to ensure the latest version is loaded.
3402
- *
3403
- * @param configPath
3404
- * @returns A promise that resolves to the imported configuration module.
3467
+ *
3468
+ * @param configPath
3469
+ * @returns A promise that resolves to the imported configuration module.
3405
3470
  */
3406
3471
  const importConfigFile = (configPath) => {
3407
3472
  return RuntimeModuleLoader.load(configPath);
@@ -3421,9 +3486,9 @@ const loadRuntimeConfigSync = () => {
3421
3486
  return false;
3422
3487
  };
3423
3488
  /**
3424
- * Load the ArkORM configuration by searching for configuration files in the
3489
+ * Load the ArkORM configuration by searching for configuration files in the
3425
3490
  * current working directory.
3426
- * @returns
3491
+ * @returns
3427
3492
  */
3428
3493
  const loadArkormConfig = async () => {
3429
3494
  if (runtimeConfigLoaded) {
@@ -3454,11 +3519,11 @@ const loadArkormConfig = async () => {
3454
3519
  await runtimeConfigLoadingPromise;
3455
3520
  };
3456
3521
  /**
3457
- * Ensure that the ArkORM configuration is loaded.
3522
+ * Ensure that the ArkORM configuration is loaded.
3458
3523
  * This function can be called to trigger the loading process if it hasn't already been initiated.
3459
3524
  * If the configuration is already loaded, it will return immediately.
3460
- *
3461
- * @returns
3525
+ *
3526
+ * @returns
3462
3527
  */
3463
3528
  const ensureArkormConfigLoading = () => {
3464
3529
  if (runtimeConfigLoaded) return;
@@ -3469,10 +3534,10 @@ const getDefaultStubsPath = () => {
3469
3534
  };
3470
3535
  /**
3471
3536
  * Get the runtime compatibility client.
3472
- * This function will trigger the loading of the ArkORM configuration if
3537
+ * This function will trigger the loading of the ArkORM configuration if
3473
3538
  * it hasn't already been loaded.
3474
- *
3475
- * @returns
3539
+ *
3540
+ * @returns
3476
3541
  */
3477
3542
  const getRuntimeClient = () => {
3478
3543
  const activeTransactionClient = transactionClientStorage.getStore();
@@ -3486,8 +3551,8 @@ const getRuntimeClient = () => {
3486
3551
  const getRuntimePrismaClient = getRuntimeClient;
3487
3552
  /**
3488
3553
  * Get the currently configured runtime adapter, if any.
3489
- *
3490
- * @returns
3554
+ *
3555
+ * @returns
3491
3556
  */
3492
3557
  const getRuntimeAdapter = () => {
3493
3558
  const activeTransactionAdapter = transactionAdapterStorage.getStore();
@@ -3564,7 +3629,7 @@ const emitRuntimeDebugEvent = (event) => {
3564
3629
  /**
3565
3630
  * Check if a given value matches Arkorm's query-schema contract
3566
3631
  * by verifying the presence of common delegate methods.
3567
- *
3632
+ *
3568
3633
  * @param value The value to check.
3569
3634
  * @returns True if the value matches the query-schema contract, false otherwise.
3570
3635
  */
@@ -3590,7 +3655,7 @@ loadArkormConfig();
3590
3655
  //#region src/URLDriver.ts
3591
3656
  /**
3592
3657
  * URLDriver builds pagination URLs from paginator options.
3593
- *
3658
+ *
3594
3659
  * @author Legacy (3m1n3nc3)
3595
3660
  * @since 0.1.0
3596
3661
  */
@@ -3633,7 +3698,7 @@ var URLDriver = class URLDriver {
3633
3698
  /**
3634
3699
  * The LengthAwarePaginator class encapsulates paginated results with full
3635
3700
  * metadata including the total result count and last page.
3636
- *
3701
+ *
3637
3702
  * @template T The type of the data being paginated.
3638
3703
  * @author Legacy (3m1n3nc3)
3639
3704
  * @since 0.1.0
@@ -3641,7 +3706,7 @@ var URLDriver = class URLDriver {
3641
3706
  var LengthAwarePaginator = class {
3642
3707
  /**
3643
3708
  * Creates a new LengthAwarePaginator instance.
3644
- *
3709
+ *
3645
3710
  * @param data The collection of data being paginated.
3646
3711
  * @param total The total number of items.
3647
3712
  * @param perPage The number of items per page.
@@ -3686,8 +3751,8 @@ var LengthAwarePaginator = class {
3686
3751
  }
3687
3752
  /**
3688
3753
  * Converts the paginator instance to a JSON-serializable object.
3689
- *
3690
- * @returns
3754
+ *
3755
+ * @returns
3691
3756
  */
3692
3757
  toJSON() {
3693
3758
  return {
@@ -3762,7 +3827,7 @@ var Paginator = class {
3762
3827
  //#region src/relationship/Relation.ts
3763
3828
  /**
3764
3829
  * Base class for all relationship types. Not meant to be used directly.
3765
- *
3830
+ *
3766
3831
  * @author Legacy (3m1n3nc3)
3767
3832
  * @since 0.1.0
3768
3833
  */
@@ -3808,7 +3873,7 @@ var Relation = class {
3808
3873
  }
3809
3874
  /**
3810
3875
  * Apply a constraint to the relationship query.
3811
- *
3876
+ *
3812
3877
  * @param constraint The constraint function to apply to the query.
3813
3878
  * @returns The current relation instance.
3814
3879
  */
@@ -3912,81 +3977,81 @@ var Relation = class {
3912
3977
  }
3913
3978
  /**
3914
3979
  * Adds clause to determine if a column's value is in the past
3915
- *
3916
- * @param key
3917
- * @returns
3980
+ *
3981
+ * @param key
3982
+ * @returns
3918
3983
  */
3919
3984
  wherePast(key) {
3920
3985
  return this.constrain((query) => query.wherePast(key));
3921
3986
  }
3922
3987
  /**
3923
3988
  * Adds clause to determine if a column's value is in the future
3924
- *
3925
- * @param key
3926
- * @returns
3989
+ *
3990
+ * @param key
3991
+ * @returns
3927
3992
  */
3928
3993
  whereFuture(key) {
3929
3994
  return this.constrain((query) => query.whereFuture(key));
3930
3995
  }
3931
3996
  /**
3932
3997
  * Adds clause to determine if a column's value is in the past, inclusive of the current date and time
3933
- *
3934
- * @param key
3935
- * @returns
3998
+ *
3999
+ * @param key
4000
+ * @returns
3936
4001
  */
3937
4002
  whereNowOrPast(key) {
3938
4003
  return this.constrain((query) => query.whereNowOrPast(key));
3939
4004
  }
3940
4005
  /**
3941
4006
  * Adds clause to determine if a column's value is in the future, inclusive of the current date and time
3942
- *
3943
- * @param key
3944
- * @returns
4007
+ *
4008
+ * @param key
4009
+ * @returns
3945
4010
  */
3946
4011
  whereNowOrFuture(key) {
3947
4012
  return this.constrain((query) => query.whereNowOrFuture(key));
3948
4013
  }
3949
4014
  /**
3950
4015
  * Adds clause to determine if a column's value is today
3951
- *
3952
- * @param key
3953
- * @returns
4016
+ *
4017
+ * @param key
4018
+ * @returns
3954
4019
  */
3955
4020
  whereToday(key) {
3956
4021
  return this.constrain((query) => query.whereToday(key));
3957
4022
  }
3958
4023
  /**
3959
4024
  * Adds clause to determine if a column's value is before today
3960
- *
3961
- * @param key
3962
- * @returns
4025
+ *
4026
+ * @param key
4027
+ * @returns
3963
4028
  */
3964
4029
  whereBeforeToday(key) {
3965
4030
  return this.constrain((query) => query.whereBeforeToday(key));
3966
4031
  }
3967
4032
  /**
3968
4033
  * Adds clause to determine if a column's value is after today
3969
- *
3970
- * @param key
3971
- * @returns
4034
+ *
4035
+ * @param key
4036
+ * @returns
3972
4037
  */
3973
4038
  whereAfterToday(key) {
3974
4039
  return this.constrain((query) => query.whereAfterToday(key));
3975
4040
  }
3976
4041
  /**
3977
4042
  * Adds clause to determine if a column's value is today or before today
3978
- *
3979
- * @param key
3980
- * @returns
4043
+ *
4044
+ * @param key
4045
+ * @returns
3981
4046
  */
3982
4047
  whereTodayOrBefore(key) {
3983
4048
  return this.constrain((query) => query.whereTodayOrBefore(key));
3984
4049
  }
3985
4050
  /**
3986
4051
  * Adds clause to determine if a column's value is today or after today
3987
- *
3988
- * @param key
3989
- * @returns
4052
+ *
4053
+ * @param key
4054
+ * @returns
3990
4055
  */
3991
4056
  whereTodayOrAfter(key) {
3992
4057
  return this.constrain((query) => query.whereTodayOrAfter(key));
@@ -3996,9 +4061,9 @@ var Relation = class {
3996
4061
  }
3997
4062
  /**
3998
4063
  * Adds "where exists" SQL clauses.
3999
- *
4000
- * @param queryOrCallback
4001
- * @returns
4064
+ *
4065
+ * @param queryOrCallback
4066
+ * @returns
4002
4067
  */
4003
4068
  whereExists(queryOrCallback) {
4004
4069
  return this.constrain((query) => query.whereExists(queryOrCallback));
@@ -4097,107 +4162,107 @@ var Relation = class {
4097
4162
  }
4098
4163
  /**
4099
4164
  * Add an OR string contains clause to the relationship query.
4100
- *
4101
- * @param key
4102
- * @param value
4103
- * @returns
4165
+ *
4166
+ * @param key
4167
+ * @param value
4168
+ * @returns
4104
4169
  */
4105
4170
  orWhereLike(key, value) {
4106
4171
  return this.constrain((query) => query.orWhereLike(key, value));
4107
4172
  }
4108
4173
  /**
4109
4174
  * Add a negated string contains (NOT LIKE) clause to the relationship query.
4110
- *
4111
- * @param key
4112
- * @param value
4113
- * @returns
4175
+ *
4176
+ * @param key
4177
+ * @param value
4178
+ * @returns
4114
4179
  */
4115
4180
  whereNotLike(key, value) {
4116
4181
  return this.constrain((query) => query.whereNotLike(key, value));
4117
4182
  }
4118
4183
  /**
4119
4184
  * Add an OR negated string contains (NOT LIKE) clause to the relationship query.
4120
- *
4121
- * @param key
4122
- * @param value
4123
- * @returns
4185
+ *
4186
+ * @param key
4187
+ * @param value
4188
+ * @returns
4124
4189
  */
4125
4190
  orWhereNotLike(key, value) {
4126
4191
  return this.constrain((query) => query.orWhereNotLike(key, value));
4127
4192
  }
4128
4193
  /**
4129
4194
  * Add a JSON containment clause to the relationship query.
4130
- *
4131
- * @param key
4132
- * @param value
4133
- * @returns
4195
+ *
4196
+ * @param key
4197
+ * @param value
4198
+ * @returns
4134
4199
  */
4135
4200
  whereJsonContains(column, value) {
4136
4201
  return this.constrain((query) => query.whereJsonContains(column, value));
4137
4202
  }
4138
4203
  /**
4139
4204
  * OR variant of whereJsonContains().
4140
- *
4141
- * @param column
4142
- * @param value
4143
- * @returns
4205
+ *
4206
+ * @param column
4207
+ * @param value
4208
+ * @returns
4144
4209
  */
4145
4210
  orWhereJsonContains(column, value) {
4146
4211
  return this.constrain((query) => query.orWhereJsonContains(column, value));
4147
4212
  }
4148
4213
  /**
4149
4214
  * Add a negated JSON containment clause to the relationship query.
4150
- *
4151
- * @param column
4152
- * @param value
4153
- * @returns
4215
+ *
4216
+ * @param column
4217
+ * @param value
4218
+ * @returns
4154
4219
  */
4155
4220
  whereJsonDoesntContain(column, value) {
4156
4221
  return this.constrain((query) => query.whereJsonDoesntContain(column, value));
4157
4222
  }
4158
4223
  /**
4159
4224
  * OR variant of whereJsonDoesntContain().
4160
- *
4161
- * @param column
4162
- * @param value
4163
- * @returns
4225
+ *
4226
+ * @param column
4227
+ * @param value
4228
+ * @returns
4164
4229
  */
4165
4230
  orWhereJsonDoesntContain(column, value) {
4166
4231
  return this.constrain((query) => query.orWhereJsonDoesntContain(column, value));
4167
4232
  }
4168
4233
  /**
4169
4234
  * Add a JSON key-existence clause to the relationship query.
4170
- *
4171
- * @param column
4172
- * @param value
4173
- * @returns
4235
+ *
4236
+ * @param column
4237
+ * @param value
4238
+ * @returns
4174
4239
  */
4175
4240
  whereJsonContainsKey(column) {
4176
4241
  return this.constrain((query) => query.whereJsonContainsKey(column));
4177
4242
  }
4178
4243
  /**
4179
4244
  * OR variant of whereJsonContainsKey().
4180
- *
4181
- * @param column
4182
- * @returns
4245
+ *
4246
+ * @param column
4247
+ * @returns
4183
4248
  */
4184
4249
  orWhereJsonContainsKey(column) {
4185
4250
  return this.constrain((query) => query.orWhereJsonContainsKey(column));
4186
4251
  }
4187
4252
  /**
4188
4253
  * Add a negated JSON key-existence clause to the relationship query.
4189
- *
4190
- * @param column
4191
- * @returns
4254
+ *
4255
+ * @param column
4256
+ * @returns
4192
4257
  */
4193
4258
  whereJsonDoesntContainKey(column) {
4194
4259
  return this.constrain((query) => query.whereJsonDoesntContainKey(column));
4195
4260
  }
4196
4261
  /**
4197
4262
  * OR variant of whereJsonDoesntContainKey().
4198
- *
4199
- * @param column
4200
- * @returns
4263
+ *
4264
+ * @param column
4265
+ * @returns
4201
4266
  */
4202
4267
  orWhereJsonDoesntContainKey(column) {
4203
4268
  return this.constrain((query) => query.orWhereJsonDoesntContainKey(column));
@@ -4210,18 +4275,18 @@ var Relation = class {
4210
4275
  }
4211
4276
  /**
4212
4277
  * Add a JSON array overlap clause to the relationship query.
4213
- *
4214
- * @param column
4215
- * @param value
4278
+ *
4279
+ * @param column
4280
+ * @param value
4216
4281
  */
4217
4282
  whereJsonOverlaps(column, value) {
4218
4283
  return this.constrain((query) => query.whereJsonOverlaps(column, value));
4219
4284
  }
4220
4285
  /**
4221
4286
  * OR variant of whereJsonOverlaps().
4222
- *
4223
- * @param column
4224
- * @param value
4287
+ *
4288
+ * @param column
4289
+ * @param value
4225
4290
  */
4226
4291
  orWhereJsonOverlaps(column, value) {
4227
4292
  return this.constrain((query) => query.orWhereJsonOverlaps(column, value));
@@ -4448,9 +4513,9 @@ var Relation = class {
4448
4513
  }
4449
4514
  /**
4450
4515
  * Apply the defined constraint to the given query, if any.
4451
- *
4516
+ *
4452
4517
  * @param query The query builder instance to apply the constraint to.
4453
- *
4518
+ *
4454
4519
  * @returns The query builder instance with the constraint applied, if any.
4455
4520
  */
4456
4521
  applyConstraint(query) {
@@ -4477,18 +4542,18 @@ var Relation = class {
4477
4542
  }
4478
4543
  /**
4479
4544
  * Execute the relationship query and return the first related model or throw an error if not found.
4480
- *
4481
- * @returns
4545
+ *
4546
+ * @returns
4482
4547
  */
4483
4548
  async firstOrFail() {
4484
4549
  return (await this.getQuery()).firstOrFail();
4485
4550
  }
4486
4551
  /**
4487
- * Execute the relationship query and return the first related model or the result of
4552
+ * Execute the relationship query and return the first related model or the result of
4488
4553
  * the callback if not found.
4489
- *
4490
- * @param callback
4491
- * @returns
4554
+ *
4555
+ * @param callback
4556
+ * @returns
4492
4557
  */
4493
4558
  async firstOr(callback) {
4494
4559
  const result = await this.first();
@@ -4524,11 +4589,11 @@ var Relation = class {
4524
4589
  return !await this.exists();
4525
4590
  }
4526
4591
  /**
4527
- * Create a new instance of the related model with the given attributes and
4592
+ * Create a new instance of the related model with the given attributes and
4528
4593
  * relationship creation attributes applied, but do not save it.
4529
- *
4530
- * @param attributes
4531
- * @returns
4594
+ *
4595
+ * @param attributes
4596
+ * @returns
4532
4597
  */
4533
4598
  make(attributes = {}) {
4534
4599
  const model = this.getRelatedModelConstructor().hydrate(this.mergeCreationAttributes(attributes));
@@ -4536,31 +4601,31 @@ var Relation = class {
4536
4601
  return model;
4537
4602
  }
4538
4603
  /**
4539
- * Create new instances of the related model with the given attributes and relationship
4604
+ * Create new instances of the related model with the given attributes and relationship
4540
4605
  * creation attributes applied, but do not save them.
4541
- *
4542
- * @param attributes
4543
- * @returns
4606
+ *
4607
+ * @param attributes
4608
+ * @returns
4544
4609
  */
4545
4610
  makeMany(attributes = []) {
4546
4611
  return attributes.map((item) => this.make(item));
4547
4612
  }
4548
4613
  /**
4549
- * Create a new instance of the related model with the given attributes and relationship
4614
+ * Create a new instance of the related model with the given attributes and relationship
4550
4615
  * creation attributes applied, and save it to the database.
4551
- *
4552
- * @param attributes
4553
- * @returns
4616
+ *
4617
+ * @param attributes
4618
+ * @returns
4554
4619
  */
4555
4620
  async create(attributes = {}) {
4556
4621
  return await this.getRelatedModelConstructor().query().create(this.mergeCreationAttributes(attributes));
4557
4622
  }
4558
4623
  /**
4559
- * Create new instances of the related model with the given attributes and relationship
4624
+ * Create new instances of the related model with the given attributes and relationship
4560
4625
  * creation attributes applied, and save them to the database.
4561
- *
4562
- * @param values
4563
- * @returns
4626
+ *
4627
+ * @param values
4628
+ * @returns
4564
4629
  */
4565
4630
  async createMany(values = []) {
4566
4631
  if (values.length === 0) return [];
@@ -4568,9 +4633,9 @@ var Relation = class {
4568
4633
  }
4569
4634
  /**
4570
4635
  * Save the given model instance by applying relationship creation attributes and calling save() on it.
4571
- *
4572
- * @param model
4573
- * @returns
4636
+ *
4637
+ * @param model
4638
+ * @returns
4574
4639
  */
4575
4640
  async save(model) {
4576
4641
  const saveable = this.applyCreationAttributesToModel(model);
@@ -4584,11 +4649,11 @@ var Relation = class {
4584
4649
  }
4585
4650
  }
4586
4651
  /**
4587
- * Save the given model instance by applying relationship creation attributes and
4652
+ * Save the given model instance by applying relationship creation attributes and
4588
4653
  * calling saveQuietly() on it if supported, otherwise falling back to save().
4589
- *
4590
- * @param model
4591
- * @returns
4654
+ *
4655
+ * @param model
4656
+ * @returns
4592
4657
  */
4593
4658
  async saveQuietly(model) {
4594
4659
  const saveable = this.applyCreationAttributesToModel(model);
@@ -4606,21 +4671,21 @@ var Relation = class {
4606
4671
  return error instanceof Error && (error.name === "ModelNotFoundException" || error.message.includes("Record not found"));
4607
4672
  }
4608
4673
  /**
4609
- * Create new instances of the related model with the given attributes and
4674
+ * Create new instances of the related model with the given attributes and
4610
4675
  * relationship * creation attributes applied, and save them to the database.
4611
- *
4612
- * @param models
4613
- * @returns
4676
+ *
4677
+ * @param models
4678
+ * @returns
4614
4679
  */
4615
4680
  async saveMany(models = []) {
4616
4681
  return await Promise.all(models.map(async (model) => await this.save(model)));
4617
4682
  }
4618
4683
  /**
4619
- * Create new instances of the related model with the given attributes and relationship
4684
+ * Create new instances of the related model with the given attributes and relationship
4620
4685
  * creation attributes applied, and save them to the database.
4621
- *
4622
- * @param models
4623
- * @returns
4686
+ *
4687
+ * @param models
4688
+ * @returns
4624
4689
  */
4625
4690
  async saveManyQuietly(models = []) {
4626
4691
  return await Promise.all(models.map(async (model) => await this.saveQuietly(model)));
@@ -4644,10 +4709,10 @@ var Relation = class {
4644
4709
  }
4645
4710
  /**
4646
4711
  * Find the first related model by a specific key and value, or create a new instance if not found.
4647
- *
4648
- * @param attributes
4649
- * @param values
4650
- * @returns
4712
+ *
4713
+ * @param attributes
4714
+ * @param values
4715
+ * @returns
4651
4716
  */
4652
4717
  async firstOrNew(attributes, values = {}) {
4653
4718
  const found = await (await this.getQuery()).clone().where(attributes).first();
@@ -4658,12 +4723,12 @@ var Relation = class {
4658
4723
  });
4659
4724
  }
4660
4725
  /**
4661
- * Find the first related model by a specific key and value, or create and save a new instance
4726
+ * Find the first related model by a specific key and value, or create and save a new instance
4662
4727
  * if not found.
4663
- *
4664
- * @param attributes
4665
- * @param values
4666
- * @returns
4728
+ *
4729
+ * @param attributes
4730
+ * @param values
4731
+ * @returns
4667
4732
  */
4668
4733
  async firstOrCreate(attributes, values = {}) {
4669
4734
  const found = await (await this.getQuery()).clone().where(attributes).first();
@@ -4674,12 +4739,12 @@ var Relation = class {
4674
4739
  });
4675
4740
  }
4676
4741
  /**
4677
- * Find the first related model by a specific key and value, update the first matching record with
4742
+ * Find the first related model by a specific key and value, update the first matching record with
4678
4743
  * the given values, or create and save a new instance if no matching record is found.
4679
- *
4680
- * @param attributes
4681
- * @param values
4682
- * @returns
4744
+ *
4745
+ * @param attributes
4746
+ * @param values
4747
+ * @returns
4683
4748
  */
4684
4749
  async updateOrCreate(attributes, values = {}) {
4685
4750
  const query = await this.getQuery();
@@ -4693,35 +4758,35 @@ var Relation = class {
4693
4758
  return await query.clone().where(attributes).update(values);
4694
4759
  }
4695
4760
  /**
4696
- * Find related models by specific attributes, update matching records with the given values, or
4761
+ * Find related models by specific attributes, update matching records with the given values, or
4697
4762
  * create and save new instances if no matching records are found.
4698
- *
4699
- * @param values
4700
- * @param uniqueBy
4701
- * @param update
4702
- * @returns
4763
+ *
4764
+ * @param values
4765
+ * @param uniqueBy
4766
+ * @param update
4767
+ * @returns
4703
4768
  */
4704
4769
  async upsert(values, uniqueBy, update = null) {
4705
4770
  return await (await this.getQuery()).upsert(values.map((value) => this.mergeCreationAttributes(value)), uniqueBy, update);
4706
4771
  }
4707
4772
  /**
4708
4773
  * Paginate the relationship query results.
4709
- *
4710
- * @param perPage
4711
- * @param page
4712
- * @param options
4713
- * @returns
4774
+ *
4775
+ * @param perPage
4776
+ * @param page
4777
+ * @param options
4778
+ * @returns
4714
4779
  */
4715
4780
  async paginate(perPage = 15, page, options = {}) {
4716
4781
  return (await this.getQuery()).paginate(perPage, page, options);
4717
4782
  }
4718
4783
  /**
4719
4784
  * Paginate the relationship query results without total count optimization.
4720
- *
4721
- * @param perPage
4722
- * @param page
4723
- * @param options
4724
- * @returns
4785
+ *
4786
+ * @param perPage
4787
+ * @param page
4788
+ * @param options
4789
+ * @returns
4725
4790
  */
4726
4791
  async simplePaginate(perPage = 15, page, options = {}) {
4727
4792
  return (await this.getQuery()).simplePaginate(perPage, page, options);
@@ -4732,7 +4797,7 @@ var Relation = class {
4732
4797
  //#region src/relationship/BelongsToManyRelation.ts
4733
4798
  /**
4734
4799
  * Defines a many-to-many relationship.
4735
- *
4800
+ *
4736
4801
  * @author Legacy (3m1n3nc3)
4737
4802
  * @since 0.1.0
4738
4803
  */
@@ -4755,9 +4820,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4755
4820
  }
4756
4821
  /**
4757
4822
  * Specifies additional pivot columns to include on the related models.
4758
- *
4759
- * @param columns The pivot columns to include on the related models.
4760
- * @returns
4823
+ *
4824
+ * @param columns The pivot columns to include on the related models.
4825
+ * @returns
4761
4826
  */
4762
4827
  withPivot(...columns) {
4763
4828
  columns.flat().forEach((column) => {
@@ -4768,9 +4833,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4768
4833
  return this;
4769
4834
  }
4770
4835
  /**
4771
- * Specifies that the pivot table contains timestamp columns and optionally
4836
+ * Specifies that the pivot table contains timestamp columns and optionally
4772
4837
  * allows customizing the names of those columns.
4773
- *
4838
+ *
4774
4839
  * @param createdAtColumn The name of the "created at" timestamp column.
4775
4840
  * @param updatedAtColumn The name of the "updated at" timestamp column.
4776
4841
  * @returns The current instance of the relationship.
@@ -4781,10 +4846,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4781
4846
  return this.withPivot(createdAtColumn, updatedAtColumn);
4782
4847
  }
4783
4848
  /**
4784
- * Specifies a custom accessor name for the pivot attributes on the related models.
4785
- * By default, pivot attributes are accessible via the `pivot` property on the
4849
+ * Specifies a custom accessor name for the pivot attributes on the related models.
4850
+ * By default, pivot attributes are accessible via the `pivot` property on the
4786
4851
  * related models.
4787
- *
4852
+ *
4788
4853
  * @param accessor The custom accessor name for the pivot attributes.
4789
4854
  * @returns The current instance of the relationship.
4790
4855
  */
@@ -4796,10 +4861,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4796
4861
  return this;
4797
4862
  }
4798
4863
  /**
4799
- * Specifies a custom pivot model to use for the pivot records. The pivot model can
4800
- * be used to define custom behavior or methods on the pivot records, as well as to
4864
+ * Specifies a custom pivot model to use for the pivot records. The pivot model can
4865
+ * be used to define custom behavior or methods on the pivot records, as well as to
4801
4866
  * specify a custom hydration method for the pivot records.
4802
- *
4867
+ *
4803
4868
  * @param pivotModel The custom pivot model to use.
4804
4869
  * @returns The current instance of the relationship.
4805
4870
  */
@@ -4816,20 +4881,20 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4816
4881
  }
4817
4882
  /**
4818
4883
  * Adds a "pivot column in" condition to the relationship query.
4819
- *
4820
- * @param column
4821
- * @param values
4822
- * @returns
4884
+ *
4885
+ * @param column
4886
+ * @param values
4887
+ * @returns
4823
4888
  */
4824
4889
  wherePivotNotIn(column, values) {
4825
4890
  return this.addPivotWhere(this.makePivotComparison(column, "not-in", values));
4826
4891
  }
4827
4892
  /**
4828
4893
  * Adds a "pivot column between" condition to the relationship query.
4829
- *
4830
- * @param column
4831
- * @param range
4832
- * @returns
4894
+ *
4895
+ * @param column
4896
+ * @param range
4897
+ * @returns
4833
4898
  */
4834
4899
  wherePivotBetween(column, range) {
4835
4900
  return this.addPivotWhere({
@@ -4840,10 +4905,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4840
4905
  }
4841
4906
  /**
4842
4907
  * Adds a "pivot column not between" condition to the relationship query.
4843
- *
4844
- * @param column
4845
- * @param range
4846
- * @returns
4908
+ *
4909
+ * @param column
4910
+ * @param range
4911
+ * @returns
4847
4912
  */
4848
4913
  wherePivotNotBetween(column, range) {
4849
4914
  return this.addPivotWhere({
@@ -4857,18 +4922,18 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
4857
4922
  }
4858
4923
  /**
4859
4924
  * Adds a "pivot column is null" condition to the relationship query.
4860
- *
4861
- * @param column
4862
- * @returns
4925
+ *
4926
+ * @param column
4927
+ * @returns
4863
4928
  */
4864
4929
  wherePivotNull(column) {
4865
4930
  return this.addPivotWhere(this.makePivotComparison(column, "is-null"));
4866
4931
  }
4867
4932
  /**
4868
4933
  * Adds a "pivot column is not null" condition to the relationship query.
4869
- *
4870
- * @param column
4871
- * @returns
4934
+ *
4935
+ * @param column
4936
+ * @returns
4872
4937
  */
4873
4938
  wherePivotNotNull(column) {
4874
4939
  return this.addPivotWhere(this.makePivotComparison(column, "is-not-null"));
@@ -5068,9 +5133,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5068
5133
  return rows.length;
5069
5134
  }
5070
5135
  /**
5071
- * Creates a new instance of the related model with the given attributes and attaches
5136
+ * Creates a new instance of the related model with the given attributes and attaches
5072
5137
  * pivot attributes if pivot attributes should be included.
5073
- *
5138
+ *
5074
5139
  * @param attributes The attributes to initialize the related model with.
5075
5140
  * @returns A new instance of the related model.
5076
5141
  */
@@ -5078,10 +5143,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5078
5143
  return this.related.hydrate(attributes);
5079
5144
  }
5080
5145
  /**
5081
- * Creates a new related model record with the given attributes, creates a pivot record
5082
- * with the given pivot attributes, and attaches pivot attributes if pivot attributes
5146
+ * Creates a new related model record with the given attributes, creates a pivot record
5147
+ * with the given pivot attributes, and attaches pivot attributes if pivot attributes
5083
5148
  * should be included.
5084
- *
5149
+ *
5085
5150
  * @param attributes The attributes to initialize the related model with.
5086
5151
  * @param pivotAttributes The attributes to initialize the pivot record with.
5087
5152
  * @returns A new instance of the related model with pivot attributes attached.
@@ -5093,10 +5158,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5093
5158
  return this.attachPivotToSingleResult(related, pivotRow);
5094
5159
  }
5095
5160
  /**
5096
- * Saves a related model record, creates a pivot record with the given pivot attributes
5097
- * if the related model was not previously persisted, and attaches pivot attributes if
5161
+ * Saves a related model record, creates a pivot record with the given pivot attributes
5162
+ * if the related model was not previously persisted, and attaches pivot attributes if
5098
5163
  * pivot attributes should be included.
5099
- *
5164
+ *
5100
5165
  * @param related The related model instance to save.
5101
5166
  * @param pivotAttributes The attributes to initialize the pivot record with.
5102
5167
  * @returns A new instance of the related model with pivot attributes attached.
@@ -5116,9 +5181,9 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5116
5181
  return this.attachPivotToSingleResult(persisted, pivotRow);
5117
5182
  }
5118
5183
  /**
5119
- * Attaches one or more related model records to the parent model by creating pivot
5184
+ * Attaches one or more related model records to the parent model by creating pivot
5120
5185
  * records with the given pivot attributes if pivot attributes should be included.
5121
- *
5186
+ *
5122
5187
  * @param related The related model instance(s) to attach.
5123
5188
  * @param pivotAttributes The attributes to initialize the pivot record with.
5124
5189
  * @returns The number of related model records attached.
@@ -5201,7 +5266,7 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5201
5266
  }
5202
5267
  /**
5203
5268
  * Creates a pivot record from a row of data.
5204
- *
5269
+ *
5205
5270
  * @param row The row of data containing pivot attributes.
5206
5271
  * @returns The pivot record.
5207
5272
  */
@@ -5216,10 +5281,10 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5216
5281
  }
5217
5282
  /**
5218
5283
  * Attaches pivot attributes to the related models if pivot attributes should be included.
5219
- *
5220
- * @param results
5221
- * @param pivotRows
5222
- * @returns
5284
+ *
5285
+ * @param results
5286
+ * @param pivotRows
5287
+ * @returns
5223
5288
  */
5224
5289
  attachPivotToResults(results, pivotRows) {
5225
5290
  if (!this.shouldAttachPivotAttributes()) return results;
@@ -5311,8 +5376,8 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5311
5376
  }
5312
5377
  /**
5313
5378
  * Fetches the related models for this relationship.
5314
- *
5315
- * @returns
5379
+ *
5380
+ * @returns
5316
5381
  */
5317
5382
  async getResults() {
5318
5383
  return (await this.getQuery()).get();
@@ -5323,7 +5388,7 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
5323
5388
  //#region src/relationship/SingleResultRelation.ts
5324
5389
  /**
5325
5390
  * Base class for relationships that resolve to a single related model.
5326
- *
5391
+ *
5327
5392
  * @author Legacy (3m1n3nc3)
5328
5393
  * @since 1.3.0
5329
5394
  */
@@ -5335,7 +5400,7 @@ var SingleResultRelation = class extends Relation {
5335
5400
  }
5336
5401
  /**
5337
5402
  * Defines a default value to return when the relationship does not find a related model.
5338
- *
5403
+ *
5339
5404
  * @param value The default value or a callback that returns the default value.
5340
5405
  * @returns The current instance for method chaining.
5341
5406
  */
@@ -5355,7 +5420,7 @@ var SingleResultRelation = class extends Relation {
5355
5420
  //#region src/relationship/BelongsToRelation.ts
5356
5421
  /**
5357
5422
  * Defines an inverse one-to-one or many relationship.
5358
- *
5423
+ *
5359
5424
  * @author Legacy (3m1n3nc3)
5360
5425
  * @since 0.1.0
5361
5426
  */
@@ -5384,8 +5449,8 @@ var BelongsToRelation = class extends SingleResultRelation {
5384
5449
  }
5385
5450
  /**
5386
5451
  * Fetches the related models for this relationship.
5387
- *
5388
- * @returns
5452
+ *
5453
+ * @returns
5389
5454
  */
5390
5455
  async getResults() {
5391
5456
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5396,7 +5461,7 @@ var BelongsToRelation = class extends SingleResultRelation {
5396
5461
  //#region src/relationship/HasManyRelation.ts
5397
5462
  /**
5398
5463
  * Defines a one-to-many relationship.
5399
- *
5464
+ *
5400
5465
  * @author Legacy (3m1n3nc3)
5401
5466
  * @since 0.1.0
5402
5467
  */
@@ -5430,8 +5495,8 @@ var HasManyRelation = class extends Relation {
5430
5495
  }
5431
5496
  /**
5432
5497
  * Fetches the related models for this relationship.
5433
- *
5434
- * @returns
5498
+ *
5499
+ * @returns
5435
5500
  */
5436
5501
  async getResults() {
5437
5502
  return (await this.getQuery()).get();
@@ -5441,9 +5506,9 @@ var HasManyRelation = class extends Relation {
5441
5506
  //#endregion
5442
5507
  //#region src/relationship/HasManyThroughRelation.ts
5443
5508
  /**
5444
- * Defines a has-many-through relationship, which provides a convenient way to access
5445
- * distant relations via an intermediate relation.
5446
- *
5509
+ * Defines a has-many-through relationship, which provides a convenient way to access
5510
+ * distant relations via an intermediate relation.
5511
+ *
5447
5512
  * @author Legacy (3m1n3nc3)
5448
5513
  * @since 0.1.0
5449
5514
  */
@@ -5492,8 +5557,8 @@ var HasManyThroughRelation = class extends Relation {
5492
5557
  }
5493
5558
  /**
5494
5559
  * Fetches the related models for this relationship.
5495
- *
5496
- * @returns
5560
+ *
5561
+ * @returns
5497
5562
  */
5498
5563
  async getResults() {
5499
5564
  return (await this.getQuery()).get();
@@ -5504,7 +5569,7 @@ var HasManyThroughRelation = class extends Relation {
5504
5569
  //#region src/relationship/HasOneRelation.ts
5505
5570
  /**
5506
5571
  * Represents a "has one" relationship between two models.
5507
- *
5572
+ *
5508
5573
  * @author Legacy (3m1n3nc3)
5509
5574
  * @since 0.1.0
5510
5575
  */
@@ -5536,8 +5601,8 @@ var HasOneRelation = class extends SingleResultRelation {
5536
5601
  }
5537
5602
  /**
5538
5603
  * Fetches the related models for this relationship.
5539
- *
5540
- * @returns
5604
+ *
5605
+ * @returns
5541
5606
  */
5542
5607
  async getResults() {
5543
5608
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5547,9 +5612,9 @@ var HasOneRelation = class extends SingleResultRelation {
5547
5612
  //#endregion
5548
5613
  //#region src/relationship/HasOneThroughRelation.ts
5549
5614
  /**
5550
- * Represents a "has one through" relationship, where the parent model is related
5615
+ * Represents a "has one through" relationship, where the parent model is related
5551
5616
  * to exactly one instance of the related model through an intermediate model.
5552
- *
5617
+ *
5553
5618
  * @author Legacy (3m1n3nc3)
5554
5619
  * @since 0.1.0
5555
5620
  */
@@ -5597,8 +5662,8 @@ var HasOneThroughRelation = class extends SingleResultRelation {
5597
5662
  }
5598
5663
  /**
5599
5664
  * Fetches the related models for this relationship.
5600
- *
5601
- * @returns
5665
+ *
5666
+ * @returns
5602
5667
  */
5603
5668
  async getResults() {
5604
5669
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5608,8 +5673,8 @@ var HasOneThroughRelation = class extends SingleResultRelation {
5608
5673
  //#endregion
5609
5674
  //#region src/relationship/MorphManyRelation.ts
5610
5675
  /**
5611
- * Defines a polymorphic one-to-many relationship.
5612
- *
5676
+ * Defines a polymorphic one-to-many relationship.
5677
+ *
5613
5678
  * @author Legacy (3m1n3nc3)
5614
5679
  * @since 0.1.0
5615
5680
  */
@@ -5654,8 +5719,8 @@ var MorphManyRelation = class extends Relation {
5654
5719
  }
5655
5720
  /**
5656
5721
  * Fetches the related models for this relationship.
5657
- *
5658
- * @returns
5722
+ *
5723
+ * @returns
5659
5724
  */
5660
5725
  async getResults() {
5661
5726
  return (await this.getQuery()).get();
@@ -5666,7 +5731,7 @@ var MorphManyRelation = class extends Relation {
5666
5731
  //#region src/relationship/MorphOneRelation.ts
5667
5732
  /**
5668
5733
  * Defines a polymorphic one-to-one relationship.
5669
- *
5734
+ *
5670
5735
  * @author Legacy (3m1n3nc3)
5671
5736
  * @since 0.1.0
5672
5737
  */
@@ -5709,8 +5774,8 @@ var MorphOneRelation = class extends SingleResultRelation {
5709
5774
  }
5710
5775
  /**
5711
5776
  * Fetches the related models for this relationship.
5712
- *
5713
- * @returns
5777
+ *
5778
+ * @returns
5714
5779
  */
5715
5780
  async getResults() {
5716
5781
  return await (await this.getQuery()).first() ?? this.resolveDefaultResult();
@@ -5720,8 +5785,8 @@ var MorphOneRelation = class extends SingleResultRelation {
5720
5785
  //#endregion
5721
5786
  //#region src/relationship/MorphToManyRelation.ts
5722
5787
  /**
5723
- * Defines a polymorphic many-to-many relationship.
5724
- *
5788
+ * Defines a polymorphic many-to-many relationship.
5789
+ *
5725
5790
  * @author Legacy (3m1n3nc3)
5726
5791
  * @since 0.1.0
5727
5792
  */
@@ -5784,8 +5849,8 @@ var MorphToManyRelation = class extends Relation {
5784
5849
  }
5785
5850
  /**
5786
5851
  * Fetches the related models for this relationship.
5787
- *
5788
- * @returns
5852
+ *
5853
+ * @returns
5789
5854
  */
5790
5855
  async getResults() {
5791
5856
  return (await this.getQuery()).get();