@particle-academy/gmail-inbox-js 0.0.0 → 0.1.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/index.cjs ADDED
@@ -0,0 +1,341 @@
1
+ 'use strict';
2
+
3
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
4
+
5
+ // src/faker.ts
6
+ function fakeLabelList({ config, fake }) {
7
+ return {
8
+ "labels": [
9
+ {
10
+ "id": "INBOX",
11
+ "name": "INBOX",
12
+ "type": "system"
13
+ },
14
+ {
15
+ "id": "UNREAD",
16
+ "name": "UNREAD",
17
+ "type": "system"
18
+ },
19
+ {
20
+ "id": "IMPORTANT",
21
+ "name": "IMPORTANT",
22
+ "type": "system",
23
+ "messagesTotal": 412,
24
+ "messagesUnread": 18,
25
+ "threadsTotal": 203,
26
+ "threadsUnread": 11
27
+ },
28
+ {
29
+ "id": fake.id("Label"),
30
+ "name": "Design Reviews",
31
+ "type": "user",
32
+ "messageListVisibility": "show",
33
+ "labelListVisibility": "labelShow",
34
+ "messagesTotal": 27,
35
+ "messagesUnread": 2,
36
+ "threadsTotal": 9,
37
+ "threadsUnread": 1
38
+ }
39
+ ]
40
+ };
41
+ }
42
+ function fakeMessageGet({ config, fake }) {
43
+ return {
44
+ "id": config.id !== void 0 && config.id !== null && config.id !== "" ? String(config.id) : fake.hex(16),
45
+ "threadId": fake.hex(16),
46
+ "labelIds": [
47
+ "INBOX",
48
+ "UNREAD",
49
+ "IMPORTANT"
50
+ ],
51
+ "snippet": "Hi Ada, just confirming the design review is still on for Thursday at 2pm. Let me know if...",
52
+ "internalDate": "1790712000000",
53
+ "payload": {
54
+ "mimeType": "text/plain",
55
+ "headers": [
56
+ {
57
+ "name": "From",
58
+ "value": "Grace Hopper <grace@example.test>"
59
+ },
60
+ {
61
+ "name": "To",
62
+ "value": "Ada Lovelace <ada@example.test>"
63
+ },
64
+ {
65
+ "name": "Subject",
66
+ "value": "Re: Design review Thursday"
67
+ },
68
+ {
69
+ "name": "Date",
70
+ "value": "Tue, 29 Sep 2026 14:03:00 -0400"
71
+ }
72
+ ],
73
+ "body": {
74
+ "size": 612,
75
+ "data": fake.id("base64url_body")
76
+ }
77
+ }
78
+ };
79
+ }
80
+ function fakeMessageList({ config, fake }) {
81
+ return {
82
+ "messages": [
83
+ {
84
+ "id": fake.hex(16),
85
+ "threadId": fake.hex(16)
86
+ },
87
+ {
88
+ "id": fake.hex(16),
89
+ "threadId": fake.hex(16)
90
+ }
91
+ ],
92
+ "resultSizeEstimate": 2
93
+ };
94
+ }
95
+ function fakeThreadGet({ config, fake }) {
96
+ return {
97
+ "id": config.id !== void 0 && config.id !== null && config.id !== "" ? String(config.id) : fake.hex(16),
98
+ "historyId": Array.from({ length: 10 }, () => fake.int(0, 9)).join(""),
99
+ "messages": [
100
+ {
101
+ "id": fake.hex(16),
102
+ "labelIds": [
103
+ "INBOX",
104
+ "IMPORTANT"
105
+ ],
106
+ "snippet": "Hey team, scheduling the Q3 design review for Thursday at 2pm. Conference room B...",
107
+ "internalDate": "1790625600000",
108
+ "payload": {
109
+ "mimeType": "text/plain",
110
+ "headers": [
111
+ {
112
+ "name": "From",
113
+ "value": "Ada Lovelace <ada@example.test>"
114
+ },
115
+ {
116
+ "name": "To",
117
+ "value": "Grace Hopper <grace@example.test>"
118
+ },
119
+ {
120
+ "name": "Subject",
121
+ "value": "Design review Thursday"
122
+ },
123
+ {
124
+ "name": "Date",
125
+ "value": "Mon, 28 Sep 2026 09:00:00 -0400"
126
+ }
127
+ ],
128
+ "body": {
129
+ "size": 540,
130
+ "data": fake.id("base64url_body")
131
+ }
132
+ }
133
+ },
134
+ {
135
+ "id": fake.hex(16),
136
+ "labelIds": [
137
+ "INBOX",
138
+ "UNREAD",
139
+ "IMPORTANT"
140
+ ],
141
+ "snippet": "Hi Ada, just confirming the design review is still on for Thursday at 2pm. Let me know if...",
142
+ "internalDate": "1790712000000",
143
+ "payload": {
144
+ "mimeType": "text/plain",
145
+ "headers": [
146
+ {
147
+ "name": "From",
148
+ "value": "Grace Hopper <grace@example.test>"
149
+ },
150
+ {
151
+ "name": "To",
152
+ "value": "Ada Lovelace <ada@example.test>"
153
+ },
154
+ {
155
+ "name": "Subject",
156
+ "value": "Re: Design review Thursday"
157
+ },
158
+ {
159
+ "name": "Date",
160
+ "value": "Tue, 29 Sep 2026 14:03:00 -0400"
161
+ }
162
+ ],
163
+ "body": {
164
+ "size": 612,
165
+ "data": fake.id("base64url_body")
166
+ }
167
+ }
168
+ }
169
+ ]
170
+ };
171
+ }
172
+ var gmailInboxFaker = (operation, request) => {
173
+ switch (operation) {
174
+ case "label_list":
175
+ return fakeLabelList(request);
176
+ case "message_get":
177
+ return fakeMessageGet(request);
178
+ case "message_list":
179
+ return fakeMessageList(request);
180
+ case "thread_get":
181
+ return fakeThreadGet(request);
182
+ default:
183
+ throw new Error(
184
+ `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.`
185
+ );
186
+ }
187
+ };
188
+
189
+ // src/service.ts
190
+ var CONNECTOR_API_VERSION = 1;
191
+ var GMAIL_INBOX_BASE_URLS = {
192
+ "live": "https://gmail.googleapis.com"
193
+ };
194
+ var GMAIL_INBOX_REQUIRES = [
195
+ "accessToken",
196
+ "refreshToken",
197
+ "clientId",
198
+ "clientSecret"
199
+ ];
200
+ function gmailInboxAuthorize(credentials, request, _mode) {
201
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
202
+ }
203
+ var GMAIL_INBOX = {
204
+ service: "gmail_inbox",
205
+ title: "Gmail Inbox",
206
+ sandbox: "none",
207
+ baseUrls: { ...GMAIL_INBOX_BASE_URLS },
208
+ requires: [...GMAIL_INBOX_REQUIRES],
209
+ authorize: gmailInboxAuthorize,
210
+ faker: gmailInboxFaker
211
+ };
212
+ var LABEL_LIST_OPERATION = "label_list";
213
+ async function gmailInboxLabelList(options) {
214
+ const config = options.config ?? {};
215
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
216
+ throw new Error(`label_list: "userId" is required (Mailbox).`);
217
+ }
218
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
219
+ operation: LABEL_LIST_OPERATION,
220
+ config,
221
+ input: options.input,
222
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
223
+ ...options.mode === void 0 ? {} : { mode: options.mode },
224
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
225
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
226
+ ...options.transport === void 0 ? {} : { transport: options.transport },
227
+ request: {
228
+ method: "GET",
229
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/labels`,
230
+ query: {}
231
+ }
232
+ });
233
+ }
234
+ var MESSAGE_GET_OPERATION = "message_get";
235
+ async function gmailInboxMessageGet(options) {
236
+ const config = options.config ?? {};
237
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
238
+ throw new Error(`message_get: "userId" is required (Mailbox).`);
239
+ }
240
+ if (config.id === void 0 || config.id === null || config.id === "") {
241
+ throw new Error(`message_get: "id" is required (Message ID).`);
242
+ }
243
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
244
+ operation: MESSAGE_GET_OPERATION,
245
+ config,
246
+ input: options.input,
247
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
248
+ ...options.mode === void 0 ? {} : { mode: options.mode },
249
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
250
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
251
+ ...options.transport === void 0 ? {} : { transport: options.transport },
252
+ request: {
253
+ method: "GET",
254
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/messages/${encodeURIComponent(String(config.id))}`,
255
+ query: {
256
+ "format": "full"
257
+ }
258
+ }
259
+ });
260
+ }
261
+ var MESSAGE_LIST_OPERATION = "message_list";
262
+ async function gmailInboxMessageList(options) {
263
+ const config = options.config ?? {};
264
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
265
+ throw new Error(`message_list: "userId" is required (Mailbox).`);
266
+ }
267
+ {
268
+ const n = Number(config.maxResults);
269
+ const given = config.maxResults !== void 0 && config.maxResults !== null && config.maxResults !== "";
270
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 500)) {
271
+ throw new Error(
272
+ `message_list: "maxResults" must be a integer, got ${JSON.stringify(config.maxResults)}.`
273
+ );
274
+ }
275
+ }
276
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
277
+ operation: MESSAGE_LIST_OPERATION,
278
+ config,
279
+ input: options.input,
280
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
281
+ ...options.mode === void 0 ? {} : { mode: options.mode },
282
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
283
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
284
+ ...options.transport === void 0 ? {} : { transport: options.transport },
285
+ request: {
286
+ method: "GET",
287
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/messages`,
288
+ query: {
289
+ ...config.q !== void 0 && config.q !== null && config.q !== "" ? { "q": String(config.q) } : {},
290
+ ...config.labelId !== void 0 && config.labelId !== null && config.labelId !== "" ? { "labelIds": String(config.labelId) } : {},
291
+ ...config.includeSpamTrash !== void 0 && config.includeSpamTrash !== null && config.includeSpamTrash !== "" ? { "includeSpamTrash": Boolean(config.includeSpamTrash) } : {},
292
+ "maxResults": config.maxResults !== void 0 && config.maxResults !== null && config.maxResults !== "" ? Math.trunc(Number(config.maxResults)) : 100,
293
+ ...config.pageToken !== void 0 && config.pageToken !== null && config.pageToken !== "" ? { "pageToken": String(config.pageToken) } : {}
294
+ }
295
+ }
296
+ });
297
+ }
298
+ var THREAD_GET_OPERATION = "thread_get";
299
+ async function gmailInboxThreadGet(options) {
300
+ const config = options.config ?? {};
301
+ if (config.userId === void 0 || config.userId === null || config.userId === "") {
302
+ throw new Error(`thread_get: "userId" is required (Mailbox).`);
303
+ }
304
+ if (config.id === void 0 || config.id === null || config.id === "") {
305
+ throw new Error(`thread_get: "id" is required (Thread ID).`);
306
+ }
307
+ return fancyConnectorCore.callConnector(GMAIL_INBOX, {
308
+ operation: THREAD_GET_OPERATION,
309
+ config,
310
+ input: options.input,
311
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
312
+ ...options.mode === void 0 ? {} : { mode: options.mode },
313
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
314
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
315
+ ...options.transport === void 0 ? {} : { transport: options.transport },
316
+ request: {
317
+ method: "GET",
318
+ path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/threads/${encodeURIComponent(String(config.id))}`,
319
+ query: {
320
+ "format": "full"
321
+ }
322
+ }
323
+ });
324
+ }
325
+
326
+ exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
327
+ exports.GMAIL_INBOX = GMAIL_INBOX;
328
+ exports.GMAIL_INBOX_BASE_URLS = GMAIL_INBOX_BASE_URLS;
329
+ exports.GMAIL_INBOX_REQUIRES = GMAIL_INBOX_REQUIRES;
330
+ exports.LABEL_LIST_OPERATION = LABEL_LIST_OPERATION;
331
+ exports.MESSAGE_GET_OPERATION = MESSAGE_GET_OPERATION;
332
+ exports.MESSAGE_LIST_OPERATION = MESSAGE_LIST_OPERATION;
333
+ exports.THREAD_GET_OPERATION = THREAD_GET_OPERATION;
334
+ exports.gmailInboxAuthorize = gmailInboxAuthorize;
335
+ exports.gmailInboxFaker = gmailInboxFaker;
336
+ exports.gmailInboxLabelList = gmailInboxLabelList;
337
+ exports.gmailInboxMessageGet = gmailInboxMessageGet;
338
+ exports.gmailInboxMessageList = gmailInboxMessageList;
339
+ exports.gmailInboxThreadGet = gmailInboxThreadGet;
340
+ //# sourceMappingURL=index.cjs.map
341
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/label-list.ts","../src/actions/message-get.ts","../src/actions/message-list.ts","../src/actions/thread-get.ts"],"names":["callConnector"],"mappings":";;;;;AAyBA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAAA,OAAO;AAAA,IACL,QAAA,EAAU;AAAA,MACR;AAAA,QACE,IAAA,EAAM,OAAA;AAAA,QACN,MAAA,EAAQ,OAAA;AAAA,QACR,MAAA,EAAQ;AAAA,OACV;AAAA,MACA;AAAA,QACE,IAAA,EAAM,QAAA;AAAA,QACN,MAAA,EAAQ,QAAA;AAAA,QACR,MAAA,EAAQ;AAAA,OACV;AAAA,MACA;AAAA,QACE,IAAA,EAAM,WAAA;AAAA,QACN,MAAA,EAAQ,WAAA;AAAA,QACR,MAAA,EAAQ,QAAA;AAAA,QACR,eAAA,EAAiB,GAAA;AAAA,QACjB,gBAAA,EAAkB,EAAA;AAAA,QAClB,cAAA,EAAgB,GAAA;AAAA,QAChB,eAAA,EAAiB;AAAA,OACnB;AAAA,MACA;AAAA,QACE,IAAA,EAAM,IAAA,CAAK,EAAA,CAAG,OAAO,CAAA;AAAA,QACrB,MAAA,EAAQ,gBAAA;AAAA,QACR,MAAA,EAAQ,MAAA;AAAA,QACR,uBAAA,EAAyB,MAAA;AAAA,QACzB,qBAAA,EAAuB,WAAA;AAAA,QACvB,eAAA,EAAiB,EAAA;AAAA,QACjB,gBAAA,EAAkB,CAAA;AAAA,QAClB,cAAA,EAAgB,CAAA;AAAA,QAChB,eAAA,EAAiB;AAAA;AACnB;AACF,GACF;AACF;AAEA,SAAS,cAAA,CAAe,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC9D,EAAA,OAAO;AAAA,IACL,MAAO,MAAA,CAAO,EAAA,KAAO,MAAA,IAAa,MAAA,CAAO,OAAO,IAAA,IAAQ,MAAA,CAAO,EAAA,KAAO,EAAA,GAAK,OAAO,MAAA,CAAO,EAAE,CAAA,GAAI,IAAA,CAAK,IAAI,EAAE,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IACA,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,GAAI,QAAQ,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,WAAA,EAAa,OAAA,CAAQ,WAAA,EAAY;AAAA,IAChF,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,CAAA,gBAAA,EAAmB,kBAAA,CAAmB,MAAA,CAAO,OAAO,MAAM,CAAC,CAAC,CAAA,SAAA,EAAY,kBAAA,CAAmB,MAAA,CAAO,MAAA,CAAO,EAAE,CAAC,CAAC,CAAA,CAAA;AAAA,MACnH,KAAA,EAAO;AAAA,QACL,QAAA,EAAU;AAAA;AACZ;AACF,GACD,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- gmail_inbox\n */\n\n/**\n * The Gmail Inbox faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Gmail Inbox actually publishes, so an author can wire {{ $json.data.id\n * }} against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeLabelList({ config, fake }: FakeRequest): unknown {\n return {\n \"labels\": [\n {\n \"id\": \"INBOX\",\n \"name\": \"INBOX\",\n \"type\": \"system\",\n },\n {\n \"id\": \"UNREAD\",\n \"name\": \"UNREAD\",\n \"type\": \"system\",\n },\n {\n \"id\": \"IMPORTANT\",\n \"name\": \"IMPORTANT\",\n \"type\": \"system\",\n \"messagesTotal\": 412,\n \"messagesUnread\": 18,\n \"threadsTotal\": 203,\n \"threadsUnread\": 11,\n },\n {\n \"id\": fake.id(\"Label\"),\n \"name\": \"Design Reviews\",\n \"type\": \"user\",\n \"messageListVisibility\": \"show\",\n \"labelListVisibility\": \"labelShow\",\n \"messagesTotal\": 27,\n \"messagesUnread\": 2,\n \"threadsTotal\": 9,\n \"threadsUnread\": 1,\n },\n ],\n };\n}\n\nfunction fakeMessageGet({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": (config.id !== undefined && config.id !== null && config.id !== \"\" ? String(config.id) : fake.hex(16)),\n \"threadId\": fake.hex(16),\n \"labelIds\": [\n \"INBOX\",\n \"UNREAD\",\n \"IMPORTANT\",\n ],\n \"snippet\": \"Hi Ada, just confirming the design review is still on for Thursday at 2pm. Let me know if...\",\n \"internalDate\": \"1790712000000\",\n \"payload\": {\n \"mimeType\": \"text/plain\",\n \"headers\": [\n {\n \"name\": \"From\",\n \"value\": \"Grace Hopper <grace@example.test>\",\n },\n {\n \"name\": \"To\",\n \"value\": \"Ada Lovelace <ada@example.test>\",\n },\n {\n \"name\": \"Subject\",\n \"value\": \"Re: Design review Thursday\",\n },\n {\n \"name\": \"Date\",\n \"value\": \"Tue, 29 Sep 2026 14:03:00 -0400\",\n },\n ],\n \"body\": {\n \"size\": 612,\n \"data\": fake.id(\"base64url_body\"),\n },\n },\n };\n}\n\nfunction fakeMessageList({ config, fake }: FakeRequest): unknown {\n return {\n \"messages\": [\n {\n \"id\": fake.hex(16),\n \"threadId\": fake.hex(16),\n },\n {\n \"id\": fake.hex(16),\n \"threadId\": fake.hex(16),\n },\n ],\n \"resultSizeEstimate\": 2,\n };\n}\n\nfunction fakeThreadGet({ config, fake }: FakeRequest): unknown {\n return {\n \"id\": (config.id !== undefined && config.id !== null && config.id !== \"\" ? String(config.id) : fake.hex(16)),\n \"historyId\": Array.from({ length: 10 }, () => fake.int(0, 9)).join(\"\"),\n \"messages\": [\n {\n \"id\": fake.hex(16),\n \"labelIds\": [\n \"INBOX\",\n \"IMPORTANT\",\n ],\n \"snippet\": \"Hey team, scheduling the Q3 design review for Thursday at 2pm. Conference room B...\",\n \"internalDate\": \"1790625600000\",\n \"payload\": {\n \"mimeType\": \"text/plain\",\n \"headers\": [\n {\n \"name\": \"From\",\n \"value\": \"Ada Lovelace <ada@example.test>\",\n },\n {\n \"name\": \"To\",\n \"value\": \"Grace Hopper <grace@example.test>\",\n },\n {\n \"name\": \"Subject\",\n \"value\": \"Design review Thursday\",\n },\n {\n \"name\": \"Date\",\n \"value\": \"Mon, 28 Sep 2026 09:00:00 -0400\",\n },\n ],\n \"body\": {\n \"size\": 540,\n \"data\": fake.id(\"base64url_body\"),\n },\n },\n },\n {\n \"id\": fake.hex(16),\n \"labelIds\": [\n \"INBOX\",\n \"UNREAD\",\n \"IMPORTANT\",\n ],\n \"snippet\": \"Hi Ada, just confirming the design review is still on for Thursday at 2pm. Let me know if...\",\n \"internalDate\": \"1790712000000\",\n \"payload\": {\n \"mimeType\": \"text/plain\",\n \"headers\": [\n {\n \"name\": \"From\",\n \"value\": \"Grace Hopper <grace@example.test>\",\n },\n {\n \"name\": \"To\",\n \"value\": \"Ada Lovelace <ada@example.test>\",\n },\n {\n \"name\": \"Subject\",\n \"value\": \"Re: Design review Thursday\",\n },\n {\n \"name\": \"Date\",\n \"value\": \"Tue, 29 Sep 2026 14:03:00 -0400\",\n },\n ],\n \"body\": {\n \"size\": 612,\n \"data\": fake.id(\"base64url_body\"),\n },\n },\n },\n ],\n };\n}\n\nexport const gmailInboxFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"label_list\":\n return fakeLabelList(request);\n\n case \"message_get\":\n return fakeMessageGet(request);\n\n case \"message_list\":\n return fakeMessageList(request);\n\n case \"thread_get\":\n return fakeThreadGet(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `gmail_inbox: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- gmail_inbox\n */\n\n/**\n * Gmail Inbox, as one service descriptor shared by every Gmail Inbox\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Gmail Inbox: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Gmail has no sandbox. Every read reaches the connected account's real mail.\n * The faker is the only way to develop against it without touching a real\n * mailbox.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { gmailInboxFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GMAIL_INBOX_BASE_URLS = {\n \"live\": \"https://gmail.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GMAIL_INBOX_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Gmail Inbox's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function gmailInboxAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Gmail Inbox service, for the TypeScript runtime. */\nexport const GMAIL_INBOX: ServiceDescriptor = {\n service: \"gmail_inbox\",\n title: \"Gmail Inbox\",\n sandbox: \"none\",\n baseUrls: { ...GMAIL_INBOX_BASE_URLS },\n requires: [...GMAIL_INBOX_REQUIRES],\n authorize: gmailInboxAuthorize,\n faker: gmailInboxFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/label-list.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/label-list.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- gmail_inbox\n */\n\n/**\n * List every label on the mailbox, system and user-created.\n *\n * GET /gmail/v1/users/{userId}/labels —\n * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.labels/list\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Gmail Inbox or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GMAIL_INBOX } from \"../service.js\";\n\nexport const LABEL_LIST_OPERATION = \"label_list\";\n\nexport type LabelListOptions = {\n /** The node's resolved config. Keys: userId. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function gmailInboxLabelList(options: LabelListOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.userId === undefined || config.userId === null || config.userId === \"\") {\n throw new Error(`label_list: \"userId\" is required (Mailbox).`);\n }\n\n return callConnector(GMAIL_INBOX, {\n operation: LABEL_LIST_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/labels`,\n query: {},\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/message-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/message-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- gmail_inbox\n */\n\n/**\n * Read one message's headers and preview. The body's plain/HTML text is NOT\n * decoded -- see the raw payload for that.\n *\n * GET /gmail/v1/users/{userId}/messages/{id} —\n * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Gmail Inbox or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GMAIL_INBOX } from \"../service.js\";\n\nexport const MESSAGE_GET_OPERATION = \"message_get\";\n\nexport type MessageGetOptions = {\n /** The node's resolved config. Keys: userId, id. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function gmailInboxMessageGet(options: MessageGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.userId === undefined || config.userId === null || config.userId === \"\") {\n throw new Error(`message_get: \"userId\" is required (Mailbox).`);\n }\n\n if (config.id === undefined || config.id === null || config.id === \"\") {\n throw new Error(`message_get: \"id\" is required (Message ID).`);\n }\n\n return callConnector(GMAIL_INBOX, {\n operation: MESSAGE_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/messages/${encodeURIComponent(String(config.id))}`,\n query: {\n \"format\": \"full\",\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/message-list.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/message-list.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- gmail_inbox\n */\n\n/**\n * List message ids matching a search, newest first.\n *\n * GET /gmail/v1/users/{userId}/messages —\n * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/list\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Gmail Inbox or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GMAIL_INBOX } from \"../service.js\";\n\nexport const MESSAGE_LIST_OPERATION = \"message_list\";\n\nexport type MessageListOptions = {\n /** The node's resolved config. Keys: userId, q, labelId, includeSpamTrash, maxResults, pageToken. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function gmailInboxMessageList(options: MessageListOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.userId === undefined || config.userId === null || config.userId === \"\") {\n throw new Error(`message_list: \"userId\" is required (Mailbox).`);\n }\n\n {\n const n = Number(config.maxResults);\n const given = config.maxResults !== undefined && config.maxResults !== null && config.maxResults !== \"\";\n if (given && !(Number.isInteger(n) && n >= 1 && n <= 500)) {\n throw new Error(\n `message_list: \"maxResults\" must be a integer, got ${JSON.stringify(config.maxResults)}.`,\n );\n }\n }\n\n return callConnector(GMAIL_INBOX, {\n operation: MESSAGE_LIST_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/messages`,\n query: {\n ...(config.q !== undefined && config.q !== null && config.q !== \"\" ? { \"q\": String(config.q) } : {}),\n ...(config.labelId !== undefined && config.labelId !== null && config.labelId !== \"\" ? { \"labelIds\": String(config.labelId) } : {}),\n ...(config.includeSpamTrash !== undefined && config.includeSpamTrash !== null && config.includeSpamTrash !== \"\" ? { \"includeSpamTrash\": Boolean(config.includeSpamTrash) } : {}),\n \"maxResults\": config.maxResults !== undefined && config.maxResults !== null && config.maxResults !== \"\" ? Math.trunc(Number(config.maxResults)) : 100,\n ...(config.pageToken !== undefined && config.pageToken !== null && config.pageToken !== \"\" ? { \"pageToken\": String(config.pageToken) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/thread-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/thread-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- gmail_inbox\n */\n\n/**\n * Read every message in a conversation thread, oldest first.\n *\n * GET /gmail/v1/users/{userId}/threads/{id} —\n * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Gmail Inbox or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GMAIL_INBOX } from \"../service.js\";\n\nexport const THREAD_GET_OPERATION = \"thread_get\";\n\nexport type ThreadGetOptions = {\n /** The node's resolved config. Keys: userId, id. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function gmailInboxThreadGet(options: ThreadGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.userId === undefined || config.userId === null || config.userId === \"\") {\n throw new Error(`thread_get: \"userId\" is required (Mailbox).`);\n }\n\n if (config.id === undefined || config.id === null || config.id === \"\") {\n throw new Error(`thread_get: \"id\" is required (Thread ID).`);\n }\n\n return callConnector(GMAIL_INBOX, {\n operation: THREAD_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/gmail/v1/users/${encodeURIComponent(String(config.userId))}/threads/${encodeURIComponent(String(config.id))}`,\n query: {\n \"format\": \"full\",\n },\n },\n });\n}\n"]}
@@ -0,0 +1,223 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/manifest.json by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/manifest.json (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- gmail_inbox
12
+ */
13
+ /**
14
+ * Gmail Inbox, as one service descriptor shared by every Gmail Inbox
15
+ * operation.
16
+ *
17
+ * @particle-academy/fancy-connector-core carries what is true of ALL
18
+ * connectors. This carries what is true of Gmail Inbox: its base URL, its auth
19
+ * scheme, its idempotency header, and its faker.
20
+ *
21
+ * ## The sandbox trap, written down where it is used
22
+ *
23
+ * Gmail has no sandbox. Every read reaches the connected account's real mail.
24
+ * The faker is the only way to develop against it without touching a real
25
+ * mailbox.
26
+ */
27
+
28
+ /**
29
+ * The connector API version this package was GENERATED against.
30
+ *
31
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
32
+ * very claim it exists to detect, after which the copy agrees with itself
33
+ * forever.
34
+ */
35
+ declare const CONNECTOR_API_VERSION = 1;
36
+ declare const GMAIL_INBOX_BASE_URLS: {
37
+ readonly live: "https://gmail.googleapis.com";
38
+ };
39
+ /** Credential keys a remote call cannot proceed without. */
40
+ declare const GMAIL_INBOX_REQUIRES: readonly ["accessToken", "refreshToken", "clientId", "clientSecret"];
41
+ /**
42
+ * Apply Gmail Inbox's auth scheme to an outgoing request.
43
+ *
44
+ *
45
+ *
46
+ * The mode is passed in because for some providers auth and estate are the
47
+ * same decision expressed in the URL; here it is unused, and saying so is
48
+ * cheaper than wondering later whether it was forgotten.
49
+ */
50
+ declare function gmailInboxAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
51
+ /** The Gmail Inbox service, for the TypeScript runtime. */
52
+ declare const GMAIL_INBOX: ServiceDescriptor;
53
+
54
+ /**
55
+ * GENERATED FILE — do not edit.
56
+ *
57
+ * Emitted from provider/fixtures/ by weaver's generator.
58
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
59
+ * being rejected, because it works until it silently does not. Fix
60
+ * provider/fixtures/ (or weaver's template/) and regenerate:
61
+ *
62
+ * npm run provider -- gmail_inbox
63
+ */
64
+ /**
65
+ * The Gmail Inbox faker.
66
+ *
67
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
68
+ * NAMES Gmail Inbox actually publishes, so an author can wire {{ $json.data.id
69
+ * }} against a fake and have it keep working against the real thing.
70
+ *
71
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
72
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
73
+ * throw", which is the assertion that catches nothing.
74
+ */
75
+
76
+ declare const gmailInboxFaker: ConnectorFaker;
77
+
78
+ /**
79
+ * GENERATED FILE — do not edit.
80
+ *
81
+ * Emitted from provider/actions/label-list.json by weaver's generator.
82
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
83
+ * being rejected, because it works until it silently does not. Fix
84
+ * provider/actions/label-list.json (or weaver's template/) and regenerate:
85
+ *
86
+ * npm run provider -- gmail_inbox
87
+ */
88
+ /**
89
+ * List every label on the mailbox, system and user-created.
90
+ *
91
+ * GET /gmail/v1/users/{userId}/labels —
92
+ * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.labels/list
93
+ *
94
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
95
+ * no fake/real branch. This describes the request; callConnector resolves the
96
+ * connection, picks the estate, and either calls Gmail Inbox or calls the
97
+ * faker.
98
+ */
99
+
100
+ declare const LABEL_LIST_OPERATION = "label_list";
101
+ type LabelListOptions = {
102
+ /** The node's resolved config. Keys: userId. */
103
+ config: Record<string, unknown>;
104
+ credentials?: Record<string, string | undefined>;
105
+ mode?: RequestedMode;
106
+ connectionId?: string | null;
107
+ input?: unknown;
108
+ attempts?: number;
109
+ /** Override the transport. The only way to exercise this without a network. */
110
+ transport?: Transport;
111
+ };
112
+ declare function gmailInboxLabelList(options: LabelListOptions): Promise<ConnectorResult>;
113
+
114
+ /**
115
+ * GENERATED FILE — do not edit.
116
+ *
117
+ * Emitted from provider/actions/message-get.json by weaver's generator.
118
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
119
+ * being rejected, because it works until it silently does not. Fix
120
+ * provider/actions/message-get.json (or weaver's template/) and regenerate:
121
+ *
122
+ * npm run provider -- gmail_inbox
123
+ */
124
+ /**
125
+ * Read one message's headers and preview. The body's plain/HTML text is NOT
126
+ * decoded -- see the raw payload for that.
127
+ *
128
+ * GET /gmail/v1/users/{userId}/messages/{id} —
129
+ * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/get
130
+ *
131
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
132
+ * no fake/real branch. This describes the request; callConnector resolves the
133
+ * connection, picks the estate, and either calls Gmail Inbox or calls the
134
+ * faker.
135
+ */
136
+
137
+ declare const MESSAGE_GET_OPERATION = "message_get";
138
+ type MessageGetOptions = {
139
+ /** The node's resolved config. Keys: userId, id. */
140
+ config: Record<string, unknown>;
141
+ credentials?: Record<string, string | undefined>;
142
+ mode?: RequestedMode;
143
+ connectionId?: string | null;
144
+ input?: unknown;
145
+ attempts?: number;
146
+ /** Override the transport. The only way to exercise this without a network. */
147
+ transport?: Transport;
148
+ };
149
+ declare function gmailInboxMessageGet(options: MessageGetOptions): Promise<ConnectorResult>;
150
+
151
+ /**
152
+ * GENERATED FILE — do not edit.
153
+ *
154
+ * Emitted from provider/actions/message-list.json by weaver's generator.
155
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
156
+ * being rejected, because it works until it silently does not. Fix
157
+ * provider/actions/message-list.json (or weaver's template/) and regenerate:
158
+ *
159
+ * npm run provider -- gmail_inbox
160
+ */
161
+ /**
162
+ * List message ids matching a search, newest first.
163
+ *
164
+ * GET /gmail/v1/users/{userId}/messages —
165
+ * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/list
166
+ *
167
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
168
+ * no fake/real branch. This describes the request; callConnector resolves the
169
+ * connection, picks the estate, and either calls Gmail Inbox or calls the
170
+ * faker.
171
+ */
172
+
173
+ declare const MESSAGE_LIST_OPERATION = "message_list";
174
+ type MessageListOptions = {
175
+ /** The node's resolved config. Keys: userId, q, labelId, includeSpamTrash, maxResults, pageToken. */
176
+ config: Record<string, unknown>;
177
+ credentials?: Record<string, string | undefined>;
178
+ mode?: RequestedMode;
179
+ connectionId?: string | null;
180
+ input?: unknown;
181
+ attempts?: number;
182
+ /** Override the transport. The only way to exercise this without a network. */
183
+ transport?: Transport;
184
+ };
185
+ declare function gmailInboxMessageList(options: MessageListOptions): Promise<ConnectorResult>;
186
+
187
+ /**
188
+ * GENERATED FILE — do not edit.
189
+ *
190
+ * Emitted from provider/actions/thread-get.json by weaver's generator.
191
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
192
+ * being rejected, because it works until it silently does not. Fix
193
+ * provider/actions/thread-get.json (or weaver's template/) and regenerate:
194
+ *
195
+ * npm run provider -- gmail_inbox
196
+ */
197
+ /**
198
+ * Read every message in a conversation thread, oldest first.
199
+ *
200
+ * GET /gmail/v1/users/{userId}/threads/{id} —
201
+ * https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/get
202
+ *
203
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
204
+ * no fake/real branch. This describes the request; callConnector resolves the
205
+ * connection, picks the estate, and either calls Gmail Inbox or calls the
206
+ * faker.
207
+ */
208
+
209
+ declare const THREAD_GET_OPERATION = "thread_get";
210
+ type ThreadGetOptions = {
211
+ /** The node's resolved config. Keys: userId, id. */
212
+ config: Record<string, unknown>;
213
+ credentials?: Record<string, string | undefined>;
214
+ mode?: RequestedMode;
215
+ connectionId?: string | null;
216
+ input?: unknown;
217
+ attempts?: number;
218
+ /** Override the transport. The only way to exercise this without a network. */
219
+ transport?: Transport;
220
+ };
221
+ declare function gmailInboxThreadGet(options: ThreadGetOptions): Promise<ConnectorResult>;
222
+
223
+ export { CONNECTOR_API_VERSION, GMAIL_INBOX, GMAIL_INBOX_BASE_URLS, GMAIL_INBOX_REQUIRES, LABEL_LIST_OPERATION, type LabelListOptions, MESSAGE_GET_OPERATION, MESSAGE_LIST_OPERATION, type MessageGetOptions, type MessageListOptions, THREAD_GET_OPERATION, type ThreadGetOptions, gmailInboxAuthorize, gmailInboxFaker, gmailInboxLabelList, gmailInboxMessageGet, gmailInboxMessageList, gmailInboxThreadGet };