@constructive-sdk/cli 0.12.23 → 0.13.1
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 +3 -3
- 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
|
@@ -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
|
};
|
|
@@ -197,5 +197,41 @@ function createMutationOperations(client) {
|
|
|
197
197
|
},
|
|
198
198
|
], input_types_1.connectionFieldsMap, 'VerifyTotpPayload'),
|
|
199
199
|
}),
|
|
200
|
+
requestUploadUrl: (args, options) => new query_builder_1.QueryBuilder({
|
|
201
|
+
client,
|
|
202
|
+
operation: 'mutation',
|
|
203
|
+
operationName: 'RequestUploadUrl',
|
|
204
|
+
fieldName: 'requestUploadUrl',
|
|
205
|
+
...(0, query_builder_1.buildCustomDocument)('mutation', 'RequestUploadUrl', 'requestUploadUrl', options.select, args, [
|
|
206
|
+
{
|
|
207
|
+
name: 'input',
|
|
208
|
+
type: 'RequestUploadUrlInput!',
|
|
209
|
+
},
|
|
210
|
+
], input_types_1.connectionFieldsMap, 'RequestUploadUrlPayload'),
|
|
211
|
+
}),
|
|
212
|
+
confirmUpload: (args, options) => new query_builder_1.QueryBuilder({
|
|
213
|
+
client,
|
|
214
|
+
operation: 'mutation',
|
|
215
|
+
operationName: 'ConfirmUpload',
|
|
216
|
+
fieldName: 'confirmUpload',
|
|
217
|
+
...(0, query_builder_1.buildCustomDocument)('mutation', 'ConfirmUpload', 'confirmUpload', options.select, args, [
|
|
218
|
+
{
|
|
219
|
+
name: 'input',
|
|
220
|
+
type: 'ConfirmUploadInput!',
|
|
221
|
+
},
|
|
222
|
+
], input_types_1.connectionFieldsMap, 'ConfirmUploadPayload'),
|
|
223
|
+
}),
|
|
224
|
+
provisionBucket: (args, options) => new query_builder_1.QueryBuilder({
|
|
225
|
+
client,
|
|
226
|
+
operation: 'mutation',
|
|
227
|
+
operationName: 'ProvisionBucket',
|
|
228
|
+
fieldName: 'provisionBucket',
|
|
229
|
+
...(0, query_builder_1.buildCustomDocument)('mutation', 'ProvisionBucket', 'provisionBucket', options.select, args, [
|
|
230
|
+
{
|
|
231
|
+
name: 'input',
|
|
232
|
+
type: 'ProvisionBucketInput!',
|
|
233
|
+
},
|
|
234
|
+
], input_types_1.connectionFieldsMap, 'ProvisionBucketPayload'),
|
|
235
|
+
}),
|
|
200
236
|
};
|
|
201
237
|
}
|
|
@@ -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
|
+
};
|
|
@@ -51,6 +51,9 @@ import orgPermissionsGetByMaskCmd from './commands/org-permissions-get-by-mask';
|
|
|
51
51
|
import stepsRequiredCmd from './commands/steps-required';
|
|
52
52
|
import submitInviteCodeCmd from './commands/submit-invite-code';
|
|
53
53
|
import submitOrgInviteCodeCmd from './commands/submit-org-invite-code';
|
|
54
|
+
import requestUploadUrlCmd from './commands/request-upload-url';
|
|
55
|
+
import confirmUploadCmd from './commands/confirm-upload';
|
|
56
|
+
import provisionBucketCmd from './commands/provision-bucket';
|
|
54
57
|
const createCommandMap = () => ({
|
|
55
58
|
context: contextCmd,
|
|
56
59
|
auth: authCmd,
|
|
@@ -99,8 +102,11 @@ const createCommandMap = () => ({
|
|
|
99
102
|
'steps-required': stepsRequiredCmd,
|
|
100
103
|
'submit-invite-code': submitInviteCodeCmd,
|
|
101
104
|
'submit-org-invite-code': submitOrgInviteCodeCmd,
|
|
105
|
+
'request-upload-url': requestUploadUrlCmd,
|
|
106
|
+
'confirm-upload': confirmUploadCmd,
|
|
107
|
+
'provision-bucket': provisionBucketCmd,
|
|
102
108
|
});
|
|
103
|
-
const usage =
|
|
109
|
+
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 app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n org-member orgMember CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n membership-type membershipType CRUD operations\n app-limit appLimit CRUD operations\n app-achievement appAchievement CRUD operations\n app-step appStep CRUD operations\n claimed-invite claimedInvite CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-limit orgLimit CRUD operations\n app-grant appGrant CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n app-level appLevel CRUD operations\n invite invite CRUD operations\n app-membership appMembership CRUD operations\n org-membership orgMembership CRUD operations\n org-invite orgInvite CRUD operations\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n steps-achieved stepsAchieved\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\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 submit-invite-code submitInviteCode\n submit-org-invite-code submitOrgInviteCode\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";
|
|
104
110
|
export const commands = async (argv, prompter, options) => {
|
|
105
111
|
if (argv.help || argv.h) {
|
|
106
112
|
console.log(usage);
|
|
@@ -100,5 +100,20 @@ export declare function getClient(contextName?: string): {
|
|
|
100
100
|
} & import("..").StrictSelect<S, import("../orm/input-types").SubmitOrgInviteCodePayloadSelect>) => import("..").QueryBuilder<{
|
|
101
101
|
submitOrgInviteCode: import("..").InferSelectResult<import("../orm/input-types").SubmitOrgInviteCodePayload, S> | null;
|
|
102
102
|
}>;
|
|
103
|
+
requestUploadUrl: <S extends import("../orm/input-types").RequestUploadUrlPayloadSelect>(args: import("../orm/mutation").RequestUploadUrlVariables, options: {
|
|
104
|
+
select: S;
|
|
105
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").RequestUploadUrlPayloadSelect>) => import("..").QueryBuilder<{
|
|
106
|
+
requestUploadUrl: import("..").InferSelectResult<import("../orm/input-types").RequestUploadUrlPayload, S> | null;
|
|
107
|
+
}>;
|
|
108
|
+
confirmUpload: <S extends import("../orm/input-types").ConfirmUploadPayloadSelect>(args: import("../orm/mutation").ConfirmUploadVariables, options: {
|
|
109
|
+
select: S;
|
|
110
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ConfirmUploadPayloadSelect>) => import("..").QueryBuilder<{
|
|
111
|
+
confirmUpload: import("..").InferSelectResult<import("../orm/input-types").ConfirmUploadPayload, S> | null;
|
|
112
|
+
}>;
|
|
113
|
+
provisionBucket: <S extends import("../orm/input-types").ProvisionBucketPayloadSelect>(args: import("../orm/mutation").ProvisionBucketVariables, options: {
|
|
114
|
+
select: S;
|
|
115
|
+
} & import("..").StrictSelect<S, import("../orm/input-types").ProvisionBucketPayloadSelect>) => import("..").QueryBuilder<{
|
|
116
|
+
provisionBucket: import("..").InferSelectResult<import("../orm/input-types").ProvisionBucketPayload, S> | null;
|
|
117
|
+
}>;
|
|
103
118
|
};
|
|
104
119
|
};
|
package/esm/admin/orm/index.d.ts
CHANGED
|
@@ -163,5 +163,20 @@ export declare function createClient(config: OrmClientConfig): {
|
|
|
163
163
|
} & import("./select-types").StrictSelect<S, import("./input-types").SubmitOrgInviteCodePayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
164
164
|
submitOrgInviteCode: import("./select-types").InferSelectResult<import("./input-types").SubmitOrgInviteCodePayload, S> | null;
|
|
165
165
|
}>;
|
|
166
|
+
requestUploadUrl: <S extends import("./input-types").RequestUploadUrlPayloadSelect>(args: import("./mutation").RequestUploadUrlVariables, options: {
|
|
167
|
+
select: S;
|
|
168
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").RequestUploadUrlPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
169
|
+
requestUploadUrl: import("./select-types").InferSelectResult<import("./input-types").RequestUploadUrlPayload, S> | null;
|
|
170
|
+
}>;
|
|
171
|
+
confirmUpload: <S extends import("./input-types").ConfirmUploadPayloadSelect>(args: import("./mutation").ConfirmUploadVariables, options: {
|
|
172
|
+
select: S;
|
|
173
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ConfirmUploadPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
174
|
+
confirmUpload: import("./select-types").InferSelectResult<import("./input-types").ConfirmUploadPayload, S> | null;
|
|
175
|
+
}>;
|
|
176
|
+
provisionBucket: <S extends import("./input-types").ProvisionBucketPayloadSelect>(args: import("./mutation").ProvisionBucketVariables, options: {
|
|
177
|
+
select: S;
|
|
178
|
+
} & import("./select-types").StrictSelect<S, import("./input-types").ProvisionBucketPayloadSelect>) => import("./query-builder").QueryBuilder<{
|
|
179
|
+
provisionBucket: import("./select-types").InferSelectResult<import("./input-types").ProvisionBucketPayload, S> | null;
|
|
180
|
+
}>;
|
|
166
181
|
};
|
|
167
182
|
};
|
|
@@ -2570,6 +2570,26 @@ export interface SubmitOrgInviteCodeInput {
|
|
|
2570
2570
|
clientMutationId?: string;
|
|
2571
2571
|
token?: string;
|
|
2572
2572
|
}
|
|
2573
|
+
export interface RequestUploadUrlInput {
|
|
2574
|
+
/** Bucket key (e.g., "public", "private") */
|
|
2575
|
+
bucketKey: string;
|
|
2576
|
+
/** SHA-256 content hash computed by the client (hex-encoded, 64 chars) */
|
|
2577
|
+
contentHash: string;
|
|
2578
|
+
/** MIME type of the file (e.g., "image/png") */
|
|
2579
|
+
contentType: string;
|
|
2580
|
+
/** File size in bytes */
|
|
2581
|
+
size: number;
|
|
2582
|
+
/** Original filename (optional, for display and Content-Disposition) */
|
|
2583
|
+
filename?: string;
|
|
2584
|
+
}
|
|
2585
|
+
export interface ConfirmUploadInput {
|
|
2586
|
+
/** The file ID returned by requestUploadUrl */
|
|
2587
|
+
fileId: string;
|
|
2588
|
+
}
|
|
2589
|
+
export interface ProvisionBucketInput {
|
|
2590
|
+
/** The logical bucket key (e.g., "public", "private") */
|
|
2591
|
+
bucketKey: string;
|
|
2592
|
+
}
|
|
2573
2593
|
/** A filter to be used against ConstructiveInternalTypeImage fields. All fields are combined with a logical ‘and.’ */
|
|
2574
2594
|
export interface ConstructiveInternalTypeImageFilter {
|
|
2575
2595
|
/** Is null (if `true` is specified) or is not null (if `false` is specified). */
|
|
@@ -2755,6 +2775,60 @@ export type SubmitOrgInviteCodePayloadSelect = {
|
|
|
2755
2775
|
clientMutationId?: boolean;
|
|
2756
2776
|
result?: boolean;
|
|
2757
2777
|
};
|
|
2778
|
+
export interface RequestUploadUrlPayload {
|
|
2779
|
+
/** Presigned PUT URL (null if file was deduplicated) */
|
|
2780
|
+
uploadUrl?: string | null;
|
|
2781
|
+
/** The file ID (existing if deduplicated, new if fresh upload) */
|
|
2782
|
+
fileId: string;
|
|
2783
|
+
/** The S3 object key */
|
|
2784
|
+
key: string;
|
|
2785
|
+
/** Whether this file was deduplicated (already exists with same hash) */
|
|
2786
|
+
deduplicated: boolean;
|
|
2787
|
+
/** Presigned URL expiry time (null if deduplicated) */
|
|
2788
|
+
expiresAt?: string | null;
|
|
2789
|
+
}
|
|
2790
|
+
export type RequestUploadUrlPayloadSelect = {
|
|
2791
|
+
uploadUrl?: boolean;
|
|
2792
|
+
fileId?: boolean;
|
|
2793
|
+
key?: boolean;
|
|
2794
|
+
deduplicated?: boolean;
|
|
2795
|
+
expiresAt?: boolean;
|
|
2796
|
+
};
|
|
2797
|
+
export interface ConfirmUploadPayload {
|
|
2798
|
+
/** The confirmed file ID */
|
|
2799
|
+
fileId: string;
|
|
2800
|
+
/** New file status */
|
|
2801
|
+
status: string;
|
|
2802
|
+
/** Whether confirmation succeeded */
|
|
2803
|
+
success: boolean;
|
|
2804
|
+
}
|
|
2805
|
+
export type ConfirmUploadPayloadSelect = {
|
|
2806
|
+
fileId?: boolean;
|
|
2807
|
+
status?: boolean;
|
|
2808
|
+
success?: boolean;
|
|
2809
|
+
};
|
|
2810
|
+
export interface ProvisionBucketPayload {
|
|
2811
|
+
/** Whether provisioning succeeded */
|
|
2812
|
+
success: boolean;
|
|
2813
|
+
/** The S3 bucket name that was provisioned */
|
|
2814
|
+
bucketName: string;
|
|
2815
|
+
/** The access type applied */
|
|
2816
|
+
accessType: string;
|
|
2817
|
+
/** The storage provider used */
|
|
2818
|
+
provider: string;
|
|
2819
|
+
/** The S3 endpoint (null for AWS S3 default) */
|
|
2820
|
+
endpoint?: string | null;
|
|
2821
|
+
/** Error message if provisioning failed */
|
|
2822
|
+
error?: string | null;
|
|
2823
|
+
}
|
|
2824
|
+
export type ProvisionBucketPayloadSelect = {
|
|
2825
|
+
success?: boolean;
|
|
2826
|
+
bucketName?: boolean;
|
|
2827
|
+
accessType?: boolean;
|
|
2828
|
+
provider?: boolean;
|
|
2829
|
+
endpoint?: boolean;
|
|
2830
|
+
error?: boolean;
|
|
2831
|
+
};
|
|
2758
2832
|
export interface CreateAppPermissionPayload {
|
|
2759
2833
|
clientMutationId?: string | null;
|
|
2760
2834
|
/** The `AppPermission` that was created by this mutation. */
|
|
@@ -6,13 +6,42 @@
|
|
|
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 { SubmitInviteCodeInput, SubmitOrgInviteCodeInput, SubmitInviteCodePayload, SubmitOrgInviteCodePayload, SubmitInviteCodePayloadSelect, SubmitOrgInviteCodePayloadSelect } from '../input-types';
|
|
9
|
+
import type { SubmitInviteCodeInput, SubmitOrgInviteCodeInput, RequestUploadUrlInput, ConfirmUploadInput, ProvisionBucketInput, SubmitInviteCodePayload, SubmitOrgInviteCodePayload, RequestUploadUrlPayload, ConfirmUploadPayload, ProvisionBucketPayload, SubmitInviteCodePayloadSelect, SubmitOrgInviteCodePayloadSelect, RequestUploadUrlPayloadSelect, ConfirmUploadPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
|
|
10
10
|
export interface SubmitInviteCodeVariables {
|
|
11
11
|
input: SubmitInviteCodeInput;
|
|
12
12
|
}
|
|
13
13
|
export interface SubmitOrgInviteCodeVariables {
|
|
14
14
|
input: SubmitOrgInviteCodeInput;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Variables for requestUploadUrl
|
|
18
|
+
* Request a presigned URL for uploading a file directly to S3.
|
|
19
|
+
Client computes SHA-256 of the file content and provides it here.
|
|
20
|
+
If a file with the same hash already exists (dedup), returns the
|
|
21
|
+
existing file ID and deduplicated=true with no uploadUrl.
|
|
22
|
+
*/
|
|
23
|
+
export interface RequestUploadUrlVariables {
|
|
24
|
+
input: RequestUploadUrlInput;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Variables for confirmUpload
|
|
28
|
+
* Confirm that a file has been uploaded to S3.
|
|
29
|
+
Verifies the object exists in S3, checks content-type,
|
|
30
|
+
and transitions the file status from 'pending' to 'ready'.
|
|
31
|
+
*/
|
|
32
|
+
export interface ConfirmUploadVariables {
|
|
33
|
+
input: ConfirmUploadInput;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Variables for provisionBucket
|
|
37
|
+
* Provision an S3 bucket for a logical bucket in the database.
|
|
38
|
+
Reads the bucket config via RLS, then creates and configures
|
|
39
|
+
the S3 bucket with the appropriate privacy policies, CORS rules,
|
|
40
|
+
and lifecycle settings.
|
|
41
|
+
*/
|
|
42
|
+
export interface ProvisionBucketVariables {
|
|
43
|
+
input: ProvisionBucketInput;
|
|
44
|
+
}
|
|
16
45
|
export declare function createMutationOperations(client: OrmClient): {
|
|
17
46
|
submitInviteCode: <S extends SubmitInviteCodePayloadSelect>(args: SubmitInviteCodeVariables, options: {
|
|
18
47
|
select: S;
|
|
@@ -24,4 +53,19 @@ export declare function createMutationOperations(client: OrmClient): {
|
|
|
24
53
|
} & StrictSelect<S, SubmitOrgInviteCodePayloadSelect>) => QueryBuilder<{
|
|
25
54
|
submitOrgInviteCode: InferSelectResult<SubmitOrgInviteCodePayload, S> | null;
|
|
26
55
|
}>;
|
|
56
|
+
requestUploadUrl: <S extends RequestUploadUrlPayloadSelect>(args: RequestUploadUrlVariables, options: {
|
|
57
|
+
select: S;
|
|
58
|
+
} & StrictSelect<S, RequestUploadUrlPayloadSelect>) => QueryBuilder<{
|
|
59
|
+
requestUploadUrl: InferSelectResult<RequestUploadUrlPayload, S> | null;
|
|
60
|
+
}>;
|
|
61
|
+
confirmUpload: <S extends ConfirmUploadPayloadSelect>(args: ConfirmUploadVariables, options: {
|
|
62
|
+
select: S;
|
|
63
|
+
} & StrictSelect<S, ConfirmUploadPayloadSelect>) => QueryBuilder<{
|
|
64
|
+
confirmUpload: InferSelectResult<ConfirmUploadPayload, S> | null;
|
|
65
|
+
}>;
|
|
66
|
+
provisionBucket: <S extends ProvisionBucketPayloadSelect>(args: ProvisionBucketVariables, options: {
|
|
67
|
+
select: S;
|
|
68
|
+
} & StrictSelect<S, ProvisionBucketPayloadSelect>) => QueryBuilder<{
|
|
69
|
+
provisionBucket: InferSelectResult<ProvisionBucketPayload, S> | null;
|
|
70
|
+
}>;
|
|
27
71
|
};
|
|
@@ -26,5 +26,41 @@ export function createMutationOperations(client) {
|
|
|
26
26
|
},
|
|
27
27
|
], connectionFieldsMap, 'SubmitOrgInviteCodePayload'),
|
|
28
28
|
}),
|
|
29
|
+
requestUploadUrl: (args, options) => new QueryBuilder({
|
|
30
|
+
client,
|
|
31
|
+
operation: 'mutation',
|
|
32
|
+
operationName: 'RequestUploadUrl',
|
|
33
|
+
fieldName: 'requestUploadUrl',
|
|
34
|
+
...buildCustomDocument('mutation', 'RequestUploadUrl', 'requestUploadUrl', options.select, args, [
|
|
35
|
+
{
|
|
36
|
+
name: 'input',
|
|
37
|
+
type: 'RequestUploadUrlInput!',
|
|
38
|
+
},
|
|
39
|
+
], connectionFieldsMap, 'RequestUploadUrlPayload'),
|
|
40
|
+
}),
|
|
41
|
+
confirmUpload: (args, options) => new QueryBuilder({
|
|
42
|
+
client,
|
|
43
|
+
operation: 'mutation',
|
|
44
|
+
operationName: 'ConfirmUpload',
|
|
45
|
+
fieldName: 'confirmUpload',
|
|
46
|
+
...buildCustomDocument('mutation', 'ConfirmUpload', 'confirmUpload', options.select, args, [
|
|
47
|
+
{
|
|
48
|
+
name: 'input',
|
|
49
|
+
type: 'ConfirmUploadInput!',
|
|
50
|
+
},
|
|
51
|
+
], connectionFieldsMap, 'ConfirmUploadPayload'),
|
|
52
|
+
}),
|
|
53
|
+
provisionBucket: (args, options) => new QueryBuilder({
|
|
54
|
+
client,
|
|
55
|
+
operation: 'mutation',
|
|
56
|
+
operationName: 'ProvisionBucket',
|
|
57
|
+
fieldName: 'provisionBucket',
|
|
58
|
+
...buildCustomDocument('mutation', 'ProvisionBucket', 'provisionBucket', options.select, args, [
|
|
59
|
+
{
|
|
60
|
+
name: 'input',
|
|
61
|
+
type: 'ProvisionBucketInput!',
|
|
62
|
+
},
|
|
63
|
+
], connectionFieldsMap, 'ProvisionBucketPayload'),
|
|
64
|
+
}),
|
|
29
65
|
};
|
|
30
66
|
}
|
|
@@ -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
|
+
};
|