@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdurable/connector-brevo",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Brevo contact operations for Dex Flows",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,8 @@
25
25
  "./mock": {
26
26
  "types": "./dist/mock.d.ts",
27
27
  "import": "./dist/mock.js"
28
- }
28
+ },
29
+ "./dex-connector.json": "./dex-connector.json"
29
30
  },
30
31
  "files": [
31
32
  "dist",
@@ -43,7 +44,7 @@
43
44
  "example:sync:start": "npm run build && tsx examples/contact-sync/start.ts"
44
45
  },
45
46
  "dependencies": {
46
- "@superdurable/connectors-sdk": "0.1.1",
47
+ "@superdurable/connectors-sdk": "0.13.0",
47
48
  "@superdurable/dex": ">=1.28.0",
48
49
  "email-addresses": "5.0.0",
49
50
  "zod": "^4.1.0"
@@ -1,131 +0,0 @@
1
- // src/generated/models.ts
2
- import { z } from "zod";
3
- var ConfigSchema = z.object({
4
- "baseUrl": z.string().optional(),
5
- "timeoutMs": z.number().int().optional(),
6
- "maxResponseBytes": z.number().int().optional()
7
- });
8
- var CreateOrUpdateContactInputSchema = z.strictObject({
9
- "email": z.string(),
10
- "attributes": z.record(z.string(), z.string()).optional()
11
- });
12
- var ContactWriteResultSchema = z.strictObject({
13
- "id": z.number().int().optional(),
14
- "email": z.string(),
15
- "created": z.boolean()
16
- });
17
- var GetContactInputSchema = z.strictObject({
18
- "email": z.string()
19
- });
20
- var ContactSchema = z.strictObject({
21
- "id": z.number().int(),
22
- "email": z.string()
23
- });
24
-
25
- // src/generated/definitions.ts
26
- var ConnectorID = "brevo";
27
- var ProviderID = "brevo";
28
- var CreateOrUpdateContactBranch = {
29
- Saved: "saved",
30
- ProviderRejected: "providerRejected",
31
- InvalidResponse: "invalidResponse",
32
- Defect: "defect"
33
- };
34
- var CreateOrUpdateContactBranchSaved = CreateOrUpdateContactBranch.Saved;
35
- var CreateOrUpdateContactBranchProviderRejected = CreateOrUpdateContactBranch.ProviderRejected;
36
- var CreateOrUpdateContactBranchInvalidResponse = CreateOrUpdateContactBranch.InvalidResponse;
37
- var CreateOrUpdateContactBranchDefect = CreateOrUpdateContactBranch.Defect;
38
- var CreateOrUpdateContactDefinition = {
39
- operation: { connectorId: ConnectorID, operationId: "createOrUpdateContact" },
40
- branches: [
41
- { id: "saved", description: "Brevo created or updated the contact." },
42
- { id: "providerRejected", description: "Brevo rejected the contact or credentials.", optional: true },
43
- { id: "invalidResponse", description: "Brevo returned malformed or oversized data.", optional: true },
44
- { id: "defect", description: "Local input or credentials are invalid.", optional: true }
45
- ],
46
- stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
47
- };
48
- var CreateOrUpdateContactMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
49
- var GetContactBranch = {
50
- Found: "found",
51
- NotFound: "notFound",
52
- ProviderRejected: "providerRejected",
53
- InvalidResponse: "invalidResponse",
54
- Defect: "defect"
55
- };
56
- var GetContactBranchFound = GetContactBranch.Found;
57
- var GetContactBranchNotFound = GetContactBranch.NotFound;
58
- var GetContactBranchProviderRejected = GetContactBranch.ProviderRejected;
59
- var GetContactBranchInvalidResponse = GetContactBranch.InvalidResponse;
60
- var GetContactBranchDefect = GetContactBranch.Defect;
61
- var GetContactDefinition = {
62
- operation: { connectorId: ConnectorID, operationId: "getContact" },
63
- branches: [
64
- { id: "found", description: "Brevo returned the contact." },
65
- { id: "notFound", description: "No contact has that email.", optional: true },
66
- { id: "providerRejected", description: "Brevo rejected the request or credentials.", optional: true },
67
- { id: "invalidResponse", description: "Brevo returned malformed or oversized data.", optional: true },
68
- { id: "defect", description: "Local input or credentials are invalid.", optional: true }
69
- ],
70
- stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
71
- };
72
- var GetContactMetadata = { kind: "query", idempotency: "none", authorization: "required" };
73
-
74
- // src/generated/connection.ts
75
- import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
76
- var Connection = class {
77
- /** Stable provider and connection name. */
78
- reference;
79
- /** Bound provider operations. */
80
- operations;
81
- /** Validate a reference and bind operations. */
82
- constructor(reference, operations) {
83
- this.reference = ConnectionRefSchema.parse(reference);
84
- if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
85
- if (!operations) throw new TypeError("connector operations are required");
86
- this.operations = operations;
87
- }
88
- };
89
- function newConnection(client, reference) {
90
- if (!client) throw new TypeError("connector client is required");
91
- return new Connection(reference, client);
92
- }
93
- function newConnectionWithOperations(operations, reference) {
94
- return new Connection(reference, operations);
95
- }
96
- function newProjectConnection(project, connectionName, createClient) {
97
- if (!project) throw new TypeError("loaded project is required");
98
- const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
99
- const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
100
- if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
101
- return newConnection(createClient(project, connectionName), reference);
102
- }
103
-
104
- export {
105
- ConfigSchema,
106
- CreateOrUpdateContactInputSchema,
107
- ContactWriteResultSchema,
108
- GetContactInputSchema,
109
- ContactSchema,
110
- ConnectorID,
111
- ProviderID,
112
- CreateOrUpdateContactBranch,
113
- CreateOrUpdateContactBranchSaved,
114
- CreateOrUpdateContactBranchProviderRejected,
115
- CreateOrUpdateContactBranchInvalidResponse,
116
- CreateOrUpdateContactBranchDefect,
117
- CreateOrUpdateContactDefinition,
118
- CreateOrUpdateContactMetadata,
119
- GetContactBranch,
120
- GetContactBranchFound,
121
- GetContactBranchNotFound,
122
- GetContactBranchProviderRejected,
123
- GetContactBranchInvalidResponse,
124
- GetContactBranchDefect,
125
- GetContactDefinition,
126
- GetContactMetadata,
127
- Connection,
128
- newConnection,
129
- newConnectionWithOperations,
130
- newProjectConnection
131
- };
@@ -1,98 +0,0 @@
1
- import { SecretString, CredentialProvider, Mutation, Query, ConnectionRef } from '@superdurable/connectors-sdk';
2
- import { z } from 'zod';
3
-
4
- /** Connector configuration; omitted fields use manifest defaults. */
5
- interface Config {
6
- /** Brevo v3 API base URL; leave blank for the public endpoint, or enter a compatible HTTPS gateway URL for a custom deployment. */
7
- baseUrl?: string;
8
- /** Positive Go duration limiting each HTTP request; leave blank for the displayed default, or override for a slower network. Runtime value in milliseconds. */
9
- timeoutMs?: number;
10
- /** Maximum response bytes as a positive integer; leave blank for the displayed safety limit, or raise it for larger contact responses. */
11
- maxResponseBytes?: number;
12
- }
13
- /** Runtime schema for manifest configuration. */
14
- declare const ConfigSchema: z.ZodObject<{
15
- baseUrl: z.ZodOptional<z.ZodString>;
16
- timeoutMs: z.ZodOptional<z.ZodNumber>;
17
- maxResponseBytes: z.ZodOptional<z.ZodNumber>;
18
- }, z.core.$strip>;
19
- /** Private connector credentials resolved by the host. */
20
- interface Credentials {
21
- /** Secret Brevo API key from https://app.brevo.com/settings/keys/api after Settings > SMTP & API > API keys > Generate a new API key; copy the displayed string once. Blank prevents requests. */
22
- apiKey: SecretString;
23
- }
24
- /** Host-owned source of private connector credentials. */
25
- type CredentialSource = CredentialProvider<Credentials>;
26
- /** CreateOrUpdateContactInput supplies an email and absolute attribute values. */
27
- interface CreateOrUpdateContactInput {
28
- /** Email identifies the contact and must be a plain email address. */
29
- "email": string;
30
- /** Attributes sets existing Brevo contact attributes by their uppercase names. */
31
- "attributes"?: {
32
- [key: string]: string;
33
- } | undefined;
34
- }
35
- /** ContactWriteResult confirms a contact create or update without exposing provider data. */
36
- interface ContactWriteResult {
37
- /** ID is available when Brevo created the contact. */
38
- "id"?: number | undefined;
39
- /** Email is the submitted contact email. */
40
- "email": string;
41
- /** Created distinguishes a 201 create from a 204 update. */
42
- "created": boolean;
43
- }
44
- /** GetContactInput identifies a contact by email. */
45
- interface GetContactInput {
46
- /** Email is a plain email address. */
47
- "email": string;
48
- }
49
- /** Contact contains the minimal non-secret contact identity returned by Brevo. */
50
- interface Contact {
51
- /** ID is Brevo's contact identifier. */
52
- "id": number;
53
- /** Email is the contact email. */
54
- "email": string;
55
- }
56
- /** Runtime validator for CreateOrUpdateContactInput. */
57
- declare const CreateOrUpdateContactInputSchema: z.ZodObject<{
58
- email: z.ZodString;
59
- attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
60
- }, z.core.$strict>;
61
- /** Runtime validator for ContactWriteResult. */
62
- declare const ContactWriteResultSchema: z.ZodObject<{
63
- id: z.ZodOptional<z.ZodNumber>;
64
- email: z.ZodString;
65
- created: z.ZodBoolean;
66
- }, z.core.$strict>;
67
- /** Runtime validator for GetContactInput. */
68
- declare const GetContactInputSchema: z.ZodObject<{
69
- email: z.ZodString;
70
- }, z.core.$strict>;
71
- /** Runtime validator for Contact. */
72
- declare const ContactSchema: z.ZodObject<{
73
- id: z.ZodNumber;
74
- email: z.ZodString;
75
- }, z.core.$strict>;
76
-
77
- /** Typed operations supplied by a client or mock. */
78
- interface Operations {
79
- /** Invoke createOrUpdateContact through this connection. */
80
- createOrUpdateContact(): Mutation<CreateOrUpdateContactInput, ContactWriteResult>;
81
- /** Invoke getContact through this connection. */
82
- getContact(): Query<GetContactInput, Contact>;
83
- }
84
- /** Named connector connection kept outside Flow state. */
85
- declare class Connection<BoundOperations = Operations> {
86
- /** Stable provider and connection name. */
87
- readonly reference: ConnectionRef;
88
- /** Bound provider operations. */
89
- readonly operations: BoundOperations;
90
- /** Validate a reference and bind operations. */
91
- constructor(reference: ConnectionRef, operations: BoundOperations);
92
- }
93
- /** Bind a client to a named connection. */
94
- declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
95
- /** Bind scripted operations to a named connection. */
96
- declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
97
-
98
- export { type CreateOrUpdateContactInput as C, type GetContactInput as G, type Operations as O, type ContactWriteResult as a, Connection as b, type Contact as c, type Config as d, type Credentials as e, ConfigSchema as f, ContactSchema as g, ContactWriteResultSchema as h, CreateOrUpdateContactInputSchema as i, type CredentialSource as j, GetContactInputSchema as k, newConnectionWithOperations as l, newConnection as n };