@pgpmjs/migrate-client 1.0.4 → 1.0.6
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/index.d.ts +1 -1
- package/esm/migrate/index.js +1 -1
- package/esm/migrate/orm/client.js +3 -1
- package/esm/migrate/orm/index.d.ts +9 -9
- package/esm/migrate/orm/index.js +10 -10
- package/esm/migrate/orm/input-types.d.ts +2 -8
- package/esm/migrate/orm/models/astMigration.d.ts +5 -5
- package/esm/migrate/orm/models/astMigration.js +32 -32
- package/esm/migrate/orm/models/index.d.ts +2 -2
- package/esm/migrate/orm/models/index.js +2 -2
- package/esm/migrate/orm/models/sqlAction.d.ts +5 -5
- package/esm/migrate/orm/models/sqlAction.js +32 -32
- package/esm/migrate/orm/mutation/index.d.ts +4 -4
- package/esm/migrate/orm/mutation/index.js +10 -12
- package/esm/migrate/orm/query-builder.js +15 -5
- package/migrate/index.d.ts +1 -1
- package/migrate/orm/client.js +3 -1
- package/migrate/orm/index.d.ts +9 -9
- package/migrate/orm/index.js +1 -1
- package/migrate/orm/input-types.d.ts +2 -8
- package/migrate/orm/models/astMigration.d.ts +5 -5
- package/migrate/orm/models/astMigration.js +30 -30
- package/migrate/orm/models/index.d.ts +2 -2
- package/migrate/orm/models/sqlAction.d.ts +5 -5
- package/migrate/orm/models/sqlAction.js +30 -30
- package/migrate/orm/mutation/index.d.ts +4 -4
- package/migrate/orm/mutation/index.js +8 -10
- package/migrate/orm/query-builder.js +15 -5
- package/package.json +4 -4
package/esm/migrate/index.d.ts
CHANGED
package/esm/migrate/index.js
CHANGED
|
@@ -35,7 +35,9 @@ export class FetchAdapter {
|
|
|
35
35
|
return {
|
|
36
36
|
ok: false,
|
|
37
37
|
data: null,
|
|
38
|
-
errors: [
|
|
38
|
+
errors: [
|
|
39
|
+
{ message: `HTTP ${response.status}: ${response.statusText}` },
|
|
40
|
+
],
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
const json = (await response.json());
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { OrmClientConfig } from
|
|
2
|
-
import { AstMigrationModel } from
|
|
3
|
-
import { SqlActionModel } from
|
|
4
|
-
export type { OrmClientConfig, QueryResult, GraphQLError, GraphQLAdapter } from
|
|
5
|
-
export { GraphQLRequestError, FetchAdapter } from
|
|
6
|
-
export { QueryBuilder } from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export { createMutationOperations } from
|
|
1
|
+
import type { OrmClientConfig } from "./client";
|
|
2
|
+
import { AstMigrationModel } from "./models/astMigration";
|
|
3
|
+
import { SqlActionModel } from "./models/sqlAction";
|
|
4
|
+
export type { OrmClientConfig, QueryResult, GraphQLError, GraphQLAdapter } from "./client";
|
|
5
|
+
export { GraphQLRequestError, FetchAdapter } from "./client";
|
|
6
|
+
export { QueryBuilder } from "./query-builder";
|
|
7
|
+
export * from "./select-types";
|
|
8
|
+
export * from "./models";
|
|
9
|
+
export { createMutationOperations } from "./mutation";
|
|
10
10
|
/**
|
|
11
11
|
* Create an ORM client instance
|
|
12
12
|
*
|
package/esm/migrate/orm/index.js
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
import { OrmClient } from
|
|
7
|
-
import { AstMigrationModel } from
|
|
8
|
-
import { SqlActionModel } from
|
|
9
|
-
import { createMutationOperations } from
|
|
10
|
-
export { GraphQLRequestError, FetchAdapter } from
|
|
11
|
-
export { QueryBuilder } from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export { createMutationOperations } from
|
|
6
|
+
import { OrmClient } from "./client";
|
|
7
|
+
import { AstMigrationModel } from "./models/astMigration";
|
|
8
|
+
import { SqlActionModel } from "./models/sqlAction";
|
|
9
|
+
import { createMutationOperations } from "./mutation";
|
|
10
|
+
export { GraphQLRequestError, FetchAdapter } from "./client";
|
|
11
|
+
export { QueryBuilder } from "./query-builder";
|
|
12
|
+
export * from "./select-types";
|
|
13
|
+
export * from "./models";
|
|
14
|
+
export { createMutationOperations } from "./mutation";
|
|
15
15
|
/**
|
|
16
16
|
* Create an ORM client instance
|
|
17
17
|
*
|
|
@@ -40,6 +40,6 @@ export function createClient(config) {
|
|
|
40
40
|
return {
|
|
41
41
|
astMigration: new AstMigrationModel(client),
|
|
42
42
|
sqlAction: new SqlActionModel(client),
|
|
43
|
-
mutation: createMutationOperations(client)
|
|
43
|
+
mutation: createMutationOperations(client)
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -248,7 +248,6 @@ export interface SqlAction {
|
|
|
248
248
|
actionId?: string | null;
|
|
249
249
|
actionName?: string | null;
|
|
250
250
|
actorId?: string | null;
|
|
251
|
-
category?: string | null;
|
|
252
251
|
content?: string | null;
|
|
253
252
|
createdAt?: string | null;
|
|
254
253
|
databaseId?: string | null;
|
|
@@ -296,7 +295,6 @@ export type SqlActionSelect = {
|
|
|
296
295
|
actionId?: boolean;
|
|
297
296
|
actionName?: boolean;
|
|
298
297
|
actorId?: boolean;
|
|
299
|
-
category?: boolean;
|
|
300
298
|
content?: boolean;
|
|
301
299
|
createdAt?: boolean;
|
|
302
300
|
databaseId?: boolean;
|
|
@@ -351,8 +349,6 @@ export interface SqlActionFilter {
|
|
|
351
349
|
actorId?: UUIDFilter;
|
|
352
350
|
/** Checks for all expressions in this list. */
|
|
353
351
|
and?: SqlActionFilter[];
|
|
354
|
-
/** Filter by the object’s `category` field. */
|
|
355
|
-
category?: StringFilter;
|
|
356
352
|
/** Filter by the object’s `content` field. */
|
|
357
353
|
content?: StringFilter;
|
|
358
354
|
/** Filter by the object’s `createdAt` field. */
|
|
@@ -376,8 +372,8 @@ export interface SqlActionFilter {
|
|
|
376
372
|
/** Filter by the object’s `verify` field. */
|
|
377
373
|
verify?: StringFilter;
|
|
378
374
|
}
|
|
379
|
-
export type AstMigrationOrderBy =
|
|
380
|
-
export type SqlActionOrderBy =
|
|
375
|
+
export type AstMigrationOrderBy = "ACTION_ID_ASC" | "ACTION_ID_DESC" | "ACTION_NAME_ASC" | "ACTION_NAME_DESC" | "ACTOR_ID_ASC" | "ACTOR_ID_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "DATABASE_ID_ASC" | "DATABASE_ID_DESC" | "DEPLOYS_ASC" | "DEPLOYS_DESC" | "DEPLOY_ASC" | "DEPLOY_DESC" | "ID_ASC" | "ID_DESC" | "NAME_ASC" | "NAME_DESC" | "NATURAL" | "PAYLOAD_ASC" | "PAYLOAD_DESC" | "REQUIRES_ASC" | "REQUIRES_DESC" | "REVERT_ASC" | "REVERT_DESC" | "VERIFY_ASC" | "VERIFY_DESC";
|
|
376
|
+
export type SqlActionOrderBy = "ACTION_ID_ASC" | "ACTION_ID_DESC" | "ACTION_NAME_ASC" | "ACTION_NAME_DESC" | "ACTOR_ID_ASC" | "ACTOR_ID_DESC" | "CONTENT_ASC" | "CONTENT_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "DATABASE_ID_ASC" | "DATABASE_ID_DESC" | "DEPLOY_ASC" | "DEPLOY_DESC" | "DEPS_ASC" | "DEPS_DESC" | "ID_ASC" | "ID_DESC" | "NAME_ASC" | "NAME_DESC" | "NATURAL" | "PAYLOAD_ASC" | "PAYLOAD_DESC" | "REVERT_ASC" | "REVERT_DESC" | "VERIFY_ASC" | "VERIFY_DESC";
|
|
381
377
|
export interface CreateAstMigrationInput {
|
|
382
378
|
clientMutationId?: string;
|
|
383
379
|
astMigration: {
|
|
@@ -422,7 +418,6 @@ export interface CreateSqlActionInput {
|
|
|
422
418
|
actionId: string;
|
|
423
419
|
actionName?: string;
|
|
424
420
|
actorId: string;
|
|
425
|
-
category?: string;
|
|
426
421
|
content?: string;
|
|
427
422
|
databaseId: string;
|
|
428
423
|
deploy?: string;
|
|
@@ -437,7 +432,6 @@ export interface SqlActionPatch {
|
|
|
437
432
|
actionId?: string | null;
|
|
438
433
|
actionName?: string | null;
|
|
439
434
|
actorId?: string | null;
|
|
440
|
-
category?: string | null;
|
|
441
435
|
content?: string | null;
|
|
442
436
|
databaseId?: string | null;
|
|
443
437
|
deploy?: string | null;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
import { OrmClient } from
|
|
7
|
-
import { QueryBuilder } from
|
|
8
|
-
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from
|
|
9
|
-
import type { AstMigrationWithRelations, AstMigrationSelect, AstMigrationFilter, AstMigrationOrderBy, CreateAstMigrationInput } from
|
|
6
|
+
import { OrmClient } from "../client";
|
|
7
|
+
import { QueryBuilder } from "../query-builder";
|
|
8
|
+
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from "../select-types";
|
|
9
|
+
import type { AstMigrationWithRelations, AstMigrationSelect, AstMigrationFilter, AstMigrationOrderBy, CreateAstMigrationInput } from "../input-types";
|
|
10
10
|
export declare class AstMigrationModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
@@ -26,7 +26,7 @@ export declare class AstMigrationModel {
|
|
|
26
26
|
} & StrictSelect<S, AstMigrationSelect>): QueryBuilder<{
|
|
27
27
|
astMigration: InferSelectResult<AstMigrationWithRelations, S> | null;
|
|
28
28
|
}>;
|
|
29
|
-
create<S extends AstMigrationSelect>(args: CreateArgs<S, CreateAstMigrationInput[
|
|
29
|
+
create<S extends AstMigrationSelect>(args: CreateArgs<S, CreateAstMigrationInput["astMigration"]> & {
|
|
30
30
|
select: S;
|
|
31
31
|
} & StrictSelect<S, AstMigrationSelect>): QueryBuilder<{
|
|
32
32
|
createAstMigration: {
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument
|
|
2
|
-
import { connectionFieldsMap } from
|
|
1
|
+
import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument } from "../query-builder";
|
|
2
|
+
import { connectionFieldsMap } from "../input-types";
|
|
3
3
|
export class AstMigrationModel {
|
|
4
4
|
client;
|
|
5
5
|
constructor(client) {
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
findMany(args) {
|
|
9
|
-
const { document, variables } = buildFindManyDocument(
|
|
9
|
+
const { document, variables } = buildFindManyDocument("AstMigration", "astMigrations", args.select, {
|
|
10
10
|
where: args?.where,
|
|
11
11
|
orderBy: args?.orderBy,
|
|
12
12
|
first: args?.first,
|
|
13
13
|
last: args?.last,
|
|
14
14
|
after: args?.after,
|
|
15
15
|
before: args?.before,
|
|
16
|
-
offset: args?.offset
|
|
17
|
-
},
|
|
16
|
+
offset: args?.offset
|
|
17
|
+
}, "AstMigrationFilter", "AstMigrationOrderBy", connectionFieldsMap);
|
|
18
18
|
return new QueryBuilder({
|
|
19
19
|
client: this.client,
|
|
20
|
-
operation:
|
|
21
|
-
operationName:
|
|
22
|
-
fieldName:
|
|
20
|
+
operation: "query",
|
|
21
|
+
operationName: "AstMigration",
|
|
22
|
+
fieldName: "astMigrations",
|
|
23
23
|
document,
|
|
24
|
-
variables
|
|
24
|
+
variables
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
findFirst(args) {
|
|
28
|
-
const { document, variables } = buildFindFirstDocument(
|
|
28
|
+
const { document, variables } = buildFindFirstDocument("AstMigration", "astMigrations", args.select, {
|
|
29
29
|
where: args?.where,
|
|
30
|
-
orderBy: args?.orderBy
|
|
31
|
-
},
|
|
30
|
+
orderBy: args?.orderBy
|
|
31
|
+
}, "AstMigrationFilter", "AstMigrationOrderBy", connectionFieldsMap);
|
|
32
32
|
return new QueryBuilder({
|
|
33
33
|
client: this.client,
|
|
34
|
-
operation:
|
|
35
|
-
operationName:
|
|
36
|
-
fieldName:
|
|
34
|
+
operation: "query",
|
|
35
|
+
operationName: "AstMigration",
|
|
36
|
+
fieldName: "astMigration",
|
|
37
37
|
document,
|
|
38
38
|
variables,
|
|
39
39
|
transform: (data) => ({
|
|
40
|
-
astMigration: data.astMigrations?.nodes?.[0] ?? null
|
|
41
|
-
})
|
|
40
|
+
"astMigration": data.astMigrations?.nodes?.[0] ?? null
|
|
41
|
+
})
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
findOne(args) {
|
|
45
|
-
const { document, variables } = buildFindManyDocument(
|
|
45
|
+
const { document, variables } = buildFindManyDocument("AstMigration", "astMigrations", args.select, {
|
|
46
46
|
where: {
|
|
47
47
|
id: {
|
|
48
|
-
equalTo: args.id
|
|
49
|
-
}
|
|
48
|
+
equalTo: args.id
|
|
49
|
+
}
|
|
50
50
|
},
|
|
51
|
-
first: 1
|
|
52
|
-
},
|
|
51
|
+
first: 1
|
|
52
|
+
}, "AstMigrationFilter", "AstMigrationOrderBy", connectionFieldsMap);
|
|
53
53
|
return new QueryBuilder({
|
|
54
54
|
client: this.client,
|
|
55
|
-
operation:
|
|
56
|
-
operationName:
|
|
57
|
-
fieldName:
|
|
55
|
+
operation: "query",
|
|
56
|
+
operationName: "AstMigration",
|
|
57
|
+
fieldName: "astMigration",
|
|
58
58
|
document,
|
|
59
59
|
variables,
|
|
60
60
|
transform: (data) => ({
|
|
61
|
-
astMigration: data.astMigrations?.nodes?.[0] ?? null
|
|
62
|
-
})
|
|
61
|
+
"astMigration": data.astMigrations?.nodes?.[0] ?? null
|
|
62
|
+
})
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
create(args) {
|
|
66
|
-
const { document, variables } = buildCreateDocument(
|
|
66
|
+
const { document, variables } = buildCreateDocument("AstMigration", "createAstMigration", "astMigration", args.select, args.data, "CreateAstMigrationInput", connectionFieldsMap);
|
|
67
67
|
return new QueryBuilder({
|
|
68
68
|
client: this.client,
|
|
69
|
-
operation:
|
|
70
|
-
operationName:
|
|
71
|
-
fieldName:
|
|
69
|
+
operation: "mutation",
|
|
70
|
+
operationName: "AstMigration",
|
|
71
|
+
fieldName: "createAstMigration",
|
|
72
72
|
document,
|
|
73
|
-
variables
|
|
73
|
+
variables
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
export { AstMigrationModel } from
|
|
7
|
-
export { SqlActionModel } from
|
|
6
|
+
export { AstMigrationModel } from "./astMigration";
|
|
7
|
+
export { SqlActionModel } from "./sqlAction";
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
export { AstMigrationModel } from
|
|
7
|
-
export { SqlActionModel } from
|
|
6
|
+
export { AstMigrationModel } from "./astMigration";
|
|
7
|
+
export { SqlActionModel } from "./sqlAction";
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
import { OrmClient } from
|
|
7
|
-
import { QueryBuilder } from
|
|
8
|
-
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from
|
|
9
|
-
import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActionOrderBy, CreateSqlActionInput } from
|
|
6
|
+
import { OrmClient } from "../client";
|
|
7
|
+
import { QueryBuilder } from "../query-builder";
|
|
8
|
+
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from "../select-types";
|
|
9
|
+
import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActionOrderBy, CreateSqlActionInput } from "../input-types";
|
|
10
10
|
export declare class SqlActionModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
@@ -26,7 +26,7 @@ export declare class SqlActionModel {
|
|
|
26
26
|
} & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
|
|
27
27
|
sqlAction: InferSelectResult<SqlActionWithRelations, S> | null;
|
|
28
28
|
}>;
|
|
29
|
-
create<S extends SqlActionSelect>(args: CreateArgs<S, CreateSqlActionInput[
|
|
29
|
+
create<S extends SqlActionSelect>(args: CreateArgs<S, CreateSqlActionInput["sqlAction"]> & {
|
|
30
30
|
select: S;
|
|
31
31
|
} & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
|
|
32
32
|
createSqlAction: {
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument
|
|
2
|
-
import { connectionFieldsMap } from
|
|
1
|
+
import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument } from "../query-builder";
|
|
2
|
+
import { connectionFieldsMap } from "../input-types";
|
|
3
3
|
export class SqlActionModel {
|
|
4
4
|
client;
|
|
5
5
|
constructor(client) {
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
findMany(args) {
|
|
9
|
-
const { document, variables } = buildFindManyDocument(
|
|
9
|
+
const { document, variables } = buildFindManyDocument("SqlAction", "sqlActions", args.select, {
|
|
10
10
|
where: args?.where,
|
|
11
11
|
orderBy: args?.orderBy,
|
|
12
12
|
first: args?.first,
|
|
13
13
|
last: args?.last,
|
|
14
14
|
after: args?.after,
|
|
15
15
|
before: args?.before,
|
|
16
|
-
offset: args?.offset
|
|
17
|
-
},
|
|
16
|
+
offset: args?.offset
|
|
17
|
+
}, "SqlActionFilter", "SqlActionOrderBy", connectionFieldsMap);
|
|
18
18
|
return new QueryBuilder({
|
|
19
19
|
client: this.client,
|
|
20
|
-
operation:
|
|
21
|
-
operationName:
|
|
22
|
-
fieldName:
|
|
20
|
+
operation: "query",
|
|
21
|
+
operationName: "SqlAction",
|
|
22
|
+
fieldName: "sqlActions",
|
|
23
23
|
document,
|
|
24
|
-
variables
|
|
24
|
+
variables
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
findFirst(args) {
|
|
28
|
-
const { document, variables } = buildFindFirstDocument(
|
|
28
|
+
const { document, variables } = buildFindFirstDocument("SqlAction", "sqlActions", args.select, {
|
|
29
29
|
where: args?.where,
|
|
30
|
-
orderBy: args?.orderBy
|
|
31
|
-
},
|
|
30
|
+
orderBy: args?.orderBy
|
|
31
|
+
}, "SqlActionFilter", "SqlActionOrderBy", connectionFieldsMap);
|
|
32
32
|
return new QueryBuilder({
|
|
33
33
|
client: this.client,
|
|
34
|
-
operation:
|
|
35
|
-
operationName:
|
|
36
|
-
fieldName:
|
|
34
|
+
operation: "query",
|
|
35
|
+
operationName: "SqlAction",
|
|
36
|
+
fieldName: "sqlAction",
|
|
37
37
|
document,
|
|
38
38
|
variables,
|
|
39
39
|
transform: (data) => ({
|
|
40
|
-
sqlAction: data.sqlActions?.nodes?.[0] ?? null
|
|
41
|
-
})
|
|
40
|
+
"sqlAction": data.sqlActions?.nodes?.[0] ?? null
|
|
41
|
+
})
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
findOne(args) {
|
|
45
|
-
const { document, variables } = buildFindManyDocument(
|
|
45
|
+
const { document, variables } = buildFindManyDocument("SqlAction", "sqlActions", args.select, {
|
|
46
46
|
where: {
|
|
47
47
|
id: {
|
|
48
|
-
equalTo: args.id
|
|
49
|
-
}
|
|
48
|
+
equalTo: args.id
|
|
49
|
+
}
|
|
50
50
|
},
|
|
51
|
-
first: 1
|
|
52
|
-
},
|
|
51
|
+
first: 1
|
|
52
|
+
}, "SqlActionFilter", "SqlActionOrderBy", connectionFieldsMap);
|
|
53
53
|
return new QueryBuilder({
|
|
54
54
|
client: this.client,
|
|
55
|
-
operation:
|
|
56
|
-
operationName:
|
|
57
|
-
fieldName:
|
|
55
|
+
operation: "query",
|
|
56
|
+
operationName: "SqlAction",
|
|
57
|
+
fieldName: "sqlAction",
|
|
58
58
|
document,
|
|
59
59
|
variables,
|
|
60
60
|
transform: (data) => ({
|
|
61
|
-
sqlAction: data.sqlActions?.nodes?.[0] ?? null
|
|
62
|
-
})
|
|
61
|
+
"sqlAction": data.sqlActions?.nodes?.[0] ?? null
|
|
62
|
+
})
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
create(args) {
|
|
66
|
-
const { document, variables } = buildCreateDocument(
|
|
66
|
+
const { document, variables } = buildCreateDocument("SqlAction", "createSqlAction", "sqlAction", args.select, args.data, "CreateSqlActionInput", connectionFieldsMap);
|
|
67
67
|
return new QueryBuilder({
|
|
68
68
|
client: this.client,
|
|
69
|
-
operation:
|
|
70
|
-
operationName:
|
|
71
|
-
fieldName:
|
|
69
|
+
operation: "mutation",
|
|
70
|
+
operationName: "SqlAction",
|
|
71
|
+
fieldName: "createSqlAction",
|
|
72
72
|
document,
|
|
73
|
-
variables
|
|
73
|
+
variables
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
import { OrmClient } from
|
|
7
|
-
import { QueryBuilder } from
|
|
8
|
-
import type { InferSelectResult, StrictSelect } from
|
|
9
|
-
import type { ProvisionBucketInput, ProvisionBucketPayload, ProvisionBucketPayloadSelect } from
|
|
6
|
+
import { OrmClient } from "../client";
|
|
7
|
+
import { QueryBuilder } from "../query-builder";
|
|
8
|
+
import type { InferSelectResult, StrictSelect } from "../select-types";
|
|
9
|
+
import type { ProvisionBucketInput, ProvisionBucketPayload, ProvisionBucketPayloadSelect } from "../input-types";
|
|
10
10
|
/**
|
|
11
11
|
* Variables for provisionBucket
|
|
12
12
|
* Provision an S3 bucket for a logical bucket in the database.
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { QueryBuilder, buildCustomDocument } from
|
|
2
|
-
import { connectionFieldsMap } from
|
|
1
|
+
import { QueryBuilder, buildCustomDocument } from "../query-builder";
|
|
2
|
+
import { connectionFieldsMap } from "../input-types";
|
|
3
3
|
export function createMutationOperations(client) {
|
|
4
4
|
return {
|
|
5
5
|
provisionBucket: (args, options) => new QueryBuilder({
|
|
6
6
|
client,
|
|
7
|
-
operation:
|
|
8
|
-
operationName:
|
|
9
|
-
fieldName:
|
|
10
|
-
...buildCustomDocument(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
], connectionFieldsMap, 'ProvisionBucketPayload'),
|
|
16
|
-
}),
|
|
7
|
+
operation: "mutation",
|
|
8
|
+
operationName: "ProvisionBucket",
|
|
9
|
+
fieldName: "provisionBucket",
|
|
10
|
+
...buildCustomDocument("mutation", "ProvisionBucket", "provisionBucket", options.select, args, [{
|
|
11
|
+
name: "input",
|
|
12
|
+
type: "ProvisionBucketInput!"
|
|
13
|
+
}], connectionFieldsMap, "ProvisionBucketPayload")
|
|
14
|
+
})
|
|
17
15
|
};
|
|
18
16
|
}
|
|
@@ -78,7 +78,9 @@ export function buildSelections(select, connectionFieldsMap, entityType) {
|
|
|
78
78
|
return [];
|
|
79
79
|
}
|
|
80
80
|
const fields = [];
|
|
81
|
-
const entityConnections = entityType
|
|
81
|
+
const entityConnections = entityType
|
|
82
|
+
? connectionFieldsMap?.[entityType]
|
|
83
|
+
: undefined;
|
|
82
84
|
for (const [key, value] of Object.entries(select)) {
|
|
83
85
|
if (value === false || value === undefined) {
|
|
84
86
|
continue;
|
|
@@ -182,7 +184,9 @@ export function buildFindManyDocument(operationName, queryField, select, args, f
|
|
|
182
184
|
t.operationDefinition({
|
|
183
185
|
operation: OP_QUERY,
|
|
184
186
|
name: operationName + 'Query',
|
|
185
|
-
variableDefinitions: variableDefinitions.length
|
|
187
|
+
variableDefinitions: variableDefinitions.length
|
|
188
|
+
? variableDefinitions
|
|
189
|
+
: undefined,
|
|
186
190
|
selectionSet: t.selectionSet({
|
|
187
191
|
selections: [
|
|
188
192
|
t.field({
|
|
@@ -433,7 +437,9 @@ export function buildCustomDocument(operationType, operationName, fieldName, sel
|
|
|
433
437
|
name: definition.name,
|
|
434
438
|
value: t.variable({ name: definition.name }),
|
|
435
439
|
}));
|
|
436
|
-
const fieldSelections = isConnection
|
|
440
|
+
const fieldSelections = isConnection
|
|
441
|
+
? buildConnectionSelections(selections)
|
|
442
|
+
: selections;
|
|
437
443
|
const document = t.document({
|
|
438
444
|
definitions: [
|
|
439
445
|
t.operationDefinition({
|
|
@@ -471,7 +477,9 @@ function isCustomSelectionWrapper(value) {
|
|
|
471
477
|
if (keys.some((key) => key !== 'select' && key !== 'connection')) {
|
|
472
478
|
return false;
|
|
473
479
|
}
|
|
474
|
-
return !!record.select &&
|
|
480
|
+
return (!!record.select &&
|
|
481
|
+
typeof record.select === 'object' &&
|
|
482
|
+
!Array.isArray(record.select));
|
|
475
483
|
}
|
|
476
484
|
// ============================================================================
|
|
477
485
|
// Helper Functions
|
|
@@ -483,7 +491,9 @@ function buildOptionalArg(name, value) {
|
|
|
483
491
|
if (value === undefined) {
|
|
484
492
|
return null;
|
|
485
493
|
}
|
|
486
|
-
const valueNode = typeof value === 'number'
|
|
494
|
+
const valueNode = typeof value === 'number'
|
|
495
|
+
? t.intValue({ value: value.toString() })
|
|
496
|
+
: t.stringValue({ value });
|
|
487
497
|
return t.argument({ name, value: valueNode });
|
|
488
498
|
}
|
|
489
499
|
function buildEnumListArg(name, values) {
|
package/migrate/index.d.ts
CHANGED
package/migrate/orm/client.js
CHANGED
|
@@ -39,7 +39,9 @@ class FetchAdapter {
|
|
|
39
39
|
return {
|
|
40
40
|
ok: false,
|
|
41
41
|
data: null,
|
|
42
|
-
errors: [
|
|
42
|
+
errors: [
|
|
43
|
+
{ message: `HTTP ${response.status}: ${response.statusText}` },
|
|
44
|
+
],
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
const json = (await response.json());
|
package/migrate/orm/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { OrmClientConfig } from
|
|
2
|
-
import { AstMigrationModel } from
|
|
3
|
-
import { SqlActionModel } from
|
|
4
|
-
export type { OrmClientConfig, QueryResult, GraphQLError, GraphQLAdapter } from
|
|
5
|
-
export { GraphQLRequestError, FetchAdapter } from
|
|
6
|
-
export { QueryBuilder } from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export { createMutationOperations } from
|
|
1
|
+
import type { OrmClientConfig } from "./client";
|
|
2
|
+
import { AstMigrationModel } from "./models/astMigration";
|
|
3
|
+
import { SqlActionModel } from "./models/sqlAction";
|
|
4
|
+
export type { OrmClientConfig, QueryResult, GraphQLError, GraphQLAdapter } from "./client";
|
|
5
|
+
export { GraphQLRequestError, FetchAdapter } from "./client";
|
|
6
|
+
export { QueryBuilder } from "./query-builder";
|
|
7
|
+
export * from "./select-types";
|
|
8
|
+
export * from "./models";
|
|
9
|
+
export { createMutationOperations } from "./mutation";
|
|
10
10
|
/**
|
|
11
11
|
* Create an ORM client instance
|
|
12
12
|
*
|
package/migrate/orm/index.js
CHANGED
|
@@ -62,6 +62,6 @@ function createClient(config) {
|
|
|
62
62
|
return {
|
|
63
63
|
astMigration: new astMigration_1.AstMigrationModel(client),
|
|
64
64
|
sqlAction: new sqlAction_1.SqlActionModel(client),
|
|
65
|
-
mutation: (0, mutation_1.createMutationOperations)(client)
|
|
65
|
+
mutation: (0, mutation_1.createMutationOperations)(client)
|
|
66
66
|
};
|
|
67
67
|
}
|
|
@@ -248,7 +248,6 @@ export interface SqlAction {
|
|
|
248
248
|
actionId?: string | null;
|
|
249
249
|
actionName?: string | null;
|
|
250
250
|
actorId?: string | null;
|
|
251
|
-
category?: string | null;
|
|
252
251
|
content?: string | null;
|
|
253
252
|
createdAt?: string | null;
|
|
254
253
|
databaseId?: string | null;
|
|
@@ -296,7 +295,6 @@ export type SqlActionSelect = {
|
|
|
296
295
|
actionId?: boolean;
|
|
297
296
|
actionName?: boolean;
|
|
298
297
|
actorId?: boolean;
|
|
299
|
-
category?: boolean;
|
|
300
298
|
content?: boolean;
|
|
301
299
|
createdAt?: boolean;
|
|
302
300
|
databaseId?: boolean;
|
|
@@ -351,8 +349,6 @@ export interface SqlActionFilter {
|
|
|
351
349
|
actorId?: UUIDFilter;
|
|
352
350
|
/** Checks for all expressions in this list. */
|
|
353
351
|
and?: SqlActionFilter[];
|
|
354
|
-
/** Filter by the object’s `category` field. */
|
|
355
|
-
category?: StringFilter;
|
|
356
352
|
/** Filter by the object’s `content` field. */
|
|
357
353
|
content?: StringFilter;
|
|
358
354
|
/** Filter by the object’s `createdAt` field. */
|
|
@@ -376,8 +372,8 @@ export interface SqlActionFilter {
|
|
|
376
372
|
/** Filter by the object’s `verify` field. */
|
|
377
373
|
verify?: StringFilter;
|
|
378
374
|
}
|
|
379
|
-
export type AstMigrationOrderBy =
|
|
380
|
-
export type SqlActionOrderBy =
|
|
375
|
+
export type AstMigrationOrderBy = "ACTION_ID_ASC" | "ACTION_ID_DESC" | "ACTION_NAME_ASC" | "ACTION_NAME_DESC" | "ACTOR_ID_ASC" | "ACTOR_ID_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "DATABASE_ID_ASC" | "DATABASE_ID_DESC" | "DEPLOYS_ASC" | "DEPLOYS_DESC" | "DEPLOY_ASC" | "DEPLOY_DESC" | "ID_ASC" | "ID_DESC" | "NAME_ASC" | "NAME_DESC" | "NATURAL" | "PAYLOAD_ASC" | "PAYLOAD_DESC" | "REQUIRES_ASC" | "REQUIRES_DESC" | "REVERT_ASC" | "REVERT_DESC" | "VERIFY_ASC" | "VERIFY_DESC";
|
|
376
|
+
export type SqlActionOrderBy = "ACTION_ID_ASC" | "ACTION_ID_DESC" | "ACTION_NAME_ASC" | "ACTION_NAME_DESC" | "ACTOR_ID_ASC" | "ACTOR_ID_DESC" | "CONTENT_ASC" | "CONTENT_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "DATABASE_ID_ASC" | "DATABASE_ID_DESC" | "DEPLOY_ASC" | "DEPLOY_DESC" | "DEPS_ASC" | "DEPS_DESC" | "ID_ASC" | "ID_DESC" | "NAME_ASC" | "NAME_DESC" | "NATURAL" | "PAYLOAD_ASC" | "PAYLOAD_DESC" | "REVERT_ASC" | "REVERT_DESC" | "VERIFY_ASC" | "VERIFY_DESC";
|
|
381
377
|
export interface CreateAstMigrationInput {
|
|
382
378
|
clientMutationId?: string;
|
|
383
379
|
astMigration: {
|
|
@@ -422,7 +418,6 @@ export interface CreateSqlActionInput {
|
|
|
422
418
|
actionId: string;
|
|
423
419
|
actionName?: string;
|
|
424
420
|
actorId: string;
|
|
425
|
-
category?: string;
|
|
426
421
|
content?: string;
|
|
427
422
|
databaseId: string;
|
|
428
423
|
deploy?: string;
|
|
@@ -437,7 +432,6 @@ export interface SqlActionPatch {
|
|
|
437
432
|
actionId?: string | null;
|
|
438
433
|
actionName?: string | null;
|
|
439
434
|
actorId?: string | null;
|
|
440
|
-
category?: string | null;
|
|
441
435
|
content?: string | null;
|
|
442
436
|
databaseId?: string | null;
|
|
443
437
|
deploy?: string | null;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
import { OrmClient } from
|
|
7
|
-
import { QueryBuilder } from
|
|
8
|
-
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from
|
|
9
|
-
import type { AstMigrationWithRelations, AstMigrationSelect, AstMigrationFilter, AstMigrationOrderBy, CreateAstMigrationInput } from
|
|
6
|
+
import { OrmClient } from "../client";
|
|
7
|
+
import { QueryBuilder } from "../query-builder";
|
|
8
|
+
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from "../select-types";
|
|
9
|
+
import type { AstMigrationWithRelations, AstMigrationSelect, AstMigrationFilter, AstMigrationOrderBy, CreateAstMigrationInput } from "../input-types";
|
|
10
10
|
export declare class AstMigrationModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
@@ -26,7 +26,7 @@ export declare class AstMigrationModel {
|
|
|
26
26
|
} & StrictSelect<S, AstMigrationSelect>): QueryBuilder<{
|
|
27
27
|
astMigration: InferSelectResult<AstMigrationWithRelations, S> | null;
|
|
28
28
|
}>;
|
|
29
|
-
create<S extends AstMigrationSelect>(args: CreateArgs<S, CreateAstMigrationInput[
|
|
29
|
+
create<S extends AstMigrationSelect>(args: CreateArgs<S, CreateAstMigrationInput["astMigration"]> & {
|
|
30
30
|
select: S;
|
|
31
31
|
} & StrictSelect<S, AstMigrationSelect>): QueryBuilder<{
|
|
32
32
|
createAstMigration: {
|
|
@@ -9,71 +9,71 @@ class AstMigrationModel {
|
|
|
9
9
|
this.client = client;
|
|
10
10
|
}
|
|
11
11
|
findMany(args) {
|
|
12
|
-
const { document, variables } = (0, query_builder_1.buildFindManyDocument)(
|
|
12
|
+
const { document, variables } = (0, query_builder_1.buildFindManyDocument)("AstMigration", "astMigrations", args.select, {
|
|
13
13
|
where: args?.where,
|
|
14
14
|
orderBy: args?.orderBy,
|
|
15
15
|
first: args?.first,
|
|
16
16
|
last: args?.last,
|
|
17
17
|
after: args?.after,
|
|
18
18
|
before: args?.before,
|
|
19
|
-
offset: args?.offset
|
|
20
|
-
},
|
|
19
|
+
offset: args?.offset
|
|
20
|
+
}, "AstMigrationFilter", "AstMigrationOrderBy", input_types_1.connectionFieldsMap);
|
|
21
21
|
return new query_builder_1.QueryBuilder({
|
|
22
22
|
client: this.client,
|
|
23
|
-
operation:
|
|
24
|
-
operationName:
|
|
25
|
-
fieldName:
|
|
23
|
+
operation: "query",
|
|
24
|
+
operationName: "AstMigration",
|
|
25
|
+
fieldName: "astMigrations",
|
|
26
26
|
document,
|
|
27
|
-
variables
|
|
27
|
+
variables
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
findFirst(args) {
|
|
31
|
-
const { document, variables } = (0, query_builder_1.buildFindFirstDocument)(
|
|
31
|
+
const { document, variables } = (0, query_builder_1.buildFindFirstDocument)("AstMigration", "astMigrations", args.select, {
|
|
32
32
|
where: args?.where,
|
|
33
|
-
orderBy: args?.orderBy
|
|
34
|
-
},
|
|
33
|
+
orderBy: args?.orderBy
|
|
34
|
+
}, "AstMigrationFilter", "AstMigrationOrderBy", input_types_1.connectionFieldsMap);
|
|
35
35
|
return new query_builder_1.QueryBuilder({
|
|
36
36
|
client: this.client,
|
|
37
|
-
operation:
|
|
38
|
-
operationName:
|
|
39
|
-
fieldName:
|
|
37
|
+
operation: "query",
|
|
38
|
+
operationName: "AstMigration",
|
|
39
|
+
fieldName: "astMigration",
|
|
40
40
|
document,
|
|
41
41
|
variables,
|
|
42
42
|
transform: (data) => ({
|
|
43
|
-
astMigration: data.astMigrations?.nodes?.[0] ?? null
|
|
44
|
-
})
|
|
43
|
+
"astMigration": data.astMigrations?.nodes?.[0] ?? null
|
|
44
|
+
})
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
findOne(args) {
|
|
48
|
-
const { document, variables } = (0, query_builder_1.buildFindManyDocument)(
|
|
48
|
+
const { document, variables } = (0, query_builder_1.buildFindManyDocument)("AstMigration", "astMigrations", args.select, {
|
|
49
49
|
where: {
|
|
50
50
|
id: {
|
|
51
|
-
equalTo: args.id
|
|
52
|
-
}
|
|
51
|
+
equalTo: args.id
|
|
52
|
+
}
|
|
53
53
|
},
|
|
54
|
-
first: 1
|
|
55
|
-
},
|
|
54
|
+
first: 1
|
|
55
|
+
}, "AstMigrationFilter", "AstMigrationOrderBy", input_types_1.connectionFieldsMap);
|
|
56
56
|
return new query_builder_1.QueryBuilder({
|
|
57
57
|
client: this.client,
|
|
58
|
-
operation:
|
|
59
|
-
operationName:
|
|
60
|
-
fieldName:
|
|
58
|
+
operation: "query",
|
|
59
|
+
operationName: "AstMigration",
|
|
60
|
+
fieldName: "astMigration",
|
|
61
61
|
document,
|
|
62
62
|
variables,
|
|
63
63
|
transform: (data) => ({
|
|
64
|
-
astMigration: data.astMigrations?.nodes?.[0] ?? null
|
|
65
|
-
})
|
|
64
|
+
"astMigration": data.astMigrations?.nodes?.[0] ?? null
|
|
65
|
+
})
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
create(args) {
|
|
69
|
-
const { document, variables } = (0, query_builder_1.buildCreateDocument)(
|
|
69
|
+
const { document, variables } = (0, query_builder_1.buildCreateDocument)("AstMigration", "createAstMigration", "astMigration", args.select, args.data, "CreateAstMigrationInput", input_types_1.connectionFieldsMap);
|
|
70
70
|
return new query_builder_1.QueryBuilder({
|
|
71
71
|
client: this.client,
|
|
72
|
-
operation:
|
|
73
|
-
operationName:
|
|
74
|
-
fieldName:
|
|
72
|
+
operation: "mutation",
|
|
73
|
+
operationName: "AstMigration",
|
|
74
|
+
fieldName: "createAstMigration",
|
|
75
75
|
document,
|
|
76
|
-
variables
|
|
76
|
+
variables
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
export { AstMigrationModel } from
|
|
7
|
-
export { SqlActionModel } from
|
|
6
|
+
export { AstMigrationModel } from "./astMigration";
|
|
7
|
+
export { SqlActionModel } from "./sqlAction";
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
import { OrmClient } from
|
|
7
|
-
import { QueryBuilder } from
|
|
8
|
-
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from
|
|
9
|
-
import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActionOrderBy, CreateSqlActionInput } from
|
|
6
|
+
import { OrmClient } from "../client";
|
|
7
|
+
import { QueryBuilder } from "../query-builder";
|
|
8
|
+
import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, InferSelectResult, StrictSelect } from "../select-types";
|
|
9
|
+
import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActionOrderBy, CreateSqlActionInput } from "../input-types";
|
|
10
10
|
export declare class SqlActionModel {
|
|
11
11
|
private client;
|
|
12
12
|
constructor(client: OrmClient);
|
|
@@ -26,7 +26,7 @@ export declare class SqlActionModel {
|
|
|
26
26
|
} & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
|
|
27
27
|
sqlAction: InferSelectResult<SqlActionWithRelations, S> | null;
|
|
28
28
|
}>;
|
|
29
|
-
create<S extends SqlActionSelect>(args: CreateArgs<S, CreateSqlActionInput[
|
|
29
|
+
create<S extends SqlActionSelect>(args: CreateArgs<S, CreateSqlActionInput["sqlAction"]> & {
|
|
30
30
|
select: S;
|
|
31
31
|
} & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
|
|
32
32
|
createSqlAction: {
|
|
@@ -9,71 +9,71 @@ class SqlActionModel {
|
|
|
9
9
|
this.client = client;
|
|
10
10
|
}
|
|
11
11
|
findMany(args) {
|
|
12
|
-
const { document, variables } = (0, query_builder_1.buildFindManyDocument)(
|
|
12
|
+
const { document, variables } = (0, query_builder_1.buildFindManyDocument)("SqlAction", "sqlActions", args.select, {
|
|
13
13
|
where: args?.where,
|
|
14
14
|
orderBy: args?.orderBy,
|
|
15
15
|
first: args?.first,
|
|
16
16
|
last: args?.last,
|
|
17
17
|
after: args?.after,
|
|
18
18
|
before: args?.before,
|
|
19
|
-
offset: args?.offset
|
|
20
|
-
},
|
|
19
|
+
offset: args?.offset
|
|
20
|
+
}, "SqlActionFilter", "SqlActionOrderBy", input_types_1.connectionFieldsMap);
|
|
21
21
|
return new query_builder_1.QueryBuilder({
|
|
22
22
|
client: this.client,
|
|
23
|
-
operation:
|
|
24
|
-
operationName:
|
|
25
|
-
fieldName:
|
|
23
|
+
operation: "query",
|
|
24
|
+
operationName: "SqlAction",
|
|
25
|
+
fieldName: "sqlActions",
|
|
26
26
|
document,
|
|
27
|
-
variables
|
|
27
|
+
variables
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
findFirst(args) {
|
|
31
|
-
const { document, variables } = (0, query_builder_1.buildFindFirstDocument)(
|
|
31
|
+
const { document, variables } = (0, query_builder_1.buildFindFirstDocument)("SqlAction", "sqlActions", args.select, {
|
|
32
32
|
where: args?.where,
|
|
33
|
-
orderBy: args?.orderBy
|
|
34
|
-
},
|
|
33
|
+
orderBy: args?.orderBy
|
|
34
|
+
}, "SqlActionFilter", "SqlActionOrderBy", input_types_1.connectionFieldsMap);
|
|
35
35
|
return new query_builder_1.QueryBuilder({
|
|
36
36
|
client: this.client,
|
|
37
|
-
operation:
|
|
38
|
-
operationName:
|
|
39
|
-
fieldName:
|
|
37
|
+
operation: "query",
|
|
38
|
+
operationName: "SqlAction",
|
|
39
|
+
fieldName: "sqlAction",
|
|
40
40
|
document,
|
|
41
41
|
variables,
|
|
42
42
|
transform: (data) => ({
|
|
43
|
-
sqlAction: data.sqlActions?.nodes?.[0] ?? null
|
|
44
|
-
})
|
|
43
|
+
"sqlAction": data.sqlActions?.nodes?.[0] ?? null
|
|
44
|
+
})
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
findOne(args) {
|
|
48
|
-
const { document, variables } = (0, query_builder_1.buildFindManyDocument)(
|
|
48
|
+
const { document, variables } = (0, query_builder_1.buildFindManyDocument)("SqlAction", "sqlActions", args.select, {
|
|
49
49
|
where: {
|
|
50
50
|
id: {
|
|
51
|
-
equalTo: args.id
|
|
52
|
-
}
|
|
51
|
+
equalTo: args.id
|
|
52
|
+
}
|
|
53
53
|
},
|
|
54
|
-
first: 1
|
|
55
|
-
},
|
|
54
|
+
first: 1
|
|
55
|
+
}, "SqlActionFilter", "SqlActionOrderBy", input_types_1.connectionFieldsMap);
|
|
56
56
|
return new query_builder_1.QueryBuilder({
|
|
57
57
|
client: this.client,
|
|
58
|
-
operation:
|
|
59
|
-
operationName:
|
|
60
|
-
fieldName:
|
|
58
|
+
operation: "query",
|
|
59
|
+
operationName: "SqlAction",
|
|
60
|
+
fieldName: "sqlAction",
|
|
61
61
|
document,
|
|
62
62
|
variables,
|
|
63
63
|
transform: (data) => ({
|
|
64
|
-
sqlAction: data.sqlActions?.nodes?.[0] ?? null
|
|
65
|
-
})
|
|
64
|
+
"sqlAction": data.sqlActions?.nodes?.[0] ?? null
|
|
65
|
+
})
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
create(args) {
|
|
69
|
-
const { document, variables } = (0, query_builder_1.buildCreateDocument)(
|
|
69
|
+
const { document, variables } = (0, query_builder_1.buildCreateDocument)("SqlAction", "createSqlAction", "sqlAction", args.select, args.data, "CreateSqlActionInput", input_types_1.connectionFieldsMap);
|
|
70
70
|
return new query_builder_1.QueryBuilder({
|
|
71
71
|
client: this.client,
|
|
72
|
-
operation:
|
|
73
|
-
operationName:
|
|
74
|
-
fieldName:
|
|
72
|
+
operation: "mutation",
|
|
73
|
+
operationName: "SqlAction",
|
|
74
|
+
fieldName: "createSqlAction",
|
|
75
75
|
document,
|
|
76
|
-
variables
|
|
76
|
+
variables
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @generated by @constructive-io/graphql-codegen
|
|
4
4
|
* DO NOT EDIT - changes will be overwritten
|
|
5
5
|
*/
|
|
6
|
-
import { OrmClient } from
|
|
7
|
-
import { QueryBuilder } from
|
|
8
|
-
import type { InferSelectResult, StrictSelect } from
|
|
9
|
-
import type { ProvisionBucketInput, ProvisionBucketPayload, ProvisionBucketPayloadSelect } from
|
|
6
|
+
import { OrmClient } from "../client";
|
|
7
|
+
import { QueryBuilder } from "../query-builder";
|
|
8
|
+
import type { InferSelectResult, StrictSelect } from "../select-types";
|
|
9
|
+
import type { ProvisionBucketInput, ProvisionBucketPayload, ProvisionBucketPayloadSelect } from "../input-types";
|
|
10
10
|
/**
|
|
11
11
|
* Variables for provisionBucket
|
|
12
12
|
* Provision an S3 bucket for a logical bucket in the database.
|
|
@@ -7,15 +7,13 @@ function createMutationOperations(client) {
|
|
|
7
7
|
return {
|
|
8
8
|
provisionBucket: (args, options) => new query_builder_1.QueryBuilder({
|
|
9
9
|
client,
|
|
10
|
-
operation:
|
|
11
|
-
operationName:
|
|
12
|
-
fieldName:
|
|
13
|
-
...(0, query_builder_1.buildCustomDocument)(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
], input_types_1.connectionFieldsMap, 'ProvisionBucketPayload'),
|
|
19
|
-
}),
|
|
10
|
+
operation: "mutation",
|
|
11
|
+
operationName: "ProvisionBucket",
|
|
12
|
+
fieldName: "provisionBucket",
|
|
13
|
+
...(0, query_builder_1.buildCustomDocument)("mutation", "ProvisionBucket", "provisionBucket", options.select, args, [{
|
|
14
|
+
name: "input",
|
|
15
|
+
type: "ProvisionBucketInput!"
|
|
16
|
+
}], input_types_1.connectionFieldsMap, "ProvisionBucketPayload")
|
|
17
|
+
})
|
|
20
18
|
};
|
|
21
19
|
}
|
|
@@ -130,7 +130,9 @@ function buildSelections(select, connectionFieldsMap, entityType) {
|
|
|
130
130
|
return [];
|
|
131
131
|
}
|
|
132
132
|
const fields = [];
|
|
133
|
-
const entityConnections = entityType
|
|
133
|
+
const entityConnections = entityType
|
|
134
|
+
? connectionFieldsMap?.[entityType]
|
|
135
|
+
: undefined;
|
|
134
136
|
for (const [key, value] of Object.entries(select)) {
|
|
135
137
|
if (value === false || value === undefined) {
|
|
136
138
|
continue;
|
|
@@ -234,7 +236,9 @@ function buildFindManyDocument(operationName, queryField, select, args, filterTy
|
|
|
234
236
|
t.operationDefinition({
|
|
235
237
|
operation: OP_QUERY,
|
|
236
238
|
name: operationName + 'Query',
|
|
237
|
-
variableDefinitions: variableDefinitions.length
|
|
239
|
+
variableDefinitions: variableDefinitions.length
|
|
240
|
+
? variableDefinitions
|
|
241
|
+
: undefined,
|
|
238
242
|
selectionSet: t.selectionSet({
|
|
239
243
|
selections: [
|
|
240
244
|
t.field({
|
|
@@ -485,7 +489,9 @@ function buildCustomDocument(operationType, operationName, fieldName, select, ar
|
|
|
485
489
|
name: definition.name,
|
|
486
490
|
value: t.variable({ name: definition.name }),
|
|
487
491
|
}));
|
|
488
|
-
const fieldSelections = isConnection
|
|
492
|
+
const fieldSelections = isConnection
|
|
493
|
+
? buildConnectionSelections(selections)
|
|
494
|
+
: selections;
|
|
489
495
|
const document = t.document({
|
|
490
496
|
definitions: [
|
|
491
497
|
t.operationDefinition({
|
|
@@ -523,7 +529,9 @@ function isCustomSelectionWrapper(value) {
|
|
|
523
529
|
if (keys.some((key) => key !== 'select' && key !== 'connection')) {
|
|
524
530
|
return false;
|
|
525
531
|
}
|
|
526
|
-
return !!record.select &&
|
|
532
|
+
return (!!record.select &&
|
|
533
|
+
typeof record.select === 'object' &&
|
|
534
|
+
!Array.isArray(record.select));
|
|
527
535
|
}
|
|
528
536
|
// ============================================================================
|
|
529
537
|
// Helper Functions
|
|
@@ -535,7 +543,9 @@ function buildOptionalArg(name, value) {
|
|
|
535
543
|
if (value === undefined) {
|
|
536
544
|
return null;
|
|
537
545
|
}
|
|
538
|
-
const valueNode = typeof value === 'number'
|
|
546
|
+
const valueNode = typeof value === 'number'
|
|
547
|
+
? t.intValue({ value: value.toString() })
|
|
548
|
+
: t.stringValue({ value });
|
|
539
549
|
return t.argument({ name, value: valueNode });
|
|
540
550
|
}
|
|
541
551
|
function buildEnumListArg(name, values) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpmjs/migrate-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
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",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@0no-co/graphql.web": "^1.1.2",
|
|
43
|
-
"@constructive-io/graphql-query": "^4.0.
|
|
44
|
-
"@constructive-io/graphql-types": "^3.
|
|
43
|
+
"@constructive-io/graphql-query": "^4.0.6",
|
|
44
|
+
"@constructive-io/graphql-types": "^3.16.1",
|
|
45
45
|
"gql-ast": "^3.13.0",
|
|
46
46
|
"graphql": "16.13.0"
|
|
47
47
|
},
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"makage": "^0.3.0",
|
|
51
51
|
"typescript": "^5.9.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "ebba3f838664032e6f6adf6c9c6d2b6cdddd994a"
|
|
54
54
|
}
|