@constructive-io/sdk 0.5.2 → 0.6.1
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/admin/orm/input-types.d.ts +7 -280
- package/admin/orm/query-builder.d.ts +6 -4
- package/admin/orm/query-builder.js +13 -3
- package/admin/orm/select-types.d.ts +4 -2
- package/auth/orm/input-types.d.ts +7 -63
- package/auth/orm/query-builder.d.ts +6 -4
- package/auth/orm/query-builder.js +13 -3
- package/auth/orm/select-types.d.ts +4 -2
- package/esm/admin/orm/input-types.d.ts +7 -280
- package/esm/admin/orm/query-builder.d.ts +6 -4
- package/esm/admin/orm/query-builder.js +13 -3
- package/esm/admin/orm/select-types.d.ts +4 -2
- package/esm/auth/orm/input-types.d.ts +7 -63
- package/esm/auth/orm/query-builder.d.ts +6 -4
- package/esm/auth/orm/query-builder.js +13 -3
- package/esm/auth/orm/select-types.d.ts +4 -2
- package/esm/objects/orm/input-types.d.ts +7 -39
- package/esm/objects/orm/query-builder.d.ts +6 -4
- package/esm/objects/orm/query-builder.js +13 -3
- package/esm/objects/orm/select-types.d.ts +4 -2
- package/esm/public/orm/input-types.d.ts +7 -1196
- package/esm/public/orm/query-builder.d.ts +6 -4
- package/esm/public/orm/query-builder.js +13 -3
- package/esm/public/orm/select-types.d.ts +4 -2
- package/objects/orm/input-types.d.ts +7 -39
- package/objects/orm/query-builder.d.ts +6 -4
- package/objects/orm/query-builder.js +13 -3
- package/objects/orm/select-types.d.ts +4 -2
- package/package.json +3 -3
- package/public/orm/input-types.d.ts +7 -1196
- package/public/orm/query-builder.d.ts +6 -4
- package/public/orm/query-builder.js +13 -3
- package/public/orm/select-types.d.ts +4 -2
|
@@ -131,13 +131,18 @@ export function buildSelections(select, connectionFieldsMap, entityType) {
|
|
|
131
131
|
// ============================================================================
|
|
132
132
|
// Document Builders
|
|
133
133
|
// ============================================================================
|
|
134
|
-
export function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName, connectionFieldsMap) {
|
|
134
|
+
export function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName, connectionFieldsMap, conditionTypeName) {
|
|
135
135
|
const selections = select
|
|
136
136
|
? buildSelections(select, connectionFieldsMap, operationName)
|
|
137
137
|
: [t.field({ name: 'id' })];
|
|
138
138
|
const variableDefinitions = [];
|
|
139
139
|
const queryArgs = [];
|
|
140
140
|
const variables = {};
|
|
141
|
+
addVariable({
|
|
142
|
+
varName: 'condition',
|
|
143
|
+
typeName: conditionTypeName,
|
|
144
|
+
value: args.condition,
|
|
145
|
+
}, variableDefinitions, queryArgs, variables);
|
|
141
146
|
addVariable({
|
|
142
147
|
varName: 'where',
|
|
143
148
|
argName: 'filter',
|
|
@@ -176,7 +181,7 @@ export function buildFindManyDocument(operationName, queryField, select, args, f
|
|
|
176
181
|
});
|
|
177
182
|
return { document: print(document), variables };
|
|
178
183
|
}
|
|
179
|
-
export function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap) {
|
|
184
|
+
export function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap, conditionTypeName) {
|
|
180
185
|
const selections = select
|
|
181
186
|
? buildSelections(select, connectionFieldsMap, operationName)
|
|
182
187
|
: [t.field({ name: 'id' })];
|
|
@@ -185,6 +190,11 @@ export function buildFindFirstDocument(operationName, queryField, select, args,
|
|
|
185
190
|
const variables = {};
|
|
186
191
|
// Always add first: 1 for findFirst
|
|
187
192
|
addVariable({ varName: 'first', typeName: 'Int', value: 1 }, variableDefinitions, queryArgs, variables);
|
|
193
|
+
addVariable({
|
|
194
|
+
varName: 'condition',
|
|
195
|
+
typeName: conditionTypeName,
|
|
196
|
+
value: args.condition,
|
|
197
|
+
}, variableDefinitions, queryArgs, variables);
|
|
188
198
|
addVariable({
|
|
189
199
|
varName: 'where',
|
|
190
200
|
argName: 'filter',
|
|
@@ -519,7 +529,7 @@ function buildInputMutationDocument(config) {
|
|
|
519
529
|
return print(document);
|
|
520
530
|
}
|
|
521
531
|
function addVariable(spec, definitions, args, variables) {
|
|
522
|
-
if (spec.value === undefined)
|
|
532
|
+
if (spec.value === undefined || !spec.typeName)
|
|
523
533
|
return;
|
|
524
534
|
definitions.push(t.variableDefinition({
|
|
525
535
|
variable: t.variable({ name: spec.varName }),
|
|
@@ -14,9 +14,10 @@ export interface PageInfo {
|
|
|
14
14
|
startCursor?: string | null;
|
|
15
15
|
endCursor?: string | null;
|
|
16
16
|
}
|
|
17
|
-
export interface FindManyArgs<TSelect, TWhere, TOrderBy> {
|
|
17
|
+
export interface FindManyArgs<TSelect, TWhere, TCondition = never, TOrderBy = never> {
|
|
18
18
|
select?: TSelect;
|
|
19
19
|
where?: TWhere;
|
|
20
|
+
condition?: TCondition;
|
|
20
21
|
orderBy?: TOrderBy[];
|
|
21
22
|
first?: number;
|
|
22
23
|
last?: number;
|
|
@@ -24,9 +25,10 @@ export interface FindManyArgs<TSelect, TWhere, TOrderBy> {
|
|
|
24
25
|
before?: string;
|
|
25
26
|
offset?: number;
|
|
26
27
|
}
|
|
27
|
-
export interface FindFirstArgs<TSelect, TWhere> {
|
|
28
|
+
export interface FindFirstArgs<TSelect, TWhere, TCondition = never> {
|
|
28
29
|
select?: TSelect;
|
|
29
30
|
where?: TWhere;
|
|
31
|
+
condition?: TCondition;
|
|
30
32
|
}
|
|
31
33
|
export interface CreateArgs<TSelect, TData> {
|
|
32
34
|
data: TData;
|