@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
|
@@ -17,11 +17,6 @@ const fieldSchema = {
|
|
|
17
17
|
description: 'string',
|
|
18
18
|
definition: 'json',
|
|
19
19
|
templateId: 'uuid',
|
|
20
|
-
status: 'string',
|
|
21
|
-
constructedAt: 'string',
|
|
22
|
-
errorDetails: 'string',
|
|
23
|
-
refMap: 'json',
|
|
24
|
-
constructedDefinition: 'json',
|
|
25
20
|
definitionHash: 'uuid',
|
|
26
21
|
tableHashes: 'json',
|
|
27
22
|
createdAt: 'string',
|
|
@@ -77,11 +72,6 @@ async function handleList(argv, _prompter) {
|
|
|
77
72
|
description: true,
|
|
78
73
|
definition: true,
|
|
79
74
|
templateId: true,
|
|
80
|
-
status: true,
|
|
81
|
-
constructedAt: true,
|
|
82
|
-
errorDetails: true,
|
|
83
|
-
refMap: true,
|
|
84
|
-
constructedDefinition: true,
|
|
85
75
|
definitionHash: true,
|
|
86
76
|
tableHashes: true,
|
|
87
77
|
createdAt: true,
|
|
@@ -111,11 +101,6 @@ async function handleFindFirst(argv, _prompter) {
|
|
|
111
101
|
description: true,
|
|
112
102
|
definition: true,
|
|
113
103
|
templateId: true,
|
|
114
|
-
status: true,
|
|
115
|
-
constructedAt: true,
|
|
116
|
-
errorDetails: true,
|
|
117
|
-
refMap: true,
|
|
118
|
-
constructedDefinition: true,
|
|
119
104
|
definitionHash: true,
|
|
120
105
|
tableHashes: true,
|
|
121
106
|
createdAt: true,
|
|
@@ -157,11 +142,6 @@ async function handleGet(argv, prompter) {
|
|
|
157
142
|
description: true,
|
|
158
143
|
definition: true,
|
|
159
144
|
templateId: true,
|
|
160
|
-
status: true,
|
|
161
|
-
constructedAt: true,
|
|
162
|
-
errorDetails: true,
|
|
163
|
-
refMap: true,
|
|
164
|
-
constructedDefinition: true,
|
|
165
145
|
definitionHash: true,
|
|
166
146
|
tableHashes: true,
|
|
167
147
|
createdAt: true,
|
|
@@ -226,41 +206,6 @@ async function handleCreate(argv, prompter) {
|
|
|
226
206
|
required: false,
|
|
227
207
|
skipPrompt: true,
|
|
228
208
|
},
|
|
229
|
-
{
|
|
230
|
-
type: 'text',
|
|
231
|
-
name: 'status',
|
|
232
|
-
message: 'status',
|
|
233
|
-
required: false,
|
|
234
|
-
skipPrompt: true,
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
type: 'text',
|
|
238
|
-
name: 'constructedAt',
|
|
239
|
-
message: 'constructedAt',
|
|
240
|
-
required: false,
|
|
241
|
-
skipPrompt: true,
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
type: 'text',
|
|
245
|
-
name: 'errorDetails',
|
|
246
|
-
message: 'errorDetails',
|
|
247
|
-
required: false,
|
|
248
|
-
skipPrompt: true,
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
type: 'json',
|
|
252
|
-
name: 'refMap',
|
|
253
|
-
message: 'refMap',
|
|
254
|
-
required: false,
|
|
255
|
-
skipPrompt: true,
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
type: 'json',
|
|
259
|
-
name: 'constructedDefinition',
|
|
260
|
-
message: 'constructedDefinition',
|
|
261
|
-
required: false,
|
|
262
|
-
skipPrompt: true,
|
|
263
|
-
},
|
|
264
209
|
{
|
|
265
210
|
type: 'text',
|
|
266
211
|
name: 'definitionHash',
|
|
@@ -289,11 +234,6 @@ async function handleCreate(argv, prompter) {
|
|
|
289
234
|
description: cleanedData.description,
|
|
290
235
|
definition: cleanedData.definition,
|
|
291
236
|
templateId: cleanedData.templateId,
|
|
292
|
-
status: cleanedData.status,
|
|
293
|
-
constructedAt: cleanedData.constructedAt,
|
|
294
|
-
errorDetails: cleanedData.errorDetails,
|
|
295
|
-
refMap: cleanedData.refMap,
|
|
296
|
-
constructedDefinition: cleanedData.constructedDefinition,
|
|
297
237
|
definitionHash: cleanedData.definitionHash,
|
|
298
238
|
tableHashes: cleanedData.tableHashes,
|
|
299
239
|
},
|
|
@@ -306,11 +246,6 @@ async function handleCreate(argv, prompter) {
|
|
|
306
246
|
description: true,
|
|
307
247
|
definition: true,
|
|
308
248
|
templateId: true,
|
|
309
|
-
status: true,
|
|
310
|
-
constructedAt: true,
|
|
311
|
-
errorDetails: true,
|
|
312
|
-
refMap: true,
|
|
313
|
-
constructedDefinition: true,
|
|
314
249
|
definitionHash: true,
|
|
315
250
|
tableHashes: true,
|
|
316
251
|
createdAt: true,
|
|
@@ -381,41 +316,6 @@ async function handleUpdate(argv, prompter) {
|
|
|
381
316
|
required: false,
|
|
382
317
|
skipPrompt: true,
|
|
383
318
|
},
|
|
384
|
-
{
|
|
385
|
-
type: 'text',
|
|
386
|
-
name: 'status',
|
|
387
|
-
message: 'status',
|
|
388
|
-
required: false,
|
|
389
|
-
skipPrompt: true,
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
type: 'text',
|
|
393
|
-
name: 'constructedAt',
|
|
394
|
-
message: 'constructedAt',
|
|
395
|
-
required: false,
|
|
396
|
-
skipPrompt: true,
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
type: 'text',
|
|
400
|
-
name: 'errorDetails',
|
|
401
|
-
message: 'errorDetails',
|
|
402
|
-
required: false,
|
|
403
|
-
skipPrompt: true,
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
type: 'json',
|
|
407
|
-
name: 'refMap',
|
|
408
|
-
message: 'refMap',
|
|
409
|
-
required: false,
|
|
410
|
-
skipPrompt: true,
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
type: 'json',
|
|
414
|
-
name: 'constructedDefinition',
|
|
415
|
-
message: 'constructedDefinition',
|
|
416
|
-
required: false,
|
|
417
|
-
skipPrompt: true,
|
|
418
|
-
},
|
|
419
319
|
{
|
|
420
320
|
type: 'text',
|
|
421
321
|
name: 'definitionHash',
|
|
@@ -447,11 +347,6 @@ async function handleUpdate(argv, prompter) {
|
|
|
447
347
|
description: cleanedData.description,
|
|
448
348
|
definition: cleanedData.definition,
|
|
449
349
|
templateId: cleanedData.templateId,
|
|
450
|
-
status: cleanedData.status,
|
|
451
|
-
constructedAt: cleanedData.constructedAt,
|
|
452
|
-
errorDetails: cleanedData.errorDetails,
|
|
453
|
-
refMap: cleanedData.refMap,
|
|
454
|
-
constructedDefinition: cleanedData.constructedDefinition,
|
|
455
350
|
definitionHash: cleanedData.definitionHash,
|
|
456
351
|
tableHashes: cleanedData.tableHashes,
|
|
457
352
|
},
|
|
@@ -464,11 +359,6 @@ async function handleUpdate(argv, prompter) {
|
|
|
464
359
|
description: true,
|
|
465
360
|
definition: true,
|
|
466
361
|
templateId: true,
|
|
467
|
-
status: true,
|
|
468
|
-
constructedAt: true,
|
|
469
|
-
errorDetails: true,
|
|
470
|
-
refMap: true,
|
|
471
|
-
constructedDefinition: true,
|
|
472
362
|
definitionHash: true,
|
|
473
363
|
tableHashes: true,
|
|
474
364
|
createdAt: true,
|
|
@@ -5,7 +5,7 @@ const utils_1 = require("../utils");
|
|
|
5
5
|
exports.default = async (argv, prompter, _options) => {
|
|
6
6
|
try {
|
|
7
7
|
if (argv.help || argv.h) {
|
|
8
|
-
console.log('construct-blueprint - Executes a
|
|
8
|
+
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');
|
|
9
9
|
process.exit(0);
|
|
10
10
|
}
|
|
11
11
|
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,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const executor_1 = require("../executor");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
exports.default = async (argv, prompter, _options) => {
|
|
6
|
+
try {
|
|
7
|
+
if (argv.help || argv.h) {
|
|
8
|
+
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');
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
const answers = await prompter.prompt(argv, [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
name: 'input',
|
|
15
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
const client = (0, executor_1.getClient)();
|
|
20
|
+
const parsedAnswers = (0, utils_1.unflattenDotNotation)(answers);
|
|
21
|
+
const selectFields = (0, utils_1.buildSelectFromPaths)(argv.select ?? 'clientMutationId');
|
|
22
|
+
const result = await client.mutation
|
|
23
|
+
.provisionFullTextSearch(parsedAnswers, {
|
|
24
|
+
select: selectFields,
|
|
25
|
+
})
|
|
26
|
+
.execute();
|
|
27
|
+
console.log(JSON.stringify(result, null, 2));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('Failed: provisionFullTextSearch');
|
|
31
|
+
if (error instanceof Error) {
|
|
32
|
+
console.error(error.message);
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -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,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const executor_1 = require("../executor");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
exports.default = async (argv, prompter, _options) => {
|
|
6
|
+
try {
|
|
7
|
+
if (argv.help || argv.h) {
|
|
8
|
+
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');
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
const answers = await prompter.prompt(argv, [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
name: 'input',
|
|
15
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
const client = (0, executor_1.getClient)();
|
|
20
|
+
const parsedAnswers = (0, utils_1.unflattenDotNotation)(answers);
|
|
21
|
+
const selectFields = (0, utils_1.buildSelectFromPaths)(argv.select ?? 'clientMutationId');
|
|
22
|
+
const result = await client.mutation
|
|
23
|
+
.provisionIndex(parsedAnswers, {
|
|
24
|
+
select: selectFields,
|
|
25
|
+
})
|
|
26
|
+
.execute();
|
|
27
|
+
console.log(JSON.stringify(result, null, 2));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('Failed: provisionIndex');
|
|
31
|
+
if (error instanceof Error) {
|
|
32
|
+
console.error(error.message);
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -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;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const executor_1 = require("../executor");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
exports.default = async (argv, prompter, _options) => {
|
|
6
|
+
try {
|
|
7
|
+
if (argv.help || argv.h) {
|
|
8
|
+
console.log('provision-relation - Composable relation provisioning: creates FK fields, indexes, unique constraints, and junction tables depending on the relation_type. Supports RelationBelongsTo, RelationHasOne, RelationHasMany, and RelationManyToMany. ManyToMany uses provision_table() internally for junction table creation with full node/grant/policy support. All operations are graceful (skip existing). Returns (out_field_id, out_junction_table_id, out_source_field_id, out_target_field_id).\n\nUsage: provision-relation [OPTIONS]\n');
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
const answers = await prompter.prompt(argv, [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
name: 'input',
|
|
15
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
const client = (0, executor_1.getClient)();
|
|
20
|
+
const parsedAnswers = (0, utils_1.unflattenDotNotation)(answers);
|
|
21
|
+
const selectFields = (0, utils_1.buildSelectFromPaths)(argv.select ?? 'clientMutationId');
|
|
22
|
+
const result = await client.mutation
|
|
23
|
+
.provisionRelation(parsedAnswers, {
|
|
24
|
+
select: selectFields,
|
|
25
|
+
})
|
|
26
|
+
.execute();
|
|
27
|
+
console.log(JSON.stringify(result, null, 2));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('Failed: provisionRelation');
|
|
31
|
+
if (error instanceof Error) {
|
|
32
|
+
console.error(error.message);
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for mutation provisionTable
|
|
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,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const executor_1 = require("../executor");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
exports.default = async (argv, prompter, _options) => {
|
|
6
|
+
try {
|
|
7
|
+
if (argv.help || argv.h) {
|
|
8
|
+
console.log('provision-table - Composable table provisioning: creates or finds a table, then applies N nodes (Data* modules), creates fields, enables RLS, creates grants, creates N policies, and optionally creates table-level indexes/full_text_searches/unique_constraints. All operations are graceful (skip existing). Accepts multiple nodes and multiple policies per call, unlike secure_table_provision which is limited to one of each. Returns (out_table_id, out_fields).\n\nUsage: provision-table [OPTIONS]\n');
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
const answers = await prompter.prompt(argv, [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
name: 'input',
|
|
15
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
const client = (0, executor_1.getClient)();
|
|
20
|
+
const parsedAnswers = (0, utils_1.unflattenDotNotation)(answers);
|
|
21
|
+
const selectFields = (0, utils_1.buildSelectFromPaths)(argv.select ?? 'clientMutationId');
|
|
22
|
+
const result = await client.mutation
|
|
23
|
+
.provisionTable(parsedAnswers, {
|
|
24
|
+
select: selectFields,
|
|
25
|
+
})
|
|
26
|
+
.execute();
|
|
27
|
+
console.log(JSON.stringify(result, null, 2));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('Failed: provisionTable');
|
|
31
|
+
if (error instanceof Error) {
|
|
32
|
+
console.error(error.message);
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for mutation provisionUniqueConstraint
|
|
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,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const executor_1 = require("../executor");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
exports.default = async (argv, prompter, _options) => {
|
|
6
|
+
try {
|
|
7
|
+
if (argv.help || argv.h) {
|
|
8
|
+
console.log('provision-unique-constraint - Creates a unique constraint on a table. Accepts a jsonb definition with columns (array of field names). Graceful: skips if the exact same unique constraint already exists.\n\nUsage: provision-unique-constraint [OPTIONS]\n');
|
|
9
|
+
process.exit(0);
|
|
10
|
+
}
|
|
11
|
+
const answers = await prompter.prompt(argv, [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
name: 'input',
|
|
15
|
+
message: 'The exclusive input argument for this mutation. An object type, make sure to see documentation for this object\u2019s fields.',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
const client = (0, executor_1.getClient)();
|
|
20
|
+
const parsedAnswers = (0, utils_1.unflattenDotNotation)(answers);
|
|
21
|
+
const selectFields = (0, utils_1.buildSelectFromPaths)(argv.select ?? 'clientMutationId');
|
|
22
|
+
const result = await client.mutation
|
|
23
|
+
.provisionUniqueConstraint(parsedAnswers, {
|
|
24
|
+
select: selectFields,
|
|
25
|
+
})
|
|
26
|
+
.execute();
|
|
27
|
+
console.log(JSON.stringify(result, null, 2));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('Failed: provisionUniqueConstraint');
|
|
31
|
+
if (error instanceof Error) {
|
|
32
|
+
console.error(error.message);
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -26,8 +26,7 @@ const fieldSchema = {
|
|
|
26
26
|
useCompositeKey: 'boolean',
|
|
27
27
|
createIndex: 'boolean',
|
|
28
28
|
exposeInApi: 'boolean',
|
|
29
|
-
|
|
30
|
-
nodeData: 'json',
|
|
29
|
+
nodes: 'json',
|
|
31
30
|
grantRoles: 'string',
|
|
32
31
|
grantPrivileges: 'json',
|
|
33
32
|
policyType: 'string',
|
|
@@ -100,8 +99,7 @@ async function handleList(argv, _prompter) {
|
|
|
100
99
|
useCompositeKey: true,
|
|
101
100
|
createIndex: true,
|
|
102
101
|
exposeInApi: true,
|
|
103
|
-
|
|
104
|
-
nodeData: true,
|
|
102
|
+
nodes: true,
|
|
105
103
|
grantRoles: true,
|
|
106
104
|
grantPrivileges: true,
|
|
107
105
|
policyType: true,
|
|
@@ -148,8 +146,7 @@ async function handleFindFirst(argv, _prompter) {
|
|
|
148
146
|
useCompositeKey: true,
|
|
149
147
|
createIndex: true,
|
|
150
148
|
exposeInApi: true,
|
|
151
|
-
|
|
152
|
-
nodeData: true,
|
|
149
|
+
nodes: true,
|
|
153
150
|
grantRoles: true,
|
|
154
151
|
grantPrivileges: true,
|
|
155
152
|
policyType: true,
|
|
@@ -208,8 +205,7 @@ async function handleGet(argv, prompter) {
|
|
|
208
205
|
useCompositeKey: true,
|
|
209
206
|
createIndex: true,
|
|
210
207
|
exposeInApi: true,
|
|
211
|
-
|
|
212
|
-
nodeData: true,
|
|
208
|
+
nodes: true,
|
|
213
209
|
grantRoles: true,
|
|
214
210
|
grantPrivileges: true,
|
|
215
211
|
policyType: true,
|
|
@@ -346,17 +342,10 @@ async function handleCreate(argv, prompter) {
|
|
|
346
342
|
required: false,
|
|
347
343
|
skipPrompt: true,
|
|
348
344
|
},
|
|
349
|
-
{
|
|
350
|
-
type: 'text',
|
|
351
|
-
name: 'nodeType',
|
|
352
|
-
message: 'nodeType',
|
|
353
|
-
required: false,
|
|
354
|
-
skipPrompt: true,
|
|
355
|
-
},
|
|
356
345
|
{
|
|
357
346
|
type: 'json',
|
|
358
|
-
name: '
|
|
359
|
-
message: '
|
|
347
|
+
name: 'nodes',
|
|
348
|
+
message: 'nodes',
|
|
360
349
|
required: false,
|
|
361
350
|
skipPrompt: true,
|
|
362
351
|
},
|
|
@@ -467,8 +456,7 @@ async function handleCreate(argv, prompter) {
|
|
|
467
456
|
useCompositeKey: cleanedData.useCompositeKey,
|
|
468
457
|
createIndex: cleanedData.createIndex,
|
|
469
458
|
exposeInApi: cleanedData.exposeInApi,
|
|
470
|
-
|
|
471
|
-
nodeData: cleanedData.nodeData,
|
|
459
|
+
nodes: cleanedData.nodes,
|
|
472
460
|
grantRoles: cleanedData.grantRoles,
|
|
473
461
|
grantPrivileges: cleanedData.grantPrivileges,
|
|
474
462
|
policyType: cleanedData.policyType,
|
|
@@ -500,8 +488,7 @@ async function handleCreate(argv, prompter) {
|
|
|
500
488
|
useCompositeKey: true,
|
|
501
489
|
createIndex: true,
|
|
502
490
|
exposeInApi: true,
|
|
503
|
-
|
|
504
|
-
nodeData: true,
|
|
491
|
+
nodes: true,
|
|
505
492
|
grantRoles: true,
|
|
506
493
|
grantPrivileges: true,
|
|
507
494
|
policyType: true,
|
|
@@ -644,17 +631,10 @@ async function handleUpdate(argv, prompter) {
|
|
|
644
631
|
required: false,
|
|
645
632
|
skipPrompt: true,
|
|
646
633
|
},
|
|
647
|
-
{
|
|
648
|
-
type: 'text',
|
|
649
|
-
name: 'nodeType',
|
|
650
|
-
message: 'nodeType',
|
|
651
|
-
required: false,
|
|
652
|
-
skipPrompt: true,
|
|
653
|
-
},
|
|
654
634
|
{
|
|
655
635
|
type: 'json',
|
|
656
|
-
name: '
|
|
657
|
-
message: '
|
|
636
|
+
name: 'nodes',
|
|
637
|
+
message: 'nodes',
|
|
658
638
|
required: false,
|
|
659
639
|
skipPrompt: true,
|
|
660
640
|
},
|
|
@@ -768,8 +748,7 @@ async function handleUpdate(argv, prompter) {
|
|
|
768
748
|
useCompositeKey: cleanedData.useCompositeKey,
|
|
769
749
|
createIndex: cleanedData.createIndex,
|
|
770
750
|
exposeInApi: cleanedData.exposeInApi,
|
|
771
|
-
|
|
772
|
-
nodeData: cleanedData.nodeData,
|
|
751
|
+
nodes: cleanedData.nodes,
|
|
773
752
|
grantRoles: cleanedData.grantRoles,
|
|
774
753
|
grantPrivileges: cleanedData.grantPrivileges,
|
|
775
754
|
policyType: cleanedData.policyType,
|
|
@@ -801,8 +780,7 @@ async function handleUpdate(argv, prompter) {
|
|
|
801
780
|
useCompositeKey: true,
|
|
802
781
|
createIndex: true,
|
|
803
782
|
exposeInApi: true,
|
|
804
|
-
|
|
805
|
-
nodeData: true,
|
|
783
|
+
nodes: true,
|
|
806
784
|
grantRoles: true,
|
|
807
785
|
grantPrivileges: true,
|
|
808
786
|
policyType: true,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command for query resolveBlueprintTable
|
|
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,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const executor_1 = require("../executor");
|
|
4
|
+
exports.default = async (argv, prompter, _options) => {
|
|
5
|
+
try {
|
|
6
|
+
if (argv.help || argv.h) {
|
|
7
|
+
console.log('resolve-blueprint-table - Resolves a table_name (with optional schema_name) to a table_id. Resolution order: (1) if schema_name provided, exact lookup via metaschema_public.schema.name + metaschema_public.table; (2) check local table_map (tables created in current blueprint); (3) search metaschema_public.table by name across all schemas; (4) if multiple matches, throw ambiguous error asking for schema_name; (5) if no match, throw not-found error.\n\nUsage: resolve-blueprint-table [OPTIONS]\n');
|
|
8
|
+
process.exit(0);
|
|
9
|
+
}
|
|
10
|
+
const answers = await prompter.prompt(argv, [
|
|
11
|
+
{
|
|
12
|
+
type: 'text',
|
|
13
|
+
name: 'databaseId',
|
|
14
|
+
message: 'databaseId',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'text',
|
|
18
|
+
name: 'tableName',
|
|
19
|
+
message: 'tableName',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'text',
|
|
23
|
+
name: 'schemaName',
|
|
24
|
+
message: 'schemaName',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
name: 'tableMap',
|
|
29
|
+
message: 'tableMap',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'text',
|
|
33
|
+
name: 'defaultSchemaId',
|
|
34
|
+
message: 'defaultSchemaId',
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
const client = (0, executor_1.getClient)();
|
|
38
|
+
const result = await client.query
|
|
39
|
+
.resolveBlueprintTable(answers)
|
|
40
|
+
.execute();
|
|
41
|
+
console.log(JSON.stringify(result, null, 2));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Failed: resolveBlueprintTable');
|
|
45
|
+
if (error instanceof Error) {
|
|
46
|
+
console.error(error.message);
|
|
47
|
+
}
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
};
|