@particle-academy/gmail-inbox-js 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 +57 -0
- package/README.md +53 -1
- package/dist/chunk-2PSRTESV.js +550 -0
- package/dist/chunk-2PSRTESV.js.map +1 -0
- package/dist/flow.cjs +279 -1
- package/dist/flow.cjs.map +1 -1
- package/dist/flow.d.cts +5 -1
- package/dist/flow.d.ts +5 -1
- package/dist/flow.js +66 -5
- package/dist/flow.js.map +1 -1
- package/dist/index.cjs +239 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +210 -2
- package/dist/index.d.ts +210 -2
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-UT3U2BPM.js +0 -326
- package/dist/chunk-UT3U2BPM.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
|
|
1
|
+
import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult, TriggerDescriptor, CursorReadSpec, DeliveryDecode, LeaseDeclaration, OidcJwtScheme, InboundDelivery, Jwk, WebhookVerification } from '@particle-academy/fancy-connector-core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* GENERATED FILE — do not edit.
|
|
@@ -75,6 +75,43 @@ declare const GMAIL_INBOX: ServiceDescriptor;
|
|
|
75
75
|
|
|
76
76
|
declare const gmailInboxFaker: ConnectorFaker;
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* GENERATED FILE — do not edit.
|
|
80
|
+
*
|
|
81
|
+
* Emitted from provider/actions/history-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/history-list.json (or weaver's template/) and regenerate:
|
|
85
|
+
*
|
|
86
|
+
* npm run provider -- gmail_inbox
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* List what changed in a mailbox since a history id: messages added or
|
|
90
|
+
* deleted, labels added or removed.
|
|
91
|
+
*
|
|
92
|
+
* GET /gmail/v1/users/{userId}/history —
|
|
93
|
+
* https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.history/list
|
|
94
|
+
*
|
|
95
|
+
* Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
|
|
96
|
+
* no fake/real branch. This describes the request; callConnector resolves the
|
|
97
|
+
* connection, picks the estate, and either calls Gmail Inbox or calls the
|
|
98
|
+
* faker.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
declare const HISTORY_LIST_OPERATION = "history_list";
|
|
102
|
+
type HistoryListOptions = {
|
|
103
|
+
/** The node's resolved config. Keys: userId, startHistoryId, historyTypes, labelId, maxResults, pageToken. */
|
|
104
|
+
config: Record<string, unknown>;
|
|
105
|
+
credentials?: Record<string, string | undefined>;
|
|
106
|
+
mode?: RequestedMode;
|
|
107
|
+
connectionId?: string | null;
|
|
108
|
+
input?: unknown;
|
|
109
|
+
attempts?: number;
|
|
110
|
+
/** Override the transport. The only way to exercise this without a network. */
|
|
111
|
+
transport?: Transport;
|
|
112
|
+
};
|
|
113
|
+
declare function gmailInboxHistoryList(options: HistoryListOptions): Promise<ConnectorResult>;
|
|
114
|
+
|
|
78
115
|
/**
|
|
79
116
|
* GENERATED FILE — do not edit.
|
|
80
117
|
*
|
|
@@ -111,6 +148,78 @@ type LabelListOptions = {
|
|
|
111
148
|
};
|
|
112
149
|
declare function gmailInboxLabelList(options: LabelListOptions): Promise<ConnectorResult>;
|
|
113
150
|
|
|
151
|
+
/**
|
|
152
|
+
* GENERATED FILE — do not edit.
|
|
153
|
+
*
|
|
154
|
+
* Emitted from provider/actions/mailbox-stop.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/mailbox-stop.json (or weaver's template/) and regenerate:
|
|
158
|
+
*
|
|
159
|
+
* npm run provider -- gmail_inbox
|
|
160
|
+
*/
|
|
161
|
+
/**
|
|
162
|
+
* Turn off push notifications for a mailbox.
|
|
163
|
+
*
|
|
164
|
+
* POST /gmail/v1/users/{userId}/stop —
|
|
165
|
+
* https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/stop
|
|
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 MAILBOX_STOP_OPERATION = "mailbox_stop";
|
|
174
|
+
type MailboxStopOptions = {
|
|
175
|
+
/** The node's resolved config. Keys: userId. */
|
|
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 gmailInboxMailboxStop(options: MailboxStopOptions): Promise<ConnectorResult>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* GENERATED FILE — do not edit.
|
|
189
|
+
*
|
|
190
|
+
* Emitted from provider/actions/mailbox-watch.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/mailbox-watch.json (or weaver's template/) and regenerate:
|
|
194
|
+
*
|
|
195
|
+
* npm run provider -- gmail_inbox
|
|
196
|
+
*/
|
|
197
|
+
/**
|
|
198
|
+
* Start (or renew) push notifications for a mailbox to a Cloud Pub/Sub topic.
|
|
199
|
+
*
|
|
200
|
+
* POST /gmail/v1/users/{userId}/watch —
|
|
201
|
+
* https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/watch
|
|
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 MAILBOX_WATCH_OPERATION = "mailbox_watch";
|
|
210
|
+
type MailboxWatchOptions = {
|
|
211
|
+
/** The node's resolved config. Keys: userId, topicName, labelIds, labelFilterBehavior. */
|
|
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 gmailInboxMailboxWatch(options: MailboxWatchOptions): Promise<ConnectorResult>;
|
|
222
|
+
|
|
114
223
|
/**
|
|
115
224
|
* GENERATED FILE — do not edit.
|
|
116
225
|
*
|
|
@@ -220,4 +329,103 @@ type ThreadGetOptions = {
|
|
|
220
329
|
};
|
|
221
330
|
declare function gmailInboxThreadGet(options: ThreadGetOptions): Promise<ConnectorResult>;
|
|
222
331
|
|
|
223
|
-
|
|
332
|
+
/**
|
|
333
|
+
* GENERATED FILE — do not edit.
|
|
334
|
+
*
|
|
335
|
+
* Emitted from provider/triggers/message-received.json by weaver's generator.
|
|
336
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
337
|
+
* being rejected, because it works until it silently does not. Fix
|
|
338
|
+
* provider/triggers/message-received.json (or weaver's template/) and regenerate:
|
|
339
|
+
*
|
|
340
|
+
* npm run provider -- gmail_inbox
|
|
341
|
+
*/
|
|
342
|
+
/**
|
|
343
|
+
* Gmail Inbox's subscription trigger — the delivery contract.
|
|
344
|
+
*
|
|
345
|
+
* Kept beside the service descriptor rather than inside a node, because the
|
|
346
|
+
* way a delivery is verified is a fact about GMAIL INBOX. Two Gmail Inbox
|
|
347
|
+
* triggers must not be able to disagree about how a delivery is verified.
|
|
348
|
+
*
|
|
349
|
+
* A SUBSCRIPTION: Gmail Inbox stops delivering unless somebody renews it,
|
|
350
|
+
* forever, and if nobody does the workflow stops firing with no error
|
|
351
|
+
* anywhere. The lease below says where the expiry is read from and how early
|
|
352
|
+
* to renew; the host runs ONE renewal scheduler for every expiring trigger.
|
|
353
|
+
*/
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* How Gmail Inbox's push is authenticated: a bearer token in `Authorization`,
|
|
357
|
+
* signed by the provider, whose issuer must be one of these and whose
|
|
358
|
+
* principal claim must EQUAL the service account the host configured. The
|
|
359
|
+
* keys, the audience and the principal are the HOST's, passed to verify.
|
|
360
|
+
*/
|
|
361
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_OIDC_SCHEME: OidcJwtScheme;
|
|
362
|
+
/**
|
|
363
|
+
* The lease this subscription carries: where the provider's expiry sits in the
|
|
364
|
+
* `mailbox_watch` response (`expiration`, epoch-ms), how early the host
|
|
365
|
+
* renews, and what it calls when the lease is due. The host builds the value
|
|
366
|
+
* with the core's `leaseFromResponse` and runs one scheduler for every
|
|
367
|
+
* expiring trigger.
|
|
368
|
+
*/
|
|
369
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_LEASE: LeaseDeclaration;
|
|
370
|
+
/**
|
|
371
|
+
* Which of this package's actions create, renew and stop the subscription.
|
|
372
|
+
* `renew` is null where the provider cannot renew and the host calls create
|
|
373
|
+
* again — after stopping the old one, and after re-listing, because
|
|
374
|
+
* notifications during the gap are gone.
|
|
375
|
+
*/
|
|
376
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_SUBSCRIPTION: {
|
|
377
|
+
readonly create: "mailbox_watch";
|
|
378
|
+
readonly renew: "mailbox_watch";
|
|
379
|
+
readonly stop: "mailbox_stop";
|
|
380
|
+
};
|
|
381
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_DECODE: DeliveryDecode;
|
|
382
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED: TriggerDescriptor;
|
|
383
|
+
/**
|
|
384
|
+
* Where the follow-up read's cursor goes and comes from. The HOST stores it:
|
|
385
|
+
* seeded from the `mailbox_watch` response's `historyId`, advanced to
|
|
386
|
+
* `cursor.next` after each successful run, and filled into this trigger's
|
|
387
|
+
* config on every run.
|
|
388
|
+
*/
|
|
389
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_CURSOR: CursorReadSpec;
|
|
390
|
+
/**
|
|
391
|
+
* Read what changed since the HOST's stored cursor: `history_list` from
|
|
392
|
+
* `config.startHistoryId`, every page, `history` concatenated, published under
|
|
393
|
+
* `history` with `cursor: {used, next}`. Persist `cursor.next` once the run
|
|
394
|
+
* succeeds. A lapsed cursor (cursor-expired) or too many pages
|
|
395
|
+
* (cursor-overflow) is refused BY NAME with the bounded resync query, and a
|
|
396
|
+
* missing one (cursor-missing) calls nothing. In fake mode with no stored
|
|
397
|
+
* cursor the read is faked from a placeholder, so the node runs on a canvas.
|
|
398
|
+
*/
|
|
399
|
+
declare function readGmailInboxMessageReceivedAfter(event: unknown, config: Record<string, unknown>, options?: {
|
|
400
|
+
credentials?: Record<string, string | undefined>;
|
|
401
|
+
transport?: Transport;
|
|
402
|
+
}): Promise<Record<string, unknown>>;
|
|
403
|
+
/**
|
|
404
|
+
* Verify one inbound Gmail Inbox delivery.
|
|
405
|
+
*
|
|
406
|
+
* The host calls this BEFORE starting a run. The body proves nothing here: the
|
|
407
|
+
* delivery is authenticated by the bearer token in its header. `keys` are the
|
|
408
|
+
* provider's signing keys (its JWKS `keys`), fetched and cached by the HOST;
|
|
409
|
+
* nothing in this package fetches them. `pushAudience` and
|
|
410
|
+
* `pushServiceAccount` are the connection's, and both are REQUIRED: an
|
|
411
|
+
* unchecked audience accepts every token the provider signs for anyone, and an
|
|
412
|
+
* unchecked principal accepts a stranger's subscription aimed at your URL. Any
|
|
413
|
+
* of the three missing refuses every delivery.
|
|
414
|
+
*/
|
|
415
|
+
declare function verifyGmailInboxDelivery(delivery: InboundDelivery, expected: {
|
|
416
|
+
keys: readonly Jwk[];
|
|
417
|
+
pushAudience: string | undefined;
|
|
418
|
+
pushServiceAccount: string | undefined;
|
|
419
|
+
}, now?: number): Promise<WebhookVerification>;
|
|
420
|
+
/**
|
|
421
|
+
* Read one VERIFIED Gmail Inbox delivery.
|
|
422
|
+
*
|
|
423
|
+
* The body is not plain JSON: it is pubsub-push, the provider's envelope,
|
|
424
|
+
* unwrapped to the message it carries. The host calls this AFTER
|
|
425
|
+
* `verifyGmailInboxDelivery` has accepted the delivery, with the SAME raw
|
|
426
|
+
* bytes, and starts the run with what it returns. A body that cannot be read
|
|
427
|
+
* is refused by name, never passed on.
|
|
428
|
+
*/
|
|
429
|
+
declare function decodeGmailInboxDelivery(raw: Uint8Array | string): unknown;
|
|
430
|
+
|
|
431
|
+
export { CONNECTOR_API_VERSION, GMAIL_INBOX, GMAIL_INBOX_BASE_URLS, GMAIL_INBOX_MESSAGE_RECEIVED, GMAIL_INBOX_MESSAGE_RECEIVED_CURSOR, GMAIL_INBOX_MESSAGE_RECEIVED_DECODE, GMAIL_INBOX_MESSAGE_RECEIVED_LEASE, GMAIL_INBOX_MESSAGE_RECEIVED_OIDC_SCHEME, GMAIL_INBOX_MESSAGE_RECEIVED_SUBSCRIPTION, GMAIL_INBOX_REQUIRES, HISTORY_LIST_OPERATION, type HistoryListOptions, LABEL_LIST_OPERATION, type LabelListOptions, MAILBOX_STOP_OPERATION, MAILBOX_WATCH_OPERATION, MESSAGE_GET_OPERATION, MESSAGE_LIST_OPERATION, type MailboxStopOptions, type MailboxWatchOptions, type MessageGetOptions, type MessageListOptions, THREAD_GET_OPERATION, type ThreadGetOptions, decodeGmailInboxDelivery, gmailInboxAuthorize, gmailInboxFaker, gmailInboxHistoryList, gmailInboxLabelList, gmailInboxMailboxStop, gmailInboxMailboxWatch, gmailInboxMessageGet, gmailInboxMessageList, gmailInboxThreadGet, readGmailInboxMessageReceivedAfter, verifyGmailInboxDelivery };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
|
|
1
|
+
import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult, TriggerDescriptor, CursorReadSpec, DeliveryDecode, LeaseDeclaration, OidcJwtScheme, InboundDelivery, Jwk, WebhookVerification } from '@particle-academy/fancy-connector-core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* GENERATED FILE — do not edit.
|
|
@@ -75,6 +75,43 @@ declare const GMAIL_INBOX: ServiceDescriptor;
|
|
|
75
75
|
|
|
76
76
|
declare const gmailInboxFaker: ConnectorFaker;
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* GENERATED FILE — do not edit.
|
|
80
|
+
*
|
|
81
|
+
* Emitted from provider/actions/history-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/history-list.json (or weaver's template/) and regenerate:
|
|
85
|
+
*
|
|
86
|
+
* npm run provider -- gmail_inbox
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* List what changed in a mailbox since a history id: messages added or
|
|
90
|
+
* deleted, labels added or removed.
|
|
91
|
+
*
|
|
92
|
+
* GET /gmail/v1/users/{userId}/history —
|
|
93
|
+
* https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.history/list
|
|
94
|
+
*
|
|
95
|
+
* Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
|
|
96
|
+
* no fake/real branch. This describes the request; callConnector resolves the
|
|
97
|
+
* connection, picks the estate, and either calls Gmail Inbox or calls the
|
|
98
|
+
* faker.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
declare const HISTORY_LIST_OPERATION = "history_list";
|
|
102
|
+
type HistoryListOptions = {
|
|
103
|
+
/** The node's resolved config. Keys: userId, startHistoryId, historyTypes, labelId, maxResults, pageToken. */
|
|
104
|
+
config: Record<string, unknown>;
|
|
105
|
+
credentials?: Record<string, string | undefined>;
|
|
106
|
+
mode?: RequestedMode;
|
|
107
|
+
connectionId?: string | null;
|
|
108
|
+
input?: unknown;
|
|
109
|
+
attempts?: number;
|
|
110
|
+
/** Override the transport. The only way to exercise this without a network. */
|
|
111
|
+
transport?: Transport;
|
|
112
|
+
};
|
|
113
|
+
declare function gmailInboxHistoryList(options: HistoryListOptions): Promise<ConnectorResult>;
|
|
114
|
+
|
|
78
115
|
/**
|
|
79
116
|
* GENERATED FILE — do not edit.
|
|
80
117
|
*
|
|
@@ -111,6 +148,78 @@ type LabelListOptions = {
|
|
|
111
148
|
};
|
|
112
149
|
declare function gmailInboxLabelList(options: LabelListOptions): Promise<ConnectorResult>;
|
|
113
150
|
|
|
151
|
+
/**
|
|
152
|
+
* GENERATED FILE — do not edit.
|
|
153
|
+
*
|
|
154
|
+
* Emitted from provider/actions/mailbox-stop.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/mailbox-stop.json (or weaver's template/) and regenerate:
|
|
158
|
+
*
|
|
159
|
+
* npm run provider -- gmail_inbox
|
|
160
|
+
*/
|
|
161
|
+
/**
|
|
162
|
+
* Turn off push notifications for a mailbox.
|
|
163
|
+
*
|
|
164
|
+
* POST /gmail/v1/users/{userId}/stop —
|
|
165
|
+
* https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/stop
|
|
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 MAILBOX_STOP_OPERATION = "mailbox_stop";
|
|
174
|
+
type MailboxStopOptions = {
|
|
175
|
+
/** The node's resolved config. Keys: userId. */
|
|
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 gmailInboxMailboxStop(options: MailboxStopOptions): Promise<ConnectorResult>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* GENERATED FILE — do not edit.
|
|
189
|
+
*
|
|
190
|
+
* Emitted from provider/actions/mailbox-watch.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/mailbox-watch.json (or weaver's template/) and regenerate:
|
|
194
|
+
*
|
|
195
|
+
* npm run provider -- gmail_inbox
|
|
196
|
+
*/
|
|
197
|
+
/**
|
|
198
|
+
* Start (or renew) push notifications for a mailbox to a Cloud Pub/Sub topic.
|
|
199
|
+
*
|
|
200
|
+
* POST /gmail/v1/users/{userId}/watch —
|
|
201
|
+
* https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/watch
|
|
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 MAILBOX_WATCH_OPERATION = "mailbox_watch";
|
|
210
|
+
type MailboxWatchOptions = {
|
|
211
|
+
/** The node's resolved config. Keys: userId, topicName, labelIds, labelFilterBehavior. */
|
|
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 gmailInboxMailboxWatch(options: MailboxWatchOptions): Promise<ConnectorResult>;
|
|
222
|
+
|
|
114
223
|
/**
|
|
115
224
|
* GENERATED FILE — do not edit.
|
|
116
225
|
*
|
|
@@ -220,4 +329,103 @@ type ThreadGetOptions = {
|
|
|
220
329
|
};
|
|
221
330
|
declare function gmailInboxThreadGet(options: ThreadGetOptions): Promise<ConnectorResult>;
|
|
222
331
|
|
|
223
|
-
|
|
332
|
+
/**
|
|
333
|
+
* GENERATED FILE — do not edit.
|
|
334
|
+
*
|
|
335
|
+
* Emitted from provider/triggers/message-received.json by weaver's generator.
|
|
336
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
337
|
+
* being rejected, because it works until it silently does not. Fix
|
|
338
|
+
* provider/triggers/message-received.json (or weaver's template/) and regenerate:
|
|
339
|
+
*
|
|
340
|
+
* npm run provider -- gmail_inbox
|
|
341
|
+
*/
|
|
342
|
+
/**
|
|
343
|
+
* Gmail Inbox's subscription trigger — the delivery contract.
|
|
344
|
+
*
|
|
345
|
+
* Kept beside the service descriptor rather than inside a node, because the
|
|
346
|
+
* way a delivery is verified is a fact about GMAIL INBOX. Two Gmail Inbox
|
|
347
|
+
* triggers must not be able to disagree about how a delivery is verified.
|
|
348
|
+
*
|
|
349
|
+
* A SUBSCRIPTION: Gmail Inbox stops delivering unless somebody renews it,
|
|
350
|
+
* forever, and if nobody does the workflow stops firing with no error
|
|
351
|
+
* anywhere. The lease below says where the expiry is read from and how early
|
|
352
|
+
* to renew; the host runs ONE renewal scheduler for every expiring trigger.
|
|
353
|
+
*/
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* How Gmail Inbox's push is authenticated: a bearer token in `Authorization`,
|
|
357
|
+
* signed by the provider, whose issuer must be one of these and whose
|
|
358
|
+
* principal claim must EQUAL the service account the host configured. The
|
|
359
|
+
* keys, the audience and the principal are the HOST's, passed to verify.
|
|
360
|
+
*/
|
|
361
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_OIDC_SCHEME: OidcJwtScheme;
|
|
362
|
+
/**
|
|
363
|
+
* The lease this subscription carries: where the provider's expiry sits in the
|
|
364
|
+
* `mailbox_watch` response (`expiration`, epoch-ms), how early the host
|
|
365
|
+
* renews, and what it calls when the lease is due. The host builds the value
|
|
366
|
+
* with the core's `leaseFromResponse` and runs one scheduler for every
|
|
367
|
+
* expiring trigger.
|
|
368
|
+
*/
|
|
369
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_LEASE: LeaseDeclaration;
|
|
370
|
+
/**
|
|
371
|
+
* Which of this package's actions create, renew and stop the subscription.
|
|
372
|
+
* `renew` is null where the provider cannot renew and the host calls create
|
|
373
|
+
* again — after stopping the old one, and after re-listing, because
|
|
374
|
+
* notifications during the gap are gone.
|
|
375
|
+
*/
|
|
376
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_SUBSCRIPTION: {
|
|
377
|
+
readonly create: "mailbox_watch";
|
|
378
|
+
readonly renew: "mailbox_watch";
|
|
379
|
+
readonly stop: "mailbox_stop";
|
|
380
|
+
};
|
|
381
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_DECODE: DeliveryDecode;
|
|
382
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED: TriggerDescriptor;
|
|
383
|
+
/**
|
|
384
|
+
* Where the follow-up read's cursor goes and comes from. The HOST stores it:
|
|
385
|
+
* seeded from the `mailbox_watch` response's `historyId`, advanced to
|
|
386
|
+
* `cursor.next` after each successful run, and filled into this trigger's
|
|
387
|
+
* config on every run.
|
|
388
|
+
*/
|
|
389
|
+
declare const GMAIL_INBOX_MESSAGE_RECEIVED_CURSOR: CursorReadSpec;
|
|
390
|
+
/**
|
|
391
|
+
* Read what changed since the HOST's stored cursor: `history_list` from
|
|
392
|
+
* `config.startHistoryId`, every page, `history` concatenated, published under
|
|
393
|
+
* `history` with `cursor: {used, next}`. Persist `cursor.next` once the run
|
|
394
|
+
* succeeds. A lapsed cursor (cursor-expired) or too many pages
|
|
395
|
+
* (cursor-overflow) is refused BY NAME with the bounded resync query, and a
|
|
396
|
+
* missing one (cursor-missing) calls nothing. In fake mode with no stored
|
|
397
|
+
* cursor the read is faked from a placeholder, so the node runs on a canvas.
|
|
398
|
+
*/
|
|
399
|
+
declare function readGmailInboxMessageReceivedAfter(event: unknown, config: Record<string, unknown>, options?: {
|
|
400
|
+
credentials?: Record<string, string | undefined>;
|
|
401
|
+
transport?: Transport;
|
|
402
|
+
}): Promise<Record<string, unknown>>;
|
|
403
|
+
/**
|
|
404
|
+
* Verify one inbound Gmail Inbox delivery.
|
|
405
|
+
*
|
|
406
|
+
* The host calls this BEFORE starting a run. The body proves nothing here: the
|
|
407
|
+
* delivery is authenticated by the bearer token in its header. `keys` are the
|
|
408
|
+
* provider's signing keys (its JWKS `keys`), fetched and cached by the HOST;
|
|
409
|
+
* nothing in this package fetches them. `pushAudience` and
|
|
410
|
+
* `pushServiceAccount` are the connection's, and both are REQUIRED: an
|
|
411
|
+
* unchecked audience accepts every token the provider signs for anyone, and an
|
|
412
|
+
* unchecked principal accepts a stranger's subscription aimed at your URL. Any
|
|
413
|
+
* of the three missing refuses every delivery.
|
|
414
|
+
*/
|
|
415
|
+
declare function verifyGmailInboxDelivery(delivery: InboundDelivery, expected: {
|
|
416
|
+
keys: readonly Jwk[];
|
|
417
|
+
pushAudience: string | undefined;
|
|
418
|
+
pushServiceAccount: string | undefined;
|
|
419
|
+
}, now?: number): Promise<WebhookVerification>;
|
|
420
|
+
/**
|
|
421
|
+
* Read one VERIFIED Gmail Inbox delivery.
|
|
422
|
+
*
|
|
423
|
+
* The body is not plain JSON: it is pubsub-push, the provider's envelope,
|
|
424
|
+
* unwrapped to the message it carries. The host calls this AFTER
|
|
425
|
+
* `verifyGmailInboxDelivery` has accepted the delivery, with the SAME raw
|
|
426
|
+
* bytes, and starts the run with what it returns. A body that cannot be read
|
|
427
|
+
* is refused by name, never passed on.
|
|
428
|
+
*/
|
|
429
|
+
declare function decodeGmailInboxDelivery(raw: Uint8Array | string): unknown;
|
|
430
|
+
|
|
431
|
+
export { CONNECTOR_API_VERSION, GMAIL_INBOX, GMAIL_INBOX_BASE_URLS, GMAIL_INBOX_MESSAGE_RECEIVED, GMAIL_INBOX_MESSAGE_RECEIVED_CURSOR, GMAIL_INBOX_MESSAGE_RECEIVED_DECODE, GMAIL_INBOX_MESSAGE_RECEIVED_LEASE, GMAIL_INBOX_MESSAGE_RECEIVED_OIDC_SCHEME, GMAIL_INBOX_MESSAGE_RECEIVED_SUBSCRIPTION, GMAIL_INBOX_REQUIRES, HISTORY_LIST_OPERATION, type HistoryListOptions, LABEL_LIST_OPERATION, type LabelListOptions, MAILBOX_STOP_OPERATION, MAILBOX_WATCH_OPERATION, MESSAGE_GET_OPERATION, MESSAGE_LIST_OPERATION, type MailboxStopOptions, type MailboxWatchOptions, type MessageGetOptions, type MessageListOptions, THREAD_GET_OPERATION, type ThreadGetOptions, decodeGmailInboxDelivery, gmailInboxAuthorize, gmailInboxFaker, gmailInboxHistoryList, gmailInboxLabelList, gmailInboxMailboxStop, gmailInboxMailboxWatch, gmailInboxMessageGet, gmailInboxMessageList, gmailInboxThreadGet, readGmailInboxMessageReceivedAfter, verifyGmailInboxDelivery };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CONNECTOR_API_VERSION, GMAIL_INBOX, GMAIL_INBOX_BASE_URLS, GMAIL_INBOX_REQUIRES, LABEL_LIST_OPERATION, MESSAGE_GET_OPERATION, MESSAGE_LIST_OPERATION, THREAD_GET_OPERATION, gmailInboxAuthorize, gmailInboxFaker, gmailInboxLabelList, gmailInboxMessageGet, gmailInboxMessageList, gmailInboxThreadGet } from './chunk-
|
|
1
|
+
export { CONNECTOR_API_VERSION, GMAIL_INBOX, GMAIL_INBOX_BASE_URLS, GMAIL_INBOX_MESSAGE_RECEIVED, GMAIL_INBOX_MESSAGE_RECEIVED_CURSOR, GMAIL_INBOX_MESSAGE_RECEIVED_DECODE, GMAIL_INBOX_MESSAGE_RECEIVED_LEASE, GMAIL_INBOX_MESSAGE_RECEIVED_OIDC_SCHEME, GMAIL_INBOX_MESSAGE_RECEIVED_SUBSCRIPTION, GMAIL_INBOX_REQUIRES, HISTORY_LIST_OPERATION, LABEL_LIST_OPERATION, MAILBOX_STOP_OPERATION, MAILBOX_WATCH_OPERATION, MESSAGE_GET_OPERATION, MESSAGE_LIST_OPERATION, THREAD_GET_OPERATION, decodeGmailInboxDelivery, gmailInboxAuthorize, gmailInboxFaker, gmailInboxHistoryList, gmailInboxLabelList, gmailInboxMailboxStop, gmailInboxMailboxWatch, gmailInboxMessageGet, gmailInboxMessageList, gmailInboxThreadGet, readGmailInboxMessageReceivedAfter, verifyGmailInboxDelivery } from './chunk-2PSRTESV.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-academy/gmail-inbox-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Gmail Inbox for Node — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP on @particle-academy/fancy-connector-core; no vendor SDK.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"prepublishOnly": "tsup"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@particle-academy/fancy-connector-core": ">=0.
|
|
53
|
+
"@particle-academy/fancy-connector-core": ">=0.14.0 <2.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@particle-academy/fancy-flow": ">=0.47.1 <2.0",
|
|
57
|
-
"@particle-academy/gmail-inbox-ui": ">=0.
|
|
57
|
+
"@particle-academy/gmail-inbox-ui": ">=0.3.0 <0.4.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"@particle-academy/fancy-flow": {
|