Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .agents/skills/cli-public/references/provision-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Composable table provisioning: creates or finds a table, then creates fields (so
## Usage

```bash
csdk provision-table --input.clientMutationId <String> --input.databaseId <UUID> --input.schemaId <UUID> --input.tableName <String> --input.tableId <UUID> --input.nodes <JSON> --input.fields <JSON> --input.policies <JSON> --input.grants <JSON> --input.useRls <Boolean> --input.indexes <JSON> --input.fullTextSearches <JSON> --input.uniqueConstraints <JSON>
csdk provision-table --input.clientMutationId <String> --input.databaseId <UUID> --input.schemaId <UUID> --input.tableName <String> --input.tableId <UUID> --input.nodes <JSON> --input.fields <JSON> --input.policies <JSON> --input.grants <JSON> --input.useRls <Boolean> --input.indexes <JSON> --input.fullTextSearches <JSON> --input.uniqueConstraints <JSON> --input.description <String>
```

## Examples

### Run provisionTable

```bash
csdk provision-table --input.clientMutationId <String> --input.databaseId <UUID> --input.schemaId <UUID> --input.tableName <String> --input.tableId <UUID> --input.nodes <JSON> --input.fields <JSON> --input.policies <JSON> --input.grants <JSON> --input.useRls <Boolean> --input.indexes <JSON> --input.fullTextSearches <JSON> --input.uniqueConstraints <JSON>
csdk provision-table --input.clientMutationId <String> --input.databaseId <UUID> --input.schemaId <UUID> --input.tableName <String> --input.tableId <UUID> --input.nodes <JSON> --input.fields <JSON> --input.policies <JSON> --input.grants <JSON> --input.useRls <Boolean> --input.indexes <JSON> --input.fullTextSearches <JSON> --input.uniqueConstraints <JSON> --input.description <String>
```
6 changes: 3 additions & 3 deletions .agents/skills/cli-public/references/storage-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ csdk storage-module list --where.<field>.<op> <value> --orderBy <values>
csdk storage-module list --limit 10 --after <cursor>
csdk storage-module find-first --where.<field>.<op> <value>
csdk storage-module get --id <UUID>
csdk storage-module create --databaseId <UUID> [--schemaId <UUID>] [--privateSchemaId <UUID>] [--bucketsTableId <UUID>] [--filesTableId <UUID>] [--uploadRequestsTableId <UUID>] [--bucketsTableName <String>] [--filesTableName <String>] [--uploadRequestsTableName <String>] [--membershipType <Int>] [--policies <String>] [--entityTableId <UUID>] [--endpoint <String>] [--publicUrlPrefix <String>] [--provider <String>] [--allowedOrigins <String>] [--uploadUrlExpirySeconds <Int>] [--downloadUrlExpirySeconds <Int>] [--defaultMaxFileSize <BigInt>] [--maxFilenameLength <Int>] [--cacheTtlSeconds <Int>]
csdk storage-module update --id <UUID> [--databaseId <UUID>] [--schemaId <UUID>] [--privateSchemaId <UUID>] [--bucketsTableId <UUID>] [--filesTableId <UUID>] [--uploadRequestsTableId <UUID>] [--bucketsTableName <String>] [--filesTableName <String>] [--uploadRequestsTableName <String>] [--membershipType <Int>] [--policies <String>] [--entityTableId <UUID>] [--endpoint <String>] [--publicUrlPrefix <String>] [--provider <String>] [--allowedOrigins <String>] [--uploadUrlExpirySeconds <Int>] [--downloadUrlExpirySeconds <Int>] [--defaultMaxFileSize <BigInt>] [--maxFilenameLength <Int>] [--cacheTtlSeconds <Int>]
csdk storage-module create --databaseId <UUID> [--schemaId <UUID>] [--privateSchemaId <UUID>] [--bucketsTableId <UUID>] [--filesTableId <UUID>] [--uploadRequestsTableId <UUID>] [--bucketsTableName <String>] [--filesTableName <String>] [--uploadRequestsTableName <String>] [--membershipType <Int>] [--policies <JSON>] [--entityTableId <UUID>] [--endpoint <String>] [--publicUrlPrefix <String>] [--provider <String>] [--allowedOrigins <String>] [--uploadUrlExpirySeconds <Int>] [--downloadUrlExpirySeconds <Int>] [--defaultMaxFileSize <BigInt>] [--maxFilenameLength <Int>] [--cacheTtlSeconds <Int>]
csdk storage-module update --id <UUID> [--databaseId <UUID>] [--schemaId <UUID>] [--privateSchemaId <UUID>] [--bucketsTableId <UUID>] [--filesTableId <UUID>] [--uploadRequestsTableId <UUID>] [--bucketsTableName <String>] [--filesTableName <String>] [--uploadRequestsTableName <String>] [--membershipType <Int>] [--policies <JSON>] [--entityTableId <UUID>] [--endpoint <String>] [--publicUrlPrefix <String>] [--provider <String>] [--allowedOrigins <String>] [--uploadUrlExpirySeconds <Int>] [--downloadUrlExpirySeconds <Int>] [--defaultMaxFileSize <BigInt>] [--maxFilenameLength <Int>] [--cacheTtlSeconds <Int>]
csdk storage-module delete --id <UUID>
```

Expand Down Expand Up @@ -58,7 +58,7 @@ csdk storage-module list --where.id.equalTo <value> --orderBy ID_ASC
### Create a storageModule

```bash
csdk storage-module create --databaseId <UUID> [--schemaId <UUID>] [--privateSchemaId <UUID>] [--bucketsTableId <UUID>] [--filesTableId <UUID>] [--uploadRequestsTableId <UUID>] [--bucketsTableName <String>] [--filesTableName <String>] [--uploadRequestsTableName <String>] [--membershipType <Int>] [--policies <String>] [--entityTableId <UUID>] [--endpoint <String>] [--publicUrlPrefix <String>] [--provider <String>] [--allowedOrigins <String>] [--uploadUrlExpirySeconds <Int>] [--downloadUrlExpirySeconds <Int>] [--defaultMaxFileSize <BigInt>] [--maxFilenameLength <Int>] [--cacheTtlSeconds <Int>]
csdk storage-module create --databaseId <UUID> [--schemaId <UUID>] [--privateSchemaId <UUID>] [--bucketsTableId <UUID>] [--filesTableId <UUID>] [--uploadRequestsTableId <UUID>] [--bucketsTableName <String>] [--filesTableName <String>] [--uploadRequestsTableName <String>] [--membershipType <Int>] [--policies <JSON>] [--entityTableId <UUID>] [--endpoint <String>] [--publicUrlPrefix <String>] [--provider <String>] [--allowedOrigins <String>] [--uploadUrlExpirySeconds <Int>] [--downloadUrlExpirySeconds <Int>] [--defaultMaxFileSize <BigInt>] [--maxFilenameLength <Int>] [--cacheTtlSeconds <Int>]
```

### Get a storageModule by id
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/hooks-public/references/storage-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ const { data, isLoading } = useStorageModulesQuery({
const { mutate } = useCreateStorageModuleMutation({
selection: { fields: { id: true } },
});
mutate({ databaseId: '<UUID>', schemaId: '<UUID>', privateSchemaId: '<UUID>', bucketsTableId: '<UUID>', filesTableId: '<UUID>', uploadRequestsTableId: '<UUID>', bucketsTableName: '<String>', filesTableName: '<String>', uploadRequestsTableName: '<String>', membershipType: '<Int>', policies: '<String>', entityTableId: '<UUID>', endpoint: '<String>', publicUrlPrefix: '<String>', provider: '<String>', allowedOrigins: '<String>', uploadUrlExpirySeconds: '<Int>', downloadUrlExpirySeconds: '<Int>', defaultMaxFileSize: '<BigInt>', maxFilenameLength: '<Int>', cacheTtlSeconds: '<Int>' });
mutate({ databaseId: '<UUID>', schemaId: '<UUID>', privateSchemaId: '<UUID>', bucketsTableId: '<UUID>', filesTableId: '<UUID>', uploadRequestsTableId: '<UUID>', bucketsTableName: '<String>', filesTableName: '<String>', uploadRequestsTableName: '<String>', membershipType: '<Int>', policies: '<JSON>', entityTableId: '<UUID>', endpoint: '<String>', publicUrlPrefix: '<String>', provider: '<String>', allowedOrigins: '<String>', uploadUrlExpirySeconds: '<Int>', downloadUrlExpirySeconds: '<Int>', defaultMaxFileSize: '<BigInt>', maxFilenameLength: '<Int>', cacheTtlSeconds: '<Int>' });
```
4 changes: 2 additions & 2 deletions .agents/skills/orm-public/references/storage-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ORM operations for StorageModule records
```typescript
db.storageModule.findMany({ select: { id: true } }).execute()
db.storageModule.findOne({ id: '<UUID>', select: { id: true } }).execute()
db.storageModule.create({ data: { databaseId: '<UUID>', schemaId: '<UUID>', privateSchemaId: '<UUID>', bucketsTableId: '<UUID>', filesTableId: '<UUID>', uploadRequestsTableId: '<UUID>', bucketsTableName: '<String>', filesTableName: '<String>', uploadRequestsTableName: '<String>', membershipType: '<Int>', policies: '<String>', entityTableId: '<UUID>', endpoint: '<String>', publicUrlPrefix: '<String>', provider: '<String>', allowedOrigins: '<String>', uploadUrlExpirySeconds: '<Int>', downloadUrlExpirySeconds: '<Int>', defaultMaxFileSize: '<BigInt>', maxFilenameLength: '<Int>', cacheTtlSeconds: '<Int>' }, select: { id: true } }).execute()
db.storageModule.create({ data: { databaseId: '<UUID>', schemaId: '<UUID>', privateSchemaId: '<UUID>', bucketsTableId: '<UUID>', filesTableId: '<UUID>', uploadRequestsTableId: '<UUID>', bucketsTableName: '<String>', filesTableName: '<String>', uploadRequestsTableName: '<String>', membershipType: '<Int>', policies: '<JSON>', entityTableId: '<UUID>', endpoint: '<String>', publicUrlPrefix: '<String>', provider: '<String>', allowedOrigins: '<String>', uploadUrlExpirySeconds: '<Int>', downloadUrlExpirySeconds: '<Int>', defaultMaxFileSize: '<BigInt>', maxFilenameLength: '<Int>', cacheTtlSeconds: '<Int>' }, select: { id: true } }).execute()
db.storageModule.update({ where: { id: '<UUID>' }, data: { databaseId: '<UUID>' }, select: { id: true } }).execute()
db.storageModule.delete({ where: { id: '<UUID>' } }).execute()
```
Expand All @@ -28,7 +28,7 @@ const items = await db.storageModule.findMany({

```typescript
const item = await db.storageModule.create({
data: { databaseId: '<UUID>', schemaId: '<UUID>', privateSchemaId: '<UUID>', bucketsTableId: '<UUID>', filesTableId: '<UUID>', uploadRequestsTableId: '<UUID>', bucketsTableName: '<String>', filesTableName: '<String>', uploadRequestsTableName: '<String>', membershipType: '<Int>', policies: '<String>', entityTableId: '<UUID>', endpoint: '<String>', publicUrlPrefix: '<String>', provider: '<String>', allowedOrigins: '<String>', uploadUrlExpirySeconds: '<Int>', downloadUrlExpirySeconds: '<Int>', defaultMaxFileSize: '<BigInt>', maxFilenameLength: '<Int>', cacheTtlSeconds: '<Int>' },
data: { databaseId: '<UUID>', schemaId: '<UUID>', privateSchemaId: '<UUID>', bucketsTableId: '<UUID>', filesTableId: '<UUID>', uploadRequestsTableId: '<UUID>', bucketsTableName: '<String>', filesTableName: '<String>', uploadRequestsTableName: '<String>', membershipType: '<Int>', policies: '<JSON>', entityTableId: '<UUID>', endpoint: '<String>', publicUrlPrefix: '<String>', provider: '<String>', allowedOrigins: '<String>', uploadUrlExpirySeconds: '<Int>', downloadUrlExpirySeconds: '<Int>', defaultMaxFileSize: '<BigInt>', maxFilenameLength: '<Int>', cacheTtlSeconds: '<Int>' },
select: { id: true }
}).execute();
```
28 changes: 7 additions & 21 deletions sdk/constructive-cli/src/admin/orm/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter {
constructor(
private endpoint: string,
headers?: Record<string, string>,
fetchFn?: typeof globalThis.fetch,
fetchFn?: typeof globalThis.fetch
) {
this.headers = headers ?? {};
this.fetchFn = fetchFn ?? createFetch();
}

async execute<T>(
document: string,
variables?: Record<string, unknown>,
): Promise<QueryResult<T>> {
async execute<T>(document: string, variables?: Record<string, unknown>): Promise<QueryResult<T>> {
const response = await this.fetchFn(this.endpoint, {
method: 'POST',
headers: {
Expand All @@ -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}` }],
};
}

Expand Down Expand Up @@ -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}`);
Expand All @@ -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<T>(
document: string,
variables?: Record<string, unknown>,
): Promise<QueryResult<T>> {
async execute<T>(document: string, variables?: Record<string, unknown>): Promise<QueryResult<T>> {
return this.adapter.execute<T>(document, variables);
}

Expand Down
3 changes: 3 additions & 0 deletions sdk/constructive-cli/src/admin/orm/input-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3615,13 +3615,16 @@ 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;
fileId?: boolean;
key?: boolean;
deduplicated?: boolean;
expiresAt?: boolean;
status?: boolean;
};
export interface ConfirmUploadPayload {
/** The confirmed file ID */
Expand Down
28 changes: 7 additions & 21 deletions sdk/constructive-cli/src/auth/orm/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter {
constructor(
private endpoint: string,
headers?: Record<string, string>,
fetchFn?: typeof globalThis.fetch,
fetchFn?: typeof globalThis.fetch
) {
this.headers = headers ?? {};
this.fetchFn = fetchFn ?? createFetch();
}

async execute<T>(
document: string,
variables?: Record<string, unknown>,
): Promise<QueryResult<T>> {
async execute<T>(document: string, variables?: Record<string, unknown>): Promise<QueryResult<T>> {
const response = await this.fetchFn(this.endpoint, {
method: 'POST',
headers: {
Expand All @@ -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}` }],
};
}

Expand Down Expand Up @@ -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}`);
Expand All @@ -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<T>(
document: string,
variables?: Record<string, unknown>,
): Promise<QueryResult<T>> {
async execute<T>(document: string, variables?: Record<string, unknown>): Promise<QueryResult<T>> {
return this.adapter.execute<T>(document, variables);
}

Expand Down
3 changes: 3 additions & 0 deletions sdk/constructive-cli/src/auth/orm/input-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2440,13 +2440,16 @@ 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;
fileId?: boolean;
key?: boolean;
deduplicated?: boolean;
expiresAt?: boolean;
status?: boolean;
};
export interface ConfirmUploadPayload {
/** The confirmed file ID */
Expand Down
28 changes: 7 additions & 21 deletions sdk/constructive-cli/src/objects/orm/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ export class FetchAdapter implements GraphQLAdapter {
constructor(
private endpoint: string,
headers?: Record<string, string>,
fetchFn?: typeof globalThis.fetch,
fetchFn?: typeof globalThis.fetch
) {
this.headers = headers ?? {};
this.fetchFn = fetchFn ?? createFetch();
}

async execute<T>(
document: string,
variables?: Record<string, unknown>,
): Promise<QueryResult<T>> {
async execute<T>(document: string, variables?: Record<string, unknown>): Promise<QueryResult<T>> {
const response = await this.fetchFn(this.endpoint, {
method: 'POST',
headers: {
Expand All @@ -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}` }],
};
}

Expand Down Expand Up @@ -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}`);
Expand All @@ -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<T>(
document: string,
variables?: Record<string, unknown>,
): Promise<QueryResult<T>> {
async execute<T>(document: string, variables?: Record<string, unknown>): Promise<QueryResult<T>> {
return this.adapter.execute<T>(document, variables);
}

Expand Down
3 changes: 3 additions & 0 deletions sdk/constructive-cli/src/objects/orm/input-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,16 @@ 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;
fileId?: boolean;
key?: boolean;
deduplicated?: boolean;
expiresAt?: boolean;
status?: boolean;
};
export interface ConfirmUploadPayload {
/** The confirmed file ID */
Expand Down
3 changes: 2 additions & 1 deletion sdk/constructive-cli/src/public/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const fieldSchema: FieldSchema = {
filesTableName: 'string',
uploadRequestsTableName: 'string',
membershipType: 'int',
policies: 'string',
policies: 'json',
entityTableId: 'uuid',
endpoint: 'string',
publicUrlPrefix: 'string',
Expand Down Expand Up @@ -293,7 +293,7 @@ async function handleCreate(argv: Partial<Record<string, unknown>>, prompter: In
skipPrompt: true,
},
{
type: 'text',
type: 'json',
name: 'policies',
message: 'policies',
required: false,
Expand Down Expand Up @@ -515,7 +515,7 @@ async function handleUpdate(argv: Partial<Record<string, unknown>>, prompter: In
skipPrompt: true,
},
{
type: 'text',
type: 'json',
name: 'policies',
message: 'policies',
required: false,
Expand Down
Loading
Loading