@superdurable/connector-brevo 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,749 @@
1
+ // src/generated/models.ts
2
+ import { z } from "zod";
3
+ import { SecretString } from "@superdurable/connectors-sdk";
4
+ var nativeJSON = JSON;
5
+ var signedIntegerToken = /^-?(?:0|[1-9][0-9]*)$/;
6
+ var minimumSignedInteger = -(1n << 63n);
7
+ var maximumSignedInteger = (1n << 63n) - 1n;
8
+ function decodeSignedInteger(value) {
9
+ if (typeof value === "number" && Number.isSafeInteger(value)) return value === 0 ? 0 : value;
10
+ if (!nativeJSON.isRawJSON(value) || value.rawJSON.length > 20 || !signedIntegerToken.test(value.rawJSON)) {
11
+ throw new TypeError("expected a signed 64-bit integer");
12
+ }
13
+ const integer = BigInt(value.rawJSON);
14
+ if (integer < minimumSignedInteger || integer > maximumSignedInteger) throw new RangeError("signed 64-bit integer out of range");
15
+ const number = Number(integer);
16
+ return Number.isSafeInteger(number) ? number : value;
17
+ }
18
+ var signedIntegerSchema = z.unknown().transform((value, context) => {
19
+ try {
20
+ return decodeSignedInteger(value);
21
+ } catch {
22
+ context.addIssue({ code: "custom", message: "expected a signed 64-bit integer" });
23
+ return z.NEVER;
24
+ }
25
+ });
26
+ function parseJSONNumberTokens(text) {
27
+ return JSON.parse(text, (_key, value, context) => typeof value === "number" && context?.source !== void 0 ? nativeJSON.rawJSON(context.source) : value);
28
+ }
29
+ function parseExactIntegerJSON(text) {
30
+ return JSON.parse(text, (_key, field, context) => typeof field === "number" && !Number.isSafeInteger(field) && context?.source && signedIntegerToken.test(context.source) ? nativeJSON.rawJSON(context.source) : field);
31
+ }
32
+ function exactIntegerJSONCodec(decode) {
33
+ return {
34
+ typeName: "json",
35
+ wireKind: "json",
36
+ encode(value) {
37
+ const data = JSON.stringify(value, (_key, field) => {
38
+ if (typeof field === "number" && Number.isInteger(field) && !Number.isSafeInteger(field)) {
39
+ throw new RangeError("use a raw JSON token for integers outside the safe number range");
40
+ }
41
+ return field;
42
+ });
43
+ if (data === void 0) throw new TypeError("value cannot be encoded as JSON");
44
+ return { kind: "json", data };
45
+ },
46
+ decode(wire) {
47
+ if (wire.kind !== "json" || typeof wire.data !== "string") throw new TypeError("expected Dex JSON wire data");
48
+ const value = parseExactIntegerJSON(wire.data);
49
+ return decode ? decode(value) : value;
50
+ }
51
+ };
52
+ }
53
+ var ConfigSchema = z.object({
54
+ "baseUrl": z.string().optional(),
55
+ "timeoutMs": z.number().int().optional(),
56
+ "maxResponseBytes": z.number().int().optional()
57
+ });
58
+ var CredentialMaterialError = class extends TypeError {
59
+ constructor(message) {
60
+ super(message);
61
+ this.name = "CredentialMaterialError";
62
+ }
63
+ };
64
+ var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
65
+ "project credential decoding failed",
66
+ "shared project credential decoding failed",
67
+ "project credential decoding failed: this connector version does not support shared credentials"
68
+ ]);
69
+ function isCredentialMaterialError(error) {
70
+ return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
71
+ }
72
+ function decodeCredentials(value) {
73
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
74
+ const fields = value;
75
+ const allowed = /* @__PURE__ */ new Set(["api_key"]);
76
+ if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
77
+ if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new CredentialMaterialError("credential api_key has an invalid type");
78
+ const credentials = {};
79
+ if (!fields["api_key"]) throw new CredentialMaterialError("credential api_key is required");
80
+ credentials.apiKey = new SecretString(fields["api_key"] ?? "");
81
+ return credentials;
82
+ }
83
+ var CreateContactInputSchema = z.strictObject({
84
+ "email": z.string(),
85
+ "attributes": z.record(z.string(), z.string()).optional()
86
+ });
87
+ var ContactWriteResultSchema = z.strictObject({
88
+ "id": signedIntegerSchema.optional(),
89
+ "email": z.string(),
90
+ "created": z.boolean()
91
+ });
92
+ var ListContactsInputSchema = z.strictObject({
93
+ "limit": signedIntegerSchema,
94
+ "offset": signedIntegerSchema
95
+ });
96
+ var ContactIdentitySchema = z.strictObject({
97
+ "id": signedIntegerSchema,
98
+ "email": z.string().optional()
99
+ });
100
+ var ContactsListSchema = z.strictObject({
101
+ "contacts": z.array(ContactIdentitySchema).nullable(),
102
+ "count": signedIntegerSchema
103
+ });
104
+ var UpdateContactInputSchema = z.strictObject({
105
+ "email": z.string(),
106
+ "attributes": z.record(z.string(), z.string()).nullable()
107
+ });
108
+ var ContactChangeResultSchema = z.strictObject({
109
+ "email": z.string()
110
+ });
111
+ var DeleteContactInputSchema = z.strictObject({
112
+ "email": z.string()
113
+ });
114
+ var ListAttributesInputSchema = z.strictObject({});
115
+ var AttributeIdentitySchema = z.strictObject({
116
+ "name": z.string(),
117
+ "category": z.string(),
118
+ "type": z.string()
119
+ });
120
+ var AttributesListSchema = z.strictObject({
121
+ "attributes": z.array(AttributeIdentitySchema).nullable()
122
+ });
123
+ var AttributeEnumerationValueSchema = z.strictObject({
124
+ "value": signedIntegerSchema,
125
+ "label": z.string()
126
+ });
127
+ var CreateAttributeInputSchema = z.strictObject({
128
+ "category": z.string(),
129
+ "name": z.string(),
130
+ "type": z.string().optional(),
131
+ "value": z.string().optional(),
132
+ "options": z.array(z.string()).optional(),
133
+ "enumeration": z.array(AttributeEnumerationValueSchema).optional()
134
+ });
135
+ var AttributeChangeResultSchema = z.strictObject({
136
+ "category": z.string(),
137
+ "name": z.string()
138
+ });
139
+ var UpdateAttributeInputSchema = z.strictObject({
140
+ "category": z.string(),
141
+ "name": z.string(),
142
+ "options": z.array(z.string()).optional(),
143
+ "enumeration": z.array(AttributeEnumerationValueSchema).optional(),
144
+ "value": z.string().optional()
145
+ });
146
+ var DeleteAttributeInputSchema = z.strictObject({
147
+ "category": z.string(),
148
+ "name": z.string()
149
+ });
150
+ var ListSendersInputSchema = z.strictObject({});
151
+ var SenderIdentitySchema = z.strictObject({
152
+ "id": signedIntegerSchema,
153
+ "name": z.string(),
154
+ "email": z.string(),
155
+ "active": z.boolean()
156
+ });
157
+ var SendersListSchema = z.strictObject({
158
+ "senders": z.array(SenderIdentitySchema).nullable()
159
+ });
160
+ var CreateSenderInputSchema = z.strictObject({
161
+ "email": z.string(),
162
+ "name": z.string()
163
+ });
164
+ var SenderChangeResultSchema = z.strictObject({
165
+ "id": signedIntegerSchema
166
+ });
167
+ var UpdateSenderInputSchema = z.strictObject({
168
+ "id": signedIntegerSchema,
169
+ "name": z.string()
170
+ });
171
+ var DeleteSenderInputSchema = z.strictObject({
172
+ "id": signedIntegerSchema
173
+ });
174
+ var SendEmailInputSchema = z.strictObject({
175
+ "senderEmail": z.string(),
176
+ "senderName": z.string(),
177
+ "toEmail": z.string(),
178
+ "subject": z.string(),
179
+ "textContent": z.string().optional(),
180
+ "htmlContent": z.string().optional()
181
+ });
182
+ var EmailSendResultSchema = z.strictObject({
183
+ "messageId": z.string()
184
+ });
185
+ var SendTemplateEmailInputSchema = z.strictObject({
186
+ "templateId": signedIntegerSchema,
187
+ "toEmail": z.string(),
188
+ "params": z.record(z.string(), z.string()).optional()
189
+ });
190
+ var CreateOrUpdateContactInputSchema = z.strictObject({
191
+ "email": z.string(),
192
+ "attributes": z.record(z.string(), z.string()).optional()
193
+ });
194
+ var GetContactInputSchema = z.strictObject({
195
+ "email": z.string()
196
+ });
197
+ var ContactSchema = z.strictObject({
198
+ "id": signedIntegerSchema,
199
+ "email": z.string()
200
+ });
201
+
202
+ // src/generated/definitions.ts
203
+ var ConnectorID = "brevo";
204
+ var ProviderID = "brevo";
205
+ var CreateContactBranch = {
206
+ Created: "created",
207
+ ProviderRejected: "providerRejected",
208
+ Defect: "defect",
209
+ Uncertain: "uncertain"
210
+ };
211
+ var CreateContactBranchCreated = CreateContactBranch.Created;
212
+ var CreateContactBranchProviderRejected = CreateContactBranch.ProviderRejected;
213
+ var CreateContactBranchDefect = CreateContactBranch.Defect;
214
+ var CreateContactBranchUncertain = CreateContactBranch.Uncertain;
215
+ var CreateContactDefinition = {
216
+ operation: { connectorId: ConnectorID, operationId: "createContact" },
217
+ branches: [
218
+ { id: "created", description: "Brevo created the contact." },
219
+ { id: "providerRejected", description: "Brevo conclusively rejected the contact.", optional: true },
220
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true },
221
+ { id: "uncertain", description: "The contact may have been created after the send cap.", optional: true }
222
+ ],
223
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
224
+ repeatOnUnknown: "limited",
225
+ maxSends: 3
226
+ };
227
+ var CreateContactMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
228
+ var ListContactsBranch = {
229
+ Listed: "listed",
230
+ ProviderRejected: "providerRejected",
231
+ InvalidResponse: "invalidResponse",
232
+ Defect: "defect"
233
+ };
234
+ var ListContactsBranchListed = ListContactsBranch.Listed;
235
+ var ListContactsBranchProviderRejected = ListContactsBranch.ProviderRejected;
236
+ var ListContactsBranchInvalidResponse = ListContactsBranch.InvalidResponse;
237
+ var ListContactsBranchDefect = ListContactsBranch.Defect;
238
+ var ListContactsDefinition = {
239
+ operation: { connectorId: ConnectorID, operationId: "listContacts" },
240
+ branches: [
241
+ { id: "listed", description: "Brevo completed the operation." },
242
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
243
+ { id: "invalidResponse", description: "Brevo returned malformed or oversized data.", optional: true },
244
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
245
+ ],
246
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
247
+ };
248
+ var ListContactsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
249
+ var UpdateContactBranch = {
250
+ Updated: "updated",
251
+ NotFound: "notFound",
252
+ ProviderRejected: "providerRejected",
253
+ Defect: "defect"
254
+ };
255
+ var UpdateContactBranchUpdated = UpdateContactBranch.Updated;
256
+ var UpdateContactBranchNotFound = UpdateContactBranch.NotFound;
257
+ var UpdateContactBranchProviderRejected = UpdateContactBranch.ProviderRejected;
258
+ var UpdateContactBranchDefect = UpdateContactBranch.Defect;
259
+ var UpdateContactDefinition = {
260
+ operation: { connectorId: ConnectorID, operationId: "updateContact" },
261
+ branches: [
262
+ { id: "updated", description: "Brevo completed the operation." },
263
+ { id: "notFound", description: "Brevo did not find the contact.", optional: true },
264
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
265
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
266
+ ],
267
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
268
+ repeatOnUnknown: "safe"
269
+ };
270
+ var UpdateContactMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
271
+ var DeleteContactBranch = {
272
+ Deleted: "deleted",
273
+ NotFound: "notFound",
274
+ ProviderRejected: "providerRejected",
275
+ Defect: "defect"
276
+ };
277
+ var DeleteContactBranchDeleted = DeleteContactBranch.Deleted;
278
+ var DeleteContactBranchNotFound = DeleteContactBranch.NotFound;
279
+ var DeleteContactBranchProviderRejected = DeleteContactBranch.ProviderRejected;
280
+ var DeleteContactBranchDefect = DeleteContactBranch.Defect;
281
+ var DeleteContactDefinition = {
282
+ operation: { connectorId: ConnectorID, operationId: "deleteContact" },
283
+ branches: [
284
+ { id: "deleted", description: "Brevo completed the operation." },
285
+ { id: "notFound", description: "Brevo did not find the contact.", optional: true },
286
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
287
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
288
+ ],
289
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
290
+ repeatOnUnknown: "safe"
291
+ };
292
+ var DeleteContactMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
293
+ var ListAttributesBranch = {
294
+ Listed: "listed",
295
+ ProviderRejected: "providerRejected",
296
+ InvalidResponse: "invalidResponse",
297
+ Defect: "defect"
298
+ };
299
+ var ListAttributesBranchListed = ListAttributesBranch.Listed;
300
+ var ListAttributesBranchProviderRejected = ListAttributesBranch.ProviderRejected;
301
+ var ListAttributesBranchInvalidResponse = ListAttributesBranch.InvalidResponse;
302
+ var ListAttributesBranchDefect = ListAttributesBranch.Defect;
303
+ var ListAttributesDefinition = {
304
+ operation: { connectorId: ConnectorID, operationId: "listAttributes" },
305
+ branches: [
306
+ { id: "listed", description: "Brevo completed the operation." },
307
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
308
+ { id: "invalidResponse", description: "Brevo returned malformed or oversized data.", optional: true },
309
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
310
+ ],
311
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
312
+ };
313
+ var ListAttributesMetadata = { kind: "query", idempotency: "none", authorization: "required" };
314
+ var CreateAttributeBranch = {
315
+ Created: "created",
316
+ ProviderRejected: "providerRejected",
317
+ Defect: "defect",
318
+ Uncertain: "uncertain"
319
+ };
320
+ var CreateAttributeBranchCreated = CreateAttributeBranch.Created;
321
+ var CreateAttributeBranchProviderRejected = CreateAttributeBranch.ProviderRejected;
322
+ var CreateAttributeBranchDefect = CreateAttributeBranch.Defect;
323
+ var CreateAttributeBranchUncertain = CreateAttributeBranch.Uncertain;
324
+ var CreateAttributeDefinition = {
325
+ operation: { connectorId: ConnectorID, operationId: "createAttribute" },
326
+ branches: [
327
+ { id: "created", description: "Brevo created the attribute." },
328
+ { id: "providerRejected", description: "Brevo conclusively rejected the attribute.", optional: true },
329
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true },
330
+ { id: "uncertain", description: "The attribute may have been created after the send cap.", optional: true }
331
+ ],
332
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
333
+ repeatOnUnknown: "limited",
334
+ maxSends: 3
335
+ };
336
+ var CreateAttributeMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
337
+ var UpdateAttributeBranch = {
338
+ Updated: "updated",
339
+ NotFound: "notFound",
340
+ ProviderRejected: "providerRejected",
341
+ Defect: "defect"
342
+ };
343
+ var UpdateAttributeBranchUpdated = UpdateAttributeBranch.Updated;
344
+ var UpdateAttributeBranchNotFound = UpdateAttributeBranch.NotFound;
345
+ var UpdateAttributeBranchProviderRejected = UpdateAttributeBranch.ProviderRejected;
346
+ var UpdateAttributeBranchDefect = UpdateAttributeBranch.Defect;
347
+ var UpdateAttributeDefinition = {
348
+ operation: { connectorId: ConnectorID, operationId: "updateAttribute" },
349
+ branches: [
350
+ { id: "updated", description: "Brevo updated the attribute." },
351
+ { id: "notFound", description: "Brevo did not find the attribute.", optional: true },
352
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
353
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
354
+ ],
355
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
356
+ repeatOnUnknown: "safe"
357
+ };
358
+ var UpdateAttributeMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
359
+ var DeleteAttributeBranch = {
360
+ Deleted: "deleted",
361
+ NotFound: "notFound",
362
+ ProviderRejected: "providerRejected",
363
+ Defect: "defect"
364
+ };
365
+ var DeleteAttributeBranchDeleted = DeleteAttributeBranch.Deleted;
366
+ var DeleteAttributeBranchNotFound = DeleteAttributeBranch.NotFound;
367
+ var DeleteAttributeBranchProviderRejected = DeleteAttributeBranch.ProviderRejected;
368
+ var DeleteAttributeBranchDefect = DeleteAttributeBranch.Defect;
369
+ var DeleteAttributeDefinition = {
370
+ operation: { connectorId: ConnectorID, operationId: "deleteAttribute" },
371
+ branches: [
372
+ { id: "deleted", description: "Brevo deleted the attribute." },
373
+ { id: "notFound", description: "Brevo did not find the attribute.", optional: true },
374
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
375
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
376
+ ],
377
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
378
+ repeatOnUnknown: "safe"
379
+ };
380
+ var DeleteAttributeMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
381
+ var ListSendersBranch = {
382
+ Listed: "listed",
383
+ ProviderRejected: "providerRejected",
384
+ InvalidResponse: "invalidResponse",
385
+ Defect: "defect"
386
+ };
387
+ var ListSendersBranchListed = ListSendersBranch.Listed;
388
+ var ListSendersBranchProviderRejected = ListSendersBranch.ProviderRejected;
389
+ var ListSendersBranchInvalidResponse = ListSendersBranch.InvalidResponse;
390
+ var ListSendersBranchDefect = ListSendersBranch.Defect;
391
+ var ListSendersDefinition = {
392
+ operation: { connectorId: ConnectorID, operationId: "listSenders" },
393
+ branches: [
394
+ { id: "listed", description: "Brevo completed the operation." },
395
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
396
+ { id: "invalidResponse", description: "Brevo returned malformed or oversized data.", optional: true },
397
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
398
+ ],
399
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
400
+ };
401
+ var ListSendersMetadata = { kind: "query", idempotency: "none", authorization: "required" };
402
+ var CreateSenderBranch = {
403
+ Created: "created",
404
+ ProviderRejected: "providerRejected",
405
+ Defect: "defect",
406
+ Uncertain: "uncertain"
407
+ };
408
+ var CreateSenderBranchCreated = CreateSenderBranch.Created;
409
+ var CreateSenderBranchProviderRejected = CreateSenderBranch.ProviderRejected;
410
+ var CreateSenderBranchDefect = CreateSenderBranch.Defect;
411
+ var CreateSenderBranchUncertain = CreateSenderBranch.Uncertain;
412
+ var CreateSenderDefinition = {
413
+ operation: { connectorId: ConnectorID, operationId: "createSender" },
414
+ branches: [
415
+ { id: "created", description: "Brevo created the sender." },
416
+ { id: "providerRejected", description: "Brevo conclusively rejected the sender.", optional: true },
417
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true },
418
+ { id: "uncertain", description: "The sender may have been created after the send cap.", optional: true }
419
+ ],
420
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
421
+ repeatOnUnknown: "limited",
422
+ maxSends: 3
423
+ };
424
+ var CreateSenderMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
425
+ var UpdateSenderBranch = {
426
+ Updated: "updated",
427
+ NotFound: "notFound",
428
+ ProviderRejected: "providerRejected",
429
+ Defect: "defect"
430
+ };
431
+ var UpdateSenderBranchUpdated = UpdateSenderBranch.Updated;
432
+ var UpdateSenderBranchNotFound = UpdateSenderBranch.NotFound;
433
+ var UpdateSenderBranchProviderRejected = UpdateSenderBranch.ProviderRejected;
434
+ var UpdateSenderBranchDefect = UpdateSenderBranch.Defect;
435
+ var UpdateSenderDefinition = {
436
+ operation: { connectorId: ConnectorID, operationId: "updateSender" },
437
+ branches: [
438
+ { id: "updated", description: "Brevo updated the sender." },
439
+ { id: "notFound", description: "Brevo did not find the sender.", optional: true },
440
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
441
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
442
+ ],
443
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
444
+ repeatOnUnknown: "safe"
445
+ };
446
+ var UpdateSenderMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
447
+ var DeleteSenderBranch = {
448
+ Deleted: "deleted",
449
+ NotFound: "notFound",
450
+ ProviderRejected: "providerRejected",
451
+ Defect: "defect"
452
+ };
453
+ var DeleteSenderBranchDeleted = DeleteSenderBranch.Deleted;
454
+ var DeleteSenderBranchNotFound = DeleteSenderBranch.NotFound;
455
+ var DeleteSenderBranchProviderRejected = DeleteSenderBranch.ProviderRejected;
456
+ var DeleteSenderBranchDefect = DeleteSenderBranch.Defect;
457
+ var DeleteSenderDefinition = {
458
+ operation: { connectorId: ConnectorID, operationId: "deleteSender" },
459
+ branches: [
460
+ { id: "deleted", description: "Brevo deleted the sender." },
461
+ { id: "notFound", description: "Brevo did not find the sender.", optional: true },
462
+ { id: "providerRejected", description: "Brevo conclusively rejected the request.", optional: true },
463
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
464
+ ],
465
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
466
+ repeatOnUnknown: "safe"
467
+ };
468
+ var DeleteSenderMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
469
+ var SendEmailBranch = {
470
+ Sent: "sent",
471
+ ProviderRejected: "providerRejected",
472
+ Defect: "defect",
473
+ Uncertain: "uncertain"
474
+ };
475
+ var SendEmailBranchSent = SendEmailBranch.Sent;
476
+ var SendEmailBranchProviderRejected = SendEmailBranch.ProviderRejected;
477
+ var SendEmailBranchDefect = SendEmailBranch.Defect;
478
+ var SendEmailBranchUncertain = SendEmailBranch.Uncertain;
479
+ var SendEmailDefinition = {
480
+ operation: { connectorId: ConnectorID, operationId: "sendEmail" },
481
+ branches: [
482
+ { id: "sent", description: "Brevo accepted the transactional email." },
483
+ { id: "providerRejected", description: "Brevo conclusively rejected the email.", optional: true },
484
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true },
485
+ { id: "uncertain", description: "The email may have been sent after the send cap.", optional: true }
486
+ ],
487
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
488
+ repeatOnUnknown: "limited",
489
+ maxSends: 3
490
+ };
491
+ var SendEmailMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
492
+ var SendTemplateEmailBranch = {
493
+ Sent: "sent",
494
+ ProviderRejected: "providerRejected",
495
+ Defect: "defect",
496
+ Uncertain: "uncertain"
497
+ };
498
+ var SendTemplateEmailBranchSent = SendTemplateEmailBranch.Sent;
499
+ var SendTemplateEmailBranchProviderRejected = SendTemplateEmailBranch.ProviderRejected;
500
+ var SendTemplateEmailBranchDefect = SendTemplateEmailBranch.Defect;
501
+ var SendTemplateEmailBranchUncertain = SendTemplateEmailBranch.Uncertain;
502
+ var SendTemplateEmailDefinition = {
503
+ operation: { connectorId: ConnectorID, operationId: "sendTemplateEmail" },
504
+ branches: [
505
+ { id: "sent", description: "Brevo accepted the template email." },
506
+ { id: "providerRejected", description: "Brevo conclusively rejected the email.", optional: true },
507
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true },
508
+ { id: "uncertain", description: "The email may have been sent after the send cap.", optional: true }
509
+ ],
510
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync" },
511
+ repeatOnUnknown: "limited",
512
+ maxSends: 3
513
+ };
514
+ var SendTemplateEmailMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
515
+ var CreateOrUpdateContactBranch = {
516
+ Saved: "saved",
517
+ ProviderRejected: "providerRejected",
518
+ InvalidResponse: "invalidResponse",
519
+ Defect: "defect"
520
+ };
521
+ var CreateOrUpdateContactBranchSaved = CreateOrUpdateContactBranch.Saved;
522
+ var CreateOrUpdateContactBranchProviderRejected = CreateOrUpdateContactBranch.ProviderRejected;
523
+ var CreateOrUpdateContactBranchInvalidResponse = CreateOrUpdateContactBranch.InvalidResponse;
524
+ var CreateOrUpdateContactBranchDefect = CreateOrUpdateContactBranch.Defect;
525
+ var CreateOrUpdateContactDefinition = {
526
+ operation: { connectorId: ConnectorID, operationId: "createOrUpdateContact" },
527
+ branches: [
528
+ { id: "saved", description: "Brevo created or updated the contact." },
529
+ { id: "providerRejected", description: "Brevo rejected the contact or credentials.", optional: true },
530
+ { id: "invalidResponse", description: "Brevo returned malformed or oversized data.", optional: true },
531
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
532
+ ],
533
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
534
+ repeatOnUnknown: "safe"
535
+ };
536
+ var CreateOrUpdateContactMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
537
+ var GetContactBranch = {
538
+ Found: "found",
539
+ NotFound: "notFound",
540
+ ProviderRejected: "providerRejected",
541
+ InvalidResponse: "invalidResponse",
542
+ Defect: "defect"
543
+ };
544
+ var GetContactBranchFound = GetContactBranch.Found;
545
+ var GetContactBranchNotFound = GetContactBranch.NotFound;
546
+ var GetContactBranchProviderRejected = GetContactBranch.ProviderRejected;
547
+ var GetContactBranchInvalidResponse = GetContactBranch.InvalidResponse;
548
+ var GetContactBranchDefect = GetContactBranch.Defect;
549
+ var GetContactDefinition = {
550
+ operation: { connectorId: ConnectorID, operationId: "getContact" },
551
+ branches: [
552
+ { id: "found", description: "Brevo returned the contact." },
553
+ { id: "notFound", description: "No contact has that email.", optional: true },
554
+ { id: "providerRejected", description: "Brevo rejected the request or credentials.", optional: true },
555
+ { id: "invalidResponse", description: "Brevo returned malformed or oversized data.", optional: true },
556
+ { id: "defect", description: "Local input or credentials are invalid.", optional: true }
557
+ ],
558
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
559
+ };
560
+ var GetContactMetadata = { kind: "query", idempotency: "none", authorization: "required" };
561
+
562
+ // src/generated/connection.ts
563
+ import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
564
+ var Connection = class {
565
+ /** Stable provider and connection name. */
566
+ reference;
567
+ /** Bound provider operations. */
568
+ operations;
569
+ /** Validate a reference and bind operations. */
570
+ constructor(reference, operations) {
571
+ this.reference = ConnectionRefSchema.parse(reference);
572
+ if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
573
+ if (!operations) throw new TypeError("connector operations are required");
574
+ this.operations = operations;
575
+ }
576
+ };
577
+ function newConnection(client, reference) {
578
+ if (!client) throw new TypeError("connector client is required");
579
+ return new Connection(reference, client);
580
+ }
581
+ function newConnectionWithOperations(operations, reference) {
582
+ return new Connection(reference, operations);
583
+ }
584
+ function newProjectConnection(project, connectionName, createClient) {
585
+ if (!project) throw new TypeError("loaded project is required");
586
+ const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
587
+ const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
588
+ if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
589
+ return newConnection(createClient(project, connectionName), reference);
590
+ }
591
+
592
+ export {
593
+ decodeSignedInteger,
594
+ parseJSONNumberTokens,
595
+ parseExactIntegerJSON,
596
+ exactIntegerJSONCodec,
597
+ ConfigSchema,
598
+ CredentialMaterialError,
599
+ isCredentialMaterialError,
600
+ decodeCredentials,
601
+ CreateContactInputSchema,
602
+ ContactWriteResultSchema,
603
+ ListContactsInputSchema,
604
+ ContactIdentitySchema,
605
+ ContactsListSchema,
606
+ UpdateContactInputSchema,
607
+ ContactChangeResultSchema,
608
+ DeleteContactInputSchema,
609
+ ListAttributesInputSchema,
610
+ AttributeIdentitySchema,
611
+ AttributesListSchema,
612
+ AttributeEnumerationValueSchema,
613
+ CreateAttributeInputSchema,
614
+ AttributeChangeResultSchema,
615
+ UpdateAttributeInputSchema,
616
+ DeleteAttributeInputSchema,
617
+ ListSendersInputSchema,
618
+ SenderIdentitySchema,
619
+ SendersListSchema,
620
+ CreateSenderInputSchema,
621
+ SenderChangeResultSchema,
622
+ UpdateSenderInputSchema,
623
+ DeleteSenderInputSchema,
624
+ SendEmailInputSchema,
625
+ EmailSendResultSchema,
626
+ SendTemplateEmailInputSchema,
627
+ CreateOrUpdateContactInputSchema,
628
+ GetContactInputSchema,
629
+ ContactSchema,
630
+ ConnectorID,
631
+ ProviderID,
632
+ CreateContactBranch,
633
+ CreateContactBranchCreated,
634
+ CreateContactBranchProviderRejected,
635
+ CreateContactBranchDefect,
636
+ CreateContactBranchUncertain,
637
+ CreateContactDefinition,
638
+ CreateContactMetadata,
639
+ ListContactsBranch,
640
+ ListContactsBranchListed,
641
+ ListContactsBranchProviderRejected,
642
+ ListContactsBranchInvalidResponse,
643
+ ListContactsBranchDefect,
644
+ ListContactsDefinition,
645
+ ListContactsMetadata,
646
+ UpdateContactBranch,
647
+ UpdateContactBranchUpdated,
648
+ UpdateContactBranchNotFound,
649
+ UpdateContactBranchProviderRejected,
650
+ UpdateContactBranchDefect,
651
+ UpdateContactDefinition,
652
+ UpdateContactMetadata,
653
+ DeleteContactBranch,
654
+ DeleteContactBranchDeleted,
655
+ DeleteContactBranchNotFound,
656
+ DeleteContactBranchProviderRejected,
657
+ DeleteContactBranchDefect,
658
+ DeleteContactDefinition,
659
+ DeleteContactMetadata,
660
+ ListAttributesBranch,
661
+ ListAttributesBranchListed,
662
+ ListAttributesBranchProviderRejected,
663
+ ListAttributesBranchInvalidResponse,
664
+ ListAttributesBranchDefect,
665
+ ListAttributesDefinition,
666
+ ListAttributesMetadata,
667
+ CreateAttributeBranch,
668
+ CreateAttributeBranchCreated,
669
+ CreateAttributeBranchProviderRejected,
670
+ CreateAttributeBranchDefect,
671
+ CreateAttributeBranchUncertain,
672
+ CreateAttributeDefinition,
673
+ CreateAttributeMetadata,
674
+ UpdateAttributeBranch,
675
+ UpdateAttributeBranchUpdated,
676
+ UpdateAttributeBranchNotFound,
677
+ UpdateAttributeBranchProviderRejected,
678
+ UpdateAttributeBranchDefect,
679
+ UpdateAttributeDefinition,
680
+ UpdateAttributeMetadata,
681
+ DeleteAttributeBranch,
682
+ DeleteAttributeBranchDeleted,
683
+ DeleteAttributeBranchNotFound,
684
+ DeleteAttributeBranchProviderRejected,
685
+ DeleteAttributeBranchDefect,
686
+ DeleteAttributeDefinition,
687
+ DeleteAttributeMetadata,
688
+ ListSendersBranch,
689
+ ListSendersBranchListed,
690
+ ListSendersBranchProviderRejected,
691
+ ListSendersBranchInvalidResponse,
692
+ ListSendersBranchDefect,
693
+ ListSendersDefinition,
694
+ ListSendersMetadata,
695
+ CreateSenderBranch,
696
+ CreateSenderBranchCreated,
697
+ CreateSenderBranchProviderRejected,
698
+ CreateSenderBranchDefect,
699
+ CreateSenderBranchUncertain,
700
+ CreateSenderDefinition,
701
+ CreateSenderMetadata,
702
+ UpdateSenderBranch,
703
+ UpdateSenderBranchUpdated,
704
+ UpdateSenderBranchNotFound,
705
+ UpdateSenderBranchProviderRejected,
706
+ UpdateSenderBranchDefect,
707
+ UpdateSenderDefinition,
708
+ UpdateSenderMetadata,
709
+ DeleteSenderBranch,
710
+ DeleteSenderBranchDeleted,
711
+ DeleteSenderBranchNotFound,
712
+ DeleteSenderBranchProviderRejected,
713
+ DeleteSenderBranchDefect,
714
+ DeleteSenderDefinition,
715
+ DeleteSenderMetadata,
716
+ SendEmailBranch,
717
+ SendEmailBranchSent,
718
+ SendEmailBranchProviderRejected,
719
+ SendEmailBranchDefect,
720
+ SendEmailBranchUncertain,
721
+ SendEmailDefinition,
722
+ SendEmailMetadata,
723
+ SendTemplateEmailBranch,
724
+ SendTemplateEmailBranchSent,
725
+ SendTemplateEmailBranchProviderRejected,
726
+ SendTemplateEmailBranchDefect,
727
+ SendTemplateEmailBranchUncertain,
728
+ SendTemplateEmailDefinition,
729
+ SendTemplateEmailMetadata,
730
+ CreateOrUpdateContactBranch,
731
+ CreateOrUpdateContactBranchSaved,
732
+ CreateOrUpdateContactBranchProviderRejected,
733
+ CreateOrUpdateContactBranchInvalidResponse,
734
+ CreateOrUpdateContactBranchDefect,
735
+ CreateOrUpdateContactDefinition,
736
+ CreateOrUpdateContactMetadata,
737
+ GetContactBranch,
738
+ GetContactBranchFound,
739
+ GetContactBranchNotFound,
740
+ GetContactBranchProviderRejected,
741
+ GetContactBranchInvalidResponse,
742
+ GetContactBranchDefect,
743
+ GetContactDefinition,
744
+ GetContactMetadata,
745
+ Connection,
746
+ newConnection,
747
+ newConnectionWithOperations,
748
+ newProjectConnection
749
+ };