arkormx 0.2.10 → 1.0.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/README.md +17 -0
- package/dist/cli.mjs +39 -9
- package/dist/index.cjs +553 -43
- package/dist/index.d.cts +246 -9
- package/dist/index.d.mts +246 -9
- package/dist/index.mjs +544 -44
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -570,10 +570,6 @@ declare class InlineFactory<TModel, TAttributes extends FactoryAttributes> exten
|
|
|
570
570
|
declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Partial<ModelAttributes<TModel>>>(model: FactoryModelConstructor<TModel>, definition: FactoryDefinition<TAttributes>) => ModelFactory<TModel, TAttributes>;
|
|
571
571
|
//#endregion
|
|
572
572
|
//#region src/Model.d.ts
|
|
573
|
-
type RelatedModelClass<TInstance = unknown> = (abstract new (attributes?: Record<string, unknown>) => TInstance) & RelationshipModelStatic;
|
|
574
|
-
type GlobalScope = (query: QueryBuilder<any, any>) => QueryBuilder<any, any> | void;
|
|
575
|
-
type ModelEventName = 'saving' | 'saved' | 'creating' | 'created' | 'updating' | 'updated' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'forceDeleting' | 'forceDeleted';
|
|
576
|
-
type ModelEventListener<TModel extends Model = Model> = (model: TModel) => void | Promise<void>;
|
|
577
573
|
/**
|
|
578
574
|
* Base model class that all models should extend.
|
|
579
575
|
*
|
|
@@ -583,6 +579,8 @@ type ModelEventListener<TModel extends Model = Model> = (model: TModel) => void
|
|
|
583
579
|
* @since 0.1.0
|
|
584
580
|
*/
|
|
585
581
|
declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
|
|
582
|
+
private static readonly lifecycleStates;
|
|
583
|
+
private static eventsSuppressed;
|
|
586
584
|
protected static factoryClass?: new () => ModelFactory<any, any>;
|
|
587
585
|
protected static client: Record<string, unknown>;
|
|
588
586
|
protected static delegate: string;
|
|
@@ -590,6 +588,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
590
588
|
protected static deletedAtColumn: string;
|
|
591
589
|
protected static globalScopes: Record<string, GlobalScope>;
|
|
592
590
|
protected static eventListeners: Partial<Record<ModelEventName, ModelEventListener<any>[]>>;
|
|
591
|
+
protected static dispatchesEvents: Partial<Record<ModelEventName, ModelEventDispatcher<any> | ModelEventDispatcher<any>[]>>;
|
|
593
592
|
protected casts: CastMap;
|
|
594
593
|
protected hidden: string[];
|
|
595
594
|
protected visible: string[];
|
|
@@ -611,6 +610,13 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
611
610
|
* @param scope
|
|
612
611
|
*/
|
|
613
612
|
static addGlobalScope(name: string, scope: GlobalScope): void;
|
|
613
|
+
/**
|
|
614
|
+
* Execute a callback without applying global scopes for the current model class.
|
|
615
|
+
*
|
|
616
|
+
* @param callback
|
|
617
|
+
* @returns
|
|
618
|
+
*/
|
|
619
|
+
static withoutGlobalScopes<T>(callback: () => T | Promise<T>): Promise<Awaited<T>>;
|
|
614
620
|
/**
|
|
615
621
|
* Remove a global scope by name.
|
|
616
622
|
*
|
|
@@ -628,6 +634,26 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
628
634
|
* @param listener
|
|
629
635
|
*/
|
|
630
636
|
static on<TModel extends Model = Model>(event: ModelEventName, listener: ModelEventListener<TModel>): void;
|
|
637
|
+
/**
|
|
638
|
+
* Register a model lifecycle callback listener.
|
|
639
|
+
*
|
|
640
|
+
* @param event
|
|
641
|
+
* @param listener
|
|
642
|
+
*/
|
|
643
|
+
static event<TModel extends Model = Model>(event: ModelEventName, listener: ModelEventListener<TModel>): void;
|
|
644
|
+
static retrieved<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
645
|
+
static saving<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
646
|
+
static saved<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
647
|
+
static creating<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
648
|
+
static created<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
649
|
+
static updating<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
650
|
+
static updated<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
651
|
+
static deleting<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
652
|
+
static deleted<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
653
|
+
static restoring<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
654
|
+
static restored<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
655
|
+
static forceDeleting<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
656
|
+
static forceDeleted<TModel extends Model = Model>(listener: ModelEventListener<TModel>): void;
|
|
631
657
|
/**
|
|
632
658
|
* Remove listeners for an event. If listener is omitted, all listeners for that event are removed.
|
|
633
659
|
*
|
|
@@ -639,6 +665,22 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
639
665
|
* Clears all event listeners for the model.
|
|
640
666
|
*/
|
|
641
667
|
static clearEventListeners(): void;
|
|
668
|
+
/**
|
|
669
|
+
* Execute a callback while suppressing lifecycle events for all models.
|
|
670
|
+
*
|
|
671
|
+
* @param callback
|
|
672
|
+
* @returns
|
|
673
|
+
*/
|
|
674
|
+
static withoutEvents<T>(callback: () => T | Promise<T>): Promise<Awaited<T>>;
|
|
675
|
+
/**
|
|
676
|
+
* Execute a callback within a transaction scope.
|
|
677
|
+
* Nested calls reuse the active transaction client.
|
|
678
|
+
*
|
|
679
|
+
* @param callback
|
|
680
|
+
* @param options
|
|
681
|
+
* @returns
|
|
682
|
+
*/
|
|
683
|
+
static transaction<T>(callback: (client: PrismaClientLike) => T | Promise<T>, options?: PrismaTransactionOptions): Promise<Awaited<T>>;
|
|
642
684
|
/**
|
|
643
685
|
* Get the Prisma delegate for the model.
|
|
644
686
|
* If a delegate name is provided, it will attempt to resolve that delegate.
|
|
@@ -656,6 +698,14 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
656
698
|
* @returns
|
|
657
699
|
*/
|
|
658
700
|
static query<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any>, TModel extends InstanceType<TThis> = InstanceType<TThis>, TDelegate extends PrismaDelegateLike = DelegateForModelSchema<TModel extends Model<infer TSchema> ? TSchema : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
|
|
701
|
+
/**
|
|
702
|
+
* Boot hook for subclasses to register scopes or perform one-time setup.
|
|
703
|
+
*/
|
|
704
|
+
protected static boot(): void;
|
|
705
|
+
/**
|
|
706
|
+
* Booted hook for subclasses to register callbacks after boot logic runs.
|
|
707
|
+
*/
|
|
708
|
+
protected static booted(): void;
|
|
659
709
|
/**
|
|
660
710
|
* Get a query builder instance that includes soft-deleted records.
|
|
661
711
|
*
|
|
@@ -704,6 +754,22 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
704
754
|
* @returns
|
|
705
755
|
*/
|
|
706
756
|
static hydrateMany<TModel>(this: new (attributes: Record<string, unknown>) => TModel, attributes: Record<string, unknown>[]): TModel[];
|
|
757
|
+
/**
|
|
758
|
+
* Hydrate a model instance and dispatch the retrieved lifecycle event.
|
|
759
|
+
*
|
|
760
|
+
* @param this
|
|
761
|
+
* @param attributes
|
|
762
|
+
* @returns
|
|
763
|
+
*/
|
|
764
|
+
static hydrateRetrieved<TModel>(this: ModelStatic<TModel, PrismaDelegateLike>, attributes: Record<string, unknown>): Promise<TModel>;
|
|
765
|
+
/**
|
|
766
|
+
* Hydrate multiple model instances and dispatch the retrieved lifecycle event for each.
|
|
767
|
+
*
|
|
768
|
+
* @param this
|
|
769
|
+
* @param attributes
|
|
770
|
+
* @returns
|
|
771
|
+
*/
|
|
772
|
+
static hydrateManyRetrieved<TModel>(this: ModelStatic<TModel, PrismaDelegateLike>, attributes: Record<string, unknown>[]): Promise<TModel[]>;
|
|
707
773
|
/**
|
|
708
774
|
* Fill the model's attributes from a plain object, using the
|
|
709
775
|
* setAttribute method to ensure that mutators and casts are applied.
|
|
@@ -738,6 +804,12 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
738
804
|
* @returns
|
|
739
805
|
*/
|
|
740
806
|
save(): Promise<this>;
|
|
807
|
+
/**
|
|
808
|
+
* Save the model without dispatching lifecycle events.
|
|
809
|
+
*
|
|
810
|
+
* @returns
|
|
811
|
+
*/
|
|
812
|
+
saveQuietly(): Promise<this>;
|
|
741
813
|
/**
|
|
742
814
|
* Delete the model from the database.
|
|
743
815
|
* If soft deletes are enabled, it will perform a soft delete by
|
|
@@ -747,6 +819,12 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
747
819
|
* @returns
|
|
748
820
|
*/
|
|
749
821
|
delete(): Promise<this>;
|
|
822
|
+
/**
|
|
823
|
+
* Delete the model without dispatching lifecycle events.
|
|
824
|
+
*
|
|
825
|
+
* @returns
|
|
826
|
+
*/
|
|
827
|
+
deleteQuietly(): Promise<this>;
|
|
750
828
|
/**
|
|
751
829
|
* Permanently delete the model from the database, regardless of whether soft
|
|
752
830
|
* deletes are enabled.
|
|
@@ -754,12 +832,24 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
754
832
|
* @returns
|
|
755
833
|
*/
|
|
756
834
|
forceDelete(): Promise<this>;
|
|
835
|
+
/**
|
|
836
|
+
* Force delete the model without dispatching lifecycle events.
|
|
837
|
+
*
|
|
838
|
+
* @returns
|
|
839
|
+
*/
|
|
840
|
+
forceDeleteQuietly(): Promise<this>;
|
|
757
841
|
/**
|
|
758
842
|
* Restore a soft-deleted model by setting the deleted at column to null.
|
|
759
843
|
*
|
|
760
844
|
* @returns
|
|
761
845
|
*/
|
|
762
846
|
restore(): Promise<this>;
|
|
847
|
+
/**
|
|
848
|
+
* Restore the model without dispatching lifecycle events.
|
|
849
|
+
*
|
|
850
|
+
* @returns
|
|
851
|
+
*/
|
|
852
|
+
restoreQuietly(): Promise<this>;
|
|
763
853
|
/**
|
|
764
854
|
* Load related models onto the current model instance.
|
|
765
855
|
*
|
|
@@ -786,6 +876,34 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
786
876
|
* @returns
|
|
787
877
|
*/
|
|
788
878
|
toJSON(): Serializable;
|
|
879
|
+
/**
|
|
880
|
+
* Determine if another model represents the same persisted record.
|
|
881
|
+
*
|
|
882
|
+
* @param model
|
|
883
|
+
* @returns
|
|
884
|
+
*/
|
|
885
|
+
is(model: unknown): boolean;
|
|
886
|
+
/**
|
|
887
|
+
* Determine if another model does not represent the same persisted record.
|
|
888
|
+
*
|
|
889
|
+
* @param model
|
|
890
|
+
* @returns
|
|
891
|
+
*/
|
|
892
|
+
isNot(model: unknown): boolean;
|
|
893
|
+
/**
|
|
894
|
+
* Determine if another model is the same in-memory instance.
|
|
895
|
+
*
|
|
896
|
+
* @param model
|
|
897
|
+
* @returns
|
|
898
|
+
*/
|
|
899
|
+
isSame(model: unknown): boolean;
|
|
900
|
+
/**
|
|
901
|
+
* Determine if another model is not the same in-memory instance.
|
|
902
|
+
*
|
|
903
|
+
* @param model
|
|
904
|
+
* @returns
|
|
905
|
+
*/
|
|
906
|
+
isNotSame(model: unknown): boolean;
|
|
789
907
|
/**
|
|
790
908
|
* Define a has one relationship.
|
|
791
909
|
*
|
|
@@ -908,6 +1026,42 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
908
1026
|
* Ensures event listeners are own properties on subclass constructors.
|
|
909
1027
|
*/
|
|
910
1028
|
private static ensureOwnEventListeners;
|
|
1029
|
+
/**
|
|
1030
|
+
* Resolve lifecycle state for the provided model class.
|
|
1031
|
+
*
|
|
1032
|
+
* @param modelClass
|
|
1033
|
+
* @returns
|
|
1034
|
+
*/
|
|
1035
|
+
private static getLifecycleState;
|
|
1036
|
+
/**
|
|
1037
|
+
* Ensure the target model class has executed its boot lifecycle.
|
|
1038
|
+
*
|
|
1039
|
+
* @param modelClass
|
|
1040
|
+
*/
|
|
1041
|
+
private static ensureModelBooted;
|
|
1042
|
+
/**
|
|
1043
|
+
* Determine if global scopes are currently suppressed for the model class.
|
|
1044
|
+
*
|
|
1045
|
+
* @param modelClass
|
|
1046
|
+
* @returns
|
|
1047
|
+
*/
|
|
1048
|
+
private static areGlobalScopesSuppressed;
|
|
1049
|
+
/**
|
|
1050
|
+
* Resolve configured class-based event handlers for a lifecycle event.
|
|
1051
|
+
*
|
|
1052
|
+
* @param modelClass
|
|
1053
|
+
* @param event
|
|
1054
|
+
* @returns
|
|
1055
|
+
*/
|
|
1056
|
+
private static resolveDispatchedEventListeners;
|
|
1057
|
+
/**
|
|
1058
|
+
* Determine whether a lifecycle event has any registered listeners.
|
|
1059
|
+
*
|
|
1060
|
+
* @param modelClass
|
|
1061
|
+
* @param event
|
|
1062
|
+
* @returns
|
|
1063
|
+
*/
|
|
1064
|
+
private static hasEventListeners;
|
|
911
1065
|
/**
|
|
912
1066
|
* Dispatches lifecycle events to registered listeners.
|
|
913
1067
|
*
|
|
@@ -934,6 +1088,15 @@ type DelegateFromPrismaClient<TKey extends string> = LowercaseString<TKey> exten
|
|
|
934
1088
|
type DelegateForModelSchema<TSchema extends PrismaDelegateLike | Record<string, unknown> | string> = TSchema extends PrismaDelegateLike ? TSchema : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends PrismaDelegateLike ? DelegateFromPrismaClient<TSchema> : PrismaDelegateLike : PrismaDelegateLike;
|
|
935
1089
|
type ModelAttributesOf<TSchema extends PrismaDelegateLike | Record<string, unknown> | string> = TSchema extends PrismaDelegateLike ? DelegateRow<TSchema> extends Record<string, unknown> ? DelegateRow<TSchema> : Record<string, any> : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends PrismaDelegateLike ? DelegateRow<DelegateFromPrismaClient<TSchema>> extends Record<string, unknown> ? DelegateRow<DelegateFromPrismaClient<TSchema>> : Record<string, any> : Record<string, any> : TSchema extends Record<string, unknown> ? TSchema : Record<string, any>;
|
|
936
1090
|
type ModelAttributes<TModel> = TModel extends Model<infer TSchema> ? ModelAttributesOf<TSchema> : Record<string, any>;
|
|
1091
|
+
type RelatedModelClass<TInstance = unknown> = (abstract new (attributes?: Record<string, unknown>) => TInstance) & RelationshipModelStatic;
|
|
1092
|
+
type GlobalScope = (query: QueryBuilder<any, any>) => QueryBuilder<any, any> | void;
|
|
1093
|
+
type ModelEventName = 'retrieved' | 'saving' | 'saved' | 'creating' | 'created' | 'updating' | 'updated' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'forceDeleting' | 'forceDeleted';
|
|
1094
|
+
type ModelEventListener<TModel extends Model = Model> = (model: TModel) => void | Promise<void>;
|
|
1095
|
+
type ModelEventHandler<TModel extends Model = Model> = {
|
|
1096
|
+
handle: (model: TModel) => void | Promise<void>;
|
|
1097
|
+
};
|
|
1098
|
+
type ModelEventHandlerConstructor<TModel extends Model = Model> = new () => ModelEventHandler<TModel>;
|
|
1099
|
+
type ModelEventDispatcher<TModel extends Model = Model> = ModelEventHandler<TModel> | ModelEventHandlerConstructor<TModel>;
|
|
937
1100
|
//#endregion
|
|
938
1101
|
//#region src/Paginator.d.ts
|
|
939
1102
|
/**
|
|
@@ -1039,6 +1202,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
1039
1202
|
* @param model
|
|
1040
1203
|
*/
|
|
1041
1204
|
constructor(delegate: TDelegate, model: ModelStatic<TModel, TDelegate>);
|
|
1205
|
+
private resolvePaginationPage;
|
|
1042
1206
|
/**
|
|
1043
1207
|
* Adds a where clause to the query. Multiple calls to where will combine
|
|
1044
1208
|
* the clauses with AND logic.
|
|
@@ -1700,7 +1864,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
1700
1864
|
* @param options
|
|
1701
1865
|
* @returns
|
|
1702
1866
|
*/
|
|
1703
|
-
paginate(
|
|
1867
|
+
paginate(perPage?: number, page?: number | undefined, options?: PaginationOptions): Promise<LengthAwarePaginator<TModel>>;
|
|
1704
1868
|
/**
|
|
1705
1869
|
* Paginates results without calculating total row count.
|
|
1706
1870
|
*
|
|
@@ -1708,7 +1872,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
1708
1872
|
* @param page
|
|
1709
1873
|
* @returns
|
|
1710
1874
|
*/
|
|
1711
|
-
simplePaginate(perPage?: number, page?: number, options?: PaginationOptions): Promise<Paginator<TModel>>;
|
|
1875
|
+
simplePaginate(perPage?: number, page?: number | undefined, options?: PaginationOptions): Promise<Paginator<TModel>>;
|
|
1712
1876
|
/**
|
|
1713
1877
|
* Creates a clone of the current query builder instance with the same state.
|
|
1714
1878
|
*
|
|
@@ -1771,6 +1935,8 @@ interface ModelStatic<TModel, TDelegate extends PrismaDelegateLike = PrismaDeleg
|
|
|
1771
1935
|
query: () => QueryBuilder<TModel, TDelegate>;
|
|
1772
1936
|
hydrate: (attributes: DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>) => TModel;
|
|
1773
1937
|
hydrateMany: (attributes: (DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>)[]) => TModel[];
|
|
1938
|
+
hydrateRetrieved: (attributes: DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>) => Promise<TModel>;
|
|
1939
|
+
hydrateManyRetrieved: (attributes: (DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>)[]) => Promise<TModel[]>;
|
|
1774
1940
|
getDelegate: (delegate?: string) => TDelegate;
|
|
1775
1941
|
getSoftDeleteConfig: () => SoftDeleteConfig;
|
|
1776
1942
|
}
|
|
@@ -1788,6 +1954,15 @@ interface CastHandler<T = unknown> {
|
|
|
1788
1954
|
type CastDefinition = CastType | CastHandler;
|
|
1789
1955
|
type CastMap = Record<string, CastDefinition>;
|
|
1790
1956
|
type PrismaClientLike = PrismaClient | Record<string, unknown>;
|
|
1957
|
+
interface PrismaTransactionOptions {
|
|
1958
|
+
maxWait?: number;
|
|
1959
|
+
timeout?: number;
|
|
1960
|
+
isolationLevel?: string;
|
|
1961
|
+
}
|
|
1962
|
+
type PrismaTransactionCallback<TResult = unknown> = (client: PrismaClientLike) => TResult | Promise<TResult>;
|
|
1963
|
+
interface PrismaTransactionCapableClient {
|
|
1964
|
+
$transaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
|
|
1965
|
+
}
|
|
1791
1966
|
type ClientResolver = PrismaClientLike | (() => PrismaClientLike);
|
|
1792
1967
|
interface ArkormConfig {
|
|
1793
1968
|
/**
|
|
@@ -1799,6 +1974,7 @@ interface ArkormConfig {
|
|
|
1799
1974
|
*/
|
|
1800
1975
|
pagination?: {
|
|
1801
1976
|
urlDriver?: PaginationURLDriverFactory;
|
|
1977
|
+
resolveCurrentPage?: PaginationCurrentPageResolver;
|
|
1802
1978
|
};
|
|
1803
1979
|
/**
|
|
1804
1980
|
* @property paths Optional custom paths for various generated files.
|
|
@@ -1866,6 +2042,7 @@ interface PaginationOptions {
|
|
|
1866
2042
|
fragment?: string;
|
|
1867
2043
|
pageName?: string;
|
|
1868
2044
|
}
|
|
2045
|
+
type PaginationCurrentPageResolver = (pageName: string, options: PaginationOptions) => number | undefined;
|
|
1869
2046
|
interface PaginationURLDriver {
|
|
1870
2047
|
getPageName: () => string;
|
|
1871
2048
|
url: (page: number) => string;
|
|
@@ -2788,8 +2965,34 @@ declare abstract class Seeder {
|
|
|
2788
2965
|
* @author Legacy (3m1n3nc3)
|
|
2789
2966
|
* @since 0.1.0
|
|
2790
2967
|
*/
|
|
2968
|
+
interface ArkormErrorContext {
|
|
2969
|
+
code?: string;
|
|
2970
|
+
operation?: string;
|
|
2971
|
+
model?: string;
|
|
2972
|
+
delegate?: string;
|
|
2973
|
+
relation?: string;
|
|
2974
|
+
scope?: string;
|
|
2975
|
+
meta?: Record<string, unknown>;
|
|
2976
|
+
cause?: unknown;
|
|
2977
|
+
}
|
|
2791
2978
|
declare class ArkormException extends Error {
|
|
2792
|
-
|
|
2979
|
+
readonly code?: string;
|
|
2980
|
+
readonly operation?: string;
|
|
2981
|
+
readonly model?: string;
|
|
2982
|
+
readonly delegate?: string;
|
|
2983
|
+
readonly relation?: string;
|
|
2984
|
+
readonly scope?: string;
|
|
2985
|
+
readonly meta?: Record<string, unknown>;
|
|
2986
|
+
constructor(message: string, context?: ArkormErrorContext);
|
|
2987
|
+
getContext(): Omit<ArkormErrorContext, 'cause'> & {
|
|
2988
|
+
cause?: unknown;
|
|
2989
|
+
};
|
|
2990
|
+
toJSON(): Record<string, unknown>;
|
|
2991
|
+
}
|
|
2992
|
+
//#endregion
|
|
2993
|
+
//#region src/Exceptions/MissingDelegateException.d.ts
|
|
2994
|
+
declare class MissingDelegateException extends ArkormException {
|
|
2995
|
+
constructor(message: string, context?: ArkormErrorContext);
|
|
2793
2996
|
}
|
|
2794
2997
|
//#endregion
|
|
2795
2998
|
//#region src/Exceptions/ModelNotFoundException.d.ts
|
|
@@ -2802,10 +3005,35 @@ declare class ArkormException extends Error {
|
|
|
2802
3005
|
*/
|
|
2803
3006
|
declare class ModelNotFoundException extends ArkormException {
|
|
2804
3007
|
private modelName;
|
|
2805
|
-
constructor(modelName: string, message?: string);
|
|
3008
|
+
constructor(modelName: string, message?: string, context?: ArkormErrorContext);
|
|
2806
3009
|
getModelName(): string;
|
|
2807
3010
|
}
|
|
2808
3011
|
//#endregion
|
|
3012
|
+
//#region src/Exceptions/QueryConstraintException.d.ts
|
|
3013
|
+
declare class QueryConstraintException extends ArkormException {
|
|
3014
|
+
constructor(message: string, context?: ArkormErrorContext);
|
|
3015
|
+
}
|
|
3016
|
+
//#endregion
|
|
3017
|
+
//#region src/Exceptions/RelationResolutionException.d.ts
|
|
3018
|
+
declare class RelationResolutionException extends ArkormException {
|
|
3019
|
+
constructor(message: string, context?: ArkormErrorContext);
|
|
3020
|
+
}
|
|
3021
|
+
//#endregion
|
|
3022
|
+
//#region src/Exceptions/ScopeNotDefinedException.d.ts
|
|
3023
|
+
declare class ScopeNotDefinedException extends ArkormException {
|
|
3024
|
+
constructor(message: string, context?: ArkormErrorContext);
|
|
3025
|
+
}
|
|
3026
|
+
//#endregion
|
|
3027
|
+
//#region src/Exceptions/UniqueConstraintResolutionException.d.ts
|
|
3028
|
+
declare class UniqueConstraintResolutionException extends ArkormException {
|
|
3029
|
+
constructor(message: string, context?: ArkormErrorContext);
|
|
3030
|
+
}
|
|
3031
|
+
//#endregion
|
|
3032
|
+
//#region src/Exceptions/UnsupportedAdapterFeatureException.d.ts
|
|
3033
|
+
declare class UnsupportedAdapterFeatureException extends ArkormException {
|
|
3034
|
+
constructor(message: string, context?: ArkormErrorContext);
|
|
3035
|
+
}
|
|
3036
|
+
//#endregion
|
|
2809
3037
|
//#region src/helpers/migration-history.d.ts
|
|
2810
3038
|
declare const resolveMigrationStateFilePath: (cwd: string, configuredPath?: string) => string;
|
|
2811
3039
|
declare const buildMigrationIdentity: (filePath: string, className: string) => string;
|
|
@@ -3122,12 +3350,21 @@ declare const getDefaultStubsPath: () => string;
|
|
|
3122
3350
|
* @returns
|
|
3123
3351
|
*/
|
|
3124
3352
|
declare const getRuntimePrismaClient: () => PrismaClientLike | undefined;
|
|
3353
|
+
declare const getActiveTransactionClient: () => PrismaClientLike | undefined;
|
|
3354
|
+
declare const isTransactionCapableClient: (value: unknown) => value is PrismaTransactionCapableClient;
|
|
3355
|
+
declare const runArkormTransaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
|
|
3125
3356
|
/**
|
|
3126
3357
|
* Get the configured pagination URL driver factory from runtime config.
|
|
3127
3358
|
*
|
|
3128
3359
|
* @returns
|
|
3129
3360
|
*/
|
|
3130
3361
|
declare const getRuntimePaginationURLDriverFactory: () => PaginationURLDriverFactory | undefined;
|
|
3362
|
+
/**
|
|
3363
|
+
* Get the configured current-page resolver from runtime config.
|
|
3364
|
+
*
|
|
3365
|
+
* @returns
|
|
3366
|
+
*/
|
|
3367
|
+
declare const getRuntimePaginationCurrentPageResolver: () => PaginationCurrentPageResolver | undefined;
|
|
3131
3368
|
/**
|
|
3132
3369
|
* Check if a given value is a Prisma delegate-like object
|
|
3133
3370
|
* by verifying the presence of common delegate methods.
|
|
@@ -3182,4 +3419,4 @@ declare class URLDriver {
|
|
|
3182
3419
|
url(page: number): string;
|
|
3183
3420
|
}
|
|
3184
3421
|
//#endregion
|
|
3185
|
-
export { ArkormCollection, ArkormException, Attribute, AttributeOptions, CliApp, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, SEEDER_BRAND, SchemaBuilder, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, 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, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
|
|
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 };
|