arkormx 2.12.6 → 2.12.8

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.
@@ -1,8 +1,7 @@
1
1
  import { Collection } from "@h3ravel/collect.js";
2
2
  import { Kysely, Transaction } from "kysely";
3
- import { Command } from "@h3ravel/musket";
3
+ import { Application, Command, Musket } from "@h3ravel/musket";
4
4
  import { PrismaClient } from "@prisma/client";
5
-
6
5
  //#region src/types/migrations.d.ts
7
6
  type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'decimal' | 'boolean' | 'json' | 'date' | 'dateTime' | 'timestamp';
8
7
  interface PrimaryKeyGeneration {
@@ -368,7 +367,7 @@ interface FactoryRelationshipResolver {
368
367
  getModelConstructor: () => FactoryModelConstructor<unknown>;
369
368
  }
370
369
  type FactoryAttributeResolver<TAttributes extends FactoryAttributes> = (attributes: TAttributes) => MaybePromise<unknown>;
371
- type FactoryDefinitionAttributes<TAttributes extends FactoryAttributes> = { [TKey in keyof TAttributes]?: TAttributes[TKey] | FactoryRelationshipResolver | FactoryAttributeResolver<TAttributes> } & Record<string, unknown>;
370
+ type FactoryDefinitionAttributes<TAttributes extends FactoryAttributes> = { [TKey in keyof TAttributes]?: TAttributes[TKey] | FactoryRelationshipResolver | FactoryAttributeResolver<TAttributes>; } & Record<string, unknown>;
372
371
  type FactoryDefinition<TAttributes extends FactoryAttributes> = (sequence: number) => MaybePromise<FactoryDefinitionAttributes<TAttributes>>;
373
372
  type FactoryState<TAttributes extends FactoryAttributes> = (attributes: TAttributes, sequence: number) => MaybePromise<FactoryDefinitionAttributes<TAttributes>>;
374
373
  type FactoryCallback<TModel> = (model: TModel) => MaybePromise<void>;
@@ -579,7 +578,7 @@ type JoinSource = QueryBuilder<any, any> | string;
579
578
  * A callback that builds a parenthesized group of nested where conditions.
580
579
  */
581
580
  type WhereCallback<TModel, TDelegate extends ModelQuerySchemaLike> = (query: QueryBuilder<TModel, TDelegate>) => QueryBuilder<any, any> | void;
582
- type EagerLoadRelations<TModel> = { [TKey in ModelRelationshipKey<TModel>]?: true | EagerLoadConstraint<EagerLoadQueryForRelationship<TModel, TKey>> };
581
+ type EagerLoadRelations<TModel> = { [TKey in ModelRelationshipKey<TModel>]?: true | EagerLoadConstraint<EagerLoadQueryForRelationship<TModel, TKey>>; };
583
582
  //#endregion
584
583
  //#region src/types/relationship.d.ts
585
584
  type RelationResult = unknown[] | unknown | null;
@@ -3623,11 +3622,11 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
3623
3622
  interface ArkormModelRegistry {}
3624
3623
  interface ArkormModelNameRegistry {}
3625
3624
  type LowercaseString<T extends string> = Lowercase<T>;
3626
- type Simplify<TValue> = { [TKey in keyof TValue]: TValue[TKey] } & {};
3625
+ type Simplify<TValue> = { [TKey in keyof TValue]: TValue[TKey]; } & {};
3627
3626
  type ConventionalAutoManagedKeys = 'id' | 'createdAt' | 'updatedAt' | 'deletedAt';
3628
3627
  type SingularKey<T extends string> = LowercaseString<T> extends `${infer Base}s` ? Base : LowercaseString<T>;
3629
3628
  type PluralKey<T extends string> = `${SingularKey<T>}s`;
3630
- type PrismaClientDelegates = { [TKey in keyof PrismaClient as PrismaClient[TKey] extends ModelQuerySchemaLike ? TKey : never]: PrismaClient[TKey] };
3629
+ type PrismaClientDelegates = { [TKey in keyof PrismaClient as PrismaClient[TKey] extends ModelQuerySchemaLike ? TKey : never]: PrismaClient[TKey]; };
3631
3630
  type DelegateFromPrismaClient<TKey extends string> = LowercaseString<TKey> extends keyof PrismaClientDelegates ? PrismaClientDelegates[LowercaseString<TKey>] : SingularKey<TKey> extends keyof PrismaClientDelegates ? PrismaClientDelegates[SingularKey<TKey>] : PluralKey<TKey> extends keyof PrismaClientDelegates ? PrismaClientDelegates[PluralKey<TKey>] : never;
3632
3631
  type AttributeScalarFilter<TValue> = Omit<PrismaLikeScalarFilter, 'equals' | 'not' | 'in' | 'notIn' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith'> & {
3633
3632
  equals?: TValue;
@@ -3646,11 +3645,11 @@ type AttributeWhereInput<TAttributes extends Record<string, unknown>> = {
3646
3645
  AND?: AttributeWhereInput<TAttributes>[];
3647
3646
  OR?: AttributeWhereInput<TAttributes>[];
3648
3647
  NOT?: AttributeWhereInput<TAttributes> | AttributeWhereInput<TAttributes>[];
3649
- } & { [TKey in keyof TAttributes]?: TAttributes[TKey] | AttributeScalarFilter<NonNullable<TAttributes[TKey]>> | null };
3648
+ } & { [TKey in keyof TAttributes]?: TAttributes[TKey] | AttributeScalarFilter<NonNullable<TAttributes[TKey]>> | null; };
3650
3649
  type AttributeOrderBy<TAttributes extends Record<string, unknown>> = Partial<Record<keyof TAttributes & string, PrismaLikeSortOrder>> | Array<Partial<Record<keyof TAttributes & string, PrismaLikeSortOrder>>>;
3651
- type AttributeSelect<TAttributes extends Record<string, unknown>> = { [TKey in keyof TAttributes]?: boolean };
3652
- type RequiredCreateKeys<TAttributes extends Record<string, unknown>> = Exclude<{ [TKey in keyof TAttributes]-?: undefined extends TAttributes[TKey] ? never : null extends TAttributes[TKey] ? never : TKey }[keyof TAttributes], ConventionalAutoManagedKeys>;
3653
- type AtLeastOne<TValue extends Record<string, unknown>> = { [TKey in keyof TValue]-?: Required<Pick<TValue, TKey>> & Partial<Omit<TValue, TKey>> }[keyof TValue];
3650
+ type AttributeSelect<TAttributes extends Record<string, unknown>> = { [TKey in keyof TAttributes]?: boolean; };
3651
+ type RequiredCreateKeys<TAttributes extends Record<string, unknown>> = Exclude<{ [TKey in keyof TAttributes]-?: undefined extends TAttributes[TKey] ? never : null extends TAttributes[TKey] ? never : TKey; }[keyof TAttributes], ConventionalAutoManagedKeys>;
3652
+ type AtLeastOne<TValue extends Record<string, unknown>> = { [TKey in keyof TValue]-?: Required<Pick<TValue, TKey>> & Partial<Omit<TValue, TKey>>; }[keyof TValue];
3654
3653
  type AttributeCreateInput<TAttributes extends Record<string, unknown>> = Simplify<Pick<TAttributes, RequiredCreateKeys<TAttributes>> & Partial<Omit<TAttributes, RequiredCreateKeys<TAttributes>>>>;
3655
3654
  type AttributeUpdateInput<TAttributes extends Record<string, unknown>> = AtLeastOne<Partial<TAttributes>>;
3656
3655
  interface AttributeQuerySchema<TAttributes extends Record<string, unknown>> extends ModelQuerySchemaLike {
@@ -3698,8 +3697,8 @@ type AttributeSchemaDelegate<TAttributes extends Record<string, unknown>> = Attr
3698
3697
  type DelegateForModelSchema<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> = QuerySchemaForModel<TSchema, TAttributes>;
3699
3698
  type ModelAttributesOf<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string> = TSchema extends ModelQuerySchemaLike ? QuerySchemaRow<TSchema> extends Record<string, unknown> ? QuerySchemaRow<TSchema> : Record<string, any> : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends ModelQuerySchemaLike ? QuerySchemaRow<DelegateFromPrismaClient<TSchema>> extends Record<string, unknown> ? QuerySchemaRow<DelegateFromPrismaClient<TSchema>> : Record<string, any> : Record<string, any> : TSchema extends Record<string, unknown> ? TSchema : Record<string, any>;
3700
3699
  type BaseModelInstance = Model<any, any>;
3701
- type ModelDeclaredAttributeKey<TModel> = { [TKey in keyof TModel & string]: TKey extends keyof BaseModelInstance ? never : TModel[TKey] extends ((...args: any[]) => any) ? never : TKey }[keyof TModel & string];
3702
- type ModelDeclaredAttributes<TModel> = { [TKey in ModelDeclaredAttributeKey<TModel>]: TModel[TKey] };
3700
+ type ModelDeclaredAttributeKey<TModel> = { [TKey in keyof TModel & string]: TKey extends keyof BaseModelInstance ? never : TModel[TKey] extends ((...args: any[]) => any) ? never : TKey; }[keyof TModel & string];
3701
+ type ModelDeclaredAttributes<TModel> = { [TKey in ModelDeclaredAttributeKey<TModel>]: TModel[TKey]; };
3703
3702
  type ResolveModelAttributes<TModel, TAttributes extends Record<string, unknown>> = [ModelDeclaredAttributeKey<TModel>] extends [never] ? TAttributes : string extends keyof TAttributes ? ModelDeclaredAttributes<TModel> : TAttributes & ModelDeclaredAttributes<TModel>;
3704
3703
  type ModelAttributes<TModel> = TModel extends Model<any, infer TAttributes> ? ResolveModelAttributes<TModel, TAttributes> : Record<string, any>;
3705
3704
  type QuerySchemaForModelInstance<TModel> = TModel extends Model<infer TSchema, infer TAttributes> ? TSchema extends ModelQuerySchemaLike | string ? QuerySchemaForModel<TSchema, TAttributes> : AttributeQuerySchema<ResolveModelAttributes<TModel, TAttributes>> : ModelQuerySchemaLike;
@@ -3708,7 +3707,7 @@ type ModelOrderByInput<TModel> = string extends keyof ModelAttributes<TModel> ?
3708
3707
  type RelationshipResultProvider<TResult = unknown> = {
3709
3708
  getResults: (...args: any[]) => Promise<TResult>;
3710
3709
  };
3711
- type ModelRelationshipKey<TModel> = { [TKey in keyof TModel & string]: TKey extends keyof BaseModelInstance ? never : TModel[TKey] extends ((...args: any[]) => infer TReturn) ? Parameters<TModel[TKey]> extends [] ? TReturn extends RelationshipResultProvider<any> ? TKey : never : never : never }[keyof TModel & string];
3710
+ type ModelRelationshipKey<TModel> = { [TKey in keyof TModel & string]: TKey extends keyof BaseModelInstance ? never : TModel[TKey] extends ((...args: any[]) => infer TReturn) ? Parameters<TModel[TKey]> extends [] ? TReturn extends RelationshipResultProvider<any> ? TKey : never : never : never; }[keyof TModel & string];
3712
3711
  type ModelRelationshipResult<TModel, TKey extends ModelRelationshipKey<TModel>> = TModel[TKey] extends ((...args: any[]) => infer TReturn) ? TReturn extends RelationshipResultProvider<infer TResult> ? TResult : never : never;
3713
3712
  type ModelAttributeValue<TModel, TAttributes extends Record<string, unknown>, TKey extends string> = TKey extends ModelRelationshipKey<TModel> ? ModelRelationshipResult<TModel, TKey> : TKey extends ModelDeclaredAttributeKey<TModel> ? TModel[TKey] : TKey extends keyof TAttributes & string ? TAttributes[TKey] : unknown;
3714
3713
  type ModelCreateData<TModel, TDelegate extends ModelQuerySchemaLike> = TModel extends Model<any, infer TAttributes> ? TDelegate extends AttributeQuerySchema<TAttributes> ? AttributeCreateInput<TAttributes> : QuerySchemaCreateData<TDelegate> : QuerySchemaCreateData<TDelegate>;
@@ -3756,20 +3755,20 @@ interface GroupByAggregateSpec<TModel> {
3756
3755
  _min?: AggregateColumnMap<TModel>;
3757
3756
  _max?: AggregateColumnMap<TModel>;
3758
3757
  }
3759
- type SameTypeAggregate<TModel, TMap> = { [K in keyof TMap]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown };
3758
+ type SameTypeAggregate<TModel, TMap> = { [K in keyof TMap]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown; };
3760
3759
  /** The typed plain row returned for a {@link GroupByAggregateSpec} query. */
3761
- type GroupByAggregateRow<TModel, TSpec extends GroupByAggregateSpec<TModel>> = { [K in TSpec['by'][number]]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown } & (TSpec extends {
3760
+ type GroupByAggregateRow<TModel, TSpec extends GroupByAggregateSpec<TModel>> = { [K in TSpec['by'][number]]: K extends keyof ModelAttributes<TModel> ? ModelAttributes<TModel>[K] : unknown; } & (TSpec extends {
3762
3761
  _count: infer C;
3763
3762
  } ? {
3764
- _count: C extends AggregateColumnMap<TModel> ? { [K in keyof C]: number } : number;
3763
+ _count: C extends AggregateColumnMap<TModel> ? { [K in keyof C]: number; } : number;
3765
3764
  } : object) & (TSpec extends {
3766
3765
  _sum: infer S;
3767
3766
  } ? {
3768
- _sum: { [K in keyof S]: number | null };
3767
+ _sum: { [K in keyof S]: number | null; };
3769
3768
  } : object) & (TSpec extends {
3770
3769
  _avg: infer A;
3771
3770
  } ? {
3772
- _avg: { [K in keyof A]: number | null };
3771
+ _avg: { [K in keyof A]: number | null; };
3773
3772
  } : object) & (TSpec extends {
3774
3773
  _min: infer M;
3775
3774
  } ? {
@@ -3901,6 +3900,23 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
3901
3900
  * @returns
3902
3901
  */
3903
3902
  whereNotNull<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey): this;
3903
+ /**
3904
+ * Adds an OR null check for a key.
3905
+ *
3906
+ * The OR counterpart of {@link whereNull}, so a null check can be combined
3907
+ * inside a grouped `where` callback, e.g. `q.whereFuture('expiresAt').orWhereNull('expiresAt')`.
3908
+ *
3909
+ * @param key
3910
+ * @returns
3911
+ */
3912
+ orWhereNull<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey): this;
3913
+ /**
3914
+ * Adds an OR not-null check for a key. The OR counterpart of {@link whereNotNull}.
3915
+ *
3916
+ * @param key
3917
+ * @returns
3918
+ */
3919
+ orWhereNotNull<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey): this;
3904
3920
  /**
3905
3921
  * Adds a between range clause for a key.
3906
3922
  *
@@ -6981,8 +6997,8 @@ declare class Attribute<TGet = unknown, TSet = unknown> {
6981
6997
  //#region src/casts.d.ts
6982
6998
  declare function resolveCast(definition: CastDefinition): CastHandler;
6983
6999
  //#endregion
6984
- //#region src/cli/CliApp.d.ts
6985
- type SyncedModelsResult = {
7000
+ //#region src/types/cli.d.ts
7001
+ interface SyncedModelsResult {
6986
7002
  source: 'adapter' | 'prisma' | 'registry';
6987
7003
  schemaPath?: string;
6988
7004
  modelsDir: string;
@@ -6990,14 +7006,16 @@ type SyncedModelsResult = {
6990
7006
  total: number;
6991
7007
  updated: string[];
6992
7008
  skipped: string[];
6993
- };
7009
+ }
7010
+ //#endregion
7011
+ //#region src/cli/CliApp.d.ts
6994
7012
  /**
6995
7013
  * Main application class for the Arkormˣ CLI.
6996
7014
  *
6997
7015
  * @author Legacy (3m1n3nc3)
6998
7016
  * @since 0.1.0
6999
7017
  */
7000
- declare class CliApp {
7018
+ declare class CliApp extends Application {
7001
7019
  command: Command;
7002
7020
  protected config: Partial<ArkormConfig>;
7003
7021
  constructor();
@@ -7008,6 +7026,7 @@ declare class CliApp {
7008
7026
  * @returns The entire configuration object or the value of the specified key
7009
7027
  */
7010
7028
  getConfig: GetUserConfig;
7029
+ registerMusketListeners(musket: Musket<this>): void;
7011
7030
  private isUsingPrismaAdapter;
7012
7031
  /**
7013
7032
  * Utility to ensure directory exists
@@ -8733,6 +8752,8 @@ declare const getRuntimeAdapter: () => DatabaseAdapter | undefined;
8733
8752
  * processes (the CLI) so the Node event loop drains and the process exits
8734
8753
  * promptly instead of hanging on pool idle timeouts. Teardown failures are
8735
8754
  * swallowed because the process is shutting down anyway.
8755
+ *
8756
+ * @returns
8736
8757
  */
8737
8758
  declare const disposeArkormRuntime: () => Promise<void>;
8738
8759
  declare const getActiveTransactionClient: () => RuntimeClientLike | undefined;
@@ -8767,7 +8788,7 @@ declare const isQuerySchemaLike: (value: unknown) => value is ModelQuerySchemaLi
8767
8788
  declare const isDelegateLike: (value: unknown) => value is ModelQuerySchemaLike;
8768
8789
  //#endregion
8769
8790
  //#region src/helpers/prisma.d.ts
8770
- type PrismaDelegateMap<TClient extends RuntimeClientLike> = { [K in keyof TClient as TClient[K] extends ModelQuerySchemaLike ? K : never]: TClient[K] extends ModelQuerySchemaLike ? TClient[K] : never };
8791
+ type PrismaDelegateMap<TClient extends RuntimeClientLike> = { [K in keyof TClient as TClient[K] extends ModelQuerySchemaLike ? K : never]: TClient[K] extends ModelQuerySchemaLike ? TClient[K] : never; };
8771
8792
  /**
8772
8793
  * Compatibility-only helper that exposes Prisma query schemas as a plain object map.
8773
8794
  * It is retained for migration support and tests, not as a supported runtime bootstrap path.
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_relationship = require('./relationship-BuHgK3wO.cjs');
2
+ const require_relationship = require('./relationship-BMHIbxB3.cjs');
3
3
  let pg = require("pg");
4
4
  let node_path = require("node:path");
5
5
  let node_fs = require("node:fs");
@@ -11,8 +11,8 @@ let path = require("path");
11
11
  let _h3ravel_support = require("@h3ravel/support");
12
12
  let node_async_hooks = require("node:async_hooks");
13
13
  let kysely = require("kysely");
14
- let _h3ravel_shared = require("@h3ravel/shared");
15
14
  let _h3ravel_musket = require("@h3ravel/musket");
15
+ let _h3ravel_shared = require("@h3ravel/shared");
16
16
 
17
17
  //#region src/Exceptions/QueryExecutionException.ts
18
18
  var QueryExecutionException = class extends require_relationship.ArkormException {
@@ -693,7 +693,8 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
693
693
  buildOrderBy(target, orderBy, qualifyColumns = false) {
694
694
  if (!orderBy || orderBy.length === 0) return kysely.sql``;
695
695
  return kysely.sql` order by ${kysely.sql.join(orderBy.map(({ column, direction, expression }) => {
696
- return kysely.sql`${expression ? this.buildExpression(target, expression) : qualifyColumns ? this.buildColumnReference(this.resolveTable(target), this.mapColumn(target, column)) : kysely.sql.ref(this.mapColumn(target, column))} ${kysely.sql.raw(direction === "desc" ? "desc" : "asc")}`;
696
+ const reference = expression ? this.buildExpression(target, expression) : qualifyColumns ? this.buildColumnReference(this.resolveTable(target), this.mapColumn(target, column)) : kysely.sql.ref(this.mapColumn(target, column));
697
+ return kysely.sql`${reference} ${kysely.sql.raw(direction === "desc" ? "desc" : "asc")}`;
697
698
  }), kysely.sql`, `)}`;
698
699
  }
699
700
  buildGroupBy(target, groupBy) {
@@ -794,7 +795,8 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
794
795
  if (condition.operator === "contains") return kysely.sql`${column} like ${`%${String(condition.value ?? "")}%`}`;
795
796
  if (condition.operator === "starts-with") return kysely.sql`${column} like ${`${String(condition.value ?? "")}%`}`;
796
797
  if (condition.operator === "ends-with") return kysely.sql`${column} like ${`%${String(condition.value ?? "")}`}`;
797
- return kysely.sql`${column} ${condition.operator === "!=" ? kysely.sql.raw("!=") : kysely.sql.raw(condition.operator)} ${condition.value}`;
798
+ const operator = condition.operator === "!=" ? kysely.sql.raw("!=") : kysely.sql.raw(condition.operator);
799
+ return kysely.sql`${column} ${operator} ${condition.value}`;
798
800
  }
799
801
  buildRawWhereCondition(condition) {
800
802
  const segments = condition.sql.split("?");
@@ -814,10 +816,12 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
814
816
  return kysely.sql`${left} ${kysely.sql.raw(condition.operator)} ${right}`;
815
817
  }
816
818
  buildTimeCondition(target, condition) {
817
- return kysely.sql`${kysely.sql.ref(this.mapColumn(target, condition.column))}::time ${kysely.sql.raw(condition.operator)} ${condition.value}::time`;
819
+ const column = kysely.sql.ref(this.mapColumn(target, condition.column));
820
+ return kysely.sql`${column}::time ${kysely.sql.raw(condition.operator)} ${condition.value}::time`;
818
821
  }
819
822
  buildDayCondition(target, condition) {
820
- return kysely.sql`extract(day from ${kysely.sql.ref(this.mapColumn(target, condition.column))}) ${kysely.sql.raw(condition.operator)} ${condition.value}`;
823
+ const column = kysely.sql.ref(this.mapColumn(target, condition.column));
824
+ return kysely.sql`extract(day from ${column}) ${kysely.sql.raw(condition.operator)} ${condition.value}`;
821
825
  }
822
826
  buildExistsCondition(condition) {
823
827
  const target = condition.query.target;
@@ -830,19 +834,24 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
830
834
  }
831
835
  buildFullTextCondition(target, condition) {
832
836
  const language = kysely.sql.raw(`'${condition.language ?? "simple"}'`);
833
- return kysely.sql`to_tsvector(${language}, ${kysely.sql.join(condition.columns.map((column) => {
837
+ const document = kysely.sql.join(condition.columns.map((column) => {
834
838
  return kysely.sql`coalesce(${kysely.sql.ref(this.mapColumn(target, column))}::text, '')`;
835
- }), kysely.sql` || ' ' || `)}) @@ plainto_tsquery(${language}, ${condition.value})`;
839
+ }), kysely.sql` || ' ' || `);
840
+ return kysely.sql`to_tsvector(${language}, ${document}) @@ plainto_tsquery(${language}, ${condition.value})`;
836
841
  }
837
842
  buildJsonAccessor(target, column, path) {
838
843
  const base = kysely.sql`${kysely.sql.ref(this.mapColumn(target, column))}::jsonb`;
839
844
  if (!path || path.length === 0) return base;
840
- return kysely.sql`(${base} #> ${`{${path.join(",")}}`}::text[])`;
845
+ const pathLiteral = `{${path.join(",")}}`;
846
+ return kysely.sql`(${base} #> ${pathLiteral}::text[])`;
841
847
  }
842
848
  buildJsonCondition(target, condition) {
843
849
  const accessor = this.buildJsonAccessor(target, condition.column, condition.path);
844
850
  if (condition.kind === "contains-key") return condition.not ? kysely.sql`${accessor} is null` : kysely.sql`${accessor} is not null`;
845
- if (condition.kind === "length") return kysely.sql`jsonb_array_length(${accessor}) ${kysely.sql.raw(condition.operator ?? "=")} ${condition.value}`;
851
+ if (condition.kind === "length") {
852
+ const operator = kysely.sql.raw(condition.operator ?? "=");
853
+ return kysely.sql`jsonb_array_length(${accessor}) ${operator} ${condition.value}`;
854
+ }
846
855
  const jsonValue = JSON.stringify(condition.value ?? null);
847
856
  if (condition.kind === "overlaps") return kysely.sql`exists (
848
857
  select 1
@@ -922,7 +931,10 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
922
931
  let accessor;
923
932
  if (node.path.length === 0) accessor = base;
924
933
  else if (node.path.length === 1) accessor = kysely.sql`(${base} ->> ${node.path[0]})`;
925
- else accessor = kysely.sql`(${base} #>> ${`{${node.path.join(",")}}`}::text[])`;
934
+ else {
935
+ const pathLiteral = `{${node.path.join(",")}}`;
936
+ accessor = kysely.sql`(${base} #>> ${pathLiteral}::text[])`;
937
+ }
926
938
  if (node.cast === "number") return kysely.sql`(${accessor})::numeric`;
927
939
  if (node.cast === "boolean") return kysely.sql`(${accessor})::boolean`;
928
940
  return accessor;
@@ -1087,11 +1099,13 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
1087
1099
  buildRelationFilterExpression(target, filter) {
1088
1100
  if (filter.morph) return this.buildMorphRelationFilterExpression(target, filter);
1089
1101
  const { relatedTarget, from, condition } = this.buildRelatedJoinCondition(target, filter.relation);
1102
+ const whereCondition = this.combineConditions([condition, filter.where ? this.buildWhereCondition(relatedTarget, filter.where) : void 0]);
1103
+ const operator = filter.operator === "!=" ? kysely.sql.raw("!=") : kysely.sql.raw(filter.operator);
1090
1104
  return kysely.sql`(
1091
1105
  select count(*)::int
1092
1106
  from ${from}
1093
- where ${this.combineConditions([condition, filter.where ? this.buildWhereCondition(relatedTarget, filter.where) : void 0])}
1094
- ) ${filter.operator === "!=" ? kysely.sql.raw("!=") : kysely.sql.raw(filter.operator)} ${filter.count}`;
1107
+ where ${whereCondition}
1108
+ ) ${operator} ${filter.count}`;
1095
1109
  }
1096
1110
  buildMorphRelationFilterExpression(outerTarget, filter) {
1097
1111
  const morph = filter.morph;
@@ -1157,8 +1171,9 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
1157
1171
  where ${whereCondition}
1158
1172
  ) as ${kysely.sql.id(aggregate.alias ?? `${aggregate.relation}Exists`)}`;
1159
1173
  const selectedColumn = aggregate.column ? this.buildColumnReference(relatedTable, this.mapColumn(relatedTarget, aggregate.column)) : kysely.sql.raw("*");
1174
+ const aggregateExpression = aggregate.type === "count" ? kysely.sql`count(*)::int` : aggregate.type === "sum" ? kysely.sql`sum(${selectedColumn})::double precision` : aggregate.type === "avg" ? kysely.sql`avg(${selectedColumn})::double precision` : aggregate.type === "min" ? kysely.sql`min(${selectedColumn})` : kysely.sql`max(${selectedColumn})`;
1160
1175
  return kysely.sql`, (
1161
- select ${aggregate.type === "count" ? kysely.sql`count(*)::int` : aggregate.type === "sum" ? kysely.sql`sum(${selectedColumn})::double precision` : aggregate.type === "avg" ? kysely.sql`avg(${selectedColumn})::double precision` : aggregate.type === "min" ? kysely.sql`min(${selectedColumn})` : kysely.sql`max(${selectedColumn})`}
1176
+ select ${aggregateExpression}
1162
1177
  from ${from}
1163
1178
  where ${whereCondition}
1164
1179
  ) as ${kysely.sql.id(aggregate.alias ?? `${aggregate.relation}${aggregate.type}`)}`;
@@ -1644,6 +1659,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
1644
1659
  }
1645
1660
  async introspectModels(options = {}) {
1646
1661
  const tables = options.tables?.filter(Boolean) ?? [];
1662
+ const tableFilter = tables.length > 0 ? kysely.sql` and cls.relname in (${kysely.sql.join(tables)})` : kysely.sql``;
1647
1663
  const result = await kysely.sql`
1648
1664
  select
1649
1665
  cls.relname as table_name,
@@ -1668,7 +1684,7 @@ var KyselyDatabaseAdapter = class KyselyDatabaseAdapter {
1668
1684
  and att.attnum > 0
1669
1685
  and not att.attisdropped
1670
1686
  and ns.nspname not in ('pg_catalog', 'information_schema')
1671
- ${tables.length > 0 ? kysely.sql` and cls.relname in (${kysely.sql.join(tables)})` : kysely.sql``}
1687
+ ${tableFilter}
1672
1688
  order by cls.relname asc, att.attnum asc
1673
1689
  `.execute(this.db);
1674
1690
  const models = /* @__PURE__ */ new Map();
@@ -2449,9 +2465,11 @@ const loadModel = (modelName, exportName) => {
2449
2465
  sourceMaps: true
2450
2466
  });
2451
2467
  for (const directory of getModelDirectories()) {
2452
- const modulePath = resolveRuntimeModelPath((0, node_path.join)(directory, modelName));
2468
+ const sourcePath = (0, node_path.join)(directory, modelName);
2469
+ const modulePath = resolveRuntimeModelPath(sourcePath);
2453
2470
  if (!(0, node_fs.existsSync)(modulePath)) continue;
2454
- const model = resolveModelExport(jiti$1(modulePath), exportName);
2471
+ const module = jiti$1(modulePath);
2472
+ const model = resolveModelExport(module, exportName);
2455
2473
  if (!isModelConstructor(model)) continue;
2456
2474
  require_relationship.registerModels(model);
2457
2475
  return model;
@@ -2729,12 +2747,18 @@ function resolveCast(definition) {
2729
2747
  * @author Legacy (3m1n3nc3)
2730
2748
  * @since 0.1.0
2731
2749
  */
2732
- var CliApp = class {
2750
+ var CliApp = class extends _h3ravel_musket.Application {
2733
2751
  constructor() {
2752
+ super();
2734
2753
  this.config = {};
2735
2754
  this.getConfig = require_relationship.getUserConfig;
2736
2755
  this.config = require_relationship.getUserConfig();
2737
2756
  }
2757
+ registerMusketListeners(musket) {
2758
+ musket.afterHandle.on(async () => {
2759
+ await require_relationship.disposeArkormRuntime();
2760
+ });
2761
+ }
2738
2762
  isUsingPrismaAdapter() {
2739
2763
  return this.getConfig("adapter") instanceof PrismaDatabaseAdapter;
2740
2764
  }
@@ -2871,7 +2895,8 @@ var CliApp = class {
2871
2895
  * @returns
2872
2896
  */
2873
2897
  resolveStubPath(stubName) {
2874
- return (0, path.join)(this.resolveConfigPath("stubs", require_relationship.getDefaultStubsPath()), stubName);
2898
+ const stubsDir = this.resolveConfigPath("stubs", require_relationship.getDefaultStubsPath());
2899
+ return (0, path.join)(stubsDir, stubName);
2875
2900
  }
2876
2901
  /**
2877
2902
  * Generate a factory file for a given model name.
@@ -2885,7 +2910,8 @@ var CliApp = class {
2885
2910
  const factoryName = `${baseName}Factory`;
2886
2911
  const modelName = options.modelName ? (0, _h3ravel_support.str)(options.modelName).pascal() : baseName;
2887
2912
  const outputExt = this.resolveOutputExt();
2888
- const outputPath = (0, path.join)(this.resolveConfigPath("factories", (0, path.join)(process.cwd(), "database", "factories")), `${factoryName}.${outputExt}`);
2913
+ const factoriesDir = this.resolveConfigPath("factories", (0, path.join)(process.cwd(), "database", "factories"));
2914
+ const outputPath = (0, path.join)(factoriesDir, `${factoryName}.${outputExt}`);
2889
2915
  const modelPath = (0, path.join)(this.resolveConfigPath("models", (0, path.join)(process.cwd(), "src", "models")), `${modelName}.${outputExt}`);
2890
2916
  const relativeImport = options.modelImportPath ?? `./${this.stripKnownSourceExtension((0, path.relative)((0, path.dirname)(outputPath), modelPath).replace(/\\/g, "/"))}${outputExt === "js" ? ".js" : ""}`;
2891
2917
  const stubPath = this.resolveStubPath(outputExt === "js" ? "factory.js.stub" : "factory.stub");
@@ -2908,7 +2934,8 @@ var CliApp = class {
2908
2934
  makeSeeder(name, options = {}) {
2909
2935
  const seederName = `${(0, _h3ravel_support.str)(name.replace(/Seeder$/, "")).pascal()}Seeder`;
2910
2936
  const outputExt = this.resolveOutputExt();
2911
- const outputPath = (0, path.join)(this.resolveConfigPath("seeders", (0, path.join)(process.cwd(), "database", "seeders")), `${seederName}.${outputExt}`);
2937
+ const seedersDir = this.resolveConfigPath("seeders", (0, path.join)(process.cwd(), "database", "seeders"));
2938
+ const outputPath = (0, path.join)(seedersDir, `${seederName}.${outputExt}`);
2912
2939
  const stubPath = this.resolveStubPath(outputExt === "js" ? "seeder.js.stub" : "seeder.stub");
2913
2940
  return {
2914
2941
  name: seederName,
@@ -2922,8 +2949,9 @@ var CliApp = class {
2922
2949
  * @returns An object containing the name and path of the generated migration file.
2923
2950
  */
2924
2951
  makeMigration(name) {
2952
+ const migrationsDir = this.resolveConfigPath("migrations", (0, path.join)(process.cwd(), "database", "migrations"));
2925
2953
  const generated = require_relationship.generateMigrationFile(name, {
2926
- directory: this.resolveConfigPath("migrations", (0, path.join)(process.cwd(), "database", "migrations")),
2954
+ directory: migrationsDir,
2927
2955
  extension: this.resolveOutputExt()
2928
2956
  });
2929
2957
  return {
@@ -2943,7 +2971,8 @@ var CliApp = class {
2943
2971
  const modelName = `${baseName}`;
2944
2972
  const tableName = (0, _h3ravel_support.str)(baseName).camel().plural().toString();
2945
2973
  const outputExt = this.resolveOutputExt();
2946
- const outputPath = (0, path.join)(this.resolveConfigPath("models", (0, path.join)(process.cwd(), "src", "models")), `${modelName}.${outputExt}`);
2974
+ const modelsDir = this.resolveConfigPath("models", (0, path.join)(process.cwd(), "src", "models"));
2975
+ const outputPath = (0, path.join)(modelsDir, `${modelName}.${outputExt}`);
2947
2976
  const shouldBuildFactory = options.all || options.factory;
2948
2977
  const shouldBuildSeeder = options.all || options.seeder;
2949
2978
  const shouldBuildMigration = options.all || options.migration;
@@ -2997,7 +3026,7 @@ var CliApp = class {
2997
3026
  path: schemaPath,
2998
3027
  updated: false
2999
3028
  };
3000
- (0, fs.writeFileSync)(schemaPath, require_relationship.applyCreateTableOperation(source, {
3029
+ const updated = require_relationship.applyCreateTableOperation(source, {
3001
3030
  type: "createTable",
3002
3031
  table: tableName,
3003
3032
  columns: [{
@@ -3007,7 +3036,8 @@ var CliApp = class {
3007
3036
  }],
3008
3037
  indexes: [],
3009
3038
  foreignKeys: []
3010
- }));
3039
+ });
3040
+ (0, fs.writeFileSync)(schemaPath, updated);
3011
3041
  return {
3012
3042
  path: schemaPath,
3013
3043
  updated: true
@@ -3205,7 +3235,7 @@ var CliApp = class {
3205
3235
  const existingImport = modelSource.match(importRegex);
3206
3236
  if (existingImport) {
3207
3237
  const existingTypes = existingImport[1].split(",").map((value) => value.trim()).filter(Boolean);
3208
- const mergedTypes = [...new Set([...existingTypes, ...enumTypes])].sort((left, right) => left.localeCompare(right));
3238
+ const mergedTypes = [.../* @__PURE__ */ new Set([...existingTypes, ...enumTypes])].sort((left, right) => left.localeCompare(right));
3209
3239
  return modelSource.replace(importRegex, `import type { ${mergedTypes.join(", ")} } from '@prisma/client'`);
3210
3240
  }
3211
3241
  const lines = modelSource.split("\n");
@@ -3253,7 +3283,8 @@ var CliApp = class {
3253
3283
  return (0, fs.readdirSync)(modelsDir).filter((file) => file.endsWith(".ts")).map((file) => (0, path.join)(modelsDir, file));
3254
3284
  }
3255
3285
  syncModelRegistryTypes(modelFiles) {
3256
- const registryDir = (0, path.join)((0, fs.realpathSync)(process.cwd()), ".arkormx");
3286
+ const cwd = (0, fs.realpathSync)(process.cwd());
3287
+ const registryDir = (0, path.join)(cwd, ".arkormx");
3257
3288
  const registryPath = (0, path.join)(registryDir, "models.d.ts");
3258
3289
  const models = modelFiles.map((filePath) => {
3259
3290
  const parsed = this.parseModelSyncSource((0, fs.readFileSync)(filePath, "utf-8"));
@@ -3372,7 +3403,7 @@ var CliApp = class {
3372
3403
  const models = [];
3373
3404
  const enumDefinitions = this.parsePrismaEnums(schema);
3374
3405
  const modelRegex = /model\s+(\w+)\s*\{([\s\S]*?)\n\}/g;
3375
- const scalarTypes = new Set([
3406
+ const scalarTypes = /* @__PURE__ */ new Set([
3376
3407
  "Int",
3377
3408
  "Float",
3378
3409
  "Decimal",
@@ -4055,12 +4086,15 @@ var MigrateCommand = class extends _h3ravel_musket.Command {
4055
4086
  }
4056
4087
  if (!useDatabaseMigrations && !this.option("skip-generate")) require_relationship.runPrismaCommand(["generate"], process.cwd());
4057
4088
  if (!useDatabaseMigrations && !this.option("skip-migrate")) if (this.option("deploy")) require_relationship.runPrismaCommand(["migrate", "deploy"], process.cwd());
4058
- else require_relationship.runPrismaCommand([
4059
- "migrate",
4060
- "dev",
4061
- "--name",
4062
- this.option("migration-name") ? String(this.option("migration-name")) : `arkorm_cli_${Date.now()}`
4063
- ], process.cwd());
4089
+ else {
4090
+ const name = this.option("migration-name") ? String(this.option("migration-name")) : `arkorm_cli_${Date.now()}`;
4091
+ require_relationship.runPrismaCommand([
4092
+ "migrate",
4093
+ "dev",
4094
+ "--name",
4095
+ name
4096
+ ], process.cwd());
4097
+ }
4064
4098
  this.success(`Applied ${pending.length} migration(s).`);
4065
4099
  pending.forEach(([_, file]) => this.success(this.app.splitLogger("Migrated", file)));
4066
4100
  this.syncModelRegistryIfRequested();
@@ -4217,7 +4251,8 @@ var MigrateFreshCommand = class extends _h3ravel_musket.Command {
4217
4251
  if (!(await this.runWithDatabaseCreationRetry(adapter, () => adapter.resetDatabase())).ok) return;
4218
4252
  } else {
4219
4253
  if (!(0, node_fs.existsSync)(schemaPath)) return void this.error(`Error: Prisma schema file not found: ${this.app.formatPathForLog(schemaPath)}`);
4220
- (0, node_fs.writeFileSync)(schemaPath, require_relationship.stripPrismaSchemaModelsAndEnums((0, node_fs.readFileSync)(schemaPath, "utf-8")));
4254
+ const source = (0, node_fs.readFileSync)(schemaPath, "utf-8");
4255
+ (0, node_fs.writeFileSync)(schemaPath, require_relationship.stripPrismaSchemaModelsAndEnums(source));
4221
4256
  }
4222
4257
  let appliedState = require_relationship.createEmptyAppliedMigrationsState();
4223
4258
  if (!(await this.runWithDatabaseCreationRetry(adapter, () => require_relationship.writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedState))).ok) return;
@@ -4402,12 +4437,15 @@ var MigrateRollbackCommand = class extends _h3ravel_musket.Command {
4402
4437
  }
4403
4438
  if (!useDatabaseMigrations && !this.option("skip-generate")) require_relationship.runPrismaCommand(["generate"], process.cwd());
4404
4439
  if (!useDatabaseMigrations && !this.option("skip-migrate")) if (this.option("deploy")) require_relationship.runPrismaCommand(["migrate", "deploy"], process.cwd());
4405
- else require_relationship.runPrismaCommand([
4406
- "migrate",
4407
- "dev",
4408
- "--name",
4409
- this.option("migration-name") ? String(this.option("migration-name")) : `arkorm_cli_rollback_${Date.now()}`
4410
- ], process.cwd());
4440
+ else {
4441
+ const name = this.option("migration-name") ? String(this.option("migration-name")) : `arkorm_cli_rollback_${Date.now()}`;
4442
+ require_relationship.runPrismaCommand([
4443
+ "migrate",
4444
+ "dev",
4445
+ "--name",
4446
+ name
4447
+ ], process.cwd());
4448
+ }
4411
4449
  this.success(`Rolled back ${rollbackClasses.length} migration(s).`);
4412
4450
  rollbackClasses.forEach(([_, file]) => this.success(this.app.splitLogger("RolledBack", file)));
4413
4451
  }
@@ -5017,7 +5055,7 @@ var QueryBuilder = class QueryBuilder {
5017
5055
  * condition and appends it.
5018
5056
  */
5019
5057
  addPositionalWhere(boolean, column, argCount, operatorOrValue, value) {
5020
- const unaryOperators = new Set(["is-null", "is-not-null"]);
5058
+ const unaryOperators = /* @__PURE__ */ new Set(["is-null", "is-not-null"]);
5021
5059
  let operator;
5022
5060
  let resolvedValue;
5023
5061
  if (argCount >= 3) {
@@ -5129,6 +5167,27 @@ var QueryBuilder = class QueryBuilder {
5129
5167
  return this.where({ [key]: { not: null } });
5130
5168
  }
5131
5169
  /**
5170
+ * Adds an OR null check for a key.
5171
+ *
5172
+ * The OR counterpart of {@link whereNull}, so a null check can be combined
5173
+ * inside a grouped `where` callback, e.g. `q.whereFuture('expiresAt').orWhereNull('expiresAt')`.
5174
+ *
5175
+ * @param key
5176
+ * @returns
5177
+ */
5178
+ orWhereNull(key) {
5179
+ return this.orWhere({ [key]: null });
5180
+ }
5181
+ /**
5182
+ * Adds an OR not-null check for a key. The OR counterpart of {@link whereNotNull}.
5183
+ *
5184
+ * @param key
5185
+ * @returns
5186
+ */
5187
+ orWhereNotNull(key) {
5188
+ return this.orWhere({ [key]: { not: null } });
5189
+ }
5190
+ /**
5132
5191
  * Adds a between range clause for a key.
5133
5192
  *
5134
5193
  * @param key
@@ -7093,7 +7152,8 @@ var QueryBuilder = class QueryBuilder {
7093
7152
  async pluck(column, key) {
7094
7153
  const rows = await this.executeReadRows();
7095
7154
  if (!key) return new require_relationship.ArkormCollection(rows.map((row) => row[column]));
7096
- return new require_relationship.ArkormCollection(rows.sort((leftRow, rightRow) => String(leftRow[key]).localeCompare(String(rightRow[key]))).map((row) => row[column]));
7155
+ const keyedValues = rows.sort((leftRow, rightRow) => String(leftRow[key]).localeCompare(String(rightRow[key]))).map((row) => row[column]);
7156
+ return new require_relationship.ArkormCollection(keyedValues);
7097
7157
  }
7098
7158
  /**
7099
7159
  * Creates a new record with the specified data and returns it as a model instance.
@@ -7595,11 +7655,13 @@ var QueryBuilder = class QueryBuilder {
7595
7655
  const pageSize = Math.max(1, perPage);
7596
7656
  const rows = (await this.get()).all();
7597
7657
  const start = (currentPage - 1) * pageSize;
7598
- return new require_relationship.LengthAwarePaginator(new require_relationship.ArkormCollection(rows.slice(start, start + pageSize)), rows.length, pageSize, currentPage, options);
7658
+ const slice = new require_relationship.ArkormCollection(rows.slice(start, start + pageSize));
7659
+ return new require_relationship.LengthAwarePaginator(slice, rows.length, pageSize, currentPage, options);
7599
7660
  }
7600
7661
  const pageSize = Math.max(1, perPage);
7601
7662
  const total = await this.count();
7602
- return new require_relationship.LengthAwarePaginator(await this.clone().skip((currentPage - 1) * pageSize).take(pageSize).get(), total, pageSize, currentPage, options);
7663
+ const items = await this.clone().skip((currentPage - 1) * pageSize).take(pageSize).get();
7664
+ return new require_relationship.LengthAwarePaginator(items, total, pageSize, currentPage, options);
7603
7665
  }
7604
7666
  /**
7605
7667
  * Paginates results without calculating total row count.
@@ -7621,7 +7683,8 @@ var QueryBuilder = class QueryBuilder {
7621
7683
  const pageSize = Math.max(1, perPage);
7622
7684
  const items = await this.clone().skip((currentPage - 1) * pageSize).take(pageSize + 1).get();
7623
7685
  const hasMorePages = items.all().length > pageSize;
7624
- return new require_relationship.Paginator(hasMorePages ? new require_relationship.ArkormCollection(items.all().slice(0, pageSize)) : items, pageSize, currentPage, hasMorePages, options);
7686
+ const data = hasMorePages ? new require_relationship.ArkormCollection(items.all().slice(0, pageSize)) : items;
7687
+ return new require_relationship.Paginator(data, pageSize, currentPage, hasMorePages, options);
7625
7688
  }
7626
7689
  /**
7627
7690
  * Creates a clone of the current query builder instance with the same state.
@@ -8346,7 +8409,7 @@ var QueryBuilder = class QueryBuilder {
8346
8409
  const adapter = this.requireAdapter();
8347
8410
  const payloads = this.normalizeInsertPayloads(values);
8348
8411
  const timestampUpdateColumns = (this.model.getModelMetadata().timestampColumns ?? []).filter((column) => column.updatedAt).map((column) => column.column);
8349
- const normalizedUpdateColumns = updateColumns ? Array.from(new Set([...updateColumns, ...timestampUpdateColumns])) : updateColumns;
8412
+ const normalizedUpdateColumns = updateColumns ? Array.from(/* @__PURE__ */ new Set([...updateColumns, ...timestampUpdateColumns])) : updateColumns;
8350
8413
  if (typeof adapter.upsert !== "function") throw new require_relationship.UnsupportedAdapterFeatureException("Upsert is not supported by the current adapter.", {
8351
8414
  operation: "query.upsert",
8352
8415
  model: this.model.name
@@ -9240,12 +9303,13 @@ var Model = class Model {
9240
9303
  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.");
9241
9304
  require_relationship.ensureArkormConfigLoading();
9242
9305
  const key = delegate || this.delegate || this.getTable();
9243
- return resolveRuntimeCompatibilityQuerySchemaOrThrow(key, [
9306
+ const candidates = [
9244
9307
  key,
9245
9308
  `${(0, _h3ravel_support.str)(key).camel()}`,
9246
9309
  `${(0, _h3ravel_support.str)(key).singular()}`,
9247
9310
  `${(0, _h3ravel_support.str)(key).camel().singular()}`
9248
- ], this.name, this.client);
9311
+ ];
9312
+ return resolveRuntimeCompatibilityQuerySchemaOrThrow(key, candidates, this.name, this.client);
9249
9313
  }
9250
9314
  static getAdapter() {
9251
9315
  require_relationship.ensureArkormConfigLoading();
@@ -9983,7 +10047,7 @@ var Model = class Model {
9983
10047
  */
9984
10048
  getDirtyAttributes(keys) {
9985
10049
  const requestedKeys = this.normalizeAttributeKeys(keys);
9986
- return (requestedKeys.length > 0 ? requestedKeys : Array.from(new Set([...Object.keys(this.original), ...this.touchedAttributes]))).reduce((dirty, key) => {
10050
+ return (requestedKeys.length > 0 ? requestedKeys : Array.from(/* @__PURE__ */ new Set([...Object.keys(this.original), ...this.touchedAttributes]))).reduce((dirty, key) => {
9987
10051
  const currentValue = this.attributes[key];
9988
10052
  const originalValue = this.original[key];
9989
10053
  const hasCurrent = Object.prototype.hasOwnProperty.call(this.attributes, key);