@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
|
@@ -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
|
+
};
|
package/esm/auth/cli/commands.js
CHANGED
|
@@ -33,6 +33,9 @@ import forgotPasswordCmd from './commands/forgot-password';
|
|
|
33
33
|
import sendVerificationEmailCmd from './commands/send-verification-email';
|
|
34
34
|
import verifyPasswordCmd from './commands/verify-password';
|
|
35
35
|
import verifyTotpCmd from './commands/verify-totp';
|
|
36
|
+
import requestUploadUrlCmd from './commands/request-upload-url';
|
|
37
|
+
import confirmUploadCmd from './commands/confirm-upload';
|
|
38
|
+
import provisionBucketCmd from './commands/provision-bucket';
|
|
36
39
|
const createCommandMap = () => ({
|
|
37
40
|
context: contextCmd,
|
|
38
41
|
auth: authCmd,
|
|
@@ -63,8 +66,11 @@ const createCommandMap = () => ({
|
|
|
63
66
|
'send-verification-email': sendVerificationEmailCmd,
|
|
64
67
|
'verify-password': verifyPasswordCmd,
|
|
65
68
|
'verify-totp': verifyTotpCmd,
|
|
69
|
+
'request-upload-url': requestUploadUrlCmd,
|
|
70
|
+
'confirm-upload': confirmUploadCmd,
|
|
71
|
+
'provision-bucket': provisionBucketCmd,
|
|
66
72
|
});
|
|
67
|
-
const usage =
|
|
73
|
+
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n connected-account connectedAccount CRUD operations\n audit-log auditLog CRUD operations\n role-type roleType CRUD operations\n user user CRUD operations\n current-ip-address currentIpAddress\n current-user-agent currentUserAgent\n current-user-id currentUserId\n current-user currentUser\n sign-out signOut\n send-account-deletion-email sendAccountDeletionEmail\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n reset-password resetPassword\n sign-in-one-time-token signInOneTimeToken\n sign-in signIn\n sign-up signUp\n one-time-token oneTimeToken\n extend-token-expires extendTokenExpires\n forgot-password forgotPassword\n send-verification-email sendVerificationEmail\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";
|
|
68
74
|
export const commands = async (argv, prompter, options) => {
|
|
69
75
|
if (argv.help || argv.h) {
|
|
70
76
|
console.log(usage);
|
|
@@ -110,5 +110,20 @@ export declare function getClient(contextName?: string): {
|
|
|
110
110
|
} & import("..").StrictSelect<S, import("../orm/input-types").VerifyTotpPayloadSelect>) => import("..").QueryBuilder<{
|
|
111
111
|
verifyTotp: import("..").InferSelectResult<import("../orm/input-types").VerifyTotpPayload, S> | null;
|
|
112
112
|
}>;
|
|
113
|
+
requestUploadUrl: <S extends import("../orm/input-types").RequestUploadUrlPayloadSelect>(args: import("../orm/mutation").RequestUploadUrlVariables, options: {
|
|
114
|
+
select: S;
|
|
115
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").RequestUploadUrlPayloadSelect>) => import("..").QueryBuilder<{
|
|
116
|
+
requestUploadUrl: import("..").InferSelectResult<import("../orm/input-types").RequestUploadUrlPayload, S> | null;
|
|
117
|
+
}>;
|
|
118
|
+
confirmUpload: <S extends import("../orm/input-types").ConfirmUploadPayloadSelect>(args: import("../orm/mutation").ConfirmUploadVariables, options: {
|
|
119
|
+
select: S;
|
|
120
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ConfirmUploadPayloadSelect>) => import("..").QueryBuilder<{
|
|
121
|
+
confirmUpload: import("..").InferSelectResult<import("../orm/input-types").ConfirmUploadPayload, S> | null;
|
|
122
|
+
}>;
|
|
123
|
+
provisionBucket: <S extends import("../orm/input-types").ProvisionBucketPayloadSelect>(args: import("../orm/mutation").ProvisionBucketVariables, options: {
|
|
124
|
+
select: S;
|
|
125
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ProvisionBucketPayloadSelect>) => import("..").QueryBuilder<{
|
|
126
|
+
provisionBucket: import("..").InferSelectResult<import("../orm/input-types").ProvisionBucketPayload, S> | null;
|
|
127
|
+
}>;
|
|
113
128
|
};
|
|
114
129
|
};
|
package/esm/auth/orm/index.d.ts
CHANGED
|
@@ -148,5 +148,20 @@ export declare function createClient(config: OrmClientConfig): {
|
|
|
148
148
|
} & import("./select-types").StrictSelect<S, import("./input-types").VerifyTotpPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
149
149
|
verifyTotp: import("./select-types").InferSelectResult<import("./input-types").VerifyTotpPayload, S> | null;
|
|
150
150
|
}>;
|
|
151
|
+
requestUploadUrl: <S extends import("./input-types").RequestUploadUrlPayloadSelect>(args: import("./mutation").RequestUploadUrlVariables, options: {
|
|
152
|
+
select: S;
|
|
153
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").RequestUploadUrlPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
154
|
+
requestUploadUrl: import("./select-types").InferSelectResult<import("./input-types").RequestUploadUrlPayload, S> | null;
|
|
155
|
+
}>;
|
|
156
|
+
confirmUpload: <S extends import("./input-types").ConfirmUploadPayloadSelect>(args: import("./mutation").ConfirmUploadVariables, options: {
|
|
157
|
+
select: S;
|
|
158
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ConfirmUploadPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
159
|
+
confirmUpload: import("./select-types").InferSelectResult<import("./input-types").ConfirmUploadPayload, S> | null;
|
|
160
|
+
}>;
|
|
161
|
+
provisionBucket: <S extends import("./input-types").ProvisionBucketPayloadSelect>(args: import("./mutation").ProvisionBucketVariables, options: {
|
|
162
|
+
select: S;
|
|
163
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ProvisionBucketPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
164
|
+
provisionBucket: import("./select-types").InferSelectResult<import("./input-types").ProvisionBucketPayload, S> | null;
|
|
165
|
+
}>;
|
|
151
166
|
};
|
|
152
167
|
};
|
|
@@ -937,6 +937,26 @@ export interface VerifyTotpInput {
|
|
|
937
937
|
clientMutationId?: string;
|
|
938
938
|
totpValue: string;
|
|
939
939
|
}
|
|
940
|
+
export interface RequestUploadUrlInput {
|
|
941
|
+
/** Bucket key (e.g., "public", "private") */
|
|
942
|
+
bucketKey: string;
|
|
943
|
+
/** SHA-256 content hash computed by the client (hex-encoded, 64 chars) */
|
|
944
|
+
contentHash: string;
|
|
945
|
+
/** MIME type of the file (e.g., "image/png") */
|
|
946
|
+
contentType: string;
|
|
947
|
+
/** File size in bytes */
|
|
948
|
+
size: number;
|
|
949
|
+
/** Original filename (optional, for display and Content-Disposition) */
|
|
950
|
+
filename?: string;
|
|
951
|
+
}
|
|
952
|
+
export interface ConfirmUploadInput {
|
|
953
|
+
/** The file ID returned by requestUploadUrl */
|
|
954
|
+
fileId: string;
|
|
955
|
+
}
|
|
956
|
+
export interface ProvisionBucketInput {
|
|
957
|
+
/** The logical bucket key (e.g., "public", "private") */
|
|
958
|
+
bucketKey: string;
|
|
959
|
+
}
|
|
940
960
|
/** A filter to be used against ConstructiveInternalTypeEmail fields. All fields are combined with a logical ‘and.’ */
|
|
941
961
|
export interface ConstructiveInternalTypeEmailFilter {
|
|
942
962
|
/** Is null (if `true` is specified) or is not null (if `false` is specified). */
|
|
@@ -1882,6 +1902,60 @@ export type VerifyTotpPayloadSelect = {
|
|
|
1882
1902
|
select: SessionSelect;
|
|
1883
1903
|
};
|
|
1884
1904
|
};
|
|
1905
|
+
export interface RequestUploadUrlPayload {
|
|
1906
|
+
/** Presigned PUT URL (null if file was deduplicated) */
|
|
1907
|
+
uploadUrl?: string | null;
|
|
1908
|
+
/** The file ID (existing if deduplicated, new if fresh upload) */
|
|
1909
|
+
fileId: string;
|
|
1910
|
+
/** The S3 object key */
|
|
1911
|
+
key: string;
|
|
1912
|
+
/** Whether this file was deduplicated (already exists with same hash) */
|
|
1913
|
+
deduplicated: boolean;
|
|
1914
|
+
/** Presigned URL expiry time (null if deduplicated) */
|
|
1915
|
+
expiresAt?: string | null;
|
|
1916
|
+
}
|
|
1917
|
+
export type RequestUploadUrlPayloadSelect = {
|
|
1918
|
+
uploadUrl?: boolean;
|
|
1919
|
+
fileId?: boolean;
|
|
1920
|
+
key?: boolean;
|
|
1921
|
+
deduplicated?: boolean;
|
|
1922
|
+
expiresAt?: boolean;
|
|
1923
|
+
};
|
|
1924
|
+
export interface ConfirmUploadPayload {
|
|
1925
|
+
/** The confirmed file ID */
|
|
1926
|
+
fileId: string;
|
|
1927
|
+
/** New file status */
|
|
1928
|
+
status: string;
|
|
1929
|
+
/** Whether confirmation succeeded */
|
|
1930
|
+
success: boolean;
|
|
1931
|
+
}
|
|
1932
|
+
export type ConfirmUploadPayloadSelect = {
|
|
1933
|
+
fileId?: boolean;
|
|
1934
|
+
status?: boolean;
|
|
1935
|
+
success?: boolean;
|
|
1936
|
+
};
|
|
1937
|
+
export interface ProvisionBucketPayload {
|
|
1938
|
+
/** Whether provisioning succeeded */
|
|
1939
|
+
success: boolean;
|
|
1940
|
+
/** The S3 bucket name that was provisioned */
|
|
1941
|
+
bucketName: string;
|
|
1942
|
+
/** The access type applied */
|
|
1943
|
+
accessType: string;
|
|
1944
|
+
/** The storage provider used */
|
|
1945
|
+
provider: string;
|
|
1946
|
+
/** The S3 endpoint (null for AWS S3 default) */
|
|
1947
|
+
endpoint?: string | null;
|
|
1948
|
+
/** Error message if provisioning failed */
|
|
1949
|
+
error?: string | null;
|
|
1950
|
+
}
|
|
1951
|
+
export type ProvisionBucketPayloadSelect = {
|
|
1952
|
+
success?: boolean;
|
|
1953
|
+
bucketName?: boolean;
|
|
1954
|
+
accessType?: boolean;
|
|
1955
|
+
provider?: boolean;
|
|
1956
|
+
endpoint?: boolean;
|
|
1957
|
+
error?: boolean;
|
|
1958
|
+
};
|
|
1885
1959
|
export interface CreateEmailPayload {
|
|
1886
1960
|
clientMutationId?: string | null;
|
|
1887
1961
|
/** The `Email` 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 { SignOutInput, SendAccountDeletionEmailInput, CheckPasswordInput, ConfirmDeleteAccountInput, SetPasswordInput, VerifyEmailInput, ResetPasswordInput, SignInOneTimeTokenInput, SignInInput, SignUpInput, OneTimeTokenInput, ExtendTokenExpiresInput, ForgotPasswordInput, SendVerificationEmailInput, VerifyPasswordInput, VerifyTotpInput, SignOutPayload, SendAccountDeletionEmailPayload, CheckPasswordPayload, ConfirmDeleteAccountPayload, SetPasswordPayload, VerifyEmailPayload, ResetPasswordPayload, SignInOneTimeTokenPayload, SignInPayload, SignUpPayload, OneTimeTokenPayload, ExtendTokenExpiresPayload, ForgotPasswordPayload, SendVerificationEmailPayload, VerifyPasswordPayload, VerifyTotpPayload, SignOutPayloadSelect, SendAccountDeletionEmailPayloadSelect, CheckPasswordPayloadSelect, ConfirmDeleteAccountPayloadSelect, SetPasswordPayloadSelect, VerifyEmailPayloadSelect, ResetPasswordPayloadSelect, SignInOneTimeTokenPayloadSelect, SignInPayloadSelect, SignUpPayloadSelect, OneTimeTokenPayloadSelect, ExtendTokenExpiresPayloadSelect, ForgotPasswordPayloadSelect, SendVerificationEmailPayloadSelect, VerifyPasswordPayloadSelect, VerifyTotpPayloadSelect } from '../input-types';
|
|
9
|
+
import type { SignOutInput, SendAccountDeletionEmailInput, CheckPasswordInput, ConfirmDeleteAccountInput, SetPasswordInput, VerifyEmailInput, ResetPasswordInput, SignInOneTimeTokenInput, SignInInput, SignUpInput, OneTimeTokenInput, ExtendTokenExpiresInput, ForgotPasswordInput, SendVerificationEmailInput, VerifyPasswordInput, VerifyTotpInput, RequestUploadUrlInput, ConfirmUploadInput, ProvisionBucketInput, SignOutPayload, SendAccountDeletionEmailPayload, CheckPasswordPayload, ConfirmDeleteAccountPayload, SetPasswordPayload, VerifyEmailPayload, ResetPasswordPayload, SignInOneTimeTokenPayload, SignInPayload, SignUpPayload, OneTimeTokenPayload, ExtendTokenExpiresPayload, ForgotPasswordPayload, SendVerificationEmailPayload, VerifyPasswordPayload, VerifyTotpPayload, RequestUploadUrlPayload, ConfirmUploadPayload, ProvisionBucketPayload, SignOutPayloadSelect, SendAccountDeletionEmailPayloadSelect, CheckPasswordPayloadSelect, ConfirmDeleteAccountPayloadSelect, SetPasswordPayloadSelect, VerifyEmailPayloadSelect, ResetPasswordPayloadSelect, SignInOneTimeTokenPayloadSelect, SignInPayloadSelect, SignUpPayloadSelect, OneTimeTokenPayloadSelect, ExtendTokenExpiresPayloadSelect, ForgotPasswordPayloadSelect, SendVerificationEmailPayloadSelect, VerifyPasswordPayloadSelect, VerifyTotpPayloadSelect, RequestUploadUrlPayloadSelect, ConfirmUploadPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
|
|
10
10
|
export interface SignOutVariables {
|
|
11
11
|
input: SignOutInput;
|
|
12
12
|
}
|
|
@@ -55,6 +55,35 @@ export interface VerifyPasswordVariables {
|
|
|
55
55
|
export interface VerifyTotpVariables {
|
|
56
56
|
input: VerifyTotpInput;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Variables for requestUploadUrl
|
|
60
|
+
* Request a presigned URL for uploading a file directly to S3.
|
|
61
|
+
Client computes SHA-256 of the file content and provides it here.
|
|
62
|
+
If a file with the same hash already exists (dedup), returns the
|
|
63
|
+
existing file ID and deduplicated=true with no uploadUrl.
|
|
64
|
+
*/
|
|
65
|
+
export interface RequestUploadUrlVariables {
|
|
66
|
+
input: RequestUploadUrlInput;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Variables for confirmUpload
|
|
70
|
+
* Confirm that a file has been uploaded to S3.
|
|
71
|
+
Verifies the object exists in S3, checks content-type,
|
|
72
|
+
and transitions the file status from 'pending' to 'ready'.
|
|
73
|
+
*/
|
|
74
|
+
export interface ConfirmUploadVariables {
|
|
75
|
+
input: ConfirmUploadInput;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Variables for provisionBucket
|
|
79
|
+
* Provision an S3 bucket for a logical bucket in the database.
|
|
80
|
+
Reads the bucket config via RLS, then creates and configures
|
|
81
|
+
the S3 bucket with the appropriate privacy policies, CORS rules,
|
|
82
|
+
and lifecycle settings.
|
|
83
|
+
*/
|
|
84
|
+
export interface ProvisionBucketVariables {
|
|
85
|
+
input: ProvisionBucketInput;
|
|
86
|
+
}
|
|
58
87
|
export declare function createMutationOperations(client: OrmClient): {
|
|
59
88
|
signOut: <S extends SignOutPayloadSelect>(args: SignOutVariables, options: {
|
|
60
89
|
select: S;
|
|
@@ -136,4 +165,19 @@ export declare function createMutationOperations(client: OrmClient): {
|
|
|
136
165
|
} & StrictSelect<S, VerifyTotpPayloadSelect>) => QueryBuilder<{
|
|
137
166
|
verifyTotp: InferSelectResult<VerifyTotpPayload, S> | null;
|
|
138
167
|
}>;
|
|
168
|
+
requestUploadUrl: <S extends RequestUploadUrlPayloadSelect>(args: RequestUploadUrlVariables, options: {
|
|
169
|
+
select: S;
|
|
170
|
+
} & StrictSelect<S, RequestUploadUrlPayloadSelect>) => QueryBuilder<{
|
|
171
|
+
requestUploadUrl: InferSelectResult<RequestUploadUrlPayload, S> | null;
|
|
172
|
+
}>;
|
|
173
|
+
confirmUpload: <S extends ConfirmUploadPayloadSelect>(args: ConfirmUploadVariables, options: {
|
|
174
|
+
select: S;
|
|
175
|
+
} & StrictSelect<S, ConfirmUploadPayloadSelect>) => QueryBuilder<{
|
|
176
|
+
confirmUpload: InferSelectResult<ConfirmUploadPayload, S> | null;
|
|
177
|
+
}>;
|
|
178
|
+
provisionBucket: <S extends ProvisionBucketPayloadSelect>(args: ProvisionBucketVariables, options: {
|
|
179
|
+
select: S;
|
|
180
|
+
} & StrictSelect<S, ProvisionBucketPayloadSelect>) => QueryBuilder<{
|
|
181
|
+
provisionBucket: InferSelectResult<ProvisionBucketPayload, S> | null;
|
|
182
|
+
}>;
|
|
139
183
|
};
|
|
@@ -194,5 +194,41 @@ export function createMutationOperations(client) {
|
|
|
194
194
|
},
|
|
195
195
|
], connectionFieldsMap, 'VerifyTotpPayload'),
|
|
196
196
|
}),
|
|
197
|
+
requestUploadUrl: (args, options) => new QueryBuilder({
|
|
198
|
+
client,
|
|
199
|
+
operation: 'mutation',
|
|
200
|
+
operationName: 'RequestUploadUrl',
|
|
201
|
+
fieldName: 'requestUploadUrl',
|
|
202
|
+
...buildCustomDocument('mutation', 'RequestUploadUrl', 'requestUploadUrl', options.select, args, [
|
|
203
|
+
{
|
|
204
|
+
name: 'input',
|
|
205
|
+
type: 'RequestUploadUrlInput!',
|
|
206
|
+
},
|
|
207
|
+
], connectionFieldsMap, 'RequestUploadUrlPayload'),
|
|
208
|
+
}),
|
|
209
|
+
confirmUpload: (args, options) => new QueryBuilder({
|
|
210
|
+
client,
|
|
211
|
+
operation: 'mutation',
|
|
212
|
+
operationName: 'ConfirmUpload',
|
|
213
|
+
fieldName: 'confirmUpload',
|
|
214
|
+
...buildCustomDocument('mutation', 'ConfirmUpload', 'confirmUpload', options.select, args, [
|
|
215
|
+
{
|
|
216
|
+
name: 'input',
|
|
217
|
+
type: 'ConfirmUploadInput!',
|
|
218
|
+
},
|
|
219
|
+
], connectionFieldsMap, 'ConfirmUploadPayload'),
|
|
220
|
+
}),
|
|
221
|
+
provisionBucket: (args, options) => new QueryBuilder({
|
|
222
|
+
client,
|
|
223
|
+
operation: 'mutation',
|
|
224
|
+
operationName: 'ProvisionBucket',
|
|
225
|
+
fieldName: 'provisionBucket',
|
|
226
|
+
...buildCustomDocument('mutation', 'ProvisionBucket', 'provisionBucket', options.select, args, [
|
|
227
|
+
{
|
|
228
|
+
name: 'input',
|
|
229
|
+
type: 'ProvisionBucketInput!',
|
|
230
|
+
},
|
|
231
|
+
], connectionFieldsMap, 'ProvisionBucketPayload'),
|
|
232
|
+
}),
|
|
197
233
|
};
|
|
198
234
|
}
|
|
@@ -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
|
+
};
|
|
@@ -23,6 +23,9 @@ import setPropsAndCommitCmd from './commands/set-props-and-commit';
|
|
|
23
23
|
import insertNodeAtPathCmd from './commands/insert-node-at-path';
|
|
24
24
|
import updateNodeAtPathCmd from './commands/update-node-at-path';
|
|
25
25
|
import setAndCommitCmd from './commands/set-and-commit';
|
|
26
|
+
import requestUploadUrlCmd from './commands/request-upload-url';
|
|
27
|
+
import confirmUploadCmd from './commands/confirm-upload';
|
|
28
|
+
import provisionBucketCmd from './commands/provision-bucket';
|
|
26
29
|
const createCommandMap = () => ({
|
|
27
30
|
context: contextCmd,
|
|
28
31
|
auth: authCmd,
|
|
@@ -43,8 +46,11 @@ const createCommandMap = () => ({
|
|
|
43
46
|
'insert-node-at-path': insertNodeAtPathCmd,
|
|
44
47
|
'update-node-at-path': updateNodeAtPathCmd,
|
|
45
48
|
'set-and-commit': setAndCommitCmd,
|
|
49
|
+
'request-upload-url': requestUploadUrlCmd,
|
|
50
|
+
'confirm-upload': confirmUploadCmd,
|
|
51
|
+
'provision-bucket': provisionBucketCmd,
|
|
46
52
|
});
|
|
47
|
-
const usage =
|
|
53
|
+
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n get-all-record getAllRecord CRUD operations\n object object CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n commit commit CRUD operations\n rev-parse revParse\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 freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n remove-node-at-path removeNodeAtPath\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\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";
|
|
48
54
|
export const commands = async (argv, prompter, options) => {
|
|
49
55
|
if (argv.help || argv.h) {
|
|
50
56
|
console.log(usage);
|
|
@@ -68,5 +68,20 @@ export declare function getClient(contextName?: string): {
|
|
|
68
68
|
} & import("..").StrictSelect<S, import("../orm/input-types").SetAndCommitPayloadSelect>) => import("..").QueryBuilder<{
|
|
69
69
|
setAndCommit: import("..").InferSelectResult<import("../orm/input-types").SetAndCommitPayload, S> | null;
|
|
70
70
|
}>;
|
|
71
|
+
requestUploadUrl: <S extends import("../orm/input-types").RequestUploadUrlPayloadSelect>(args: import("../orm/mutation").RequestUploadUrlVariables, options: {
|
|
72
|
+
select: S;
|
|
73
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").RequestUploadUrlPayloadSelect>) => import("..").QueryBuilder<{
|
|
74
|
+
requestUploadUrl: import("..").InferSelectResult<import("../orm/input-types").RequestUploadUrlPayload, S> | null;
|
|
75
|
+
}>;
|
|
76
|
+
confirmUpload: <S extends import("../orm/input-types").ConfirmUploadPayloadSelect>(args: import("../orm/mutation").ConfirmUploadVariables, options: {
|
|
77
|
+
select: S;
|
|
78
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ConfirmUploadPayloadSelect>) => import("..").QueryBuilder<{
|
|
79
|
+
confirmUpload: import("..").InferSelectResult<import("../orm/input-types").ConfirmUploadPayload, S> | null;
|
|
80
|
+
}>;
|
|
81
|
+
provisionBucket: <S extends import("../orm/input-types").ProvisionBucketPayloadSelect>(args: import("../orm/mutation").ProvisionBucketVariables, options: {
|
|
82
|
+
select: S;
|
|
83
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ProvisionBucketPayloadSelect>) => import("..").QueryBuilder<{
|
|
84
|
+
provisionBucket: import("..").InferSelectResult<import("../orm/input-types").ProvisionBucketPayload, S> | null;
|
|
85
|
+
}>;
|
|
71
86
|
};
|
|
72
87
|
};
|
|
@@ -104,5 +104,20 @@ export declare function createClient(config: OrmClientConfig): {
|
|
|
104
104
|
} & import("./select-types").StrictSelect<S, import("./input-types").SetAndCommitPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
105
105
|
setAndCommit: import("./select-types").InferSelectResult<import("./input-types").SetAndCommitPayload, S> | null;
|
|
106
106
|
}>;
|
|
107
|
+
requestUploadUrl: <S extends import("./input-types").RequestUploadUrlPayloadSelect>(args: import("./mutation").RequestUploadUrlVariables, options: {
|
|
108
|
+
select: S;
|
|
109
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").RequestUploadUrlPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
110
|
+
requestUploadUrl: import("./select-types").InferSelectResult<import("./input-types").RequestUploadUrlPayload, S> | null;
|
|
111
|
+
}>;
|
|
112
|
+
confirmUpload: <S extends import("./input-types").ConfirmUploadPayloadSelect>(args: import("./mutation").ConfirmUploadVariables, options: {
|
|
113
|
+
select: S;
|
|
114
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ConfirmUploadPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
115
|
+
confirmUpload: import("./select-types").InferSelectResult<import("./input-types").ConfirmUploadPayload, S> | null;
|
|
116
|
+
}>;
|
|
117
|
+
provisionBucket: <S extends import("./input-types").ProvisionBucketPayloadSelect>(args: import("./mutation").ProvisionBucketVariables, options: {
|
|
118
|
+
select: S;
|
|
119
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ProvisionBucketPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
120
|
+
provisionBucket: import("./select-types").InferSelectResult<import("./input-types").ProvisionBucketPayload, S> | null;
|
|
121
|
+
}>;
|
|
107
122
|
};
|
|
108
123
|
};
|