@constructive-sdk/cli 0.12.22 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/cli/commands/confirm-upload.d.ts +8 -0
- package/admin/cli/commands/confirm-upload.js +36 -0
- package/admin/cli/commands/provision-bucket.d.ts +8 -0
- package/admin/cli/commands/provision-bucket.js +36 -0
- package/admin/cli/commands/request-upload-url.d.ts +8 -0
- package/admin/cli/commands/request-upload-url.js +36 -0
- package/admin/cli/commands.js +7 -1
- package/admin/cli/executor.d.ts +15 -0
- package/admin/orm/index.d.ts +15 -0
- package/admin/orm/input-types.d.ts +74 -0
- package/admin/orm/mutation/index.d.ts +45 -1
- package/admin/orm/mutation/index.js +36 -0
- package/auth/cli/commands/confirm-upload.d.ts +8 -0
- package/auth/cli/commands/confirm-upload.js +36 -0
- package/auth/cli/commands/provision-bucket.d.ts +8 -0
- package/auth/cli/commands/provision-bucket.js +36 -0
- package/auth/cli/commands/request-upload-url.d.ts +8 -0
- package/auth/cli/commands/request-upload-url.js +36 -0
- package/auth/cli/commands.js +7 -1
- package/auth/cli/executor.d.ts +15 -0
- package/auth/orm/index.d.ts +15 -0
- package/auth/orm/input-types.d.ts +74 -0
- package/auth/orm/mutation/index.d.ts +45 -1
- package/auth/orm/mutation/index.js +36 -0
- package/esm/admin/cli/commands/confirm-upload.d.ts +8 -0
- package/esm/admin/cli/commands/confirm-upload.js +34 -0
- package/esm/admin/cli/commands/provision-bucket.d.ts +8 -0
- package/esm/admin/cli/commands/provision-bucket.js +34 -0
- package/esm/admin/cli/commands/request-upload-url.d.ts +8 -0
- package/esm/admin/cli/commands/request-upload-url.js +34 -0
- package/esm/admin/cli/commands.js +7 -1
- package/esm/admin/cli/executor.d.ts +15 -0
- package/esm/admin/orm/index.d.ts +15 -0
- package/esm/admin/orm/input-types.d.ts +74 -0
- package/esm/admin/orm/mutation/index.d.ts +45 -1
- package/esm/admin/orm/mutation/index.js +36 -0
- package/esm/auth/cli/commands/confirm-upload.d.ts +8 -0
- package/esm/auth/cli/commands/confirm-upload.js +34 -0
- package/esm/auth/cli/commands/provision-bucket.d.ts +8 -0
- package/esm/auth/cli/commands/provision-bucket.js +34 -0
- package/esm/auth/cli/commands/request-upload-url.d.ts +8 -0
- package/esm/auth/cli/commands/request-upload-url.js +34 -0
- package/esm/auth/cli/commands.js +7 -1
- package/esm/auth/cli/executor.d.ts +15 -0
- package/esm/auth/orm/index.d.ts +15 -0
- package/esm/auth/orm/input-types.d.ts +74 -0
- package/esm/auth/orm/mutation/index.d.ts +45 -1
- package/esm/auth/orm/mutation/index.js +36 -0
- package/esm/objects/cli/commands/confirm-upload.d.ts +8 -0
- package/esm/objects/cli/commands/confirm-upload.js +34 -0
- package/esm/objects/cli/commands/provision-bucket.d.ts +8 -0
- package/esm/objects/cli/commands/provision-bucket.js +34 -0
- package/esm/objects/cli/commands/request-upload-url.d.ts +8 -0
- package/esm/objects/cli/commands/request-upload-url.js +34 -0
- package/esm/objects/cli/commands.js +7 -1
- package/esm/objects/cli/executor.d.ts +15 -0
- package/esm/objects/orm/index.d.ts +15 -0
- package/esm/objects/orm/input-types.d.ts +74 -0
- package/esm/objects/orm/mutation/index.d.ts +45 -1
- package/esm/objects/orm/mutation/index.js +36 -0
- package/esm/public/cli/commands/confirm-upload.d.ts +8 -0
- package/esm/public/cli/commands/confirm-upload.js +34 -0
- package/esm/public/cli/commands/provision-bucket.d.ts +8 -0
- package/esm/public/cli/commands/provision-bucket.js +34 -0
- package/esm/public/cli/commands/request-upload-url.d.ts +8 -0
- package/esm/public/cli/commands/request-upload-url.js +34 -0
- package/esm/public/cli/commands/storage-module.js +88 -0
- package/esm/public/cli/commands.js +7 -1
- package/esm/public/cli/executor.d.ts +15 -0
- package/esm/public/orm/index.d.ts +15 -0
- package/esm/public/orm/input-types.d.ts +107 -1
- package/esm/public/orm/mutation/index.d.ts +45 -1
- package/esm/public/orm/mutation/index.js +36 -0
- package/objects/cli/commands/confirm-upload.d.ts +8 -0
- package/objects/cli/commands/confirm-upload.js +36 -0
- package/objects/cli/commands/provision-bucket.d.ts +8 -0
- package/objects/cli/commands/provision-bucket.js +36 -0
- package/objects/cli/commands/request-upload-url.d.ts +8 -0
- package/objects/cli/commands/request-upload-url.js +36 -0
- package/objects/cli/commands.js +7 -1
- package/objects/cli/executor.d.ts +15 -0
- package/objects/orm/index.d.ts +15 -0
- package/objects/orm/input-types.d.ts +74 -0
- package/objects/orm/mutation/index.d.ts +45 -1
- package/objects/orm/mutation/index.js +36 -0
- package/package.json +4 -4
- package/public/cli/commands/confirm-upload.d.ts +8 -0
- package/public/cli/commands/confirm-upload.js +36 -0
- package/public/cli/commands/provision-bucket.d.ts +8 -0
- package/public/cli/commands/provision-bucket.js +36 -0
- package/public/cli/commands/request-upload-url.d.ts +8 -0
- package/public/cli/commands/request-upload-url.js +36 -0
- package/public/cli/commands/storage-module.js +88 -0
- package/public/cli/commands.js +7 -1
- package/public/cli/executor.d.ts +15 -0
- package/public/orm/index.d.ts +15 -0
- package/public/orm/input-types.d.ts +107 -1
- package/public/orm/mutation/index.d.ts +45 -1
- package/public/orm/mutation/index.js +36 -0
|
@@ -629,6 +629,26 @@ export interface SetAndCommitInput {
|
|
|
629
629
|
kids?: string[];
|
|
630
630
|
ktree?: string[];
|
|
631
631
|
}
|
|
632
|
+
export interface RequestUploadUrlInput {
|
|
633
|
+
/** Bucket key (e.g., "public", "private") */
|
|
634
|
+
bucketKey: string;
|
|
635
|
+
/** SHA-256 content hash computed by the client (hex-encoded, 64 chars) */
|
|
636
|
+
contentHash: string;
|
|
637
|
+
/** MIME type of the file (e.g., "image/png") */
|
|
638
|
+
contentType: string;
|
|
639
|
+
/** File size in bytes */
|
|
640
|
+
size: number;
|
|
641
|
+
/** Original filename (optional, for display and Content-Disposition) */
|
|
642
|
+
filename?: string;
|
|
643
|
+
}
|
|
644
|
+
export interface ConfirmUploadInput {
|
|
645
|
+
/** The file ID returned by requestUploadUrl */
|
|
646
|
+
fileId: string;
|
|
647
|
+
}
|
|
648
|
+
export interface ProvisionBucketInput {
|
|
649
|
+
/** The logical bucket key (e.g., "public", "private") */
|
|
650
|
+
bucketKey: string;
|
|
651
|
+
}
|
|
632
652
|
/** A connection to a list of `Object` values. */
|
|
633
653
|
export interface ObjectConnection {
|
|
634
654
|
nodes: Object[];
|
|
@@ -708,6 +728,60 @@ export type SetAndCommitPayloadSelect = {
|
|
|
708
728
|
clientMutationId?: boolean;
|
|
709
729
|
result?: boolean;
|
|
710
730
|
};
|
|
731
|
+
export interface RequestUploadUrlPayload {
|
|
732
|
+
/** Presigned PUT URL (null if file was deduplicated) */
|
|
733
|
+
uploadUrl?: string | null;
|
|
734
|
+
/** The file ID (existing if deduplicated, new if fresh upload) */
|
|
735
|
+
fileId: string;
|
|
736
|
+
/** The S3 object key */
|
|
737
|
+
key: string;
|
|
738
|
+
/** Whether this file was deduplicated (already exists with same hash) */
|
|
739
|
+
deduplicated: boolean;
|
|
740
|
+
/** Presigned URL expiry time (null if deduplicated) */
|
|
741
|
+
expiresAt?: string | null;
|
|
742
|
+
}
|
|
743
|
+
export type RequestUploadUrlPayloadSelect = {
|
|
744
|
+
uploadUrl?: boolean;
|
|
745
|
+
fileId?: boolean;
|
|
746
|
+
key?: boolean;
|
|
747
|
+
deduplicated?: boolean;
|
|
748
|
+
expiresAt?: boolean;
|
|
749
|
+
};
|
|
750
|
+
export interface ConfirmUploadPayload {
|
|
751
|
+
/** The confirmed file ID */
|
|
752
|
+
fileId: string;
|
|
753
|
+
/** New file status */
|
|
754
|
+
status: string;
|
|
755
|
+
/** Whether confirmation succeeded */
|
|
756
|
+
success: boolean;
|
|
757
|
+
}
|
|
758
|
+
export type ConfirmUploadPayloadSelect = {
|
|
759
|
+
fileId?: boolean;
|
|
760
|
+
status?: boolean;
|
|
761
|
+
success?: boolean;
|
|
762
|
+
};
|
|
763
|
+
export interface ProvisionBucketPayload {
|
|
764
|
+
/** Whether provisioning succeeded */
|
|
765
|
+
success: boolean;
|
|
766
|
+
/** The S3 bucket name that was provisioned */
|
|
767
|
+
bucketName: string;
|
|
768
|
+
/** The access type applied */
|
|
769
|
+
accessType: string;
|
|
770
|
+
/** The storage provider used */
|
|
771
|
+
provider: string;
|
|
772
|
+
/** The S3 endpoint (null for AWS S3 default) */
|
|
773
|
+
endpoint?: string | null;
|
|
774
|
+
/** Error message if provisioning failed */
|
|
775
|
+
error?: string | null;
|
|
776
|
+
}
|
|
777
|
+
export type ProvisionBucketPayloadSelect = {
|
|
778
|
+
success?: boolean;
|
|
779
|
+
bucketName?: boolean;
|
|
780
|
+
accessType?: boolean;
|
|
781
|
+
provider?: boolean;
|
|
782
|
+
endpoint?: boolean;
|
|
783
|
+
error?: boolean;
|
|
784
|
+
};
|
|
711
785
|
export interface CreateObjectPayload {
|
|
712
786
|
clientMutationId?: string | null;
|
|
713
787
|
/** The `Object` that was created by this mutation. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { OrmClient } from '../client';
|
|
7
7
|
import { QueryBuilder } from '../query-builder';
|
|
8
8
|
import type { InferSelectResult, StrictSelect } from '../select-types';
|
|
9
|
-
import type { FreezeObjectsInput, InitEmptyRepoInput, RemoveNodeAtPathInput, SetDataAtPathInput, SetPropsAndCommitInput, InsertNodeAtPathInput, UpdateNodeAtPathInput, SetAndCommitInput, FreezeObjectsPayload, InitEmptyRepoPayload, RemoveNodeAtPathPayload, SetDataAtPathPayload, SetPropsAndCommitPayload, InsertNodeAtPathPayload, UpdateNodeAtPathPayload, SetAndCommitPayload, FreezeObjectsPayloadSelect, InitEmptyRepoPayloadSelect, RemoveNodeAtPathPayloadSelect, SetDataAtPathPayloadSelect, SetPropsAndCommitPayloadSelect, InsertNodeAtPathPayloadSelect, UpdateNodeAtPathPayloadSelect, SetAndCommitPayloadSelect } from '../input-types';
|
|
9
|
+
import type { FreezeObjectsInput, InitEmptyRepoInput, RemoveNodeAtPathInput, SetDataAtPathInput, SetPropsAndCommitInput, InsertNodeAtPathInput, UpdateNodeAtPathInput, SetAndCommitInput, RequestUploadUrlInput, ConfirmUploadInput, ProvisionBucketInput, FreezeObjectsPayload, InitEmptyRepoPayload, RemoveNodeAtPathPayload, SetDataAtPathPayload, SetPropsAndCommitPayload, InsertNodeAtPathPayload, UpdateNodeAtPathPayload, SetAndCommitPayload, RequestUploadUrlPayload, ConfirmUploadPayload, ProvisionBucketPayload, FreezeObjectsPayloadSelect, InitEmptyRepoPayloadSelect, RemoveNodeAtPathPayloadSelect, SetDataAtPathPayloadSelect, SetPropsAndCommitPayloadSelect, InsertNodeAtPathPayloadSelect, UpdateNodeAtPathPayloadSelect, SetAndCommitPayloadSelect, RequestUploadUrlPayloadSelect, ConfirmUploadPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
|
|
10
10
|
export interface FreezeObjectsVariables {
|
|
11
11
|
input: FreezeObjectsInput;
|
|
12
12
|
}
|
|
@@ -31,6 +31,35 @@ export interface UpdateNodeAtPathVariables {
|
|
|
31
31
|
export interface SetAndCommitVariables {
|
|
32
32
|
input: SetAndCommitInput;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Variables for requestUploadUrl
|
|
36
|
+
* Request a presigned URL for uploading a file directly to S3.
|
|
37
|
+
Client computes SHA-256 of the file content and provides it here.
|
|
38
|
+
If a file with the same hash already exists (dedup), returns the
|
|
39
|
+
existing file ID and deduplicated=true with no uploadUrl.
|
|
40
|
+
*/
|
|
41
|
+
export interface RequestUploadUrlVariables {
|
|
42
|
+
input: RequestUploadUrlInput;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Variables for confirmUpload
|
|
46
|
+
* Confirm that a file has been uploaded to S3.
|
|
47
|
+
Verifies the object exists in S3, checks content-type,
|
|
48
|
+
and transitions the file status from 'pending' to 'ready'.
|
|
49
|
+
*/
|
|
50
|
+
export interface ConfirmUploadVariables {
|
|
51
|
+
input: ConfirmUploadInput;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Variables for provisionBucket
|
|
55
|
+
* Provision an S3 bucket for a logical bucket in the database.
|
|
56
|
+
Reads the bucket config via RLS, then creates and configures
|
|
57
|
+
the S3 bucket with the appropriate privacy policies, CORS rules,
|
|
58
|
+
and lifecycle settings.
|
|
59
|
+
*/
|
|
60
|
+
export interface ProvisionBucketVariables {
|
|
61
|
+
input: ProvisionBucketInput;
|
|
62
|
+
}
|
|
34
63
|
export declare function createMutationOperations(client: OrmClient): {
|
|
35
64
|
freezeObjects: <S extends FreezeObjectsPayloadSelect>(args: FreezeObjectsVariables, options: {
|
|
36
65
|
select: S;
|
|
@@ -72,4 +101,19 @@ export declare function createMutationOperations(client: OrmClient): {
|
|
|
72
101
|
} & StrictSelect<S, SetAndCommitPayloadSelect>) => QueryBuilder<{
|
|
73
102
|
setAndCommit: InferSelectResult<SetAndCommitPayload, S> | null;
|
|
74
103
|
}>;
|
|
104
|
+
requestUploadUrl: <S extends RequestUploadUrlPayloadSelect>(args: RequestUploadUrlVariables, options: {
|
|
105
|
+
select: S;
|
|
106
|
+
} & StrictSelect<S, RequestUploadUrlPayloadSelect>) => QueryBuilder<{
|
|
107
|
+
requestUploadUrl: InferSelectResult<RequestUploadUrlPayload, S> | null;
|
|
108
|
+
}>;
|
|
109
|
+
confirmUpload: <S extends ConfirmUploadPayloadSelect>(args: ConfirmUploadVariables, options: {
|
|
110
|
+
select: S;
|
|
111
|
+
} & StrictSelect<S, ConfirmUploadPayloadSelect>) => QueryBuilder<{
|
|
112
|
+
confirmUpload: InferSelectResult<ConfirmUploadPayload, S> | null;
|
|
113
|
+
}>;
|
|
114
|
+
provisionBucket: <S extends ProvisionBucketPayloadSelect>(args: ProvisionBucketVariables, options: {
|
|
115
|
+
select: S;
|
|
116
|
+
} & StrictSelect<S, ProvisionBucketPayloadSelect>) => QueryBuilder<{
|
|
117
|
+
provisionBucket: InferSelectResult<ProvisionBucketPayload, S> | null;
|
|
118
|
+
}>;
|
|
75
119
|
};
|
|
@@ -98,5 +98,41 @@ export function createMutationOperations(client) {
|
|
|
98
98
|
},
|
|
99
99
|
], connectionFieldsMap, 'SetAndCommitPayload'),
|
|
100
100
|
}),
|
|
101
|
+
requestUploadUrl: (args, options) => new QueryBuilder({
|
|
102
|
+
client,
|
|
103
|
+
operation: 'mutation',
|
|
104
|
+
operationName: 'RequestUploadUrl',
|
|
105
|
+
fieldName: 'requestUploadUrl',
|
|
106
|
+
...buildCustomDocument('mutation', 'RequestUploadUrl', 'requestUploadUrl', options.select, args, [
|
|
107
|
+
{
|
|
108
|
+
name: 'input',
|
|
109
|
+
type: 'RequestUploadUrlInput!',
|
|
110
|
+
},
|
|
111
|
+
], connectionFieldsMap, 'RequestUploadUrlPayload'),
|
|
112
|
+
}),
|
|
113
|
+
confirmUpload: (args, options) => new QueryBuilder({
|
|
114
|
+
client,
|
|
115
|
+
operation: 'mutation',
|
|
116
|
+
operationName: 'ConfirmUpload',
|
|
117
|
+
fieldName: 'confirmUpload',
|
|
118
|
+
...buildCustomDocument('mutation', 'ConfirmUpload', 'confirmUpload', options.select, args, [
|
|
119
|
+
{
|
|
120
|
+
name: 'input',
|
|
121
|
+
type: 'ConfirmUploadInput!',
|
|
122
|
+
},
|
|
123
|
+
], connectionFieldsMap, 'ConfirmUploadPayload'),
|
|
124
|
+
}),
|
|
125
|
+
provisionBucket: (args, options) => new QueryBuilder({
|
|
126
|
+
client,
|
|
127
|
+
operation: 'mutation',
|
|
128
|
+
operationName: 'ProvisionBucket',
|
|
129
|
+
fieldName: 'provisionBucket',
|
|
130
|
+
...buildCustomDocument('mutation', 'ProvisionBucket', 'provisionBucket', options.select, args, [
|
|
131
|
+
{
|
|
132
|
+
name: 'input',
|
|
133
|
+
type: 'ProvisionBucketInput!',
|
|
134
|
+
},
|
|
135
|
+
], connectionFieldsMap, 'ProvisionBucketPayload'),
|
|
136
|
+
}),
|
|
101
137
|
};
|
|
102
138
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for mutation confirmUpload
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
7
|
+
declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getClient } from '../executor';
|
|
2
|
+
import { unflattenDotNotation, buildSelectFromPaths } from '../utils';
|
|
3
|
+
export default async (argv, prompter, _options) => {
|
|
4
|
+
try {
|
|
5
|
+
if (argv.help || argv.h) {
|
|
6
|
+
console.log("confirm-upload - Confirm that a file has been uploaded to S3.\nVerifies the object exists in S3, checks content-type,\nand transitions the file status from 'pending' to 'ready'.\n\nUsage: confirm-upload [OPTIONS]\n");
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
const answers = await prompter.prompt(argv, [
|
|
10
|
+
{
|
|
11
|
+
type: 'text',
|
|
12
|
+
name: 'input',
|
|
13
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
]);
|
|
17
|
+
const client = getClient();
|
|
18
|
+
const parsedAnswers = unflattenDotNotation(answers);
|
|
19
|
+
const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId');
|
|
20
|
+
const result = await client.mutation
|
|
21
|
+
.confirmUpload(parsedAnswers, {
|
|
22
|
+
select: selectFields,
|
|
23
|
+
})
|
|
24
|
+
.execute();
|
|
25
|
+
console.log(JSON.stringify(result, null, 2));
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Failed: confirmUpload');
|
|
29
|
+
if (error instanceof Error) {
|
|
30
|
+
console.error(error.message);
|
|
31
|
+
}
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for mutation provisionBucket
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
7
|
+
declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getClient } from '../executor';
|
|
2
|
+
import { unflattenDotNotation, buildSelectFromPaths } from '../utils';
|
|
3
|
+
export default async (argv, prompter, _options) => {
|
|
4
|
+
try {
|
|
5
|
+
if (argv.help || argv.h) {
|
|
6
|
+
console.log('provision-bucket - Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n\nUsage: provision-bucket [OPTIONS]\n');
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
const answers = await prompter.prompt(argv, [
|
|
10
|
+
{
|
|
11
|
+
type: 'text',
|
|
12
|
+
name: 'input',
|
|
13
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
]);
|
|
17
|
+
const client = getClient();
|
|
18
|
+
const parsedAnswers = unflattenDotNotation(answers);
|
|
19
|
+
const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId');
|
|
20
|
+
const result = await client.mutation
|
|
21
|
+
.provisionBucket(parsedAnswers, {
|
|
22
|
+
select: selectFields,
|
|
23
|
+
})
|
|
24
|
+
.execute();
|
|
25
|
+
console.log(JSON.stringify(result, null, 2));
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Failed: provisionBucket');
|
|
29
|
+
if (error instanceof Error) {
|
|
30
|
+
console.error(error.message);
|
|
31
|
+
}
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for mutation requestUploadUrl
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { CLIOptions, Inquirerer } from 'inquirerer';
|
|
7
|
+
declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getClient } from '../executor';
|
|
2
|
+
import { unflattenDotNotation, buildSelectFromPaths } from '../utils';
|
|
3
|
+
export default async (argv, prompter, _options) => {
|
|
4
|
+
try {
|
|
5
|
+
if (argv.help || argv.h) {
|
|
6
|
+
console.log('request-upload-url - Request a presigned URL for uploading a file directly to S3.\nClient computes SHA-256 of the file content and provides it here.\nIf a file with the same hash already exists (dedup), returns the\nexisting file ID and deduplicated=true with no uploadUrl.\n\nUsage: request-upload-url [OPTIONS]\n');
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
const answers = await prompter.prompt(argv, [
|
|
10
|
+
{
|
|
11
|
+
type: 'text',
|
|
12
|
+
name: 'input',
|
|
13
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
]);
|
|
17
|
+
const client = getClient();
|
|
18
|
+
const parsedAnswers = unflattenDotNotation(answers);
|
|
19
|
+
const selectFields = buildSelectFromPaths(argv.select ?? 'clientMutationId');
|
|
20
|
+
const result = await client.mutation
|
|
21
|
+
.requestUploadUrl(parsedAnswers, {
|
|
22
|
+
select: selectFields,
|
|
23
|
+
})
|
|
24
|
+
.execute();
|
|
25
|
+
console.log(JSON.stringify(result, null, 2));
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Failed: requestUploadUrl');
|
|
29
|
+
if (error instanceof Error) {
|
|
30
|
+
console.error(error.message);
|
|
31
|
+
}
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -18,6 +18,10 @@ const fieldSchema = {
|
|
|
18
18
|
filesTableName: 'string',
|
|
19
19
|
uploadRequestsTableName: 'string',
|
|
20
20
|
entityTableId: 'uuid',
|
|
21
|
+
endpoint: 'string',
|
|
22
|
+
publicUrlPrefix: 'string',
|
|
23
|
+
provider: 'string',
|
|
24
|
+
allowedOrigins: 'string',
|
|
21
25
|
uploadUrlExpirySeconds: 'int',
|
|
22
26
|
downloadUrlExpirySeconds: 'int',
|
|
23
27
|
defaultMaxFileSize: 'int',
|
|
@@ -77,6 +81,10 @@ async function handleList(argv, _prompter) {
|
|
|
77
81
|
filesTableName: true,
|
|
78
82
|
uploadRequestsTableName: true,
|
|
79
83
|
entityTableId: true,
|
|
84
|
+
endpoint: true,
|
|
85
|
+
publicUrlPrefix: true,
|
|
86
|
+
provider: true,
|
|
87
|
+
allowedOrigins: true,
|
|
80
88
|
uploadUrlExpirySeconds: true,
|
|
81
89
|
downloadUrlExpirySeconds: true,
|
|
82
90
|
defaultMaxFileSize: true,
|
|
@@ -110,6 +118,10 @@ async function handleFindFirst(argv, _prompter) {
|
|
|
110
118
|
filesTableName: true,
|
|
111
119
|
uploadRequestsTableName: true,
|
|
112
120
|
entityTableId: true,
|
|
121
|
+
endpoint: true,
|
|
122
|
+
publicUrlPrefix: true,
|
|
123
|
+
provider: true,
|
|
124
|
+
allowedOrigins: true,
|
|
113
125
|
uploadUrlExpirySeconds: true,
|
|
114
126
|
downloadUrlExpirySeconds: true,
|
|
115
127
|
defaultMaxFileSize: true,
|
|
@@ -155,6 +167,10 @@ async function handleGet(argv, prompter) {
|
|
|
155
167
|
filesTableName: true,
|
|
156
168
|
uploadRequestsTableName: true,
|
|
157
169
|
entityTableId: true,
|
|
170
|
+
endpoint: true,
|
|
171
|
+
publicUrlPrefix: true,
|
|
172
|
+
provider: true,
|
|
173
|
+
allowedOrigins: true,
|
|
158
174
|
uploadUrlExpirySeconds: true,
|
|
159
175
|
downloadUrlExpirySeconds: true,
|
|
160
176
|
defaultMaxFileSize: true,
|
|
@@ -245,6 +261,34 @@ async function handleCreate(argv, prompter) {
|
|
|
245
261
|
required: false,
|
|
246
262
|
skipPrompt: true,
|
|
247
263
|
},
|
|
264
|
+
{
|
|
265
|
+
type: 'text',
|
|
266
|
+
name: 'endpoint',
|
|
267
|
+
message: 'endpoint',
|
|
268
|
+
required: false,
|
|
269
|
+
skipPrompt: true,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
type: 'text',
|
|
273
|
+
name: 'publicUrlPrefix',
|
|
274
|
+
message: 'publicUrlPrefix',
|
|
275
|
+
required: false,
|
|
276
|
+
skipPrompt: true,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
type: 'text',
|
|
280
|
+
name: 'provider',
|
|
281
|
+
message: 'provider',
|
|
282
|
+
required: false,
|
|
283
|
+
skipPrompt: true,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
type: 'text',
|
|
287
|
+
name: 'allowedOrigins',
|
|
288
|
+
message: 'allowedOrigins',
|
|
289
|
+
required: false,
|
|
290
|
+
skipPrompt: true,
|
|
291
|
+
},
|
|
248
292
|
{
|
|
249
293
|
type: 'text',
|
|
250
294
|
name: 'uploadUrlExpirySeconds',
|
|
@@ -297,6 +341,10 @@ async function handleCreate(argv, prompter) {
|
|
|
297
341
|
filesTableName: cleanedData.filesTableName,
|
|
298
342
|
uploadRequestsTableName: cleanedData.uploadRequestsTableName,
|
|
299
343
|
entityTableId: cleanedData.entityTableId,
|
|
344
|
+
endpoint: cleanedData.endpoint,
|
|
345
|
+
publicUrlPrefix: cleanedData.publicUrlPrefix,
|
|
346
|
+
provider: cleanedData.provider,
|
|
347
|
+
allowedOrigins: cleanedData.allowedOrigins,
|
|
300
348
|
uploadUrlExpirySeconds: cleanedData.uploadUrlExpirySeconds,
|
|
301
349
|
downloadUrlExpirySeconds: cleanedData.downloadUrlExpirySeconds,
|
|
302
350
|
defaultMaxFileSize: cleanedData.defaultMaxFileSize,
|
|
@@ -315,6 +363,10 @@ async function handleCreate(argv, prompter) {
|
|
|
315
363
|
filesTableName: true,
|
|
316
364
|
uploadRequestsTableName: true,
|
|
317
365
|
entityTableId: true,
|
|
366
|
+
endpoint: true,
|
|
367
|
+
publicUrlPrefix: true,
|
|
368
|
+
provider: true,
|
|
369
|
+
allowedOrigins: true,
|
|
318
370
|
uploadUrlExpirySeconds: true,
|
|
319
371
|
downloadUrlExpirySeconds: true,
|
|
320
372
|
defaultMaxFileSize: true,
|
|
@@ -411,6 +463,34 @@ async function handleUpdate(argv, prompter) {
|
|
|
411
463
|
required: false,
|
|
412
464
|
skipPrompt: true,
|
|
413
465
|
},
|
|
466
|
+
{
|
|
467
|
+
type: 'text',
|
|
468
|
+
name: 'endpoint',
|
|
469
|
+
message: 'endpoint',
|
|
470
|
+
required: false,
|
|
471
|
+
skipPrompt: true,
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
type: 'text',
|
|
475
|
+
name: 'publicUrlPrefix',
|
|
476
|
+
message: 'publicUrlPrefix',
|
|
477
|
+
required: false,
|
|
478
|
+
skipPrompt: true,
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
type: 'text',
|
|
482
|
+
name: 'provider',
|
|
483
|
+
message: 'provider',
|
|
484
|
+
required: false,
|
|
485
|
+
skipPrompt: true,
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
type: 'text',
|
|
489
|
+
name: 'allowedOrigins',
|
|
490
|
+
message: 'allowedOrigins',
|
|
491
|
+
required: false,
|
|
492
|
+
skipPrompt: true,
|
|
493
|
+
},
|
|
414
494
|
{
|
|
415
495
|
type: 'text',
|
|
416
496
|
name: 'uploadUrlExpirySeconds',
|
|
@@ -466,6 +546,10 @@ async function handleUpdate(argv, prompter) {
|
|
|
466
546
|
filesTableName: cleanedData.filesTableName,
|
|
467
547
|
uploadRequestsTableName: cleanedData.uploadRequestsTableName,
|
|
468
548
|
entityTableId: cleanedData.entityTableId,
|
|
549
|
+
endpoint: cleanedData.endpoint,
|
|
550
|
+
publicUrlPrefix: cleanedData.publicUrlPrefix,
|
|
551
|
+
provider: cleanedData.provider,
|
|
552
|
+
allowedOrigins: cleanedData.allowedOrigins,
|
|
469
553
|
uploadUrlExpirySeconds: cleanedData.uploadUrlExpirySeconds,
|
|
470
554
|
downloadUrlExpirySeconds: cleanedData.downloadUrlExpirySeconds,
|
|
471
555
|
defaultMaxFileSize: cleanedData.defaultMaxFileSize,
|
|
@@ -484,6 +568,10 @@ async function handleUpdate(argv, prompter) {
|
|
|
484
568
|
filesTableName: true,
|
|
485
569
|
uploadRequestsTableName: true,
|
|
486
570
|
entityTableId: true,
|
|
571
|
+
endpoint: true,
|
|
572
|
+
publicUrlPrefix: true,
|
|
573
|
+
provider: true,
|
|
574
|
+
allowedOrigins: true,
|
|
487
575
|
uploadUrlExpirySeconds: true,
|
|
488
576
|
downloadUrlExpirySeconds: true,
|
|
489
577
|
defaultMaxFileSize: true,
|
|
@@ -175,6 +175,9 @@ import sendVerificationEmailCmd from './commands/send-verification-email';
|
|
|
175
175
|
import forgotPasswordCmd from './commands/forgot-password';
|
|
176
176
|
import verifyPasswordCmd from './commands/verify-password';
|
|
177
177
|
import verifyTotpCmd from './commands/verify-totp';
|
|
178
|
+
import requestUploadUrlCmd from './commands/request-upload-url';
|
|
179
|
+
import confirmUploadCmd from './commands/confirm-upload';
|
|
180
|
+
import provisionBucketCmd from './commands/provision-bucket';
|
|
178
181
|
const createCommandMap = () => ({
|
|
179
182
|
context: contextCmd,
|
|
180
183
|
auth: authCmd,
|
|
@@ -347,8 +350,11 @@ const createCommandMap = () => ({
|
|
|
347
350
|
'forgot-password': forgotPasswordCmd,
|
|
348
351
|
'verify-password': verifyPasswordCmd,
|
|
349
352
|
'verify-totp': verifyTotpCmd,
|
|
353
|
+
'request-upload-url': requestUploadUrlCmd,
|
|
354
|
+
'confirm-upload': confirmUploadCmd,
|
|
355
|
+
'provision-bucket': provisionBucketCmd,
|
|
350
356
|
});
|
|
351
|
-
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n get-all-record getAllRecord CRUD operations\n object object CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n table-template-module tableTemplateModule CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n blueprint-construction blueprintConstruction CRUD operations\n storage-module storageModule CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n org-limit orgLimit CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n connected-account connectedAccount CRUD operations\n invite invite CRUD operations\n claimed-invite claimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n role-type roleType CRUD operations\n migrate-file migrateFile CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n membership-type membershipType CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n commit commit CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n rls-module rlsModule CRUD operations\n sql-action sqlAction CRUD operations\n user user CRUD operations\n ast-migration astMigration CRUD operations\n app-membership appMembership CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-ip-address currentIpAddress\n current-user-agent currentUserAgent\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n resolve-blueprint-table Resolves a table_name (with optional schema_name) to a table_id. Resolution order: (1) if schema_name provided, exact lookup via metaschema_public.schema.name + metaschema_public.table; (2) check local table_map (tables created in current blueprint); (3) search metaschema_public.table by name across all schemas; (4) if multiple matches, throw ambiguous error asking for schema_name; (5) if no match, throw not-found error.\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n submit-invite-code submitInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Five phases: (1) provision_table() for each table with all nodes[], fields[], policies[], grants, and table-level indexes/fts/unique_constraints in a single call, (2) provision_relation() for each relation, (3) provision_index() for top-level indexes, (4) provision_full_text_search() for top-level FTS, (5) provision_unique_constraint() for top-level unique constraints. Tables are identified by table_name with optional per-table schema_name. Relations use $type for relation_type with source_table/target_table. Returns the construction record ID on success, NULL on failure.\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n provision-unique-constraint Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.\n provision-full-text-search Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id.\n provision-index Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id.\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n provision-database-with-user provisionDatabaseWithUser\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n provision-relation Composable relation provisioning: creates FK fields, indexes, unique constraints, and junction tables depending on the relation_type. Supports RelationBelongsTo, RelationHasOne, RelationHasMany, and RelationManyToMany. ManyToMany uses provision_table() internally for junction table creation with full node/grant/policy support. All operations are graceful (skip existing). Returns (out_field_id, out_junction_table_id, out_source_field_id, out_target_field_id).\n apply-rls applyRls\n sign-in-one-time-token signInOneTimeToken\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n sign-in signIn\n sign-up signUp\n one-time-token oneTimeToken\n provision-table Composable table provisioning: creates or finds a table, then creates fields (so Data* modules can reference them), applies N nodes (Data* modules), enables RLS, creates grants, creates N policies, and optionally creates table-level indexes/full_text_searches/unique_constraints. All operations are graceful (skip existing). Accepts multiple nodes and multiple policies per call, unlike secure_table_provision which is limited to one of each. Returns (out_table_id, out_fields).\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n verify-password verifyPassword\n verify-totp verifyTotp\n\n --help, -h Show this help message\n --version, -v Show version\n";
|
|
357
|
+
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n get-all-record getAllRecord CRUD operations\n object object CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n table-template-module tableTemplateModule CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n blueprint-construction blueprintConstruction CRUD operations\n storage-module storageModule CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n org-limit orgLimit CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n connected-account connectedAccount CRUD operations\n invite invite CRUD operations\n claimed-invite claimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n role-type roleType CRUD operations\n migrate-file migrateFile CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n membership-type membershipType CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n commit commit CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n rls-module rlsModule CRUD operations\n sql-action sqlAction CRUD operations\n user user CRUD operations\n ast-migration astMigration CRUD operations\n app-membership appMembership CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-ip-address currentIpAddress\n current-user-agent currentUserAgent\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n resolve-blueprint-table Resolves a table_name (with optional schema_name) to a table_id. Resolution order: (1) if schema_name provided, exact lookup via metaschema_public.schema.name + metaschema_public.table; (2) check local table_map (tables created in current blueprint); (3) search metaschema_public.table by name across all schemas; (4) if multiple matches, throw ambiguous error asking for schema_name; (5) if no match, throw not-found error.\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n submit-invite-code submitInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Five phases: (1) provision_table() for each table with all nodes[], fields[], policies[], grants, and table-level indexes/fts/unique_constraints in a single call, (2) provision_relation() for each relation, (3) provision_index() for top-level indexes, (4) provision_full_text_search() for top-level FTS, (5) provision_unique_constraint() for top-level unique constraints. Tables are identified by table_name with optional per-table schema_name. Relations use $type for relation_type with source_table/target_table. Returns the construction record ID on success, NULL on failure.\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n provision-unique-constraint Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.\n provision-full-text-search Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id.\n provision-index Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id.\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n provision-database-with-user provisionDatabaseWithUser\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n provision-relation Composable relation provisioning: creates FK fields, indexes, unique constraints, and junction tables depending on the relation_type. Supports RelationBelongsTo, RelationHasOne, RelationHasMany, and RelationManyToMany. ManyToMany uses provision_table() internally for junction table creation with full node/grant/policy support. All operations are graceful (skip existing). Returns (out_field_id, out_junction_table_id, out_source_field_id, out_target_field_id).\n apply-rls applyRls\n sign-in-one-time-token signInOneTimeToken\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n sign-in signIn\n sign-up signUp\n one-time-token oneTimeToken\n provision-table Composable table provisioning: creates or finds a table, then creates fields (so Data* modules can reference them), applies N nodes (Data* modules), enables RLS, creates grants, creates N policies, and optionally creates table-level indexes/full_text_searches/unique_constraints. All operations are graceful (skip existing). Accepts multiple nodes and multiple policies per call, unlike secure_table_provision which is limited to one of each. Returns (out_table_id, out_fields).\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n verify-password verifyPassword\n verify-totp verifyTotp\n request-upload-url Request a presigned URL for uploading a file directly to S3.\nClient computes SHA-256 of the file content and provides it here.\nIf a file with the same hash already exists (dedup), returns the\nexisting file ID and deduplicated=true with no uploadUrl.\n confirm-upload Confirm that a file has been uploaded to S3.\nVerifies the object exists in S3, checks content-type,\nand transitions the file status from 'pending' to 'ready'.\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n\n --help, -h Show this help message\n --version, -v Show version\n";
|
|
352
358
|
export const commands = async (argv, prompter, options) => {
|
|
353
359
|
if (argv.help || argv.h) {
|
|
354
360
|
console.log(usage);
|
|
@@ -416,5 +416,20 @@ export declare function getClient(contextName?: string): {
|
|
|
416
416
|
} & import("..").StrictSelect<S, import("../orm/input-types").VerifyTotpPayloadSelect>) => import("..").QueryBuilder<{
|
|
417
417
|
verifyTotp: import("..").InferSelectResult<import("../orm/input-types").VerifyTotpPayload, S> | null;
|
|
418
418
|
}>;
|
|
419
|
+
requestUploadUrl: <S extends import("../orm/input-types").RequestUploadUrlPayloadSelect>(args: import("../orm/mutation").RequestUploadUrlVariables, options: {
|
|
420
|
+
select: S;
|
|
421
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").RequestUploadUrlPayloadSelect>) => import("..").QueryBuilder<{
|
|
422
|
+
requestUploadUrl: import("..").InferSelectResult<import("../orm/input-types").RequestUploadUrlPayload, S> | null;
|
|
423
|
+
}>;
|
|
424
|
+
confirmUpload: <S extends import("../orm/input-types").ConfirmUploadPayloadSelect>(args: import("../orm/mutation").ConfirmUploadVariables, options: {
|
|
425
|
+
select: S;
|
|
426
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ConfirmUploadPayloadSelect>) => import("..").QueryBuilder<{
|
|
427
|
+
confirmUpload: import("..").InferSelectResult<import("../orm/input-types").ConfirmUploadPayload, S> | null;
|
|
428
|
+
}>;
|
|
429
|
+
provisionBucket: <S extends import("../orm/input-types").ProvisionBucketPayloadSelect>(args: import("../orm/mutation").ProvisionBucketVariables, options: {
|
|
430
|
+
select: S;
|
|
431
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ProvisionBucketPayloadSelect>) => import("..").QueryBuilder<{
|
|
432
|
+
provisionBucket: import("..").InferSelectResult<import("../orm/input-types").ProvisionBucketPayload, S> | null;
|
|
433
|
+
}>;
|
|
419
434
|
};
|
|
420
435
|
};
|
|
@@ -555,5 +555,20 @@ export declare function createClient(config: OrmClientConfig): {
|
|
|
555
555
|
} & import("./select-types").StrictSelect<S, import("./input-types").VerifyTotpPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
556
556
|
verifyTotp: import("./select-types").InferSelectResult<import("./input-types").VerifyTotpPayload, S> | null;
|
|
557
557
|
}>;
|
|
558
|
+
requestUploadUrl: <S extends import("./input-types").RequestUploadUrlPayloadSelect>(args: import("./mutation").RequestUploadUrlVariables, options: {
|
|
559
|
+
select: S;
|
|
560
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").RequestUploadUrlPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
561
|
+
requestUploadUrl: import("./select-types").InferSelectResult<import("./input-types").RequestUploadUrlPayload, S> | null;
|
|
562
|
+
}>;
|
|
563
|
+
confirmUpload: <S extends import("./input-types").ConfirmUploadPayloadSelect>(args: import("./mutation").ConfirmUploadVariables, options: {
|
|
564
|
+
select: S;
|
|
565
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ConfirmUploadPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
566
|
+
confirmUpload: import("./select-types").InferSelectResult<import("./input-types").ConfirmUploadPayload, S> | null;
|
|
567
|
+
}>;
|
|
568
|
+
provisionBucket: <S extends import("./input-types").ProvisionBucketPayloadSelect>(args: import("./mutation").ProvisionBucketVariables, options: {
|
|
569
|
+
select: S;
|
|
570
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ProvisionBucketPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
571
|
+
provisionBucket: import("./select-types").InferSelectResult<import("./input-types").ProvisionBucketPayload, S> | null;
|
|
572
|
+
}>;
|
|
558
573
|
};
|
|
559
574
|
};
|