@particle-academy/gmail-inbox-ui 0.1.0 → 0.3.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 CHANGED
@@ -12,6 +12,63 @@ derived — somebody has to write what changed — but writing it in the
12
12
  provider repo would be a hand-edit that `.weaver.json` flags and the next
13
13
  sync destroys.
14
14
 
15
+ ## [0.3.0] — 2026-11-08
16
+
17
+ ### Added
18
+
19
+ - **Laravel integration, in this package** (`src/Laravel/`), auto-discovered
20
+ through composer's `extra.laravel`. Laravel is SUGGESTED, never required:
21
+ outside a Laravel app none of it loads.
22
+ - a service provider that merges `config/gmail-inbox.php` under
23
+ `connectors.gmail-inbox` (credentials from the environment, or per call for a
24
+ multi-account app);
25
+ - the `GmailInbox` facade: `GmailInbox::call('<operation>', [...])` runs any action;
26
+ - `GmailInbox::fake()`, answered from the connector's faker, with
27
+ `assertSent` / `assertNotSent` / `assertNothingSent` / `assertSentCount`;
28
+ - a webhook ROUTE per trigger (`Route::gmailInboxMessageReceived('/path')`) that VERIFIES the raw delivery with the trigger's own scheme before the app sees it, answers 401 with the reason when it does not, then dispatches an event (`Events\\…Received`);
29
+ - its own Pest test of all of it against a booted Laravel app.
30
+
31
+ ### Changed
32
+
33
+ - **Tests: Pest `^5`**, and `laravel/framework` `^13` as a DEV-ONLY test
34
+ dependency (the framework this package integrates with; nothing ships in
35
+ `require`).
36
+
37
+ ## [0.2.0] — 2026-11-08
38
+
39
+ ### Added
40
+
41
+ - **`message_received`: a trigger for new Gmail mail, still read-only**
42
+ (`gmail.readonly` is the only scope). `mailbox_watch` makes Gmail publish
43
+ mailbox changes to a Cloud Pub/Sub topic in YOUR app's own Google Cloud
44
+ project, and a push subscription delivers each change to your host.
45
+ - **Every push is verified before anything reads it.** It carries a
46
+ Google-signed token in `Authorization`, checked for Google's issuer, the
47
+ subscription's audience (`pushAudience`), and the push service account
48
+ with `email_verified` true (`pushServiceAccount`). The service-account
49
+ check is what refuses a stranger's subscription aimed at your URL.
50
+ - **Routing.** The Pub/Sub envelope is unwrapped, then the push is routed by
51
+ `emailAddress`, only after verification. One topic serves every mailbox.
52
+ - **What arrives.** A push carries only the mailbox's NEW position, so the
53
+ trigger reads `history.list` from the cursor YOUR HOST stored. It reads
54
+ every page and publishes the changes under `history` with `cursor: {used,
55
+ next}`. Your host persists `cursor.next` when a run succeeds.
56
+ - **Received mail only, by default:** `labelId: INBOX` and `historyTypes:
57
+ messageAdded`, so no sent mail or drafts. Widen either in the trigger's
58
+ config.
59
+ - **A lapsed cursor** (Gmail's 404) or more than 20 pages fails by name, as
60
+ `cursor-expired` or `cursor-overflow`. Each carries a bounded resync query
61
+ (`newer_than:7d`; `resyncWindowDays` sets it, default 7). Watch again
62
+ first, then list with that query. The mailbox is never fully re-pulled.
63
+ - **The watch is a lease:** Gmail's `expiration` is in epoch milliseconds,
64
+ renewed by watching again, a day early. Google requires at least once
65
+ every 7 days and recommends daily.
66
+ - **Read state is never changed.**
67
+
68
+ New actions: `mailbox_watch`, `mailbox_stop` and `history_list`. New
69
+ credentials: `pushAudience` and `pushServiceAccount`, needed only for the
70
+ trigger. Requires fancy-connector-core 0.14.0.
71
+
15
72
  ## [0.1.0] — 2026-10-01
16
73
 
17
74
  ### Added
package/README.md CHANGED
@@ -35,7 +35,7 @@ Everything below is generated from `provider/manifest.json`, so it cannot disagr
35
35
 
36
36
  ### Credentials
37
37
 
38
- A Gmail Inbox connection holds 4 values.
38
+ A Gmail Inbox connection holds 6 values.
39
39
 
40
40
  **Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
41
41
 
@@ -45,6 +45,8 @@ A Gmail Inbox connection holds 4 values.
45
45
  | **OAuth client secret** | per installation | **secret** | The client secret for the same OAuth app. One value for the whole installation. |
46
46
  | **Access token** | per connected account | **secret** | Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token. |
47
47
  | **Refresh token** | per connected account | **secret** | Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour. |
48
+ | **Push audience** *(optional)* | per installation | not secret | The audience set on the Pub/Sub PUSH subscription (normally the endpoint URL your host mounts for message_received). Every push's Google-signed token must name it; an unchecked audience accepts any token Google signs for anyone. Needed only for the message_received trigger. |
49
+ | **Push service account** *(optional)* | per installation | not secret | The service account the push subscription authenticates as (its email). Every push's token must be for exactly this account: a stranger's subscription aimed at your URL carries a token Google signed correctly, and only this check refuses it. Needed only for message_received. |
48
50
 
49
51
  ### Authorising
50
52
 
@@ -67,6 +69,21 @@ The refresh tokens do **not** rotate: the same one is reusable, so a refresh may
67
69
 
68
70
  ### Actions
69
71
 
72
+ #### `history_list` — List Gmail mailbox history
73
+
74
+ List what changed in a mailbox since a history id: messages added or deleted, labels added or removed.
75
+
76
+ `GET /gmail/v1/users/{userId}/history` · reads only — safe to replay
77
+
78
+ | Input | Required | What it is |
79
+ |---|---|---|
80
+ | `userId` | yes | `me` is the connected account and is almost always what you want. |
81
+ | `startHistoryId` | yes | Changes AFTER this id. Take it from a watch, a message, or a previous list's historyId. Out of Gmail's range (typically older than a week) it answers 404. |
82
+ | `historyTypes` | no | Blank: every kind. messageAdded is new mail (and sent mail and drafts, unless a label narrows it). |
83
+ | `labelId` | no | Only messages with this label, e.g. INBOX for received mail. |
84
+ | `maxResults` | no | Gmail's own maximum is 500. |
85
+ | `pageToken` | no | From a previous page's nextPageToken. |
86
+
70
87
  #### `label_list` — List Gmail labels
71
88
 
72
89
  List every label on the mailbox, system and user-created.
@@ -77,6 +94,29 @@ List every label on the mailbox, system and user-created.
77
94
  |---|---|---|
78
95
  | `userId` | yes | Mailbox |
79
96
 
97
+ #### `mailbox_stop` — Stop watching a Gmail mailbox
98
+
99
+ Turn off push notifications for a mailbox.
100
+
101
+ `POST /gmail/v1/users/{userId}/stop` · idempotent — safe to replay
102
+
103
+ | Input | Required | What it is |
104
+ |---|---|---|
105
+ | `userId` | yes | `me` is the connected account and is almost always what you want. |
106
+
107
+ #### `mailbox_watch` — Watch a Gmail mailbox
108
+
109
+ Start (or renew) push notifications for a mailbox to a Cloud Pub/Sub topic.
110
+
111
+ `POST /gmail/v1/users/{userId}/watch` · idempotent — safe to replay
112
+
113
+ | Input | Required | What it is |
114
+ |---|---|---|
115
+ | `userId` | yes | `me` is the connected account and is almost always what you want. |
116
+ | `topicName` | yes | The full topic name, in YOUR app's own Google Cloud project: Google requires its project id to match the project whose OAuth client makes this call. One topic serves every mailbox. |
117
+ | `labelIds` | no | Comma-separated label ids to restrict notifications to (e.g. INBOX). Blank: every change is pushed. |
118
+ | `labelFilterBehavior` | no | Whether the labels above are the ONLY ones notified (include) or the ones NOT notified (exclude). |
119
+
80
120
  #### `message_get` — Gmail message
81
121
 
82
122
  Read one message's headers and preview. The body's plain/HTML text is NOT decoded -- see the raw payload for that.
@@ -114,6 +154,18 @@ Read every message in a conversation thread, oldest first.
114
154
  | `userId` | yes | Mailbox |
115
155
  | `id` | yes | A message's threadId, from message_list or message_get. |
116
156
 
157
+ ### Triggers
158
+
159
+ #### `message_received` — Gmail message received
160
+
161
+ Start when new mail arrives in a watched mailbox, with every new message since the last run.
162
+
163
+ A SUBSCRIPTION: Gmail Inbox delivers to your endpoint only while a subscription it issued is alive, at most 168 hours at a time. Its expiry is read from the `mailbox_watch` response (`expiration`); 86400 seconds before it, the host renews it (`mailbox_watch`). A lease that lapses is re-listed AND re-subscribed, because notifications during the gap are gone. Every delivery: the signature is verified before anything runs. The delivery only names what arrived, so the run's first step reads it: `history_list` with , published under `history`. A failed read fails the run.
164
+
165
+ **You have to set this up with the provider first:**
166
+
167
+ 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.
168
+
117
169
  ## Run it before you have credentials
118
170
 
119
171
  Every operation ships a **faker**, whether or not Gmail Inbox has a sandbox. Set a
package/dist/index.cjs CHANGED
@@ -38,6 +38,22 @@ var GMAIL_INBOX_CREDENTIALS = [
38
38
  "scope": "account",
39
39
  "secret": true,
40
40
  "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."
41
+ },
42
+ {
43
+ "key": "pushAudience",
44
+ "label": "Push audience",
45
+ "scope": "provider",
46
+ "secret": false,
47
+ "optional": true,
48
+ "help": "The audience set on the Pub/Sub PUSH subscription (normally the endpoint URL your host mounts for message_received). Every push's Google-signed token must name it; an unchecked audience accepts any token Google signs for anyone. Needed only for the message_received trigger."
49
+ },
50
+ {
51
+ "key": "pushServiceAccount",
52
+ "label": "Push service account",
53
+ "scope": "provider",
54
+ "secret": false,
55
+ "optional": true,
56
+ "help": "The service account the push subscription authenticates as (its email). Every push's token must be for exactly this account: a stranger's subscription aimed at your URL carries a token Google signed correctly, and only this check refuses it. Needed only for message_received."
41
57
  }
42
58
  ];
43
59
  var GMAIL_INBOX_OAUTH = {
@@ -55,6 +71,107 @@ var GMAIL_INBOX_OAUTH = {
55
71
  function gmailInboxMeta(role, operation, docs) {
56
72
  return { ...GMAIL_INBOX_SERVICE, role, operation, docs };
57
73
  }
74
+ var GMAIL_INBOX_HISTORY_LIST_KIND = "@particle-academy/gmail_inbox_history_list";
75
+ var GMAIL_INBOX_HISTORY_LIST_OPERATION = "history_list";
76
+ var GMAIL_INBOX_HISTORY_LIST_META = gmailInboxMeta("action", "list mailbox history", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.history/list");
77
+ var GMAIL_INBOX_HISTORY_LIST_OUTPUT = [
78
+ {
79
+ "path": "data.history",
80
+ "type": "array",
81
+ "description": "History records, oldest first. Each has an id and messagesAdded / messagesDeleted / labelsAdded / labelsRemoved; a message there carries only id and threadId: read its content with message_get."
82
+ },
83
+ {
84
+ "path": "data.historyId",
85
+ "type": "string",
86
+ "description": "The mailbox's CURRENT history id. Store it as the next start ONLY when there is no nextPageToken."
87
+ },
88
+ {
89
+ "path": "data.nextPageToken",
90
+ "type": "string",
91
+ "description": "Present when there is another page."
92
+ },
93
+ {
94
+ "path": "mode",
95
+ "type": "string",
96
+ "description": "Which estate this ran against. Google has no sandbox, so: fake or live."
97
+ }
98
+ ];
99
+ var gmailInboxHistoryListKind = connectors.defineConnectorKind(GMAIL_INBOX_HISTORY_LIST_META, {
100
+ name: GMAIL_INBOX_HISTORY_LIST_KIND,
101
+ aliases: ["gmail_inbox_history_list"],
102
+ label: "List Gmail mailbox history",
103
+ description: "List what changed in a mailbox since a history id: messages added or deleted, labels added or removed.",
104
+ inputs: [{ id: "in" }],
105
+ outputs: [{ id: "out" }],
106
+ sideEffects: "none",
107
+ outputShape: GMAIL_INBOX_HISTORY_LIST_OUTPUT,
108
+ configSchema: [
109
+ {
110
+ "type": "text",
111
+ "key": "userId",
112
+ "label": "Mailbox",
113
+ "required": true,
114
+ "default": "me",
115
+ "description": "`me` is the connected account and is almost always what you want."
116
+ },
117
+ {
118
+ "type": "text",
119
+ "key": "startHistoryId",
120
+ "label": "Start history id",
121
+ "required": true,
122
+ "description": "Changes AFTER this id. Take it from a watch, a message, or a previous list's historyId. Out of Gmail's range (typically older than a week) it answers 404."
123
+ },
124
+ {
125
+ "type": "select",
126
+ "key": "historyTypes",
127
+ "label": "Only this kind of change",
128
+ "description": "Blank: every kind. messageAdded is new mail (and sent mail and drafts, unless a label narrows it).",
129
+ "options": [
130
+ {
131
+ "value": "messageAdded",
132
+ "label": "Messages added"
133
+ },
134
+ {
135
+ "value": "messageDeleted",
136
+ "label": "Messages deleted"
137
+ },
138
+ {
139
+ "value": "labelAdded",
140
+ "label": "Labels added"
141
+ },
142
+ {
143
+ "value": "labelRemoved",
144
+ "label": "Labels removed"
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ "type": "text",
150
+ "key": "labelId",
151
+ "label": "Only this label",
152
+ "description": "Only messages with this label, e.g. INBOX for received mail."
153
+ },
154
+ {
155
+ "type": "number",
156
+ "key": "maxResults",
157
+ "label": "Page size",
158
+ "min": 1,
159
+ "max": 500,
160
+ "default": 100,
161
+ "description": "Gmail's own maximum is 500."
162
+ },
163
+ {
164
+ "type": "text",
165
+ "key": "pageToken",
166
+ "label": "Page token",
167
+ "description": "From a previous page's nextPageToken."
168
+ }
169
+ ],
170
+ defaultConfig: {
171
+ "mode": "auto"
172
+ },
173
+ renderBody: ({ config }) => connectors.summarize(GMAIL_INBOX_HISTORY_LIST_META, config, "list mailbox history")
174
+ });
58
175
  var GMAIL_INBOX_LABEL_LIST_KIND = "@particle-academy/gmail_inbox_label_list";
59
176
  var GMAIL_INBOX_LABEL_LIST_OPERATION = "label_list";
60
177
  var GMAIL_INBOX_LABEL_LIST_META = gmailInboxMeta("action", "list labels", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.labels/list");
@@ -88,6 +205,114 @@ var gmailInboxLabelListKind = connectors.defineConnectorKind(GMAIL_INBOX_LABEL_L
88
205
  },
89
206
  renderBody: ({ config }) => connectors.summarize(GMAIL_INBOX_LABEL_LIST_META, config, "list labels")
90
207
  });
208
+ var GMAIL_INBOX_MAILBOX_STOP_KIND = "@particle-academy/gmail_inbox_mailbox_stop";
209
+ var GMAIL_INBOX_MAILBOX_STOP_OPERATION = "mailbox_stop";
210
+ var GMAIL_INBOX_MAILBOX_STOP_META = gmailInboxMeta("action", "stop watching", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/stop");
211
+ var GMAIL_INBOX_MAILBOX_STOP_OUTPUT = [
212
+ {
213
+ "path": "mode",
214
+ "type": "string",
215
+ "description": "Which estate this ran against. Google has no sandbox, so: fake or live."
216
+ }
217
+ ];
218
+ var gmailInboxMailboxStopKind = connectors.defineConnectorKind(GMAIL_INBOX_MAILBOX_STOP_META, {
219
+ name: GMAIL_INBOX_MAILBOX_STOP_KIND,
220
+ aliases: ["gmail_inbox_mailbox_stop"],
221
+ label: "Stop watching a Gmail mailbox",
222
+ description: "Turn off push notifications for a mailbox.",
223
+ inputs: [{ id: "in" }],
224
+ outputs: [{ id: "out" }],
225
+ sideEffects: "idempotent",
226
+ outputShape: GMAIL_INBOX_MAILBOX_STOP_OUTPUT,
227
+ configSchema: [
228
+ {
229
+ "type": "text",
230
+ "key": "userId",
231
+ "label": "Mailbox",
232
+ "required": true,
233
+ "default": "me",
234
+ "description": "`me` is the connected account and is almost always what you want."
235
+ }
236
+ ],
237
+ defaultConfig: {
238
+ "mode": "auto"
239
+ },
240
+ renderBody: ({ config }) => connectors.summarize(GMAIL_INBOX_MAILBOX_STOP_META, config, "stop watching")
241
+ });
242
+ var GMAIL_INBOX_MAILBOX_WATCH_KIND = "@particle-academy/gmail_inbox_mailbox_watch";
243
+ var GMAIL_INBOX_MAILBOX_WATCH_OPERATION = "mailbox_watch";
244
+ var GMAIL_INBOX_MAILBOX_WATCH_META = gmailInboxMeta("action", "watch a mailbox", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/watch");
245
+ var GMAIL_INBOX_MAILBOX_WATCH_OUTPUT = [
246
+ {
247
+ "path": "data.historyId",
248
+ "type": "string",
249
+ "description": "The mailbox's CURRENT history id: seed the trigger's stored cursor from it."
250
+ },
251
+ {
252
+ "path": "data.expiration",
253
+ "type": "string",
254
+ "description": "When Gmail stops pushing, in epoch MILLISECONDS. Renew before it; Google recommends daily."
255
+ },
256
+ {
257
+ "path": "mode",
258
+ "type": "string",
259
+ "description": "Which estate this ran against. Google has no sandbox, so: fake or live."
260
+ }
261
+ ];
262
+ var gmailInboxMailboxWatchKind = connectors.defineConnectorKind(GMAIL_INBOX_MAILBOX_WATCH_META, {
263
+ name: GMAIL_INBOX_MAILBOX_WATCH_KIND,
264
+ aliases: ["gmail_inbox_mailbox_watch"],
265
+ label: "Watch a Gmail mailbox",
266
+ description: "Start (or renew) push notifications for a mailbox to a Cloud Pub/Sub topic.",
267
+ inputs: [{ id: "in" }],
268
+ outputs: [{ id: "out" }],
269
+ sideEffects: "idempotent",
270
+ outputShape: GMAIL_INBOX_MAILBOX_WATCH_OUTPUT,
271
+ configSchema: [
272
+ {
273
+ "type": "text",
274
+ "key": "userId",
275
+ "label": "Mailbox",
276
+ "required": true,
277
+ "default": "me",
278
+ "description": "`me` is the connected account and is almost always what you want."
279
+ },
280
+ {
281
+ "type": "text",
282
+ "key": "topicName",
283
+ "label": "Pub/Sub topic",
284
+ "required": true,
285
+ "placeholder": "projects/my-project/topics/gmail-push",
286
+ "description": "The full topic name, in YOUR app's own Google Cloud project: Google requires its project id to match the project whose OAuth client makes this call. One topic serves every mailbox."
287
+ },
288
+ {
289
+ "type": "text",
290
+ "key": "labelIds",
291
+ "label": "Only these labels",
292
+ "description": "Comma-separated label ids to restrict notifications to (e.g. INBOX). Blank: every change is pushed."
293
+ },
294
+ {
295
+ "type": "select",
296
+ "key": "labelFilterBehavior",
297
+ "label": "Label filter",
298
+ "description": "Whether the labels above are the ONLY ones notified (include) or the ones NOT notified (exclude).",
299
+ "options": [
300
+ {
301
+ "value": "include",
302
+ "label": "Only these labels"
303
+ },
304
+ {
305
+ "value": "exclude",
306
+ "label": "Every label except these"
307
+ }
308
+ ]
309
+ }
310
+ ],
311
+ defaultConfig: {
312
+ "mode": "auto"
313
+ },
314
+ renderBody: ({ config }) => connectors.summarize(GMAIL_INBOX_MAILBOX_WATCH_META, config, "watch a mailbox")
315
+ });
91
316
  var GMAIL_INBOX_MESSAGE_GET_KIND = "@particle-academy/gmail_inbox_message_get";
92
317
  var GMAIL_INBOX_MESSAGE_GET_OPERATION = "message_get";
93
318
  var GMAIL_INBOX_MESSAGE_GET_META = gmailInboxMeta("action", "read a message", "https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/get");
@@ -300,22 +525,150 @@ var gmailInboxThreadGetKind = connectors.defineConnectorKind(GMAIL_INBOX_THREAD_
300
525
  },
301
526
  renderBody: ({ config }) => connectors.summarize(GMAIL_INBOX_THREAD_GET_META, config, "read a thread")
302
527
  });
528
+ var GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_KIND = "@particle-academy/gmail_inbox_message_received_trigger";
529
+ var GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_OPERATION = "message_received";
530
+ var GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_META = gmailInboxMeta("trigger", "new mail", "https://developers.google.com/workspace/gmail/api/guides/push");
531
+ var GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_OUTPUT = [
532
+ {
533
+ "path": "messageId",
534
+ "type": "string",
535
+ "description": "Pub/Sub's id for this push. The same push may be delivered more than once."
536
+ },
537
+ {
538
+ "path": "publishTime",
539
+ "type": "string",
540
+ "description": "When Pub/Sub published it."
541
+ },
542
+ {
543
+ "path": "data.emailAddress",
544
+ "type": "string",
545
+ "description": "The mailbox. The ONLY routing key, and only after verification."
546
+ },
547
+ {
548
+ "path": "data.historyId",
549
+ "type": "number",
550
+ "description": "The mailbox's new position, as Gmail pushed it. The read below starts from the STORED cursor, not this."
551
+ },
552
+ {
553
+ "path": "history.history",
554
+ "type": "array",
555
+ "description": "Every change since the stored cursor, all pages, oldest first. New mail is history[].messagesAdded[].message {id, threadId}: read each with message_get."
556
+ },
557
+ {
558
+ "path": "history.historyId",
559
+ "type": "string",
560
+ "description": "The mailbox's position after the read."
561
+ },
562
+ {
563
+ "path": "history.nextPageToken",
564
+ "type": "string",
565
+ "description": "Always absent here: every page was read."
566
+ },
567
+ {
568
+ "path": "cursor.used",
569
+ "type": "string",
570
+ "description": "The stored cursor this read started from."
571
+ },
572
+ {
573
+ "path": "cursor.next",
574
+ "type": "string",
575
+ "description": "The cursor to store once this run succeeds (null: keep the one used)."
576
+ }
577
+ ];
578
+ var gmailInboxMessageReceivedTriggerKind = connectors.defineConnectorKind(GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_META, {
579
+ name: GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_KIND,
580
+ aliases: ["gmail_inbox_message_received_trigger"],
581
+ label: "Gmail message received",
582
+ description: "Start when new mail arrives in a watched mailbox, with every new message since the last run.",
583
+ inputs: [],
584
+ outputs: [{ id: "out" }],
585
+ sideEffects: "none",
586
+ outputShape: GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_OUTPUT,
587
+ configSchema: [
588
+ {
589
+ "type": "text",
590
+ "key": "startHistoryId",
591
+ "label": "Stored cursor",
592
+ "description": "The host fills this on every run from the cursor it stored: seeded from mailbox_watch's historyId, then cursor.next after each successful run."
593
+ },
594
+ {
595
+ "type": "number",
596
+ "key": "resyncWindowDays",
597
+ "label": "Resync window (days)",
598
+ "min": 1,
599
+ "max": 30,
600
+ "description": "How far back the host re-lists after a lapse, never the whole mailbox."
601
+ },
602
+ {
603
+ "type": "text",
604
+ "key": "labelId",
605
+ "label": "Only this label",
606
+ "description": "INBOX: received mail only. Blank: every label, including sent mail and drafts."
607
+ },
608
+ {
609
+ "type": "select",
610
+ "key": "historyTypes",
611
+ "label": "Only this kind of change",
612
+ "options": [
613
+ {
614
+ "value": "messageAdded",
615
+ "label": "New messages"
616
+ },
617
+ {
618
+ "value": "messageDeleted",
619
+ "label": "Deleted messages"
620
+ },
621
+ {
622
+ "value": "labelAdded",
623
+ "label": "Labels added"
624
+ },
625
+ {
626
+ "value": "labelRemoved",
627
+ "label": "Labels removed"
628
+ }
629
+ ]
630
+ }
631
+ ],
632
+ defaultConfig: {
633
+ "mode": "auto",
634
+ "resyncWindowDays": 7,
635
+ "labelId": "INBOX",
636
+ "historyTypes": "messageAdded"
637
+ },
638
+ renderBody: ({ config }) => connectors.summarize(GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_META, config, "new mail")
639
+ });
303
640
 
304
641
  // src/index.ts
305
642
  var GMAIL_INBOX_KINDS = [
643
+ gmailInboxHistoryListKind,
306
644
  gmailInboxLabelListKind,
645
+ gmailInboxMailboxStopKind,
646
+ gmailInboxMailboxWatchKind,
307
647
  gmailInboxMessageGetKind,
308
648
  gmailInboxMessageListKind,
309
- gmailInboxThreadGetKind
649
+ gmailInboxThreadGetKind,
650
+ gmailInboxMessageReceivedTriggerKind
310
651
  ];
311
652
 
312
653
  exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
313
654
  exports.GMAIL_INBOX_CREDENTIALS = GMAIL_INBOX_CREDENTIALS;
655
+ exports.GMAIL_INBOX_HISTORY_LIST_KIND = GMAIL_INBOX_HISTORY_LIST_KIND;
656
+ exports.GMAIL_INBOX_HISTORY_LIST_META = GMAIL_INBOX_HISTORY_LIST_META;
657
+ exports.GMAIL_INBOX_HISTORY_LIST_OPERATION = GMAIL_INBOX_HISTORY_LIST_OPERATION;
658
+ exports.GMAIL_INBOX_HISTORY_LIST_OUTPUT = GMAIL_INBOX_HISTORY_LIST_OUTPUT;
314
659
  exports.GMAIL_INBOX_KINDS = GMAIL_INBOX_KINDS;
315
660
  exports.GMAIL_INBOX_LABEL_LIST_KIND = GMAIL_INBOX_LABEL_LIST_KIND;
316
661
  exports.GMAIL_INBOX_LABEL_LIST_META = GMAIL_INBOX_LABEL_LIST_META;
317
662
  exports.GMAIL_INBOX_LABEL_LIST_OPERATION = GMAIL_INBOX_LABEL_LIST_OPERATION;
318
663
  exports.GMAIL_INBOX_LABEL_LIST_OUTPUT = GMAIL_INBOX_LABEL_LIST_OUTPUT;
664
+ exports.GMAIL_INBOX_MAILBOX_STOP_KIND = GMAIL_INBOX_MAILBOX_STOP_KIND;
665
+ exports.GMAIL_INBOX_MAILBOX_STOP_META = GMAIL_INBOX_MAILBOX_STOP_META;
666
+ exports.GMAIL_INBOX_MAILBOX_STOP_OPERATION = GMAIL_INBOX_MAILBOX_STOP_OPERATION;
667
+ exports.GMAIL_INBOX_MAILBOX_STOP_OUTPUT = GMAIL_INBOX_MAILBOX_STOP_OUTPUT;
668
+ exports.GMAIL_INBOX_MAILBOX_WATCH_KIND = GMAIL_INBOX_MAILBOX_WATCH_KIND;
669
+ exports.GMAIL_INBOX_MAILBOX_WATCH_META = GMAIL_INBOX_MAILBOX_WATCH_META;
670
+ exports.GMAIL_INBOX_MAILBOX_WATCH_OPERATION = GMAIL_INBOX_MAILBOX_WATCH_OPERATION;
671
+ exports.GMAIL_INBOX_MAILBOX_WATCH_OUTPUT = GMAIL_INBOX_MAILBOX_WATCH_OUTPUT;
319
672
  exports.GMAIL_INBOX_MESSAGE_GET_KIND = GMAIL_INBOX_MESSAGE_GET_KIND;
320
673
  exports.GMAIL_INBOX_MESSAGE_GET_META = GMAIL_INBOX_MESSAGE_GET_META;
321
674
  exports.GMAIL_INBOX_MESSAGE_GET_OPERATION = GMAIL_INBOX_MESSAGE_GET_OPERATION;
@@ -324,15 +677,23 @@ exports.GMAIL_INBOX_MESSAGE_LIST_KIND = GMAIL_INBOX_MESSAGE_LIST_KIND;
324
677
  exports.GMAIL_INBOX_MESSAGE_LIST_META = GMAIL_INBOX_MESSAGE_LIST_META;
325
678
  exports.GMAIL_INBOX_MESSAGE_LIST_OPERATION = GMAIL_INBOX_MESSAGE_LIST_OPERATION;
326
679
  exports.GMAIL_INBOX_MESSAGE_LIST_OUTPUT = GMAIL_INBOX_MESSAGE_LIST_OUTPUT;
680
+ exports.GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_KIND = GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_KIND;
681
+ exports.GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_META = GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_META;
682
+ exports.GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_OPERATION = GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_OPERATION;
683
+ exports.GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_OUTPUT = GMAIL_INBOX_MESSAGE_RECEIVED_TRIGGER_OUTPUT;
327
684
  exports.GMAIL_INBOX_OAUTH = GMAIL_INBOX_OAUTH;
328
685
  exports.GMAIL_INBOX_SERVICE = GMAIL_INBOX_SERVICE;
329
686
  exports.GMAIL_INBOX_THREAD_GET_KIND = GMAIL_INBOX_THREAD_GET_KIND;
330
687
  exports.GMAIL_INBOX_THREAD_GET_META = GMAIL_INBOX_THREAD_GET_META;
331
688
  exports.GMAIL_INBOX_THREAD_GET_OPERATION = GMAIL_INBOX_THREAD_GET_OPERATION;
332
689
  exports.GMAIL_INBOX_THREAD_GET_OUTPUT = GMAIL_INBOX_THREAD_GET_OUTPUT;
690
+ exports.gmailInboxHistoryListKind = gmailInboxHistoryListKind;
333
691
  exports.gmailInboxLabelListKind = gmailInboxLabelListKind;
692
+ exports.gmailInboxMailboxStopKind = gmailInboxMailboxStopKind;
693
+ exports.gmailInboxMailboxWatchKind = gmailInboxMailboxWatchKind;
334
694
  exports.gmailInboxMessageGetKind = gmailInboxMessageGetKind;
335
695
  exports.gmailInboxMessageListKind = gmailInboxMessageListKind;
696
+ exports.gmailInboxMessageReceivedTriggerKind = gmailInboxMessageReceivedTriggerKind;
336
697
  exports.gmailInboxMeta = gmailInboxMeta;
337
698
  exports.gmailInboxThreadGetKind = gmailInboxThreadGetKind;
338
699
  //# sourceMappingURL=index.cjs.map