arkormx 2.9.1 → 2.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -24
- package/dist/cli.mjs +461 -337
- package/dist/{index-18M5gEFk.d.cts → index-BFNEyqme.d.cts} +77 -13
- package/dist/{index-CFXreeV7.d.mts → index-EVK8EOKN.d.mts} +77 -13
- package/dist/index.cjs +550 -516
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +550 -516
- package/dist/relationship/index.cjs +1 -1
- package/dist/relationship/index.d.cts +1 -1
- package/dist/relationship/index.d.mts +1 -1
- package/dist/relationship/index.mjs +1 -1
- package/dist/{relationship-DtNgcxxv.mjs → relationship-BD04hN72.mjs} +614 -549
- package/dist/{relationship-BVYP9lU2.cjs → relationship-DhdzLnKH.cjs} +614 -549
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_relationship = require('./relationship-
|
|
2
|
+
const require_relationship = require('./relationship-DhdzLnKH.cjs');
|
|
3
3
|
let pg = require("pg");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
let module$1 = require("module");
|
|
@@ -34,9 +34,9 @@ var QueryExecutionException = class extends require_relationship.ArkormException
|
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/adapters/KyselyDatabaseAdapter.ts
|
|
36
36
|
/**
|
|
37
|
-
* Database adapter implementation for Kysely, allowing Arkorm to execute queries using Kysely
|
|
37
|
+
* Database adapter implementation for Kysely, allowing Arkorm to execute queries using Kysely
|
|
38
38
|
* as the underlying query builder and executor.
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* @author Legacy (3m1n3nc3)
|
|
41
41
|
* @since 2.0.0-next.0
|
|
42
42
|
*/
|
|
@@ -1084,9 +1084,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
/**
|
|
1087
|
-
* Selects records from the database matching the specified criteria and returns
|
|
1087
|
+
* Selects records from the database matching the specified criteria and returns
|
|
1088
1088
|
* them as an array of database rows.
|
|
1089
|
-
*
|
|
1089
|
+
*
|
|
1090
1090
|
* @param spec The specification defining the selection criteria.
|
|
1091
1091
|
* @returns A promise that resolves to an array of database rows.
|
|
1092
1092
|
*/
|
|
@@ -1104,10 +1104,10 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1104
1104
|
});
|
|
1105
1105
|
}
|
|
1106
1106
|
/**
|
|
1107
|
-
* Selects a single record from the database matching the specified criteria and returns it as
|
|
1108
|
-
* a database row. If multiple records match the criteria, only the first one is returned.
|
|
1107
|
+
* Selects a single record from the database matching the specified criteria and returns it as
|
|
1108
|
+
* a database row. If multiple records match the criteria, only the first one is returned.
|
|
1109
1109
|
* If no records match, null is returned.
|
|
1110
|
-
*
|
|
1110
|
+
*
|
|
1111
1111
|
* @param spec The specification defining the selection criteria.
|
|
1112
1112
|
* @returns A promise that resolves to a database row or null if no records match.
|
|
1113
1113
|
*/
|
|
@@ -1118,11 +1118,11 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1118
1118
|
}))[0] ?? null;
|
|
1119
1119
|
}
|
|
1120
1120
|
/**
|
|
1121
|
-
* Inserts a new record into the database with the specified values and returns the
|
|
1121
|
+
* Inserts a new record into the database with the specified values and returns the
|
|
1122
1122
|
* inserted record as a database row.
|
|
1123
|
-
*
|
|
1124
|
-
* @param spec
|
|
1125
|
-
* @returns
|
|
1123
|
+
*
|
|
1124
|
+
* @param spec
|
|
1125
|
+
* @returns
|
|
1126
1126
|
*/
|
|
1127
1127
|
async insert(spec) {
|
|
1128
1128
|
const values = this.mapValues(spec.target, spec.values);
|
|
@@ -1141,9 +1141,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1141
1141
|
}, { values: spec.values });
|
|
1142
1142
|
}
|
|
1143
1143
|
/**
|
|
1144
|
-
* Inserts multiple records into the database with the specified values and returns the number
|
|
1145
|
-
* of records successfully inserted.
|
|
1146
|
-
*
|
|
1144
|
+
* Inserts multiple records into the database with the specified values and returns the number
|
|
1145
|
+
* of records successfully inserted.
|
|
1146
|
+
*
|
|
1147
1147
|
* @param spec The specification defining the values to be inserted.
|
|
1148
1148
|
* @returns A promise that resolves to the number of records successfully inserted.
|
|
1149
1149
|
*/
|
|
@@ -1214,11 +1214,11 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1214
1214
|
return spec.values.length;
|
|
1215
1215
|
}
|
|
1216
1216
|
/**
|
|
1217
|
-
* Updates records in the database matching the specified criteria with the given values
|
|
1218
|
-
* and returns the updated record as a database row.
|
|
1219
|
-
*
|
|
1217
|
+
* Updates records in the database matching the specified criteria with the given values
|
|
1218
|
+
* and returns the updated record as a database row.
|
|
1219
|
+
*
|
|
1220
1220
|
* @param spec The specification defining the update criteria and values.
|
|
1221
|
-
* @returns A promise that resolves to the updated record as a database row, or null if no records match the criteria.
|
|
1221
|
+
* @returns A promise that resolves to the updated record as a database row, or null if no records match the criteria.
|
|
1222
1222
|
*/
|
|
1223
1223
|
async update(spec) {
|
|
1224
1224
|
const values = this.mapValues(spec.target, spec.values);
|
|
@@ -1245,9 +1245,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
/**
|
|
1247
1247
|
* Updates a single record in the database matching the specified criteria with the given values.
|
|
1248
|
-
*
|
|
1249
|
-
* @param spec
|
|
1250
|
-
* @returns
|
|
1248
|
+
*
|
|
1249
|
+
* @param spec
|
|
1250
|
+
* @returns
|
|
1251
1251
|
*/
|
|
1252
1252
|
async updateFirst(spec) {
|
|
1253
1253
|
const values = this.mapValues(spec.target, spec.values);
|
|
@@ -1277,9 +1277,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1277
1277
|
});
|
|
1278
1278
|
}
|
|
1279
1279
|
/**
|
|
1280
|
-
* Updates multiple records in the database matching the specified criteria with the
|
|
1280
|
+
* Updates multiple records in the database matching the specified criteria with the
|
|
1281
1281
|
* given values and returns the number of records successfully updated.
|
|
1282
|
-
*
|
|
1282
|
+
*
|
|
1283
1283
|
* @param spec The specification defining the update criteria and values.
|
|
1284
1284
|
* @returns A promise that resolves to the number of records successfully updated.
|
|
1285
1285
|
*/
|
|
@@ -1301,9 +1301,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1301
1301
|
});
|
|
1302
1302
|
}
|
|
1303
1303
|
/**
|
|
1304
|
-
* Deletes records from the database matching the specified criteria and returns the
|
|
1304
|
+
* Deletes records from the database matching the specified criteria and returns the
|
|
1305
1305
|
* deleted record as a database row.
|
|
1306
|
-
*
|
|
1306
|
+
*
|
|
1307
1307
|
* @param spec The specification defining the delete criteria.
|
|
1308
1308
|
* @returns A promise that resolves to the deleted record as a database row, or null if no records match the criteria.
|
|
1309
1309
|
*/
|
|
@@ -1319,9 +1319,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1319
1319
|
}
|
|
1320
1320
|
/**
|
|
1321
1321
|
* Deletes a single record from the database matching the specified criteria and returns it as a database row.
|
|
1322
|
-
*
|
|
1323
|
-
* @param spec
|
|
1324
|
-
* @returns
|
|
1322
|
+
*
|
|
1323
|
+
* @param spec
|
|
1324
|
+
* @returns
|
|
1325
1325
|
*/
|
|
1326
1326
|
async deleteFirst(spec) {
|
|
1327
1327
|
const primaryKey = this.resolvePrimaryKey(spec.target);
|
|
@@ -1338,9 +1338,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1338
1338
|
}, { where: spec.where });
|
|
1339
1339
|
}
|
|
1340
1340
|
/**
|
|
1341
|
-
* Deletes multiple records from the database matching the specified criteria and
|
|
1341
|
+
* Deletes multiple records from the database matching the specified criteria and
|
|
1342
1342
|
* returns the number of records successfully deleted.
|
|
1343
|
-
*
|
|
1343
|
+
*
|
|
1344
1344
|
* @param spec The specification defining the delete criteria.
|
|
1345
1345
|
* @returns A promise that resolves to the number of records successfully deleted.
|
|
1346
1346
|
*/
|
|
@@ -1353,9 +1353,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1353
1353
|
return await this.executeWithDebug("deleteMany", spec.target, statement, (rows) => rows.length, { where: spec.where });
|
|
1354
1354
|
}
|
|
1355
1355
|
/**
|
|
1356
|
-
* Counts the number of records in the database matching the specified criteria and returns
|
|
1356
|
+
* Counts the number of records in the database matching the specified criteria and returns
|
|
1357
1357
|
* the count as a number.
|
|
1358
|
-
*
|
|
1358
|
+
*
|
|
1359
1359
|
* @param spec The specification defining the count criteria.
|
|
1360
1360
|
* @returns A promise that resolves to the number of records matching the criteria.
|
|
1361
1361
|
*/
|
|
@@ -1369,7 +1369,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
/**
|
|
1371
1371
|
* Checks for the existence of records matching the specified criteria.
|
|
1372
|
-
*
|
|
1372
|
+
*
|
|
1373
1373
|
* @param spec The specification defining the existence criteria.
|
|
1374
1374
|
* @returns A promise that resolves to a boolean indicating whether any records match the criteria.
|
|
1375
1375
|
*/
|
|
@@ -1383,9 +1383,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
/**
|
|
1385
1385
|
* Loads relations for the given models based on the specified relation load plans.
|
|
1386
|
-
*
|
|
1386
|
+
*
|
|
1387
1387
|
* @param spec The specification defining the models and their relations to be loaded.
|
|
1388
|
-
* @returns
|
|
1388
|
+
* @returns
|
|
1389
1389
|
*/
|
|
1390
1390
|
async loadRelations(spec) {
|
|
1391
1391
|
if (spec.models.length === 0 || spec.relations.length === 0) return;
|
|
@@ -1521,10 +1521,10 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1521
1521
|
});
|
|
1522
1522
|
}
|
|
1523
1523
|
/**
|
|
1524
|
-
* Executes a series of database operations within a transaction.
|
|
1525
|
-
* The provided callback function is called with a new instance of the
|
|
1524
|
+
* Executes a series of database operations within a transaction.
|
|
1525
|
+
* The provided callback function is called with a new instance of the
|
|
1526
1526
|
* KyselyDatabaseAdapter that is bound to the transaction context.
|
|
1527
|
-
*
|
|
1527
|
+
*
|
|
1528
1528
|
* @param callback The callback function containing the database operations to be executed within the transaction.
|
|
1529
1529
|
* @param context The transaction context specifying options such as read-only mode and isolation level.
|
|
1530
1530
|
* @returns A promise that resolves to the result of the callback function.
|
|
@@ -1539,12 +1539,12 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
};
|
|
1541
1541
|
/**
|
|
1542
|
-
* Factory function to create a KyselyDatabaseAdapter instance with the given Kysely executor
|
|
1542
|
+
* Factory function to create a KyselyDatabaseAdapter instance with the given Kysely executor
|
|
1543
1543
|
* and optional table name mapping.
|
|
1544
|
-
*
|
|
1544
|
+
*
|
|
1545
1545
|
* @param db The Kysely executor to be used by the adapter.
|
|
1546
1546
|
* @param mapping Optional table name mapping for the adapter.
|
|
1547
|
-
* @returns A new instance of KyselyDatabaseAdapter.
|
|
1547
|
+
* @returns A new instance of KyselyDatabaseAdapter.
|
|
1548
1548
|
*/
|
|
1549
1549
|
const createKyselyAdapter = (db, mapping = {}) => {
|
|
1550
1550
|
return new KyselyDatabaseAdapter(db, mapping);
|
|
@@ -1603,7 +1603,7 @@ function createPrismaDelegateMap(prisma, mapping = {}) {
|
|
|
1603
1603
|
}
|
|
1604
1604
|
/**
|
|
1605
1605
|
* Infer the Prisma delegate name for a given model name using a simple convention.
|
|
1606
|
-
*
|
|
1606
|
+
*
|
|
1607
1607
|
* @param modelName The name of the model to infer the delegate name for.
|
|
1608
1608
|
* @returns The inferred Prisma delegate name.
|
|
1609
1609
|
*/
|
|
@@ -1614,9 +1614,9 @@ function inferDelegateName(modelName) {
|
|
|
1614
1614
|
//#endregion
|
|
1615
1615
|
//#region src/adapters/PrismaDatabaseAdapter.ts
|
|
1616
1616
|
/**
|
|
1617
|
-
* Database adapter implementation for Prisma, allowing Arkorm to execute queries using Prisma
|
|
1617
|
+
* Database adapter implementation for Prisma, allowing Arkorm to execute queries using Prisma
|
|
1618
1618
|
* as the underlying query builder and executor.
|
|
1619
|
-
*
|
|
1619
|
+
*
|
|
1620
1620
|
* @author Legacy (3m1n3nc3)
|
|
1621
1621
|
* @since 2.0.0-next.0
|
|
1622
1622
|
*/
|
|
@@ -1885,9 +1885,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1885
1885
|
* Prisma include/select arguments, but the adapter does not advertise the
|
|
1886
1886
|
* adapter-owned batch relation load seam. QueryBuilder eager loads therefore stay
|
|
1887
1887
|
* on Arkorm's generic relation loader on the Prisma compatibility path.
|
|
1888
|
-
*
|
|
1889
|
-
* @param spec
|
|
1890
|
-
* @returns
|
|
1888
|
+
*
|
|
1889
|
+
* @param spec
|
|
1890
|
+
* @returns
|
|
1891
1891
|
*/
|
|
1892
1892
|
async select(spec) {
|
|
1893
1893
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -1897,10 +1897,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1897
1897
|
}, { args });
|
|
1898
1898
|
}
|
|
1899
1899
|
/**
|
|
1900
|
-
* Selects a single record matching the specified criteria.
|
|
1901
|
-
*
|
|
1902
|
-
* @param spec
|
|
1903
|
-
* @returns
|
|
1900
|
+
* Selects a single record matching the specified criteria.
|
|
1901
|
+
*
|
|
1902
|
+
* @param spec
|
|
1903
|
+
* @returns
|
|
1904
1904
|
*/
|
|
1905
1905
|
async selectOne(spec) {
|
|
1906
1906
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -1911,9 +1911,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1911
1911
|
}
|
|
1912
1912
|
/**
|
|
1913
1913
|
* Inserts a single record into the database and returns the created record.
|
|
1914
|
-
*
|
|
1915
|
-
* @param spec
|
|
1916
|
-
* @returns
|
|
1914
|
+
*
|
|
1915
|
+
* @param spec
|
|
1916
|
+
* @returns
|
|
1917
1917
|
*/
|
|
1918
1918
|
async insert(spec) {
|
|
1919
1919
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -1922,10 +1922,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1922
1922
|
}, { values: spec.values });
|
|
1923
1923
|
}
|
|
1924
1924
|
/**
|
|
1925
|
-
* Inserts multiple records into the database.
|
|
1926
|
-
*
|
|
1927
|
-
* @param spec
|
|
1928
|
-
* @returns
|
|
1925
|
+
* Inserts multiple records into the database.
|
|
1926
|
+
*
|
|
1927
|
+
* @param spec
|
|
1928
|
+
* @returns
|
|
1929
1929
|
*/
|
|
1930
1930
|
async insertMany(spec) {
|
|
1931
1931
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -1954,9 +1954,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1954
1954
|
}
|
|
1955
1955
|
/**
|
|
1956
1956
|
* Updates a single record matching the specified criteria and returns the updated record.
|
|
1957
|
-
*
|
|
1958
|
-
* @param spec
|
|
1959
|
-
* @returns
|
|
1957
|
+
*
|
|
1958
|
+
* @param spec
|
|
1959
|
+
* @returns
|
|
1960
1960
|
*/
|
|
1961
1961
|
async update(spec) {
|
|
1962
1962
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -1973,10 +1973,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1973
1973
|
});
|
|
1974
1974
|
}
|
|
1975
1975
|
/**
|
|
1976
|
-
* Updates multiple records matching the specified criteria.
|
|
1977
|
-
*
|
|
1978
|
-
* @param spec
|
|
1979
|
-
* @returns
|
|
1976
|
+
* Updates multiple records matching the specified criteria.
|
|
1977
|
+
*
|
|
1978
|
+
* @param spec
|
|
1979
|
+
* @returns
|
|
1980
1980
|
*/
|
|
1981
1981
|
async updateMany(spec) {
|
|
1982
1982
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -2006,9 +2006,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
/**
|
|
2008
2008
|
* Deletes a single record matching the specified criteria and returns the deleted record.
|
|
2009
|
-
*
|
|
2010
|
-
* @param spec
|
|
2011
|
-
* @returns
|
|
2009
|
+
*
|
|
2010
|
+
* @param spec
|
|
2011
|
+
* @returns
|
|
2012
2012
|
*/
|
|
2013
2013
|
async delete(spec) {
|
|
2014
2014
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -2019,10 +2019,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2019
2019
|
}, { where });
|
|
2020
2020
|
}
|
|
2021
2021
|
/**
|
|
2022
|
-
* Deletes multiple records matching the specified criteria.
|
|
2023
|
-
*
|
|
2024
|
-
* @param spec
|
|
2025
|
-
* @returns
|
|
2022
|
+
* Deletes multiple records matching the specified criteria.
|
|
2023
|
+
*
|
|
2024
|
+
* @param spec
|
|
2025
|
+
* @returns
|
|
2026
2026
|
*/
|
|
2027
2027
|
async deleteMany(spec) {
|
|
2028
2028
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -2037,9 +2037,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2037
2037
|
}
|
|
2038
2038
|
/**
|
|
2039
2039
|
* Counts the number of records matching the specified criteria.
|
|
2040
|
-
*
|
|
2041
|
-
* @param spec
|
|
2042
|
-
* @returns
|
|
2040
|
+
*
|
|
2041
|
+
* @param spec
|
|
2042
|
+
* @returns
|
|
2043
2043
|
*/
|
|
2044
2044
|
async count(spec) {
|
|
2045
2045
|
const delegate = this.resolveDelegate(spec.target);
|
|
@@ -2050,9 +2050,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2050
2050
|
}
|
|
2051
2051
|
/**
|
|
2052
2052
|
* Checks for the existence of records matching the specified criteria.
|
|
2053
|
-
*
|
|
2054
|
-
* @param spec
|
|
2055
|
-
* @returns
|
|
2053
|
+
*
|
|
2054
|
+
* @param spec
|
|
2055
|
+
* @returns
|
|
2056
2056
|
*/
|
|
2057
2057
|
async exists(spec) {
|
|
2058
2058
|
return await this.selectOne({
|
|
@@ -2062,8 +2062,8 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2062
2062
|
}
|
|
2063
2063
|
/**
|
|
2064
2064
|
* Loads related models for a batch of parent records based on the specified relation load plans.
|
|
2065
|
-
*
|
|
2066
|
-
* @param _spec
|
|
2065
|
+
*
|
|
2066
|
+
* @param _spec
|
|
2067
2067
|
*/
|
|
2068
2068
|
async loadRelations(_spec) {
|
|
2069
2069
|
throw new require_relationship.UnsupportedAdapterFeatureException("Adapter-owned relation batch loading is intentionally unavailable on the Prisma compatibility adapter; eager loading stays on Arkorm's generic loader for this path.", {
|
|
@@ -2072,12 +2072,12 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2072
2072
|
});
|
|
2073
2073
|
}
|
|
2074
2074
|
/**
|
|
2075
|
-
* Executes a series of database operations within a transaction.
|
|
2075
|
+
* Executes a series of database operations within a transaction.
|
|
2076
2076
|
* If the underlying Prisma client does not support transactions, an exception is thrown.
|
|
2077
|
-
*
|
|
2078
|
-
* @param callback
|
|
2079
|
-
* @param context
|
|
2080
|
-
* @returns
|
|
2077
|
+
*
|
|
2078
|
+
* @param callback
|
|
2079
|
+
* @param context
|
|
2080
|
+
* @returns
|
|
2081
2081
|
*/
|
|
2082
2082
|
async transaction(callback, context = {}) {
|
|
2083
2083
|
if (!this.hasTransactionSupport(this.prisma)) throw new require_relationship.UnsupportedAdapterFeatureException("Transactions are not supported by the Prisma compatibility adapter.", {
|
|
@@ -2094,9 +2094,9 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2094
2094
|
}
|
|
2095
2095
|
};
|
|
2096
2096
|
/**
|
|
2097
|
-
* Factory function to create a PrismaDatabaseAdapter instance with the given
|
|
2097
|
+
* Factory function to create a PrismaDatabaseAdapter instance with the given
|
|
2098
2098
|
* Prisma client and optional delegate name mapping.
|
|
2099
|
-
*
|
|
2099
|
+
*
|
|
2100
2100
|
* @param prisma The Prisma client instance to be used by the adapter.
|
|
2101
2101
|
* @param mapping Optional mapping of delegate names.
|
|
2102
2102
|
* @returns A new instance of PrismaDatabaseAdapter.
|
|
@@ -2105,9 +2105,9 @@ const createPrismaDatabaseAdapter = (prisma, mapping = {}) => {
|
|
|
2105
2105
|
return new PrismaDatabaseAdapter(prisma, mapping);
|
|
2106
2106
|
};
|
|
2107
2107
|
/**
|
|
2108
|
-
* Alias for createPrismaDatabaseAdapter to maintain backward compatibility with
|
|
2108
|
+
* Alias for createPrismaDatabaseAdapter to maintain backward compatibility with
|
|
2109
2109
|
* previous versions of Arkorm that exported the adapter factory under a different name.
|
|
2110
|
-
*
|
|
2110
|
+
*
|
|
2111
2111
|
* @param prisma The Prisma client instance to be used by the adapter.
|
|
2112
2112
|
* @param mapping Optional mapping of delegate names.
|
|
2113
2113
|
* @returns A new instance of PrismaDatabaseAdapter.
|
|
@@ -2137,10 +2137,10 @@ var Arkorm = class Arkorm {
|
|
|
2137
2137
|
}
|
|
2138
2138
|
/**
|
|
2139
2139
|
* Configure the ArkORM runtime with the provided runtime client resolver and adapter-first options.
|
|
2140
|
-
*
|
|
2141
|
-
* @param client
|
|
2142
|
-
* @param options
|
|
2143
|
-
* @returns
|
|
2140
|
+
*
|
|
2141
|
+
* @param client
|
|
2142
|
+
* @param options
|
|
2143
|
+
* @returns
|
|
2144
2144
|
*/
|
|
2145
2145
|
static configure(options, client) {
|
|
2146
2146
|
return require_relationship.configureArkormRuntime(client, options);
|
|
@@ -2157,113 +2157,113 @@ var Arkorm = class Arkorm {
|
|
|
2157
2157
|
}
|
|
2158
2158
|
/**
|
|
2159
2159
|
* Register migration constructors directly without relying on runtime discovery.
|
|
2160
|
-
*
|
|
2161
|
-
* @param migrations
|
|
2162
|
-
* @returns
|
|
2160
|
+
*
|
|
2161
|
+
* @param migrations
|
|
2162
|
+
* @returns
|
|
2163
2163
|
*/
|
|
2164
2164
|
static registerMigrations(...migrations) {
|
|
2165
2165
|
return require_relationship.registerMigrations(...migrations);
|
|
2166
2166
|
}
|
|
2167
2167
|
/**
|
|
2168
2168
|
* Register seeder constructors directly without relying on runtime discovery.
|
|
2169
|
-
*
|
|
2170
|
-
* @param seeders
|
|
2171
|
-
* @returns
|
|
2169
|
+
*
|
|
2170
|
+
* @param seeders
|
|
2171
|
+
* @returns
|
|
2172
2172
|
*/
|
|
2173
2173
|
static registerSeeders(...seeders) {
|
|
2174
2174
|
return require_relationship.registerSeeders(...seeders);
|
|
2175
2175
|
}
|
|
2176
2176
|
/**
|
|
2177
2177
|
* Register model constructors directly without relying on runtime discovery.
|
|
2178
|
-
*
|
|
2179
|
-
* @param models
|
|
2180
|
-
* @returns
|
|
2178
|
+
*
|
|
2179
|
+
* @param models
|
|
2180
|
+
* @returns
|
|
2181
2181
|
*/
|
|
2182
2182
|
static registerModels(...models) {
|
|
2183
2183
|
return require_relationship.registerModels(...models);
|
|
2184
2184
|
}
|
|
2185
2185
|
/**
|
|
2186
2186
|
* Register factory constructors or instances directly without relying on runtime discovery.
|
|
2187
|
-
*
|
|
2188
|
-
* @param factories
|
|
2189
|
-
* @returns
|
|
2187
|
+
*
|
|
2188
|
+
* @param factories
|
|
2189
|
+
* @returns
|
|
2190
2190
|
*/
|
|
2191
2191
|
static registerFactories(...factories) {
|
|
2192
2192
|
return require_relationship.registerFactories(...factories);
|
|
2193
2193
|
}
|
|
2194
2194
|
/**
|
|
2195
2195
|
* Register additional runtime discovery paths for models without replacing configured paths.
|
|
2196
|
-
*
|
|
2197
|
-
* @param paths
|
|
2198
|
-
* @returns
|
|
2196
|
+
*
|
|
2197
|
+
* @param paths
|
|
2198
|
+
* @returns
|
|
2199
2199
|
*/
|
|
2200
2200
|
static loadModelsFrom(paths) {
|
|
2201
2201
|
return require_relationship.loadModelsFrom(paths);
|
|
2202
2202
|
}
|
|
2203
2203
|
/**
|
|
2204
2204
|
* Register additional runtime discovery paths for seeders without replacing configured paths.
|
|
2205
|
-
*
|
|
2206
|
-
* @param paths
|
|
2207
|
-
* @returns
|
|
2205
|
+
*
|
|
2206
|
+
* @param paths
|
|
2207
|
+
* @returns
|
|
2208
2208
|
*/
|
|
2209
2209
|
static loadSeedersFrom(paths) {
|
|
2210
2210
|
return require_relationship.loadSeedersFrom(paths);
|
|
2211
2211
|
}
|
|
2212
2212
|
/**
|
|
2213
2213
|
* Register additional runtime discovery paths for migrations without replacing configured paths.
|
|
2214
|
-
*
|
|
2215
|
-
* @param paths
|
|
2216
|
-
* @returns
|
|
2214
|
+
*
|
|
2215
|
+
* @param paths
|
|
2216
|
+
* @returns
|
|
2217
2217
|
*/
|
|
2218
2218
|
static loadMigrationsFrom(paths) {
|
|
2219
2219
|
return require_relationship.loadMigrationsFrom(paths);
|
|
2220
2220
|
}
|
|
2221
2221
|
/**
|
|
2222
2222
|
* Register additional runtime discovery paths for factories without replacing configured paths.
|
|
2223
|
-
*
|
|
2224
|
-
* @param paths
|
|
2225
|
-
* @returns
|
|
2223
|
+
*
|
|
2224
|
+
* @param paths
|
|
2225
|
+
* @returns
|
|
2226
2226
|
*/
|
|
2227
2227
|
static loadFactoriesFrom(paths) {
|
|
2228
2228
|
return require_relationship.loadFactoriesFrom(paths);
|
|
2229
2229
|
}
|
|
2230
2230
|
/**
|
|
2231
2231
|
* Get registered runtime discovery paths or registered constructors for a specific type.
|
|
2232
|
-
*
|
|
2233
|
-
* @param key
|
|
2234
|
-
* @returns
|
|
2232
|
+
*
|
|
2233
|
+
* @param key
|
|
2234
|
+
* @returns
|
|
2235
2235
|
*/
|
|
2236
2236
|
static getRegisteredPaths(key) {
|
|
2237
2237
|
return require_relationship.getRegisteredPaths(key);
|
|
2238
2238
|
}
|
|
2239
2239
|
/**
|
|
2240
2240
|
* Get registered migration constructors instances
|
|
2241
|
-
*
|
|
2242
|
-
* @returns
|
|
2241
|
+
*
|
|
2242
|
+
* @returns
|
|
2243
2243
|
*/
|
|
2244
2244
|
static getRegisteredMigrations() {
|
|
2245
2245
|
return require_relationship.getRegisteredMigrations();
|
|
2246
2246
|
}
|
|
2247
2247
|
/**
|
|
2248
2248
|
* Get registered seeder constructors instances.
|
|
2249
|
-
*
|
|
2250
|
-
* @returns
|
|
2249
|
+
*
|
|
2250
|
+
* @returns
|
|
2251
2251
|
*/
|
|
2252
2252
|
static getRegisteredSeeders() {
|
|
2253
2253
|
return require_relationship.getRegisteredSeeders();
|
|
2254
2254
|
}
|
|
2255
2255
|
/**
|
|
2256
2256
|
* Get registered model constructors instances.
|
|
2257
|
-
*
|
|
2258
|
-
* @returns
|
|
2257
|
+
*
|
|
2258
|
+
* @returns
|
|
2259
2259
|
*/
|
|
2260
2260
|
static getRegisteredModels() {
|
|
2261
2261
|
return require_relationship.getRegisteredModels();
|
|
2262
2262
|
}
|
|
2263
2263
|
/**
|
|
2264
2264
|
* Get registered factory constructors or instances.
|
|
2265
|
-
*
|
|
2266
|
-
* @returns
|
|
2265
|
+
*
|
|
2266
|
+
* @returns
|
|
2267
2267
|
*/
|
|
2268
2268
|
static getRegisteredFactories() {
|
|
2269
2269
|
return require_relationship.getRegisteredFactories();
|
|
@@ -2391,12 +2391,12 @@ var CliApp = class {
|
|
|
2391
2391
|
return relPath;
|
|
2392
2392
|
}
|
|
2393
2393
|
/**
|
|
2394
|
-
* Utility to format a value for logging, converting absolute paths under current
|
|
2394
|
+
* Utility to format a value for logging, converting absolute paths under current
|
|
2395
2395
|
* working directory into relative display paths.
|
|
2396
|
-
*
|
|
2397
|
-
* @param name
|
|
2398
|
-
* @param value
|
|
2399
|
-
* @returns
|
|
2396
|
+
*
|
|
2397
|
+
* @param name
|
|
2398
|
+
* @param value
|
|
2399
|
+
* @returns
|
|
2400
2400
|
*/
|
|
2401
2401
|
splitLogger(name, value) {
|
|
2402
2402
|
value = value.includes(process.cwd()) ? this.formatPathForLog(value) : value;
|
|
@@ -2485,7 +2485,7 @@ var CliApp = class {
|
|
|
2485
2485
|
}
|
|
2486
2486
|
/**
|
|
2487
2487
|
* Resolve a configuration path with a fallback default
|
|
2488
|
-
*
|
|
2488
|
+
*
|
|
2489
2489
|
* @param key The configuration key to resolve
|
|
2490
2490
|
* @param fallback The fallback value if the configuration key is not set
|
|
2491
2491
|
* @returns The resolved configuration path
|
|
@@ -2497,19 +2497,19 @@ var CliApp = class {
|
|
|
2497
2497
|
}
|
|
2498
2498
|
/**
|
|
2499
2499
|
* Resolve the path to a stub file based on configuration
|
|
2500
|
-
*
|
|
2501
|
-
* @param stubName
|
|
2502
|
-
* @returns
|
|
2500
|
+
*
|
|
2501
|
+
* @param stubName
|
|
2502
|
+
* @returns
|
|
2503
2503
|
*/
|
|
2504
2504
|
resolveStubPath(stubName) {
|
|
2505
2505
|
return (0, path.join)(this.resolveConfigPath("stubs", require_relationship.getDefaultStubsPath()), stubName);
|
|
2506
2506
|
}
|
|
2507
2507
|
/**
|
|
2508
2508
|
* Generate a factory file for a given model name.
|
|
2509
|
-
*
|
|
2510
|
-
* @param name
|
|
2511
|
-
* @param options
|
|
2512
|
-
* @returns
|
|
2509
|
+
*
|
|
2510
|
+
* @param name
|
|
2511
|
+
* @param options
|
|
2512
|
+
* @returns
|
|
2513
2513
|
*/
|
|
2514
2514
|
makeFactory(name, options = {}) {
|
|
2515
2515
|
const baseName = (0, _h3ravel_support.str)(name.replace(/Factory$/, "")).pascal();
|
|
@@ -2531,10 +2531,10 @@ var CliApp = class {
|
|
|
2531
2531
|
}
|
|
2532
2532
|
/**
|
|
2533
2533
|
* Generate a seeder file for a given name.
|
|
2534
|
-
*
|
|
2535
|
-
* @param name
|
|
2536
|
-
* @param options
|
|
2537
|
-
* @returns
|
|
2534
|
+
*
|
|
2535
|
+
* @param name
|
|
2536
|
+
* @param options
|
|
2537
|
+
* @returns
|
|
2538
2538
|
*/
|
|
2539
2539
|
makeSeeder(name, options = {}) {
|
|
2540
2540
|
const seederName = `${(0, _h3ravel_support.str)(name.replace(/Seeder$/, "")).pascal()}Seeder`;
|
|
@@ -2548,7 +2548,7 @@ var CliApp = class {
|
|
|
2548
2548
|
}
|
|
2549
2549
|
/**
|
|
2550
2550
|
* Generate a migration file for a given name.
|
|
2551
|
-
*
|
|
2551
|
+
*
|
|
2552
2552
|
* @param name The name of the migration.
|
|
2553
2553
|
* @returns An object containing the name and path of the generated migration file.
|
|
2554
2554
|
*/
|
|
@@ -2564,10 +2564,10 @@ var CliApp = class {
|
|
|
2564
2564
|
}
|
|
2565
2565
|
/**
|
|
2566
2566
|
* Generate a model file along with optional factory, seeder, and migration files.
|
|
2567
|
-
*
|
|
2568
|
-
* @param name
|
|
2569
|
-
* @param options
|
|
2570
|
-
* @returns
|
|
2567
|
+
*
|
|
2568
|
+
* @param name
|
|
2569
|
+
* @param options
|
|
2570
|
+
* @returns
|
|
2571
2571
|
*/
|
|
2572
2572
|
makeModel(name, options = {}) {
|
|
2573
2573
|
const baseName = (0, _h3ravel_support.str)(name.replace(/Model$/, "")).pascal().toString();
|
|
@@ -2611,10 +2611,10 @@ var CliApp = class {
|
|
|
2611
2611
|
return created;
|
|
2612
2612
|
}
|
|
2613
2613
|
/**
|
|
2614
|
-
* Ensure that the Prisma schema has a model entry for the given model
|
|
2614
|
+
* Ensure that the Prisma schema has a model entry for the given model
|
|
2615
2615
|
* and table names.
|
|
2616
2616
|
* If the entry does not exist, it will be created with a default `id` field.
|
|
2617
|
-
*
|
|
2617
|
+
*
|
|
2618
2618
|
* @param modelName The name of the model to ensure in the Prisma schema.
|
|
2619
2619
|
* @param tableName The table name to ensure in the Prisma schema.
|
|
2620
2620
|
*/
|
|
@@ -2646,7 +2646,7 @@ var CliApp = class {
|
|
|
2646
2646
|
}
|
|
2647
2647
|
/**
|
|
2648
2648
|
* Convert a Prisma scalar type to its corresponding TypeScript type.
|
|
2649
|
-
*
|
|
2649
|
+
*
|
|
2650
2650
|
* @param value The Prisma scalar type.
|
|
2651
2651
|
* @returns The corresponding TypeScript type.
|
|
2652
2652
|
*/
|
|
@@ -2939,9 +2939,9 @@ var CliApp = class {
|
|
|
2939
2939
|
return isList ? `Array<${baseType}>` : baseType;
|
|
2940
2940
|
}
|
|
2941
2941
|
/**
|
|
2942
|
-
* Parse the Prisma schema to extract model definitions and their fields, focusing
|
|
2942
|
+
* Parse the Prisma schema to extract model definitions and their fields, focusing
|
|
2943
2943
|
* on scalar types.
|
|
2944
|
-
*
|
|
2944
|
+
*
|
|
2945
2945
|
* @param schema The Prisma schema as a string.
|
|
2946
2946
|
* @returns An array of model definitions with their fields.
|
|
2947
2947
|
*/
|
|
@@ -2989,11 +2989,11 @@ var CliApp = class {
|
|
|
2989
2989
|
return models;
|
|
2990
2990
|
}
|
|
2991
2991
|
/**
|
|
2992
|
-
* Sync model attribute declarations in a model file based on the
|
|
2992
|
+
* Sync model attribute declarations in a model file based on the
|
|
2993
2993
|
* provided declarations.
|
|
2994
|
-
* This method takes the source code of a model file and a list of
|
|
2994
|
+
* This method takes the source code of a model file and a list of
|
|
2995
2995
|
* attribute declarations,
|
|
2996
|
-
*
|
|
2996
|
+
*
|
|
2997
2997
|
* @param modelSource The source code of the model file.
|
|
2998
2998
|
* @param declarations A list of attribute declarations to sync.
|
|
2999
2999
|
* @returns An object containing the updated content and a flag indicating if it was updated.
|
|
@@ -3089,12 +3089,12 @@ var CliApp = class {
|
|
|
3089
3089
|
}
|
|
3090
3090
|
/**
|
|
3091
3091
|
* Sync model attribute declarations in model files based on the Prisma schema.
|
|
3092
|
-
* This method reads the Prisma schema to extract model definitions and their
|
|
3093
|
-
* scalar fields, then updates the corresponding model files to include `declare`
|
|
3092
|
+
* This method reads the Prisma schema to extract model definitions and their
|
|
3093
|
+
* scalar fields, then updates the corresponding model files to include `declare`
|
|
3094
3094
|
* statements for these fields. It returns an object containing the paths of the
|
|
3095
|
-
* schema and models, the total number of model files processed, and lists of
|
|
3095
|
+
* schema and models, the total number of model files processed, and lists of
|
|
3096
3096
|
* updated and skipped files.
|
|
3097
|
-
*
|
|
3097
|
+
*
|
|
3098
3098
|
* @param options Optional parameters to specify custom paths for the Prisma schema and models directory.
|
|
3099
3099
|
* @returns An object with details about the synchronization process, including updated and skipped files.
|
|
3100
3100
|
*/
|
|
@@ -3125,7 +3125,7 @@ var CliApp = class {
|
|
|
3125
3125
|
//#endregion
|
|
3126
3126
|
//#region src/cli/commands/InitCommand.ts
|
|
3127
3127
|
/**
|
|
3128
|
-
* The InitCommand class implements the CLI command for initializing Arkormˣ by creating
|
|
3128
|
+
* The InitCommand class implements the CLI command for initializing Arkormˣ by creating
|
|
3129
3129
|
* a default config file in the current directory.
|
|
3130
3130
|
*
|
|
3131
3131
|
* @author Legacy (3m1n3nc3)
|
|
@@ -3184,8 +3184,8 @@ var MakeFactoryCommand = class extends _h3ravel_musket.Command {
|
|
|
3184
3184
|
}
|
|
3185
3185
|
/**
|
|
3186
3186
|
* Command handler for the make:factory command.
|
|
3187
|
-
*
|
|
3188
|
-
* @returns
|
|
3187
|
+
*
|
|
3188
|
+
* @returns
|
|
3189
3189
|
*/
|
|
3190
3190
|
async handle() {
|
|
3191
3191
|
this.app.command = this;
|
|
@@ -3214,8 +3214,8 @@ var MakeMigrationCommand = class extends _h3ravel_musket.Command {
|
|
|
3214
3214
|
}
|
|
3215
3215
|
/**
|
|
3216
3216
|
* Command handler for the make:migration command.
|
|
3217
|
-
*
|
|
3218
|
-
* @returns
|
|
3217
|
+
*
|
|
3218
|
+
* @returns
|
|
3219
3219
|
*/
|
|
3220
3220
|
async handle() {
|
|
3221
3221
|
this.app.command = this;
|
|
@@ -3229,7 +3229,7 @@ var MakeMigrationCommand = class extends _h3ravel_musket.Command {
|
|
|
3229
3229
|
//#endregion
|
|
3230
3230
|
//#region src/cli/commands/MakeModelCommand.ts
|
|
3231
3231
|
/**
|
|
3232
|
-
* The MakeModelCommand class implements the CLI command for creating new model
|
|
3232
|
+
* The MakeModelCommand class implements the CLI command for creating new model
|
|
3233
3233
|
* classes along with optional linked resources such as factories, seeders, and migrations.
|
|
3234
3234
|
*
|
|
3235
3235
|
* @author Legacy (3m1n3nc3)
|
|
@@ -3251,8 +3251,8 @@ var MakeModelCommand = class extends _h3ravel_musket.Command {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
/**
|
|
3253
3253
|
* Command handler for the make:model command.
|
|
3254
|
-
*
|
|
3255
|
-
* @returns
|
|
3254
|
+
*
|
|
3255
|
+
* @returns
|
|
3256
3256
|
*/
|
|
3257
3257
|
async handle() {
|
|
3258
3258
|
this.app.command = this;
|
|
@@ -3302,8 +3302,8 @@ var MakeSeederCommand = class extends _h3ravel_musket.Command {
|
|
|
3302
3302
|
//#region src/database/Migration.ts
|
|
3303
3303
|
const MIGRATION_BRAND = Symbol.for("arkormx.migration");
|
|
3304
3304
|
/**
|
|
3305
|
-
* The Migration class serves as a base for defining database migrations, requiring
|
|
3306
|
-
* the implementation of `up` and `down` methods to specify the changes to be
|
|
3305
|
+
* The Migration class serves as a base for defining database migrations, requiring
|
|
3306
|
+
* the implementation of `up` and `down` methods to specify the changes to be
|
|
3307
3307
|
* applied or reverted in the database schema.
|
|
3308
3308
|
*
|
|
3309
3309
|
* @author Legacy (3m1n3nc3)
|
|
@@ -3318,7 +3318,7 @@ var Migration = class {
|
|
|
3318
3318
|
//#endregion
|
|
3319
3319
|
//#region src/cli/commands/MigrateCommand.ts
|
|
3320
3320
|
/**
|
|
3321
|
-
* The MigrateCommand class implements the CLI command for applying migration
|
|
3321
|
+
* The MigrateCommand class implements the CLI command for applying migration
|
|
3322
3322
|
* classes to the Prisma schema and running the Prisma workflow.
|
|
3323
3323
|
*
|
|
3324
3324
|
* @author Legacy (3m1n3nc3)
|
|
@@ -3342,12 +3342,12 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
3342
3342
|
}
|
|
3343
3343
|
/**
|
|
3344
3344
|
* Command handler for the migrate command.
|
|
3345
|
-
* This method is responsible for orchestrating the migration
|
|
3346
|
-
* process, including loading migration classes, applying them to
|
|
3347
|
-
* the Prisma schema, and running the appropriate Prisma commands
|
|
3345
|
+
* This method is responsible for orchestrating the migration
|
|
3346
|
+
* process, including loading migration classes, applying them to
|
|
3347
|
+
* the Prisma schema, and running the appropriate Prisma commands
|
|
3348
3348
|
* based on the provided options.
|
|
3349
|
-
*
|
|
3350
|
-
* @returns
|
|
3349
|
+
*
|
|
3350
|
+
* @returns
|
|
3351
3351
|
*/
|
|
3352
3352
|
async handle() {
|
|
3353
3353
|
this.app.command = this;
|
|
@@ -3462,10 +3462,10 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
3462
3462
|
}
|
|
3463
3463
|
/**
|
|
3464
3464
|
* Load migration classes from a specific file or by class name.
|
|
3465
|
-
*
|
|
3466
|
-
* @param migrationsDir
|
|
3467
|
-
* @param name
|
|
3468
|
-
* @returns
|
|
3465
|
+
*
|
|
3466
|
+
* @param migrationsDir
|
|
3467
|
+
* @param name
|
|
3468
|
+
* @returns
|
|
3469
3469
|
*/
|
|
3470
3470
|
async loadNamedMigration(migrationsDirs, name) {
|
|
3471
3471
|
if (!name) return [[void 0, ""]];
|
|
@@ -3488,9 +3488,9 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
3488
3488
|
}
|
|
3489
3489
|
/**
|
|
3490
3490
|
* Load migration classes from a given file path.
|
|
3491
|
-
*
|
|
3492
|
-
* @param filePath
|
|
3493
|
-
* @returns
|
|
3491
|
+
*
|
|
3492
|
+
* @param filePath
|
|
3493
|
+
* @returns
|
|
3494
3494
|
*/
|
|
3495
3495
|
async loadMigrationClassesFromFile(filePath) {
|
|
3496
3496
|
const imported = await require_relationship.RuntimeModuleLoader.load(filePath);
|
|
@@ -3909,7 +3909,7 @@ var ModelsSyncCommand = class extends _h3ravel_musket.Command {
|
|
|
3909
3909
|
//#region src/database/Seeder.ts
|
|
3910
3910
|
const SEEDER_BRAND = Symbol.for("arkormx.seeder");
|
|
3911
3911
|
/**
|
|
3912
|
-
* The Seeder class serves as a base for defining database seeders, which are
|
|
3912
|
+
* The Seeder class serves as a base for defining database seeders, which are
|
|
3913
3913
|
* used to populate the database with initial or test data.
|
|
3914
3914
|
*
|
|
3915
3915
|
* @author Legacy (3m1n3nc3)
|
|
@@ -3924,7 +3924,7 @@ var Seeder = class Seeder {
|
|
|
3924
3924
|
}
|
|
3925
3925
|
/**
|
|
3926
3926
|
* Runs one or more seeders.
|
|
3927
|
-
*
|
|
3927
|
+
*
|
|
3928
3928
|
* @param seeders The seeders to be run.
|
|
3929
3929
|
*/
|
|
3930
3930
|
async call(...seeders) {
|
|
@@ -3932,9 +3932,9 @@ var Seeder = class Seeder {
|
|
|
3932
3932
|
}
|
|
3933
3933
|
/**
|
|
3934
3934
|
* Run seeders and return every seeder class executed, including nested calls.
|
|
3935
|
-
*
|
|
3936
|
-
* @param seeders
|
|
3937
|
-
* @returns
|
|
3935
|
+
*
|
|
3936
|
+
* @param seeders
|
|
3937
|
+
* @returns
|
|
3938
3938
|
*/
|
|
3939
3939
|
static async runWithReport(...seeders) {
|
|
3940
3940
|
const report = [];
|
|
@@ -3944,8 +3944,8 @@ var Seeder = class Seeder {
|
|
|
3944
3944
|
return report;
|
|
3945
3945
|
}
|
|
3946
3946
|
/**
|
|
3947
|
-
* Converts a SeederInput into a Seeder instance.
|
|
3948
|
-
*
|
|
3947
|
+
* Converts a SeederInput into a Seeder instance.
|
|
3948
|
+
*
|
|
3949
3949
|
* @param input The SeederInput to convert.
|
|
3950
3950
|
* @returns A Seeder instance.
|
|
3951
3951
|
*/
|
|
@@ -3958,7 +3958,7 @@ var Seeder = class Seeder {
|
|
|
3958
3958
|
}
|
|
3959
3959
|
/**
|
|
3960
3960
|
* Runs the given seeders in sequence.
|
|
3961
|
-
*
|
|
3961
|
+
*
|
|
3962
3962
|
* @param seeders The seeders to be run.
|
|
3963
3963
|
*/
|
|
3964
3964
|
static async runSeeders(...seeders) {
|
|
@@ -3978,7 +3978,7 @@ var Seeder = class Seeder {
|
|
|
3978
3978
|
//#endregion
|
|
3979
3979
|
//#region src/cli/commands/SeedCommand.ts
|
|
3980
3980
|
/**
|
|
3981
|
-
* The SeedCommand class implements the CLI command for running seeder classes.
|
|
3981
|
+
* The SeedCommand class implements the CLI command for running seeder classes.
|
|
3982
3982
|
*
|
|
3983
3983
|
* @author Legacy (3m1n3nc3)
|
|
3984
3984
|
* @since 0.1.0
|
|
@@ -3994,8 +3994,8 @@ var SeedCommand = class extends _h3ravel_musket.Command {
|
|
|
3994
3994
|
}
|
|
3995
3995
|
/**
|
|
3996
3996
|
* Command handler for the seed command.
|
|
3997
|
-
*
|
|
3998
|
-
* @returns
|
|
3997
|
+
*
|
|
3998
|
+
* @returns
|
|
3999
3999
|
*/
|
|
4000
4000
|
async handle() {
|
|
4001
4001
|
this.app.command = this;
|
|
@@ -4011,9 +4011,9 @@ var SeedCommand = class extends _h3ravel_musket.Command {
|
|
|
4011
4011
|
}
|
|
4012
4012
|
/**
|
|
4013
4013
|
* Load all seeder classes from the specified directory.
|
|
4014
|
-
*
|
|
4015
|
-
* @param seedersDir
|
|
4016
|
-
* @returns
|
|
4014
|
+
*
|
|
4015
|
+
* @param seedersDir
|
|
4016
|
+
* @returns
|
|
4017
4017
|
*/
|
|
4018
4018
|
resolveSeederDirectories(configuredSeedersDir) {
|
|
4019
4019
|
return [this.app.resolveRuntimeDirectoryPath(configuredSeedersDir), ...require_relationship.getRegisteredPaths("seeders").map((directory) => this.app.resolveRuntimeDirectoryPath(directory))].filter((directory, index, all) => (0, node_fs.existsSync)(directory) && all.indexOf(directory) === index);
|
|
@@ -4024,10 +4024,10 @@ var SeedCommand = class extends _h3ravel_musket.Command {
|
|
|
4024
4024
|
}
|
|
4025
4025
|
/**
|
|
4026
4026
|
* Load seeder classes from a specific file or by class name.
|
|
4027
|
-
*
|
|
4028
|
-
* @param seedersDir
|
|
4029
|
-
* @param name
|
|
4030
|
-
* @returns
|
|
4027
|
+
*
|
|
4028
|
+
* @param seedersDir
|
|
4029
|
+
* @param name
|
|
4030
|
+
* @returns
|
|
4031
4031
|
*/
|
|
4032
4032
|
async loadNamedSeeder(seedersDirs, name) {
|
|
4033
4033
|
const base = name.replace(/Seeder$/, "");
|
|
@@ -4049,7 +4049,7 @@ var SeedCommand = class extends _h3ravel_musket.Command {
|
|
|
4049
4049
|
}
|
|
4050
4050
|
/**
|
|
4051
4051
|
* Load seeder classes from a given file path.
|
|
4052
|
-
*
|
|
4052
|
+
*
|
|
4053
4053
|
* @param filePath The path to the file containing seeder classes.
|
|
4054
4054
|
* @returns An array of seeder classes.
|
|
4055
4055
|
*/
|
|
@@ -4315,9 +4315,9 @@ var JoinClause = class JoinClause {
|
|
|
4315
4315
|
//#endregion
|
|
4316
4316
|
//#region src/Exceptions/ModelNotFoundException.ts
|
|
4317
4317
|
/**
|
|
4318
|
-
* The ModelNotFoundException class is a custom error type for handling
|
|
4319
|
-
* cases where a requested model instance cannot be found in the database.
|
|
4320
|
-
*
|
|
4318
|
+
* The ModelNotFoundException class is a custom error type for handling
|
|
4319
|
+
* cases where a requested model instance cannot be found in the database.
|
|
4320
|
+
*
|
|
4321
4321
|
* @author Legacy (3m1n3nc3)
|
|
4322
4322
|
* @since 0.1.0
|
|
4323
4323
|
*/
|
|
@@ -4375,9 +4375,9 @@ var UniqueConstraintResolutionException = class extends require_relationship.Ark
|
|
|
4375
4375
|
//#endregion
|
|
4376
4376
|
//#region src/QueryBuilder.ts
|
|
4377
4377
|
/**
|
|
4378
|
-
* The QueryBuilder class provides a fluent interface for building and
|
|
4378
|
+
* The QueryBuilder class provides a fluent interface for building and
|
|
4379
4379
|
* executing database queries.
|
|
4380
|
-
*
|
|
4380
|
+
*
|
|
4381
4381
|
* @template TModel The type of the model being queried.
|
|
4382
4382
|
* @author Legacy (3m1n3nc3)
|
|
4383
4383
|
* @since 0.1.0
|
|
@@ -4385,8 +4385,8 @@ var UniqueConstraintResolutionException = class extends require_relationship.Ark
|
|
|
4385
4385
|
var QueryBuilder = class QueryBuilder {
|
|
4386
4386
|
/**
|
|
4387
4387
|
* Creates a new QueryBuilder instance.
|
|
4388
|
-
*
|
|
4389
|
-
* @param model
|
|
4388
|
+
*
|
|
4389
|
+
* @param model
|
|
4390
4390
|
*/
|
|
4391
4391
|
constructor(model, adapter) {
|
|
4392
4392
|
this.model = model;
|
|
@@ -4564,45 +4564,45 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4564
4564
|
}
|
|
4565
4565
|
/**
|
|
4566
4566
|
* Adds clause to determine if a column's value is in the past
|
|
4567
|
-
*
|
|
4568
|
-
* @param key
|
|
4569
|
-
* @returns
|
|
4567
|
+
*
|
|
4568
|
+
* @param key
|
|
4569
|
+
* @returns
|
|
4570
4570
|
*/
|
|
4571
4571
|
wherePast(key) {
|
|
4572
4572
|
return this.where({ [key]: { lt: /* @__PURE__ */ new Date() } });
|
|
4573
4573
|
}
|
|
4574
4574
|
/**
|
|
4575
4575
|
* Adds clause to determine if a column's value is in the future
|
|
4576
|
-
*
|
|
4577
|
-
* @param key
|
|
4578
|
-
* @returns
|
|
4576
|
+
*
|
|
4577
|
+
* @param key
|
|
4578
|
+
* @returns
|
|
4579
4579
|
*/
|
|
4580
4580
|
whereFuture(key) {
|
|
4581
4581
|
return this.where({ [key]: { gt: /* @__PURE__ */ new Date() } });
|
|
4582
4582
|
}
|
|
4583
4583
|
/**
|
|
4584
4584
|
* Adds clause to determine if a column's value is in the past, inclusive of the current date and time
|
|
4585
|
-
*
|
|
4586
|
-
* @param key
|
|
4587
|
-
* @returns
|
|
4585
|
+
*
|
|
4586
|
+
* @param key
|
|
4587
|
+
* @returns
|
|
4588
4588
|
*/
|
|
4589
4589
|
whereNowOrPast(key) {
|
|
4590
4590
|
return this.where({ [key]: { lte: /* @__PURE__ */ new Date() } });
|
|
4591
4591
|
}
|
|
4592
4592
|
/**
|
|
4593
4593
|
* Adds clause to determine if a column's value is in the future, inclusive of the current date and time
|
|
4594
|
-
*
|
|
4595
|
-
* @param key
|
|
4596
|
-
* @returns
|
|
4594
|
+
*
|
|
4595
|
+
* @param key
|
|
4596
|
+
* @returns
|
|
4597
4597
|
*/
|
|
4598
4598
|
whereNowOrFuture(key) {
|
|
4599
4599
|
return this.where({ [key]: { gte: /* @__PURE__ */ new Date() } });
|
|
4600
4600
|
}
|
|
4601
4601
|
/**
|
|
4602
4602
|
* Adds clause to determine if a column's value is today
|
|
4603
|
-
*
|
|
4604
|
-
* @param key
|
|
4605
|
-
* @returns
|
|
4603
|
+
*
|
|
4604
|
+
* @param key
|
|
4605
|
+
* @returns
|
|
4606
4606
|
*/
|
|
4607
4607
|
whereToday(key) {
|
|
4608
4608
|
const [start, end] = this.getUtcDayBounds();
|
|
@@ -4613,9 +4613,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4613
4613
|
}
|
|
4614
4614
|
/**
|
|
4615
4615
|
* Adds clause to determine if a column's value is before today
|
|
4616
|
-
*
|
|
4617
|
-
* @param key
|
|
4618
|
-
* @returns
|
|
4616
|
+
*
|
|
4617
|
+
* @param key
|
|
4618
|
+
* @returns
|
|
4619
4619
|
*/
|
|
4620
4620
|
whereBeforeToday(key) {
|
|
4621
4621
|
const [start] = this.getUtcDayBounds();
|
|
@@ -4623,9 +4623,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4623
4623
|
}
|
|
4624
4624
|
/**
|
|
4625
4625
|
* Adds clause to determine if a column's value is after today
|
|
4626
|
-
*
|
|
4627
|
-
* @param key
|
|
4628
|
-
* @returns
|
|
4626
|
+
*
|
|
4627
|
+
* @param key
|
|
4628
|
+
* @returns
|
|
4629
4629
|
*/
|
|
4630
4630
|
whereAfterToday(key) {
|
|
4631
4631
|
const [, end] = this.getUtcDayBounds();
|
|
@@ -4633,9 +4633,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4633
4633
|
}
|
|
4634
4634
|
/**
|
|
4635
4635
|
* Adds clause to determine if a column's value is today or before today
|
|
4636
|
-
*
|
|
4637
|
-
* @param key
|
|
4638
|
-
* @returns
|
|
4636
|
+
*
|
|
4637
|
+
* @param key
|
|
4638
|
+
* @returns
|
|
4639
4639
|
*/
|
|
4640
4640
|
whereTodayOrBefore(key) {
|
|
4641
4641
|
const [, end] = this.getUtcDayBounds();
|
|
@@ -4643,9 +4643,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4643
4643
|
}
|
|
4644
4644
|
/**
|
|
4645
4645
|
* Adds clause to determine if a column's value is today or after today
|
|
4646
|
-
*
|
|
4647
|
-
* @param key
|
|
4648
|
-
* @returns
|
|
4646
|
+
*
|
|
4647
|
+
* @param key
|
|
4648
|
+
* @returns
|
|
4649
4649
|
*/
|
|
4650
4650
|
whereTodayOrAfter(key) {
|
|
4651
4651
|
const [start] = this.getUtcDayBounds();
|
|
@@ -4662,9 +4662,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4662
4662
|
}
|
|
4663
4663
|
/**
|
|
4664
4664
|
* Adds "where exists" SQL clauses.
|
|
4665
|
-
*
|
|
4666
|
-
* @param queryOrCallback
|
|
4667
|
-
* @returns
|
|
4665
|
+
*
|
|
4666
|
+
* @param queryOrCallback
|
|
4667
|
+
* @returns
|
|
4668
4668
|
*/
|
|
4669
4669
|
whereExists(queryOrCallback) {
|
|
4670
4670
|
const baseQuery = new QueryBuilder(this.model, this.adapter);
|
|
@@ -4804,12 +4804,12 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4804
4804
|
/**
|
|
4805
4805
|
* Append a structured JSON predicate, splitting a `column->path->key`
|
|
4806
4806
|
* expression into its base column and nested path segments.
|
|
4807
|
-
*
|
|
4808
|
-
* @param boolean
|
|
4809
|
-
* @param kind
|
|
4810
|
-
* @param column
|
|
4811
|
-
* @param options
|
|
4812
|
-
* @returns
|
|
4807
|
+
*
|
|
4808
|
+
* @param boolean
|
|
4809
|
+
* @param kind
|
|
4810
|
+
* @param column
|
|
4811
|
+
* @param options
|
|
4812
|
+
* @returns
|
|
4813
4813
|
*/
|
|
4814
4814
|
appendJsonCondition(boolean, kind, column, options = {}) {
|
|
4815
4815
|
const [base, ...path] = column.split("->").map((segment) => segment.trim());
|
|
@@ -4838,10 +4838,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4838
4838
|
}
|
|
4839
4839
|
/**
|
|
4840
4840
|
* OR variant of whereJsonContains().
|
|
4841
|
-
*
|
|
4842
|
-
* @param column
|
|
4843
|
-
* @param value
|
|
4844
|
-
* @returns
|
|
4841
|
+
*
|
|
4842
|
+
* @param column
|
|
4843
|
+
* @param value
|
|
4844
|
+
* @returns
|
|
4845
4845
|
*/
|
|
4846
4846
|
orWhereJsonContains(column, value) {
|
|
4847
4847
|
return this.appendJsonCondition("OR", "contains", column, { value });
|
|
@@ -4861,10 +4861,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4861
4861
|
}
|
|
4862
4862
|
/**
|
|
4863
4863
|
* OR variant of whereJsonDoesntContain().
|
|
4864
|
-
*
|
|
4865
|
-
* @param column
|
|
4866
|
-
* @param value
|
|
4867
|
-
* @returns
|
|
4864
|
+
*
|
|
4865
|
+
* @param column
|
|
4866
|
+
* @param value
|
|
4867
|
+
* @returns
|
|
4868
4868
|
*/
|
|
4869
4869
|
orWhereJsonDoesntContain(column, value) {
|
|
4870
4870
|
return this.appendJsonCondition("OR", "contains", column, {
|
|
@@ -4883,9 +4883,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4883
4883
|
}
|
|
4884
4884
|
/**
|
|
4885
4885
|
* OR variant of whereJsonContainsKey().
|
|
4886
|
-
*
|
|
4887
|
-
* @param column
|
|
4888
|
-
* @returns
|
|
4886
|
+
*
|
|
4887
|
+
* @param column
|
|
4888
|
+
* @returns
|
|
4889
4889
|
*/
|
|
4890
4890
|
orWhereJsonContainsKey(column) {
|
|
4891
4891
|
return this.appendJsonCondition("OR", "contains-key", column);
|
|
@@ -4901,9 +4901,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4901
4901
|
}
|
|
4902
4902
|
/**
|
|
4903
4903
|
* OR variant of whereJsonDoesntContainKey().
|
|
4904
|
-
*
|
|
4905
|
-
* @param column
|
|
4906
|
-
* @returns
|
|
4904
|
+
*
|
|
4905
|
+
* @param column
|
|
4906
|
+
* @returns
|
|
4907
4907
|
*/
|
|
4908
4908
|
orWhereJsonDoesntContainKey(column) {
|
|
4909
4909
|
return this.appendJsonCondition("OR", "contains-key", column, { not: true });
|
|
@@ -4945,10 +4945,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4945
4945
|
}
|
|
4946
4946
|
/**
|
|
4947
4947
|
* OR variant of whereJsonOverlaps().
|
|
4948
|
-
*
|
|
4949
|
-
* @param column
|
|
4950
|
-
* @param value
|
|
4951
|
-
* @returns
|
|
4948
|
+
*
|
|
4949
|
+
* @param column
|
|
4950
|
+
* @param value
|
|
4951
|
+
* @returns
|
|
4952
4952
|
*/
|
|
4953
4953
|
orWhereJsonOverlaps(column, value) {
|
|
4954
4954
|
return this.appendJsonCondition("OR", "overlaps", column, { value });
|
|
@@ -5066,9 +5066,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5066
5066
|
}
|
|
5067
5067
|
/**
|
|
5068
5068
|
* Adds an orderBy clause to the query. This will overwrite any existing orderBy clause.
|
|
5069
|
-
*
|
|
5070
|
-
* @param orderBy
|
|
5071
|
-
* @returns
|
|
5069
|
+
*
|
|
5070
|
+
* @param orderBy
|
|
5071
|
+
* @returns
|
|
5072
5072
|
*/
|
|
5073
5073
|
orderBy(orderBy) {
|
|
5074
5074
|
this.randomOrderEnabled = false;
|
|
@@ -5122,9 +5122,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5122
5122
|
}
|
|
5123
5123
|
/**
|
|
5124
5124
|
* Adds an include clause to the query. This will overwrite any existing include clause.
|
|
5125
|
-
*
|
|
5126
|
-
* @param include
|
|
5127
|
-
* @returns
|
|
5125
|
+
*
|
|
5126
|
+
* @param include
|
|
5127
|
+
* @returns
|
|
5128
5128
|
*/
|
|
5129
5129
|
include(include) {
|
|
5130
5130
|
const normalized = this.normalizeRelationLoads(include);
|
|
@@ -5137,11 +5137,11 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5137
5137
|
return this;
|
|
5138
5138
|
}
|
|
5139
5139
|
/**
|
|
5140
|
-
* Adds eager loading for the specified relations.
|
|
5140
|
+
* Adds eager loading for the specified relations.
|
|
5141
5141
|
* This will merge with any existing include clause.
|
|
5142
|
-
*
|
|
5143
|
-
* @param relations
|
|
5144
|
-
* @returns
|
|
5142
|
+
*
|
|
5143
|
+
* @param relations
|
|
5144
|
+
* @returns
|
|
5145
5145
|
*/
|
|
5146
5146
|
with(relations) {
|
|
5147
5147
|
const relationMap = this.normalizeWith(relations);
|
|
@@ -5343,10 +5343,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5343
5343
|
return this.withRelationAggregate("max", relation, column);
|
|
5344
5344
|
}
|
|
5345
5345
|
/**
|
|
5346
|
-
* Includes soft-deleted records in the query results.
|
|
5346
|
+
* Includes soft-deleted records in the query results.
|
|
5347
5347
|
* This method is only applicable if the model has soft delete enabled.
|
|
5348
|
-
*
|
|
5349
|
-
* @returns
|
|
5348
|
+
*
|
|
5349
|
+
* @returns
|
|
5350
5350
|
*/
|
|
5351
5351
|
withTrashed() {
|
|
5352
5352
|
this.includeTrashed = true;
|
|
@@ -5354,10 +5354,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5354
5354
|
return this;
|
|
5355
5355
|
}
|
|
5356
5356
|
/**
|
|
5357
|
-
* Limits the query results to only soft-deleted records.
|
|
5357
|
+
* Limits the query results to only soft-deleted records.
|
|
5358
5358
|
* This method is only applicable if the model has soft delete enabled.
|
|
5359
|
-
*
|
|
5360
|
-
* @returns
|
|
5359
|
+
*
|
|
5360
|
+
* @returns
|
|
5361
5361
|
*/
|
|
5362
5362
|
onlyTrashed() {
|
|
5363
5363
|
this.onlyTrashedRecords = true;
|
|
@@ -5365,11 +5365,11 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5365
5365
|
return this;
|
|
5366
5366
|
}
|
|
5367
5367
|
/**
|
|
5368
|
-
* Excludes soft-deleted records from the query results.
|
|
5369
|
-
* This is the default behavior, but this method can be used to explicitly
|
|
5368
|
+
* Excludes soft-deleted records from the query results.
|
|
5369
|
+
* This is the default behavior, but this method can be used to explicitly
|
|
5370
5370
|
* enforce it after using withTrashed or onlyTrashed.
|
|
5371
|
-
*
|
|
5372
|
-
* @returns
|
|
5371
|
+
*
|
|
5372
|
+
* @returns
|
|
5373
5373
|
*/
|
|
5374
5374
|
withoutTrashed() {
|
|
5375
5375
|
this.includeTrashed = false;
|
|
@@ -5378,14 +5378,14 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5378
5378
|
}
|
|
5379
5379
|
/**
|
|
5380
5380
|
* Applies a named scope to the query. A scope is a reusable query constraint
|
|
5381
|
-
* defined as a static method on the model. The scope method will look for a
|
|
5382
|
-
* method with the name `scope{Name}` on the model's prototype.
|
|
5383
|
-
* If found, it will call that method with the current query builder
|
|
5381
|
+
* defined as a static method on the model. The scope method will look for a
|
|
5382
|
+
* method with the name `scope{Name}` on the model's prototype.
|
|
5383
|
+
* If found, it will call that method with the current query builder
|
|
5384
5384
|
* instance and any additional arguments provided.
|
|
5385
|
-
*
|
|
5386
|
-
* @param name
|
|
5387
|
-
* @param args
|
|
5388
|
-
* @returns
|
|
5385
|
+
*
|
|
5386
|
+
* @param name
|
|
5387
|
+
* @param args
|
|
5388
|
+
* @returns
|
|
5389
5389
|
*/
|
|
5390
5390
|
scope(name, ...args) {
|
|
5391
5391
|
const methodName = `scope${name.charAt(0).toUpperCase()}${name.slice(1)}`;
|
|
@@ -5448,9 +5448,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5448
5448
|
}
|
|
5449
5449
|
/**
|
|
5450
5450
|
* Adds a select clause to the query. This will overwrite any existing select clause.
|
|
5451
|
-
*
|
|
5452
|
-
* @param select
|
|
5453
|
-
* @returns
|
|
5451
|
+
*
|
|
5452
|
+
* @param select
|
|
5453
|
+
* @returns
|
|
5454
5454
|
*/
|
|
5455
5455
|
select(select) {
|
|
5456
5456
|
const normalized = this.normalizeQuerySelect(select);
|
|
@@ -5801,9 +5801,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5801
5801
|
/**
|
|
5802
5802
|
* Adds a skip clause to the query for pagination.
|
|
5803
5803
|
* This will overwrite any existing skip clause.
|
|
5804
|
-
*
|
|
5805
|
-
* @param skip
|
|
5806
|
-
* @returns
|
|
5804
|
+
*
|
|
5805
|
+
* @param skip
|
|
5806
|
+
* @returns
|
|
5807
5807
|
*/
|
|
5808
5808
|
skip(skip) {
|
|
5809
5809
|
this.offsetValue = skip;
|
|
@@ -5820,9 +5820,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5820
5820
|
}
|
|
5821
5821
|
/**
|
|
5822
5822
|
* Adds a take clause to the query for pagination.
|
|
5823
|
-
*
|
|
5824
|
-
* @param take
|
|
5825
|
-
* @returns
|
|
5823
|
+
*
|
|
5824
|
+
* @param take
|
|
5825
|
+
* @returns
|
|
5826
5826
|
*/
|
|
5827
5827
|
take(take) {
|
|
5828
5828
|
this.limitValue = take;
|
|
@@ -5839,9 +5839,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5839
5839
|
}
|
|
5840
5840
|
/**
|
|
5841
5841
|
* Returns a representation of the query that can be used for debugging or logging purposes.
|
|
5842
|
-
*
|
|
5843
|
-
* @param operation
|
|
5844
|
-
* @returns
|
|
5842
|
+
*
|
|
5843
|
+
* @param operation
|
|
5844
|
+
* @returns
|
|
5845
5845
|
*/
|
|
5846
5846
|
inspect(operation = "select") {
|
|
5847
5847
|
const adapter = this.requireAdapter();
|
|
@@ -5888,8 +5888,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5888
5888
|
}
|
|
5889
5889
|
/**
|
|
5890
5890
|
* Executes the query and returns the results as a collection of model instances.
|
|
5891
|
-
*
|
|
5892
|
-
* @returns
|
|
5891
|
+
*
|
|
5892
|
+
* @returns
|
|
5893
5893
|
*/
|
|
5894
5894
|
async get() {
|
|
5895
5895
|
const useAdapterRelationFeatures = this.canExecuteRelationFeaturesInAdapter();
|
|
@@ -5910,10 +5910,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5910
5910
|
return new require_relationship.ArkormCollection(filteredModels);
|
|
5911
5911
|
}
|
|
5912
5912
|
/**
|
|
5913
|
-
* Executes the query and returns the first result as a model
|
|
5913
|
+
* Executes the query and returns the first result as a model
|
|
5914
5914
|
* instance, or null if no results are found.
|
|
5915
|
-
*
|
|
5916
|
-
* @returns
|
|
5915
|
+
*
|
|
5916
|
+
* @returns
|
|
5917
5917
|
*/
|
|
5918
5918
|
async first() {
|
|
5919
5919
|
if (this.shouldUseCompatibilityRelationFallback()) return (await this.get()).all()[0] ?? null;
|
|
@@ -5934,8 +5934,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5934
5934
|
}
|
|
5935
5935
|
/**
|
|
5936
5936
|
* Executes the query and returns the first result as a model instance.
|
|
5937
|
-
*
|
|
5938
|
-
* @returns
|
|
5937
|
+
*
|
|
5938
|
+
* @returns
|
|
5939
5939
|
*/
|
|
5940
5940
|
async firstOrFail() {
|
|
5941
5941
|
const model = await this.first();
|
|
@@ -6048,9 +6048,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6048
6048
|
}
|
|
6049
6049
|
/**
|
|
6050
6050
|
* Creates a new record with the specified data and returns it as a model instance.
|
|
6051
|
-
*
|
|
6052
|
-
* @param data
|
|
6053
|
-
* @returns
|
|
6051
|
+
*
|
|
6052
|
+
* @param data
|
|
6053
|
+
* @returns
|
|
6054
6054
|
*/
|
|
6055
6055
|
async create(data) {
|
|
6056
6056
|
const created = await this.executeInsertRow(data);
|
|
@@ -6136,11 +6136,11 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6136
6136
|
return this.insertOrIgnore(rows);
|
|
6137
6137
|
}
|
|
6138
6138
|
/**
|
|
6139
|
-
* Updates records matching the current query constraints with the
|
|
6139
|
+
* Updates records matching the current query constraints with the
|
|
6140
6140
|
* specified data and returns the updated record(s) as model instance(s).
|
|
6141
|
-
*
|
|
6142
|
-
* @param data
|
|
6143
|
-
* @returns
|
|
6141
|
+
*
|
|
6142
|
+
* @param data
|
|
6143
|
+
* @returns
|
|
6144
6144
|
*/
|
|
6145
6145
|
async update(data) {
|
|
6146
6146
|
const where = this.buildWhere();
|
|
@@ -6255,8 +6255,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6255
6255
|
/**
|
|
6256
6256
|
* Deletes the first record matching the current query constraints and returns
|
|
6257
6257
|
* it as a hydrated model instance. Returns null when no record matches.
|
|
6258
|
-
*
|
|
6259
|
-
* @returns
|
|
6258
|
+
*
|
|
6259
|
+
* @returns
|
|
6260
6260
|
*/
|
|
6261
6261
|
async delete() {
|
|
6262
6262
|
const where = this.buildWhere();
|
|
@@ -6354,8 +6354,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6354
6354
|
}
|
|
6355
6355
|
/**
|
|
6356
6356
|
* Counts the number of records matching the current query constraints.
|
|
6357
|
-
*
|
|
6358
|
-
* @returns
|
|
6357
|
+
*
|
|
6358
|
+
* @returns
|
|
6359
6359
|
*/
|
|
6360
6360
|
async count() {
|
|
6361
6361
|
if (this.hasRelationFilters() && this.shouldUseCompatibilityRelationFallback()) return (await this.get()).all().length;
|
|
@@ -6393,15 +6393,24 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6393
6393
|
if (nextPayload[column.column] !== void 0 && nextPayload[column.column] !== null) continue;
|
|
6394
6394
|
if (column.default === "now()" || column.updatedAt) nextPayload[column.column] = now;
|
|
6395
6395
|
}
|
|
6396
|
-
return nextPayload;
|
|
6396
|
+
return this.castForPersistence(nextPayload);
|
|
6397
6397
|
});
|
|
6398
6398
|
}
|
|
6399
|
+
/**
|
|
6400
|
+
* Apply the model's persistence casts when a real model backs the query.
|
|
6401
|
+
*
|
|
6402
|
+
* @param payload
|
|
6403
|
+
* @returns
|
|
6404
|
+
*/
|
|
6405
|
+
castForPersistence(payload) {
|
|
6406
|
+
return typeof this.model.castAttributesForPersistence === "function" ? this.model.castAttributesForPersistence(payload) : payload;
|
|
6407
|
+
}
|
|
6399
6408
|
normalizeUpdatePayload(values) {
|
|
6400
6409
|
const metadata = this.model.getModelMetadata();
|
|
6401
6410
|
const nextPayload = { ...values };
|
|
6402
6411
|
const now = /* @__PURE__ */ new Date();
|
|
6403
6412
|
for (const column of metadata.timestampColumns ?? []) if (column.updatedAt) nextPayload[column.column] = now;
|
|
6404
|
-
return nextPayload;
|
|
6413
|
+
return this.castForPersistence(nextPayload);
|
|
6405
6414
|
}
|
|
6406
6415
|
resolveAffectedCount(result, fallback) {
|
|
6407
6416
|
if (typeof result === "number") return result;
|
|
@@ -6553,13 +6562,13 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6553
6562
|
return this;
|
|
6554
6563
|
}
|
|
6555
6564
|
/**
|
|
6556
|
-
* Paginates the query results and returns a LengthAwarePaginator instance
|
|
6565
|
+
* Paginates the query results and returns a LengthAwarePaginator instance
|
|
6557
6566
|
* containing data and total-aware pagination metadata.
|
|
6558
|
-
*
|
|
6559
|
-
* @param page
|
|
6560
|
-
* @param perPage
|
|
6567
|
+
*
|
|
6568
|
+
* @param page
|
|
6569
|
+
* @param perPage
|
|
6561
6570
|
* @param options
|
|
6562
|
-
* @returns
|
|
6571
|
+
* @returns
|
|
6563
6572
|
*/
|
|
6564
6573
|
async paginate(perPage = 15, page = void 0, options = {}) {
|
|
6565
6574
|
const currentPage = this.resolvePaginationPage(page, options);
|
|
@@ -6597,8 +6606,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6597
6606
|
}
|
|
6598
6607
|
/**
|
|
6599
6608
|
* Creates a clone of the current query builder instance with the same state.
|
|
6600
|
-
*
|
|
6601
|
-
* @returns
|
|
6609
|
+
*
|
|
6610
|
+
* @returns
|
|
6602
6611
|
*/
|
|
6603
6612
|
clone() {
|
|
6604
6613
|
const builder = new QueryBuilder(this.model, this.adapter);
|
|
@@ -6628,9 +6637,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6628
6637
|
}
|
|
6629
6638
|
/**
|
|
6630
6639
|
* Normalizes the input for eager loading relations into a consistent format.
|
|
6631
|
-
*
|
|
6632
|
-
* @param relations
|
|
6633
|
-
* @returns
|
|
6640
|
+
*
|
|
6641
|
+
* @param relations
|
|
6642
|
+
* @returns
|
|
6634
6643
|
*/
|
|
6635
6644
|
normalizeWith(relations) {
|
|
6636
6645
|
if (typeof relations === "string") return { [relations]: void 0 };
|
|
@@ -6819,7 +6828,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
6819
6828
|
}
|
|
6820
6829
|
/**
|
|
6821
6830
|
* Attempts to build relation load plans for the adapter based on the eager loads specified in the query builder.
|
|
6822
|
-
*
|
|
6831
|
+
*
|
|
6823
6832
|
* @returns an array of RelationLoadPlan if successful, or null if the eager loads contain constraints that cannot be represented in a way compatible with adapter-based loading.
|
|
6824
6833
|
*/
|
|
6825
6834
|
tryBuildAdapterRelationLoadPlans() {
|
|
@@ -7287,10 +7296,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7287
7296
|
return deleted;
|
|
7288
7297
|
}
|
|
7289
7298
|
/**
|
|
7290
|
-
* Builds the where clause for the query, taking into account soft delete
|
|
7299
|
+
* Builds the where clause for the query, taking into account soft delete
|
|
7291
7300
|
* settings if applicable.
|
|
7292
|
-
*
|
|
7293
|
-
* @returns
|
|
7301
|
+
*
|
|
7302
|
+
* @returns
|
|
7294
7303
|
*/
|
|
7295
7304
|
buildWhere() {
|
|
7296
7305
|
const baseWhere = this.legacyWhere ?? this.toQuerySchemaWhere(this.queryWhere);
|
|
@@ -7303,14 +7312,14 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7303
7312
|
}
|
|
7304
7313
|
/**
|
|
7305
7314
|
* Builds the arguments for the findMany delegate method, including the where clause.
|
|
7306
|
-
*
|
|
7307
|
-
* @returns
|
|
7315
|
+
*
|
|
7316
|
+
* @returns
|
|
7308
7317
|
*/
|
|
7309
7318
|
/**
|
|
7310
|
-
* Resolves a unique where clause for update and delete operations.
|
|
7311
|
-
*
|
|
7312
|
-
* @param where
|
|
7313
|
-
* @returns
|
|
7319
|
+
* Resolves a unique where clause for update and delete operations.
|
|
7320
|
+
*
|
|
7321
|
+
* @param where
|
|
7322
|
+
* @returns
|
|
7314
7323
|
*/
|
|
7315
7324
|
async resolveUniqueWhere(where, failIfMissing = true) {
|
|
7316
7325
|
if (this.isUniqueWhere(where)) return where;
|
|
@@ -7341,11 +7350,11 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7341
7350
|
return { [primaryKey]: row[primaryKey] };
|
|
7342
7351
|
}
|
|
7343
7352
|
/**
|
|
7344
|
-
* Checks if the provided where clause is already a unique
|
|
7353
|
+
* Checks if the provided where clause is already a unique
|
|
7345
7354
|
* identifier (i.e., contains only an 'id' field).
|
|
7346
|
-
*
|
|
7347
|
-
* @param where
|
|
7348
|
-
* @returns
|
|
7355
|
+
*
|
|
7356
|
+
* @param where
|
|
7357
|
+
* @returns
|
|
7349
7358
|
*/
|
|
7350
7359
|
isUniqueWhere(where) {
|
|
7351
7360
|
const primaryKey = this.model.getPrimaryKey();
|
|
@@ -7615,10 +7624,10 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7615
7624
|
//#endregion
|
|
7616
7625
|
//#region src/Model.ts
|
|
7617
7626
|
/**
|
|
7618
|
-
* Base model class that all models should extend.
|
|
7619
|
-
*
|
|
7627
|
+
* Base model class that all models should extend.
|
|
7628
|
+
*
|
|
7620
7629
|
* @template TModel The type of the model extending this base class.
|
|
7621
|
-
*
|
|
7630
|
+
*
|
|
7622
7631
|
* @author Legacy (3m1n3nc3)
|
|
7623
7632
|
* @since 0.1.0
|
|
7624
7633
|
*/
|
|
@@ -7626,6 +7635,9 @@ var Model = class Model {
|
|
|
7626
7635
|
static {
|
|
7627
7636
|
this.lifecycleStates = /* @__PURE__ */ new WeakMap();
|
|
7628
7637
|
}
|
|
7638
|
+
static {
|
|
7639
|
+
this.castMapCache = /* @__PURE__ */ new WeakMap();
|
|
7640
|
+
}
|
|
7629
7641
|
static {
|
|
7630
7642
|
this.emittedDeprecationWarnings = /* @__PURE__ */ new Set();
|
|
7631
7643
|
}
|
|
@@ -7764,6 +7776,31 @@ var Model = class Model {
|
|
|
7764
7776
|
timestampColumns: persistedMetadata.timestampColumns?.map((column) => ({ ...column }))
|
|
7765
7777
|
};
|
|
7766
7778
|
}
|
|
7779
|
+
/**
|
|
7780
|
+
* The model's cast map. Resolved from a throwaway instance (casts are an
|
|
7781
|
+
* instance field) and cached per model class.
|
|
7782
|
+
*/
|
|
7783
|
+
static getCasts() {
|
|
7784
|
+
const cached = Model.castMapCache.get(this);
|
|
7785
|
+
if (cached) return cached;
|
|
7786
|
+
const casts = { ...new this({}).casts };
|
|
7787
|
+
Model.castMapCache.set(this, casts);
|
|
7788
|
+
return casts;
|
|
7789
|
+
}
|
|
7790
|
+
/**
|
|
7791
|
+
* Apply built-in persistence casts (currently `json` serialisation) to a raw
|
|
7792
|
+
* attribute payload, without re-running arbitrary custom setters. Used by
|
|
7793
|
+
* both instance `save()` and the query-builder insert/update paths so a JS
|
|
7794
|
+
* object/array destined for a `json`/`jsonb` column is serialised to a string
|
|
7795
|
+
* rather than bound as a Postgres array.
|
|
7796
|
+
*/
|
|
7797
|
+
static castAttributesForPersistence(attributes) {
|
|
7798
|
+
const casts = this.getCasts();
|
|
7799
|
+
return Object.entries(attributes).reduce((normalized, [key, value]) => {
|
|
7800
|
+
normalized[key] = casts[key] === "json" ? resolveCast("json").set(value) : value;
|
|
7801
|
+
return normalized;
|
|
7802
|
+
}, {});
|
|
7803
|
+
}
|
|
7767
7804
|
static getRelationMetadata(name) {
|
|
7768
7805
|
const resolver = this.prototype[name];
|
|
7769
7806
|
if (typeof resolver !== "function") return null;
|
|
@@ -7941,9 +7978,9 @@ var Model = class Model {
|
|
|
7941
7978
|
* If a delegate name is provided, it will attempt to resolve that delegate.
|
|
7942
7979
|
* Otherwise, it will attempt to resolve a compatibility schema based on the model's name or
|
|
7943
7980
|
* the static `delegate` property.
|
|
7944
|
-
*
|
|
7945
|
-
* @param delegate
|
|
7946
|
-
* @returns
|
|
7981
|
+
*
|
|
7982
|
+
* @param delegate
|
|
7983
|
+
* @returns
|
|
7947
7984
|
*/
|
|
7948
7985
|
static getDelegate(delegate) {
|
|
7949
7986
|
Model.emitDeprecationWarning("ARKORM_GET_DELEGATE_DEPRECATED", "Model.getDelegate() is deprecated and will be removed in Arkorm 3.0. Use Model.getAdapter() and adapter-backed execution instead.");
|
|
@@ -7965,9 +8002,9 @@ var Model = class Model {
|
|
|
7965
8002
|
}
|
|
7966
8003
|
/**
|
|
7967
8004
|
* Get a new query builder instance for the model.
|
|
7968
|
-
*
|
|
7969
|
-
* @param this
|
|
7970
|
-
* @returns
|
|
8005
|
+
*
|
|
8006
|
+
* @param this
|
|
8007
|
+
* @returns
|
|
7971
8008
|
*/
|
|
7972
8009
|
static query() {
|
|
7973
8010
|
Model.ensureModelBooted(this);
|
|
@@ -7993,31 +8030,31 @@ var Model = class Model {
|
|
|
7993
8030
|
static booted() {}
|
|
7994
8031
|
/**
|
|
7995
8032
|
* Get a query builder instance that includes soft-deleted records.
|
|
7996
|
-
*
|
|
7997
|
-
* @param this
|
|
7998
|
-
* @returns
|
|
8033
|
+
*
|
|
8034
|
+
* @param this
|
|
8035
|
+
* @returns
|
|
7999
8036
|
*/
|
|
8000
8037
|
static withTrashed() {
|
|
8001
8038
|
return this.query().withTrashed();
|
|
8002
8039
|
}
|
|
8003
8040
|
/**
|
|
8004
8041
|
* Get a query builder instance that only includes soft-deleted records.
|
|
8005
|
-
*
|
|
8006
|
-
* @param this
|
|
8007
|
-
* @returns
|
|
8042
|
+
*
|
|
8043
|
+
* @param this
|
|
8044
|
+
* @returns
|
|
8008
8045
|
*/
|
|
8009
8046
|
static onlyTrashed() {
|
|
8010
8047
|
return this.query().onlyTrashed();
|
|
8011
8048
|
}
|
|
8012
8049
|
/**
|
|
8013
|
-
* Get a query builder instance that excludes soft-deleted records.
|
|
8014
|
-
* This is the default behavior of the query builder, but this method can be used
|
|
8050
|
+
* Get a query builder instance that excludes soft-deleted records.
|
|
8051
|
+
* This is the default behavior of the query builder, but this method can be used
|
|
8015
8052
|
* to explicitly specify it after using `withTrashed` or `onlyTrashed`.
|
|
8016
|
-
*
|
|
8017
|
-
* @param this
|
|
8018
|
-
* @param name
|
|
8019
|
-
* @param args
|
|
8020
|
-
* @returns
|
|
8053
|
+
*
|
|
8054
|
+
* @param this
|
|
8055
|
+
* @param name
|
|
8056
|
+
* @param args
|
|
8057
|
+
* @returns
|
|
8021
8058
|
*/
|
|
8022
8059
|
static scope(name, ...args) {
|
|
8023
8060
|
return this.query().scope(name, ...args);
|
|
@@ -8085,10 +8122,10 @@ var Model = class Model {
|
|
|
8085
8122
|
return deleted;
|
|
8086
8123
|
}
|
|
8087
8124
|
/**
|
|
8088
|
-
* Get the soft delete configuration for the model, including whether
|
|
8125
|
+
* Get the soft delete configuration for the model, including whether
|
|
8089
8126
|
* soft deletes are enabled and the name of the deleted at column.
|
|
8090
|
-
*
|
|
8091
|
-
* @returns
|
|
8127
|
+
*
|
|
8128
|
+
* @returns
|
|
8092
8129
|
*/
|
|
8093
8130
|
static getSoftDeleteConfig() {
|
|
8094
8131
|
return {
|
|
@@ -8097,11 +8134,11 @@ var Model = class Model {
|
|
|
8097
8134
|
};
|
|
8098
8135
|
}
|
|
8099
8136
|
/**
|
|
8100
|
-
* Hydrate a model instance from a plain object of attributes.
|
|
8101
|
-
*
|
|
8102
|
-
* @param this
|
|
8103
|
-
* @param attributes
|
|
8104
|
-
* @returns
|
|
8137
|
+
* Hydrate a model instance from a plain object of attributes.
|
|
8138
|
+
*
|
|
8139
|
+
* @param this
|
|
8140
|
+
* @param attributes
|
|
8141
|
+
* @returns
|
|
8105
8142
|
*/
|
|
8106
8143
|
static hydrate(attributes) {
|
|
8107
8144
|
const model = new this(attributes);
|
|
@@ -8112,10 +8149,10 @@ var Model = class Model {
|
|
|
8112
8149
|
}
|
|
8113
8150
|
/**
|
|
8114
8151
|
* Hydrate multiple model instances from an array of plain objects of attributes.
|
|
8115
|
-
*
|
|
8116
|
-
* @param this
|
|
8117
|
-
* @param attributes
|
|
8118
|
-
* @returns
|
|
8152
|
+
*
|
|
8153
|
+
* @param this
|
|
8154
|
+
* @param attributes
|
|
8155
|
+
* @returns
|
|
8119
8156
|
*/
|
|
8120
8157
|
static hydrateMany(attributes) {
|
|
8121
8158
|
const constructor = this;
|
|
@@ -8255,12 +8292,12 @@ var Model = class Model {
|
|
|
8255
8292
|
return await this.constructor.transaction(async () => await this.save());
|
|
8256
8293
|
}
|
|
8257
8294
|
/**
|
|
8258
|
-
* Delete the model from the database.
|
|
8259
|
-
* If soft deletes are enabled, it will perform a soft delete by
|
|
8260
|
-
* setting the deleted at column to the current date.
|
|
8295
|
+
* Delete the model from the database.
|
|
8296
|
+
* If soft deletes are enabled, it will perform a soft delete by
|
|
8297
|
+
* setting the deleted at column to the current date.
|
|
8261
8298
|
* Otherwise, it will perform a hard delete.
|
|
8262
|
-
*
|
|
8263
|
-
* @returns
|
|
8299
|
+
*
|
|
8300
|
+
* @returns
|
|
8264
8301
|
*/
|
|
8265
8302
|
async delete() {
|
|
8266
8303
|
const constructor = this.constructor;
|
|
@@ -8304,10 +8341,10 @@ var Model = class Model {
|
|
|
8304
8341
|
return await this.constructor.transaction(async () => await this.delete());
|
|
8305
8342
|
}
|
|
8306
8343
|
/**
|
|
8307
|
-
* Permanently delete the model from the database, regardless of whether soft
|
|
8344
|
+
* Permanently delete the model from the database, regardless of whether soft
|
|
8308
8345
|
* deletes are enabled.
|
|
8309
|
-
*
|
|
8310
|
-
* @returns
|
|
8346
|
+
*
|
|
8347
|
+
* @returns
|
|
8311
8348
|
*/
|
|
8312
8349
|
async forceDelete() {
|
|
8313
8350
|
const constructor = this.constructor;
|
|
@@ -8336,8 +8373,8 @@ var Model = class Model {
|
|
|
8336
8373
|
}
|
|
8337
8374
|
/**
|
|
8338
8375
|
* Restore a soft-deleted model by setting the deleted at column to null.
|
|
8339
|
-
*
|
|
8340
|
-
* @returns
|
|
8376
|
+
*
|
|
8377
|
+
* @returns
|
|
8341
8378
|
*/
|
|
8342
8379
|
async restore() {
|
|
8343
8380
|
const constructor = this.constructor;
|
|
@@ -8365,9 +8402,9 @@ var Model = class Model {
|
|
|
8365
8402
|
}
|
|
8366
8403
|
/**
|
|
8367
8404
|
* Load related models onto the current model instance.
|
|
8368
|
-
*
|
|
8369
|
-
* @param relations
|
|
8370
|
-
* @returns
|
|
8405
|
+
*
|
|
8406
|
+
* @param relations
|
|
8407
|
+
* @returns
|
|
8371
8408
|
*/
|
|
8372
8409
|
async load(relations) {
|
|
8373
8410
|
const relationMap = this.normalizeRelationMap(relations);
|
|
@@ -8433,8 +8470,8 @@ var Model = class Model {
|
|
|
8433
8470
|
}
|
|
8434
8471
|
/**
|
|
8435
8472
|
* Get the raw attributes of the model without applying any mutators or casts.
|
|
8436
|
-
*
|
|
8437
|
-
* @returns
|
|
8473
|
+
*
|
|
8474
|
+
* @returns
|
|
8438
8475
|
*/
|
|
8439
8476
|
getRawAttributes() {
|
|
8440
8477
|
return { ...this.attributes };
|
|
@@ -8495,10 +8532,10 @@ var Model = class Model {
|
|
|
8495
8532
|
}, {});
|
|
8496
8533
|
}
|
|
8497
8534
|
/**
|
|
8498
|
-
* Convert the model instance to a plain object, applying visibility
|
|
8535
|
+
* Convert the model instance to a plain object, applying visibility
|
|
8499
8536
|
* rules, appends, and mutators.
|
|
8500
|
-
*
|
|
8501
|
-
* @returns
|
|
8537
|
+
*
|
|
8538
|
+
* @returns
|
|
8502
8539
|
*/
|
|
8503
8540
|
toObject() {
|
|
8504
8541
|
const object = (this.visible.length > 0 ? this.visible : Object.keys(this.attributes).filter((key) => !this.hidden.includes(key))).reduce((accumulator, key) => {
|
|
@@ -8514,8 +8551,8 @@ var Model = class Model {
|
|
|
8514
8551
|
}
|
|
8515
8552
|
/**
|
|
8516
8553
|
* Convert the model instance to JSON by first converting it to a plain object.
|
|
8517
|
-
*
|
|
8518
|
-
* @returns
|
|
8554
|
+
*
|
|
8555
|
+
* @returns
|
|
8519
8556
|
*/
|
|
8520
8557
|
toJSON() {
|
|
8521
8558
|
return this.toObject();
|
|
@@ -8564,11 +8601,11 @@ var Model = class Model {
|
|
|
8564
8601
|
}
|
|
8565
8602
|
/**
|
|
8566
8603
|
* Define a has one relationship.
|
|
8567
|
-
*
|
|
8568
|
-
* @param related
|
|
8569
|
-
* @param foreignKey
|
|
8570
|
-
* @param localKey
|
|
8571
|
-
* @returns
|
|
8604
|
+
*
|
|
8605
|
+
* @param related
|
|
8606
|
+
* @param foreignKey
|
|
8607
|
+
* @param localKey
|
|
8608
|
+
* @returns
|
|
8572
8609
|
*/
|
|
8573
8610
|
hasOne(related, foreignKey, localKey) {
|
|
8574
8611
|
const constructor = this.constructor;
|
|
@@ -8576,11 +8613,11 @@ var Model = class Model {
|
|
|
8576
8613
|
}
|
|
8577
8614
|
/**
|
|
8578
8615
|
* Define a has many relationship.
|
|
8579
|
-
*
|
|
8580
|
-
* @param related
|
|
8581
|
-
* @param foreignKey
|
|
8582
|
-
* @param localKey
|
|
8583
|
-
* @returns
|
|
8616
|
+
*
|
|
8617
|
+
* @param related
|
|
8618
|
+
* @param foreignKey
|
|
8619
|
+
* @param localKey
|
|
8620
|
+
* @returns
|
|
8584
8621
|
*/
|
|
8585
8622
|
hasMany(related, foreignKey, localKey) {
|
|
8586
8623
|
const constructor = this.constructor;
|
|
@@ -8588,25 +8625,25 @@ var Model = class Model {
|
|
|
8588
8625
|
}
|
|
8589
8626
|
/**
|
|
8590
8627
|
* Define a belongs to relationship.
|
|
8591
|
-
*
|
|
8592
|
-
* @param related
|
|
8593
|
-
* @param foreignKey
|
|
8594
|
-
* @param ownerKey
|
|
8595
|
-
* @returns
|
|
8628
|
+
*
|
|
8629
|
+
* @param related
|
|
8630
|
+
* @param foreignKey
|
|
8631
|
+
* @param ownerKey
|
|
8632
|
+
* @returns
|
|
8596
8633
|
*/
|
|
8597
8634
|
belongsTo(related, foreignKey, ownerKey) {
|
|
8598
8635
|
return new require_relationship.BelongsToRelation(this, related, foreignKey, ownerKey ?? related.getPrimaryKey());
|
|
8599
8636
|
}
|
|
8600
8637
|
/**
|
|
8601
8638
|
* Define a belongs to many relationship.
|
|
8602
|
-
*
|
|
8603
|
-
* @param related
|
|
8639
|
+
*
|
|
8640
|
+
* @param related
|
|
8604
8641
|
* @param throughTable
|
|
8605
|
-
* @param foreignPivotKey
|
|
8606
|
-
* @param relatedPivotKey
|
|
8607
|
-
* @param parentKey
|
|
8608
|
-
* @param relatedKey
|
|
8609
|
-
* @returns
|
|
8642
|
+
* @param foreignPivotKey
|
|
8643
|
+
* @param relatedPivotKey
|
|
8644
|
+
* @param parentKey
|
|
8645
|
+
* @param relatedKey
|
|
8646
|
+
* @returns
|
|
8610
8647
|
*/
|
|
8611
8648
|
belongsToMany(related, throughTable, foreignPivotKey, relatedPivotKey, parentKey, relatedKey) {
|
|
8612
8649
|
const constructor = this.constructor;
|
|
@@ -8614,14 +8651,14 @@ var Model = class Model {
|
|
|
8614
8651
|
}
|
|
8615
8652
|
/**
|
|
8616
8653
|
* Define a has one through relationship.
|
|
8617
|
-
*
|
|
8618
|
-
* @param related
|
|
8654
|
+
*
|
|
8655
|
+
* @param related
|
|
8619
8656
|
* @param throughTable
|
|
8620
|
-
* @param firstKey
|
|
8621
|
-
* @param secondKey
|
|
8622
|
-
* @param localKey
|
|
8623
|
-
* @param secondLocalKey
|
|
8624
|
-
* @returns
|
|
8657
|
+
* @param firstKey
|
|
8658
|
+
* @param secondKey
|
|
8659
|
+
* @param localKey
|
|
8660
|
+
* @param secondLocalKey
|
|
8661
|
+
* @returns
|
|
8625
8662
|
*/
|
|
8626
8663
|
hasOneThrough(related, throughTable, firstKey, secondKey, localKey, secondLocalKey = "id") {
|
|
8627
8664
|
const constructor = this.constructor;
|
|
@@ -8629,14 +8666,14 @@ var Model = class Model {
|
|
|
8629
8666
|
}
|
|
8630
8667
|
/**
|
|
8631
8668
|
* Define a has many through relationship.
|
|
8632
|
-
*
|
|
8633
|
-
* @param related
|
|
8669
|
+
*
|
|
8670
|
+
* @param related
|
|
8634
8671
|
* @param throughTable
|
|
8635
|
-
* @param firstKey
|
|
8636
|
-
* @param secondKey
|
|
8637
|
-
* @param localKey
|
|
8638
|
-
* @param secondLocalKey
|
|
8639
|
-
* @returns
|
|
8672
|
+
* @param firstKey
|
|
8673
|
+
* @param secondKey
|
|
8674
|
+
* @param localKey
|
|
8675
|
+
* @param secondLocalKey
|
|
8676
|
+
* @returns
|
|
8640
8677
|
*/
|
|
8641
8678
|
hasManyThrough(related, throughTable, firstKey, secondKey, localKey, secondLocalKey = "id") {
|
|
8642
8679
|
const constructor = this.constructor;
|
|
@@ -8644,13 +8681,13 @@ var Model = class Model {
|
|
|
8644
8681
|
}
|
|
8645
8682
|
/**
|
|
8646
8683
|
* Define a polymorphic one to one relationship.
|
|
8647
|
-
*
|
|
8648
|
-
* @param related
|
|
8684
|
+
*
|
|
8685
|
+
* @param related
|
|
8649
8686
|
* @param morphName
|
|
8650
8687
|
* @param idColumn
|
|
8651
8688
|
* @param typeColumn
|
|
8652
8689
|
* @param localKey
|
|
8653
|
-
* @returns
|
|
8690
|
+
* @returns
|
|
8654
8691
|
*/
|
|
8655
8692
|
morphOne(related, morphName, idColumn, typeColumn, localKey) {
|
|
8656
8693
|
const constructor = this.constructor;
|
|
@@ -8659,13 +8696,13 @@ var Model = class Model {
|
|
|
8659
8696
|
}
|
|
8660
8697
|
/**
|
|
8661
8698
|
* Define a polymorphic one to many relationship.
|
|
8662
|
-
*
|
|
8663
|
-
* @param related
|
|
8699
|
+
*
|
|
8700
|
+
* @param related
|
|
8664
8701
|
* @param morphName
|
|
8665
8702
|
* @param idColumn
|
|
8666
8703
|
* @param typeColumn
|
|
8667
8704
|
* @param localKey
|
|
8668
|
-
* @returns
|
|
8705
|
+
* @returns
|
|
8669
8706
|
*/
|
|
8670
8707
|
morphMany(related, morphName, idColumn, typeColumn, localKey) {
|
|
8671
8708
|
const constructor = this.constructor;
|
|
@@ -8680,7 +8717,7 @@ var Model = class Model {
|
|
|
8680
8717
|
}
|
|
8681
8718
|
/**
|
|
8682
8719
|
* Define a polymorphic many to many relationship.
|
|
8683
|
-
*
|
|
8720
|
+
*
|
|
8684
8721
|
* @param related
|
|
8685
8722
|
* @param morphName
|
|
8686
8723
|
* @param throughTable
|
|
@@ -8689,7 +8726,7 @@ var Model = class Model {
|
|
|
8689
8726
|
* @param relatedPivotKey
|
|
8690
8727
|
* @param parentKey
|
|
8691
8728
|
* @param relatedKey
|
|
8692
|
-
* @returns
|
|
8729
|
+
* @returns
|
|
8693
8730
|
*/
|
|
8694
8731
|
morphToMany(related, morphName, throughTable, foreignPivotKey, morphTypeColumn, relatedPivotKey, parentKey, relatedKey) {
|
|
8695
8732
|
const constructor = this.constructor;
|
|
@@ -8717,9 +8754,9 @@ var Model = class Model {
|
|
|
8717
8754
|
}
|
|
8718
8755
|
/**
|
|
8719
8756
|
* Resolve a get mutator method for a given attribute key, if it exists.
|
|
8720
|
-
*
|
|
8721
|
-
* @param key
|
|
8722
|
-
* @returns
|
|
8757
|
+
*
|
|
8758
|
+
* @param key
|
|
8759
|
+
* @returns
|
|
8723
8760
|
*/
|
|
8724
8761
|
resolveGetMutator(key) {
|
|
8725
8762
|
const methodName = `get${(0, _h3ravel_support.str)(key).studly()}Attribute`;
|
|
@@ -8751,10 +8788,7 @@ var Model = class Model {
|
|
|
8751
8788
|
* @returns
|
|
8752
8789
|
*/
|
|
8753
8790
|
normalizePersistenceAttributes(attributes) {
|
|
8754
|
-
return
|
|
8755
|
-
normalized[key] = this.casts[key] === "json" ? resolveCast("json").set(value) : value;
|
|
8756
|
-
return normalized;
|
|
8757
|
-
}, {});
|
|
8791
|
+
return this.constructor.castAttributesForPersistence(attributes);
|
|
8758
8792
|
}
|
|
8759
8793
|
/**
|
|
8760
8794
|
* Normalize a key or key list for dirty/change lookups.
|
|
@@ -8786,9 +8820,9 @@ var Model = class Model {
|
|
|
8786
8820
|
}
|
|
8787
8821
|
/**
|
|
8788
8822
|
* Resolve a set mutator method for a given attribute key, if it exists.
|
|
8789
|
-
*
|
|
8790
|
-
* @param key
|
|
8791
|
-
* @returns
|
|
8823
|
+
*
|
|
8824
|
+
* @param key
|
|
8825
|
+
* @returns
|
|
8792
8826
|
*/
|
|
8793
8827
|
resolveSetMutator(key) {
|
|
8794
8828
|
const methodName = `set${(0, _h3ravel_support.str)(key).studly()}Attribute`;
|
|
@@ -9015,9 +9049,9 @@ var Model = class Model {
|
|
|
9015
9049
|
}
|
|
9016
9050
|
/**
|
|
9017
9051
|
* Normalize the relation map for eager loading.
|
|
9018
|
-
*
|
|
9019
|
-
* @param relations
|
|
9020
|
-
* @returns
|
|
9052
|
+
*
|
|
9053
|
+
* @param relations
|
|
9054
|
+
* @returns
|
|
9021
9055
|
*/
|
|
9022
9056
|
normalizeRelationMap(relations) {
|
|
9023
9057
|
if (typeof relations === "string") return { [relations]: void 0 };
|
|
@@ -9035,9 +9069,9 @@ var Model = class Model {
|
|
|
9035
9069
|
//#endregion
|
|
9036
9070
|
//#region src/database/factories.ts
|
|
9037
9071
|
/**
|
|
9038
|
-
* Base class for defining model factories.
|
|
9072
|
+
* Base class for defining model factories.
|
|
9039
9073
|
* Not meant to be used directly.
|
|
9040
|
-
*
|
|
9074
|
+
*
|
|
9041
9075
|
* @template TModel The type of model the factory creates.
|
|
9042
9076
|
* @template TAttributes The type of attributes used to create the model.
|
|
9043
9077
|
* @author Legacy (3m1n3nc3)
|
|
@@ -9063,9 +9097,9 @@ var ModelFactory = class ModelFactory {
|
|
|
9063
9097
|
configure() {}
|
|
9064
9098
|
/**
|
|
9065
9099
|
* Set the number of models to create.
|
|
9066
|
-
*
|
|
9067
|
-
* @param amount
|
|
9068
|
-
* @returns
|
|
9100
|
+
*
|
|
9101
|
+
* @param amount
|
|
9102
|
+
* @returns
|
|
9069
9103
|
*/
|
|
9070
9104
|
count(amount) {
|
|
9071
9105
|
this.ensureConfigured();
|
|
@@ -9073,9 +9107,9 @@ var ModelFactory = class ModelFactory {
|
|
|
9073
9107
|
return this;
|
|
9074
9108
|
}
|
|
9075
9109
|
/**
|
|
9076
|
-
* Define a state transformation for the factory.
|
|
9110
|
+
* Define a state transformation for the factory.
|
|
9077
9111
|
* States are applied in the order they were defined.
|
|
9078
|
-
*
|
|
9112
|
+
*
|
|
9079
9113
|
* @param resolver A function that takes the current attributes and sequence number, and returns the transformed attributes.
|
|
9080
9114
|
* @returns The factory instance for chaining.
|
|
9081
9115
|
*/
|
|
@@ -9086,9 +9120,9 @@ var ModelFactory = class ModelFactory {
|
|
|
9086
9120
|
}
|
|
9087
9121
|
/**
|
|
9088
9122
|
* Register a callback that runs after a model is made.
|
|
9089
|
-
*
|
|
9090
|
-
* @param callback
|
|
9091
|
-
* @returns
|
|
9123
|
+
*
|
|
9124
|
+
* @param callback
|
|
9125
|
+
* @returns
|
|
9092
9126
|
*/
|
|
9093
9127
|
afterMaking(callback) {
|
|
9094
9128
|
this.ensureConfigured();
|
|
@@ -9097,9 +9131,9 @@ var ModelFactory = class ModelFactory {
|
|
|
9097
9131
|
}
|
|
9098
9132
|
/**
|
|
9099
9133
|
* Register a callback that runs after a model is persisted.
|
|
9100
|
-
*
|
|
9101
|
-
* @param callback
|
|
9102
|
-
* @returns
|
|
9134
|
+
*
|
|
9135
|
+
* @param callback
|
|
9136
|
+
* @returns
|
|
9103
9137
|
*/
|
|
9104
9138
|
afterCreating(callback) {
|
|
9105
9139
|
this.ensureConfigured();
|
|
@@ -9108,9 +9142,9 @@ var ModelFactory = class ModelFactory {
|
|
|
9108
9142
|
}
|
|
9109
9143
|
/**
|
|
9110
9144
|
* Create a new model instance without saving it to the database.
|
|
9111
|
-
*
|
|
9112
|
-
* @param overrides
|
|
9113
|
-
* @returns
|
|
9145
|
+
*
|
|
9146
|
+
* @param overrides
|
|
9147
|
+
* @returns
|
|
9114
9148
|
*/
|
|
9115
9149
|
make(overrides = {}) {
|
|
9116
9150
|
this.ensureConfigured();
|
|
@@ -9135,10 +9169,10 @@ var ModelFactory = class ModelFactory {
|
|
|
9135
9169
|
}
|
|
9136
9170
|
/**
|
|
9137
9171
|
* Create multiple model instances without saving them to the database.
|
|
9138
|
-
*
|
|
9139
|
-
* @param amount
|
|
9140
|
-
* @param overrides
|
|
9141
|
-
* @returns
|
|
9172
|
+
*
|
|
9173
|
+
* @param amount
|
|
9174
|
+
* @param overrides
|
|
9175
|
+
* @returns
|
|
9142
9176
|
*/
|
|
9143
9177
|
makeMany(amount = this.amount, overrides = {}) {
|
|
9144
9178
|
const total = Math.max(1, Math.floor(amount));
|
|
@@ -9160,19 +9194,19 @@ var ModelFactory = class ModelFactory {
|
|
|
9160
9194
|
}
|
|
9161
9195
|
/**
|
|
9162
9196
|
* Create a new model instance and save it to the database.
|
|
9163
|
-
*
|
|
9164
|
-
* @param overrides
|
|
9165
|
-
* @returns
|
|
9197
|
+
*
|
|
9198
|
+
* @param overrides
|
|
9199
|
+
* @returns
|
|
9166
9200
|
*/
|
|
9167
9201
|
async create(overrides = {}) {
|
|
9168
9202
|
return await this.createPersisted(overrides);
|
|
9169
9203
|
}
|
|
9170
9204
|
/**
|
|
9171
9205
|
* Create multiple model instances and save them to the database.
|
|
9172
|
-
*
|
|
9173
|
-
* @param amount
|
|
9174
|
-
* @param overrides
|
|
9175
|
-
* @returns
|
|
9206
|
+
*
|
|
9207
|
+
* @param amount
|
|
9208
|
+
* @param overrides
|
|
9209
|
+
* @returns
|
|
9176
9210
|
*/
|
|
9177
9211
|
async createMany(amount = this.amount, overrides = {}) {
|
|
9178
9212
|
this.ensureConfigured();
|
|
@@ -9183,10 +9217,10 @@ var ModelFactory = class ModelFactory {
|
|
|
9183
9217
|
}
|
|
9184
9218
|
/**
|
|
9185
9219
|
* Create related models through a has-one or has-many relationship.
|
|
9186
|
-
*
|
|
9187
|
-
* @param factory
|
|
9188
|
-
* @param relationship
|
|
9189
|
-
* @returns
|
|
9220
|
+
*
|
|
9221
|
+
* @param factory
|
|
9222
|
+
* @param relationship
|
|
9223
|
+
* @returns
|
|
9190
9224
|
*/
|
|
9191
9225
|
has(factory, relationship) {
|
|
9192
9226
|
this.ensureConfigured();
|
|
@@ -9198,10 +9232,10 @@ var ModelFactory = class ModelFactory {
|
|
|
9198
9232
|
}
|
|
9199
9233
|
/**
|
|
9200
9234
|
* Associate the created model with a parent model or factory.
|
|
9201
|
-
*
|
|
9202
|
-
* @param related
|
|
9203
|
-
* @param relationship
|
|
9204
|
-
* @returns
|
|
9235
|
+
*
|
|
9236
|
+
* @param related
|
|
9237
|
+
* @param relationship
|
|
9238
|
+
* @returns
|
|
9205
9239
|
*/
|
|
9206
9240
|
for(related, relationship) {
|
|
9207
9241
|
this.ensureConfigured();
|
|
@@ -9213,11 +9247,11 @@ var ModelFactory = class ModelFactory {
|
|
|
9213
9247
|
}
|
|
9214
9248
|
/**
|
|
9215
9249
|
* Create or reuse related models and attach them through a many-to-many relationship.
|
|
9216
|
-
*
|
|
9217
|
-
* @param related
|
|
9218
|
-
* @param pivot
|
|
9219
|
-
* @param relationship
|
|
9220
|
-
* @returns
|
|
9250
|
+
*
|
|
9251
|
+
* @param related
|
|
9252
|
+
* @param pivot
|
|
9253
|
+
* @param relationship
|
|
9254
|
+
* @returns
|
|
9221
9255
|
*/
|
|
9222
9256
|
hasAttached(related, pivot = {}, relationship) {
|
|
9223
9257
|
this.ensureConfigured();
|
|
@@ -9230,9 +9264,9 @@ var ModelFactory = class ModelFactory {
|
|
|
9230
9264
|
}
|
|
9231
9265
|
/**
|
|
9232
9266
|
* Reuse existing models when resolving factory-backed relationships.
|
|
9233
|
-
*
|
|
9234
|
-
* @param models
|
|
9235
|
-
* @returns
|
|
9267
|
+
*
|
|
9268
|
+
* @param models
|
|
9269
|
+
* @returns
|
|
9236
9270
|
*/
|
|
9237
9271
|
recycle(models) {
|
|
9238
9272
|
this.ensureConfigured();
|
|
@@ -9246,18 +9280,18 @@ var ModelFactory = class ModelFactory {
|
|
|
9246
9280
|
}
|
|
9247
9281
|
/**
|
|
9248
9282
|
* Get the model contgructor
|
|
9249
|
-
*
|
|
9250
|
-
* @returns
|
|
9283
|
+
*
|
|
9284
|
+
* @returns
|
|
9251
9285
|
*/
|
|
9252
9286
|
getModelConstructor() {
|
|
9253
9287
|
return this.model;
|
|
9254
9288
|
}
|
|
9255
9289
|
/**
|
|
9256
|
-
* Build the attributes for a model instance, applying the factory
|
|
9290
|
+
* Build the attributes for a model instance, applying the factory
|
|
9257
9291
|
* definition and any defined states, and merging in any overrides.
|
|
9258
|
-
*
|
|
9259
|
-
* @param overrides
|
|
9260
|
-
* @returns
|
|
9292
|
+
*
|
|
9293
|
+
* @param overrides
|
|
9294
|
+
* @returns
|
|
9261
9295
|
*/
|
|
9262
9296
|
buildAttributes(overrides) {
|
|
9263
9297
|
const sequence = this.sequence;
|
|
@@ -9428,11 +9462,11 @@ var ModelFactory = class ModelFactory {
|
|
|
9428
9462
|
}
|
|
9429
9463
|
};
|
|
9430
9464
|
/**
|
|
9431
|
-
* A helper class for defining factories using an inline definition
|
|
9465
|
+
* A helper class for defining factories using an inline definition
|
|
9432
9466
|
* function, without needing to create a separate factory class.
|
|
9433
|
-
*
|
|
9467
|
+
*
|
|
9434
9468
|
* @template TModel
|
|
9435
|
-
* @template TAttributes
|
|
9469
|
+
* @template TAttributes
|
|
9436
9470
|
* @author Legacy (3m1n3nc3)
|
|
9437
9471
|
* @since 0.1.0
|
|
9438
9472
|
*/
|
|
@@ -9448,7 +9482,7 @@ var InlineFactory = class extends ModelFactory {
|
|
|
9448
9482
|
};
|
|
9449
9483
|
/**
|
|
9450
9484
|
* Define a factory for a given model using an inline definition function.
|
|
9451
|
-
*
|
|
9485
|
+
*
|
|
9452
9486
|
* @template TModel The type of model the factory creates.
|
|
9453
9487
|
* @template TAttributes The type of attributes used to create the model.
|
|
9454
9488
|
* @param model The model constructor.
|
|
@@ -9581,10 +9615,10 @@ var DB = class DB {
|
|
|
9581
9615
|
//#endregion
|
|
9582
9616
|
//#region src/PivotModel.ts
|
|
9583
9617
|
/**
|
|
9584
|
-
* Base pivot class that all pivot models should extend.
|
|
9585
|
-
*
|
|
9618
|
+
* Base pivot class that all pivot models should extend.
|
|
9619
|
+
*
|
|
9586
9620
|
* @template TModel The type of the model extending this base class.
|
|
9587
|
-
*
|
|
9621
|
+
*
|
|
9588
9622
|
* @author Legacy (3m1n3nc3)
|
|
9589
9623
|
* @since 2.0.0-next.18
|
|
9590
9624
|
*/
|