@superdurable/connector-activecampaign 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,181 @@
1
1
  import {
2
+ AccountContactAssociationSchema,
3
+ AccountContactDeletionSchema,
4
+ AccountContactsPageSchema,
5
+ AccountDeletionSchema,
6
+ AccountMetadataSchema,
7
+ AccountsPageSchema,
8
+ ApplyTagToContactBranch,
9
+ ApplyTagToContactBranchApplied,
10
+ ApplyTagToContactBranchDefect,
11
+ ApplyTagToContactBranchInvalidResponse,
12
+ ApplyTagToContactBranchNotFound,
13
+ ApplyTagToContactBranchProviderRejected,
14
+ ApplyTagToContactDefinition,
15
+ ApplyTagToContactInputSchema,
16
+ ApplyTagToContactMetadata,
2
17
  ConfigSchema,
3
18
  Connection,
19
+ ConnectionDeletionSchema,
20
+ ConnectionMetadataSchema,
21
+ ConnectionsPageSchema,
4
22
  ConnectorID,
23
+ ContactListMembershipSchema,
24
+ ContactListMembershipsPageSchema,
5
25
  ContactMetadataSchema,
26
+ ContactTagAssociationSchema,
27
+ ContactTagAssociationsSchema,
28
+ ContactTagRemovalSchema,
6
29
  ContactsPageSchema,
30
+ CreateAccountBranch,
31
+ CreateAccountBranchCreated,
32
+ CreateAccountBranchDefect,
33
+ CreateAccountBranchProviderRejected,
34
+ CreateAccountBranchUncertain,
35
+ CreateAccountContactBranch,
36
+ CreateAccountContactBranchCreated,
37
+ CreateAccountContactBranchDefect,
38
+ CreateAccountContactBranchProviderRejected,
39
+ CreateAccountContactBranchUncertain,
40
+ CreateAccountContactDefinition,
41
+ CreateAccountContactInputSchema,
42
+ CreateAccountContactMetadata,
43
+ CreateAccountDefinition,
44
+ CreateAccountInputSchema,
45
+ CreateAccountMetadata,
46
+ CreateConnectionBranch,
47
+ CreateConnectionBranchCreated,
48
+ CreateConnectionBranchDefect,
49
+ CreateConnectionBranchProviderRejected,
50
+ CreateConnectionBranchUncertain,
51
+ CreateConnectionDefinition,
52
+ CreateConnectionInputSchema,
53
+ CreateConnectionMetadata,
54
+ CreateDealBranch,
55
+ CreateDealBranchCreated,
56
+ CreateDealBranchDefect,
57
+ CreateDealBranchInvalidResponse,
58
+ CreateDealBranchProviderRejected,
59
+ CreateDealBranchUncertain,
60
+ CreateDealDefinition,
61
+ CreateDealInputSchema,
62
+ CreateDealMetadata,
63
+ CreateDealNoteBranch,
64
+ CreateDealNoteBranchCreated,
65
+ CreateDealNoteBranchDefect,
66
+ CreateDealNoteBranchInvalidResponse,
67
+ CreateDealNoteBranchProviderRejected,
68
+ CreateDealNoteBranchUncertain,
69
+ CreateDealNoteDefinition,
70
+ CreateDealNoteInputSchema,
71
+ CreateDealNoteMetadata,
72
+ CreateEcommerceCustomerBranch,
73
+ CreateEcommerceCustomerBranchCreated,
74
+ CreateEcommerceCustomerBranchDefect,
75
+ CreateEcommerceCustomerBranchProviderRejected,
76
+ CreateEcommerceCustomerBranchUncertain,
77
+ CreateEcommerceCustomerDefinition,
78
+ CreateEcommerceCustomerInputSchema,
79
+ CreateEcommerceCustomerMetadata,
80
+ CreateTagBranch,
81
+ CreateTagBranchCreated,
82
+ CreateTagBranchDefect,
83
+ CreateTagBranchInvalidResponse,
84
+ CreateTagBranchProviderRejected,
85
+ CreateTagBranchUncertain,
86
+ CreateTagDefinition,
87
+ CreateTagInputSchema,
88
+ CreateTagMetadata,
89
+ CredentialMaterialError,
90
+ DealDeletionSchema,
91
+ DealMetadataSchema,
92
+ DealNoteMetadataSchema,
93
+ DealNotesPageSchema,
94
+ DealsPageSchema,
95
+ DeleteAccountBranch,
96
+ DeleteAccountBranchDefect,
97
+ DeleteAccountBranchDeleted,
98
+ DeleteAccountBranchInvalidResponse,
99
+ DeleteAccountBranchProviderRejected,
100
+ DeleteAccountContactBranch,
101
+ DeleteAccountContactBranchDefect,
102
+ DeleteAccountContactBranchDeleted,
103
+ DeleteAccountContactBranchInvalidResponse,
104
+ DeleteAccountContactBranchProviderRejected,
105
+ DeleteAccountContactDefinition,
106
+ DeleteAccountContactInputSchema,
107
+ DeleteAccountContactMetadata,
108
+ DeleteAccountDefinition,
109
+ DeleteAccountInputSchema,
110
+ DeleteAccountMetadata,
111
+ DeleteConnectionBranch,
112
+ DeleteConnectionBranchDefect,
113
+ DeleteConnectionBranchDeleted,
114
+ DeleteConnectionBranchInvalidResponse,
115
+ DeleteConnectionBranchProviderRejected,
116
+ DeleteConnectionDefinition,
117
+ DeleteConnectionInputSchema,
118
+ DeleteConnectionMetadata,
119
+ DeleteDealBranch,
120
+ DeleteDealBranchDefect,
121
+ DeleteDealBranchDeleted,
122
+ DeleteDealBranchInvalidResponse,
123
+ DeleteDealBranchProviderRejected,
124
+ DeleteDealDefinition,
125
+ DeleteDealInputSchema,
126
+ DeleteDealMetadata,
127
+ DeleteEcommerceCustomerBranch,
128
+ DeleteEcommerceCustomerBranchDefect,
129
+ DeleteEcommerceCustomerBranchDeleted,
130
+ DeleteEcommerceCustomerBranchInvalidResponse,
131
+ DeleteEcommerceCustomerBranchProviderRejected,
132
+ DeleteEcommerceCustomerDefinition,
133
+ DeleteEcommerceCustomerInputSchema,
134
+ DeleteEcommerceCustomerMetadata,
135
+ DeleteTagBranch,
136
+ DeleteTagBranchDefect,
137
+ DeleteTagBranchDeleted,
138
+ DeleteTagBranchInvalidResponse,
139
+ DeleteTagBranchProviderRejected,
140
+ DeleteTagDefinition,
141
+ DeleteTagInputSchema,
142
+ DeleteTagMetadata,
143
+ EcommerceCustomerDeletionSchema,
144
+ EcommerceCustomerMetadataSchema,
145
+ EcommerceCustomersPageSchema,
146
+ EcommerceOrderLineItemInputSchema,
147
+ EcommerceOrderMetadataSchema,
148
+ EcommerceOrderProductMetadataSchema,
149
+ EcommerceOrderProductsPageSchema,
150
+ EcommerceOrderUpsertMetadataSchema,
151
+ EcommerceOrdersPageSchema,
152
+ GetAccountBranch,
153
+ GetAccountBranchDefect,
154
+ GetAccountBranchFound,
155
+ GetAccountBranchInvalidResponse,
156
+ GetAccountBranchNotFound,
157
+ GetAccountBranchProviderRejected,
158
+ GetAccountContactBranch,
159
+ GetAccountContactBranchDefect,
160
+ GetAccountContactBranchFound,
161
+ GetAccountContactBranchInvalidResponse,
162
+ GetAccountContactBranchNotFound,
163
+ GetAccountContactBranchProviderRejected,
164
+ GetAccountContactDefinition,
165
+ GetAccountContactInputSchema,
166
+ GetAccountContactMetadata,
167
+ GetAccountDefinition,
168
+ GetAccountInputSchema,
169
+ GetAccountMetadata,
170
+ GetConnectionBranch,
171
+ GetConnectionBranchDefect,
172
+ GetConnectionBranchFound,
173
+ GetConnectionBranchInvalidResponse,
174
+ GetConnectionBranchNotFound,
175
+ GetConnectionBranchProviderRejected,
176
+ GetConnectionDefinition,
177
+ GetConnectionInputSchema,
178
+ GetConnectionMetadata,
7
179
  GetContactBranch,
8
180
  GetContactBranchDefect,
9
181
  GetContactBranchFound,
@@ -13,6 +185,110 @@ import {
13
185
  GetContactDefinition,
14
186
  GetContactInputSchema,
15
187
  GetContactMetadata,
188
+ GetDealBranch,
189
+ GetDealBranchDefect,
190
+ GetDealBranchFound,
191
+ GetDealBranchInvalidResponse,
192
+ GetDealBranchNotFound,
193
+ GetDealBranchProviderRejected,
194
+ GetDealDefinition,
195
+ GetDealInputSchema,
196
+ GetDealMetadata,
197
+ GetDealNoteBranch,
198
+ GetDealNoteBranchDefect,
199
+ GetDealNoteBranchFound,
200
+ GetDealNoteBranchInvalidResponse,
201
+ GetDealNoteBranchNotFound,
202
+ GetDealNoteBranchProviderRejected,
203
+ GetDealNoteDefinition,
204
+ GetDealNoteInputSchema,
205
+ GetDealNoteMetadata,
206
+ GetEcommerceCustomerBranch,
207
+ GetEcommerceCustomerBranchDefect,
208
+ GetEcommerceCustomerBranchFound,
209
+ GetEcommerceCustomerBranchInvalidResponse,
210
+ GetEcommerceCustomerBranchNotFound,
211
+ GetEcommerceCustomerBranchProviderRejected,
212
+ GetEcommerceCustomerDefinition,
213
+ GetEcommerceCustomerInputSchema,
214
+ GetEcommerceCustomerMetadata,
215
+ GetEcommerceOrderBranch,
216
+ GetEcommerceOrderBranchDefect,
217
+ GetEcommerceOrderBranchFound,
218
+ GetEcommerceOrderBranchInvalidResponse,
219
+ GetEcommerceOrderBranchNotFound,
220
+ GetEcommerceOrderBranchProviderRejected,
221
+ GetEcommerceOrderDefinition,
222
+ GetEcommerceOrderInputSchema,
223
+ GetEcommerceOrderMetadata,
224
+ GetEcommerceOrderProductBranch,
225
+ GetEcommerceOrderProductBranchDefect,
226
+ GetEcommerceOrderProductBranchFound,
227
+ GetEcommerceOrderProductBranchInvalidResponse,
228
+ GetEcommerceOrderProductBranchNotFound,
229
+ GetEcommerceOrderProductBranchProviderRejected,
230
+ GetEcommerceOrderProductDefinition,
231
+ GetEcommerceOrderProductInputSchema,
232
+ GetEcommerceOrderProductMetadata,
233
+ GetListBranch,
234
+ GetListBranchDefect,
235
+ GetListBranchFound,
236
+ GetListBranchInvalidResponse,
237
+ GetListBranchNotFound,
238
+ GetListBranchProviderRejected,
239
+ GetListDefinition,
240
+ GetListInputSchema,
241
+ GetListMetadata,
242
+ GetTagBranch,
243
+ GetTagBranchDefect,
244
+ GetTagBranchFound,
245
+ GetTagBranchInvalidResponse,
246
+ GetTagBranchNotFound,
247
+ GetTagBranchProviderRejected,
248
+ GetTagDefinition,
249
+ GetTagInputSchema,
250
+ GetTagMetadata,
251
+ ListAccountContactsBranch,
252
+ ListAccountContactsBranchDefect,
253
+ ListAccountContactsBranchInvalidResponse,
254
+ ListAccountContactsBranchListed,
255
+ ListAccountContactsBranchProviderRejected,
256
+ ListAccountContactsDefinition,
257
+ ListAccountContactsInputSchema,
258
+ ListAccountContactsMetadata,
259
+ ListAccountsBranch,
260
+ ListAccountsBranchDefect,
261
+ ListAccountsBranchInvalidResponse,
262
+ ListAccountsBranchListed,
263
+ ListAccountsBranchProviderRejected,
264
+ ListAccountsDefinition,
265
+ ListAccountsInputSchema,
266
+ ListAccountsMetadata,
267
+ ListConnectionsBranch,
268
+ ListConnectionsBranchDefect,
269
+ ListConnectionsBranchInvalidResponse,
270
+ ListConnectionsBranchListed,
271
+ ListConnectionsBranchProviderRejected,
272
+ ListConnectionsDefinition,
273
+ ListConnectionsInputSchema,
274
+ ListConnectionsMetadata,
275
+ ListContactListMembershipsBranch,
276
+ ListContactListMembershipsBranchDefect,
277
+ ListContactListMembershipsBranchInvalidResponse,
278
+ ListContactListMembershipsBranchListed,
279
+ ListContactListMembershipsBranchProviderRejected,
280
+ ListContactListMembershipsDefinition,
281
+ ListContactListMembershipsInputSchema,
282
+ ListContactListMembershipsMetadata,
283
+ ListContactTagsBranch,
284
+ ListContactTagsBranchDefect,
285
+ ListContactTagsBranchInvalidResponse,
286
+ ListContactTagsBranchListed,
287
+ ListContactTagsBranchNotFound,
288
+ ListContactTagsBranchProviderRejected,
289
+ ListContactTagsDefinition,
290
+ ListContactTagsInputSchema,
291
+ ListContactTagsMetadata,
16
292
  ListContactsBranch,
17
293
  ListContactsBranchDefect,
18
294
  ListContactsBranchInvalidResponse,
@@ -21,29 +297,221 @@ import {
21
297
  ListContactsDefinition,
22
298
  ListContactsInputSchema,
23
299
  ListContactsMetadata,
300
+ ListDealNotesBranch,
301
+ ListDealNotesBranchDefect,
302
+ ListDealNotesBranchInvalidResponse,
303
+ ListDealNotesBranchListed,
304
+ ListDealNotesBranchProviderRejected,
305
+ ListDealNotesDefinition,
306
+ ListDealNotesInputSchema,
307
+ ListDealNotesMetadata,
308
+ ListDealsBranch,
309
+ ListDealsBranchDefect,
310
+ ListDealsBranchInvalidResponse,
311
+ ListDealsBranchListed,
312
+ ListDealsBranchProviderRejected,
313
+ ListDealsDefinition,
314
+ ListDealsInputSchema,
315
+ ListDealsMetadata,
316
+ ListEcommerceCustomersBranch,
317
+ ListEcommerceCustomersBranchDefect,
318
+ ListEcommerceCustomersBranchInvalidResponse,
319
+ ListEcommerceCustomersBranchListed,
320
+ ListEcommerceCustomersBranchProviderRejected,
321
+ ListEcommerceCustomersDefinition,
322
+ ListEcommerceCustomersInputSchema,
323
+ ListEcommerceCustomersMetadata,
324
+ ListEcommerceOrderProductsBranch,
325
+ ListEcommerceOrderProductsBranchDefect,
326
+ ListEcommerceOrderProductsBranchInvalidResponse,
327
+ ListEcommerceOrderProductsBranchListed,
328
+ ListEcommerceOrderProductsBranchProviderRejected,
329
+ ListEcommerceOrderProductsDefinition,
330
+ ListEcommerceOrderProductsInputSchema,
331
+ ListEcommerceOrderProductsMetadata,
332
+ ListEcommerceOrdersBranch,
333
+ ListEcommerceOrdersBranchDefect,
334
+ ListEcommerceOrdersBranchInvalidResponse,
335
+ ListEcommerceOrdersBranchListed,
336
+ ListEcommerceOrdersBranchProviderRejected,
337
+ ListEcommerceOrdersDefinition,
338
+ ListEcommerceOrdersInputSchema,
339
+ ListEcommerceOrdersMetadata,
340
+ ListListsBranch,
341
+ ListListsBranchDefect,
342
+ ListListsBranchInvalidResponse,
343
+ ListListsBranchListed,
344
+ ListListsBranchProviderRejected,
345
+ ListListsDefinition,
346
+ ListListsInputSchema,
347
+ ListListsMetadata,
348
+ ListMetadataSchema,
349
+ ListProductsForEcommerceOrderBranch,
350
+ ListProductsForEcommerceOrderBranchDefect,
351
+ ListProductsForEcommerceOrderBranchInvalidResponse,
352
+ ListProductsForEcommerceOrderBranchListed,
353
+ ListProductsForEcommerceOrderBranchNotFound,
354
+ ListProductsForEcommerceOrderBranchProviderRejected,
355
+ ListProductsForEcommerceOrderDefinition,
356
+ ListProductsForEcommerceOrderInputSchema,
357
+ ListProductsForEcommerceOrderMetadata,
358
+ ListTagsBranch,
359
+ ListTagsBranchDefect,
360
+ ListTagsBranchInvalidResponse,
361
+ ListTagsBranchListed,
362
+ ListTagsBranchProviderRejected,
363
+ ListTagsDefinition,
364
+ ListTagsInputSchema,
365
+ ListTagsMetadata,
366
+ ListsPageSchema,
24
367
  ProviderID,
368
+ RemoveTagFromContactBranch,
369
+ RemoveTagFromContactBranchDefect,
370
+ RemoveTagFromContactBranchInvalidResponse,
371
+ RemoveTagFromContactBranchProviderRejected,
372
+ RemoveTagFromContactBranchRemoved,
373
+ RemoveTagFromContactDefinition,
374
+ RemoveTagFromContactInputSchema,
375
+ RemoveTagFromContactMetadata,
376
+ SetContactListMembershipInputSchema,
377
+ SubscribeContactToListBranch,
378
+ SubscribeContactToListBranchDefect,
379
+ SubscribeContactToListBranchProviderRejected,
380
+ SubscribeContactToListBranchSubscribed,
381
+ SubscribeContactToListBranchUncertain,
382
+ SubscribeContactToListDefinition,
383
+ SubscribeContactToListMetadata,
384
+ SyncContactBranch,
385
+ SyncContactBranchDefect,
386
+ SyncContactBranchInvalidResponse,
387
+ SyncContactBranchProviderRejected,
388
+ SyncContactBranchSynced,
389
+ SyncContactDefinition,
390
+ SyncContactInputSchema,
391
+ SyncContactMetadata,
392
+ TagDeletionSchema,
393
+ TagMetadataSchema,
394
+ TagsPageSchema,
395
+ UnsubscribeContactFromListBranch,
396
+ UnsubscribeContactFromListBranchDefect,
397
+ UnsubscribeContactFromListBranchProviderRejected,
398
+ UnsubscribeContactFromListBranchUncertain,
399
+ UnsubscribeContactFromListBranchUnsubscribed,
400
+ UnsubscribeContactFromListDefinition,
401
+ UnsubscribeContactFromListMetadata,
402
+ UpdateAccountBranch,
403
+ UpdateAccountBranchDefect,
404
+ UpdateAccountBranchInvalidResponse,
405
+ UpdateAccountBranchNotFound,
406
+ UpdateAccountBranchProviderRejected,
407
+ UpdateAccountBranchUpdated,
408
+ UpdateAccountContactBranch,
409
+ UpdateAccountContactBranchDefect,
410
+ UpdateAccountContactBranchInvalidResponse,
411
+ UpdateAccountContactBranchNotFound,
412
+ UpdateAccountContactBranchProviderRejected,
413
+ UpdateAccountContactBranchUpdated,
414
+ UpdateAccountContactDefinition,
415
+ UpdateAccountContactInputSchema,
416
+ UpdateAccountContactMetadata,
417
+ UpdateAccountDefinition,
418
+ UpdateAccountInputSchema,
419
+ UpdateAccountMetadata,
420
+ UpdateConnectionBranch,
421
+ UpdateConnectionBranchDefect,
422
+ UpdateConnectionBranchInvalidResponse,
423
+ UpdateConnectionBranchNotFound,
424
+ UpdateConnectionBranchProviderRejected,
425
+ UpdateConnectionBranchUpdated,
426
+ UpdateConnectionDefinition,
427
+ UpdateConnectionInputSchema,
428
+ UpdateConnectionMetadata,
429
+ UpdateContactBranch,
430
+ UpdateContactBranchDefect,
431
+ UpdateContactBranchInvalidResponse,
432
+ UpdateContactBranchNotFound,
433
+ UpdateContactBranchProviderRejected,
434
+ UpdateContactBranchUpdated,
435
+ UpdateContactDefinition,
436
+ UpdateContactInputSchema,
437
+ UpdateContactMetadata,
438
+ UpdateDealBranch,
439
+ UpdateDealBranchDefect,
440
+ UpdateDealBranchInvalidResponse,
441
+ UpdateDealBranchNotFound,
442
+ UpdateDealBranchProviderRejected,
443
+ UpdateDealBranchUpdated,
444
+ UpdateDealDefinition,
445
+ UpdateDealInputSchema,
446
+ UpdateDealMetadata,
447
+ UpdateDealNoteBranch,
448
+ UpdateDealNoteBranchDefect,
449
+ UpdateDealNoteBranchInvalidResponse,
450
+ UpdateDealNoteBranchNotFound,
451
+ UpdateDealNoteBranchProviderRejected,
452
+ UpdateDealNoteBranchUpdated,
453
+ UpdateDealNoteDefinition,
454
+ UpdateDealNoteInputSchema,
455
+ UpdateDealNoteMetadata,
456
+ UpdateEcommerceCustomerBranch,
457
+ UpdateEcommerceCustomerBranchDefect,
458
+ UpdateEcommerceCustomerBranchInvalidResponse,
459
+ UpdateEcommerceCustomerBranchNotFound,
460
+ UpdateEcommerceCustomerBranchProviderRejected,
461
+ UpdateEcommerceCustomerBranchUpdated,
462
+ UpdateEcommerceCustomerDefinition,
463
+ UpdateEcommerceCustomerInputSchema,
464
+ UpdateEcommerceCustomerMetadata,
465
+ UpdateTagBranch,
466
+ UpdateTagBranchDefect,
467
+ UpdateTagBranchInvalidResponse,
468
+ UpdateTagBranchNotFound,
469
+ UpdateTagBranchProviderRejected,
470
+ UpdateTagBranchUpdated,
471
+ UpdateTagDefinition,
472
+ UpdateTagInputSchema,
473
+ UpdateTagMetadata,
474
+ UpsertEcommerceOrderBranch,
475
+ UpsertEcommerceOrderBranchDefect,
476
+ UpsertEcommerceOrderBranchProviderRejected,
477
+ UpsertEcommerceOrderBranchUpserted,
478
+ UpsertEcommerceOrderDefinition,
479
+ UpsertEcommerceOrderInputSchema,
480
+ UpsertEcommerceOrderMetadata,
25
481
  decodeCredentials,
26
- newConnection,
27
- newConnectionWithOperations,
28
- newProjectConnection
29
- } from "./chunk-N3WLALRE.js";
482
+ decodeSignedInteger,
483
+ exactIntegerJSONCodec,
484
+ isCredentialMaterialError,
485
+ newProjectConnection,
486
+ parseExactIntegerJSON,
487
+ parseJSONNumberTokens
488
+ } from "./chunk-KJZQXWCV.js";
30
489
 
31
490
  // src/generated/steps.ts
32
- import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
33
- function newListContactsStep(configuration) {
491
+ import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
492
+ function newUpsertEcommerceOrderStep(configuration) {
493
+ const { connection, connectionName, upserted, providerRejected, defect, maxSends, ...stepConfiguration } = configuration;
494
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
495
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.upsertEcommerceOrder(), connection: connection.reference, branches: [
496
+ goToBranch("upserted", upserted),
497
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
498
+ ...defect ? [goToBranch("defect", defect)] : []
499
+ ] });
500
+ }
501
+ function newListEcommerceOrdersStep(configuration) {
34
502
  const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
35
503
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
36
- return newQueryStep({ ...stepConfiguration, operation: connection.operations.listContacts(), connection: connection.reference, branches: [
504
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listEcommerceOrders(), connection: connection.reference, branches: [
37
505
  goToBranch("listed", listed),
38
506
  ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
39
507
  ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
40
508
  ...defect ? [goToBranch("defect", defect)] : []
41
509
  ] });
42
510
  }
43
- function newGetContactStep(configuration) {
511
+ function newGetEcommerceOrderStep(configuration) {
44
512
  const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
45
513
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
46
- return newQueryStep({ ...stepConfiguration, operation: connection.operations.getContact(), connection: connection.reference, branches: [
514
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getEcommerceOrder(), connection: connection.reference, branches: [
47
515
  goToBranch("found", found),
48
516
  ...notFound ? [goToBranch("notFound", notFound)] : [],
49
517
  ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
@@ -51,168 +519,3197 @@ function newGetContactStep(configuration) {
51
519
  ...defect ? [goToBranch("defect", defect)] : []
52
520
  ] });
53
521
  }
54
-
55
- // src/project.ts
56
- import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
57
- import { z } from "zod";
58
-
59
- // src/client.ts
60
- import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
61
- import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
62
- var numericId = /^[0-9]{1,24}$/;
63
- var countString = /^\+?[0-9]+$/;
64
- var emptyContacts = () => ({ contacts: [], offset: 0, limit: 0, total: 0 });
65
- var emptyContact = () => ({ id: "", email: "", firstName: "", lastName: "" });
66
- var ActiveCampaignClient = class {
67
- /** Validate account configuration without contacting ActiveCampaign. */
68
- constructor(config, credentials, options = {}) {
69
- this.credentials = credentials;
70
- if (!credentials) throw new TypeError("ActiveCampaign credential source is required");
71
- this.baseUrl = validateBaseURL(config.baseUrl);
72
- this.timeoutMs = config.timeoutMs || 15e3;
73
- this.maxResponseBytes = config.maxResponseBytes || 1048576;
74
- if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0) throw new TypeError("ActiveCampaign timeout is invalid");
75
- if (!Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0) throw new TypeError("ActiveCampaign response limit is invalid");
76
- this.sendRequest = options.send ?? sendProviderRequest;
522
+ function newListEcommerceOrderProductsStep(configuration) {
523
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
524
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
525
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listEcommerceOrderProducts(), connection: connection.reference, branches: [
526
+ goToBranch("listed", listed),
527
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
528
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
529
+ ...defect ? [goToBranch("defect", defect)] : []
530
+ ] });
531
+ }
532
+ function newGetEcommerceOrderProductStep(configuration) {
533
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
534
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
535
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getEcommerceOrderProduct(), connection: connection.reference, branches: [
536
+ goToBranch("found", found),
537
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
538
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
539
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
540
+ ...defect ? [goToBranch("defect", defect)] : []
541
+ ] });
542
+ }
543
+ function newListProductsForEcommerceOrderStep(configuration) {
544
+ const { connection, connectionName, listed, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
545
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
546
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listProductsForEcommerceOrder(), connection: connection.reference, branches: [
547
+ goToBranch("listed", listed),
548
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
549
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
550
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
551
+ ...defect ? [goToBranch("defect", defect)] : []
552
+ ] });
553
+ }
554
+ function newListEcommerceCustomersStep(configuration) {
555
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
556
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
557
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listEcommerceCustomers(), connection: connection.reference, branches: [
558
+ goToBranch("listed", listed),
559
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
560
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
561
+ ...defect ? [goToBranch("defect", defect)] : []
562
+ ] });
563
+ }
564
+ function newGetEcommerceCustomerStep(configuration) {
565
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
566
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
567
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getEcommerceCustomer(), connection: connection.reference, branches: [
568
+ goToBranch("found", found),
569
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
570
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
571
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
572
+ ...defect ? [goToBranch("defect", defect)] : []
573
+ ] });
574
+ }
575
+ function newCreateEcommerceCustomerStep(configuration) {
576
+ const { connection, connectionName, created, uncertain, providerRejected, defect, ...stepConfiguration } = configuration;
577
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
578
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createEcommerceCustomer(), connection: connection.reference, branches: [
579
+ goToBranch("created", created),
580
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
581
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
582
+ ...defect ? [goToBranch("defect", defect)] : []
583
+ ] });
584
+ }
585
+ function newUpdateEcommerceCustomerStep(configuration) {
586
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
587
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
588
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateEcommerceCustomer(), connection: connection.reference, branches: [
589
+ goToBranch("updated", updated),
590
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
591
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
592
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
593
+ ...defect ? [goToBranch("defect", defect)] : []
594
+ ] });
595
+ }
596
+ function newDeleteEcommerceCustomerStep(configuration) {
597
+ const { connection, connectionName, deleted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
598
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
599
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteEcommerceCustomer(), connection: connection.reference, branches: [
600
+ goToBranch("deleted", deleted),
601
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
602
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
603
+ ...defect ? [goToBranch("defect", defect)] : []
604
+ ] });
605
+ }
606
+ function newListConnectionsStep(configuration) {
607
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
608
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
609
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listConnections(), connection: connection.reference, branches: [
610
+ goToBranch("listed", listed),
611
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
612
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
613
+ ...defect ? [goToBranch("defect", defect)] : []
614
+ ] });
615
+ }
616
+ function newGetConnectionStep(configuration) {
617
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
618
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
619
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getConnection(), connection: connection.reference, branches: [
620
+ goToBranch("found", found),
621
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
622
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
623
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
624
+ ...defect ? [goToBranch("defect", defect)] : []
625
+ ] });
626
+ }
627
+ function newCreateConnectionStep(configuration) {
628
+ const { connection, connectionName, created, uncertain, providerRejected, defect, ...stepConfiguration } = configuration;
629
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
630
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createConnection(), connection: connection.reference, branches: [
631
+ goToBranch("created", created),
632
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
633
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
634
+ ...defect ? [goToBranch("defect", defect)] : []
635
+ ] });
636
+ }
637
+ function newUpdateConnectionStep(configuration) {
638
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
639
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
640
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateConnection(), connection: connection.reference, branches: [
641
+ goToBranch("updated", updated),
642
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
643
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
644
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
645
+ ...defect ? [goToBranch("defect", defect)] : []
646
+ ] });
647
+ }
648
+ function newDeleteConnectionStep(configuration) {
649
+ const { connection, connectionName, deleted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
650
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
651
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteConnection(), connection: connection.reference, branches: [
652
+ goToBranch("deleted", deleted),
653
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
654
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
655
+ ...defect ? [goToBranch("defect", defect)] : []
656
+ ] });
657
+ }
658
+ function newListAccountContactsStep(configuration) {
659
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
660
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
661
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listAccountContacts(), connection: connection.reference, branches: [
662
+ goToBranch("listed", listed),
663
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
664
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
665
+ ...defect ? [goToBranch("defect", defect)] : []
666
+ ] });
667
+ }
668
+ function newGetAccountContactStep(configuration) {
669
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
670
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
671
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getAccountContact(), connection: connection.reference, branches: [
672
+ goToBranch("found", found),
673
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
674
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
675
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
676
+ ...defect ? [goToBranch("defect", defect)] : []
677
+ ] });
678
+ }
679
+ function newCreateAccountContactStep(configuration) {
680
+ const { connection, connectionName, created, uncertain, providerRejected, defect, ...stepConfiguration } = configuration;
681
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
682
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createAccountContact(), connection: connection.reference, branches: [
683
+ goToBranch("created", created),
684
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
685
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
686
+ ...defect ? [goToBranch("defect", defect)] : []
687
+ ] });
688
+ }
689
+ function newUpdateAccountContactStep(configuration) {
690
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
691
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
692
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateAccountContact(), connection: connection.reference, branches: [
693
+ goToBranch("updated", updated),
694
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
695
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
696
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
697
+ ...defect ? [goToBranch("defect", defect)] : []
698
+ ] });
699
+ }
700
+ function newDeleteAccountContactStep(configuration) {
701
+ const { connection, connectionName, deleted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
702
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
703
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteAccountContact(), connection: connection.reference, branches: [
704
+ goToBranch("deleted", deleted),
705
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
706
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
707
+ ...defect ? [goToBranch("defect", defect)] : []
708
+ ] });
709
+ }
710
+ function newListAccountsStep(configuration) {
711
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
712
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
713
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listAccounts(), connection: connection.reference, branches: [
714
+ goToBranch("listed", listed),
715
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
716
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
717
+ ...defect ? [goToBranch("defect", defect)] : []
718
+ ] });
719
+ }
720
+ function newGetAccountStep(configuration) {
721
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
722
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
723
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getAccount(), connection: connection.reference, branches: [
724
+ goToBranch("found", found),
725
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
726
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
727
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
728
+ ...defect ? [goToBranch("defect", defect)] : []
729
+ ] });
730
+ }
731
+ function newCreateAccountStep(configuration) {
732
+ const { connection, connectionName, created, uncertain, providerRejected, defect, ...stepConfiguration } = configuration;
733
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
734
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createAccount(), connection: connection.reference, branches: [
735
+ goToBranch("created", created),
736
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
737
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
738
+ ...defect ? [goToBranch("defect", defect)] : []
739
+ ] });
740
+ }
741
+ function newUpdateAccountStep(configuration) {
742
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
743
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
744
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateAccount(), connection: connection.reference, branches: [
745
+ goToBranch("updated", updated),
746
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
747
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
748
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
749
+ ...defect ? [goToBranch("defect", defect)] : []
750
+ ] });
751
+ }
752
+ function newDeleteAccountStep(configuration) {
753
+ const { connection, connectionName, deleted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
754
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
755
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteAccount(), connection: connection.reference, branches: [
756
+ goToBranch("deleted", deleted),
757
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
758
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
759
+ ...defect ? [goToBranch("defect", defect)] : []
760
+ ] });
761
+ }
762
+ function newListContactListMembershipsStep(configuration) {
763
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
764
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
765
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listContactListMemberships(), connection: connection.reference, branches: [
766
+ goToBranch("listed", listed),
767
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
768
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
769
+ ...defect ? [goToBranch("defect", defect)] : []
770
+ ] });
771
+ }
772
+ function newSubscribeContactToListStep(configuration) {
773
+ const { connection, connectionName, subscribed, uncertain, providerRejected, defect, ...stepConfiguration } = configuration;
774
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
775
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.subscribeContactToList(), connection: connection.reference, branches: [
776
+ goToBranch("subscribed", subscribed),
777
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
778
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
779
+ ...defect ? [goToBranch("defect", defect)] : []
780
+ ] });
781
+ }
782
+ function newUnsubscribeContactFromListStep(configuration) {
783
+ const { connection, connectionName, unsubscribed, uncertain, providerRejected, defect, ...stepConfiguration } = configuration;
784
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
785
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.unsubscribeContactFromList(), connection: connection.reference, branches: [
786
+ goToBranch("unsubscribed", unsubscribed),
787
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
788
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
789
+ ...defect ? [goToBranch("defect", defect)] : []
790
+ ] });
791
+ }
792
+ function newListContactTagsStep(configuration) {
793
+ const { connection, connectionName, listed, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
794
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
795
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listContactTags(), connection: connection.reference, branches: [
796
+ goToBranch("listed", listed),
797
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
798
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
799
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
800
+ ...defect ? [goToBranch("defect", defect)] : []
801
+ ] });
802
+ }
803
+ function newApplyTagToContactStep(configuration) {
804
+ const { connection, connectionName, applied, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
805
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
806
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.applyTagToContact(), connection: connection.reference, branches: [
807
+ goToBranch("applied", applied),
808
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
809
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
810
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
811
+ ...defect ? [goToBranch("defect", defect)] : []
812
+ ] });
813
+ }
814
+ function newRemoveTagFromContactStep(configuration) {
815
+ const { connection, connectionName, removed, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
816
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
817
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.removeTagFromContact(), connection: connection.reference, branches: [
818
+ goToBranch("removed", removed),
819
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
820
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
821
+ ...defect ? [goToBranch("defect", defect)] : []
822
+ ] });
823
+ }
824
+ function newListDealNotesStep(configuration) {
825
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
826
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
827
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listDealNotes(), connection: connection.reference, branches: [
828
+ goToBranch("listed", listed),
829
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
830
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
831
+ ...defect ? [goToBranch("defect", defect)] : []
832
+ ] });
833
+ }
834
+ function newGetDealNoteStep(configuration) {
835
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
836
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
837
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getDealNote(), connection: connection.reference, branches: [
838
+ goToBranch("found", found),
839
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
840
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
841
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
842
+ ...defect ? [goToBranch("defect", defect)] : []
843
+ ] });
844
+ }
845
+ function newCreateDealNoteStep(configuration) {
846
+ const { connection, connectionName, created, uncertain, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
847
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
848
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createDealNote(), connection: connection.reference, branches: [
849
+ goToBranch("created", created),
850
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
851
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
852
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
853
+ ...defect ? [goToBranch("defect", defect)] : []
854
+ ] });
855
+ }
856
+ function newUpdateDealNoteStep(configuration) {
857
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
858
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
859
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateDealNote(), connection: connection.reference, branches: [
860
+ goToBranch("updated", updated),
861
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
862
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
863
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
864
+ ...defect ? [goToBranch("defect", defect)] : []
865
+ ] });
866
+ }
867
+ function newListDealsStep(configuration) {
868
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
869
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
870
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listDeals(), connection: connection.reference, branches: [
871
+ goToBranch("listed", listed),
872
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
873
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
874
+ ...defect ? [goToBranch("defect", defect)] : []
875
+ ] });
876
+ }
877
+ function newGetDealStep(configuration) {
878
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
879
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
880
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getDeal(), connection: connection.reference, branches: [
881
+ goToBranch("found", found),
882
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
883
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
884
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
885
+ ...defect ? [goToBranch("defect", defect)] : []
886
+ ] });
887
+ }
888
+ function newCreateDealStep(configuration) {
889
+ const { connection, connectionName, created, uncertain, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
890
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
891
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createDeal(), connection: connection.reference, branches: [
892
+ goToBranch("created", created),
893
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
894
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
895
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
896
+ ...defect ? [goToBranch("defect", defect)] : []
897
+ ] });
898
+ }
899
+ function newUpdateDealStep(configuration) {
900
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
901
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
902
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateDeal(), connection: connection.reference, branches: [
903
+ goToBranch("updated", updated),
904
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
905
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
906
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
907
+ ...defect ? [goToBranch("defect", defect)] : []
908
+ ] });
909
+ }
910
+ function newDeleteDealStep(configuration) {
911
+ const { connection, connectionName, deleted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
912
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
913
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteDeal(), connection: connection.reference, branches: [
914
+ goToBranch("deleted", deleted),
915
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
916
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
917
+ ...defect ? [goToBranch("defect", defect)] : []
918
+ ] });
919
+ }
920
+ function newListTagsStep(configuration) {
921
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
922
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
923
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listTags(), connection: connection.reference, branches: [
924
+ goToBranch("listed", listed),
925
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
926
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
927
+ ...defect ? [goToBranch("defect", defect)] : []
928
+ ] });
929
+ }
930
+ function newGetTagStep(configuration) {
931
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
932
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
933
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getTag(), connection: connection.reference, branches: [
934
+ goToBranch("found", found),
935
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
936
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
937
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
938
+ ...defect ? [goToBranch("defect", defect)] : []
939
+ ] });
940
+ }
941
+ function newCreateTagStep(configuration) {
942
+ const { connection, connectionName, created, uncertain, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
943
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
944
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.createTag(), connection: connection.reference, branches: [
945
+ goToBranch("created", created),
946
+ ...uncertain ? [goToBranch("uncertain", uncertain)] : [],
947
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
948
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
949
+ ...defect ? [goToBranch("defect", defect)] : []
950
+ ] });
951
+ }
952
+ function newUpdateTagStep(configuration) {
953
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
954
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
955
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateTag(), connection: connection.reference, branches: [
956
+ goToBranch("updated", updated),
957
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
958
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
959
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
960
+ ...defect ? [goToBranch("defect", defect)] : []
961
+ ] });
962
+ }
963
+ function newDeleteTagStep(configuration) {
964
+ const { connection, connectionName, deleted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
965
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
966
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteTag(), connection: connection.reference, branches: [
967
+ goToBranch("deleted", deleted),
968
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
969
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
970
+ ...defect ? [goToBranch("defect", defect)] : []
971
+ ] });
972
+ }
973
+ function newListListsStep(configuration) {
974
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
975
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
976
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listLists(), connection: connection.reference, branches: [
977
+ goToBranch("listed", listed),
978
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
979
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
980
+ ...defect ? [goToBranch("defect", defect)] : []
981
+ ] });
982
+ }
983
+ function newGetListStep(configuration) {
984
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
985
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
986
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getList(), connection: connection.reference, branches: [
987
+ goToBranch("found", found),
988
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
989
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
990
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
991
+ ...defect ? [goToBranch("defect", defect)] : []
992
+ ] });
993
+ }
994
+ function newListContactsStep(configuration) {
995
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
996
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
997
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listContacts(), connection: connection.reference, branches: [
998
+ goToBranch("listed", listed),
999
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
1000
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
1001
+ ...defect ? [goToBranch("defect", defect)] : []
1002
+ ] });
1003
+ }
1004
+ function newGetContactStep(configuration) {
1005
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
1006
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
1007
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getContact(), connection: connection.reference, branches: [
1008
+ goToBranch("found", found),
1009
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
1010
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
1011
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
1012
+ ...defect ? [goToBranch("defect", defect)] : []
1013
+ ] });
1014
+ }
1015
+ function newSyncContactStep(configuration) {
1016
+ const { connection, connectionName, synced, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
1017
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
1018
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.syncContact(), connection: connection.reference, branches: [
1019
+ goToBranch("synced", synced),
1020
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
1021
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
1022
+ ...defect ? [goToBranch("defect", defect)] : []
1023
+ ] });
1024
+ }
1025
+ function newUpdateContactStep(configuration) {
1026
+ const { connection, connectionName, updated, notFound, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
1027
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
1028
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateContact(), connection: connection.reference, branches: [
1029
+ goToBranch("updated", updated),
1030
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
1031
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
1032
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
1033
+ ...defect ? [goToBranch("defect", defect)] : []
1034
+ ] });
1035
+ }
1036
+
1037
+ // src/project.ts
1038
+ import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
1039
+ import { z } from "zod";
1040
+
1041
+ // src/client.ts
1042
+ import { Fence, CheckpointError, InsufficientTimeError } from "@superdurable/connectors-sdk/singledispatch";
1043
+ import { isIP } from "net";
1044
+ import { newMutationBranch, newMutationUncertain, newMutationRetry, SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
1045
+ import { BodyTooLargeError, ProviderStalledError, ProviderTransportError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
1046
+ var numericId = /^[0-9]{1,24}$/;
1047
+ var countString = /^\+?[0-9]+$/;
1048
+ var emptyContacts = () => ({ contacts: [], offset: 0, limit: 0, total: 0 });
1049
+ var emptyContact = () => ({ id: "", email: "", firstName: "", lastName: "" });
1050
+ var ActiveCampaignClient = class {
1051
+ /** Validate account configuration without contacting ActiveCampaign. */
1052
+ constructor(config, credentials, options = {}) {
1053
+ this.credentials = credentials;
1054
+ if (!credentials) throw new TypeError("ActiveCampaign credential source is required");
1055
+ this.baseUrl = validateBaseURL(config.baseUrl);
1056
+ this.timeoutMs = config.timeoutMs || 15e3;
1057
+ this.maxResponseBytes = config.maxResponseBytes || 1048576;
1058
+ if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0)
1059
+ throw new TypeError("ActiveCampaign timeout is invalid");
1060
+ if (!Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0)
1061
+ throw new TypeError("ActiveCampaign response limit is invalid");
1062
+ this.sendRequest = options.send ?? sendProviderRequest;
1063
+ }
1064
+ credentials;
1065
+ baseUrl;
1066
+ timeoutMs;
1067
+ maxResponseBytes;
1068
+ sendRequest;
1069
+ /** Bind the contact page Query. */
1070
+ listContacts() {
1071
+ return new ListContactsOperation(this);
1072
+ }
1073
+ /** Bind the contact metadata Query. */
1074
+ getContact() {
1075
+ return new GetContactOperation(this);
1076
+ }
1077
+ /** Bind the listAccounts Query. */
1078
+ listAccounts() {
1079
+ return new ListAccountsOperation(this);
1080
+ }
1081
+ /** Bind the getAccount Query. */
1082
+ getAccount() {
1083
+ return new GetAccountOperation(this);
1084
+ }
1085
+ /** Bind the listTags Query. */
1086
+ listTags() {
1087
+ return new ListTagsOperation(this);
1088
+ }
1089
+ /** Bind the getTag Query. */
1090
+ getTag() {
1091
+ return new GetTagOperation(this);
1092
+ }
1093
+ /** Bind the listLists Query. */
1094
+ listLists() {
1095
+ return new ListListsOperation(this);
1096
+ }
1097
+ /** Bind the getList Query. */
1098
+ getList() {
1099
+ return new GetListOperation(this);
1100
+ }
1101
+ /** Bind the listDealNotes Query. */
1102
+ listDealNotes() {
1103
+ return new ListDealNotesOperation(this);
1104
+ }
1105
+ /** Bind the getDealNote Query. */
1106
+ getDealNote() {
1107
+ return new GetDealNoteOperation(this);
1108
+ }
1109
+ /** Bind the listAccountContacts Query. */
1110
+ listAccountContacts() {
1111
+ return new ListAccountContactsOperation(this);
1112
+ }
1113
+ /** Bind the getAccountContact Query. */
1114
+ getAccountContact() {
1115
+ return new GetAccountContactOperation(this);
1116
+ }
1117
+ /** Bind the listContactListMemberships Query. */
1118
+ listContactListMemberships() {
1119
+ return new ListContactListMembershipsOperation(this);
1120
+ }
1121
+ /** Bind the listContactTags Query. */
1122
+ listContactTags() {
1123
+ return new ListContactTagsOperation(this);
1124
+ }
1125
+ /** Bind the listConnections Query. */
1126
+ listConnections() {
1127
+ return new ListConnectionsOperation(this);
1128
+ }
1129
+ /** Bind the getConnection Query. */
1130
+ getConnection() {
1131
+ return new GetConnectionOperation(this);
1132
+ }
1133
+ /** Bind the listDeals Query. */
1134
+ listDeals() {
1135
+ return new ListDealsOperation(this);
1136
+ }
1137
+ /** Bind the getDeal Query. */
1138
+ getDeal() {
1139
+ return new GetDealOperation(this);
1140
+ }
1141
+ /** Bind the listEcommerceCustomers Query. */
1142
+ listEcommerceCustomers() {
1143
+ return new ListEcommerceCustomersOperation(this);
1144
+ }
1145
+ /** Bind the getEcommerceCustomer Query. */
1146
+ getEcommerceCustomer() {
1147
+ return new GetEcommerceCustomerOperation(this);
1148
+ }
1149
+ /** Bind the listEcommerceOrders Query. */
1150
+ listEcommerceOrders() {
1151
+ return new ListEcommerceOrdersOperation(this);
1152
+ }
1153
+ /** Bind the getEcommerceOrder Query. */
1154
+ getEcommerceOrder() {
1155
+ return new GetEcommerceOrderOperation(this);
1156
+ }
1157
+ /** Bind the listEcommerceOrderProducts Query. */
1158
+ listEcommerceOrderProducts() {
1159
+ return new ListEcommerceOrderProductsOperation(this);
1160
+ }
1161
+ /** Bind the getEcommerceOrderProduct Query. */
1162
+ getEcommerceOrderProduct() {
1163
+ return new GetEcommerceOrderProductOperation(this);
1164
+ }
1165
+ /** Bind the listProductsForEcommerceOrder Query. */
1166
+ listProductsForEcommerceOrder() {
1167
+ return new ListProductsForEcommerceOrderOperation(this);
1168
+ }
1169
+ /** Bind the deleteAccount Mutation. */
1170
+ deleteAccount() {
1171
+ return new DeleteAccountOperation(this);
1172
+ }
1173
+ /** Bind the deleteAccountContact Mutation. */
1174
+ deleteAccountContact() {
1175
+ return new DeleteAccountContactOperation(this);
1176
+ }
1177
+ /** Bind the deleteConnection Mutation. */
1178
+ deleteConnection() {
1179
+ return new DeleteConnectionOperation(this);
1180
+ }
1181
+ /** Bind the deleteDeal Mutation. */
1182
+ deleteDeal() {
1183
+ return new DeleteDealOperation(this);
1184
+ }
1185
+ /** Bind the deleteEcommerceCustomer Mutation. */
1186
+ deleteEcommerceCustomer() {
1187
+ return new DeleteEcommerceCustomerOperation(this);
1188
+ }
1189
+ /** Bind the deleteTag Mutation. */
1190
+ deleteTag() {
1191
+ return new DeleteTagOperation(this);
1192
+ }
1193
+ async request(call, operation, path, method, payload, signal = call.context.cancellationSignal) {
1194
+ let apiKey;
1195
+ try {
1196
+ const resolved = await this.credentials.resolve(call, signal);
1197
+ apiKey = resolved.apiKey instanceof SecretString ? resolved.apiKey.reveal() : "";
1198
+ } catch {
1199
+ return {
1200
+ branch: "defect",
1201
+ failure: failure(operation, "AUTHENTICATION", "connection credentials are unavailable or invalid")
1202
+ };
1203
+ }
1204
+ if (!apiKey || !isHeaderSafeCredential(apiKey))
1205
+ return {
1206
+ branch: "defect",
1207
+ failure: failure(operation, "AUTHENTICATION", "connection credentials are unavailable or invalid")
1208
+ };
1209
+ const request = {
1210
+ url: `${this.baseUrl}${path}`,
1211
+ method,
1212
+ headers: {
1213
+ Accept: "application/json",
1214
+ "Api-Token": apiKey,
1215
+ ...payload ? { "Content-Type": "application/json" } : {}
1216
+ },
1217
+ ...payload ? { body: Buffer.from(JSON.stringify(payload)) } : {},
1218
+ maxResponseBytes: this.maxResponseBytes,
1219
+ timeoutMs: this.timeoutMs,
1220
+ addressPolicy: this.baseUrl.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP",
1221
+ signal
1222
+ };
1223
+ try {
1224
+ return { response: await this.sendRequest(request) };
1225
+ } catch (error) {
1226
+ if (error instanceof BodyTooLargeError && error.status !== void 0) {
1227
+ const response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
1228
+ return { response, tooLarge: true };
1229
+ }
1230
+ if ((error instanceof ProviderTransportError || error instanceof ProviderStalledError) && error.status !== void 0)
1231
+ return { retry: true, failure: failure(operation, "TRANSPORT", "ActiveCampaign response was interrupted"), interruptedResponse: { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() } };
1232
+ return { retry: true, failure: failure(operation, "TRANSPORT", "ActiveCampaign request failed") };
1233
+ }
1234
+ }
1235
+ /** Write absolute resource fields and return the provider-confirmed resource and receipt. */
1236
+ async writeResource(call, operation, method, path, field, replacements, project, empty, expectedId = "") {
1237
+ const transport = failure(operation, "TRANSPORT", "ActiveCampaign request failed");
1238
+ const result = await this.request(call, operation, path, method, { [field]: replacements });
1239
+ if (!("response" in result)) return newMutationRetry(transport);
1240
+ const { status, body, headers } = result.response;
1241
+ if (status === 429 || status === 503)
1242
+ return newMutationRetry(
1243
+ failure(
1244
+ operation,
1245
+ status === 429 ? "RATE_LIMIT" : "AVAILABILITY",
1246
+ "ActiveCampaign returned HTTP " + status
1247
+ ),
1248
+ parseRetryAfter(headerValue(headers["retry-after"]))
1249
+ );
1250
+ const accepted = status === 200 || status === 201 && ["syncContact", "updateContact", "updateTag"].includes(operation);
1251
+ const tooLarge = result.tooLarge || body.length > this.maxResponseBytes;
1252
+ if (!accepted) {
1253
+ if ((status < 200 || status >= 300) && (tooLarge || call.context.attempt > 1 || !isDefiniteRefusal(status, body)))
1254
+ return newMutationRetry(transport);
1255
+ if (status === 404 && operation !== "syncContact")
1256
+ return newMutationBranch(
1257
+ "notFound",
1258
+ empty,
1259
+ {},
1260
+ failure(operation, "NOT_FOUND", "ActiveCampaign did not find the resource")
1261
+ );
1262
+ return newMutationBranch(
1263
+ "providerRejected",
1264
+ empty,
1265
+ {},
1266
+ failure(operation, "PROVIDER_REJECTION", "ActiveCampaign rejected HTTP " + status)
1267
+ );
1268
+ }
1269
+ if (tooLarge)
1270
+ return newMutationRetry(
1271
+ operation === "updateAccount" ? transport : failure(operation, "RESPONSE_TOO_LARGE", "ActiveCampaign response exceeded the configured limit")
1272
+ );
1273
+ try {
1274
+ const document = operation === "updateDeal" ? integerDocument("value", "status", "total")(body) : parseJSON(body);
1275
+ const value = project(record(record(document)[field.toLowerCase()]));
1276
+ if (expectedId && value.id !== expectedId) throw new TypeError("unexpected resource ID");
1277
+ return newMutationBranch(operation === "syncContact" ? "synced" : "updated", value, {
1278
+ callId: call.id,
1279
+ idempotencyKey: call.idempotencyKey,
1280
+ provider: "activecampaign",
1281
+ providerObjectId: value.id,
1282
+ observedAt: (/* @__PURE__ */ new Date()).toISOString()
1283
+ });
1284
+ } catch {
1285
+ return newMutationRetry(failure(operation, "PROTOCOL", "ActiveCampaign returned invalid JSON"));
1286
+ }
1287
+ }
1288
+ /** Delete one selected resource and correlate confirmed absence with the Dex Call. */
1289
+ async deleteResource(call, operation, collection, resourceId, label, deleted, empty) {
1290
+ if (!isNumericId(resourceId))
1291
+ return newMutationBranch(
1292
+ "defect",
1293
+ empty,
1294
+ {},
1295
+ failure(operation, "VALIDATION", label + " ID must be numeric")
1296
+ );
1297
+ const transport = failure(operation, "TRANSPORT", "ActiveCampaign request failed");
1298
+ const result = await this.request(call, operation, "/" + collection + "/" + resourceId, "DELETE");
1299
+ if (!("response" in result)) return newMutationRetry(transport);
1300
+ const { status, body, headers } = result.response;
1301
+ if (status === 429 || status === 503) {
1302
+ return newMutationRetry(
1303
+ failure(
1304
+ operation,
1305
+ status === 429 ? "RATE_LIMIT" : "AVAILABILITY",
1306
+ "ActiveCampaign returned HTTP " + status
1307
+ ),
1308
+ parseRetryAfter(headerValue(headers["retry-after"]))
1309
+ );
1310
+ }
1311
+ const tooLarge = result.tooLarge || body.length > this.maxResponseBytes;
1312
+ if (status < 200 || status >= 300) {
1313
+ if (tooLarge || call.context.attempt > 1 || !isDefiniteRefusal(status, body))
1314
+ return newMutationRetry(transport);
1315
+ }
1316
+ if (status !== 200 && status !== 404 && !(status === 204 && operation !== "deleteTag")) {
1317
+ return newMutationBranch(
1318
+ "providerRejected",
1319
+ empty,
1320
+ {},
1321
+ failure(operation, "PROVIDER_REJECTION", "ActiveCampaign rejected HTTP " + status)
1322
+ );
1323
+ }
1324
+ if (tooLarge)
1325
+ return newMutationRetry(
1326
+ failure(operation, "RESPONSE_TOO_LARGE", "ActiveCampaign response exceeded the configured limit")
1327
+ );
1328
+ if (status === 200 && (body.length > 0 || operation === "deleteTag" || operation === "deleteDeal")) {
1329
+ try {
1330
+ JSON.parse(new TextDecoder("utf-8", { ignoreBOM: true }).decode(body));
1331
+ } catch {
1332
+ return newMutationRetry(failure(operation, "PROTOCOL", "ActiveCampaign returned invalid JSON"));
1333
+ }
1334
+ }
1335
+ return newMutationBranch("deleted", deleted, {
1336
+ callId: call.id,
1337
+ idempotencyKey: call.idempotencyKey,
1338
+ provider: "activecampaign",
1339
+ providerObjectId: resourceId,
1340
+ observedAt: (/* @__PURE__ */ new Date()).toISOString()
1341
+ });
1342
+ }
1343
+ /** Bind the updateAccount Mutation. */
1344
+ updateAccount() {
1345
+ return new UpdateAccountOperation(this);
1346
+ }
1347
+ /** Bind the updateAccountContact Mutation. */
1348
+ updateAccountContact() {
1349
+ return new UpdateAccountContactOperation(this);
1350
+ }
1351
+ /** Bind the updateConnection Mutation. */
1352
+ updateConnection() {
1353
+ return new UpdateConnectionOperation(this);
1354
+ }
1355
+ /** Bind the updateContact Mutation. */
1356
+ updateContact() {
1357
+ return new UpdateContactOperation(this);
1358
+ }
1359
+ /** Bind the syncContact Mutation. */
1360
+ syncContact() {
1361
+ return new SyncContactOperation(this);
1362
+ }
1363
+ /** Bind the updateDeal Mutation. */
1364
+ updateDeal() {
1365
+ return new UpdateDealOperation(this);
1366
+ }
1367
+ /** Bind the updateDealNote Mutation. */
1368
+ updateDealNote() {
1369
+ return new UpdateDealNoteOperation(this);
1370
+ }
1371
+ /** Bind the updateEcommerceCustomer Mutation. */
1372
+ updateEcommerceCustomer() {
1373
+ return new UpdateEcommerceCustomerOperation(this);
1374
+ }
1375
+ /** Bind the updateTag Mutation. */
1376
+ updateTag() {
1377
+ return new UpdateTagOperation(this);
1378
+ }
1379
+ /** Apply an existing tag to a contact. */
1380
+ applyTagToContact() {
1381
+ return new ApplyTagToContactOperation(this);
1382
+ }
1383
+ /** Remove a tag association or confirm its absence. */
1384
+ removeTagFromContact() {
1385
+ return new RemoveTagFromContactOperation(this);
1386
+ }
1387
+ /** Subscribe a contact after checking its current list membership. */
1388
+ subscribeContactToList() {
1389
+ return new SubscribeContactToListOperation(this);
1390
+ }
1391
+ /** Unsubscribe a contact after checking its current list membership. */
1392
+ unsubscribeContactFromList() {
1393
+ return new UnsubscribeContactFromListOperation(this);
1394
+ }
1395
+ async contactRequest(call, operation, path, method, payload, signal = call.context.cancellationSignal) {
1396
+ const result = await this.request(call, operation, path, method, payload, signal);
1397
+ if ("response" in result) return { ...result, interrupted: false };
1398
+ if (result.interruptedResponse)
1399
+ return { response: result.interruptedResponse, interrupted: true, tooLarge: false };
1400
+ return result;
1401
+ }
1402
+ /** Write an order under its store key and verify the provider confirmation. */
1403
+ async writeStoreOrder(call, input) {
1404
+ const operation = "upsertEcommerceOrder";
1405
+ const reason = (kind) => failure(operation, kind, "ActiveCampaign order upsert failed");
1406
+ const empty = { connectionId: "", storeOrderId: "", email: "" };
1407
+ const query = orderUpsertQuery(input);
1408
+ if (query === void 0) return newMutationBranch("defect", empty, {}, reason("VALIDATION"));
1409
+ const result = await this.contactRequest(call, operation, "/ecom/graphql", "POST", { query });
1410
+ if (!("response" in result)) return newMutationRetry(reason("TRANSPORT"));
1411
+ const { status, headers, body } = result.response;
1412
+ if (status === 429 || status === 503)
1413
+ return newMutationRetry(
1414
+ reason(status === 429 ? "RATE_LIMIT" : "AVAILABILITY"),
1415
+ parseRetryAfter(headerValue(headers["retry-after"]))
1416
+ );
1417
+ const incomplete = result.tooLarge || result.interrupted || body.length > this.maxResponseBytes;
1418
+ if ((status < 200 || status >= 300) && (incomplete || call.context.attempt > 1 || !isDefiniteRefusal(status, body)))
1419
+ return newMutationRetry(reason("TRANSPORT"));
1420
+ if (status !== 200)
1421
+ return newMutationBranch("providerRejected", empty, {}, reason("PROVIDER_REJECTION"));
1422
+ if (incomplete) return newMutationRetry(reason("TRANSPORT"));
1423
+ try {
1424
+ const document = record(
1425
+ JSON.parse(
1426
+ Buffer.from(body).toString("utf8"),
1427
+ (key, value, context) => key.toLowerCase() === "connectionid" && typeof value === "number" ? context?.source : value
1428
+ )
1429
+ );
1430
+ if (document.errors != null && (!Array.isArray(document.errors) || document.errors.length))
1431
+ throw new TypeError("GraphQL errors");
1432
+ const order = record(record(document.data).upsertorder);
1433
+ if (order.connectionid !== String(Number(input.connectionId)) || order.connectionid !== input.connectionId || order.storeorderid !== input.storeOrderId || order.email !== input.email)
1434
+ throw new TypeError("order confirmation does not match");
1435
+ return newMutationBranch(
1436
+ "upserted",
1437
+ { connectionId: input.connectionId, storeOrderId: input.storeOrderId, email: input.email },
1438
+ membershipReceipt(call, input.storeOrderId)
1439
+ );
1440
+ } catch {
1441
+ return newMutationRetry(reason("PROTOCOL"));
1442
+ }
1443
+ }
1444
+ /** Write a tag relationship and validate the provider confirmation. */
1445
+ async changeTag(call, operation, input, empty, method, accepted, project, branch) {
1446
+ if (!isNumericId(input.contactId) || !isNumericId(input.tagId))
1447
+ return newMutationBranch(
1448
+ "defect",
1449
+ empty,
1450
+ {},
1451
+ failure(operation, "VALIDATION", "contact or tag ID must be numeric")
1452
+ );
1453
+ const path = "/contacts/" + input.contactId + "/tags";
1454
+ const result = method === "POST" ? await this.contactRequest(call, operation, path, method, {
1455
+ tagIds: [input.tagId],
1456
+ createMissing: false
1457
+ }) : await this.contactRequest(call, operation, path + "/" + input.tagId, method);
1458
+ if (!("response" in result))
1459
+ return newMutationRetry(failure(operation, "TRANSPORT", "ActiveCampaign request failed"));
1460
+ const { status, headers, body } = result.response;
1461
+ if ((status < 200 || status >= 300) && status !== 429 && status !== 503 && (result.interrupted || result.tooLarge || body.length > this.maxResponseBytes || call.context.attempt > 1 || !isDefiniteRefusal(status, body)))
1462
+ return newMutationRetry(failure(operation, "TRANSPORT", "ActiveCampaign request outcome is unknown"));
1463
+ if (status === 429 || status === 408 || status >= 500)
1464
+ return newMutationRetry(
1465
+ failure(
1466
+ operation,
1467
+ status === 429 ? "RATE_LIMIT" : "AVAILABILITY",
1468
+ "ActiveCampaign is temporarily unavailable"
1469
+ ),
1470
+ parseRetryAfter(headerValue(headers["retry-after"]))
1471
+ );
1472
+ if (!accepted.includes(status))
1473
+ return status === 404 ? newMutationBranch("notFound", empty, {}, failure(operation, "NOT_FOUND", "contact was not found")) : newMutationBranch(
1474
+ "providerRejected",
1475
+ empty,
1476
+ {},
1477
+ failure(operation, "PROVIDER_REJECTION", "ActiveCampaign rejected HTTP " + status)
1478
+ );
1479
+ if (result.interrupted)
1480
+ return newMutationRetry(failure(operation, "TRANSPORT", "ActiveCampaign response was interrupted"));
1481
+ if (result.tooLarge || body.length > this.maxResponseBytes)
1482
+ return newMutationRetry(
1483
+ failure(operation, "RESPONSE_TOO_LARGE", "ActiveCampaign response exceeded the configured limit")
1484
+ );
1485
+ try {
1486
+ const [value, identifier2] = project(body, status);
1487
+ return newMutationBranch(branch, value, membershipReceipt(call, identifier2));
1488
+ } catch {
1489
+ return newMutationRetry(
1490
+ failure(operation, "PROTOCOL", "ActiveCampaign returned an invalid tag confirmation")
1491
+ );
1492
+ }
1493
+ }
1494
+ /** Create a record with the operation's bounded-send policy and provider-ID read-back. */
1495
+ async createResource(call, definition, spec) {
1496
+ const operation = definition.operation.operationId, isTag = operation === "createTag";
1497
+ const { empty, field, path } = spec;
1498
+ const reason = (kind2) => failure(operation, kind2, "ActiveCampaign create could not be confirmed");
1499
+ if (!spec.valid) return newMutationBranch("defect", empty, {}, reason("VALIDATION"));
1500
+ const cap = call.maxSendsOverride ?? definition.maxSends ?? 3;
1501
+ let fence;
1502
+ try {
1503
+ fence = new Fence(call, definition.stepDefaults.executeMethodTimeoutMs ?? 0, { maxSends: cap });
1504
+ } catch {
1505
+ return newMutationBranch("defect", empty, {}, reason("LOCAL_DEFECT"));
1506
+ }
1507
+ try {
1508
+ if (call.context.hasLastHeartbeatValue()) {
1509
+ const checkpoint = call.context.getLastHeartbeatValue();
1510
+ if (checkpoint === null || typeof checkpoint !== "object" || Array.isArray(checkpoint))
1511
+ return newMutationRetry(reason("AVAILABILITY"));
1512
+ }
1513
+ } catch {
1514
+ return newMutationRetry(reason("AVAILABILITY"));
1515
+ }
1516
+ const decision = fence.decide();
1517
+ if (decision.kind === "failClosed") return newMutationRetry(reason("AVAILABILITY"));
1518
+ const prior = decision.priorSendUpperBound ?? 0, identifier2 = decision.marker?.providerId ?? "";
1519
+ const decode = (body) => spec.project(
1520
+ record(
1521
+ record(operation === "createDeal" ? parseDeals(body) : parseJSON(body))[field.toLowerCase()]
1522
+ )
1523
+ );
1524
+ const uncertain = () => newMutationUncertain(empty, reason("TRANSPORT"), membershipReceipt(call, ""));
1525
+ if (identifier2) {
1526
+ const read = await this.contactRequest(
1527
+ call,
1528
+ operation,
1529
+ (spec.readPath ?? path) + "/" + identifier2,
1530
+ "GET"
1531
+ );
1532
+ const complete = "response" in read && !read.interrupted && !read.tooLarge && read.response.body.length <= this.maxResponseBytes;
1533
+ if (complete && read.response.status === 200) {
1534
+ try {
1535
+ const value = decode(read.response.body);
1536
+ if (spec.matches(value) && (!isTag || value.id === identifier2))
1537
+ return newMutationBranch("created", value, membershipReceipt(call, value.id));
1538
+ } catch {
1539
+ }
1540
+ }
1541
+ if (isTag) {
1542
+ if (decision.kind !== "readBackRequired") return newMutationRetry(reason("AVAILABILITY"));
1543
+ } else if (!complete || read.response.status === 429 || read.response.status >= 500)
1544
+ return newMutationRetry(reason("AVAILABILITY"));
1545
+ else if (read.response.status !== 404) return uncertain();
1546
+ }
1547
+ if (decision.kind === "readBackRequired") return uncertain();
1548
+ let result;
1549
+ try {
1550
+ result = await fence.dispatch(
1551
+ (signal) => this.contactRequest(call, operation, path, "POST", { [field]: spec.fields }, signal)
1552
+ );
1553
+ } catch (error) {
1554
+ if (error instanceof CheckpointError || error instanceof InsufficientTimeError)
1555
+ return newMutationRetry(reason("AVAILABILITY"));
1556
+ return prior + 1 >= cap ? uncertain() : newMutationRetry(reason("TRANSPORT"));
1557
+ }
1558
+ const response = "response" in result ? result.response : void 0;
1559
+ const status = response?.status ?? 0, credentialLost = "failure" in result && result.failure?.kind === "AUTHENTICATION";
1560
+ const incomplete = "response" in result && (result.tooLarge || result.interrupted || result.response.body.length > this.maxResponseBytes);
1561
+ if (status === 429 || status === 503 || !prior && !identifier2 && credentialLost || !prior && response && !incomplete && isDefiniteRefusal(status, response.body)) {
1562
+ try {
1563
+ await fence.recordCanResend();
1564
+ } catch {
1565
+ return newMutationRetry(reason("AVAILABILITY"));
1566
+ }
1567
+ if (credentialLost) return newMutationBranch("defect", empty, {}, reason("AUTHENTICATION"));
1568
+ if (status === 429 || status === 503)
1569
+ return newMutationRetry(
1570
+ reason(isTag || status === 429 ? "RATE_LIMIT" : "AVAILABILITY"),
1571
+ parseRetryAfter(headerValue(response?.headers["retry-after"]))
1572
+ );
1573
+ return newMutationBranch("providerRejected", empty, {}, reason("PROVIDER_REJECTION"));
1574
+ }
1575
+ let kind = "TRANSPORT";
1576
+ if (credentialLost) kind = "AUTHENTICATION";
1577
+ else if (!isTag && (status === 408 || status >= 500)) kind = "AVAILABILITY";
1578
+ else if (response && (status === 200 || status === 201)) {
1579
+ if (incomplete) kind = isTag ? "PROTOCOL" : "TRANSPORT";
1580
+ else {
1581
+ try {
1582
+ const value = decode(response.body);
1583
+ const confirmed = spec.confirms ? spec.confirms(value) : spec.matches(value);
1584
+ if (!confirmed || isTag && prior && status === 200)
1585
+ throw new TypeError("confirmation does not match");
1586
+ try {
1587
+ await fence.recordProviderId(value.id);
1588
+ } catch {
1589
+ if (isTag) return newMutationRetry(reason("AVAILABILITY"));
1590
+ }
1591
+ return newMutationBranch("created", value, membershipReceipt(call, value.id));
1592
+ } catch {
1593
+ kind = "PROTOCOL";
1594
+ }
1595
+ }
1596
+ }
1597
+ return prior + 1 >= cap ? newMutationUncertain(empty, reason(kind), membershipReceipt(call, credentialLost ? identifier2 : "")) : newMutationRetry(reason(kind));
1598
+ }
1599
+ /** Read the membership and bound possible writes using the Dex dispatch fence. */
1600
+ async changeMembership(call, definition, input, branch, target) {
1601
+ const operation = definition.operation.operationId;
1602
+ const empty = { id: "", contactId: "", listId: "", status: 0 };
1603
+ const reason = (kind) => failure(operation, kind, "ActiveCampaign membership change could not be confirmed");
1604
+ if (!isNumericId(input.contactId) || !isNumericId(input.listId))
1605
+ return newMutationBranch("defect", empty, {}, reason("VALIDATION"));
1606
+ let fence;
1607
+ const cap = call.maxSendsOverride ?? definition.maxSends ?? 3;
1608
+ try {
1609
+ fence = new Fence(call, definition.stepDefaults.executeMethodTimeoutMs ?? 0, { maxSends: cap });
1610
+ } catch {
1611
+ return newMutationBranch("defect", empty, {}, reason("LOCAL_DEFECT"));
1612
+ }
1613
+ try {
1614
+ if (call.context.hasLastHeartbeatValue()) {
1615
+ const checkpoint = call.context.getLastHeartbeatValue();
1616
+ if (checkpoint === null || typeof checkpoint !== "object" || Array.isArray(checkpoint))
1617
+ return newMutationRetry(reason("AVAILABILITY"));
1618
+ }
1619
+ } catch {
1620
+ return newMutationRetry(reason("AVAILABILITY"));
1621
+ }
1622
+ const decision = fence.decide();
1623
+ if (decision.kind === "failClosed") return newMutationRetry(reason("AVAILABILITY"));
1624
+ const prior = decision.priorSendUpperBound ?? 0;
1625
+ if (!prior) {
1626
+ const read = await this.contactRequest(
1627
+ call,
1628
+ operation,
1629
+ "/contactLists?contact=" + input.contactId + "&limit=100&offset=0",
1630
+ "GET"
1631
+ );
1632
+ if (!("response" in read))
1633
+ return read.retry ? newMutationRetry(reason("TRANSPORT")) : newMutationBranch("defect", empty, {}, reason("AUTHENTICATION"));
1634
+ const { status: status2, body, headers } = read.response;
1635
+ if (status2 === 408 || status2 === 429 || status2 >= 500)
1636
+ return newMutationRetry(
1637
+ reason(status2 === 429 ? "RATE_LIMIT" : "AVAILABILITY"),
1638
+ parseRetryAfter(headerValue(headers["retry-after"]))
1639
+ );
1640
+ if (status2 !== 200)
1641
+ return newMutationBranch("providerRejected", empty, {}, reason("PROVIDER_REJECTION"));
1642
+ if (read.interrupted || read.tooLarge || body.length > this.maxResponseBytes)
1643
+ return newMutationRetry(reason("PROTOCOL"));
1644
+ let matches;
1645
+ try {
1646
+ const envelope = record(parseMemberships(body));
1647
+ const rows = envelope.contactlists;
1648
+ if (!Array.isArray(rows) || count(text(record(envelope.meta), "total")) > rows.length)
1649
+ throw new Error("incomplete membership page");
1650
+ matches = rows.map((row) => contactMembership(record(row), input.contactId)).filter((row) => row.listId === input.listId);
1651
+ if (matches.length > 1) throw new Error("duplicate list membership");
1652
+ } catch {
1653
+ return newMutationRetry(reason("PROTOCOL"));
1654
+ }
1655
+ if (matches[0]?.status === target)
1656
+ return newMutationBranch(branch, matches[0], membershipReceipt(call, matches[0].id));
1657
+ if (!matches.length && target === 2)
1658
+ return newMutationBranch(
1659
+ branch,
1660
+ { id: "", contactId: input.contactId, listId: input.listId, status: target },
1661
+ membershipReceipt(call, "")
1662
+ );
1663
+ }
1664
+ if (decision.kind === "readBackRequired")
1665
+ return newMutationUncertain(empty, reason("TRANSPORT"), membershipReceipt(call, ""));
1666
+ const payload = { contactList: { contact: input.contactId, list: input.listId, status: target } };
1667
+ let result;
1668
+ try {
1669
+ result = await fence.dispatch(
1670
+ (signal) => this.contactRequest(call, operation, "/contactLists", "POST", payload, signal)
1671
+ );
1672
+ } catch (error) {
1673
+ if (error instanceof CheckpointError || error instanceof InsufficientTimeError)
1674
+ return newMutationRetry(reason("AVAILABILITY"));
1675
+ return prior + 1 >= cap ? newMutationUncertain(empty, reason("TRANSPORT"), membershipReceipt(call, "")) : newMutationRetry(reason("TRANSPORT"));
1676
+ }
1677
+ const response = "response" in result ? result.response : void 0;
1678
+ const status = response?.status ?? 0;
1679
+ const tooLarge = response && ("tooLarge" in result && result.tooLarge || response.body.length > this.maxResponseBytes);
1680
+ const interrupted = "interrupted" in result && result.interrupted;
1681
+ const credentialLost = "failure" in result && result.failure?.kind === "AUTHENTICATION";
1682
+ if (status === 429 || status === 503 || !prior && credentialLost || !prior && response && !tooLarge && !interrupted && isDefiniteRefusal(status, response.body)) {
1683
+ try {
1684
+ await fence.recordCanResend();
1685
+ } catch {
1686
+ return newMutationRetry(reason("AVAILABILITY"));
1687
+ }
1688
+ if (credentialLost) return newMutationBranch("defect", empty, {}, reason("AUTHENTICATION"));
1689
+ if (status === 429 || status === 503)
1690
+ return newMutationRetry(
1691
+ reason(status === 429 ? "RATE_LIMIT" : "AVAILABILITY"),
1692
+ parseRetryAfter(headerValue(response?.headers["retry-after"]))
1693
+ );
1694
+ return newMutationBranch("providerRejected", empty, {}, reason("PROVIDER_REJECTION"));
1695
+ }
1696
+ let unknown;
1697
+ if (!response) unknown = credentialLost ? "AUTHENTICATION" : "TRANSPORT";
1698
+ else if (status === 200 || status === 201) {
1699
+ try {
1700
+ if (tooLarge || interrupted) throw new Error("response incomplete");
1701
+ const value = contactMembership(
1702
+ record(record(parseMemberships(response.body)).contactlist),
1703
+ input.contactId
1704
+ );
1705
+ if (value.listId !== input.listId || value.status !== target)
1706
+ throw new Error("membership does not match request");
1707
+ try {
1708
+ await fence.recordProviderId(value.id);
1709
+ } catch {
1710
+ }
1711
+ return newMutationBranch(branch, value, membershipReceipt(call, value.id));
1712
+ } catch {
1713
+ unknown = "PROTOCOL";
1714
+ }
1715
+ } else unknown = "AVAILABILITY";
1716
+ const identifier2 = credentialLost ? decision.marker?.providerId ?? "" : "";
1717
+ return prior + 1 >= cap ? newMutationUncertain(empty, reason(unknown), membershipReceipt(call, identifier2)) : newMutationRetry(reason(unknown));
1718
+ }
1719
+ /** Bind the createAccount mutation. */
1720
+ createAccount() {
1721
+ return new CreateAccountOperation(this);
1722
+ }
1723
+ /** Bind the createAccountContact mutation. */
1724
+ createAccountContact() {
1725
+ return new CreateAccountContactOperation(this);
1726
+ }
1727
+ /** Bind the createConnection mutation. */
1728
+ createConnection() {
1729
+ return new CreateConnectionOperation(this);
1730
+ }
1731
+ /** Bind the createDeal mutation. */
1732
+ createDeal() {
1733
+ return new CreateDealOperation(this);
1734
+ }
1735
+ /** Bind the createDealNote mutation. */
1736
+ createDealNote() {
1737
+ return new CreateDealNoteOperation(this);
1738
+ }
1739
+ /** Bind the createEcommerceCustomer mutation. */
1740
+ createEcommerceCustomer() {
1741
+ return new CreateEcommerceCustomerOperation(this);
1742
+ }
1743
+ /** Bind the createTag mutation. */
1744
+ createTag() {
1745
+ return new CreateTagOperation(this);
1746
+ }
1747
+ /** Bind the keyed store order upsert. */
1748
+ upsertEcommerceOrder() {
1749
+ return new UpsertEcommerceOrderOperation(this);
1750
+ }
1751
+ /** Send one read and classify transport, HTTP, and response-size outcomes. */
1752
+ async exchange(call, operation, path, hasNotFound) {
1753
+ const result = await this.request(call, operation, path, "GET");
1754
+ if (!("response" in result)) return result;
1755
+ const { response, tooLarge } = result;
1756
+ const status = response.status;
1757
+ const retryAfter = headerValue(response.headers["retry-after"]);
1758
+ if (status === 429)
1759
+ return {
1760
+ retry: true,
1761
+ retryAfterMs: parseRetryAfter(retryAfter),
1762
+ failure: failure(operation, "RATE_LIMIT", "ActiveCampaign rate limited the request")
1763
+ };
1764
+ if (status === 408 || status >= 500)
1765
+ return {
1766
+ retry: true,
1767
+ retryAfterMs: parseRetryAfter(retryAfter),
1768
+ failure: failure(operation, "AVAILABILITY", "ActiveCampaign is temporarily unavailable")
1769
+ };
1770
+ if (status === 404 && hasNotFound)
1771
+ return {
1772
+ branch: "notFound",
1773
+ failure: failure(operation, "NOT_FOUND", "ActiveCampaign did not find the resource")
1774
+ };
1775
+ if (status !== 200)
1776
+ return {
1777
+ branch: "providerRejected",
1778
+ failure: failure(operation, "PROVIDER_REJECTION", `ActiveCampaign rejected HTTP ${status}`)
1779
+ };
1780
+ if (tooLarge || response.body.length > this.maxResponseBytes)
1781
+ return {
1782
+ branch: "invalidResponse",
1783
+ failure: failure(
1784
+ operation,
1785
+ "RESPONSE_TOO_LARGE",
1786
+ "ActiveCampaign response exceeded the configured limit"
1787
+ )
1788
+ };
1789
+ return { body: response.body };
1790
+ }
1791
+ };
1792
+ var ListContactsOperation = class {
1793
+ /** Bind the provider client. */
1794
+ constructor(client) {
1795
+ this.client = client;
1796
+ }
1797
+ client;
1798
+ /** Return the generated operation definition. */
1799
+ definition() {
1800
+ return ListContactsDefinition;
1801
+ }
1802
+ /** Validate pagination and read contact metadata. */
1803
+ async invoke(call, input) {
1804
+ const offset = input.offset ?? 0;
1805
+ const limit = input.limit === void 0 || input.limit === 0 ? 20 : input.limit;
1806
+ if (!isNonnegativeInteger(offset) || !isPositiveInteger(limit) || limit > 100) return terminal("listContacts", "defect", "VALIDATION", "offset or limit is invalid", emptyContacts());
1807
+ const result = await this.client.exchange(call, "listContacts", `/contacts?limit=${limit}&offset=${offset}`, false);
1808
+ if (result.retry) return newQueryRetry(result.failure, result.retryAfterMs);
1809
+ if (result.failure) return newQueryBranch(result.branch, emptyContacts(), {}, result.failure);
1810
+ const document = parseJSON(result.body);
1811
+ if (!isObject(document) || !Array.isArray(document.contacts) || !isObject(document.meta) || typeof document.meta.total !== "string" || !countString.test(document.meta.total)) return invalid("listContacts", emptyContacts());
1812
+ const total = Number(document.meta.total);
1813
+ if (!Number.isSafeInteger(total) || total < 0) return invalid("listContacts", emptyContacts());
1814
+ const contacts = [];
1815
+ for (const item of document.contacts) {
1816
+ if (!isContact(item)) return invalid("listContacts", emptyContacts());
1817
+ contacts.push(contactMetadata(item));
1818
+ }
1819
+ return newQueryBranch("listed", { contacts, offset, limit, total });
1820
+ }
1821
+ };
1822
+ var GetContactOperation = class {
1823
+ /** Bind the provider client. */
1824
+ constructor(client) {
1825
+ this.client = client;
1826
+ }
1827
+ client;
1828
+ /** Return the generated operation definition. */
1829
+ definition() {
1830
+ return GetContactDefinition;
1831
+ }
1832
+ /** Validate the contact ID and read its metadata. */
1833
+ async invoke(call, input) {
1834
+ if (!isNumericId(input.contactId)) return terminal("getContact", "defect", "VALIDATION", "contact ID must be numeric", emptyContact());
1835
+ const result = await this.client.exchange(call, "getContact", `/contacts/${input.contactId}`, true);
1836
+ if (result.retry) return newQueryRetry(result.failure, result.retryAfterMs);
1837
+ if (result.failure) return newQueryBranch(result.branch, emptyContact(), {}, result.failure);
1838
+ const document = parseJSON(result.body);
1839
+ if (!isObject(document) || !isContact(document.contact)) return invalid("getContact", emptyContact());
1840
+ return newQueryBranch("found", contactMetadata(document.contact));
1841
+ }
1842
+ };
1843
+ function failure(operation, kind, message) {
1844
+ return { provider: "activecampaign", operation, kind, message };
1845
+ }
1846
+ function terminal(operation, branch, kind, message, empty) {
1847
+ return newQueryBranch(branch, empty, {}, failure(operation, kind, message));
1848
+ }
1849
+ function invalid(operation, empty) {
1850
+ return terminal(operation, "invalidResponse", "PROTOCOL", "ActiveCampaign returned invalid JSON", empty);
1851
+ }
1852
+ function isObject(value) {
1853
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1854
+ }
1855
+ function isNumericId(value) {
1856
+ return typeof value === "string" && numericId.test(value);
1857
+ }
1858
+ function isPositiveInteger(value) {
1859
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
1860
+ }
1861
+ function isNonnegativeInteger(value) {
1862
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
1863
+ }
1864
+ function isContact(value) {
1865
+ return isObject(value) && isNumericId(value.id) && ["email", "firstName", "lastName"].every((field) => value[field] === void 0 || typeof value[field] === "string");
1866
+ }
1867
+ function contactMetadata(value) {
1868
+ return { id: value.id ?? "", email: value.email ?? "", firstName: value.firstName ?? "", lastName: value.lastName ?? "" };
1869
+ }
1870
+ function parseJSON(body) {
1871
+ try {
1872
+ return JSON.parse(Buffer.from(body).toString("utf8"));
1873
+ } catch {
1874
+ return void 0;
1875
+ }
1876
+ }
1877
+ function headerValue(value) {
1878
+ return Array.isArray(value) ? value[0] ?? "" : value ?? "";
1879
+ }
1880
+ function record(value) {
1881
+ if (!isObject(value)) throw new TypeError("expected a provider object");
1882
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key.toLowerCase(), item]));
1883
+ }
1884
+ function text(value, key) {
1885
+ const field = value[key.toLowerCase()] ?? "";
1886
+ if (typeof field !== "string") throw new TypeError("expected a provider string");
1887
+ return field;
1888
+ }
1889
+ function required(value, key) {
1890
+ const field = text(value, key);
1891
+ if (!field) throw new TypeError("missing metadata field");
1892
+ return field;
1893
+ }
1894
+ function identifier(value, key = "id") {
1895
+ const field = text(value, key);
1896
+ if (!isNumericId(field)) throw new TypeError("invalid metadata ID");
1897
+ return field;
1898
+ }
1899
+ function count(value) {
1900
+ if (!/^[+-]?[0-9]+$/.test(value)) throw new TypeError("invalid count");
1901
+ const parsed = Number(value);
1902
+ if (!isNonnegativeInteger(parsed)) throw new TypeError("count out of range");
1903
+ return parsed || 0;
1904
+ }
1905
+ function account(value) {
1906
+ return { id: identifier(value), name: required(value, "name"), accountUrl: text(value, "accountUrl") };
1907
+ }
1908
+ function tag(value) {
1909
+ const tagType = text(value, "tagType");
1910
+ if (tagType !== "contact") throw new TypeError("expected a contact tag");
1911
+ return {
1912
+ id: identifier(value),
1913
+ name: required(value, "tag"),
1914
+ description: text(value, "description"),
1915
+ tagType
1916
+ };
1917
+ }
1918
+ function mailingList(value, includeCounts) {
1919
+ const active = text(value, "active_subscribers");
1920
+ const nonDeleted = text(value, "non_deleted_subscribers");
1921
+ return {
1922
+ id: identifier(value),
1923
+ name: required(value, "name"),
1924
+ activeSubscribers: includeCounts ? count(active || "0") : 0,
1925
+ nonDeletedSubscribers: includeCounts ? count(nonDeleted || "0") : 0
1926
+ };
1927
+ }
1928
+ function dealNote(value, owner) {
1929
+ const dealId = identifier(value, "relid");
1930
+ if (text(value, "reltype") !== "Deal" || owner !== void 0 && owner !== dealId)
1931
+ throw new TypeError("note belongs to a different resource");
1932
+ return { id: identifier(value), dealId, text: required(value, "note") };
1933
+ }
1934
+ async function getMetadata(client, call, operation, collection, id, field, project, empty, decode = parseJSON) {
1935
+ if (!isNumericId(id)) return terminal(operation, "defect", "VALIDATION", "invalid resource ID", empty);
1936
+ const reply = await client.exchange(call, operation, `/${collection}/${id}`, true);
1937
+ if (reply.retry) return newQueryRetry(reply.failure, reply.retryAfterMs);
1938
+ if (reply.failure) return newQueryBranch(reply.branch, empty, {}, reply.failure);
1939
+ try {
1940
+ return newQueryBranch("found", project(record(record(decode(reply.body))[field.toLowerCase()])));
1941
+ } catch {
1942
+ return invalid(operation, empty);
1943
+ }
1944
+ }
1945
+ async function listMetadata(client, call, operation, collection, input, project, page, options = {}) {
1946
+ const offset = input.offset ?? 0;
1947
+ const limit = input.limit === void 0 || input.limit === 0 ? 20 : input.limit;
1948
+ const empty = options.emptyPage ?? page([], 0, 0, 0);
1949
+ if (!isNonnegativeInteger(offset) || !isPositiveInteger(limit) || limit > 100)
1950
+ return terminal(operation, "defect", "VALIDATION", "invalid page selection", empty);
1951
+ const parameters = new URLSearchParams(options.filters);
1952
+ if (!options.providerPagination || input.limit) parameters.set("limit", String(limit));
1953
+ if (!options.providerPagination || offset) parameters.set("offset", String(offset));
1954
+ parameters.sort();
1955
+ const query = parameters.toString().replace(/\*/g, "%2A").replace(/%7E/g, "~");
1956
+ const resource = options.orderId === void 0 ? "/" + collection : `/ecomOrders/${options.orderId}/orderProducts`;
1957
+ const reply = await client.exchange(
1958
+ call,
1959
+ operation,
1960
+ resource + (query ? "?" + query : ""),
1961
+ options.orderId !== void 0
1962
+ );
1963
+ if (reply.retry) return newQueryRetry(reply.failure, reply.retryAfterMs);
1964
+ if (reply.failure) return newQueryBranch(reply.branch, empty, {}, reply.failure);
1965
+ try {
1966
+ const envelope = record((options.decode ?? parseJSON)(reply.body));
1967
+ const rows = envelope[collection.toLowerCase()];
1968
+ if (!Array.isArray(rows)) return invalid(operation, empty);
1969
+ return newQueryBranch(
1970
+ "listed",
1971
+ page(
1972
+ rows.map((row) => project(record(row))),
1973
+ offset,
1974
+ limit,
1975
+ options.pageTotal ? options.pageTotal(envelope, rows.length) : count(text(record(envelope.meta), "total"))
1976
+ )
1977
+ );
1978
+ } catch {
1979
+ return invalid(operation, empty);
1980
+ }
1981
+ }
1982
+ var ListAccountsOperation = class {
1983
+ /** Bind the provider client. */
1984
+ constructor(client) {
1985
+ this.client = client;
1986
+ }
1987
+ client;
1988
+ /** Return the manifest contract for listAccounts. */
1989
+ definition() {
1990
+ return ListAccountsDefinition;
1991
+ }
1992
+ /** Validate the selection and return public metadata or a classified failure. */
1993
+ async invoke(call, input) {
1994
+ return listMetadata(
1995
+ this.client,
1996
+ call,
1997
+ "listAccounts",
1998
+ "accounts",
1999
+ input,
2000
+ account,
2001
+ (accounts, offset, limit, total) => ({ accounts, offset, limit, total })
2002
+ );
2003
+ }
2004
+ };
2005
+ var GetAccountOperation = class {
2006
+ /** Bind the provider client. */
2007
+ constructor(client) {
2008
+ this.client = client;
2009
+ }
2010
+ client;
2011
+ /** Return the manifest contract for getAccount. */
2012
+ definition() {
2013
+ return GetAccountDefinition;
2014
+ }
2015
+ /** Validate the selection and return public metadata or a classified failure. */
2016
+ async invoke(call, input) {
2017
+ return getMetadata(this.client, call, "getAccount", "accounts", input.accountId, "account", account, {
2018
+ id: "",
2019
+ name: "",
2020
+ accountUrl: ""
2021
+ });
2022
+ }
2023
+ };
2024
+ var ListTagsOperation = class {
2025
+ /** Bind the provider client. */
2026
+ constructor(client) {
2027
+ this.client = client;
2028
+ }
2029
+ client;
2030
+ /** Return the manifest contract for listTags. */
2031
+ definition() {
2032
+ return ListTagsDefinition;
2033
+ }
2034
+ /** Validate the selection and return public metadata or a classified failure. */
2035
+ async invoke(call, input) {
2036
+ return listMetadata(this.client, call, "listTags", "tags", input, tag, (tags, offset, limit, total) => ({
2037
+ tags,
2038
+ offset,
2039
+ limit,
2040
+ total
2041
+ }));
2042
+ }
2043
+ };
2044
+ var GetTagOperation = class {
2045
+ /** Bind the provider client. */
2046
+ constructor(client) {
2047
+ this.client = client;
2048
+ }
2049
+ client;
2050
+ /** Return the manifest contract for getTag. */
2051
+ definition() {
2052
+ return GetTagDefinition;
2053
+ }
2054
+ /** Validate the selection and return public metadata or a classified failure. */
2055
+ async invoke(call, input) {
2056
+ return getMetadata(this.client, call, "getTag", "tags", input.tagId, "tag", tag, {
2057
+ id: "",
2058
+ name: "",
2059
+ description: "",
2060
+ tagType: ""
2061
+ });
2062
+ }
2063
+ };
2064
+ var ListListsOperation = class {
2065
+ /** Bind the provider client. */
2066
+ constructor(client) {
2067
+ this.client = client;
2068
+ }
2069
+ client;
2070
+ /** Return the manifest contract for listLists. */
2071
+ definition() {
2072
+ return ListListsDefinition;
2073
+ }
2074
+ /** Validate the selection and return public metadata or a classified failure. */
2075
+ async invoke(call, input) {
2076
+ return listMetadata(
2077
+ this.client,
2078
+ call,
2079
+ "listLists",
2080
+ "lists",
2081
+ input,
2082
+ (row) => mailingList(row, true),
2083
+ (lists, offset, limit, total) => ({ lists, offset, limit, total })
2084
+ );
2085
+ }
2086
+ };
2087
+ var GetListOperation = class {
2088
+ /** Bind the provider client. */
2089
+ constructor(client) {
2090
+ this.client = client;
2091
+ }
2092
+ client;
2093
+ /** Return the manifest contract for getList. */
2094
+ definition() {
2095
+ return GetListDefinition;
2096
+ }
2097
+ /** Validate the selection and return public metadata or a classified failure. */
2098
+ async invoke(call, input) {
2099
+ return getMetadata(
2100
+ this.client,
2101
+ call,
2102
+ "getList",
2103
+ "lists",
2104
+ input.listId,
2105
+ "list",
2106
+ (row) => mailingList(row, false),
2107
+ { id: "", name: "", activeSubscribers: 0, nonDeletedSubscribers: 0 }
2108
+ );
2109
+ }
2110
+ };
2111
+ var ListDealNotesOperation = class {
2112
+ /** Bind the provider client. */
2113
+ constructor(client) {
2114
+ this.client = client;
2115
+ }
2116
+ client;
2117
+ /** Return the manifest contract for listDealNotes. */
2118
+ definition() {
2119
+ return ListDealNotesDefinition;
2120
+ }
2121
+ /** Validate the selection and return public metadata or a classified failure. */
2122
+ async invoke(call, input) {
2123
+ if (!isNumericId(input.dealId))
2124
+ return terminal("listDealNotes", "defect", "VALIDATION", "invalid deal ID", {
2125
+ notes: [],
2126
+ offset: 0,
2127
+ limit: 0,
2128
+ total: 0
2129
+ });
2130
+ return listMetadata(
2131
+ this.client,
2132
+ call,
2133
+ "listDealNotes",
2134
+ "notes",
2135
+ input,
2136
+ (row) => dealNote(row, input.dealId),
2137
+ (notes, offset, limit, total) => ({ notes, offset, limit, total }),
2138
+ { filters: { "filters[relid]": input.dealId, "filters[reltype]": "Deal" } }
2139
+ );
2140
+ }
2141
+ };
2142
+ var GetDealNoteOperation = class {
2143
+ /** Bind the provider client. */
2144
+ constructor(client) {
2145
+ this.client = client;
2146
+ }
2147
+ client;
2148
+ /** Return the manifest contract for getDealNote. */
2149
+ definition() {
2150
+ return GetDealNoteDefinition;
2151
+ }
2152
+ /** Validate the selection and return public metadata or a classified failure. */
2153
+ async invoke(call, input) {
2154
+ return getMetadata(this.client, call, "getDealNote", "notes", input.noteId, "note", dealNote, {
2155
+ id: "",
2156
+ dealId: "",
2157
+ text: ""
2158
+ });
2159
+ }
2160
+ };
2161
+ function accountContact(row) {
2162
+ return {
2163
+ id: identifier(row),
2164
+ accountId: identifier(row, "account"),
2165
+ contactId: identifier(row, "contact"),
2166
+ jobTitle: text(row, "jobTitle")
2167
+ };
2168
+ }
2169
+ function commerceConnection(row) {
2170
+ return {
2171
+ id: identifier(row),
2172
+ service: required(row, "service"),
2173
+ externalId: required(row, "externalid"),
2174
+ name: required(row, "name"),
2175
+ listId: text(row, "listId")
2176
+ };
2177
+ }
2178
+ function validConnectionFilter(value) {
2179
+ return typeof value === "string" && Buffer.byteLength(value, "utf8") <= 250 && !/[\r\n]/.test(value);
2180
+ }
2181
+ var parseMemberships = integerDocument("status");
2182
+ function contactMembership(row, owner) {
2183
+ const status = typeof row.status === "string" ? count(row.status) : row.status;
2184
+ if (!isNonnegativeInteger(status) || status > 3 || identifier(row, "contact") !== owner)
2185
+ throw new TypeError("invalid contact membership");
2186
+ return { id: identifier(row), contactId: owner, listId: identifier(row, "list"), status };
2187
+ }
2188
+ function contactTag(row, owner) {
2189
+ if (identifier(row, "contact") !== owner) throw new TypeError("tag belongs to a different contact");
2190
+ return { associationId: identifier(row), contactId: owner, tagId: identifier(row, "tag") };
2191
+ }
2192
+ var ListAccountContactsOperation = class {
2193
+ /** Bind the provider client. */
2194
+ constructor(client) {
2195
+ this.client = client;
2196
+ }
2197
+ client;
2198
+ /** Return the manifest-generated Query definition. */
2199
+ definition() {
2200
+ return ListAccountContactsDefinition;
2201
+ }
2202
+ /** Validate the selection and return public metadata or a classified provider outcome. */
2203
+ async invoke(call, input) {
2204
+ const empty = { associations: [], offset: 0, limit: 0, total: 0 };
2205
+ const filters = {};
2206
+ for (const [key, value] of [
2207
+ ["filters[account]", input.accountId],
2208
+ ["filters[contact]", input.contactId]
2209
+ ]) {
2210
+ if (value !== void 0 && value !== "") {
2211
+ if (!isNumericId(value))
2212
+ return terminal(
2213
+ "listAccountContacts",
2214
+ "defect",
2215
+ "VALIDATION",
2216
+ "invalid account or contact ID",
2217
+ empty
2218
+ );
2219
+ filters[key] = value;
2220
+ }
2221
+ }
2222
+ return listMetadata(
2223
+ this.client,
2224
+ call,
2225
+ "listAccountContacts",
2226
+ "accountContacts",
2227
+ input,
2228
+ accountContact,
2229
+ (associations, offset, limit, total) => ({ associations, offset, limit, total }),
2230
+ { filters }
2231
+ );
2232
+ }
2233
+ };
2234
+ var GetAccountContactOperation = class {
2235
+ /** Bind the provider client. */
2236
+ constructor(client) {
2237
+ this.client = client;
2238
+ }
2239
+ client;
2240
+ /** Return the manifest-generated Query definition. */
2241
+ definition() {
2242
+ return GetAccountContactDefinition;
2243
+ }
2244
+ /** Validate the selection and return public metadata or a classified provider outcome. */
2245
+ async invoke(call, input) {
2246
+ return getMetadata(
2247
+ this.client,
2248
+ call,
2249
+ "getAccountContact",
2250
+ "accountContacts",
2251
+ input.associationId,
2252
+ "accountContact",
2253
+ accountContact,
2254
+ { id: "", accountId: "", contactId: "", jobTitle: "" }
2255
+ );
2256
+ }
2257
+ };
2258
+ var ListContactListMembershipsOperation = class {
2259
+ /** Bind the provider client. */
2260
+ constructor(client) {
2261
+ this.client = client;
2262
+ }
2263
+ client;
2264
+ /** Return the manifest-generated Query definition. */
2265
+ definition() {
2266
+ return ListContactListMembershipsDefinition;
2267
+ }
2268
+ /** Validate the selection and return public metadata or a classified provider outcome. */
2269
+ async invoke(call, input) {
2270
+ const emptyPage = { memberships: [], contactId: "", offset: 0, limit: 0, total: 0 };
2271
+ if (!isNumericId(input.contactId))
2272
+ return terminal("listContactListMemberships", "defect", "VALIDATION", "invalid contact ID", emptyPage);
2273
+ return listMetadata(
2274
+ this.client,
2275
+ call,
2276
+ "listContactListMemberships",
2277
+ "contactLists",
2278
+ input,
2279
+ (row) => contactMembership(row, input.contactId),
2280
+ (memberships, offset, limit, total) => ({
2281
+ memberships,
2282
+ contactId: input.contactId,
2283
+ offset,
2284
+ limit,
2285
+ total
2286
+ }),
2287
+ { filters: { contact: input.contactId }, emptyPage, decode: parseMemberships }
2288
+ );
2289
+ }
2290
+ };
2291
+ var ListContactTagsOperation = class {
2292
+ /** Bind the provider client. */
2293
+ constructor(client) {
2294
+ this.client = client;
2295
+ }
2296
+ client;
2297
+ /** Return the manifest-generated Query definition. */
2298
+ definition() {
2299
+ return ListContactTagsDefinition;
2300
+ }
2301
+ /** Validate the selection and return public metadata or a classified provider outcome. */
2302
+ async invoke(call, input) {
2303
+ const empty = { contactId: "", tags: [] };
2304
+ if (!isNumericId(input.contactId))
2305
+ return terminal("listContactTags", "defect", "VALIDATION", "invalid contact ID", empty);
2306
+ const reply = await this.client.exchange(
2307
+ call,
2308
+ "listContactTags",
2309
+ `/contacts/${input.contactId}/contactTags`,
2310
+ true
2311
+ );
2312
+ if (reply.retry) return newQueryRetry(reply.failure, reply.retryAfterMs);
2313
+ if (reply.failure) return newQueryBranch(reply.branch, empty, {}, reply.failure);
2314
+ try {
2315
+ const entries = record(parseJSON(reply.body)).contacttags;
2316
+ if (!Array.isArray(entries)) return invalid("listContactTags", empty);
2317
+ return newQueryBranch("listed", {
2318
+ contactId: input.contactId,
2319
+ tags: entries.map((row) => contactTag(record(row), input.contactId))
2320
+ });
2321
+ } catch {
2322
+ return invalid("listContactTags", empty);
2323
+ }
2324
+ }
2325
+ };
2326
+ var ListConnectionsOperation = class {
2327
+ /** Bind the provider client. */
2328
+ constructor(client) {
2329
+ this.client = client;
2330
+ }
2331
+ client;
2332
+ /** Return the manifest-generated Query definition. */
2333
+ definition() {
2334
+ return ListConnectionsDefinition;
2335
+ }
2336
+ /** Validate the selection and return public metadata or a classified provider outcome. */
2337
+ async invoke(call, input) {
2338
+ const service = input.service ?? "", externalId = input.externalId ?? "";
2339
+ if (!validConnectionFilter(service) || !validConnectionFilter(externalId))
2340
+ return terminal("listConnections", "defect", "VALIDATION", "invalid service or external ID", {
2341
+ connections: [],
2342
+ total: 0
2343
+ });
2344
+ const filters = {};
2345
+ if (service) filters["filters[service]"] = service;
2346
+ if (externalId) filters["filters[externalid]"] = externalId;
2347
+ return listMetadata(
2348
+ this.client,
2349
+ call,
2350
+ "listConnections",
2351
+ "connections",
2352
+ input,
2353
+ commerceConnection,
2354
+ (connections, _offset, _limit, total) => ({ connections, total }),
2355
+ { filters, providerPagination: true }
2356
+ );
2357
+ }
2358
+ };
2359
+ var GetConnectionOperation = class {
2360
+ /** Bind the provider client. */
2361
+ constructor(client) {
2362
+ this.client = client;
2363
+ }
2364
+ client;
2365
+ /** Return the manifest-generated Query definition. */
2366
+ definition() {
2367
+ return GetConnectionDefinition;
2368
+ }
2369
+ /** Validate the selection and return public metadata or a classified provider outcome. */
2370
+ async invoke(call, input) {
2371
+ return getMetadata(
2372
+ this.client,
2373
+ call,
2374
+ "getConnection",
2375
+ "connections",
2376
+ input.connectionId,
2377
+ "connection",
2378
+ commerceConnection,
2379
+ { id: "", service: "", externalId: "", name: "", listId: "" }
2380
+ );
2381
+ }
2382
+ };
2383
+ function integerDocument(...rawFields) {
2384
+ const fields = new Set(rawFields);
2385
+ return (body) => JSON.parse(
2386
+ Buffer.from(body).toString("utf8"),
2387
+ (key, value, context) => {
2388
+ if (!fields.has(key.toLowerCase())) return value;
2389
+ if (typeof value === "number") {
2390
+ if (!/^-?[0-9]+$/.test(context?.source ?? "")) return NaN;
2391
+ if (key.toLowerCase() === "value" && !Number.isSafeInteger(value)) return context.source;
2392
+ }
2393
+ if (typeof value === "string" && context?.source?.includes("\\")) return NaN;
2394
+ return value;
2395
+ }
2396
+ );
2397
+ }
2398
+ var parseDeals = integerDocument("value", "status", "total");
2399
+ var parseOrders = integerDocument("totalprice", "state");
2400
+ var parseProducts = integerDocument("price", "quantity");
2401
+ function providerInteger(value, minimum = Number.MIN_SAFE_INTEGER, maximum = Number.MAX_SAFE_INTEGER) {
2402
+ const number = typeof value === "string" && /^[+-]?[0-9]+$/.test(value) ? Number(value) : value;
2403
+ if (typeof number !== "number" || !Number.isSafeInteger(number) || number < minimum || number > maximum)
2404
+ throw new TypeError("invalid provider integer");
2405
+ return number || 0;
2406
+ }
2407
+ function dealTotal(envelope) {
2408
+ return providerInteger(record(envelope.meta).total, 0);
2409
+ }
2410
+ function productTotal(envelope, size) {
2411
+ return envelope.meta == null ? size : count(text(record(envelope.meta), "total"));
2412
+ }
2413
+ function dealAmount(value) {
2414
+ if (typeof value === "string") {
2415
+ if (!/^[+-]?[0-9]+$/.test(value)) throw new TypeError("invalid deal amount");
2416
+ const integer = BigInt(value);
2417
+ if (integer < -(1n << 63n) || integer >= 1n << 63n) throw new RangeError("deal amount exceeds int64");
2418
+ const raw = JSON;
2419
+ return decodeSignedInteger(raw.rawJSON(integer.toString()));
2420
+ }
2421
+ return decodeSignedInteger(value);
2422
+ }
2423
+ function nonnegativeDealAmount(value) {
2424
+ try {
2425
+ const exact = decodeSignedInteger(value);
2426
+ return typeof exact === "number" ? exact >= 0 : !exact.rawJSON.startsWith("-");
2427
+ } catch {
2428
+ return false;
2429
+ }
2430
+ }
2431
+ function deal(row) {
2432
+ return {
2433
+ id: identifier(row),
2434
+ title: required(row, "title"),
2435
+ contactId: text(row, "contact"),
2436
+ stageId: text(row, "stage"),
2437
+ currency: text(row, "currency").toUpperCase(),
2438
+ valueMinor: dealAmount(row.value === void 0 ? 0 : row.value),
2439
+ status: providerInteger(row.status === void 0 ? 0 : row.status, 0, 2)
2440
+ };
2441
+ }
2442
+ var mailboxSpecials = new Set('()<>[]:;@\\,"');
2443
+ function emailAtom(part) {
2444
+ if (!part || part.startsWith(".") || part.endsWith(".") || part.includes("..")) return false;
2445
+ return [...part].every(
2446
+ (ch) => ch.charCodeAt(0) >= 33 && ch.charCodeAt(0) !== 127 && !mailboxSpecials.has(ch)
2447
+ );
2448
+ }
2449
+ function validCustomerEmail(email) {
2450
+ if (typeof email !== "string" || email.trim() !== email) return false;
2451
+ const parts = email.split("@");
2452
+ if (parts.length !== 2 || !emailAtom(parts[0])) return false;
2453
+ const domain = parts[1];
2454
+ if (domain.startsWith("[") && domain.endsWith("]")) {
2455
+ const literal = domain.slice(1, -1);
2456
+ return !literal.includes("%") && isIP(literal) !== 0;
2457
+ }
2458
+ return emailAtom(domain);
2459
+ }
2460
+ function customerEmail(row) {
2461
+ const email = text(row, "email");
2462
+ if (!validCustomerEmail(email)) throw new TypeError("invalid buyer email");
2463
+ return email;
2464
+ }
2465
+ function commerceFilters(input) {
2466
+ const { connectionId = "", externalId = "", email = "" } = input;
2467
+ if (connectionId && !isNumericId(connectionId) || !validConnectionFilter(externalId) || email && !validCustomerEmail(email))
2468
+ return void 0;
2469
+ const filters = {};
2470
+ if (connectionId) filters["filters[connectionid]"] = connectionId;
2471
+ if (externalId) filters["filters[externalid]"] = externalId;
2472
+ if (email) filters["filters[email]"] = email;
2473
+ return filters;
2474
+ }
2475
+ function customer(row) {
2476
+ return {
2477
+ id: identifier(row),
2478
+ connectionId: identifier(row, "connectionid"),
2479
+ externalId: required(row, "externalid"),
2480
+ email: customerEmail(row)
2481
+ };
2482
+ }
2483
+ function ecommerceOrder(row) {
2484
+ const currency = text(row, "currency");
2485
+ if (Buffer.byteLength(currency, "utf8") !== 3) throw new TypeError("invalid currency");
2486
+ return {
2487
+ id: identifier(row),
2488
+ connectionId: identifier(row, "connectionid"),
2489
+ externalId: required(row, "externalid"),
2490
+ customerId: identifier(row, "customerid"),
2491
+ email: customerEmail(row),
2492
+ currency,
2493
+ totalMinor: providerInteger(row.totalprice),
2494
+ state: providerInteger(row.state, 0, 9)
2495
+ };
2496
+ }
2497
+ function orderProduct(row) {
2498
+ return {
2499
+ id: identifier(row),
2500
+ orderId: identifier(row, "orderid"),
2501
+ externalId: required(row, "externalid"),
2502
+ name: required(row, "name"),
2503
+ priceMinor: providerInteger(row.price),
2504
+ quantity: providerInteger(row.quantity, 0)
2505
+ };
2506
+ }
2507
+ var ListDealsOperation = class {
2508
+ /** Bind the provider client. */
2509
+ constructor(client) {
2510
+ this.client = client;
2511
+ }
2512
+ client;
2513
+ /** Return the manifest-generated Query contract. */
2514
+ definition() {
2515
+ return ListDealsDefinition;
2516
+ }
2517
+ /** Validate the selection and project the provider response. */
2518
+ async invoke(call, input) {
2519
+ return listMetadata(
2520
+ this.client,
2521
+ call,
2522
+ "listDeals",
2523
+ "deals",
2524
+ input,
2525
+ deal,
2526
+ (deals, offset, limit, total) => ({ deals, offset, limit, total }),
2527
+ { decode: parseDeals, pageTotal: dealTotal }
2528
+ );
2529
+ }
2530
+ };
2531
+ var GetDealOperation = class {
2532
+ /** Bind the provider client. */
2533
+ constructor(client) {
2534
+ this.client = client;
2535
+ }
2536
+ client;
2537
+ /** Return the manifest-generated Query contract. */
2538
+ definition() {
2539
+ return GetDealDefinition;
2540
+ }
2541
+ /** Validate the selection and project the provider response. */
2542
+ async invoke(call, input) {
2543
+ return getMetadata(
2544
+ this.client,
2545
+ call,
2546
+ "getDeal",
2547
+ "deals",
2548
+ input.dealId,
2549
+ "deal",
2550
+ deal,
2551
+ { id: "", title: "", contactId: "", stageId: "", currency: "", valueMinor: 0, status: 0 },
2552
+ parseDeals
2553
+ );
2554
+ }
2555
+ };
2556
+ var ListEcommerceCustomersOperation = class {
2557
+ /** Bind the provider client. */
2558
+ constructor(client) {
2559
+ this.client = client;
2560
+ }
2561
+ client;
2562
+ /** Return the manifest-generated Query contract. */
2563
+ definition() {
2564
+ return ListEcommerceCustomersDefinition;
2565
+ }
2566
+ /** Validate the selection and project the provider response. */
2567
+ async invoke(call, input) {
2568
+ const filters = commerceFilters(input);
2569
+ if (!filters)
2570
+ return terminal(
2571
+ "listEcommerceCustomers",
2572
+ "defect",
2573
+ "VALIDATION",
2574
+ "invalid connection, external ID or buyer email",
2575
+ { customers: [], total: 0 }
2576
+ );
2577
+ return listMetadata(
2578
+ this.client,
2579
+ call,
2580
+ "listEcommerceCustomers",
2581
+ "ecomCustomers",
2582
+ input,
2583
+ customer,
2584
+ (customers, _offset, _limit, total) => ({ customers, total }),
2585
+ { filters, providerPagination: true }
2586
+ );
2587
+ }
2588
+ };
2589
+ var GetEcommerceCustomerOperation = class {
2590
+ /** Bind the provider client. */
2591
+ constructor(client) {
2592
+ this.client = client;
2593
+ }
2594
+ client;
2595
+ /** Return the manifest-generated Query contract. */
2596
+ definition() {
2597
+ return GetEcommerceCustomerDefinition;
2598
+ }
2599
+ /** Validate the selection and project the provider response. */
2600
+ async invoke(call, input) {
2601
+ return getMetadata(
2602
+ this.client,
2603
+ call,
2604
+ "getEcommerceCustomer",
2605
+ "ecomCustomers",
2606
+ input.customerId,
2607
+ "ecomCustomer",
2608
+ customer,
2609
+ { id: "", connectionId: "", externalId: "", email: "" }
2610
+ );
2611
+ }
2612
+ };
2613
+ var ListEcommerceOrdersOperation = class {
2614
+ /** Bind the provider client. */
2615
+ constructor(client) {
2616
+ this.client = client;
2617
+ }
2618
+ client;
2619
+ /** Return the manifest-generated Query contract. */
2620
+ definition() {
2621
+ return ListEcommerceOrdersDefinition;
2622
+ }
2623
+ /** Validate the selection and project the provider response. */
2624
+ async invoke(call, input) {
2625
+ const filters = commerceFilters(input);
2626
+ if (!filters)
2627
+ return terminal(
2628
+ "listEcommerceOrders",
2629
+ "defect",
2630
+ "VALIDATION",
2631
+ "invalid connection, external ID or buyer email",
2632
+ { orders: [], total: 0 }
2633
+ );
2634
+ return listMetadata(
2635
+ this.client,
2636
+ call,
2637
+ "listEcommerceOrders",
2638
+ "ecomOrders",
2639
+ input,
2640
+ ecommerceOrder,
2641
+ (orders, _offset, _limit, total) => ({ orders, total }),
2642
+ { filters, providerPagination: true, decode: parseOrders }
2643
+ );
2644
+ }
2645
+ };
2646
+ var GetEcommerceOrderOperation = class {
2647
+ /** Bind the provider client. */
2648
+ constructor(client) {
2649
+ this.client = client;
2650
+ }
2651
+ client;
2652
+ /** Return the manifest-generated Query contract. */
2653
+ definition() {
2654
+ return GetEcommerceOrderDefinition;
2655
+ }
2656
+ /** Validate the selection and project the provider response. */
2657
+ async invoke(call, input) {
2658
+ return getMetadata(
2659
+ this.client,
2660
+ call,
2661
+ "getEcommerceOrder",
2662
+ "ecomOrders",
2663
+ input.orderId,
2664
+ "ecomOrder",
2665
+ ecommerceOrder,
2666
+ {
2667
+ id: "",
2668
+ connectionId: "",
2669
+ externalId: "",
2670
+ customerId: "",
2671
+ email: "",
2672
+ currency: "",
2673
+ totalMinor: 0,
2674
+ state: 0
2675
+ },
2676
+ parseOrders
2677
+ );
2678
+ }
2679
+ };
2680
+ var ListEcommerceOrderProductsOperation = class {
2681
+ /** Bind the provider client. */
2682
+ constructor(client) {
2683
+ this.client = client;
2684
+ }
2685
+ client;
2686
+ /** Return the manifest-generated Query contract. */
2687
+ definition() {
2688
+ return ListEcommerceOrderProductsDefinition;
2689
+ }
2690
+ /** Validate the selection and project the provider response. */
2691
+ async invoke(call, input) {
2692
+ return listMetadata(
2693
+ this.client,
2694
+ call,
2695
+ "listEcommerceOrderProducts",
2696
+ "ecomOrderProducts",
2697
+ input,
2698
+ orderProduct,
2699
+ (products, _offset, _limit, total) => ({ products, total }),
2700
+ { providerPagination: true, decode: parseProducts, pageTotal: productTotal }
2701
+ );
2702
+ }
2703
+ };
2704
+ var GetEcommerceOrderProductOperation = class {
2705
+ /** Bind the provider client. */
2706
+ constructor(client) {
2707
+ this.client = client;
2708
+ }
2709
+ client;
2710
+ /** Return the manifest-generated Query contract. */
2711
+ definition() {
2712
+ return GetEcommerceOrderProductDefinition;
2713
+ }
2714
+ /** Validate the selection and project the provider response. */
2715
+ async invoke(call, input) {
2716
+ return getMetadata(
2717
+ this.client,
2718
+ call,
2719
+ "getEcommerceOrderProduct",
2720
+ "ecomOrderProducts",
2721
+ input.productId,
2722
+ "ecomOrderProduct",
2723
+ orderProduct,
2724
+ { id: "", orderId: "", externalId: "", name: "", priceMinor: 0, quantity: 0 },
2725
+ parseProducts
2726
+ );
2727
+ }
2728
+ };
2729
+ var ListProductsForEcommerceOrderOperation = class {
2730
+ /** Bind the provider client. */
2731
+ constructor(client) {
2732
+ this.client = client;
2733
+ }
2734
+ client;
2735
+ /** Return the manifest-generated Query contract. */
2736
+ definition() {
2737
+ return ListProductsForEcommerceOrderDefinition;
2738
+ }
2739
+ /** Validate the selection and project the provider response. */
2740
+ async invoke(call, input) {
2741
+ if (!isNumericId(input.orderId))
2742
+ return terminal("listProductsForEcommerceOrder", "defect", "VALIDATION", "invalid order ID", {
2743
+ products: [],
2744
+ total: 0
2745
+ });
2746
+ return listMetadata(
2747
+ this.client,
2748
+ call,
2749
+ "listProductsForEcommerceOrder",
2750
+ "ecomOrderProducts",
2751
+ input,
2752
+ orderProduct,
2753
+ (products, _offset, _limit, total) => ({ products, total }),
2754
+ { providerPagination: true, decode: parseProducts, pageTotal: productTotal, orderId: input.orderId }
2755
+ );
2756
+ }
2757
+ };
2758
+ function isDefiniteRefusal(status, body) {
2759
+ if (![400, 401, 403, 404, 411, 413, 414, 415, 422].includes(status)) return false;
2760
+ try {
2761
+ const document = JSON.parse(new TextDecoder("utf-8", { ignoreBOM: true }).decode(body));
2762
+ return Array.isArray(document?.errors) && document.errors.length > 0 && ![
2763
+ "account",
2764
+ "accountContact",
2765
+ "connection",
2766
+ "contact",
2767
+ "deal",
2768
+ "ecomCustomer",
2769
+ "note",
2770
+ "contactList",
2771
+ "tag"
2772
+ ].some((key) => Object.hasOwn(document, key));
2773
+ } catch {
2774
+ return false;
2775
+ }
2776
+ }
2777
+ var DeleteAccountOperation = class {
2778
+ /** Bind the authenticated provider client. */
2779
+ constructor(client) {
2780
+ this.client = client;
2781
+ }
2782
+ client;
2783
+ /** Return the generated deleteAccount contract. */
2784
+ definition() {
2785
+ return DeleteAccountDefinition;
2786
+ }
2787
+ /** Use the stable Dex Call ID to correlate deletion attempts. */
2788
+ idempotencyKey(callId) {
2789
+ return callId;
2790
+ }
2791
+ /** Delete the selected account or confirm its absence. */
2792
+ invoke(call, input) {
2793
+ return this.client.deleteResource(
2794
+ call,
2795
+ "deleteAccount",
2796
+ "accounts",
2797
+ input.accountId,
2798
+ "account",
2799
+ { accountId: input.accountId, deleted: true },
2800
+ { accountId: "", deleted: false }
2801
+ );
2802
+ }
2803
+ };
2804
+ var DeleteAccountContactOperation = class {
2805
+ /** Bind the authenticated provider client. */
2806
+ constructor(client) {
2807
+ this.client = client;
2808
+ }
2809
+ client;
2810
+ /** Return the generated deleteAccountContact contract. */
2811
+ definition() {
2812
+ return DeleteAccountContactDefinition;
2813
+ }
2814
+ /** Use the stable Dex Call ID to correlate deletion attempts. */
2815
+ idempotencyKey(callId) {
2816
+ return callId;
2817
+ }
2818
+ /** Delete the selected link or confirm its absence. */
2819
+ invoke(call, input) {
2820
+ return this.client.deleteResource(
2821
+ call,
2822
+ "deleteAccountContact",
2823
+ "accountContacts",
2824
+ input.associationId,
2825
+ "link",
2826
+ { associationId: input.associationId, deleted: true },
2827
+ { associationId: "", deleted: false }
2828
+ );
2829
+ }
2830
+ };
2831
+ var DeleteConnectionOperation = class {
2832
+ /** Bind the authenticated provider client. */
2833
+ constructor(client) {
2834
+ this.client = client;
2835
+ }
2836
+ client;
2837
+ /** Return the generated deleteConnection contract. */
2838
+ definition() {
2839
+ return DeleteConnectionDefinition;
2840
+ }
2841
+ /** Use the stable Dex Call ID to correlate deletion attempts. */
2842
+ idempotencyKey(callId) {
2843
+ return callId;
2844
+ }
2845
+ /** Delete the selected connection or confirm its absence. */
2846
+ invoke(call, input) {
2847
+ return this.client.deleteResource(
2848
+ call,
2849
+ "deleteConnection",
2850
+ "connections",
2851
+ input.connectionId,
2852
+ "connection",
2853
+ { connectionId: input.connectionId, deleted: true },
2854
+ { connectionId: "", deleted: false }
2855
+ );
2856
+ }
2857
+ };
2858
+ var DeleteDealOperation = class {
2859
+ /** Bind the authenticated provider client. */
2860
+ constructor(client) {
2861
+ this.client = client;
2862
+ }
2863
+ client;
2864
+ /** Return the generated deleteDeal contract. */
2865
+ definition() {
2866
+ return DeleteDealDefinition;
2867
+ }
2868
+ /** Use the stable Dex Call ID to correlate deletion attempts. */
2869
+ idempotencyKey(callId) {
2870
+ return callId;
2871
+ }
2872
+ /** Delete the selected deal or confirm its absence. */
2873
+ invoke(call, input) {
2874
+ return this.client.deleteResource(
2875
+ call,
2876
+ "deleteDeal",
2877
+ "deals",
2878
+ input.dealId,
2879
+ "deal",
2880
+ { dealId: input.dealId, deleted: true },
2881
+ { dealId: "", deleted: false }
2882
+ );
2883
+ }
2884
+ };
2885
+ var DeleteEcommerceCustomerOperation = class {
2886
+ /** Bind the authenticated provider client. */
2887
+ constructor(client) {
2888
+ this.client = client;
2889
+ }
2890
+ client;
2891
+ /** Return the generated deleteEcommerceCustomer contract. */
2892
+ definition() {
2893
+ return DeleteEcommerceCustomerDefinition;
2894
+ }
2895
+ /** Use the stable Dex Call ID to correlate deletion attempts. */
2896
+ idempotencyKey(callId) {
2897
+ return callId;
2898
+ }
2899
+ /** Delete the selected customer or confirm its absence. */
2900
+ invoke(call, input) {
2901
+ return this.client.deleteResource(
2902
+ call,
2903
+ "deleteEcommerceCustomer",
2904
+ "ecomCustomers",
2905
+ input.customerId,
2906
+ "customer",
2907
+ { customerId: input.customerId, deleted: true },
2908
+ { customerId: "", deleted: false }
2909
+ );
2910
+ }
2911
+ };
2912
+ var DeleteTagOperation = class {
2913
+ /** Bind the authenticated provider client. */
2914
+ constructor(client) {
2915
+ this.client = client;
2916
+ }
2917
+ client;
2918
+ /** Return the generated deleteTag contract. */
2919
+ definition() {
2920
+ return DeleteTagDefinition;
2921
+ }
2922
+ /** Use the stable Dex Call ID to correlate deletion attempts. */
2923
+ idempotencyKey(callId) {
2924
+ return callId;
2925
+ }
2926
+ /** Delete the selected tag or confirm its absence. */
2927
+ invoke(call, input) {
2928
+ return this.client.deleteResource(
2929
+ call,
2930
+ "deleteTag",
2931
+ "tags",
2932
+ input.tagId,
2933
+ "tag",
2934
+ { tagId: input.tagId, deleted: true },
2935
+ { tagId: "", deleted: false }
2936
+ );
2937
+ }
2938
+ };
2939
+ function writeContact(row) {
2940
+ return {
2941
+ id: identifier(row),
2942
+ email: text(row, "email"),
2943
+ firstName: text(row, "firstName"),
2944
+ lastName: text(row, "lastName")
2945
+ };
2946
+ }
2947
+ function validAccountUrl(value) {
2948
+ if (!value) return true;
2949
+ if ([...value].some((ch) => ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127) || /%(?![0-9a-fA-F]{2})/u.test(value))
2950
+ return false;
2951
+ const parts = /^https:\/\/([^/?#]+)(?:\/[^?#]*)?(?:\?)?(?:#)?$/iu.exec(value);
2952
+ return !!parts && !/[ @<>^|\\{}]/u.test(parts[1]) && /^(?:\[[^\]]+\]|[^:]+)(?::[0-9]*)?$/u.test(parts[1]);
2953
+ }
2954
+ function validUpdateLabel(value) {
2955
+ return /\P{White_Space}/u.test(value) && Buffer.byteLength(value) <= 250 && !/[\r\n]/u.test(value);
2956
+ }
2957
+ var UpdateAccountOperation = class {
2958
+ /** Bind the authenticated provider client. */
2959
+ constructor(client) {
2960
+ this.client = client;
2961
+ }
2962
+ client;
2963
+ /** Return the generated updateAccount contract. */
2964
+ definition() {
2965
+ return UpdateAccountDefinition;
2966
+ }
2967
+ /** Use the stable Dex Call ID across attempts. */
2968
+ idempotencyKey(callId) {
2969
+ return callId;
2970
+ }
2971
+ /** Apply the supplied fields and return the confirmed account. */
2972
+ async invoke(call, input) {
2973
+ const empty = { id: "", name: "", accountUrl: "" };
2974
+ if (!isNumericId(input.accountId) || input.name === void 0 && input.accountUrl === void 0 || input.name !== void 0 && !validUpdateLabel(input.name) || input.accountUrl !== void 0 && !validAccountUrl(input.accountUrl))
2975
+ return newMutationBranch(
2976
+ "defect",
2977
+ empty,
2978
+ {},
2979
+ failure("updateAccount", "VALIDATION", "invalid account replacement fields")
2980
+ );
2981
+ return this.client.writeResource(
2982
+ call,
2983
+ "updateAccount",
2984
+ "PUT",
2985
+ "/accounts/" + input.accountId,
2986
+ "account",
2987
+ { name: input.name, accountUrl: input.accountUrl },
2988
+ account,
2989
+ empty,
2990
+ input.accountId
2991
+ );
2992
+ }
2993
+ };
2994
+ var UpdateAccountContactOperation = class {
2995
+ /** Bind the authenticated provider client. */
2996
+ constructor(client) {
2997
+ this.client = client;
2998
+ }
2999
+ client;
3000
+ /** Return the generated updateAccountContact contract. */
3001
+ definition() {
3002
+ return UpdateAccountContactDefinition;
3003
+ }
3004
+ /** Use the stable Dex Call ID across attempts. */
3005
+ idempotencyKey(callId) {
3006
+ return callId;
3007
+ }
3008
+ /** Apply the supplied fields and return the confirmed accountContact. */
3009
+ async invoke(call, input) {
3010
+ const empty = { id: "", accountId: "", contactId: "", jobTitle: "" };
3011
+ if (!isNumericId(input.associationId) || input.accountId === void 0 && input.jobTitle === void 0 || input.accountId !== void 0 && !isNumericId(input.accountId) || input.jobTitle !== void 0 && !(Buffer.byteLength(input.jobTitle) <= 250 && !/[\r\n]/u.test(input.jobTitle)))
3012
+ return newMutationBranch(
3013
+ "defect",
3014
+ empty,
3015
+ {},
3016
+ failure("updateAccountContact", "VALIDATION", "invalid accountContact replacement fields")
3017
+ );
3018
+ return this.client.writeResource(
3019
+ call,
3020
+ "updateAccountContact",
3021
+ "PUT",
3022
+ "/accountContacts/" + input.associationId,
3023
+ "accountContact",
3024
+ { account: input.accountId, jobTitle: input.jobTitle },
3025
+ accountContact,
3026
+ empty,
3027
+ input.associationId
3028
+ );
3029
+ }
3030
+ };
3031
+ var UpdateConnectionOperation = class {
3032
+ /** Bind the authenticated provider client. */
3033
+ constructor(client) {
3034
+ this.client = client;
3035
+ }
3036
+ client;
3037
+ /** Return the generated updateConnection contract. */
3038
+ definition() {
3039
+ return UpdateConnectionDefinition;
3040
+ }
3041
+ /** Use the stable Dex Call ID across attempts. */
3042
+ idempotencyKey(callId) {
3043
+ return callId;
3044
+ }
3045
+ /** Apply the supplied fields and return the confirmed connection. */
3046
+ async invoke(call, input) {
3047
+ const empty = { id: "", service: "", externalId: "", name: "", listId: "" };
3048
+ if (!isNumericId(input.connectionId) || input.service === void 0 && input.externalId === void 0 && input.name === void 0 && input.listId === void 0 || input.service !== void 0 && !validUpdateLabel(input.service) || input.externalId !== void 0 && !validUpdateLabel(input.externalId) || input.name !== void 0 && !validUpdateLabel(input.name) || input.listId !== void 0 && !isNumericId(input.listId))
3049
+ return newMutationBranch(
3050
+ "defect",
3051
+ empty,
3052
+ {},
3053
+ failure("updateConnection", "VALIDATION", "invalid connection replacement fields")
3054
+ );
3055
+ return this.client.writeResource(
3056
+ call,
3057
+ "updateConnection",
3058
+ "PUT",
3059
+ "/connections/" + input.connectionId,
3060
+ "connection",
3061
+ { service: input.service, externalid: input.externalId, name: input.name, listId: input.listId },
3062
+ commerceConnection,
3063
+ empty,
3064
+ input.connectionId
3065
+ );
3066
+ }
3067
+ };
3068
+ var UpdateContactOperation = class {
3069
+ /** Bind the authenticated provider client. */
3070
+ constructor(client) {
3071
+ this.client = client;
77
3072
  }
78
- credentials;
79
- baseUrl;
80
- timeoutMs;
81
- maxResponseBytes;
82
- sendRequest;
83
- /** Bind the contact page Query. */
84
- listContacts() {
85
- return new ListContactsOperation(this);
3073
+ client;
3074
+ /** Return the generated updateContact contract. */
3075
+ definition() {
3076
+ return UpdateContactDefinition;
86
3077
  }
87
- /** Bind the contact metadata Query. */
88
- getContact() {
89
- return new GetContactOperation(this);
3078
+ /** Use the stable Dex Call ID across attempts. */
3079
+ idempotencyKey(callId) {
3080
+ return callId;
90
3081
  }
91
- /** Send one read and classify transport, HTTP, and response-size outcomes. */
92
- async exchange(call, operation, path, hasNotFound) {
93
- let apiKey;
94
- try {
95
- const resolved = await this.credentials.resolve(call, call.context.cancellationSignal);
96
- apiKey = resolved.apiKey instanceof SecretString ? resolved.apiKey.reveal() : "";
97
- } catch {
98
- return { branch: "defect", failure: failure(operation, "AUTHENTICATION", "connection credentials are unavailable or invalid") };
99
- }
100
- if (!apiKey || !isHeaderSafeCredential(apiKey)) return { branch: "defect", failure: failure(operation, "AUTHENTICATION", "connection credentials are unavailable or invalid") };
101
- const request = {
102
- url: `${this.baseUrl}${path}`,
103
- method: "GET",
104
- headers: { Accept: "application/json", "Api-Token": apiKey },
105
- maxResponseBytes: this.maxResponseBytes,
106
- timeoutMs: this.timeoutMs,
107
- addressPolicy: this.baseUrl.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP",
108
- signal: call.context.cancellationSignal
3082
+ /** Apply the supplied fields and return the confirmed contact. */
3083
+ async invoke(call, input) {
3084
+ const empty = { id: "", email: "", firstName: "", lastName: "" };
3085
+ if (!isNumericId(input.contactId) || input.email === void 0 && input.firstName === void 0 && input.lastName === void 0 || input.email !== void 0 && !validCustomerEmail(input.email))
3086
+ return newMutationBranch(
3087
+ "defect",
3088
+ empty,
3089
+ {},
3090
+ failure("updateContact", "VALIDATION", "invalid contact replacement fields")
3091
+ );
3092
+ return this.client.writeResource(
3093
+ call,
3094
+ "updateContact",
3095
+ "PUT",
3096
+ "/contacts/" + input.contactId,
3097
+ "contact",
3098
+ { email: input.email, firstName: input.firstName, lastName: input.lastName },
3099
+ writeContact,
3100
+ empty
3101
+ );
3102
+ }
3103
+ };
3104
+ var SyncContactOperation = class {
3105
+ /** Bind the authenticated provider client. */
3106
+ constructor(client) {
3107
+ this.client = client;
3108
+ }
3109
+ client;
3110
+ /** Return the generated syncContact contract. */
3111
+ definition() {
3112
+ return SyncContactDefinition;
3113
+ }
3114
+ /** Use the stable Dex Call ID across attempts. */
3115
+ idempotencyKey(callId) {
3116
+ return callId;
3117
+ }
3118
+ /** Apply the supplied fields and return the confirmed contact. */
3119
+ async invoke(call, input) {
3120
+ const empty = { id: "", email: "", firstName: "", lastName: "" };
3121
+ if (!validCustomerEmail(input.email))
3122
+ return newMutationBranch(
3123
+ "defect",
3124
+ empty,
3125
+ {},
3126
+ failure("syncContact", "VALIDATION", "invalid contact replacement fields")
3127
+ );
3128
+ return this.client.writeResource(
3129
+ call,
3130
+ "syncContact",
3131
+ "POST",
3132
+ "/contact/sync",
3133
+ "contact",
3134
+ { email: input.email, firstName: input.firstName, lastName: input.lastName },
3135
+ writeContact,
3136
+ empty
3137
+ );
3138
+ }
3139
+ };
3140
+ var UpdateDealOperation = class {
3141
+ /** Bind the authenticated provider client. */
3142
+ constructor(client) {
3143
+ this.client = client;
3144
+ }
3145
+ client;
3146
+ /** Return the generated updateDeal contract. */
3147
+ definition() {
3148
+ return UpdateDealDefinition;
3149
+ }
3150
+ /** Use the stable Dex Call ID across attempts. */
3151
+ idempotencyKey(callId) {
3152
+ return callId;
3153
+ }
3154
+ /** Apply the supplied fields and return the confirmed deal. */
3155
+ async invoke(call, input) {
3156
+ const empty = {
3157
+ id: "",
3158
+ title: "",
3159
+ contactId: "",
3160
+ stageId: "",
3161
+ valueMinor: 0,
3162
+ currency: "",
3163
+ status: 0
109
3164
  };
110
- let response;
111
- try {
112
- response = await this.sendRequest(request);
113
- } catch (error) {
114
- if (error instanceof BodyTooLargeError && error.status !== void 0) {
115
- response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
116
- if (response.status === 200) return { branch: "invalidResponse", failure: failure(operation, "RESPONSE_TOO_LARGE", "ActiveCampaign response exceeded the configured limit") };
117
- } else return { retry: true, failure: failure(operation, "TRANSPORT", "ActiveCampaign request failed") };
118
- }
119
- const status = response.status;
120
- const retryAfter = headerValue(response.headers["retry-after"]);
121
- if (status === 429) return { retry: true, retryAfterMs: parseRetryAfter(retryAfter), failure: failure(operation, "RATE_LIMIT", "ActiveCampaign rate limited the request") };
122
- if (status === 408 || status >= 500) return { retry: true, retryAfterMs: parseRetryAfter(retryAfter), failure: failure(operation, "AVAILABILITY", "ActiveCampaign is temporarily unavailable") };
123
- if (status === 404 && hasNotFound) return { branch: "notFound", failure: failure(operation, "NOT_FOUND", "ActiveCampaign did not find the resource") };
124
- if (status !== 200) return { branch: "providerRejected", failure: failure(operation, "PROVIDER_REJECTION", `ActiveCampaign rejected HTTP ${status}`) };
125
- if (response.body.length > this.maxResponseBytes) return { branch: "invalidResponse", failure: failure(operation, "RESPONSE_TOO_LARGE", "ActiveCampaign response exceeded the configured limit") };
126
- return { body: response.body };
3165
+ if (!isNumericId(input.dealId) || input.title === void 0 && input.stageId === void 0 && input.valueMinor === void 0 && input.currency === void 0 && input.status === void 0 || input.title !== void 0 && !(input.title.trim() && Buffer.byteLength(input.title) <= 250) || input.stageId !== void 0 && !isNumericId(input.stageId) || input.valueMinor !== void 0 && !nonnegativeDealAmount(input.valueMinor) || input.currency !== void 0 && !(/^[A-Z]{3}$/u.test(input.currency) && input.currency.length === 3) || input.status !== void 0 && !(isNonnegativeInteger(input.status) && input.status <= 2))
3166
+ return newMutationBranch(
3167
+ "defect",
3168
+ empty,
3169
+ {},
3170
+ failure("updateDeal", "VALIDATION", "invalid deal replacement fields")
3171
+ );
3172
+ return this.client.writeResource(
3173
+ call,
3174
+ "updateDeal",
3175
+ "PUT",
3176
+ "/deals/" + input.dealId,
3177
+ "deal",
3178
+ {
3179
+ title: input.title,
3180
+ stage: input.stageId,
3181
+ value: input.valueMinor,
3182
+ currency: input.currency?.toLowerCase(),
3183
+ status: input.status
3184
+ },
3185
+ deal,
3186
+ empty
3187
+ );
127
3188
  }
128
3189
  };
129
- var ListContactsOperation = class {
130
- /** Bind the provider client. */
3190
+ var UpdateDealNoteOperation = class {
3191
+ /** Bind the authenticated provider client. */
131
3192
  constructor(client) {
132
3193
  this.client = client;
133
3194
  }
134
3195
  client;
135
- /** Return the generated operation definition. */
3196
+ /** Return the generated updateDealNote contract. */
136
3197
  definition() {
137
- return ListContactsDefinition;
3198
+ return UpdateDealNoteDefinition;
138
3199
  }
139
- /** Validate pagination and read contact metadata. */
3200
+ /** Use the stable Dex Call ID across attempts. */
3201
+ idempotencyKey(callId) {
3202
+ return callId;
3203
+ }
3204
+ /** Apply the supplied fields and return the confirmed note. */
140
3205
  async invoke(call, input) {
141
- const offset = input.offset;
142
- const limit = input.limit === void 0 || input.limit === 0 ? 20 : input.limit;
143
- if (!isNonnegativeInteger(offset) || !isPositiveInteger(limit) || limit > 100) return terminal("listContacts", "defect", "VALIDATION", "offset or limit is invalid", emptyContacts());
144
- const result = await this.client.exchange(call, "listContacts", `/contacts?limit=${limit}&offset=${offset}`, false);
145
- if (result.retry) return newQueryRetry(result.failure, result.retryAfterMs);
146
- if (result.failure) return newQueryBranch(result.branch, emptyContacts(), {}, result.failure);
147
- const document = parseJSON(result.body);
148
- if (!isObject(document) || !Array.isArray(document.contacts) || !isObject(document.meta) || typeof document.meta.total !== "string" || !countString.test(document.meta.total)) return invalid("listContacts", emptyContacts());
149
- const total = Number(document.meta.total);
150
- if (!Number.isSafeInteger(total) || total < 0) return invalid("listContacts", emptyContacts());
151
- const contacts = [];
152
- for (const item of document.contacts) {
153
- if (!isContact(item)) return invalid("listContacts", emptyContacts());
154
- contacts.push(contactMetadata(item));
155
- }
156
- return newQueryBranch("listed", { contacts, offset, limit, total });
3206
+ const empty = { id: "", dealId: "", text: "" };
3207
+ if (!isNumericId(input.dealId) || !isNumericId(input.noteId) || !(input.text.trim() && Buffer.byteLength(input.text) <= 1e5))
3208
+ return newMutationBranch(
3209
+ "defect",
3210
+ empty,
3211
+ {},
3212
+ failure("updateDealNote", "VALIDATION", "invalid note replacement fields")
3213
+ );
3214
+ return this.client.writeResource(
3215
+ call,
3216
+ "updateDealNote",
3217
+ "PUT",
3218
+ "/deals/" + input.dealId + "/notes/" + input.noteId,
3219
+ "note",
3220
+ { note: input.text },
3221
+ (row) => dealNote(row, input.dealId),
3222
+ empty
3223
+ );
157
3224
  }
158
3225
  };
159
- var GetContactOperation = class {
160
- /** Bind the provider client. */
3226
+ var UpdateEcommerceCustomerOperation = class {
3227
+ /** Bind the authenticated provider client. */
161
3228
  constructor(client) {
162
3229
  this.client = client;
163
3230
  }
164
3231
  client;
165
- /** Return the generated operation definition. */
3232
+ /** Return the generated updateEcommerceCustomer contract. */
166
3233
  definition() {
167
- return GetContactDefinition;
3234
+ return UpdateEcommerceCustomerDefinition;
168
3235
  }
169
- /** Validate the contact ID and read its metadata. */
3236
+ /** Use the stable Dex Call ID across attempts. */
3237
+ idempotencyKey(callId) {
3238
+ return callId;
3239
+ }
3240
+ /** Apply the supplied fields and return the confirmed ecomCustomer. */
170
3241
  async invoke(call, input) {
171
- if (!isNumericId(input.contactId)) return terminal("getContact", "defect", "VALIDATION", "contact ID must be numeric", emptyContact());
172
- const result = await this.client.exchange(call, "getContact", `/contacts/${input.contactId}`, true);
173
- if (result.retry) return newQueryRetry(result.failure, result.retryAfterMs);
174
- if (result.failure) return newQueryBranch(result.branch, emptyContact(), {}, result.failure);
175
- const document = parseJSON(result.body);
176
- if (!isObject(document) || !isContact(document.contact)) return invalid("getContact", emptyContact());
177
- return newQueryBranch("found", contactMetadata(document.contact));
3242
+ const empty = { id: "", connectionId: "", externalId: "", email: "" };
3243
+ if (!isNumericId(input.customerId) || input.externalId === void 0 && input.email === void 0 || input.externalId !== void 0 && !validUpdateLabel(input.externalId) || input.email !== void 0 && !validCustomerEmail(input.email))
3244
+ return newMutationBranch(
3245
+ "defect",
3246
+ empty,
3247
+ {},
3248
+ failure("updateEcommerceCustomer", "VALIDATION", "invalid ecomCustomer replacement fields")
3249
+ );
3250
+ return this.client.writeResource(
3251
+ call,
3252
+ "updateEcommerceCustomer",
3253
+ "PUT",
3254
+ "/ecomCustomers/" + input.customerId,
3255
+ "ecomCustomer",
3256
+ { externalid: input.externalId, email: input.email },
3257
+ customer,
3258
+ empty,
3259
+ input.customerId
3260
+ );
178
3261
  }
179
3262
  };
180
- function failure(operation, kind, message) {
181
- return { provider: "activecampaign", operation, kind, message };
182
- }
183
- function terminal(operation, branch, kind, message, empty) {
184
- return newQueryBranch(branch, empty, {}, failure(operation, kind, message));
185
- }
186
- function invalid(operation, empty) {
187
- return terminal(operation, "invalidResponse", "PROTOCOL", "ActiveCampaign returned invalid JSON", empty);
188
- }
189
- function isObject(value) {
190
- return typeof value === "object" && value !== null && !Array.isArray(value);
191
- }
192
- function isNumericId(value) {
193
- return typeof value === "string" && numericId.test(value);
194
- }
195
- function isPositiveInteger(value) {
196
- return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
197
- }
198
- function isNonnegativeInteger(value) {
199
- return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
3263
+ var UpdateTagOperation = class {
3264
+ /** Bind the authenticated provider client. */
3265
+ constructor(client) {
3266
+ this.client = client;
3267
+ }
3268
+ client;
3269
+ /** Return the generated updateTag contract. */
3270
+ definition() {
3271
+ return UpdateTagDefinition;
3272
+ }
3273
+ /** Use the stable Dex Call ID across attempts. */
3274
+ idempotencyKey(callId) {
3275
+ return callId;
3276
+ }
3277
+ /** Apply the supplied fields and return the confirmed tag. */
3278
+ async invoke(call, input) {
3279
+ const empty = { id: "", name: "", description: "", tagType: "" };
3280
+ if (!isNumericId(input.tagId) || !(input.name.length > 0 && input.name.length <= 250 && !/[,\r\n<>\ufffd\ud800-\udfff]/.test(input.name)))
3281
+ return newMutationBranch(
3282
+ "defect",
3283
+ empty,
3284
+ {},
3285
+ failure("updateTag", "VALIDATION", "invalid tag replacement fields")
3286
+ );
3287
+ return this.client.writeResource(
3288
+ call,
3289
+ "updateTag",
3290
+ "PUT",
3291
+ "/tags/" + input.tagId,
3292
+ "tag",
3293
+ { tag: input.name, description: input.description, tagType: "contact" },
3294
+ tag,
3295
+ empty
3296
+ );
3297
+ }
3298
+ };
3299
+ function membershipReceipt(call, identifier2) {
3300
+ return {
3301
+ callId: call.id,
3302
+ idempotencyKey: call.idempotencyKey,
3303
+ provider: "activecampaign",
3304
+ providerObjectId: identifier2,
3305
+ observedAt: (/* @__PURE__ */ new Date()).toISOString()
3306
+ };
200
3307
  }
201
- function isContact(value) {
202
- return isObject(value) && isNumericId(value.id) && ["email", "firstName", "lastName"].every((field) => value[field] === void 0 || typeof value[field] === "string");
3308
+ var ApplyTagToContactOperation = class {
3309
+ /** Bind the authenticated provider client. */
3310
+ constructor(client) {
3311
+ this.client = client;
3312
+ }
3313
+ client;
3314
+ /** Return the generated applyTagToContact contract. */
3315
+ definition() {
3316
+ return ApplyTagToContactDefinition;
3317
+ }
3318
+ /** Correlate attempts using the Dex Call ID. */
3319
+ idempotencyKey(callId) {
3320
+ return callId;
3321
+ }
3322
+ /** Apply an existing tag to a contact. */
3323
+ async invoke(call, input) {
3324
+ return this.client.changeTag(
3325
+ call,
3326
+ "applyTagToContact",
3327
+ input,
3328
+ { associationId: "", contactId: "", tagId: "" },
3329
+ "POST",
3330
+ [201],
3331
+ (body) => {
3332
+ const rows = record(parseJSON(body)).contacttags;
3333
+ if (!Array.isArray(rows) || rows.length !== 1) throw new Error("expected one tag");
3334
+ const value = contactTag(record(rows[0]), input.contactId);
3335
+ if (value.tagId !== input.tagId) throw new Error("unexpected tag");
3336
+ return [value, value.associationId];
3337
+ },
3338
+ "applied"
3339
+ );
3340
+ }
3341
+ };
3342
+ var RemoveTagFromContactOperation = class {
3343
+ /** Bind the authenticated provider client. */
3344
+ constructor(client) {
3345
+ this.client = client;
3346
+ }
3347
+ client;
3348
+ /** Return the generated removeTagFromContact contract. */
3349
+ definition() {
3350
+ return RemoveTagFromContactDefinition;
3351
+ }
3352
+ /** Correlate attempts using the Dex Call ID. */
3353
+ idempotencyKey(callId) {
3354
+ return callId;
3355
+ }
3356
+ /** Remove a tag association or confirm its absence. */
3357
+ async invoke(call, input) {
3358
+ return this.client.changeTag(
3359
+ call,
3360
+ "removeTagFromContact",
3361
+ input,
3362
+ { contactId: "", tagId: "", removed: false },
3363
+ "DELETE",
3364
+ [200, 204, 404],
3365
+ (body, status) => {
3366
+ if (status === 200 && body.length)
3367
+ JSON.parse(new TextDecoder("utf-8", { ignoreBOM: true }).decode(body));
3368
+ return [
3369
+ { contactId: input.contactId, tagId: input.tagId, removed: true },
3370
+ input.contactId + ":" + input.tagId
3371
+ ];
3372
+ },
3373
+ "removed"
3374
+ );
3375
+ }
3376
+ };
3377
+ var SubscribeContactToListOperation = class {
3378
+ /** Bind the authenticated provider client. */
3379
+ constructor(client) {
3380
+ this.client = client;
3381
+ }
3382
+ client;
3383
+ /** Return the generated subscribeContactToList contract. */
3384
+ definition() {
3385
+ return SubscribeContactToListDefinition;
3386
+ }
3387
+ /** Correlate attempts using the Dex Call ID. */
3388
+ idempotencyKey(callId) {
3389
+ return callId;
3390
+ }
3391
+ /** Subscribe a contact after checking its current list membership. */
3392
+ async invoke(call, input) {
3393
+ return this.client.changeMembership(call, this.definition(), input, "subscribed", 1);
3394
+ }
3395
+ };
3396
+ var UnsubscribeContactFromListOperation = class {
3397
+ /** Bind the authenticated provider client. */
3398
+ constructor(client) {
3399
+ this.client = client;
3400
+ }
3401
+ client;
3402
+ /** Return the generated unsubscribeContactFromList contract. */
3403
+ definition() {
3404
+ return UnsubscribeContactFromListDefinition;
3405
+ }
3406
+ /** Correlate attempts using the Dex Call ID. */
3407
+ idempotencyKey(callId) {
3408
+ return callId;
3409
+ }
3410
+ /** Unsubscribe a contact after checking its current list membership. */
3411
+ async invoke(call, input) {
3412
+ return this.client.changeMembership(call, this.definition(), input, "unsubscribed", 2);
3413
+ }
3414
+ };
3415
+ var CreateAccountOperation = class {
3416
+ /** Bind the account-scoped provider client. */
3417
+ constructor(client) {
3418
+ this.client = client;
3419
+ }
3420
+ client;
3421
+ /** Return the generated create contract. */
3422
+ definition() {
3423
+ return CreateAccountDefinition;
3424
+ }
3425
+ /** Correlate possible sends locally with the stable Dex Call ID. */
3426
+ idempotencyKey(callId) {
3427
+ return callId;
3428
+ }
3429
+ /** Dispatch the creation or recover the previously observed provider record. */
3430
+ async invoke(call, input) {
3431
+ return this.client.createResource(call, this.definition(), {
3432
+ valid: validUpdateLabel(input.name) && validAccountUrl(input.accountUrl ?? ""),
3433
+ path: "/accounts",
3434
+ field: "account",
3435
+ fields: { name: input.name, accountUrl: input.accountUrl ?? "" },
3436
+ empty: { id: "", name: "", accountUrl: "" },
3437
+ project: account,
3438
+ matches: (v) => v.name === input.name && v.accountUrl === (input.accountUrl ?? "")
3439
+ });
3440
+ }
3441
+ };
3442
+ var CreateAccountContactOperation = class {
3443
+ /** Bind the account-scoped provider client. */
3444
+ constructor(client) {
3445
+ this.client = client;
3446
+ }
3447
+ client;
3448
+ /** Return the generated create contract. */
3449
+ definition() {
3450
+ return CreateAccountContactDefinition;
3451
+ }
3452
+ /** Correlate possible sends locally with the stable Dex Call ID. */
3453
+ idempotencyKey(callId) {
3454
+ return callId;
3455
+ }
3456
+ /** Dispatch the creation or recover the previously observed provider record. */
3457
+ async invoke(call, input) {
3458
+ return this.client.createResource(call, this.definition(), {
3459
+ valid: isNumericId(input.accountId) && isNumericId(input.contactId) && Buffer.byteLength(input.jobTitle ?? "") <= 250 && !/[\r\n]/.test(input.jobTitle ?? ""),
3460
+ path: "/accountContacts",
3461
+ field: "accountContact",
3462
+ fields: { account: input.accountId, contact: input.contactId, jobTitle: input.jobTitle ?? "" },
3463
+ empty: { id: "", accountId: "", contactId: "", jobTitle: "" },
3464
+ project: accountContact,
3465
+ matches: (v) => v.accountId === input.accountId && v.contactId === input.contactId && v.jobTitle === (input.jobTitle ?? "")
3466
+ });
3467
+ }
3468
+ };
3469
+ var CreateConnectionOperation = class {
3470
+ /** Bind the account-scoped provider client. */
3471
+ constructor(client) {
3472
+ this.client = client;
3473
+ }
3474
+ client;
3475
+ /** Return the generated create contract. */
3476
+ definition() {
3477
+ return CreateConnectionDefinition;
3478
+ }
3479
+ /** Correlate possible sends locally with the stable Dex Call ID. */
3480
+ idempotencyKey(callId) {
3481
+ return callId;
3482
+ }
3483
+ /** Dispatch the creation or recover the previously observed provider record. */
3484
+ async invoke(call, input) {
3485
+ return this.client.createResource(call, this.definition(), {
3486
+ valid: validUpdateLabel(input.service) && validUpdateLabel(input.externalId) && validUpdateLabel(input.name) && (!input.listId || isNumericId(input.listId)),
3487
+ path: "/connections",
3488
+ field: "connection",
3489
+ fields: {
3490
+ service: input.service,
3491
+ externalid: input.externalId,
3492
+ name: input.name,
3493
+ ...input.listId && { listId: input.listId }
3494
+ },
3495
+ empty: { id: "", service: "", externalId: "", name: "", listId: "" },
3496
+ project: commerceConnection,
3497
+ matches: (v) => v.service === input.service && v.externalId === input.externalId && v.name === input.name && (!input.listId || v.listId === input.listId)
3498
+ });
3499
+ }
3500
+ };
3501
+ var CreateDealOperation = class {
3502
+ /** Bind the account-scoped provider client. */
3503
+ constructor(client) {
3504
+ this.client = client;
3505
+ }
3506
+ client;
3507
+ /** Return the generated create contract. */
3508
+ definition() {
3509
+ return CreateDealDefinition;
3510
+ }
3511
+ /** Correlate possible sends locally with the stable Dex Call ID. */
3512
+ idempotencyKey(callId) {
3513
+ return callId;
3514
+ }
3515
+ /** Dispatch the creation or recover the previously observed provider record. */
3516
+ async invoke(call, input) {
3517
+ return this.client.createResource(call, this.definition(), {
3518
+ valid: !!input.title.trim() && Buffer.byteLength(input.title) <= 250 && [input.contactId, input.pipelineId, input.stageId].every(isNumericId) && nonnegativeDealAmount(input.valueMinor) && /^[A-Z]{3}$/.test(input.currency) && input.currency.length === 3,
3519
+ path: "/deals",
3520
+ field: "deal",
3521
+ fields: {
3522
+ title: input.title,
3523
+ contact: input.contactId,
3524
+ group: input.pipelineId,
3525
+ stage: input.stageId,
3526
+ value: input.valueMinor,
3527
+ currency: input.currency.toLowerCase(),
3528
+ status: 0
3529
+ },
3530
+ empty: { id: "", title: "", contactId: "", stageId: "", valueMinor: 0, currency: "", status: 0 },
3531
+ project: deal,
3532
+ matches: (v) => v.title === input.title && v.contactId === input.contactId && v.stageId === input.stageId && JSON.stringify(v.valueMinor) === JSON.stringify(input.valueMinor) && v.currency.toLowerCase() === input.currency.toLowerCase() && v.status === 0,
3533
+ confirms: () => true
3534
+ });
3535
+ }
3536
+ };
3537
+ var CreateDealNoteOperation = class {
3538
+ /** Bind the account-scoped provider client. */
3539
+ constructor(client) {
3540
+ this.client = client;
3541
+ }
3542
+ client;
3543
+ /** Return the generated create contract. */
3544
+ definition() {
3545
+ return CreateDealNoteDefinition;
3546
+ }
3547
+ /** Correlate possible sends locally with the stable Dex Call ID. */
3548
+ idempotencyKey(callId) {
3549
+ return callId;
3550
+ }
3551
+ /** Dispatch the creation or recover the previously observed provider record. */
3552
+ async invoke(call, input) {
3553
+ return this.client.createResource(call, this.definition(), {
3554
+ valid: isNumericId(input.dealId) && !!input.text.trim() && Buffer.byteLength(input.text) <= 1e5,
3555
+ path: `/deals/${input.dealId}/notes`,
3556
+ field: "note",
3557
+ fields: { note: input.text },
3558
+ empty: { id: "", dealId: "", text: "" },
3559
+ project: dealNote,
3560
+ matches: (v) => v.dealId === input.dealId && v.text === input.text,
3561
+ readPath: "/notes",
3562
+ confirms: (v) => v.dealId === input.dealId
3563
+ });
3564
+ }
3565
+ };
3566
+ var CreateEcommerceCustomerOperation = class {
3567
+ /** Bind the account-scoped provider client. */
3568
+ constructor(client) {
3569
+ this.client = client;
3570
+ }
3571
+ client;
3572
+ /** Return the generated create contract. */
3573
+ definition() {
3574
+ return CreateEcommerceCustomerDefinition;
3575
+ }
3576
+ /** Correlate possible sends locally with the stable Dex Call ID. */
3577
+ idempotencyKey(callId) {
3578
+ return callId;
3579
+ }
3580
+ /** Dispatch the creation or recover the previously observed provider record. */
3581
+ async invoke(call, input) {
3582
+ return this.client.createResource(call, this.definition(), {
3583
+ valid: isNumericId(input.connectionId) && validUpdateLabel(input.externalId) && validCustomerEmail(input.email),
3584
+ path: "/ecomCustomers",
3585
+ field: "ecomCustomer",
3586
+ fields: { connectionid: input.connectionId, externalid: input.externalId, email: input.email },
3587
+ empty: { id: "", connectionId: "", externalId: "", email: "" },
3588
+ project: customer,
3589
+ matches: (v) => v.connectionId === input.connectionId && v.externalId === input.externalId && v.email === input.email
3590
+ });
3591
+ }
3592
+ };
3593
+ var CreateTagOperation = class {
3594
+ /** Bind the account-scoped provider client. */
3595
+ constructor(client) {
3596
+ this.client = client;
3597
+ }
3598
+ client;
3599
+ /** Return the generated create contract. */
3600
+ definition() {
3601
+ return CreateTagDefinition;
3602
+ }
3603
+ /** Correlate possible sends locally with the stable Dex Call ID. */
3604
+ idempotencyKey(callId) {
3605
+ return callId;
3606
+ }
3607
+ /** Dispatch the creation or recover the previously observed provider record. */
3608
+ async invoke(call, input) {
3609
+ return this.client.createResource(call, this.definition(), {
3610
+ valid: input.name.length > 0 && [...input.name].length <= 250 && !/[,\r\n<>\ufffd\ud800-\udfff]/.test(input.name),
3611
+ path: "/tags",
3612
+ field: "tag",
3613
+ fields: { tag: input.name, tagType: "contact", description: input.description ?? "" },
3614
+ empty: { id: "", name: "", description: "", tagType: "" },
3615
+ project: tag,
3616
+ matches: (v) => v.name === input.name && v.description === (input.description ?? ""),
3617
+ confirms: () => true
3618
+ });
3619
+ }
3620
+ };
3621
+ var UpsertEcommerceOrderOperation = class {
3622
+ /** Bind the provider client. */
3623
+ constructor(client) {
3624
+ this.client = client;
3625
+ }
3626
+ client;
3627
+ /** Return the generated keyed order upsert contract. */
3628
+ definition() {
3629
+ return UpsertEcommerceOrderDefinition;
3630
+ }
3631
+ /** Correlate attempts while the connection and store order ID identify the provider record. */
3632
+ idempotencyKey(callId) {
3633
+ return callId;
3634
+ }
3635
+ /** Write the order and verify its connection, store order ID and email in the confirmation. */
3636
+ invoke(call, input) {
3637
+ return this.client.writeStoreOrder(call, input);
3638
+ }
3639
+ };
3640
+ var orderAmount = /^(?:0|[1-9][0-9]{0,10})(?:\.[0-9]{1,4})?$/;
3641
+ var orderStatuses = /* @__PURE__ */ new Set([
3642
+ "PENDING",
3643
+ "COMPLETED",
3644
+ "ABANDONED",
3645
+ "RECOVERED",
3646
+ "WAITING",
3647
+ "CANCELLED",
3648
+ "REFUNDED",
3649
+ "FAILED",
3650
+ "RETURNED",
3651
+ "PENDING_PAYMENT"
3652
+ ]);
3653
+ function validOrderTimestamp(value) {
3654
+ const match = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{1,2}):([0-9]{2}):([0-9]{2})(?:[.,][0-9]+)?(?:Z|[+-]([0-9]{2}):([0-9]{2}))$/.exec(
3655
+ value
3656
+ );
3657
+ if (!match) return false;
3658
+ const year = Number(match[1] ?? 0);
3659
+ const month = Number(match[2] ?? 0);
3660
+ const day = Number(match[3] ?? 0);
3661
+ const hour = Number(match[4] ?? 0);
3662
+ const minute = Number(match[5] ?? 0);
3663
+ const second = Number(match[6] ?? 0);
3664
+ const zoneHour = Number(match[7] ?? 0);
3665
+ const zoneMinute = Number(match[8] ?? 0);
3666
+ if (year < 2e3 || month < 1 || month > 12 || day < 1 || day > new Date(Date.UTC(year, month, 0)).getUTCDate())
3667
+ return false;
3668
+ return hour < 24 && minute < 60 && second < 60 && (!match[7] || zoneHour <= 24 && zoneMinute <= 60);
203
3669
  }
204
- function contactMetadata(value) {
205
- return { id: value.id ?? "", email: value.email ?? "", firstName: value.firstName ?? "", lastName: value.lastName ?? "" };
3670
+ function orderGraphQLString(value) {
3671
+ return JSON.stringify(value).replace(
3672
+ /[<>&\u2028\u2029]/gu,
3673
+ (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, "0")
3674
+ );
206
3675
  }
207
- function parseJSON(body) {
208
- try {
209
- return JSON.parse(Buffer.from(body).toString("utf8"));
210
- } catch {
3676
+ function orderUpsertQuery(input) {
3677
+ const connectionId = Number(input.connectionId);
3678
+ if (!isNumericId(input.connectionId) || connectionId < 1 || connectionId > 2147483647 || !validUpdateLabel(input.storeOrderId) || !validUpdateLabel(input.storeCustomerId) || !validCustomerEmail(input.email) || !validOrderTimestamp(input.createdAt) || !/^[A-Z]{3}$/.test(input.currency) || !orderAmount.test(input.finalAmount) || !["REAL_TIME", "HISTORICAL"].includes(input.creationSource) || !orderStatuses.has(input.status))
211
3679
  return void 0;
3680
+ let lineFields = "";
3681
+ if (input.lineItems != null) {
3682
+ if (input.lineItems.length > 100) return void 0;
3683
+ const seen = /* @__PURE__ */ new Set();
3684
+ const lines = [];
3685
+ for (const item of input.lineItems) {
3686
+ if (![item.storeLineItemId, item.productStorePrimaryId, item.name].every(validUpdateLabel) || !Number.isInteger(item.quantity) || item.quantity < 1 || item.quantity > 1e5 || !orderAmount.test(item.priceAmount) || seen.has(item.storeLineItemId))
3687
+ return void 0;
3688
+ seen.add(item.storeLineItemId);
3689
+ const fields2 = [
3690
+ `legacyConnectionId: ${connectionId}`,
3691
+ `storeLineItemId: ${orderGraphQLString(item.storeLineItemId)}`,
3692
+ `productStorePrimaryId: ${orderGraphQLString(item.productStorePrimaryId)}`,
3693
+ `name: ${orderGraphQLString(item.name)}`,
3694
+ `quantity: ${item.quantity}`,
3695
+ `priceAmount: ${item.priceAmount}`
3696
+ ];
3697
+ lines.push(`{ ${fields2.join(", ")} }`);
3698
+ }
3699
+ lineFields = ", lineItems: [" + lines.join(", ") + "]";
212
3700
  }
213
- }
214
- function headerValue(value) {
215
- return Array.isArray(value) ? value[0] ?? "" : value ?? "";
3701
+ const fields = [
3702
+ `legacyConnectionId: ${connectionId}`,
3703
+ `storeOrderId: ${orderGraphQLString(input.storeOrderId)}`,
3704
+ `storeCustomerId: ${orderGraphQLString(input.storeCustomerId)}`,
3705
+ `email: ${orderGraphQLString(input.email)}`,
3706
+ `storeCreatedDate: ${orderGraphQLString(input.createdAt)}`,
3707
+ `currency: ${orderGraphQLString(input.currency)}`,
3708
+ `finalAmount: ${input.finalAmount}`,
3709
+ `creationSource: ${input.creationSource}`,
3710
+ `normalizedStatus: ${input.status}`
3711
+ ];
3712
+ return `mutation { upsertOrder(order: { ${fields.join(", ")}${lineFields} }) { connectionId storeOrderId email } }`;
216
3713
  }
217
3714
 
218
3715
  // src/project.ts
@@ -250,13 +3747,464 @@ function parseDurationMilliseconds(value) {
250
3747
  if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("ActiveCampaign timeout must resolve to positive whole milliseconds");
251
3748
  return milliseconds;
252
3749
  }
3750
+
3751
+ // src/index.ts
3752
+ function newConnection(client, reference) {
3753
+ return newConnectionWithOperations(client, reference);
3754
+ }
3755
+ function newConnectionWithOperations(operations, reference) {
3756
+ if (!operations || typeof operations.listContacts !== "function" || typeof operations.getContact !== "function")
3757
+ throw new TypeError("ActiveCampaign contact operations are required");
3758
+ if (operations.listAccounts && operations.getAccount && operations.listTags && operations.getTag && operations.listLists && operations.getList && operations.listDealNotes && operations.getDealNote && operations.listAccountContacts && operations.getAccountContact && operations.listContactListMemberships && operations.listContactTags && operations.listConnections && operations.getConnection && operations.listDeals && operations.getDeal && operations.listEcommerceCustomers && operations.getEcommerceCustomer && operations.listEcommerceOrders && operations.getEcommerceOrder && operations.listEcommerceOrderProducts && operations.getEcommerceOrderProduct && operations.listProductsForEcommerceOrder && operations.deleteAccount && operations.deleteAccountContact && operations.deleteConnection && operations.deleteDeal && operations.deleteEcommerceCustomer && operations.deleteTag && operations.updateAccount && operations.updateAccountContact && operations.updateConnection && operations.updateContact && operations.syncContact && operations.updateDeal && operations.updateDealNote && operations.updateEcommerceCustomer && operations.updateTag && operations.createAccount && operations.createAccountContact && operations.createConnection && operations.createDeal && operations.createDealNote && operations.createEcommerceCustomer && operations.createTag && operations.upsertEcommerceOrder && operations.applyTagToContact && operations.removeTagFromContact && operations.subscribeContactToList && operations.unsubscribeContactFromList)
3759
+ return new Connection(reference, operations);
3760
+ return new Connection(reference, {
3761
+ listContacts: () => operations.listContacts(),
3762
+ getContact: () => operations.getContact(),
3763
+ listAccounts: () => {
3764
+ if (!operations.listAccounts)
3765
+ throw new TypeError("listAccounts is not bound to this ActiveCampaign connection");
3766
+ return operations.listAccounts();
3767
+ },
3768
+ getAccount: () => {
3769
+ if (!operations.getAccount)
3770
+ throw new TypeError("getAccount is not bound to this ActiveCampaign connection");
3771
+ return operations.getAccount();
3772
+ },
3773
+ listTags: () => {
3774
+ if (!operations.listTags)
3775
+ throw new TypeError("listTags is not bound to this ActiveCampaign connection");
3776
+ return operations.listTags();
3777
+ },
3778
+ getTag: () => {
3779
+ if (!operations.getTag) throw new TypeError("getTag is not bound to this ActiveCampaign connection");
3780
+ return operations.getTag();
3781
+ },
3782
+ listLists: () => {
3783
+ if (!operations.listLists)
3784
+ throw new TypeError("listLists is not bound to this ActiveCampaign connection");
3785
+ return operations.listLists();
3786
+ },
3787
+ getList: () => {
3788
+ if (!operations.getList) throw new TypeError("getList is not bound to this ActiveCampaign connection");
3789
+ return operations.getList();
3790
+ },
3791
+ listDealNotes: () => {
3792
+ if (!operations.listDealNotes)
3793
+ throw new TypeError("listDealNotes is not bound to this ActiveCampaign connection");
3794
+ return operations.listDealNotes();
3795
+ },
3796
+ listAccountContacts: () => {
3797
+ if (!operations.listAccountContacts)
3798
+ throw new TypeError("listAccountContacts is not bound to this ActiveCampaign connection");
3799
+ return operations.listAccountContacts();
3800
+ },
3801
+ getAccountContact: () => {
3802
+ if (!operations.getAccountContact)
3803
+ throw new TypeError("getAccountContact is not bound to this ActiveCampaign connection");
3804
+ return operations.getAccountContact();
3805
+ },
3806
+ listContactListMemberships: () => {
3807
+ if (!operations.listContactListMemberships)
3808
+ throw new TypeError("listContactListMemberships is not bound to this ActiveCampaign connection");
3809
+ return operations.listContactListMemberships();
3810
+ },
3811
+ listContactTags: () => {
3812
+ if (!operations.listContactTags)
3813
+ throw new TypeError("listContactTags is not bound to this ActiveCampaign connection");
3814
+ return operations.listContactTags();
3815
+ },
3816
+ listConnections: () => {
3817
+ if (!operations.listConnections)
3818
+ throw new TypeError("listConnections is not bound to this ActiveCampaign connection");
3819
+ return operations.listConnections();
3820
+ },
3821
+ getConnection: () => {
3822
+ if (!operations.getConnection)
3823
+ throw new TypeError("getConnection is not bound to this ActiveCampaign connection");
3824
+ return operations.getConnection();
3825
+ },
3826
+ listDeals: () => {
3827
+ if (!operations.listDeals)
3828
+ throw new TypeError("listDeals is not bound to this ActiveCampaign connection");
3829
+ return operations.listDeals();
3830
+ },
3831
+ getDeal: () => {
3832
+ if (!operations.getDeal) throw new TypeError("getDeal is not bound to this ActiveCampaign connection");
3833
+ return operations.getDeal();
3834
+ },
3835
+ listEcommerceCustomers: () => {
3836
+ if (!operations.listEcommerceCustomers)
3837
+ throw new TypeError("listEcommerceCustomers is not bound to this ActiveCampaign connection");
3838
+ return operations.listEcommerceCustomers();
3839
+ },
3840
+ getEcommerceCustomer: () => {
3841
+ if (!operations.getEcommerceCustomer)
3842
+ throw new TypeError("getEcommerceCustomer is not bound to this ActiveCampaign connection");
3843
+ return operations.getEcommerceCustomer();
3844
+ },
3845
+ listEcommerceOrders: () => {
3846
+ if (!operations.listEcommerceOrders)
3847
+ throw new TypeError("listEcommerceOrders is not bound to this ActiveCampaign connection");
3848
+ return operations.listEcommerceOrders();
3849
+ },
3850
+ getEcommerceOrder: () => {
3851
+ if (!operations.getEcommerceOrder)
3852
+ throw new TypeError("getEcommerceOrder is not bound to this ActiveCampaign connection");
3853
+ return operations.getEcommerceOrder();
3854
+ },
3855
+ listEcommerceOrderProducts: () => {
3856
+ if (!operations.listEcommerceOrderProducts)
3857
+ throw new TypeError("listEcommerceOrderProducts is not bound to this ActiveCampaign connection");
3858
+ return operations.listEcommerceOrderProducts();
3859
+ },
3860
+ getEcommerceOrderProduct: () => {
3861
+ if (!operations.getEcommerceOrderProduct)
3862
+ throw new TypeError("getEcommerceOrderProduct is not bound to this ActiveCampaign connection");
3863
+ return operations.getEcommerceOrderProduct();
3864
+ },
3865
+ listProductsForEcommerceOrder: () => {
3866
+ if (!operations.listProductsForEcommerceOrder)
3867
+ throw new TypeError("listProductsForEcommerceOrder is not bound to this ActiveCampaign connection");
3868
+ return operations.listProductsForEcommerceOrder();
3869
+ },
3870
+ deleteAccount: () => {
3871
+ if (!operations.deleteAccount)
3872
+ throw new TypeError("deleteAccount is not bound to this ActiveCampaign connection");
3873
+ return operations.deleteAccount();
3874
+ },
3875
+ deleteAccountContact: () => {
3876
+ if (!operations.deleteAccountContact)
3877
+ throw new TypeError("deleteAccountContact is not bound to this ActiveCampaign connection");
3878
+ return operations.deleteAccountContact();
3879
+ },
3880
+ deleteConnection: () => {
3881
+ if (!operations.deleteConnection)
3882
+ throw new TypeError("deleteConnection is not bound to this ActiveCampaign connection");
3883
+ return operations.deleteConnection();
3884
+ },
3885
+ deleteDeal: () => {
3886
+ if (!operations.deleteDeal)
3887
+ throw new TypeError("deleteDeal is not bound to this ActiveCampaign connection");
3888
+ return operations.deleteDeal();
3889
+ },
3890
+ deleteEcommerceCustomer: () => {
3891
+ if (!operations.deleteEcommerceCustomer)
3892
+ throw new TypeError("deleteEcommerceCustomer is not bound to this ActiveCampaign connection");
3893
+ return operations.deleteEcommerceCustomer();
3894
+ },
3895
+ deleteTag: () => {
3896
+ if (!operations.deleteTag)
3897
+ throw new TypeError("deleteTag is not bound to this ActiveCampaign connection");
3898
+ return operations.deleteTag();
3899
+ },
3900
+ updateAccount: () => {
3901
+ if (!operations.updateAccount)
3902
+ throw new TypeError("updateAccount is not bound to this ActiveCampaign connection");
3903
+ return operations.updateAccount();
3904
+ },
3905
+ updateAccountContact: () => {
3906
+ if (!operations.updateAccountContact)
3907
+ throw new TypeError("updateAccountContact is not bound to this ActiveCampaign connection");
3908
+ return operations.updateAccountContact();
3909
+ },
3910
+ updateConnection: () => {
3911
+ if (!operations.updateConnection)
3912
+ throw new TypeError("updateConnection is not bound to this ActiveCampaign connection");
3913
+ return operations.updateConnection();
3914
+ },
3915
+ updateContact: () => {
3916
+ if (!operations.updateContact)
3917
+ throw new TypeError("updateContact is not bound to this ActiveCampaign connection");
3918
+ return operations.updateContact();
3919
+ },
3920
+ syncContact: () => {
3921
+ if (!operations.syncContact)
3922
+ throw new TypeError("syncContact is not bound to this ActiveCampaign connection");
3923
+ return operations.syncContact();
3924
+ },
3925
+ updateDeal: () => {
3926
+ if (!operations.updateDeal)
3927
+ throw new TypeError("updateDeal is not bound to this ActiveCampaign connection");
3928
+ return operations.updateDeal();
3929
+ },
3930
+ updateDealNote: () => {
3931
+ if (!operations.updateDealNote)
3932
+ throw new TypeError("updateDealNote is not bound to this ActiveCampaign connection");
3933
+ return operations.updateDealNote();
3934
+ },
3935
+ updateEcommerceCustomer: () => {
3936
+ if (!operations.updateEcommerceCustomer)
3937
+ throw new TypeError("updateEcommerceCustomer is not bound to this ActiveCampaign connection");
3938
+ return operations.updateEcommerceCustomer();
3939
+ },
3940
+ updateTag: () => {
3941
+ if (!operations.updateTag)
3942
+ throw new TypeError("updateTag is not bound to this ActiveCampaign connection");
3943
+ return operations.updateTag();
3944
+ },
3945
+ createAccount: () => {
3946
+ if (!operations.createAccount)
3947
+ throw new TypeError("createAccount is not bound to this ActiveCampaign connection");
3948
+ return operations.createAccount();
3949
+ },
3950
+ createAccountContact: () => {
3951
+ if (!operations.createAccountContact)
3952
+ throw new TypeError("createAccountContact is not bound to this ActiveCampaign connection");
3953
+ return operations.createAccountContact();
3954
+ },
3955
+ createConnection: () => {
3956
+ if (!operations.createConnection)
3957
+ throw new TypeError("createConnection is not bound to this ActiveCampaign connection");
3958
+ return operations.createConnection();
3959
+ },
3960
+ createDeal: () => {
3961
+ if (!operations.createDeal)
3962
+ throw new TypeError("createDeal is not bound to this ActiveCampaign connection");
3963
+ return operations.createDeal();
3964
+ },
3965
+ createDealNote: () => {
3966
+ if (!operations.createDealNote)
3967
+ throw new TypeError("createDealNote is not bound to this ActiveCampaign connection");
3968
+ return operations.createDealNote();
3969
+ },
3970
+ createEcommerceCustomer: () => {
3971
+ if (!operations.createEcommerceCustomer)
3972
+ throw new TypeError("createEcommerceCustomer is not bound to this ActiveCampaign connection");
3973
+ return operations.createEcommerceCustomer();
3974
+ },
3975
+ createTag: () => {
3976
+ if (!operations.createTag)
3977
+ throw new TypeError("createTag is not bound to this ActiveCampaign connection");
3978
+ return operations.createTag();
3979
+ },
3980
+ upsertEcommerceOrder: () => {
3981
+ if (!operations.upsertEcommerceOrder)
3982
+ throw new TypeError("upsertEcommerceOrder is not bound to this ActiveCampaign connection");
3983
+ return operations.upsertEcommerceOrder();
3984
+ },
3985
+ applyTagToContact: () => {
3986
+ if (!operations.applyTagToContact)
3987
+ throw new TypeError("applyTagToContact is not bound to this ActiveCampaign connection");
3988
+ return operations.applyTagToContact();
3989
+ },
3990
+ removeTagFromContact: () => {
3991
+ if (!operations.removeTagFromContact)
3992
+ throw new TypeError("removeTagFromContact is not bound to this ActiveCampaign connection");
3993
+ return operations.removeTagFromContact();
3994
+ },
3995
+ subscribeContactToList: () => {
3996
+ if (!operations.subscribeContactToList)
3997
+ throw new TypeError("subscribeContactToList is not bound to this ActiveCampaign connection");
3998
+ return operations.subscribeContactToList();
3999
+ },
4000
+ unsubscribeContactFromList: () => {
4001
+ if (!operations.unsubscribeContactFromList)
4002
+ throw new TypeError("unsubscribeContactFromList is not bound to this ActiveCampaign connection");
4003
+ return operations.unsubscribeContactFromList();
4004
+ },
4005
+ getDealNote: () => {
4006
+ if (!operations.getDealNote)
4007
+ throw new TypeError("getDealNote is not bound to this ActiveCampaign connection");
4008
+ return operations.getDealNote();
4009
+ }
4010
+ });
4011
+ }
253
4012
  export {
4013
+ AccountContactAssociationSchema,
4014
+ AccountContactDeletionSchema,
4015
+ AccountContactsPageSchema,
4016
+ AccountDeletionSchema,
4017
+ AccountMetadataSchema,
4018
+ AccountsPageSchema,
254
4019
  ActiveCampaignClient,
4020
+ ApplyTagToContactBranch,
4021
+ ApplyTagToContactBranchApplied,
4022
+ ApplyTagToContactBranchDefect,
4023
+ ApplyTagToContactBranchInvalidResponse,
4024
+ ApplyTagToContactBranchNotFound,
4025
+ ApplyTagToContactBranchProviderRejected,
4026
+ ApplyTagToContactDefinition,
4027
+ ApplyTagToContactInputSchema,
4028
+ ApplyTagToContactMetadata,
4029
+ ApplyTagToContactOperation,
255
4030
  ConfigSchema,
256
4031
  Connection,
4032
+ ConnectionDeletionSchema,
4033
+ ConnectionMetadataSchema,
4034
+ ConnectionsPageSchema,
257
4035
  ConnectorID,
4036
+ ContactListMembershipSchema,
4037
+ ContactListMembershipsPageSchema,
258
4038
  ContactMetadataSchema,
4039
+ ContactTagAssociationSchema,
4040
+ ContactTagAssociationsSchema,
4041
+ ContactTagRemovalSchema,
259
4042
  ContactsPageSchema,
4043
+ CreateAccountBranch,
4044
+ CreateAccountBranchCreated,
4045
+ CreateAccountBranchDefect,
4046
+ CreateAccountBranchProviderRejected,
4047
+ CreateAccountBranchUncertain,
4048
+ CreateAccountContactBranch,
4049
+ CreateAccountContactBranchCreated,
4050
+ CreateAccountContactBranchDefect,
4051
+ CreateAccountContactBranchProviderRejected,
4052
+ CreateAccountContactBranchUncertain,
4053
+ CreateAccountContactDefinition,
4054
+ CreateAccountContactInputSchema,
4055
+ CreateAccountContactMetadata,
4056
+ CreateAccountContactOperation,
4057
+ CreateAccountDefinition,
4058
+ CreateAccountInputSchema,
4059
+ CreateAccountMetadata,
4060
+ CreateAccountOperation,
4061
+ CreateConnectionBranch,
4062
+ CreateConnectionBranchCreated,
4063
+ CreateConnectionBranchDefect,
4064
+ CreateConnectionBranchProviderRejected,
4065
+ CreateConnectionBranchUncertain,
4066
+ CreateConnectionDefinition,
4067
+ CreateConnectionInputSchema,
4068
+ CreateConnectionMetadata,
4069
+ CreateConnectionOperation,
4070
+ CreateDealBranch,
4071
+ CreateDealBranchCreated,
4072
+ CreateDealBranchDefect,
4073
+ CreateDealBranchInvalidResponse,
4074
+ CreateDealBranchProviderRejected,
4075
+ CreateDealBranchUncertain,
4076
+ CreateDealDefinition,
4077
+ CreateDealInputSchema,
4078
+ CreateDealMetadata,
4079
+ CreateDealNoteBranch,
4080
+ CreateDealNoteBranchCreated,
4081
+ CreateDealNoteBranchDefect,
4082
+ CreateDealNoteBranchInvalidResponse,
4083
+ CreateDealNoteBranchProviderRejected,
4084
+ CreateDealNoteBranchUncertain,
4085
+ CreateDealNoteDefinition,
4086
+ CreateDealNoteInputSchema,
4087
+ CreateDealNoteMetadata,
4088
+ CreateDealNoteOperation,
4089
+ CreateDealOperation,
4090
+ CreateEcommerceCustomerBranch,
4091
+ CreateEcommerceCustomerBranchCreated,
4092
+ CreateEcommerceCustomerBranchDefect,
4093
+ CreateEcommerceCustomerBranchProviderRejected,
4094
+ CreateEcommerceCustomerBranchUncertain,
4095
+ CreateEcommerceCustomerDefinition,
4096
+ CreateEcommerceCustomerInputSchema,
4097
+ CreateEcommerceCustomerMetadata,
4098
+ CreateEcommerceCustomerOperation,
4099
+ CreateTagBranch,
4100
+ CreateTagBranchCreated,
4101
+ CreateTagBranchDefect,
4102
+ CreateTagBranchInvalidResponse,
4103
+ CreateTagBranchProviderRejected,
4104
+ CreateTagBranchUncertain,
4105
+ CreateTagDefinition,
4106
+ CreateTagInputSchema,
4107
+ CreateTagMetadata,
4108
+ CreateTagOperation,
4109
+ CredentialMaterialError,
4110
+ DealDeletionSchema,
4111
+ DealMetadataSchema,
4112
+ DealNoteMetadataSchema,
4113
+ DealNotesPageSchema,
4114
+ DealsPageSchema,
4115
+ DeleteAccountBranch,
4116
+ DeleteAccountBranchDefect,
4117
+ DeleteAccountBranchDeleted,
4118
+ DeleteAccountBranchInvalidResponse,
4119
+ DeleteAccountBranchProviderRejected,
4120
+ DeleteAccountContactBranch,
4121
+ DeleteAccountContactBranchDefect,
4122
+ DeleteAccountContactBranchDeleted,
4123
+ DeleteAccountContactBranchInvalidResponse,
4124
+ DeleteAccountContactBranchProviderRejected,
4125
+ DeleteAccountContactDefinition,
4126
+ DeleteAccountContactInputSchema,
4127
+ DeleteAccountContactMetadata,
4128
+ DeleteAccountContactOperation,
4129
+ DeleteAccountDefinition,
4130
+ DeleteAccountInputSchema,
4131
+ DeleteAccountMetadata,
4132
+ DeleteAccountOperation,
4133
+ DeleteConnectionBranch,
4134
+ DeleteConnectionBranchDefect,
4135
+ DeleteConnectionBranchDeleted,
4136
+ DeleteConnectionBranchInvalidResponse,
4137
+ DeleteConnectionBranchProviderRejected,
4138
+ DeleteConnectionDefinition,
4139
+ DeleteConnectionInputSchema,
4140
+ DeleteConnectionMetadata,
4141
+ DeleteConnectionOperation,
4142
+ DeleteDealBranch,
4143
+ DeleteDealBranchDefect,
4144
+ DeleteDealBranchDeleted,
4145
+ DeleteDealBranchInvalidResponse,
4146
+ DeleteDealBranchProviderRejected,
4147
+ DeleteDealDefinition,
4148
+ DeleteDealInputSchema,
4149
+ DeleteDealMetadata,
4150
+ DeleteDealOperation,
4151
+ DeleteEcommerceCustomerBranch,
4152
+ DeleteEcommerceCustomerBranchDefect,
4153
+ DeleteEcommerceCustomerBranchDeleted,
4154
+ DeleteEcommerceCustomerBranchInvalidResponse,
4155
+ DeleteEcommerceCustomerBranchProviderRejected,
4156
+ DeleteEcommerceCustomerDefinition,
4157
+ DeleteEcommerceCustomerInputSchema,
4158
+ DeleteEcommerceCustomerMetadata,
4159
+ DeleteEcommerceCustomerOperation,
4160
+ DeleteTagBranch,
4161
+ DeleteTagBranchDefect,
4162
+ DeleteTagBranchDeleted,
4163
+ DeleteTagBranchInvalidResponse,
4164
+ DeleteTagBranchProviderRejected,
4165
+ DeleteTagDefinition,
4166
+ DeleteTagInputSchema,
4167
+ DeleteTagMetadata,
4168
+ DeleteTagOperation,
4169
+ EcommerceCustomerDeletionSchema,
4170
+ EcommerceCustomerMetadataSchema,
4171
+ EcommerceCustomersPageSchema,
4172
+ EcommerceOrderLineItemInputSchema,
4173
+ EcommerceOrderMetadataSchema,
4174
+ EcommerceOrderProductMetadataSchema,
4175
+ EcommerceOrderProductsPageSchema,
4176
+ EcommerceOrderUpsertMetadataSchema,
4177
+ EcommerceOrdersPageSchema,
4178
+ GetAccountBranch,
4179
+ GetAccountBranchDefect,
4180
+ GetAccountBranchFound,
4181
+ GetAccountBranchInvalidResponse,
4182
+ GetAccountBranchNotFound,
4183
+ GetAccountBranchProviderRejected,
4184
+ GetAccountContactBranch,
4185
+ GetAccountContactBranchDefect,
4186
+ GetAccountContactBranchFound,
4187
+ GetAccountContactBranchInvalidResponse,
4188
+ GetAccountContactBranchNotFound,
4189
+ GetAccountContactBranchProviderRejected,
4190
+ GetAccountContactDefinition,
4191
+ GetAccountContactInputSchema,
4192
+ GetAccountContactMetadata,
4193
+ GetAccountContactOperation,
4194
+ GetAccountDefinition,
4195
+ GetAccountInputSchema,
4196
+ GetAccountMetadata,
4197
+ GetAccountOperation,
4198
+ GetConnectionBranch,
4199
+ GetConnectionBranchDefect,
4200
+ GetConnectionBranchFound,
4201
+ GetConnectionBranchInvalidResponse,
4202
+ GetConnectionBranchNotFound,
4203
+ GetConnectionBranchProviderRejected,
4204
+ GetConnectionDefinition,
4205
+ GetConnectionInputSchema,
4206
+ GetConnectionMetadata,
4207
+ GetConnectionOperation,
260
4208
  GetContactBranch,
261
4209
  GetContactBranchDefect,
262
4210
  GetContactBranchFound,
@@ -267,6 +4215,122 @@ export {
267
4215
  GetContactInputSchema,
268
4216
  GetContactMetadata,
269
4217
  GetContactOperation,
4218
+ GetDealBranch,
4219
+ GetDealBranchDefect,
4220
+ GetDealBranchFound,
4221
+ GetDealBranchInvalidResponse,
4222
+ GetDealBranchNotFound,
4223
+ GetDealBranchProviderRejected,
4224
+ GetDealDefinition,
4225
+ GetDealInputSchema,
4226
+ GetDealMetadata,
4227
+ GetDealNoteBranch,
4228
+ GetDealNoteBranchDefect,
4229
+ GetDealNoteBranchFound,
4230
+ GetDealNoteBranchInvalidResponse,
4231
+ GetDealNoteBranchNotFound,
4232
+ GetDealNoteBranchProviderRejected,
4233
+ GetDealNoteDefinition,
4234
+ GetDealNoteInputSchema,
4235
+ GetDealNoteMetadata,
4236
+ GetDealNoteOperation,
4237
+ GetDealOperation,
4238
+ GetEcommerceCustomerBranch,
4239
+ GetEcommerceCustomerBranchDefect,
4240
+ GetEcommerceCustomerBranchFound,
4241
+ GetEcommerceCustomerBranchInvalidResponse,
4242
+ GetEcommerceCustomerBranchNotFound,
4243
+ GetEcommerceCustomerBranchProviderRejected,
4244
+ GetEcommerceCustomerDefinition,
4245
+ GetEcommerceCustomerInputSchema,
4246
+ GetEcommerceCustomerMetadata,
4247
+ GetEcommerceCustomerOperation,
4248
+ GetEcommerceOrderBranch,
4249
+ GetEcommerceOrderBranchDefect,
4250
+ GetEcommerceOrderBranchFound,
4251
+ GetEcommerceOrderBranchInvalidResponse,
4252
+ GetEcommerceOrderBranchNotFound,
4253
+ GetEcommerceOrderBranchProviderRejected,
4254
+ GetEcommerceOrderDefinition,
4255
+ GetEcommerceOrderInputSchema,
4256
+ GetEcommerceOrderMetadata,
4257
+ GetEcommerceOrderOperation,
4258
+ GetEcommerceOrderProductBranch,
4259
+ GetEcommerceOrderProductBranchDefect,
4260
+ GetEcommerceOrderProductBranchFound,
4261
+ GetEcommerceOrderProductBranchInvalidResponse,
4262
+ GetEcommerceOrderProductBranchNotFound,
4263
+ GetEcommerceOrderProductBranchProviderRejected,
4264
+ GetEcommerceOrderProductDefinition,
4265
+ GetEcommerceOrderProductInputSchema,
4266
+ GetEcommerceOrderProductMetadata,
4267
+ GetEcommerceOrderProductOperation,
4268
+ GetListBranch,
4269
+ GetListBranchDefect,
4270
+ GetListBranchFound,
4271
+ GetListBranchInvalidResponse,
4272
+ GetListBranchNotFound,
4273
+ GetListBranchProviderRejected,
4274
+ GetListDefinition,
4275
+ GetListInputSchema,
4276
+ GetListMetadata,
4277
+ GetListOperation,
4278
+ GetTagBranch,
4279
+ GetTagBranchDefect,
4280
+ GetTagBranchFound,
4281
+ GetTagBranchInvalidResponse,
4282
+ GetTagBranchNotFound,
4283
+ GetTagBranchProviderRejected,
4284
+ GetTagDefinition,
4285
+ GetTagInputSchema,
4286
+ GetTagMetadata,
4287
+ GetTagOperation,
4288
+ ListAccountContactsBranch,
4289
+ ListAccountContactsBranchDefect,
4290
+ ListAccountContactsBranchInvalidResponse,
4291
+ ListAccountContactsBranchListed,
4292
+ ListAccountContactsBranchProviderRejected,
4293
+ ListAccountContactsDefinition,
4294
+ ListAccountContactsInputSchema,
4295
+ ListAccountContactsMetadata,
4296
+ ListAccountContactsOperation,
4297
+ ListAccountsBranch,
4298
+ ListAccountsBranchDefect,
4299
+ ListAccountsBranchInvalidResponse,
4300
+ ListAccountsBranchListed,
4301
+ ListAccountsBranchProviderRejected,
4302
+ ListAccountsDefinition,
4303
+ ListAccountsInputSchema,
4304
+ ListAccountsMetadata,
4305
+ ListAccountsOperation,
4306
+ ListConnectionsBranch,
4307
+ ListConnectionsBranchDefect,
4308
+ ListConnectionsBranchInvalidResponse,
4309
+ ListConnectionsBranchListed,
4310
+ ListConnectionsBranchProviderRejected,
4311
+ ListConnectionsDefinition,
4312
+ ListConnectionsInputSchema,
4313
+ ListConnectionsMetadata,
4314
+ ListConnectionsOperation,
4315
+ ListContactListMembershipsBranch,
4316
+ ListContactListMembershipsBranchDefect,
4317
+ ListContactListMembershipsBranchInvalidResponse,
4318
+ ListContactListMembershipsBranchListed,
4319
+ ListContactListMembershipsBranchProviderRejected,
4320
+ ListContactListMembershipsDefinition,
4321
+ ListContactListMembershipsInputSchema,
4322
+ ListContactListMembershipsMetadata,
4323
+ ListContactListMembershipsOperation,
4324
+ ListContactTagsBranch,
4325
+ ListContactTagsBranchDefect,
4326
+ ListContactTagsBranchInvalidResponse,
4327
+ ListContactTagsBranchListed,
4328
+ ListContactTagsBranchNotFound,
4329
+ ListContactTagsBranchProviderRejected,
4330
+ ListContactTagsDefinition,
4331
+ ListContactTagsInputSchema,
4332
+ ListContactTagsMetadata,
4333
+ ListContactTagsOperation,
270
4334
  ListContactsBranch,
271
4335
  ListContactsBranchDefect,
272
4336
  ListContactsBranchInvalidResponse,
@@ -276,11 +4340,267 @@ export {
276
4340
  ListContactsInputSchema,
277
4341
  ListContactsMetadata,
278
4342
  ListContactsOperation,
4343
+ ListDealNotesBranch,
4344
+ ListDealNotesBranchDefect,
4345
+ ListDealNotesBranchInvalidResponse,
4346
+ ListDealNotesBranchListed,
4347
+ ListDealNotesBranchProviderRejected,
4348
+ ListDealNotesDefinition,
4349
+ ListDealNotesInputSchema,
4350
+ ListDealNotesMetadata,
4351
+ ListDealNotesOperation,
4352
+ ListDealsBranch,
4353
+ ListDealsBranchDefect,
4354
+ ListDealsBranchInvalidResponse,
4355
+ ListDealsBranchListed,
4356
+ ListDealsBranchProviderRejected,
4357
+ ListDealsDefinition,
4358
+ ListDealsInputSchema,
4359
+ ListDealsMetadata,
4360
+ ListDealsOperation,
4361
+ ListEcommerceCustomersBranch,
4362
+ ListEcommerceCustomersBranchDefect,
4363
+ ListEcommerceCustomersBranchInvalidResponse,
4364
+ ListEcommerceCustomersBranchListed,
4365
+ ListEcommerceCustomersBranchProviderRejected,
4366
+ ListEcommerceCustomersDefinition,
4367
+ ListEcommerceCustomersInputSchema,
4368
+ ListEcommerceCustomersMetadata,
4369
+ ListEcommerceCustomersOperation,
4370
+ ListEcommerceOrderProductsBranch,
4371
+ ListEcommerceOrderProductsBranchDefect,
4372
+ ListEcommerceOrderProductsBranchInvalidResponse,
4373
+ ListEcommerceOrderProductsBranchListed,
4374
+ ListEcommerceOrderProductsBranchProviderRejected,
4375
+ ListEcommerceOrderProductsDefinition,
4376
+ ListEcommerceOrderProductsInputSchema,
4377
+ ListEcommerceOrderProductsMetadata,
4378
+ ListEcommerceOrderProductsOperation,
4379
+ ListEcommerceOrdersBranch,
4380
+ ListEcommerceOrdersBranchDefect,
4381
+ ListEcommerceOrdersBranchInvalidResponse,
4382
+ ListEcommerceOrdersBranchListed,
4383
+ ListEcommerceOrdersBranchProviderRejected,
4384
+ ListEcommerceOrdersDefinition,
4385
+ ListEcommerceOrdersInputSchema,
4386
+ ListEcommerceOrdersMetadata,
4387
+ ListEcommerceOrdersOperation,
4388
+ ListListsBranch,
4389
+ ListListsBranchDefect,
4390
+ ListListsBranchInvalidResponse,
4391
+ ListListsBranchListed,
4392
+ ListListsBranchProviderRejected,
4393
+ ListListsDefinition,
4394
+ ListListsInputSchema,
4395
+ ListListsMetadata,
4396
+ ListListsOperation,
4397
+ ListMetadataSchema,
4398
+ ListProductsForEcommerceOrderBranch,
4399
+ ListProductsForEcommerceOrderBranchDefect,
4400
+ ListProductsForEcommerceOrderBranchInvalidResponse,
4401
+ ListProductsForEcommerceOrderBranchListed,
4402
+ ListProductsForEcommerceOrderBranchNotFound,
4403
+ ListProductsForEcommerceOrderBranchProviderRejected,
4404
+ ListProductsForEcommerceOrderDefinition,
4405
+ ListProductsForEcommerceOrderInputSchema,
4406
+ ListProductsForEcommerceOrderMetadata,
4407
+ ListProductsForEcommerceOrderOperation,
4408
+ ListTagsBranch,
4409
+ ListTagsBranchDefect,
4410
+ ListTagsBranchInvalidResponse,
4411
+ ListTagsBranchListed,
4412
+ ListTagsBranchProviderRejected,
4413
+ ListTagsDefinition,
4414
+ ListTagsInputSchema,
4415
+ ListTagsMetadata,
4416
+ ListTagsOperation,
4417
+ ListsPageSchema,
279
4418
  ProviderID,
4419
+ RemoveTagFromContactBranch,
4420
+ RemoveTagFromContactBranchDefect,
4421
+ RemoveTagFromContactBranchInvalidResponse,
4422
+ RemoveTagFromContactBranchProviderRejected,
4423
+ RemoveTagFromContactBranchRemoved,
4424
+ RemoveTagFromContactDefinition,
4425
+ RemoveTagFromContactInputSchema,
4426
+ RemoveTagFromContactMetadata,
4427
+ RemoveTagFromContactOperation,
4428
+ SetContactListMembershipInputSchema,
4429
+ SubscribeContactToListBranch,
4430
+ SubscribeContactToListBranchDefect,
4431
+ SubscribeContactToListBranchProviderRejected,
4432
+ SubscribeContactToListBranchSubscribed,
4433
+ SubscribeContactToListBranchUncertain,
4434
+ SubscribeContactToListDefinition,
4435
+ SubscribeContactToListMetadata,
4436
+ SubscribeContactToListOperation,
4437
+ SyncContactBranch,
4438
+ SyncContactBranchDefect,
4439
+ SyncContactBranchInvalidResponse,
4440
+ SyncContactBranchProviderRejected,
4441
+ SyncContactBranchSynced,
4442
+ SyncContactDefinition,
4443
+ SyncContactInputSchema,
4444
+ SyncContactMetadata,
4445
+ SyncContactOperation,
4446
+ TagDeletionSchema,
4447
+ TagMetadataSchema,
4448
+ TagsPageSchema,
4449
+ UnsubscribeContactFromListBranch,
4450
+ UnsubscribeContactFromListBranchDefect,
4451
+ UnsubscribeContactFromListBranchProviderRejected,
4452
+ UnsubscribeContactFromListBranchUncertain,
4453
+ UnsubscribeContactFromListBranchUnsubscribed,
4454
+ UnsubscribeContactFromListDefinition,
4455
+ UnsubscribeContactFromListMetadata,
4456
+ UnsubscribeContactFromListOperation,
4457
+ UpdateAccountBranch,
4458
+ UpdateAccountBranchDefect,
4459
+ UpdateAccountBranchInvalidResponse,
4460
+ UpdateAccountBranchNotFound,
4461
+ UpdateAccountBranchProviderRejected,
4462
+ UpdateAccountBranchUpdated,
4463
+ UpdateAccountContactBranch,
4464
+ UpdateAccountContactBranchDefect,
4465
+ UpdateAccountContactBranchInvalidResponse,
4466
+ UpdateAccountContactBranchNotFound,
4467
+ UpdateAccountContactBranchProviderRejected,
4468
+ UpdateAccountContactBranchUpdated,
4469
+ UpdateAccountContactDefinition,
4470
+ UpdateAccountContactInputSchema,
4471
+ UpdateAccountContactMetadata,
4472
+ UpdateAccountContactOperation,
4473
+ UpdateAccountDefinition,
4474
+ UpdateAccountInputSchema,
4475
+ UpdateAccountMetadata,
4476
+ UpdateAccountOperation,
4477
+ UpdateConnectionBranch,
4478
+ UpdateConnectionBranchDefect,
4479
+ UpdateConnectionBranchInvalidResponse,
4480
+ UpdateConnectionBranchNotFound,
4481
+ UpdateConnectionBranchProviderRejected,
4482
+ UpdateConnectionBranchUpdated,
4483
+ UpdateConnectionDefinition,
4484
+ UpdateConnectionInputSchema,
4485
+ UpdateConnectionMetadata,
4486
+ UpdateConnectionOperation,
4487
+ UpdateContactBranch,
4488
+ UpdateContactBranchDefect,
4489
+ UpdateContactBranchInvalidResponse,
4490
+ UpdateContactBranchNotFound,
4491
+ UpdateContactBranchProviderRejected,
4492
+ UpdateContactBranchUpdated,
4493
+ UpdateContactDefinition,
4494
+ UpdateContactInputSchema,
4495
+ UpdateContactMetadata,
4496
+ UpdateContactOperation,
4497
+ UpdateDealBranch,
4498
+ UpdateDealBranchDefect,
4499
+ UpdateDealBranchInvalidResponse,
4500
+ UpdateDealBranchNotFound,
4501
+ UpdateDealBranchProviderRejected,
4502
+ UpdateDealBranchUpdated,
4503
+ UpdateDealDefinition,
4504
+ UpdateDealInputSchema,
4505
+ UpdateDealMetadata,
4506
+ UpdateDealNoteBranch,
4507
+ UpdateDealNoteBranchDefect,
4508
+ UpdateDealNoteBranchInvalidResponse,
4509
+ UpdateDealNoteBranchNotFound,
4510
+ UpdateDealNoteBranchProviderRejected,
4511
+ UpdateDealNoteBranchUpdated,
4512
+ UpdateDealNoteDefinition,
4513
+ UpdateDealNoteInputSchema,
4514
+ UpdateDealNoteMetadata,
4515
+ UpdateDealNoteOperation,
4516
+ UpdateDealOperation,
4517
+ UpdateEcommerceCustomerBranch,
4518
+ UpdateEcommerceCustomerBranchDefect,
4519
+ UpdateEcommerceCustomerBranchInvalidResponse,
4520
+ UpdateEcommerceCustomerBranchNotFound,
4521
+ UpdateEcommerceCustomerBranchProviderRejected,
4522
+ UpdateEcommerceCustomerBranchUpdated,
4523
+ UpdateEcommerceCustomerDefinition,
4524
+ UpdateEcommerceCustomerInputSchema,
4525
+ UpdateEcommerceCustomerMetadata,
4526
+ UpdateEcommerceCustomerOperation,
4527
+ UpdateTagBranch,
4528
+ UpdateTagBranchDefect,
4529
+ UpdateTagBranchInvalidResponse,
4530
+ UpdateTagBranchNotFound,
4531
+ UpdateTagBranchProviderRejected,
4532
+ UpdateTagBranchUpdated,
4533
+ UpdateTagDefinition,
4534
+ UpdateTagInputSchema,
4535
+ UpdateTagMetadata,
4536
+ UpdateTagOperation,
4537
+ UpsertEcommerceOrderBranch,
4538
+ UpsertEcommerceOrderBranchDefect,
4539
+ UpsertEcommerceOrderBranchProviderRejected,
4540
+ UpsertEcommerceOrderBranchUpserted,
4541
+ UpsertEcommerceOrderDefinition,
4542
+ UpsertEcommerceOrderInputSchema,
4543
+ UpsertEcommerceOrderMetadata,
4544
+ UpsertEcommerceOrderOperation,
280
4545
  decodeCredentials,
4546
+ decodeSignedInteger,
4547
+ exactIntegerJSONCodec,
4548
+ isCredentialMaterialError,
4549
+ newApplyTagToContactStep,
281
4550
  newConnection,
282
4551
  newConnectionWithOperations,
4552
+ newCreateAccountContactStep,
4553
+ newCreateAccountStep,
4554
+ newCreateConnectionStep,
4555
+ newCreateDealNoteStep,
4556
+ newCreateDealStep,
4557
+ newCreateEcommerceCustomerStep,
4558
+ newCreateTagStep,
4559
+ newDeleteAccountContactStep,
4560
+ newDeleteAccountStep,
4561
+ newDeleteConnectionStep,
4562
+ newDeleteDealStep,
4563
+ newDeleteEcommerceCustomerStep,
4564
+ newDeleteTagStep,
4565
+ newGetAccountContactStep,
4566
+ newGetAccountStep,
4567
+ newGetConnectionStep,
283
4568
  newGetContactStep,
4569
+ newGetDealNoteStep,
4570
+ newGetDealStep,
4571
+ newGetEcommerceCustomerStep,
4572
+ newGetEcommerceOrderProductStep,
4573
+ newGetEcommerceOrderStep,
4574
+ newGetListStep,
4575
+ newGetTagStep,
4576
+ newListAccountContactsStep,
4577
+ newListAccountsStep,
4578
+ newListConnectionsStep,
4579
+ newListContactListMembershipsStep,
4580
+ newListContactTagsStep,
284
4581
  newListContactsStep,
285
- newProjectConnection2 as newProjectConnection
4582
+ newListDealNotesStep,
4583
+ newListDealsStep,
4584
+ newListEcommerceCustomersStep,
4585
+ newListEcommerceOrderProductsStep,
4586
+ newListEcommerceOrdersStep,
4587
+ newListListsStep,
4588
+ newListProductsForEcommerceOrderStep,
4589
+ newListTagsStep,
4590
+ newProjectConnection2 as newProjectConnection,
4591
+ newRemoveTagFromContactStep,
4592
+ newSubscribeContactToListStep,
4593
+ newSyncContactStep,
4594
+ newUnsubscribeContactFromListStep,
4595
+ newUpdateAccountContactStep,
4596
+ newUpdateAccountStep,
4597
+ newUpdateConnectionStep,
4598
+ newUpdateContactStep,
4599
+ newUpdateDealNoteStep,
4600
+ newUpdateDealStep,
4601
+ newUpdateEcommerceCustomerStep,
4602
+ newUpdateTagStep,
4603
+ newUpsertEcommerceOrderStep,
4604
+ parseExactIntegerJSON,
4605
+ parseJSONNumberTokens
286
4606
  };