arkormx 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +19 -6
- package/dist/index.cjs +20 -6
- package/dist/index.d.cts +6 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +20 -7
- package/package.json +6 -5
package/dist/cli.mjs
CHANGED
|
@@ -5,13 +5,14 @@ import { spawnSync } from "node:child_process";
|
|
|
5
5
|
import { str } from "@h3ravel/support";
|
|
6
6
|
import path, { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
|
|
7
7
|
import { copyFileSync, 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 "fs";
|
|
8
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
9
8
|
import { AsyncLocalStorage } from "async_hooks";
|
|
9
|
+
import { createJiti } from "@rexxars/jiti";
|
|
10
|
+
import { pathToFileURL } from "node:url";
|
|
10
11
|
import { createRequire } from "module";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
11
13
|
import { Logger } from "@h3ravel/shared";
|
|
12
14
|
import { Command, Kernel } from "@h3ravel/musket";
|
|
13
15
|
import { createHash } from "node:crypto";
|
|
14
|
-
import { pathToFileURL as pathToFileURL$1 } from "node:url";
|
|
15
16
|
|
|
16
17
|
//#region src/Exceptions/ArkormException.ts
|
|
17
18
|
var ArkormException = class extends Error {
|
|
@@ -1413,6 +1414,18 @@ const applyMigrationRollbackToPrismaSchema = async (migration, options = {}) =>
|
|
|
1413
1414
|
};
|
|
1414
1415
|
};
|
|
1415
1416
|
|
|
1417
|
+
//#endregion
|
|
1418
|
+
//#region src/helpers/runtime-module-loader.ts
|
|
1419
|
+
var RuntimeModuleLoader = class {
|
|
1420
|
+
static async load(filePath) {
|
|
1421
|
+
const resolvedPath = resolve(filePath);
|
|
1422
|
+
return await createJiti(pathToFileURL(resolvedPath).href, {
|
|
1423
|
+
interopDefault: false,
|
|
1424
|
+
tsconfigPaths: true
|
|
1425
|
+
}).import(resolvedPath);
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
|
|
1416
1429
|
//#endregion
|
|
1417
1430
|
//#region src/helpers/runtime-config.ts
|
|
1418
1431
|
const resolveDefaultStubsPath = () => {
|
|
@@ -1516,7 +1529,7 @@ const resolveAndApplyConfig = (imported) => {
|
|
|
1516
1529
|
* @returns A promise that resolves to the imported configuration module.
|
|
1517
1530
|
*/
|
|
1518
1531
|
const importConfigFile = (configPath) => {
|
|
1519
|
-
return
|
|
1532
|
+
return RuntimeModuleLoader.load(configPath);
|
|
1520
1533
|
};
|
|
1521
1534
|
const loadRuntimeConfigSync = () => {
|
|
1522
1535
|
const require = createRequire(import.meta.url);
|
|
@@ -2664,7 +2677,7 @@ var MigrateCommand = class extends Command {
|
|
|
2664
2677
|
* @returns
|
|
2665
2678
|
*/
|
|
2666
2679
|
async loadMigrationClassesFromFile(filePath) {
|
|
2667
|
-
const imported = await
|
|
2680
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
2668
2681
|
return Object.values(imported).filter((value) => {
|
|
2669
2682
|
if (typeof value !== "function") return false;
|
|
2670
2683
|
const candidate = value;
|
|
@@ -2749,7 +2762,7 @@ var MigrateRollbackCommand = class extends Command {
|
|
|
2749
2762
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
2750
2763
|
}
|
|
2751
2764
|
async loadMigrationClassesFromFile(filePath) {
|
|
2752
|
-
const imported = await
|
|
2765
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
2753
2766
|
return Object.values(imported).filter((value) => {
|
|
2754
2767
|
if (typeof value !== "function") return false;
|
|
2755
2768
|
const candidate = value;
|
|
@@ -2959,7 +2972,7 @@ var SeedCommand = class extends Command {
|
|
|
2959
2972
|
* @returns An array of seeder classes.
|
|
2960
2973
|
*/
|
|
2961
2974
|
async loadSeederClassesFromFile(filePath) {
|
|
2962
|
-
const imported = await
|
|
2975
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
2963
2976
|
return Object.values(imported).filter((value) => {
|
|
2964
2977
|
if (typeof value !== "function") return false;
|
|
2965
2978
|
const candidate = value;
|
package/dist/index.cjs
CHANGED
|
@@ -33,13 +33,14 @@ let _h3ravel_support = require("@h3ravel/support");
|
|
|
33
33
|
let path = require("path");
|
|
34
34
|
path = __toESM(path);
|
|
35
35
|
let fs = require("fs");
|
|
36
|
-
let url = require("url");
|
|
37
36
|
let async_hooks = require("async_hooks");
|
|
37
|
+
let _rexxars_jiti = require("@rexxars/jiti");
|
|
38
|
+
let node_url = require("node:url");
|
|
38
39
|
let module$1 = require("module");
|
|
40
|
+
let url = require("url");
|
|
39
41
|
let _h3ravel_shared = require("@h3ravel/shared");
|
|
40
42
|
let _h3ravel_musket = require("@h3ravel/musket");
|
|
41
43
|
let node_crypto = require("node:crypto");
|
|
42
|
-
let node_url = require("node:url");
|
|
43
44
|
let _h3ravel_collect_js = require("@h3ravel/collect.js");
|
|
44
45
|
|
|
45
46
|
//#region src/Attribute.ts
|
|
@@ -1554,6 +1555,18 @@ const runMigrationWithPrisma = async (migration, options = {}) => {
|
|
|
1554
1555
|
};
|
|
1555
1556
|
};
|
|
1556
1557
|
|
|
1558
|
+
//#endregion
|
|
1559
|
+
//#region src/helpers/runtime-module-loader.ts
|
|
1560
|
+
var RuntimeModuleLoader = class {
|
|
1561
|
+
static async load(filePath) {
|
|
1562
|
+
const resolvedPath = (0, node_path.resolve)(filePath);
|
|
1563
|
+
return await (0, _rexxars_jiti.createJiti)((0, node_url.pathToFileURL)(resolvedPath).href, {
|
|
1564
|
+
interopDefault: false,
|
|
1565
|
+
tsconfigPaths: true
|
|
1566
|
+
}).import(resolvedPath);
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
|
|
1557
1570
|
//#endregion
|
|
1558
1571
|
//#region src/Exceptions/UnsupportedAdapterFeatureException.ts
|
|
1559
1572
|
var UnsupportedAdapterFeatureException = class extends ArkormException {
|
|
@@ -1706,7 +1719,7 @@ const resolveAndApplyConfig = (imported) => {
|
|
|
1706
1719
|
* @returns A promise that resolves to the imported configuration module.
|
|
1707
1720
|
*/
|
|
1708
1721
|
const importConfigFile = (configPath) => {
|
|
1709
|
-
return
|
|
1722
|
+
return RuntimeModuleLoader.load(configPath);
|
|
1710
1723
|
};
|
|
1711
1724
|
const loadRuntimeConfigSync = () => {
|
|
1712
1725
|
const require = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
@@ -2940,7 +2953,7 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
|
|
|
2940
2953
|
* @returns
|
|
2941
2954
|
*/
|
|
2942
2955
|
async loadMigrationClassesFromFile(filePath) {
|
|
2943
|
-
const imported = await
|
|
2956
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
2944
2957
|
return Object.values(imported).filter((value) => {
|
|
2945
2958
|
if (typeof value !== "function") return false;
|
|
2946
2959
|
const candidate = value;
|
|
@@ -3025,7 +3038,7 @@ var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
|
|
|
3025
3038
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
3026
3039
|
}
|
|
3027
3040
|
async loadMigrationClassesFromFile(filePath) {
|
|
3028
|
-
const imported = await
|
|
3041
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
3029
3042
|
return Object.values(imported).filter((value) => {
|
|
3030
3043
|
if (typeof value !== "function") return false;
|
|
3031
3044
|
const candidate = value;
|
|
@@ -3235,7 +3248,7 @@ var SeedCommand = class extends _h3ravel_musket.Command {
|
|
|
3235
3248
|
* @returns An array of seeder classes.
|
|
3236
3249
|
*/
|
|
3237
3250
|
async loadSeederClassesFromFile(filePath) {
|
|
3238
|
-
const imported = await
|
|
3251
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
3239
3252
|
return Object.values(imported).filter((value) => {
|
|
3240
3253
|
if (typeof value !== "function") return false;
|
|
3241
3254
|
const candidate = value;
|
|
@@ -6804,6 +6817,7 @@ exports.Paginator = Paginator;
|
|
|
6804
6817
|
exports.QueryBuilder = QueryBuilder;
|
|
6805
6818
|
exports.QueryConstraintException = QueryConstraintException;
|
|
6806
6819
|
exports.RelationResolutionException = RelationResolutionException;
|
|
6820
|
+
exports.RuntimeModuleLoader = RuntimeModuleLoader;
|
|
6807
6821
|
exports.SEEDER_BRAND = SEEDER_BRAND;
|
|
6808
6822
|
exports.SchemaBuilder = SchemaBuilder;
|
|
6809
6823
|
exports.ScopeNotDefinedException = ScopeNotDefinedException;
|
package/dist/index.d.cts
CHANGED
|
@@ -3712,6 +3712,11 @@ declare function createPrismaDelegateMap(prisma: PrismaClientLike): Record<strin
|
|
|
3712
3712
|
*/
|
|
3713
3713
|
declare function inferDelegateName(modelName: string): string;
|
|
3714
3714
|
//#endregion
|
|
3715
|
+
//#region src/helpers/runtime-module-loader.d.ts
|
|
3716
|
+
declare class RuntimeModuleLoader {
|
|
3717
|
+
static load<T = unknown>(filePath: string): Promise<T>;
|
|
3718
|
+
}
|
|
3719
|
+
//#endregion
|
|
3715
3720
|
//#region src/URLDriver.d.ts
|
|
3716
3721
|
/**
|
|
3717
3722
|
* URLDriver builds pagination URLs from paginator options.
|
|
@@ -3730,4 +3735,4 @@ declare class URLDriver {
|
|
|
3730
3735
|
url(page: number): string;
|
|
3731
3736
|
}
|
|
3732
3737
|
//#endregion
|
|
3733
|
-
export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, QueryConstraintException, RelationResolutionException, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
|
3738
|
+
export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, QueryConstraintException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
package/dist/index.d.mts
CHANGED
|
@@ -3712,6 +3712,11 @@ declare function createPrismaDelegateMap(prisma: PrismaClientLike): Record<strin
|
|
|
3712
3712
|
*/
|
|
3713
3713
|
declare function inferDelegateName(modelName: string): string;
|
|
3714
3714
|
//#endregion
|
|
3715
|
+
//#region src/helpers/runtime-module-loader.d.ts
|
|
3716
|
+
declare class RuntimeModuleLoader {
|
|
3717
|
+
static load<T = unknown>(filePath: string): Promise<T>;
|
|
3718
|
+
}
|
|
3719
|
+
//#endregion
|
|
3715
3720
|
//#region src/URLDriver.d.ts
|
|
3716
3721
|
/**
|
|
3717
3722
|
* URLDriver builds pagination URLs from paginator options.
|
|
@@ -3730,4 +3735,4 @@ declare class URLDriver {
|
|
|
3730
3735
|
url(page: number): string;
|
|
3731
3736
|
}
|
|
3732
3737
|
//#endregion
|
|
3733
|
-
export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, QueryConstraintException, RelationResolutionException, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
|
3738
|
+
export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, QueryConstraintException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
package/dist/index.mjs
CHANGED
|
@@ -4,13 +4,14 @@ import { spawnSync } from "node:child_process";
|
|
|
4
4
|
import { str } from "@h3ravel/support";
|
|
5
5
|
import path, { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
|
|
6
6
|
import { copyFileSync, 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 "fs";
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
8
7
|
import { AsyncLocalStorage } from "async_hooks";
|
|
8
|
+
import { createJiti } from "@rexxars/jiti";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
9
10
|
import { createRequire } from "module";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
10
12
|
import { Logger } from "@h3ravel/shared";
|
|
11
13
|
import { Command } from "@h3ravel/musket";
|
|
12
14
|
import { createHash } from "node:crypto";
|
|
13
|
-
import { pathToFileURL as pathToFileURL$1 } from "node:url";
|
|
14
15
|
import { Collection } from "@h3ravel/collect.js";
|
|
15
16
|
|
|
16
17
|
//#region src/Attribute.ts
|
|
@@ -1525,6 +1526,18 @@ const runMigrationWithPrisma = async (migration, options = {}) => {
|
|
|
1525
1526
|
};
|
|
1526
1527
|
};
|
|
1527
1528
|
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region src/helpers/runtime-module-loader.ts
|
|
1531
|
+
var RuntimeModuleLoader = class {
|
|
1532
|
+
static async load(filePath) {
|
|
1533
|
+
const resolvedPath = resolve(filePath);
|
|
1534
|
+
return await createJiti(pathToFileURL(resolvedPath).href, {
|
|
1535
|
+
interopDefault: false,
|
|
1536
|
+
tsconfigPaths: true
|
|
1537
|
+
}).import(resolvedPath);
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1528
1541
|
//#endregion
|
|
1529
1542
|
//#region src/Exceptions/UnsupportedAdapterFeatureException.ts
|
|
1530
1543
|
var UnsupportedAdapterFeatureException = class extends ArkormException {
|
|
@@ -1677,7 +1690,7 @@ const resolveAndApplyConfig = (imported) => {
|
|
|
1677
1690
|
* @returns A promise that resolves to the imported configuration module.
|
|
1678
1691
|
*/
|
|
1679
1692
|
const importConfigFile = (configPath) => {
|
|
1680
|
-
return
|
|
1693
|
+
return RuntimeModuleLoader.load(configPath);
|
|
1681
1694
|
};
|
|
1682
1695
|
const loadRuntimeConfigSync = () => {
|
|
1683
1696
|
const require = createRequire(import.meta.url);
|
|
@@ -2911,7 +2924,7 @@ var MigrateCommand = class extends Command {
|
|
|
2911
2924
|
* @returns
|
|
2912
2925
|
*/
|
|
2913
2926
|
async loadMigrationClassesFromFile(filePath) {
|
|
2914
|
-
const imported = await
|
|
2927
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
2915
2928
|
return Object.values(imported).filter((value) => {
|
|
2916
2929
|
if (typeof value !== "function") return false;
|
|
2917
2930
|
const candidate = value;
|
|
@@ -2996,7 +3009,7 @@ var MigrateRollbackCommand = class extends Command {
|
|
|
2996
3009
|
return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
|
|
2997
3010
|
}
|
|
2998
3011
|
async loadMigrationClassesFromFile(filePath) {
|
|
2999
|
-
const imported = await
|
|
3012
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
3000
3013
|
return Object.values(imported).filter((value) => {
|
|
3001
3014
|
if (typeof value !== "function") return false;
|
|
3002
3015
|
const candidate = value;
|
|
@@ -3206,7 +3219,7 @@ var SeedCommand = class extends Command {
|
|
|
3206
3219
|
* @returns An array of seeder classes.
|
|
3207
3220
|
*/
|
|
3208
3221
|
async loadSeederClassesFromFile(filePath) {
|
|
3209
|
-
const imported = await
|
|
3222
|
+
const imported = await RuntimeModuleLoader.load(filePath);
|
|
3210
3223
|
return Object.values(imported).filter((value) => {
|
|
3211
3224
|
if (typeof value !== "function") return false;
|
|
3212
3225
|
const candidate = value;
|
|
@@ -6745,4 +6758,4 @@ var Model = class Model {
|
|
|
6745
6758
|
};
|
|
6746
6759
|
|
|
6747
6760
|
//#endregion
|
|
6748
|
-
export { ArkormCollection, ArkormException, Attribute, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, QueryBuilder, QueryConstraintException, RelationResolutionException, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
|
6761
|
+
export { ArkormCollection, ArkormException, Attribute, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, QueryBuilder, QueryConstraintException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arkormx",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Modern TypeScript-first ORM for Node.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"orm",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@eslint/js": "^10.0.1",
|
|
50
50
|
"@eslint/markdown": "^7.5.1",
|
|
51
|
+
"@prisma/adapter-pg": "^7.6.0",
|
|
51
52
|
"@types/express": "^4.17.21",
|
|
52
53
|
"@types/node": "^20.10.6",
|
|
53
|
-
"@
|
|
54
|
-
"@vitest/coverage-v8": "4.0.18",
|
|
54
|
+
"@vitest/coverage-v8": "4.1.2",
|
|
55
55
|
"barrelize": "^1.7.3",
|
|
56
56
|
"eslint": "^10.0.0",
|
|
57
57
|
"pg": "^8.19.0",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"tsx": "^4.21.0",
|
|
61
61
|
"typescript": "^5.3.3",
|
|
62
62
|
"typescript-eslint": "^8.56.0",
|
|
63
|
-
"vite-tsconfig-paths": "^6.1.1",
|
|
64
63
|
"vitepress": "2.0.0-alpha.16",
|
|
65
|
-
"
|
|
64
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
65
|
+
"vitest": "^4.1.2"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=20.0.0"
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"@h3ravel/musket": "^0.10.1",
|
|
73
73
|
"@h3ravel/shared": "^0.27.13",
|
|
74
74
|
"@h3ravel/support": "^0.15.11",
|
|
75
|
+
"@rexxars/jiti": "^2.6.1",
|
|
75
76
|
"dotenv": "^17.3.1"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|