@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
|
};
|
|
@@ -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;
|
|
@@ -162,6 +162,13 @@ export interface InternetAddressFilter {
|
|
|
162
162
|
export interface FullTextFilter {
|
|
163
163
|
matches?: string;
|
|
164
164
|
}
|
|
165
|
+
export interface VectorFilter {
|
|
166
|
+
isNull?: boolean;
|
|
167
|
+
equalTo?: number[];
|
|
168
|
+
notEqualTo?: number[];
|
|
169
|
+
distinctFrom?: number[];
|
|
170
|
+
notDistinctFrom?: number[];
|
|
171
|
+
}
|
|
165
172
|
export interface StringListFilter {
|
|
166
173
|
isNull?: boolean;
|
|
167
174
|
equalTo?: string[];
|
|
@@ -396,45 +403,6 @@ export interface CommitFilter {
|
|
|
396
403
|
or?: CommitFilter[];
|
|
397
404
|
not?: CommitFilter;
|
|
398
405
|
}
|
|
399
|
-
export interface GetAllRecordCondition {
|
|
400
|
-
path?: string | null;
|
|
401
|
-
data?: unknown | null;
|
|
402
|
-
}
|
|
403
|
-
export interface ObjectCondition {
|
|
404
|
-
hashUuid?: string | null;
|
|
405
|
-
id?: string | null;
|
|
406
|
-
databaseId?: string | null;
|
|
407
|
-
kids?: string | null;
|
|
408
|
-
ktree?: string | null;
|
|
409
|
-
data?: unknown | null;
|
|
410
|
-
frzn?: boolean | null;
|
|
411
|
-
createdAt?: string | null;
|
|
412
|
-
}
|
|
413
|
-
export interface RefCondition {
|
|
414
|
-
id?: string | null;
|
|
415
|
-
name?: string | null;
|
|
416
|
-
databaseId?: string | null;
|
|
417
|
-
storeId?: string | null;
|
|
418
|
-
commitId?: string | null;
|
|
419
|
-
}
|
|
420
|
-
export interface StoreCondition {
|
|
421
|
-
id?: string | null;
|
|
422
|
-
name?: string | null;
|
|
423
|
-
databaseId?: string | null;
|
|
424
|
-
hash?: string | null;
|
|
425
|
-
createdAt?: string | null;
|
|
426
|
-
}
|
|
427
|
-
export interface CommitCondition {
|
|
428
|
-
id?: string | null;
|
|
429
|
-
message?: string | null;
|
|
430
|
-
databaseId?: string | null;
|
|
431
|
-
storeId?: string | null;
|
|
432
|
-
parentIds?: string | null;
|
|
433
|
-
authorId?: string | null;
|
|
434
|
-
committerId?: string | null;
|
|
435
|
-
treeId?: string | null;
|
|
436
|
-
date?: string | null;
|
|
437
|
-
}
|
|
438
406
|
export type GetAllRecordsOrderBy = 'PRIMARY_KEY_ASC' | 'PRIMARY_KEY_DESC' | 'NATURAL' | 'PATH_ASC' | 'PATH_DESC' | 'DATA_ASC' | 'DATA_DESC';
|
|
439
407
|
export type ObjectOrderBy = 'PRIMARY_KEY_ASC' | 'PRIMARY_KEY_DESC' | 'NATURAL' | 'HASH_UUID_ASC' | 'HASH_UUID_DESC' | 'ID_ASC' | 'ID_DESC' | 'DATABASE_ID_ASC' | 'DATABASE_ID_DESC' | 'KIDS_ASC' | 'KIDS_DESC' | 'KTREE_ASC' | 'KTREE_DESC' | 'DATA_ASC' | 'DATA_DESC' | 'FRZN_ASC' | 'FRZN_DESC' | 'CREATED_AT_ASC' | 'CREATED_AT_DESC';
|
|
440
408
|
export type RefOrderBy = 'PRIMARY_KEY_ASC' | 'PRIMARY_KEY_DESC' | 'NATURAL' | 'ID_ASC' | 'ID_DESC' | 'NAME_ASC' | 'NAME_DESC' | 'DATABASE_ID_ASC' | 'DATABASE_ID_DESC' | 'STORE_ID_ASC' | 'STORE_ID_DESC' | 'COMMIT_ID_ASC' | 'COMMIT_ID_DESC';
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive SDK - Auto-generated GraphQL types and ORM client",
|
|
6
6
|
"main": "index.js",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"graphql": "^16.13.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@constructive-io/graphql-codegen": "^4.
|
|
47
|
+
"@constructive-io/graphql-codegen": "^4.13.0",
|
|
48
48
|
"@types/node": "^22.19.11",
|
|
49
49
|
"makage": "^0.1.12",
|
|
50
50
|
"tsx": "^4.19.0",
|
|
51
51
|
"typescript": "^5.9.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "67218366027bc6370e07a1b96d8bf25adba18f42"
|
|
54
54
|
}
|