@constructive-sdk/cli 0.9.2 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/admin/cli/commands/app-level-requirement.js +0 -2
- package/admin/cli/commands/app-level.js +0 -2
- package/admin/cli/commands/app-permission.js +0 -2
- package/admin/cli/commands/invite.js +0 -2
- package/admin/cli/commands/membership-type.js +0 -3
- package/admin/cli/commands/org-chart-edge-grant.js +3 -3
- package/admin/cli/commands/org-chart-edge.js +0 -2
- package/admin/cli/commands/org-invite.js +0 -2
- package/admin/cli/commands/org-permission.js +0 -2
- package/admin/orm/input-types.d.ts +33 -127
- package/auth/cli/commands/audit-log.js +0 -2
- package/auth/cli/commands/connected-account.js +0 -3
- package/auth/cli/commands/crypto-address.js +0 -2
- package/auth/cli/commands/phone-number.js +0 -3
- package/auth/cli/commands.js +7 -7
- package/auth/cli/executor.d.ts +3 -3
- package/auth/orm/index.d.ts +6 -6
- package/auth/orm/index.js +6 -6
- package/auth/orm/input-types.d.ts +279 -327
- package/auth/orm/input-types.js +9 -1
- package/auth/orm/models/index.d.ts +3 -3
- package/auth/orm/models/index.js +7 -7
- package/esm/admin/cli/commands/app-level-requirement.js +0 -2
- package/esm/admin/cli/commands/app-level.js +0 -2
- package/esm/admin/cli/commands/app-permission.js +0 -2
- package/esm/admin/cli/commands/invite.js +0 -2
- package/esm/admin/cli/commands/membership-type.js +0 -3
- package/esm/admin/cli/commands/org-chart-edge-grant.js +3 -3
- package/esm/admin/cli/commands/org-chart-edge.js +0 -2
- package/esm/admin/cli/commands/org-invite.js +0 -2
- package/esm/admin/cli/commands/org-permission.js +0 -2
- package/esm/admin/orm/input-types.d.ts +33 -127
- package/esm/auth/cli/commands/audit-log.js +0 -2
- package/esm/auth/cli/commands/connected-account.js +0 -3
- package/esm/auth/cli/commands/crypto-address.js +0 -2
- package/esm/auth/cli/commands/phone-number.js +0 -3
- package/esm/auth/cli/commands.js +7 -7
- package/esm/auth/cli/executor.d.ts +3 -3
- package/esm/auth/orm/index.d.ts +6 -6
- package/esm/auth/orm/index.js +6 -6
- package/esm/auth/orm/input-types.d.ts +279 -327
- package/esm/auth/orm/input-types.js +9 -1
- package/esm/auth/orm/models/index.d.ts +3 -3
- package/esm/auth/orm/models/index.js +3 -3
- package/esm/index.d.ts +3 -3
- package/esm/index.js +3 -3
- package/esm/objects/cli/commands/commit.js +0 -2
- package/esm/objects/cli/commands/ref.js +0 -2
- package/esm/objects/cli/commands/store.js +0 -2
- package/esm/objects/orm/input-types.d.ts +17 -48
- package/esm/public/cli/commands/accept-database-transfer.d.ts +8 -0
- package/esm/public/cli/commands/accept-database-transfer.js +34 -0
- package/esm/public/cli/commands/api-module.js +0 -2
- package/esm/public/cli/commands/api.js +0 -5
- package/esm/public/cli/commands/app-level-requirement.js +0 -2
- package/esm/public/cli/commands/app-level.js +0 -2
- package/esm/public/cli/commands/app-permission.js +0 -2
- package/esm/public/cli/commands/app.js +0 -4
- package/esm/public/cli/commands/ast-migration.js +0 -2
- package/esm/public/cli/commands/audit-log.js +0 -2
- package/esm/public/cli/commands/blueprint-template.d.ts +8 -0
- package/esm/public/cli/commands/blueprint-template.js +549 -0
- package/esm/public/cli/commands/{uuid-module.d.ts → blueprint.d.ts} +1 -1
- package/esm/public/cli/commands/blueprint.js +484 -0
- package/esm/public/cli/commands/cancel-database-transfer.d.ts +8 -0
- package/esm/public/cli/commands/cancel-database-transfer.js +34 -0
- package/esm/public/cli/commands/check-constraint.js +0 -4
- package/esm/public/cli/commands/commit.js +0 -2
- package/esm/public/cli/commands/connected-account.js +0 -3
- package/esm/public/cli/commands/connected-accounts-module.js +0 -2
- package/esm/public/cli/commands/construct-blueprint.d.ts +8 -0
- package/esm/public/cli/commands/construct-blueprint.js +34 -0
- package/esm/public/cli/commands/copy-template-to-blueprint.d.ts +8 -0
- package/esm/public/cli/commands/copy-template-to-blueprint.js +34 -0
- package/esm/public/cli/commands/crypto-address.js +0 -2
- package/esm/public/cli/commands/crypto-addresses-module.js +0 -3
- package/esm/public/cli/commands/crypto-auth-module.js +0 -7
- package/esm/public/cli/commands/database-provision-module.js +0 -6
- package/esm/public/cli/commands/database-transfer.d.ts +8 -0
- package/esm/public/cli/commands/database-transfer.js +425 -0
- package/esm/public/cli/commands/database.js +0 -4
- package/esm/public/cli/commands/default-privilege.js +0 -4
- package/esm/public/cli/commands/denormalized-table-field.js +0 -2
- package/esm/public/cli/commands/emails-module.js +0 -2
- package/esm/public/cli/commands/embedding-chunk.d.ts +8 -0
- package/esm/public/cli/commands/embedding-chunk.js +513 -0
- package/esm/public/cli/commands/encrypted-secrets-module.js +0 -2
- package/{public/cli/commands/uuid-module.d.ts → esm/public/cli/commands/enum.d.ts} +1 -1
- package/esm/public/cli/commands/{uuid-module.js → enum.js} +175 -33
- package/esm/public/cli/commands/field-module.js +0 -2
- package/esm/public/cli/commands/field.js +21 -7
- package/esm/public/cli/commands/foreign-key-constraint.js +0 -7
- package/esm/public/cli/commands/hierarchy-module.js +0 -11
- package/esm/public/cli/commands/index.js +0 -4
- package/esm/public/cli/commands/invite.js +0 -2
- package/esm/public/cli/commands/invites-module.js +0 -5
- package/esm/public/cli/commands/levels-module.js +0 -16
- package/esm/public/cli/commands/limits-module.js +0 -10
- package/esm/public/cli/commands/membership-type.js +0 -3
- package/esm/public/cli/commands/membership-types-module.js +0 -2
- package/esm/public/cli/commands/memberships-module.js +0 -13
- package/esm/public/cli/commands/node-type-registry.js +0 -6
- package/esm/public/cli/commands/org-chart-edge-grant.js +3 -3
- package/esm/public/cli/commands/org-chart-edge.js +0 -2
- package/esm/public/cli/commands/org-invite.js +0 -2
- package/esm/public/cli/commands/org-permission.js +0 -2
- package/esm/public/cli/commands/permissions-module.js +0 -8
- package/esm/public/cli/commands/phone-number.js +0 -3
- package/esm/public/cli/commands/phone-numbers-module.js +0 -2
- package/esm/public/cli/commands/policy.js +0 -6
- package/esm/public/cli/commands/primary-key-constraint.js +0 -4
- package/esm/public/cli/commands/profiles-module.js +0 -6
- package/esm/public/cli/commands/ref.js +0 -2
- package/esm/public/cli/commands/reject-database-transfer.d.ts +8 -0
- package/esm/public/cli/commands/reject-database-transfer.js +34 -0
- package/esm/public/cli/commands/relation-provision.js +63 -11
- package/esm/public/cli/commands/rls-module.js +0 -5
- package/esm/public/cli/commands/schema-grant.js +0 -2
- package/esm/public/cli/commands/schema.js +0 -6
- package/esm/public/cli/commands/secrets-module.js +0 -2
- package/esm/public/cli/commands/secure-table-provision.js +0 -6
- package/esm/public/cli/commands/sessions-module.js +0 -4
- package/esm/public/cli/commands/site-metadatum.js +0 -3
- package/esm/public/cli/commands/site-module.js +0 -2
- package/esm/public/cli/commands/site.js +0 -4
- package/esm/public/cli/commands/sql-migration.js +0 -7
- package/esm/public/cli/commands/store.js +0 -2
- package/esm/public/cli/commands/table-grant.js +0 -3
- package/esm/public/cli/commands/table-template-module.js +0 -3
- package/esm/public/cli/commands/table.js +0 -7
- package/esm/public/cli/commands/trigger-function.js +0 -3
- package/esm/public/cli/commands/trigger.js +0 -5
- package/esm/public/cli/commands/unique-constraint.js +0 -5
- package/esm/public/cli/commands/user-auth-module.js +0 -17
- package/esm/public/cli/commands/users-module.js +0 -3
- package/esm/public/cli/commands/view-grant.js +0 -3
- package/esm/public/cli/commands/view-rule.js +0 -4
- package/esm/public/cli/commands/view.js +0 -5
- package/esm/public/cli/commands.js +53 -35
- package/esm/public/cli/executor.d.ts +68 -39
- package/esm/public/orm/index.d.ts +81 -48
- package/esm/public/orm/index.js +26 -18
- package/esm/public/orm/input-types.d.ts +2447 -2980
- package/esm/public/orm/input-types.js +26 -1
- package/esm/public/orm/models/blueprint.d.ts +56 -0
- package/esm/public/orm/models/blueprint.js +94 -0
- package/esm/public/orm/models/blueprintTemplate.d.ts +56 -0
- package/esm/public/orm/models/blueprintTemplate.js +94 -0
- package/esm/public/orm/models/databaseTransfer.d.ts +56 -0
- package/esm/public/orm/models/databaseTransfer.js +94 -0
- package/esm/public/orm/models/embeddingChunk.d.ts +56 -0
- package/esm/public/orm/models/embeddingChunk.js +94 -0
- package/esm/public/orm/models/enum.d.ts +56 -0
- package/esm/public/orm/models/{uuidModule.js → enum.js} +23 -23
- package/esm/public/orm/models/index.d.ts +13 -9
- package/esm/public/orm/models/index.js +13 -9
- package/esm/public/orm/mutation/index.d.ts +98 -50
- package/esm/public/orm/mutation/index.js +126 -66
- package/index.d.ts +3 -3
- package/index.js +8 -8
- package/objects/cli/commands/commit.js +0 -2
- package/objects/cli/commands/ref.js +0 -2
- package/objects/cli/commands/store.js +0 -2
- package/objects/orm/input-types.d.ts +17 -48
- package/package.json +3 -3
- package/public/cli/commands/accept-database-transfer.d.ts +8 -0
- package/public/cli/commands/accept-database-transfer.js +36 -0
- package/public/cli/commands/api-module.js +0 -2
- package/public/cli/commands/api.js +0 -5
- package/public/cli/commands/app-level-requirement.js +0 -2
- package/public/cli/commands/app-level.js +0 -2
- package/public/cli/commands/app-permission.js +0 -2
- package/public/cli/commands/app.js +0 -4
- package/public/cli/commands/ast-migration.js +0 -2
- package/public/cli/commands/audit-log.js +0 -2
- package/public/cli/commands/blueprint-template.d.ts +8 -0
- package/public/cli/commands/blueprint-template.js +551 -0
- package/public/cli/commands/blueprint.d.ts +8 -0
- package/public/cli/commands/blueprint.js +486 -0
- package/public/cli/commands/cancel-database-transfer.d.ts +8 -0
- package/public/cli/commands/cancel-database-transfer.js +36 -0
- package/public/cli/commands/check-constraint.js +0 -4
- package/public/cli/commands/commit.js +0 -2
- package/public/cli/commands/connected-account.js +0 -3
- package/public/cli/commands/connected-accounts-module.js +0 -2
- package/public/cli/commands/construct-blueprint.d.ts +8 -0
- package/public/cli/commands/construct-blueprint.js +36 -0
- package/public/cli/commands/copy-template-to-blueprint.d.ts +8 -0
- package/public/cli/commands/copy-template-to-blueprint.js +36 -0
- package/public/cli/commands/crypto-address.js +0 -2
- package/public/cli/commands/crypto-addresses-module.js +0 -3
- package/public/cli/commands/crypto-auth-module.js +0 -7
- package/public/cli/commands/database-provision-module.js +0 -6
- package/public/cli/commands/database-transfer.d.ts +8 -0
- package/public/cli/commands/database-transfer.js +427 -0
- package/public/cli/commands/database.js +0 -4
- package/public/cli/commands/default-privilege.js +0 -4
- package/public/cli/commands/denormalized-table-field.js +0 -2
- package/public/cli/commands/emails-module.js +0 -2
- package/public/cli/commands/embedding-chunk.d.ts +8 -0
- package/public/cli/commands/embedding-chunk.js +515 -0
- package/public/cli/commands/encrypted-secrets-module.js +0 -2
- package/public/cli/commands/enum.d.ts +8 -0
- package/public/cli/commands/{uuid-module.js → enum.js} +175 -33
- package/public/cli/commands/field-module.js +0 -2
- package/public/cli/commands/field.js +21 -7
- package/public/cli/commands/foreign-key-constraint.js +0 -7
- package/public/cli/commands/hierarchy-module.js +0 -11
- package/public/cli/commands/index.js +0 -4
- package/public/cli/commands/invite.js +0 -2
- package/public/cli/commands/invites-module.js +0 -5
- package/public/cli/commands/levels-module.js +0 -16
- package/public/cli/commands/limits-module.js +0 -10
- package/public/cli/commands/membership-type.js +0 -3
- package/public/cli/commands/membership-types-module.js +0 -2
- package/public/cli/commands/memberships-module.js +0 -13
- package/public/cli/commands/node-type-registry.js +0 -6
- package/public/cli/commands/org-chart-edge-grant.js +3 -3
- package/public/cli/commands/org-chart-edge.js +0 -2
- package/public/cli/commands/org-invite.js +0 -2
- package/public/cli/commands/org-permission.js +0 -2
- package/public/cli/commands/permissions-module.js +0 -8
- package/public/cli/commands/phone-number.js +0 -3
- package/public/cli/commands/phone-numbers-module.js +0 -2
- package/public/cli/commands/policy.js +0 -6
- package/public/cli/commands/primary-key-constraint.js +0 -4
- package/public/cli/commands/profiles-module.js +0 -6
- package/public/cli/commands/ref.js +0 -2
- package/public/cli/commands/reject-database-transfer.d.ts +8 -0
- package/public/cli/commands/reject-database-transfer.js +36 -0
- package/public/cli/commands/relation-provision.js +63 -11
- package/public/cli/commands/rls-module.js +0 -5
- package/public/cli/commands/schema-grant.js +0 -2
- package/public/cli/commands/schema.js +0 -6
- package/public/cli/commands/secrets-module.js +0 -2
- package/public/cli/commands/secure-table-provision.js +0 -6
- package/public/cli/commands/sessions-module.js +0 -4
- package/public/cli/commands/site-metadatum.js +0 -3
- package/public/cli/commands/site-module.js +0 -2
- package/public/cli/commands/site.js +0 -4
- package/public/cli/commands/sql-migration.js +0 -7
- package/public/cli/commands/store.js +0 -2
- package/public/cli/commands/table-grant.js +0 -3
- package/public/cli/commands/table-template-module.js +0 -3
- package/public/cli/commands/table.js +0 -7
- package/public/cli/commands/trigger-function.js +0 -3
- package/public/cli/commands/trigger.js +0 -5
- package/public/cli/commands/unique-constraint.js +0 -5
- package/public/cli/commands/user-auth-module.js +0 -17
- package/public/cli/commands/users-module.js +0 -3
- package/public/cli/commands/view-grant.js +0 -3
- package/public/cli/commands/view-rule.js +0 -4
- package/public/cli/commands/view.js +0 -5
- package/public/cli/commands.js +53 -35
- package/public/cli/executor.d.ts +68 -39
- package/public/orm/index.d.ts +81 -48
- package/public/orm/index.js +26 -18
- package/public/orm/input-types.d.ts +2447 -2980
- package/public/orm/input-types.js +26 -1
- package/public/orm/models/blueprint.d.ts +56 -0
- package/public/orm/models/blueprint.js +98 -0
- package/public/orm/models/blueprintTemplate.d.ts +56 -0
- package/public/orm/models/blueprintTemplate.js +98 -0
- package/public/orm/models/databaseTransfer.d.ts +56 -0
- package/public/orm/models/databaseTransfer.js +98 -0
- package/public/orm/models/embeddingChunk.d.ts +56 -0
- package/public/orm/models/embeddingChunk.js +98 -0
- package/public/orm/models/enum.d.ts +56 -0
- package/public/orm/models/{uuidModule.js → enum.js} +25 -25
- package/public/orm/models/index.d.ts +13 -9
- package/public/orm/models/index.js +29 -21
- package/public/orm/mutation/index.d.ts +98 -50
- package/public/orm/mutation/index.js +126 -66
- package/esm/public/orm/models/uuidModule.d.ts +0 -56
- package/public/orm/models/uuidModule.d.ts +0 -56
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for BlueprintTemplate
|
|
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, stripUndefined } from '../utils';
|
|
9
|
+
const fieldSchema = {
|
|
10
|
+
id: 'uuid',
|
|
11
|
+
name: 'string',
|
|
12
|
+
version: 'string',
|
|
13
|
+
displayName: 'string',
|
|
14
|
+
description: 'string',
|
|
15
|
+
ownerId: 'uuid',
|
|
16
|
+
visibility: 'string',
|
|
17
|
+
categories: 'string',
|
|
18
|
+
tags: 'string',
|
|
19
|
+
definition: 'json',
|
|
20
|
+
definitionSchemaVersion: 'string',
|
|
21
|
+
source: 'string',
|
|
22
|
+
complexity: 'string',
|
|
23
|
+
copyCount: 'int',
|
|
24
|
+
forkCount: 'int',
|
|
25
|
+
forkedFromId: 'uuid',
|
|
26
|
+
definitionHash: 'uuid',
|
|
27
|
+
tableHashes: 'json',
|
|
28
|
+
createdAt: 'string',
|
|
29
|
+
updatedAt: 'string',
|
|
30
|
+
};
|
|
31
|
+
const usage = '\nblueprint-template <command>\n\nCommands:\n list List all blueprintTemplate records\n get Get a blueprintTemplate by ID\n create Create a new blueprintTemplate\n update Update an existing blueprintTemplate\n delete Delete a blueprintTemplate\n\n --help, -h Show this help message\n';
|
|
32
|
+
export default async (argv, prompter, _options) => {
|
|
33
|
+
if (argv.help || argv.h) {
|
|
34
|
+
console.log(usage);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
const { first: subcommand, newArgv } = extractFirst(argv);
|
|
38
|
+
if (!subcommand) {
|
|
39
|
+
const answer = await prompter.prompt(argv, [
|
|
40
|
+
{
|
|
41
|
+
type: 'autocomplete',
|
|
42
|
+
name: 'subcommand',
|
|
43
|
+
message: 'What do you want to do?',
|
|
44
|
+
options: ['list', 'get', 'create', 'update', 'delete'],
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
48
|
+
}
|
|
49
|
+
return handleTableSubcommand(subcommand, newArgv, prompter);
|
|
50
|
+
};
|
|
51
|
+
async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
52
|
+
switch (subcommand) {
|
|
53
|
+
case 'list':
|
|
54
|
+
return handleList(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 client = getClient();
|
|
71
|
+
const result = await client.blueprintTemplate
|
|
72
|
+
.findMany({
|
|
73
|
+
select: {
|
|
74
|
+
id: true,
|
|
75
|
+
name: true,
|
|
76
|
+
version: true,
|
|
77
|
+
displayName: true,
|
|
78
|
+
description: true,
|
|
79
|
+
ownerId: true,
|
|
80
|
+
visibility: true,
|
|
81
|
+
categories: true,
|
|
82
|
+
tags: true,
|
|
83
|
+
definition: true,
|
|
84
|
+
definitionSchemaVersion: true,
|
|
85
|
+
source: true,
|
|
86
|
+
complexity: true,
|
|
87
|
+
copyCount: true,
|
|
88
|
+
forkCount: true,
|
|
89
|
+
forkedFromId: true,
|
|
90
|
+
definitionHash: true,
|
|
91
|
+
tableHashes: true,
|
|
92
|
+
createdAt: true,
|
|
93
|
+
updatedAt: true,
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
.execute();
|
|
97
|
+
console.log(JSON.stringify(result, null, 2));
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.error('Failed to list records.');
|
|
101
|
+
if (error instanceof Error) {
|
|
102
|
+
console.error(error.message);
|
|
103
|
+
}
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function handleGet(argv, prompter) {
|
|
108
|
+
try {
|
|
109
|
+
const answers = await prompter.prompt(argv, [
|
|
110
|
+
{
|
|
111
|
+
type: 'text',
|
|
112
|
+
name: 'id',
|
|
113
|
+
message: 'id',
|
|
114
|
+
required: true,
|
|
115
|
+
},
|
|
116
|
+
]);
|
|
117
|
+
const client = getClient();
|
|
118
|
+
const result = await client.blueprintTemplate
|
|
119
|
+
.findOne({
|
|
120
|
+
id: answers.id,
|
|
121
|
+
select: {
|
|
122
|
+
id: true,
|
|
123
|
+
name: true,
|
|
124
|
+
version: true,
|
|
125
|
+
displayName: true,
|
|
126
|
+
description: true,
|
|
127
|
+
ownerId: true,
|
|
128
|
+
visibility: true,
|
|
129
|
+
categories: true,
|
|
130
|
+
tags: true,
|
|
131
|
+
definition: true,
|
|
132
|
+
definitionSchemaVersion: true,
|
|
133
|
+
source: true,
|
|
134
|
+
complexity: true,
|
|
135
|
+
copyCount: true,
|
|
136
|
+
forkCount: true,
|
|
137
|
+
forkedFromId: true,
|
|
138
|
+
definitionHash: true,
|
|
139
|
+
tableHashes: true,
|
|
140
|
+
createdAt: true,
|
|
141
|
+
updatedAt: true,
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
.execute();
|
|
145
|
+
console.log(JSON.stringify(result, null, 2));
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.error('Record not found.');
|
|
149
|
+
if (error instanceof Error) {
|
|
150
|
+
console.error(error.message);
|
|
151
|
+
}
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async function handleCreate(argv, prompter) {
|
|
156
|
+
try {
|
|
157
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
158
|
+
{
|
|
159
|
+
type: 'text',
|
|
160
|
+
name: 'name',
|
|
161
|
+
message: 'name',
|
|
162
|
+
required: true,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'text',
|
|
166
|
+
name: 'version',
|
|
167
|
+
message: 'version',
|
|
168
|
+
required: false,
|
|
169
|
+
skipPrompt: true,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
type: 'text',
|
|
173
|
+
name: 'displayName',
|
|
174
|
+
message: 'displayName',
|
|
175
|
+
required: true,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
type: 'text',
|
|
179
|
+
name: 'description',
|
|
180
|
+
message: 'description',
|
|
181
|
+
required: false,
|
|
182
|
+
skipPrompt: true,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
type: 'text',
|
|
186
|
+
name: 'ownerId',
|
|
187
|
+
message: 'ownerId',
|
|
188
|
+
required: true,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
type: 'text',
|
|
192
|
+
name: 'visibility',
|
|
193
|
+
message: 'visibility',
|
|
194
|
+
required: false,
|
|
195
|
+
skipPrompt: true,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
type: 'text',
|
|
199
|
+
name: 'categories',
|
|
200
|
+
message: 'categories',
|
|
201
|
+
required: false,
|
|
202
|
+
skipPrompt: true,
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
type: 'text',
|
|
206
|
+
name: 'tags',
|
|
207
|
+
message: 'tags',
|
|
208
|
+
required: false,
|
|
209
|
+
skipPrompt: true,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
type: 'json',
|
|
213
|
+
name: 'definition',
|
|
214
|
+
message: 'definition',
|
|
215
|
+
required: true,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
type: 'text',
|
|
219
|
+
name: 'definitionSchemaVersion',
|
|
220
|
+
message: 'definitionSchemaVersion',
|
|
221
|
+
required: false,
|
|
222
|
+
skipPrompt: true,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
type: 'text',
|
|
226
|
+
name: 'source',
|
|
227
|
+
message: 'source',
|
|
228
|
+
required: false,
|
|
229
|
+
skipPrompt: true,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
type: 'text',
|
|
233
|
+
name: 'complexity',
|
|
234
|
+
message: 'complexity',
|
|
235
|
+
required: false,
|
|
236
|
+
skipPrompt: true,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
type: 'text',
|
|
240
|
+
name: 'copyCount',
|
|
241
|
+
message: 'copyCount',
|
|
242
|
+
required: false,
|
|
243
|
+
skipPrompt: true,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
type: 'text',
|
|
247
|
+
name: 'forkCount',
|
|
248
|
+
message: 'forkCount',
|
|
249
|
+
required: false,
|
|
250
|
+
skipPrompt: true,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
type: 'text',
|
|
254
|
+
name: 'forkedFromId',
|
|
255
|
+
message: 'forkedFromId',
|
|
256
|
+
required: false,
|
|
257
|
+
skipPrompt: true,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: 'text',
|
|
261
|
+
name: 'definitionHash',
|
|
262
|
+
message: 'definitionHash',
|
|
263
|
+
required: false,
|
|
264
|
+
skipPrompt: true,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
type: 'json',
|
|
268
|
+
name: 'tableHashes',
|
|
269
|
+
message: 'tableHashes',
|
|
270
|
+
required: false,
|
|
271
|
+
skipPrompt: true,
|
|
272
|
+
},
|
|
273
|
+
]);
|
|
274
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
275
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
276
|
+
const client = getClient();
|
|
277
|
+
const result = await client.blueprintTemplate
|
|
278
|
+
.create({
|
|
279
|
+
data: {
|
|
280
|
+
name: cleanedData.name,
|
|
281
|
+
version: cleanedData.version,
|
|
282
|
+
displayName: cleanedData.displayName,
|
|
283
|
+
description: cleanedData.description,
|
|
284
|
+
ownerId: cleanedData.ownerId,
|
|
285
|
+
visibility: cleanedData.visibility,
|
|
286
|
+
categories: cleanedData.categories,
|
|
287
|
+
tags: cleanedData.tags,
|
|
288
|
+
definition: cleanedData.definition,
|
|
289
|
+
definitionSchemaVersion: cleanedData.definitionSchemaVersion,
|
|
290
|
+
source: cleanedData.source,
|
|
291
|
+
complexity: cleanedData.complexity,
|
|
292
|
+
copyCount: cleanedData.copyCount,
|
|
293
|
+
forkCount: cleanedData.forkCount,
|
|
294
|
+
forkedFromId: cleanedData.forkedFromId,
|
|
295
|
+
definitionHash: cleanedData.definitionHash,
|
|
296
|
+
tableHashes: cleanedData.tableHashes,
|
|
297
|
+
},
|
|
298
|
+
select: {
|
|
299
|
+
id: true,
|
|
300
|
+
name: true,
|
|
301
|
+
version: true,
|
|
302
|
+
displayName: true,
|
|
303
|
+
description: true,
|
|
304
|
+
ownerId: true,
|
|
305
|
+
visibility: true,
|
|
306
|
+
categories: true,
|
|
307
|
+
tags: true,
|
|
308
|
+
definition: true,
|
|
309
|
+
definitionSchemaVersion: true,
|
|
310
|
+
source: true,
|
|
311
|
+
complexity: true,
|
|
312
|
+
copyCount: true,
|
|
313
|
+
forkCount: true,
|
|
314
|
+
forkedFromId: true,
|
|
315
|
+
definitionHash: true,
|
|
316
|
+
tableHashes: true,
|
|
317
|
+
createdAt: true,
|
|
318
|
+
updatedAt: true,
|
|
319
|
+
},
|
|
320
|
+
})
|
|
321
|
+
.execute();
|
|
322
|
+
console.log(JSON.stringify(result, null, 2));
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
console.error('Failed to create record.');
|
|
326
|
+
if (error instanceof Error) {
|
|
327
|
+
console.error(error.message);
|
|
328
|
+
}
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function handleUpdate(argv, prompter) {
|
|
333
|
+
try {
|
|
334
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
335
|
+
{
|
|
336
|
+
type: 'text',
|
|
337
|
+
name: 'id',
|
|
338
|
+
message: 'id',
|
|
339
|
+
required: true,
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
type: 'text',
|
|
343
|
+
name: 'name',
|
|
344
|
+
message: 'name',
|
|
345
|
+
required: false,
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
type: 'text',
|
|
349
|
+
name: 'version',
|
|
350
|
+
message: 'version',
|
|
351
|
+
required: false,
|
|
352
|
+
skipPrompt: true,
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
type: 'text',
|
|
356
|
+
name: 'displayName',
|
|
357
|
+
message: 'displayName',
|
|
358
|
+
required: false,
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
type: 'text',
|
|
362
|
+
name: 'description',
|
|
363
|
+
message: 'description',
|
|
364
|
+
required: false,
|
|
365
|
+
skipPrompt: true,
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
type: 'text',
|
|
369
|
+
name: 'ownerId',
|
|
370
|
+
message: 'ownerId',
|
|
371
|
+
required: false,
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
type: 'text',
|
|
375
|
+
name: 'visibility',
|
|
376
|
+
message: 'visibility',
|
|
377
|
+
required: false,
|
|
378
|
+
skipPrompt: true,
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
type: 'text',
|
|
382
|
+
name: 'categories',
|
|
383
|
+
message: 'categories',
|
|
384
|
+
required: false,
|
|
385
|
+
skipPrompt: true,
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
type: 'text',
|
|
389
|
+
name: 'tags',
|
|
390
|
+
message: 'tags',
|
|
391
|
+
required: false,
|
|
392
|
+
skipPrompt: true,
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
type: 'json',
|
|
396
|
+
name: 'definition',
|
|
397
|
+
message: 'definition',
|
|
398
|
+
required: false,
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
type: 'text',
|
|
402
|
+
name: 'definitionSchemaVersion',
|
|
403
|
+
message: 'definitionSchemaVersion',
|
|
404
|
+
required: false,
|
|
405
|
+
skipPrompt: true,
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
type: 'text',
|
|
409
|
+
name: 'source',
|
|
410
|
+
message: 'source',
|
|
411
|
+
required: false,
|
|
412
|
+
skipPrompt: true,
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
type: 'text',
|
|
416
|
+
name: 'complexity',
|
|
417
|
+
message: 'complexity',
|
|
418
|
+
required: false,
|
|
419
|
+
skipPrompt: true,
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
type: 'text',
|
|
423
|
+
name: 'copyCount',
|
|
424
|
+
message: 'copyCount',
|
|
425
|
+
required: false,
|
|
426
|
+
skipPrompt: true,
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
type: 'text',
|
|
430
|
+
name: 'forkCount',
|
|
431
|
+
message: 'forkCount',
|
|
432
|
+
required: false,
|
|
433
|
+
skipPrompt: true,
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
type: 'text',
|
|
437
|
+
name: 'forkedFromId',
|
|
438
|
+
message: 'forkedFromId',
|
|
439
|
+
required: false,
|
|
440
|
+
skipPrompt: true,
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
type: 'text',
|
|
444
|
+
name: 'definitionHash',
|
|
445
|
+
message: 'definitionHash',
|
|
446
|
+
required: false,
|
|
447
|
+
skipPrompt: true,
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
type: 'json',
|
|
451
|
+
name: 'tableHashes',
|
|
452
|
+
message: 'tableHashes',
|
|
453
|
+
required: false,
|
|
454
|
+
skipPrompt: true,
|
|
455
|
+
},
|
|
456
|
+
]);
|
|
457
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
458
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
459
|
+
const client = getClient();
|
|
460
|
+
const result = await client.blueprintTemplate
|
|
461
|
+
.update({
|
|
462
|
+
where: {
|
|
463
|
+
id: answers.id,
|
|
464
|
+
},
|
|
465
|
+
data: {
|
|
466
|
+
name: cleanedData.name,
|
|
467
|
+
version: cleanedData.version,
|
|
468
|
+
displayName: cleanedData.displayName,
|
|
469
|
+
description: cleanedData.description,
|
|
470
|
+
ownerId: cleanedData.ownerId,
|
|
471
|
+
visibility: cleanedData.visibility,
|
|
472
|
+
categories: cleanedData.categories,
|
|
473
|
+
tags: cleanedData.tags,
|
|
474
|
+
definition: cleanedData.definition,
|
|
475
|
+
definitionSchemaVersion: cleanedData.definitionSchemaVersion,
|
|
476
|
+
source: cleanedData.source,
|
|
477
|
+
complexity: cleanedData.complexity,
|
|
478
|
+
copyCount: cleanedData.copyCount,
|
|
479
|
+
forkCount: cleanedData.forkCount,
|
|
480
|
+
forkedFromId: cleanedData.forkedFromId,
|
|
481
|
+
definitionHash: cleanedData.definitionHash,
|
|
482
|
+
tableHashes: cleanedData.tableHashes,
|
|
483
|
+
},
|
|
484
|
+
select: {
|
|
485
|
+
id: true,
|
|
486
|
+
name: true,
|
|
487
|
+
version: true,
|
|
488
|
+
displayName: true,
|
|
489
|
+
description: true,
|
|
490
|
+
ownerId: true,
|
|
491
|
+
visibility: true,
|
|
492
|
+
categories: true,
|
|
493
|
+
tags: true,
|
|
494
|
+
definition: true,
|
|
495
|
+
definitionSchemaVersion: true,
|
|
496
|
+
source: true,
|
|
497
|
+
complexity: true,
|
|
498
|
+
copyCount: true,
|
|
499
|
+
forkCount: true,
|
|
500
|
+
forkedFromId: true,
|
|
501
|
+
definitionHash: true,
|
|
502
|
+
tableHashes: true,
|
|
503
|
+
createdAt: true,
|
|
504
|
+
updatedAt: true,
|
|
505
|
+
},
|
|
506
|
+
})
|
|
507
|
+
.execute();
|
|
508
|
+
console.log(JSON.stringify(result, null, 2));
|
|
509
|
+
}
|
|
510
|
+
catch (error) {
|
|
511
|
+
console.error('Failed to update record.');
|
|
512
|
+
if (error instanceof Error) {
|
|
513
|
+
console.error(error.message);
|
|
514
|
+
}
|
|
515
|
+
process.exit(1);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
async function handleDelete(argv, prompter) {
|
|
519
|
+
try {
|
|
520
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
521
|
+
{
|
|
522
|
+
type: 'text',
|
|
523
|
+
name: 'id',
|
|
524
|
+
message: 'id',
|
|
525
|
+
required: true,
|
|
526
|
+
},
|
|
527
|
+
]);
|
|
528
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
529
|
+
const client = getClient();
|
|
530
|
+
const result = await client.blueprintTemplate
|
|
531
|
+
.delete({
|
|
532
|
+
where: {
|
|
533
|
+
id: answers.id,
|
|
534
|
+
},
|
|
535
|
+
select: {
|
|
536
|
+
id: true,
|
|
537
|
+
},
|
|
538
|
+
})
|
|
539
|
+
.execute();
|
|
540
|
+
console.log(JSON.stringify(result, null, 2));
|
|
541
|
+
}
|
|
542
|
+
catch (error) {
|
|
543
|
+
console.error('Failed to delete record.');
|
|
544
|
+
if (error instanceof Error) {
|
|
545
|
+
console.error(error.message);
|
|
546
|
+
}
|
|
547
|
+
process.exit(1);
|
|
548
|
+
}
|
|
549
|
+
}
|