@pgpmjs/migrate-client 1.21.32 → 1.21.34

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.
@@ -374,22 +374,6 @@ export interface SqlActionFilter {
374
374
  }
375
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
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';
377
- export interface CreateAstMigrationInput {
378
- clientMutationId?: string;
379
- astMigration: {
380
- actionId: string;
381
- actionName?: string;
382
- actorId: string;
383
- databaseId: string;
384
- deploy?: Record<string, unknown>;
385
- deploys?: string;
386
- name?: string;
387
- payload?: Record<string, unknown>;
388
- requires?: string[];
389
- revert?: Record<string, unknown>;
390
- verify?: Record<string, unknown>;
391
- };
392
- }
393
377
  export interface AstMigrationPatch {
394
378
  actionId?: string | null;
395
379
  actionName?: string | null;
@@ -412,22 +396,6 @@ export interface DeleteAstMigrationInput {
412
396
  clientMutationId?: string;
413
397
  id: number;
414
398
  }
415
- export interface CreateSqlActionInput {
416
- clientMutationId?: string;
417
- sqlAction: {
418
- actionId: string;
419
- actionName?: string;
420
- actorId: string;
421
- content?: string;
422
- databaseId: string;
423
- deploy?: string;
424
- deps?: string[];
425
- name?: string;
426
- payload?: Record<string, unknown>;
427
- revert?: string;
428
- verify?: string;
429
- };
430
- }
431
399
  export interface SqlActionPatch {
432
400
  actionId?: string | null;
433
401
  actionName?: string | null;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { OrmClient } from '../client';
7
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';
8
+ import type { ConnectionResult, FindManyArgs, FindFirstArgs, InferSelectResult, StrictSelect } from '../select-types';
9
+ import type { AstMigrationWithRelations, AstMigrationSelect, AstMigrationFilter, AstMigrationOrderBy } from '../input-types';
10
10
  export declare class AstMigrationModel {
11
11
  private client;
12
12
  constructor(client: OrmClient);
@@ -26,11 +26,4 @@ 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['astMigration']> & {
30
- select: S;
31
- } & StrictSelect<S, AstMigrationSelect>): QueryBuilder<{
32
- createAstMigration: {
33
- astMigration: InferSelectResult<AstMigrationWithRelations, S>;
34
- };
35
- }>;
36
29
  }
@@ -1,4 +1,4 @@
1
- import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, } from '../query-builder';
1
+ import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, } from '../query-builder';
2
2
  import { connectionFieldsMap } from '../input-types';
3
3
  export class AstMigrationModel {
4
4
  client;
@@ -62,15 +62,4 @@ export class AstMigrationModel {
62
62
  }),
63
63
  });
64
64
  }
65
- create(args) {
66
- const { document, variables } = buildCreateDocument('AstMigration', 'createAstMigration', 'astMigration', args.select, args.data, 'CreateAstMigrationInput', connectionFieldsMap);
67
- return new QueryBuilder({
68
- client: this.client,
69
- operation: 'mutation',
70
- operationName: 'AstMigration',
71
- fieldName: 'createAstMigration',
72
- document,
73
- variables,
74
- });
75
- }
76
65
  }
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { OrmClient } from '../client';
7
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';
8
+ import type { ConnectionResult, FindManyArgs, FindFirstArgs, InferSelectResult, StrictSelect } from '../select-types';
9
+ import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActionOrderBy } from '../input-types';
10
10
  export declare class SqlActionModel {
11
11
  private client;
12
12
  constructor(client: OrmClient);
@@ -26,11 +26,4 @@ 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['sqlAction']> & {
30
- select: S;
31
- } & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
32
- createSqlAction: {
33
- sqlAction: InferSelectResult<SqlActionWithRelations, S>;
34
- };
35
- }>;
36
29
  }
@@ -1,4 +1,4 @@
1
- import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, } from '../query-builder';
1
+ import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, } from '../query-builder';
2
2
  import { connectionFieldsMap } from '../input-types';
3
3
  export class SqlActionModel {
4
4
  client;
@@ -62,15 +62,4 @@ export class SqlActionModel {
62
62
  }),
63
63
  });
64
64
  }
65
- create(args) {
66
- const { document, variables } = buildCreateDocument('SqlAction', 'createSqlAction', 'sqlAction', args.select, args.data, 'CreateSqlActionInput', connectionFieldsMap);
67
- return new QueryBuilder({
68
- client: this.client,
69
- operation: 'mutation',
70
- operationName: 'SqlAction',
71
- fieldName: 'createSqlAction',
72
- document,
73
- variables,
74
- });
75
- }
76
65
  }
@@ -94,9 +94,7 @@ export function buildSelections(select, connectionFieldsMap, entityType) {
94
94
  const fieldArgs = Object.entries(nested.args).map(([argName, argValue]) => t.argument({ name: argName, value: buildValueAst(argValue) }));
95
95
  const nestedSelect = nested.select;
96
96
  if (nestedSelect && typeof nestedSelect === 'object') {
97
- const subSelections = Object.entries(nestedSelect)
98
- .filter(([, v]) => v)
99
- .map(([name]) => t.field({ name }));
97
+ const subSelections = buildSelections(nestedSelect, connectionFieldsMap);
100
98
  fields.push(t.field({
101
99
  name: key,
102
100
  args: fieldArgs.length ? fieldArgs : undefined,
@@ -120,6 +120,6 @@ export type HookStrictSelect<S, Shape> = S extends DeepExact<S, Shape, 5> ? {} :
120
120
  export type InferSelectResult<TEntity, TSelect> = TSelect extends undefined ? TEntity : {
121
121
  [K in keyof TSelect as TSelect[K] extends false | undefined ? never : K]: TSelect[K] extends true ? K extends keyof TEntity ? TEntity[K] : never : TSelect[K] extends {
122
122
  select: infer NestedSelect;
123
- } ? K extends keyof TEntity ? NonNullable<TEntity[K]> extends ConnectionResult<infer NodeType> ? ConnectionResult<InferSelectResult<NodeType, NestedSelect>> : InferSelectResult<NonNullable<TEntity[K]>, NestedSelect> | (null extends TEntity[K] ? null : never) : never : K extends keyof TEntity ? TEntity[K] : never;
123
+ } ? K extends keyof TEntity ? NonNullable<TEntity[K]> extends ConnectionResult<infer NodeType> ? ConnectionResult<InferSelectResult<NodeType, NestedSelect>> : NonNullable<TEntity[K]> extends readonly (infer Item)[] ? InferSelectResult<NonNullable<Item>, NestedSelect>[] | (null extends TEntity[K] ? null : never) : InferSelectResult<NonNullable<TEntity[K]>, NestedSelect> | (null extends TEntity[K] ? null : never) : never : K extends keyof TEntity ? TEntity[K] : never;
124
124
  };
125
125
  export {};
@@ -374,22 +374,6 @@ export interface SqlActionFilter {
374
374
  }
375
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
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';
377
- export interface CreateAstMigrationInput {
378
- clientMutationId?: string;
379
- astMigration: {
380
- actionId: string;
381
- actionName?: string;
382
- actorId: string;
383
- databaseId: string;
384
- deploy?: Record<string, unknown>;
385
- deploys?: string;
386
- name?: string;
387
- payload?: Record<string, unknown>;
388
- requires?: string[];
389
- revert?: Record<string, unknown>;
390
- verify?: Record<string, unknown>;
391
- };
392
- }
393
377
  export interface AstMigrationPatch {
394
378
  actionId?: string | null;
395
379
  actionName?: string | null;
@@ -412,22 +396,6 @@ export interface DeleteAstMigrationInput {
412
396
  clientMutationId?: string;
413
397
  id: number;
414
398
  }
415
- export interface CreateSqlActionInput {
416
- clientMutationId?: string;
417
- sqlAction: {
418
- actionId: string;
419
- actionName?: string;
420
- actorId: string;
421
- content?: string;
422
- databaseId: string;
423
- deploy?: string;
424
- deps?: string[];
425
- name?: string;
426
- payload?: Record<string, unknown>;
427
- revert?: string;
428
- verify?: string;
429
- };
430
- }
431
399
  export interface SqlActionPatch {
432
400
  actionId?: string | null;
433
401
  actionName?: string | null;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { OrmClient } from '../client';
7
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';
8
+ import type { ConnectionResult, FindManyArgs, FindFirstArgs, InferSelectResult, StrictSelect } from '../select-types';
9
+ import type { AstMigrationWithRelations, AstMigrationSelect, AstMigrationFilter, AstMigrationOrderBy } from '../input-types';
10
10
  export declare class AstMigrationModel {
11
11
  private client;
12
12
  constructor(client: OrmClient);
@@ -26,11 +26,4 @@ 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['astMigration']> & {
30
- select: S;
31
- } & StrictSelect<S, AstMigrationSelect>): QueryBuilder<{
32
- createAstMigration: {
33
- astMigration: InferSelectResult<AstMigrationWithRelations, S>;
34
- };
35
- }>;
36
29
  }
@@ -65,16 +65,5 @@ class AstMigrationModel {
65
65
  }),
66
66
  });
67
67
  }
68
- create(args) {
69
- const { document, variables } = (0, query_builder_1.buildCreateDocument)('AstMigration', 'createAstMigration', 'astMigration', args.select, args.data, 'CreateAstMigrationInput', input_types_1.connectionFieldsMap);
70
- return new query_builder_1.QueryBuilder({
71
- client: this.client,
72
- operation: 'mutation',
73
- operationName: 'AstMigration',
74
- fieldName: 'createAstMigration',
75
- document,
76
- variables,
77
- });
78
- }
79
68
  }
80
69
  exports.AstMigrationModel = AstMigrationModel;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { OrmClient } from '../client';
7
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';
8
+ import type { ConnectionResult, FindManyArgs, FindFirstArgs, InferSelectResult, StrictSelect } from '../select-types';
9
+ import type { SqlActionWithRelations, SqlActionSelect, SqlActionFilter, SqlActionOrderBy } from '../input-types';
10
10
  export declare class SqlActionModel {
11
11
  private client;
12
12
  constructor(client: OrmClient);
@@ -26,11 +26,4 @@ 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['sqlAction']> & {
30
- select: S;
31
- } & StrictSelect<S, SqlActionSelect>): QueryBuilder<{
32
- createSqlAction: {
33
- sqlAction: InferSelectResult<SqlActionWithRelations, S>;
34
- };
35
- }>;
36
29
  }
@@ -65,16 +65,5 @@ class SqlActionModel {
65
65
  }),
66
66
  });
67
67
  }
68
- create(args) {
69
- const { document, variables } = (0, query_builder_1.buildCreateDocument)('SqlAction', 'createSqlAction', 'sqlAction', args.select, args.data, 'CreateSqlActionInput', input_types_1.connectionFieldsMap);
70
- return new query_builder_1.QueryBuilder({
71
- client: this.client,
72
- operation: 'mutation',
73
- operationName: 'SqlAction',
74
- fieldName: 'createSqlAction',
75
- document,
76
- variables,
77
- });
78
- }
79
68
  }
80
69
  exports.SqlActionModel = SqlActionModel;
@@ -146,9 +146,7 @@ function buildSelections(select, connectionFieldsMap, entityType) {
146
146
  const fieldArgs = Object.entries(nested.args).map(([argName, argValue]) => t.argument({ name: argName, value: buildValueAst(argValue) }));
147
147
  const nestedSelect = nested.select;
148
148
  if (nestedSelect && typeof nestedSelect === 'object') {
149
- const subSelections = Object.entries(nestedSelect)
150
- .filter(([, v]) => v)
151
- .map(([name]) => t.field({ name }));
149
+ const subSelections = buildSelections(nestedSelect, connectionFieldsMap);
152
150
  fields.push(t.field({
153
151
  name: key,
154
152
  args: fieldArgs.length ? fieldArgs : undefined,
@@ -120,6 +120,6 @@ export type HookStrictSelect<S, Shape> = S extends DeepExact<S, Shape, 5> ? {} :
120
120
  export type InferSelectResult<TEntity, TSelect> = TSelect extends undefined ? TEntity : {
121
121
  [K in keyof TSelect as TSelect[K] extends false | undefined ? never : K]: TSelect[K] extends true ? K extends keyof TEntity ? TEntity[K] : never : TSelect[K] extends {
122
122
  select: infer NestedSelect;
123
- } ? K extends keyof TEntity ? NonNullable<TEntity[K]> extends ConnectionResult<infer NodeType> ? ConnectionResult<InferSelectResult<NodeType, NestedSelect>> : InferSelectResult<NonNullable<TEntity[K]>, NestedSelect> | (null extends TEntity[K] ? null : never) : never : K extends keyof TEntity ? TEntity[K] : never;
123
+ } ? K extends keyof TEntity ? NonNullable<TEntity[K]> extends ConnectionResult<infer NodeType> ? ConnectionResult<InferSelectResult<NodeType, NestedSelect>> : NonNullable<TEntity[K]> extends readonly (infer Item)[] ? InferSelectResult<NonNullable<Item>, NestedSelect>[] | (null extends TEntity[K] ? null : never) : InferSelectResult<NonNullable<TEntity[K]>, NestedSelect> | (null extends TEntity[K] ? null : never) : never : K extends keyof TEntity ? TEntity[K] : never;
124
124
  };
125
125
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/migrate-client",
3
- "version": "1.21.32",
3
+ "version": "1.21.34",
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.3.3",
43
- "@constructive-io/graphql-query": "^4.24.8",
44
- "@constructive-io/graphql-types": "^3.36.2",
43
+ "@constructive-io/graphql-query": "^4.24.10",
44
+ "@constructive-io/graphql-types": "^3.36.3",
45
45
  "gql-ast": "^3.26.0",
46
46
  "graphql": "16.13.0"
47
47
  },
@@ -50,5 +50,5 @@
50
50
  "makage": "^0.8.0",
51
51
  "typescript": "^6.0.3"
52
52
  },
53
- "gitHead": "8cc2311b286b42c60815794773bc038fa1250643"
53
+ "gitHead": "ebe62350b20676f718ebe9a6de45250407a682cc"
54
54
  }