@pgpmjs/migrate-client 0.4.0 → 0.4.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/esm/migrate/orm/models/migrateFile.d.ts +1 -1
- package/esm/migrate/orm/models/sqlAction.d.ts +1 -1
- package/esm/migrate/orm/query-builder.d.ts +4 -6
- package/esm/migrate/orm/query-builder.js +2 -12
- package/esm/migrate/orm/select-types.d.ts +2 -4
- package/migrate/orm/models/migrateFile.d.ts +1 -1
- package/migrate/orm/models/sqlAction.d.ts +1 -1
- package/migrate/orm/query-builder.d.ts +4 -6
- package/migrate/orm/query-builder.js +2 -12
- package/migrate/orm/select-types.d.ts +2 -4
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ import type { MigrateFileWithRelations, MigrateFileSelect, MigrateFileFilter, Mi
|
|
|
10
10
|
export declare class MigrateFileModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
13
|
-
findMany<S extends MigrateFileSelect>(args: FindManyArgs<S, MigrateFileFilter,
|
|
13
|
+
findMany<S extends MigrateFileSelect>(args: FindManyArgs<S, MigrateFileFilter, MigrateFileOrderBy> & {
|
|
14
14
|
select: S;
|
|
15
15
|
} & StrictSelect<S, MigrateFileSelect>): QueryBuilder<{
|
|
16
16
|
migrateFiles: ConnectionResult<InferSelectResult<MigrateFileWithRelations, S>>;
|
|
@@ -10,7 +10,7 @@ import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActio
|
|
|
10
10
|
export declare class SqlActionModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
13
|
-
findMany<S extends SqlActionSelect>(args: FindManyArgs<S, SqlActionFilter,
|
|
13
|
+
findMany<S extends SqlActionSelect>(args: FindManyArgs<S, SqlActionFilter, SqlActionOrderBy> & {
|
|
14
14
|
select: S;
|
|
15
15
|
} & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
|
|
16
16
|
sqlActions: ConnectionResult<InferSelectResult<SqlActionWithRelations, S>>;
|
|
@@ -34,23 +34,21 @@ 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
|
|
37
|
+
export declare function buildFindManyDocument<TSelect, TWhere>(operationName: string, queryField: string, select: TSelect, args: {
|
|
38
38
|
where?: TWhere;
|
|
39
|
-
condition?: TCondition;
|
|
40
39
|
orderBy?: string[];
|
|
41
40
|
first?: number;
|
|
42
41
|
last?: number;
|
|
43
42
|
after?: string;
|
|
44
43
|
before?: string;
|
|
45
44
|
offset?: number;
|
|
46
|
-
}, filterTypeName: string, orderByTypeName: string, connectionFieldsMap?: Record<string, Record<string, string
|
|
45
|
+
}, filterTypeName: string, orderByTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>): {
|
|
47
46
|
document: string;
|
|
48
47
|
variables: Record<string, unknown>;
|
|
49
48
|
};
|
|
50
|
-
export declare function buildFindFirstDocument<TSelect, TWhere
|
|
49
|
+
export declare function buildFindFirstDocument<TSelect, TWhere>(operationName: string, queryField: string, select: TSelect, args: {
|
|
51
50
|
where?: TWhere;
|
|
52
|
-
|
|
53
|
-
}, filterTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>, conditionTypeName?: string): {
|
|
51
|
+
}, filterTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>): {
|
|
54
52
|
document: string;
|
|
55
53
|
variables: Record<string, unknown>;
|
|
56
54
|
};
|
|
@@ -131,18 +131,13 @@ 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) {
|
|
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);
|
|
146
141
|
addVariable({
|
|
147
142
|
varName: 'where',
|
|
148
143
|
typeName: filterTypeName,
|
|
@@ -180,7 +175,7 @@ export function buildFindManyDocument(operationName, queryField, select, args, f
|
|
|
180
175
|
});
|
|
181
176
|
return { document: print(document), variables };
|
|
182
177
|
}
|
|
183
|
-
export function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap
|
|
178
|
+
export function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap) {
|
|
184
179
|
const selections = select
|
|
185
180
|
? buildSelections(select, connectionFieldsMap, operationName)
|
|
186
181
|
: [t.field({ name: 'id' })];
|
|
@@ -189,11 +184,6 @@ export function buildFindFirstDocument(operationName, queryField, select, args,
|
|
|
189
184
|
const variables = {};
|
|
190
185
|
// Always add first: 1 for findFirst
|
|
191
186
|
addVariable({ varName: 'first', typeName: 'Int', value: 1 }, variableDefinitions, queryArgs, variables);
|
|
192
|
-
addVariable({
|
|
193
|
-
varName: 'condition',
|
|
194
|
-
typeName: conditionTypeName,
|
|
195
|
-
value: args.condition,
|
|
196
|
-
}, variableDefinitions, queryArgs, variables);
|
|
197
187
|
addVariable({
|
|
198
188
|
varName: 'where',
|
|
199
189
|
typeName: filterTypeName,
|
|
@@ -14,10 +14,9 @@ export interface PageInfo {
|
|
|
14
14
|
startCursor?: string | null;
|
|
15
15
|
endCursor?: string | null;
|
|
16
16
|
}
|
|
17
|
-
export interface FindManyArgs<TSelect, TWhere,
|
|
17
|
+
export interface FindManyArgs<TSelect, TWhere, TOrderBy = never> {
|
|
18
18
|
select?: TSelect;
|
|
19
19
|
where?: TWhere;
|
|
20
|
-
condition?: TCondition;
|
|
21
20
|
orderBy?: TOrderBy[];
|
|
22
21
|
first?: number;
|
|
23
22
|
last?: number;
|
|
@@ -25,10 +24,9 @@ export interface FindManyArgs<TSelect, TWhere, TCondition = never, TOrderBy = ne
|
|
|
25
24
|
before?: string;
|
|
26
25
|
offset?: number;
|
|
27
26
|
}
|
|
28
|
-
export interface FindFirstArgs<TSelect, TWhere
|
|
27
|
+
export interface FindFirstArgs<TSelect, TWhere> {
|
|
29
28
|
select?: TSelect;
|
|
30
29
|
where?: TWhere;
|
|
31
|
-
condition?: TCondition;
|
|
32
30
|
}
|
|
33
31
|
export interface CreateArgs<TSelect, TData> {
|
|
34
32
|
data: TData;
|
|
@@ -10,7 +10,7 @@ import type { MigrateFileWithRelations, MigrateFileSelect, MigrateFileFilter, Mi
|
|
|
10
10
|
export declare class MigrateFileModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
13
|
-
findMany<S extends MigrateFileSelect>(args: FindManyArgs<S, MigrateFileFilter,
|
|
13
|
+
findMany<S extends MigrateFileSelect>(args: FindManyArgs<S, MigrateFileFilter, MigrateFileOrderBy> & {
|
|
14
14
|
select: S;
|
|
15
15
|
} & StrictSelect<S, MigrateFileSelect>): QueryBuilder<{
|
|
16
16
|
migrateFiles: ConnectionResult<InferSelectResult<MigrateFileWithRelations, S>>;
|
|
@@ -10,7 +10,7 @@ import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActio
|
|
|
10
10
|
export declare class SqlActionModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
13
|
-
findMany<S extends SqlActionSelect>(args: FindManyArgs<S, SqlActionFilter,
|
|
13
|
+
findMany<S extends SqlActionSelect>(args: FindManyArgs<S, SqlActionFilter, SqlActionOrderBy> & {
|
|
14
14
|
select: S;
|
|
15
15
|
} & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
|
|
16
16
|
sqlActions: ConnectionResult<InferSelectResult<SqlActionWithRelations, S>>;
|
|
@@ -34,23 +34,21 @@ 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
|
|
37
|
+
export declare function buildFindManyDocument<TSelect, TWhere>(operationName: string, queryField: string, select: TSelect, args: {
|
|
38
38
|
where?: TWhere;
|
|
39
|
-
condition?: TCondition;
|
|
40
39
|
orderBy?: string[];
|
|
41
40
|
first?: number;
|
|
42
41
|
last?: number;
|
|
43
42
|
after?: string;
|
|
44
43
|
before?: string;
|
|
45
44
|
offset?: number;
|
|
46
|
-
}, filterTypeName: string, orderByTypeName: string, connectionFieldsMap?: Record<string, Record<string, string
|
|
45
|
+
}, filterTypeName: string, orderByTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>): {
|
|
47
46
|
document: string;
|
|
48
47
|
variables: Record<string, unknown>;
|
|
49
48
|
};
|
|
50
|
-
export declare function buildFindFirstDocument<TSelect, TWhere
|
|
49
|
+
export declare function buildFindFirstDocument<TSelect, TWhere>(operationName: string, queryField: string, select: TSelect, args: {
|
|
51
50
|
where?: TWhere;
|
|
52
|
-
|
|
53
|
-
}, filterTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>, conditionTypeName?: string): {
|
|
51
|
+
}, filterTypeName: string, connectionFieldsMap?: Record<string, Record<string, string>>): {
|
|
54
52
|
document: string;
|
|
55
53
|
variables: Record<string, unknown>;
|
|
56
54
|
};
|
|
@@ -179,18 +179,13 @@ function buildSelections(select, connectionFieldsMap, entityType) {
|
|
|
179
179
|
// ============================================================================
|
|
180
180
|
// Document Builders
|
|
181
181
|
// ============================================================================
|
|
182
|
-
function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName, connectionFieldsMap
|
|
182
|
+
function buildFindManyDocument(operationName, queryField, select, args, filterTypeName, orderByTypeName, connectionFieldsMap) {
|
|
183
183
|
const selections = select
|
|
184
184
|
? buildSelections(select, connectionFieldsMap, operationName)
|
|
185
185
|
: [t.field({ name: 'id' })];
|
|
186
186
|
const variableDefinitions = [];
|
|
187
187
|
const queryArgs = [];
|
|
188
188
|
const variables = {};
|
|
189
|
-
addVariable({
|
|
190
|
-
varName: 'condition',
|
|
191
|
-
typeName: conditionTypeName,
|
|
192
|
-
value: args.condition,
|
|
193
|
-
}, variableDefinitions, queryArgs, variables);
|
|
194
189
|
addVariable({
|
|
195
190
|
varName: 'where',
|
|
196
191
|
typeName: filterTypeName,
|
|
@@ -228,7 +223,7 @@ function buildFindManyDocument(operationName, queryField, select, args, filterTy
|
|
|
228
223
|
});
|
|
229
224
|
return { document: (0, graphql_web_1.print)(document), variables };
|
|
230
225
|
}
|
|
231
|
-
function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap
|
|
226
|
+
function buildFindFirstDocument(operationName, queryField, select, args, filterTypeName, connectionFieldsMap) {
|
|
232
227
|
const selections = select
|
|
233
228
|
? buildSelections(select, connectionFieldsMap, operationName)
|
|
234
229
|
: [t.field({ name: 'id' })];
|
|
@@ -237,11 +232,6 @@ function buildFindFirstDocument(operationName, queryField, select, args, filterT
|
|
|
237
232
|
const variables = {};
|
|
238
233
|
// Always add first: 1 for findFirst
|
|
239
234
|
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);
|
|
245
235
|
addVariable({
|
|
246
236
|
varName: 'where',
|
|
247
237
|
typeName: filterTypeName,
|
|
@@ -14,10 +14,9 @@ export interface PageInfo {
|
|
|
14
14
|
startCursor?: string | null;
|
|
15
15
|
endCursor?: string | null;
|
|
16
16
|
}
|
|
17
|
-
export interface FindManyArgs<TSelect, TWhere,
|
|
17
|
+
export interface FindManyArgs<TSelect, TWhere, TOrderBy = never> {
|
|
18
18
|
select?: TSelect;
|
|
19
19
|
where?: TWhere;
|
|
20
|
-
condition?: TCondition;
|
|
21
20
|
orderBy?: TOrderBy[];
|
|
22
21
|
first?: number;
|
|
23
22
|
last?: number;
|
|
@@ -25,10 +24,9 @@ export interface FindManyArgs<TSelect, TWhere, TCondition = never, TOrderBy = ne
|
|
|
25
24
|
before?: string;
|
|
26
25
|
offset?: number;
|
|
27
26
|
}
|
|
28
|
-
export interface FindFirstArgs<TSelect, TWhere
|
|
27
|
+
export interface FindFirstArgs<TSelect, TWhere> {
|
|
29
28
|
select?: TSelect;
|
|
30
29
|
where?: TWhere;
|
|
31
|
-
condition?: TCondition;
|
|
32
30
|
}
|
|
33
31
|
export interface CreateArgs<TSelect, TData> {
|
|
34
32
|
data: TData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpmjs/migrate-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Typed GraphQL ORM client for the Constructive Migrate API (db_migrate schema)",
|
|
6
6
|
"main": "index.js",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"makage": "^0.3.0",
|
|
50
50
|
"typescript": "^5.9.3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "79cd3e66871804a22c672c7ca2fa5e2105d4b368"
|
|
53
53
|
}
|