@constructive-sdk/cli 0.12.15 → 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 +3 -3
  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
@@ -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-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');
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
+ .provisionRelation(parsedAnswers, {
22
+ select: selectFields,
23
+ })
24
+ .execute();
25
+ console.log(JSON.stringify(result, null, 2));
26
+ }
27
+ catch (error) {
28
+ console.error('Failed: provisionRelation');
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 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,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-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');
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
+ .provisionTable(parsedAnswers, {
22
+ select: selectFields,
23
+ })
24
+ .execute();
25
+ console.log(JSON.stringify(result, null, 2));
26
+ }
27
+ catch (error) {
28
+ console.error('Failed: provisionTable');
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 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,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-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');
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
+ .provisionUniqueConstraint(parsedAnswers, {
22
+ select: selectFields,
23
+ })
24
+ .execute();
25
+ console.log(JSON.stringify(result, null, 2));
26
+ }
27
+ catch (error) {
28
+ console.error('Failed: provisionUniqueConstraint');
29
+ if (error instanceof Error) {
30
+ console.error(error.message);
31
+ }
32
+ process.exit(1);
33
+ }
34
+ };
@@ -24,8 +24,7 @@ const fieldSchema = {
24
24
  useCompositeKey: 'boolean',
25
25
  createIndex: 'boolean',
26
26
  exposeInApi: 'boolean',
27
- nodeType: 'string',
28
- nodeData: 'json',
27
+ nodes: 'json',
29
28
  grantRoles: 'string',
30
29
  grantPrivileges: 'json',
31
30
  policyType: 'string',
@@ -98,8 +97,7 @@ async function handleList(argv, _prompter) {
98
97
  useCompositeKey: true,
99
98
  createIndex: true,
100
99
  exposeInApi: true,
101
- nodeType: true,
102
- nodeData: true,
100
+ nodes: true,
103
101
  grantRoles: true,
104
102
  grantPrivileges: true,
105
103
  policyType: true,
@@ -146,8 +144,7 @@ async function handleFindFirst(argv, _prompter) {
146
144
  useCompositeKey: true,
147
145
  createIndex: true,
148
146
  exposeInApi: true,
149
- nodeType: true,
150
- nodeData: true,
147
+ nodes: true,
151
148
  grantRoles: true,
152
149
  grantPrivileges: true,
153
150
  policyType: true,
@@ -206,8 +203,7 @@ async function handleGet(argv, prompter) {
206
203
  useCompositeKey: true,
207
204
  createIndex: true,
208
205
  exposeInApi: true,
209
- nodeType: true,
210
- nodeData: true,
206
+ nodes: true,
211
207
  grantRoles: true,
212
208
  grantPrivileges: true,
213
209
  policyType: true,
@@ -344,17 +340,10 @@ async function handleCreate(argv, prompter) {
344
340
  required: false,
345
341
  skipPrompt: true,
346
342
  },
347
- {
348
- type: 'text',
349
- name: 'nodeType',
350
- message: 'nodeType',
351
- required: false,
352
- skipPrompt: true,
353
- },
354
343
  {
355
344
  type: 'json',
356
- name: 'nodeData',
357
- message: 'nodeData',
345
+ name: 'nodes',
346
+ message: 'nodes',
358
347
  required: false,
359
348
  skipPrompt: true,
360
349
  },
@@ -465,8 +454,7 @@ async function handleCreate(argv, prompter) {
465
454
  useCompositeKey: cleanedData.useCompositeKey,
466
455
  createIndex: cleanedData.createIndex,
467
456
  exposeInApi: cleanedData.exposeInApi,
468
- nodeType: cleanedData.nodeType,
469
- nodeData: cleanedData.nodeData,
457
+ nodes: cleanedData.nodes,
470
458
  grantRoles: cleanedData.grantRoles,
471
459
  grantPrivileges: cleanedData.grantPrivileges,
472
460
  policyType: cleanedData.policyType,
@@ -498,8 +486,7 @@ async function handleCreate(argv, prompter) {
498
486
  useCompositeKey: true,
499
487
  createIndex: true,
500
488
  exposeInApi: true,
501
- nodeType: true,
502
- nodeData: true,
489
+ nodes: true,
503
490
  grantRoles: true,
504
491
  grantPrivileges: true,
505
492
  policyType: true,
@@ -642,17 +629,10 @@ async function handleUpdate(argv, prompter) {
642
629
  required: false,
643
630
  skipPrompt: true,
644
631
  },
645
- {
646
- type: 'text',
647
- name: 'nodeType',
648
- message: 'nodeType',
649
- required: false,
650
- skipPrompt: true,
651
- },
652
632
  {
653
633
  type: 'json',
654
- name: 'nodeData',
655
- message: 'nodeData',
634
+ name: 'nodes',
635
+ message: 'nodes',
656
636
  required: false,
657
637
  skipPrompt: true,
658
638
  },
@@ -766,8 +746,7 @@ async function handleUpdate(argv, prompter) {
766
746
  useCompositeKey: cleanedData.useCompositeKey,
767
747
  createIndex: cleanedData.createIndex,
768
748
  exposeInApi: cleanedData.exposeInApi,
769
- nodeType: cleanedData.nodeType,
770
- nodeData: cleanedData.nodeData,
749
+ nodes: cleanedData.nodes,
771
750
  grantRoles: cleanedData.grantRoles,
772
751
  grantPrivileges: cleanedData.grantPrivileges,
773
752
  policyType: cleanedData.policyType,
@@ -799,8 +778,7 @@ async function handleUpdate(argv, prompter) {
799
778
  useCompositeKey: true,
800
779
  createIndex: true,
801
780
  exposeInApi: true,
802
- nodeType: true,
803
- nodeData: true,
781
+ nodes: true,
804
782
  grantRoles: true,
805
783
  grantPrivileges: true,
806
784
  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,48 @@
1
+ import { getClient } from '../executor';
2
+ export default async (argv, prompter, _options) => {
3
+ try {
4
+ if (argv.help || argv.h) {
5
+ 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');
6
+ process.exit(0);
7
+ }
8
+ const answers = await prompter.prompt(argv, [
9
+ {
10
+ type: 'text',
11
+ name: 'databaseId',
12
+ message: 'databaseId',
13
+ },
14
+ {
15
+ type: 'text',
16
+ name: 'tableName',
17
+ message: 'tableName',
18
+ },
19
+ {
20
+ type: 'text',
21
+ name: 'schemaName',
22
+ message: 'schemaName',
23
+ },
24
+ {
25
+ type: 'text',
26
+ name: 'tableMap',
27
+ message: 'tableMap',
28
+ },
29
+ {
30
+ type: 'text',
31
+ name: 'defaultSchemaId',
32
+ message: 'defaultSchemaId',
33
+ },
34
+ ]);
35
+ const client = getClient();
36
+ const result = await client.query
37
+ .resolveBlueprintTable(answers)
38
+ .execute();
39
+ console.log(JSON.stringify(result, null, 2));
40
+ }
41
+ catch (error) {
42
+ console.error('Failed: resolveBlueprintTable');
43
+ if (error instanceof Error) {
44
+ console.error(error.message);
45
+ }
46
+ process.exit(1);
47
+ }
48
+ };
@@ -12,9 +12,8 @@ const fieldSchema = {
12
12
  schemaId: 'uuid',
13
13
  tableId: 'uuid',
14
14
  tableName: 'string',
15
- nodeType: 'string',
15
+ nodes: 'json',
16
16
  useRls: 'boolean',
17
- nodeData: 'json',
18
17
  fields: 'json',
19
18
  grantRoles: 'string',
20
19
  grantPrivileges: 'json',
@@ -73,9 +72,8 @@ async function handleList(argv, _prompter) {
73
72
  schemaId: true,
74
73
  tableId: true,
75
74
  tableName: true,
76
- nodeType: true,
75
+ nodes: true,
77
76
  useRls: true,
78
- nodeData: true,
79
77
  fields: true,
80
78
  grantRoles: true,
81
79
  grantPrivileges: true,
@@ -108,9 +106,8 @@ async function handleFindFirst(argv, _prompter) {
108
106
  schemaId: true,
109
107
  tableId: true,
110
108
  tableName: true,
111
- nodeType: true,
109
+ nodes: true,
112
110
  useRls: true,
113
- nodeData: true,
114
111
  fields: true,
115
112
  grantRoles: true,
116
113
  grantPrivileges: true,
@@ -155,9 +152,8 @@ async function handleGet(argv, prompter) {
155
152
  schemaId: true,
156
153
  tableId: true,
157
154
  tableName: true,
158
- nodeType: true,
155
+ nodes: true,
159
156
  useRls: true,
160
- nodeData: true,
161
157
  fields: true,
162
158
  grantRoles: true,
163
159
  grantPrivileges: true,
@@ -212,9 +208,9 @@ async function handleCreate(argv, prompter) {
212
208
  skipPrompt: true,
213
209
  },
214
210
  {
215
- type: 'text',
216
- name: 'nodeType',
217
- message: 'nodeType',
211
+ type: 'json',
212
+ name: 'nodes',
213
+ message: 'nodes',
218
214
  required: false,
219
215
  skipPrompt: true,
220
216
  },
@@ -225,13 +221,6 @@ async function handleCreate(argv, prompter) {
225
221
  required: false,
226
222
  skipPrompt: true,
227
223
  },
228
- {
229
- type: 'json',
230
- name: 'nodeData',
231
- message: 'nodeData',
232
- required: false,
233
- skipPrompt: true,
234
- },
235
224
  {
236
225
  type: 'json',
237
226
  name: 'fields',
@@ -313,9 +302,8 @@ async function handleCreate(argv, prompter) {
313
302
  schemaId: cleanedData.schemaId,
314
303
  tableId: cleanedData.tableId,
315
304
  tableName: cleanedData.tableName,
316
- nodeType: cleanedData.nodeType,
305
+ nodes: cleanedData.nodes,
317
306
  useRls: cleanedData.useRls,
318
- nodeData: cleanedData.nodeData,
319
307
  fields: cleanedData.fields,
320
308
  grantRoles: cleanedData.grantRoles,
321
309
  grantPrivileges: cleanedData.grantPrivileges,
@@ -333,9 +321,8 @@ async function handleCreate(argv, prompter) {
333
321
  schemaId: true,
334
322
  tableId: true,
335
323
  tableName: true,
336
- nodeType: true,
324
+ nodes: true,
337
325
  useRls: true,
338
- nodeData: true,
339
326
  fields: true,
340
327
  grantRoles: true,
341
328
  grantPrivileges: true,
@@ -396,9 +383,9 @@ async function handleUpdate(argv, prompter) {
396
383
  skipPrompt: true,
397
384
  },
398
385
  {
399
- type: 'text',
400
- name: 'nodeType',
401
- message: 'nodeType',
386
+ type: 'json',
387
+ name: 'nodes',
388
+ message: 'nodes',
402
389
  required: false,
403
390
  skipPrompt: true,
404
391
  },
@@ -409,13 +396,6 @@ async function handleUpdate(argv, prompter) {
409
396
  required: false,
410
397
  skipPrompt: true,
411
398
  },
412
- {
413
- type: 'json',
414
- name: 'nodeData',
415
- message: 'nodeData',
416
- required: false,
417
- skipPrompt: true,
418
- },
419
399
  {
420
400
  type: 'json',
421
401
  name: 'fields',
@@ -500,9 +480,8 @@ async function handleUpdate(argv, prompter) {
500
480
  schemaId: cleanedData.schemaId,
501
481
  tableId: cleanedData.tableId,
502
482
  tableName: cleanedData.tableName,
503
- nodeType: cleanedData.nodeType,
483
+ nodes: cleanedData.nodes,
504
484
  useRls: cleanedData.useRls,
505
- nodeData: cleanedData.nodeData,
506
485
  fields: cleanedData.fields,
507
486
  grantRoles: cleanedData.grantRoles,
508
487
  grantPrivileges: cleanedData.grantPrivileges,
@@ -520,9 +499,8 @@ async function handleUpdate(argv, prompter) {
520
499
  schemaId: true,
521
500
  tableId: true,
522
501
  tableName: true,
523
- nodeType: true,
502
+ nodes: true,
524
503
  useRls: true,
525
- nodeData: true,
526
504
  fields: true,
527
505
  grantRoles: true,
528
506
  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;