@agentuity/cli 1.0.21 → 1.0.23
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/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +7 -0
- package/dist/auth.js.map +1 -1
- package/dist/cache/resource-region.d.ts +1 -1
- package/dist/cache/resource-region.d.ts.map +1 -1
- package/dist/cache/resource-region.js.map +1 -1
- package/dist/cmd/ai/claude-code/install.d.ts.map +1 -1
- package/dist/cmd/ai/claude-code/install.js +0 -1
- package/dist/cmd/ai/claude-code/install.js.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +4 -2
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.js +18 -4
- package/dist/cmd/build/vite/public-asset-path-plugin.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +1 -1
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/email/create.d.ts +3 -0
- package/dist/cmd/cloud/email/create.d.ts.map +1 -0
- package/dist/cmd/cloud/email/create.js +58 -0
- package/dist/cmd/cloud/email/create.js.map +1 -0
- package/dist/cmd/cloud/email/delete.d.ts +3 -0
- package/dist/cmd/cloud/email/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/email/delete.js +47 -0
- package/dist/cmd/cloud/email/delete.js.map +1 -0
- package/dist/cmd/cloud/email/destination/delete.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/delete.js +54 -0
- package/dist/cmd/cloud/email/destination/delete.js.map +1 -0
- package/dist/cmd/cloud/email/destination/index.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/index.js +14 -0
- package/dist/cmd/cloud/email/destination/index.js.map +1 -0
- package/dist/cmd/cloud/email/destination/list.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/list.js +39 -0
- package/dist/cmd/cloud/email/destination/list.js.map +1 -0
- package/dist/cmd/cloud/email/destination/schemas.d.ts +9 -0
- package/dist/cmd/cloud/email/destination/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/schemas.js +9 -0
- package/dist/cmd/cloud/email/destination/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/destination/url.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/url.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/url.js +64 -0
- package/dist/cmd/cloud/email/destination/url.js.map +1 -0
- package/dist/cmd/cloud/email/get.d.ts +3 -0
- package/dist/cmd/cloud/email/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/get.js +43 -0
- package/dist/cmd/cloud/email/get.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/get.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/get.js +44 -0
- package/dist/cmd/cloud/email/inbound/get.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/index.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/index.js +12 -0
- package/dist/cmd/cloud/email/inbound/index.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/list.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/list.js +43 -0
- package/dist/cmd/cloud/email/inbound/list.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/schemas.d.ts +11 -0
- package/dist/cmd/cloud/email/inbound/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/schemas.js +11 -0
- package/dist/cmd/cloud/email/inbound/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/index.d.ts +3 -0
- package/dist/cmd/cloud/email/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/index.js +28 -0
- package/dist/cmd/cloud/email/index.js.map +1 -0
- package/dist/cmd/cloud/email/list.d.ts +3 -0
- package/dist/cmd/cloud/email/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/list.js +37 -0
- package/dist/cmd/cloud/email/list.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/get.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/get.js +45 -0
- package/dist/cmd/cloud/email/outbound/get.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/index.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/index.js +12 -0
- package/dist/cmd/cloud/email/outbound/index.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/list.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/list.js +43 -0
- package/dist/cmd/cloud/email/outbound/list.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/schemas.d.ts +15 -0
- package/dist/cmd/cloud/email/outbound/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/schemas.js +15 -0
- package/dist/cmd/cloud/email/outbound/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/send.d.ts +3 -0
- package/dist/cmd/cloud/email/send.d.ts.map +1 -0
- package/dist/cmd/cloud/email/send.js +77 -0
- package/dist/cmd/cloud/email/send.js.map +1 -0
- package/dist/cmd/cloud/email/util.d.ts +26 -0
- package/dist/cmd/cloud/email/util.d.ts.map +1 -0
- package/dist/cmd/cloud/email/util.js +57 -0
- package/dist/cmd/cloud/email/util.js.map +1 -0
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +8 -0
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts.map +1 -1
- package/dist/cmd/cloud/region-lookup.js +44 -2
- package/dist/cmd/cloud/region-lookup.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts +7 -0
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +46 -28
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.js +5 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.js.map +1 -1
- package/dist/cmd/cloud/schedule/create.d.ts +3 -0
- package/dist/cmd/cloud/schedule/create.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/create.js +72 -0
- package/dist/cmd/cloud/schedule/create.js.map +1 -0
- package/dist/cmd/cloud/schedule/delete.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delete.js +38 -0
- package/dist/cmd/cloud/schedule/delete.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/get.js +78 -0
- package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/index.js +23 -0
- package/dist/cmd/cloud/schedule/delivery/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/list.js +67 -0
- package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/create.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/create.js +97 -0
- package/dist/cmd/cloud/schedule/destination/create.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/delete.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/delete.js +41 -0
- package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/get.js +57 -0
- package/dist/cmd/cloud/schedule/destination/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/index.js +26 -0
- package/dist/cmd/cloud/schedule/destination/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/list.js +58 -0
- package/dist/cmd/cloud/schedule/destination/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/get.js +76 -0
- package/dist/cmd/cloud/schedule/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/index.js +35 -0
- package/dist/cmd/cloud/schedule/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/list.js +60 -0
- package/dist/cmd/cloud/schedule/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/update.d.ts +3 -0
- package/dist/cmd/cloud/schedule/update.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/update.js +65 -0
- package/dist/cmd/cloud/schedule/update.js.map +1 -0
- package/dist/cmd/cloud/schedule/util.d.ts +11 -0
- package/dist/cmd/cloud/schedule/util.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/util.js +17 -0
- package/dist/cmd/cloud/schedule/util.js.map +1 -0
- package/dist/cmd/cloud/task/create.d.ts +3 -0
- package/dist/cmd/cloud/task/create.d.ts.map +1 -0
- package/dist/cmd/cloud/task/create.js +108 -0
- package/dist/cmd/cloud/task/create.js.map +1 -0
- package/dist/cmd/cloud/task/get.d.ts +3 -0
- package/dist/cmd/cloud/task/get.d.ts.map +1 -0
- package/dist/cmd/cloud/task/get.js +124 -0
- package/dist/cmd/cloud/task/get.js.map +1 -0
- package/dist/cmd/cloud/task/index.d.ts +3 -0
- package/dist/cmd/cloud/task/index.d.ts.map +1 -0
- package/dist/cmd/cloud/task/index.js +33 -0
- package/dist/cmd/cloud/task/index.js.map +1 -0
- package/dist/cmd/cloud/task/list.d.ts +3 -0
- package/dist/cmd/cloud/task/list.d.ts.map +1 -0
- package/dist/cmd/cloud/task/list.js +174 -0
- package/dist/cmd/cloud/task/list.js.map +1 -0
- package/dist/cmd/cloud/task/update.d.ts +3 -0
- package/dist/cmd/cloud/task/update.d.ts.map +1 -0
- package/dist/cmd/cloud/task/update.js +118 -0
- package/dist/cmd/cloud/task/update.js.map +1 -0
- package/dist/cmd/cloud/task/util.d.ts +18 -0
- package/dist/cmd/cloud/task/util.d.ts.map +1 -0
- package/dist/cmd/cloud/task/util.js +45 -0
- package/dist/cmd/cloud/task/util.js.map +1 -0
- package/dist/cmd/cloud/webhook/create.d.ts +3 -0
- package/dist/cmd/cloud/webhook/create.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/create.js +54 -0
- package/dist/cmd/cloud/webhook/create.js.map +1 -0
- package/dist/cmd/cloud/webhook/delete.d.ts +3 -0
- package/dist/cmd/cloud/webhook/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/delete.js +50 -0
- package/dist/cmd/cloud/webhook/delete.js.map +1 -0
- package/dist/cmd/cloud/webhook/deliveries.d.ts +3 -0
- package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/deliveries.js +123 -0
- package/dist/cmd/cloud/webhook/deliveries.js.map +1 -0
- package/dist/cmd/cloud/webhook/destinations.d.ts +3 -0
- package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/destinations.js +212 -0
- package/dist/cmd/cloud/webhook/destinations.js.map +1 -0
- package/dist/cmd/cloud/webhook/get.d.ts +3 -0
- package/dist/cmd/cloud/webhook/get.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/get.js +50 -0
- package/dist/cmd/cloud/webhook/get.js.map +1 -0
- package/dist/cmd/cloud/webhook/index.d.ts +3 -0
- package/dist/cmd/cloud/webhook/index.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/index.js +45 -0
- package/dist/cmd/cloud/webhook/index.js.map +1 -0
- package/dist/cmd/cloud/webhook/list.d.ts +3 -0
- package/dist/cmd/cloud/webhook/list.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/list.js +72 -0
- package/dist/cmd/cloud/webhook/list.js.map +1 -0
- package/dist/cmd/cloud/webhook/receipts.d.ts +3 -0
- package/dist/cmd/cloud/webhook/receipts.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/receipts.js +128 -0
- package/dist/cmd/cloud/webhook/receipts.js.map +1 -0
- package/dist/cmd/cloud/webhook/util.d.ts +27 -0
- package/dist/cmd/cloud/webhook/util.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/util.js +20 -0
- package/dist/cmd/cloud/webhook/util.js.map +1 -0
- package/dist/cmd/project/add/domain.d.ts.map +1 -1
- package/dist/cmd/project/add/domain.js +6 -4
- package/dist/cmd/project/add/domain.js.map +1 -1
- package/dist/cmd/project/domain/check.d.ts.map +1 -1
- package/dist/cmd/project/domain/check.js +10 -5
- package/dist/cmd/project/domain/check.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +2 -1
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/domain.d.ts +3 -2
- package/dist/domain.d.ts.map +1 -1
- package/dist/domain.js +87 -21
- package/dist/domain.js.map +1 -1
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -2
- package/dist/types.js.map +1 -1
- package/dist/version-check.d.ts.map +1 -1
- package/dist/version-check.js +18 -3
- package/dist/version-check.js.map +1 -1
- package/package.json +6 -6
- package/src/auth.ts +7 -0
- package/src/cache/resource-region.ts +4 -1
- package/src/cmd/ai/claude-code/install.ts +0 -3
- package/src/cmd/build/vite/public-asset-path-plugin.ts +18 -4
- package/src/cmd/cloud/deploy.ts +1 -0
- package/src/cmd/cloud/email/create.ts +70 -0
- package/src/cmd/cloud/email/delete.ts +53 -0
- package/src/cmd/cloud/email/destination/delete.ts +65 -0
- package/src/cmd/cloud/email/destination/index.ts +15 -0
- package/src/cmd/cloud/email/destination/list.ts +46 -0
- package/src/cmd/cloud/email/destination/schemas.ts +9 -0
- package/src/cmd/cloud/email/destination/url.ts +75 -0
- package/src/cmd/cloud/email/get.ts +52 -0
- package/src/cmd/cloud/email/inbound/get.ts +53 -0
- package/src/cmd/cloud/email/inbound/index.ts +13 -0
- package/src/cmd/cloud/email/inbound/list.ts +50 -0
- package/src/cmd/cloud/email/inbound/schemas.ts +11 -0
- package/src/cmd/cloud/email/index.ts +29 -0
- package/src/cmd/cloud/email/list.ts +44 -0
- package/src/cmd/cloud/email/outbound/get.ts +54 -0
- package/src/cmd/cloud/email/outbound/index.ts +13 -0
- package/src/cmd/cloud/email/outbound/list.ts +50 -0
- package/src/cmd/cloud/email/outbound/schemas.ts +15 -0
- package/src/cmd/cloud/email/send.ts +91 -0
- package/src/cmd/cloud/email/util.ts +89 -0
- package/src/cmd/cloud/index.ts +8 -0
- package/src/cmd/cloud/region-lookup.ts +58 -2
- package/src/cmd/cloud/sandbox/snapshot/build.ts +59 -55
- package/src/cmd/cloud/sandbox/snapshot/generate.ts +5 -1
- package/src/cmd/cloud/schedule/create.ts +83 -0
- package/src/cmd/cloud/schedule/delete.ts +43 -0
- package/src/cmd/cloud/schedule/delivery/get.ts +85 -0
- package/src/cmd/cloud/schedule/delivery/index.ts +24 -0
- package/src/cmd/cloud/schedule/delivery/list.ts +82 -0
- package/src/cmd/cloud/schedule/destination/create.ts +110 -0
- package/src/cmd/cloud/schedule/destination/delete.ts +46 -0
- package/src/cmd/cloud/schedule/destination/get.ts +66 -0
- package/src/cmd/cloud/schedule/destination/index.ts +27 -0
- package/src/cmd/cloud/schedule/destination/list.ts +72 -0
- package/src/cmd/cloud/schedule/get.ts +92 -0
- package/src/cmd/cloud/schedule/index.ts +36 -0
- package/src/cmd/cloud/schedule/list.ts +78 -0
- package/src/cmd/cloud/schedule/update.ts +74 -0
- package/src/cmd/cloud/schedule/util.ts +34 -0
- package/src/cmd/cloud/task/create.ts +124 -0
- package/src/cmd/cloud/task/get.ts +138 -0
- package/src/cmd/cloud/task/index.ts +34 -0
- package/src/cmd/cloud/task/list.ts +191 -0
- package/src/cmd/cloud/task/update.ts +123 -0
- package/src/cmd/cloud/task/util.ts +74 -0
- package/src/cmd/cloud/webhook/create.ts +66 -0
- package/src/cmd/cloud/webhook/delete.ts +57 -0
- package/src/cmd/cloud/webhook/deliveries.ts +149 -0
- package/src/cmd/cloud/webhook/destinations.ts +274 -0
- package/src/cmd/cloud/webhook/get.ts +59 -0
- package/src/cmd/cloud/webhook/index.ts +46 -0
- package/src/cmd/cloud/webhook/list.ts +82 -0
- package/src/cmd/cloud/webhook/receipts.ts +157 -0
- package/src/cmd/cloud/webhook/util.ts +35 -0
- package/src/cmd/project/add/domain.ts +10 -4
- package/src/cmd/project/domain/check.ts +16 -5
- package/src/cmd/project/template-flow.ts +2 -1
- package/src/domain.ts +96 -21
- package/src/types.ts +3 -1
- package/src/version-check.ts +22 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const ScheduleDeleteResponseSchema = z.object({
|
|
8
|
+
success: z.boolean(),
|
|
9
|
+
schedule_id: z.string(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const deleteSubcommand = createCommand({
|
|
13
|
+
name: 'delete',
|
|
14
|
+
aliases: ['rm'],
|
|
15
|
+
description: 'Delete a schedule',
|
|
16
|
+
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
17
|
+
requires: { auth: true, region: true },
|
|
18
|
+
optional: { project: true },
|
|
19
|
+
idempotent: true,
|
|
20
|
+
examples: [
|
|
21
|
+
{ command: getCommand('cloud schedule delete sched_abc123'), description: 'Delete a schedule' },
|
|
22
|
+
],
|
|
23
|
+
schema: {
|
|
24
|
+
args: z.object({
|
|
25
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
26
|
+
}),
|
|
27
|
+
response: ScheduleDeleteResponseSchema,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
async handler(ctx) {
|
|
31
|
+
const { args, options } = ctx;
|
|
32
|
+
const schedule = createScheduleAdapter(ctx);
|
|
33
|
+
await schedule.delete(args.schedule_id);
|
|
34
|
+
|
|
35
|
+
if (!options.json) {
|
|
36
|
+
tui.success(`Deleted schedule: ${args.schedule_id}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return { success: true, schedule_id: args.schedule_id };
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default deleteSubcommand;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const DeliveryGetResponseSchema = z.object({
|
|
8
|
+
delivery: z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
date: z.string(),
|
|
11
|
+
schedule_id: z.string(),
|
|
12
|
+
schedule_destination_id: z.string(),
|
|
13
|
+
status: z.enum(['pending', 'success', 'failed']),
|
|
14
|
+
retries: z.number(),
|
|
15
|
+
error: z.string().nullable(),
|
|
16
|
+
response: z.record(z.string(), z.unknown()).nullable(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const getSubcommand = createCommand({
|
|
21
|
+
name: 'get',
|
|
22
|
+
description: 'Get delivery details',
|
|
23
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
24
|
+
requires: { auth: true, region: true },
|
|
25
|
+
optional: { project: true },
|
|
26
|
+
idempotent: true,
|
|
27
|
+
examples: [
|
|
28
|
+
{
|
|
29
|
+
command: getCommand('cloud schedule delivery get sched_abc123 sdel_abc456'),
|
|
30
|
+
description: 'Get delivery details',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
schema: {
|
|
34
|
+
args: z.object({
|
|
35
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
36
|
+
delivery_id: z.string().min(1).describe('Delivery ID'),
|
|
37
|
+
}),
|
|
38
|
+
options: z.object({
|
|
39
|
+
limit: z.coerce
|
|
40
|
+
.number()
|
|
41
|
+
.min(0)
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Maximum number of deliveries to scan while filtering'),
|
|
44
|
+
offset: z.coerce
|
|
45
|
+
.number()
|
|
46
|
+
.min(0)
|
|
47
|
+
.optional()
|
|
48
|
+
.describe('Offset while scanning deliveries for filtering'),
|
|
49
|
+
}),
|
|
50
|
+
response: DeliveryGetResponseSchema,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
async handler(ctx) {
|
|
54
|
+
const { args, opts, options } = ctx;
|
|
55
|
+
const schedule = createScheduleAdapter(ctx);
|
|
56
|
+
const delivery = await schedule.getDelivery(args.schedule_id, args.delivery_id, {
|
|
57
|
+
limit: opts.limit,
|
|
58
|
+
offset: opts.offset,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (!options.json) {
|
|
62
|
+
const details: Record<string, unknown> = {
|
|
63
|
+
ID: delivery.id,
|
|
64
|
+
'Schedule ID': delivery.schedule_id,
|
|
65
|
+
'Destination ID': delivery.schedule_destination_id,
|
|
66
|
+
Date: new Date(delivery.date).toLocaleString(),
|
|
67
|
+
Status: delivery.status,
|
|
68
|
+
Retries: delivery.retries,
|
|
69
|
+
Error: delivery.error ?? '-',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
tui.table([details], undefined, { layout: 'vertical' });
|
|
73
|
+
|
|
74
|
+
if (delivery.response) {
|
|
75
|
+
tui.newline();
|
|
76
|
+
tui.info('Response');
|
|
77
|
+
tui.json(delivery.response);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return { delivery };
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export default getSubcommand;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createCommand } from '../../../../types';
|
|
2
|
+
import { listSubcommand } from './list';
|
|
3
|
+
import { getSubcommand } from './get';
|
|
4
|
+
import { getCommand } from '../../../../command-prefix';
|
|
5
|
+
|
|
6
|
+
export const command = createCommand({
|
|
7
|
+
name: 'delivery',
|
|
8
|
+
description: 'Manage schedule delivery attempts',
|
|
9
|
+
tags: ['requires-auth'],
|
|
10
|
+
requires: { auth: true },
|
|
11
|
+
subcommands: [listSubcommand, getSubcommand],
|
|
12
|
+
examples: [
|
|
13
|
+
{
|
|
14
|
+
command: getCommand('cloud schedule delivery list sched_abc123'),
|
|
15
|
+
description: 'List deliveries for schedule',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
command: getCommand('cloud schedule delivery get sched_abc123 sdel_abc456'),
|
|
19
|
+
description: 'Get delivery details',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default command;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const DeliveryListResponseSchema = z.object({
|
|
8
|
+
deliveries: z.array(
|
|
9
|
+
z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
date: z.string(),
|
|
12
|
+
schedule_id: z.string(),
|
|
13
|
+
schedule_destination_id: z.string(),
|
|
14
|
+
status: z.enum(['pending', 'success', 'failed']),
|
|
15
|
+
retries: z.number(),
|
|
16
|
+
error: z.string().nullable(),
|
|
17
|
+
response: z.record(z.string(), z.unknown()).nullable(),
|
|
18
|
+
})
|
|
19
|
+
),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const listSubcommand = createCommand({
|
|
23
|
+
name: 'list',
|
|
24
|
+
aliases: ['ls'],
|
|
25
|
+
description: 'List deliveries for a schedule',
|
|
26
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
27
|
+
requires: { auth: true, region: true },
|
|
28
|
+
optional: { project: true },
|
|
29
|
+
idempotent: true,
|
|
30
|
+
examples: [
|
|
31
|
+
{
|
|
32
|
+
command: getCommand('cloud schedule delivery list sched_abc123 --limit 50'),
|
|
33
|
+
description: 'List schedule deliveries',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
schema: {
|
|
37
|
+
args: z.object({
|
|
38
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
39
|
+
}),
|
|
40
|
+
options: z.object({
|
|
41
|
+
limit: z.coerce.number().min(0).optional().describe('Maximum number of deliveries'),
|
|
42
|
+
offset: z.coerce.number().min(0).optional().describe('Pagination offset'),
|
|
43
|
+
}),
|
|
44
|
+
response: DeliveryListResponseSchema,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
async handler(ctx) {
|
|
48
|
+
const { args, opts, options } = ctx;
|
|
49
|
+
const schedule = createScheduleAdapter(ctx);
|
|
50
|
+
const result = await schedule.listDeliveries(args.schedule_id, {
|
|
51
|
+
limit: opts.limit,
|
|
52
|
+
offset: opts.offset,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (!options.json) {
|
|
56
|
+
if (result.deliveries.length === 0) {
|
|
57
|
+
tui.info('No deliveries found');
|
|
58
|
+
} else {
|
|
59
|
+
tui.table(
|
|
60
|
+
result.deliveries.map((delivery: {
|
|
61
|
+
id: string;
|
|
62
|
+
date: string;
|
|
63
|
+
status: 'pending' | 'success' | 'failed';
|
|
64
|
+
retries: number;
|
|
65
|
+
schedule_destination_id: string;
|
|
66
|
+
}) => ({
|
|
67
|
+
ID: delivery.id,
|
|
68
|
+
Date: new Date(delivery.date).toLocaleString(),
|
|
69
|
+
Status: delivery.status,
|
|
70
|
+
Retries: delivery.retries,
|
|
71
|
+
'Destination ID': delivery.schedule_destination_id,
|
|
72
|
+
})),
|
|
73
|
+
['ID', 'Date', 'Status', 'Retries', 'Destination ID']
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return result;
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export default listSubcommand;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const CreateDestinationResponseSchema = z.object({
|
|
8
|
+
destination: z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
schedule_id: z.string(),
|
|
11
|
+
created_at: z.string(),
|
|
12
|
+
updated_at: z.string(),
|
|
13
|
+
created_by: z.string(),
|
|
14
|
+
type: z.enum(['url', 'sandbox']),
|
|
15
|
+
config: z.record(z.string(), z.unknown()),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const createSubcommand = createCommand({
|
|
20
|
+
name: 'create',
|
|
21
|
+
description: 'Create destination for a schedule',
|
|
22
|
+
tags: ['mutating', 'creates-resource', 'requires-auth'],
|
|
23
|
+
requires: { auth: true, region: true },
|
|
24
|
+
optional: { project: true },
|
|
25
|
+
examples: [
|
|
26
|
+
{
|
|
27
|
+
command: getCommand('cloud schedule destination create url sched_abc123 https://example.com'),
|
|
28
|
+
description: 'Create URL destination',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
command: getCommand('cloud schedule destination create url sched_abc123 https://example.com --method POST'),
|
|
32
|
+
description: 'Create URL destination with POST method',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
schema: {
|
|
36
|
+
args: z.object({
|
|
37
|
+
type: z.enum(['url', 'sandbox']).describe('Destination type (url or sandbox)'),
|
|
38
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
39
|
+
target: z.string().min(1).describe('Destination URL or sandbox ID'),
|
|
40
|
+
}),
|
|
41
|
+
options: z.object({
|
|
42
|
+
method: z.string().optional().describe('HTTP method for URL destination'),
|
|
43
|
+
timeout: z.coerce.number().optional().describe('Request timeout in milliseconds'),
|
|
44
|
+
config: z.string().optional().describe('Additional config as JSON object'),
|
|
45
|
+
}),
|
|
46
|
+
response: CreateDestinationResponseSchema,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
async handler(ctx) {
|
|
50
|
+
const { args, opts, options } = ctx;
|
|
51
|
+
const schedule = createScheduleAdapter(ctx);
|
|
52
|
+
|
|
53
|
+
if (args.type === 'sandbox' && !args.target.startsWith('sbx_')) {
|
|
54
|
+
tui.fatal('Sandbox target must start with "sbx_"');
|
|
55
|
+
}
|
|
56
|
+
if (args.type === 'url' && !args.target.startsWith('http://') && !args.target.startsWith('https://')) {
|
|
57
|
+
tui.fatal('URL target must start with http:// or https://');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let parsedConfig: Record<string, unknown> = {};
|
|
61
|
+
if (opts.config) {
|
|
62
|
+
try {
|
|
63
|
+
parsedConfig = JSON.parse(opts.config) as Record<string, unknown>;
|
|
64
|
+
} catch (e) {
|
|
65
|
+
tui.fatal(`Invalid JSON in --config: ${e instanceof Error ? e.message : String(e)}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const config: Record<string, unknown> = {
|
|
70
|
+
...parsedConfig,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if (args.type === 'url') {
|
|
74
|
+
config.url = args.target;
|
|
75
|
+
}
|
|
76
|
+
if (args.type === 'sandbox') {
|
|
77
|
+
config.sandbox_id = args.target;
|
|
78
|
+
}
|
|
79
|
+
if (opts.method && args.type === 'url') {
|
|
80
|
+
config.method = opts.method;
|
|
81
|
+
}
|
|
82
|
+
if (opts.timeout !== undefined && args.type === 'url') {
|
|
83
|
+
config.timeout = opts.timeout;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const result = await schedule.createDestination(args.schedule_id, {
|
|
87
|
+
type: args.type,
|
|
88
|
+
config,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (!options.json) {
|
|
92
|
+
tui.success(`Created destination: ${result.destination.id}`);
|
|
93
|
+
tui.table(
|
|
94
|
+
[
|
|
95
|
+
{
|
|
96
|
+
ID: result.destination.id,
|
|
97
|
+
Type: result.destination.type,
|
|
98
|
+
Config: JSON.stringify(result.destination.config),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
undefined,
|
|
102
|
+
{ layout: 'vertical' }
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return result;
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export default createSubcommand;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const DestinationDeleteResponseSchema = z.object({
|
|
8
|
+
success: z.boolean(),
|
|
9
|
+
destination_id: z.string(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const deleteSubcommand = createCommand({
|
|
13
|
+
name: 'delete',
|
|
14
|
+
aliases: ['rm'],
|
|
15
|
+
description: 'Delete a destination',
|
|
16
|
+
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
17
|
+
requires: { auth: true, region: true },
|
|
18
|
+
optional: { project: true },
|
|
19
|
+
idempotent: true,
|
|
20
|
+
examples: [
|
|
21
|
+
{
|
|
22
|
+
command: getCommand('cloud schedule destination delete sdest_abc456'),
|
|
23
|
+
description: 'Delete destination',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
schema: {
|
|
27
|
+
args: z.object({
|
|
28
|
+
destination_id: z.string().min(1).describe('Destination ID'),
|
|
29
|
+
}),
|
|
30
|
+
response: DestinationDeleteResponseSchema,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
async handler(ctx) {
|
|
34
|
+
const { args, options } = ctx;
|
|
35
|
+
const schedule = createScheduleAdapter(ctx);
|
|
36
|
+
await schedule.deleteDestination(args.destination_id);
|
|
37
|
+
|
|
38
|
+
if (!options.json) {
|
|
39
|
+
tui.success(`Deleted destination: ${args.destination_id}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { success: true, destination_id: args.destination_id };
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export default deleteSubcommand;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const DestinationGetResponseSchema = z.object({
|
|
8
|
+
destination: z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
schedule_id: z.string(),
|
|
11
|
+
created_at: z.string(),
|
|
12
|
+
updated_at: z.string(),
|
|
13
|
+
created_by: z.string(),
|
|
14
|
+
type: z.enum(['url', 'sandbox']),
|
|
15
|
+
config: z.record(z.string(), z.unknown()),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const getSubcommand = createCommand({
|
|
20
|
+
name: 'get',
|
|
21
|
+
description: 'Get destination details',
|
|
22
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
23
|
+
requires: { auth: true, region: true },
|
|
24
|
+
optional: { project: true },
|
|
25
|
+
idempotent: true,
|
|
26
|
+
examples: [
|
|
27
|
+
{
|
|
28
|
+
command: getCommand('cloud schedule destination get sched_abc123 sdest_abc456'),
|
|
29
|
+
description: 'Get destination details',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
schema: {
|
|
33
|
+
args: z.object({
|
|
34
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
35
|
+
destination_id: z.string().min(1).describe('Destination ID'),
|
|
36
|
+
}),
|
|
37
|
+
response: DestinationGetResponseSchema,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
async handler(ctx) {
|
|
41
|
+
const { args, options } = ctx;
|
|
42
|
+
const schedule = createScheduleAdapter(ctx);
|
|
43
|
+
const destination = await schedule.getDestination(args.schedule_id, args.destination_id);
|
|
44
|
+
|
|
45
|
+
if (!options.json) {
|
|
46
|
+
tui.table(
|
|
47
|
+
[
|
|
48
|
+
{
|
|
49
|
+
ID: destination.id,
|
|
50
|
+
'Schedule ID': destination.schedule_id,
|
|
51
|
+
Type: destination.type,
|
|
52
|
+
Config: JSON.stringify(destination.config),
|
|
53
|
+
Created: new Date(destination.created_at).toLocaleString(),
|
|
54
|
+
Updated: new Date(destination.updated_at).toLocaleString(),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
undefined,
|
|
58
|
+
{ layout: 'vertical' }
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return { destination };
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export default getSubcommand;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createCommand } from '../../../../types';
|
|
2
|
+
import { createSubcommand } from './create';
|
|
3
|
+
import { listSubcommand } from './list';
|
|
4
|
+
import { getSubcommand } from './get';
|
|
5
|
+
import { deleteSubcommand } from './delete';
|
|
6
|
+
import { getCommand } from '../../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
export const command = createCommand({
|
|
9
|
+
name: 'destination',
|
|
10
|
+
aliases: ['dest'],
|
|
11
|
+
description: 'Manage schedule destinations',
|
|
12
|
+
tags: ['requires-auth'],
|
|
13
|
+
requires: { auth: true },
|
|
14
|
+
subcommands: [createSubcommand, listSubcommand, getSubcommand, deleteSubcommand],
|
|
15
|
+
examples: [
|
|
16
|
+
{
|
|
17
|
+
command: getCommand('cloud schedule destination list sched_abc123'),
|
|
18
|
+
description: 'List destinations',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
command: getCommand('cloud schedule destination create url sched_abc123 https://example.com'),
|
|
22
|
+
description: 'Create URL destination',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default command;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../../types';
|
|
3
|
+
import * as tui from '../../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from '../util';
|
|
5
|
+
import { getCommand } from '../../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const DestinationListResponseSchema = z.object({
|
|
8
|
+
destinations: z.array(
|
|
9
|
+
z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
schedule_id: z.string(),
|
|
12
|
+
created_at: z.string(),
|
|
13
|
+
updated_at: z.string(),
|
|
14
|
+
created_by: z.string(),
|
|
15
|
+
type: z.enum(['url', 'sandbox']),
|
|
16
|
+
config: z.record(z.string(), z.unknown()),
|
|
17
|
+
})
|
|
18
|
+
),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const listSubcommand = createCommand({
|
|
22
|
+
name: 'list',
|
|
23
|
+
aliases: ['ls'],
|
|
24
|
+
description: 'List destinations for a schedule',
|
|
25
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
26
|
+
requires: { auth: true, region: true },
|
|
27
|
+
optional: { project: true },
|
|
28
|
+
idempotent: true,
|
|
29
|
+
examples: [
|
|
30
|
+
{
|
|
31
|
+
command: getCommand('cloud schedule destination list sched_abc123'),
|
|
32
|
+
description: 'List schedule destinations',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
schema: {
|
|
36
|
+
args: z.object({
|
|
37
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
38
|
+
}),
|
|
39
|
+
response: DestinationListResponseSchema,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
async handler(ctx) {
|
|
43
|
+
const { args, options } = ctx;
|
|
44
|
+
const schedule = createScheduleAdapter(ctx);
|
|
45
|
+
const result = await schedule.get(args.schedule_id);
|
|
46
|
+
|
|
47
|
+
if (!options.json) {
|
|
48
|
+
if (result.destinations.length === 0) {
|
|
49
|
+
tui.info('No destinations configured');
|
|
50
|
+
} else {
|
|
51
|
+
tui.table(
|
|
52
|
+
result.destinations.map((destination: {
|
|
53
|
+
id: string;
|
|
54
|
+
type: 'url' | 'sandbox';
|
|
55
|
+
config: Record<string, unknown>;
|
|
56
|
+
created_at: string;
|
|
57
|
+
}) => ({
|
|
58
|
+
ID: destination.id,
|
|
59
|
+
Type: destination.type,
|
|
60
|
+
Config: JSON.stringify(destination.config),
|
|
61
|
+
Created: new Date(destination.created_at).toLocaleString(),
|
|
62
|
+
})),
|
|
63
|
+
['ID', 'Type', 'Config', 'Created']
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return { destinations: result.destinations };
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export default listSubcommand;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const ScheduleGetResponseSchema = z.object({
|
|
8
|
+
schedule: z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
created_at: z.string(),
|
|
11
|
+
updated_at: z.string(),
|
|
12
|
+
created_by: z.string(),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
description: z.string().nullable(),
|
|
15
|
+
expression: z.string(),
|
|
16
|
+
due_date: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
destinations: z.array(
|
|
19
|
+
z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
schedule_id: z.string(),
|
|
22
|
+
created_at: z.string(),
|
|
23
|
+
updated_at: z.string(),
|
|
24
|
+
created_by: z.string(),
|
|
25
|
+
type: z.enum(['url', 'sandbox']),
|
|
26
|
+
config: z.record(z.string(), z.unknown()),
|
|
27
|
+
})
|
|
28
|
+
),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const getSubcommand = createCommand({
|
|
32
|
+
name: 'get',
|
|
33
|
+
description: 'Get schedule details',
|
|
34
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
35
|
+
requires: { auth: true, region: true },
|
|
36
|
+
optional: { project: true },
|
|
37
|
+
idempotent: true,
|
|
38
|
+
examples: [
|
|
39
|
+
{ command: getCommand('cloud schedule get sched_abc123'), description: 'Get schedule details' },
|
|
40
|
+
],
|
|
41
|
+
schema: {
|
|
42
|
+
args: z.object({
|
|
43
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
44
|
+
}),
|
|
45
|
+
response: ScheduleGetResponseSchema,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
async handler(ctx) {
|
|
49
|
+
const { args, options } = ctx;
|
|
50
|
+
const schedule = createScheduleAdapter(ctx);
|
|
51
|
+
const result = await schedule.get(args.schedule_id);
|
|
52
|
+
|
|
53
|
+
if (!options.json) {
|
|
54
|
+
const details: Record<string, unknown> = {
|
|
55
|
+
Name: result.schedule.name,
|
|
56
|
+
ID: result.schedule.id,
|
|
57
|
+
Expression: result.schedule.expression,
|
|
58
|
+
Description: result.schedule.description ?? '-',
|
|
59
|
+
'Next Due': result.schedule.due_date,
|
|
60
|
+
Created: new Date(result.schedule.created_at).toLocaleString(),
|
|
61
|
+
Updated: new Date(result.schedule.updated_at).toLocaleString(),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
tui.table([details], undefined, { layout: 'vertical', padStart: ' ' });
|
|
65
|
+
|
|
66
|
+
tui.newline();
|
|
67
|
+
tui.info('Destinations');
|
|
68
|
+
if (result.destinations.length === 0) {
|
|
69
|
+
tui.info('No destinations configured');
|
|
70
|
+
} else {
|
|
71
|
+
tui.table(
|
|
72
|
+
result.destinations.map((destination: {
|
|
73
|
+
id: string;
|
|
74
|
+
type: 'url' | 'sandbox';
|
|
75
|
+
config: Record<string, unknown>;
|
|
76
|
+
created_at: string;
|
|
77
|
+
}) => ({
|
|
78
|
+
ID: destination.id,
|
|
79
|
+
Type: destination.type,
|
|
80
|
+
Config: JSON.stringify(destination.config),
|
|
81
|
+
Created: new Date(destination.created_at).toLocaleString(),
|
|
82
|
+
})),
|
|
83
|
+
['ID', 'Type', 'Config', 'Created']
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return result;
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export default getSubcommand;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createCommand } from '../../../types';
|
|
2
|
+
import { listSubcommand } from './list';
|
|
3
|
+
import { createSubcommand } from './create';
|
|
4
|
+
import { getSubcommand } from './get';
|
|
5
|
+
import { deleteSubcommand } from './delete';
|
|
6
|
+
import { updateSubcommand } from './update';
|
|
7
|
+
import destinationSubcommand from './destination';
|
|
8
|
+
import deliverySubcommand from './delivery';
|
|
9
|
+
import { getCommand } from '../../../command-prefix';
|
|
10
|
+
|
|
11
|
+
export const command = createCommand({
|
|
12
|
+
name: 'schedule',
|
|
13
|
+
aliases: ['schedules', 'sched'],
|
|
14
|
+
description: 'Manage scheduled tasks',
|
|
15
|
+
tags: ['requires-auth'],
|
|
16
|
+
requires: { auth: true },
|
|
17
|
+
subcommands: [
|
|
18
|
+
listSubcommand,
|
|
19
|
+
createSubcommand,
|
|
20
|
+
getSubcommand,
|
|
21
|
+
deleteSubcommand,
|
|
22
|
+
updateSubcommand,
|
|
23
|
+
destinationSubcommand,
|
|
24
|
+
deliverySubcommand,
|
|
25
|
+
],
|
|
26
|
+
examples: [
|
|
27
|
+
{ command: getCommand('cloud schedule list'), description: 'List schedules' },
|
|
28
|
+
{
|
|
29
|
+
command: getCommand("cloud schedule create --name nightly --expression '0 0 * * *'"),
|
|
30
|
+
description: 'Create a schedule',
|
|
31
|
+
},
|
|
32
|
+
{ command: getCommand('cloud schedule get sched_abc123'), description: 'Get schedule details' },
|
|
33
|
+
],
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default command;
|