@constructive-sdk/cli 0.17.1 → 0.17.3
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/admin/cli/commands/app-invite.js +22 -0
- package/admin/cli/commands/app-limit-default.js +22 -0
- package/admin/cli/commands/{confirm-upload.d.ts → app-limit-event.d.ts} +1 -1
- package/admin/cli/commands/app-limit-event.js +212 -0
- package/admin/cli/commands/app-limit.js +66 -0
- package/admin/cli/commands/app-membership.js +0 -22
- package/admin/cli/commands/org-invite.js +22 -0
- package/{esm/admin/cli/commands/confirm-upload.d.ts → admin/cli/commands/org-limit-aggregate.d.ts} +1 -1
- package/admin/cli/commands/org-limit-aggregate.js +362 -0
- package/admin/cli/commands/org-limit-default.js +22 -0
- package/{auth/cli/commands/confirm-upload.d.ts → admin/cli/commands/org-limit-event.d.ts} +1 -1
- package/admin/cli/commands/org-limit-event.js +212 -0
- package/admin/cli/commands/org-limit.js +66 -0
- package/admin/cli/commands/org-membership-setting.js +44 -0
- package/admin/cli/commands.js +25 -21
- package/admin/cli/executor.d.ts +12 -14
- package/admin/orm/index.d.ts +24 -23
- package/admin/orm/index.js +24 -18
- package/admin/orm/input-types.d.ts +1297 -839
- package/admin/orm/models/appLimitEvent.d.ts +32 -0
- package/admin/orm/models/appLimitEvent.js +55 -0
- package/admin/orm/models/index.d.ts +12 -9
- package/admin/orm/models/index.js +25 -19
- package/admin/orm/models/orgLimitAggregate.d.ts +56 -0
- package/admin/orm/models/orgLimitAggregate.js +100 -0
- package/admin/orm/models/orgLimitEvent.d.ts +32 -0
- package/admin/orm/models/orgLimitEvent.js +55 -0
- package/admin/orm/mutation/index.d.ts +1 -15
- package/admin/orm/mutation/index.js +0 -12
- package/auth/cli/commands.js +1 -3
- package/auth/cli/executor.d.ts +0 -5
- package/auth/orm/index.d.ts +0 -5
- package/auth/orm/input-types.d.ts +0 -20
- package/auth/orm/mutation/index.d.ts +1 -15
- package/auth/orm/mutation/index.js +0 -12
- package/esm/admin/cli/commands/app-invite.js +22 -0
- package/esm/admin/cli/commands/app-limit-default.js +22 -0
- package/esm/{auth/cli/commands/confirm-upload.d.ts → admin/cli/commands/app-limit-event.d.ts} +1 -1
- package/esm/admin/cli/commands/app-limit-event.js +210 -0
- package/esm/admin/cli/commands/app-limit.js +66 -0
- package/esm/admin/cli/commands/app-membership.js +0 -22
- package/esm/admin/cli/commands/org-invite.js +22 -0
- package/esm/admin/cli/commands/org-limit-aggregate.d.ts +8 -0
- package/esm/admin/cli/commands/org-limit-aggregate.js +360 -0
- package/esm/admin/cli/commands/org-limit-default.js +22 -0
- package/esm/admin/cli/commands/org-limit-event.d.ts +8 -0
- package/esm/admin/cli/commands/org-limit-event.js +210 -0
- package/esm/admin/cli/commands/org-limit.js +66 -0
- package/esm/admin/cli/commands/org-membership-setting.js +44 -0
- package/esm/admin/cli/commands.js +25 -21
- package/esm/admin/cli/executor.d.ts +12 -14
- package/esm/admin/orm/index.d.ts +24 -23
- package/esm/admin/orm/index.js +24 -18
- package/esm/admin/orm/input-types.d.ts +1297 -839
- package/esm/admin/orm/models/appLimitEvent.d.ts +32 -0
- package/esm/admin/orm/models/appLimitEvent.js +51 -0
- package/esm/admin/orm/models/index.d.ts +12 -9
- package/esm/admin/orm/models/index.js +12 -9
- package/esm/admin/orm/models/orgLimitAggregate.d.ts +56 -0
- package/esm/admin/orm/models/orgLimitAggregate.js +96 -0
- package/esm/admin/orm/models/orgLimitEvent.d.ts +32 -0
- package/esm/admin/orm/models/orgLimitEvent.js +51 -0
- package/esm/admin/orm/mutation/index.d.ts +1 -15
- package/esm/admin/orm/mutation/index.js +0 -12
- package/esm/auth/cli/commands.js +1 -3
- package/esm/auth/cli/executor.d.ts +0 -5
- package/esm/auth/orm/index.d.ts +0 -5
- package/esm/auth/orm/input-types.d.ts +0 -20
- package/esm/auth/orm/mutation/index.d.ts +1 -15
- package/esm/auth/orm/mutation/index.js +0 -12
- package/esm/objects/cli/commands.js +1 -3
- package/esm/objects/cli/executor.d.ts +0 -5
- package/esm/objects/orm/index.d.ts +0 -5
- package/esm/objects/orm/input-types.d.ts +0 -20
- package/esm/objects/orm/mutation/index.d.ts +1 -15
- package/esm/objects/orm/mutation/index.js +0 -12
- package/esm/public/cli/commands/agent-message.d.ts +8 -0
- package/esm/public/cli/commands/agent-message.js +324 -0
- package/esm/public/cli/commands/agent-task.d.ts +8 -0
- package/esm/public/cli/commands/agent-task.js +368 -0
- package/esm/public/cli/commands/agent-thread.d.ts +8 -0
- package/esm/public/cli/commands/agent-thread.js +372 -0
- package/esm/public/cli/commands/app-invite.js +22 -0
- package/esm/public/cli/commands/app-limit-default.js +22 -0
- package/esm/public/cli/commands/app-limit-event.d.ts +8 -0
- package/esm/public/cli/commands/app-limit-event.js +210 -0
- package/esm/public/cli/commands/app-limit.js +66 -0
- package/esm/public/cli/commands/app-membership.js +0 -22
- package/esm/public/cli/commands/billing-module.d.ts +8 -0
- package/esm/public/cli/commands/billing-module.js +492 -0
- package/esm/public/cli/commands/limits-module.js +22 -0
- package/esm/public/cli/commands/node-type-registry.d.ts +8 -0
- package/esm/public/cli/commands/node-type-registry.js +343 -0
- package/esm/public/cli/commands/org-invite.js +22 -0
- package/esm/public/cli/commands/org-limit-aggregate.d.ts +8 -0
- package/esm/public/cli/commands/org-limit-aggregate.js +360 -0
- package/esm/public/cli/commands/org-limit-default.js +22 -0
- package/esm/public/cli/commands/org-limit-event.d.ts +8 -0
- package/esm/public/cli/commands/org-limit-event.js +210 -0
- package/esm/public/cli/commands/org-limit.js +66 -0
- package/esm/public/cli/commands/org-membership-setting.js +44 -0
- package/esm/public/cli/commands/plans-module.d.ts +8 -0
- package/esm/public/cli/commands/plans-module.js +426 -0
- package/esm/public/cli/commands/profiles-module.js +44 -0
- package/esm/public/cli/commands/storage-module.js +22 -44
- package/esm/public/cli/commands.js +45 -29
- package/esm/public/cli/executor.d.ts +38 -34
- package/esm/public/orm/index.d.ts +56 -43
- package/esm/public/orm/index.js +36 -18
- package/esm/public/orm/input-types.d.ts +2983 -1112
- package/esm/public/orm/input-types.js +9 -0
- package/esm/public/orm/models/agentMessage.d.ts +56 -0
- package/esm/public/orm/models/agentMessage.js +96 -0
- package/esm/public/orm/models/agentTask.d.ts +56 -0
- package/esm/public/orm/models/agentTask.js +96 -0
- package/esm/public/orm/models/agentThread.d.ts +56 -0
- package/esm/public/orm/models/agentThread.js +96 -0
- package/esm/public/orm/models/appLimitEvent.d.ts +32 -0
- package/esm/public/orm/models/appLimitEvent.js +51 -0
- package/esm/public/orm/models/billingModule.d.ts +56 -0
- package/esm/public/orm/models/billingModule.js +96 -0
- package/esm/public/orm/models/index.d.ts +18 -9
- package/esm/public/orm/models/index.js +18 -9
- package/esm/public/orm/models/nodeTypeRegistry.d.ts +56 -0
- package/esm/public/orm/models/nodeTypeRegistry.js +96 -0
- package/esm/public/orm/models/orgLimitAggregate.d.ts +56 -0
- package/esm/public/orm/models/orgLimitAggregate.js +96 -0
- package/esm/public/orm/models/orgLimitEvent.d.ts +32 -0
- package/esm/public/orm/models/orgLimitEvent.js +51 -0
- package/esm/public/orm/models/plansModule.d.ts +56 -0
- package/esm/public/orm/models/plansModule.js +96 -0
- package/esm/public/orm/mutation/index.d.ts +17 -31
- package/esm/public/orm/mutation/index.js +24 -36
- package/esm/public/orm/query/index.d.ts +28 -28
- package/esm/public/orm/query/index.js +48 -48
- package/objects/cli/commands.js +1 -3
- package/objects/cli/executor.d.ts +0 -5
- package/objects/orm/index.d.ts +0 -5
- package/objects/orm/input-types.d.ts +0 -20
- package/objects/orm/mutation/index.d.ts +1 -15
- package/objects/orm/mutation/index.js +0 -12
- package/package.json +4 -4
- package/public/cli/commands/agent-message.d.ts +8 -0
- package/public/cli/commands/agent-message.js +326 -0
- package/public/cli/commands/agent-task.d.ts +8 -0
- package/public/cli/commands/agent-task.js +370 -0
- package/public/cli/commands/agent-thread.d.ts +8 -0
- package/public/cli/commands/agent-thread.js +374 -0
- package/public/cli/commands/app-invite.js +22 -0
- package/public/cli/commands/app-limit-default.js +22 -0
- package/public/cli/commands/app-limit-event.d.ts +8 -0
- package/public/cli/commands/app-limit-event.js +212 -0
- package/public/cli/commands/app-limit.js +66 -0
- package/public/cli/commands/app-membership.js +0 -22
- package/public/cli/commands/billing-module.d.ts +8 -0
- package/public/cli/commands/billing-module.js +494 -0
- package/public/cli/commands/limits-module.js +22 -0
- package/public/cli/commands/node-type-registry.d.ts +8 -0
- package/public/cli/commands/node-type-registry.js +345 -0
- package/public/cli/commands/org-invite.js +22 -0
- package/public/cli/commands/org-limit-aggregate.d.ts +8 -0
- package/public/cli/commands/org-limit-aggregate.js +362 -0
- package/public/cli/commands/org-limit-default.js +22 -0
- package/public/cli/commands/org-limit-event.d.ts +8 -0
- package/public/cli/commands/org-limit-event.js +212 -0
- package/public/cli/commands/org-limit.js +66 -0
- package/public/cli/commands/org-membership-setting.js +44 -0
- package/public/cli/commands/plans-module.d.ts +8 -0
- package/public/cli/commands/plans-module.js +428 -0
- package/public/cli/commands/profiles-module.js +44 -0
- package/public/cli/commands/storage-module.js +22 -44
- package/public/cli/commands.js +45 -29
- package/public/cli/executor.d.ts +38 -34
- package/public/orm/index.d.ts +56 -43
- package/public/orm/index.js +36 -18
- package/public/orm/input-types.d.ts +2983 -1112
- package/public/orm/input-types.js +9 -0
- package/public/orm/models/agentMessage.d.ts +56 -0
- package/public/orm/models/agentMessage.js +100 -0
- package/public/orm/models/agentTask.d.ts +56 -0
- package/public/orm/models/agentTask.js +100 -0
- package/public/orm/models/agentThread.d.ts +56 -0
- package/public/orm/models/agentThread.js +100 -0
- package/public/orm/models/appLimitEvent.d.ts +32 -0
- package/public/orm/models/appLimitEvent.js +55 -0
- package/public/orm/models/billingModule.d.ts +56 -0
- package/public/orm/models/billingModule.js +100 -0
- package/public/orm/models/index.d.ts +18 -9
- package/public/orm/models/index.js +39 -21
- package/public/orm/models/nodeTypeRegistry.d.ts +56 -0
- package/public/orm/models/nodeTypeRegistry.js +100 -0
- package/public/orm/models/orgLimitAggregate.d.ts +56 -0
- package/public/orm/models/orgLimitAggregate.js +100 -0
- package/public/orm/models/orgLimitEvent.d.ts +32 -0
- package/public/orm/models/orgLimitEvent.js +55 -0
- package/public/orm/models/plansModule.d.ts +56 -0
- package/public/orm/models/plansModule.js +100 -0
- package/public/orm/mutation/index.d.ts +17 -31
- package/public/orm/mutation/index.js +24 -36
- package/public/orm/query/index.d.ts +28 -28
- package/public/orm/query/index.js +48 -48
- package/admin/cli/commands/confirm-upload.js +0 -36
- package/auth/cli/commands/confirm-upload.js +0 -36
- package/esm/admin/cli/commands/confirm-upload.js +0 -34
- package/esm/auth/cli/commands/confirm-upload.js +0 -34
- package/esm/objects/cli/commands/confirm-upload.d.ts +0 -8
- package/esm/objects/cli/commands/confirm-upload.js +0 -34
- package/esm/public/cli/commands/confirm-upload.d.ts +0 -8
- package/esm/public/cli/commands/confirm-upload.js +0 -34
- package/objects/cli/commands/confirm-upload.d.ts +0 -8
- package/objects/cli/commands/confirm-upload.js +0 -36
- package/public/cli/commands/confirm-upload.d.ts +0 -8
- package/public/cli/commands/confirm-upload.js +0 -36
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for AgentTask
|
|
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
|
+
threadId: 'uuid',
|
|
11
|
+
entityId: 'uuid',
|
|
12
|
+
description: 'string',
|
|
13
|
+
source: 'string',
|
|
14
|
+
error: 'string',
|
|
15
|
+
id: 'uuid',
|
|
16
|
+
createdAt: 'string',
|
|
17
|
+
updatedAt: 'string',
|
|
18
|
+
ownerId: 'uuid',
|
|
19
|
+
status: 'string',
|
|
20
|
+
};
|
|
21
|
+
const usage = '\nagent-task <command>\n\nCommands:\n list List agentTask records\n find-first Find first matching agentTask record\n get Get a agentTask by ID\n create Create a new agentTask\n update Update an existing agentTask\n delete Delete a agentTask\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';
|
|
22
|
+
export default async (argv, prompter, _options) => {
|
|
23
|
+
if (argv.help || argv.h) {
|
|
24
|
+
console.log(usage);
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
const { first: subcommand, newArgv } = extractFirst(argv);
|
|
28
|
+
if (!subcommand) {
|
|
29
|
+
const answer = await prompter.prompt(argv, [
|
|
30
|
+
{
|
|
31
|
+
type: 'autocomplete',
|
|
32
|
+
name: 'subcommand',
|
|
33
|
+
message: 'What do you want to do?',
|
|
34
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
35
|
+
},
|
|
36
|
+
]);
|
|
37
|
+
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
38
|
+
}
|
|
39
|
+
return handleTableSubcommand(subcommand, newArgv, prompter);
|
|
40
|
+
};
|
|
41
|
+
async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
42
|
+
switch (subcommand) {
|
|
43
|
+
case 'list':
|
|
44
|
+
return handleList(argv, prompter);
|
|
45
|
+
case 'find-first':
|
|
46
|
+
return handleFindFirst(argv, prompter);
|
|
47
|
+
case 'get':
|
|
48
|
+
return handleGet(argv, prompter);
|
|
49
|
+
case 'create':
|
|
50
|
+
return handleCreate(argv, prompter);
|
|
51
|
+
case 'update':
|
|
52
|
+
return handleUpdate(argv, prompter);
|
|
53
|
+
case 'delete':
|
|
54
|
+
return handleDelete(argv, prompter);
|
|
55
|
+
default:
|
|
56
|
+
console.log(usage);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function handleList(argv, _prompter) {
|
|
61
|
+
try {
|
|
62
|
+
const defaultSelect = {
|
|
63
|
+
threadId: true,
|
|
64
|
+
entityId: true,
|
|
65
|
+
description: true,
|
|
66
|
+
source: true,
|
|
67
|
+
error: true,
|
|
68
|
+
id: true,
|
|
69
|
+
createdAt: true,
|
|
70
|
+
updatedAt: true,
|
|
71
|
+
ownerId: true,
|
|
72
|
+
status: true,
|
|
73
|
+
};
|
|
74
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
75
|
+
const client = getClient();
|
|
76
|
+
const result = await client.agentTask.findMany(findManyArgs).execute();
|
|
77
|
+
console.log(JSON.stringify(result, null, 2));
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error('Failed to list records.');
|
|
81
|
+
if (error instanceof Error) {
|
|
82
|
+
console.error(error.message);
|
|
83
|
+
}
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function handleFindFirst(argv, _prompter) {
|
|
88
|
+
try {
|
|
89
|
+
const defaultSelect = {
|
|
90
|
+
threadId: true,
|
|
91
|
+
entityId: true,
|
|
92
|
+
description: true,
|
|
93
|
+
source: true,
|
|
94
|
+
error: true,
|
|
95
|
+
id: true,
|
|
96
|
+
createdAt: true,
|
|
97
|
+
updatedAt: true,
|
|
98
|
+
ownerId: true,
|
|
99
|
+
status: true,
|
|
100
|
+
};
|
|
101
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
102
|
+
const client = getClient();
|
|
103
|
+
const result = await client.agentTask.findFirst(findFirstArgs).execute();
|
|
104
|
+
console.log(JSON.stringify(result, null, 2));
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error('Failed to find record.');
|
|
108
|
+
if (error instanceof Error) {
|
|
109
|
+
console.error(error.message);
|
|
110
|
+
}
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async function handleGet(argv, prompter) {
|
|
115
|
+
try {
|
|
116
|
+
const answers = await prompter.prompt(argv, [
|
|
117
|
+
{
|
|
118
|
+
type: 'text',
|
|
119
|
+
name: 'id',
|
|
120
|
+
message: 'id',
|
|
121
|
+
required: true,
|
|
122
|
+
},
|
|
123
|
+
]);
|
|
124
|
+
const client = getClient();
|
|
125
|
+
const result = await client.agentTask
|
|
126
|
+
.findOne({
|
|
127
|
+
id: answers.id,
|
|
128
|
+
select: {
|
|
129
|
+
threadId: true,
|
|
130
|
+
entityId: true,
|
|
131
|
+
description: true,
|
|
132
|
+
source: true,
|
|
133
|
+
error: true,
|
|
134
|
+
id: true,
|
|
135
|
+
createdAt: true,
|
|
136
|
+
updatedAt: true,
|
|
137
|
+
ownerId: true,
|
|
138
|
+
status: true,
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
|
+
.execute();
|
|
142
|
+
console.log(JSON.stringify(result, null, 2));
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
console.error('Record not found.');
|
|
146
|
+
if (error instanceof Error) {
|
|
147
|
+
console.error(error.message);
|
|
148
|
+
}
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function handleCreate(argv, prompter) {
|
|
153
|
+
try {
|
|
154
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
155
|
+
{
|
|
156
|
+
type: 'text',
|
|
157
|
+
name: 'threadId',
|
|
158
|
+
message: 'threadId',
|
|
159
|
+
required: true,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'text',
|
|
163
|
+
name: 'entityId',
|
|
164
|
+
message: 'entityId',
|
|
165
|
+
required: true,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: 'text',
|
|
169
|
+
name: 'description',
|
|
170
|
+
message: 'description',
|
|
171
|
+
required: true,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'text',
|
|
175
|
+
name: 'source',
|
|
176
|
+
message: 'source',
|
|
177
|
+
required: false,
|
|
178
|
+
skipPrompt: true,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'text',
|
|
182
|
+
name: 'error',
|
|
183
|
+
message: 'error',
|
|
184
|
+
required: false,
|
|
185
|
+
skipPrompt: true,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'text',
|
|
189
|
+
name: 'ownerId',
|
|
190
|
+
message: 'ownerId',
|
|
191
|
+
required: false,
|
|
192
|
+
skipPrompt: true,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
type: 'text',
|
|
196
|
+
name: 'status',
|
|
197
|
+
message: 'status',
|
|
198
|
+
required: false,
|
|
199
|
+
skipPrompt: true,
|
|
200
|
+
},
|
|
201
|
+
]);
|
|
202
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
203
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
204
|
+
const client = getClient();
|
|
205
|
+
const result = await client.agentTask
|
|
206
|
+
.create({
|
|
207
|
+
data: {
|
|
208
|
+
threadId: cleanedData.threadId,
|
|
209
|
+
entityId: cleanedData.entityId,
|
|
210
|
+
description: cleanedData.description,
|
|
211
|
+
source: cleanedData.source,
|
|
212
|
+
error: cleanedData.error,
|
|
213
|
+
ownerId: cleanedData.ownerId,
|
|
214
|
+
status: cleanedData.status,
|
|
215
|
+
},
|
|
216
|
+
select: {
|
|
217
|
+
threadId: true,
|
|
218
|
+
entityId: true,
|
|
219
|
+
description: true,
|
|
220
|
+
source: true,
|
|
221
|
+
error: true,
|
|
222
|
+
id: true,
|
|
223
|
+
createdAt: true,
|
|
224
|
+
updatedAt: true,
|
|
225
|
+
ownerId: true,
|
|
226
|
+
status: true,
|
|
227
|
+
},
|
|
228
|
+
})
|
|
229
|
+
.execute();
|
|
230
|
+
console.log(JSON.stringify(result, null, 2));
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
console.error('Failed to create record.');
|
|
234
|
+
if (error instanceof Error) {
|
|
235
|
+
console.error(error.message);
|
|
236
|
+
}
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async function handleUpdate(argv, prompter) {
|
|
241
|
+
try {
|
|
242
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
243
|
+
{
|
|
244
|
+
type: 'text',
|
|
245
|
+
name: 'id',
|
|
246
|
+
message: 'id',
|
|
247
|
+
required: true,
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
type: 'text',
|
|
251
|
+
name: 'threadId',
|
|
252
|
+
message: 'threadId',
|
|
253
|
+
required: false,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
type: 'text',
|
|
257
|
+
name: 'entityId',
|
|
258
|
+
message: 'entityId',
|
|
259
|
+
required: false,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: 'text',
|
|
263
|
+
name: 'description',
|
|
264
|
+
message: 'description',
|
|
265
|
+
required: false,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
type: 'text',
|
|
269
|
+
name: 'source',
|
|
270
|
+
message: 'source',
|
|
271
|
+
required: false,
|
|
272
|
+
skipPrompt: true,
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
type: 'text',
|
|
276
|
+
name: 'error',
|
|
277
|
+
message: 'error',
|
|
278
|
+
required: false,
|
|
279
|
+
skipPrompt: true,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
type: 'text',
|
|
283
|
+
name: 'ownerId',
|
|
284
|
+
message: 'ownerId',
|
|
285
|
+
required: false,
|
|
286
|
+
skipPrompt: true,
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
type: 'text',
|
|
290
|
+
name: 'status',
|
|
291
|
+
message: 'status',
|
|
292
|
+
required: false,
|
|
293
|
+
skipPrompt: true,
|
|
294
|
+
},
|
|
295
|
+
]);
|
|
296
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
297
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
298
|
+
const client = getClient();
|
|
299
|
+
const result = await client.agentTask
|
|
300
|
+
.update({
|
|
301
|
+
where: {
|
|
302
|
+
id: answers.id,
|
|
303
|
+
},
|
|
304
|
+
data: {
|
|
305
|
+
threadId: cleanedData.threadId,
|
|
306
|
+
entityId: cleanedData.entityId,
|
|
307
|
+
description: cleanedData.description,
|
|
308
|
+
source: cleanedData.source,
|
|
309
|
+
error: cleanedData.error,
|
|
310
|
+
ownerId: cleanedData.ownerId,
|
|
311
|
+
status: cleanedData.status,
|
|
312
|
+
},
|
|
313
|
+
select: {
|
|
314
|
+
threadId: true,
|
|
315
|
+
entityId: true,
|
|
316
|
+
description: true,
|
|
317
|
+
source: true,
|
|
318
|
+
error: true,
|
|
319
|
+
id: true,
|
|
320
|
+
createdAt: true,
|
|
321
|
+
updatedAt: true,
|
|
322
|
+
ownerId: true,
|
|
323
|
+
status: true,
|
|
324
|
+
},
|
|
325
|
+
})
|
|
326
|
+
.execute();
|
|
327
|
+
console.log(JSON.stringify(result, null, 2));
|
|
328
|
+
}
|
|
329
|
+
catch (error) {
|
|
330
|
+
console.error('Failed to update record.');
|
|
331
|
+
if (error instanceof Error) {
|
|
332
|
+
console.error(error.message);
|
|
333
|
+
}
|
|
334
|
+
process.exit(1);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
async function handleDelete(argv, prompter) {
|
|
338
|
+
try {
|
|
339
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
340
|
+
{
|
|
341
|
+
type: 'text',
|
|
342
|
+
name: 'id',
|
|
343
|
+
message: 'id',
|
|
344
|
+
required: true,
|
|
345
|
+
},
|
|
346
|
+
]);
|
|
347
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
348
|
+
const client = getClient();
|
|
349
|
+
const result = await client.agentTask
|
|
350
|
+
.delete({
|
|
351
|
+
where: {
|
|
352
|
+
id: answers.id,
|
|
353
|
+
},
|
|
354
|
+
select: {
|
|
355
|
+
id: true,
|
|
356
|
+
},
|
|
357
|
+
})
|
|
358
|
+
.execute();
|
|
359
|
+
console.log(JSON.stringify(result, null, 2));
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
console.error('Failed to delete record.');
|
|
363
|
+
if (error instanceof Error) {
|
|
364
|
+
console.error(error.message);
|
|
365
|
+
}
|
|
366
|
+
process.exit(1);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for AgentThread
|
|
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;
|