arkormx 2.0.9 → 2.0.10

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 CHANGED
@@ -16,13 +16,6 @@ import { Command, Kernel } from "@h3ravel/musket";
16
16
 
17
17
  //#region src/Exceptions/ArkormException.ts
18
18
  var ArkormException = class extends Error {
19
- code;
20
- operation;
21
- model;
22
- delegate;
23
- relation;
24
- scope;
25
- meta;
26
19
  constructor(message, context = {}) {
27
20
  super(message, context.cause === void 0 ? void 0 : { cause: context.cause });
28
21
  this.name = "ArkormException";
@@ -70,7 +63,6 @@ var MissingDelegateException = class extends ArkormException {
70
63
  //#endregion
71
64
  //#region src/Exceptions/QueryExecutionException.ts
72
65
  var QueryExecutionException = class extends ArkormException {
73
- inspection;
74
66
  constructor(message = "Database query execution failed.", context = {}) {
75
67
  super(message, {
76
68
  code: "QUERY_EXECUTION_FAILED",
@@ -103,13 +95,13 @@ var UnsupportedAdapterFeatureException = class extends ArkormException {
103
95
  //#endregion
104
96
  //#region src/helpers/runtime-module-loader.ts
105
97
  var RuntimeModuleLoader = class {
106
- static async load(filePath) {
98
+ static async load(filePath, useDefault = false) {
107
99
  const resolvedPath = resolve(filePath);
108
100
  return await createJiti(pathToFileURL(resolvedPath).href, {
109
101
  interopDefault: false,
110
102
  tsconfigPaths: true,
111
103
  sourceMaps: true
112
- }).import(resolvedPath, { default: true });
104
+ }).import(resolvedPath, useDefault ? { default: true } : {});
113
105
  }
114
106
  };
115
107
 
@@ -262,7 +254,6 @@ var PrimaryKeyGenerationPlanner = class {
262
254
  * @since 0.2.2
263
255
  */
264
256
  var ForeignKeyBuilder = class {
265
- foreignKey;
266
257
  constructor(foreignKey) {
267
258
  this.foreignKey = foreignKey;
268
259
  }
@@ -349,8 +340,6 @@ const normalizeEnumMembers = (columnName, values) => {
349
340
  * @since 0.2.3
350
341
  */
351
342
  var EnumBuilder = class {
352
- tableBuilder;
353
- columnName;
354
343
  constructor(tableBuilder, columnName) {
355
344
  this.tableBuilder = tableBuilder;
356
345
  this.columnName = columnName;
@@ -422,11 +411,12 @@ var EnumBuilder = class {
422
411
  * @since 0.1.0
423
412
  */
424
413
  var TableBuilder = class {
425
- columns = [];
426
- dropColumnNames = [];
427
- indexes = [];
428
- foreignKeys = [];
429
- latestColumnName;
414
+ constructor() {
415
+ this.columns = [];
416
+ this.dropColumnNames = [];
417
+ this.indexes = [];
418
+ this.foreignKeys = [];
419
+ }
430
420
  /**
431
421
  * Defines a primary key column in the table.
432
422
  *
@@ -840,7 +830,9 @@ var TableBuilder = class {
840
830
  * @since 0.1.0
841
831
  */
842
832
  var SchemaBuilder = class {
843
- operations = [];
833
+ constructor() {
834
+ this.operations = [];
835
+ }
844
836
  /**
845
837
  * Defines a new table to be created in the migration.
846
838
  *
@@ -2252,8 +2244,6 @@ function inferDelegateName(modelName) {
2252
2244
  * @since 2.0.0-next.0
2253
2245
  */
2254
2246
  var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2255
- capabilities;
2256
- delegates;
2257
2247
  constructor(prisma, mapping = {}) {
2258
2248
  this.prisma = prisma;
2259
2249
  this.mapping = mapping;
@@ -2703,18 +2693,11 @@ var PrismaDatabaseAdapter = class PrismaDatabaseAdapter {
2703
2693
  * @since 0.1.0
2704
2694
  */
2705
2695
  var CliApp = class {
2706
- command;
2707
- config = {};
2708
2696
  constructor() {
2697
+ this.config = {};
2698
+ this.getConfig = getUserConfig;
2709
2699
  this.config = getUserConfig();
2710
2700
  }
2711
- /**
2712
- * Get the current configuration object or a specific configuration value.
2713
- *
2714
- * @param key Optional specific configuration key to retrieve
2715
- * @returns The entire configuration object or the value of the specified key
2716
- */
2717
- getConfig = getUserConfig;
2718
2701
  isUsingPrismaAdapter() {
2719
2702
  return this.getConfig("adapter") instanceof PrismaDatabaseAdapter;
2720
2703
  }
@@ -3481,10 +3464,13 @@ var CliApp = class {
3481
3464
  * @since 0.1.0
3482
3465
  */
3483
3466
  var InitCommand = class extends Command {
3484
- signature = `init
3467
+ constructor(..._args) {
3468
+ super(..._args);
3469
+ this.signature = `init
3485
3470
  {--force : Force overwrite if config file already exists (existing file will be backed up) }
3486
3471
  `;
3487
- description = "Initialize Arkormˣ by creating a default config file in the current directory";
3472
+ this.description = "Initialize Arkormˣ by creating a default config file in the current directory";
3473
+ }
3488
3474
  /**
3489
3475
  * Command handler for the init command.
3490
3476
  */
@@ -3520,11 +3506,14 @@ var InitCommand = class extends Command {
3520
3506
  * @since 0.1.0
3521
3507
  */
3522
3508
  var MakeFactoryCommand = class extends Command {
3523
- signature = `make:factory
3509
+ constructor(..._args) {
3510
+ super(..._args);
3511
+ this.signature = `make:factory
3524
3512
  {name : Name of the factory to create}
3525
3513
  {--f|force : Overwrite existing file}
3526
3514
  `;
3527
- description = "Create a new model factory class";
3515
+ this.description = "Create a new model factory class";
3516
+ }
3528
3517
  /**
3529
3518
  * Command handler for the make:factory command.
3530
3519
  *
@@ -3548,10 +3537,13 @@ var MakeFactoryCommand = class extends Command {
3548
3537
  * @since 0.1.0
3549
3538
  */
3550
3539
  var MakeMigrationCommand = class extends Command {
3551
- signature = `make:migration
3540
+ constructor(..._args) {
3541
+ super(..._args);
3542
+ this.signature = `make:migration
3552
3543
  {name : Name of the migration to create}
3553
3544
  `;
3554
- description = "Create a new migration class file";
3545
+ this.description = "Create a new migration class file";
3546
+ }
3555
3547
  /**
3556
3548
  * Command handler for the make:migration command.
3557
3549
  *
@@ -3576,7 +3568,9 @@ var MakeMigrationCommand = class extends Command {
3576
3568
  * @since 0.1.0
3577
3569
  */
3578
3570
  var MakeModelCommand = class extends Command {
3579
- signature = `make:model
3571
+ constructor(..._args) {
3572
+ super(..._args);
3573
+ this.signature = `make:model
3580
3574
  {name : Name of the model to create}
3581
3575
  {--f|force : Overwrite existing files}
3582
3576
  {--factory : Create and link a factory}
@@ -3585,7 +3579,8 @@ var MakeModelCommand = class extends Command {
3585
3579
  {--p|pivot : Indicate the required model is an intermediate pivot model}
3586
3580
  {--all : Create and link factory, seeder, and migration}
3587
3581
  `;
3588
- description = "Create a new model and optional linked resources";
3582
+ this.description = "Create a new model and optional linked resources";
3583
+ }
3589
3584
  /**
3590
3585
  * Command handler for the make:model command.
3591
3586
  *
@@ -3615,11 +3610,14 @@ var MakeModelCommand = class extends Command {
3615
3610
  * @since 0.1.0
3616
3611
  */
3617
3612
  var MakeSeederCommand = class extends Command {
3618
- signature = `make:seeder
3613
+ constructor(..._args) {
3614
+ super(..._args);
3615
+ this.signature = `make:seeder
3619
3616
  {name : Name of the seeder to create}
3620
3617
  {--f|force : Overwrite existing file}
3621
3618
  `;
3622
- description = "Create a new seeder class";
3619
+ this.description = "Create a new seeder class";
3620
+ }
3623
3621
  /**
3624
3622
  * Command handler for the make:seeder command.
3625
3623
  */
@@ -3644,7 +3642,9 @@ const MIGRATION_BRAND = Symbol.for("arkormx.migration");
3644
3642
  * @since 0.1.0
3645
3643
  */
3646
3644
  var Migration = class {
3647
- static [MIGRATION_BRAND] = true;
3645
+ static {
3646
+ this[MIGRATION_BRAND] = true;
3647
+ }
3648
3648
  };
3649
3649
 
3650
3650
  //#endregion
@@ -3657,7 +3657,9 @@ var Migration = class {
3657
3657
  * @since 0.1.0
3658
3658
  */
3659
3659
  var MigrateCommand = class extends Command {
3660
- signature = `migrate
3660
+ constructor(..._args) {
3661
+ super(..._args);
3662
+ this.signature = `migrate
3661
3663
  {name? : Migration class or file name}
3662
3664
  {--all : Run all migrations from the configured migrations directory}
3663
3665
  {--deploy : Use prisma migrate deploy instead of migrate dev}
@@ -3667,7 +3669,8 @@ var MigrateCommand = class extends Command {
3667
3669
  {--schema= : Explicit prisma schema path}
3668
3670
  {--migration-name= : Name for prisma migrate dev}
3669
3671
  `;
3670
- description = "Apply migration classes to schema.prisma and run Prisma workflow";
3672
+ this.description = "Apply migration classes to schema.prisma and run Prisma workflow";
3673
+ }
3671
3674
  /**
3672
3675
  * Command handler for the migrate command.
3673
3676
  * This method is responsible for orchestrating the migration
@@ -3823,13 +3826,16 @@ var MigrateCommand = class extends Command {
3823
3826
  //#endregion
3824
3827
  //#region src/cli/commands/MigrateFreshCommand.ts
3825
3828
  var MigrateFreshCommand = class extends Command {
3826
- signature = `migrate:fresh
3829
+ constructor(..._args) {
3830
+ super(..._args);
3831
+ this.signature = `migrate:fresh
3827
3832
  {--skip-generate : Skip prisma generate}
3828
3833
  {--skip-migrate : Skip prisma database sync}
3829
3834
  {--state-file= : Path to applied migration state file}
3830
3835
  {--schema= : Explicit prisma schema path}
3831
3836
  `;
3832
- description = "Reset the database and rerun all migration classes";
3837
+ this.description = "Reset the database and rerun all migration classes";
3838
+ }
3833
3839
  async handle() {
3834
3840
  this.app.command = this;
3835
3841
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
@@ -3927,7 +3933,9 @@ var MigrateFreshCommand = class extends Command {
3927
3933
  * @since 0.2.4
3928
3934
  */
3929
3935
  var MigrateRollbackCommand = class extends Command {
3930
- signature = `migrate:rollback
3936
+ constructor(..._args) {
3937
+ super(..._args);
3938
+ this.signature = `migrate:rollback
3931
3939
  {--step= : Number of latest applied migration classes to rollback}
3932
3940
  {--dry-run : Preview rollback targets without applying changes}
3933
3941
  {--deploy : Use prisma migrate deploy instead of migrate dev}
@@ -3937,7 +3945,8 @@ var MigrateRollbackCommand = class extends Command {
3937
3945
  {--schema= : Explicit prisma schema path}
3938
3946
  {--migration-name= : Name for prisma migrate dev}
3939
3947
  `;
3940
- description = "Rollback migration classes from schema.prisma and run Prisma workflow";
3948
+ this.description = "Rollback migration classes from schema.prisma and run Prisma workflow";
3949
+ }
3941
3950
  async handle() {
3942
3951
  this.app.command = this;
3943
3952
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
@@ -4026,13 +4035,16 @@ var MigrateRollbackCommand = class extends Command {
4026
4035
  * @since 0.2.4
4027
4036
  */
4028
4037
  var MigrationHistoryCommand = class extends Command {
4029
- signature = `migrate:history
4038
+ constructor(..._args) {
4039
+ super(..._args);
4040
+ this.signature = `migrate:history
4030
4041
  {--state-file= : Path to applied migration state file}
4031
4042
  {--reset : Clear tracked migration history file}
4032
4043
  {--delete : Delete tracked migration history file}
4033
4044
  {--json : Print raw JSON output}
4034
4045
  `;
4035
- description = "Inspect or reset tracked migration history";
4046
+ this.description = "Inspect or reset tracked migration history";
4047
+ }
4036
4048
  async handle() {
4037
4049
  this.app.command = this;
4038
4050
  const stateFilePath = resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
@@ -4083,11 +4095,14 @@ var MigrationHistoryCommand = class extends Command {
4083
4095
  //#endregion
4084
4096
  //#region src/cli/commands/ModelsSyncCommand.ts
4085
4097
  var ModelsSyncCommand = class extends Command {
4086
- signature = `models:sync
4098
+ constructor(..._args) {
4099
+ super(..._args);
4100
+ this.signature = `models:sync
4087
4101
  {--schema= : Path to prisma schema file used when adapter introspection is unavailable}
4088
4102
  {--models= : Path to models directory}
4089
4103
  `;
4090
- description = "Sync model declare attributes from the active adapter when supported";
4104
+ this.description = "Sync model declare attributes from the active adapter when supported";
4105
+ }
4091
4106
  async handle() {
4092
4107
  this.app.command = this;
4093
4108
  let result;
@@ -4124,7 +4139,9 @@ const SEEDER_BRAND = Symbol.for("arkormx.seeder");
4124
4139
  * @since 0.1.0
4125
4140
  */
4126
4141
  var Seeder = class Seeder {
4127
- static [SEEDER_BRAND] = true;
4142
+ static {
4143
+ this[SEEDER_BRAND] = true;
4144
+ }
4128
4145
  /**
4129
4146
  * Runs one or more seeders.
4130
4147
  *
@@ -4170,11 +4187,14 @@ var Seeder = class Seeder {
4170
4187
  * @since 0.1.0
4171
4188
  */
4172
4189
  var SeedCommand = class extends Command {
4173
- signature = `seed
4190
+ constructor(..._args) {
4191
+ super(..._args);
4192
+ this.signature = `seed
4174
4193
  {name? : Seeder class or file name}
4175
4194
  {--all : Run all seeders in the configured seeders directory}
4176
4195
  `;
4177
- description = "Run one or more seeders";
4196
+ this.description = "Run one or more seeders";
4197
+ }
4178
4198
  /**
4179
4199
  * Command handler for the seed command.
4180
4200
  *
@@ -1,7 +1,7 @@
1
- import { Kysely, Transaction } from "kysely";
2
- import { PrismaClient } from "@prisma/client";
3
1
  import { Collection } from "@h3ravel/collect.js";
2
+ import { Kysely, Transaction } from "kysely";
4
3
  import { Command } from "@h3ravel/musket";
4
+ import { PrismaClient } from "@prisma/client";
5
5
 
6
6
  //#region src/types/migrations.d.ts
7
7
  type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
@@ -5427,7 +5427,7 @@ declare const resolveRuntimeCompatibilityQuerySchemaOrThrow: <TSchema extends Mo
5427
5427
  //#endregion
5428
5428
  //#region src/helpers/runtime-module-loader.d.ts
5429
5429
  declare class RuntimeModuleLoader {
5430
- static load<T = unknown>(filePath: string): Promise<T>;
5430
+ static load<T = unknown>(filePath: string, useDefault?: boolean): Promise<T>;
5431
5431
  }
5432
5432
  //#endregion
5433
5433
  //#region src/PivotModel.d.ts
@@ -1,7 +1,7 @@
1
- import { Collection } from "@h3ravel/collect.js";
2
1
  import { Kysely, Transaction } from "kysely";
3
- import { Command } from "@h3ravel/musket";
4
2
  import { PrismaClient } from "@prisma/client";
3
+ import { Collection } from "@h3ravel/collect.js";
4
+ import { Command } from "@h3ravel/musket";
5
5
 
6
6
  //#region src/types/migrations.d.ts
7
7
  type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
@@ -5427,7 +5427,7 @@ declare const resolveRuntimeCompatibilityQuerySchemaOrThrow: <TSchema extends Mo
5427
5427
  //#endregion
5428
5428
  //#region src/helpers/runtime-module-loader.d.ts
5429
5429
  declare class RuntimeModuleLoader {
5430
- static load<T = unknown>(filePath: string): Promise<T>;
5430
+ static load<T = unknown>(filePath: string, useDefault?: boolean): Promise<T>;
5431
5431
  }
5432
5432
  //#endregion
5433
5433
  //#region src/PivotModel.d.ts