arkormx 2.0.9 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +74 -54
- package/dist/{URLDriver-BpGqakSw.d.cts → index-BJDRQWuc.d.mts} +13 -3
- package/dist/{URLDriver-DMJkuKOm.d.mts → index-D2xzn3OX.d.cts} +13 -3
- package/dist/index.cjs +421 -388
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +138 -105
- package/dist/relationship/index.cjs +14 -14
- 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/{MorphToManyRelation-CYo17sC0.cjs → relationship-CG78rqWf.cjs} +24 -40
- package/dist/{MorphToManyRelation-DWmrAkT8.mjs → relationship-RG9V2vgd.mjs} +23 -39
- package/package.json +18 -11
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
require('./relationship/index.cjs');
|
|
2
|
+
const require_relationship = require('./relationship-CG78rqWf.cjs');
|
|
4
3
|
let node_path = require("node:path");
|
|
5
4
|
let module$1 = require("module");
|
|
6
5
|
let fs = require("fs");
|
|
@@ -12,8 +11,7 @@ let _h3ravel_shared = require("@h3ravel/shared");
|
|
|
12
11
|
let _h3ravel_musket = require("@h3ravel/musket");
|
|
13
12
|
|
|
14
13
|
//#region src/Exceptions/QueryExecutionException.ts
|
|
15
|
-
var QueryExecutionException = class extends
|
|
16
|
-
inspection;
|
|
14
|
+
var QueryExecutionException = class extends require_relationship.ArkormException {
|
|
17
15
|
constructor(message = "Database query execution failed.", context = {}) {
|
|
18
16
|
super(message, {
|
|
19
17
|
code: "QUERY_EXECUTION_FAILED",
|
|
@@ -41,24 +39,28 @@ var QueryExecutionException = class extends require_MorphToManyRelation.ArkormEx
|
|
|
41
39
|
* @since 2.0.0-next.0
|
|
42
40
|
*/
|
|
43
41
|
var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
44
|
-
static
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
upsert: true,
|
|
51
|
-
updateMany: true,
|
|
52
|
-
deleteMany: true,
|
|
53
|
-
exists: true,
|
|
54
|
-
relationLoads: true,
|
|
55
|
-
relationAggregates: true,
|
|
56
|
-
relationFilters: true,
|
|
57
|
-
rawWhere: true
|
|
58
|
-
};
|
|
42
|
+
static {
|
|
43
|
+
this.migrationStateTable = "arkormx_migrations";
|
|
44
|
+
}
|
|
45
|
+
static {
|
|
46
|
+
this.migrationRunTable = "arkormx_migration_runs";
|
|
47
|
+
}
|
|
59
48
|
constructor(db, mapping = {}) {
|
|
60
49
|
this.db = db;
|
|
61
50
|
this.mapping = mapping;
|
|
51
|
+
this.capabilities = {
|
|
52
|
+
transactions: true,
|
|
53
|
+
returning: true,
|
|
54
|
+
insertMany: true,
|
|
55
|
+
upsert: true,
|
|
56
|
+
updateMany: true,
|
|
57
|
+
deleteMany: true,
|
|
58
|
+
exists: true,
|
|
59
|
+
relationLoads: true,
|
|
60
|
+
relationAggregates: true,
|
|
61
|
+
relationFilters: true,
|
|
62
|
+
rawWhere: true
|
|
63
|
+
};
|
|
62
64
|
}
|
|
63
65
|
quoteIdentifier(value) {
|
|
64
66
|
return `"${value.replace(/"/g, "\"\"")}"`;
|
|
@@ -177,7 +179,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
177
179
|
) as exists
|
|
178
180
|
`.execute(executor)).rows[0]?.exists) continue;
|
|
179
181
|
const values = column.enumValues ?? [];
|
|
180
|
-
if (values.length === 0) throw new
|
|
182
|
+
if (values.length === 0) throw new require_relationship.ArkormException(`Enum column [${column.name}] requires enum values for database-backed migrations.`);
|
|
181
183
|
await this.executeRawStatement(`create type ${this.quoteIdentifier(enumName)} as enum (${values.map((value) => this.quoteLiteral(value)).join(", ")})`, executor);
|
|
182
184
|
}
|
|
183
185
|
}
|
|
@@ -299,7 +301,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
299
301
|
}
|
|
300
302
|
resolveTable(target) {
|
|
301
303
|
if (target.table && target.table.trim().length > 0) return this.mapping[target.table] ?? target.table;
|
|
302
|
-
throw new
|
|
304
|
+
throw new require_relationship.ArkormException("Kysely adapter requires a concrete target table.", {
|
|
303
305
|
operation: "adapter.table",
|
|
304
306
|
model: target.modelName,
|
|
305
307
|
meta: { target }
|
|
@@ -375,7 +377,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
375
377
|
buildRawWhereCondition(condition) {
|
|
376
378
|
const segments = condition.sql.split("?");
|
|
377
379
|
const bindings = condition.bindings ?? [];
|
|
378
|
-
if (segments.length !== bindings.length + 1) throw new
|
|
380
|
+
if (segments.length !== bindings.length + 1) throw new require_relationship.ArkormException("Raw where bindings do not match the number of placeholders.");
|
|
379
381
|
const parts = [];
|
|
380
382
|
segments.forEach((segment, index) => {
|
|
381
383
|
if (segment.length > 0) parts.push(kysely.sql.raw(segment));
|
|
@@ -418,12 +420,12 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
418
420
|
}
|
|
419
421
|
buildRelatedTargetFromRelation(target, relation) {
|
|
420
422
|
const metadata = target.model?.getRelationMetadata(relation);
|
|
421
|
-
if (!metadata) throw new
|
|
423
|
+
if (!metadata) throw new require_relationship.UnsupportedAdapterFeatureException(`Relation [${relation}] could not be resolved for SQL-backed relation execution.`, {
|
|
422
424
|
operation: "adapter.relation.metadata",
|
|
423
425
|
model: target.modelName,
|
|
424
426
|
relation
|
|
425
427
|
});
|
|
426
|
-
if (metadata.type !== "hasMany" && metadata.type !== "hasOne" && metadata.type !== "belongsTo" && metadata.type !== "belongsToMany" && metadata.type !== "hasOneThrough" && metadata.type !== "hasManyThrough") throw new
|
|
428
|
+
if (metadata.type !== "hasMany" && metadata.type !== "hasOne" && metadata.type !== "belongsTo" && metadata.type !== "belongsToMany" && metadata.type !== "hasOneThrough" && metadata.type !== "hasManyThrough") throw new require_relationship.UnsupportedAdapterFeatureException(`Relation [${relation}] is not supported for SQL-backed relation execution by the Kysely adapter yet.`, {
|
|
427
429
|
operation: "adapter.relation.metadata",
|
|
428
430
|
model: target.modelName,
|
|
429
431
|
relation,
|
|
@@ -644,7 +646,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
644
646
|
};
|
|
645
647
|
}
|
|
646
648
|
emitDebugQuery(phase, operation, target, inspection, meta, durationMs, error) {
|
|
647
|
-
|
|
649
|
+
require_relationship.emitRuntimeDebugEvent({
|
|
648
650
|
type: "query",
|
|
649
651
|
phase,
|
|
650
652
|
adapter: "kysely",
|
|
@@ -657,7 +659,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
657
659
|
});
|
|
658
660
|
}
|
|
659
661
|
wrapExecutionError(error, operation, target, inspection, meta) {
|
|
660
|
-
if (error instanceof
|
|
662
|
+
if (error instanceof require_relationship.ArkormException) return error;
|
|
661
663
|
return new QueryExecutionException(`Failed to execute ${operation} query.`, {
|
|
662
664
|
operation: `adapter.${operation}`,
|
|
663
665
|
model: target.modelName,
|
|
@@ -997,11 +999,11 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
|
|
|
997
999
|
*/
|
|
998
1000
|
async loadRelations(spec) {
|
|
999
1001
|
if (spec.models.length === 0 || spec.relations.length === 0) return;
|
|
1000
|
-
if (spec.models.some((model) => !this.isEagerLoadableModel(model))) throw new
|
|
1002
|
+
if (spec.models.some((model) => !this.isEagerLoadableModel(model))) throw new require_relationship.UnsupportedAdapterFeatureException("Kysely adapter relation-load execution requires Arkorm model instances.", {
|
|
1001
1003
|
operation: "adapter.loadRelations",
|
|
1002
1004
|
meta: { feature: "relationLoads" }
|
|
1003
1005
|
});
|
|
1004
|
-
await new
|
|
1006
|
+
await new require_relationship.SetBasedEagerLoader(spec.models, this.toEagerLoadMap(spec.relations)).load();
|
|
1005
1007
|
}
|
|
1006
1008
|
async introspectModels(options = {}) {
|
|
1007
1009
|
const tables = options.tables?.filter(Boolean) ?? [];
|
|
@@ -1139,7 +1141,7 @@ const createKyselyAdapter = (db, mapping = {}) => {
|
|
|
1139
1141
|
|
|
1140
1142
|
//#endregion
|
|
1141
1143
|
//#region src/Exceptions/MissingDelegateException.ts
|
|
1142
|
-
var MissingDelegateException = class extends
|
|
1144
|
+
var MissingDelegateException = class extends require_relationship.ArkormException {
|
|
1143
1145
|
constructor(message, context = {}) {
|
|
1144
1146
|
super(message, {
|
|
1145
1147
|
code: "MISSING_DELEGATE",
|
|
@@ -1163,7 +1165,7 @@ var MissingDelegateException = class extends require_MorphToManyRelation.ArkormE
|
|
|
1163
1165
|
*/
|
|
1164
1166
|
function createPrismaAdapter(prisma) {
|
|
1165
1167
|
return Object.entries(prisma).reduce((accumulator, [key, value]) => {
|
|
1166
|
-
if (!
|
|
1168
|
+
if (!require_relationship.isQuerySchemaLike(value)) return accumulator;
|
|
1167
1169
|
accumulator[key] = value;
|
|
1168
1170
|
return accumulator;
|
|
1169
1171
|
}, {});
|
|
@@ -1208,13 +1210,11 @@ function inferDelegateName(modelName) {
|
|
|
1208
1210
|
* @since 2.0.0-next.0
|
|
1209
1211
|
*/
|
|
1210
1212
|
var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
1211
|
-
capabilities;
|
|
1212
|
-
delegates;
|
|
1213
1213
|
constructor(prisma, mapping = {}) {
|
|
1214
1214
|
this.prisma = prisma;
|
|
1215
1215
|
this.mapping = mapping;
|
|
1216
1216
|
this.delegates = Object.entries(prisma).reduce((accumulator, [key, value]) => {
|
|
1217
|
-
if (!
|
|
1217
|
+
if (!require_relationship.isDelegateLike(value)) return accumulator;
|
|
1218
1218
|
accumulator[key] = value;
|
|
1219
1219
|
return accumulator;
|
|
1220
1220
|
}, {});
|
|
@@ -1303,7 +1303,7 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1303
1303
|
if (!nested) return void 0;
|
|
1304
1304
|
return { NOT: nested };
|
|
1305
1305
|
}
|
|
1306
|
-
throw new
|
|
1306
|
+
throw new require_relationship.UnsupportedAdapterFeatureException("Raw where clauses are not supported by the Prisma compatibility adapter; use a SQL-backed adapter for raw SQL predicates.", {
|
|
1307
1307
|
operation: "adapter.where",
|
|
1308
1308
|
meta: {
|
|
1309
1309
|
feature: "rawWhere",
|
|
@@ -1322,7 +1322,7 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1322
1322
|
};
|
|
1323
1323
|
}
|
|
1324
1324
|
emitDebugQuery(phase, operation, target, meta, durationMs, error, inspection = null) {
|
|
1325
|
-
|
|
1325
|
+
require_relationship.emitRuntimeDebugEvent({
|
|
1326
1326
|
type: "query",
|
|
1327
1327
|
phase,
|
|
1328
1328
|
adapter: "prisma",
|
|
@@ -1335,7 +1335,7 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1335
1335
|
});
|
|
1336
1336
|
}
|
|
1337
1337
|
wrapExecutionError(error, operation, target, meta) {
|
|
1338
|
-
if (error instanceof
|
|
1338
|
+
if (error instanceof require_relationship.ArkormException) return error;
|
|
1339
1339
|
return new QueryExecutionException(`Failed to execute ${operation} query.`, {
|
|
1340
1340
|
operation: `adapter.${operation}`,
|
|
1341
1341
|
model: target.modelName,
|
|
@@ -1622,7 +1622,7 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1622
1622
|
* @param _spec
|
|
1623
1623
|
*/
|
|
1624
1624
|
async loadRelations(_spec) {
|
|
1625
|
-
throw new
|
|
1625
|
+
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.", {
|
|
1626
1626
|
operation: "adapter.loadRelations",
|
|
1627
1627
|
meta: { feature: "relationLoads" }
|
|
1628
1628
|
});
|
|
@@ -1636,7 +1636,7 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
1636
1636
|
* @returns
|
|
1637
1637
|
*/
|
|
1638
1638
|
async transaction(callback, context = {}) {
|
|
1639
|
-
if (!this.hasTransactionSupport(this.prisma)) throw new
|
|
1639
|
+
if (!this.hasTransactionSupport(this.prisma)) throw new require_relationship.UnsupportedAdapterFeatureException("Transactions are not supported by the Prisma compatibility adapter.", {
|
|
1640
1640
|
operation: "adapter.transaction",
|
|
1641
1641
|
meta: { feature: "transactions" }
|
|
1642
1642
|
});
|
|
@@ -1673,8 +1673,6 @@ const createPrismaCompatibilityAdapter = createPrismaDatabaseAdapter;
|
|
|
1673
1673
|
//#endregion
|
|
1674
1674
|
//#region src/Attribute.ts
|
|
1675
1675
|
var Attribute = class Attribute {
|
|
1676
|
-
get;
|
|
1677
|
-
set;
|
|
1678
1676
|
constructor(options = {}) {
|
|
1679
1677
|
this.get = options.get;
|
|
1680
1678
|
this.set = options.set;
|
|
@@ -1759,18 +1757,11 @@ function resolveCast(definition) {
|
|
|
1759
1757
|
* @since 0.1.0
|
|
1760
1758
|
*/
|
|
1761
1759
|
var CliApp = class {
|
|
1762
|
-
command;
|
|
1763
|
-
config = {};
|
|
1764
1760
|
constructor() {
|
|
1765
|
-
this.config =
|
|
1761
|
+
this.config = {};
|
|
1762
|
+
this.getConfig = require_relationship.getUserConfig;
|
|
1763
|
+
this.config = require_relationship.getUserConfig();
|
|
1766
1764
|
}
|
|
1767
|
-
/**
|
|
1768
|
-
* Get the current configuration object or a specific configuration value.
|
|
1769
|
-
*
|
|
1770
|
-
* @param key Optional specific configuration key to retrieve
|
|
1771
|
-
* @returns The entire configuration object or the value of the specified key
|
|
1772
|
-
*/
|
|
1773
|
-
getConfig = require_MorphToManyRelation.getUserConfig;
|
|
1774
1765
|
isUsingPrismaAdapter() {
|
|
1775
1766
|
return this.getConfig("adapter") instanceof PrismaDatabaseAdapter;
|
|
1776
1767
|
}
|
|
@@ -1907,7 +1898,7 @@ var CliApp = class {
|
|
|
1907
1898
|
* @returns
|
|
1908
1899
|
*/
|
|
1909
1900
|
resolveStubPath(stubName) {
|
|
1910
|
-
return (0, path.join)(this.resolveConfigPath("stubs",
|
|
1901
|
+
return (0, path.join)(this.resolveConfigPath("stubs", require_relationship.getDefaultStubsPath()), stubName);
|
|
1911
1902
|
}
|
|
1912
1903
|
/**
|
|
1913
1904
|
* Generate a factory file for a given model name.
|
|
@@ -1958,7 +1949,7 @@ var CliApp = class {
|
|
|
1958
1949
|
* @returns An object containing the name and path of the generated migration file.
|
|
1959
1950
|
*/
|
|
1960
1951
|
makeMigration(name) {
|
|
1961
|
-
const generated =
|
|
1952
|
+
const generated = require_relationship.generateMigrationFile(name, {
|
|
1962
1953
|
directory: this.resolveConfigPath("migrations", (0, path.join)(process.cwd(), "database", "migrations")),
|
|
1963
1954
|
extension: this.resolveOutputExt()
|
|
1964
1955
|
});
|
|
@@ -2027,13 +2018,13 @@ var CliApp = class {
|
|
|
2027
2018
|
const schemaPath = (0, path.join)(process.cwd(), "prisma", "schema.prisma");
|
|
2028
2019
|
if (!(0, fs.existsSync)(schemaPath)) return void 0;
|
|
2029
2020
|
const source = (0, fs.readFileSync)(schemaPath, "utf-8");
|
|
2030
|
-
const existingByTable =
|
|
2021
|
+
const existingByTable = require_relationship.findModelBlock(source, tableName);
|
|
2031
2022
|
const existingByName = new RegExp(`model\\s+${modelName}\\s*\\{`, "m").test(source);
|
|
2032
2023
|
if (existingByTable || existingByName) return {
|
|
2033
2024
|
path: schemaPath,
|
|
2034
2025
|
updated: false
|
|
2035
2026
|
};
|
|
2036
|
-
(0, fs.writeFileSync)(schemaPath,
|
|
2027
|
+
(0, fs.writeFileSync)(schemaPath, require_relationship.applyCreateTableOperation(source, {
|
|
2037
2028
|
type: "createTable",
|
|
2038
2029
|
table: tableName,
|
|
2039
2030
|
columns: [{
|
|
@@ -2285,8 +2276,8 @@ var CliApp = class {
|
|
|
2285
2276
|
};
|
|
2286
2277
|
}
|
|
2287
2278
|
applyPersistedFieldMetadata(structure) {
|
|
2288
|
-
const persistedMetadata =
|
|
2289
|
-
features:
|
|
2279
|
+
const persistedMetadata = require_relationship.getPersistedTableMetadata(structure.table, {
|
|
2280
|
+
features: require_relationship.resolvePersistedMetadataFeatures(this.getConfig("features")),
|
|
2290
2281
|
strict: true
|
|
2291
2282
|
});
|
|
2292
2283
|
if (Object.keys(persistedMetadata.columns).length === 0 && Object.keys(persistedMetadata.enums).length === 0) return structure;
|
|
@@ -2303,7 +2294,7 @@ var CliApp = class {
|
|
|
2303
2294
|
...field,
|
|
2304
2295
|
name: logicalName
|
|
2305
2296
|
};
|
|
2306
|
-
const enumType =
|
|
2297
|
+
const enumType = require_relationship.getPersistedEnumTsType(enumValues);
|
|
2307
2298
|
const isArray = /^Array<.+>$/.test(field.type);
|
|
2308
2299
|
return {
|
|
2309
2300
|
...field,
|
|
@@ -2321,7 +2312,7 @@ var CliApp = class {
|
|
|
2321
2312
|
*/
|
|
2322
2313
|
parsePrismaEnums(schema) {
|
|
2323
2314
|
const enums = /* @__PURE__ */ new Map();
|
|
2324
|
-
for (const match of schema.matchAll(
|
|
2315
|
+
for (const match of schema.matchAll(require_relationship.PRISMA_ENUM_REGEX)) {
|
|
2325
2316
|
const enumName = match[1];
|
|
2326
2317
|
const values = match[0].split("\n").slice(1, -1).map((line) => line.trim()).filter((line) => Boolean(line) && !line.startsWith("//")).map((line) => {
|
|
2327
2318
|
return line.match(/^([A-Za-z][A-Za-z0-9_]*)\b/)?.[1];
|
|
@@ -2537,18 +2528,21 @@ var CliApp = class {
|
|
|
2537
2528
|
* @since 0.1.0
|
|
2538
2529
|
*/
|
|
2539
2530
|
var InitCommand = class extends _h3ravel_musket.Command {
|
|
2540
|
-
|
|
2531
|
+
constructor(..._args) {
|
|
2532
|
+
super(..._args);
|
|
2533
|
+
this.signature = `init
|
|
2541
2534
|
{--force : Force overwrite if config file already exists (existing file will be backed up) }
|
|
2542
2535
|
`;
|
|
2543
|
-
|
|
2536
|
+
this.description = "Initialize Arkormˣ by creating a default config file in the current directory";
|
|
2537
|
+
}
|
|
2544
2538
|
/**
|
|
2545
2539
|
* Command handler for the init command.
|
|
2546
2540
|
*/
|
|
2547
2541
|
async handle() {
|
|
2548
2542
|
this.app.command = this;
|
|
2549
2543
|
const outputDir = (0, node_path.join)(process.cwd(), "arkormx.config.js");
|
|
2550
|
-
const { stubs } =
|
|
2551
|
-
const stubsDir = typeof stubs === "string" && stubs.trim().length > 0 ? stubs :
|
|
2544
|
+
const { stubs } = require_relationship.getUserConfig("paths") ?? {};
|
|
2545
|
+
const stubsDir = typeof stubs === "string" && stubs.trim().length > 0 ? stubs : require_relationship.getDefaultStubsPath();
|
|
2552
2546
|
const preferredStubPath = (0, node_path.join)(stubsDir, "arkormx.config.stub");
|
|
2553
2547
|
const legacyStubPath = (0, node_path.join)(stubsDir, "arkorm.config.stub");
|
|
2554
2548
|
const stubPath = (0, fs.existsSync)(preferredStubPath) ? preferredStubPath : legacyStubPath;
|
|
@@ -2576,11 +2570,14 @@ var InitCommand = class extends _h3ravel_musket.Command {
|
|
|
2576
2570
|
* @since 0.1.0
|
|
2577
2571
|
*/
|
|
2578
2572
|
var MakeFactoryCommand = class extends _h3ravel_musket.Command {
|
|
2579
|
-
|
|
2573
|
+
constructor(..._args) {
|
|
2574
|
+
super(..._args);
|
|
2575
|
+
this.signature = `make:factory
|
|
2580
2576
|
{name : Name of the factory to create}
|
|
2581
2577
|
{--f|force : Overwrite existing file}
|
|
2582
2578
|
`;
|
|
2583
|
-
|
|
2579
|
+
this.description = "Create a new model factory class";
|
|
2580
|
+
}
|
|
2584
2581
|
/**
|
|
2585
2582
|
* Command handler for the make:factory command.
|
|
2586
2583
|
*
|
|
@@ -2604,10 +2601,13 @@ var MakeFactoryCommand = class extends _h3ravel_musket.Command {
|
|
|
2604
2601
|
* @since 0.1.0
|
|
2605
2602
|
*/
|
|
2606
2603
|
var MakeMigrationCommand = class extends _h3ravel_musket.Command {
|
|
2607
|
-
|
|
2604
|
+
constructor(..._args) {
|
|
2605
|
+
super(..._args);
|
|
2606
|
+
this.signature = `make:migration
|
|
2608
2607
|
{name : Name of the migration to create}
|
|
2609
2608
|
`;
|
|
2610
|
-
|
|
2609
|
+
this.description = "Create a new migration class file";
|
|
2610
|
+
}
|
|
2611
2611
|
/**
|
|
2612
2612
|
* Command handler for the make:migration command.
|
|
2613
2613
|
*
|
|
@@ -2632,7 +2632,9 @@ var MakeMigrationCommand = class extends _h3ravel_musket.Command {
|
|
|
2632
2632
|
* @since 0.1.0
|
|
2633
2633
|
*/
|
|
2634
2634
|
var MakeModelCommand = class extends _h3ravel_musket.Command {
|
|
2635
|
-
|
|
2635
|
+
constructor(..._args) {
|
|
2636
|
+
super(..._args);
|
|
2637
|
+
this.signature = `make:model
|
|
2636
2638
|
{name : Name of the model to create}
|
|
2637
2639
|
{--f|force : Overwrite existing files}
|
|
2638
2640
|
{--factory : Create and link a factory}
|
|
@@ -2641,7 +2643,8 @@ var MakeModelCommand = class extends _h3ravel_musket.Command {
|
|
|
2641
2643
|
{--p|pivot : Indicate the required model is an intermediate pivot model}
|
|
2642
2644
|
{--all : Create and link factory, seeder, and migration}
|
|
2643
2645
|
`;
|
|
2644
|
-
|
|
2646
|
+
this.description = "Create a new model and optional linked resources";
|
|
2647
|
+
}
|
|
2645
2648
|
/**
|
|
2646
2649
|
* Command handler for the make:model command.
|
|
2647
2650
|
*
|
|
@@ -2671,11 +2674,14 @@ var MakeModelCommand = class extends _h3ravel_musket.Command {
|
|
|
2671
2674
|
* @since 0.1.0
|
|
2672
2675
|
*/
|
|
2673
2676
|
var MakeSeederCommand = class extends _h3ravel_musket.Command {
|
|
2674
|
-
|
|
2677
|
+
constructor(..._args) {
|
|
2678
|
+
super(..._args);
|
|
2679
|
+
this.signature = `make:seeder
|
|
2675
2680
|
{name : Name of the seeder to create}
|
|
2676
2681
|
{--f|force : Overwrite existing file}
|
|
2677
2682
|
`;
|
|
2678
|
-
|
|
2683
|
+
this.description = "Create a new seeder class";
|
|
2684
|
+
}
|
|
2679
2685
|
/**
|
|
2680
2686
|
* Command handler for the make:seeder command.
|
|
2681
2687
|
*/
|
|
@@ -2700,7 +2706,9 @@ const MIGRATION_BRAND = Symbol.for("arkormx.migration");
|
|
|
2700
2706
|
* @since 0.1.0
|
|
2701
2707
|
*/
|
|
2702
2708
|
var Migration = class {
|
|
2703
|
-
static
|
|
2709
|
+
static {
|
|
2710
|
+
this[MIGRATION_BRAND] = true;
|
|
2711
|
+
}
|
|
2704
2712
|
};
|
|
2705
2713
|
|
|
2706
2714
|
//#endregion
|
|
@@ -2713,7 +2721,9 @@ var Migration = class {
|
|
|
2713
2721
|
* @since 0.1.0
|
|
2714
2722
|
*/
|
|
2715
2723
|
var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
2716
|
-
|
|
2724
|
+
constructor(..._args) {
|
|
2725
|
+
super(..._args);
|
|
2726
|
+
this.signature = `migrate
|
|
2717
2727
|
{name? : Migration class or file name}
|
|
2718
2728
|
{--all : Run all migrations from the configured migrations directory}
|
|
2719
2729
|
{--deploy : Use prisma migrate deploy instead of migrate dev}
|
|
@@ -2723,7 +2733,8 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2723
2733
|
{--schema= : Explicit prisma schema path}
|
|
2724
2734
|
{--migration-name= : Name for prisma migrate dev}
|
|
2725
2735
|
`;
|
|
2726
|
-
|
|
2736
|
+
this.description = "Apply migration classes to schema.prisma and run Prisma workflow";
|
|
2737
|
+
}
|
|
2727
2738
|
/**
|
|
2728
2739
|
* Command handler for the migrate command.
|
|
2729
2740
|
* This method is responsible for orchestrating the migration
|
|
@@ -2741,20 +2752,20 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2741
2752
|
const schemaPath = this.option("schema") ? (0, node_path.resolve)(String(this.option("schema"))) : (0, node_path.join)(process.cwd(), "prisma", "schema.prisma");
|
|
2742
2753
|
const classes = this.option("all") || !this.argument("name") ? await this.loadAllMigrations(migrationsDir) : (await this.loadNamedMigration(migrationsDir, this.argument("name"))).filter(([cls]) => cls !== void 0);
|
|
2743
2754
|
if (classes.length === 0) return void this.error("Error: No migration classes found to run.");
|
|
2744
|
-
const stateFilePath =
|
|
2745
|
-
let appliedState = await
|
|
2755
|
+
const stateFilePath = require_relationship.resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
|
|
2756
|
+
let appliedState = await require_relationship.readAppliedMigrationsStateFromStore(this.app.getConfig("adapter"), stateFilePath);
|
|
2746
2757
|
const adapter = this.app.getConfig("adapter");
|
|
2747
|
-
const useDatabaseMigrations =
|
|
2748
|
-
const persistedFeatures =
|
|
2758
|
+
const useDatabaseMigrations = require_relationship.supportsDatabaseMigrationExecution(adapter);
|
|
2759
|
+
const persistedFeatures = require_relationship.resolvePersistedMetadataFeatures(this.app.getConfig("features"));
|
|
2749
2760
|
const skipped = [];
|
|
2750
2761
|
const changed = [];
|
|
2751
2762
|
const pending = classes.filter(([migrationClass, file]) => {
|
|
2752
2763
|
if (!appliedState) return true;
|
|
2753
|
-
const identity =
|
|
2754
|
-
const checksum =
|
|
2755
|
-
const alreadyApplied =
|
|
2764
|
+
const identity = require_relationship.buildMigrationIdentity(file, migrationClass.name);
|
|
2765
|
+
const checksum = require_relationship.computeMigrationChecksum(file);
|
|
2766
|
+
const alreadyApplied = require_relationship.isMigrationApplied(appliedState, identity, checksum);
|
|
2756
2767
|
if (alreadyApplied) skipped.push([migrationClass, file]);
|
|
2757
|
-
else if (
|
|
2768
|
+
else if (require_relationship.findAppliedMigration(appliedState, identity)) changed.push([migrationClass, file]);
|
|
2758
2769
|
return !alreadyApplied;
|
|
2759
2770
|
});
|
|
2760
2771
|
skipped.forEach(([migrationClass, file]) => {
|
|
@@ -2765,7 +2776,7 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2765
2776
|
});
|
|
2766
2777
|
if (pending.length === 0) {
|
|
2767
2778
|
if (appliedState) try {
|
|
2768
|
-
await
|
|
2779
|
+
await require_relationship.syncPersistedColumnMappingsFromState(process.cwd(), appliedState, await this.loadAllMigrations(migrationsDir), persistedFeatures);
|
|
2769
2780
|
} catch (error) {
|
|
2770
2781
|
this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
2771
2782
|
return;
|
|
@@ -2774,17 +2785,17 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2774
2785
|
return;
|
|
2775
2786
|
}
|
|
2776
2787
|
if (useDatabaseMigrations) try {
|
|
2777
|
-
await
|
|
2788
|
+
await require_relationship.validatePersistedMetadataFeaturesForMigrations(pending, persistedFeatures);
|
|
2778
2789
|
} catch (error) {
|
|
2779
2790
|
this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
2780
2791
|
return;
|
|
2781
2792
|
}
|
|
2782
2793
|
for (const [MigrationClassItem] of pending) {
|
|
2783
2794
|
if (useDatabaseMigrations) {
|
|
2784
|
-
await
|
|
2795
|
+
await require_relationship.applyMigrationToDatabase(adapter, MigrationClassItem);
|
|
2785
2796
|
continue;
|
|
2786
2797
|
}
|
|
2787
|
-
await
|
|
2798
|
+
await require_relationship.applyMigrationToPrismaSchema(MigrationClassItem, {
|
|
2788
2799
|
schemaPath,
|
|
2789
2800
|
write: true
|
|
2790
2801
|
});
|
|
@@ -2792,32 +2803,32 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2792
2803
|
if (appliedState) {
|
|
2793
2804
|
const runAppliedIds = [];
|
|
2794
2805
|
for (const [migrationClass, file] of pending) {
|
|
2795
|
-
const identity =
|
|
2796
|
-
appliedState =
|
|
2806
|
+
const identity = require_relationship.buildMigrationIdentity(file, migrationClass.name);
|
|
2807
|
+
appliedState = require_relationship.markMigrationApplied(appliedState, {
|
|
2797
2808
|
id: identity,
|
|
2798
2809
|
file,
|
|
2799
2810
|
className: migrationClass.name,
|
|
2800
2811
|
appliedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2801
|
-
checksum:
|
|
2812
|
+
checksum: require_relationship.computeMigrationChecksum(file)
|
|
2802
2813
|
});
|
|
2803
2814
|
runAppliedIds.push(identity);
|
|
2804
2815
|
}
|
|
2805
|
-
appliedState =
|
|
2806
|
-
id:
|
|
2816
|
+
appliedState = require_relationship.markMigrationRun(appliedState, {
|
|
2817
|
+
id: require_relationship.buildMigrationRunId(),
|
|
2807
2818
|
appliedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2808
2819
|
migrationIds: runAppliedIds
|
|
2809
2820
|
});
|
|
2810
|
-
await
|
|
2821
|
+
await require_relationship.writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedState);
|
|
2811
2822
|
try {
|
|
2812
|
-
await
|
|
2823
|
+
await require_relationship.syncPersistedColumnMappingsFromState(process.cwd(), appliedState, await this.loadAllMigrations(migrationsDir), persistedFeatures);
|
|
2813
2824
|
} catch (error) {
|
|
2814
2825
|
this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
2815
2826
|
return;
|
|
2816
2827
|
}
|
|
2817
2828
|
}
|
|
2818
|
-
if (!useDatabaseMigrations && !this.option("skip-generate"))
|
|
2819
|
-
if (!useDatabaseMigrations && !this.option("skip-migrate")) if (this.option("deploy"))
|
|
2820
|
-
else
|
|
2829
|
+
if (!useDatabaseMigrations && !this.option("skip-generate")) require_relationship.runPrismaCommand(["generate"], process.cwd());
|
|
2830
|
+
if (!useDatabaseMigrations && !this.option("skip-migrate")) if (this.option("deploy")) require_relationship.runPrismaCommand(["migrate", "deploy"], process.cwd());
|
|
2831
|
+
else require_relationship.runPrismaCommand([
|
|
2821
2832
|
"migrate",
|
|
2822
2833
|
"dev",
|
|
2823
2834
|
"--name",
|
|
@@ -2866,7 +2877,7 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2866
2877
|
* @returns
|
|
2867
2878
|
*/
|
|
2868
2879
|
async loadMigrationClassesFromFile(filePath) {
|
|
2869
|
-
const imported = await
|
|
2880
|
+
const imported = await require_relationship.RuntimeModuleLoader.load(filePath);
|
|
2870
2881
|
return Object.values(imported).filter((value) => {
|
|
2871
2882
|
if (typeof value !== "function") return false;
|
|
2872
2883
|
const candidate = value;
|
|
@@ -2879,76 +2890,79 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2879
2890
|
//#endregion
|
|
2880
2891
|
//#region src/cli/commands/MigrateFreshCommand.ts
|
|
2881
2892
|
var MigrateFreshCommand = class extends _h3ravel_musket.Command {
|
|
2882
|
-
|
|
2893
|
+
constructor(..._args) {
|
|
2894
|
+
super(..._args);
|
|
2895
|
+
this.signature = `migrate:fresh
|
|
2883
2896
|
{--skip-generate : Skip prisma generate}
|
|
2884
2897
|
{--skip-migrate : Skip prisma database sync}
|
|
2885
2898
|
{--state-file= : Path to applied migration state file}
|
|
2886
2899
|
{--schema= : Explicit prisma schema path}
|
|
2887
2900
|
`;
|
|
2888
|
-
|
|
2901
|
+
this.description = "Reset the database and rerun all migration classes";
|
|
2902
|
+
}
|
|
2889
2903
|
async handle() {
|
|
2890
2904
|
this.app.command = this;
|
|
2891
2905
|
const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? (0, node_path.join)(process.cwd(), "database", "migrations");
|
|
2892
2906
|
const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
|
|
2893
2907
|
if (!(0, node_fs.existsSync)(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
2894
2908
|
const adapter = this.app.getConfig("adapter");
|
|
2895
|
-
const useDatabaseMigrations =
|
|
2896
|
-
const persistedFeatures =
|
|
2909
|
+
const useDatabaseMigrations = require_relationship.supportsDatabaseMigrationExecution(adapter);
|
|
2910
|
+
const persistedFeatures = require_relationship.resolvePersistedMetadataFeatures(this.app.getConfig("features"));
|
|
2897
2911
|
const schemaPath = this.option("schema") ? (0, node_path.resolve)(String(this.option("schema"))) : (0, node_path.join)(process.cwd(), "prisma", "schema.prisma");
|
|
2898
|
-
const stateFilePath =
|
|
2912
|
+
const stateFilePath = require_relationship.resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
|
|
2899
2913
|
const migrations = await this.loadAllMigrations(migrationsDir);
|
|
2900
2914
|
if (migrations.length === 0) return void this.error("Error: No migration classes found to run.");
|
|
2901
2915
|
if (useDatabaseMigrations) try {
|
|
2902
|
-
await
|
|
2916
|
+
await require_relationship.validatePersistedMetadataFeaturesForMigrations(migrations, persistedFeatures);
|
|
2903
2917
|
} catch (error) {
|
|
2904
2918
|
this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
2905
2919
|
return;
|
|
2906
2920
|
}
|
|
2907
2921
|
if (useDatabaseMigrations) {
|
|
2908
|
-
if (!
|
|
2922
|
+
if (!require_relationship.supportsDatabaseReset(adapter)) {
|
|
2909
2923
|
this.error("Error: Your current database adapter does not support database reset.");
|
|
2910
2924
|
return;
|
|
2911
2925
|
}
|
|
2912
2926
|
await adapter.resetDatabase();
|
|
2913
2927
|
} else {
|
|
2914
2928
|
if (!(0, node_fs.existsSync)(schemaPath)) return void this.error(`Error: Prisma schema file not found: ${this.app.formatPathForLog(schemaPath)}`);
|
|
2915
|
-
(0, node_fs.writeFileSync)(schemaPath,
|
|
2929
|
+
(0, node_fs.writeFileSync)(schemaPath, require_relationship.stripPrismaSchemaModelsAndEnums((0, node_fs.readFileSync)(schemaPath, "utf-8")));
|
|
2916
2930
|
}
|
|
2917
|
-
let appliedState =
|
|
2918
|
-
await
|
|
2931
|
+
let appliedState = require_relationship.createEmptyAppliedMigrationsState();
|
|
2932
|
+
await require_relationship.writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedState);
|
|
2919
2933
|
for (const [MigrationClassItem] of migrations) {
|
|
2920
2934
|
if (useDatabaseMigrations) {
|
|
2921
|
-
await
|
|
2935
|
+
await require_relationship.applyMigrationToDatabase(adapter, MigrationClassItem);
|
|
2922
2936
|
continue;
|
|
2923
2937
|
}
|
|
2924
|
-
await
|
|
2938
|
+
await require_relationship.applyMigrationToPrismaSchema(MigrationClassItem, {
|
|
2925
2939
|
schemaPath,
|
|
2926
2940
|
write: true
|
|
2927
2941
|
});
|
|
2928
2942
|
}
|
|
2929
|
-
for (const [migrationClass, file] of migrations) appliedState =
|
|
2930
|
-
id:
|
|
2943
|
+
for (const [migrationClass, file] of migrations) appliedState = require_relationship.markMigrationApplied(appliedState, {
|
|
2944
|
+
id: require_relationship.buildMigrationIdentity(file, migrationClass.name),
|
|
2931
2945
|
file,
|
|
2932
2946
|
className: migrationClass.name,
|
|
2933
2947
|
appliedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2934
|
-
checksum:
|
|
2948
|
+
checksum: require_relationship.computeMigrationChecksum(file)
|
|
2935
2949
|
});
|
|
2936
|
-
appliedState =
|
|
2937
|
-
id:
|
|
2950
|
+
appliedState = require_relationship.markMigrationRun(appliedState, {
|
|
2951
|
+
id: require_relationship.buildMigrationRunId(),
|
|
2938
2952
|
appliedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2939
2953
|
migrationIds: appliedState.migrations.map((migration) => migration.id)
|
|
2940
2954
|
});
|
|
2941
|
-
await
|
|
2955
|
+
await require_relationship.writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedState);
|
|
2942
2956
|
try {
|
|
2943
|
-
await
|
|
2957
|
+
await require_relationship.syncPersistedColumnMappingsFromState(process.cwd(), appliedState, migrations, persistedFeatures);
|
|
2944
2958
|
} catch (error) {
|
|
2945
2959
|
this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
2946
2960
|
return;
|
|
2947
2961
|
}
|
|
2948
2962
|
if (!useDatabaseMigrations) {
|
|
2949
2963
|
const schemaArgs = this.option("schema") ? ["--schema", schemaPath] : [];
|
|
2950
|
-
if (!this.option("skip-generate"))
|
|
2951
|
-
if (!this.option("skip-migrate"))
|
|
2964
|
+
if (!this.option("skip-generate")) require_relationship.runPrismaCommand(["generate", ...schemaArgs], process.cwd());
|
|
2965
|
+
if (!this.option("skip-migrate")) require_relationship.runPrismaCommand([
|
|
2952
2966
|
"db",
|
|
2953
2967
|
"push",
|
|
2954
2968
|
"--force-reset",
|
|
@@ -2963,7 +2977,7 @@ var MigrateFreshCommand = class extends _h3ravel_musket.Command {
|
|
|
2963
2977
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
2964
2978
|
}
|
|
2965
2979
|
async loadMigrationClassesFromFile(filePath) {
|
|
2966
|
-
const imported = await
|
|
2980
|
+
const imported = await require_relationship.RuntimeModuleLoader.load(filePath);
|
|
2967
2981
|
return Object.values(imported).filter((value) => {
|
|
2968
2982
|
if (typeof value !== "function") return false;
|
|
2969
2983
|
const candidate = value;
|
|
@@ -2983,7 +2997,9 @@ var MigrateFreshCommand = class extends _h3ravel_musket.Command {
|
|
|
2983
2997
|
* @since 0.2.4
|
|
2984
2998
|
*/
|
|
2985
2999
|
var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
|
|
2986
|
-
|
|
3000
|
+
constructor(..._args) {
|
|
3001
|
+
super(..._args);
|
|
3002
|
+
this.signature = `migrate:rollback
|
|
2987
3003
|
{--step= : Number of latest applied migration classes to rollback}
|
|
2988
3004
|
{--dry-run : Preview rollback targets without applying changes}
|
|
2989
3005
|
{--deploy : Use prisma migrate deploy instead of migrate dev}
|
|
@@ -2993,23 +3009,24 @@ var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
|
|
|
2993
3009
|
{--schema= : Explicit prisma schema path}
|
|
2994
3010
|
{--migration-name= : Name for prisma migrate dev}
|
|
2995
3011
|
`;
|
|
2996
|
-
|
|
3012
|
+
this.description = "Rollback migration classes from schema.prisma and run Prisma workflow";
|
|
3013
|
+
}
|
|
2997
3014
|
async handle() {
|
|
2998
3015
|
this.app.command = this;
|
|
2999
3016
|
const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? (0, node_path.join)(process.cwd(), "database", "migrations");
|
|
3000
3017
|
const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
|
|
3001
3018
|
if (!(0, node_fs.existsSync)(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
3002
3019
|
const schemaPath = this.option("schema") ? (0, node_path.resolve)(String(this.option("schema"))) : (0, node_path.join)(process.cwd(), "prisma", "schema.prisma");
|
|
3003
|
-
const stateFilePath =
|
|
3020
|
+
const stateFilePath = require_relationship.resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
|
|
3004
3021
|
const adapter = this.app.getConfig("adapter");
|
|
3005
|
-
const useDatabaseMigrations =
|
|
3006
|
-
const persistedFeatures =
|
|
3007
|
-
let appliedState = await
|
|
3022
|
+
const useDatabaseMigrations = require_relationship.supportsDatabaseMigrationExecution(adapter);
|
|
3023
|
+
const persistedFeatures = require_relationship.resolvePersistedMetadataFeatures(this.app.getConfig("features"));
|
|
3024
|
+
let appliedState = await require_relationship.readAppliedMigrationsStateFromStore(adapter, stateFilePath);
|
|
3008
3025
|
const stepOption = this.option("step");
|
|
3009
3026
|
const stepCount = stepOption == null ? void 0 : Number(stepOption);
|
|
3010
3027
|
if (stepCount != null && (!Number.isFinite(stepCount) || stepCount <= 0 || !Number.isInteger(stepCount))) return void this.error("Error: --step must be a positive integer.");
|
|
3011
|
-
const targets = stepCount ?
|
|
3012
|
-
const lastRun =
|
|
3028
|
+
const targets = stepCount ? require_relationship.getLatestAppliedMigrations(appliedState, stepCount) : (() => {
|
|
3029
|
+
const lastRun = require_relationship.getLastMigrationRun(appliedState);
|
|
3013
3030
|
if (!lastRun) return [];
|
|
3014
3031
|
return lastRun.migrationIds.map((id) => appliedState.migrations.find((migration) => migration.id === id)).filter((migration) => Boolean(migration));
|
|
3015
3032
|
})();
|
|
@@ -3017,7 +3034,7 @@ var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
|
|
|
3017
3034
|
const available = await this.loadAllMigrations(migrationsDir);
|
|
3018
3035
|
const rollbackClasses = targets.map((target) => {
|
|
3019
3036
|
return available.find(([migrationClass, file]) => {
|
|
3020
|
-
return
|
|
3037
|
+
return require_relationship.buildMigrationIdentity(file, migrationClass.name) === target.id || migrationClass.name === target.className;
|
|
3021
3038
|
});
|
|
3022
3039
|
}).filter((entry) => Boolean(entry));
|
|
3023
3040
|
if (rollbackClasses.length === 0) return void this.error("Error: Unable to resolve rollback migration classes from tracked history.");
|
|
@@ -3028,28 +3045,28 @@ var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
|
|
|
3028
3045
|
}
|
|
3029
3046
|
for (const [MigrationClassItem] of rollbackClasses) {
|
|
3030
3047
|
if (useDatabaseMigrations) {
|
|
3031
|
-
await
|
|
3048
|
+
await require_relationship.applyMigrationRollbackToDatabase(adapter, MigrationClassItem);
|
|
3032
3049
|
continue;
|
|
3033
3050
|
}
|
|
3034
|
-
await
|
|
3051
|
+
await require_relationship.applyMigrationRollbackToPrismaSchema(MigrationClassItem, {
|
|
3035
3052
|
schemaPath,
|
|
3036
3053
|
write: true
|
|
3037
3054
|
});
|
|
3038
3055
|
}
|
|
3039
3056
|
for (const [migrationClass, file] of rollbackClasses) {
|
|
3040
|
-
const identity =
|
|
3041
|
-
appliedState =
|
|
3057
|
+
const identity = require_relationship.buildMigrationIdentity(file, migrationClass.name);
|
|
3058
|
+
appliedState = require_relationship.removeAppliedMigration(appliedState, identity);
|
|
3042
3059
|
}
|
|
3043
|
-
await
|
|
3060
|
+
await require_relationship.writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedState);
|
|
3044
3061
|
try {
|
|
3045
|
-
await
|
|
3062
|
+
await require_relationship.syncPersistedColumnMappingsFromState(process.cwd(), appliedState, available, persistedFeatures);
|
|
3046
3063
|
} catch (error) {
|
|
3047
3064
|
this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
3048
3065
|
return;
|
|
3049
3066
|
}
|
|
3050
|
-
if (!useDatabaseMigrations && !this.option("skip-generate"))
|
|
3051
|
-
if (!useDatabaseMigrations && !this.option("skip-migrate")) if (this.option("deploy"))
|
|
3052
|
-
else
|
|
3067
|
+
if (!useDatabaseMigrations && !this.option("skip-generate")) require_relationship.runPrismaCommand(["generate"], process.cwd());
|
|
3068
|
+
if (!useDatabaseMigrations && !this.option("skip-migrate")) if (this.option("deploy")) require_relationship.runPrismaCommand(["migrate", "deploy"], process.cwd());
|
|
3069
|
+
else require_relationship.runPrismaCommand([
|
|
3053
3070
|
"migrate",
|
|
3054
3071
|
"dev",
|
|
3055
3072
|
"--name",
|
|
@@ -3063,7 +3080,7 @@ var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
|
|
|
3063
3080
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
3064
3081
|
}
|
|
3065
3082
|
async loadMigrationClassesFromFile(filePath) {
|
|
3066
|
-
const imported = await
|
|
3083
|
+
const imported = await require_relationship.RuntimeModuleLoader.load(filePath);
|
|
3067
3084
|
return Object.values(imported).filter((value) => {
|
|
3068
3085
|
if (typeof value !== "function") return false;
|
|
3069
3086
|
const candidate = value;
|
|
@@ -3082,22 +3099,25 @@ var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
|
|
|
3082
3099
|
* @since 0.2.4
|
|
3083
3100
|
*/
|
|
3084
3101
|
var MigrationHistoryCommand = class extends _h3ravel_musket.Command {
|
|
3085
|
-
|
|
3102
|
+
constructor(..._args) {
|
|
3103
|
+
super(..._args);
|
|
3104
|
+
this.signature = `migrate:history
|
|
3086
3105
|
{--state-file= : Path to applied migration state file}
|
|
3087
3106
|
{--reset : Clear tracked migration history file}
|
|
3088
3107
|
{--delete : Delete tracked migration history file}
|
|
3089
3108
|
{--json : Print raw JSON output}
|
|
3090
3109
|
`;
|
|
3091
|
-
|
|
3110
|
+
this.description = "Inspect or reset tracked migration history";
|
|
3111
|
+
}
|
|
3092
3112
|
async handle() {
|
|
3093
3113
|
this.app.command = this;
|
|
3094
|
-
const stateFilePath =
|
|
3114
|
+
const stateFilePath = require_relationship.resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
|
|
3095
3115
|
const adapter = this.app.getConfig("adapter");
|
|
3096
|
-
const usesDatabaseState =
|
|
3116
|
+
const usesDatabaseState = require_relationship.supportsDatabaseMigrationState(adapter);
|
|
3097
3117
|
if (this.option("delete")) {
|
|
3098
3118
|
if (usesDatabaseState) {
|
|
3099
|
-
await adapter.writeAppliedMigrationsState(
|
|
3100
|
-
|
|
3119
|
+
await adapter.writeAppliedMigrationsState(require_relationship.createEmptyAppliedMigrationsState());
|
|
3120
|
+
require_relationship.deletePersistedColumnMappingsState(require_relationship.resolveColumnMappingsFilePath(process.cwd()));
|
|
3101
3121
|
this.success("Deleted tracked migration state from database.");
|
|
3102
3122
|
return;
|
|
3103
3123
|
}
|
|
@@ -3106,17 +3126,17 @@ var MigrationHistoryCommand = class extends _h3ravel_musket.Command {
|
|
|
3106
3126
|
return;
|
|
3107
3127
|
}
|
|
3108
3128
|
(0, node_fs.rmSync)(stateFilePath);
|
|
3109
|
-
|
|
3129
|
+
require_relationship.deletePersistedColumnMappingsState(require_relationship.resolveColumnMappingsFilePath(process.cwd()));
|
|
3110
3130
|
this.success(`Deleted migration state file: ${this.app.formatPathForLog(stateFilePath)}`);
|
|
3111
3131
|
return;
|
|
3112
3132
|
}
|
|
3113
3133
|
if (this.option("reset")) {
|
|
3114
|
-
await
|
|
3115
|
-
|
|
3134
|
+
await require_relationship.writeAppliedMigrationsStateToStore(adapter, stateFilePath, require_relationship.createEmptyAppliedMigrationsState());
|
|
3135
|
+
require_relationship.deletePersistedColumnMappingsState(require_relationship.resolveColumnMappingsFilePath(process.cwd()));
|
|
3116
3136
|
this.success(usesDatabaseState ? "Reset migration state in database." : `Reset migration state: ${this.app.formatPathForLog(stateFilePath)}`);
|
|
3117
3137
|
return;
|
|
3118
3138
|
}
|
|
3119
|
-
const state = await
|
|
3139
|
+
const state = await require_relationship.readAppliedMigrationsStateFromStore(adapter, stateFilePath);
|
|
3120
3140
|
if (this.option("json")) {
|
|
3121
3141
|
this.success(JSON.stringify({
|
|
3122
3142
|
path: usesDatabaseState ? "database" : stateFilePath,
|
|
@@ -3139,11 +3159,14 @@ var MigrationHistoryCommand = class extends _h3ravel_musket.Command {
|
|
|
3139
3159
|
//#endregion
|
|
3140
3160
|
//#region src/cli/commands/ModelsSyncCommand.ts
|
|
3141
3161
|
var ModelsSyncCommand = class extends _h3ravel_musket.Command {
|
|
3142
|
-
|
|
3162
|
+
constructor(..._args) {
|
|
3163
|
+
super(..._args);
|
|
3164
|
+
this.signature = `models:sync
|
|
3143
3165
|
{--schema= : Path to prisma schema file used when adapter introspection is unavailable}
|
|
3144
3166
|
{--models= : Path to models directory}
|
|
3145
3167
|
`;
|
|
3146
|
-
|
|
3168
|
+
this.description = "Sync model declare attributes from the active adapter when supported";
|
|
3169
|
+
}
|
|
3147
3170
|
async handle() {
|
|
3148
3171
|
this.app.command = this;
|
|
3149
3172
|
let result;
|
|
@@ -3180,7 +3203,9 @@ const SEEDER_BRAND = Symbol.for("arkormx.seeder");
|
|
|
3180
3203
|
* @since 0.1.0
|
|
3181
3204
|
*/
|
|
3182
3205
|
var Seeder = class Seeder {
|
|
3183
|
-
static
|
|
3206
|
+
static {
|
|
3207
|
+
this[SEEDER_BRAND] = true;
|
|
3208
|
+
}
|
|
3184
3209
|
/**
|
|
3185
3210
|
* Runs one or more seeders.
|
|
3186
3211
|
*
|
|
@@ -3226,11 +3251,14 @@ var Seeder = class Seeder {
|
|
|
3226
3251
|
* @since 0.1.0
|
|
3227
3252
|
*/
|
|
3228
3253
|
var SeedCommand = class extends _h3ravel_musket.Command {
|
|
3229
|
-
|
|
3254
|
+
constructor(..._args) {
|
|
3255
|
+
super(..._args);
|
|
3256
|
+
this.signature = `seed
|
|
3230
3257
|
{name? : Seeder class or file name}
|
|
3231
3258
|
{--all : Run all seeders in the configured seeders directory}
|
|
3232
3259
|
`;
|
|
3233
|
-
|
|
3260
|
+
this.description = "Run one or more seeders";
|
|
3261
|
+
}
|
|
3234
3262
|
/**
|
|
3235
3263
|
* Command handler for the seed command.
|
|
3236
3264
|
*
|
|
@@ -3287,7 +3315,7 @@ var SeedCommand = class extends _h3ravel_musket.Command {
|
|
|
3287
3315
|
* @returns An array of seeder classes.
|
|
3288
3316
|
*/
|
|
3289
3317
|
async loadSeederClassesFromFile(filePath) {
|
|
3290
|
-
const imported = await
|
|
3318
|
+
const imported = await require_relationship.RuntimeModuleLoader.load(filePath);
|
|
3291
3319
|
return Object.values(imported).filter((value) => {
|
|
3292
3320
|
if (typeof value !== "function") return false;
|
|
3293
3321
|
const candidate = value;
|
|
@@ -3320,9 +3348,11 @@ var logo_default = String.raw`
|
|
|
3320
3348
|
* @since 0.1.0
|
|
3321
3349
|
*/
|
|
3322
3350
|
var ModelFactory = class {
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3351
|
+
constructor() {
|
|
3352
|
+
this.amount = 1;
|
|
3353
|
+
this.sequence = 0;
|
|
3354
|
+
this.states = [];
|
|
3355
|
+
}
|
|
3326
3356
|
/**
|
|
3327
3357
|
* Set the number of models to create.
|
|
3328
3358
|
*
|
|
@@ -3418,7 +3448,6 @@ var ModelFactory = class {
|
|
|
3418
3448
|
* @since 0.1.0
|
|
3419
3449
|
*/
|
|
3420
3450
|
var InlineFactory = class extends ModelFactory {
|
|
3421
|
-
model;
|
|
3422
3451
|
constructor(model, resolver) {
|
|
3423
3452
|
super();
|
|
3424
3453
|
this.resolver = resolver;
|
|
@@ -3450,8 +3479,7 @@ const defineFactory = (model, definition) => {
|
|
|
3450
3479
|
* @author Legacy (3m1n3nc3)
|
|
3451
3480
|
* @since 0.1.0
|
|
3452
3481
|
*/
|
|
3453
|
-
var ModelNotFoundException = class extends
|
|
3454
|
-
modelName;
|
|
3482
|
+
var ModelNotFoundException = class extends require_relationship.ArkormException {
|
|
3455
3483
|
constructor(modelName, message = "No query results for the given model.", context = {}) {
|
|
3456
3484
|
super(message, {
|
|
3457
3485
|
code: "MODEL_NOT_FOUND",
|
|
@@ -3468,7 +3496,7 @@ var ModelNotFoundException = class extends require_MorphToManyRelation.ArkormExc
|
|
|
3468
3496
|
|
|
3469
3497
|
//#endregion
|
|
3470
3498
|
//#region src/Exceptions/QueryConstraintException.ts
|
|
3471
|
-
var QueryConstraintException = class extends
|
|
3499
|
+
var QueryConstraintException = class extends require_relationship.ArkormException {
|
|
3472
3500
|
constructor(message, context = {}) {
|
|
3473
3501
|
super(message, {
|
|
3474
3502
|
code: "QUERY_CONSTRAINT",
|
|
@@ -3480,7 +3508,7 @@ var QueryConstraintException = class extends require_MorphToManyRelation.ArkormE
|
|
|
3480
3508
|
|
|
3481
3509
|
//#endregion
|
|
3482
3510
|
//#region src/Exceptions/ScopeNotDefinedException.ts
|
|
3483
|
-
var ScopeNotDefinedException = class extends
|
|
3511
|
+
var ScopeNotDefinedException = class extends require_relationship.ArkormException {
|
|
3484
3512
|
constructor(message, context = {}) {
|
|
3485
3513
|
super(message, {
|
|
3486
3514
|
code: "SCOPE_NOT_DEFINED",
|
|
@@ -3492,7 +3520,7 @@ var ScopeNotDefinedException = class extends require_MorphToManyRelation.ArkormE
|
|
|
3492
3520
|
|
|
3493
3521
|
//#endregion
|
|
3494
3522
|
//#region src/Exceptions/UniqueConstraintResolutionException.ts
|
|
3495
|
-
var UniqueConstraintResolutionException = class extends
|
|
3523
|
+
var UniqueConstraintResolutionException = class extends require_relationship.ArkormException {
|
|
3496
3524
|
constructor(message, context = {}) {
|
|
3497
3525
|
super(message, {
|
|
3498
3526
|
code: "UNIQUE_CONSTRAINT_RESOLUTION_FAILED",
|
|
@@ -3513,19 +3541,6 @@ var UniqueConstraintResolutionException = class extends require_MorphToManyRelat
|
|
|
3513
3541
|
* @since 0.1.0
|
|
3514
3542
|
*/
|
|
3515
3543
|
var QueryBuilder = class QueryBuilder {
|
|
3516
|
-
queryWhere;
|
|
3517
|
-
legacyWhere;
|
|
3518
|
-
queryRelationLoads;
|
|
3519
|
-
queryOrderBy;
|
|
3520
|
-
querySelect;
|
|
3521
|
-
offsetValue;
|
|
3522
|
-
limitValue;
|
|
3523
|
-
eagerLoads = {};
|
|
3524
|
-
includeTrashed = false;
|
|
3525
|
-
onlyTrashedRecords = false;
|
|
3526
|
-
randomOrderEnabled = false;
|
|
3527
|
-
relationFilters = [];
|
|
3528
|
-
relationAggregates = [];
|
|
3529
3544
|
/**
|
|
3530
3545
|
* Creates a new QueryBuilder instance.
|
|
3531
3546
|
*
|
|
@@ -3534,11 +3549,17 @@ var QueryBuilder = class QueryBuilder {
|
|
|
3534
3549
|
constructor(model, adapter) {
|
|
3535
3550
|
this.model = model;
|
|
3536
3551
|
this.adapter = adapter;
|
|
3552
|
+
this.eagerLoads = {};
|
|
3553
|
+
this.includeTrashed = false;
|
|
3554
|
+
this.onlyTrashedRecords = false;
|
|
3555
|
+
this.randomOrderEnabled = false;
|
|
3556
|
+
this.relationFilters = [];
|
|
3557
|
+
this.relationAggregates = [];
|
|
3537
3558
|
}
|
|
3538
3559
|
resolvePaginationPage(page, options) {
|
|
3539
3560
|
if (typeof page !== "undefined") return Number.isFinite(page) ? Math.max(1, page) : 1;
|
|
3540
3561
|
const pageName = options.pageName ?? "page";
|
|
3541
|
-
const resolvedPage =
|
|
3562
|
+
const resolvedPage = require_relationship.getRuntimePaginationCurrentPageResolver()?.(pageName, options);
|
|
3542
3563
|
if (typeof resolvedPage !== "number" || !Number.isFinite(resolvedPage)) return 1;
|
|
3543
3564
|
return Math.max(1, resolvedPage);
|
|
3544
3565
|
}
|
|
@@ -3769,7 +3790,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
3769
3790
|
}
|
|
3770
3791
|
coerceDate(value) {
|
|
3771
3792
|
const parsed = value instanceof Date ? new Date(value.getTime()) : new Date(value);
|
|
3772
|
-
if (Number.isNaN(parsed.getTime())) throw new
|
|
3793
|
+
if (Number.isNaN(parsed.getTime())) throw new require_relationship.ArkormException("Invalid date value for date-based query helper.");
|
|
3773
3794
|
return parsed;
|
|
3774
3795
|
}
|
|
3775
3796
|
/**
|
|
@@ -3801,7 +3822,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
3801
3822
|
orderBy(orderBy) {
|
|
3802
3823
|
this.randomOrderEnabled = false;
|
|
3803
3824
|
const normalized = this.normalizeQueryOrderBy(orderBy);
|
|
3804
|
-
if (!normalized) throw new
|
|
3825
|
+
if (!normalized) throw new require_relationship.UnsupportedAdapterFeatureException("Order clauses must use Arkorm-normalizable column directions.", {
|
|
3805
3826
|
operation: "orderBy",
|
|
3806
3827
|
model: this.model.name
|
|
3807
3828
|
});
|
|
@@ -3856,7 +3877,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
3856
3877
|
*/
|
|
3857
3878
|
include(include) {
|
|
3858
3879
|
const normalized = this.normalizeRelationLoads(include);
|
|
3859
|
-
if (normalized === null) throw new
|
|
3880
|
+
if (normalized === null) throw new require_relationship.UnsupportedAdapterFeatureException("Include clauses could not be normalized into Arkorm relation load plans.", {
|
|
3860
3881
|
operation: "include",
|
|
3861
3882
|
model: this.model.name,
|
|
3862
3883
|
meta: { feature: "relationLoads" }
|
|
@@ -4186,7 +4207,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4186
4207
|
*/
|
|
4187
4208
|
select(select) {
|
|
4188
4209
|
const normalized = this.normalizeQuerySelect(select);
|
|
4189
|
-
if (normalized === null) throw new
|
|
4210
|
+
if (normalized === null) throw new require_relationship.UnsupportedAdapterFeatureException("Select clauses must use Arkorm-normalizable column projections.", {
|
|
4190
4211
|
operation: "select",
|
|
4191
4212
|
model: this.model.name
|
|
4192
4213
|
});
|
|
@@ -4243,7 +4264,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4243
4264
|
if (typeof adapter.inspectQuery !== "function") return null;
|
|
4244
4265
|
if (operation === "count") {
|
|
4245
4266
|
const spec = this.tryBuildAggregateSpec();
|
|
4246
|
-
if (!spec) throw new
|
|
4267
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Query shape could not be compiled into an Arkorm aggregate specification.", {
|
|
4247
4268
|
operation: "query.inspect",
|
|
4248
4269
|
model: this.model.name
|
|
4249
4270
|
});
|
|
@@ -4253,7 +4274,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4253
4274
|
});
|
|
4254
4275
|
}
|
|
4255
4276
|
const spec = this.tryBuildSelectSpec(this.buildWhere());
|
|
4256
|
-
if (!spec) throw new
|
|
4277
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Query shape could not be compiled into an Arkorm select specification.", {
|
|
4257
4278
|
operation: "query.inspect",
|
|
4258
4279
|
model: this.model.name
|
|
4259
4280
|
});
|
|
@@ -4302,7 +4323,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4302
4323
|
} else filteredModels = await this.filterModelsByRelationConstraints(models, relationCache);
|
|
4303
4324
|
if (this.hasRelationAggregates() && useCompatibilityRelationFallback) await this.applyRelationAggregates(filteredModels, relationCache);
|
|
4304
4325
|
await this.eagerLoadModels(filteredModels);
|
|
4305
|
-
return new
|
|
4326
|
+
return new require_relationship.ArkormCollection(filteredModels);
|
|
4306
4327
|
}
|
|
4307
4328
|
/**
|
|
4308
4329
|
* Executes the query and returns the first result as a model
|
|
@@ -4383,8 +4404,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4383
4404
|
*/
|
|
4384
4405
|
async pluck(column, key) {
|
|
4385
4406
|
const rows = await this.executeReadRows();
|
|
4386
|
-
if (!key) return new
|
|
4387
|
-
return new
|
|
4407
|
+
if (!key) return new require_relationship.ArkormCollection(rows.map((row) => row[column]));
|
|
4408
|
+
return new require_relationship.ArkormCollection(rows.sort((leftRow, rightRow) => String(leftRow[key]).localeCompare(String(rightRow[key]))).map((row) => row[column]));
|
|
4388
4409
|
}
|
|
4389
4410
|
/**
|
|
4390
4411
|
* Creates a new record with the specified data and returns it as a model instance.
|
|
@@ -4697,7 +4718,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4697
4718
|
const now = /* @__PURE__ */ new Date();
|
|
4698
4719
|
const primaryKeyValue = nextPayload[metadata.primaryKey];
|
|
4699
4720
|
if (primaryKeyValue === void 0 || primaryKeyValue === null) {
|
|
4700
|
-
const generated =
|
|
4721
|
+
const generated = require_relationship.PrimaryKeyGenerationPlanner.generate(metadata.primaryKeyGeneration);
|
|
4701
4722
|
if (generated !== void 0) nextPayload[metadata.primaryKey] = generated;
|
|
4702
4723
|
}
|
|
4703
4724
|
for (const column of metadata.timestampColumns ?? []) {
|
|
@@ -4831,7 +4852,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4831
4852
|
* @returns
|
|
4832
4853
|
*/
|
|
4833
4854
|
whereRaw(sql, bindings = []) {
|
|
4834
|
-
if (!this.adapter?.capabilities?.rawWhere) throw new
|
|
4855
|
+
if (!this.adapter?.capabilities?.rawWhere) throw new require_relationship.UnsupportedAdapterFeatureException("Raw where clauses are not supported by the current adapter.", {
|
|
4835
4856
|
operation: "whereRaw",
|
|
4836
4857
|
model: this.model.name,
|
|
4837
4858
|
meta: { feature: "rawWhere" }
|
|
@@ -4851,7 +4872,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4851
4872
|
* @returns
|
|
4852
4873
|
*/
|
|
4853
4874
|
orWhereRaw(sql, bindings = []) {
|
|
4854
|
-
if (!this.adapter?.capabilities?.rawWhere) throw new
|
|
4875
|
+
if (!this.adapter?.capabilities?.rawWhere) throw new require_relationship.UnsupportedAdapterFeatureException("Raw where clauses are not supported by the current adapter.", {
|
|
4855
4876
|
operation: "orWhereRaw",
|
|
4856
4877
|
model: this.model.name,
|
|
4857
4878
|
meta: { feature: "rawWhere" }
|
|
@@ -4878,11 +4899,11 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4878
4899
|
const pageSize = Math.max(1, perPage);
|
|
4879
4900
|
const rows = (await this.get()).all();
|
|
4880
4901
|
const start = (currentPage - 1) * pageSize;
|
|
4881
|
-
return new
|
|
4902
|
+
return new require_relationship.LengthAwarePaginator(new require_relationship.ArkormCollection(rows.slice(start, start + pageSize)), rows.length, pageSize, currentPage, options);
|
|
4882
4903
|
}
|
|
4883
4904
|
const pageSize = Math.max(1, perPage);
|
|
4884
4905
|
const total = await this.count();
|
|
4885
|
-
return new
|
|
4906
|
+
return new require_relationship.LengthAwarePaginator(await this.clone().skip((currentPage - 1) * pageSize).take(pageSize).get(), total, pageSize, currentPage, options);
|
|
4886
4907
|
}
|
|
4887
4908
|
/**
|
|
4888
4909
|
* Paginates results without calculating total row count.
|
|
@@ -4899,12 +4920,12 @@ var QueryBuilder = class QueryBuilder {
|
|
|
4899
4920
|
const start = (currentPage - 1) * pageSize;
|
|
4900
4921
|
const pageRows = rows.slice(start, start + pageSize);
|
|
4901
4922
|
const hasMorePages = start + pageSize < rows.length;
|
|
4902
|
-
return new
|
|
4923
|
+
return new require_relationship.Paginator(new require_relationship.ArkormCollection(pageRows), pageSize, currentPage, hasMorePages, options);
|
|
4903
4924
|
}
|
|
4904
4925
|
const pageSize = Math.max(1, perPage);
|
|
4905
4926
|
const items = await this.clone().skip((currentPage - 1) * pageSize).take(pageSize + 1).get();
|
|
4906
4927
|
const hasMorePages = items.all().length > pageSize;
|
|
4907
|
-
return new
|
|
4928
|
+
return new require_relationship.Paginator(hasMorePages ? new require_relationship.ArkormCollection(items.all().slice(0, pageSize)) : items, pageSize, currentPage, hasMorePages, options);
|
|
4908
4929
|
}
|
|
4909
4930
|
/**
|
|
4910
4931
|
* Creates a clone of the current query builder instance with the same state.
|
|
@@ -5047,7 +5068,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5047
5068
|
applyRelationLoadPlan(plan) {
|
|
5048
5069
|
if (plan.constraint) {
|
|
5049
5070
|
const normalizedWhere = this.toQuerySchemaWhere(plan.constraint);
|
|
5050
|
-
if (!normalizedWhere) throw new
|
|
5071
|
+
if (!normalizedWhere) throw new require_relationship.UnsupportedAdapterFeatureException("Relation load plan constraints could not be normalized back into query where syntax.", {
|
|
5051
5072
|
operation: "relationLoads.applyPlan",
|
|
5052
5073
|
model: this.model.name
|
|
5053
5074
|
});
|
|
@@ -5135,7 +5156,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5135
5156
|
});
|
|
5136
5157
|
return;
|
|
5137
5158
|
}
|
|
5138
|
-
await new
|
|
5159
|
+
await new require_relationship.SetBasedEagerLoader(models, this.eagerLoads).load();
|
|
5139
5160
|
}
|
|
5140
5161
|
normalizeRelationLoadSelect(select) {
|
|
5141
5162
|
if (Array.isArray(select) || typeof select !== "object" || !select) return null;
|
|
@@ -5404,7 +5425,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5404
5425
|
};
|
|
5405
5426
|
}
|
|
5406
5427
|
requireAdapter() {
|
|
5407
|
-
if (!this.adapter) throw new
|
|
5428
|
+
if (!this.adapter) throw new require_relationship.UnsupportedAdapterFeatureException("Query execution requires a configured database adapter.", {
|
|
5408
5429
|
operation: "query.execute",
|
|
5409
5430
|
model: this.model.name,
|
|
5410
5431
|
meta: { feature: "adapter" }
|
|
@@ -5414,7 +5435,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5414
5435
|
async executeReadRows(whereOverride, useWhereOverride = false) {
|
|
5415
5436
|
const adapter = this.requireAdapter();
|
|
5416
5437
|
const spec = this.tryBuildSelectSpec(useWhereOverride ? whereOverride : this.buildWhere(), useWhereOverride);
|
|
5417
|
-
if (!spec) throw new
|
|
5438
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Query shape could not be compiled into an Arkorm select specification.", {
|
|
5418
5439
|
operation: "query.select",
|
|
5419
5440
|
model: this.model.name
|
|
5420
5441
|
});
|
|
@@ -5423,7 +5444,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5423
5444
|
async executeReadRow() {
|
|
5424
5445
|
const adapter = this.requireAdapter();
|
|
5425
5446
|
const spec = this.tryBuildSelectSpec(this.buildWhere());
|
|
5426
|
-
if (!spec) throw new
|
|
5447
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Query shape could not be compiled into an Arkorm select specification.", {
|
|
5427
5448
|
operation: "query.selectOne",
|
|
5428
5449
|
model: this.model.name
|
|
5429
5450
|
});
|
|
@@ -5432,7 +5453,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5432
5453
|
async executeReadCount() {
|
|
5433
5454
|
const adapter = this.requireAdapter();
|
|
5434
5455
|
const spec = this.tryBuildAggregateSpec();
|
|
5435
|
-
if (!spec) throw new
|
|
5456
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Query shape could not be compiled into an Arkorm aggregate specification.", {
|
|
5436
5457
|
operation: "query.count",
|
|
5437
5458
|
model: this.model.name
|
|
5438
5459
|
});
|
|
@@ -5441,7 +5462,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5441
5462
|
async executeReadExists() {
|
|
5442
5463
|
const adapter = this.requireAdapter();
|
|
5443
5464
|
const spec = this.tryBuildSelectSpec(this.buildWhere());
|
|
5444
|
-
if (!spec) throw new
|
|
5465
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Query shape could not be compiled into an Arkorm select specification.", {
|
|
5445
5466
|
operation: "query.exists",
|
|
5446
5467
|
model: this.model.name
|
|
5447
5468
|
});
|
|
@@ -5476,7 +5497,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5476
5497
|
const payloads = this.normalizeInsertPayloads(values);
|
|
5477
5498
|
const timestampUpdateColumns = (this.model.getModelMetadata().timestampColumns ?? []).filter((column) => column.updatedAt).map((column) => column.column);
|
|
5478
5499
|
const normalizedUpdateColumns = updateColumns ? Array.from(new Set([...updateColumns, ...timestampUpdateColumns])) : updateColumns;
|
|
5479
|
-
if (typeof adapter.upsert !== "function") throw new
|
|
5500
|
+
if (typeof adapter.upsert !== "function") throw new require_relationship.UnsupportedAdapterFeatureException("Upsert is not supported by the current adapter.", {
|
|
5480
5501
|
operation: "query.upsert",
|
|
5481
5502
|
model: this.model.name
|
|
5482
5503
|
});
|
|
@@ -5485,7 +5506,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5485
5506
|
async executeUpdateRow(where, values) {
|
|
5486
5507
|
const adapter = this.requireAdapter();
|
|
5487
5508
|
const spec = this.tryBuildUpdateSpec(where, this.normalizeUpdatePayload(values));
|
|
5488
|
-
if (!spec) throw new
|
|
5509
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Update could not be compiled into an Arkorm update specification.", {
|
|
5489
5510
|
operation: "query.update",
|
|
5490
5511
|
model: this.model.name
|
|
5491
5512
|
});
|
|
@@ -5497,7 +5518,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5497
5518
|
const adapter = this.requireAdapter();
|
|
5498
5519
|
const normalizedValues = this.normalizeUpdatePayload(values);
|
|
5499
5520
|
const spec = this.tryBuildUpdateManySpec(where, normalizedValues);
|
|
5500
|
-
if (!spec) throw new
|
|
5521
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Update-many could not be compiled into an Arkorm update specification.", {
|
|
5501
5522
|
operation: "query.updateMany",
|
|
5502
5523
|
model: this.model.name
|
|
5503
5524
|
});
|
|
@@ -5521,7 +5542,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5521
5542
|
async executeDeleteRow(where, failIfMissing = true) {
|
|
5522
5543
|
const adapter = this.requireAdapter();
|
|
5523
5544
|
const spec = this.tryBuildDeleteSpec(where);
|
|
5524
|
-
if (!spec) throw new
|
|
5545
|
+
if (!spec) throw new require_relationship.UnsupportedAdapterFeatureException("Delete could not be compiled into an Arkorm delete specification.", {
|
|
5525
5546
|
operation: "query.delete",
|
|
5526
5547
|
model: this.model.name
|
|
5527
5548
|
});
|
|
@@ -5635,7 +5656,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5635
5656
|
const adapter = this.adapter;
|
|
5636
5657
|
const sqlRelationFiltersRejected = this.hasUncompilableSqlRelationFilters(adapter);
|
|
5637
5658
|
const sqlRelationAggregatesRejected = this.hasUncompilableSqlRelationAggregates(adapter);
|
|
5638
|
-
if (sqlRelationFiltersRejected || sqlRelationAggregatesRejected) throw new
|
|
5659
|
+
if (sqlRelationFiltersRejected || sqlRelationAggregatesRejected) throw new require_relationship.UnsupportedAdapterFeatureException("Relation filters or aggregates could not be compiled into Arkorm adapter specifications for the current query shape.", {
|
|
5639
5660
|
operation: "query.relations",
|
|
5640
5661
|
model: this.model.name,
|
|
5641
5662
|
meta: {
|
|
@@ -5802,7 +5823,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5802
5823
|
if (cached) return await cached;
|
|
5803
5824
|
const resolver = (async () => {
|
|
5804
5825
|
const relationMethod = model[relation];
|
|
5805
|
-
if (typeof relationMethod !== "function") throw new
|
|
5826
|
+
if (typeof relationMethod !== "function") throw new require_relationship.RelationResolutionException(`Relation [${relation}] is not defined on the model.`, {
|
|
5806
5827
|
operation: "resolveRelatedResults",
|
|
5807
5828
|
model: this.model.name,
|
|
5808
5829
|
relation
|
|
@@ -5813,15 +5834,15 @@ var QueryBuilder = class QueryBuilder {
|
|
|
5813
5834
|
});
|
|
5814
5835
|
if (typeof relationInstance.get === "function") {
|
|
5815
5836
|
const results = await relationInstance.get();
|
|
5816
|
-
if (results instanceof
|
|
5837
|
+
if (results instanceof require_relationship.ArkormCollection) return results.all();
|
|
5817
5838
|
return results;
|
|
5818
5839
|
}
|
|
5819
5840
|
if (typeof relationInstance.getResults === "function") {
|
|
5820
5841
|
const results = await relationInstance.getResults();
|
|
5821
|
-
if (results instanceof
|
|
5842
|
+
if (results instanceof require_relationship.ArkormCollection) return results.all();
|
|
5822
5843
|
return results;
|
|
5823
5844
|
}
|
|
5824
|
-
throw new
|
|
5845
|
+
throw new require_relationship.RelationResolutionException(`Relation [${relation}] does not support result resolution.`, {
|
|
5825
5846
|
operation: "resolveRelatedResults",
|
|
5826
5847
|
model: this.model.name,
|
|
5827
5848
|
relation
|
|
@@ -5864,8 +5885,8 @@ const isCompatibilityClient = (value) => {
|
|
|
5864
5885
|
return Boolean(value) && typeof value === "object";
|
|
5865
5886
|
};
|
|
5866
5887
|
const getCompatibilitySources = (preferredClient) => {
|
|
5867
|
-
const activeTransactionClient =
|
|
5868
|
-
const runtimeClient =
|
|
5888
|
+
const activeTransactionClient = require_relationship.getActiveTransactionClient();
|
|
5889
|
+
const runtimeClient = require_relationship.getRuntimeClient();
|
|
5869
5890
|
return activeTransactionClient ? [
|
|
5870
5891
|
activeTransactionClient,
|
|
5871
5892
|
preferredClient,
|
|
@@ -5881,7 +5902,7 @@ const resolveRuntimeCompatibilityQuerySchema = (candidates, preferredClient) =>
|
|
|
5881
5902
|
return getCompatibilitySources(preferredClient).flatMap((source) => {
|
|
5882
5903
|
if (!isObjectLike(source)) return [];
|
|
5883
5904
|
return candidates.map((candidate) => source[candidate]);
|
|
5884
|
-
}).find((candidate) =>
|
|
5905
|
+
}).find((candidate) => require_relationship.isQuerySchemaLike(candidate));
|
|
5885
5906
|
};
|
|
5886
5907
|
const resolveRuntimeCompatibilityQuerySchemaOrThrow = (key, candidates, modelName, preferredClient) => {
|
|
5887
5908
|
const resolved = resolveRuntimeCompatibilityQuerySchema(candidates, preferredClient);
|
|
@@ -5901,8 +5922,6 @@ const defaultSoftDeleteConfig = {
|
|
|
5901
5922
|
column: "deletedAt"
|
|
5902
5923
|
};
|
|
5903
5924
|
var DB = class DB {
|
|
5904
|
-
static adapter;
|
|
5905
|
-
scopedAdapter;
|
|
5906
5925
|
constructor(adapter) {
|
|
5907
5926
|
this.scopedAdapter = adapter;
|
|
5908
5927
|
}
|
|
@@ -5910,7 +5929,7 @@ var DB = class DB {
|
|
|
5910
5929
|
this.adapter = adapter;
|
|
5911
5930
|
}
|
|
5912
5931
|
static getAdapter() {
|
|
5913
|
-
const runtimeAdapter =
|
|
5932
|
+
const runtimeAdapter = require_relationship.getRuntimeAdapter();
|
|
5914
5933
|
if (runtimeAdapter) return runtimeAdapter;
|
|
5915
5934
|
if (this.adapter) return this.adapter;
|
|
5916
5935
|
return getRuntimeCompatibilityAdapter();
|
|
@@ -5929,11 +5948,11 @@ var DB = class DB {
|
|
|
5929
5948
|
}
|
|
5930
5949
|
async raw(sql, bindings = []) {
|
|
5931
5950
|
const adapter = this.getAdapter();
|
|
5932
|
-
if (!adapter) throw new
|
|
5951
|
+
if (!adapter) throw new require_relationship.ArkormException("Raw queries require a configured database adapter.", {
|
|
5933
5952
|
code: "ADAPTER_NOT_CONFIGURED",
|
|
5934
5953
|
operation: "db.raw"
|
|
5935
5954
|
});
|
|
5936
|
-
if (!adapter.rawQuery) throw new
|
|
5955
|
+
if (!adapter.rawQuery) throw new require_relationship.UnsupportedAdapterFeatureException("Raw queries are not supported by the current adapter.", {
|
|
5937
5956
|
operation: "db.raw",
|
|
5938
5957
|
meta: { feature: "rawQuery" }
|
|
5939
5958
|
});
|
|
@@ -5941,14 +5960,14 @@ var DB = class DB {
|
|
|
5941
5960
|
sql,
|
|
5942
5961
|
bindings
|
|
5943
5962
|
});
|
|
5944
|
-
return
|
|
5963
|
+
return require_relationship.ArkormCollection.make(rows);
|
|
5945
5964
|
}
|
|
5946
5965
|
static async transaction(callback, context) {
|
|
5947
5966
|
return await new DB().transaction(callback, context);
|
|
5948
5967
|
}
|
|
5949
5968
|
async transaction(callback, context) {
|
|
5950
5969
|
const adapter = this.getAdapter();
|
|
5951
|
-
if (!adapter) throw new
|
|
5970
|
+
if (!adapter) throw new require_relationship.ArkormException("DB transactions require a configured database adapter.", {
|
|
5952
5971
|
code: "ADAPTER_NOT_CONFIGURED",
|
|
5953
5972
|
operation: "db.transaction"
|
|
5954
5973
|
});
|
|
@@ -6006,10 +6025,10 @@ var DB = class DB {
|
|
|
6006
6025
|
enums: {}
|
|
6007
6026
|
};
|
|
6008
6027
|
const persistedMetadataOptions = typeof options.persistedMetadata === "object" ? options.persistedMetadata : {};
|
|
6009
|
-
return
|
|
6028
|
+
return require_relationship.getPersistedTableMetadata(table, {
|
|
6010
6029
|
cwd: persistedMetadataOptions.cwd,
|
|
6011
6030
|
configuredPath: persistedMetadataOptions.configuredPath,
|
|
6012
|
-
features:
|
|
6031
|
+
features: require_relationship.resolvePersistedMetadataFeatures(require_relationship.getUserConfig("features")),
|
|
6013
6032
|
strict: persistedMetadataOptions.strict ?? (Boolean(adapter) && !(adapter instanceof PrismaDatabaseAdapter))
|
|
6014
6033
|
});
|
|
6015
6034
|
}
|
|
@@ -6026,37 +6045,41 @@ var DB = class DB {
|
|
|
6026
6045
|
* @since 0.1.0
|
|
6027
6046
|
*/
|
|
6028
6047
|
var Model = class Model {
|
|
6029
|
-
static
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
static
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
static
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
static
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
static
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
static
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6048
|
+
static {
|
|
6049
|
+
this.lifecycleStates = /* @__PURE__ */ new WeakMap();
|
|
6050
|
+
}
|
|
6051
|
+
static {
|
|
6052
|
+
this.emittedDeprecationWarnings = /* @__PURE__ */ new Set();
|
|
6053
|
+
}
|
|
6054
|
+
static {
|
|
6055
|
+
this.eventsSuppressed = 0;
|
|
6056
|
+
}
|
|
6057
|
+
static {
|
|
6058
|
+
this.primaryKey = "id";
|
|
6059
|
+
}
|
|
6060
|
+
static {
|
|
6061
|
+
this.columns = {};
|
|
6062
|
+
}
|
|
6063
|
+
static {
|
|
6064
|
+
this.softDeletes = false;
|
|
6065
|
+
}
|
|
6066
|
+
static {
|
|
6067
|
+
this.deletedAtColumn = "deletedAt";
|
|
6068
|
+
}
|
|
6069
|
+
static {
|
|
6070
|
+
this.globalScopes = {};
|
|
6071
|
+
}
|
|
6072
|
+
static {
|
|
6073
|
+
this.eventListeners = {};
|
|
6074
|
+
}
|
|
6075
|
+
static {
|
|
6076
|
+
this.dispatchesEvents = {};
|
|
6077
|
+
}
|
|
6059
6078
|
constructor(attributes = {}) {
|
|
6079
|
+
this.casts = {};
|
|
6080
|
+
this.hidden = [];
|
|
6081
|
+
this.visible = [];
|
|
6082
|
+
this.appends = [];
|
|
6060
6083
|
this.attributes = {};
|
|
6061
6084
|
this.original = {};
|
|
6062
6085
|
this.changes = {};
|
|
@@ -6106,13 +6129,13 @@ var Model = class Model {
|
|
|
6106
6129
|
this.adapter = adapter;
|
|
6107
6130
|
}
|
|
6108
6131
|
static getTable() {
|
|
6109
|
-
|
|
6132
|
+
require_relationship.ensureArkormConfigLoading();
|
|
6110
6133
|
if (this.table) return this.table;
|
|
6111
6134
|
if (this.delegate) {
|
|
6112
6135
|
Model.emitDeprecationWarning("ARKORM_MODEL_DELEGATE_DEPRECATED", "Model.delegate is deprecated and will be removed in Arkorm 3.0. Use Model.table instead.");
|
|
6113
6136
|
return this.delegate;
|
|
6114
6137
|
}
|
|
6115
|
-
const modelTableCase =
|
|
6138
|
+
const modelTableCase = require_relationship.getUserConfig("naming")?.modelTableCase ?? "snake";
|
|
6116
6139
|
const modelName = (0, _h3ravel_support.str)(this.name);
|
|
6117
6140
|
if (modelTableCase === "camel") return `${modelName.camel().plural()}`;
|
|
6118
6141
|
if (modelTableCase === "kebab") return `${modelName.kebab().plural()}`;
|
|
@@ -6126,8 +6149,8 @@ var Model = class Model {
|
|
|
6126
6149
|
const adapter = this.getAdapter();
|
|
6127
6150
|
const shouldStrictlyValidatePersistedMappings = Boolean(adapter) && !(adapter instanceof PrismaDatabaseAdapter);
|
|
6128
6151
|
return {
|
|
6129
|
-
...
|
|
6130
|
-
features:
|
|
6152
|
+
...require_relationship.getPersistedTableMetadata(this.getTable(), {
|
|
6153
|
+
features: require_relationship.resolvePersistedMetadataFeatures(require_relationship.getUserConfig("features")),
|
|
6131
6154
|
strict: shouldStrictlyValidatePersistedMappings
|
|
6132
6155
|
}).columns,
|
|
6133
6156
|
...this.columns
|
|
@@ -6139,8 +6162,8 @@ var Model = class Model {
|
|
|
6139
6162
|
static getModelMetadata() {
|
|
6140
6163
|
const adapter = this.getAdapter();
|
|
6141
6164
|
const shouldStrictlyValidatePersistedMappings = Boolean(adapter) && !(adapter instanceof PrismaDatabaseAdapter);
|
|
6142
|
-
const persistedMetadata =
|
|
6143
|
-
features:
|
|
6165
|
+
const persistedMetadata = require_relationship.getPersistedTableMetadata(this.getTable(), {
|
|
6166
|
+
features: require_relationship.resolvePersistedMetadataFeatures(require_relationship.getUserConfig("features")),
|
|
6144
6167
|
strict: shouldStrictlyValidatePersistedMappings
|
|
6145
6168
|
});
|
|
6146
6169
|
return {
|
|
@@ -6165,7 +6188,7 @@ var Model = class Model {
|
|
|
6165
6188
|
if (typeof resolver !== "function") return null;
|
|
6166
6189
|
const instance = new this({});
|
|
6167
6190
|
const relation = resolver.call(instance);
|
|
6168
|
-
if (!(relation instanceof
|
|
6191
|
+
if (!(relation instanceof require_relationship.Relation)) return null;
|
|
6169
6192
|
return relation.getMetadata();
|
|
6170
6193
|
}
|
|
6171
6194
|
static setFactory(factoryClass) {
|
|
@@ -6173,7 +6196,7 @@ var Model = class Model {
|
|
|
6173
6196
|
}
|
|
6174
6197
|
static factory(count) {
|
|
6175
6198
|
const factoryClass = this.factoryClass;
|
|
6176
|
-
if (!factoryClass) throw new
|
|
6199
|
+
if (!factoryClass) throw new require_relationship.ArkormException(`Factory is not configured for model [${this.name}].`, {
|
|
6177
6200
|
code: "FACTORY_NOT_CONFIGURED",
|
|
6178
6201
|
operation: "factory",
|
|
6179
6202
|
model: this.name
|
|
@@ -6325,8 +6348,8 @@ var Model = class Model {
|
|
|
6325
6348
|
* @returns
|
|
6326
6349
|
*/
|
|
6327
6350
|
static async transaction(callback, options = {}) {
|
|
6328
|
-
|
|
6329
|
-
return await
|
|
6351
|
+
require_relationship.ensureArkormConfigLoading();
|
|
6352
|
+
return await require_relationship.runArkormTransaction(async (context) => {
|
|
6330
6353
|
return await callback(context);
|
|
6331
6354
|
}, options, this.getAdapter());
|
|
6332
6355
|
}
|
|
@@ -6343,7 +6366,7 @@ var Model = class Model {
|
|
|
6343
6366
|
*/
|
|
6344
6367
|
static getDelegate(delegate) {
|
|
6345
6368
|
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.");
|
|
6346
|
-
|
|
6369
|
+
require_relationship.ensureArkormConfigLoading();
|
|
6347
6370
|
const key = delegate || this.delegate || this.getTable();
|
|
6348
6371
|
return resolveRuntimeCompatibilityQuerySchemaOrThrow(key, [
|
|
6349
6372
|
key,
|
|
@@ -6353,8 +6376,8 @@ var Model = class Model {
|
|
|
6353
6376
|
], this.name, this.client);
|
|
6354
6377
|
}
|
|
6355
6378
|
static getAdapter() {
|
|
6356
|
-
|
|
6357
|
-
const runtimeAdapter =
|
|
6379
|
+
require_relationship.ensureArkormConfigLoading();
|
|
6380
|
+
const runtimeAdapter = require_relationship.getRuntimeAdapter();
|
|
6358
6381
|
if (runtimeAdapter) return runtimeAdapter;
|
|
6359
6382
|
if (this.adapter) return this.adapter;
|
|
6360
6383
|
return getRuntimeCompatibilityAdapter(this.client);
|
|
@@ -6489,6 +6512,16 @@ var Model = class Model {
|
|
|
6489
6512
|
});
|
|
6490
6513
|
return this;
|
|
6491
6514
|
}
|
|
6515
|
+
async update(attributes) {
|
|
6516
|
+
try {
|
|
6517
|
+
const primaryKey = this.constructor.getPrimaryKey();
|
|
6518
|
+
if (!this.getAttribute(primaryKey)) return false;
|
|
6519
|
+
await this.fill(attributes).save();
|
|
6520
|
+
return true;
|
|
6521
|
+
} catch {
|
|
6522
|
+
return false;
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6492
6525
|
getAttribute(key) {
|
|
6493
6526
|
const attributeMutator = this.resolveAttributeMutator(key);
|
|
6494
6527
|
const mutator = this.resolveGetMutator(key);
|
|
@@ -6565,7 +6598,7 @@ var Model = class Model {
|
|
|
6565
6598
|
const constructor = this.constructor;
|
|
6566
6599
|
const primaryKey = constructor.getPrimaryKey();
|
|
6567
6600
|
const identifier = this.getAttribute(primaryKey);
|
|
6568
|
-
if (identifier == null) throw new
|
|
6601
|
+
if (identifier == null) throw new require_relationship.ArkormException(primaryKey === "id" ? "Cannot delete a model without an id." : `Cannot delete a model without a [${primaryKey}] value.`);
|
|
6569
6602
|
const previousOriginal = this.getOriginal();
|
|
6570
6603
|
await Model.dispatchEvent(constructor, "deleting", this);
|
|
6571
6604
|
const softDeleteConfig = constructor.getSoftDeleteConfig();
|
|
@@ -6602,7 +6635,7 @@ var Model = class Model {
|
|
|
6602
6635
|
const constructor = this.constructor;
|
|
6603
6636
|
const primaryKey = constructor.getPrimaryKey();
|
|
6604
6637
|
const identifier = this.getAttribute(primaryKey);
|
|
6605
|
-
if (identifier == null) throw new
|
|
6638
|
+
if (identifier == null) throw new require_relationship.ArkormException(primaryKey === "id" ? "Cannot force delete a model without an id." : `Cannot force delete a model without a [${primaryKey}] value.`);
|
|
6606
6639
|
const previousOriginal = this.getOriginal();
|
|
6607
6640
|
await Model.dispatchEvent(constructor, "forceDeleting", this);
|
|
6608
6641
|
await Model.dispatchEvent(constructor, "deleting", this);
|
|
@@ -6631,7 +6664,7 @@ var Model = class Model {
|
|
|
6631
6664
|
const constructor = this.constructor;
|
|
6632
6665
|
const primaryKey = constructor.getPrimaryKey();
|
|
6633
6666
|
const identifier = this.getAttribute(primaryKey);
|
|
6634
|
-
if (identifier == null) throw new
|
|
6667
|
+
if (identifier == null) throw new require_relationship.ArkormException(primaryKey === "id" ? "Cannot restore a model without an id." : `Cannot restore a model without a [${primaryKey}] value.`);
|
|
6635
6668
|
const softDeleteConfig = constructor.getSoftDeleteConfig();
|
|
6636
6669
|
if (!softDeleteConfig.enabled) return this;
|
|
6637
6670
|
const previousOriginal = this.getOriginal();
|
|
@@ -6788,7 +6821,7 @@ var Model = class Model {
|
|
|
6788
6821
|
*/
|
|
6789
6822
|
hasOne(related, foreignKey, localKey) {
|
|
6790
6823
|
const constructor = this.constructor;
|
|
6791
|
-
return new
|
|
6824
|
+
return new require_relationship.HasOneRelation(this, related, foreignKey, localKey ?? constructor.getPrimaryKey());
|
|
6792
6825
|
}
|
|
6793
6826
|
/**
|
|
6794
6827
|
* Define a has many relationship.
|
|
@@ -6800,7 +6833,7 @@ var Model = class Model {
|
|
|
6800
6833
|
*/
|
|
6801
6834
|
hasMany(related, foreignKey, localKey) {
|
|
6802
6835
|
const constructor = this.constructor;
|
|
6803
|
-
return new
|
|
6836
|
+
return new require_relationship.HasManyRelation(this, related, foreignKey, localKey ?? constructor.getPrimaryKey());
|
|
6804
6837
|
}
|
|
6805
6838
|
/**
|
|
6806
6839
|
* Define a belongs to relationship.
|
|
@@ -6811,7 +6844,7 @@ var Model = class Model {
|
|
|
6811
6844
|
* @returns
|
|
6812
6845
|
*/
|
|
6813
6846
|
belongsTo(related, foreignKey, ownerKey) {
|
|
6814
|
-
return new
|
|
6847
|
+
return new require_relationship.BelongsToRelation(this, related, foreignKey, ownerKey ?? related.getPrimaryKey());
|
|
6815
6848
|
}
|
|
6816
6849
|
/**
|
|
6817
6850
|
* Define a belongs to many relationship.
|
|
@@ -6826,7 +6859,7 @@ var Model = class Model {
|
|
|
6826
6859
|
*/
|
|
6827
6860
|
belongsToMany(related, throughTable, foreignPivotKey, relatedPivotKey, parentKey, relatedKey) {
|
|
6828
6861
|
const constructor = this.constructor;
|
|
6829
|
-
return new
|
|
6862
|
+
return new require_relationship.BelongsToManyRelation(this, related, throughTable, foreignPivotKey, relatedPivotKey, parentKey ?? constructor.getPrimaryKey(), relatedKey ?? related.getPrimaryKey());
|
|
6830
6863
|
}
|
|
6831
6864
|
/**
|
|
6832
6865
|
* Define a has one through relationship.
|
|
@@ -6841,7 +6874,7 @@ var Model = class Model {
|
|
|
6841
6874
|
*/
|
|
6842
6875
|
hasOneThrough(related, throughTable, firstKey, secondKey, localKey, secondLocalKey = "id") {
|
|
6843
6876
|
const constructor = this.constructor;
|
|
6844
|
-
return new
|
|
6877
|
+
return new require_relationship.HasOneThroughRelation(this, related, throughTable, firstKey, secondKey, localKey ?? constructor.getPrimaryKey(), secondLocalKey);
|
|
6845
6878
|
}
|
|
6846
6879
|
/**
|
|
6847
6880
|
* Define a has many through relationship.
|
|
@@ -6856,7 +6889,7 @@ var Model = class Model {
|
|
|
6856
6889
|
*/
|
|
6857
6890
|
hasManyThrough(related, throughTable, firstKey, secondKey, localKey, secondLocalKey = "id") {
|
|
6858
6891
|
const constructor = this.constructor;
|
|
6859
|
-
return new
|
|
6892
|
+
return new require_relationship.HasManyThroughRelation(this, related, throughTable, firstKey, secondKey, localKey ?? constructor.getPrimaryKey(), secondLocalKey);
|
|
6860
6893
|
}
|
|
6861
6894
|
/**
|
|
6862
6895
|
* Define a polymorphic one to one relationship.
|
|
@@ -6868,7 +6901,7 @@ var Model = class Model {
|
|
|
6868
6901
|
*/
|
|
6869
6902
|
morphOne(related, morphName, localKey) {
|
|
6870
6903
|
const constructor = this.constructor;
|
|
6871
|
-
return new
|
|
6904
|
+
return new require_relationship.MorphOneRelation(this, related, morphName, localKey ?? constructor.getPrimaryKey());
|
|
6872
6905
|
}
|
|
6873
6906
|
/**
|
|
6874
6907
|
* Define a polymorphic one to many relationship.
|
|
@@ -6880,7 +6913,7 @@ var Model = class Model {
|
|
|
6880
6913
|
*/
|
|
6881
6914
|
morphMany(related, morphName, localKey) {
|
|
6882
6915
|
const constructor = this.constructor;
|
|
6883
|
-
return new
|
|
6916
|
+
return new require_relationship.MorphManyRelation(this, related, morphName, localKey ?? constructor.getPrimaryKey());
|
|
6884
6917
|
}
|
|
6885
6918
|
/**
|
|
6886
6919
|
* Define a polymorphic many to many relationship.
|
|
@@ -6895,7 +6928,7 @@ var Model = class Model {
|
|
|
6895
6928
|
*/
|
|
6896
6929
|
morphToMany(related, throughTable, morphName, relatedPivotKey, parentKey, relatedKey) {
|
|
6897
6930
|
const constructor = this.constructor;
|
|
6898
|
-
return new
|
|
6931
|
+
return new require_relationship.MorphToManyRelation(this, related, throughTable, morphName, relatedPivotKey, parentKey ?? constructor.getPrimaryKey(), relatedKey ?? related.getPrimaryKey());
|
|
6899
6932
|
}
|
|
6900
6933
|
/**
|
|
6901
6934
|
* Resolve a get mutator method for a given attribute key, if it exists.
|
|
@@ -7094,7 +7127,7 @@ var Model = class Model {
|
|
|
7094
7127
|
if (!configured) return [];
|
|
7095
7128
|
return (Array.isArray(configured) ? configured : [configured]).map((entry) => {
|
|
7096
7129
|
const handler = typeof entry === "function" ? new entry() : entry;
|
|
7097
|
-
if (!handler || typeof handler.handle !== "function") throw new
|
|
7130
|
+
if (!handler || typeof handler.handle !== "function") throw new require_relationship.ArkormException(`Invalid event handler configured for [${modelClass.name}.${event}].`);
|
|
7098
7131
|
return async (model) => {
|
|
7099
7132
|
await handler.handle(model);
|
|
7100
7133
|
};
|
|
@@ -7162,17 +7195,17 @@ var PivotModel = class extends Model {
|
|
|
7162
7195
|
};
|
|
7163
7196
|
|
|
7164
7197
|
//#endregion
|
|
7165
|
-
exports.ArkormCollection =
|
|
7166
|
-
exports.ArkormException =
|
|
7198
|
+
exports.ArkormCollection = require_relationship.ArkormCollection;
|
|
7199
|
+
exports.ArkormException = require_relationship.ArkormException;
|
|
7167
7200
|
exports.Attribute = Attribute;
|
|
7168
7201
|
exports.CliApp = CliApp;
|
|
7169
7202
|
exports.DB = DB;
|
|
7170
|
-
exports.EnumBuilder =
|
|
7171
|
-
exports.ForeignKeyBuilder =
|
|
7203
|
+
exports.EnumBuilder = require_relationship.EnumBuilder;
|
|
7204
|
+
exports.ForeignKeyBuilder = require_relationship.ForeignKeyBuilder;
|
|
7172
7205
|
exports.InitCommand = InitCommand;
|
|
7173
7206
|
exports.InlineFactory = InlineFactory;
|
|
7174
7207
|
exports.KyselyDatabaseAdapter = KyselyDatabaseAdapter;
|
|
7175
|
-
exports.LengthAwarePaginator =
|
|
7208
|
+
exports.LengthAwarePaginator = require_relationship.LengthAwarePaginator;
|
|
7176
7209
|
exports.MIGRATION_BRAND = MIGRATION_BRAND;
|
|
7177
7210
|
exports.MakeFactoryCommand = MakeFactoryCommand;
|
|
7178
7211
|
exports.MakeMigrationCommand = MakeMigrationCommand;
|
|
@@ -7188,131 +7221,131 @@ exports.Model = Model;
|
|
|
7188
7221
|
exports.ModelFactory = ModelFactory;
|
|
7189
7222
|
exports.ModelNotFoundException = ModelNotFoundException;
|
|
7190
7223
|
exports.ModelsSyncCommand = ModelsSyncCommand;
|
|
7191
|
-
exports.PRISMA_ENUM_MEMBER_REGEX =
|
|
7192
|
-
exports.PRISMA_ENUM_REGEX =
|
|
7193
|
-
exports.PRISMA_MODEL_REGEX =
|
|
7194
|
-
exports.Paginator =
|
|
7224
|
+
exports.PRISMA_ENUM_MEMBER_REGEX = require_relationship.PRISMA_ENUM_MEMBER_REGEX;
|
|
7225
|
+
exports.PRISMA_ENUM_REGEX = require_relationship.PRISMA_ENUM_REGEX;
|
|
7226
|
+
exports.PRISMA_MODEL_REGEX = require_relationship.PRISMA_MODEL_REGEX;
|
|
7227
|
+
exports.Paginator = require_relationship.Paginator;
|
|
7195
7228
|
exports.PivotModel = PivotModel;
|
|
7196
|
-
exports.PrimaryKeyGenerationPlanner =
|
|
7229
|
+
exports.PrimaryKeyGenerationPlanner = require_relationship.PrimaryKeyGenerationPlanner;
|
|
7197
7230
|
exports.PrismaDatabaseAdapter = PrismaDatabaseAdapter;
|
|
7198
7231
|
exports.QueryBuilder = QueryBuilder;
|
|
7199
7232
|
exports.QueryConstraintException = QueryConstraintException;
|
|
7200
7233
|
exports.QueryExecutionException = QueryExecutionException;
|
|
7201
|
-
exports.RelationResolutionException =
|
|
7202
|
-
exports.RuntimeModuleLoader =
|
|
7234
|
+
exports.RelationResolutionException = require_relationship.RelationResolutionException;
|
|
7235
|
+
exports.RuntimeModuleLoader = require_relationship.RuntimeModuleLoader;
|
|
7203
7236
|
exports.SEEDER_BRAND = SEEDER_BRAND;
|
|
7204
|
-
exports.SchemaBuilder =
|
|
7237
|
+
exports.SchemaBuilder = require_relationship.SchemaBuilder;
|
|
7205
7238
|
exports.ScopeNotDefinedException = ScopeNotDefinedException;
|
|
7206
7239
|
exports.SeedCommand = SeedCommand;
|
|
7207
7240
|
exports.Seeder = Seeder;
|
|
7208
|
-
exports.TableBuilder =
|
|
7209
|
-
exports.URLDriver =
|
|
7241
|
+
exports.TableBuilder = require_relationship.TableBuilder;
|
|
7242
|
+
exports.URLDriver = require_relationship.URLDriver;
|
|
7210
7243
|
exports.UniqueConstraintResolutionException = UniqueConstraintResolutionException;
|
|
7211
|
-
exports.UnsupportedAdapterFeatureException =
|
|
7212
|
-
exports.applyAlterTableOperation =
|
|
7213
|
-
exports.applyCreateTableOperation =
|
|
7214
|
-
exports.applyDropTableOperation =
|
|
7215
|
-
exports.applyMigrationRollbackToDatabase =
|
|
7216
|
-
exports.applyMigrationRollbackToPrismaSchema =
|
|
7217
|
-
exports.applyMigrationToDatabase =
|
|
7218
|
-
exports.applyMigrationToPrismaSchema =
|
|
7219
|
-
exports.applyOperationsToPersistedColumnMappingsState =
|
|
7220
|
-
exports.applyOperationsToPrismaSchema =
|
|
7221
|
-
exports.bindAdapterToModels =
|
|
7222
|
-
exports.buildEnumBlock =
|
|
7223
|
-
exports.buildFieldLine =
|
|
7224
|
-
exports.buildIndexLine =
|
|
7225
|
-
exports.buildInverseRelationLine =
|
|
7226
|
-
exports.buildMigrationIdentity =
|
|
7227
|
-
exports.buildMigrationRunId =
|
|
7228
|
-
exports.buildMigrationSource =
|
|
7229
|
-
exports.buildModelBlock =
|
|
7230
|
-
exports.buildRelationLine =
|
|
7231
|
-
exports.computeMigrationChecksum =
|
|
7232
|
-
exports.configureArkormRuntime =
|
|
7233
|
-
exports.createEmptyAppliedMigrationsState =
|
|
7234
|
-
exports.createEmptyPersistedColumnMappingsState =
|
|
7244
|
+
exports.UnsupportedAdapterFeatureException = require_relationship.UnsupportedAdapterFeatureException;
|
|
7245
|
+
exports.applyAlterTableOperation = require_relationship.applyAlterTableOperation;
|
|
7246
|
+
exports.applyCreateTableOperation = require_relationship.applyCreateTableOperation;
|
|
7247
|
+
exports.applyDropTableOperation = require_relationship.applyDropTableOperation;
|
|
7248
|
+
exports.applyMigrationRollbackToDatabase = require_relationship.applyMigrationRollbackToDatabase;
|
|
7249
|
+
exports.applyMigrationRollbackToPrismaSchema = require_relationship.applyMigrationRollbackToPrismaSchema;
|
|
7250
|
+
exports.applyMigrationToDatabase = require_relationship.applyMigrationToDatabase;
|
|
7251
|
+
exports.applyMigrationToPrismaSchema = require_relationship.applyMigrationToPrismaSchema;
|
|
7252
|
+
exports.applyOperationsToPersistedColumnMappingsState = require_relationship.applyOperationsToPersistedColumnMappingsState;
|
|
7253
|
+
exports.applyOperationsToPrismaSchema = require_relationship.applyOperationsToPrismaSchema;
|
|
7254
|
+
exports.bindAdapterToModels = require_relationship.bindAdapterToModels;
|
|
7255
|
+
exports.buildEnumBlock = require_relationship.buildEnumBlock;
|
|
7256
|
+
exports.buildFieldLine = require_relationship.buildFieldLine;
|
|
7257
|
+
exports.buildIndexLine = require_relationship.buildIndexLine;
|
|
7258
|
+
exports.buildInverseRelationLine = require_relationship.buildInverseRelationLine;
|
|
7259
|
+
exports.buildMigrationIdentity = require_relationship.buildMigrationIdentity;
|
|
7260
|
+
exports.buildMigrationRunId = require_relationship.buildMigrationRunId;
|
|
7261
|
+
exports.buildMigrationSource = require_relationship.buildMigrationSource;
|
|
7262
|
+
exports.buildModelBlock = require_relationship.buildModelBlock;
|
|
7263
|
+
exports.buildRelationLine = require_relationship.buildRelationLine;
|
|
7264
|
+
exports.computeMigrationChecksum = require_relationship.computeMigrationChecksum;
|
|
7265
|
+
exports.configureArkormRuntime = require_relationship.configureArkormRuntime;
|
|
7266
|
+
exports.createEmptyAppliedMigrationsState = require_relationship.createEmptyAppliedMigrationsState;
|
|
7267
|
+
exports.createEmptyPersistedColumnMappingsState = require_relationship.createEmptyPersistedColumnMappingsState;
|
|
7235
7268
|
exports.createKyselyAdapter = createKyselyAdapter;
|
|
7236
|
-
exports.createMigrationTimestamp =
|
|
7269
|
+
exports.createMigrationTimestamp = require_relationship.createMigrationTimestamp;
|
|
7237
7270
|
exports.createPrismaAdapter = createPrismaAdapter;
|
|
7238
7271
|
exports.createPrismaCompatibilityAdapter = createPrismaCompatibilityAdapter;
|
|
7239
7272
|
exports.createPrismaDatabaseAdapter = createPrismaDatabaseAdapter;
|
|
7240
7273
|
exports.createPrismaDelegateMap = createPrismaDelegateMap;
|
|
7241
|
-
exports.defineConfig =
|
|
7274
|
+
exports.defineConfig = require_relationship.defineConfig;
|
|
7242
7275
|
exports.defineFactory = defineFactory;
|
|
7243
|
-
exports.deleteAppliedMigrationsStateFromStore =
|
|
7244
|
-
exports.deletePersistedColumnMappingsState =
|
|
7245
|
-
exports.deriveCollectionFieldName =
|
|
7246
|
-
exports.deriveInverseRelationAlias =
|
|
7247
|
-
exports.deriveRelationAlias =
|
|
7248
|
-
exports.deriveRelationFieldName =
|
|
7249
|
-
exports.deriveSingularFieldName =
|
|
7250
|
-
exports.emitRuntimeDebugEvent =
|
|
7251
|
-
exports.ensureArkormConfigLoading =
|
|
7252
|
-
exports.escapeRegex =
|
|
7253
|
-
exports.findAppliedMigration =
|
|
7254
|
-
exports.findEnumBlock =
|
|
7255
|
-
exports.findModelBlock =
|
|
7256
|
-
exports.formatDefaultValue =
|
|
7257
|
-
exports.formatEnumDefaultValue =
|
|
7258
|
-
exports.formatRelationAction =
|
|
7259
|
-
exports.generateMigrationFile =
|
|
7260
|
-
exports.getActiveTransactionAdapter =
|
|
7261
|
-
exports.getActiveTransactionClient =
|
|
7262
|
-
exports.getDefaultStubsPath =
|
|
7263
|
-
exports.getLastMigrationRun =
|
|
7264
|
-
exports.getLatestAppliedMigrations =
|
|
7265
|
-
exports.getMigrationPlan =
|
|
7266
|
-
exports.getPersistedColumnMap =
|
|
7267
|
-
exports.getPersistedEnumMap =
|
|
7268
|
-
exports.getPersistedEnumTsType =
|
|
7269
|
-
exports.getPersistedPrimaryKeyGeneration =
|
|
7270
|
-
exports.getPersistedTableMetadata =
|
|
7271
|
-
exports.getPersistedTimestampColumns =
|
|
7272
|
-
exports.getRuntimeAdapter =
|
|
7273
|
-
exports.getRuntimeClient =
|
|
7276
|
+
exports.deleteAppliedMigrationsStateFromStore = require_relationship.deleteAppliedMigrationsStateFromStore;
|
|
7277
|
+
exports.deletePersistedColumnMappingsState = require_relationship.deletePersistedColumnMappingsState;
|
|
7278
|
+
exports.deriveCollectionFieldName = require_relationship.deriveCollectionFieldName;
|
|
7279
|
+
exports.deriveInverseRelationAlias = require_relationship.deriveInverseRelationAlias;
|
|
7280
|
+
exports.deriveRelationAlias = require_relationship.deriveRelationAlias;
|
|
7281
|
+
exports.deriveRelationFieldName = require_relationship.deriveRelationFieldName;
|
|
7282
|
+
exports.deriveSingularFieldName = require_relationship.deriveSingularFieldName;
|
|
7283
|
+
exports.emitRuntimeDebugEvent = require_relationship.emitRuntimeDebugEvent;
|
|
7284
|
+
exports.ensureArkormConfigLoading = require_relationship.ensureArkormConfigLoading;
|
|
7285
|
+
exports.escapeRegex = require_relationship.escapeRegex;
|
|
7286
|
+
exports.findAppliedMigration = require_relationship.findAppliedMigration;
|
|
7287
|
+
exports.findEnumBlock = require_relationship.findEnumBlock;
|
|
7288
|
+
exports.findModelBlock = require_relationship.findModelBlock;
|
|
7289
|
+
exports.formatDefaultValue = require_relationship.formatDefaultValue;
|
|
7290
|
+
exports.formatEnumDefaultValue = require_relationship.formatEnumDefaultValue;
|
|
7291
|
+
exports.formatRelationAction = require_relationship.formatRelationAction;
|
|
7292
|
+
exports.generateMigrationFile = require_relationship.generateMigrationFile;
|
|
7293
|
+
exports.getActiveTransactionAdapter = require_relationship.getActiveTransactionAdapter;
|
|
7294
|
+
exports.getActiveTransactionClient = require_relationship.getActiveTransactionClient;
|
|
7295
|
+
exports.getDefaultStubsPath = require_relationship.getDefaultStubsPath;
|
|
7296
|
+
exports.getLastMigrationRun = require_relationship.getLastMigrationRun;
|
|
7297
|
+
exports.getLatestAppliedMigrations = require_relationship.getLatestAppliedMigrations;
|
|
7298
|
+
exports.getMigrationPlan = require_relationship.getMigrationPlan;
|
|
7299
|
+
exports.getPersistedColumnMap = require_relationship.getPersistedColumnMap;
|
|
7300
|
+
exports.getPersistedEnumMap = require_relationship.getPersistedEnumMap;
|
|
7301
|
+
exports.getPersistedEnumTsType = require_relationship.getPersistedEnumTsType;
|
|
7302
|
+
exports.getPersistedPrimaryKeyGeneration = require_relationship.getPersistedPrimaryKeyGeneration;
|
|
7303
|
+
exports.getPersistedTableMetadata = require_relationship.getPersistedTableMetadata;
|
|
7304
|
+
exports.getPersistedTimestampColumns = require_relationship.getPersistedTimestampColumns;
|
|
7305
|
+
exports.getRuntimeAdapter = require_relationship.getRuntimeAdapter;
|
|
7306
|
+
exports.getRuntimeClient = require_relationship.getRuntimeClient;
|
|
7274
7307
|
exports.getRuntimeCompatibilityAdapter = getRuntimeCompatibilityAdapter;
|
|
7275
|
-
exports.getRuntimeDebugHandler =
|
|
7276
|
-
exports.getRuntimePaginationCurrentPageResolver =
|
|
7277
|
-
exports.getRuntimePaginationURLDriverFactory =
|
|
7278
|
-
exports.getRuntimePrismaClient =
|
|
7279
|
-
exports.getUserConfig =
|
|
7308
|
+
exports.getRuntimeDebugHandler = require_relationship.getRuntimeDebugHandler;
|
|
7309
|
+
exports.getRuntimePaginationCurrentPageResolver = require_relationship.getRuntimePaginationCurrentPageResolver;
|
|
7310
|
+
exports.getRuntimePaginationURLDriverFactory = require_relationship.getRuntimePaginationURLDriverFactory;
|
|
7311
|
+
exports.getRuntimePrismaClient = require_relationship.getRuntimePrismaClient;
|
|
7312
|
+
exports.getUserConfig = require_relationship.getUserConfig;
|
|
7280
7313
|
exports.inferDelegateName = inferDelegateName;
|
|
7281
|
-
exports.isDelegateLike =
|
|
7282
|
-
exports.isMigrationApplied =
|
|
7283
|
-
exports.isQuerySchemaLike =
|
|
7284
|
-
exports.isTransactionCapableClient =
|
|
7285
|
-
exports.loadArkormConfig =
|
|
7286
|
-
exports.markMigrationApplied =
|
|
7287
|
-
exports.markMigrationRun =
|
|
7288
|
-
exports.pad =
|
|
7289
|
-
exports.readAppliedMigrationsState =
|
|
7290
|
-
exports.readAppliedMigrationsStateFromStore =
|
|
7291
|
-
exports.readPersistedColumnMappingsState =
|
|
7292
|
-
exports.rebuildPersistedColumnMappingsState =
|
|
7293
|
-
exports.removeAppliedMigration =
|
|
7294
|
-
exports.resetArkormRuntimeForTests =
|
|
7295
|
-
exports.resetPersistedColumnMappingsCache =
|
|
7314
|
+
exports.isDelegateLike = require_relationship.isDelegateLike;
|
|
7315
|
+
exports.isMigrationApplied = require_relationship.isMigrationApplied;
|
|
7316
|
+
exports.isQuerySchemaLike = require_relationship.isQuerySchemaLike;
|
|
7317
|
+
exports.isTransactionCapableClient = require_relationship.isTransactionCapableClient;
|
|
7318
|
+
exports.loadArkormConfig = require_relationship.loadArkormConfig;
|
|
7319
|
+
exports.markMigrationApplied = require_relationship.markMigrationApplied;
|
|
7320
|
+
exports.markMigrationRun = require_relationship.markMigrationRun;
|
|
7321
|
+
exports.pad = require_relationship.pad;
|
|
7322
|
+
exports.readAppliedMigrationsState = require_relationship.readAppliedMigrationsState;
|
|
7323
|
+
exports.readAppliedMigrationsStateFromStore = require_relationship.readAppliedMigrationsStateFromStore;
|
|
7324
|
+
exports.readPersistedColumnMappingsState = require_relationship.readPersistedColumnMappingsState;
|
|
7325
|
+
exports.rebuildPersistedColumnMappingsState = require_relationship.rebuildPersistedColumnMappingsState;
|
|
7326
|
+
exports.removeAppliedMigration = require_relationship.removeAppliedMigration;
|
|
7327
|
+
exports.resetArkormRuntimeForTests = require_relationship.resetArkormRuntimeForTests;
|
|
7328
|
+
exports.resetPersistedColumnMappingsCache = require_relationship.resetPersistedColumnMappingsCache;
|
|
7296
7329
|
exports.resolveCast = resolveCast;
|
|
7297
|
-
exports.resolveColumnMappingsFilePath =
|
|
7298
|
-
exports.resolveEnumName =
|
|
7299
|
-
exports.resolveMigrationClassName =
|
|
7300
|
-
exports.resolveMigrationStateFilePath =
|
|
7301
|
-
exports.resolvePersistedMetadataFeatures =
|
|
7302
|
-
exports.resolvePrismaType =
|
|
7330
|
+
exports.resolveColumnMappingsFilePath = require_relationship.resolveColumnMappingsFilePath;
|
|
7331
|
+
exports.resolveEnumName = require_relationship.resolveEnumName;
|
|
7332
|
+
exports.resolveMigrationClassName = require_relationship.resolveMigrationClassName;
|
|
7333
|
+
exports.resolveMigrationStateFilePath = require_relationship.resolveMigrationStateFilePath;
|
|
7334
|
+
exports.resolvePersistedMetadataFeatures = require_relationship.resolvePersistedMetadataFeatures;
|
|
7335
|
+
exports.resolvePrismaType = require_relationship.resolvePrismaType;
|
|
7303
7336
|
exports.resolveRuntimeCompatibilityQuerySchema = resolveRuntimeCompatibilityQuerySchema;
|
|
7304
7337
|
exports.resolveRuntimeCompatibilityQuerySchemaOrThrow = resolveRuntimeCompatibilityQuerySchemaOrThrow;
|
|
7305
|
-
exports.runArkormTransaction =
|
|
7306
|
-
exports.runMigrationWithPrisma =
|
|
7307
|
-
exports.runPrismaCommand =
|
|
7308
|
-
exports.stripPrismaSchemaModelsAndEnums =
|
|
7309
|
-
exports.supportsDatabaseMigrationExecution =
|
|
7310
|
-
exports.supportsDatabaseMigrationState =
|
|
7311
|
-
exports.supportsDatabaseReset =
|
|
7312
|
-
exports.syncPersistedColumnMappingsFromState =
|
|
7313
|
-
exports.toMigrationFileSlug =
|
|
7314
|
-
exports.toModelName =
|
|
7315
|
-
exports.validatePersistedMetadataFeaturesForMigrations =
|
|
7316
|
-
exports.writeAppliedMigrationsState =
|
|
7317
|
-
exports.writeAppliedMigrationsStateToStore =
|
|
7318
|
-
exports.writePersistedColumnMappingsState =
|
|
7338
|
+
exports.runArkormTransaction = require_relationship.runArkormTransaction;
|
|
7339
|
+
exports.runMigrationWithPrisma = require_relationship.runMigrationWithPrisma;
|
|
7340
|
+
exports.runPrismaCommand = require_relationship.runPrismaCommand;
|
|
7341
|
+
exports.stripPrismaSchemaModelsAndEnums = require_relationship.stripPrismaSchemaModelsAndEnums;
|
|
7342
|
+
exports.supportsDatabaseMigrationExecution = require_relationship.supportsDatabaseMigrationExecution;
|
|
7343
|
+
exports.supportsDatabaseMigrationState = require_relationship.supportsDatabaseMigrationState;
|
|
7344
|
+
exports.supportsDatabaseReset = require_relationship.supportsDatabaseReset;
|
|
7345
|
+
exports.syncPersistedColumnMappingsFromState = require_relationship.syncPersistedColumnMappingsFromState;
|
|
7346
|
+
exports.toMigrationFileSlug = require_relationship.toMigrationFileSlug;
|
|
7347
|
+
exports.toModelName = require_relationship.toModelName;
|
|
7348
|
+
exports.validatePersistedMetadataFeaturesForMigrations = require_relationship.validatePersistedMetadataFeaturesForMigrations;
|
|
7349
|
+
exports.writeAppliedMigrationsState = require_relationship.writeAppliedMigrationsState;
|
|
7350
|
+
exports.writeAppliedMigrationsStateToStore = require_relationship.writeAppliedMigrationsStateToStore;
|
|
7351
|
+
exports.writePersistedColumnMappingsState = require_relationship.writePersistedColumnMappingsState;
|