arkormx 2.9.2 → 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.
@@ -291,7 +291,7 @@ declare class LengthAwarePaginator<T> {
291
291
  readonly meta: PaginationMeta;
292
292
  private readonly urlDriver;
293
293
  /**
294
- * Creates a new LengthAwarePaginator instance.
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.
@@ -2373,8 +2373,8 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2373
2373
  constructor(attributes?: Record<string, unknown>);
2374
2374
  private static emitDeprecationWarning;
2375
2375
  /**
2376
- * Compatibility-only runtime API retained for the 2.x transition window.
2377
- * This is no longer part of the supported runtime bootstrap path.
2376
+ * Compatibility-only runtime API retained for the 2.x transition window.
2377
+ * This is no longer part of the supported runtime bootstrap path.
2378
2378
  *
2379
2379
  * @deprecated Use Model.setAdapter(createPrismaDatabaseAdapter(...)) or another
2380
2380
  * adapter-first bootstrap path instead.
@@ -2899,7 +2899,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2899
2899
  * Define a belongs to many relationship.
2900
2900
  *
2901
2901
  * @param related
2902
- * @param throughTable
2902
+ * @param throughTable
2903
2903
  * @param foreignPivotKey
2904
2904
  * @param relatedPivotKey
2905
2905
  * @param parentKey
@@ -2911,7 +2911,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2911
2911
  * Define a has one through relationship.
2912
2912
  *
2913
2913
  * @param related
2914
- * @param throughTable
2914
+ * @param throughTable
2915
2915
  * @param firstKey
2916
2916
  * @param secondKey
2917
2917
  * @param localKey
@@ -2923,7 +2923,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2923
2923
  * Define a has many through relationship.
2924
2924
  *
2925
2925
  * @param related
2926
- * @param throughTable
2926
+ * @param throughTable
2927
2927
  * @param firstKey
2928
2928
  * @param secondKey
2929
2929
  * @param localKey
@@ -4563,8 +4563,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4563
4563
  */
4564
4564
  orWhereRaw(sql: string, bindings?: unknown[]): this;
4565
4565
  /**
4566
- * Paginates the query results and returns a LengthAwarePaginator instance
4567
- * containing data and total-aware pagination metadata.
4566
+ * Paginates the query results and returns a LengthAwarePaginator instance
4567
+ * containing data and total-aware pagination metadata.
4568
4568
  *
4569
4569
  * @param page
4570
4570
  * @param perPage
@@ -4803,12 +4803,12 @@ type NamingCase = 'camel' | 'snake' | 'kebab' | 'studly';
4803
4803
  type ModelTableCase = NamingCase;
4804
4804
  interface ArkormConfig {
4805
4805
  /**
4806
- * @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
4807
- */
4806
+ * @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
4807
+ */
4808
4808
  client?: ClientResolver;
4809
4809
  /**
4810
- * @deprecated Use client instead.
4811
- * @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
4810
+ * @deprecated Use client instead.
4811
+ * @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
4812
4812
  */
4813
4813
  prisma?: ClientResolver;
4814
4814
  /**
@@ -6307,7 +6307,7 @@ declare class CliApp {
6307
6307
  *
6308
6308
  * @param schema The Prisma schema source.
6309
6309
  * @returns A map of enum names to their declared member names.
6310
- */
6310
+ */
6311
6311
  private parsePrismaEnums;
6312
6312
  /**
6313
6313
  * Resolve the generated TypeScript declaration type for a Prisma field.
@@ -7029,6 +7029,47 @@ declare class TableBuilder {
7029
7029
  */
7030
7030
  declare class SchemaBuilder {
7031
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;
7032
7073
  /**
7033
7074
  * Defines a new table to be created in the migration.
7034
7075
  *
@@ -291,7 +291,7 @@ declare class LengthAwarePaginator<T> {
291
291
  readonly meta: PaginationMeta;
292
292
  private readonly urlDriver;
293
293
  /**
294
- * Creates a new LengthAwarePaginator instance.
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.
@@ -2373,8 +2373,8 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2373
2373
  constructor(attributes?: Record<string, unknown>);
2374
2374
  private static emitDeprecationWarning;
2375
2375
  /**
2376
- * Compatibility-only runtime API retained for the 2.x transition window.
2377
- * This is no longer part of the supported runtime bootstrap path.
2376
+ * Compatibility-only runtime API retained for the 2.x transition window.
2377
+ * This is no longer part of the supported runtime bootstrap path.
2378
2378
  *
2379
2379
  * @deprecated Use Model.setAdapter(createPrismaDatabaseAdapter(...)) or another
2380
2380
  * adapter-first bootstrap path instead.
@@ -2899,7 +2899,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2899
2899
  * Define a belongs to many relationship.
2900
2900
  *
2901
2901
  * @param related
2902
- * @param throughTable
2902
+ * @param throughTable
2903
2903
  * @param foreignPivotKey
2904
2904
  * @param relatedPivotKey
2905
2905
  * @param parentKey
@@ -2911,7 +2911,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2911
2911
  * Define a has one through relationship.
2912
2912
  *
2913
2913
  * @param related
2914
- * @param throughTable
2914
+ * @param throughTable
2915
2915
  * @param firstKey
2916
2916
  * @param secondKey
2917
2917
  * @param localKey
@@ -2923,7 +2923,7 @@ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<strin
2923
2923
  * Define a has many through relationship.
2924
2924
  *
2925
2925
  * @param related
2926
- * @param throughTable
2926
+ * @param throughTable
2927
2927
  * @param firstKey
2928
2928
  * @param secondKey
2929
2929
  * @param localKey
@@ -4563,8 +4563,8 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
4563
4563
  */
4564
4564
  orWhereRaw(sql: string, bindings?: unknown[]): this;
4565
4565
  /**
4566
- * Paginates the query results and returns a LengthAwarePaginator instance
4567
- * containing data and total-aware pagination metadata.
4566
+ * Paginates the query results and returns a LengthAwarePaginator instance
4567
+ * containing data and total-aware pagination metadata.
4568
4568
  *
4569
4569
  * @param page
4570
4570
  * @param perPage
@@ -4803,12 +4803,12 @@ type NamingCase = 'camel' | 'snake' | 'kebab' | 'studly';
4803
4803
  type ModelTableCase = NamingCase;
4804
4804
  interface ArkormConfig {
4805
4805
  /**
4806
- * @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
4807
- */
4806
+ * @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
4807
+ */
4808
4808
  client?: ClientResolver;
4809
4809
  /**
4810
- * @deprecated Use client instead.
4811
- * @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
4810
+ * @deprecated Use client instead.
4811
+ * @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
4812
4812
  */
4813
4813
  prisma?: ClientResolver;
4814
4814
  /**
@@ -6307,7 +6307,7 @@ declare class CliApp {
6307
6307
  *
6308
6308
  * @param schema The Prisma schema source.
6309
6309
  * @returns A map of enum names to their declared member names.
6310
- */
6310
+ */
6311
6311
  private parsePrismaEnums;
6312
6312
  /**
6313
6313
  * Resolve the generated TypeScript declaration type for a Prisma field.
@@ -7029,6 +7029,47 @@ declare class TableBuilder {
7029
7029
  */
7030
7030
  declare class SchemaBuilder {
7031
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;
7032
7073
  /**
7033
7074
  * Defines a new table to be created in the migration.
7034
7075
  *