@pgpmjs/migrate-client 0.11.3 → 0.11.5

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.
@@ -44,11 +44,6 @@ export declare function createClient(config: OrmClientConfig): {
44
44
  } & import("./select-types").StrictSelect<S, import("./input-types").RunMigrationPayloadSelect>) => import("./query-builder").QueryBuilder<{
45
45
  runMigration: import("./select-types").InferSelectResult<import("./input-types").RunMigrationPayload, S> | null;
46
46
  }>;
47
- requestUploadUrl: <S extends import("./input-types").RequestUploadUrlPayloadSelect>(args: import("./mutation").RequestUploadUrlVariables, options: {
48
- select: S;
49
- } & import("./select-types").StrictSelect<S, import("./input-types").RequestUploadUrlPayloadSelect>) => import("./query-builder").QueryBuilder<{
50
- requestUploadUrl: import("./select-types").InferSelectResult<import("./input-types").RequestUploadUrlPayload, S> | null;
51
- }>;
52
47
  provisionBucket: <S extends import("./input-types").ProvisionBucketPayloadSelect>(args: import("./mutation").ProvisionBucketVariables, options: {
53
48
  select: S;
54
49
  } & import("./select-types").StrictSelect<S, import("./input-types").ProvisionBucketPayloadSelect>) => import("./query-builder").QueryBuilder<{
@@ -405,25 +405,6 @@ export interface RunMigrationInput {
405
405
  migration?: number;
406
406
  kind?: string;
407
407
  }
408
- export interface RequestUploadUrlInput {
409
- /** Bucket key (e.g., "public", "private") */
410
- bucketKey: string;
411
- /**
412
- * Owner entity ID for entity-scoped uploads.
413
- * Omit for app-level (database-wide) storage.
414
- * When provided, resolves the storage module for the entity type
415
- * that owns this entity instance (e.g., a data room ID, team ID).
416
- */
417
- ownerId?: string;
418
- /** SHA-256 content hash computed by the client (hex-encoded, 64 chars) */
419
- contentHash: string;
420
- /** MIME type of the file (e.g., "image/png") */
421
- contentType: string;
422
- /** File size in bytes */
423
- size: number;
424
- /** Original filename (optional, for display and Content-Disposition) */
425
- filename?: string;
426
- }
427
408
  export interface ProvisionBucketInput {
428
409
  /** The logical bucket key (e.g., "public", "private") */
429
410
  bucketKey: string;
@@ -480,25 +461,6 @@ export interface RunMigrationPayload {
480
461
  export type RunMigrationPayloadSelect = {
481
462
  clientMutationId?: boolean;
482
463
  };
483
- export interface RequestUploadUrlPayload {
484
- /** Presigned PUT URL (null if file was deduplicated) */
485
- uploadUrl?: string | null;
486
- /** The file ID (existing if deduplicated, new if fresh upload) */
487
- fileId: string;
488
- /** The S3 object key */
489
- key: string;
490
- /** Whether this file was deduplicated (already exists with same hash) */
491
- deduplicated: boolean;
492
- /** Presigned URL expiry time (null if deduplicated) */
493
- expiresAt?: string | null;
494
- }
495
- export type RequestUploadUrlPayloadSelect = {
496
- uploadUrl?: boolean;
497
- fileId?: boolean;
498
- key?: boolean;
499
- deduplicated?: boolean;
500
- expiresAt?: boolean;
501
- };
502
464
  export interface ProvisionBucketPayload {
503
465
  /** Whether provisioning succeeded */
504
466
  success: boolean;
@@ -6,23 +6,13 @@
6
6
  import { OrmClient } from '../client';
7
7
  import { QueryBuilder } from '../query-builder';
8
8
  import type { InferSelectResult, StrictSelect } from '../select-types';
9
- import type { ExecuteSqlInput, RunMigrationInput, RequestUploadUrlInput, ProvisionBucketInput, ExecuteSqlPayload, RunMigrationPayload, RequestUploadUrlPayload, ProvisionBucketPayload, ExecuteSqlPayloadSelect, RunMigrationPayloadSelect, RequestUploadUrlPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
9
+ import type { ExecuteSqlInput, RunMigrationInput, ProvisionBucketInput, ExecuteSqlPayload, RunMigrationPayload, ProvisionBucketPayload, ExecuteSqlPayloadSelect, RunMigrationPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
10
10
  export interface ExecuteSqlVariables {
11
11
  input: ExecuteSqlInput;
12
12
  }
13
13
  export interface RunMigrationVariables {
14
14
  input: RunMigrationInput;
15
15
  }
16
- /**
17
- * Variables for requestUploadUrl
18
- * Request a presigned URL for uploading a file directly to S3.
19
- Client computes SHA-256 of the file content and provides it here.
20
- If a file with the same hash already exists (dedup), returns the
21
- existing file ID and deduplicated=true with no uploadUrl.
22
- */
23
- export interface RequestUploadUrlVariables {
24
- input: RequestUploadUrlInput;
25
- }
26
16
  /**
27
17
  * Variables for provisionBucket
28
18
  * Provision an S3 bucket for a logical bucket in the database.
@@ -44,11 +34,6 @@ export declare function createMutationOperations(client: OrmClient): {
44
34
  } & StrictSelect<S, RunMigrationPayloadSelect>) => QueryBuilder<{
45
35
  runMigration: InferSelectResult<RunMigrationPayload, S> | null;
46
36
  }>;
47
- requestUploadUrl: <S extends RequestUploadUrlPayloadSelect>(args: RequestUploadUrlVariables, options: {
48
- select: S;
49
- } & StrictSelect<S, RequestUploadUrlPayloadSelect>) => QueryBuilder<{
50
- requestUploadUrl: InferSelectResult<RequestUploadUrlPayload, S> | null;
51
- }>;
52
37
  provisionBucket: <S extends ProvisionBucketPayloadSelect>(args: ProvisionBucketVariables, options: {
53
38
  select: S;
54
39
  } & StrictSelect<S, ProvisionBucketPayloadSelect>) => QueryBuilder<{
@@ -26,18 +26,6 @@ export function createMutationOperations(client) {
26
26
  },
27
27
  ], connectionFieldsMap, 'RunMigrationPayload'),
28
28
  }),
29
- requestUploadUrl: (args, options) => new QueryBuilder({
30
- client,
31
- operation: 'mutation',
32
- operationName: 'RequestUploadUrl',
33
- fieldName: 'requestUploadUrl',
34
- ...buildCustomDocument('mutation', 'RequestUploadUrl', 'requestUploadUrl', options.select, args, [
35
- {
36
- name: 'input',
37
- type: 'RequestUploadUrlInput!',
38
- },
39
- ], connectionFieldsMap, 'RequestUploadUrlPayload'),
40
- }),
41
29
  provisionBucket: (args, options) => new QueryBuilder({
42
30
  client,
43
31
  operation: 'mutation',
@@ -89,6 +89,30 @@ export function buildSelections(select, connectionFieldsMap, entityType) {
89
89
  }
90
90
  if (typeof value === 'object' && value !== null) {
91
91
  const nested = value;
92
+ // Field with arguments (e.g. requestUploadUrl on bucket types)
93
+ if (nested.args && typeof nested.args === 'object') {
94
+ const fieldArgs = Object.entries(nested.args).map(([argName, argValue]) => t.argument({ name: argName, value: buildValueAst(argValue) }));
95
+ const nestedSelect = nested.select;
96
+ if (nestedSelect && typeof nestedSelect === 'object') {
97
+ const subSelections = Object.entries(nestedSelect)
98
+ .filter(([, v]) => v)
99
+ .map(([name]) => t.field({ name }));
100
+ fields.push(t.field({
101
+ name: key,
102
+ args: fieldArgs.length ? fieldArgs : undefined,
103
+ selectionSet: subSelections.length
104
+ ? t.selectionSet({ selections: subSelections })
105
+ : undefined,
106
+ }));
107
+ }
108
+ else {
109
+ fields.push(t.field({
110
+ name: key,
111
+ args: fieldArgs.length ? fieldArgs : undefined,
112
+ }));
113
+ }
114
+ continue;
115
+ }
92
116
  if (!nested.select || typeof nested.select !== 'object') {
93
117
  throw new Error(`Invalid selection for field "${key}": nested selections must include a "select" object.`);
94
118
  }
@@ -44,11 +44,6 @@ export declare function createClient(config: OrmClientConfig): {
44
44
  } & import("./select-types").StrictSelect<S, import("./input-types").RunMigrationPayloadSelect>) => import("./query-builder").QueryBuilder<{
45
45
  runMigration: import("./select-types").InferSelectResult<import("./input-types").RunMigrationPayload, S> | null;
46
46
  }>;
47
- requestUploadUrl: <S extends import("./input-types").RequestUploadUrlPayloadSelect>(args: import("./mutation").RequestUploadUrlVariables, options: {
48
- select: S;
49
- } & import("./select-types").StrictSelect<S, import("./input-types").RequestUploadUrlPayloadSelect>) => import("./query-builder").QueryBuilder<{
50
- requestUploadUrl: import("./select-types").InferSelectResult<import("./input-types").RequestUploadUrlPayload, S> | null;
51
- }>;
52
47
  provisionBucket: <S extends import("./input-types").ProvisionBucketPayloadSelect>(args: import("./mutation").ProvisionBucketVariables, options: {
53
48
  select: S;
54
49
  } & import("./select-types").StrictSelect<S, import("./input-types").ProvisionBucketPayloadSelect>) => import("./query-builder").QueryBuilder<{
@@ -405,25 +405,6 @@ export interface RunMigrationInput {
405
405
  migration?: number;
406
406
  kind?: string;
407
407
  }
408
- export interface RequestUploadUrlInput {
409
- /** Bucket key (e.g., "public", "private") */
410
- bucketKey: string;
411
- /**
412
- * Owner entity ID for entity-scoped uploads.
413
- * Omit for app-level (database-wide) storage.
414
- * When provided, resolves the storage module for the entity type
415
- * that owns this entity instance (e.g., a data room ID, team ID).
416
- */
417
- ownerId?: string;
418
- /** SHA-256 content hash computed by the client (hex-encoded, 64 chars) */
419
- contentHash: string;
420
- /** MIME type of the file (e.g., "image/png") */
421
- contentType: string;
422
- /** File size in bytes */
423
- size: number;
424
- /** Original filename (optional, for display and Content-Disposition) */
425
- filename?: string;
426
- }
427
408
  export interface ProvisionBucketInput {
428
409
  /** The logical bucket key (e.g., "public", "private") */
429
410
  bucketKey: string;
@@ -480,25 +461,6 @@ export interface RunMigrationPayload {
480
461
  export type RunMigrationPayloadSelect = {
481
462
  clientMutationId?: boolean;
482
463
  };
483
- export interface RequestUploadUrlPayload {
484
- /** Presigned PUT URL (null if file was deduplicated) */
485
- uploadUrl?: string | null;
486
- /** The file ID (existing if deduplicated, new if fresh upload) */
487
- fileId: string;
488
- /** The S3 object key */
489
- key: string;
490
- /** Whether this file was deduplicated (already exists with same hash) */
491
- deduplicated: boolean;
492
- /** Presigned URL expiry time (null if deduplicated) */
493
- expiresAt?: string | null;
494
- }
495
- export type RequestUploadUrlPayloadSelect = {
496
- uploadUrl?: boolean;
497
- fileId?: boolean;
498
- key?: boolean;
499
- deduplicated?: boolean;
500
- expiresAt?: boolean;
501
- };
502
464
  export interface ProvisionBucketPayload {
503
465
  /** Whether provisioning succeeded */
504
466
  success: boolean;
@@ -6,23 +6,13 @@
6
6
  import { OrmClient } from '../client';
7
7
  import { QueryBuilder } from '../query-builder';
8
8
  import type { InferSelectResult, StrictSelect } from '../select-types';
9
- import type { ExecuteSqlInput, RunMigrationInput, RequestUploadUrlInput, ProvisionBucketInput, ExecuteSqlPayload, RunMigrationPayload, RequestUploadUrlPayload, ProvisionBucketPayload, ExecuteSqlPayloadSelect, RunMigrationPayloadSelect, RequestUploadUrlPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
9
+ import type { ExecuteSqlInput, RunMigrationInput, ProvisionBucketInput, ExecuteSqlPayload, RunMigrationPayload, ProvisionBucketPayload, ExecuteSqlPayloadSelect, RunMigrationPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
10
10
  export interface ExecuteSqlVariables {
11
11
  input: ExecuteSqlInput;
12
12
  }
13
13
  export interface RunMigrationVariables {
14
14
  input: RunMigrationInput;
15
15
  }
16
- /**
17
- * Variables for requestUploadUrl
18
- * Request a presigned URL for uploading a file directly to S3.
19
- Client computes SHA-256 of the file content and provides it here.
20
- If a file with the same hash already exists (dedup), returns the
21
- existing file ID and deduplicated=true with no uploadUrl.
22
- */
23
- export interface RequestUploadUrlVariables {
24
- input: RequestUploadUrlInput;
25
- }
26
16
  /**
27
17
  * Variables for provisionBucket
28
18
  * Provision an S3 bucket for a logical bucket in the database.
@@ -44,11 +34,6 @@ export declare function createMutationOperations(client: OrmClient): {
44
34
  } & StrictSelect<S, RunMigrationPayloadSelect>) => QueryBuilder<{
45
35
  runMigration: InferSelectResult<RunMigrationPayload, S> | null;
46
36
  }>;
47
- requestUploadUrl: <S extends RequestUploadUrlPayloadSelect>(args: RequestUploadUrlVariables, options: {
48
- select: S;
49
- } & StrictSelect<S, RequestUploadUrlPayloadSelect>) => QueryBuilder<{
50
- requestUploadUrl: InferSelectResult<RequestUploadUrlPayload, S> | null;
51
- }>;
52
37
  provisionBucket: <S extends ProvisionBucketPayloadSelect>(args: ProvisionBucketVariables, options: {
53
38
  select: S;
54
39
  } & StrictSelect<S, ProvisionBucketPayloadSelect>) => QueryBuilder<{
@@ -29,18 +29,6 @@ function createMutationOperations(client) {
29
29
  },
30
30
  ], input_types_1.connectionFieldsMap, 'RunMigrationPayload'),
31
31
  }),
32
- requestUploadUrl: (args, options) => new query_builder_1.QueryBuilder({
33
- client,
34
- operation: 'mutation',
35
- operationName: 'RequestUploadUrl',
36
- fieldName: 'requestUploadUrl',
37
- ...(0, query_builder_1.buildCustomDocument)('mutation', 'RequestUploadUrl', 'requestUploadUrl', options.select, args, [
38
- {
39
- name: 'input',
40
- type: 'RequestUploadUrlInput!',
41
- },
42
- ], input_types_1.connectionFieldsMap, 'RequestUploadUrlPayload'),
43
- }),
44
32
  provisionBucket: (args, options) => new query_builder_1.QueryBuilder({
45
33
  client,
46
34
  operation: 'mutation',
@@ -137,6 +137,30 @@ function buildSelections(select, connectionFieldsMap, entityType) {
137
137
  }
138
138
  if (typeof value === 'object' && value !== null) {
139
139
  const nested = value;
140
+ // Field with arguments (e.g. requestUploadUrl on bucket types)
141
+ if (nested.args && typeof nested.args === 'object') {
142
+ const fieldArgs = Object.entries(nested.args).map(([argName, argValue]) => t.argument({ name: argName, value: buildValueAst(argValue) }));
143
+ const nestedSelect = nested.select;
144
+ if (nestedSelect && typeof nestedSelect === 'object') {
145
+ const subSelections = Object.entries(nestedSelect)
146
+ .filter(([, v]) => v)
147
+ .map(([name]) => t.field({ name }));
148
+ fields.push(t.field({
149
+ name: key,
150
+ args: fieldArgs.length ? fieldArgs : undefined,
151
+ selectionSet: subSelections.length
152
+ ? t.selectionSet({ selections: subSelections })
153
+ : undefined,
154
+ }));
155
+ }
156
+ else {
157
+ fields.push(t.field({
158
+ name: key,
159
+ args: fieldArgs.length ? fieldArgs : undefined,
160
+ }));
161
+ }
162
+ continue;
163
+ }
140
164
  if (!nested.select || typeof nested.select !== 'object') {
141
165
  throw new Error(`Invalid selection for field "${key}": nested selections must include a "select" object.`);
142
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/migrate-client",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
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,7 +40,7 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@0no-co/graphql.web": "^1.1.2",
43
- "@constructive-io/graphql-query": "^3.21.0",
43
+ "@constructive-io/graphql-query": "^3.21.2",
44
44
  "@constructive-io/graphql-types": "^3.8.0",
45
45
  "gql-ast": "^3.8.0",
46
46
  "graphql": "16.13.0"
@@ -50,5 +50,5 @@
50
50
  "makage": "^0.3.0",
51
51
  "typescript": "^5.9.3"
52
52
  },
53
- "gitHead": "97ec8e14f2b0855b0ee0bc732a082e1a91301b64"
53
+ "gitHead": "38a99d5e61d756271a0024eb16d4f85923da936f"
54
54
  }