@particle-academy/google-calendar-ui 0.0.0 → 0.2.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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +209 -2
- package/art/fancified.svg +26 -0
- package/dist/index.cjs +892 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +241 -0
- package/dist/index.d.ts +241 -0
- package/dist/index.js +845 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -6
package/dist/index.js
ADDED
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import { defineConnectorKind, summarize } from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
|
|
3
|
+
// src/service.ts
|
|
4
|
+
var CONNECTOR_API_VERSION = 1;
|
|
5
|
+
var GOOGLE_CALENDAR_SERVICE = {
|
|
6
|
+
service: "google_calendar",
|
|
7
|
+
serviceTitle: "Google Calendar",
|
|
8
|
+
domain: "calendar",
|
|
9
|
+
sandbox: "none"
|
|
10
|
+
};
|
|
11
|
+
var GOOGLE_CALENDAR_CREDENTIALS = [
|
|
12
|
+
{
|
|
13
|
+
"key": "clientId",
|
|
14
|
+
"label": "OAuth client ID",
|
|
15
|
+
"scope": "provider",
|
|
16
|
+
"secret": false,
|
|
17
|
+
"help": "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"key": "clientSecret",
|
|
21
|
+
"label": "OAuth client secret",
|
|
22
|
+
"scope": "provider",
|
|
23
|
+
"secret": true,
|
|
24
|
+
"help": "The client secret for the same OAuth app. One value for the whole installation."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"key": "accessToken",
|
|
28
|
+
"label": "Access token",
|
|
29
|
+
"scope": "account",
|
|
30
|
+
"secret": true,
|
|
31
|
+
"help": "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "refreshToken",
|
|
35
|
+
"label": "Refresh token",
|
|
36
|
+
"scope": "account",
|
|
37
|
+
"secret": true,
|
|
38
|
+
"help": "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"key": "channelToken",
|
|
42
|
+
"label": "Channel token",
|
|
43
|
+
"scope": "account",
|
|
44
|
+
"secret": true,
|
|
45
|
+
"help": "A secret the host chooses per connected account and sends as `token` on every events.watch. Google echoes it back in the X-Goog-Channel-Token header of every notification, and that echo is the ONLY thing that authenticates a delivery -- Google does not sign them. Up to 256 characters."
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
var GOOGLE_CALENDAR_OAUTH = {
|
|
49
|
+
"flow": "authorization_code",
|
|
50
|
+
"authorizeUrl": "https://accounts.google.com/o/oauth2/v2/auth",
|
|
51
|
+
"tokenUrl": "https://oauth2.googleapis.com/token",
|
|
52
|
+
"scopes": [
|
|
53
|
+
"https://www.googleapis.com/auth/calendar.events"
|
|
54
|
+
],
|
|
55
|
+
"accessTokenCredential": "accessToken",
|
|
56
|
+
"refreshTokenCredential": "refreshToken",
|
|
57
|
+
"refreshTokenRotates": false,
|
|
58
|
+
"accessTokenTtlSeconds": 3600
|
|
59
|
+
};
|
|
60
|
+
function googleCalendarMeta(role, operation, docs) {
|
|
61
|
+
return { ...GOOGLE_CALENDAR_SERVICE, role, operation, docs };
|
|
62
|
+
}
|
|
63
|
+
var GOOGLE_CALENDAR_CHANNEL_STOP_KIND = "@particle-academy/google_calendar_channel_stop";
|
|
64
|
+
var GOOGLE_CALENDAR_CHANNEL_STOP_OPERATION = "channel_stop";
|
|
65
|
+
var GOOGLE_CALENDAR_CHANNEL_STOP_META = googleCalendarMeta("action", "stop a channel", "https://developers.google.com/workspace/calendar/api/v3/reference/channels/stop");
|
|
66
|
+
var GOOGLE_CALENDAR_CHANNEL_STOP_OUTPUT = [
|
|
67
|
+
{
|
|
68
|
+
"path": "mode",
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Which estate this ran against. Google answers with an empty body, so this is the only thing published."
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
var googleCalendarChannelStopKind = defineConnectorKind(GOOGLE_CALENDAR_CHANNEL_STOP_META, {
|
|
74
|
+
name: GOOGLE_CALENDAR_CHANNEL_STOP_KIND,
|
|
75
|
+
aliases: ["google_calendar_channel_stop"],
|
|
76
|
+
label: "Google Calendar stop watching",
|
|
77
|
+
description: "Close a push-notification channel. The host's subscription machinery calls this before re-creating a channel and when a trigger is removed.",
|
|
78
|
+
inputs: [{ id: "in" }],
|
|
79
|
+
outputs: [{ id: "out" }],
|
|
80
|
+
sideEffects: "idempotent",
|
|
81
|
+
outputShape: GOOGLE_CALENDAR_CHANNEL_STOP_OUTPUT,
|
|
82
|
+
configSchema: [
|
|
83
|
+
{
|
|
84
|
+
"type": "text",
|
|
85
|
+
"key": "channelId",
|
|
86
|
+
"label": "Channel ID",
|
|
87
|
+
"required": true,
|
|
88
|
+
"description": "The channel's id, as sent to channel_watch."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "text",
|
|
92
|
+
"key": "resourceId",
|
|
93
|
+
"label": "Resource ID",
|
|
94
|
+
"required": true,
|
|
95
|
+
"description": "The resourceId channel_watch answered with. Both are needed; Google refuses a stop with only one."
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
defaultConfig: {
|
|
99
|
+
"mode": "auto"
|
|
100
|
+
},
|
|
101
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_CHANNEL_STOP_META, config, "stop a channel")
|
|
102
|
+
});
|
|
103
|
+
var GOOGLE_CALENDAR_CHANNEL_WATCH_KIND = "@particle-academy/google_calendar_channel_watch";
|
|
104
|
+
var GOOGLE_CALENDAR_CHANNEL_WATCH_OPERATION = "channel_watch";
|
|
105
|
+
var GOOGLE_CALENDAR_CHANNEL_WATCH_META = googleCalendarMeta("action", "watch a calendar", "https://developers.google.com/workspace/calendar/api/v3/reference/events/watch");
|
|
106
|
+
var GOOGLE_CALENDAR_CHANNEL_WATCH_OUTPUT = [
|
|
107
|
+
{
|
|
108
|
+
"path": "data.id",
|
|
109
|
+
"type": "string",
|
|
110
|
+
"description": "The channel id -- what was sent."
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"path": "data.resourceId",
|
|
114
|
+
"type": "string",
|
|
115
|
+
"description": "Google's opaque id for the watched resource. channel_stop needs it together with the channel id."
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"path": "data.resourceUri",
|
|
119
|
+
"type": "string",
|
|
120
|
+
"description": "The watched resource's URI."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"path": "data.token",
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "The token that will be echoed on every notification."
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"path": "data.expiration",
|
|
129
|
+
"type": "string",
|
|
130
|
+
"description": "When the channel expires, as epoch MILLISECONDS in a string. The subscription trigger's lease is built from this."
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"path": "mode",
|
|
134
|
+
"type": "string",
|
|
135
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
var googleCalendarChannelWatchKind = defineConnectorKind(GOOGLE_CALENDAR_CHANNEL_WATCH_META, {
|
|
139
|
+
name: GOOGLE_CALENDAR_CHANNEL_WATCH_KIND,
|
|
140
|
+
aliases: ["google_calendar_channel_watch"],
|
|
141
|
+
label: "Google Calendar watch",
|
|
142
|
+
description: "Open a push-notification channel on a calendar's events. The host's subscription machinery calls this; it is not a node most workflows need.",
|
|
143
|
+
inputs: [{ id: "in" }],
|
|
144
|
+
outputs: [{ id: "out" }],
|
|
145
|
+
sideEffects: "unsafe-to-replay",
|
|
146
|
+
outputShape: GOOGLE_CALENDAR_CHANNEL_WATCH_OUTPUT,
|
|
147
|
+
configSchema: [
|
|
148
|
+
{
|
|
149
|
+
"type": "text",
|
|
150
|
+
"key": "calendarId",
|
|
151
|
+
"label": "Calendar ID",
|
|
152
|
+
"required": true,
|
|
153
|
+
"default": "primary",
|
|
154
|
+
"description": "`primary` for the connected account's own calendar, or a calendar's id."
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"type": "text",
|
|
158
|
+
"key": "channelId",
|
|
159
|
+
"label": "Channel ID",
|
|
160
|
+
"required": true,
|
|
161
|
+
"description": "A UUID the host mints for THIS channel. Google requires it to be unique; it comes back in every notification as X-Goog-Channel-ID and is what channel_stop needs."
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"type": "text",
|
|
165
|
+
"key": "address",
|
|
166
|
+
"label": "Notification URL",
|
|
167
|
+
"required": true,
|
|
168
|
+
"description": "The HTTPS URL the host mounts for this trigger. Google POSTs notifications here with an EMPTY body and the facts in X-Goog-* headers."
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"type": "text",
|
|
172
|
+
"key": "token",
|
|
173
|
+
"label": "Channel token",
|
|
174
|
+
"required": true,
|
|
175
|
+
"description": "The connection's channelToken. The host fills this from the connection -- never type a value here. Google echoes it in X-Goog-Channel-Token, and that echo is how a delivery is verified."
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "text",
|
|
179
|
+
"key": "ttlSeconds",
|
|
180
|
+
"label": "Lifetime (seconds)",
|
|
181
|
+
"required": true,
|
|
182
|
+
"default": "604800",
|
|
183
|
+
"description": "How long Google keeps the channel alive. Google's default is 604800 (one week), and the discovery document types it as a STRING inside `params`."
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
defaultConfig: {
|
|
187
|
+
"mode": "auto"
|
|
188
|
+
},
|
|
189
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_CHANNEL_WATCH_META, config, "watch a calendar")
|
|
190
|
+
});
|
|
191
|
+
var GOOGLE_CALENDAR_EVENT_CREATE_KIND = "@particle-academy/google_calendar_event_create";
|
|
192
|
+
var GOOGLE_CALENDAR_EVENT_CREATE_OPERATION = "event_create";
|
|
193
|
+
var GOOGLE_CALENDAR_EVENT_CREATE_META = googleCalendarMeta("action", "create an event", "https://developers.google.com/workspace/calendar/api/v3/reference/events/insert");
|
|
194
|
+
var GOOGLE_CALENDAR_EVENT_CREATE_OUTPUT = [
|
|
195
|
+
{
|
|
196
|
+
"path": "data.id",
|
|
197
|
+
"type": "string",
|
|
198
|
+
"description": "The new event's id."
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"path": "data.status",
|
|
202
|
+
"type": "string",
|
|
203
|
+
"description": "confirmed or tentative, echoing what was sent (or Google's default)."
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"path": "data.summary",
|
|
207
|
+
"type": "string",
|
|
208
|
+
"description": "Echoes what was sent."
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"path": "data.htmlLink",
|
|
212
|
+
"type": "string",
|
|
213
|
+
"description": "The event in the Google Calendar UI."
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"path": "data.start.dateTime",
|
|
217
|
+
"type": "string",
|
|
218
|
+
"description": "Echoes what was sent."
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"path": "data.end.dateTime",
|
|
222
|
+
"type": "string",
|
|
223
|
+
"description": "Echoes what was sent."
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"path": "data.created",
|
|
227
|
+
"type": "string",
|
|
228
|
+
"description": "RFC 3339 creation time."
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"path": "data.organizer.email",
|
|
232
|
+
"type": "string",
|
|
233
|
+
"description": "The connected account, almost always."
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"path": "mode",
|
|
237
|
+
"type": "string",
|
|
238
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
239
|
+
}
|
|
240
|
+
];
|
|
241
|
+
var googleCalendarEventCreateKind = defineConnectorKind(GOOGLE_CALENDAR_EVENT_CREATE_META, {
|
|
242
|
+
name: GOOGLE_CALENDAR_EVENT_CREATE_KIND,
|
|
243
|
+
aliases: ["google_calendar_event_create"],
|
|
244
|
+
label: "Create Google Calendar event",
|
|
245
|
+
description: "Create a timed event on a Google Calendar.",
|
|
246
|
+
inputs: [{ id: "in" }],
|
|
247
|
+
outputs: [{ id: "out" }],
|
|
248
|
+
sideEffects: "unsafe-to-replay",
|
|
249
|
+
outputShape: GOOGLE_CALENDAR_EVENT_CREATE_OUTPUT,
|
|
250
|
+
configSchema: [
|
|
251
|
+
{
|
|
252
|
+
"type": "text",
|
|
253
|
+
"key": "calendarId",
|
|
254
|
+
"label": "Calendar ID",
|
|
255
|
+
"required": true,
|
|
256
|
+
"default": "primary",
|
|
257
|
+
"description": "`primary` for the connected account's own calendar, or a calendar's id."
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"type": "text",
|
|
261
|
+
"key": "summary",
|
|
262
|
+
"label": "Title",
|
|
263
|
+
"required": true
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"type": "textarea",
|
|
267
|
+
"key": "description",
|
|
268
|
+
"label": "Description",
|
|
269
|
+
"description": "Can contain HTML."
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"type": "text",
|
|
273
|
+
"key": "location",
|
|
274
|
+
"label": "Location",
|
|
275
|
+
"description": "Free-form text."
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"type": "text",
|
|
279
|
+
"key": "startDateTime",
|
|
280
|
+
"label": "Start",
|
|
281
|
+
"required": true,
|
|
282
|
+
"description": "RFC 3339, e.g. 2026-10-01T14:00:00Z. Include an offset, or pair with a time zone below."
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"type": "text",
|
|
286
|
+
"key": "startTimeZone",
|
|
287
|
+
"label": "Start time zone",
|
|
288
|
+
"description": "IANA name, e.g. America/New_York. Optional when the start time already carries an offset."
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"type": "text",
|
|
292
|
+
"key": "endDateTime",
|
|
293
|
+
"label": "End",
|
|
294
|
+
"required": true,
|
|
295
|
+
"description": "RFC 3339. Exclusive -- the event ends at, not through, this instant."
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"type": "text",
|
|
299
|
+
"key": "endTimeZone",
|
|
300
|
+
"label": "End time zone"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"type": "select",
|
|
304
|
+
"key": "status",
|
|
305
|
+
"label": "Status",
|
|
306
|
+
"options": [
|
|
307
|
+
{
|
|
308
|
+
"value": "confirmed",
|
|
309
|
+
"label": "Confirmed"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"value": "tentative",
|
|
313
|
+
"label": "Tentative"
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
"description": `"cancelled" is not offered here -- that is event_delete's job, not a status this action should be able to set on create.`
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"type": "select",
|
|
320
|
+
"key": "visibility",
|
|
321
|
+
"label": "Visibility",
|
|
322
|
+
"options": [
|
|
323
|
+
{
|
|
324
|
+
"value": "default",
|
|
325
|
+
"label": "Default"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"value": "public",
|
|
329
|
+
"label": "Public"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"value": "private",
|
|
333
|
+
"label": "Private"
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"type": "select",
|
|
339
|
+
"key": "transparency",
|
|
340
|
+
"label": "Show me as",
|
|
341
|
+
"options": [
|
|
342
|
+
{
|
|
343
|
+
"value": "opaque",
|
|
344
|
+
"label": "Busy"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"value": "transparent",
|
|
348
|
+
"label": "Available"
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
"description": "opaque blocks time on the calendar (Busy); transparent does not (Available)."
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"type": "text",
|
|
355
|
+
"key": "colorId",
|
|
356
|
+
"label": "Color ID",
|
|
357
|
+
"description": "An id from the colors endpoint's event section. Leave blank for the calendar's default."
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
defaultConfig: {
|
|
361
|
+
"mode": "auto"
|
|
362
|
+
},
|
|
363
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_EVENT_CREATE_META, config, "create an event")
|
|
364
|
+
});
|
|
365
|
+
var GOOGLE_CALENDAR_EVENT_DELETE_KIND = "@particle-academy/google_calendar_event_delete";
|
|
366
|
+
var GOOGLE_CALENDAR_EVENT_DELETE_OPERATION = "event_delete";
|
|
367
|
+
var GOOGLE_CALENDAR_EVENT_DELETE_META = googleCalendarMeta("action", "delete an event", "https://developers.google.com/workspace/calendar/api/v3/reference/events/delete");
|
|
368
|
+
var GOOGLE_CALENDAR_EVENT_DELETE_OUTPUT = [
|
|
369
|
+
{
|
|
370
|
+
"path": "mode",
|
|
371
|
+
"type": "string",
|
|
372
|
+
"description": "Which estate this ran against. Google answers 204 with no body, so this is the only thing published."
|
|
373
|
+
}
|
|
374
|
+
];
|
|
375
|
+
var googleCalendarEventDeleteKind = defineConnectorKind(GOOGLE_CALENDAR_EVENT_DELETE_META, {
|
|
376
|
+
name: GOOGLE_CALENDAR_EVENT_DELETE_KIND,
|
|
377
|
+
aliases: ["google_calendar_event_delete"],
|
|
378
|
+
label: "Delete Google Calendar event",
|
|
379
|
+
description: "Remove an event from a Google Calendar.",
|
|
380
|
+
inputs: [{ id: "in" }],
|
|
381
|
+
outputs: [{ id: "out" }],
|
|
382
|
+
sideEffects: "idempotent",
|
|
383
|
+
outputShape: GOOGLE_CALENDAR_EVENT_DELETE_OUTPUT,
|
|
384
|
+
configSchema: [
|
|
385
|
+
{
|
|
386
|
+
"type": "text",
|
|
387
|
+
"key": "calendarId",
|
|
388
|
+
"label": "Calendar ID",
|
|
389
|
+
"required": true,
|
|
390
|
+
"default": "primary"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"type": "text",
|
|
394
|
+
"key": "eventId",
|
|
395
|
+
"label": "Event ID",
|
|
396
|
+
"required": true,
|
|
397
|
+
"description": "From event_create's data.id, or event_list/event_get."
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
defaultConfig: {
|
|
401
|
+
"mode": "auto"
|
|
402
|
+
},
|
|
403
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_EVENT_DELETE_META, config, "delete an event")
|
|
404
|
+
});
|
|
405
|
+
var GOOGLE_CALENDAR_EVENT_GET_KIND = "@particle-academy/google_calendar_event_get";
|
|
406
|
+
var GOOGLE_CALENDAR_EVENT_GET_OPERATION = "event_get";
|
|
407
|
+
var GOOGLE_CALENDAR_EVENT_GET_META = googleCalendarMeta("action", "read an event", "https://developers.google.com/workspace/calendar/api/v3/reference/events/get");
|
|
408
|
+
var GOOGLE_CALENDAR_EVENT_GET_OUTPUT = [
|
|
409
|
+
{
|
|
410
|
+
"path": "data.id",
|
|
411
|
+
"type": "string",
|
|
412
|
+
"description": "The event id."
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"path": "data.status",
|
|
416
|
+
"type": "string",
|
|
417
|
+
"description": "confirmed, tentative or cancelled."
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"path": "data.summary",
|
|
421
|
+
"type": "string",
|
|
422
|
+
"description": "The title."
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"path": "data.description",
|
|
426
|
+
"type": "string",
|
|
427
|
+
"description": "The description, when there is one."
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"path": "data.start.dateTime",
|
|
431
|
+
"type": "string",
|
|
432
|
+
"description": "RFC 3339 start. All-day events carry start.date instead."
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"path": "data.end.dateTime",
|
|
436
|
+
"type": "string",
|
|
437
|
+
"description": "RFC 3339 end. All-day events carry end.date instead."
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"path": "data.htmlLink",
|
|
441
|
+
"type": "string",
|
|
442
|
+
"description": "The event in the Google Calendar UI."
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"path": "data.updated",
|
|
446
|
+
"type": "string",
|
|
447
|
+
"description": "RFC 3339 last modification."
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"path": "data.organizer.email",
|
|
451
|
+
"type": "string",
|
|
452
|
+
"description": "Who organises it."
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"path": "mode",
|
|
456
|
+
"type": "string",
|
|
457
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
458
|
+
}
|
|
459
|
+
];
|
|
460
|
+
var googleCalendarEventGetKind = defineConnectorKind(GOOGLE_CALENDAR_EVENT_GET_META, {
|
|
461
|
+
name: GOOGLE_CALENDAR_EVENT_GET_KIND,
|
|
462
|
+
aliases: ["google_calendar_event_get"],
|
|
463
|
+
label: "Google Calendar event",
|
|
464
|
+
description: "Read one event from a Google Calendar.",
|
|
465
|
+
inputs: [{ id: "in" }],
|
|
466
|
+
outputs: [{ id: "out" }],
|
|
467
|
+
sideEffects: "none",
|
|
468
|
+
outputShape: GOOGLE_CALENDAR_EVENT_GET_OUTPUT,
|
|
469
|
+
configSchema: [
|
|
470
|
+
{
|
|
471
|
+
"type": "text",
|
|
472
|
+
"key": "calendarId",
|
|
473
|
+
"label": "Calendar ID",
|
|
474
|
+
"required": true,
|
|
475
|
+
"default": "primary",
|
|
476
|
+
"description": "`primary` for the connected account's own calendar, or a calendar's id (usually an email address)."
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"type": "text",
|
|
480
|
+
"key": "eventId",
|
|
481
|
+
"label": "Event ID",
|
|
482
|
+
"required": true,
|
|
483
|
+
"description": "The event's id, as published by another node or by a notification's follow-up list."
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
defaultConfig: {
|
|
487
|
+
"mode": "auto"
|
|
488
|
+
},
|
|
489
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_EVENT_GET_META, config, "read an event")
|
|
490
|
+
});
|
|
491
|
+
var GOOGLE_CALENDAR_EVENT_LIST_KIND = "@particle-academy/google_calendar_event_list";
|
|
492
|
+
var GOOGLE_CALENDAR_EVENT_LIST_OPERATION = "event_list";
|
|
493
|
+
var GOOGLE_CALENDAR_EVENT_LIST_META = googleCalendarMeta("action", "list events", "https://developers.google.com/workspace/calendar/api/v3/reference/events/list");
|
|
494
|
+
var GOOGLE_CALENDAR_EVENT_LIST_OUTPUT = [
|
|
495
|
+
{
|
|
496
|
+
"path": "data.items",
|
|
497
|
+
"type": "array",
|
|
498
|
+
"description": "The events on this page, each shaped like event_get's output."
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"path": "data.nextPageToken",
|
|
502
|
+
"type": "string",
|
|
503
|
+
"description": "Present when there is another page."
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"path": "data.nextSyncToken",
|
|
507
|
+
"type": "string",
|
|
508
|
+
"description": "Present on the LAST page only. Store it and pass it as syncToken next time to get only what changed."
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"path": "data.updated",
|
|
512
|
+
"type": "string",
|
|
513
|
+
"description": "RFC 3339 last modification of the calendar."
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"path": "mode",
|
|
517
|
+
"type": "string",
|
|
518
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
519
|
+
}
|
|
520
|
+
];
|
|
521
|
+
var googleCalendarEventListKind = defineConnectorKind(GOOGLE_CALENDAR_EVENT_LIST_META, {
|
|
522
|
+
name: GOOGLE_CALENDAR_EVENT_LIST_KIND,
|
|
523
|
+
aliases: ["google_calendar_event_list"],
|
|
524
|
+
label: "Google Calendar events",
|
|
525
|
+
description: "List events from a Google Calendar, in full or incrementally with a sync token.",
|
|
526
|
+
inputs: [{ id: "in" }],
|
|
527
|
+
outputs: [{ id: "out" }],
|
|
528
|
+
sideEffects: "none",
|
|
529
|
+
outputShape: GOOGLE_CALENDAR_EVENT_LIST_OUTPUT,
|
|
530
|
+
configSchema: [
|
|
531
|
+
{
|
|
532
|
+
"type": "text",
|
|
533
|
+
"key": "calendarId",
|
|
534
|
+
"label": "Calendar ID",
|
|
535
|
+
"required": true,
|
|
536
|
+
"default": "primary",
|
|
537
|
+
"description": "`primary` for the connected account's own calendar, or a calendar's id."
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"type": "text",
|
|
541
|
+
"key": "syncToken",
|
|
542
|
+
"label": "Sync token",
|
|
543
|
+
"description": "From a previous list's nextSyncToken. With one set, Google returns ONLY what changed since -- including deletions, as cancelled events. Leave blank for a full list."
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"type": "text",
|
|
547
|
+
"key": "timeMin",
|
|
548
|
+
"label": "From",
|
|
549
|
+
"description": "RFC 3339 lower bound on an event's END time, e.g. 2026-09-15T00:00:00Z. Not allowed together with a sync token."
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"type": "text",
|
|
553
|
+
"key": "timeMax",
|
|
554
|
+
"label": "To",
|
|
555
|
+
"description": "RFC 3339 upper bound on an event's START time. Not allowed together with a sync token."
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"type": "number",
|
|
559
|
+
"key": "maxResults",
|
|
560
|
+
"label": "Page size",
|
|
561
|
+
"min": 1,
|
|
562
|
+
"max": 2500,
|
|
563
|
+
"default": 250,
|
|
564
|
+
"description": "Events per page. Google's default is 250 and its maximum 2500; a nextPageToken means there are more."
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
"type": "text",
|
|
568
|
+
"key": "pageToken",
|
|
569
|
+
"label": "Page token",
|
|
570
|
+
"description": "From a previous page's nextPageToken."
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"type": "switch",
|
|
574
|
+
"key": "singleEvents",
|
|
575
|
+
"label": "Expand recurring events",
|
|
576
|
+
"default": true,
|
|
577
|
+
"description": "Return each occurrence of a recurring event as its own item, rather than the series once."
|
|
578
|
+
}
|
|
579
|
+
],
|
|
580
|
+
defaultConfig: {
|
|
581
|
+
"mode": "auto"
|
|
582
|
+
},
|
|
583
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_EVENT_LIST_META, config, "list events")
|
|
584
|
+
});
|
|
585
|
+
var GOOGLE_CALENDAR_EVENT_UPDATE_KIND = "@particle-academy/google_calendar_event_update";
|
|
586
|
+
var GOOGLE_CALENDAR_EVENT_UPDATE_OPERATION = "event_update";
|
|
587
|
+
var GOOGLE_CALENDAR_EVENT_UPDATE_META = googleCalendarMeta("action", "update an event", "https://developers.google.com/workspace/calendar/api/v3/reference/events/patch");
|
|
588
|
+
var GOOGLE_CALENDAR_EVENT_UPDATE_OUTPUT = [
|
|
589
|
+
{
|
|
590
|
+
"path": "data.id",
|
|
591
|
+
"type": "string",
|
|
592
|
+
"description": "The event's id."
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"path": "data.status",
|
|
596
|
+
"type": "string",
|
|
597
|
+
"description": "The event's status after this update."
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
"path": "data.summary",
|
|
601
|
+
"type": "string",
|
|
602
|
+
"description": "The event's title after this update."
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"path": "data.htmlLink",
|
|
606
|
+
"type": "string",
|
|
607
|
+
"description": "The event in the Google Calendar UI."
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"path": "data.start.dateTime",
|
|
611
|
+
"type": "string",
|
|
612
|
+
"description": "The event's start after this update."
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"path": "data.end.dateTime",
|
|
616
|
+
"type": "string",
|
|
617
|
+
"description": "The event's end after this update."
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
"path": "data.updated",
|
|
621
|
+
"type": "string",
|
|
622
|
+
"description": "RFC 3339 last modification -- now."
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"path": "mode",
|
|
626
|
+
"type": "string",
|
|
627
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
628
|
+
}
|
|
629
|
+
];
|
|
630
|
+
var googleCalendarEventUpdateKind = defineConnectorKind(GOOGLE_CALENDAR_EVENT_UPDATE_META, {
|
|
631
|
+
name: GOOGLE_CALENDAR_EVENT_UPDATE_KIND,
|
|
632
|
+
aliases: ["google_calendar_event_update"],
|
|
633
|
+
label: "Update Google Calendar event",
|
|
634
|
+
description: "Change one or more fields of an existing event. Only the fields provided are touched.",
|
|
635
|
+
inputs: [{ id: "in" }],
|
|
636
|
+
outputs: [{ id: "out" }],
|
|
637
|
+
sideEffects: "idempotent",
|
|
638
|
+
outputShape: GOOGLE_CALENDAR_EVENT_UPDATE_OUTPUT,
|
|
639
|
+
configSchema: [
|
|
640
|
+
{
|
|
641
|
+
"type": "text",
|
|
642
|
+
"key": "calendarId",
|
|
643
|
+
"label": "Calendar ID",
|
|
644
|
+
"required": true,
|
|
645
|
+
"default": "primary"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"type": "text",
|
|
649
|
+
"key": "eventId",
|
|
650
|
+
"label": "Event ID",
|
|
651
|
+
"required": true,
|
|
652
|
+
"description": "From event_create's data.id, or event_list/event_get."
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"type": "text",
|
|
656
|
+
"key": "summary",
|
|
657
|
+
"label": "Title"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"type": "textarea",
|
|
661
|
+
"key": "description",
|
|
662
|
+
"label": "Description"
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
"type": "text",
|
|
666
|
+
"key": "location",
|
|
667
|
+
"label": "Location"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"type": "text",
|
|
671
|
+
"key": "startDateTime",
|
|
672
|
+
"label": "Start",
|
|
673
|
+
"description": "RFC 3339. Leave blank to leave the start time unchanged."
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"type": "text",
|
|
677
|
+
"key": "startTimeZone",
|
|
678
|
+
"label": "Start time zone"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"type": "text",
|
|
682
|
+
"key": "endDateTime",
|
|
683
|
+
"label": "End",
|
|
684
|
+
"description": "RFC 3339. Leave blank to leave the end time unchanged."
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
"type": "text",
|
|
688
|
+
"key": "endTimeZone",
|
|
689
|
+
"label": "End time zone"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"type": "select",
|
|
693
|
+
"key": "status",
|
|
694
|
+
"label": "Status",
|
|
695
|
+
"options": [
|
|
696
|
+
{
|
|
697
|
+
"value": "confirmed",
|
|
698
|
+
"label": "Confirmed"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"value": "tentative",
|
|
702
|
+
"label": "Tentative"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"value": "cancelled",
|
|
706
|
+
"label": "Cancelled"
|
|
707
|
+
}
|
|
708
|
+
],
|
|
709
|
+
"description": "Setting cancelled here has the same effect as event_delete -- offered because PATCH is also Google's documented way to cancel one instance of a recurring event, which event_delete (which removes the whole resource) cannot target."
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"type": "select",
|
|
713
|
+
"key": "visibility",
|
|
714
|
+
"label": "Visibility",
|
|
715
|
+
"options": [
|
|
716
|
+
{
|
|
717
|
+
"value": "default",
|
|
718
|
+
"label": "Default"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"value": "public",
|
|
722
|
+
"label": "Public"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"value": "private",
|
|
726
|
+
"label": "Private"
|
|
727
|
+
}
|
|
728
|
+
]
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"type": "select",
|
|
732
|
+
"key": "transparency",
|
|
733
|
+
"label": "Show me as",
|
|
734
|
+
"options": [
|
|
735
|
+
{
|
|
736
|
+
"value": "opaque",
|
|
737
|
+
"label": "Busy"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"value": "transparent",
|
|
741
|
+
"label": "Available"
|
|
742
|
+
}
|
|
743
|
+
]
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"type": "text",
|
|
747
|
+
"key": "colorId",
|
|
748
|
+
"label": "Color ID"
|
|
749
|
+
}
|
|
750
|
+
],
|
|
751
|
+
defaultConfig: {
|
|
752
|
+
"mode": "auto"
|
|
753
|
+
},
|
|
754
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_EVENT_UPDATE_META, config, "update an event")
|
|
755
|
+
});
|
|
756
|
+
var GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_KIND = "@particle-academy/google_calendar_events_changed_trigger";
|
|
757
|
+
var GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_OPERATION = "events_changed";
|
|
758
|
+
var GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_META = googleCalendarMeta("trigger", "a calendar change", "https://developers.google.com/workspace/calendar/api/guides/push");
|
|
759
|
+
var GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_OUTPUT = [
|
|
760
|
+
{
|
|
761
|
+
"path": "channelId",
|
|
762
|
+
"type": "string",
|
|
763
|
+
"description": "X-Goog-Channel-ID: which channel this came from."
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"path": "messageNumber",
|
|
767
|
+
"type": "string",
|
|
768
|
+
"description": "X-Goog-Message-Number: increases per channel; 1 is the sync message."
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
"path": "resourceId",
|
|
772
|
+
"type": "string",
|
|
773
|
+
"description": "X-Goog-Resource-ID: the watched resource."
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
"path": "resourceState",
|
|
777
|
+
"type": "string",
|
|
778
|
+
"description": "X-Goog-Resource-State: sync, exists or not_exists. `sync` carries no change."
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"path": "resourceUri",
|
|
782
|
+
"type": "string",
|
|
783
|
+
"description": "X-Goog-Resource-URI: the watched resource's URI."
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"path": "channelExpiration",
|
|
787
|
+
"type": "string",
|
|
788
|
+
"description": "X-Goog-Channel-Expiration, when Google sends it: the channel's expiry in a human-readable format, not an instant to compute with."
|
|
789
|
+
}
|
|
790
|
+
];
|
|
791
|
+
var googleCalendarEventsChangedTriggerKind = defineConnectorKind(GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_META, {
|
|
792
|
+
name: GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_KIND,
|
|
793
|
+
aliases: ["google_calendar_events_changed_trigger"],
|
|
794
|
+
label: "Google Calendar change",
|
|
795
|
+
description: "Start a run when something changes on a watched Google Calendar.",
|
|
796
|
+
icon: "\u{1F4C5}",
|
|
797
|
+
inputs: [],
|
|
798
|
+
outputs: [{ id: "out" }],
|
|
799
|
+
sideEffects: "none",
|
|
800
|
+
outputShape: GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_OUTPUT,
|
|
801
|
+
configSchema: [
|
|
802
|
+
{
|
|
803
|
+
"type": "select",
|
|
804
|
+
"key": "sample",
|
|
805
|
+
"label": "Sample state (fake mode)",
|
|
806
|
+
"default": "exists",
|
|
807
|
+
"description": "Which resource state the faked notification carries: `exists` is a change, `sync` is the first message on a new channel, `not_exists` is the resource going away.",
|
|
808
|
+
"options": [
|
|
809
|
+
{
|
|
810
|
+
"value": "exists",
|
|
811
|
+
"label": "exists \u2014 something changed"
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
"value": "sync",
|
|
815
|
+
"label": "sync \u2014 the channel just opened"
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"value": "not_exists",
|
|
819
|
+
"label": "not_exists \u2014 the resource is gone"
|
|
820
|
+
}
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
],
|
|
824
|
+
defaultConfig: {
|
|
825
|
+
"mode": "auto",
|
|
826
|
+
"sample": "exists"
|
|
827
|
+
},
|
|
828
|
+
renderBody: ({ config }) => summarize(GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_META, config, "a calendar change")
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
// src/index.ts
|
|
832
|
+
var GOOGLE_CALENDAR_KINDS = [
|
|
833
|
+
googleCalendarChannelStopKind,
|
|
834
|
+
googleCalendarChannelWatchKind,
|
|
835
|
+
googleCalendarEventCreateKind,
|
|
836
|
+
googleCalendarEventDeleteKind,
|
|
837
|
+
googleCalendarEventGetKind,
|
|
838
|
+
googleCalendarEventListKind,
|
|
839
|
+
googleCalendarEventUpdateKind,
|
|
840
|
+
googleCalendarEventsChangedTriggerKind
|
|
841
|
+
];
|
|
842
|
+
|
|
843
|
+
export { CONNECTOR_API_VERSION, GOOGLE_CALENDAR_CHANNEL_STOP_KIND, GOOGLE_CALENDAR_CHANNEL_STOP_META, GOOGLE_CALENDAR_CHANNEL_STOP_OPERATION, GOOGLE_CALENDAR_CHANNEL_STOP_OUTPUT, GOOGLE_CALENDAR_CHANNEL_WATCH_KIND, GOOGLE_CALENDAR_CHANNEL_WATCH_META, GOOGLE_CALENDAR_CHANNEL_WATCH_OPERATION, GOOGLE_CALENDAR_CHANNEL_WATCH_OUTPUT, GOOGLE_CALENDAR_CREDENTIALS, GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_KIND, GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_META, GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_OPERATION, GOOGLE_CALENDAR_EVENTS_CHANGED_TRIGGER_OUTPUT, GOOGLE_CALENDAR_EVENT_CREATE_KIND, GOOGLE_CALENDAR_EVENT_CREATE_META, GOOGLE_CALENDAR_EVENT_CREATE_OPERATION, GOOGLE_CALENDAR_EVENT_CREATE_OUTPUT, GOOGLE_CALENDAR_EVENT_DELETE_KIND, GOOGLE_CALENDAR_EVENT_DELETE_META, GOOGLE_CALENDAR_EVENT_DELETE_OPERATION, GOOGLE_CALENDAR_EVENT_DELETE_OUTPUT, GOOGLE_CALENDAR_EVENT_GET_KIND, GOOGLE_CALENDAR_EVENT_GET_META, GOOGLE_CALENDAR_EVENT_GET_OPERATION, GOOGLE_CALENDAR_EVENT_GET_OUTPUT, GOOGLE_CALENDAR_EVENT_LIST_KIND, GOOGLE_CALENDAR_EVENT_LIST_META, GOOGLE_CALENDAR_EVENT_LIST_OPERATION, GOOGLE_CALENDAR_EVENT_LIST_OUTPUT, GOOGLE_CALENDAR_EVENT_UPDATE_KIND, GOOGLE_CALENDAR_EVENT_UPDATE_META, GOOGLE_CALENDAR_EVENT_UPDATE_OPERATION, GOOGLE_CALENDAR_EVENT_UPDATE_OUTPUT, GOOGLE_CALENDAR_KINDS, GOOGLE_CALENDAR_OAUTH, GOOGLE_CALENDAR_SERVICE, googleCalendarChannelStopKind, googleCalendarChannelWatchKind, googleCalendarEventCreateKind, googleCalendarEventDeleteKind, googleCalendarEventGetKind, googleCalendarEventListKind, googleCalendarEventUpdateKind, googleCalendarEventsChangedTriggerKind, googleCalendarMeta };
|
|
844
|
+
//# sourceMappingURL=index.js.map
|
|
845
|
+
//# sourceMappingURL=index.js.map
|