pqb 0.2.7 → 0.2.8
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 +6 -6
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/queryMethods/then.ts +2 -2
- package/src/queryMethods/update.ts +12 -12
package/package.json
CHANGED
package/src/queryMethods/then.ts
CHANGED
|
@@ -18,10 +18,10 @@ export const queryMethodByReturnType: Record<
|
|
|
18
18
|
'query' | 'arrays'
|
|
19
19
|
> = {
|
|
20
20
|
all: 'query',
|
|
21
|
-
one: 'query',
|
|
22
|
-
oneOrThrow: 'query',
|
|
23
21
|
rows: 'arrays',
|
|
24
22
|
pluck: 'arrays',
|
|
23
|
+
one: 'query',
|
|
24
|
+
oneOrThrow: 'query',
|
|
25
25
|
value: 'arrays',
|
|
26
26
|
valueOrThrow: 'arrays',
|
|
27
27
|
rowCount: 'arrays',
|
|
@@ -40,21 +40,22 @@ type UpdateBelongsToData<T extends Query, Rel extends BelongsToRelation> =
|
|
|
40
40
|
| {
|
|
41
41
|
create: InsertData<Rel['nestedCreateQuery']>;
|
|
42
42
|
}
|
|
43
|
-
| (T['returnType'] extends '
|
|
44
|
-
?
|
|
43
|
+
| (T['returnType'] extends 'all'
|
|
44
|
+
? never
|
|
45
|
+
: {
|
|
45
46
|
upsert: {
|
|
46
47
|
update: UpdateData<Rel['model']>;
|
|
47
48
|
create: InsertData<Rel['nestedCreateQuery']>;
|
|
48
49
|
};
|
|
49
|
-
}
|
|
50
|
-
: never);
|
|
50
|
+
});
|
|
51
51
|
|
|
52
52
|
type UpdateHasOneData<T extends Query, Rel extends HasOneRelation> =
|
|
53
53
|
| { disconnect: boolean }
|
|
54
54
|
| { delete: boolean }
|
|
55
55
|
| { update: UpdateData<Rel['model']> }
|
|
56
|
-
| (T['returnType'] extends '
|
|
57
|
-
?
|
|
56
|
+
| (T['returnType'] extends 'all'
|
|
57
|
+
? never
|
|
58
|
+
:
|
|
58
59
|
| { set: WhereArg<Rel['model']> }
|
|
59
60
|
| {
|
|
60
61
|
upsert: {
|
|
@@ -64,8 +65,7 @@ type UpdateHasOneData<T extends Query, Rel extends HasOneRelation> =
|
|
|
64
65
|
}
|
|
65
66
|
| {
|
|
66
67
|
create: InsertData<Rel['nestedCreateQuery']>;
|
|
67
|
-
}
|
|
68
|
-
: never);
|
|
68
|
+
});
|
|
69
69
|
|
|
70
70
|
type UpdateHasManyData<T extends Query, Rel extends HasManyRelation> = {
|
|
71
71
|
disconnect?: MaybeArray<WhereArg<Rel['model']>>;
|
|
@@ -74,12 +74,12 @@ type UpdateHasManyData<T extends Query, Rel extends HasManyRelation> = {
|
|
|
74
74
|
where: MaybeArray<WhereArg<Rel['model']>>;
|
|
75
75
|
data: UpdateData<Rel['model']>;
|
|
76
76
|
};
|
|
77
|
-
} & (T['returnType'] extends '
|
|
78
|
-
?
|
|
77
|
+
} & (T['returnType'] extends 'all'
|
|
78
|
+
? EmptyObject
|
|
79
|
+
: {
|
|
79
80
|
set?: MaybeArray<WhereArg<Rel['model']>>;
|
|
80
81
|
create?: InsertData<Rel['nestedCreateQuery']>[];
|
|
81
|
-
}
|
|
82
|
-
: EmptyObject);
|
|
82
|
+
});
|
|
83
83
|
|
|
84
84
|
type UpdateHasAndBelongsToManyData<Rel extends HasAndBelongsToManyRelation> = {
|
|
85
85
|
disconnect?: MaybeArray<WhereArg<Rel['model']>>;
|