@constructive-io/sdk 0.5.2 → 0.6.0
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
|
@@ -34,21 +34,23 @@ export declare class QueryBuilder<TResult> {
|
|
|
34
34
|
getVariables(): Record<string, unknown> | undefined;
|
|
35
35
|
}
|
|
36
36
|
export declare function buildSelections(select: Record<string, unknown> | undefined, connectionFieldsMap?: Record<string, Record<string, string>>, entityType?: string): FieldNode[];
|
|
37
|
-
export declare function buildFindManyDocument<TSelect, TWhere>(operationName: string, queryField: string, select: TSelect, args: {
|
|
37
|
+
export declare function buildFindManyDocument<TSelect, TWhere, TCondition = never>(operationName: string, queryField: string, select: TSelect, args: {
|
|
38
38
|
where?: TWhere;
|
|
39
|
+
condition?: TCondition;
|
|
39
40
|
orderBy?: string[];
|
|
40
41
|
first?: number;
|
|
41
42
|
last?: number;
|
|
42
43
|
after?: string;
|
|
43
44
|
before?: string;
|
|
44
45
|
offset?: number;
|
|
45
|
-
}, filterTypeName: string, orderByTypeName: string, connectionFieldsMap?: Record<string, Record<string, string
|
|
46
|
+
}, filterTypeName: string, orderByTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>, conditionTypeName?: string): {
|
|
46
47
|
document: string;
|
|
47
48
|
variables: Record<string, unknown>;
|
|
48
49
|
};
|
|
49
|
-
export declare function buildFindFirstDocument<TSelect, TWhere>(operationName: string, queryField: string, select: TSelect, args: {
|
|
50
|
+
export declare function buildFindFirstDocument<TSelect, TWhere, TCondition = never>(operationName: string, queryField: string, select: TSelect, args: {
|
|
50
51
|
where?: TWhere;
|
|
51
|
-
|
|
52
|
+
condition?: TCondition;
|
|
53
|
+
}, filterTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>, conditionTypeName?: string): {
|
|
52
54
|
document: string;
|
|
53
55
|
variables: Record<string, unknown>;
|
|
54
56
|
};
|
|
@@ -178,13 +178,18 @@ function buildSelections(select, connectionFieldsMap, entityType) {
|
|
|
178
178
|
// ============================================================================
|
|
179
179
|
// Document Builders
|
|
180
180
|
// ============================================================================
|
|
181
|
-
function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName, connectionFieldsMap) {
|
|
181
|
+
function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName, connectionFieldsMap, conditionTypeName) {
|
|
182
182
|
const selections = select
|
|
183
183
|
? buildSelections(select, connectionFieldsMap, operationName)
|
|
184
184
|
: [t.field({ name: 'id' })];
|
|
185
185
|
const variableDefinitions = [];
|
|
186
186
|
const queryArgs = [];
|
|
187
187
|
const variables = {};
|
|
188
|
+
addVariable({
|
|
189
|
+
varName: 'condition',
|
|
190
|
+
typeName: conditionTypeName,
|
|
191
|
+
value: args.condition,
|
|
192
|
+
}, variableDefinitions, queryArgs, variables);
|
|
188
193
|
addVariable({
|
|
189
194
|
varName: 'where',
|
|
190
195
|
argName: 'filter',
|
|
@@ -223,7 +228,7 @@ function buildFindManyDocument(operationName, queryField, select, args, filterTy
|
|
|
223
228
|
});
|
|
224
229
|
return { document: (0, graphql_web_1.print)(document), variables };
|
|
225
230
|
}
|
|
226
|
-
function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap) {
|
|
231
|
+
function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap, conditionTypeName) {
|
|
227
232
|
const selections = select
|
|
228
233
|
? buildSelections(select, connectionFieldsMap, operationName)
|
|
229
234
|
: [t.field({ name: 'id' })];
|
|
@@ -232,6 +237,11 @@ function buildFindFirstDocument(operationName, queryField, select, args, filterT
|
|
|
232
237
|
const variables = {};
|
|
233
238
|
// Always add first: 1 for findFirst
|
|
234
239
|
addVariable({ varName: 'first', typeName: 'Int', value: 1 }, variableDefinitions, queryArgs, variables);
|
|
240
|
+
addVariable({
|
|
241
|
+
varName: 'condition',
|
|
242
|
+
typeName: conditionTypeName,
|
|
243
|
+
value: args.condition,
|
|
244
|
+
}, variableDefinitions, queryArgs, variables);
|
|
235
245
|
addVariable({
|
|
236
246
|
varName: 'where',
|
|
237
247
|
argName: 'filter',
|
|
@@ -566,7 +576,7 @@ function buildInputMutationDocument(config) {
|
|
|
566
576
|
return (0, graphql_web_1.print)(document);
|
|
567
577
|
}
|
|
568
578
|
function addVariable(spec, definitions, args, variables) {
|
|
569
|
-
if (spec.value === undefined)
|
|
579
|
+
if (spec.value === undefined || !spec.typeName)
|
|
570
580
|
return;
|
|
571
581
|
definitions.push(t.variableDefinition({
|
|
572
582
|
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;
|