@particle-academy/gmail-inbox-js 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/dist/flow.cjs ADDED
@@ -0,0 +1,676 @@
1
+ 'use strict';
2
+
3
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
4
+ var gmailInboxUi = require('@particle-academy/gmail-inbox-ui');
5
+
6
+ // src/flow.ts
7
+
8
+ // src/faker.ts
9
+ function fakeHistoryList({ config, fake }) {
10
+ return {
11
+ "history": [
12
+ {
13
+ "id": "1234567891",
14
+ "messagesAdded": [
15
+ {
16
+ "message": {
17
+ "id": fake.hex(16),
18
+ "threadId": fake.hex(16),
19
+ "labelIds": [
20
+ "INBOX",
21
+ "UNREAD"
22
+ ]
23
+ }
24
+ }
25
+ ]
26
+ }
27
+ ],
28
+ "historyId": "1234567891"
29
+ };
30
+ }
31
+ function fakeLabelList({ config, fake }) {
32
+ return {
33
+ "labels": [
34
+ {
35
+ "id": "INBOX",
36
+ "name": "INBOX",
37
+ "type": "system"
38
+ },
39
+ {
40
+ "id": "UNREAD",
41
+ "name": "UNREAD",
42
+ "type": "system"
43
+ },
44
+ {
45
+ "id": "IMPORTANT",
46
+ "name": "IMPORTANT",
47
+ "type": "system",
48
+ "messagesTotal": 412,
49
+ "messagesUnread": 18,
50
+ "threadsTotal": 203,
51
+ "threadsUnread": 11
52
+ },
53
+ {
54
+ "id": fake.id("Label"),
55
+ "name": "Design Reviews",
56
+ "type": "user",
57
+ "messageListVisibility": "show",
58
+ "labelListVisibility": "labelShow",
59
+ "messagesTotal": 27,
60
+ "messagesUnread": 2,
61
+ "threadsTotal": 9,
62
+ "threadsUnread": 1
63
+ }
64
+ ]
65
+ };
66
+ }
67
+ function fakeMailboxStop({ config, fake }) {
68
+ return {};
69
+ }
70
+ function fakeMailboxWatch({ config, fake }) {
71
+ return {
72
+ "historyId": "1234567890",
73
+ "expiration": "1767312000000"
74
+ };
75
+ }
76
+ function fakeMessageGet({ config, fake }) {
77
+ return {
78
+ "id": config.id !== void 0 && config.id !== null && config.id !== "" ? String(config.id) : fake.hex(16),
79
+ "threadId": fake.hex(16),
80
+ "labelIds": [
81
+ "INBOX",
82
+ "UNREAD",
83
+ "IMPORTANT"
84
+ ],
85
+ "snippet": "Hi Ada, just confirming the design review is still on for Thursday at 2pm. Let me know if...",
86
+ "internalDate": "1790712000000",
87
+ "payload": {
88
+ "mimeType": "text/plain",
89
+ "headers": [
90
+ {
91
+ "name": "From",
92
+ "value": "Grace Hopper <grace@example.test>"
93
+ },
94
+ {
95
+ "name": "To",
96
+ "value": "Ada Lovelace <ada@example.test>"
97
+ },
98
+ {
99
+ "name": "Subject",
100
+ "value": "Re: Design review Thursday"
101
+ },
102
+ {
103
+ "name": "Date",
104
+ "value": "Tue, 29 Sep 2026 14:03:00 -0400"
105
+ }
106
+ ],
107
+ "body": {
108
+ "size": 612,
109
+ "data": fake.id("base64url_body")
110
+ }
111
+ }
112
+ };
113
+ }
114
+ function fakeMessageList({ config, fake }) {
115
+ return {
116
+ "messages": [
117
+ {
118
+ "id": fake.hex(16),
119
+ "threadId": fake.hex(16)
120
+ },
121
+ {
122
+ "id": fake.hex(16),
123
+ "threadId": fake.hex(16)
124
+ }
125
+ ],
126
+ "resultSizeEstimate": 2
127
+ };
128
+ }
129
+ function fakeThreadGet({ config, fake }) {
130
+ return {
131
+ "id": config.id !== void 0 && config.id !== null && config.id !== "" ? String(config.id) : fake.hex(16),
132
+ "historyId": Array.from({ length: 10 }, () => fake.int(0, 9)).join(""),
133
+ "messages": [
134
+ {
135
+ "id": fake.hex(16),
136
+ "labelIds": [
137
+ "INBOX",
138
+ "IMPORTANT"
139
+ ],
140
+ "snippet": "Hey team, scheduling the Q3 design review for Thursday at 2pm. Conference room B...",
141
+ "internalDate": "1790625600000",
142
+ "payload": {
143
+ "mimeType": "text/plain",
144
+ "headers": [
145
+ {
146
+ "name": "From",
147
+ "value": "Ada Lovelace <ada@example.test>"
148
+ },
149
+ {
150
+ "name": "To",
151
+ "value": "Grace Hopper <grace@example.test>"
152
+ },
153
+ {
154
+ "name": "Subject",
155
+ "value": "Design review Thursday"
156
+ },
157
+ {
158
+ "name": "Date",
159
+ "value": "Mon, 28 Sep 2026 09:00:00 -0400"
160
+ }
161
+ ],
162
+ "body": {
163
+ "size": 540,
164
+ "data": fake.id("base64url_body")
165
+ }
166
+ }
167
+ },
168
+ {
169
+ "id": fake.hex(16),
170
+ "labelIds": [
171
+ "INBOX",
172
+ "UNREAD",
173
+ "IMPORTANT"
174
+ ],
175
+ "snippet": "Hi Ada, just confirming the design review is still on for Thursday at 2pm. Let me know if...",
176
+ "internalDate": "1790712000000",
177
+ "payload": {
178
+ "mimeType": "text/plain",
179
+ "headers": [
180
+ {
181
+ "name": "From",
182
+ "value": "Grace Hopper <grace@example.test>"
183
+ },
184
+ {
185
+ "name": "To",
186
+ "value": "Ada Lovelace <ada@example.test>"
187
+ },
188
+ {
189
+ "name": "Subject",
190
+ "value": "Re: Design review Thursday"
191
+ },
192
+ {
193
+ "name": "Date",
194
+ "value": "Tue, 29 Sep 2026 14:03:00 -0400"
195
+ }
196
+ ],
197
+ "body": {
198
+ "size": 612,
199
+ "data": fake.id("base64url_body")
200
+ }
201
+ }
202
+ }
203
+ ]
204
+ };
205
+ }
206
+ function fakeMessageReceived({ config, fake }) {
207
+ return {
208
+ "subscription": "projects/my-project/subscriptions/gmail-push",
209
+ "messageId": Array.from({ length: 16 }, () => fake.int(0, 9)).join(""),
210
+ "publishTime": "2026-11-08T09:00:00.000Z",
211
+ "attributes": {},
212
+ "deliveryAttempt": null,
213
+ "data": {
214
+ "emailAddress": "user@example.test",
215
+ "historyId": 1234567891
216
+ }
217
+ };
218
+ }
219
+ var gmailInboxFaker = (operation, request) => {
220
+ switch (operation) {
221
+ case "history_list":
222
+ return fakeHistoryList(request);
223
+ case "label_list":
224
+ return fakeLabelList(request);
225
+ case "mailbox_stop":
226
+ return fakeMailboxStop(request);
227
+ case "mailbox_watch":
228
+ return fakeMailboxWatch(request);
229
+ case "message_get":
230
+ return fakeMessageGet(request);
231
+ case "message_list":
232
+ return fakeMessageList(request);
233
+ case "thread_get":
234
+ return fakeThreadGet(request);
235
+ case "message_received":
236
+ return fakeMessageReceived(request);
237
+ default:
238
+ throw new Error(
239
+ `gmail_inbox: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
240
+ );
241
+ }
242
+ };
243
+
244
+ // src/service.ts
245
+ var GMAIL_INBOX_BASE_URLS = {
246
+ "live": "https://gmail.googleapis.com"
247
+ };
248
+ var GMAIL_INBOX_REQUIRES = [
249
+ "accessToken",
250
+ "refreshToken",
251
+ "clientId",
252
+ "clientSecret"
253
+ ];
254
+ function gmailInboxAuthorize(credentials, request, _mode) {
255
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
256
+ }
257
+ var GMAIL_INBOX = {
258
+ service: "gmail_inbox",
259
+ title: "Gmail Inbox",
260
+ sandbox: "none",
261
+ baseUrls: { ...GMAIL_INBOX_BASE_URLS },
262
+ requires: [...GMAIL_INBOX_REQUIRES],
263
+ authorize: gmailInboxAuthorize,
264
+ faker: gmailInboxFaker
265
+ };
266
+ var HISTORY_LIST_OPERATION = "history_list";
267
+ async function gmailInboxHistoryList(options) {
268
+ const config = options.config ?? {};
269
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
270
+ throw new Error(`history_list: "userId" is required (Mailbox).`);
271
+ }
272
+ if (config.startHistoryId === void 0 || config.startHistoryId === null || config.startHistoryId === "") {
273
+ throw new Error(`history_list: "startHistoryId" is required (Start history id).`);
274
+ }
275
+ {
276
+ const n = Number(config.maxResults);
277
+ const given = config.maxResults !== void 0 && config.maxResults !== null && config.maxResults !== "";
278
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 500)) {
279
+ throw new Error(
280
+ `history_list: "maxResults" must be a integer, got ${JSON.stringify(config.maxResults)}.`
281
+ );
282
+ }
283
+ }
284
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
285
+ operation: HISTORY_LIST_OPERATION,
286
+ config,
287
+ input: options.input,
288
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
289
+ ...options.mode === void 0 ? {} : { mode: options.mode },
290
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
291
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
292
+ ...options.transport === void 0 ? {} : { transport: options.transport },
293
+ request: {
294
+ method: "GET",
295
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/history`,
296
+ query: {
297
+ "startHistoryId": String(config.startHistoryId),
298
+ ...config.historyTypes !== void 0 && config.historyTypes !== null && config.historyTypes !== "" ? { "historyTypes": String(config.historyTypes) } : {},
299
+ ...config.labelId !== void 0 && config.labelId !== null && config.labelId !== "" ? { "labelId": String(config.labelId) } : {},
300
+ "maxResults": config.maxResults !== void 0 && config.maxResults !== null && config.maxResults !== "" ? Math.trunc(Number(config.maxResults)) : 100,
301
+ ...config.pageToken !== void 0 && config.pageToken !== null && config.pageToken !== "" ? { "pageToken": String(config.pageToken) } : {}
302
+ }
303
+ }
304
+ });
305
+ }
306
+ var LABEL_LIST_OPERATION = "label_list";
307
+ async function gmailInboxLabelList(options) {
308
+ const config = options.config ?? {};
309
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
310
+ throw new Error(`label_list: "userId" is required (Mailbox).`);
311
+ }
312
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
313
+ operation: LABEL_LIST_OPERATION,
314
+ config,
315
+ input: options.input,
316
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
317
+ ...options.mode === void 0 ? {} : { mode: options.mode },
318
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
319
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
320
+ ...options.transport === void 0 ? {} : { transport: options.transport },
321
+ request: {
322
+ method: "GET",
323
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/labels`,
324
+ query: {}
325
+ }
326
+ });
327
+ }
328
+ var MAILBOX_STOP_OPERATION = "mailbox_stop";
329
+ async function gmailInboxMailboxStop(options) {
330
+ const config = options.config ?? {};
331
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
332
+ throw new Error(`mailbox_stop: "userId" is required (Mailbox).`);
333
+ }
334
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
335
+ operation: MAILBOX_STOP_OPERATION,
336
+ config,
337
+ input: options.input,
338
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
339
+ ...options.mode === void 0 ? {} : { mode: options.mode },
340
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
341
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
342
+ ...options.transport === void 0 ? {} : { transport: options.transport },
343
+ request: {
344
+ method: "POST",
345
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/stop`,
346
+ json: {}
347
+ }
348
+ });
349
+ }
350
+ var MAILBOX_WATCH_OPERATION = "mailbox_watch";
351
+ async function gmailInboxMailboxWatch(options) {
352
+ const config = options.config ?? {};
353
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
354
+ throw new Error(`mailbox_watch: "userId" is required (Mailbox).`);
355
+ }
356
+ if (config.topicName === void 0 || config.topicName === null || config.topicName === "") {
357
+ throw new Error(`mailbox_watch: "topicName" is required (Pub/Sub topic).`);
358
+ }
359
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
360
+ operation: MAILBOX_WATCH_OPERATION,
361
+ config,
362
+ input: options.input,
363
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
364
+ ...options.mode === void 0 ? {} : { mode: options.mode },
365
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
366
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
367
+ ...options.transport === void 0 ? {} : { transport: options.transport },
368
+ request: {
369
+ method: "POST",
370
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/watch`,
371
+ json: {
372
+ "topicName": String(config.topicName).trim(),
373
+ ...config.labelIds !== void 0 && config.labelIds !== null && config.labelIds !== "" ? { "labelIds": labelidsList(config.labelIds) } : {},
374
+ ...config.labelFilterBehavior !== void 0 && config.labelFilterBehavior !== null && config.labelFilterBehavior !== "" ? { "labelFilterBehavior": String(config.labelFilterBehavior) } : {}
375
+ }
376
+ }
377
+ });
378
+ }
379
+ function labelidsList(value) {
380
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
381
+ return items.map((item) => item.trim()).filter(Boolean);
382
+ }
383
+ var MESSAGE_GET_OPERATION = "message_get";
384
+ async function gmailInboxMessageGet(options) {
385
+ const config = options.config ?? {};
386
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
387
+ throw new Error(`message_get: "userId" is required (Mailbox).`);
388
+ }
389
+ if (config.id === void 0 || config.id === null || config.id === "") {
390
+ throw new Error(`message_get: "id" is required (Message ID).`);
391
+ }
392
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
393
+ operation: MESSAGE_GET_OPERATION,
394
+ config,
395
+ input: options.input,
396
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
397
+ ...options.mode === void 0 ? {} : { mode: options.mode },
398
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
399
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
400
+ ...options.transport === void 0 ? {} : { transport: options.transport },
401
+ request: {
402
+ method: "GET",
403
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/messages/${encodeURIComponent(String(config.id))}`,
404
+ query: {
405
+ "format": "full"
406
+ }
407
+ }
408
+ });
409
+ }
410
+ var MESSAGE_LIST_OPERATION = "message_list";
411
+ async function gmailInboxMessageList(options) {
412
+ const config = options.config ?? {};
413
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
414
+ throw new Error(`message_list: "userId" is required (Mailbox).`);
415
+ }
416
+ {
417
+ const n = Number(config.maxResults);
418
+ const given = config.maxResults !== void 0 && config.maxResults !== null && config.maxResults !== "";
419
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 500)) {
420
+ throw new Error(
421
+ `message_list: "maxResults" must be a integer, got ${JSON.stringify(config.maxResults)}.`
422
+ );
423
+ }
424
+ }
425
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
426
+ operation: MESSAGE_LIST_OPERATION,
427
+ config,
428
+ input: options.input,
429
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
430
+ ...options.mode === void 0 ? {} : { mode: options.mode },
431
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
432
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
433
+ ...options.transport === void 0 ? {} : { transport: options.transport },
434
+ request: {
435
+ method: "GET",
436
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/messages`,
437
+ query: {
438
+ ...config.q !== void 0 && config.q !== null && config.q !== "" ? { "q": String(config.q) } : {},
439
+ ...config.labelId !== void 0 && config.labelId !== null && config.labelId !== "" ? { "labelIds": String(config.labelId) } : {},
440
+ ...config.includeSpamTrash !== void 0 && config.includeSpamTrash !== null && config.includeSpamTrash !== "" ? { "includeSpamTrash": Boolean(config.includeSpamTrash) } : {},
441
+ "maxResults": config.maxResults !== void 0 && config.maxResults !== null && config.maxResults !== "" ? Math.trunc(Number(config.maxResults)) : 100,
442
+ ...config.pageToken !== void 0 && config.pageToken !== null && config.pageToken !== "" ? { "pageToken": String(config.pageToken) } : {}
443
+ }
444
+ }
445
+ });
446
+ }
447
+ var THREAD_GET_OPERATION = "thread_get";
448
+ async function gmailInboxThreadGet(options) {
449
+ const config = options.config ?? {};
450
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
451
+ throw new Error(`thread_get: "userId" is required (Mailbox).`);
452
+ }
453
+ if (config.id === void 0 || config.id === null || config.id === "") {
454
+ throw new Error(`thread_get: "id" is required (Thread ID).`);
455
+ }
456
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
457
+ operation: THREAD_GET_OPERATION,
458
+ config,
459
+ input: options.input,
460
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
461
+ ...options.mode === void 0 ? {} : { mode: options.mode },
462
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
463
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
464
+ ...options.transport === void 0 ? {} : { transport: options.transport },
465
+ request: {
466
+ method: "GET",
467
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/threads/${encodeURIComponent(String(config.id))}`,
468
+ query: {
469
+ "format": "full"
470
+ }
471
+ }
472
+ });
473
+ }
474
+ var GMAIL_INBOX_MESSAGE_RECEIVED_OIDC_SCHEME = {
475
+ kind: "oidc-jwt",
476
+ header: "Authorization",
477
+ issuers: ["https://accounts.google.com", "accounts.google.com"],
478
+ principalClaim: "email",
479
+ verifiedClaim: "email_verified"
480
+ };
481
+ var GMAIL_INBOX_MESSAGE_RECEIVED_LEASE = {
482
+ expiresAtFrom: "expiration",
483
+ expiresAtUnit: "epoch-ms",
484
+ renewBeforeSeconds: 86400,
485
+ renewOperation: "mailbox_watch"
486
+ };
487
+ var GMAIL_INBOX_MESSAGE_RECEIVED_DECODE = {
488
+ kind: "pubsub-push"
489
+ };
490
+ var GMAIL_INBOX_MESSAGE_RECEIVED = {
491
+ service: "gmail_inbox",
492
+ operation: "message_received",
493
+ delivery: "subscription",
494
+ setup: "In YOUR app's Google Cloud project (the one owning the OAuth client): create a Pub/Sub topic, grant publish on it to gmail-api-push@system.gserviceaccount.com, and create a PUSH subscription to the route your host mounts for this trigger, with authentication on (a service account you choose; the endpoint URL as the audience). Put that audience and service account on the connection as pushAudience and pushServiceAccount, and fetch Google's signing keys for verification. Then call mailbox_watch with the topic for each mailbox and store its historyId as the trigger's cursor (startHistoryId); renew the watch daily. ONE topic serves every mailbox: route each push by its emailAddress, and only after the token verifies, to a mailbox you watched; drop an unmapped address with a 2xx. Persist cursor.next when a run succeeds. On cursor-expired or cursor-overflow, watch again for a fresh historyId FIRST, then list with message_list using the resyncQuery, and match it against the mail you already handled. This trigger never changes read state.",
495
+ subscriptionTtl: 604800,
496
+ lease: GMAIL_INBOX_MESSAGE_RECEIVED_LEASE,
497
+ verification: {
498
+ scheme: GMAIL_INBOX_MESSAGE_RECEIVED_OIDC_SCHEME
499
+ },
500
+ decode: GMAIL_INBOX_MESSAGE_RECEIVED_DECODE,
501
+ route: { by: "emailAddress", path: "data.emailAddress" },
502
+ faker: gmailInboxFaker
503
+ };
504
+ var GMAIL_INBOX_MESSAGE_RECEIVED_CURSOR = {
505
+ param: "startHistoryId",
506
+ advanceFrom: "historyId",
507
+ page: { param: "pageToken", from: "nextPageToken", collect: "history", maxPages: 20 },
508
+ expiredStatus: 404
509
+ };
510
+ async function readGmailInboxMessageReceivedAfter(event, config, options = {}) {
511
+ const stored = config.startHistoryId ?? (config.mode === "fake" ? "1" : void 0);
512
+ const read = await fancyConnectorCore.readWithCursor(
513
+ GMAIL_INBOX_MESSAGE_RECEIVED_CURSOR,
514
+ stored,
515
+ async (params) => {
516
+ const result = await gmailInboxHistoryList({
517
+ config: {
518
+ userId: "me",
519
+ maxResults: 100,
520
+ ...config.connection === void 0 || config.connection === null ? {} : { connection: config.connection },
521
+ ...config.mode === void 0 || config.mode === null ? {} : { mode: config.mode },
522
+ labelId: config.labelId ?? "INBOX",
523
+ historyTypes: config.historyTypes ?? "messageAdded",
524
+ ...params
525
+ },
526
+ input: event,
527
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
528
+ ...options.transport === void 0 ? {} : { transport: options.transport }
529
+ });
530
+ return result.data;
531
+ },
532
+ { resyncQuery: `newer_than:${String(config.resyncWindowDays ?? 7)}d` }
533
+ );
534
+ return {
535
+ ...event !== null && typeof event === "object" ? event : {},
536
+ history: read.data,
537
+ cursor: read.cursor
538
+ };
539
+ }
540
+
541
+ // src/flow.ts
542
+ var gmailInboxHistoryListExecutor = async (ctx) => {
543
+ const config = ctx.node.data?.config ?? {};
544
+ const result = await gmailInboxHistoryList({
545
+ config,
546
+ input: ctx.inputs?.in
547
+ });
548
+ ctx.emit({
549
+ type: "log",
550
+ level: "info",
551
+ nodeId: ctx.node.id,
552
+ message: `gmail_inbox history_list ${result.data?.id} (${result.mode})`
553
+ });
554
+ return { __port: "out", value: result };
555
+ };
556
+ var gmailInboxLabelListExecutor = async (ctx) => {
557
+ const config = ctx.node.data?.config ?? {};
558
+ const result = await gmailInboxLabelList({
559
+ config,
560
+ input: ctx.inputs?.in
561
+ });
562
+ ctx.emit({
563
+ type: "log",
564
+ level: "info",
565
+ nodeId: ctx.node.id,
566
+ message: `gmail_inbox label_list ${result.data?.id} (${result.mode})`
567
+ });
568
+ return { __port: "out", value: result };
569
+ };
570
+ var gmailInboxMailboxStopExecutor = async (ctx) => {
571
+ const config = ctx.node.data?.config ?? {};
572
+ const result = await gmailInboxMailboxStop({
573
+ config,
574
+ input: ctx.inputs?.in
575
+ });
576
+ ctx.emit({
577
+ type: "log",
578
+ level: "info",
579
+ nodeId: ctx.node.id,
580
+ message: `gmail_inbox mailbox_stop ${result.data?.id} (${result.mode})`
581
+ });
582
+ return { __port: "out", value: result };
583
+ };
584
+ var gmailInboxMailboxWatchExecutor = async (ctx) => {
585
+ const config = ctx.node.data?.config ?? {};
586
+ const result = await gmailInboxMailboxWatch({
587
+ config,
588
+ input: ctx.inputs?.in
589
+ });
590
+ ctx.emit({
591
+ type: "log",
592
+ level: "info",
593
+ nodeId: ctx.node.id,
594
+ message: `gmail_inbox mailbox_watch ${result.data?.id} (${result.mode})`
595
+ });
596
+ return { __port: "out", value: result };
597
+ };
598
+ var gmailInboxMessageGetExecutor = async (ctx) => {
599
+ const config = ctx.node.data?.config ?? {};
600
+ const result = await gmailInboxMessageGet({
601
+ config,
602
+ input: ctx.inputs?.in
603
+ });
604
+ ctx.emit({
605
+ type: "log",
606
+ level: "info",
607
+ nodeId: ctx.node.id,
608
+ message: `gmail_inbox message_get ${result.data?.id} (${result.mode})`
609
+ });
610
+ return { __port: "out", value: result };
611
+ };
612
+ var gmailInboxMessageListExecutor = async (ctx) => {
613
+ const config = ctx.node.data?.config ?? {};
614
+ const result = await gmailInboxMessageList({
615
+ config,
616
+ input: ctx.inputs?.in
617
+ });
618
+ ctx.emit({
619
+ type: "log",
620
+ level: "info",
621
+ nodeId: ctx.node.id,
622
+ message: `gmail_inbox message_list ${result.data?.id} (${result.mode})`
623
+ });
624
+ return { __port: "out", value: result };
625
+ };
626
+ var gmailInboxThreadGetExecutor = async (ctx) => {
627
+ const config = ctx.node.data?.config ?? {};
628
+ const result = await gmailInboxThreadGet({
629
+ config,
630
+ input: ctx.inputs?.in
631
+ });
632
+ ctx.emit({
633
+ type: "log",
634
+ level: "info",
635
+ nodeId: ctx.node.id,
636
+ message: `gmail_inbox thread_get ${result.data?.id} (${result.mode})`
637
+ });
638
+ return { __port: "out", value: result };
639
+ };
640
+ var gmailInboxMessageReceivedTriggerExecutor = async (ctx) => {
641
+ const config = ctx.node.data?.config ?? {};
642
+ const connection = fancyConnectorCore.resolveConnection({
643
+ service: GMAIL_INBOX.service,
644
+ operation: "message_received",
645
+ sandbox: GMAIL_INBOX.sandbox,
646
+ baseUrls: GMAIL_INBOX.baseUrls,
647
+ requires: GMAIL_INBOX.requires,
648
+ connectionId: typeof config.connection === "string" ? config.connection : null,
649
+ requested: typeof config.mode === "string" ? config.mode : null
650
+ });
651
+ const event = fancyConnectorCore.triggerEvent(GMAIL_INBOX_MESSAGE_RECEIVED, connection, ctx.inputs?.in, config);
652
+ const value = await readGmailInboxMessageReceivedAfter(event, config);
653
+ return { __port: "out", value };
654
+ };
655
+ var GMAIL_INBOX_RUNNABLE_KINDS = [
656
+ { ...gmailInboxUi.gmailInboxHistoryListKind, executor: gmailInboxHistoryListExecutor },
657
+ { ...gmailInboxUi.gmailInboxLabelListKind, executor: gmailInboxLabelListExecutor },
658
+ { ...gmailInboxUi.gmailInboxMailboxStopKind, executor: gmailInboxMailboxStopExecutor },
659
+ { ...gmailInboxUi.gmailInboxMailboxWatchKind, executor: gmailInboxMailboxWatchExecutor },
660
+ { ...gmailInboxUi.gmailInboxMessageGetKind, executor: gmailInboxMessageGetExecutor },
661
+ { ...gmailInboxUi.gmailInboxMessageListKind, executor: gmailInboxMessageListExecutor },
662
+ { ...gmailInboxUi.gmailInboxThreadGetKind, executor: gmailInboxThreadGetExecutor },
663
+ { ...gmailInboxUi.gmailInboxMessageReceivedTriggerKind, executor: gmailInboxMessageReceivedTriggerExecutor }
664
+ ];
665
+
666
+ exports.GMAIL_INBOX_RUNNABLE_KINDS = GMAIL_INBOX_RUNNABLE_KINDS;
667
+ exports.gmailInboxHistoryListExecutor = gmailInboxHistoryListExecutor;
668
+ exports.gmailInboxLabelListExecutor = gmailInboxLabelListExecutor;
669
+ exports.gmailInboxMailboxStopExecutor = gmailInboxMailboxStopExecutor;
670
+ exports.gmailInboxMailboxWatchExecutor = gmailInboxMailboxWatchExecutor;
671
+ exports.gmailInboxMessageGetExecutor = gmailInboxMessageGetExecutor;
672
+ exports.gmailInboxMessageListExecutor = gmailInboxMessageListExecutor;
673
+ exports.gmailInboxMessageReceivedTriggerExecutor = gmailInboxMessageReceivedTriggerExecutor;
674
+ exports.gmailInboxThreadGetExecutor = gmailInboxThreadGetExecutor;
675
+ //# sourceMappingURL=flow.cjs.map
676
+ //# sourceMappingURL=flow.cjs.map