@constructive-sdk/cli 0.12.16 → 0.12.17

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.
Files changed (73) hide show
  1. package/esm/public/cli/commands/blueprint-construction.d.ts +8 -0
  2. package/esm/public/cli/commands/blueprint-construction.js +392 -0
  3. package/esm/public/cli/commands/blueprint.js +0 -110
  4. package/esm/public/cli/commands/construct-blueprint.js +1 -1
  5. package/esm/public/cli/commands/provision-full-text-search.d.ts +8 -0
  6. package/esm/public/cli/commands/provision-full-text-search.js +34 -0
  7. package/esm/public/cli/commands/provision-index.d.ts +8 -0
  8. package/esm/public/cli/commands/provision-index.js +34 -0
  9. package/esm/public/cli/commands/provision-relation.d.ts +8 -0
  10. package/esm/public/cli/commands/provision-relation.js +34 -0
  11. package/esm/public/cli/commands/provision-table.d.ts +8 -0
  12. package/esm/public/cli/commands/provision-table.js +34 -0
  13. package/esm/public/cli/commands/provision-unique-constraint.d.ts +8 -0
  14. package/esm/public/cli/commands/provision-unique-constraint.js +34 -0
  15. package/esm/public/cli/commands/relation-provision.js +12 -34
  16. package/esm/public/cli/commands/resolve-blueprint-table.d.ts +8 -0
  17. package/esm/public/cli/commands/resolve-blueprint-table.js +48 -0
  18. package/esm/public/cli/commands/secure-table-provision.js +14 -36
  19. package/esm/public/cli/commands/storage-module.d.ts +8 -0
  20. package/esm/public/cli/commands/storage-module.js +536 -0
  21. package/esm/public/cli/commands.js +27 -11
  22. package/esm/public/cli/executor.d.ts +49 -17
  23. package/esm/public/orm/index.d.ts +53 -19
  24. package/esm/public/orm/index.js +8 -4
  25. package/esm/public/orm/input-types.d.ts +886 -249
  26. package/esm/public/orm/input-types.js +5 -0
  27. package/esm/public/orm/models/blueprintConstruction.d.ts +56 -0
  28. package/esm/public/orm/models/blueprintConstruction.js +96 -0
  29. package/esm/public/orm/models/index.d.ts +4 -2
  30. package/esm/public/orm/models/index.js +4 -2
  31. package/esm/public/orm/models/storageModule.d.ts +56 -0
  32. package/esm/public/orm/models/storageModule.js +96 -0
  33. package/esm/public/orm/mutation/index.d.ts +86 -26
  34. package/esm/public/orm/mutation/index.js +96 -36
  35. package/esm/public/orm/query/index.d.ts +16 -0
  36. package/esm/public/orm/query/index.js +28 -0
  37. package/package.json +2 -2
  38. package/public/cli/commands/blueprint-construction.d.ts +8 -0
  39. package/public/cli/commands/blueprint-construction.js +394 -0
  40. package/public/cli/commands/blueprint.js +0 -110
  41. package/public/cli/commands/construct-blueprint.js +1 -1
  42. package/public/cli/commands/provision-full-text-search.d.ts +8 -0
  43. package/public/cli/commands/provision-full-text-search.js +36 -0
  44. package/public/cli/commands/provision-index.d.ts +8 -0
  45. package/public/cli/commands/provision-index.js +36 -0
  46. package/public/cli/commands/provision-relation.d.ts +8 -0
  47. package/public/cli/commands/provision-relation.js +36 -0
  48. package/public/cli/commands/provision-table.d.ts +8 -0
  49. package/public/cli/commands/provision-table.js +36 -0
  50. package/public/cli/commands/provision-unique-constraint.d.ts +8 -0
  51. package/public/cli/commands/provision-unique-constraint.js +36 -0
  52. package/public/cli/commands/relation-provision.js +12 -34
  53. package/public/cli/commands/resolve-blueprint-table.d.ts +8 -0
  54. package/public/cli/commands/resolve-blueprint-table.js +50 -0
  55. package/public/cli/commands/secure-table-provision.js +14 -36
  56. package/public/cli/commands/storage-module.d.ts +8 -0
  57. package/public/cli/commands/storage-module.js +538 -0
  58. package/public/cli/commands.js +27 -11
  59. package/public/cli/executor.d.ts +49 -17
  60. package/public/orm/index.d.ts +53 -19
  61. package/public/orm/index.js +8 -4
  62. package/public/orm/input-types.d.ts +886 -249
  63. package/public/orm/input-types.js +5 -0
  64. package/public/orm/models/blueprintConstruction.d.ts +56 -0
  65. package/public/orm/models/blueprintConstruction.js +100 -0
  66. package/public/orm/models/index.d.ts +4 -2
  67. package/public/orm/models/index.js +11 -7
  68. package/public/orm/models/storageModule.d.ts +56 -0
  69. package/public/orm/models/storageModule.js +100 -0
  70. package/public/orm/mutation/index.d.ts +86 -26
  71. package/public/orm/mutation/index.js +96 -36
  72. package/public/orm/query/index.d.ts +16 -0
  73. package/public/orm/query/index.js +28 -0
@@ -14,9 +14,8 @@ const fieldSchema = {
14
14
  schemaId: 'uuid',
15
15
  tableId: 'uuid',
16
16
  tableName: 'string',
17
- nodeType: 'string',
17
+ nodes: 'json',
18
18
  useRls: 'boolean',
19
- nodeData: 'json',
20
19
  fields: 'json',
21
20
  grantRoles: 'string',
22
21
  grantPrivileges: 'json',
@@ -75,9 +74,8 @@ async function handleList(argv, _prompter) {
75
74
  schemaId: true,
76
75
  tableId: true,
77
76
  tableName: true,
78
- nodeType: true,
77
+ nodes: true,
79
78
  useRls: true,
80
- nodeData: true,
81
79
  fields: true,
82
80
  grantRoles: true,
83
81
  grantPrivileges: true,
@@ -110,9 +108,8 @@ async function handleFindFirst(argv, _prompter) {
110
108
  schemaId: true,
111
109
  tableId: true,
112
110
  tableName: true,
113
- nodeType: true,
111
+ nodes: true,
114
112
  useRls: true,
115
- nodeData: true,
116
113
  fields: true,
117
114
  grantRoles: true,
118
115
  grantPrivileges: true,
@@ -157,9 +154,8 @@ async function handleGet(argv, prompter) {
157
154
  schemaId: true,
158
155
  tableId: true,
159
156
  tableName: true,
160
- nodeType: true,
157
+ nodes: true,
161
158
  useRls: true,
162
- nodeData: true,
163
159
  fields: true,
164
160
  grantRoles: true,
165
161
  grantPrivileges: true,
@@ -214,9 +210,9 @@ async function handleCreate(argv, prompter) {
214
210
  skipPrompt: true,
215
211
  },
216
212
  {
217
- type: 'text',
218
- name: 'nodeType',
219
- message: 'nodeType',
213
+ type: 'json',
214
+ name: 'nodes',
215
+ message: 'nodes',
220
216
  required: false,
221
217
  skipPrompt: true,
222
218
  },
@@ -227,13 +223,6 @@ async function handleCreate(argv, prompter) {
227
223
  required: false,
228
224
  skipPrompt: true,
229
225
  },
230
- {
231
- type: 'json',
232
- name: 'nodeData',
233
- message: 'nodeData',
234
- required: false,
235
- skipPrompt: true,
236
- },
237
226
  {
238
227
  type: 'json',
239
228
  name: 'fields',
@@ -315,9 +304,8 @@ async function handleCreate(argv, prompter) {
315
304
  schemaId: cleanedData.schemaId,
316
305
  tableId: cleanedData.tableId,
317
306
  tableName: cleanedData.tableName,
318
- nodeType: cleanedData.nodeType,
307
+ nodes: cleanedData.nodes,
319
308
  useRls: cleanedData.useRls,
320
- nodeData: cleanedData.nodeData,
321
309
  fields: cleanedData.fields,
322
310
  grantRoles: cleanedData.grantRoles,
323
311
  grantPrivileges: cleanedData.grantPrivileges,
@@ -335,9 +323,8 @@ async function handleCreate(argv, prompter) {
335
323
  schemaId: true,
336
324
  tableId: true,
337
325
  tableName: true,
338
- nodeType: true,
326
+ nodes: true,
339
327
  useRls: true,
340
- nodeData: true,
341
328
  fields: true,
342
329
  grantRoles: true,
343
330
  grantPrivileges: true,
@@ -398,9 +385,9 @@ async function handleUpdate(argv, prompter) {
398
385
  skipPrompt: true,
399
386
  },
400
387
  {
401
- type: 'text',
402
- name: 'nodeType',
403
- message: 'nodeType',
388
+ type: 'json',
389
+ name: 'nodes',
390
+ message: 'nodes',
404
391
  required: false,
405
392
  skipPrompt: true,
406
393
  },
@@ -411,13 +398,6 @@ async function handleUpdate(argv, prompter) {
411
398
  required: false,
412
399
  skipPrompt: true,
413
400
  },
414
- {
415
- type: 'json',
416
- name: 'nodeData',
417
- message: 'nodeData',
418
- required: false,
419
- skipPrompt: true,
420
- },
421
401
  {
422
402
  type: 'json',
423
403
  name: 'fields',
@@ -502,9 +482,8 @@ async function handleUpdate(argv, prompter) {
502
482
  schemaId: cleanedData.schemaId,
503
483
  tableId: cleanedData.tableId,
504
484
  tableName: cleanedData.tableName,
505
- nodeType: cleanedData.nodeType,
485
+ nodes: cleanedData.nodes,
506
486
  useRls: cleanedData.useRls,
507
- nodeData: cleanedData.nodeData,
508
487
  fields: cleanedData.fields,
509
488
  grantRoles: cleanedData.grantRoles,
510
489
  grantPrivileges: cleanedData.grantPrivileges,
@@ -522,9 +501,8 @@ async function handleUpdate(argv, prompter) {
522
501
  schemaId: true,
523
502
  tableId: true,
524
503
  tableName: true,
525
- nodeType: true,
504
+ nodes: true,
526
505
  useRls: true,
527
- nodeData: true,
528
506
  fields: true,
529
507
  grantRoles: true,
530
508
  grantPrivileges: true,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI commands for StorageModule
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,538 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * CLI commands for StorageModule
5
+ * @generated by @constructive-io/graphql-codegen
6
+ * DO NOT EDIT - changes will be overwritten
7
+ */
8
+ const inquirerer_1 = require("inquirerer");
9
+ const executor_1 = require("../executor");
10
+ const utils_1 = require("../utils");
11
+ const fieldSchema = {
12
+ id: 'uuid',
13
+ databaseId: 'uuid',
14
+ schemaId: 'uuid',
15
+ privateSchemaId: 'uuid',
16
+ bucketsTableId: 'uuid',
17
+ filesTableId: 'uuid',
18
+ uploadRequestsTableId: 'uuid',
19
+ bucketsTableName: 'string',
20
+ filesTableName: 'string',
21
+ uploadRequestsTableName: 'string',
22
+ entityTableId: 'uuid',
23
+ uploadUrlExpirySeconds: 'int',
24
+ downloadUrlExpirySeconds: 'int',
25
+ defaultMaxFileSize: 'int',
26
+ maxFilenameLength: 'int',
27
+ cacheTtlSeconds: 'int',
28
+ };
29
+ const usage = '\nstorage-module <command>\n\nCommands:\n list List storageModule records\n find-first Find first matching storageModule record\n get Get a storageModule by ID\n create Create a new storageModule\n update Update an existing storageModule\n delete Delete a storageModule\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n\n --help, -h Show this help message\n';
30
+ exports.default = async (argv, prompter, _options) => {
31
+ if (argv.help || argv.h) {
32
+ console.log(usage);
33
+ process.exit(0);
34
+ }
35
+ const { first: subcommand, newArgv } = (0, inquirerer_1.extractFirst)(argv);
36
+ if (!subcommand) {
37
+ const answer = await prompter.prompt(argv, [
38
+ {
39
+ type: 'autocomplete',
40
+ name: 'subcommand',
41
+ message: 'What do you want to do?',
42
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
43
+ },
44
+ ]);
45
+ return handleTableSubcommand(answer.subcommand, newArgv, prompter);
46
+ }
47
+ return handleTableSubcommand(subcommand, newArgv, prompter);
48
+ };
49
+ async function handleTableSubcommand(subcommand, argv, prompter) {
50
+ switch (subcommand) {
51
+ case 'list':
52
+ return handleList(argv, prompter);
53
+ case 'find-first':
54
+ return handleFindFirst(argv, prompter);
55
+ case 'get':
56
+ return handleGet(argv, prompter);
57
+ case 'create':
58
+ return handleCreate(argv, prompter);
59
+ case 'update':
60
+ return handleUpdate(argv, prompter);
61
+ case 'delete':
62
+ return handleDelete(argv, prompter);
63
+ default:
64
+ console.log(usage);
65
+ process.exit(1);
66
+ }
67
+ }
68
+ async function handleList(argv, _prompter) {
69
+ try {
70
+ const defaultSelect = {
71
+ id: true,
72
+ databaseId: true,
73
+ schemaId: true,
74
+ privateSchemaId: true,
75
+ bucketsTableId: true,
76
+ filesTableId: true,
77
+ uploadRequestsTableId: true,
78
+ bucketsTableName: true,
79
+ filesTableName: true,
80
+ uploadRequestsTableName: true,
81
+ entityTableId: true,
82
+ uploadUrlExpirySeconds: true,
83
+ downloadUrlExpirySeconds: true,
84
+ defaultMaxFileSize: true,
85
+ maxFilenameLength: true,
86
+ cacheTtlSeconds: true,
87
+ };
88
+ const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
89
+ const client = (0, executor_1.getClient)();
90
+ const result = await client.storageModule.findMany(findManyArgs).execute();
91
+ console.log(JSON.stringify(result, null, 2));
92
+ }
93
+ catch (error) {
94
+ console.error('Failed to list records.');
95
+ if (error instanceof Error) {
96
+ console.error(error.message);
97
+ }
98
+ process.exit(1);
99
+ }
100
+ }
101
+ async function handleFindFirst(argv, _prompter) {
102
+ try {
103
+ const defaultSelect = {
104
+ id: true,
105
+ databaseId: true,
106
+ schemaId: true,
107
+ privateSchemaId: true,
108
+ bucketsTableId: true,
109
+ filesTableId: true,
110
+ uploadRequestsTableId: true,
111
+ bucketsTableName: true,
112
+ filesTableName: true,
113
+ uploadRequestsTableName: true,
114
+ entityTableId: true,
115
+ uploadUrlExpirySeconds: true,
116
+ downloadUrlExpirySeconds: true,
117
+ defaultMaxFileSize: true,
118
+ maxFilenameLength: true,
119
+ cacheTtlSeconds: true,
120
+ };
121
+ const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
122
+ const client = (0, executor_1.getClient)();
123
+ const result = await client.storageModule.findFirst(findFirstArgs).execute();
124
+ console.log(JSON.stringify(result, null, 2));
125
+ }
126
+ catch (error) {
127
+ console.error('Failed to find record.');
128
+ if (error instanceof Error) {
129
+ console.error(error.message);
130
+ }
131
+ process.exit(1);
132
+ }
133
+ }
134
+ async function handleGet(argv, prompter) {
135
+ try {
136
+ const answers = await prompter.prompt(argv, [
137
+ {
138
+ type: 'text',
139
+ name: 'id',
140
+ message: 'id',
141
+ required: true,
142
+ },
143
+ ]);
144
+ const client = (0, executor_1.getClient)();
145
+ const result = await client.storageModule
146
+ .findOne({
147
+ id: answers.id,
148
+ select: {
149
+ id: true,
150
+ databaseId: true,
151
+ schemaId: true,
152
+ privateSchemaId: true,
153
+ bucketsTableId: true,
154
+ filesTableId: true,
155
+ uploadRequestsTableId: true,
156
+ bucketsTableName: true,
157
+ filesTableName: true,
158
+ uploadRequestsTableName: true,
159
+ entityTableId: true,
160
+ uploadUrlExpirySeconds: true,
161
+ downloadUrlExpirySeconds: true,
162
+ defaultMaxFileSize: true,
163
+ maxFilenameLength: true,
164
+ cacheTtlSeconds: true,
165
+ },
166
+ })
167
+ .execute();
168
+ console.log(JSON.stringify(result, null, 2));
169
+ }
170
+ catch (error) {
171
+ console.error('Record not found.');
172
+ if (error instanceof Error) {
173
+ console.error(error.message);
174
+ }
175
+ process.exit(1);
176
+ }
177
+ }
178
+ async function handleCreate(argv, prompter) {
179
+ try {
180
+ const rawAnswers = await prompter.prompt(argv, [
181
+ {
182
+ type: 'text',
183
+ name: 'databaseId',
184
+ message: 'databaseId',
185
+ required: true,
186
+ },
187
+ {
188
+ type: 'text',
189
+ name: 'schemaId',
190
+ message: 'schemaId',
191
+ required: false,
192
+ skipPrompt: true,
193
+ },
194
+ {
195
+ type: 'text',
196
+ name: 'privateSchemaId',
197
+ message: 'privateSchemaId',
198
+ required: false,
199
+ skipPrompt: true,
200
+ },
201
+ {
202
+ type: 'text',
203
+ name: 'bucketsTableId',
204
+ message: 'bucketsTableId',
205
+ required: false,
206
+ skipPrompt: true,
207
+ },
208
+ {
209
+ type: 'text',
210
+ name: 'filesTableId',
211
+ message: 'filesTableId',
212
+ required: false,
213
+ skipPrompt: true,
214
+ },
215
+ {
216
+ type: 'text',
217
+ name: 'uploadRequestsTableId',
218
+ message: 'uploadRequestsTableId',
219
+ required: false,
220
+ skipPrompt: true,
221
+ },
222
+ {
223
+ type: 'text',
224
+ name: 'bucketsTableName',
225
+ message: 'bucketsTableName',
226
+ required: false,
227
+ skipPrompt: true,
228
+ },
229
+ {
230
+ type: 'text',
231
+ name: 'filesTableName',
232
+ message: 'filesTableName',
233
+ required: false,
234
+ skipPrompt: true,
235
+ },
236
+ {
237
+ type: 'text',
238
+ name: 'uploadRequestsTableName',
239
+ message: 'uploadRequestsTableName',
240
+ required: false,
241
+ skipPrompt: true,
242
+ },
243
+ {
244
+ type: 'text',
245
+ name: 'entityTableId',
246
+ message: 'entityTableId',
247
+ required: false,
248
+ skipPrompt: true,
249
+ },
250
+ {
251
+ type: 'text',
252
+ name: 'uploadUrlExpirySeconds',
253
+ message: 'uploadUrlExpirySeconds',
254
+ required: false,
255
+ skipPrompt: true,
256
+ },
257
+ {
258
+ type: 'text',
259
+ name: 'downloadUrlExpirySeconds',
260
+ message: 'downloadUrlExpirySeconds',
261
+ required: false,
262
+ skipPrompt: true,
263
+ },
264
+ {
265
+ type: 'text',
266
+ name: 'defaultMaxFileSize',
267
+ message: 'defaultMaxFileSize',
268
+ required: false,
269
+ skipPrompt: true,
270
+ },
271
+ {
272
+ type: 'text',
273
+ name: 'maxFilenameLength',
274
+ message: 'maxFilenameLength',
275
+ required: false,
276
+ skipPrompt: true,
277
+ },
278
+ {
279
+ type: 'text',
280
+ name: 'cacheTtlSeconds',
281
+ message: 'cacheTtlSeconds',
282
+ required: false,
283
+ skipPrompt: true,
284
+ },
285
+ ]);
286
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
287
+ const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
288
+ const client = (0, executor_1.getClient)();
289
+ const result = await client.storageModule
290
+ .create({
291
+ data: {
292
+ databaseId: cleanedData.databaseId,
293
+ schemaId: cleanedData.schemaId,
294
+ privateSchemaId: cleanedData.privateSchemaId,
295
+ bucketsTableId: cleanedData.bucketsTableId,
296
+ filesTableId: cleanedData.filesTableId,
297
+ uploadRequestsTableId: cleanedData.uploadRequestsTableId,
298
+ bucketsTableName: cleanedData.bucketsTableName,
299
+ filesTableName: cleanedData.filesTableName,
300
+ uploadRequestsTableName: cleanedData.uploadRequestsTableName,
301
+ entityTableId: cleanedData.entityTableId,
302
+ uploadUrlExpirySeconds: cleanedData.uploadUrlExpirySeconds,
303
+ downloadUrlExpirySeconds: cleanedData.downloadUrlExpirySeconds,
304
+ defaultMaxFileSize: cleanedData.defaultMaxFileSize,
305
+ maxFilenameLength: cleanedData.maxFilenameLength,
306
+ cacheTtlSeconds: cleanedData.cacheTtlSeconds,
307
+ },
308
+ select: {
309
+ id: true,
310
+ databaseId: true,
311
+ schemaId: true,
312
+ privateSchemaId: true,
313
+ bucketsTableId: true,
314
+ filesTableId: true,
315
+ uploadRequestsTableId: true,
316
+ bucketsTableName: true,
317
+ filesTableName: true,
318
+ uploadRequestsTableName: true,
319
+ entityTableId: true,
320
+ uploadUrlExpirySeconds: true,
321
+ downloadUrlExpirySeconds: true,
322
+ defaultMaxFileSize: true,
323
+ maxFilenameLength: true,
324
+ cacheTtlSeconds: true,
325
+ },
326
+ })
327
+ .execute();
328
+ console.log(JSON.stringify(result, null, 2));
329
+ }
330
+ catch (error) {
331
+ console.error('Failed to create record.');
332
+ if (error instanceof Error) {
333
+ console.error(error.message);
334
+ }
335
+ process.exit(1);
336
+ }
337
+ }
338
+ async function handleUpdate(argv, prompter) {
339
+ try {
340
+ const rawAnswers = await prompter.prompt(argv, [
341
+ {
342
+ type: 'text',
343
+ name: 'id',
344
+ message: 'id',
345
+ required: true,
346
+ },
347
+ {
348
+ type: 'text',
349
+ name: 'databaseId',
350
+ message: 'databaseId',
351
+ required: false,
352
+ },
353
+ {
354
+ type: 'text',
355
+ name: 'schemaId',
356
+ message: 'schemaId',
357
+ required: false,
358
+ skipPrompt: true,
359
+ },
360
+ {
361
+ type: 'text',
362
+ name: 'privateSchemaId',
363
+ message: 'privateSchemaId',
364
+ required: false,
365
+ skipPrompt: true,
366
+ },
367
+ {
368
+ type: 'text',
369
+ name: 'bucketsTableId',
370
+ message: 'bucketsTableId',
371
+ required: false,
372
+ skipPrompt: true,
373
+ },
374
+ {
375
+ type: 'text',
376
+ name: 'filesTableId',
377
+ message: 'filesTableId',
378
+ required: false,
379
+ skipPrompt: true,
380
+ },
381
+ {
382
+ type: 'text',
383
+ name: 'uploadRequestsTableId',
384
+ message: 'uploadRequestsTableId',
385
+ required: false,
386
+ skipPrompt: true,
387
+ },
388
+ {
389
+ type: 'text',
390
+ name: 'bucketsTableName',
391
+ message: 'bucketsTableName',
392
+ required: false,
393
+ skipPrompt: true,
394
+ },
395
+ {
396
+ type: 'text',
397
+ name: 'filesTableName',
398
+ message: 'filesTableName',
399
+ required: false,
400
+ skipPrompt: true,
401
+ },
402
+ {
403
+ type: 'text',
404
+ name: 'uploadRequestsTableName',
405
+ message: 'uploadRequestsTableName',
406
+ required: false,
407
+ skipPrompt: true,
408
+ },
409
+ {
410
+ type: 'text',
411
+ name: 'entityTableId',
412
+ message: 'entityTableId',
413
+ required: false,
414
+ skipPrompt: true,
415
+ },
416
+ {
417
+ type: 'text',
418
+ name: 'uploadUrlExpirySeconds',
419
+ message: 'uploadUrlExpirySeconds',
420
+ required: false,
421
+ skipPrompt: true,
422
+ },
423
+ {
424
+ type: 'text',
425
+ name: 'downloadUrlExpirySeconds',
426
+ message: 'downloadUrlExpirySeconds',
427
+ required: false,
428
+ skipPrompt: true,
429
+ },
430
+ {
431
+ type: 'text',
432
+ name: 'defaultMaxFileSize',
433
+ message: 'defaultMaxFileSize',
434
+ required: false,
435
+ skipPrompt: true,
436
+ },
437
+ {
438
+ type: 'text',
439
+ name: 'maxFilenameLength',
440
+ message: 'maxFilenameLength',
441
+ required: false,
442
+ skipPrompt: true,
443
+ },
444
+ {
445
+ type: 'text',
446
+ name: 'cacheTtlSeconds',
447
+ message: 'cacheTtlSeconds',
448
+ required: false,
449
+ skipPrompt: true,
450
+ },
451
+ ]);
452
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
453
+ const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
454
+ const client = (0, executor_1.getClient)();
455
+ const result = await client.storageModule
456
+ .update({
457
+ where: {
458
+ id: answers.id,
459
+ },
460
+ data: {
461
+ databaseId: cleanedData.databaseId,
462
+ schemaId: cleanedData.schemaId,
463
+ privateSchemaId: cleanedData.privateSchemaId,
464
+ bucketsTableId: cleanedData.bucketsTableId,
465
+ filesTableId: cleanedData.filesTableId,
466
+ uploadRequestsTableId: cleanedData.uploadRequestsTableId,
467
+ bucketsTableName: cleanedData.bucketsTableName,
468
+ filesTableName: cleanedData.filesTableName,
469
+ uploadRequestsTableName: cleanedData.uploadRequestsTableName,
470
+ entityTableId: cleanedData.entityTableId,
471
+ uploadUrlExpirySeconds: cleanedData.uploadUrlExpirySeconds,
472
+ downloadUrlExpirySeconds: cleanedData.downloadUrlExpirySeconds,
473
+ defaultMaxFileSize: cleanedData.defaultMaxFileSize,
474
+ maxFilenameLength: cleanedData.maxFilenameLength,
475
+ cacheTtlSeconds: cleanedData.cacheTtlSeconds,
476
+ },
477
+ select: {
478
+ id: true,
479
+ databaseId: true,
480
+ schemaId: true,
481
+ privateSchemaId: true,
482
+ bucketsTableId: true,
483
+ filesTableId: true,
484
+ uploadRequestsTableId: true,
485
+ bucketsTableName: true,
486
+ filesTableName: true,
487
+ uploadRequestsTableName: true,
488
+ entityTableId: true,
489
+ uploadUrlExpirySeconds: true,
490
+ downloadUrlExpirySeconds: true,
491
+ defaultMaxFileSize: true,
492
+ maxFilenameLength: true,
493
+ cacheTtlSeconds: true,
494
+ },
495
+ })
496
+ .execute();
497
+ console.log(JSON.stringify(result, null, 2));
498
+ }
499
+ catch (error) {
500
+ console.error('Failed to update record.');
501
+ if (error instanceof Error) {
502
+ console.error(error.message);
503
+ }
504
+ process.exit(1);
505
+ }
506
+ }
507
+ async function handleDelete(argv, prompter) {
508
+ try {
509
+ const rawAnswers = await prompter.prompt(argv, [
510
+ {
511
+ type: 'text',
512
+ name: 'id',
513
+ message: 'id',
514
+ required: true,
515
+ },
516
+ ]);
517
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
518
+ const client = (0, executor_1.getClient)();
519
+ const result = await client.storageModule
520
+ .delete({
521
+ where: {
522
+ id: answers.id,
523
+ },
524
+ select: {
525
+ id: true,
526
+ },
527
+ })
528
+ .execute();
529
+ console.log(JSON.stringify(result, null, 2));
530
+ }
531
+ catch (error) {
532
+ console.error('Failed to delete record.');
533
+ if (error instanceof Error) {
534
+ console.error(error.message);
535
+ }
536
+ process.exit(1);
537
+ }
538
+ }