arkormx 1.0.0 → 1.2.0

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/index.d.cts CHANGED
@@ -24,10 +24,12 @@ type FactoryDefinition<TAttributes extends FactoryAttributes> = (sequence: numbe
24
24
  type FactoryState<TAttributes extends FactoryAttributes> = (attributes: TAttributes, sequence: number) => TAttributes;
25
25
  //#endregion
26
26
  //#region src/types/migrations.d.ts
27
- type SchemaColumnType = 'id' | 'uuid' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
27
+ type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
28
28
  interface SchemaColumn {
29
29
  name: string;
30
30
  type: SchemaColumnType;
31
+ enumName?: string;
32
+ enumValues?: string[];
31
33
  map?: string;
32
34
  nullable?: boolean;
33
35
  unique?: boolean;
@@ -594,6 +596,9 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
594
596
  protected visible: string[];
595
597
  protected appends: string[];
596
598
  protected readonly attributes: Record<string, unknown>;
599
+ protected original: Record<string, unknown>;
600
+ protected changes: Record<string, unknown>;
601
+ protected readonly touchedAttributes: Set<string>;
597
602
  constructor(attributes?: Record<string, unknown>);
598
603
  /**
599
604
  * Set the Prisma client delegates for all models.
@@ -863,6 +868,37 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
863
868
  * @returns
864
869
  */
865
870
  getRawAttributes(): Partial<TAttributes>;
871
+ /**
872
+ * Get the model's original persisted attributes.
873
+ *
874
+ * @returns
875
+ */
876
+ getOriginal(): Partial<TAttributes>;
877
+ /**
878
+ * @param key The attribute key to retrieve the original value for.
879
+ */
880
+ getOriginal<TKey extends keyof TAttributes & string>(key: TKey): TAttributes[TKey] | undefined;
881
+ /**
882
+ * Determine whether the model has unsaved attribute changes.
883
+ *
884
+ * @param keys
885
+ * @returns
886
+ */
887
+ isDirty(keys?: string | string[]): boolean;
888
+ /**
889
+ * Determine whether the model has no unsaved attribute changes.
890
+ *
891
+ * @param keys
892
+ * @returns
893
+ */
894
+ isClean(keys?: string | string[]): boolean;
895
+ /**
896
+ * Determine whether the model changed during the last successful persistence operation.
897
+ *
898
+ * @param keys
899
+ * @returns
900
+ */
901
+ wasChanged(keys?: string | string[]): boolean;
866
902
  /**
867
903
  * Convert the model instance to a plain object, applying visibility
868
904
  * rules, appends, and mutators.
@@ -1004,6 +1040,20 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1004
1040
  * @returns
1005
1041
  */
1006
1042
  private resolveGetMutator;
1043
+ /**
1044
+ * Build a map of dirty attributes, optionally limited to specific keys.
1045
+ *
1046
+ * @param keys
1047
+ * @returns
1048
+ */
1049
+ private getDirtyAttributes;
1050
+ /**
1051
+ * Normalize a key or key list for dirty/change lookups.
1052
+ *
1053
+ * @param keys
1054
+ * @returns
1055
+ */
1056
+ private normalizeAttributeKeys;
1007
1057
  /**
1008
1058
  * Resolve an Attribute object mutator method for a given key, if it exists.
1009
1059
  *
@@ -1026,6 +1076,31 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1026
1076
  * Ensures event listeners are own properties on subclass constructors.
1027
1077
  */
1028
1078
  private static ensureOwnEventListeners;
1079
+ /**
1080
+ * Clone an attribute value to keep snapshot state isolated from live mutations.
1081
+ *
1082
+ * @param value
1083
+ * @returns
1084
+ */
1085
+ private static cloneAttributeValue;
1086
+ /**
1087
+ * Compare attribute values for dirty/change detection.
1088
+ *
1089
+ * @param left
1090
+ * @param right
1091
+ * @returns
1092
+ */
1093
+ private static areAttributeValuesEqual;
1094
+ /**
1095
+ * Sync the original snapshot to the model's current raw attributes.
1096
+ */
1097
+ private syncOriginal;
1098
+ /**
1099
+ * Sync the last-changed snapshot from a previous original state.
1100
+ *
1101
+ * @param previousOriginal
1102
+ */
1103
+ private syncChanges;
1029
1104
  /**
1030
1105
  * Resolve lifecycle state for the provided model class.
1031
1106
  *
@@ -2597,6 +2672,58 @@ declare class ForeignKeyBuilder {
2597
2672
  }
2598
2673
  //#endregion
2599
2674
  //#region src/database/TableBuilder.d.ts
2675
+ /**
2676
+ * The EnumBuilder class provides a fluent interface for configuring enum columns
2677
+ * after they are defined on a table.
2678
+ *
2679
+ * @author Legacy (3m1n3nc3)
2680
+ * @since 0.2.3
2681
+ */
2682
+ declare class EnumBuilder {
2683
+ private readonly tableBuilder;
2684
+ private readonly columnName;
2685
+ constructor(tableBuilder: TableBuilder, columnName: string);
2686
+ /**
2687
+ * Defines the Prisma enum name for this column.
2688
+ *
2689
+ * @param name
2690
+ * @returns
2691
+ */
2692
+ enumName(name: string): this;
2693
+ /**
2694
+ * Marks the enum column as nullable.
2695
+ *
2696
+ * @returns
2697
+ */
2698
+ nullable(): this;
2699
+ /**
2700
+ * Marks the enum column as unique.
2701
+ *
2702
+ * @returns
2703
+ */
2704
+ unique(): this;
2705
+ /**
2706
+ * Sets a default value for the enum column.
2707
+ *
2708
+ * @param value
2709
+ * @returns
2710
+ */
2711
+ default(value: unknown): this;
2712
+ /**
2713
+ * Positions the enum column after another column when supported.
2714
+ *
2715
+ * @param referenceColumn
2716
+ * @returns
2717
+ */
2718
+ after(referenceColumn: string): this;
2719
+ /**
2720
+ * Maps the enum column to a custom database column name.
2721
+ *
2722
+ * @param name
2723
+ * @returns
2724
+ */
2725
+ map(name: string): this;
2726
+ }
2600
2727
  /**
2601
2728
  * The TableBuilder class provides a fluent interface for defining
2602
2729
  * the structure of a database table in a migration, including columns to add or drop.
@@ -2641,6 +2768,17 @@ declare class TableBuilder {
2641
2768
  * @returns The current TableBuilder instance for chaining.
2642
2769
  */
2643
2770
  uuid(name: string, options?: Partial<SchemaColumn>): this;
2771
+ /**
2772
+ * Defines an enum column in the table.
2773
+ *
2774
+ * @param name The name of the enum column.
2775
+ * @param values Either an array of string values for the enum or the name of an existing enum to reuse.
2776
+ * @param options Additional options for the enum column.
2777
+ * @returns
2778
+ */
2779
+ enum(name: string, valuesOrEnumName: string[] | string, options?: Partial<SchemaColumn> & {
2780
+ enumName?: string;
2781
+ }): EnumBuilder;
2644
2782
  /**
2645
2783
  * Defines a string column in the table.
2646
2784
  *
@@ -2762,6 +2900,14 @@ declare class TableBuilder {
2762
2900
  * @returns The current TableBuilder instance for chaining.
2763
2901
  */
2764
2902
  nullable(columnName?: string): this;
2903
+ /**
2904
+ * Sets the Prisma enum name for an enum column.
2905
+ *
2906
+ * @param name The enum name to assign.
2907
+ * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
2908
+ * @returns The current TableBuilder instance for chaining.
2909
+ */
2910
+ enumName(name: string, columnName?: string): this;
2765
2911
  /**
2766
2912
  * Sets a default value for a column.
2767
2913
  *
@@ -3051,6 +3197,8 @@ declare const getLatestAppliedMigrations: (state: AppliedMigrationsState, steps:
3051
3197
  //#endregion
3052
3198
  //#region src/helpers/migrations.d.ts
3053
3199
  declare const PRISMA_MODEL_REGEX: RegExp;
3200
+ declare const PRISMA_ENUM_REGEX: RegExp;
3201
+ declare const PRISMA_ENUM_MEMBER_REGEX: RegExp;
3054
3202
  /**
3055
3203
  * Convert a table name to a PascalCase model name, with basic singularization.
3056
3204
  *
@@ -3072,6 +3220,7 @@ declare const escapeRegex: (value: string) => string;
3072
3220
  * @returns
3073
3221
  */
3074
3222
  declare const resolvePrismaType: (column: SchemaColumn) => string;
3223
+ declare const resolveEnumName: (column: SchemaColumn) => string;
3075
3224
  /**
3076
3225
  * Format a default value for inclusion in a Prisma schema field definition, based on its type.
3077
3226
  *
@@ -3079,6 +3228,13 @@ declare const resolvePrismaType: (column: SchemaColumn) => string;
3079
3228
  * @returns
3080
3229
  */
3081
3230
  declare const formatDefaultValue: (value: unknown) => string | undefined;
3231
+ /**
3232
+ * Format a default value for an enum column as a Prisma @default attribute, validating that it is a non-empty string.
3233
+ *
3234
+ * @param value
3235
+ * @returns
3236
+ */
3237
+ declare const formatEnumDefaultValue: (value: unknown) => string | undefined;
3082
3238
  /**
3083
3239
  * Build a single line of a Prisma model field definition based on a SchemaColumn, including type and modifiers.
3084
3240
  *
@@ -3086,6 +3242,29 @@ declare const formatDefaultValue: (value: unknown) => string | undefined;
3086
3242
  * @returns
3087
3243
  */
3088
3244
  declare const buildFieldLine: (column: SchemaColumn) => string;
3245
+ /**
3246
+ * Build a Prisma enum block string based on an enum name and its values, validating that
3247
+ * at least one value is provided.
3248
+ *
3249
+ * @param enumName The name of the enum to create.
3250
+ * @param values The array of values for the enum.
3251
+ * @returns The Prisma enum block string.
3252
+ */
3253
+ declare const buildEnumBlock: (enumName: string, values: string[]) => string;
3254
+ /**
3255
+ * Find the Prisma enum block in a schema string that corresponds to a given enum
3256
+ * name, returning its details if found.
3257
+ *
3258
+ * @param schema The Prisma schema string to search for the enum block.
3259
+ * @param enumName The name of the enum to find in the schema.
3260
+ * @returns
3261
+ */
3262
+ declare const findEnumBlock: (schema: string, enumName: string) => {
3263
+ enumName: string;
3264
+ block: string;
3265
+ start: number;
3266
+ end: number;
3267
+ } | null;
3089
3268
  /**
3090
3269
  * Build a Prisma model-level @@index definition line.
3091
3270
  *
@@ -3419,4 +3598,4 @@ declare class URLDriver {
3419
3598
  url(page: number): string;
3420
3599
  }
3421
3600
  //#endregion
3422
- export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, 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, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findModelBlock, formatDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
3601
+ 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, deriveRelationFieldName, 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
@@ -24,10 +24,12 @@ type FactoryDefinition<TAttributes extends FactoryAttributes> = (sequence: numbe
24
24
  type FactoryState<TAttributes extends FactoryAttributes> = (attributes: TAttributes, sequence: number) => TAttributes;
25
25
  //#endregion
26
26
  //#region src/types/migrations.d.ts
27
- type SchemaColumnType = 'id' | 'uuid' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
27
+ type SchemaColumnType = 'id' | 'uuid' | 'enum' | 'string' | 'text' | 'integer' | 'bigInteger' | 'float' | 'boolean' | 'json' | 'date' | 'timestamp';
28
28
  interface SchemaColumn {
29
29
  name: string;
30
30
  type: SchemaColumnType;
31
+ enumName?: string;
32
+ enumValues?: string[];
31
33
  map?: string;
32
34
  nullable?: boolean;
33
35
  unique?: boolean;
@@ -594,6 +596,9 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
594
596
  protected visible: string[];
595
597
  protected appends: string[];
596
598
  protected readonly attributes: Record<string, unknown>;
599
+ protected original: Record<string, unknown>;
600
+ protected changes: Record<string, unknown>;
601
+ protected readonly touchedAttributes: Set<string>;
597
602
  constructor(attributes?: Record<string, unknown>);
598
603
  /**
599
604
  * Set the Prisma client delegates for all models.
@@ -863,6 +868,37 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
863
868
  * @returns
864
869
  */
865
870
  getRawAttributes(): Partial<TAttributes>;
871
+ /**
872
+ * Get the model's original persisted attributes.
873
+ *
874
+ * @returns
875
+ */
876
+ getOriginal(): Partial<TAttributes>;
877
+ /**
878
+ * @param key The attribute key to retrieve the original value for.
879
+ */
880
+ getOriginal<TKey extends keyof TAttributes & string>(key: TKey): TAttributes[TKey] | undefined;
881
+ /**
882
+ * Determine whether the model has unsaved attribute changes.
883
+ *
884
+ * @param keys
885
+ * @returns
886
+ */
887
+ isDirty(keys?: string | string[]): boolean;
888
+ /**
889
+ * Determine whether the model has no unsaved attribute changes.
890
+ *
891
+ * @param keys
892
+ * @returns
893
+ */
894
+ isClean(keys?: string | string[]): boolean;
895
+ /**
896
+ * Determine whether the model changed during the last successful persistence operation.
897
+ *
898
+ * @param keys
899
+ * @returns
900
+ */
901
+ wasChanged(keys?: string | string[]): boolean;
866
902
  /**
867
903
  * Convert the model instance to a plain object, applying visibility
868
904
  * rules, appends, and mutators.
@@ -1004,6 +1040,20 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1004
1040
  * @returns
1005
1041
  */
1006
1042
  private resolveGetMutator;
1043
+ /**
1044
+ * Build a map of dirty attributes, optionally limited to specific keys.
1045
+ *
1046
+ * @param keys
1047
+ * @returns
1048
+ */
1049
+ private getDirtyAttributes;
1050
+ /**
1051
+ * Normalize a key or key list for dirty/change lookups.
1052
+ *
1053
+ * @param keys
1054
+ * @returns
1055
+ */
1056
+ private normalizeAttributeKeys;
1007
1057
  /**
1008
1058
  * Resolve an Attribute object mutator method for a given key, if it exists.
1009
1059
  *
@@ -1026,6 +1076,31 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1026
1076
  * Ensures event listeners are own properties on subclass constructors.
1027
1077
  */
1028
1078
  private static ensureOwnEventListeners;
1079
+ /**
1080
+ * Clone an attribute value to keep snapshot state isolated from live mutations.
1081
+ *
1082
+ * @param value
1083
+ * @returns
1084
+ */
1085
+ private static cloneAttributeValue;
1086
+ /**
1087
+ * Compare attribute values for dirty/change detection.
1088
+ *
1089
+ * @param left
1090
+ * @param right
1091
+ * @returns
1092
+ */
1093
+ private static areAttributeValuesEqual;
1094
+ /**
1095
+ * Sync the original snapshot to the model's current raw attributes.
1096
+ */
1097
+ private syncOriginal;
1098
+ /**
1099
+ * Sync the last-changed snapshot from a previous original state.
1100
+ *
1101
+ * @param previousOriginal
1102
+ */
1103
+ private syncChanges;
1029
1104
  /**
1030
1105
  * Resolve lifecycle state for the provided model class.
1031
1106
  *
@@ -2597,6 +2672,58 @@ declare class ForeignKeyBuilder {
2597
2672
  }
2598
2673
  //#endregion
2599
2674
  //#region src/database/TableBuilder.d.ts
2675
+ /**
2676
+ * The EnumBuilder class provides a fluent interface for configuring enum columns
2677
+ * after they are defined on a table.
2678
+ *
2679
+ * @author Legacy (3m1n3nc3)
2680
+ * @since 0.2.3
2681
+ */
2682
+ declare class EnumBuilder {
2683
+ private readonly tableBuilder;
2684
+ private readonly columnName;
2685
+ constructor(tableBuilder: TableBuilder, columnName: string);
2686
+ /**
2687
+ * Defines the Prisma enum name for this column.
2688
+ *
2689
+ * @param name
2690
+ * @returns
2691
+ */
2692
+ enumName(name: string): this;
2693
+ /**
2694
+ * Marks the enum column as nullable.
2695
+ *
2696
+ * @returns
2697
+ */
2698
+ nullable(): this;
2699
+ /**
2700
+ * Marks the enum column as unique.
2701
+ *
2702
+ * @returns
2703
+ */
2704
+ unique(): this;
2705
+ /**
2706
+ * Sets a default value for the enum column.
2707
+ *
2708
+ * @param value
2709
+ * @returns
2710
+ */
2711
+ default(value: unknown): this;
2712
+ /**
2713
+ * Positions the enum column after another column when supported.
2714
+ *
2715
+ * @param referenceColumn
2716
+ * @returns
2717
+ */
2718
+ after(referenceColumn: string): this;
2719
+ /**
2720
+ * Maps the enum column to a custom database column name.
2721
+ *
2722
+ * @param name
2723
+ * @returns
2724
+ */
2725
+ map(name: string): this;
2726
+ }
2600
2727
  /**
2601
2728
  * The TableBuilder class provides a fluent interface for defining
2602
2729
  * the structure of a database table in a migration, including columns to add or drop.
@@ -2641,6 +2768,17 @@ declare class TableBuilder {
2641
2768
  * @returns The current TableBuilder instance for chaining.
2642
2769
  */
2643
2770
  uuid(name: string, options?: Partial<SchemaColumn>): this;
2771
+ /**
2772
+ * Defines an enum column in the table.
2773
+ *
2774
+ * @param name The name of the enum column.
2775
+ * @param values Either an array of string values for the enum or the name of an existing enum to reuse.
2776
+ * @param options Additional options for the enum column.
2777
+ * @returns
2778
+ */
2779
+ enum(name: string, valuesOrEnumName: string[] | string, options?: Partial<SchemaColumn> & {
2780
+ enumName?: string;
2781
+ }): EnumBuilder;
2644
2782
  /**
2645
2783
  * Defines a string column in the table.
2646
2784
  *
@@ -2762,6 +2900,14 @@ declare class TableBuilder {
2762
2900
  * @returns The current TableBuilder instance for chaining.
2763
2901
  */
2764
2902
  nullable(columnName?: string): this;
2903
+ /**
2904
+ * Sets the Prisma enum name for an enum column.
2905
+ *
2906
+ * @param name The enum name to assign.
2907
+ * @param columnName Optional explicit target column name. When omitted, applies to the latest defined column.
2908
+ * @returns The current TableBuilder instance for chaining.
2909
+ */
2910
+ enumName(name: string, columnName?: string): this;
2765
2911
  /**
2766
2912
  * Sets a default value for a column.
2767
2913
  *
@@ -3051,6 +3197,8 @@ declare const getLatestAppliedMigrations: (state: AppliedMigrationsState, steps:
3051
3197
  //#endregion
3052
3198
  //#region src/helpers/migrations.d.ts
3053
3199
  declare const PRISMA_MODEL_REGEX: RegExp;
3200
+ declare const PRISMA_ENUM_REGEX: RegExp;
3201
+ declare const PRISMA_ENUM_MEMBER_REGEX: RegExp;
3054
3202
  /**
3055
3203
  * Convert a table name to a PascalCase model name, with basic singularization.
3056
3204
  *
@@ -3072,6 +3220,7 @@ declare const escapeRegex: (value: string) => string;
3072
3220
  * @returns
3073
3221
  */
3074
3222
  declare const resolvePrismaType: (column: SchemaColumn) => string;
3223
+ declare const resolveEnumName: (column: SchemaColumn) => string;
3075
3224
  /**
3076
3225
  * Format a default value for inclusion in a Prisma schema field definition, based on its type.
3077
3226
  *
@@ -3079,6 +3228,13 @@ declare const resolvePrismaType: (column: SchemaColumn) => string;
3079
3228
  * @returns
3080
3229
  */
3081
3230
  declare const formatDefaultValue: (value: unknown) => string | undefined;
3231
+ /**
3232
+ * Format a default value for an enum column as a Prisma @default attribute, validating that it is a non-empty string.
3233
+ *
3234
+ * @param value
3235
+ * @returns
3236
+ */
3237
+ declare const formatEnumDefaultValue: (value: unknown) => string | undefined;
3082
3238
  /**
3083
3239
  * Build a single line of a Prisma model field definition based on a SchemaColumn, including type and modifiers.
3084
3240
  *
@@ -3086,6 +3242,29 @@ declare const formatDefaultValue: (value: unknown) => string | undefined;
3086
3242
  * @returns
3087
3243
  */
3088
3244
  declare const buildFieldLine: (column: SchemaColumn) => string;
3245
+ /**
3246
+ * Build a Prisma enum block string based on an enum name and its values, validating that
3247
+ * at least one value is provided.
3248
+ *
3249
+ * @param enumName The name of the enum to create.
3250
+ * @param values The array of values for the enum.
3251
+ * @returns The Prisma enum block string.
3252
+ */
3253
+ declare const buildEnumBlock: (enumName: string, values: string[]) => string;
3254
+ /**
3255
+ * Find the Prisma enum block in a schema string that corresponds to a given enum
3256
+ * name, returning its details if found.
3257
+ *
3258
+ * @param schema The Prisma schema string to search for the enum block.
3259
+ * @param enumName The name of the enum to find in the schema.
3260
+ * @returns
3261
+ */
3262
+ declare const findEnumBlock: (schema: string, enumName: string) => {
3263
+ enumName: string;
3264
+ block: string;
3265
+ start: number;
3266
+ end: number;
3267
+ } | null;
3089
3268
  /**
3090
3269
  * Build a Prisma model-level @@index definition line.
3091
3270
  *
@@ -3419,4 +3598,4 @@ declare class URLDriver {
3419
3598
  url(page: number): string;
3420
3599
  }
3421
3600
  //#endregion
3422
- export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, 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, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findModelBlock, formatDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
3601
+ 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, deriveRelationFieldName, 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 };