@superdurable/connector-google-gmail 0.0.0-stage → 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.
@@ -0,0 +1,402 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/mock/index.ts
21
+ var mock_exports = {};
22
+ __export(mock_exports, {
23
+ GmailMock: () => GmailMock,
24
+ getMessageBranch: () => getMessageBranch,
25
+ getMessageCustomerQuestion: () => getMessageCustomerQuestion,
26
+ getMessageDefault: () => getMessageDefault,
27
+ getMessageDeletedMessage: () => getMessageDeletedMessage,
28
+ getMessageEmptyMessageID: () => getMessageEmptyMessageID,
29
+ getMessageMalformedPayload: () => getMessageMalformedPayload,
30
+ getMessageRateLimited: () => getMessageRateLimited,
31
+ getMessageRetry: () => getMessageRetry,
32
+ getMessageRevokedGrant: () => getMessageRevokedGrant,
33
+ replyToMessageBranch: () => replyToMessageBranch,
34
+ replyToMessageConnectionLost: () => replyToMessageConnectionLost,
35
+ replyToMessageDefault: () => replyToMessageDefault,
36
+ replyToMessageEmptyBody: () => replyToMessageEmptyBody,
37
+ replyToMessageMalformedSource: () => replyToMessageMalformedSource,
38
+ replyToMessageRepliedInThread: () => replyToMessageRepliedInThread,
39
+ replyToMessageRetry: () => replyToMessageRetry,
40
+ replyToMessageSourceMissing: () => replyToMessageSourceMissing,
41
+ sendMessageBranch: () => sendMessageBranch,
42
+ sendMessageConnectionLost: () => sendMessageConnectionLost,
43
+ sendMessageDefault: () => sendMessageDefault,
44
+ sendMessageInvalidRecipient: () => sendMessageInvalidRecipient,
45
+ sendMessageNoRecipients: () => sendMessageNoRecipients,
46
+ sendMessageRetry: () => sendMessageRetry,
47
+ sendMessageSentToCustomer: () => sendMessageSentToCustomer,
48
+ sendMessageUnavailable: () => sendMessageUnavailable
49
+ });
50
+ module.exports = __toCommonJS(mock_exports);
51
+ var import_connectormock = require("@superdurable/connectors-sdk/connectormock");
52
+
53
+ // src/models.ts
54
+ var import_zod = require("zod");
55
+ var ConnectorID = "gmail";
56
+ var GetMessageInputSchema = import_zod.z.strictObject({ messageId: import_zod.z.string() });
57
+ var SendMessageInputSchema = import_zod.z.strictObject({
58
+ to: import_zod.z.array(import_zod.z.string()),
59
+ subject: import_zod.z.string(),
60
+ textBody: import_zod.z.string(),
61
+ htmlBody: import_zod.z.string().optional()
62
+ });
63
+ var ReplyToMessageInputSchema = import_zod.z.strictObject({
64
+ messageId: import_zod.z.string(),
65
+ textBody: import_zod.z.string(),
66
+ htmlBody: import_zod.z.string().optional()
67
+ });
68
+ var MessageSchema = import_zod.z.strictObject({
69
+ messageId: import_zod.z.string(),
70
+ threadId: import_zod.z.string(),
71
+ rfcMessageId: import_zod.z.string().optional(),
72
+ inReplyTo: import_zod.z.string().optional(),
73
+ references: import_zod.z.string().optional(),
74
+ from: import_zod.z.string(),
75
+ replyTo: import_zod.z.string().optional(),
76
+ to: import_zod.z.array(import_zod.z.string()).optional(),
77
+ subject: import_zod.z.string(),
78
+ textBody: import_zod.z.string().optional(),
79
+ htmlBody: import_zod.z.string().optional(),
80
+ snippet: import_zod.z.string().optional(),
81
+ receivedAt: import_zod.z.iso.datetime({ offset: true }),
82
+ labelIds: import_zod.z.array(import_zod.z.string()).optional()
83
+ });
84
+ var SendMessageOutputSchema = import_zod.z.strictObject({
85
+ sender: import_zod.z.string(),
86
+ recipients: import_zod.z.array(import_zod.z.string()),
87
+ messageId: import_zod.z.string(),
88
+ threadId: import_zod.z.string()
89
+ });
90
+
91
+ // src/definitions.ts
92
+ var GetMessageBranch = { Read: "read", NotFound: "notFound", ProviderRejected: "providerRejected", InvalidResponse: "invalidResponse", Defect: "defect" };
93
+ var SendMessageBranch = { Sent: "sent", ProviderRejected: "providerRejected", Defect: "defect" };
94
+ var ReplyToMessageBranch = { Sent: "sent", ProviderRejected: "providerRejected", InvalidResponse: "invalidResponse", Defect: "defect" };
95
+ var GetMessageDefinition = {
96
+ operation: { connectorId: ConnectorID, operationId: "getMessage" },
97
+ branches: [
98
+ { id: "read", description: "The Gmail message was read." },
99
+ { id: "notFound", description: "The Gmail message does not exist.", optional: true },
100
+ { id: "providerRejected", description: "Gmail conclusively rejected the message query.", optional: true },
101
+ { id: "invalidResponse", description: "Gmail returned an invalid or oversized message response.", optional: true },
102
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
103
+ ],
104
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
105
+ };
106
+ var SendMessageDefinition = {
107
+ operation: { connectorId: ConnectorID, operationId: "sendMessage" },
108
+ branches: [
109
+ { id: "sent", description: "Gmail accepted the message; its message and thread IDs can be empty when an unusable accepted response has no Sent Mail match." },
110
+ { id: "providerRejected", description: "Gmail conclusively rejected the message.", optional: true },
111
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
112
+ ],
113
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async", executeRetry: {
114
+ initialIntervalMs: 1e3,
115
+ backoffCoefficient: 2,
116
+ maximumIntervalMs: 3e4,
117
+ maximumAttempts: 5,
118
+ totalDurationMs: 12e4
119
+ } }
120
+ };
121
+ var ReplyToMessageDefinition = {
122
+ operation: { connectorId: ConnectorID, operationId: "replyToMessage" },
123
+ branches: [
124
+ { id: "sent", description: "Gmail accepted the reply; its message ID can be empty when an unusable accepted response has no Sent Mail match, while the requested thread ID remains." },
125
+ { id: "providerRejected", description: "Gmail conclusively rejected the reply.", optional: true },
126
+ { id: "invalidResponse", description: "Gmail returned an invalid or oversized source message response before sending the reply.", optional: true },
127
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
128
+ ],
129
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async", executeRetry: {
130
+ initialIntervalMs: 1e3,
131
+ backoffCoefficient: 2,
132
+ maximumIntervalMs: 3e4,
133
+ maximumAttempts: 5,
134
+ totalDurationMs: 12e4
135
+ } }
136
+ };
137
+
138
+ // src/message.ts
139
+ var import_node_crypto = require("crypto");
140
+ var import_zod2 = require("zod");
141
+ var GmailMessagePartSchema = import_zod2.z.lazy(() => import_zod2.z.object({
142
+ mimeType: import_zod2.z.string().nullish(),
143
+ headers: import_zod2.z.array(import_zod2.z.object({ name: import_zod2.z.string(), value: import_zod2.z.string() })).nullish(),
144
+ body: import_zod2.z.object({ data: import_zod2.z.string().nullish() }).nullish(),
145
+ parts: import_zod2.z.array(GmailMessagePartSchema).nullish()
146
+ }));
147
+ var GmailMessageResourceSchema = import_zod2.z.object({
148
+ id: import_zod2.z.string().nullish().transform((value) => value ?? ""),
149
+ threadId: import_zod2.z.string().nullish().transform((value) => value ?? ""),
150
+ labelIds: import_zod2.z.array(import_zod2.z.string()).nullish(),
151
+ snippet: import_zod2.z.string().nullish(),
152
+ internalDate: import_zod2.z.string().nullish(),
153
+ payload: GmailMessagePartSchema.nullish()
154
+ });
155
+
156
+ // src/http.ts
157
+ var import_connectors_sdk = require("@superdurable/connectors-sdk");
158
+ var import_providerhttp = require("@superdurable/connectors-sdk/providerhttp");
159
+
160
+ // src/provider.ts
161
+ var import_zod3 = require("zod");
162
+ var SentMessageSchema = import_zod3.z.object({ id: import_zod3.z.string().optional(), threadId: import_zod3.z.string().optional() });
163
+ var SentSearchSchema = import_zod3.z.object({ messages: import_zod3.z.array(SentMessageSchema).nullish() });
164
+
165
+ // src/refresh.ts
166
+ var import_connectors_sdk2 = require("@superdurable/connectors-sdk");
167
+ var import_oauthtoken = require("@superdurable/connectors-sdk/oauthtoken");
168
+ var import_zod4 = require("zod");
169
+ var ServiceAccountKeySchema = import_zod4.z.object({ client_email: import_zod4.z.string().min(1), private_key: import_zod4.z.string().min(1), token_uri: import_zod4.z.url() });
170
+
171
+ // src/send.ts
172
+ var import_connectors_sdk3 = require("@superdurable/connectors-sdk");
173
+ var import_providerhttp2 = require("@superdurable/connectors-sdk/providerhttp");
174
+ var import_singledispatch = require("@superdurable/connectors-sdk/singledispatch");
175
+ var import_promises = require("timers/promises");
176
+ var SendMessageOutcomes = {
177
+ operationId: "sendMessage",
178
+ requestName: "send",
179
+ rejectionMessage: "Gmail rejected the message",
180
+ sentBranch: SendMessageBranch.Sent,
181
+ providerRejectedBranch: SendMessageBranch.ProviderRejected
182
+ };
183
+ var ReplyToMessageOutcomes = {
184
+ operationId: "replyToMessage",
185
+ requestName: "reply",
186
+ rejectionMessage: "Gmail rejected the reply",
187
+ sentBranch: ReplyToMessageBranch.Sent,
188
+ providerRejectedBranch: ReplyToMessageBranch.ProviderRejected
189
+ };
190
+
191
+ // src/client.ts
192
+ var import_connectors_sdk4 = require("@superdurable/connectors-sdk");
193
+ var import_providerhttp3 = require("@superdurable/connectors-sdk/providerhttp");
194
+
195
+ // src/connection.ts
196
+ var import_connectors_sdk5 = require("@superdurable/connectors-sdk");
197
+ var GmailConnection = class {
198
+ /** Stable logical credential reference. */
199
+ reference;
200
+ /** Provider or mock operation implementations. */
201
+ operations;
202
+ /** Bind operation implementations to a static named Google connection. */
203
+ constructor(operations, reference) {
204
+ if (!operations) throw new TypeError("Gmail connector operations are required");
205
+ this.reference = import_connectors_sdk5.ConnectionRefSchema.parse(reference);
206
+ if (this.reference.provider !== "google") throw new TypeError("Gmail connection provider must be google");
207
+ this.operations = operations;
208
+ }
209
+ };
210
+
211
+ // src/project.ts
212
+ var import_connectors_sdk7 = require("@superdurable/connectors-sdk");
213
+ var import_projectconfig = require("@superdurable/connectors-sdk/projectconfig");
214
+ var import_zod6 = require("zod");
215
+
216
+ // src/credential_codec.ts
217
+ var import_connectors_sdk6 = require("@superdurable/connectors-sdk");
218
+ var import_zod5 = require("zod");
219
+ var StoredCredentialsSchema = import_zod5.z.object({
220
+ auth_method: import_zod5.z.string().optional(),
221
+ oauth_client_id: import_zod5.z.string().optional(),
222
+ oauth_client_secret: import_zod5.z.string().optional(),
223
+ access_token: import_zod5.z.string().optional(),
224
+ refresh_token: import_zod5.z.string().optional(),
225
+ primary_email: import_zod5.z.string().optional(),
226
+ service_account_key: import_zod5.z.string().optional(),
227
+ delegated_user: import_zod5.z.string().optional()
228
+ });
229
+
230
+ // src/project.ts
231
+ var ProjectGmailConfigurationSchema = import_zod6.z.object({
232
+ endpoint: import_zod6.z.string().optional(),
233
+ maxResponseBytes: import_zod6.z.number().int().safe().optional(),
234
+ maxMessageBytes: import_zod6.z.number().int().safe().optional(),
235
+ pollInterval: import_zod6.z.number().int().safe().optional(),
236
+ pollPageSize: import_zod6.z.number().int().safe().optional()
237
+ });
238
+
239
+ // src/steps.ts
240
+ var import_connectors_sdk8 = require("@superdurable/connectors-sdk");
241
+
242
+ // src/mock/index.ts
243
+ var EmptyMessage = {
244
+ messageId: "",
245
+ threadId: "",
246
+ from: "",
247
+ subject: "",
248
+ receivedAt: "0001-01-01T00:00:00Z"
249
+ };
250
+ var EmptySend = { sender: "", recipients: [], messageId: "", threadId: "" };
251
+ var GmailMock = class {
252
+ #getMessage;
253
+ #sendMessage;
254
+ #replyToMessage;
255
+ #connection;
256
+ /** Construct all three operation scripts under one static connection name. */
257
+ constructor(connectionName) {
258
+ if (!connectionName.trim()) throw new TypeError("Gmail mock connection name is required");
259
+ this.#getMessage = (0, import_connectormock.newQuery)(GetMessageDefinition).default(getMessageDefault());
260
+ this.#sendMessage = (0, import_connectormock.newMutation)(SendMessageDefinition).default(sendMessageDefault());
261
+ this.#replyToMessage = (0, import_connectormock.newMutation)(ReplyToMessageDefinition).default(replyToMessageDefault());
262
+ this.#connection = new GmailConnection(this, { provider: "google", name: connectionName });
263
+ }
264
+ /** Return the typed connection for Gmail Step factories. */
265
+ connection() {
266
+ return this.#connection;
267
+ }
268
+ /** Script getMessage calls. */
269
+ getMessage() {
270
+ return this.#getMessage;
271
+ }
272
+ /** Script sendMessage calls. */
273
+ sendMessage() {
274
+ return this.#sendMessage;
275
+ }
276
+ /** Script replyToMessage calls. */
277
+ replyToMessage() {
278
+ return this.#replyToMessage;
279
+ }
280
+ };
281
+ function failure(operation, kind, message) {
282
+ return { kind, provider: "gmail", operation, message };
283
+ }
284
+ function getMessageBranch(branch, value, reason) {
285
+ return (0, import_connectormock.branchCase)(branch, value, reason);
286
+ }
287
+ function getMessageRetry(reason, afterMs = 0) {
288
+ return (0, import_connectormock.retryCase)(reason, afterMs);
289
+ }
290
+ function getMessageCustomerQuestion() {
291
+ return (0, import_connectormock.branchCase)(GetMessageBranch.Read, MessageSchema.parse({
292
+ messageId: "18c0a1b2c3d4e5f6",
293
+ threadId: "18c0a1b2c3d4e5f0",
294
+ rfcMessageId: "<question-1@mail.example.com>",
295
+ inReplyTo: "<welcome-1@mail.example.com>",
296
+ references: "<welcome-1@mail.example.com>",
297
+ from: "Ada Customer <ada@example.com>",
298
+ replyTo: "ada.support@example.com",
299
+ to: ["support@example.org"],
300
+ subject: "Re: Order 1042 has not arrived",
301
+ textBody: "Hello, my order 1042 has not arrived yet. Can you check?",
302
+ htmlBody: "<p>Hello, my order 1042 has not arrived yet. Can you check?</p>",
303
+ snippet: "Hello, my order 1042 has not arrived yet.",
304
+ receivedAt: "2026-03-04T09:15:00Z",
305
+ labelIds: ["INBOX", "UNREAD"]
306
+ }));
307
+ }
308
+ function getMessageDeletedMessage() {
309
+ return (0, import_connectormock.branchCase)(GetMessageBranch.NotFound, EmptyMessage, failure("getMessage", "NOT_FOUND", "The Gmail message does not exist."));
310
+ }
311
+ function getMessageRevokedGrant() {
312
+ return (0, import_connectormock.branchCase)(GetMessageBranch.ProviderRejected, EmptyMessage, failure("getMessage", "AUTHORIZATION", "Gmail rejected the message query for the granted scopes."));
313
+ }
314
+ function getMessageMalformedPayload() {
315
+ return (0, import_connectormock.branchCase)(GetMessageBranch.InvalidResponse, EmptyMessage, failure("getMessage", "PROTOCOL", "Gmail returned an invalid message payload."));
316
+ }
317
+ function getMessageEmptyMessageID() {
318
+ return (0, import_connectormock.branchCase)(GetMessageBranch.Defect, EmptyMessage, failure("getMessage", "VALIDATION", "The message ID is required."));
319
+ }
320
+ function getMessageRateLimited() {
321
+ return (0, import_connectormock.retryCase)(failure("getMessage", "RATE_LIMIT", "Gmail rate limit was reached."), 1e3);
322
+ }
323
+ function getMessageDefault() {
324
+ return getMessageCustomerQuestion();
325
+ }
326
+ function sendMessageBranch(branch, value, reason) {
327
+ return (0, import_connectormock.branchCase)(branch, value, reason);
328
+ }
329
+ function sendMessageRetry(reason, afterMs = 0) {
330
+ return (0, import_connectormock.retryCase)(reason, afterMs);
331
+ }
332
+ function sendMessageSentToCustomer() {
333
+ return (0, import_connectormock.branchCase)(SendMessageBranch.Sent, SendMessageOutputSchema.parse({ sender: "support@example.org", recipients: ["ada@example.com"], messageId: "18c0a1b2c3d4e600", threadId: "18c0a1b2c3d4e600" }));
334
+ }
335
+ function sendMessageInvalidRecipient() {
336
+ return (0, import_connectormock.branchCase)(SendMessageBranch.ProviderRejected, EmptySend, failure("sendMessage", "PROVIDER_REJECTION", "Gmail rejected the message recipients."));
337
+ }
338
+ function sendMessageConnectionLost() {
339
+ return (0, import_connectormock.retryCase)(failure("sendMessage", "TRANSPORT", "The connection closed before Gmail answered."));
340
+ }
341
+ function sendMessageNoRecipients() {
342
+ return (0, import_connectormock.branchCase)(SendMessageBranch.Defect, EmptySend, failure("sendMessage", "VALIDATION", "At least one recipient is required."));
343
+ }
344
+ function sendMessageUnavailable() {
345
+ return (0, import_connectormock.retryCase)(failure("sendMessage", "AVAILABILITY", "Gmail is temporarily unavailable."));
346
+ }
347
+ function sendMessageDefault() {
348
+ return sendMessageSentToCustomer();
349
+ }
350
+ function replyToMessageBranch(branch, value, reason) {
351
+ return (0, import_connectormock.branchCase)(branch, value, reason);
352
+ }
353
+ function replyToMessageRetry(reason, afterMs = 0) {
354
+ return (0, import_connectormock.retryCase)(reason, afterMs);
355
+ }
356
+ function replyToMessageRepliedInThread() {
357
+ return (0, import_connectormock.branchCase)(ReplyToMessageBranch.Sent, SendMessageOutputSchema.parse({ sender: "support@example.org", recipients: ["ada.support@example.com"], messageId: "18c0a1b2c3d4e700", threadId: "18c0a1b2c3d4e5f0" }));
358
+ }
359
+ function replyToMessageSourceMissing() {
360
+ return (0, import_connectormock.branchCase)(ReplyToMessageBranch.ProviderRejected, EmptySend, failure("replyToMessage", "NOT_FOUND", "The source Gmail message does not exist."));
361
+ }
362
+ function replyToMessageMalformedSource() {
363
+ return (0, import_connectormock.branchCase)(ReplyToMessageBranch.InvalidResponse, EmptySend, failure("replyToMessage", "PROTOCOL", "Gmail returned an invalid source message."));
364
+ }
365
+ function replyToMessageConnectionLost() {
366
+ return (0, import_connectormock.retryCase)(failure("replyToMessage", "TRANSPORT", "The connection closed before Gmail answered."));
367
+ }
368
+ function replyToMessageEmptyBody() {
369
+ return (0, import_connectormock.branchCase)(ReplyToMessageBranch.Defect, EmptySend, failure("replyToMessage", "VALIDATION", "The reply body is required."));
370
+ }
371
+ function replyToMessageDefault() {
372
+ return replyToMessageRepliedInThread();
373
+ }
374
+ // Annotate the CommonJS export names for ESM import in node:
375
+ 0 && (module.exports = {
376
+ GmailMock,
377
+ getMessageBranch,
378
+ getMessageCustomerQuestion,
379
+ getMessageDefault,
380
+ getMessageDeletedMessage,
381
+ getMessageEmptyMessageID,
382
+ getMessageMalformedPayload,
383
+ getMessageRateLimited,
384
+ getMessageRetry,
385
+ getMessageRevokedGrant,
386
+ replyToMessageBranch,
387
+ replyToMessageConnectionLost,
388
+ replyToMessageDefault,
389
+ replyToMessageEmptyBody,
390
+ replyToMessageMalformedSource,
391
+ replyToMessageRepliedInThread,
392
+ replyToMessageRetry,
393
+ replyToMessageSourceMissing,
394
+ sendMessageBranch,
395
+ sendMessageConnectionLost,
396
+ sendMessageDefault,
397
+ sendMessageInvalidRecipient,
398
+ sendMessageNoRecipients,
399
+ sendMessageRetry,
400
+ sendMessageSentToCustomer,
401
+ sendMessageUnavailable
402
+ });
@@ -0,0 +1,71 @@
1
+ import { Failure } from '@superdurable/connectors-sdk';
2
+ import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
3
+ import { e as GmailConnection, G as GetMessageInput, M as Message, S as SendMessageInput, c as SendMessageOutput, R as ReplyToMessageInput } from '../connection-ce8JHjE8.cjs';
4
+ import 'zod';
5
+
6
+ /** Scripted Gmail connection with the manifest's happy-path defaults. */
7
+ declare class GmailMock {
8
+ #private;
9
+ /** Construct all three operation scripts under one static connection name. */
10
+ constructor(connectionName: string);
11
+ /** Return the typed connection for Gmail Step factories. */
12
+ connection(): GmailConnection;
13
+ /** Script getMessage calls. */
14
+ getMessage(): MockQuery<GetMessageInput, Message>;
15
+ /** Script sendMessage calls. */
16
+ sendMessage(): MockMutation<SendMessageInput, SendMessageOutput>;
17
+ /** Script replyToMessage calls. */
18
+ replyToMessage(): MockMutation<ReplyToMessageInput, SendMessageOutput>;
19
+ }
20
+ /** Script an arbitrary getMessage branch. */
21
+ declare function getMessageBranch(branch: string, value: Message, reason?: Failure): Case<Message>;
22
+ /** Script an arbitrary getMessage retry. */
23
+ declare function getMessageRetry(reason: Failure, afterMs?: number): Case<Message>;
24
+ /** The manifest's customerQuestion read scenario. */
25
+ declare function getMessageCustomerQuestion(): Case<Message>;
26
+ /** The manifest's deletedMessage branch. */
27
+ declare function getMessageDeletedMessage(): Case<Message>;
28
+ /** The manifest's revokedGrant branch. */
29
+ declare function getMessageRevokedGrant(): Case<Message>;
30
+ /** The manifest's malformedPayload branch. */
31
+ declare function getMessageMalformedPayload(): Case<Message>;
32
+ /** The manifest's emptyMessageID branch. */
33
+ declare function getMessageEmptyMessageID(): Case<Message>;
34
+ /** The manifest's rateLimited retry. */
35
+ declare function getMessageRateLimited(): Case<Message>;
36
+ /** The manifest's default getMessage scenario. */
37
+ declare function getMessageDefault(): Case<Message>;
38
+ /** Script an arbitrary sendMessage branch. */
39
+ declare function sendMessageBranch(branch: string, value: SendMessageOutput, reason?: Failure): Case<SendMessageOutput>;
40
+ /** Script an arbitrary sendMessage retry. */
41
+ declare function sendMessageRetry(reason: Failure, afterMs?: number): Case<SendMessageOutput>;
42
+ /** The manifest's sentToCustomer scenario. */
43
+ declare function sendMessageSentToCustomer(): Case<SendMessageOutput>;
44
+ /** The manifest's invalidRecipient branch. */
45
+ declare function sendMessageInvalidRecipient(): Case<SendMessageOutput>;
46
+ /** The manifest's connectionLost retry. */
47
+ declare function sendMessageConnectionLost(): Case<SendMessageOutput>;
48
+ /** The manifest's noRecipients defect. */
49
+ declare function sendMessageNoRecipients(): Case<SendMessageOutput>;
50
+ /** The manifest's unavailable retry. */
51
+ declare function sendMessageUnavailable(): Case<SendMessageOutput>;
52
+ /** The manifest's default sendMessage scenario. */
53
+ declare function sendMessageDefault(): Case<SendMessageOutput>;
54
+ /** Script an arbitrary replyToMessage branch. */
55
+ declare function replyToMessageBranch(branch: string, value: SendMessageOutput, reason?: Failure): Case<SendMessageOutput>;
56
+ /** Script an arbitrary replyToMessage retry. */
57
+ declare function replyToMessageRetry(reason: Failure, afterMs?: number): Case<SendMessageOutput>;
58
+ /** The manifest's repliedInThread scenario. */
59
+ declare function replyToMessageRepliedInThread(): Case<SendMessageOutput>;
60
+ /** The manifest's sourceMissing branch. */
61
+ declare function replyToMessageSourceMissing(): Case<SendMessageOutput>;
62
+ /** The manifest's malformedSource branch. */
63
+ declare function replyToMessageMalformedSource(): Case<SendMessageOutput>;
64
+ /** The manifest's connectionLost retry. */
65
+ declare function replyToMessageConnectionLost(): Case<SendMessageOutput>;
66
+ /** The manifest's emptyBody defect. */
67
+ declare function replyToMessageEmptyBody(): Case<SendMessageOutput>;
68
+ /** The manifest's default replyToMessage scenario. */
69
+ declare function replyToMessageDefault(): Case<SendMessageOutput>;
70
+
71
+ export { GmailMock, getMessageBranch, getMessageCustomerQuestion, getMessageDefault, getMessageDeletedMessage, getMessageEmptyMessageID, getMessageMalformedPayload, getMessageRateLimited, getMessageRetry, getMessageRevokedGrant, replyToMessageBranch, replyToMessageConnectionLost, replyToMessageDefault, replyToMessageEmptyBody, replyToMessageMalformedSource, replyToMessageRepliedInThread, replyToMessageRetry, replyToMessageSourceMissing, sendMessageBranch, sendMessageConnectionLost, sendMessageDefault, sendMessageInvalidRecipient, sendMessageNoRecipients, sendMessageRetry, sendMessageSentToCustomer, sendMessageUnavailable };
@@ -0,0 +1,71 @@
1
+ import { Failure } from '@superdurable/connectors-sdk';
2
+ import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
3
+ import { e as GmailConnection, G as GetMessageInput, M as Message, S as SendMessageInput, c as SendMessageOutput, R as ReplyToMessageInput } from '../connection-ce8JHjE8.js';
4
+ import 'zod';
5
+
6
+ /** Scripted Gmail connection with the manifest's happy-path defaults. */
7
+ declare class GmailMock {
8
+ #private;
9
+ /** Construct all three operation scripts under one static connection name. */
10
+ constructor(connectionName: string);
11
+ /** Return the typed connection for Gmail Step factories. */
12
+ connection(): GmailConnection;
13
+ /** Script getMessage calls. */
14
+ getMessage(): MockQuery<GetMessageInput, Message>;
15
+ /** Script sendMessage calls. */
16
+ sendMessage(): MockMutation<SendMessageInput, SendMessageOutput>;
17
+ /** Script replyToMessage calls. */
18
+ replyToMessage(): MockMutation<ReplyToMessageInput, SendMessageOutput>;
19
+ }
20
+ /** Script an arbitrary getMessage branch. */
21
+ declare function getMessageBranch(branch: string, value: Message, reason?: Failure): Case<Message>;
22
+ /** Script an arbitrary getMessage retry. */
23
+ declare function getMessageRetry(reason: Failure, afterMs?: number): Case<Message>;
24
+ /** The manifest's customerQuestion read scenario. */
25
+ declare function getMessageCustomerQuestion(): Case<Message>;
26
+ /** The manifest's deletedMessage branch. */
27
+ declare function getMessageDeletedMessage(): Case<Message>;
28
+ /** The manifest's revokedGrant branch. */
29
+ declare function getMessageRevokedGrant(): Case<Message>;
30
+ /** The manifest's malformedPayload branch. */
31
+ declare function getMessageMalformedPayload(): Case<Message>;
32
+ /** The manifest's emptyMessageID branch. */
33
+ declare function getMessageEmptyMessageID(): Case<Message>;
34
+ /** The manifest's rateLimited retry. */
35
+ declare function getMessageRateLimited(): Case<Message>;
36
+ /** The manifest's default getMessage scenario. */
37
+ declare function getMessageDefault(): Case<Message>;
38
+ /** Script an arbitrary sendMessage branch. */
39
+ declare function sendMessageBranch(branch: string, value: SendMessageOutput, reason?: Failure): Case<SendMessageOutput>;
40
+ /** Script an arbitrary sendMessage retry. */
41
+ declare function sendMessageRetry(reason: Failure, afterMs?: number): Case<SendMessageOutput>;
42
+ /** The manifest's sentToCustomer scenario. */
43
+ declare function sendMessageSentToCustomer(): Case<SendMessageOutput>;
44
+ /** The manifest's invalidRecipient branch. */
45
+ declare function sendMessageInvalidRecipient(): Case<SendMessageOutput>;
46
+ /** The manifest's connectionLost retry. */
47
+ declare function sendMessageConnectionLost(): Case<SendMessageOutput>;
48
+ /** The manifest's noRecipients defect. */
49
+ declare function sendMessageNoRecipients(): Case<SendMessageOutput>;
50
+ /** The manifest's unavailable retry. */
51
+ declare function sendMessageUnavailable(): Case<SendMessageOutput>;
52
+ /** The manifest's default sendMessage scenario. */
53
+ declare function sendMessageDefault(): Case<SendMessageOutput>;
54
+ /** Script an arbitrary replyToMessage branch. */
55
+ declare function replyToMessageBranch(branch: string, value: SendMessageOutput, reason?: Failure): Case<SendMessageOutput>;
56
+ /** Script an arbitrary replyToMessage retry. */
57
+ declare function replyToMessageRetry(reason: Failure, afterMs?: number): Case<SendMessageOutput>;
58
+ /** The manifest's repliedInThread scenario. */
59
+ declare function replyToMessageRepliedInThread(): Case<SendMessageOutput>;
60
+ /** The manifest's sourceMissing branch. */
61
+ declare function replyToMessageSourceMissing(): Case<SendMessageOutput>;
62
+ /** The manifest's malformedSource branch. */
63
+ declare function replyToMessageMalformedSource(): Case<SendMessageOutput>;
64
+ /** The manifest's connectionLost retry. */
65
+ declare function replyToMessageConnectionLost(): Case<SendMessageOutput>;
66
+ /** The manifest's emptyBody defect. */
67
+ declare function replyToMessageEmptyBody(): Case<SendMessageOutput>;
68
+ /** The manifest's default replyToMessage scenario. */
69
+ declare function replyToMessageDefault(): Case<SendMessageOutput>;
70
+
71
+ export { GmailMock, getMessageBranch, getMessageCustomerQuestion, getMessageDefault, getMessageDeletedMessage, getMessageEmptyMessageID, getMessageMalformedPayload, getMessageRateLimited, getMessageRetry, getMessageRevokedGrant, replyToMessageBranch, replyToMessageConnectionLost, replyToMessageDefault, replyToMessageEmptyBody, replyToMessageMalformedSource, replyToMessageRepliedInThread, replyToMessageRetry, replyToMessageSourceMissing, sendMessageBranch, sendMessageConnectionLost, sendMessageDefault, sendMessageInvalidRecipient, sendMessageNoRecipients, sendMessageRetry, sendMessageSentToCustomer, sendMessageUnavailable };