@superdurable/connector-intuit-mailchimp 0.1.0 → 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/README.md CHANGED
@@ -1,11 +1,23 @@
1
1
  # Mailchimp TypeScript connector
2
2
 
3
- `@superdurable/connector-intuit-mailchimp` provides typed Dex operations for reading and listing audience contacts, upserting contacts, updating tags, and sending a reviewed campaign.
3
+ `@superdurable/connector-intuit-mailchimp` provides typed Dex operations for reading and listing audience contacts, upserting contacts, updating tags, and sending a reviewed campaign, and the `memberChanged` poll Trigger. It requires `@superdurable/connectors-sdk` 0.12.0, the release of the poll Trigger kit.
4
4
 
5
- Install with `npm install @superdurable/connector-intuit-mailchimp@0.1.0`. Configure a Mailchimp API key in Dex Web as described in the [connector README](../README.md#mailchimp-setup). The package derives the data center from the key suffix and never puts the key in Flow input or output.
5
+ Install with `npm install @superdurable/connector-intuit-mailchimp@0.2.0`. Configure a Mailchimp API key in Dex Web as described in the [connector README](../README.md#mailchimp-setup). The package derives the data center from the key suffix and never puts the key in Flow input or output.
6
6
 
7
7
  The runnable [get-member example](examples/get-member/README.md) shows the static connection name, Worker, and Flow. Its integration test uses a local Mailchimp stand-in and a real `dexcli dev` server. The Go-recorded [conformance scenarios](../../../../conformance/connectors/intuit/mailchimp/scenarios.json) cover all five operations, including retries and campaign send recovery.
8
8
 
9
9
  For `sendCampaign`, a Mailchimp throttle or a connection failure proven to occur before the send clears the dispatch checkpoint and retries. A send that might have reached Mailchimp keeps the checkpoint; a later attempt reads campaign status and reports `alreadySent` only when Mailchimp shows `sending` or `sent`, otherwise `uncertain`.
10
10
 
11
- Live Mailchimp provider authorization and behavior have not been verified for this TypeScript package.
11
+ ## memberChanged Trigger
12
+
13
+ `memberChanged` delivers each contact added to or changed in one audience, at behavior parity with the Go connector; the [connector README](../README.md#memberchanged-trigger) describes the baseline, lookback, paging, event IDs, status filter, rate limits, and cursor resets. The poll cursor token, the keyed snapshot entries, and the Trigger event IDs match Go byte for byte, so Go and TypeScript replicas share one cursor document and one Trigger inbox; `test/member_changed_go_parity.test.ts` replays a recording of the Go fetcher, including HTML-escaped and non-ASCII merge fields, numbers in exponent form, reordered tags, paging by time and by offset, and every failure class.
14
+
15
+ - `newProjectMemberTriggerRunner(project, connection, routes)` loads each binding's saved `audienceId` and `statuses` and records each change in the binding's project Trigger inbox before its cursor commits, as [`examples/member-changed/app.ts`](examples/member-changed/app.ts) does. A binding without a saved audience throws.
16
+ - `newMemberTriggerRunner(connection, routes)` takes routes with a configuration, a target, and an optional cursor store.
17
+ - `newMemberChangedTrigger(...)` keeps its cursor in memory, like Go's generated `NewMemberChangedTrigger`, so it records a new baseline on every start.
18
+
19
+ `newProjectConnection` reads the connection's `pollInterval` (at least 5 seconds); `MailchimpClient` takes it as `pollIntervalMs` and throws below `MinimumPollIntervalMs`. The runner sends one request at a time for every binding of a connection. A 429, or a 403 without an error document, is `markRateLimited` with `Retry-After`; a 400 for the poll query, an undecodable cursor, or a cursor for another audience is `markCursorInvalid`, which records a new baseline. `MemberChangedEventSchema` and `MemberChangedTriggerConfigurationSchema` are zod schemas with the Go JSON fields.
20
+
21
+ The [member-changed example](examples/member-changed/README.md) starts one `MailchimpMemberChangeTypeScript` Flow per change and reads the contact back with `newGetMemberStep`.
22
+
23
+ Live Mailchimp provider authorization and behavior have not been verified for this TypeScript package, nor have the Trigger's live assumptions: whether `since_last_changed` is exclusive at one-second resolution, how soon a change becomes listable, and whether Mailchimp ever sends `Retry-After`.
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "connectorId": "mailchimp",
3
- "releaseTag": "connectors/intuit/mailchimp/go/v0.23.0",
3
+ "releaseTag": "connectors/intuit/mailchimp/go/v0.24.0",
4
4
  "package": {
5
5
  "ecosystem": "npm",
6
6
  "name": "@superdurable/connector-intuit-mailchimp",
7
- "version": "0.1.0"
7
+ "version": "0.2.0"
8
8
  },
9
9
  "factories": [
10
10
  {
11
11
  "name": "newGetMemberStep",
12
12
  "kind": "query",
13
13
  "operationId": "getMember",
14
+ "inputType": "GetMemberInput",
15
+ "description": "Read one audience contact by email address, addressed by the MD5 hash of the lowercased address, with its status, merge fields, and up to 50 tags.",
14
16
  "fields": {
15
17
  "stepType": "stepType",
16
18
  "annotations": "annotations",
@@ -43,12 +45,33 @@
43
45
  "field": "defect",
44
46
  "optional": true
45
47
  }
46
- ]
48
+ ],
49
+ "inputSchema": {
50
+ "additionalProperties": false,
51
+ "description": "GetMemberInput identifies one audience contact.",
52
+ "properties": {
53
+ "emailAddress": {
54
+ "description": "EmailAddress is the contact's bare email address. The connector requests the MD5 hash of its lowercased form, so letter case does not matter.",
55
+ "type": "string"
56
+ },
57
+ "listId": {
58
+ "description": "ListID is the audience ID, Mailchimp's list_id, such as 57afe96172.",
59
+ "type": "string"
60
+ }
61
+ },
62
+ "required": [
63
+ "emailAddress",
64
+ "listId"
65
+ ],
66
+ "type": "object"
67
+ }
47
68
  },
48
69
  {
49
70
  "name": "newListMembersStep",
50
71
  "kind": "query",
51
72
  "operationId": "listMembers",
73
+ "inputType": "ListMembersInput",
74
+ "description": "List one bounded page of an audience's contacts, oldest change first, optionally only one status or contacts changed or opted in since a time, continuing at the returned offset.",
52
75
  "fields": {
53
76
  "stepType": "stepType",
54
77
  "annotations": "annotations",
@@ -81,12 +104,64 @@
81
104
  "field": "defect",
82
105
  "optional": true
83
106
  }
84
- ]
107
+ ],
108
+ "inputSchema": {
109
+ "additionalProperties": false,
110
+ "description": "ListMembersInput selects one page of an audience's contacts. Pages are ordered by last change, oldest first, and continue with Offset.",
111
+ "properties": {
112
+ "changedSince": {
113
+ "description": "ChangedSince keeps only contacts whose information changed after this time; nil applies no bound.",
114
+ "format": "date-time",
115
+ "type": [
116
+ "string",
117
+ "null"
118
+ ]
119
+ },
120
+ "listId": {
121
+ "description": "ListID is the audience ID, Mailchimp's list_id.",
122
+ "type": "string"
123
+ },
124
+ "offset": {
125
+ "description": "Offset is the number of matching contacts to skip; use the previous page's NextOffset.",
126
+ "type": "integer"
127
+ },
128
+ "optedInSince": {
129
+ "description": "OptedInSince keeps only contacts who opted in after this time; nil applies no bound.",
130
+ "format": "date-time",
131
+ "type": [
132
+ "string",
133
+ "null"
134
+ ]
135
+ },
136
+ "pageSize": {
137
+ "description": "PageSize is the number of contacts to read, 1 to 1000; zero reads 100.",
138
+ "type": "integer"
139
+ },
140
+ "status": {
141
+ "description": "Status keeps only contacts in one status, including cleaned or archived; empty lists every status.",
142
+ "enum": [
143
+ "archived",
144
+ "cleaned",
145
+ "pending",
146
+ "subscribed",
147
+ "transactional",
148
+ "unsubscribed"
149
+ ],
150
+ "type": "string"
151
+ }
152
+ },
153
+ "required": [
154
+ "listId"
155
+ ],
156
+ "type": "object"
157
+ }
85
158
  },
86
159
  {
87
160
  "name": "newUpsertMemberStep",
88
161
  "kind": "mutation",
89
162
  "operationId": "upsertMember",
163
+ "inputType": "UpsertMemberInput",
164
+ "description": "Add a contact or update an existing one with PUT, which Mailchimp keys by the contact's address, so a repeated attempt writes the same values. statusIfNew applies only to a new contact; changing an existing contact to subscribed or pending requires isResubscribeAllowed.",
90
165
  "fields": {
91
166
  "stepType": "stepType",
92
167
  "annotations": "annotations",
@@ -114,12 +189,99 @@
114
189
  "field": "defect",
115
190
  "optional": true
116
191
  }
117
- ]
192
+ ],
193
+ "inputSchema": {
194
+ "$defs": {
195
+ "MarketingPermissionInput": {
196
+ "additionalProperties": false,
197
+ "description": "MarketingPermissionInput is one GDPR marketing permission the contact opted in to or out of.",
198
+ "properties": {
199
+ "isEnabled": {
200
+ "description": "IsEnabled reports that the contact opted in.",
201
+ "type": "boolean"
202
+ },
203
+ "marketingPermissionId": {
204
+ "description": "MarketingPermissionID is the audience's marketing_permission_id, listed on a contact read with marketing permissions enabled.",
205
+ "type": "string"
206
+ }
207
+ },
208
+ "required": [
209
+ "isEnabled",
210
+ "marketingPermissionId"
211
+ ],
212
+ "type": "object"
213
+ }
214
+ },
215
+ "additionalProperties": false,
216
+ "description": "UpsertMemberInput adds a contact to an audience or updates the existing contact with the same address. Mailchimp applies StatusIfNew only when it creates the contact, and Status to an existing contact too, so an unsubscribed contact keeps its status unless Status says otherwise.",
217
+ "properties": {
218
+ "emailAddress": {
219
+ "description": "EmailAddress is the contact's bare email address; letter case does not change which contact is written.",
220
+ "type": "string"
221
+ },
222
+ "isResubscribeAllowed": {
223
+ "description": "IsResubscribeAllowed must be true when Status is subscribed or pending, because Mailchimp then resubscribes, or emails a confirmation to, a contact who unsubscribed or was cleaned. Set it only when the contact asked to subscribe again.",
224
+ "type": "boolean"
225
+ },
226
+ "listId": {
227
+ "description": "ListID is the audience ID, Mailchimp's list_id.",
228
+ "type": "string"
229
+ },
230
+ "marketingPermissions": {
231
+ "description": "MarketingPermissions records the contact's consent to the audience's GDPR marketing permissions.",
232
+ "items": {
233
+ "$ref": "#/$defs/MarketingPermissionInput"
234
+ },
235
+ "type": "array"
236
+ },
237
+ "mergeFields": {
238
+ "additionalProperties": {},
239
+ "description": "MergeFields maps merge tags such as FNAME to values: a string, a number, or an address object with addr1, city, state, and zip. Tags that are omitted keep their stored values.",
240
+ "type": "object"
241
+ },
242
+ "shouldSkipMergeValidation": {
243
+ "description": "ShouldSkipMergeValidation sends skip_merge_validation=true, so Mailchimp accepts the contact without the audience's required merge fields.",
244
+ "type": "boolean"
245
+ },
246
+ "status": {
247
+ "description": "Status, when set, also changes an existing contact's status: subscribed, pending, unsubscribed, or transactional. Empty keeps the existing contact's status. Unsubscribed records an opt-out.",
248
+ "enum": [
249
+ "archived",
250
+ "cleaned",
251
+ "pending",
252
+ "subscribed",
253
+ "transactional",
254
+ "unsubscribed"
255
+ ],
256
+ "type": "string"
257
+ },
258
+ "statusIfNew": {
259
+ "description": "StatusIfNew is the status of a contact Mailchimp creates: subscribed for a contact who gave permission, pending to send Mailchimp's confirmation email first, unsubscribed, or transactional. It is required and ignored for an existing contact.",
260
+ "enum": [
261
+ "archived",
262
+ "cleaned",
263
+ "pending",
264
+ "subscribed",
265
+ "transactional",
266
+ "unsubscribed"
267
+ ],
268
+ "type": "string"
269
+ }
270
+ },
271
+ "required": [
272
+ "emailAddress",
273
+ "listId",
274
+ "statusIfNew"
275
+ ],
276
+ "type": "object"
277
+ }
118
278
  },
119
279
  {
120
280
  "name": "newUpdateMemberTagsStep",
121
281
  "kind": "mutation",
122
282
  "operationId": "updateMemberTags",
283
+ "inputType": "UpdateMemberTagsInput",
284
+ "description": "Add and remove tags on one audience contact by declaring each tag active or inactive, so a repeated attempt leaves the same tags.",
123
285
  "fields": {
124
286
  "stepType": "stepType",
125
287
  "annotations": "annotations",
@@ -152,12 +314,51 @@
152
314
  "field": "defect",
153
315
  "optional": true
154
316
  }
155
- ]
317
+ ],
318
+ "inputSchema": {
319
+ "additionalProperties": false,
320
+ "description": "UpdateMemberTagsInput adds and removes tags on one existing audience contact.",
321
+ "properties": {
322
+ "addTags": {
323
+ "description": "AddTags are declared active. Mailchimp creates a tag that does not exist yet, and a tag the contact already has stays as it is.",
324
+ "items": {
325
+ "type": "string"
326
+ },
327
+ "type": "array"
328
+ },
329
+ "emailAddress": {
330
+ "description": "EmailAddress is the contact's bare email address.",
331
+ "type": "string"
332
+ },
333
+ "listId": {
334
+ "description": "ListID is the audience ID, Mailchimp's list_id.",
335
+ "type": "string"
336
+ },
337
+ "removeTags": {
338
+ "description": "RemoveTags are declared inactive; a tag the contact does not have is ignored.",
339
+ "items": {
340
+ "type": "string"
341
+ },
342
+ "type": "array"
343
+ },
344
+ "shouldSuppressAutomations": {
345
+ "description": "ShouldSuppressAutomations sends is_syncing=true, so Mailchimp does not start automations triggered by these tag changes.",
346
+ "type": "boolean"
347
+ }
348
+ },
349
+ "required": [
350
+ "emailAddress",
351
+ "listId"
352
+ ],
353
+ "type": "object"
354
+ }
156
355
  },
157
356
  {
158
357
  "name": "newSendCampaignStep",
159
358
  "kind": "mutation",
160
359
  "operationId": "sendCampaign",
360
+ "inputType": "SendCampaignInput",
361
+ "description": "Send one existing draft campaign now. The connector reads the campaign first and sends only a draft; a send is irreversible and Mailchimp has no idempotency key, so the Step runs with sync durability and sends at most once per Step execution.",
161
362
  "fields": {
162
363
  "stepType": "stepType",
163
364
  "annotations": "annotations",
@@ -205,7 +406,35 @@
205
406
  "field": "defect",
206
407
  "optional": true
207
408
  }
208
- ]
409
+ ],
410
+ "inputSchema": {
411
+ "additionalProperties": false,
412
+ "description": "SendCampaignInput identifies one existing campaign to send now. Create and review the campaign in Mailchimp first; the connector never edits campaign content or recipients.",
413
+ "properties": {
414
+ "campaignId": {
415
+ "description": "CampaignID is Mailchimp's campaign ID, such as 42694e9e57.",
416
+ "type": "string"
417
+ },
418
+ "expectedListId": {
419
+ "description": "ExpectedListID, when set, sends only when the campaign targets this audience; a campaign whose audience was changed after it was approved selects notSendable. Empty skips the check.",
420
+ "type": "string"
421
+ }
422
+ },
423
+ "required": [
424
+ "campaignId"
425
+ ],
426
+ "type": "object"
427
+ }
428
+ },
429
+ {
430
+ "name": "defineMemberChangedTriggerBinding",
431
+ "kind": "trigger",
432
+ "triggerName": "memberChanged",
433
+ "fields": {
434
+ "connectionName": "connectionName",
435
+ "bindingName": "bindingName",
436
+ "configurationUI": "configurationUI"
437
+ }
209
438
  }
210
439
  ]
211
440
  }
@@ -25,7 +25,8 @@ function canonicalGoTimeJSON(value) {
25
25
  }
26
26
  var GoTimeJSONSchema = z.string().refine(isGoTimeJSON, "invalid Go time.Time JSON timestamp").transform(canonicalGoTimeJSON);
27
27
  var ConfigSchema = z.object({
28
- "maxResponseBytes": z.number().int().optional()
28
+ "maxResponseBytes": z.number().int().optional(),
29
+ "pollIntervalMs": z.number().int().optional()
29
30
  });
30
31
  function decodeCredentials(value) {
31
32
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
@@ -193,7 +194,8 @@ var UpsertMemberDefinition = {
193
194
  { id: "invalidResponse", description: "Mailchimp returned an invalid or oversized contact, so the change may have been applied.", optional: true },
194
195
  { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
195
196
  ],
196
- stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
197
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
198
+ repeatOnUnknown: "safe"
197
199
  };
198
200
  var UpsertMemberMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
199
201
  var UpdateMemberTagsBranch = {
@@ -217,7 +219,8 @@ var UpdateMemberTagsDefinition = {
217
219
  { id: "invalidResponse", description: "Mailchimp accepted the request but returned an oversized or credential-reflecting body, so the tags may have changed.", optional: true },
218
220
  { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
219
221
  ],
220
- stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
222
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" },
223
+ repeatOnUnknown: "safe"
221
224
  };
222
225
  var UpdateMemberTagsMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
223
226
  var SendCampaignBranch = {
@@ -250,7 +253,9 @@ var SendCampaignDefinition = {
250
253
  { id: "uncertain", description: "The send request was sent but its outcome cannot be confirmed, so the campaign may be sending; the connector never sends it again.", optional: true },
251
254
  { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
252
255
  ],
253
- stepDefaults: { executeMethodTimeoutMs: 6e4, executeDurability: "sync" }
256
+ stepDefaults: { executeMethodTimeoutMs: 6e4, executeDurability: "sync" },
257
+ repeatOnUnknown: "limited",
258
+ maxSends: 3
254
259
  };
255
260
  var SendCampaignMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
256
261
 
@@ -5,10 +5,13 @@ import { z } from 'zod';
5
5
  interface Config {
6
6
  /** Maximum complete Mailchimp Marketing API response in bytes. Leave blank to keep the displayed safety limit; enter a positive integer only to change it, for example when listMembers reads pages of up to 1000 contacts with many merge fields. An oversized read selects invalidResponse, and an oversized campaign read before a send selects invalidResponse without sending. */
7
7
  maxResponseBytes?: number;
8
+ /** Delay between memberChanged Trigger polls of each watched audience, as a Go duration of at least 5s such as 45s or 2m. Leave it blank to keep the displayed interval; a shorter interval delivers contact changes sooner and uses more of the 10 simultaneous requests Mailchimp allows each user, a longer one suits large audiences. Runtime value in milliseconds. */
9
+ pollIntervalMs?: number;
8
10
  }
9
11
  /** Runtime schema for manifest configuration. */
10
12
  declare const ConfigSchema: z.ZodObject<{
11
13
  maxResponseBytes: z.ZodOptional<z.ZodNumber>;
14
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
12
15
  }, z.core.$strip>;
13
16
  /** Private connector credentials resolved by the host. */
14
17
  interface Credentials {
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { G as GetMemberInput, M as Member, C as Connection, L as ListMembersInput, a as ListMembersOutput, S as SendCampaignInput, b as SendCampaignOutput, U as UpdateMemberTagsInput, c as UpdateMemberTagsOutput, d as UpsertMemberInput, e as UpsertMemberOutput, O as Operations, f as Config, g as Credentials } from './connection-CR-ewlWK.js';
2
- export { h as Campaign, i as CampaignSchema, j as ConfigSchema, k as CredentialSource, l as GetMemberInputSchema, m as ListMembersOutputSchema, n as MarketingPermissionInput, o as MarketingPermissionInputSchema, p as MemberSchema, q as SendCampaignInputSchema, r as SendCampaignOutputSchema, s as UpdateMemberTagsInputSchema, t as UpdateMemberTagsOutputSchema, u as UpsertMemberInputSchema, v as UpsertMemberOutputSchema, w as decodeCredentials, x as newConnection, y as newConnectionWithOperations } from './connection-CR-ewlWK.js';
1
+ import { G as GetMemberInput, M as Member, C as Connection, L as ListMembersInput, a as ListMembersOutput, S as SendCampaignInput, b as SendCampaignOutput, U as UpdateMemberTagsInput, c as UpdateMemberTagsOutput, d as UpsertMemberInput, e as UpsertMemberOutput, f as Config, g as Credentials, O as Operations } from './connection-CNe_v9QS.js';
2
+ export { h as Campaign, i as CampaignSchema, j as ConfigSchema, k as CredentialSource, l as GetMemberInputSchema, m as ListMembersOutputSchema, n as MarketingPermissionInput, o as MarketingPermissionInputSchema, p as MemberSchema, q as SendCampaignInputSchema, r as SendCampaignOutputSchema, s as UpdateMemberTagsInputSchema, t as UpdateMemberTagsOutputSchema, u as UpsertMemberInputSchema, v as UpsertMemberOutputSchema, w as decodeCredentials, x as newConnection, y as newConnectionWithOperations } from './connection-CNe_v9QS.js';
3
3
  import { z } from 'zod';
4
4
  import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
5
- import { QueryDefinition, MutationDefinition, QueryStepConfig, Query, QueryResult, MutationStepConfig, Mutation, MutationResult, QueryStep, MutationStep, Call, QueryAttempt, MutationAttempt, CredentialProvider, Failure, ReceiptDraft } from '@superdurable/connectors-sdk';
5
+ import { QueryDefinition, MutationDefinition, QueryStepConfig, Query, QueryResult, MutationStepConfig, Mutation, MutationResult, QueryStep, MutationStep, Call, QueryAttempt, MutationAttempt, CredentialProvider, Failure, ReceiptDraft, ConnectorConfigurationUI, TriggerTarget, TriggerLogger, TriggerDefinition, TriggerBindingDefinition, TriggerRunner } from '@superdurable/connectors-sdk';
6
6
  import { StepTarget } from '@superdurable/dex';
7
7
  import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
8
8
  import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
9
+ import { CursorStore, Runner } from '@superdurable/connectors-sdk/pollingtrigger';
9
10
 
10
11
  /** Accept Go time.Parse's RFC 3339 forms; the operation validates the timestamp. */
11
12
  declare const ListMembersInputSchema: z.ZodObject<{
@@ -268,9 +269,6 @@ interface SendCampaignStepConfig<StepInput, OperationInput = SendCampaignInput,
268
269
  /** Build the sendCampaign Step from a named connection. */
269
270
  declare function newSendCampaignStep<StepInput, OperationInput = SendCampaignInput, OperationOutput = SendCampaignOutput>(configuration: SendCampaignStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
270
271
 
271
- /** Open one static Mailchimp connection declared in a Dex project. */
272
- declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
273
-
274
272
  /** Read one audience contact. */
275
273
  declare class GetMemberOperation implements Query<GetMemberInput, Member> {
276
274
  private readonly client;
@@ -291,7 +289,7 @@ declare class ListMembersOperation implements Query<ListMembersInput, ListMember
291
289
  declare class UpsertMemberOperation implements Mutation<UpsertMemberInput, UpsertMemberOutput> {
292
290
  private readonly client;
293
291
  /** Bind the client. */ constructor(client: MailchimpClient);
294
- /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
292
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
295
293
  /** Use the stable Call ID for receipt correlation. */ idempotencyKey(callId: string): string;
296
294
  /** Write one contact without changing an existing subscription unless requested. */
297
295
  invoke(call: Call, input: UpsertMemberInput): Promise<MutationAttempt<UpsertMemberOutput>>;
@@ -300,7 +298,7 @@ declare class UpsertMemberOperation implements Mutation<UpsertMemberInput, Upser
300
298
  declare class UpdateMemberTagsOperation implements Mutation<UpdateMemberTagsInput, UpdateMemberTagsOutput> {
301
299
  private readonly client;
302
300
  /** Bind the client. */ constructor(client: MailchimpClient);
303
- /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
301
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
304
302
  /** Use the stable Call ID for receipt correlation. */ idempotencyKey(callId: string): string;
305
303
  /** Declare tag states for one contact. */
306
304
  invoke(call: Call, input: UpdateMemberTagsInput): Promise<MutationAttempt<UpdateMemberTagsOutput>>;
@@ -309,7 +307,7 @@ declare class UpdateMemberTagsOperation implements Mutation<UpdateMemberTagsInpu
309
307
  declare class SendCampaignOperation implements Mutation<SendCampaignInput, SendCampaignOutput> {
310
308
  private readonly client;
311
309
  /** Bind the client. */ constructor(client: MailchimpClient);
312
- /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
310
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
313
311
  /** Use the stable Call ID for receipt correlation. */ idempotencyKey(callId: string): string;
314
312
  /** Read status, checkpoint dispatch, and send only a draft. */
315
313
  invoke(call: Call, input: SendCampaignInput): Promise<MutationAttempt<SendCampaignOutput>>;
@@ -335,13 +333,22 @@ interface MailchimpExchange {
335
333
  failure?: Failure;
336
334
  retryAfterMs: number;
337
335
  }
338
- /** Authenticated Mailchimp Marketing API client. */
336
+ /** Keeps a memberChanged poll loop from occupying Mailchimp's per-user request slots. */
337
+ declare const MinimumPollIntervalMs = 5000;
338
+ /**
339
+ * Authenticated Mailchimp Marketing API client. pollIntervalMs is the memberChanged Trigger's delay between
340
+ * polls of each audience, from Config.pollIntervalMs (omitted or zero uses 30 seconds); the constructor
341
+ * throws for an interval under 5 seconds, as Go's New does.
342
+ */
339
343
  declare class MailchimpClient {
344
+ /** The memberChanged Trigger's delay between polls, in milliseconds. */
345
+ readonly pollIntervalMs: number;
346
+ /** Receipt and Retry-After clock. */
347
+ readonly now: () => Date;
340
348
  private readonly maxResponseBytes;
341
349
  private readonly credentials;
342
350
  private readonly apiBaseURL;
343
351
  private readonly send;
344
- private readonly now;
345
352
  /** Validate configuration and retain immutable dependencies. */
346
353
  constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: MailchimpClientOptions);
347
354
  /** Bind the contact read. */
@@ -368,4 +375,131 @@ declare class MailchimpClient {
368
375
  receipt(call: Call, exchange: MailchimpExchange, objectID: string): ReceiptDraft;
369
376
  }
370
377
 
371
- export { Config, Connection, ConnectorID, Credentials, GetMemberBranch, GetMemberBranchDefect, GetMemberBranchFound, GetMemberBranchInvalidResponse, GetMemberBranchNotFound, GetMemberBranchProviderRejected, GetMemberDefinition, GetMemberInput, GetMemberMetadata, GetMemberOperation, type GetMemberStepConfig, ListMembersBranch, ListMembersBranchDefect, ListMembersBranchInvalidResponse, ListMembersBranchListed, ListMembersBranchNotFound, ListMembersBranchProviderRejected, ListMembersDefinition, ListMembersInput, ListMembersInputSchema, ListMembersMetadata, ListMembersOperation, ListMembersOutput, type ListMembersStepConfig, MailchimpClient, type MailchimpClientOptions, type MailchimpRequestSender, Member, ProviderID, SendCampaignBranch, SendCampaignBranchAlreadySent, SendCampaignBranchDefect, SendCampaignBranchInvalidResponse, SendCampaignBranchNotFound, SendCampaignBranchNotSendable, SendCampaignBranchProviderRejected, SendCampaignBranchSent, SendCampaignBranchUncertain, SendCampaignDefinition, SendCampaignInput, SendCampaignMetadata, SendCampaignOperation, SendCampaignOutput, type SendCampaignStepConfig, UpdateMemberTagsBranch, UpdateMemberTagsBranchDefect, UpdateMemberTagsBranchInvalidResponse, UpdateMemberTagsBranchNotFound, UpdateMemberTagsBranchProviderRejected, UpdateMemberTagsBranchUpdated, UpdateMemberTagsDefinition, UpdateMemberTagsInput, UpdateMemberTagsMetadata, UpdateMemberTagsOperation, UpdateMemberTagsOutput, type UpdateMemberTagsStepConfig, UpsertMemberBranch, UpsertMemberBranchDefect, UpsertMemberBranchInvalidResponse, UpsertMemberBranchProviderRejected, UpsertMemberBranchUpserted, UpsertMemberDefinition, UpsertMemberInput, UpsertMemberMetadata, UpsertMemberOperation, UpsertMemberOutput, type UpsertMemberStepConfig, newGetMemberStep, newListMembersStep, newProjectConnection, newSendCampaignStep, newUpdateMemberTagsStep, newUpsertMemberStep };
378
+ /**
379
+ * Open one static Mailchimp connection declared in a Dex project, with its maxResponseBytes and pollInterval.
380
+ * options replaces the transport, API base URL, or clock, for local stand-ins and tests.
381
+ */
382
+ declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: MailchimpClientOptions): Connection<Operations>;
383
+
384
+ /** Every status the memberStatusPicker offers, in its display order. */
385
+ declare const MemberStatuses: readonly ["subscribed", "unsubscribed", "cleaned", "pending", "transactional", "archived"];
386
+ /**
387
+ * The memberChanged binding configuration that the audienceIdEntry and memberStatusPicker units save in Dex
388
+ * Web. Changing the audience of a binding that already polled makes its next poll record a new baseline.
389
+ */
390
+ declare const MemberChangedTriggerConfigurationSchema: z.ZodObject<{
391
+ audienceId: z.ZodString;
392
+ statuses: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
393
+ }, z.core.$strict>;
394
+ /** The memberChanged binding configuration. */
395
+ type MemberChangedTriggerConfiguration = z.infer<typeof MemberChangedTriggerConfigurationSchema>;
396
+ /**
397
+ * One contact added to or changed in the watched audience; field names match the Go connector, so Go and
398
+ * TypeScript replicas share a binding's inbox. Mailchimp reports no change type, so a new contact and an
399
+ * edited one look alike; member.signedUpAt, member.optedInAt, and member.status tell them apart. A contact
400
+ * that changed several times between two polls is delivered once, in its latest state.
401
+ */
402
+ declare const MemberChangedEventSchema: z.ZodObject<{
403
+ audienceId: z.ZodString;
404
+ member: z.ZodObject<{
405
+ subscriberHash: z.ZodString;
406
+ emailAddress: z.ZodString;
407
+ contactId: z.ZodOptional<z.ZodString>;
408
+ fullName: z.ZodOptional<z.ZodString>;
409
+ status: z.ZodString;
410
+ emailType: z.ZodOptional<z.ZodString>;
411
+ mergeFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodUnknown>>>;
412
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
413
+ tagCount: z.ZodNumber;
414
+ isVip: z.ZodOptional<z.ZodBoolean>;
415
+ language: z.ZodOptional<z.ZodString>;
416
+ listId: z.ZodString;
417
+ webId: z.ZodOptional<z.ZodNumber>;
418
+ signedUpAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
419
+ optedInAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
420
+ lastChangedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
421
+ }, z.core.$strict>;
422
+ }, z.core.$strip>;
423
+ /** One memberChanged delivery. */
424
+ type MemberChangedEvent = z.infer<typeof MemberChangedEventSchema>;
425
+
426
+ /** Manifest definition of memberChanged. */
427
+ declare const MemberChangedTriggerDefinition: TriggerDefinition;
428
+ /** Unit ID of the audience ID entry in the connector's UI bundle. */
429
+ declare const UIUnitAudienceIDEntry = "audienceIdEntry";
430
+ /** Port of the audienceIdEntry unit that saves the audience ID. */
431
+ declare const UIAudienceIDEntryPortAudienceID = "audienceId";
432
+ /** Unit ID of the contact status picker in the connector's UI bundle. */
433
+ declare const UIUnitMemberStatusPicker = "memberStatusPicker";
434
+ /** Port of the memberStatusPicker unit that saves the selected statuses. */
435
+ declare const UIMemberStatusPickerPortStatuses = "statuses";
436
+ /** One static application binding of memberChanged. */
437
+ interface MemberChangedTriggerBindingConfig {
438
+ /** Static connection name. */ connectionName: string;
439
+ /** Static binding name. */ bindingName: string;
440
+ /** Connector Studio units that save the binding's audienceId and statuses, such as audienceIdEntry and memberStatusPicker. */ configurationUI?: ConnectorConfigurationUI;
441
+ }
442
+ /** Declare a static memberChanged binding for Flow Definition tooling and Dex Web. */
443
+ declare function defineMemberChangedTriggerBinding(config: MemberChangedTriggerBindingConfig): TriggerBindingDefinition;
444
+ /** Binds one memberChanged configuration to its application target and cursor. */
445
+ interface MemberChangedTriggerRoute {
446
+ /** The stable application binding name, unique within the runner. */ bindingName: string;
447
+ /** Selects the watched audience, which is required, and the delivered statuses. */ configuration: MemberChangedTriggerConfiguration;
448
+ /**
449
+ * Routes each change into the application. A target from newDurableTriggerTarget records each change before
450
+ * the cursor commits past it; any other target consumes it first.
451
+ */
452
+ target: TriggerTarget<MemberChangedEvent>;
453
+ /**
454
+ * Stores the binding's position, such as LoadedProject.pollCursorStore. Omitted keeps it in memory, so every
455
+ * process start records a new baseline and changes made while stopped are lost.
456
+ */
457
+ cursor?: CursorStore;
458
+ }
459
+ /** Options of the memberChanged runners. */
460
+ interface MemberTriggerRunnerOptions {
461
+ /** Receives seed, reseed, poll failure, rate-limit, and inbox records, never contact data or credentials; omitted uses defaultTriggerLogger. */ logger?: TriggerLogger;
462
+ }
463
+ /**
464
+ * Create one poll Runner for the connection's memberChanged bindings. Run replays each durable target,
465
+ * records a baseline for a binding without a cursor, then polls every binding each pollInterval with jitter,
466
+ * one request at a time, so the runner holds at most one of the 10 simultaneous requests Mailchimp allows
467
+ * each user. A 429, or a 403 without an error document, pauses every binding of the connection for
468
+ * Retry-After, or backs off exponentially without it; a 400 for the cursor's query records a new baseline
469
+ * and logs a WARN record; other failures back off per binding up to 15 minutes. Delivery is at least once,
470
+ * and each contact version keeps one Trigger event ID across refetches. Throws for a connection without a
471
+ * MailchimpClient, no routes, a blank or repeated binding name, a missing target, or an invalid configuration.
472
+ */
473
+ declare function newMemberTriggerRunner(connection: Connection, routes: readonly MemberChangedTriggerRoute[], options?: MemberTriggerRunnerOptions): Runner;
474
+ /** Selects one memberChanged binding saved in the project configuration. */
475
+ interface ProjectMemberChangedTriggerRoute {
476
+ /** Names the saved binding. */ bindingName: string;
477
+ /** Routes each change into the application, usually newDexFlowTriggerTarget. */ target: TriggerTarget<MemberChangedEvent>;
478
+ }
479
+ /**
480
+ * Create a durable Runner for memberChanged bindings saved in the loaded project. connection is the one
481
+ * newProjectConnection opened from project. Each route loads its binding's saved audienceId and statuses and
482
+ * records changes in the binding's project Trigger inbox before its position commits in the binding's project
483
+ * poll cursor, so a restarted or replaced replica neither misses nor repeats a change. Inbox payloads use the
484
+ * Go connector's JSON fields, so Go and TypeScript replicas share them. Throws for a binding without a saved
485
+ * audience, an invalid saved configuration, and as newMemberTriggerRunner does.
486
+ */
487
+ declare function newProjectMemberTriggerRunner(project: LoadedProject, connection: Connection, routes: readonly ProjectMemberChangedTriggerRoute[], options?: MemberTriggerRunnerOptions): Runner;
488
+ /** Configuration of one in-memory memberChanged Trigger. */
489
+ interface MemberChangedTriggerConfig {
490
+ /** Mailchimp connection from newProjectConnection or newConnection with a MailchimpClient. */ connection: Connection;
491
+ /** Static binding name. */ bindingName: string;
492
+ /** Selects the watched audience, which is required, and the delivered statuses. */ configuration: MemberChangedTriggerConfiguration;
493
+ /** Routes accepted changes into the application. */ target: TriggerTarget<MemberChangedEvent>;
494
+ /** Receives the Trigger's records; omitted uses defaultTriggerLogger. */ logger?: TriggerLogger;
495
+ }
496
+ /**
497
+ * Create a single memberChanged TriggerRunner, as Go's generated NewMemberChangedTrigger does. It has no
498
+ * project storage, so it keeps the cursor in memory and records a new baseline on every start; changes made
499
+ * while stopped are lost. Use newProjectMemberTriggerRunner for durable delivery.
500
+ */
501
+ declare function newMemberChangedTrigger(config: MemberChangedTriggerConfig): TriggerRunner;
502
+ /** Decode a replayed inbox payload, written by a Go or TypeScript replica; throws for another payload. */
503
+ declare function decodeMemberChangedEventPayload(payloadJSON: string): MemberChangedEvent;
504
+
505
+ export { Config, Connection, ConnectorID, Credentials, GetMemberBranch, GetMemberBranchDefect, GetMemberBranchFound, GetMemberBranchInvalidResponse, GetMemberBranchNotFound, GetMemberBranchProviderRejected, GetMemberDefinition, GetMemberInput, GetMemberMetadata, GetMemberOperation, type GetMemberStepConfig, ListMembersBranch, ListMembersBranchDefect, ListMembersBranchInvalidResponse, ListMembersBranchListed, ListMembersBranchNotFound, ListMembersBranchProviderRejected, ListMembersDefinition, ListMembersInput, ListMembersInputSchema, ListMembersMetadata, ListMembersOperation, ListMembersOutput, type ListMembersStepConfig, MailchimpClient, type MailchimpClientOptions, type MailchimpRequestSender, Member, type MemberChangedEvent, MemberChangedEventSchema, type MemberChangedTriggerBindingConfig, type MemberChangedTriggerConfig, type MemberChangedTriggerConfiguration, MemberChangedTriggerConfigurationSchema, MemberChangedTriggerDefinition, type MemberChangedTriggerRoute, MemberStatuses, type MemberTriggerRunnerOptions, MinimumPollIntervalMs, type ProjectMemberChangedTriggerRoute, ProviderID, SendCampaignBranch, SendCampaignBranchAlreadySent, SendCampaignBranchDefect, SendCampaignBranchInvalidResponse, SendCampaignBranchNotFound, SendCampaignBranchNotSendable, SendCampaignBranchProviderRejected, SendCampaignBranchSent, SendCampaignBranchUncertain, SendCampaignDefinition, SendCampaignInput, SendCampaignMetadata, SendCampaignOperation, SendCampaignOutput, type SendCampaignStepConfig, UIAudienceIDEntryPortAudienceID, UIMemberStatusPickerPortStatuses, UIUnitAudienceIDEntry, UIUnitMemberStatusPicker, UpdateMemberTagsBranch, UpdateMemberTagsBranchDefect, UpdateMemberTagsBranchInvalidResponse, UpdateMemberTagsBranchNotFound, UpdateMemberTagsBranchProviderRejected, UpdateMemberTagsBranchUpdated, UpdateMemberTagsDefinition, UpdateMemberTagsInput, UpdateMemberTagsMetadata, UpdateMemberTagsOperation, UpdateMemberTagsOutput, type UpdateMemberTagsStepConfig, UpsertMemberBranch, UpsertMemberBranchDefect, UpsertMemberBranchInvalidResponse, UpsertMemberBranchProviderRejected, UpsertMemberBranchUpserted, UpsertMemberDefinition, UpsertMemberInput, UpsertMemberMetadata, UpsertMemberOperation, UpsertMemberOutput, type UpsertMemberStepConfig, decodeMemberChangedEventPayload, defineMemberChangedTriggerBinding, newGetMemberStep, newListMembersStep, newMemberChangedTrigger, newMemberTriggerRunner, newProjectConnection, newProjectMemberTriggerRunner, newSendCampaignStep, newUpdateMemberTagsStep, newUpsertMemberStep };