@constructive-sdk/cli 1.9.2 → 1.9.4
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/{api/cli/commands/platform-api-module.d.ts → admin/cli/commands/org-chart-edge-grant.d.ts} +1 -1
- package/{api/cli/commands/platform-api-module.js → admin/cli/commands/org-chart-edge-grant.js} +137 -53
- package/{esm/api/cli/commands/platform-api-module.d.ts → admin/cli/commands/org-chart-edge.d.ts} +1 -1
- package/{api/cli/commands/api-module.js → admin/cli/commands/org-chart-edge.js} +86 -60
- package/admin/cli/commands/org-get-managers-record.d.ts +8 -0
- package/admin/cli/commands/org-get-managers-record.js +126 -0
- package/admin/cli/commands/org-get-subordinates-record.d.ts +8 -0
- package/admin/cli/commands/org-get-subordinates-record.js +126 -0
- package/admin/cli/commands/org-is-manager-of.d.ts +8 -0
- package/admin/cli/commands/org-is-manager-of.js +45 -0
- package/admin/cli/commands.js +11 -1
- package/admin/cli/executor.d.ts +9 -0
- package/admin/orm/index.d.ts +13 -0
- package/admin/orm/index.js +8 -0
- package/admin/orm/input-types.d.ts +399 -0
- package/admin/orm/models/index.d.ts +4 -0
- package/admin/orm/models/index.js +9 -1
- package/admin/orm/models/orgChartEdge.d.ts +54 -0
- package/admin/orm/models/orgChartEdge.js +104 -0
- package/admin/orm/models/orgChartEdgeGrant.d.ts +54 -0
- package/{api/orm/models/platformApiModule.js → admin/orm/models/orgChartEdgeGrant.js} +27 -27
- package/admin/orm/models/orgGetManagersRecord.d.ts +30 -0
- package/admin/orm/models/orgGetManagersRecord.js +59 -0
- package/admin/orm/models/orgGetSubordinatesRecord.d.ts +30 -0
- package/admin/orm/models/orgGetSubordinatesRecord.js +59 -0
- package/admin/orm/query/index.d.ts +11 -0
- package/admin/orm/query/index.js +24 -0
- package/api/cli/commands/{api-module.d.ts → domain-type.d.ts} +1 -1
- package/api/cli/commands/domain-type.js +466 -0
- package/api/cli/commands/table.js +22 -0
- package/api/cli/commands.js +3 -5
- package/api/cli/executor.d.ts +1 -2
- package/api/orm/index.d.ts +2 -4
- package/api/orm/index.js +2 -4
- package/api/orm/input-types.d.ts +378 -468
- package/api/orm/input-types.js +2 -2
- package/api/orm/models/domainType.d.ts +54 -0
- package/api/orm/models/{apiModule.js → domainType.js} +27 -27
- package/api/orm/models/index.d.ts +1 -2
- package/api/orm/models/index.js +4 -6
- package/compute/cli/commands/function-api-binding.js +12 -0
- package/compute/cli/commands/platform-function-api-binding.js +12 -0
- package/compute/cli/commands/platform-function-invocation.js +22 -0
- package/compute/orm/input-types.d.ts +42 -3
- package/esm/admin/cli/commands/org-chart-edge-grant.d.ts +8 -0
- package/esm/{api/cli/commands/platform-api-module.js → admin/cli/commands/org-chart-edge-grant.js} +137 -53
- package/esm/admin/cli/commands/org-chart-edge.d.ts +8 -0
- package/esm/{api/cli/commands/api-module.js → admin/cli/commands/org-chart-edge.js} +86 -60
- package/esm/admin/cli/commands/org-get-managers-record.d.ts +8 -0
- package/esm/admin/cli/commands/org-get-managers-record.js +124 -0
- package/esm/admin/cli/commands/org-get-subordinates-record.d.ts +8 -0
- package/esm/admin/cli/commands/org-get-subordinates-record.js +124 -0
- package/esm/admin/cli/commands/org-is-manager-of.d.ts +8 -0
- package/esm/admin/cli/commands/org-is-manager-of.js +43 -0
- package/esm/admin/cli/commands.js +11 -1
- package/esm/admin/cli/executor.d.ts +9 -0
- package/esm/admin/orm/index.d.ts +13 -0
- package/esm/admin/orm/index.js +8 -0
- package/esm/admin/orm/input-types.d.ts +399 -0
- package/esm/admin/orm/models/index.d.ts +4 -0
- package/esm/admin/orm/models/index.js +4 -0
- package/esm/admin/orm/models/orgChartEdge.d.ts +54 -0
- package/esm/admin/orm/models/orgChartEdge.js +100 -0
- package/esm/admin/orm/models/orgChartEdgeGrant.d.ts +54 -0
- package/esm/{api/orm/models/platformApiModule.js → admin/orm/models/orgChartEdgeGrant.js} +25 -25
- package/esm/admin/orm/models/orgGetManagersRecord.d.ts +30 -0
- package/esm/admin/orm/models/orgGetManagersRecord.js +55 -0
- package/esm/admin/orm/models/orgGetSubordinatesRecord.d.ts +30 -0
- package/esm/admin/orm/models/orgGetSubordinatesRecord.js +55 -0
- package/esm/admin/orm/query/index.d.ts +11 -0
- package/esm/admin/orm/query/index.js +24 -0
- package/esm/api/cli/commands/{api-module.d.ts → domain-type.d.ts} +1 -1
- package/esm/api/cli/commands/domain-type.js +464 -0
- package/esm/api/cli/commands/table.js +22 -0
- package/esm/api/cli/commands.js +3 -5
- package/esm/api/cli/executor.d.ts +1 -2
- package/esm/api/orm/index.d.ts +2 -4
- package/esm/api/orm/index.js +2 -4
- package/esm/api/orm/input-types.d.ts +378 -468
- package/esm/api/orm/input-types.js +2 -2
- package/esm/api/orm/models/domainType.d.ts +54 -0
- package/esm/api/orm/models/{apiModule.js → domainType.js} +25 -25
- package/esm/api/orm/models/index.d.ts +1 -2
- package/esm/api/orm/models/index.js +1 -2
- package/esm/compute/cli/commands/function-api-binding.js +12 -0
- package/esm/compute/cli/commands/platform-function-api-binding.js +12 -0
- package/esm/compute/cli/commands/platform-function-invocation.js +22 -0
- package/esm/compute/orm/input-types.d.ts +42 -3
- package/esm/modules/cli/commands/api-surface-module.js +0 -44
- package/esm/modules/cli/commands/billing-module.js +22 -0
- package/esm/modules/orm/input-types.d.ts +9 -16
- package/modules/cli/commands/api-surface-module.js +0 -44
- package/modules/cli/commands/billing-module.js +22 -0
- package/modules/orm/input-types.d.ts +9 -16
- package/package.json +5 -5
- package/api/orm/models/apiModule.d.ts +0 -54
- package/api/orm/models/platformApiModule.d.ts +0 -54
- package/esm/api/orm/models/apiModule.d.ts +0 -54
- package/esm/api/orm/models/platformApiModule.d.ts +0 -54
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for DomainType
|
|
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
|
+
baseType: 'json',
|
|
11
|
+
category: 'string',
|
|
12
|
+
checkExpr: 'json',
|
|
13
|
+
databaseId: 'uuid',
|
|
14
|
+
defaultExpr: 'json',
|
|
15
|
+
description: 'string',
|
|
16
|
+
id: 'uuid',
|
|
17
|
+
label: 'string',
|
|
18
|
+
name: 'string',
|
|
19
|
+
notNull: 'boolean',
|
|
20
|
+
schemaId: 'uuid',
|
|
21
|
+
smartTags: 'json',
|
|
22
|
+
tags: 'string',
|
|
23
|
+
};
|
|
24
|
+
const usage = '\ndomain-type <command>\n\nCommands:\n list List domainType records\n find-first Find first matching domainType record\n get Get a domainType by ID\n create Create a new domainType\n update Update an existing domainType\n delete Delete a domainType\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 --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\n --help, -h Show this help message\n';
|
|
25
|
+
export default async (argv, prompter, _options) => {
|
|
26
|
+
if (argv.help || argv.h) {
|
|
27
|
+
console.log(usage);
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
const { first: subcommand, newArgv } = extractFirst(argv);
|
|
31
|
+
if (!subcommand) {
|
|
32
|
+
const answer = await prompter.prompt(argv, [
|
|
33
|
+
{
|
|
34
|
+
type: 'autocomplete',
|
|
35
|
+
name: 'subcommand',
|
|
36
|
+
message: 'What do you want to do?',
|
|
37
|
+
options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
40
|
+
return handleTableSubcommand(answer.subcommand, newArgv, prompter);
|
|
41
|
+
}
|
|
42
|
+
return handleTableSubcommand(subcommand, newArgv, prompter);
|
|
43
|
+
};
|
|
44
|
+
async function handleTableSubcommand(subcommand, argv, prompter) {
|
|
45
|
+
switch (subcommand) {
|
|
46
|
+
case 'list':
|
|
47
|
+
return handleList(argv, prompter);
|
|
48
|
+
case 'find-first':
|
|
49
|
+
return handleFindFirst(argv, prompter);
|
|
50
|
+
case 'get':
|
|
51
|
+
return handleGet(argv, prompter);
|
|
52
|
+
case 'create':
|
|
53
|
+
return handleCreate(argv, prompter);
|
|
54
|
+
case 'update':
|
|
55
|
+
return handleUpdate(argv, prompter);
|
|
56
|
+
case 'delete':
|
|
57
|
+
return handleDelete(argv, prompter);
|
|
58
|
+
default:
|
|
59
|
+
console.log(usage);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function handleList(argv, _prompter) {
|
|
64
|
+
try {
|
|
65
|
+
const defaultSelect = {
|
|
66
|
+
baseType: true,
|
|
67
|
+
category: true,
|
|
68
|
+
checkExpr: true,
|
|
69
|
+
databaseId: true,
|
|
70
|
+
defaultExpr: true,
|
|
71
|
+
description: true,
|
|
72
|
+
id: true,
|
|
73
|
+
label: true,
|
|
74
|
+
name: true,
|
|
75
|
+
notNull: true,
|
|
76
|
+
schemaId: true,
|
|
77
|
+
smartTags: true,
|
|
78
|
+
tags: true,
|
|
79
|
+
};
|
|
80
|
+
const findManyArgs = parseFindManyArgs(argv, defaultSelect);
|
|
81
|
+
const client = getClient();
|
|
82
|
+
const result = await client.domainType.findMany(findManyArgs).execute();
|
|
83
|
+
console.log(JSON.stringify(result, null, 2));
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error('Failed to list records.');
|
|
87
|
+
if (error instanceof Error) {
|
|
88
|
+
console.error(error.message);
|
|
89
|
+
}
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function handleFindFirst(argv, _prompter) {
|
|
94
|
+
try {
|
|
95
|
+
const defaultSelect = {
|
|
96
|
+
baseType: true,
|
|
97
|
+
category: true,
|
|
98
|
+
checkExpr: true,
|
|
99
|
+
databaseId: true,
|
|
100
|
+
defaultExpr: true,
|
|
101
|
+
description: true,
|
|
102
|
+
id: true,
|
|
103
|
+
label: true,
|
|
104
|
+
name: true,
|
|
105
|
+
notNull: true,
|
|
106
|
+
schemaId: true,
|
|
107
|
+
smartTags: true,
|
|
108
|
+
tags: true,
|
|
109
|
+
};
|
|
110
|
+
const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
|
|
111
|
+
const client = getClient();
|
|
112
|
+
const result = await client.domainType.findFirst(findFirstArgs).execute();
|
|
113
|
+
console.log(JSON.stringify(result, null, 2));
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('Failed to find record.');
|
|
117
|
+
if (error instanceof Error) {
|
|
118
|
+
console.error(error.message);
|
|
119
|
+
}
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function handleGet(argv, prompter) {
|
|
124
|
+
try {
|
|
125
|
+
const answers = await prompter.prompt(argv, [
|
|
126
|
+
{
|
|
127
|
+
type: 'text',
|
|
128
|
+
name: 'id',
|
|
129
|
+
message: 'id',
|
|
130
|
+
required: true,
|
|
131
|
+
},
|
|
132
|
+
]);
|
|
133
|
+
const client = getClient();
|
|
134
|
+
const result = await client.domainType
|
|
135
|
+
.findOne({
|
|
136
|
+
id: answers.id,
|
|
137
|
+
select: {
|
|
138
|
+
baseType: true,
|
|
139
|
+
category: true,
|
|
140
|
+
checkExpr: true,
|
|
141
|
+
databaseId: true,
|
|
142
|
+
defaultExpr: true,
|
|
143
|
+
description: true,
|
|
144
|
+
id: true,
|
|
145
|
+
label: true,
|
|
146
|
+
name: true,
|
|
147
|
+
notNull: true,
|
|
148
|
+
schemaId: true,
|
|
149
|
+
smartTags: true,
|
|
150
|
+
tags: true,
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
.execute();
|
|
154
|
+
console.log(JSON.stringify(result, null, 2));
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
console.error('Record not found.');
|
|
158
|
+
if (error instanceof Error) {
|
|
159
|
+
console.error(error.message);
|
|
160
|
+
}
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async function handleCreate(argv, prompter) {
|
|
165
|
+
try {
|
|
166
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
167
|
+
{
|
|
168
|
+
type: 'json',
|
|
169
|
+
name: 'baseType',
|
|
170
|
+
message: 'baseType',
|
|
171
|
+
required: true,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'text',
|
|
175
|
+
name: 'category',
|
|
176
|
+
message: 'category',
|
|
177
|
+
required: false,
|
|
178
|
+
skipPrompt: true,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'json',
|
|
182
|
+
name: 'checkExpr',
|
|
183
|
+
message: 'checkExpr',
|
|
184
|
+
required: false,
|
|
185
|
+
skipPrompt: true,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'text',
|
|
189
|
+
name: 'databaseId',
|
|
190
|
+
message: 'databaseId',
|
|
191
|
+
required: true,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: 'json',
|
|
195
|
+
name: 'defaultExpr',
|
|
196
|
+
message: 'defaultExpr',
|
|
197
|
+
required: false,
|
|
198
|
+
skipPrompt: true,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: 'text',
|
|
202
|
+
name: 'description',
|
|
203
|
+
message: 'description',
|
|
204
|
+
required: false,
|
|
205
|
+
skipPrompt: true,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
type: 'text',
|
|
209
|
+
name: 'label',
|
|
210
|
+
message: 'label',
|
|
211
|
+
required: false,
|
|
212
|
+
skipPrompt: true,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
type: 'text',
|
|
216
|
+
name: 'name',
|
|
217
|
+
message: 'name',
|
|
218
|
+
required: true,
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: 'boolean',
|
|
222
|
+
name: 'notNull',
|
|
223
|
+
message: 'notNull',
|
|
224
|
+
required: false,
|
|
225
|
+
skipPrompt: true,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
type: 'text',
|
|
229
|
+
name: 'schemaId',
|
|
230
|
+
message: 'schemaId',
|
|
231
|
+
required: true,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
type: 'json',
|
|
235
|
+
name: 'smartTags',
|
|
236
|
+
message: 'smartTags',
|
|
237
|
+
required: false,
|
|
238
|
+
skipPrompt: true,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: 'text',
|
|
242
|
+
name: 'tags',
|
|
243
|
+
message: 'tags',
|
|
244
|
+
required: false,
|
|
245
|
+
skipPrompt: true,
|
|
246
|
+
},
|
|
247
|
+
]);
|
|
248
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
249
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
250
|
+
const client = getClient();
|
|
251
|
+
const result = await client.domainType
|
|
252
|
+
.create({
|
|
253
|
+
data: {
|
|
254
|
+
baseType: cleanedData.baseType,
|
|
255
|
+
category: cleanedData.category,
|
|
256
|
+
checkExpr: cleanedData.checkExpr,
|
|
257
|
+
databaseId: cleanedData.databaseId,
|
|
258
|
+
defaultExpr: cleanedData.defaultExpr,
|
|
259
|
+
description: cleanedData.description,
|
|
260
|
+
label: cleanedData.label,
|
|
261
|
+
name: cleanedData.name,
|
|
262
|
+
notNull: cleanedData.notNull,
|
|
263
|
+
schemaId: cleanedData.schemaId,
|
|
264
|
+
smartTags: cleanedData.smartTags,
|
|
265
|
+
tags: cleanedData.tags,
|
|
266
|
+
},
|
|
267
|
+
select: {
|
|
268
|
+
baseType: true,
|
|
269
|
+
category: true,
|
|
270
|
+
checkExpr: true,
|
|
271
|
+
databaseId: true,
|
|
272
|
+
defaultExpr: true,
|
|
273
|
+
description: true,
|
|
274
|
+
id: true,
|
|
275
|
+
label: true,
|
|
276
|
+
name: true,
|
|
277
|
+
notNull: true,
|
|
278
|
+
schemaId: true,
|
|
279
|
+
smartTags: true,
|
|
280
|
+
tags: true,
|
|
281
|
+
},
|
|
282
|
+
})
|
|
283
|
+
.execute();
|
|
284
|
+
console.log(JSON.stringify(result, null, 2));
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
console.error('Failed to create record.');
|
|
288
|
+
if (error instanceof Error) {
|
|
289
|
+
console.error(error.message);
|
|
290
|
+
}
|
|
291
|
+
process.exit(1);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async function handleUpdate(argv, prompter) {
|
|
295
|
+
try {
|
|
296
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
297
|
+
{
|
|
298
|
+
type: 'text',
|
|
299
|
+
name: 'id',
|
|
300
|
+
message: 'id',
|
|
301
|
+
required: true,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
type: 'json',
|
|
305
|
+
name: 'baseType',
|
|
306
|
+
message: 'baseType',
|
|
307
|
+
required: false,
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
type: 'text',
|
|
311
|
+
name: 'category',
|
|
312
|
+
message: 'category',
|
|
313
|
+
required: false,
|
|
314
|
+
skipPrompt: true,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
type: 'json',
|
|
318
|
+
name: 'checkExpr',
|
|
319
|
+
message: 'checkExpr',
|
|
320
|
+
required: false,
|
|
321
|
+
skipPrompt: true,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
type: 'text',
|
|
325
|
+
name: 'databaseId',
|
|
326
|
+
message: 'databaseId',
|
|
327
|
+
required: false,
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
type: 'json',
|
|
331
|
+
name: 'defaultExpr',
|
|
332
|
+
message: 'defaultExpr',
|
|
333
|
+
required: false,
|
|
334
|
+
skipPrompt: true,
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
type: 'text',
|
|
338
|
+
name: 'description',
|
|
339
|
+
message: 'description',
|
|
340
|
+
required: false,
|
|
341
|
+
skipPrompt: true,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
type: 'text',
|
|
345
|
+
name: 'label',
|
|
346
|
+
message: 'label',
|
|
347
|
+
required: false,
|
|
348
|
+
skipPrompt: true,
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
type: 'text',
|
|
352
|
+
name: 'name',
|
|
353
|
+
message: 'name',
|
|
354
|
+
required: false,
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
type: 'boolean',
|
|
358
|
+
name: 'notNull',
|
|
359
|
+
message: 'notNull',
|
|
360
|
+
required: false,
|
|
361
|
+
skipPrompt: true,
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
type: 'text',
|
|
365
|
+
name: 'schemaId',
|
|
366
|
+
message: 'schemaId',
|
|
367
|
+
required: false,
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
type: 'json',
|
|
371
|
+
name: 'smartTags',
|
|
372
|
+
message: 'smartTags',
|
|
373
|
+
required: false,
|
|
374
|
+
skipPrompt: true,
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
type: 'text',
|
|
378
|
+
name: 'tags',
|
|
379
|
+
message: 'tags',
|
|
380
|
+
required: false,
|
|
381
|
+
skipPrompt: true,
|
|
382
|
+
},
|
|
383
|
+
]);
|
|
384
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
385
|
+
const cleanedData = stripUndefined(answers, fieldSchema);
|
|
386
|
+
const client = getClient();
|
|
387
|
+
const result = await client.domainType
|
|
388
|
+
.update({
|
|
389
|
+
where: {
|
|
390
|
+
id: answers.id,
|
|
391
|
+
},
|
|
392
|
+
data: {
|
|
393
|
+
baseType: cleanedData.baseType,
|
|
394
|
+
category: cleanedData.category,
|
|
395
|
+
checkExpr: cleanedData.checkExpr,
|
|
396
|
+
databaseId: cleanedData.databaseId,
|
|
397
|
+
defaultExpr: cleanedData.defaultExpr,
|
|
398
|
+
description: cleanedData.description,
|
|
399
|
+
label: cleanedData.label,
|
|
400
|
+
name: cleanedData.name,
|
|
401
|
+
notNull: cleanedData.notNull,
|
|
402
|
+
schemaId: cleanedData.schemaId,
|
|
403
|
+
smartTags: cleanedData.smartTags,
|
|
404
|
+
tags: cleanedData.tags,
|
|
405
|
+
},
|
|
406
|
+
select: {
|
|
407
|
+
baseType: true,
|
|
408
|
+
category: true,
|
|
409
|
+
checkExpr: true,
|
|
410
|
+
databaseId: true,
|
|
411
|
+
defaultExpr: true,
|
|
412
|
+
description: true,
|
|
413
|
+
id: true,
|
|
414
|
+
label: true,
|
|
415
|
+
name: true,
|
|
416
|
+
notNull: true,
|
|
417
|
+
schemaId: true,
|
|
418
|
+
smartTags: true,
|
|
419
|
+
tags: true,
|
|
420
|
+
},
|
|
421
|
+
})
|
|
422
|
+
.execute();
|
|
423
|
+
console.log(JSON.stringify(result, null, 2));
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
console.error('Failed to update record.');
|
|
427
|
+
if (error instanceof Error) {
|
|
428
|
+
console.error(error.message);
|
|
429
|
+
}
|
|
430
|
+
process.exit(1);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
async function handleDelete(argv, prompter) {
|
|
434
|
+
try {
|
|
435
|
+
const rawAnswers = await prompter.prompt(argv, [
|
|
436
|
+
{
|
|
437
|
+
type: 'text',
|
|
438
|
+
name: 'id',
|
|
439
|
+
message: 'id',
|
|
440
|
+
required: true,
|
|
441
|
+
},
|
|
442
|
+
]);
|
|
443
|
+
const answers = coerceAnswers(rawAnswers, fieldSchema);
|
|
444
|
+
const client = getClient();
|
|
445
|
+
const result = await client.domainType
|
|
446
|
+
.delete({
|
|
447
|
+
where: {
|
|
448
|
+
id: answers.id,
|
|
449
|
+
},
|
|
450
|
+
select: {
|
|
451
|
+
id: true,
|
|
452
|
+
},
|
|
453
|
+
})
|
|
454
|
+
.execute();
|
|
455
|
+
console.log(JSON.stringify(result, null, 2));
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
console.error('Failed to delete record.');
|
|
459
|
+
if (error instanceof Error) {
|
|
460
|
+
console.error(error.message);
|
|
461
|
+
}
|
|
462
|
+
process.exit(1);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
@@ -21,6 +21,7 @@ const fieldSchema = {
|
|
|
21
21
|
partitioned: 'boolean',
|
|
22
22
|
peoplestamps: 'boolean',
|
|
23
23
|
pluralName: 'string',
|
|
24
|
+
principalstamps: 'boolean',
|
|
24
25
|
schemaId: 'uuid',
|
|
25
26
|
singularName: 'string',
|
|
26
27
|
smartTags: 'json',
|
|
@@ -86,6 +87,7 @@ async function handleList(argv, _prompter) {
|
|
|
86
87
|
partitioned: true,
|
|
87
88
|
peoplestamps: true,
|
|
88
89
|
pluralName: true,
|
|
90
|
+
principalstamps: true,
|
|
89
91
|
schemaId: true,
|
|
90
92
|
singularName: true,
|
|
91
93
|
smartTags: true,
|
|
@@ -125,6 +127,7 @@ async function handleFindFirst(argv, _prompter) {
|
|
|
125
127
|
partitioned: true,
|
|
126
128
|
peoplestamps: true,
|
|
127
129
|
pluralName: true,
|
|
130
|
+
principalstamps: true,
|
|
128
131
|
schemaId: true,
|
|
129
132
|
singularName: true,
|
|
130
133
|
smartTags: true,
|
|
@@ -176,6 +179,7 @@ async function handleGet(argv, prompter) {
|
|
|
176
179
|
partitioned: true,
|
|
177
180
|
peoplestamps: true,
|
|
178
181
|
pluralName: true,
|
|
182
|
+
principalstamps: true,
|
|
179
183
|
schemaId: true,
|
|
180
184
|
singularName: true,
|
|
181
185
|
smartTags: true,
|
|
@@ -283,6 +287,13 @@ async function handleCreate(argv, prompter) {
|
|
|
283
287
|
required: false,
|
|
284
288
|
skipPrompt: true,
|
|
285
289
|
},
|
|
290
|
+
{
|
|
291
|
+
type: 'boolean',
|
|
292
|
+
name: 'principalstamps',
|
|
293
|
+
message: 'principalstamps',
|
|
294
|
+
required: false,
|
|
295
|
+
skipPrompt: true,
|
|
296
|
+
},
|
|
286
297
|
{
|
|
287
298
|
type: 'text',
|
|
288
299
|
name: 'schemaId',
|
|
@@ -350,6 +361,7 @@ async function handleCreate(argv, prompter) {
|
|
|
350
361
|
partitioned: cleanedData.partitioned,
|
|
351
362
|
peoplestamps: cleanedData.peoplestamps,
|
|
352
363
|
pluralName: cleanedData.pluralName,
|
|
364
|
+
principalstamps: cleanedData.principalstamps,
|
|
353
365
|
schemaId: cleanedData.schemaId,
|
|
354
366
|
singularName: cleanedData.singularName,
|
|
355
367
|
smartTags: cleanedData.smartTags,
|
|
@@ -373,6 +385,7 @@ async function handleCreate(argv, prompter) {
|
|
|
373
385
|
partitioned: true,
|
|
374
386
|
peoplestamps: true,
|
|
375
387
|
pluralName: true,
|
|
388
|
+
principalstamps: true,
|
|
376
389
|
schemaId: true,
|
|
377
390
|
singularName: true,
|
|
378
391
|
smartTags: true,
|
|
@@ -486,6 +499,13 @@ async function handleUpdate(argv, prompter) {
|
|
|
486
499
|
required: false,
|
|
487
500
|
skipPrompt: true,
|
|
488
501
|
},
|
|
502
|
+
{
|
|
503
|
+
type: 'boolean',
|
|
504
|
+
name: 'principalstamps',
|
|
505
|
+
message: 'principalstamps',
|
|
506
|
+
required: false,
|
|
507
|
+
skipPrompt: true,
|
|
508
|
+
},
|
|
489
509
|
{
|
|
490
510
|
type: 'text',
|
|
491
511
|
name: 'schemaId',
|
|
@@ -556,6 +576,7 @@ async function handleUpdate(argv, prompter) {
|
|
|
556
576
|
partitioned: cleanedData.partitioned,
|
|
557
577
|
peoplestamps: cleanedData.peoplestamps,
|
|
558
578
|
pluralName: cleanedData.pluralName,
|
|
579
|
+
principalstamps: cleanedData.principalstamps,
|
|
559
580
|
schemaId: cleanedData.schemaId,
|
|
560
581
|
singularName: cleanedData.singularName,
|
|
561
582
|
smartTags: cleanedData.smartTags,
|
|
@@ -579,6 +600,7 @@ async function handleUpdate(argv, prompter) {
|
|
|
579
600
|
partitioned: true,
|
|
580
601
|
peoplestamps: true,
|
|
581
602
|
pluralName: true,
|
|
603
|
+
principalstamps: true,
|
|
582
604
|
schemaId: true,
|
|
583
605
|
singularName: true,
|
|
584
606
|
smartTags: true,
|
package/esm/api/cli/commands.js
CHANGED
|
@@ -7,7 +7,6 @@ import { extractFirst } from 'inquirerer';
|
|
|
7
7
|
import contextCmd from './commands/context';
|
|
8
8
|
import authCmd from './commands/auth';
|
|
9
9
|
import apiCmd from './commands/api';
|
|
10
|
-
import apiModuleCmd from './commands/api-module';
|
|
11
10
|
import apiSchemaCmd from './commands/api-schema';
|
|
12
11
|
import apiSettingCmd from './commands/api-setting';
|
|
13
12
|
import astMigrationCmd from './commands/ast-migration';
|
|
@@ -20,6 +19,7 @@ import databaseTransferCmd from './commands/database-transfer';
|
|
|
20
19
|
import defaultPrivilegeCmd from './commands/default-privilege';
|
|
21
20
|
import domainCmd from './commands/domain';
|
|
22
21
|
import domainEventCmd from './commands/domain-event';
|
|
22
|
+
import domainTypeCmd from './commands/domain-type';
|
|
23
23
|
import domainVerificationCmd from './commands/domain-verification';
|
|
24
24
|
import embeddingChunkCmd from './commands/embedding-chunk';
|
|
25
25
|
import enumCmd from './commands/enum';
|
|
@@ -35,7 +35,6 @@ import managedDomainCmd from './commands/managed-domain';
|
|
|
35
35
|
import nodeTypeRegistryCmd from './commands/node-type-registry';
|
|
36
36
|
import partitionCmd from './commands/partition';
|
|
37
37
|
import platformApiCmd from './commands/platform-api';
|
|
38
|
-
import platformApiModuleCmd from './commands/platform-api-module';
|
|
39
38
|
import platformApiSchemaCmd from './commands/platform-api-schema';
|
|
40
39
|
import platformApiSettingCmd from './commands/platform-api-setting';
|
|
41
40
|
import platformCorsSettingCmd from './commands/platform-cors-setting';
|
|
@@ -86,7 +85,6 @@ const createCommandMap = () => ({
|
|
|
86
85
|
context: contextCmd,
|
|
87
86
|
auth: authCmd,
|
|
88
87
|
api: apiCmd,
|
|
89
|
-
'api-module': apiModuleCmd,
|
|
90
88
|
'api-schema': apiSchemaCmd,
|
|
91
89
|
'api-setting': apiSettingCmd,
|
|
92
90
|
'ast-migration': astMigrationCmd,
|
|
@@ -99,6 +97,7 @@ const createCommandMap = () => ({
|
|
|
99
97
|
'default-privilege': defaultPrivilegeCmd,
|
|
100
98
|
domain: domainCmd,
|
|
101
99
|
'domain-event': domainEventCmd,
|
|
100
|
+
'domain-type': domainTypeCmd,
|
|
102
101
|
'domain-verification': domainVerificationCmd,
|
|
103
102
|
'embedding-chunk': embeddingChunkCmd,
|
|
104
103
|
enum: enumCmd,
|
|
@@ -114,7 +113,6 @@ const createCommandMap = () => ({
|
|
|
114
113
|
'node-type-registry': nodeTypeRegistryCmd,
|
|
115
114
|
partition: partitionCmd,
|
|
116
115
|
'platform-api': platformApiCmd,
|
|
117
|
-
'platform-api-module': platformApiModuleCmd,
|
|
118
116
|
'platform-api-schema': platformApiSchemaCmd,
|
|
119
117
|
'platform-api-setting': platformApiSettingCmd,
|
|
120
118
|
'platform-cors-setting': platformCorsSettingCmd,
|
|
@@ -162,7 +160,7 @@ const createCommandMap = () => ({
|
|
|
162
160
|
'request-database': requestDatabaseCmd,
|
|
163
161
|
'set-field-order': setFieldOrderCmd,
|
|
164
162
|
});
|
|
165
|
-
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n api api CRUD operations\n api-
|
|
163
|
+
const usage = "\ncsdk <command>\n\nCommands:\n context Manage API contexts\n auth Manage authentication\n api api CRUD operations\n api-schema apiSchema CRUD operations\n api-setting apiSetting CRUD operations\n ast-migration astMigration CRUD operations\n check-constraint checkConstraint CRUD operations\n composite-type compositeType CRUD operations\n cors-setting corsSetting CRUD operations\n database database CRUD operations\n database-setting databaseSetting CRUD operations\n database-transfer databaseTransfer CRUD operations\n default-privilege defaultPrivilege CRUD operations\n domain domain CRUD operations\n domain-event domainEvent CRUD operations\n domain-type domainType CRUD operations\n domain-verification domainVerification CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n enum enum CRUD operations\n exclusion-constraint exclusionConstraint CRUD operations\n field field CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n function function CRUD operations\n hostname-binding hostnameBinding CRUD operations\n http-route httpRoute CRUD operations\n index index CRUD operations\n managed-domain managedDomain CRUD operations\n node-type-registry nodeTypeRegistry CRUD operations\n partition partition CRUD operations\n platform-api platformApi CRUD operations\n platform-api-schema platformApiSchema CRUD operations\n platform-api-setting platformApiSetting CRUD operations\n platform-cors-setting platformCorsSetting CRUD operations\n platform-domain platformDomain CRUD operations\n platform-domain-event platformDomainEvent CRUD operations\n platform-domain-verification platformDomainVerification CRUD operations\n platform-managed-domain platformManagedDomain CRUD operations\n platform-site platformSite CRUD operations\n platform-site-metadatum platformSiteMetadatum CRUD operations\n platform-site-module platformSiteModule CRUD operations\n platform-site-theme platformSiteTheme CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n pubkey-setting pubkeySetting CRUD operations\n rls-setting rlsSetting CRUD operations\n route-binding routeBinding CRUD operations\n route route CRUD operations\n schema schema CRUD operations\n schema-grant schemaGrant CRUD operations\n site site CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n spatial-relation spatialRelation CRUD operations\n sql-action sqlAction CRUD operations\n table table CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n trigger-function triggerFunction CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n view-table viewTable CRUD operations\n webauthn-setting webauthnSetting CRUD operations\n api-schema-names apiSchemaNames\n apply-registry-defaults applyRegistryDefaults\n resolve-http-route resolveHttpRoute\n resolve-route resolveRoute\n accept-database-transfer acceptDatabaseTransfer\n apply-rls applyRls\n cancel-database-transfer cancelDatabaseTransfer\n provision-bucket Provision an S3 bucket for a logical bucket in the database.\nReads the bucket config via RLS, then creates and configures\nthe S3 bucket with the appropriate privacy policies, CORS rules,\nand lifecycle settings.\n reject-database-transfer rejectDatabaseTransfer\n request-database Requests a database and returns a ticket (database_provision_module row) to poll.\n\nPass exactly one of preset_slug or modules. The pool, presets, and owner bootstrap are private implementation details: a warm pool hit fulfills the ticket immediately (fulfilled_at set, deferred owner bootstrap), otherwise the database is cold-provisioned asynchronously with exactly the requested modules. Poll the ticket until status = 'completed'; it then carries database_id and fulfilled_at.\n\nExample usage:\n SELECT * FROM metaschema_public.request_database('my_app', 'example.com', preset_slug := 'full');\n SELECT * FROM metaschema_public.request_database('my_app', 'example.com', modules := '[\"users_module\", \"emails_module\"]'::jsonb);\n set-field-order setFieldOrder\n\n --help, -h Show this help message\n --version, -v Show version\n";
|
|
166
164
|
export const commands = async (argv, prompter, options) => {
|
|
167
165
|
if (argv.help || argv.h) {
|
|
168
166
|
console.log(usage);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const getStore: () => import("appstash").ConfigStore;
|
|
2
2
|
export declare function getClient(contextName?: string): {
|
|
3
3
|
api: import("..").ApiModel;
|
|
4
|
-
apiModule: import("..").ApiModuleModel;
|
|
5
4
|
apiSchema: import("..").ApiSchemaModel;
|
|
6
5
|
apiSetting: import("..").ApiSettingModel;
|
|
7
6
|
astMigration: import("..").AstMigrationModel;
|
|
@@ -14,6 +13,7 @@ export declare function getClient(contextName?: string): {
|
|
|
14
13
|
defaultPrivilege: import("..").DefaultPrivilegeModel;
|
|
15
14
|
domain: import("..").DomainModel;
|
|
16
15
|
domainEvent: import("..").DomainEventModel;
|
|
16
|
+
domainType: import("..").DomainTypeModel;
|
|
17
17
|
domainVerification: import("..").DomainVerificationModel;
|
|
18
18
|
embeddingChunk: import("..").EmbeddingChunkModel;
|
|
19
19
|
enum: import("..").EnumModel;
|
|
@@ -29,7 +29,6 @@ export declare function getClient(contextName?: string): {
|
|
|
29
29
|
nodeTypeRegistry: import("..").NodeTypeRegistryModel;
|
|
30
30
|
partition: import("..").PartitionModel;
|
|
31
31
|
platformApi: import("..").PlatformApiModel;
|
|
32
|
-
platformApiModule: import("..").PlatformApiModuleModel;
|
|
33
32
|
platformApiSchema: import("..").PlatformApiSchemaModel;
|
|
34
33
|
platformApiSetting: import("..").PlatformApiSettingModel;
|
|
35
34
|
platformCorsSetting: import("..").PlatformCorsSettingModel;
|