diff --git a/.agents/skills/cli-public/references/provision-table.md b/.agents/skills/cli-public/references/provision-table.md index 65cd73c65..9426533f5 100644 --- a/.agents/skills/cli-public/references/provision-table.md +++ b/.agents/skills/cli-public/references/provision-table.md @@ -7,7 +7,7 @@ Composable table provisioning: creates or finds a table, then creates fields (so ## Usage ```bash -csdk provision-table --input.clientMutationId --input.databaseId --input.schemaId --input.tableName --input.tableId --input.nodes --input.fields --input.policies --input.grants --input.useRls --input.indexes --input.fullTextSearches --input.uniqueConstraints +csdk provision-table --input.clientMutationId --input.databaseId --input.schemaId --input.tableName --input.tableId --input.nodes --input.fields --input.policies --input.grants --input.useRls --input.indexes --input.fullTextSearches --input.uniqueConstraints --input.description ``` ## Examples @@ -15,5 +15,5 @@ csdk provision-table --input.clientMutationId --input.databaseId ### Run provisionTable ```bash -csdk provision-table --input.clientMutationId --input.databaseId --input.schemaId --input.tableName --input.tableId --input.nodes --input.fields --input.policies --input.grants --input.useRls --input.indexes --input.fullTextSearches --input.uniqueConstraints +csdk provision-table --input.clientMutationId --input.databaseId --input.schemaId --input.tableName --input.tableId --input.nodes --input.fields --input.policies --input.grants --input.useRls --input.indexes --input.fullTextSearches --input.uniqueConstraints --input.description ``` diff --git a/.agents/skills/cli-public/references/storage-module.md b/.agents/skills/cli-public/references/storage-module.md index 808d5e77e..e30d226a7 100644 --- a/.agents/skills/cli-public/references/storage-module.md +++ b/.agents/skills/cli-public/references/storage-module.md @@ -12,8 +12,8 @@ csdk storage-module list --where.. --orderBy csdk storage-module list --limit 10 --after csdk storage-module find-first --where.. csdk storage-module get --id -csdk storage-module create --databaseId [--schemaId ] [--privateSchemaId ] [--bucketsTableId ] [--filesTableId ] [--uploadRequestsTableId ] [--bucketsTableName ] [--filesTableName ] [--uploadRequestsTableName ] [--membershipType ] [--policies ] [--entityTableId ] [--endpoint ] [--publicUrlPrefix ] [--provider ] [--allowedOrigins ] [--uploadUrlExpirySeconds ] [--downloadUrlExpirySeconds ] [--defaultMaxFileSize ] [--maxFilenameLength ] [--cacheTtlSeconds ] -csdk storage-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--bucketsTableId ] [--filesTableId ] [--uploadRequestsTableId ] [--bucketsTableName ] [--filesTableName ] [--uploadRequestsTableName ] [--membershipType ] [--policies ] [--entityTableId ] [--endpoint ] [--publicUrlPrefix ] [--provider ] [--allowedOrigins ] [--uploadUrlExpirySeconds ] [--downloadUrlExpirySeconds ] [--defaultMaxFileSize ] [--maxFilenameLength ] [--cacheTtlSeconds ] +csdk storage-module create --databaseId [--schemaId ] [--privateSchemaId ] [--bucketsTableId ] [--filesTableId ] [--uploadRequestsTableId ] [--bucketsTableName ] [--filesTableName ] [--uploadRequestsTableName ] [--membershipType ] [--policies ] [--entityTableId ] [--endpoint ] [--publicUrlPrefix ] [--provider ] [--allowedOrigins ] [--uploadUrlExpirySeconds ] [--downloadUrlExpirySeconds ] [--defaultMaxFileSize ] [--maxFilenameLength ] [--cacheTtlSeconds ] +csdk storage-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--bucketsTableId ] [--filesTableId ] [--uploadRequestsTableId ] [--bucketsTableName ] [--filesTableName ] [--uploadRequestsTableName ] [--membershipType ] [--policies ] [--entityTableId ] [--endpoint ] [--publicUrlPrefix ] [--provider ] [--allowedOrigins ] [--uploadUrlExpirySeconds ] [--downloadUrlExpirySeconds ] [--defaultMaxFileSize ] [--maxFilenameLength ] [--cacheTtlSeconds ] csdk storage-module delete --id ``` @@ -58,7 +58,7 @@ csdk storage-module list --where.id.equalTo --orderBy ID_ASC ### Create a storageModule ```bash -csdk storage-module create --databaseId [--schemaId ] [--privateSchemaId ] [--bucketsTableId ] [--filesTableId ] [--uploadRequestsTableId ] [--bucketsTableName ] [--filesTableName ] [--uploadRequestsTableName ] [--membershipType ] [--policies ] [--entityTableId ] [--endpoint ] [--publicUrlPrefix ] [--provider ] [--allowedOrigins ] [--uploadUrlExpirySeconds ] [--downloadUrlExpirySeconds ] [--defaultMaxFileSize ] [--maxFilenameLength ] [--cacheTtlSeconds ] +csdk storage-module create --databaseId [--schemaId ] [--privateSchemaId ] [--bucketsTableId ] [--filesTableId ] [--uploadRequestsTableId ] [--bucketsTableName ] [--filesTableName ] [--uploadRequestsTableName ] [--membershipType ] [--policies ] [--entityTableId ] [--endpoint ] [--publicUrlPrefix ] [--provider ] [--allowedOrigins ] [--uploadUrlExpirySeconds ] [--downloadUrlExpirySeconds ] [--defaultMaxFileSize ] [--maxFilenameLength ] [--cacheTtlSeconds ] ``` ### Get a storageModule by id diff --git a/.agents/skills/hooks-public/references/storage-module.md b/.agents/skills/hooks-public/references/storage-module.md index c540c425e..a1ba6f3ad 100644 --- a/.agents/skills/hooks-public/references/storage-module.md +++ b/.agents/skills/hooks-public/references/storage-module.md @@ -30,5 +30,5 @@ const { data, isLoading } = useStorageModulesQuery({ const { mutate } = useCreateStorageModuleMutation({ selection: { fields: { id: true } }, }); -mutate({ databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }); +mutate({ databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }); ``` diff --git a/.agents/skills/orm-public/references/storage-module.md b/.agents/skills/orm-public/references/storage-module.md index b43d92c44..bf80a17bb 100644 --- a/.agents/skills/orm-public/references/storage-module.md +++ b/.agents/skills/orm-public/references/storage-module.md @@ -9,7 +9,7 @@ ORM operations for StorageModule records ```typescript db.storageModule.findMany({ select: { id: true } }).execute() db.storageModule.findOne({ id: '', select: { id: true } }).execute() -db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute() +db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute() db.storageModule.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute() db.storageModule.delete({ where: { id: '' } }).execute() ``` @@ -28,7 +28,7 @@ const items = await db.storageModule.findMany({ ```typescript const item = await db.storageModule.create({ - data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, + data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute(); ``` diff --git a/sdk/constructive-cli/src/admin/orm/client.ts b/sdk/constructive-cli/src/admin/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-cli/src/admin/orm/client.ts +++ b/sdk/constructive-cli/src/admin/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-cli/src/admin/orm/input-types.ts b/sdk/constructive-cli/src/admin/orm/input-types.ts index 806b6b042..3f1ab47a3 100644 --- a/sdk/constructive-cli/src/admin/orm/input-types.ts +++ b/sdk/constructive-cli/src/admin/orm/input-types.ts @@ -3615,6 +3615,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -3622,6 +3624,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-cli/src/auth/orm/client.ts b/sdk/constructive-cli/src/auth/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-cli/src/auth/orm/client.ts +++ b/sdk/constructive-cli/src/auth/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-cli/src/auth/orm/input-types.ts b/sdk/constructive-cli/src/auth/orm/input-types.ts index ba12312ee..eb5c48d84 100644 --- a/sdk/constructive-cli/src/auth/orm/input-types.ts +++ b/sdk/constructive-cli/src/auth/orm/input-types.ts @@ -2440,6 +2440,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -2447,6 +2449,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-cli/src/objects/orm/client.ts b/sdk/constructive-cli/src/objects/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-cli/src/objects/orm/client.ts +++ b/sdk/constructive-cli/src/objects/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-cli/src/objects/orm/input-types.ts b/sdk/constructive-cli/src/objects/orm/input-types.ts index e1684b49e..5a7d7952c 100644 --- a/sdk/constructive-cli/src/objects/orm/input-types.ts +++ b/sdk/constructive-cli/src/objects/orm/input-types.ts @@ -829,6 +829,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -836,6 +838,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-cli/src/public/cli/README.md b/sdk/constructive-cli/src/public/cli/README.md index bd441e0d3..4547b1bd8 100644 --- a/sdk/constructive-cli/src/public/cli/README.md +++ b/sdk/constructive-cli/src/public/cli/README.md @@ -2409,7 +2409,7 @@ CRUD operations for StorageModule records. | `filesTableName` | String | | `uploadRequestsTableName` | String | | `membershipType` | Int | -| `policies` | String | +| `policies` | JSON | | `entityTableId` | UUID | | `endpoint` | String | | `publicUrlPrefix` | String | @@ -4950,6 +4950,7 @@ Composable table provisioning: creates or finds a table, then creates fields (so | `--input.indexes` | JSON | | `--input.fullTextSearches` | JSON | | `--input.uniqueConstraints` | JSON | + | `--input.description` | String | ### `send-verification-email` diff --git a/sdk/constructive-cli/src/public/cli/commands/storage-module.ts b/sdk/constructive-cli/src/public/cli/commands/storage-module.ts index f19a60af8..e75203344 100644 --- a/sdk/constructive-cli/src/public/cli/commands/storage-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/storage-module.ts @@ -27,7 +27,7 @@ const fieldSchema: FieldSchema = { filesTableName: 'string', uploadRequestsTableName: 'string', membershipType: 'int', - policies: 'string', + policies: 'json', entityTableId: 'uuid', endpoint: 'string', publicUrlPrefix: 'string', @@ -293,7 +293,7 @@ async function handleCreate(argv: Partial>, prompter: In skipPrompt: true, }, { - type: 'text', + type: 'json', name: 'policies', message: 'policies', required: false, @@ -515,7 +515,7 @@ async function handleUpdate(argv: Partial>, prompter: In skipPrompt: true, }, { - type: 'text', + type: 'json', name: 'policies', message: 'policies', required: false, diff --git a/sdk/constructive-cli/src/public/orm/README.md b/sdk/constructive-cli/src/public/orm/README.md index 74e83c23e..8f41c877f 100644 --- a/sdk/constructive-cli/src/public/orm/README.md +++ b/sdk/constructive-cli/src/public/orm/README.md @@ -2733,7 +2733,7 @@ CRUD operations for StorageModule records. | `filesTableName` | String | Yes | | `uploadRequestsTableName` | String | Yes | | `membershipType` | Int | Yes | -| `policies` | String | Yes | +| `policies` | JSON | Yes | | `entityTableId` | UUID | Yes | | `endpoint` | String | Yes | | `publicUrlPrefix` | String | Yes | @@ -2755,7 +2755,7 @@ const items = await db.storageModule.findMany({ select: { id: true, databaseId: const item = await db.storageModule.findOne({ id: '', select: { id: true, databaseId: true, schemaId: true, privateSchemaId: true, bucketsTableId: true, filesTableId: true, uploadRequestsTableId: true, bucketsTableName: true, filesTableName: true, uploadRequestsTableName: true, membershipType: true, policies: true, entityTableId: true, endpoint: true, publicUrlPrefix: true, provider: true, allowedOrigins: true, uploadUrlExpirySeconds: true, downloadUrlExpirySeconds: true, defaultMaxFileSize: true, maxFilenameLength: true, cacheTtlSeconds: true } }).execute(); // Create -const created = await db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute(); +const created = await db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute(); // Update const updated = await db.storageModule.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); diff --git a/sdk/constructive-cli/src/public/orm/client.ts b/sdk/constructive-cli/src/public/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-cli/src/public/orm/client.ts +++ b/sdk/constructive-cli/src/public/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-cli/src/public/orm/input-types.ts b/sdk/constructive-cli/src/public/orm/input-types.ts index 888d00b99..069586eb8 100644 --- a/sdk/constructive-cli/src/public/orm/input-types.ts +++ b/sdk/constructive-cli/src/public/orm/input-types.ts @@ -1361,7 +1361,7 @@ export interface StorageModule { filesTableName?: string | null; uploadRequestsTableName?: string | null; membershipType?: number | null; - policies?: string[] | null; + policies?: Record | null; entityTableId?: string | null; endpoint?: string | null; publicUrlPrefix?: string | null; @@ -9422,7 +9422,7 @@ export interface StorageModuleFilter { /** Filter by the object’s `membershipType` field. */ membershipType?: IntFilter; /** Filter by the object’s `policies` field. */ - policies?: StringListFilter; + policies?: JSONFilter; /** Filter by the object’s `entityTableId` field. */ entityTableId?: UUIDFilter; /** Filter by the object’s `endpoint` field. */ @@ -16466,7 +16466,7 @@ export interface CreateStorageModuleInput { filesTableName?: string; uploadRequestsTableName?: string; membershipType?: number; - policies?: string[]; + policies?: Record; entityTableId?: string; endpoint?: string; publicUrlPrefix?: string; @@ -16490,7 +16490,7 @@ export interface StorageModulePatch { filesTableName?: string | null; uploadRequestsTableName?: string | null; membershipType?: number | null; - policies?: string[] | null; + policies?: Record | null; entityTableId?: string | null; endpoint?: string | null; publicUrlPrefix?: string | null; @@ -18535,6 +18535,7 @@ export interface ProvisionTableInput { indexes?: Record; fullTextSearches?: Record; uniqueConstraints?: Record; + description?: string; } export interface SendVerificationEmailInput { clientMutationId?: string; @@ -22806,7 +22807,7 @@ export interface StorageModuleFilter { /** Filter by the object’s `membershipType` field. */ membershipType?: IntFilter; /** Filter by the object’s `policies` field. */ - policies?: StringListFilter; + policies?: JSONFilter; /** Filter by the object’s `entityTableId` field. */ entityTableId?: UUIDFilter; /** Filter by the object’s `endpoint` field. */ @@ -25755,6 +25756,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -25762,6 +25765,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/admin/orm/client.ts b/sdk/constructive-react/src/admin/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-react/src/admin/orm/client.ts +++ b/sdk/constructive-react/src/admin/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-react/src/admin/orm/input-types.ts b/sdk/constructive-react/src/admin/orm/input-types.ts index 806b6b042..3f1ab47a3 100644 --- a/sdk/constructive-react/src/admin/orm/input-types.ts +++ b/sdk/constructive-react/src/admin/orm/input-types.ts @@ -3615,6 +3615,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -3622,6 +3624,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/admin/schema-types.ts b/sdk/constructive-react/src/admin/schema-types.ts index d33c677a7..176b675ae 100644 --- a/sdk/constructive-react/src/admin/schema-types.ts +++ b/sdk/constructive-react/src/admin/schema-types.ts @@ -3884,6 +3884,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/auth/orm/client.ts b/sdk/constructive-react/src/auth/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-react/src/auth/orm/client.ts +++ b/sdk/constructive-react/src/auth/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-react/src/auth/orm/input-types.ts b/sdk/constructive-react/src/auth/orm/input-types.ts index ba12312ee..eb5c48d84 100644 --- a/sdk/constructive-react/src/auth/orm/input-types.ts +++ b/sdk/constructive-react/src/auth/orm/input-types.ts @@ -2440,6 +2440,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -2447,6 +2449,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/auth/schema-types.ts b/sdk/constructive-react/src/auth/schema-types.ts index 4894391fc..84ea522c5 100644 --- a/sdk/constructive-react/src/auth/schema-types.ts +++ b/sdk/constructive-react/src/auth/schema-types.ts @@ -1628,6 +1628,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/objects/orm/client.ts b/sdk/constructive-react/src/objects/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-react/src/objects/orm/client.ts +++ b/sdk/constructive-react/src/objects/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-react/src/objects/orm/input-types.ts b/sdk/constructive-react/src/objects/orm/input-types.ts index e1684b49e..5a7d7952c 100644 --- a/sdk/constructive-react/src/objects/orm/input-types.ts +++ b/sdk/constructive-react/src/objects/orm/input-types.ts @@ -829,6 +829,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -836,6 +838,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/objects/schema-types.ts b/sdk/constructive-react/src/objects/schema-types.ts index 1c861704b..c49783d13 100644 --- a/sdk/constructive-react/src/objects/schema-types.ts +++ b/sdk/constructive-react/src/objects/schema-types.ts @@ -607,6 +607,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/public/hooks/README.md b/sdk/constructive-react/src/public/hooks/README.md index 9c1a3e829..45ce27804 100644 --- a/sdk/constructive-react/src/public/hooks/README.md +++ b/sdk/constructive-react/src/public/hooks/README.md @@ -2175,7 +2175,7 @@ const { data: item } = useStorageModuleQuery({ const { mutate: create } = useCreateStorageModuleMutation({ selection: { fields: { id: true } }, }); -create({ databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }); +create({ databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }); ``` ### EntityTypeProvision diff --git a/sdk/constructive-react/src/public/orm/README.md b/sdk/constructive-react/src/public/orm/README.md index 74e83c23e..8f41c877f 100644 --- a/sdk/constructive-react/src/public/orm/README.md +++ b/sdk/constructive-react/src/public/orm/README.md @@ -2733,7 +2733,7 @@ CRUD operations for StorageModule records. | `filesTableName` | String | Yes | | `uploadRequestsTableName` | String | Yes | | `membershipType` | Int | Yes | -| `policies` | String | Yes | +| `policies` | JSON | Yes | | `entityTableId` | UUID | Yes | | `endpoint` | String | Yes | | `publicUrlPrefix` | String | Yes | @@ -2755,7 +2755,7 @@ const items = await db.storageModule.findMany({ select: { id: true, databaseId: const item = await db.storageModule.findOne({ id: '', select: { id: true, databaseId: true, schemaId: true, privateSchemaId: true, bucketsTableId: true, filesTableId: true, uploadRequestsTableId: true, bucketsTableName: true, filesTableName: true, uploadRequestsTableName: true, membershipType: true, policies: true, entityTableId: true, endpoint: true, publicUrlPrefix: true, provider: true, allowedOrigins: true, uploadUrlExpirySeconds: true, downloadUrlExpirySeconds: true, defaultMaxFileSize: true, maxFilenameLength: true, cacheTtlSeconds: true } }).execute(); // Create -const created = await db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute(); +const created = await db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute(); // Update const updated = await db.storageModule.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); diff --git a/sdk/constructive-react/src/public/orm/client.ts b/sdk/constructive-react/src/public/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-react/src/public/orm/client.ts +++ b/sdk/constructive-react/src/public/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-react/src/public/orm/input-types.ts b/sdk/constructive-react/src/public/orm/input-types.ts index 888d00b99..069586eb8 100644 --- a/sdk/constructive-react/src/public/orm/input-types.ts +++ b/sdk/constructive-react/src/public/orm/input-types.ts @@ -1361,7 +1361,7 @@ export interface StorageModule { filesTableName?: string | null; uploadRequestsTableName?: string | null; membershipType?: number | null; - policies?: string[] | null; + policies?: Record | null; entityTableId?: string | null; endpoint?: string | null; publicUrlPrefix?: string | null; @@ -9422,7 +9422,7 @@ export interface StorageModuleFilter { /** Filter by the object’s `membershipType` field. */ membershipType?: IntFilter; /** Filter by the object’s `policies` field. */ - policies?: StringListFilter; + policies?: JSONFilter; /** Filter by the object’s `entityTableId` field. */ entityTableId?: UUIDFilter; /** Filter by the object’s `endpoint` field. */ @@ -16466,7 +16466,7 @@ export interface CreateStorageModuleInput { filesTableName?: string; uploadRequestsTableName?: string; membershipType?: number; - policies?: string[]; + policies?: Record; entityTableId?: string; endpoint?: string; publicUrlPrefix?: string; @@ -16490,7 +16490,7 @@ export interface StorageModulePatch { filesTableName?: string | null; uploadRequestsTableName?: string | null; membershipType?: number | null; - policies?: string[] | null; + policies?: Record | null; entityTableId?: string | null; endpoint?: string | null; publicUrlPrefix?: string | null; @@ -18535,6 +18535,7 @@ export interface ProvisionTableInput { indexes?: Record; fullTextSearches?: Record; uniqueConstraints?: Record; + description?: string; } export interface SendVerificationEmailInput { clientMutationId?: string; @@ -22806,7 +22807,7 @@ export interface StorageModuleFilter { /** Filter by the object’s `membershipType` field. */ membershipType?: IntFilter; /** Filter by the object’s `policies` field. */ - policies?: StringListFilter; + policies?: JSONFilter; /** Filter by the object’s `entityTableId` field. */ entityTableId?: UUIDFilter; /** Filter by the object’s `endpoint` field. */ @@ -25755,6 +25756,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -25762,6 +25765,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/public/schema-types.ts b/sdk/constructive-react/src/public/schema-types.ts index fe153da77..cd3040b9c 100644 --- a/sdk/constructive-react/src/public/schema-types.ts +++ b/sdk/constructive-react/src/public/schema-types.ts @@ -8952,7 +8952,7 @@ export interface StorageModuleFilter { /** Filter by the object’s `membershipType` field. */ membershipType?: IntFilter; /** Filter by the object’s `policies` field. */ - policies?: StringListFilter; + policies?: JSONFilter; /** Filter by the object’s `entityTableId` field. */ entityTableId?: UUIDFilter; /** Filter by the object’s `endpoint` field. */ @@ -10083,6 +10083,7 @@ export interface ProvisionTableInput { indexes?: unknown; fullTextSearches?: unknown; uniqueConstraints?: unknown; + description?: string; } export interface SendVerificationEmailInput { clientMutationId?: string; @@ -12454,7 +12455,7 @@ export interface StorageModuleInput { filesTableName?: string; uploadRequestsTableName?: string; membershipType?: number; - policies?: string[]; + policies?: unknown; entityTableId?: string; endpoint?: string; publicUrlPrefix?: string; @@ -15190,7 +15191,7 @@ export interface StorageModulePatch { filesTableName?: string; uploadRequestsTableName?: string; membershipType?: number; - policies?: string[]; + policies?: unknown; entityTableId?: string; endpoint?: string; publicUrlPrefix?: string; @@ -19086,6 +19087,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-react/src/public/types.ts b/sdk/constructive-react/src/public/types.ts index f687bd63c..5e40e2c16 100644 --- a/sdk/constructive-react/src/public/types.ts +++ b/sdk/constructive-react/src/public/types.ts @@ -878,7 +878,7 @@ export interface StorageModule { filesTableName: string | null; uploadRequestsTableName: string | null; membershipType: number | null; - policies: string[] | null; + policies: unknown | null; entityTableId: string | null; endpoint: string | null; publicUrlPrefix: string | null; diff --git a/sdk/constructive-sdk/schemas/admin.graphql b/sdk/constructive-sdk/schemas/admin.graphql index 53bddfd60..1c41f4834 100644 --- a/sdk/constructive-sdk/schemas/admin.graphql +++ b/sdk/constructive-sdk/schemas/admin.graphql @@ -9222,6 +9222,11 @@ type RequestUploadUrlPayload { """Presigned URL expiry time (null if deduplicated)""" expiresAt: Datetime + + """ + File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. + """ + status: String! } input ConfirmUploadInput { diff --git a/sdk/constructive-sdk/schemas/app.graphql b/sdk/constructive-sdk/schemas/app.graphql index aa0eb7052..9f1e36a1d 100644 --- a/sdk/constructive-sdk/schemas/app.graphql +++ b/sdk/constructive-sdk/schemas/app.graphql @@ -193,6 +193,11 @@ type RequestUploadUrlPayload { """Presigned URL expiry time (null if deduplicated)""" expiresAt: Datetime + + """ + File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. + """ + status: String! } """ diff --git a/sdk/constructive-sdk/schemas/auth.graphql b/sdk/constructive-sdk/schemas/auth.graphql index 840b89316..f1a5922e9 100644 --- a/sdk/constructive-sdk/schemas/auth.graphql +++ b/sdk/constructive-sdk/schemas/auth.graphql @@ -4378,6 +4378,11 @@ type RequestUploadUrlPayload { """Presigned URL expiry time (null if deduplicated)""" expiresAt: Datetime + + """ + File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. + """ + status: String! } input ConfirmUploadInput { diff --git a/sdk/constructive-sdk/schemas/objects.graphql b/sdk/constructive-sdk/schemas/objects.graphql index 817de1a7f..c5b7b8027 100644 --- a/sdk/constructive-sdk/schemas/objects.graphql +++ b/sdk/constructive-sdk/schemas/objects.graphql @@ -1887,6 +1887,11 @@ type RequestUploadUrlPayload { """Presigned URL expiry time (null if deduplicated)""" expiresAt: Datetime + + """ + File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. + """ + status: String! } input ConfirmUploadInput { diff --git a/sdk/constructive-sdk/schemas/public.graphql b/sdk/constructive-sdk/schemas/public.graphql index d7c13332e..34d337d15 100644 --- a/sdk/constructive-sdk/schemas/public.graphql +++ b/sdk/constructive-sdk/schemas/public.graphql @@ -14414,7 +14414,7 @@ input StorageModuleFilter { membershipType: IntFilter """Filter by the object’s `policies` field.""" - policies: StringListFilter + policies: JSONFilter """Filter by the object’s `entityTableId` field.""" entityTableId: UUIDFilter @@ -20892,7 +20892,7 @@ type StorageModule { filesTableName: String! uploadRequestsTableName: String! membershipType: Int - policies: [String] + policies: JSON entityTableId: UUID endpoint: String publicUrlPrefix: String @@ -27429,6 +27429,7 @@ input ProvisionTableInput { indexes: JSON fullTextSearches: JSON uniqueConstraints: JSON + description: String } """The output of our `sendVerificationEmail` mutation.""" @@ -33728,7 +33729,7 @@ input StorageModuleInput { filesTableName: String uploadRequestsTableName: String membershipType: Int - policies: [String] + policies: JSON entityTableId: UUID endpoint: String publicUrlPrefix: String @@ -40900,7 +40901,7 @@ input StorageModulePatch { filesTableName: String uploadRequestsTableName: String membershipType: Int - policies: [String] + policies: JSON entityTableId: UUID endpoint: String publicUrlPrefix: String @@ -45255,6 +45256,11 @@ type RequestUploadUrlPayload { """Presigned URL expiry time (null if deduplicated)""" expiresAt: Datetime + + """ + File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. + """ + status: String! } input ConfirmUploadInput { diff --git a/sdk/constructive-sdk/src/admin/orm/client.ts b/sdk/constructive-sdk/src/admin/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-sdk/src/admin/orm/client.ts +++ b/sdk/constructive-sdk/src/admin/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-sdk/src/admin/orm/input-types.ts b/sdk/constructive-sdk/src/admin/orm/input-types.ts index 806b6b042..3f1ab47a3 100644 --- a/sdk/constructive-sdk/src/admin/orm/input-types.ts +++ b/sdk/constructive-sdk/src/admin/orm/input-types.ts @@ -3615,6 +3615,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -3622,6 +3624,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-sdk/src/auth/orm/client.ts b/sdk/constructive-sdk/src/auth/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-sdk/src/auth/orm/client.ts +++ b/sdk/constructive-sdk/src/auth/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-sdk/src/auth/orm/input-types.ts b/sdk/constructive-sdk/src/auth/orm/input-types.ts index ba12312ee..eb5c48d84 100644 --- a/sdk/constructive-sdk/src/auth/orm/input-types.ts +++ b/sdk/constructive-sdk/src/auth/orm/input-types.ts @@ -2440,6 +2440,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -2447,6 +2449,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-sdk/src/objects/orm/client.ts b/sdk/constructive-sdk/src/objects/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-sdk/src/objects/orm/client.ts +++ b/sdk/constructive-sdk/src/objects/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-sdk/src/objects/orm/input-types.ts b/sdk/constructive-sdk/src/objects/orm/input-types.ts index e1684b49e..5a7d7952c 100644 --- a/sdk/constructive-sdk/src/objects/orm/input-types.ts +++ b/sdk/constructive-sdk/src/objects/orm/input-types.ts @@ -829,6 +829,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -836,6 +838,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/constructive-sdk/src/public/orm/README.md b/sdk/constructive-sdk/src/public/orm/README.md index 74e83c23e..8f41c877f 100644 --- a/sdk/constructive-sdk/src/public/orm/README.md +++ b/sdk/constructive-sdk/src/public/orm/README.md @@ -2733,7 +2733,7 @@ CRUD operations for StorageModule records. | `filesTableName` | String | Yes | | `uploadRequestsTableName` | String | Yes | | `membershipType` | Int | Yes | -| `policies` | String | Yes | +| `policies` | JSON | Yes | | `entityTableId` | UUID | Yes | | `endpoint` | String | Yes | | `publicUrlPrefix` | String | Yes | @@ -2755,7 +2755,7 @@ const items = await db.storageModule.findMany({ select: { id: true, databaseId: const item = await db.storageModule.findOne({ id: '', select: { id: true, databaseId: true, schemaId: true, privateSchemaId: true, bucketsTableId: true, filesTableId: true, uploadRequestsTableId: true, bucketsTableName: true, filesTableName: true, uploadRequestsTableName: true, membershipType: true, policies: true, entityTableId: true, endpoint: true, publicUrlPrefix: true, provider: true, allowedOrigins: true, uploadUrlExpirySeconds: true, downloadUrlExpirySeconds: true, defaultMaxFileSize: true, maxFilenameLength: true, cacheTtlSeconds: true } }).execute(); // Create -const created = await db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute(); +const created = await db.storageModule.create({ data: { databaseId: '', schemaId: '', privateSchemaId: '', bucketsTableId: '', filesTableId: '', uploadRequestsTableId: '', bucketsTableName: '', filesTableName: '', uploadRequestsTableName: '', membershipType: '', policies: '', entityTableId: '', endpoint: '', publicUrlPrefix: '', provider: '', allowedOrigins: '', uploadUrlExpirySeconds: '', downloadUrlExpirySeconds: '', defaultMaxFileSize: '', maxFilenameLength: '', cacheTtlSeconds: '' }, select: { id: true } }).execute(); // Update const updated = await db.storageModule.update({ where: { id: '' }, data: { databaseId: '' }, select: { id: true } }).execute(); diff --git a/sdk/constructive-sdk/src/public/orm/client.ts b/sdk/constructive-sdk/src/public/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/constructive-sdk/src/public/orm/client.ts +++ b/sdk/constructive-sdk/src/public/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/constructive-sdk/src/public/orm/input-types.ts b/sdk/constructive-sdk/src/public/orm/input-types.ts index 888d00b99..069586eb8 100644 --- a/sdk/constructive-sdk/src/public/orm/input-types.ts +++ b/sdk/constructive-sdk/src/public/orm/input-types.ts @@ -1361,7 +1361,7 @@ export interface StorageModule { filesTableName?: string | null; uploadRequestsTableName?: string | null; membershipType?: number | null; - policies?: string[] | null; + policies?: Record | null; entityTableId?: string | null; endpoint?: string | null; publicUrlPrefix?: string | null; @@ -9422,7 +9422,7 @@ export interface StorageModuleFilter { /** Filter by the object’s `membershipType` field. */ membershipType?: IntFilter; /** Filter by the object’s `policies` field. */ - policies?: StringListFilter; + policies?: JSONFilter; /** Filter by the object’s `entityTableId` field. */ entityTableId?: UUIDFilter; /** Filter by the object’s `endpoint` field. */ @@ -16466,7 +16466,7 @@ export interface CreateStorageModuleInput { filesTableName?: string; uploadRequestsTableName?: string; membershipType?: number; - policies?: string[]; + policies?: Record; entityTableId?: string; endpoint?: string; publicUrlPrefix?: string; @@ -16490,7 +16490,7 @@ export interface StorageModulePatch { filesTableName?: string | null; uploadRequestsTableName?: string | null; membershipType?: number | null; - policies?: string[] | null; + policies?: Record | null; entityTableId?: string | null; endpoint?: string | null; publicUrlPrefix?: string | null; @@ -18535,6 +18535,7 @@ export interface ProvisionTableInput { indexes?: Record; fullTextSearches?: Record; uniqueConstraints?: Record; + description?: string; } export interface SendVerificationEmailInput { clientMutationId?: string; @@ -22806,7 +22807,7 @@ export interface StorageModuleFilter { /** Filter by the object’s `membershipType` field. */ membershipType?: IntFilter; /** Filter by the object’s `policies` field. */ - policies?: StringListFilter; + policies?: JSONFilter; /** Filter by the object’s `entityTableId` field. */ entityTableId?: UUIDFilter; /** Filter by the object’s `endpoint` field. */ @@ -25755,6 +25756,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -25762,6 +25765,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */ diff --git a/sdk/migrate-client/schemas/migrate.graphql b/sdk/migrate-client/schemas/migrate.graphql index 8b142b135..6f8ca5cfa 100644 --- a/sdk/migrate-client/schemas/migrate.graphql +++ b/sdk/migrate-client/schemas/migrate.graphql @@ -1118,6 +1118,11 @@ type RequestUploadUrlPayload { """Presigned URL expiry time (null if deduplicated)""" expiresAt: Datetime + + """ + File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. + """ + status: String! } input ConfirmUploadInput { diff --git a/sdk/migrate-client/src/migrate/orm/client.ts b/sdk/migrate-client/src/migrate/orm/client.ts index a1d5c74d8..39fb07eed 100644 --- a/sdk/migrate-client/src/migrate/orm/client.ts +++ b/sdk/migrate-client/src/migrate/orm/client.ts @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter { constructor( private endpoint: string, headers?: Record, - fetchFn?: typeof globalThis.fetch, + fetchFn?: typeof globalThis.fetch ) { this.headers = headers ?? {}; this.fetchFn = fetchFn ?? createFetch(); } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { const response = await this.fetchFn(this.endpoint, { method: 'POST', headers: { @@ -58,9 +55,7 @@ export class FetchAdapter implements GraphQLAdapter { return { ok: false, data: null, - errors: [ - { message: `HTTP ${response.status}: ${response.statusText}` }, - ], + errors: [{ message: `HTTP ${response.status}: ${response.statusText}` }], }; } @@ -120,7 +115,7 @@ export interface OrmClientConfig { export class GraphQLRequestError extends Error { constructor( public readonly errors: GraphQLError[], - public readonly data: unknown = null, + public readonly data: unknown = null ) { const messages = errors.map((e) => e.message).join('; '); super(`GraphQL Error: ${messages}`); @@ -135,22 +130,13 @@ export class OrmClient { if (config.adapter) { this.adapter = config.adapter; } else if (config.endpoint) { - this.adapter = new FetchAdapter( - config.endpoint, - config.headers, - config.fetch, - ); + this.adapter = new FetchAdapter(config.endpoint, config.headers, config.fetch); } else { - throw new Error( - 'OrmClientConfig requires either an endpoint or a custom adapter', - ); + throw new Error('OrmClientConfig requires either an endpoint or a custom adapter'); } } - async execute( - document: string, - variables?: Record, - ): Promise> { + async execute(document: string, variables?: Record): Promise> { return this.adapter.execute(document, variables); } diff --git a/sdk/migrate-client/src/migrate/orm/input-types.ts b/sdk/migrate-client/src/migrate/orm/input-types.ts index fafdcbb0a..35fc08ebf 100644 --- a/sdk/migrate-client/src/migrate/orm/input-types.ts +++ b/sdk/migrate-client/src/migrate/orm/input-types.ts @@ -544,6 +544,8 @@ export interface RequestUploadUrlPayload { deduplicated: boolean; /** Presigned URL expiry time (null if deduplicated) */ expiresAt?: string | null; + /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */ + status: string; } export type RequestUploadUrlPayloadSelect = { uploadUrl?: boolean; @@ -551,6 +553,7 @@ export type RequestUploadUrlPayloadSelect = { key?: boolean; deduplicated?: boolean; expiresAt?: boolean; + status?: boolean; }; export interface ConfirmUploadPayload { /** The confirmed file ID */