arkormx 2.9.1 → 2.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -24
- package/dist/cli.mjs +461 -337
- package/dist/{index-18M5gEFk.d.cts → index-BFNEyqme.d.cts} +77 -13
- package/dist/{index-CFXreeV7.d.mts → index-EVK8EOKN.d.mts} +77 -13
- package/dist/index.cjs +550 -516
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +550 -516
- package/dist/relationship/index.cjs +1 -1
- package/dist/relationship/index.d.cts +1 -1
- package/dist/relationship/index.d.mts +1 -1
- package/dist/relationship/index.mjs +1 -1
- package/dist/{relationship-DtNgcxxv.mjs → relationship-BD04hN72.mjs} +614 -549
- package/dist/{relationship-BVYP9lU2.cjs → relationship-DhdzLnKH.cjs} +614 -549
- package/package.json +6 -2
|
@@ -291,7 +291,7 @@ declare class LengthAwarePaginator<T> {
|
|
|
291
291
|
readonly meta: PaginationMeta;
|
|
292
292
|
private readonly urlDriver;
|
|
293
293
|
/**
|
|
294
|
-
|
|
294
|
+
* Creates a new LengthAwarePaginator instance.
|
|
295
295
|
*
|
|
296
296
|
* @param data The collection of data being paginated.
|
|
297
297
|
* @param total The total number of items.
|
|
@@ -2328,6 +2328,7 @@ declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Pa
|
|
|
2328
2328
|
*/
|
|
2329
2329
|
declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
|
|
2330
2330
|
private static readonly lifecycleStates;
|
|
2331
|
+
private static readonly castMapCache;
|
|
2331
2332
|
private static readonly emittedDeprecationWarnings;
|
|
2332
2333
|
private static eventsSuppressed;
|
|
2333
2334
|
protected static factoryClass?: new () => ModelFactory<any, any>;
|
|
@@ -2372,8 +2373,8 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2372
2373
|
constructor(attributes?: Record<string, unknown>);
|
|
2373
2374
|
private static emitDeprecationWarning;
|
|
2374
2375
|
/**
|
|
2375
|
-
|
|
2376
|
-
|
|
2376
|
+
* Compatibility-only runtime API retained for the 2.x transition window.
|
|
2377
|
+
* This is no longer part of the supported runtime bootstrap path.
|
|
2377
2378
|
*
|
|
2378
2379
|
* @deprecated Use Model.setAdapter(createPrismaDatabaseAdapter(...)) or another
|
|
2379
2380
|
* adapter-first bootstrap path instead.
|
|
@@ -2390,6 +2391,19 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2390
2391
|
static getColumnMap(): Record<string, string>;
|
|
2391
2392
|
static getColumnName(attribute: string): string;
|
|
2392
2393
|
static getModelMetadata(): ModelMetadata;
|
|
2394
|
+
/**
|
|
2395
|
+
* The model's cast map. Resolved from a throwaway instance (casts are an
|
|
2396
|
+
* instance field) and cached per model class.
|
|
2397
|
+
*/
|
|
2398
|
+
static getCasts(): CastMap;
|
|
2399
|
+
/**
|
|
2400
|
+
* Apply built-in persistence casts (currently `json` serialisation) to a raw
|
|
2401
|
+
* attribute payload, without re-running arbitrary custom setters. Used by
|
|
2402
|
+
* both instance `save()` and the query-builder insert/update paths so a JS
|
|
2403
|
+
* object/array destined for a `json`/`jsonb` column is serialised to a string
|
|
2404
|
+
* rather than bound as a Postgres array.
|
|
2405
|
+
*/
|
|
2406
|
+
static castAttributesForPersistence(attributes: Record<string, unknown>): Record<string, unknown>;
|
|
2393
2407
|
static getRelationMetadata(name: string): RelationMetadata | null;
|
|
2394
2408
|
static setFactory<TFactory extends ModelFactory<any, any>>(factoryClass: new () => TFactory): void;
|
|
2395
2409
|
static factory<TFactory extends ModelFactory<any, any>>(count?: number): TFactory;
|
|
@@ -2885,7 +2899,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2885
2899
|
* Define a belongs to many relationship.
|
|
2886
2900
|
*
|
|
2887
2901
|
* @param related
|
|
2888
|
-
|
|
2902
|
+
* @param throughTable
|
|
2889
2903
|
* @param foreignPivotKey
|
|
2890
2904
|
* @param relatedPivotKey
|
|
2891
2905
|
* @param parentKey
|
|
@@ -2897,7 +2911,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2897
2911
|
* Define a has one through relationship.
|
|
2898
2912
|
*
|
|
2899
2913
|
* @param related
|
|
2900
|
-
|
|
2914
|
+
* @param throughTable
|
|
2901
2915
|
* @param firstKey
|
|
2902
2916
|
* @param secondKey
|
|
2903
2917
|
* @param localKey
|
|
@@ -2909,7 +2923,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2909
2923
|
* Define a has many through relationship.
|
|
2910
2924
|
*
|
|
2911
2925
|
* @param related
|
|
2912
|
-
|
|
2926
|
+
* @param throughTable
|
|
2913
2927
|
* @param firstKey
|
|
2914
2928
|
* @param secondKey
|
|
2915
2929
|
* @param localKey
|
|
@@ -4479,6 +4493,13 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
|
|
|
4479
4493
|
*/
|
|
4480
4494
|
doesntExist(): Promise<boolean>;
|
|
4481
4495
|
private normalizeInsertPayloads;
|
|
4496
|
+
/**
|
|
4497
|
+
* Apply the model's persistence casts when a real model backs the query.
|
|
4498
|
+
*
|
|
4499
|
+
* @param payload
|
|
4500
|
+
* @returns
|
|
4501
|
+
*/
|
|
4502
|
+
private castForPersistence;
|
|
4482
4503
|
private normalizeUpdatePayload;
|
|
4483
4504
|
private resolveAffectedCount;
|
|
4484
4505
|
private resolveInsertUsingRows;
|
|
@@ -4542,8 +4563,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
|
|
|
4542
4563
|
*/
|
|
4543
4564
|
orWhereRaw(sql: string, bindings?: unknown[]): this;
|
|
4544
4565
|
/**
|
|
4545
|
-
|
|
4546
|
-
|
|
4566
|
+
* Paginates the query results and returns a LengthAwarePaginator instance
|
|
4567
|
+
* containing data and total-aware pagination metadata.
|
|
4547
4568
|
*
|
|
4548
4569
|
* @param page
|
|
4549
4570
|
* @param perPage
|
|
@@ -4680,6 +4701,8 @@ interface ModelStatic<TModel, TDelegate extends ModelQuerySchemaLike = ModelQuer
|
|
|
4680
4701
|
getColumnMap: () => Record<string, string>;
|
|
4681
4702
|
getColumnName: (attribute: string) => string;
|
|
4682
4703
|
getModelMetadata: () => ModelMetadata;
|
|
4704
|
+
getCasts: () => Record<string, unknown>;
|
|
4705
|
+
castAttributesForPersistence: (attributes: Record<string, unknown>) => Record<string, unknown>;
|
|
4683
4706
|
getPrimaryKey: () => string;
|
|
4684
4707
|
getRelationMetadata: (name: string) => RelationMetadata | null;
|
|
4685
4708
|
setAdapter: (adapter?: DatabaseAdapter) => void;
|
|
@@ -4780,12 +4803,12 @@ type NamingCase = 'camel' | 'snake' | 'kebab' | 'studly';
|
|
|
4780
4803
|
type ModelTableCase = NamingCase;
|
|
4781
4804
|
interface ArkormConfig {
|
|
4782
4805
|
/**
|
|
4783
|
-
|
|
4784
|
-
|
|
4806
|
+
* @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
|
|
4807
|
+
*/
|
|
4785
4808
|
client?: ClientResolver;
|
|
4786
4809
|
/**
|
|
4787
|
-
|
|
4788
|
-
|
|
4810
|
+
* @deprecated Use client instead.
|
|
4811
|
+
* @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
|
|
4789
4812
|
*/
|
|
4790
4813
|
prisma?: ClientResolver;
|
|
4791
4814
|
/**
|
|
@@ -6284,7 +6307,7 @@ declare class CliApp {
|
|
|
6284
6307
|
*
|
|
6285
6308
|
* @param schema The Prisma schema source.
|
|
6286
6309
|
* @returns A map of enum names to their declared member names.
|
|
6287
|
-
|
|
6310
|
+
*/
|
|
6288
6311
|
private parsePrismaEnums;
|
|
6289
6312
|
/**
|
|
6290
6313
|
* Resolve the generated TypeScript declaration type for a Prisma field.
|
|
@@ -7006,6 +7029,47 @@ declare class TableBuilder {
|
|
|
7006
7029
|
*/
|
|
7007
7030
|
declare class SchemaBuilder {
|
|
7008
7031
|
private readonly operations;
|
|
7032
|
+
/**
|
|
7033
|
+
* Disable foreign-key constraint enforcement on the active PostgreSQL
|
|
7034
|
+
* connection by switching the session into replication mode, which
|
|
7035
|
+
* suppresses the internal triggers that enforce foreign keys.
|
|
7036
|
+
*
|
|
7037
|
+
* The setting is connection-scoped, so the disable, the work that depends
|
|
7038
|
+
* on it, and the matching {@link SchemaBuilder.enableForeignKeyConstraints}
|
|
7039
|
+
* must run on the same connection. Prefer
|
|
7040
|
+
* {@link SchemaBuilder.withoutForeignKeyConstraints}, which guarantees this
|
|
7041
|
+
* by wrapping the work in a transaction. Requires a SQL-backed adapter and
|
|
7042
|
+
* a database role permitted to set `session_replication_role`.
|
|
7043
|
+
*
|
|
7044
|
+
* @returns
|
|
7045
|
+
*/
|
|
7046
|
+
static disableForeignKeyConstraints(): Promise<void>;
|
|
7047
|
+
/**
|
|
7048
|
+
* Re-enable foreign-key constraint enforcement on the active PostgreSQL
|
|
7049
|
+
* connection by restoring the default session replication role.
|
|
7050
|
+
*
|
|
7051
|
+
* @returns
|
|
7052
|
+
*/
|
|
7053
|
+
static enableForeignKeyConstraints(): Promise<void>;
|
|
7054
|
+
/**
|
|
7055
|
+
* Run the given callback with foreign-key constraints disabled, then
|
|
7056
|
+
* restore them. The whole unit runs inside a transaction so the disable,
|
|
7057
|
+
* the callback, and the re-enable share a single connection (required for
|
|
7058
|
+
* the connection-scoped replication role to take effect) and roll back
|
|
7059
|
+
* together on failure.
|
|
7060
|
+
*
|
|
7061
|
+
* @example
|
|
7062
|
+
* await SchemaBuilder.withoutForeignKeyConstraints(async () => {
|
|
7063
|
+
* await User.factory()
|
|
7064
|
+
* .hasAttached(Tenant.factory().has(Project.factory(3)), { status: 'active' }, 'tenantMemberships')
|
|
7065
|
+
* .create()
|
|
7066
|
+
* })
|
|
7067
|
+
*
|
|
7068
|
+
* @param callback
|
|
7069
|
+
* @returns
|
|
7070
|
+
*/
|
|
7071
|
+
static withoutForeignKeyConstraints<TResult>(callback: () => TResult | Promise<TResult>): Promise<TResult>;
|
|
7072
|
+
private static setSessionReplicationRole;
|
|
7009
7073
|
/**
|
|
7010
7074
|
* Defines a new table to be created in the migration.
|
|
7011
7075
|
*
|
|
@@ -291,7 +291,7 @@ declare class LengthAwarePaginator<T> {
|
|
|
291
291
|
readonly meta: PaginationMeta;
|
|
292
292
|
private readonly urlDriver;
|
|
293
293
|
/**
|
|
294
|
-
|
|
294
|
+
* Creates a new LengthAwarePaginator instance.
|
|
295
295
|
*
|
|
296
296
|
* @param data The collection of data being paginated.
|
|
297
297
|
* @param total The total number of items.
|
|
@@ -2328,6 +2328,7 @@ declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Pa
|
|
|
2328
2328
|
*/
|
|
2329
2329
|
declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
|
|
2330
2330
|
private static readonly lifecycleStates;
|
|
2331
|
+
private static readonly castMapCache;
|
|
2331
2332
|
private static readonly emittedDeprecationWarnings;
|
|
2332
2333
|
private static eventsSuppressed;
|
|
2333
2334
|
protected static factoryClass?: new () => ModelFactory<any, any>;
|
|
@@ -2372,8 +2373,8 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2372
2373
|
constructor(attributes?: Record<string, unknown>);
|
|
2373
2374
|
private static emitDeprecationWarning;
|
|
2374
2375
|
/**
|
|
2375
|
-
|
|
2376
|
-
|
|
2376
|
+
* Compatibility-only runtime API retained for the 2.x transition window.
|
|
2377
|
+
* This is no longer part of the supported runtime bootstrap path.
|
|
2377
2378
|
*
|
|
2378
2379
|
* @deprecated Use Model.setAdapter(createPrismaDatabaseAdapter(...)) or another
|
|
2379
2380
|
* adapter-first bootstrap path instead.
|
|
@@ -2390,6 +2391,19 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2390
2391
|
static getColumnMap(): Record<string, string>;
|
|
2391
2392
|
static getColumnName(attribute: string): string;
|
|
2392
2393
|
static getModelMetadata(): ModelMetadata;
|
|
2394
|
+
/**
|
|
2395
|
+
* The model's cast map. Resolved from a throwaway instance (casts are an
|
|
2396
|
+
* instance field) and cached per model class.
|
|
2397
|
+
*/
|
|
2398
|
+
static getCasts(): CastMap;
|
|
2399
|
+
/**
|
|
2400
|
+
* Apply built-in persistence casts (currently `json` serialisation) to a raw
|
|
2401
|
+
* attribute payload, without re-running arbitrary custom setters. Used by
|
|
2402
|
+
* both instance `save()` and the query-builder insert/update paths so a JS
|
|
2403
|
+
* object/array destined for a `json`/`jsonb` column is serialised to a string
|
|
2404
|
+
* rather than bound as a Postgres array.
|
|
2405
|
+
*/
|
|
2406
|
+
static castAttributesForPersistence(attributes: Record<string, unknown>): Record<string, unknown>;
|
|
2393
2407
|
static getRelationMetadata(name: string): RelationMetadata | null;
|
|
2394
2408
|
static setFactory<TFactory extends ModelFactory<any, any>>(factoryClass: new () => TFactory): void;
|
|
2395
2409
|
static factory<TFactory extends ModelFactory<any, any>>(count?: number): TFactory;
|
|
@@ -2885,7 +2899,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2885
2899
|
* Define a belongs to many relationship.
|
|
2886
2900
|
*
|
|
2887
2901
|
* @param related
|
|
2888
|
-
|
|
2902
|
+
* @param throughTable
|
|
2889
2903
|
* @param foreignPivotKey
|
|
2890
2904
|
* @param relatedPivotKey
|
|
2891
2905
|
* @param parentKey
|
|
@@ -2897,7 +2911,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2897
2911
|
* Define a has one through relationship.
|
|
2898
2912
|
*
|
|
2899
2913
|
* @param related
|
|
2900
|
-
|
|
2914
|
+
* @param throughTable
|
|
2901
2915
|
* @param firstKey
|
|
2902
2916
|
* @param secondKey
|
|
2903
2917
|
* @param localKey
|
|
@@ -2909,7 +2923,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
|
|
|
2909
2923
|
* Define a has many through relationship.
|
|
2910
2924
|
*
|
|
2911
2925
|
* @param related
|
|
2912
|
-
|
|
2926
|
+
* @param throughTable
|
|
2913
2927
|
* @param firstKey
|
|
2914
2928
|
* @param secondKey
|
|
2915
2929
|
* @param localKey
|
|
@@ -4479,6 +4493,13 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
|
|
|
4479
4493
|
*/
|
|
4480
4494
|
doesntExist(): Promise<boolean>;
|
|
4481
4495
|
private normalizeInsertPayloads;
|
|
4496
|
+
/**
|
|
4497
|
+
* Apply the model's persistence casts when a real model backs the query.
|
|
4498
|
+
*
|
|
4499
|
+
* @param payload
|
|
4500
|
+
* @returns
|
|
4501
|
+
*/
|
|
4502
|
+
private castForPersistence;
|
|
4482
4503
|
private normalizeUpdatePayload;
|
|
4483
4504
|
private resolveAffectedCount;
|
|
4484
4505
|
private resolveInsertUsingRows;
|
|
@@ -4542,8 +4563,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
|
|
|
4542
4563
|
*/
|
|
4543
4564
|
orWhereRaw(sql: string, bindings?: unknown[]): this;
|
|
4544
4565
|
/**
|
|
4545
|
-
|
|
4546
|
-
|
|
4566
|
+
* Paginates the query results and returns a LengthAwarePaginator instance
|
|
4567
|
+
* containing data and total-aware pagination metadata.
|
|
4547
4568
|
*
|
|
4548
4569
|
* @param page
|
|
4549
4570
|
* @param perPage
|
|
@@ -4680,6 +4701,8 @@ interface ModelStatic<TModel, TDelegate extends ModelQuerySchemaLike = ModelQuer
|
|
|
4680
4701
|
getColumnMap: () => Record<string, string>;
|
|
4681
4702
|
getColumnName: (attribute: string) => string;
|
|
4682
4703
|
getModelMetadata: () => ModelMetadata;
|
|
4704
|
+
getCasts: () => Record<string, unknown>;
|
|
4705
|
+
castAttributesForPersistence: (attributes: Record<string, unknown>) => Record<string, unknown>;
|
|
4683
4706
|
getPrimaryKey: () => string;
|
|
4684
4707
|
getRelationMetadata: (name: string) => RelationMetadata | null;
|
|
4685
4708
|
setAdapter: (adapter?: DatabaseAdapter) => void;
|
|
@@ -4780,12 +4803,12 @@ type NamingCase = 'camel' | 'snake' | 'kebab' | 'studly';
|
|
|
4780
4803
|
type ModelTableCase = NamingCase;
|
|
4781
4804
|
interface ArkormConfig {
|
|
4782
4805
|
/**
|
|
4783
|
-
|
|
4784
|
-
|
|
4806
|
+
* @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
|
|
4807
|
+
*/
|
|
4785
4808
|
client?: ClientResolver;
|
|
4786
4809
|
/**
|
|
4787
|
-
|
|
4788
|
-
|
|
4810
|
+
* @deprecated Use client instead.
|
|
4811
|
+
* @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
|
|
4789
4812
|
*/
|
|
4790
4813
|
prisma?: ClientResolver;
|
|
4791
4814
|
/**
|
|
@@ -6284,7 +6307,7 @@ declare class CliApp {
|
|
|
6284
6307
|
*
|
|
6285
6308
|
* @param schema The Prisma schema source.
|
|
6286
6309
|
* @returns A map of enum names to their declared member names.
|
|
6287
|
-
|
|
6310
|
+
*/
|
|
6288
6311
|
private parsePrismaEnums;
|
|
6289
6312
|
/**
|
|
6290
6313
|
* Resolve the generated TypeScript declaration type for a Prisma field.
|
|
@@ -7006,6 +7029,47 @@ declare class TableBuilder {
|
|
|
7006
7029
|
*/
|
|
7007
7030
|
declare class SchemaBuilder {
|
|
7008
7031
|
private readonly operations;
|
|
7032
|
+
/**
|
|
7033
|
+
* Disable foreign-key constraint enforcement on the active PostgreSQL
|
|
7034
|
+
* connection by switching the session into replication mode, which
|
|
7035
|
+
* suppresses the internal triggers that enforce foreign keys.
|
|
7036
|
+
*
|
|
7037
|
+
* The setting is connection-scoped, so the disable, the work that depends
|
|
7038
|
+
* on it, and the matching {@link SchemaBuilder.enableForeignKeyConstraints}
|
|
7039
|
+
* must run on the same connection. Prefer
|
|
7040
|
+
* {@link SchemaBuilder.withoutForeignKeyConstraints}, which guarantees this
|
|
7041
|
+
* by wrapping the work in a transaction. Requires a SQL-backed adapter and
|
|
7042
|
+
* a database role permitted to set `session_replication_role`.
|
|
7043
|
+
*
|
|
7044
|
+
* @returns
|
|
7045
|
+
*/
|
|
7046
|
+
static disableForeignKeyConstraints(): Promise<void>;
|
|
7047
|
+
/**
|
|
7048
|
+
* Re-enable foreign-key constraint enforcement on the active PostgreSQL
|
|
7049
|
+
* connection by restoring the default session replication role.
|
|
7050
|
+
*
|
|
7051
|
+
* @returns
|
|
7052
|
+
*/
|
|
7053
|
+
static enableForeignKeyConstraints(): Promise<void>;
|
|
7054
|
+
/**
|
|
7055
|
+
* Run the given callback with foreign-key constraints disabled, then
|
|
7056
|
+
* restore them. The whole unit runs inside a transaction so the disable,
|
|
7057
|
+
* the callback, and the re-enable share a single connection (required for
|
|
7058
|
+
* the connection-scoped replication role to take effect) and roll back
|
|
7059
|
+
* together on failure.
|
|
7060
|
+
*
|
|
7061
|
+
* @example
|
|
7062
|
+
* await SchemaBuilder.withoutForeignKeyConstraints(async () => {
|
|
7063
|
+
* await User.factory()
|
|
7064
|
+
* .hasAttached(Tenant.factory().has(Project.factory(3)), { status: 'active' }, 'tenantMemberships')
|
|
7065
|
+
* .create()
|
|
7066
|
+
* })
|
|
7067
|
+
*
|
|
7068
|
+
* @param callback
|
|
7069
|
+
* @returns
|
|
7070
|
+
*/
|
|
7071
|
+
static withoutForeignKeyConstraints<TResult>(callback: () => TResult | Promise<TResult>): Promise<TResult>;
|
|
7072
|
+
private static setSessionReplicationRole;
|
|
7009
7073
|
/**
|
|
7010
7074
|
* Defines a new table to be created in the migration.
|
|
7011
7075
|
*
|