tuturuuu 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/cli/calendar-admin.d.ts +5 -0
- package/dist/cli/calendar-admin.d.ts.map +1 -0
- package/dist/cli/calendar-admin.js +117 -0
- package/dist/cli/calendar-admin.js.map +1 -0
- package/dist/cli/calendar-integrations.d.ts +8 -0
- package/dist/cli/calendar-integrations.d.ts.map +1 -0
- package/dist/cli/calendar-integrations.js +135 -0
- package/dist/cli/calendar-integrations.js.map +1 -0
- package/dist/cli/calendar-payloads.d.ts +41 -0
- package/dist/cli/calendar-payloads.d.ts.map +1 -0
- package/dist/cli/calendar-payloads.js +254 -0
- package/dist/cli/calendar-payloads.js.map +1 -0
- package/dist/cli/calendar.d.ts +3 -0
- package/dist/cli/calendar.d.ts.map +1 -0
- package/dist/cli/calendar.js +39 -0
- package/dist/cli/calendar.js.map +1 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +11 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/finance-payloads.d.ts +7 -1
- package/dist/cli/finance-payloads.d.ts.map +1 -1
- package/dist/cli/finance-payloads.js +125 -2
- package/dist/cli/finance-payloads.js.map +1 -1
- package/dist/cli/finance-resources.d.ts +1 -1
- package/dist/cli/finance-resources.d.ts.map +1 -1
- package/dist/cli/finance-resources.js +8 -0
- package/dist/cli/finance-resources.js.map +1 -1
- package/dist/cli/finance.d.ts.map +1 -1
- package/dist/cli/finance.js +86 -1
- package/dist/cli/finance.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +229 -3
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/render.d.ts +1 -0
- package/dist/cli/render.d.ts.map +1 -1
- package/dist/cli/render.js +267 -47
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/timezone.d.ts +11 -0
- package/dist/cli/timezone.d.ts.map +1 -0
- package/dist/cli/timezone.js +159 -0
- package/dist/cli/timezone.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/platform-calendar-types.d.ts +214 -0
- package/dist/platform-calendar-types.d.ts.map +1 -0
- package/dist/platform-calendar-types.js +3 -0
- package/dist/platform-calendar-types.js.map +1 -0
- package/dist/platform-calendar.d.ts +122 -0
- package/dist/platform-calendar.d.ts.map +1 -0
- package/dist/platform-calendar.js +126 -0
- package/dist/platform-calendar.js.map +1 -0
- package/dist/platform-finance.d.ts +95 -0
- package/dist/platform-finance.d.ts.map +1 -1
- package/dist/platform-finance.js +41 -0
- package/dist/platform-finance.js.map +1 -1
- package/dist/platform.d.ts +2 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +3 -0
- package/dist/platform.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -83,6 +83,9 @@ ttr finance wallets
|
|
|
83
83
|
ttr finance transactions --page-size 10
|
|
84
84
|
ttr finance transactions create --amount 150000 --wallet <wallet-id> --taken-at 2026-05-09
|
|
85
85
|
ttr finance budgets status
|
|
86
|
+
ttr calendar events list --start 2026-06-11T00:00:00Z --end 2026-06-12T00:00:00Z
|
|
87
|
+
ttr calendar events create "Focus block" --start 2026-06-11T09:00:00+07:00 --duration-minutes 90
|
|
88
|
+
ttr calendar schedule preview --window-days 14 --timezone Asia/Ho_Chi_Minh
|
|
86
89
|
```
|
|
87
90
|
|
|
88
91
|
Login opens the browser and creates a Tuturuuu-managed CLI app-session JWT pair
|
|
@@ -137,6 +140,8 @@ Scoped help is available without login, saved config reads, or update checks:
|
|
|
137
140
|
ttr --help
|
|
138
141
|
ttr upgrade --help
|
|
139
142
|
ttr box --help
|
|
143
|
+
ttr calendar --help
|
|
144
|
+
ttr calendar events --help
|
|
140
145
|
ttr finance --help
|
|
141
146
|
ttr finance transactions --help
|
|
142
147
|
ttr tasks --help
|
|
@@ -215,6 +220,36 @@ ttr finance recurring create "Rent" --amount 5000000 --wallet <wallet-id> --freq
|
|
|
215
220
|
ttr finance recurring upcoming --days-ahead 30
|
|
216
221
|
```
|
|
217
222
|
|
|
223
|
+
Calendar commands cover event CRUD, schedule status/preview/apply, schedulable
|
|
224
|
+
tasks, default source selection, workspace calendars, categories, provider
|
|
225
|
+
accounts, provider auth URLs, provider calendar discovery, and calendar
|
|
226
|
+
connections. Calendar commands use the selected workspace by default; pass
|
|
227
|
+
`--workspace` or `--ws` to target another workspace. Event time input is exact
|
|
228
|
+
ISO datetime only. `events create` requires `--start` and exactly one of `--end`
|
|
229
|
+
or `--duration-minutes`; `events update --duration-minutes` also requires
|
|
230
|
+
`--start`. Human output uses resource-specific tables, and `--json` preserves
|
|
231
|
+
the raw structured API response for scripts. Use `calendar calendars reset
|
|
232
|
+
--yes`; without `--yes`, the reset command fails with a confirmation error.
|
|
233
|
+
|
|
234
|
+
Common calendar examples:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
ttr calendar events list --start 2026-06-11T00:00:00Z --end 2026-06-12T00:00:00Z
|
|
238
|
+
ttr calendar events get <event-id>
|
|
239
|
+
ttr calendar events create "Focus block" --start 2026-06-11T09:00:00+07:00 --duration-minutes 90
|
|
240
|
+
ttr calendar events update <event-id> --title "Focus block" --locked true
|
|
241
|
+
ttr calendar sources list
|
|
242
|
+
ttr calendar sources use --source-provider tuturuuu --calendar <calendar-id>
|
|
243
|
+
ttr calendar calendars create "Team" --color BLUE
|
|
244
|
+
ttr calendar categories reorder --json-payload '{"categories":[{"id":"...","position":0}]}'
|
|
245
|
+
ttr calendar accounts list
|
|
246
|
+
ttr calendar auth google
|
|
247
|
+
ttr calendar provider-calendars list --account <account-id>
|
|
248
|
+
ttr calendar connections create --calendar-id primary --calendar-name "Primary" --account <account-id>
|
|
249
|
+
ttr calendar schedule preview --window-days 14 --timezone Asia/Ho_Chi_Minh
|
|
250
|
+
ttr calendar calendars reset --yes
|
|
251
|
+
```
|
|
252
|
+
|
|
218
253
|
Common task examples:
|
|
219
254
|
|
|
220
255
|
```bash
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type CalendarCommandInput } from './calendar-payloads';
|
|
2
|
+
export declare function handleEvents(input: CalendarCommandInput, action: string): Promise<void>;
|
|
3
|
+
export declare function handleCalendars(input: CalendarCommandInput, action: string): Promise<void>;
|
|
4
|
+
export declare function handleCategories(input: CalendarCommandInput, action: string): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=calendar-admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-admin.d.ts","sourceRoot":"","sources":["../../src/cli/calendar-admin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,oBAAoB,EAQ1B,MAAM,qBAAqB,CAAC;AAG7B,wBAAsB,YAAY,CAChC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBA2Ef;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBA+Df;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBAmEf"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleEvents = handleEvents;
|
|
4
|
+
exports.handleCalendars = handleCalendars;
|
|
5
|
+
exports.handleCategories = handleCategories;
|
|
6
|
+
const calendar_payloads_1 = require("./calendar-payloads");
|
|
7
|
+
const render_1 = require("./render");
|
|
8
|
+
async function handleEvents(input, action) {
|
|
9
|
+
const { client, flags, json, positionals, workspaceId } = input;
|
|
10
|
+
const eventId = positionals[3];
|
|
11
|
+
if (action === 'list') {
|
|
12
|
+
const start_at = (0, calendar_payloads_1.parseIsoDateTime)((0, calendar_payloads_1.pickString)(flags, 'start', 'start-at'), '--start');
|
|
13
|
+
const end_at = (0, calendar_payloads_1.parseIsoDateTime)((0, calendar_payloads_1.pickString)(flags, 'end', 'end-at'), '--end');
|
|
14
|
+
if (!start_at || !end_at) {
|
|
15
|
+
throw new Error('Calendar events list requires --start and --end.');
|
|
16
|
+
}
|
|
17
|
+
(0, render_1.render)(await client.calendar.listEvents(workspaceId, { start_at, end_at }), {
|
|
18
|
+
calendarResource: 'events',
|
|
19
|
+
group: 'calendar',
|
|
20
|
+
json,
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (action === 'get') {
|
|
25
|
+
(0, render_1.render)(await client.calendar.getEvent(workspaceId, (0, calendar_payloads_1.requireId)(eventId, 'event', action)), { calendarResource: 'events', group: 'calendar', json });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (action === 'create') {
|
|
29
|
+
(0, render_1.render)(await client.calendar.createEvent(workspaceId, (0, calendar_payloads_1.getEventPayload)(flags, positionals, { create: true })), { calendarResource: 'events', group: 'calendar', json });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (action === 'update') {
|
|
33
|
+
(0, render_1.render)(await client.calendar.updateEvent(workspaceId, (0, calendar_payloads_1.requireId)(eventId, 'event', action), (0, calendar_payloads_1.getEventPayload)(flags, positionals)), { calendarResource: 'events', group: 'calendar', json });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (action === 'delete') {
|
|
37
|
+
(0, render_1.render)(await client.calendar.deleteEvent(workspaceId, (0, calendar_payloads_1.requireId)(eventId, 'event', action)), { calendarResource: 'events', group: 'calendar', json });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
throw new Error(`Unknown calendar events action: ${action}`);
|
|
41
|
+
}
|
|
42
|
+
async function handleCalendars(input, action) {
|
|
43
|
+
const { client, flags, json, positionals, workspaceId } = input;
|
|
44
|
+
const calendarId = positionals[3];
|
|
45
|
+
if (action === 'list') {
|
|
46
|
+
(0, render_1.render)(await client.calendar.listCalendars(workspaceId), {
|
|
47
|
+
calendarResource: 'calendars',
|
|
48
|
+
group: 'calendar',
|
|
49
|
+
json,
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (action === 'create') {
|
|
54
|
+
(0, render_1.render)(await client.calendar.createCalendar(workspaceId, (0, calendar_payloads_1.getCalendarPayload)(flags, positionals, { create: true })), { calendarResource: 'calendars', group: 'calendar', json });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (action === 'update') {
|
|
58
|
+
(0, render_1.render)(await client.calendar.updateCalendar(workspaceId, (0, calendar_payloads_1.getCalendarPayload)(flags, positionals, {
|
|
59
|
+
id: (0, calendar_payloads_1.requireId)(calendarId, 'calendar', action),
|
|
60
|
+
})), { calendarResource: 'calendars', group: 'calendar', json });
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (action === 'delete') {
|
|
64
|
+
(0, render_1.render)(await client.calendar.deleteCalendar(workspaceId, (0, calendar_payloads_1.requireId)(calendarId, 'calendar', action)), { calendarResource: 'calendars', group: 'calendar', json });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (action === 'reset') {
|
|
68
|
+
if (flags.yes !== true) {
|
|
69
|
+
throw new Error('Calendar reset is destructive. Re-run with --yes.');
|
|
70
|
+
}
|
|
71
|
+
(0, render_1.render)(await client.calendar.resetCalendars(workspaceId), {
|
|
72
|
+
calendarResource: 'calendars',
|
|
73
|
+
group: 'calendar',
|
|
74
|
+
json,
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`Unknown calendar calendars action: ${action}`);
|
|
79
|
+
}
|
|
80
|
+
async function handleCategories(input, action) {
|
|
81
|
+
const { client, flags, json, positionals, workspaceId } = input;
|
|
82
|
+
const categoryId = positionals[3];
|
|
83
|
+
if (action === 'list') {
|
|
84
|
+
(0, render_1.render)(await client.calendar.listCategories(workspaceId), {
|
|
85
|
+
calendarResource: 'categories',
|
|
86
|
+
group: 'calendar',
|
|
87
|
+
json,
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (action === 'create') {
|
|
92
|
+
(0, render_1.render)(await client.calendar.createCategory(workspaceId, (0, calendar_payloads_1.getCategoryPayload)(flags, positionals, { create: true })), { calendarResource: 'categories', group: 'calendar', json });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (action === 'update') {
|
|
96
|
+
(0, render_1.render)(await client.calendar.updateCategory(workspaceId, (0, calendar_payloads_1.requireId)(categoryId, 'category', action), (0, calendar_payloads_1.getCategoryPayload)(flags, positionals)), { calendarResource: 'categories', group: 'calendar', json });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (action === 'delete') {
|
|
100
|
+
(0, render_1.render)(await client.calendar.deleteCategory(workspaceId, (0, calendar_payloads_1.requireId)(categoryId, 'category', action)), { calendarResource: 'categories', group: 'calendar', json });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (action === 'reorder') {
|
|
104
|
+
const payload = (0, calendar_payloads_1.parseJsonPayload)(flags);
|
|
105
|
+
if (!Array.isArray(payload.categories) || payload.categories.length === 0) {
|
|
106
|
+
throw new Error('Calendar category reorder requires --json-payload with a categories array.');
|
|
107
|
+
}
|
|
108
|
+
(0, render_1.render)(await client.calendar.reorderCategories(workspaceId, payload), {
|
|
109
|
+
calendarResource: 'categories',
|
|
110
|
+
group: 'calendar',
|
|
111
|
+
json,
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
throw new Error(`Unknown calendar categories action: ${action}`);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=calendar-admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-admin.js","sourceRoot":"","sources":["../../src/cli/calendar-admin.ts"],"names":[],"mappings":";;;;;AACA,2DAS6B;AAC7B,qCAAkC;AAE3B,KAAK,uBACV,K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K,EAAE,UAAU,EAAE,IAAI,EAAE,CAC5D,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,IAAA,eAAM,EACJ,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAClC,WAAW,EACX,IAAA,6BAAS,EAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAC1C,EACD,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAC5D,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAC9B,KAAK,CACyC,CAAC;QACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1E,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;QACJ,CAAC;QAED,IAAA,eAAM,EAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE;YACpE,gBAAgB,EAAE,YAAY;YAC9B,KAAK,EAAE,UAAU;YACjB,IAAI;SACL,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CalendarCommandInput } from './calendar-payloads';
|
|
2
|
+
export declare function handleAccounts(input: CalendarCommandInput, action: string): Promise<void>;
|
|
3
|
+
export declare function handleAuth(input: CalendarCommandInput, provider?: string): Promise<void>;
|
|
4
|
+
export declare function handleProviderCalendars(input: CalendarCommandInput, action: string): Promise<void>;
|
|
5
|
+
export declare function handleConnections(input: CalendarCommandInput, action: string): Promise<void>;
|
|
6
|
+
export declare function handleSources(input: CalendarCommandInput, action: string): Promise<void>;
|
|
7
|
+
export declare function handleSchedule(input: CalendarCommandInput, action: string): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=calendar-integrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-integrations.d.ts","sourceRoot":"","sources":["../../src/cli/calendar-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAM1B,MAAM,qBAAqB,CAAC;AAG7B,wBAAsB,cAAc,CAClC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBA0Bf;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE,oBAAoB,EAC3B,QAAQ,CAAC,EAAE,MAAM,iBAuBlB;AAED,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBAef;AAED,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBAqDf;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBAyBf;AAED,wBAAsB,cAAc,CAClC,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,MAAM,iBA8Cf"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAccounts = handleAccounts;
|
|
4
|
+
exports.handleAuth = handleAuth;
|
|
5
|
+
exports.handleProviderCalendars = handleProviderCalendars;
|
|
6
|
+
exports.handleConnections = handleConnections;
|
|
7
|
+
exports.handleSources = handleSources;
|
|
8
|
+
exports.handleSchedule = handleSchedule;
|
|
9
|
+
const calendar_payloads_1 = require("./calendar-payloads");
|
|
10
|
+
const render_1 = require("./render");
|
|
11
|
+
async function handleAccounts(input, action) {
|
|
12
|
+
const { client, json, positionals, workspaceId } = input;
|
|
13
|
+
const accountId = positionals[3];
|
|
14
|
+
if (action === 'list') {
|
|
15
|
+
(0, render_1.render)(await client.calendar.listAccounts(workspaceId), {
|
|
16
|
+
calendarResource: 'accounts',
|
|
17
|
+
group: 'calendar',
|
|
18
|
+
json,
|
|
19
|
+
});
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (action === 'disconnect' || action === 'delete') {
|
|
23
|
+
(0, render_1.render)(await client.calendar.disconnectAccount(workspaceId, (0, calendar_payloads_1.requireId)(accountId, 'account', action)), { calendarResource: 'accounts', group: 'calendar', json });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
throw new Error(`Unknown calendar accounts action: ${action}`);
|
|
27
|
+
}
|
|
28
|
+
async function handleAuth(input, provider) {
|
|
29
|
+
const { client, json, workspaceId } = input;
|
|
30
|
+
if (provider === 'google') {
|
|
31
|
+
(0, render_1.render)(await client.calendar.getGoogleAuthUrl(workspaceId), {
|
|
32
|
+
calendarResource: 'auth',
|
|
33
|
+
group: 'calendar',
|
|
34
|
+
json,
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (provider === 'microsoft') {
|
|
39
|
+
(0, render_1.render)(await client.calendar.getMicrosoftAuthUrl(workspaceId), {
|
|
40
|
+
calendarResource: 'auth',
|
|
41
|
+
group: 'calendar',
|
|
42
|
+
json,
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
throw new Error('Calendar auth requires google or microsoft.');
|
|
47
|
+
}
|
|
48
|
+
async function handleProviderCalendars(input, action) {
|
|
49
|
+
const { client, flags, json, workspaceId } = input;
|
|
50
|
+
if (action === 'list') {
|
|
51
|
+
(0, render_1.render)(await client.calendar.listProviderCalendars(workspaceId, {
|
|
52
|
+
accountId: (0, calendar_payloads_1.pickString)(flags, 'account', 'account-id'),
|
|
53
|
+
}), { calendarResource: 'provider-calendars', group: 'calendar', json });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`Unknown calendar provider-calendars action: ${action}`);
|
|
57
|
+
}
|
|
58
|
+
async function handleConnections(input, action) {
|
|
59
|
+
const { client, flags, json, positionals, workspaceId } = input;
|
|
60
|
+
const connectionId = positionals[3];
|
|
61
|
+
if (action === 'list') {
|
|
62
|
+
(0, render_1.render)(await client.calendar.listConnections(workspaceId), {
|
|
63
|
+
calendarResource: 'connections',
|
|
64
|
+
group: 'calendar',
|
|
65
|
+
json,
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (action === 'create') {
|
|
70
|
+
const payload = (0, calendar_payloads_1.getConnectionPayload)(flags);
|
|
71
|
+
if (!payload.calendarId || !payload.calendarName) {
|
|
72
|
+
throw new Error('Calendar connection create requires --calendar-id and --calendar-name.');
|
|
73
|
+
}
|
|
74
|
+
(0, render_1.render)(await client.calendar.createConnection(workspaceId, payload), {
|
|
75
|
+
calendarResource: 'connections',
|
|
76
|
+
group: 'calendar',
|
|
77
|
+
json,
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (action === 'update') {
|
|
82
|
+
(0, render_1.render)(await client.calendar.updateConnection((0, calendar_payloads_1.getConnectionPayload)(flags, {
|
|
83
|
+
id: (0, calendar_payloads_1.requireId)(connectionId, 'connection', action),
|
|
84
|
+
})), { calendarResource: 'connections', group: 'calendar', json });
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (action === 'delete') {
|
|
88
|
+
(0, render_1.render)(await client.calendar.deleteConnection((0, calendar_payloads_1.requireId)(connectionId, 'connection', action)), { calendarResource: 'connections', group: 'calendar', json });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
throw new Error(`Unknown calendar connections action: ${action}`);
|
|
92
|
+
}
|
|
93
|
+
async function handleSources(input, action) {
|
|
94
|
+
const { client, flags, json, workspaceId } = input;
|
|
95
|
+
if (action === 'list') {
|
|
96
|
+
(0, render_1.render)(await client.calendar.getDefaultSource(workspaceId), {
|
|
97
|
+
calendarResource: 'sources',
|
|
98
|
+
group: 'calendar',
|
|
99
|
+
json,
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (action === 'use' || action === 'update') {
|
|
104
|
+
(0, render_1.render)(await client.calendar.updateDefaultSource(workspaceId, (0, calendar_payloads_1.getSourcePayload)(flags)), { calendarResource: 'sources', group: 'calendar', json });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`Unknown calendar sources action: ${action}`);
|
|
108
|
+
}
|
|
109
|
+
async function handleSchedule(input, action) {
|
|
110
|
+
const { client, flags, json, workspaceId } = input;
|
|
111
|
+
if (action === 'status') {
|
|
112
|
+
(0, render_1.render)(await client.calendar.getScheduleStatus(workspaceId), {
|
|
113
|
+
calendarResource: 'schedule',
|
|
114
|
+
group: 'calendar',
|
|
115
|
+
json,
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (action === 'tasks') {
|
|
120
|
+
(0, render_1.render)(await client.calendar.listSchedulableTasks(workspaceId, {
|
|
121
|
+
q: (0, calendar_payloads_1.pickString)(flags, 'q'),
|
|
122
|
+
}), { calendarResource: 'schedule-tasks', group: 'calendar', json });
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (action === 'preview') {
|
|
126
|
+
(0, render_1.render)(await client.calendar.previewSchedule(workspaceId, (0, calendar_payloads_1.getSchedulePayload)(flags)), { calendarResource: 'schedule-preview', group: 'calendar', json });
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (action === 'apply') {
|
|
130
|
+
(0, render_1.render)(await client.calendar.applySchedule(workspaceId, (0, calendar_payloads_1.getSchedulePayload)(flags)), { calendarResource: 'schedule-apply', group: 'calendar', json });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
throw new Error(`Unknown calendar schedule action: ${action}`);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=calendar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AC,KAAK,EAAE,GAAG,CAAC;SAC1B,CAAC,EACF,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAChE,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAA,eAAM,EACJ,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,CACnC,WAAW,EACX,IAAA,sCAAkB,EAAC,KAAK,CAAC,CAC1B,EACD,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAClE,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,IAAA,eAAM,EACJ,MAAM,MAAM,CAAC,QAAQ,CAAC,aAAa,CACjC,WAAW,EACX,IAAA,sCAAkB,EAAC,KAAK,CAAC,CAC1B,EACD,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAChE,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TuturuuuUserClient } from '../platform';
|
|
2
|
+
import type { CalendarCategoryPayload, CalendarConnectionPayload, CalendarConnectionUpdatePayload, ScheduleApplyRequestPayload, SchedulePreviewRequestPayload, WorkspaceCalendarEventCreatePayload, WorkspaceCalendarEventUpdatePayload, WorkspaceCalendarPayload, WorkspaceCalendarUpdatePayload } from '../platform-calendar';
|
|
3
|
+
import { type FlagValue } from './args';
|
|
4
|
+
export interface CalendarCommandInput {
|
|
5
|
+
client: TuturuuuUserClient;
|
|
6
|
+
flags: Record<string, FlagValue>;
|
|
7
|
+
json: boolean;
|
|
8
|
+
positionals: string[];
|
|
9
|
+
workspaceId: string;
|
|
10
|
+
}
|
|
11
|
+
export type CalendarResource = 'accounts' | 'auth' | 'calendars' | 'categories' | 'connections' | 'events' | 'provider-calendars' | 'schedule' | 'sources';
|
|
12
|
+
export declare function normalizeResource(value?: string): CalendarResource | undefined;
|
|
13
|
+
export declare function defaultAction(resource: CalendarResource): "list" | "status" | undefined;
|
|
14
|
+
export declare function parseJsonPayload(flags: Record<string, FlagValue>): Record<string, unknown>;
|
|
15
|
+
export declare function pickString(flags: Record<string, FlagValue>, ...keys: string[]): string | undefined;
|
|
16
|
+
export declare function requireId(id: string | undefined, resource: string, action: string): string;
|
|
17
|
+
export declare function parseIsoDateTime(value: string | undefined, flag: string): string | undefined;
|
|
18
|
+
export declare function getEventPayload(flags: Record<string, FlagValue>, positionals: string[], options?: {
|
|
19
|
+
create?: boolean;
|
|
20
|
+
}): WorkspaceCalendarEventCreatePayload & WorkspaceCalendarEventUpdatePayload;
|
|
21
|
+
export declare function getCalendarPayload(flags: Record<string, FlagValue>, positionals: string[], options?: {
|
|
22
|
+
id?: string;
|
|
23
|
+
create?: boolean;
|
|
24
|
+
}): WorkspaceCalendarPayload & WorkspaceCalendarUpdatePayload;
|
|
25
|
+
export declare function getCategoryPayload(flags: Record<string, FlagValue>, positionals: string[], options?: {
|
|
26
|
+
create?: boolean;
|
|
27
|
+
}): CalendarCategoryPayload;
|
|
28
|
+
export declare function getConnectionPayload(flags: Record<string, FlagValue>, options?: {
|
|
29
|
+
id?: string;
|
|
30
|
+
}): CalendarConnectionPayload & CalendarConnectionUpdatePayload;
|
|
31
|
+
export declare function getSchedulePayload(flags: Record<string, FlagValue>): SchedulePreviewRequestPayload & ScheduleApplyRequestPayload;
|
|
32
|
+
export declare function getSourcePayload(flags: Record<string, FlagValue>): {
|
|
33
|
+
provider: "tuturuuu";
|
|
34
|
+
workspaceCalendarId: string | null;
|
|
35
|
+
connectionId?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
workspaceCalendarId?: undefined;
|
|
38
|
+
provider: "google" | "microsoft";
|
|
39
|
+
connectionId: string;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=calendar-payloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-payloads.d.ts","sourceRoot":"","sources":["../../src/cli/calendar-payloads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,+BAA+B,EAE/B,2BAA2B,EAC3B,6BAA6B,EAC7B,mCAAmC,EACnC,mCAAmC,EACnC,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,MAAM,GACN,WAAW,GACX,YAAY,GACZ,aAAa,GACb,QAAQ,GACR,oBAAoB,GACpB,UAAU,GACV,SAAS,CAAC;AAcd,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,EAAE,MAAM,GACb,gBAAgB,GAAG,SAAS,CAY9B;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,gBAAgB,iCASvD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,2BAGhE;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAChC,GAAG,IAAI,EAAE,MAAM,EAAE,sBAMlB;AAqDD,wBAAgB,SAAS,CACvB,EAAE,EAAE,MAAM,GAAG,SAAS,E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ule", { value: true });
|
|
3
|
+
exports.normalizeResource = normalizeResource;
|
|
4
|
+
exports.defaultAction = defaultAction;
|
|
5
|
+
exports.parseJsonPayload = parseJsonPayload;
|
|
6
|
+
exports.pickString = pickString;
|
|
7
|
+
exports.requireId = requireId;
|
|
8
|
+
exports.parseIsoDateTime = parseIsoDateTime;
|
|
9
|
+
exports.getEventPayload = getEventPayload;
|
|
10
|
+
exports.getCalendarPayload = getCalendarPayload;
|
|
11
|
+
exports.getCategoryPayload = getCategoryPayload;
|
|
12
|
+
exports.getConnectionPayload = getConnectionPayload;
|
|
13
|
+
exports.getSchedulePayload = getSchedulePayload;
|
|
14
|
+
exports.getSourcePayload = getSourcePayload;
|
|
15
|
+
const args_1 = require("./args");
|
|
16
|
+
const CALENDAR_RESOURCES = new Set([
|
|
17
|
+
'accounts',
|
|
18
|
+
'auth',
|
|
19
|
+
'calendars',
|
|
20
|
+
'categories',
|
|
21
|
+
'connections',
|
|
22
|
+
'events',
|
|
23
|
+
'provider-calendars',
|
|
24
|
+
'schedule',
|
|
25
|
+
'sources',
|
|
26
|
+
]);
|
|
27
|
+
function normalizeResource(value) {
|
|
28
|
+
const normalized = (value || '').trim().toLowerCase();
|
|
29
|
+
if (!normalized)
|
|
30
|
+
return undefined;
|
|
31
|
+
if (normalized === 'source')
|
|
32
|
+
return 'sources';
|
|
33
|
+
if (normalized === 'calendar')
|
|
34
|
+
return 'calendars';
|
|
35
|
+
if (normalized === 'category')
|
|
36
|
+
return 'categories';
|
|
37
|
+
if (normalized === 'connection')
|
|
38
|
+
return 'connections';
|
|
39
|
+
if (normalized === 'account')
|
|
40
|
+
return 'accounts';
|
|
41
|
+
if (normalized === 'provider-calendar')
|
|
42
|
+
return 'provider-calendars';
|
|
43
|
+
return CALENDAR_RESOURCES.has(normalized)
|
|
44
|
+
? normalized
|
|
45
|
+
: undefined;
|
|
46
|
+
}
|
|
47
|
+
function defaultAction(resource) {
|
|
48
|
+
switch (resource) {
|
|
49
|
+
case 'auth':
|
|
50
|
+
return undefined;
|
|
51
|
+
case 'schedule':
|
|
52
|
+
return 'status';
|
|
53
|
+
default:
|
|
54
|
+
return 'list';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function parseJsonPayload(flags) {
|
|
58
|
+
const payload = (0, args_1.getFlag)(flags, 'json-payload');
|
|
59
|
+
return payload ? JSON.parse(payload) : {};
|
|
60
|
+
}
|
|
61
|
+
function pickString(flags, ...keys) {
|
|
62
|
+
for (const key of keys) {
|
|
63
|
+
const value = (0, args_1.getFlag)(flags, key);
|
|
64
|
+
if (value !== undefined)
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function parseBoolean(value) {
|
|
69
|
+
if (value === true)
|
|
70
|
+
return true;
|
|
71
|
+
if (typeof value !== 'string')
|
|
72
|
+
return undefined;
|
|
73
|
+
switch (value.trim().toLowerCase()) {
|
|
74
|
+
case '1':
|
|
75
|
+
case 'true':
|
|
76
|
+
case 'yes':
|
|
77
|
+
return true;
|
|
78
|
+
case '0':
|
|
79
|
+
case 'false':
|
|
80
|
+
case 'no':
|
|
81
|
+
return false;
|
|
82
|
+
default:
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function parseNumber(value) {
|
|
87
|
+
if (value === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
const parsed = Number(value);
|
|
90
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
91
|
+
}
|
|
92
|
+
function parsePositiveInteger(value) {
|
|
93
|
+
const parsed = parseNumber(value);
|
|
94
|
+
return parsed !== undefined && Number.isInteger(parsed) && parsed > 0
|
|
95
|
+
? parsed
|
|
96
|
+
: undefined;
|
|
97
|
+
}
|
|
98
|
+
function assignDefined(payload, key, value) {
|
|
99
|
+
if (value !== undefined) {
|
|
100
|
+
payload[key] = value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function mergePayload(payload, flags) {
|
|
104
|
+
return {
|
|
105
|
+
...payload,
|
|
106
|
+
...parseJsonPayload(flags),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function requireId(id, resource, action) {
|
|
110
|
+
if (!id) {
|
|
111
|
+
throw new Error(`Missing ${resource} id for calendar ${action}.`);
|
|
112
|
+
}
|
|
113
|
+
return id;
|
|
114
|
+
}
|
|
115
|
+
function parseIsoDateTime(value, flag) {
|
|
116
|
+
if (!value)
|
|
117
|
+
return undefined;
|
|
118
|
+
const timestamp = Date.parse(value);
|
|
119
|
+
if (!Number.isFinite(timestamp)) {
|
|
120
|
+
throw new Error(`Invalid ${flag}. Use an ISO date-time value.`);
|
|
121
|
+
}
|
|
122
|
+
return new Date(timestamp).toISOString();
|
|
123
|
+
}
|
|
124
|
+
function getEventTimePayload(flags, options = {}) {
|
|
125
|
+
const startInput = pickString(flags, 'start', 'start-at');
|
|
126
|
+
const endInput = pickString(flags, 'end', 'end-at');
|
|
127
|
+
const durationInput = pickString(flags, 'duration-minutes', 'duration');
|
|
128
|
+
const durationMinutes = parsePositiveInteger(durationInput);
|
|
129
|
+
if (options.create && !startInput) {
|
|
130
|
+
throw new Error('Calendar event create requires --start.');
|
|
131
|
+
}
|
|
132
|
+
if (durationInput !== undefined && durationMinutes === undefined) {
|
|
133
|
+
throw new Error('--duration-minutes must be a positive integer.');
|
|
134
|
+
}
|
|
135
|
+
if (endInput && durationMinutes !== undefined) {
|
|
136
|
+
throw new Error('Use either --end or --duration-minutes, not both.');
|
|
137
|
+
}
|
|
138
|
+
if (durationMinutes !== undefined && !startInput) {
|
|
139
|
+
throw new Error('--duration-minutes requires --start.');
|
|
140
|
+
}
|
|
141
|
+
if (options.create && !endInput && durationMinutes === undefined) {
|
|
142
|
+
throw new Error('Calendar event create requires --end or --duration-minutes.');
|
|
143
|
+
}
|
|
144
|
+
const start = parseIsoDateTime(startInput, '--start');
|
|
145
|
+
const end = endInput
|
|
146
|
+
? parseIsoDateTime(endInput, '--end')
|
|
147
|
+
: start && durationMinutes !== undefined
|
|
148
|
+
? new Date(Date.parse(start) + durationMinutes * 60_000).toISOString()
|
|
149
|
+
: undefined;
|
|
150
|
+
if (start && end && Date.parse(end) <= Date.parse(start)) {
|
|
151
|
+
throw new Error('Calendar event end must be after start.');
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
end_at: end,
|
|
155
|
+
start_at: start,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function getCalendarSource(flags) {
|
|
159
|
+
const provider = pickString(flags, 'source-provider', 'provider');
|
|
160
|
+
if (!provider)
|
|
161
|
+
return undefined;
|
|
162
|
+
if (provider === 'tuturuuu') {
|
|
163
|
+
return {
|
|
164
|
+
provider,
|
|
165
|
+
workspaceCalendarId: pickString(flags, 'calendar', 'workspace-calendar') ?? null,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (provider === 'google' || provider === 'microsoft') {
|
|
169
|
+
const connectionId = pickString(flags, 'connection', 'connection-id');
|
|
170
|
+
if (!connectionId) {
|
|
171
|
+
throw new Error(`Calendar ${provider} source requires --connection <id>.`);
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
provider,
|
|
175
|
+
connectionId,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
throw new Error('Unsupported calendar source provider. Use tuturuuu, google, or microsoft.');
|
|
179
|
+
}
|
|
180
|
+
function getEventPayload(flags, positionals, options = {}) {
|
|
181
|
+
const payload = {};
|
|
182
|
+
const positionalTitle = options.create
|
|
183
|
+
? positionals.slice(3).join(' ').trim()
|
|
184
|
+
: undefined;
|
|
185
|
+
assignDefined(payload, 'title', pickString(flags, 'title') || positionalTitle);
|
|
186
|
+
assignDefined(payload, 'description', pickString(flags, 'description'));
|
|
187
|
+
assignDefined(payload, 'location', pickString(flags, 'location'));
|
|
188
|
+
assignDefined(payload, 'color', pickString(flags, 'color'));
|
|
189
|
+
assignDefined(payload, 'locked', parseBoolean(flags.locked));
|
|
190
|
+
assignDefined(payload, 'task_id', pickString(flags, 'task', 'task-id'));
|
|
191
|
+
assignDefined(payload, 'source', getCalendarSource(flags));
|
|
192
|
+
const timePayload = getEventTimePayload(flags, options);
|
|
193
|
+
assignDefined(payload, 'start_at', timePayload.start_at);
|
|
194
|
+
assignDefined(payload, 'end_at', timePayload.end_at);
|
|
195
|
+
if (options.create && !payload.title) {
|
|
196
|
+
throw new Error('Calendar event create requires a title or --title.');
|
|
197
|
+
}
|
|
198
|
+
return mergePayload(payload, flags);
|
|
199
|
+
}
|
|
200
|
+
function getCalendarPayload(flags, positionals, options = {}) {
|
|
201
|
+
const payload = {};
|
|
202
|
+
const positionalName = options.create
|
|
203
|
+
? positionals.slice(3).join(' ').trim()
|
|
204
|
+
: undefined;
|
|
205
|
+
assignDefined(payload, 'id', options.id);
|
|
206
|
+
assignDefined(payload, 'name', pickString(flags, 'name') || positionalName);
|
|
207
|
+
assignDefined(payload, 'description', pickString(flags, 'description'));
|
|
208
|
+
assignDefined(payload, 'color', pickString(flags, 'color'));
|
|
209
|
+
assignDefined(payload, 'is_enabled', parseBoolean(flags.enabled));
|
|
210
|
+
assignDefined(payload, 'position', parseNumber(pickString(flags, 'position')));
|
|
211
|
+
if (options.create && !payload.name) {
|
|
212
|
+
throw new Error('Calendar create requires a name or --name.');
|
|
213
|
+
}
|
|
214
|
+
return mergePayload(payload, flags);
|
|
215
|
+
}
|
|
216
|
+
function getCategoryPayload(flags, positionals, options = {}) {
|
|
217
|
+
const payload = {};
|
|
218
|
+
const positionalName = options.create
|
|
219
|
+
? positionals.slice(3).join(' ').trim()
|
|
220
|
+
: undefined;
|
|
221
|
+
assignDefined(payload, 'name', pickString(flags, 'name') || positionalName);
|
|
222
|
+
assignDefined(payload, 'color', pickString(flags, 'color'));
|
|
223
|
+
if (options.create && !payload.name) {
|
|
224
|
+
throw new Error('Calendar category create requires a name or --name.');
|
|
225
|
+
}
|
|
226
|
+
return mergePayload(payload, flags);
|
|
227
|
+
}
|
|
228
|
+
function getConnectionPayload(flags, options = {}) {
|
|
229
|
+
const payload = {};
|
|
230
|
+
assignDefined(payload, 'id', options.id);
|
|
231
|
+
assignDefined(payload, 'calendarId', pickString(flags, 'calendar-id'));
|
|
232
|
+
assignDefined(payload, 'calendarName', pickString(flags, 'calendar-name', 'name'));
|
|
233
|
+
assignDefined(payload, 'color', pickString(flags, 'color'));
|
|
234
|
+
assignDefined(payload, 'authTokenId', pickString(flags, 'account', 'account-id'));
|
|
235
|
+
assignDefined(payload, 'accessRole', pickString(flags, 'access-role'));
|
|
236
|
+
assignDefined(payload, 'isEnabled', parseBoolean(flags.enabled));
|
|
237
|
+
return mergePayload(payload, flags);
|
|
238
|
+
}
|
|
239
|
+
function getSchedulePayload(flags) {
|
|
240
|
+
const payload = {};
|
|
241
|
+
assignDefined(payload, 'windowDays', parsePositiveInteger(pickString(flags, 'window-days')));
|
|
242
|
+
assignDefined(payload, 'clientTimezone', pickString(flags, 'timezone'));
|
|
243
|
+
assignDefined(payload, 'mode', pickString(flags, 'mode'));
|
|
244
|
+
assignDefined(payload, 'scope', pickString(flags, 'scope'));
|
|
245
|
+
return mergePayload(payload, flags);
|
|
246
|
+
}
|
|
247
|
+
function getSourcePayload(flags) {
|
|
248
|
+
const source = getCalendarSource(flags);
|
|
249
|
+
if (!source) {
|
|
250
|
+
throw new Error('Calendar source update requires --source-provider and related source flags.');
|
|
251
|
+
}
|
|
252
|
+
return source;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=calendar-payloads.js.map
|