arkormx 2.0.0-next.26 → 2.0.0-next.27
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 +123 -101
- package/dist/index.cjs +6038 -5821
- package/dist/index.d.cts +138 -43
- package/dist/index.d.mts +139 -44
- package/dist/index.mjs +6007 -5790
- package/package.json +1 -1
- package/stubs/model.js.stub +1 -1
- package/stubs/model.stub +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { AsyncLocalStorage } from "async_hooks";
|
|
3
|
-
import { dirname, extname, join, resolve } from "node:path";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
6
|
-
import { spawnSync } from "node:child_process";
|
|
7
|
-
import { str } from "@h3ravel/support";
|
|
8
3
|
import { createJiti } from "@rexxars/jiti";
|
|
9
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { dirname, extname, join, resolve } from "node:path";
|
|
10
6
|
import { createRequire } from "module";
|
|
11
|
-
import { copyFileSync, existsSync
|
|
7
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "fs";
|
|
12
8
|
import { fileURLToPath } from "url";
|
|
13
9
|
import path, { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
|
|
10
|
+
import { existsSync as existsSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, rmSync as rmSync$1, writeFileSync as writeFileSync$1 } from "node:fs";
|
|
11
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
12
|
+
import { spawnSync } from "node:child_process";
|
|
13
|
+
import { str } from "@h3ravel/support";
|
|
14
14
|
import { Logger } from "@h3ravel/shared";
|
|
15
15
|
import { Command, Kernel } from "@h3ravel/musket";
|
|
16
16
|
|
|
@@ -100,6 +100,18 @@ var UnsupportedAdapterFeatureException = class extends ArkormException {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/helpers/runtime-module-loader.ts
|
|
105
|
+
var RuntimeModuleLoader = class {
|
|
106
|
+
static async load(filePath) {
|
|
107
|
+
const resolvedPath = resolve(filePath);
|
|
108
|
+
return await createJiti(pathToFileURL(resolvedPath).href, {
|
|
109
|
+
interopDefault: false,
|
|
110
|
+
tsconfigPaths: true
|
|
111
|
+
}).import(resolvedPath);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
103
115
|
//#endregion
|
|
104
116
|
//#region src/helpers/migration-history.ts
|
|
105
117
|
const createEmptyAppliedMigrationsState = () => ({
|
|
@@ -119,13 +131,13 @@ const buildMigrationIdentity = (filePath, className) => {
|
|
|
119
131
|
return `${fileName.slice(0, fileName.length - extname(fileName).length)}:${className}`;
|
|
120
132
|
};
|
|
121
133
|
const computeMigrationChecksum = (filePath) => {
|
|
122
|
-
const source = readFileSync(filePath, "utf-8");
|
|
134
|
+
const source = readFileSync$1(filePath, "utf-8");
|
|
123
135
|
return createHash("sha256").update(source).digest("hex");
|
|
124
136
|
};
|
|
125
137
|
const readAppliedMigrationsState = (stateFilePath) => {
|
|
126
|
-
if (!existsSync(stateFilePath)) return createEmptyAppliedMigrationsState();
|
|
138
|
+
if (!existsSync$1(stateFilePath)) return createEmptyAppliedMigrationsState();
|
|
127
139
|
try {
|
|
128
|
-
const parsed = JSON.parse(readFileSync(stateFilePath, "utf-8"));
|
|
140
|
+
const parsed = JSON.parse(readFileSync$1(stateFilePath, "utf-8"));
|
|
129
141
|
if (!Array.isArray(parsed.migrations)) return createEmptyAppliedMigrationsState();
|
|
130
142
|
return {
|
|
131
143
|
version: 1,
|
|
@@ -146,8 +158,8 @@ const readAppliedMigrationsStateFromStore = async (adapter, stateFilePath) => {
|
|
|
146
158
|
};
|
|
147
159
|
const writeAppliedMigrationsState = (stateFilePath, state) => {
|
|
148
160
|
const directory = dirname(stateFilePath);
|
|
149
|
-
if (!existsSync(directory)) mkdirSync(directory, { recursive: true });
|
|
150
|
-
writeFileSync(stateFilePath, JSON.stringify(state, null, 2));
|
|
161
|
+
if (!existsSync$1(directory)) mkdirSync$1(directory, { recursive: true });
|
|
162
|
+
writeFileSync$1(stateFilePath, JSON.stringify(state, null, 2));
|
|
151
163
|
};
|
|
152
164
|
const writeAppliedMigrationsStateToStore = async (adapter, stateFilePath, state) => {
|
|
153
165
|
if (supportsDatabaseMigrationState(adapter)) {
|
|
@@ -1532,9 +1544,9 @@ const generateMigrationFile = (name, options = {}) => {
|
|
|
1532
1544
|
const filePath = join(directory, fileName);
|
|
1533
1545
|
const content = buildMigrationSource(className, extension);
|
|
1534
1546
|
if (options.write ?? true) {
|
|
1535
|
-
if (!existsSync(directory)) mkdirSync(directory, { recursive: true });
|
|
1536
|
-
if (existsSync(filePath)) throw new ArkormException(`Migration file already exists: ${filePath}`);
|
|
1537
|
-
writeFileSync(filePath, content);
|
|
1547
|
+
if (!existsSync$1(directory)) mkdirSync$1(directory, { recursive: true });
|
|
1548
|
+
if (existsSync$1(filePath)) throw new ArkormException(`Migration file already exists: ${filePath}`);
|
|
1549
|
+
writeFileSync$1(filePath, content);
|
|
1538
1550
|
}
|
|
1539
1551
|
return {
|
|
1540
1552
|
fileName,
|
|
@@ -1590,11 +1602,11 @@ const applyMigrationRollbackToDatabase = async (adapter, migration) => {
|
|
|
1590
1602
|
*/
|
|
1591
1603
|
const applyMigrationToPrismaSchema = async (migration, options = {}) => {
|
|
1592
1604
|
const schemaPath = options.schemaPath ?? join(process.cwd(), "prisma", "schema.prisma");
|
|
1593
|
-
if (!existsSync(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
|
|
1594
|
-
const source = readFileSync(schemaPath, "utf-8");
|
|
1605
|
+
if (!existsSync$1(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
|
|
1606
|
+
const source = readFileSync$1(schemaPath, "utf-8");
|
|
1595
1607
|
const operations = await getMigrationPlan(migration, "up");
|
|
1596
1608
|
const schema = applyOperationsToPrismaSchema(source, operations);
|
|
1597
|
-
if (options.write ?? true) writeFileSync(schemaPath, schema);
|
|
1609
|
+
if (options.write ?? true) writeFileSync$1(schemaPath, schema);
|
|
1598
1610
|
return {
|
|
1599
1611
|
schema,
|
|
1600
1612
|
schemaPath,
|
|
@@ -1610,11 +1622,11 @@ const applyMigrationToPrismaSchema = async (migration, options = {}) => {
|
|
|
1610
1622
|
*/
|
|
1611
1623
|
const applyMigrationRollbackToPrismaSchema = async (migration, options = {}) => {
|
|
1612
1624
|
const schemaPath = options.schemaPath ?? join(process.cwd(), "prisma", "schema.prisma");
|
|
1613
|
-
if (!existsSync(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
|
|
1614
|
-
const source = readFileSync(schemaPath, "utf-8");
|
|
1625
|
+
if (!existsSync$1(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
|
|
1626
|
+
const source = readFileSync$1(schemaPath, "utf-8");
|
|
1615
1627
|
const operations = await getMigrationPlan(migration, "down");
|
|
1616
1628
|
const schema = applyOperationsToPrismaSchema(source, operations);
|
|
1617
|
-
if (options.write ?? true) writeFileSync(schemaPath, schema);
|
|
1629
|
+
if (options.write ?? true) writeFileSync$1(schemaPath, schema);
|
|
1618
1630
|
return {
|
|
1619
1631
|
schema,
|
|
1620
1632
|
schemaPath,
|
|
@@ -1737,14 +1749,14 @@ const resetPersistedColumnMappingsCache = () => {
|
|
|
1737
1749
|
};
|
|
1738
1750
|
const readPersistedColumnMappingsState = (filePath) => {
|
|
1739
1751
|
if (cachedColumnMappingsPath === filePath && cachedColumnMappingsState) return cachedColumnMappingsState;
|
|
1740
|
-
if (!existsSync(filePath)) {
|
|
1752
|
+
if (!existsSync$1(filePath)) {
|
|
1741
1753
|
const empty = createEmptyPersistedColumnMappingsState();
|
|
1742
1754
|
cachedColumnMappingsPath = filePath;
|
|
1743
1755
|
cachedColumnMappingsState = empty;
|
|
1744
1756
|
return empty;
|
|
1745
1757
|
}
|
|
1746
1758
|
try {
|
|
1747
|
-
const normalized = normalizePersistedColumnMappingsState(JSON.parse(readFileSync(filePath, "utf-8")));
|
|
1759
|
+
const normalized = normalizePersistedColumnMappingsState(JSON.parse(readFileSync$1(filePath, "utf-8")));
|
|
1748
1760
|
cachedColumnMappingsPath = filePath;
|
|
1749
1761
|
cachedColumnMappingsState = normalized;
|
|
1750
1762
|
return normalized;
|
|
@@ -1758,13 +1770,13 @@ const readPersistedColumnMappingsState = (filePath) => {
|
|
|
1758
1770
|
const writePersistedColumnMappingsState = (filePath, state) => {
|
|
1759
1771
|
const normalized = normalizePersistedColumnMappingsState(state);
|
|
1760
1772
|
const directory = dirname(filePath);
|
|
1761
|
-
if (!existsSync(directory)) mkdirSync(directory, { recursive: true });
|
|
1762
|
-
writeFileSync(filePath, JSON.stringify(normalized, null, 2));
|
|
1773
|
+
if (!existsSync$1(directory)) mkdirSync$1(directory, { recursive: true });
|
|
1774
|
+
writeFileSync$1(filePath, JSON.stringify(normalized, null, 2));
|
|
1763
1775
|
cachedColumnMappingsPath = filePath;
|
|
1764
1776
|
cachedColumnMappingsState = normalized;
|
|
1765
1777
|
};
|
|
1766
1778
|
const deletePersistedColumnMappingsState = (filePath) => {
|
|
1767
|
-
if (existsSync(filePath)) rmSync(filePath, { force: true });
|
|
1779
|
+
if (existsSync$1(filePath)) rmSync$1(filePath, { force: true });
|
|
1768
1780
|
resetPersistedColumnMappingsCache();
|
|
1769
1781
|
};
|
|
1770
1782
|
const getPersistedTableMetadata = (table, options = {}) => {
|
|
@@ -1937,18 +1949,6 @@ const getPersistedEnumTsType = (values) => {
|
|
|
1937
1949
|
return buildEnumUnionType(values);
|
|
1938
1950
|
};
|
|
1939
1951
|
|
|
1940
|
-
//#endregion
|
|
1941
|
-
//#region src/helpers/runtime-module-loader.ts
|
|
1942
|
-
var RuntimeModuleLoader = class {
|
|
1943
|
-
static async load(filePath) {
|
|
1944
|
-
const resolvedPath = resolve(filePath);
|
|
1945
|
-
return await createJiti(pathToFileURL(resolvedPath).href, {
|
|
1946
|
-
interopDefault: false,
|
|
1947
|
-
tsconfigPaths: true
|
|
1948
|
-
}).import(resolvedPath);
|
|
1949
|
-
}
|
|
1950
|
-
};
|
|
1951
|
-
|
|
1952
1952
|
//#endregion
|
|
1953
1953
|
//#region src/helpers/runtime-config.ts
|
|
1954
1954
|
const resolveDefaultStubsPath = () => {
|
|
@@ -1956,7 +1956,7 @@ const resolveDefaultStubsPath = () => {
|
|
|
1956
1956
|
while (true) {
|
|
1957
1957
|
const packageJsonPath = path.join(current, "package.json");
|
|
1958
1958
|
const stubsPath = path.join(current, "stubs");
|
|
1959
|
-
if (existsSync
|
|
1959
|
+
if (existsSync(packageJsonPath) && existsSync(stubsPath)) return stubsPath;
|
|
1960
1960
|
const parent = path.dirname(current);
|
|
1961
1961
|
if (parent === current) break;
|
|
1962
1962
|
current = parent;
|
|
@@ -2024,6 +2024,12 @@ const mergePathConfig = (paths) => {
|
|
|
2024
2024
|
...incoming
|
|
2025
2025
|
};
|
|
2026
2026
|
};
|
|
2027
|
+
/**
|
|
2028
|
+
* Merge the feature configuration from the base defaults, user configuration, and provided options.
|
|
2029
|
+
*
|
|
2030
|
+
* @param features
|
|
2031
|
+
* @returns
|
|
2032
|
+
*/
|
|
2027
2033
|
const mergeFeatureConfig = (features) => {
|
|
2028
2034
|
const defaults = baseConfig.features ?? {};
|
|
2029
2035
|
const current = userConfig.features ?? {};
|
|
@@ -2033,6 +2039,13 @@ const mergeFeatureConfig = (features) => {
|
|
|
2033
2039
|
...features ?? {}
|
|
2034
2040
|
};
|
|
2035
2041
|
};
|
|
2042
|
+
/**
|
|
2043
|
+
* Bind a database adapter instance to an array of models that support adapter binding.
|
|
2044
|
+
*
|
|
2045
|
+
* @param adapter
|
|
2046
|
+
* @param models
|
|
2047
|
+
* @returns
|
|
2048
|
+
*/
|
|
2036
2049
|
const bindAdapterToModels = (adapter, models) => {
|
|
2037
2050
|
models.forEach((model) => {
|
|
2038
2051
|
model.setAdapter(adapter);
|
|
@@ -2042,6 +2055,7 @@ const bindAdapterToModels = (adapter, models) => {
|
|
|
2042
2055
|
/**
|
|
2043
2056
|
* Get the user-provided ArkORM configuration.
|
|
2044
2057
|
*
|
|
2058
|
+
* @param key Optional specific configuration key to retrieve. If omitted, the entire configuration object is returned.
|
|
2045
2059
|
* @returns The user-provided ArkORM configuration object.
|
|
2046
2060
|
*/
|
|
2047
2061
|
const getUserConfig = (key) => {
|
|
@@ -2052,28 +2066,33 @@ const getUserConfig = (key) => {
|
|
|
2052
2066
|
* Configure the ArkORM runtime with the provided runtime client resolver and
|
|
2053
2067
|
* adapter-first options.
|
|
2054
2068
|
*
|
|
2055
|
-
* @param
|
|
2069
|
+
* @param client
|
|
2070
|
+
* @param options
|
|
2056
2071
|
*/
|
|
2057
|
-
const configureArkormRuntime = (
|
|
2072
|
+
const configureArkormRuntime = (client, options = {}) => {
|
|
2073
|
+
const resolvedClient = client ?? options.client;
|
|
2058
2074
|
const nextConfig = {
|
|
2059
2075
|
...userConfig,
|
|
2060
2076
|
features: mergeFeatureConfig(options.features),
|
|
2061
2077
|
paths: mergePathConfig(options.paths)
|
|
2062
2078
|
};
|
|
2063
|
-
nextConfig.
|
|
2079
|
+
nextConfig.client = resolvedClient;
|
|
2080
|
+
nextConfig.prisma = resolvedClient;
|
|
2064
2081
|
if (options.pagination !== void 0) nextConfig.pagination = options.pagination;
|
|
2065
2082
|
if (options.adapter !== void 0) nextConfig.adapter = options.adapter;
|
|
2066
2083
|
if (options.boot !== void 0) nextConfig.boot = options.boot;
|
|
2067
2084
|
if (options.debug !== void 0) nextConfig.debug = options.debug;
|
|
2068
2085
|
if (options.outputExt !== void 0) nextConfig.outputExt = options.outputExt;
|
|
2069
2086
|
Object.assign(userConfig, { ...nextConfig });
|
|
2070
|
-
runtimeClientResolver =
|
|
2087
|
+
runtimeClientResolver = resolvedClient;
|
|
2071
2088
|
runtimeAdapter = options.adapter;
|
|
2072
2089
|
runtimePaginationURLDriverFactory = nextConfig.pagination?.urlDriver;
|
|
2073
2090
|
runtimePaginationCurrentPageResolver = nextConfig.pagination?.resolveCurrentPage;
|
|
2074
2091
|
runtimeDebugHandler = resolveDebugHandler(nextConfig.debug);
|
|
2092
|
+
const bootClient = resolveClient(resolvedClient);
|
|
2075
2093
|
options.boot?.({
|
|
2076
|
-
|
|
2094
|
+
client: bootClient,
|
|
2095
|
+
prisma: bootClient,
|
|
2077
2096
|
bindAdapter: bindAdapterToModels
|
|
2078
2097
|
});
|
|
2079
2098
|
};
|
|
@@ -2101,7 +2120,9 @@ const resolveClient = (resolver) => {
|
|
|
2101
2120
|
const resolveAndApplyConfig = (imported) => {
|
|
2102
2121
|
const config = imported?.default ?? imported;
|
|
2103
2122
|
if (!config || typeof config !== "object") return;
|
|
2104
|
-
|
|
2123
|
+
const runtimeClient = config.client ?? config.prisma;
|
|
2124
|
+
configureArkormRuntime(runtimeClient, {
|
|
2125
|
+
client: runtimeClient,
|
|
2105
2126
|
adapter: config.adapter,
|
|
2106
2127
|
boot: config.boot,
|
|
2107
2128
|
debug: config.debug,
|
|
@@ -2126,7 +2147,7 @@ const loadRuntimeConfigSync = () => {
|
|
|
2126
2147
|
const require = createRequire(import.meta.url);
|
|
2127
2148
|
const syncConfigPaths = [path.join(process.cwd(), "arkormx.config.cjs")];
|
|
2128
2149
|
for (const configPath of syncConfigPaths) {
|
|
2129
|
-
if (!existsSync
|
|
2150
|
+
if (!existsSync(configPath)) continue;
|
|
2130
2151
|
try {
|
|
2131
2152
|
resolveAndApplyConfig(require(configPath));
|
|
2132
2153
|
return true;
|
|
@@ -2148,7 +2169,7 @@ const loadArkormConfig = async () => {
|
|
|
2148
2169
|
runtimeConfigLoadingPromise = (async () => {
|
|
2149
2170
|
const configPaths = [path.join(process.cwd(), "arkormx.config.js"), path.join(process.cwd(), "arkormx.config.ts")];
|
|
2150
2171
|
for (const configPath of configPaths) {
|
|
2151
|
-
if (!existsSync
|
|
2172
|
+
if (!existsSync(configPath)) continue;
|
|
2152
2173
|
try {
|
|
2153
2174
|
resolveAndApplyConfig(await importConfigFile(configPath));
|
|
2154
2175
|
return;
|
|
@@ -2312,7 +2333,7 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2312
2333
|
if (!nested) return void 0;
|
|
2313
2334
|
return { NOT: nested };
|
|
2314
2335
|
}
|
|
2315
|
-
throw new UnsupportedAdapterFeatureException("Raw where clauses are not supported by the Prisma compatibility adapter.", {
|
|
2336
|
+
throw new UnsupportedAdapterFeatureException("Raw where clauses are not supported by the Prisma compatibility adapter; use a SQL-backed adapter for raw SQL predicates.", {
|
|
2316
2337
|
operation: "adapter.where",
|
|
2317
2338
|
meta: {
|
|
2318
2339
|
feature: "rawWhere",
|
|
@@ -2446,9 +2467,10 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2446
2467
|
});
|
|
2447
2468
|
}
|
|
2448
2469
|
/**
|
|
2449
|
-
*
|
|
2450
|
-
*
|
|
2451
|
-
*
|
|
2470
|
+
* Prisma can translate relation load plans on direct select/selectOne calls into
|
|
2471
|
+
* Prisma include/select arguments, but the adapter does not advertise the
|
|
2472
|
+
* adapter-owned batch relation load seam. QueryBuilder eager loads therefore stay
|
|
2473
|
+
* on Arkorm's generic relation loader on the Prisma compatibility path.
|
|
2452
2474
|
*
|
|
2453
2475
|
* @param spec
|
|
2454
2476
|
* @returns
|
|
@@ -2630,7 +2652,7 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
|
|
|
2630
2652
|
* @param _spec
|
|
2631
2653
|
*/
|
|
2632
2654
|
async loadRelations(_spec) {
|
|
2633
|
-
throw new UnsupportedAdapterFeatureException("
|
|
2655
|
+
throw new UnsupportedAdapterFeatureException("Adapter-owned relation batch loading is intentionally unavailable on the Prisma compatibility adapter; eager loading stays on Arkorm's generic loader for this path.", {
|
|
2634
2656
|
operation: "adapter.loadRelations",
|
|
2635
2657
|
meta: { feature: "relationLoads" }
|
|
2636
2658
|
});
|
|
@@ -2689,7 +2711,7 @@ var CliApp = class {
|
|
|
2689
2711
|
*/
|
|
2690
2712
|
ensureDirectory(filePath) {
|
|
2691
2713
|
const dir = dirname$1(filePath);
|
|
2692
|
-
if (!existsSync
|
|
2714
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
2693
2715
|
}
|
|
2694
2716
|
/**
|
|
2695
2717
|
* Convert absolute paths under current working directory into relative display paths.
|
|
@@ -2738,13 +2760,13 @@ var CliApp = class {
|
|
|
2738
2760
|
* @returns
|
|
2739
2761
|
*/
|
|
2740
2762
|
resolveRuntimeDirectoryPath(directoryPath) {
|
|
2741
|
-
if (existsSync
|
|
2763
|
+
if (existsSync(directoryPath)) return directoryPath;
|
|
2742
2764
|
const { buildOutput } = this.getConfig("paths") || {};
|
|
2743
2765
|
if (typeof buildOutput !== "string" || buildOutput.trim().length === 0) return directoryPath;
|
|
2744
2766
|
const relativeSource = relative(process.cwd(), directoryPath);
|
|
2745
2767
|
if (!relativeSource || relativeSource.startsWith("..")) return directoryPath;
|
|
2746
2768
|
const mappedDirectory = join$1(buildOutput, relativeSource);
|
|
2747
|
-
return existsSync
|
|
2769
|
+
return existsSync(mappedDirectory) ? mappedDirectory : directoryPath;
|
|
2748
2770
|
}
|
|
2749
2771
|
/**
|
|
2750
2772
|
* Resolve a script file path for runtime execution.
|
|
@@ -2774,7 +2796,7 @@ var CliApp = class {
|
|
|
2774
2796
|
} else candidates.push(mappedFile);
|
|
2775
2797
|
}
|
|
2776
2798
|
}
|
|
2777
|
-
const runtimeMatch = candidates.find((path) => existsSync
|
|
2799
|
+
const runtimeMatch = candidates.find((path) => existsSync(path));
|
|
2778
2800
|
if (runtimeMatch) return runtimeMatch;
|
|
2779
2801
|
return filePath;
|
|
2780
2802
|
}
|
|
@@ -2786,14 +2808,14 @@ var CliApp = class {
|
|
|
2786
2808
|
* @param replacements
|
|
2787
2809
|
*/
|
|
2788
2810
|
generateFile(stubPath, outputPath, replacements, options) {
|
|
2789
|
-
if (existsSync
|
|
2811
|
+
if (existsSync(outputPath) && !options?.force) {
|
|
2790
2812
|
this.command.error(`Error: ${this.formatPathForLog(outputPath)} already exists.`);
|
|
2791
2813
|
process.exit(1);
|
|
2792
|
-
} else if (existsSync
|
|
2793
|
-
let content = readFileSync
|
|
2814
|
+
} else if (existsSync(outputPath) && options?.force) rmSync(outputPath);
|
|
2815
|
+
let content = readFileSync(stubPath, "utf-8");
|
|
2794
2816
|
for (const [key, value] of Object.entries(replacements)) content = content.replace(new RegExp(`{{${key}}}`, "g"), value);
|
|
2795
2817
|
this.ensureDirectory(outputPath);
|
|
2796
|
-
writeFileSync
|
|
2818
|
+
writeFileSync(outputPath, content);
|
|
2797
2819
|
return outputPath;
|
|
2798
2820
|
}
|
|
2799
2821
|
/**
|
|
@@ -2885,7 +2907,7 @@ var CliApp = class {
|
|
|
2885
2907
|
makeModel(name, options = {}) {
|
|
2886
2908
|
const baseName = str(name.replace(/Model$/, "")).pascal().toString();
|
|
2887
2909
|
const modelName = `${baseName}`;
|
|
2888
|
-
const
|
|
2910
|
+
const tableName = str(baseName).camel().plural().toString();
|
|
2889
2911
|
const outputExt = this.resolveOutputExt();
|
|
2890
2912
|
const outputPath = join$1(this.resolveConfigPath("models", join$1(process.cwd(), "src", "models")), `${modelName}.${outputExt}`);
|
|
2891
2913
|
const shouldBuildFactory = options.all || options.factory;
|
|
@@ -2899,11 +2921,11 @@ var CliApp = class {
|
|
|
2899
2921
|
else stubPath = this.resolveStubPath(outputExt === "js" ? "model.js.stub" : "model.stub");
|
|
2900
2922
|
const modelPath = this.generateFile(stubPath, outputPath, {
|
|
2901
2923
|
ModelName: modelName,
|
|
2902
|
-
|
|
2924
|
+
TableName: tableName,
|
|
2903
2925
|
FactoryImport: shouldBuildFactory ? `import { ${factoryName} } from '${factoryImportPath}'\n` : "",
|
|
2904
2926
|
FactoryLink: shouldBuildFactory ? outputExt === "js" ? `\n static factoryClass = ${factoryName}` : `\n protected static override factoryClass = ${factoryName}` : ""
|
|
2905
2927
|
}, options);
|
|
2906
|
-
const prisma = this.isUsingPrismaAdapter() ? this.ensurePrismaModelEntry(modelName,
|
|
2928
|
+
const prisma = this.isUsingPrismaAdapter() ? this.ensurePrismaModelEntry(modelName, tableName) : void 0;
|
|
2907
2929
|
const created = {
|
|
2908
2930
|
model: {
|
|
2909
2931
|
name: modelName,
|
|
@@ -2920,30 +2942,30 @@ var CliApp = class {
|
|
|
2920
2942
|
modelImportPath: `./${relative(dirname$1(factoryPath), outputPath).replace(/\\/g, "/").replace(/\.(ts|tsx|mts|cts|js|mjs|cjs)$/i, "")}${outputExt === "js" ? ".js" : ""}`
|
|
2921
2943
|
});
|
|
2922
2944
|
if (shouldBuildSeeder) created.seeder = this.makeSeeder(baseName, { force: options.force });
|
|
2923
|
-
if (shouldBuildMigration) created.migration = this.makeMigration(`create ${
|
|
2945
|
+
if (shouldBuildMigration) created.migration = this.makeMigration(`create ${tableName} table`);
|
|
2924
2946
|
return created;
|
|
2925
2947
|
}
|
|
2926
2948
|
/**
|
|
2927
2949
|
* Ensure that the Prisma schema has a model entry for the given model
|
|
2928
|
-
* and
|
|
2950
|
+
* and table names.
|
|
2929
2951
|
* If the entry does not exist, it will be created with a default `id` field.
|
|
2930
2952
|
*
|
|
2931
2953
|
* @param modelName The name of the model to ensure in the Prisma schema.
|
|
2932
|
-
* @param
|
|
2954
|
+
* @param tableName The table name to ensure in the Prisma schema.
|
|
2933
2955
|
*/
|
|
2934
|
-
ensurePrismaModelEntry(modelName,
|
|
2956
|
+
ensurePrismaModelEntry(modelName, tableName) {
|
|
2935
2957
|
const schemaPath = join$1(process.cwd(), "prisma", "schema.prisma");
|
|
2936
|
-
if (!existsSync
|
|
2937
|
-
const source = readFileSync
|
|
2938
|
-
const existingByTable = findModelBlock(source,
|
|
2958
|
+
if (!existsSync(schemaPath)) return void 0;
|
|
2959
|
+
const source = readFileSync(schemaPath, "utf-8");
|
|
2960
|
+
const existingByTable = findModelBlock(source, tableName);
|
|
2939
2961
|
const existingByName = new RegExp(`model\\s+${modelName}\\s*\\{`, "m").test(source);
|
|
2940
2962
|
if (existingByTable || existingByName) return {
|
|
2941
2963
|
path: schemaPath,
|
|
2942
2964
|
updated: false
|
|
2943
2965
|
};
|
|
2944
|
-
writeFileSync
|
|
2966
|
+
writeFileSync(schemaPath, applyCreateTableOperation(source, {
|
|
2945
2967
|
type: "createTable",
|
|
2946
|
-
table:
|
|
2968
|
+
table: tableName,
|
|
2947
2969
|
columns: [{
|
|
2948
2970
|
name: "id",
|
|
2949
2971
|
type: "id",
|
|
@@ -3163,17 +3185,17 @@ var CliApp = class {
|
|
|
3163
3185
|
if (!classMatch) return null;
|
|
3164
3186
|
const className = classMatch[1];
|
|
3165
3187
|
const tableMatch = modelSource.match(/protected\s+static\s+override\s+table\s*=\s*['"]([^'"]+)['"]/) ?? modelSource.match(/static\s+table\s*=\s*['"]([^'"]+)['"]/);
|
|
3166
|
-
const
|
|
3188
|
+
const compatibilityDelegateMatch = modelSource.match(/protected\s+static\s+override\s+delegate\s*=\s*['"]([^'"]+)['"]/) ?? modelSource.match(/static\s+delegate\s*=\s*['"]([^'"]+)['"]/);
|
|
3167
3189
|
return {
|
|
3168
3190
|
className,
|
|
3169
|
-
table: tableMatch?.[1] ??
|
|
3191
|
+
table: tableMatch?.[1] ?? compatibilityDelegateMatch?.[1] ?? str(className).camel().plural().toString()
|
|
3170
3192
|
};
|
|
3171
3193
|
}
|
|
3172
3194
|
syncModelFiles(modelFiles, resolveStructure, enums) {
|
|
3173
3195
|
const updated = [];
|
|
3174
3196
|
const skipped = [];
|
|
3175
3197
|
modelFiles.forEach((filePath) => {
|
|
3176
|
-
const source = readFileSync
|
|
3198
|
+
const source = readFileSync(filePath, "utf-8");
|
|
3177
3199
|
const structure = resolveStructure(filePath, source);
|
|
3178
3200
|
if (!structure || structure.fields.length === 0) {
|
|
3179
3201
|
skipped.push(filePath);
|
|
@@ -3184,7 +3206,7 @@ var CliApp = class {
|
|
|
3184
3206
|
skipped.push(filePath);
|
|
3185
3207
|
return;
|
|
3186
3208
|
}
|
|
3187
|
-
writeFileSync
|
|
3209
|
+
writeFileSync(filePath, synced.content);
|
|
3188
3210
|
updated.push(filePath);
|
|
3189
3211
|
});
|
|
3190
3212
|
return {
|
|
@@ -3369,12 +3391,12 @@ var CliApp = class {
|
|
|
3369
3391
|
}
|
|
3370
3392
|
async syncModels(options = {}) {
|
|
3371
3393
|
const modelsDir = options.modelsDir ?? this.resolveConfigPath("models", join$1(process.cwd(), "src", "models"));
|
|
3372
|
-
if (!existsSync
|
|
3373
|
-
const modelFiles = readdirSync
|
|
3394
|
+
if (!existsSync(modelsDir)) throw new Error(`Models directory not found: ${modelsDir}`);
|
|
3395
|
+
const modelFiles = readdirSync(modelsDir).filter((file) => file.endsWith(".ts")).map((file) => join$1(modelsDir, file));
|
|
3374
3396
|
const adapter = this.getConfig("adapter");
|
|
3375
3397
|
if (adapter && typeof adapter.introspectModels === "function") {
|
|
3376
3398
|
const sources = modelFiles.reduce((all, filePath) => {
|
|
3377
|
-
const parsed = this.parseModelSyncSource(readFileSync
|
|
3399
|
+
const parsed = this.parseModelSyncSource(readFileSync(filePath, "utf-8"));
|
|
3378
3400
|
if (parsed) all.set(filePath, parsed);
|
|
3379
3401
|
return all;
|
|
3380
3402
|
}, /* @__PURE__ */ new Map());
|
|
@@ -3414,12 +3436,12 @@ var CliApp = class {
|
|
|
3414
3436
|
syncModelsFromPrisma(options = {}) {
|
|
3415
3437
|
const schemaPath = options.schemaPath ?? join$1(process.cwd(), "prisma", "schema.prisma");
|
|
3416
3438
|
const modelsDir = options.modelsDir ?? this.resolveConfigPath("models", join$1(process.cwd(), "src", "models"));
|
|
3417
|
-
if (!existsSync
|
|
3418
|
-
if (!existsSync
|
|
3419
|
-
const schema = readFileSync
|
|
3439
|
+
if (!existsSync(schemaPath)) throw new Error(`Prisma schema file not found: ${schemaPath}`);
|
|
3440
|
+
if (!existsSync(modelsDir)) throw new Error(`Models directory not found: ${modelsDir}`);
|
|
3441
|
+
const schema = readFileSync(schemaPath, "utf-8");
|
|
3420
3442
|
const prismaEnums = this.parsePrismaEnums(schema);
|
|
3421
3443
|
const prismaModels = this.parsePrismaModels(schema);
|
|
3422
|
-
const modelFiles = readdirSync
|
|
3444
|
+
const modelFiles = readdirSync(modelsDir).filter((file) => file.endsWith(".ts")).map((file) => join$1(modelsDir, file));
|
|
3423
3445
|
const result = this.syncModelFiles(modelFiles, (filePath, source) => {
|
|
3424
3446
|
const parsed = this.parseModelSyncSource(source);
|
|
3425
3447
|
if (!parsed) return void 0;
|
|
@@ -3459,18 +3481,18 @@ var InitCommand = class extends Command {
|
|
|
3459
3481
|
const stubsDir = typeof stubs === "string" && stubs.trim().length > 0 ? stubs : getDefaultStubsPath();
|
|
3460
3482
|
const preferredStubPath = join(stubsDir, "arkormx.config.stub");
|
|
3461
3483
|
const legacyStubPath = join(stubsDir, "arkorm.config.stub");
|
|
3462
|
-
const stubPath = existsSync
|
|
3463
|
-
if (existsSync
|
|
3484
|
+
const stubPath = existsSync(preferredStubPath) ? preferredStubPath : legacyStubPath;
|
|
3485
|
+
if (existsSync(outputDir) && !this.option("force")) {
|
|
3464
3486
|
this.error("Error: Arkormˣ has already been initialized. Use --force to reinitialize.");
|
|
3465
3487
|
process.exit(1);
|
|
3466
3488
|
}
|
|
3467
3489
|
this.app.ensureDirectory(outputDir);
|
|
3468
|
-
if (existsSync
|
|
3469
|
-
if (!existsSync
|
|
3490
|
+
if (existsSync(outputDir) && this.option("force")) copyFileSync(outputDir, outputDir.replace(/\.js$/, `.backup.${Date.now()}.js`));
|
|
3491
|
+
if (!existsSync(stubPath)) {
|
|
3470
3492
|
this.error(`Error: Missing config stub at ${preferredStubPath} (or ${legacyStubPath})`);
|
|
3471
3493
|
process.exit(1);
|
|
3472
3494
|
}
|
|
3473
|
-
writeFileSync
|
|
3495
|
+
writeFileSync(outputDir, readFileSync(stubPath, "utf-8"));
|
|
3474
3496
|
this.success("Arkormˣ initialized successfully!");
|
|
3475
3497
|
}
|
|
3476
3498
|
};
|
|
@@ -3645,7 +3667,7 @@ var MigrateCommand = class extends Command {
|
|
|
3645
3667
|
this.app.command = this;
|
|
3646
3668
|
const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
|
|
3647
3669
|
const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
|
|
3648
|
-
if (!existsSync(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
3670
|
+
if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
3649
3671
|
const schemaPath = this.option("schema") ? resolve(String(this.option("schema"))) : join(process.cwd(), "prisma", "schema.prisma");
|
|
3650
3672
|
const classes = this.option("all") || !this.argument("name") ? await this.loadAllMigrations(migrationsDir) : (await this.loadNamedMigration(migrationsDir, this.argument("name"))).filter(([cls]) => cls !== void 0);
|
|
3651
3673
|
if (classes.length === 0) return void this.error("Error: No migration classes found to run.");
|
|
@@ -3740,7 +3762,7 @@ var MigrateCommand = class extends Command {
|
|
|
3740
3762
|
* @param migrationsDir The directory to load migration classes from.
|
|
3741
3763
|
*/
|
|
3742
3764
|
async loadAllMigrations(migrationsDir) {
|
|
3743
|
-
const files = readdirSync(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
|
|
3765
|
+
const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
|
|
3744
3766
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
3745
3767
|
}
|
|
3746
3768
|
/**
|
|
@@ -3762,7 +3784,7 @@ var MigrateCommand = class extends Command {
|
|
|
3762
3784
|
`${base}Migration.js`,
|
|
3763
3785
|
`${base}Migration.mjs`,
|
|
3764
3786
|
`${base}Migration.cjs`
|
|
3765
|
-
].map((file) => join(migrationsDir, file)).find((file) => existsSync(file));
|
|
3787
|
+
].map((file) => join(migrationsDir, file)).find((file) => existsSync$1(file));
|
|
3766
3788
|
if (!target) return [[void 0, name]];
|
|
3767
3789
|
const runtimeTarget = this.app.resolveRuntimeScriptPath(target);
|
|
3768
3790
|
return (await this.loadMigrationClassesFromFile(runtimeTarget)).map((cls) => [cls, runtimeTarget]);
|
|
@@ -3798,7 +3820,7 @@ var MigrateFreshCommand = class extends Command {
|
|
|
3798
3820
|
this.app.command = this;
|
|
3799
3821
|
const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
|
|
3800
3822
|
const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
|
|
3801
|
-
if (!existsSync(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
3823
|
+
if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
3802
3824
|
const adapter = this.app.getConfig("adapter");
|
|
3803
3825
|
const useDatabaseMigrations = supportsDatabaseMigrationExecution(adapter);
|
|
3804
3826
|
const persistedFeatures = resolvePersistedMetadataFeatures(this.app.getConfig("features"));
|
|
@@ -3819,8 +3841,8 @@ var MigrateFreshCommand = class extends Command {
|
|
|
3819
3841
|
}
|
|
3820
3842
|
await adapter.resetDatabase();
|
|
3821
3843
|
} else {
|
|
3822
|
-
if (!existsSync(schemaPath)) return void this.error(`Error: Prisma schema file not found: ${this.app.formatPathForLog(schemaPath)}`);
|
|
3823
|
-
writeFileSync(schemaPath, stripPrismaSchemaModelsAndEnums(readFileSync(schemaPath, "utf-8")));
|
|
3844
|
+
if (!existsSync$1(schemaPath)) return void this.error(`Error: Prisma schema file not found: ${this.app.formatPathForLog(schemaPath)}`);
|
|
3845
|
+
writeFileSync$1(schemaPath, stripPrismaSchemaModelsAndEnums(readFileSync$1(schemaPath, "utf-8")));
|
|
3824
3846
|
}
|
|
3825
3847
|
let appliedState = createEmptyAppliedMigrationsState();
|
|
3826
3848
|
await writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedState);
|
|
@@ -3867,7 +3889,7 @@ var MigrateFreshCommand = class extends Command {
|
|
|
3867
3889
|
migrations.forEach(([_, file]) => this.success(this.app.splitLogger("Migrated", file)));
|
|
3868
3890
|
}
|
|
3869
3891
|
async loadAllMigrations(migrationsDir) {
|
|
3870
|
-
const files = readdirSync(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
|
|
3892
|
+
const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
|
|
3871
3893
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
3872
3894
|
}
|
|
3873
3895
|
async loadMigrationClassesFromFile(filePath) {
|
|
@@ -3906,7 +3928,7 @@ var MigrateRollbackCommand = class extends Command {
|
|
|
3906
3928
|
this.app.command = this;
|
|
3907
3929
|
const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
|
|
3908
3930
|
const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
|
|
3909
|
-
if (!existsSync(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
3931
|
+
if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
|
|
3910
3932
|
const schemaPath = this.option("schema") ? resolve(String(this.option("schema"))) : join(process.cwd(), "prisma", "schema.prisma");
|
|
3911
3933
|
const stateFilePath = resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
|
|
3912
3934
|
const adapter = this.app.getConfig("adapter");
|
|
@@ -3967,7 +3989,7 @@ var MigrateRollbackCommand = class extends Command {
|
|
|
3967
3989
|
rollbackClasses.forEach(([_, file]) => this.success(this.app.splitLogger("RolledBack", file)));
|
|
3968
3990
|
}
|
|
3969
3991
|
async loadAllMigrations(migrationsDir) {
|
|
3970
|
-
const files = readdirSync(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
|
|
3992
|
+
const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
|
|
3971
3993
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
3972
3994
|
}
|
|
3973
3995
|
async loadMigrationClassesFromFile(filePath) {
|
|
@@ -4009,11 +4031,11 @@ var MigrationHistoryCommand = class extends Command {
|
|
|
4009
4031
|
this.success("Deleted tracked migration state from database.");
|
|
4010
4032
|
return;
|
|
4011
4033
|
}
|
|
4012
|
-
if (!existsSync(stateFilePath)) {
|
|
4034
|
+
if (!existsSync$1(stateFilePath)) {
|
|
4013
4035
|
this.success(`No migration state file found at ${this.app.formatPathForLog(stateFilePath)}`);
|
|
4014
4036
|
return;
|
|
4015
4037
|
}
|
|
4016
|
-
rmSync(stateFilePath);
|
|
4038
|
+
rmSync$1(stateFilePath);
|
|
4017
4039
|
deletePersistedColumnMappingsState(resolveColumnMappingsFilePath(process.cwd()));
|
|
4018
4040
|
this.success(`Deleted migration state file: ${this.app.formatPathForLog(stateFilePath)}`);
|
|
4019
4041
|
return;
|
|
@@ -4148,7 +4170,7 @@ var SeedCommand = class extends Command {
|
|
|
4148
4170
|
this.app.command = this;
|
|
4149
4171
|
const configuredSeedersDir = this.app.getConfig("paths")?.seeders ?? join(process.cwd(), "database", "seeders");
|
|
4150
4172
|
const seedersDir = this.app.resolveRuntimeDirectoryPath(configuredSeedersDir);
|
|
4151
|
-
if (!existsSync(seedersDir)) return void this.error(`ERROR: Seeders directory not found: ${this.app.formatPathForLog(configuredSeedersDir)}`);
|
|
4173
|
+
if (!existsSync$1(seedersDir)) return void this.error(`ERROR: Seeders directory not found: ${this.app.formatPathForLog(configuredSeedersDir)}`);
|
|
4152
4174
|
const classes = this.option("all") ? await this.loadAllSeeders(seedersDir) : await this.loadNamedSeeder(seedersDir, this.argument("name") ?? "DatabaseSeeder");
|
|
4153
4175
|
if (classes.length === 0) return void this.error("ERROR: No seeder classes found to run.");
|
|
4154
4176
|
for (const SeederClassItem of classes) await new SeederClassItem().run();
|
|
@@ -4162,7 +4184,7 @@ var SeedCommand = class extends Command {
|
|
|
4162
4184
|
* @returns
|
|
4163
4185
|
*/
|
|
4164
4186
|
async loadAllSeeders(seedersDir) {
|
|
4165
|
-
const files = readdirSync(seedersDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).map((file) => this.app.resolveRuntimeScriptPath(join(seedersDir, file)));
|
|
4187
|
+
const files = readdirSync$1(seedersDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).map((file) => this.app.resolveRuntimeScriptPath(join(seedersDir, file)));
|
|
4166
4188
|
return (await Promise.all(files.map(async (file) => await this.loadSeederClassesFromFile(file)))).flat();
|
|
4167
4189
|
}
|
|
4168
4190
|
/**
|
|
@@ -4183,7 +4205,7 @@ var SeedCommand = class extends Command {
|
|
|
4183
4205
|
`${base}Seeder.js`,
|
|
4184
4206
|
`${base}Seeder.mjs`,
|
|
4185
4207
|
`${base}Seeder.cjs`
|
|
4186
|
-
].map((file) => join(seedersDir, file)).find((file) => existsSync(file));
|
|
4208
|
+
].map((file) => join(seedersDir, file)).find((file) => existsSync$1(file));
|
|
4187
4209
|
if (!target) return [];
|
|
4188
4210
|
const runtimeTarget = this.app.resolveRuntimeScriptPath(target);
|
|
4189
4211
|
return await this.loadSeederClassesFromFile(runtimeTarget);
|