pqb 0.36.4 → 0.36.6

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
@@ -68,7 +68,7 @@ interface RelationConfigBase {
68
68
  dataForUpdateOne: unknown;
69
69
  }
70
70
  interface RelationConfigDataForCreate {
71
- columns: RecordUnknown;
71
+ columns: PropertyKey;
72
72
  nested: RecordUnknown;
73
73
  }
74
74
  interface RelationsBase {
@@ -4069,9 +4069,13 @@ type CreateRelationsData<T extends CreateSelf, BelongsToData> = CreateDataWithDe
4069
4069
  type CreateBelongsToData<T extends CreateSelf> = [
4070
4070
  T['relations'][keyof T['relations']]['relationConfig']['dataForCreate']
4071
4071
  ] extends [never] ? never : CreateRelationsDataOmittingFKeys<T, T['relations'][keyof T['relations']]['relationConfig']['dataForCreate']>;
4072
- type CreateRelationsDataOmittingFKeys<T extends CreateSelf, Union> = (Union extends RelationConfigDataForCreate ? (u: keyof Union['columns'] extends keyof T['meta']['defaults'] ? Omit<Union['columns'], keyof T['meta']['defaults']> & {
4073
- [P in keyof T['meta']['defaults'] & keyof Union['columns']]?: Union['columns'][P];
4074
- } & Partial<Union['nested']> : Union['columns'] | Union['nested']) => void : never) extends (u: infer Obj) => void ? Obj : never;
4072
+ type CreateRelationsDataOmittingFKeys<T extends CreateSelf, Union> = (Union extends RelationConfigDataForCreate ? (u: Union['columns'] extends keyof T['meta']['defaults'] ? {
4073
+ [P in Exclude<Union['columns'] & keyof T['inputType'], keyof T['meta']['defaults']>]: CreateColumn<T, P>;
4074
+ } & {
4075
+ [P in keyof T['meta']['defaults'] & Union['columns']]?: CreateColumn<T, P>;
4076
+ } & Partial<Union['nested']> : {
4077
+ [P in Union['columns'] & keyof T['inputType']]: CreateColumn<T, P>;
4078
+ } | Union['nested']) => void : never) extends (u: infer Obj) => void ? Obj : never;
4075
4079
  type CreateResult<T extends CreateSelf, BT> = T extends {
4076
4080
  isCount: true;
4077
4081
  } ? SetQueryKind<T, 'create'> : T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>>;
@@ -5586,7 +5590,9 @@ declare class Union {
5586
5590
  interface UpdateSelf extends PickQueryMetaResultRelationsWithDataReturnTypeShape {
5587
5591
  inputType: RecordUnknown;
5588
5592
  }
5589
- type UpdateData<T extends UpdateSelf> = {
5593
+ type UpdateData<T extends UpdateSelf> = RelationsBase extends T['relations'] ? {
5594
+ [K in keyof T['inputType']]?: UpdateColumn<T, K>;
5595
+ } : {
5590
5596
  [K in keyof T['inputType'] | keyof T['relations']]?: K extends keyof T['inputType'] ? UpdateColumn<T, K> : UpdateRelationData<T, T['relations'][K]['relationConfig']>;
5591
5597
  };
5592
5598
  type UpdateColumn<T extends UpdateSelf, Key extends keyof T['inputType']> = T['inputType'][Key] | QueryOrExpression<T['inputType'][Key]> | ((q: T) => QueryOrExpression<T['inputType'][Key]>);