orchid-orm 1.68.2 → 1.68.4

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.ts CHANGED
@@ -28,7 +28,7 @@ interface HasOneInfo<T extends RelationConfigSelf, Name extends string, Rel exte
28
28
  query: Q;
29
29
  params: HasOneParams<T, Rel['options']>;
30
30
  maybeSingle: T['relations'][Name]['options']['required'] extends true ? QueryManyTake<Q> : QueryManyTakeOptional<Q>;
31
- columnsForCreate: never;
31
+ omitForeignKeyInCreate: never;
32
32
  optionalDataForCreate: T['relations'][Name]['options'] extends RelationThroughOptions ? EmptyObject : { [P in Name]?: RelationToOneDataForCreate<{
33
33
  nestedCreateQuery: CreateData<Q>;
34
34
  table: Q;
@@ -68,7 +68,7 @@ interface HasManyInfo<T extends RelationConfigSelf, Name extends string, Rel ext
68
68
  query: Q;
69
69
  params: HasOneParams<T, Rel['options']>;
70
70
  maybeSingle: Q;
71
- columnsForCreate: never;
71
+ omitForeignKeyInCreate: never;
72
72
  optionalDataForCreate: { [P in Name]?: T['relations'][Name]['options'] extends RelationThroughOptions ? EmptyObject : {
73
73
  create?: CreateData<Q>[];
74
74
  connect?: WhereArg<Q>[];
@@ -122,8 +122,11 @@ interface BelongsToInfo<T extends RelationConfigSelf, Name extends string, FK ex
122
122
  query: Q;
123
123
  params: BelongsToParams<T, FK>;
124
124
  maybeSingle: Required extends true ? QueryManyTake<Q> : QueryManyTakeOptional<Q>;
125
- columnsForCreate: FK;
126
- dataForCreate: { [Key in Name]?: RelationToOneDataForCreateSameQuery<Q> };
125
+ omitForeignKeyInCreate: FK;
126
+ dataForCreate: {
127
+ columns: FK;
128
+ nested: Required extends true ? { [Key in Name]: RelationToOneDataForCreateSameQuery<Q> } : { [Key in Name]?: RelationToOneDataForCreateSameQuery<Q> };
129
+ };
127
130
  optionalDataForCreate: EmptyObject;
128
131
  dataForUpdate: {
129
132
  disconnect: boolean;
@@ -278,6 +281,8 @@ interface OrchidORMMethods {
278
281
  * SQL session options (`role` and `setConfig`) cannot be nested.
279
282
  * If an outer scope already has `role` or `setConfig`, attempting to set them again
280
283
  * in a nested `$withOptions` call will throw an error.
284
+ * For transaction-bound work that needs nested overrides, pass `role` and
285
+ * `setConfig` to nested `$transaction` calls instead.
281
286
  * Nested scopes that only change `log` or `schema` will inherit the outer SQL session context.
282
287
  *
283
288
  * Explicit transactions inside the callback inherit the same SQL session context:
@@ -302,6 +307,9 @@ interface OrchidORMMethods {
302
307
  * );
303
308
  * ```
304
309
  *
310
+ * When the request's DB work should run in one transaction, prefer passing
311
+ * `role` and `setConfig` directly to `$transaction`.
312
+ *
305
313
  * Basic usage with `log` and `schema`:
306
314
  *
307
315
  * ```ts
@@ -353,7 +361,7 @@ interface HasAndBelongsToManyInfo<T extends RelationConfigSelf, Name extends str
353
361
  query: Q;
354
362
  params: HasAndBelongsToManyParams<T, FK>;
355
363
  maybeSingle: Q;
356
- columnsForCreate: never;
364
+ omitForeignKeyInCreate: never;
357
365
  optionalDataForCreate: { [P in Name]?: {
358
366
  create?: CreateData<Q>[];
359
367
  connect?: WhereArg<Q>[];