@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.
- package/esm/public/cli/commands/blueprint-construction.d.ts +8 -0
- package/esm/public/cli/commands/blueprint-construction.js +392 -0
- package/esm/public/cli/commands/blueprint.js +0 -110
- package/esm/public/cli/commands/construct-blueprint.js +1 -1
- package/esm/public/cli/commands/provision-full-text-search.d.ts +8 -0
- package/esm/public/cli/commands/provision-full-text-search.js +34 -0
- package/esm/public/cli/commands/provision-index.d.ts +8 -0
- package/esm/public/cli/commands/provision-index.js +34 -0
- package/esm/public/cli/commands/provision-relation.d.ts +8 -0
- package/esm/public/cli/commands/provision-relation.js +34 -0
- package/esm/public/cli/commands/provision-table.d.ts +8 -0
- package/esm/public/cli/commands/provision-table.js +34 -0
- package/esm/public/cli/commands/provision-unique-constraint.d.ts +8 -0
- package/esm/public/cli/commands/provision-unique-constraint.js +34 -0
- package/esm/public/cli/commands/relation-provision.js +12 -34
- package/esm/public/cli/commands/resolve-blueprint-table.d.ts +8 -0
- package/esm/public/cli/commands/resolve-blueprint-table.js +48 -0
- package/esm/public/cli/commands/secure-table-provision.js +14 -36
- package/esm/public/cli/commands/storage-module.d.ts +8 -0
- package/esm/public/cli/commands/storage-module.js +536 -0
- package/esm/public/cli/commands.js +27 -11
- package/esm/public/cli/executor.d.ts +49 -17
- package/esm/public/orm/index.d.ts +53 -19
- package/esm/public/orm/index.js +8 -4
- package/esm/public/orm/input-types.d.ts +886 -249
- package/esm/public/orm/input-types.js +5 -0
- package/esm/public/orm/models/blueprintConstruction.d.ts +56 -0
- package/esm/public/orm/models/blueprintConstruction.js +96 -0
- package/esm/public/orm/models/index.d.ts +4 -2
- package/esm/public/orm/models/index.js +4 -2
- package/esm/public/orm/models/storageModule.d.ts +56 -0
- package/esm/public/orm/models/storageModule.js +96 -0
- package/esm/public/orm/mutation/index.d.ts +86 -26
- package/esm/public/orm/mutation/index.js +96 -36
- package/esm/public/orm/query/index.d.ts +16 -0
- package/esm/public/orm/query/index.js +28 -0
- package/package.json +2 -2
- package/public/cli/commands/blueprint-construction.d.ts +8 -0
- package/public/cli/commands/blueprint-construction.js +394 -0
- package/public/cli/commands/blueprint.js +0 -110
- package/public/cli/commands/construct-blueprint.js +1 -1
- package/public/cli/commands/provision-full-text-search.d.ts +8 -0
- package/public/cli/commands/provision-full-text-search.js +36 -0
- package/public/cli/commands/provision-index.d.ts +8 -0
- package/public/cli/commands/provision-index.js +36 -0
- package/public/cli/commands/provision-relation.d.ts +8 -0
- package/public/cli/commands/provision-relation.js +36 -0
- package/public/cli/commands/provision-table.d.ts +8 -0
- package/public/cli/commands/provision-table.js +36 -0
- package/public/cli/commands/provision-unique-constraint.d.ts +8 -0
- package/public/cli/commands/provision-unique-constraint.js +36 -0
- package/public/cli/commands/relation-provision.js +12 -34
- package/public/cli/commands/resolve-blueprint-table.d.ts +8 -0
- package/public/cli/commands/resolve-blueprint-table.js +50 -0
- package/public/cli/commands/secure-table-provision.js +14 -36
- package/public/cli/commands/storage-module.d.ts +8 -0
- package/public/cli/commands/storage-module.js +538 -0
- package/public/cli/commands.js +27 -11
- package/public/cli/executor.d.ts +49 -17
- package/public/orm/index.d.ts +53 -19
- package/public/orm/index.js +8 -4
- package/public/orm/input-types.d.ts +886 -249
- package/public/orm/input-types.js +5 -0
- package/public/orm/models/blueprintConstruction.d.ts +56 -0
- package/public/orm/models/blueprintConstruction.js +100 -0
- package/public/orm/models/index.d.ts +4 -2
- package/public/orm/models/index.js +11 -7
- package/public/orm/models/storageModule.d.ts +56 -0
- package/public/orm/models/storageModule.js +100 -0
- package/public/orm/mutation/index.d.ts +86 -26
- package/public/orm/mutation/index.js +96 -36
- package/public/orm/query/index.d.ts +16 -0
- package/public/orm/query/index.js +28 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for BlueprintConstruction
|
|
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,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for BlueprintConstruction
|
|
3
|
+
* @generated by @constructive-io/graphql-codegen
|
|
4
|
+
* DO NOT EDIT - changes will be overwritten
|
|
5
|
+
*/
|
|
6
|
+
import { extractFirst } from 'inquirerer';
|
|
7
|
+
import { getClient } from '../executor';
|
|
8
|
+
import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
|
|
9
|
+
const fieldSchema = {
|
|
10
|
+
id: 'uuid',
|
|
11
|
+
blueprintId: 'uuid',
|
|
12
|
+
databaseId: 'uuid',
|
|
13
|
+
schemaId: 'uuid',
|
|
14
|
+
status: 'string',
|
|
15
|
+
errorDetails: 'string',
|
|
16
|
+
tableMap: 'json',
|
|
17
|
+
constructedDefinition: 'json',
|
|
18
|
+
constructedAt: 'string',
|
|
19
|
+
createdAt: 'string',
|
|
20
|
+
updatedAt: 'string',
|
|
21
|
+
};
|
|
22
|
+
const usage = '\nblueprint-construction <command>\n\nCommands:\n list List blueprintConstruction records\n find-first Find first matching blueprintConstruction record\n get Get a blueprintConstruction by ID\n create Create a new blueprintConstruction\n update Update an existing blueprintConstruction\n delete Delete a blueprintConstruction\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';
|
|
23
|
+
export default async (argv, prompter, _options) => {
|
|
24
|
+
if (argv.help || argv.h) {
|
|
25
|
+
console.log(usage);
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
const { first: subcommand, newArgv } = extractFirst(argv);
|
|
29
|
+
if (!subcommand) {
|
|
30
|
+
const answer = await prompter.prompt(argv, [
|
|
31
|
+
{
|
|
32
|
+
type: 'autocomplete',
|
|
33
|
+
name: 'subcommand',
|
|
34
|
+
message: 'What do you want to do?',
|
|
35
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
39
|
+
}
|
|
40
|
+
return handleTableSubcommand(subcommand, newArgv, prompter);
|
|
41
|
+
};
|
|
42
|
+
async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
43
|
+
switch (subcommand) {
|
|
44
|
+
case 'list':
|
|
45
|
+
return handleList(argv, prompter);
|
|
46
|
+
case 'find-first':
|
|
47
|
+
return handleFindFirst(argv, prompter);
|
|
48
|
+
case 'get':
|
|
49
|
+
return handleGet(argv, prompter);
|
|
50
|
+
case 'create':
|
|
51
|
+
return handleCreate(argv, prompter);
|
|
52
|
+
case 'update':
|
|
53
|
+
return handleUpdate(argv, prompter);
|
|
54
|
+
case 'delete':
|
|
55
|
+
return handleDelete(argv, prompter);
|
|
56
|
+
default:
|
|
57
|
+
console.log(usage);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function handleList(argv, _prompter) {
|
|
62
|
+
try {
|
|
63
|
+
const defaultSelect = {
|
|
64
|
+
id: true,
|
|
65
|
+
blueprintId: true,
|
|
66
|
+
databaseId: true,
|
|
67
|
+
schemaId: true,
|
|
68
|
+
status: true,
|
|
69
|
+
errorDetails: true,
|
|
70
|
+
tableMap: true,
|
|
71
|
+
constructedDefinition: true,
|
|
72
|
+
constructedAt: true,
|
|
73
|
+
createdAt: true,
|
|
74
|
+
updatedAt: true,
|
|
75
|
+
};
|
|
76
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
77
|
+
const client = getClient();
|
|
78
|
+
const result = await client.blueprintConstruction.findMany(findManyArgs).execute();
|
|
79
|
+
console.log(JSON.stringify(result, null, 2));
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error('Failed to list records.');
|
|
83
|
+
if (error instanceof Error) {
|
|
84
|
+
console.error(error.message);
|
|
85
|
+
}
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function handleFindFirst(argv, _prompter) {
|
|
90
|
+
try {
|
|
91
|
+
const defaultSelect = {
|
|
92
|
+
id: true,
|
|
93
|
+
blueprintId: true,
|
|
94
|
+
databaseId: true,
|
|
95
|
+
schemaId: true,
|
|
96
|
+
status: true,
|
|
97
|
+
errorDetails: true,
|
|
98
|
+
tableMap: true,
|
|
99
|
+
constructedDefinition: true,
|
|
100
|
+
constructedAt: true,
|
|
101
|
+
createdAt: true,
|
|
102
|
+
updatedAt: true,
|
|
103
|
+
};
|
|
104
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
105
|
+
const client = getClient();
|
|
106
|
+
const result = await client.blueprintConstruction.findFirst(findFirstArgs).execute();
|
|
107
|
+
console.log(JSON.stringify(result, null, 2));
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.error('Failed to find record.');
|
|
111
|
+
if (error instanceof Error) {
|
|
112
|
+
console.error(error.message);
|
|
113
|
+
}
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function handleGet(argv, prompter) {
|
|
118
|
+
try {
|
|
119
|
+
const answers = await prompter.prompt(argv, [
|
|
120
|
+
{
|
|
121
|
+
type: 'text',
|
|
122
|
+
name: 'id',
|
|
123
|
+
message: 'id',
|
|
124
|
+
required: true,
|
|
125
|
+
},
|
|
126
|
+
]);
|
|
127
|
+
const client = getClient();
|
|
128
|
+
const result = await client.blueprintConstruction
|
|
129
|
+
.findOne({
|
|
130
|
+
id: answers.id,
|
|
131
|
+
select: {
|
|
132
|
+
id: true,
|
|
133
|
+
blueprintId: true,
|
|
134
|
+
databaseId: true,
|
|
135
|
+
schemaId: true,
|
|
136
|
+
status: true,
|
|
137
|
+
errorDetails: true,
|
|
138
|
+
tableMap: true,
|
|
139
|
+
constructedDefinition: true,
|
|
140
|
+
constructedAt: true,
|
|
141
|
+
createdAt: true,
|
|
142
|
+
updatedAt: true,
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
.execute();
|
|
146
|
+
console.log(JSON.stringify(result, null, 2));
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.error('Record not found.');
|
|
150
|
+
if (error instanceof Error) {
|
|
151
|
+
console.error(error.message);
|
|
152
|
+
}
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function handleCreate(argv, prompter) {
|
|
157
|
+
try {
|
|
158
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
159
|
+
{
|
|
160
|
+
type: 'text',
|
|
161
|
+
name: 'blueprintId',
|
|
162
|
+
message: 'blueprintId',
|
|
163
|
+
required: true,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: 'text',
|
|
167
|
+
name: 'databaseId',
|
|
168
|
+
message: 'databaseId',
|
|
169
|
+
required: true,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
type: 'text',
|
|
173
|
+
name: 'schemaId',
|
|
174
|
+
message: 'schemaId',
|
|
175
|
+
required: false,
|
|
176
|
+
skipPrompt: true,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'text',
|
|
180
|
+
name: 'status',
|
|
181
|
+
message: 'status',
|
|
182
|
+
required: false,
|
|
183
|
+
skipPrompt: true,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
type: 'text',
|
|
187
|
+
name: 'errorDetails',
|
|
188
|
+
message: 'errorDetails',
|
|
189
|
+
required: false,
|
|
190
|
+
skipPrompt: true,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
type: 'json',
|
|
194
|
+
name: 'tableMap',
|
|
195
|
+
message: 'tableMap',
|
|
196
|
+
required: false,
|
|
197
|
+
skipPrompt: true,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'json',
|
|
201
|
+
name: 'constructedDefinition',
|
|
202
|
+
message: 'constructedDefinition',
|
|
203
|
+
required: false,
|
|
204
|
+
skipPrompt: true,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
type: 'text',
|
|
208
|
+
name: 'constructedAt',
|
|
209
|
+
message: 'constructedAt',
|
|
210
|
+
required: false,
|
|
211
|
+
skipPrompt: true,
|
|
212
|
+
},
|
|
213
|
+
]);
|
|
214
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
215
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
216
|
+
const client = getClient();
|
|
217
|
+
const result = await client.blueprintConstruction
|
|
218
|
+
.create({
|
|
219
|
+
data: {
|
|
220
|
+
blueprintId: cleanedData.blueprintId,
|
|
221
|
+
databaseId: cleanedData.databaseId,
|
|
222
|
+
schemaId: cleanedData.schemaId,
|
|
223
|
+
status: cleanedData.status,
|
|
224
|
+
errorDetails: cleanedData.errorDetails,
|
|
225
|
+
tableMap: cleanedData.tableMap,
|
|
226
|
+
constructedDefinition: cleanedData.constructedDefinition,
|
|
227
|
+
constructedAt: cleanedData.constructedAt,
|
|
228
|
+
},
|
|
229
|
+
select: {
|
|
230
|
+
id: true,
|
|
231
|
+
blueprintId: true,
|
|
232
|
+
databaseId: true,
|
|
233
|
+
schemaId: true,
|
|
234
|
+
status: true,
|
|
235
|
+
errorDetails: true,
|
|
236
|
+
tableMap: true,
|
|
237
|
+
constructedDefinition: true,
|
|
238
|
+
constructedAt: true,
|
|
239
|
+
createdAt: true,
|
|
240
|
+
updatedAt: true,
|
|
241
|
+
},
|
|
242
|
+
})
|
|
243
|
+
.execute();
|
|
244
|
+
console.log(JSON.stringify(result, null, 2));
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
console.error('Failed to create record.');
|
|
248
|
+
if (error instanceof Error) {
|
|
249
|
+
console.error(error.message);
|
|
250
|
+
}
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
async function handleUpdate(argv, prompter) {
|
|
255
|
+
try {
|
|
256
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
257
|
+
{
|
|
258
|
+
type: 'text',
|
|
259
|
+
name: 'id',
|
|
260
|
+
message: 'id',
|
|
261
|
+
required: true,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
type: 'text',
|
|
265
|
+
name: 'blueprintId',
|
|
266
|
+
message: 'blueprintId',
|
|
267
|
+
required: false,
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
type: 'text',
|
|
271
|
+
name: 'databaseId',
|
|
272
|
+
message: 'databaseId',
|
|
273
|
+
required: false,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: 'text',
|
|
277
|
+
name: 'schemaId',
|
|
278
|
+
message: 'schemaId',
|
|
279
|
+
required: false,
|
|
280
|
+
skipPrompt: true,
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
type: 'text',
|
|
284
|
+
name: 'status',
|
|
285
|
+
message: 'status',
|
|
286
|
+
required: false,
|
|
287
|
+
skipPrompt: true,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
type: 'text',
|
|
291
|
+
name: 'errorDetails',
|
|
292
|
+
message: 'errorDetails',
|
|
293
|
+
required: false,
|
|
294
|
+
skipPrompt: true,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
type: 'json',
|
|
298
|
+
name: 'tableMap',
|
|
299
|
+
message: 'tableMap',
|
|
300
|
+
required: false,
|
|
301
|
+
skipPrompt: true,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
type: 'json',
|
|
305
|
+
name: 'constructedDefinition',
|
|
306
|
+
message: 'constructedDefinition',
|
|
307
|
+
required: false,
|
|
308
|
+
skipPrompt: true,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
type: 'text',
|
|
312
|
+
name: 'constructedAt',
|
|
313
|
+
message: 'constructedAt',
|
|
314
|
+
required: false,
|
|
315
|
+
skipPrompt: true,
|
|
316
|
+
},
|
|
317
|
+
]);
|
|
318
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
319
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
320
|
+
const client = getClient();
|
|
321
|
+
const result = await client.blueprintConstruction
|
|
322
|
+
.update({
|
|
323
|
+
where: {
|
|
324
|
+
id: answers.id,
|
|
325
|
+
},
|
|
326
|
+
data: {
|
|
327
|
+
blueprintId: cleanedData.blueprintId,
|
|
328
|
+
databaseId: cleanedData.databaseId,
|
|
329
|
+
schemaId: cleanedData.schemaId,
|
|
330
|
+
status: cleanedData.status,
|
|
331
|
+
errorDetails: cleanedData.errorDetails,
|
|
332
|
+
tableMap: cleanedData.tableMap,
|
|
333
|
+
constructedDefinition: cleanedData.constructedDefinition,
|
|
334
|
+
constructedAt: cleanedData.constructedAt,
|
|
335
|
+
},
|
|
336
|
+
select: {
|
|
337
|
+
id: true,
|
|
338
|
+
blueprintId: true,
|
|
339
|
+
databaseId: true,
|
|
340
|
+
schemaId: true,
|
|
341
|
+
status: true,
|
|
342
|
+
errorDetails: true,
|
|
343
|
+
tableMap: true,
|
|
344
|
+
constructedDefinition: true,
|
|
345
|
+
constructedAt: true,
|
|
346
|
+
createdAt: true,
|
|
347
|
+
updatedAt: true,
|
|
348
|
+
},
|
|
349
|
+
})
|
|
350
|
+
.execute();
|
|
351
|
+
console.log(JSON.stringify(result, null, 2));
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
console.error('Failed to update record.');
|
|
355
|
+
if (error instanceof Error) {
|
|
356
|
+
console.error(error.message);
|
|
357
|
+
}
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
async function handleDelete(argv, prompter) {
|
|
362
|
+
try {
|
|
363
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
364
|
+
{
|
|
365
|
+
type: 'text',
|
|
366
|
+
name: 'id',
|
|
367
|
+
message: 'id',
|
|
368
|
+
required: true,
|
|
369
|
+
},
|
|
370
|
+
]);
|
|
371
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
372
|
+
const client = getClient();
|
|
373
|
+
const result = await client.blueprintConstruction
|
|
374
|
+
.delete({
|
|
375
|
+
where: {
|
|
376
|
+
id: answers.id,
|
|
377
|
+
},
|
|
378
|
+
select: {
|
|
379
|
+
id: true,
|
|
380
|
+
},
|
|
381
|
+
})
|
|
382
|
+
.execute();
|
|
383
|
+
console.log(JSON.stringify(result, null, 2));
|
|
384
|
+
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
console.error('Failed to delete record.');
|
|
387
|
+
if (error instanceof Error) {
|
|
388
|
+
console.error(error.message);
|
|
389
|
+
}
|
|
390
|
+
process.exit(1);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
@@ -15,11 +15,6 @@ const fieldSchema = {
|
|
|
15
15
|
description: 'string',
|
|
16
16
|
definition: 'json',
|
|
17
17
|
templateId: 'uuid',
|
|
18
|
-
status: 'string',
|
|
19
|
-
constructedAt: 'string',
|
|
20
|
-
errorDetails: 'string',
|
|
21
|
-
refMap: 'json',
|
|
22
|
-
constructedDefinition: 'json',
|
|
23
18
|
definitionHash: 'uuid',
|
|
24
19
|
tableHashes: 'json',
|
|
25
20
|
createdAt: 'string',
|
|
@@ -75,11 +70,6 @@ async function handleList(argv, _prompter) {
|
|
|
75
70
|
description: true,
|
|
76
71
|
definition: true,
|
|
77
72
|
templateId: true,
|
|
78
|
-
status: true,
|
|
79
|
-
constructedAt: true,
|
|
80
|
-
errorDetails: true,
|
|
81
|
-
refMap: true,
|
|
82
|
-
constructedDefinition: true,
|
|
83
73
|
definitionHash: true,
|
|
84
74
|
tableHashes: true,
|
|
85
75
|
createdAt: true,
|
|
@@ -109,11 +99,6 @@ async function handleFindFirst(argv, _prompter) {
|
|
|
109
99
|
description: true,
|
|
110
100
|
definition: true,
|
|
111
101
|
templateId: true,
|
|
112
|
-
status: true,
|
|
113
|
-
constructedAt: true,
|
|
114
|
-
errorDetails: true,
|
|
115
|
-
refMap: true,
|
|
116
|
-
constructedDefinition: true,
|
|
117
102
|
definitionHash: true,
|
|
118
103
|
tableHashes: true,
|
|
119
104
|
createdAt: true,
|
|
@@ -155,11 +140,6 @@ async function handleGet(argv, prompter) {
|
|
|
155
140
|
description: true,
|
|
156
141
|
definition: true,
|
|
157
142
|
templateId: true,
|
|
158
|
-
status: true,
|
|
159
|
-
constructedAt: true,
|
|
160
|
-
errorDetails: true,
|
|
161
|
-
refMap: true,
|
|
162
|
-
constructedDefinition: true,
|
|
163
143
|
definitionHash: true,
|
|
164
144
|
tableHashes: true,
|
|
165
145
|
createdAt: true,
|
|
@@ -224,41 +204,6 @@ async function handleCreate(argv, prompter) {
|
|
|
224
204
|
required: false,
|
|
225
205
|
skipPrompt: true,
|
|
226
206
|
},
|
|
227
|
-
{
|
|
228
|
-
type: 'text',
|
|
229
|
-
name: 'status',
|
|
230
|
-
message: 'status',
|
|
231
|
-
required: false,
|
|
232
|
-
skipPrompt: true,
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
type: 'text',
|
|
236
|
-
name: 'constructedAt',
|
|
237
|
-
message: 'constructedAt',
|
|
238
|
-
required: false,
|
|
239
|
-
skipPrompt: true,
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
type: 'text',
|
|
243
|
-
name: 'errorDetails',
|
|
244
|
-
message: 'errorDetails',
|
|
245
|
-
required: false,
|
|
246
|
-
skipPrompt: true,
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
type: 'json',
|
|
250
|
-
name: 'refMap',
|
|
251
|
-
message: 'refMap',
|
|
252
|
-
required: false,
|
|
253
|
-
skipPrompt: true,
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
type: 'json',
|
|
257
|
-
name: 'constructedDefinition',
|
|
258
|
-
message: 'constructedDefinition',
|
|
259
|
-
required: false,
|
|
260
|
-
skipPrompt: true,
|
|
261
|
-
},
|
|
262
207
|
{
|
|
263
208
|
type: 'text',
|
|
264
209
|
name: 'definitionHash',
|
|
@@ -287,11 +232,6 @@ async function handleCreate(argv, prompter) {
|
|
|
287
232
|
description: cleanedData.description,
|
|
288
233
|
definition: cleanedData.definition,
|
|
289
234
|
templateId: cleanedData.templateId,
|
|
290
|
-
status: cleanedData.status,
|
|
291
|
-
constructedAt: cleanedData.constructedAt,
|
|
292
|
-
errorDetails: cleanedData.errorDetails,
|
|
293
|
-
refMap: cleanedData.refMap,
|
|
294
|
-
constructedDefinition: cleanedData.constructedDefinition,
|
|
295
235
|
definitionHash: cleanedData.definitionHash,
|
|
296
236
|
tableHashes: cleanedData.tableHashes,
|
|
297
237
|
},
|
|
@@ -304,11 +244,6 @@ async function handleCreate(argv, prompter) {
|
|
|
304
244
|
description: true,
|
|
305
245
|
definition: true,
|
|
306
246
|
templateId: true,
|
|
307
|
-
status: true,
|
|
308
|
-
constructedAt: true,
|
|
309
|
-
errorDetails: true,
|
|
310
|
-
refMap: true,
|
|
311
|
-
constructedDefinition: true,
|
|
312
247
|
definitionHash: true,
|
|
313
248
|
tableHashes: true,
|
|
314
249
|
createdAt: true,
|
|
@@ -379,41 +314,6 @@ async function handleUpdate(argv, prompter) {
|
|
|
379
314
|
required: false,
|
|
380
315
|
skipPrompt: true,
|
|
381
316
|
},
|
|
382
|
-
{
|
|
383
|
-
type: 'text',
|
|
384
|
-
name: 'status',
|
|
385
|
-
message: 'status',
|
|
386
|
-
required: false,
|
|
387
|
-
skipPrompt: true,
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
type: 'text',
|
|
391
|
-
name: 'constructedAt',
|
|
392
|
-
message: 'constructedAt',
|
|
393
|
-
required: false,
|
|
394
|
-
skipPrompt: true,
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
type: 'text',
|
|
398
|
-
name: 'errorDetails',
|
|
399
|
-
message: 'errorDetails',
|
|
400
|
-
required: false,
|
|
401
|
-
skipPrompt: true,
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
type: 'json',
|
|
405
|
-
name: 'refMap',
|
|
406
|
-
message: 'refMap',
|
|
407
|
-
required: false,
|
|
408
|
-
skipPrompt: true,
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
type: 'json',
|
|
412
|
-
name: 'constructedDefinition',
|
|
413
|
-
message: 'constructedDefinition',
|
|
414
|
-
required: false,
|
|
415
|
-
skipPrompt: true,
|
|
416
|
-
},
|
|
417
317
|
{
|
|
418
318
|
type: 'text',
|
|
419
319
|
name: 'definitionHash',
|
|
@@ -445,11 +345,6 @@ async function handleUpdate(argv, prompter) {
|
|
|
445
345
|
description: cleanedData.description,
|
|
446
346
|
definition: cleanedData.definition,
|
|
447
347
|
templateId: cleanedData.templateId,
|
|
448
|
-
status: cleanedData.status,
|
|
449
|
-
constructedAt: cleanedData.constructedAt,
|
|
450
|
-
errorDetails: cleanedData.errorDetails,
|
|
451
|
-
refMap: cleanedData.refMap,
|
|
452
|
-
constructedDefinition: cleanedData.constructedDefinition,
|
|
453
348
|
definitionHash: cleanedData.definitionHash,
|
|
454
349
|
tableHashes: cleanedData.tableHashes,
|
|
455
350
|
},
|
|
@@ -462,11 +357,6 @@ async function handleUpdate(argv, prompter) {
|
|
|
462
357
|
description: true,
|
|
463
358
|
definition: true,
|
|
464
359
|
templateId: true,
|
|
465
|
-
status: true,
|
|
466
|
-
constructedAt: true,
|
|
467
|
-
errorDetails: true,
|
|
468
|
-
refMap: true,
|
|
469
|
-
constructedDefinition: true,
|
|
470
360
|
definitionHash: true,
|
|
471
361
|
tableHashes: true,
|
|
472
362
|
createdAt: true,
|
|
@@ -3,7 +3,7 @@ import { unflattenDotNotation, buildSelectFromPaths } from '../utils';
|
|
|
3
3
|
export default async (argv, prompter, _options) => {
|
|
4
4
|
try {
|
|
5
5
|
if (argv.help || argv.h) {
|
|
6
|
-
console.log('construct-blueprint - Executes a
|
|
6
|
+
console.log('construct-blueprint - Executes a blueprint definition by delegating to provision_* procedures. Creates a blueprint_construction record to track the attempt. Five phases: (1) provision_table() for each table with all nodes[], fields[], policies[], grants, and table-level indexes/fts/unique_constraints in a single call, (2) provision_relation() for each relation, (3) provision_index() for top-level indexes, (4) provision_full_text_search() for top-level FTS, (5) provision_unique_constraint() for top-level unique constraints. Tables are identified by table_name with optional per-table schema_name. Relations use $type for relation_type with source_table/target_table. Returns the construction record ID on success, NULL on failure.\n\nUsage: construct-blueprint [OPTIONS]\n');
|
|
7
7
|
process.exit(0);
|
|
8
8
|
}
|
|
9
9
|
const answers = await prompter.prompt(argv, [
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for mutation provisionFullTextSearch
|
|
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-full-text-search - Creates a full-text search configuration on a table. Accepts a jsonb definition with field (tsvector column name) and sources (array of {field, weight, lang}). Graceful: skips if FTS config already exists for the same (table_id, field_id). Returns the fts_id.\n\nUsage: provision-full-text-search [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
|
+
.provisionFullTextSearch(parsedAnswers, {
|
|
22
|
+
select: selectFields,
|
|
23
|
+
})
|
|
24
|
+
.execute();
|
|
25
|
+
console.log(JSON.stringify(result, null, 2));
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Failed: provisionFullTextSearch');
|
|
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 provisionIndex
|
|
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-index - Creates an index on a table. Accepts a jsonb definition with columns (array of names or single column string), access_method (default BTREE), is_unique, op_classes, options, and name (auto-generated if omitted). Graceful: skips if an index with the same (table_id, field_ids, access_method) already exists. Returns the index_id.\n\nUsage: provision-index [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
|
+
.provisionIndex(parsedAnswers, {
|
|
22
|
+
select: selectFields,
|
|
23
|
+
})
|
|
24
|
+
.execute();
|
|
25
|
+
console.log(JSON.stringify(result, null, 2));
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Failed: provisionIndex');
|
|
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 provisionRelation
|
|
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;
|