@superdurable/connector-activecampaign 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Super Durable
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
- # Temporary Holding Version
1
+ # ActiveCampaign TypeScript connector
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This package implements `listContacts` and `getContact` for Dex TypeScript Flows. Both operations replay the Go reference's provider requests, branches, retries, and exact outputs through shared conformance scenarios. Embedded relationships and custom field values are excluded from Flow results.
4
+
5
+ Sign in to [ActiveCampaign](https://www.activecampaign.com/login), open Settings > Developer, and copy the account API URL into `baseUrl` and the API Key into the Dex Web connection secret. The package sends the key only in the `Api-Token` header. The [connector README](../README.md) describes operation inputs and defaults; [contact inspection](examples/contact-inspection/README.md) is the runnable example.
6
+
7
+ Live ActiveCampaign authorization and responses have not been verified locally. Package release is independent of the Go and Python releases.
@@ -0,0 +1,118 @@
1
+ {
2
+ "connectorId": "activecampaign",
3
+ "releaseTag": "connectors/activecampaign/go/v0.1.0",
4
+ "package": {
5
+ "ecosystem": "npm",
6
+ "name": "@superdurable/connector-activecampaign",
7
+ "version": "0.1.0"
8
+ },
9
+ "factories": [
10
+ {
11
+ "name": "newListContactsStep",
12
+ "kind": "query",
13
+ "operationId": "listContacts",
14
+ "inputType": "ListContactsInput",
15
+ "description": "List one page of contact IDs, email addresses, and names without embedded relationships.",
16
+ "fields": {
17
+ "stepType": "stepType",
18
+ "annotations": "annotations",
19
+ "connectionName": "connectionName",
20
+ "resultAttribute": "resultAttribute"
21
+ },
22
+ "branches": [
23
+ {
24
+ "id": "listed",
25
+ "field": "listed",
26
+ "optional": false
27
+ },
28
+ {
29
+ "id": "providerRejected",
30
+ "field": "providerRejected",
31
+ "optional": true
32
+ },
33
+ {
34
+ "id": "invalidResponse",
35
+ "field": "invalidResponse",
36
+ "optional": true
37
+ },
38
+ {
39
+ "id": "defect",
40
+ "field": "defect",
41
+ "optional": true
42
+ }
43
+ ],
44
+ "inputSchema": {
45
+ "additionalProperties": false,
46
+ "description": "ListContactsInput selects an offset-based page of at most 100 contacts.",
47
+ "properties": {
48
+ "limit": {
49
+ "description": "Limit is the maximum contact count; zero defaults to 20.",
50
+ "type": "integer"
51
+ },
52
+ "offset": {
53
+ "description": "Offset is the zero-based number of contacts to skip.",
54
+ "type": "integer"
55
+ }
56
+ },
57
+ "required": [
58
+ "offset"
59
+ ],
60
+ "type": "object"
61
+ }
62
+ },
63
+ {
64
+ "name": "newGetContactStep",
65
+ "kind": "query",
66
+ "operationId": "getContact",
67
+ "inputType": "GetContactInput",
68
+ "description": "Read one contact's ID, email address, and name without embedded relationships.",
69
+ "fields": {
70
+ "stepType": "stepType",
71
+ "annotations": "annotations",
72
+ "connectionName": "connectionName",
73
+ "resultAttribute": "resultAttribute"
74
+ },
75
+ "branches": [
76
+ {
77
+ "id": "found",
78
+ "field": "found",
79
+ "optional": false
80
+ },
81
+ {
82
+ "id": "notFound",
83
+ "field": "notFound",
84
+ "optional": true
85
+ },
86
+ {
87
+ "id": "providerRejected",
88
+ "field": "providerRejected",
89
+ "optional": true
90
+ },
91
+ {
92
+ "id": "invalidResponse",
93
+ "field": "invalidResponse",
94
+ "optional": true
95
+ },
96
+ {
97
+ "id": "defect",
98
+ "field": "defect",
99
+ "optional": true
100
+ }
101
+ ],
102
+ "inputSchema": {
103
+ "additionalProperties": false,
104
+ "description": "GetContactInput selects one numeric ActiveCampaign contact ID.",
105
+ "properties": {
106
+ "contactId": {
107
+ "description": "ContactID is the numeric ID from the Contacts page or API.",
108
+ "type": "string"
109
+ }
110
+ },
111
+ "required": [
112
+ "contactId"
113
+ ],
114
+ "type": "object"
115
+ }
116
+ }
117
+ ]
118
+ }
@@ -0,0 +1,147 @@
1
+ // src/generated/models.ts
2
+ import { z } from "zod";
3
+ import { SecretString } from "@superdurable/connectors-sdk";
4
+ var ConfigSchema = z.object({
5
+ "baseUrl": z.string(),
6
+ "timeoutMs": z.number().int().optional(),
7
+ "maxResponseBytes": z.number().int().optional()
8
+ });
9
+ function decodeCredentials(value) {
10
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
11
+ const fields = value;
12
+ const allowed = /* @__PURE__ */ new Set(["api_key"]);
13
+ if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
14
+ if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new TypeError("credential api_key has an invalid type");
15
+ const credentials = {};
16
+ if (!fields["api_key"]) throw new TypeError("credential api_key is required");
17
+ credentials.apiKey = new SecretString(fields["api_key"] ?? "");
18
+ return credentials;
19
+ }
20
+ var ListContactsInputSchema = z.strictObject({
21
+ "offset": z.number().int(),
22
+ "limit": z.number().int().optional()
23
+ });
24
+ var ContactMetadataSchema = z.strictObject({
25
+ "id": z.string(),
26
+ "email": z.string(),
27
+ "firstName": z.string(),
28
+ "lastName": z.string()
29
+ });
30
+ var ContactsPageSchema = z.strictObject({
31
+ "contacts": z.array(ContactMetadataSchema).nullable(),
32
+ "offset": z.number().int(),
33
+ "limit": z.number().int(),
34
+ "total": z.number().int()
35
+ });
36
+ var GetContactInputSchema = z.strictObject({
37
+ "contactId": z.string()
38
+ });
39
+
40
+ // src/generated/definitions.ts
41
+ var ConnectorID = "activecampaign";
42
+ var ProviderID = "activecampaign";
43
+ var ListContactsBranch = {
44
+ Listed: "listed",
45
+ ProviderRejected: "providerRejected",
46
+ InvalidResponse: "invalidResponse",
47
+ Defect: "defect"
48
+ };
49
+ var ListContactsBranchListed = ListContactsBranch.Listed;
50
+ var ListContactsBranchProviderRejected = ListContactsBranch.ProviderRejected;
51
+ var ListContactsBranchInvalidResponse = ListContactsBranch.InvalidResponse;
52
+ var ListContactsBranchDefect = ListContactsBranch.Defect;
53
+ var ListContactsDefinition = {
54
+ operation: { connectorId: ConnectorID, operationId: "listContacts" },
55
+ branches: [
56
+ { id: "listed", description: "ActiveCampaign returned the selected contact page." },
57
+ { id: "providerRejected", description: "ActiveCampaign conclusively rejected the request.", optional: true },
58
+ { id: "invalidResponse", description: "ActiveCampaign returned malformed or oversized JSON.", optional: true },
59
+ { id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
60
+ ],
61
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
62
+ };
63
+ var ListContactsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
64
+ var GetContactBranch = {
65
+ Found: "found",
66
+ NotFound: "notFound",
67
+ ProviderRejected: "providerRejected",
68
+ InvalidResponse: "invalidResponse",
69
+ Defect: "defect"
70
+ };
71
+ var GetContactBranchFound = GetContactBranch.Found;
72
+ var GetContactBranchNotFound = GetContactBranch.NotFound;
73
+ var GetContactBranchProviderRejected = GetContactBranch.ProviderRejected;
74
+ var GetContactBranchInvalidResponse = GetContactBranch.InvalidResponse;
75
+ var GetContactBranchDefect = GetContactBranch.Defect;
76
+ var GetContactDefinition = {
77
+ operation: { connectorId: ConnectorID, operationId: "getContact" },
78
+ branches: [
79
+ { id: "found", description: "ActiveCampaign returned contact metadata." },
80
+ { id: "notFound", description: "No contact with this ID is visible to the API user.", optional: true },
81
+ { id: "providerRejected", description: "ActiveCampaign conclusively rejected the request.", optional: true },
82
+ { id: "invalidResponse", description: "ActiveCampaign returned malformed or oversized JSON.", optional: true },
83
+ { id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
84
+ ],
85
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
86
+ };
87
+ var GetContactMetadata = { kind: "query", idempotency: "none", authorization: "required" };
88
+
89
+ // src/generated/connection.ts
90
+ import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
91
+ var Connection = class {
92
+ /** Stable provider and connection name. */
93
+ reference;
94
+ /** Bound provider operations. */
95
+ operations;
96
+ /** Validate a reference and bind operations. */
97
+ constructor(reference, operations) {
98
+ this.reference = ConnectionRefSchema.parse(reference);
99
+ if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
100
+ if (!operations) throw new TypeError("connector operations are required");
101
+ this.operations = operations;
102
+ }
103
+ };
104
+ function newConnection(client, reference) {
105
+ if (!client) throw new TypeError("connector client is required");
106
+ return new Connection(reference, client);
107
+ }
108
+ function newConnectionWithOperations(operations, reference) {
109
+ return new Connection(reference, operations);
110
+ }
111
+ function newProjectConnection(project, connectionName, createClient) {
112
+ if (!project) throw new TypeError("loaded project is required");
113
+ const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
114
+ const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
115
+ if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
116
+ return newConnection(createClient(project, connectionName), reference);
117
+ }
118
+
119
+ export {
120
+ ConfigSchema,
121
+ decodeCredentials,
122
+ ListContactsInputSchema,
123
+ ContactMetadataSchema,
124
+ ContactsPageSchema,
125
+ GetContactInputSchema,
126
+ ConnectorID,
127
+ ProviderID,
128
+ ListContactsBranch,
129
+ ListContactsBranchListed,
130
+ ListContactsBranchProviderRejected,
131
+ ListContactsBranchInvalidResponse,
132
+ ListContactsBranchDefect,
133
+ ListContactsDefinition,
134
+ ListContactsMetadata,
135
+ GetContactBranch,
136
+ GetContactBranchFound,
137
+ GetContactBranchNotFound,
138
+ GetContactBranchProviderRejected,
139
+ GetContactBranchInvalidResponse,
140
+ GetContactBranchDefect,
141
+ GetContactDefinition,
142
+ GetContactMetadata,
143
+ Connection,
144
+ newConnection,
145
+ newConnectionWithOperations,
146
+ newProjectConnection
147
+ };
@@ -0,0 +1,112 @@
1
+ import { SecretString, CredentialProvider, Query, ConnectionRef } from '@superdurable/connectors-sdk';
2
+ import { z } from 'zod';
3
+
4
+ /** Connector configuration; omitted fields use manifest defaults. */
5
+ interface Config {
6
+ /** Non-secret account-specific API root copied from ActiveCampaign Settings > Developer at https://www.activecampaign.com/login. Enter the full HTTPS API URL ending in /api/3 without a trailing resource path, query, or token; blank prevents connection creation. It may have an account-specific domain and region. */
7
+ baseUrl: string;
8
+ /** Maximum duration of one API request as a positive Go duration such as 15s or 1m. Blank uses the displayed default; increase only for slow responses. Runtime value in milliseconds. */
9
+ timeoutMs?: number;
10
+ /** Positive maximum complete API response in bytes. Blank uses the displayed default; increase for known larger contact pages. Oversized responses select invalidResponse. */
11
+ maxResponseBytes?: number;
12
+ }
13
+ /** Runtime schema for manifest configuration. */
14
+ declare const ConfigSchema: z.ZodObject<{
15
+ baseUrl: z.ZodString;
16
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
17
+ maxResponseBytes: z.ZodOptional<z.ZodNumber>;
18
+ }, z.core.$strip>;
19
+ /** Private connector credentials resolved by the host. */
20
+ interface Credentials {
21
+ /** Secret user-specific API Key from ActiveCampaign Settings > Developer at https://www.activecampaign.com/login. Copy the full key into this secret field; blank makes calls select defect. Dex sends it only in the Api-Token header. Reset it on the same page to revoke an exposed key. */
22
+ apiKey: SecretString;
23
+ }
24
+ /** Decode private credential fields for the connector. */
25
+ declare function decodeCredentials(value: unknown): Credentials;
26
+ /** Host-owned source of private connector credentials. */
27
+ type CredentialSource = CredentialProvider<Credentials>;
28
+ /** ListContactsInput selects an offset-based page of at most 100 contacts. */
29
+ interface ListContactsInput {
30
+ /** Offset is the zero-based number of contacts to skip. */
31
+ "offset": number;
32
+ /** Limit is the maximum contact count; zero defaults to 20. */
33
+ "limit"?: number | undefined;
34
+ }
35
+ /** ContactMetadata contains contact identity and name without embedded relationships. */
36
+ interface ContactMetadata {
37
+ /** ID is the stable provider contact ID. */
38
+ "id": string;
39
+ /** Email is the contact email address, if present. */
40
+ "email": string;
41
+ /** FirstName is the contact given name, if present. */
42
+ "firstName": string;
43
+ /** LastName is the contact family name, if present. */
44
+ "lastName": string;
45
+ }
46
+ /** ContactsPage is one offset-based contact page. */
47
+ interface ContactsPage {
48
+ /** Contacts contains the selected contact records. */
49
+ "contacts": Array<ContactMetadata> | null;
50
+ /** Offset is the requested zero-based offset. */
51
+ "offset": number;
52
+ /** Limit is the requested maximum count. */
53
+ "limit": number;
54
+ /** Total is the provider's matching contact count. */
55
+ "total": number;
56
+ }
57
+ /** GetContactInput selects one numeric ActiveCampaign contact ID. */
58
+ interface GetContactInput {
59
+ /** ContactID is the numeric ID from the Contacts page or API. */
60
+ "contactId": string;
61
+ }
62
+ /** Runtime validator for ListContactsInput. */
63
+ declare const ListContactsInputSchema: z.ZodObject<{
64
+ offset: z.ZodNumber;
65
+ limit: z.ZodOptional<z.ZodNumber>;
66
+ }, z.core.$strict>;
67
+ /** Runtime validator for ContactMetadata. */
68
+ declare const ContactMetadataSchema: z.ZodObject<{
69
+ id: z.ZodString;
70
+ email: z.ZodString;
71
+ firstName: z.ZodString;
72
+ lastName: z.ZodString;
73
+ }, z.core.$strict>;
74
+ /** Runtime validator for ContactsPage. */
75
+ declare const ContactsPageSchema: z.ZodObject<{
76
+ contacts: z.ZodNullable<z.ZodArray<z.ZodObject<{
77
+ id: z.ZodString;
78
+ email: z.ZodString;
79
+ firstName: z.ZodString;
80
+ lastName: z.ZodString;
81
+ }, z.core.$strict>>>;
82
+ offset: z.ZodNumber;
83
+ limit: z.ZodNumber;
84
+ total: z.ZodNumber;
85
+ }, z.core.$strict>;
86
+ /** Runtime validator for GetContactInput. */
87
+ declare const GetContactInputSchema: z.ZodObject<{
88
+ contactId: z.ZodString;
89
+ }, z.core.$strict>;
90
+
91
+ /** Typed operations supplied by a client or mock. */
92
+ interface Operations {
93
+ /** Invoke listContacts through this connection. */
94
+ listContacts(): Query<ListContactsInput, ContactsPage>;
95
+ /** Invoke getContact through this connection. */
96
+ getContact(): Query<GetContactInput, ContactMetadata>;
97
+ }
98
+ /** Named connector connection kept outside Flow state. */
99
+ declare class Connection<BoundOperations = Operations> {
100
+ /** Stable provider and connection name. */
101
+ readonly reference: ConnectionRef;
102
+ /** Bound provider operations. */
103
+ readonly operations: BoundOperations;
104
+ /** Validate a reference and bind operations. */
105
+ constructor(reference: ConnectionRef, operations: BoundOperations);
106
+ }
107
+ /** Bind a client to a named connection. */
108
+ declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
109
+ /** Bind scripted operations to a named connection. */
110
+ declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
111
+
112
+ export { type ContactMetadata as C, type GetContactInput as G, type ListContactsInput as L, type Operations as O, Connection as a, type ContactsPage as b, type Config as c, type Credentials as d, ConfigSchema as e, ContactMetadataSchema as f, ContactsPageSchema as g, type CredentialSource as h, GetContactInputSchema as i, ListContactsInputSchema as j, decodeCredentials as k, newConnectionWithOperations as l, newConnection as n };
@@ -0,0 +1,149 @@
1
+ import { G as GetContactInput, C as ContactMetadata, a as Connection, L as ListContactsInput, b as ContactsPage, O as Operations, c as Config, d as Credentials } from './connection-2WCEk-xS.js';
2
+ export { e as ConfigSchema, f as ContactMetadataSchema, g as ContactsPageSchema, h as CredentialSource, i as GetContactInputSchema, j as ListContactsInputSchema, k as decodeCredentials, n as newConnection, l as newConnectionWithOperations } from './connection-2WCEk-xS.js';
3
+ import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, CredentialProvider, Call, QueryAttempt, Failure } from '@superdurable/connectors-sdk';
4
+ import { StepTarget } from '@superdurable/dex';
5
+ import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
6
+ import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
7
+ import 'zod';
8
+
9
+ /** Stable connector identity. */
10
+ declare const ConnectorID = "activecampaign";
11
+ /** Provider identity for named connections. */
12
+ declare const ProviderID = "activecampaign";
13
+ /** Branch IDs for listContacts. */
14
+ declare const ListContactsBranch: {
15
+ readonly Listed: "listed";
16
+ readonly ProviderRejected: "providerRejected";
17
+ readonly InvalidResponse: "invalidResponse";
18
+ readonly Defect: "defect";
19
+ };
20
+ /** ActiveCampaign returned the selected contact page. */
21
+ declare const ListContactsBranchListed: "listed";
22
+ /** ActiveCampaign conclusively rejected the request. */
23
+ declare const ListContactsBranchProviderRejected: "providerRejected";
24
+ /** ActiveCampaign returned malformed or oversized JSON. */
25
+ declare const ListContactsBranchInvalidResponse: "invalidResponse";
26
+ /** Local input or connection credentials are invalid. */
27
+ declare const ListContactsBranchDefect: "defect";
28
+ /** Manifest definition for listContacts. */
29
+ declare const ListContactsDefinition: QueryDefinition;
30
+ /** Manifest metadata for listContacts. */
31
+ declare const ListContactsMetadata: {
32
+ readonly kind: "query";
33
+ readonly idempotency: "none";
34
+ readonly authorization: "required";
35
+ };
36
+ /** Branch IDs for getContact. */
37
+ declare const GetContactBranch: {
38
+ readonly Found: "found";
39
+ readonly NotFound: "notFound";
40
+ readonly ProviderRejected: "providerRejected";
41
+ readonly InvalidResponse: "invalidResponse";
42
+ readonly Defect: "defect";
43
+ };
44
+ /** ActiveCampaign returned contact metadata. */
45
+ declare const GetContactBranchFound: "found";
46
+ /** No contact with this ID is visible to the API user. */
47
+ declare const GetContactBranchNotFound: "notFound";
48
+ /** ActiveCampaign conclusively rejected the request. */
49
+ declare const GetContactBranchProviderRejected: "providerRejected";
50
+ /** ActiveCampaign returned malformed or oversized JSON. */
51
+ declare const GetContactBranchInvalidResponse: "invalidResponse";
52
+ /** Local input or connection credentials are invalid. */
53
+ declare const GetContactBranchDefect: "defect";
54
+ /** Manifest definition for getContact. */
55
+ declare const GetContactDefinition: QueryDefinition;
56
+ /** Manifest metadata for getContact. */
57
+ declare const GetContactMetadata: {
58
+ readonly kind: "query";
59
+ readonly idempotency: "none";
60
+ readonly authorization: "required";
61
+ };
62
+
63
+ /** Configuration for the listContacts connector Step. */
64
+ interface ListContactsStepConfig<StepInput, OperationInput = ListContactsInput, OperationOutput = ContactsPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
65
+ /** Named connection supplying this operation. */
66
+ connection: Connection<{
67
+ listContacts(): Query<OperationInput, OperationOutput>;
68
+ }>;
69
+ /** Name matching the bound connection. */
70
+ connectionName: string;
71
+ /** ActiveCampaign returned the selected contact page. */
72
+ listed: StepTarget<QueryResult<OperationOutput>>;
73
+ /** ActiveCampaign conclusively rejected the request. */
74
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
75
+ /** ActiveCampaign returned malformed or oversized JSON. */
76
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
77
+ /** Local input or connection credentials are invalid. */
78
+ defect?: StepTarget<QueryResult<OperationOutput>>;
79
+ }
80
+ /** Build the listContacts Step from a named connection. */
81
+ declare function newListContactsStep<StepInput, OperationInput = ListContactsInput, OperationOutput = ContactsPage>(configuration: ListContactsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
82
+ /** Configuration for the getContact connector Step. */
83
+ interface GetContactStepConfig<StepInput, OperationInput = GetContactInput, OperationOutput = ContactMetadata> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
84
+ /** Named connection supplying this operation. */
85
+ connection: Connection<{
86
+ getContact(): Query<OperationInput, OperationOutput>;
87
+ }>;
88
+ /** Name matching the bound connection. */
89
+ connectionName: string;
90
+ /** ActiveCampaign returned contact metadata. */
91
+ found: StepTarget<QueryResult<OperationOutput>>;
92
+ /** No contact with this ID is visible to the API user. */
93
+ notFound?: StepTarget<QueryResult<OperationOutput>>;
94
+ /** ActiveCampaign conclusively rejected the request. */
95
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
96
+ /** ActiveCampaign returned malformed or oversized JSON. */
97
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
98
+ /** Local input or connection credentials are invalid. */
99
+ defect?: StepTarget<QueryResult<OperationOutput>>;
100
+ }
101
+ /** Build the getContact Step from a named connection. */
102
+ declare function newGetContactStep<StepInput, OperationInput = GetContactInput, OperationOutput = ContactMetadata>(configuration: GetContactStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
103
+
104
+ /** Open one named ActiveCampaign connection from Dex project configuration. */
105
+ declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
106
+
107
+ /** Optional transport dependency for provider tests and local Dex examples. */
108
+ interface ActiveCampaignClientOptions {
109
+ /** One bounded provider request sender. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
110
+ }
111
+ interface ProviderOutcome {
112
+ body?: Uint8Array;
113
+ branch?: string;
114
+ failure?: Failure;
115
+ retry?: boolean;
116
+ retryAfterMs?: number;
117
+ }
118
+ /** Authenticated ActiveCampaign API client with call-time API Key resolution. */
119
+ declare class ActiveCampaignClient {
120
+ private readonly credentials;
121
+ private readonly baseUrl;
122
+ private readonly timeoutMs;
123
+ private readonly maxResponseBytes;
124
+ private readonly sendRequest;
125
+ /** Validate account configuration without contacting ActiveCampaign. */
126
+ constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: ActiveCampaignClientOptions);
127
+ /** Bind the contact page Query. */ listContacts(): ListContactsOperation;
128
+ /** Bind the contact metadata Query. */ getContact(): GetContactOperation;
129
+ /** Send one read and classify transport, HTTP, and response-size outcomes. */
130
+ exchange(call: Call, operation: string, path: string, hasNotFound: boolean): Promise<ProviderOutcome>;
131
+ }
132
+ /** List one offset-based page of contacts accessible to the API user. */
133
+ declare class ListContactsOperation implements Query<ListContactsInput, ContactsPage> {
134
+ private readonly client;
135
+ /** Bind the provider client. */ constructor(client: ActiveCampaignClient);
136
+ /** Return the generated operation definition. */ definition(): QueryDefinition;
137
+ /** Validate pagination and read contact metadata. */
138
+ invoke(call: Call, input: ListContactsInput): Promise<QueryAttempt<ContactsPage>>;
139
+ }
140
+ /** Read one contact without embedded relationship records. */
141
+ declare class GetContactOperation implements Query<GetContactInput, ContactMetadata> {
142
+ private readonly client;
143
+ /** Bind the provider client. */ constructor(client: ActiveCampaignClient);
144
+ /** Return the generated operation definition. */ definition(): QueryDefinition;
145
+ /** Validate the contact ID and read its metadata. */
146
+ invoke(call: Call, input: GetContactInput): Promise<QueryAttempt<ContactMetadata>>;
147
+ }
148
+
149
+ export { ActiveCampaignClient, type ActiveCampaignClientOptions, Config, Connection, ConnectorID, ContactMetadata, ContactsPage, Credentials, GetContactBranch, GetContactBranchDefect, GetContactBranchFound, GetContactBranchInvalidResponse, GetContactBranchNotFound, GetContactBranchProviderRejected, GetContactDefinition, GetContactInput, GetContactMetadata, GetContactOperation, type GetContactStepConfig, ListContactsBranch, ListContactsBranchDefect, ListContactsBranchInvalidResponse, ListContactsBranchListed, ListContactsBranchProviderRejected, ListContactsDefinition, ListContactsInput, ListContactsMetadata, ListContactsOperation, type ListContactsStepConfig, ProviderID, newGetContactStep, newListContactsStep, newProjectConnection };
package/dist/index.js ADDED
@@ -0,0 +1,286 @@
1
+ import {
2
+ ConfigSchema,
3
+ Connection,
4
+ ConnectorID,
5
+ ContactMetadataSchema,
6
+ ContactsPageSchema,
7
+ GetContactBranch,
8
+ GetContactBranchDefect,
9
+ GetContactBranchFound,
10
+ GetContactBranchInvalidResponse,
11
+ GetContactBranchNotFound,
12
+ GetContactBranchProviderRejected,
13
+ GetContactDefinition,
14
+ GetContactInputSchema,
15
+ GetContactMetadata,
16
+ ListContactsBranch,
17
+ ListContactsBranchDefect,
18
+ ListContactsBranchInvalidResponse,
19
+ ListContactsBranchListed,
20
+ ListContactsBranchProviderRejected,
21
+ ListContactsDefinition,
22
+ ListContactsInputSchema,
23
+ ListContactsMetadata,
24
+ ProviderID,
25
+ decodeCredentials,
26
+ newConnection,
27
+ newConnectionWithOperations,
28
+ newProjectConnection
29
+ } from "./chunk-N3WLALRE.js";
30
+
31
+ // src/generated/steps.ts
32
+ import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
33
+ function newListContactsStep(configuration) {
34
+ const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
35
+ 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: [
37
+ goToBranch("listed", listed),
38
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
39
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
40
+ ...defect ? [goToBranch("defect", defect)] : []
41
+ ] });
42
+ }
43
+ function newGetContactStep(configuration) {
44
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
45
+ 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: [
47
+ goToBranch("found", found),
48
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
49
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
50
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
51
+ ...defect ? [goToBranch("defect", defect)] : []
52
+ ] });
53
+ }
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;
77
+ }
78
+ credentials;
79
+ baseUrl;
80
+ timeoutMs;
81
+ maxResponseBytes;
82
+ sendRequest;
83
+ /** Bind the contact page Query. */
84
+ listContacts() {
85
+ return new ListContactsOperation(this);
86
+ }
87
+ /** Bind the contact metadata Query. */
88
+ getContact() {
89
+ return new GetContactOperation(this);
90
+ }
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
109
+ };
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 };
127
+ }
128
+ };
129
+ var ListContactsOperation = class {
130
+ /** Bind the provider client. */
131
+ constructor(client) {
132
+ this.client = client;
133
+ }
134
+ client;
135
+ /** Return the generated operation definition. */
136
+ definition() {
137
+ return ListContactsDefinition;
138
+ }
139
+ /** Validate pagination and read contact metadata. */
140
+ 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 });
157
+ }
158
+ };
159
+ var GetContactOperation = class {
160
+ /** Bind the provider client. */
161
+ constructor(client) {
162
+ this.client = client;
163
+ }
164
+ client;
165
+ /** Return the generated operation definition. */
166
+ definition() {
167
+ return GetContactDefinition;
168
+ }
169
+ /** Validate the contact ID and read its metadata. */
170
+ 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));
178
+ }
179
+ };
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;
200
+ }
201
+ function isContact(value) {
202
+ return isObject(value) && isNumericId(value.id) && ["email", "firstName", "lastName"].every((field) => value[field] === void 0 || typeof value[field] === "string");
203
+ }
204
+ function contactMetadata(value) {
205
+ return { id: value.id ?? "", email: value.email ?? "", firstName: value.firstName ?? "", lastName: value.lastName ?? "" };
206
+ }
207
+ function parseJSON(body) {
208
+ try {
209
+ return JSON.parse(Buffer.from(body).toString("utf8"));
210
+ } catch {
211
+ return void 0;
212
+ }
213
+ }
214
+ function headerValue(value) {
215
+ return Array.isArray(value) ? value[0] ?? "" : value ?? "";
216
+ }
217
+
218
+ // src/project.ts
219
+ function newProjectConnection2(project, connectionName) {
220
+ return newProjectConnection(project, connectionName, (loadedProject, name) => {
221
+ const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "activecampaign" && entry.connectionName === name);
222
+ if (!selected) throw new TypeError("ActiveCampaign project connection is not configured");
223
+ const fields = z.strictObject({ baseUrl: z.string().min(1), timeout: z.union([z.string(), z.number().int()]).optional(), maxResponseBytes: z.number().int().optional() }).parse(selected.configuration);
224
+ const timeoutMs = typeof fields.timeout === "number" ? Math.ceil(fields.timeout / 1e6) : fields.timeout ? parseDurationMilliseconds(fields.timeout) : void 0;
225
+ const config = {
226
+ baseUrl: fields.baseUrl,
227
+ ...timeoutMs !== void 0 ? { timeoutMs } : {},
228
+ ...fields.maxResponseBytes !== void 0 ? { maxResponseBytes: fields.maxResponseBytes } : {}
229
+ };
230
+ const credentials = {
231
+ async resolve(_call, signal) {
232
+ const privateFields = await loadedProject.resolveCredential("activecampaign", name, signal);
233
+ if (typeof privateFields.api_key !== "string") throw new TypeError("ActiveCampaign API Key is unavailable");
234
+ return { apiKey: new SecretString2(privateFields.api_key) };
235
+ }
236
+ };
237
+ return new ActiveCampaignClient(config, credentials);
238
+ });
239
+ }
240
+ function parseDurationMilliseconds(value) {
241
+ let remaining = value;
242
+ let milliseconds = 0;
243
+ const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
244
+ while (remaining) {
245
+ const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
246
+ if (!part) throw new TypeError("ActiveCampaign timeout must be a positive Go duration");
247
+ milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
248
+ remaining = remaining.slice(part[0].length);
249
+ }
250
+ if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("ActiveCampaign timeout must resolve to positive whole milliseconds");
251
+ return milliseconds;
252
+ }
253
+ export {
254
+ ActiveCampaignClient,
255
+ ConfigSchema,
256
+ Connection,
257
+ ConnectorID,
258
+ ContactMetadataSchema,
259
+ ContactsPageSchema,
260
+ GetContactBranch,
261
+ GetContactBranchDefect,
262
+ GetContactBranchFound,
263
+ GetContactBranchInvalidResponse,
264
+ GetContactBranchNotFound,
265
+ GetContactBranchProviderRejected,
266
+ GetContactDefinition,
267
+ GetContactInputSchema,
268
+ GetContactMetadata,
269
+ GetContactOperation,
270
+ ListContactsBranch,
271
+ ListContactsBranchDefect,
272
+ ListContactsBranchInvalidResponse,
273
+ ListContactsBranchListed,
274
+ ListContactsBranchProviderRejected,
275
+ ListContactsDefinition,
276
+ ListContactsInputSchema,
277
+ ListContactsMetadata,
278
+ ListContactsOperation,
279
+ ProviderID,
280
+ decodeCredentials,
281
+ newConnection,
282
+ newConnectionWithOperations,
283
+ newGetContactStep,
284
+ newListContactsStep,
285
+ newProjectConnection2 as newProjectConnection
286
+ };
package/dist/mock.d.ts ADDED
@@ -0,0 +1,54 @@
1
+ import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
2
+ import { Failure } from '@superdurable/connectors-sdk';
3
+ import { O as Operations, a as Connection, L as ListContactsInput, b as ContactsPage, G as GetContactInput, C as ContactMetadata } from './connection-2WCEk-xS.js';
4
+ import 'zod';
5
+
6
+ /** Go zero value for ListContactsInput in scripted cases. */
7
+ declare const emptyListContactsInput: ListContactsInput;
8
+ /** Go zero value for ContactMetadata in scripted cases. */
9
+ declare const emptyContactMetadata: ContactMetadata;
10
+ /** Go zero value for ContactsPage in scripted cases. */
11
+ declare const emptyContactsPage: ContactsPage;
12
+ /** Go zero value for GetContactInput in scripted cases. */
13
+ declare const emptyGetContactInput: GetContactInput;
14
+ /** Script the listed branch. */
15
+ declare function listContactsListed(value: ContactsPage, failure?: Failure): Case<ContactsPage>;
16
+ /** Script the providerRejected branch. */
17
+ declare function listContactsProviderRejected(value: ContactsPage, failure?: Failure): Case<ContactsPage>;
18
+ /** Script the invalidResponse branch. */
19
+ declare function listContactsInvalidResponse(value: ContactsPage, failure?: Failure): Case<ContactsPage>;
20
+ /** Script the defect branch. */
21
+ declare function listContactsDefect(value: ContactsPage, failure?: Failure): Case<ContactsPage>;
22
+ /** Script a safe retry of listContacts. */
23
+ declare function listContactsRetry(failure: Failure, retryAfterMs?: number): Case<ContactsPage>;
24
+ /** Manifest scenario listedDefault for listContacts. */
25
+ declare function listContactsListedDefault(): Case<ContactsPage>;
26
+ /** Default listContacts scenario. */
27
+ declare function listContactsDefault(): Case<ContactsPage>;
28
+ /** Script the found branch. */
29
+ declare function getContactFound(value: ContactMetadata, failure?: Failure): Case<ContactMetadata>;
30
+ /** Script the notFound branch. */
31
+ declare function getContactNotFound(value: ContactMetadata, failure?: Failure): Case<ContactMetadata>;
32
+ /** Script the providerRejected branch. */
33
+ declare function getContactProviderRejected(value: ContactMetadata, failure?: Failure): Case<ContactMetadata>;
34
+ /** Script the invalidResponse branch. */
35
+ declare function getContactInvalidResponse(value: ContactMetadata, failure?: Failure): Case<ContactMetadata>;
36
+ /** Script the defect branch. */
37
+ declare function getContactDefect(value: ContactMetadata, failure?: Failure): Case<ContactMetadata>;
38
+ /** Script a safe retry of getContact. */
39
+ declare function getContactRetry(failure: Failure, retryAfterMs?: number): Case<ContactMetadata>;
40
+ /** Manifest scenario foundDefault for getContact. */
41
+ declare function getContactFoundDefault(): Case<ContactMetadata>;
42
+ /** Default getContact scenario. */
43
+ declare function getContactDefault(): Case<ContactMetadata>;
44
+ /** Scripted operations and manifest defaults for this connector. */
45
+ declare class GeneratedMock implements Operations {
46
+ #private;
47
+ constructor(connectionName: string);
48
+ connection(): Connection;
49
+ listContacts(): MockQuery<ListContactsInput, ContactsPage>;
50
+ getContact(): MockQuery<GetContactInput, ContactMetadata>;
51
+ assertNoFailures(): void;
52
+ }
53
+
54
+ export { GeneratedMock, GeneratedMock as Mock, emptyContactMetadata, emptyContactsPage, emptyGetContactInput, emptyListContactsInput, getContactDefault, getContactDefect, getContactFound, getContactFoundDefault, getContactInvalidResponse, getContactNotFound, getContactProviderRejected, getContactRetry, listContactsDefault, listContactsDefect, listContactsInvalidResponse, listContactsListed, listContactsListedDefault, listContactsProviderRejected, listContactsRetry };
package/dist/mock.js ADDED
@@ -0,0 +1,124 @@
1
+ import {
2
+ ContactMetadataSchema,
3
+ ContactsPageSchema,
4
+ GetContactDefinition,
5
+ GetContactInputSchema,
6
+ ListContactsDefinition,
7
+ ListContactsInputSchema,
8
+ ProviderID,
9
+ newConnectionWithOperations
10
+ } from "./chunk-N3WLALRE.js";
11
+
12
+ // src/generated/mock.ts
13
+ import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
14
+ var emptyListContactsInput = ListContactsInputSchema.parse({
15
+ "offset": 0
16
+ });
17
+ var emptyContactMetadata = ContactMetadataSchema.parse({
18
+ "id": "",
19
+ "email": "",
20
+ "firstName": "",
21
+ "lastName": ""
22
+ });
23
+ var emptyContactsPage = ContactsPageSchema.parse({
24
+ "contacts": [],
25
+ "offset": 0,
26
+ "limit": 0,
27
+ "total": 0
28
+ });
29
+ var emptyGetContactInput = GetContactInputSchema.parse({
30
+ "contactId": ""
31
+ });
32
+ function listContactsListed(value, failure) {
33
+ return branchCase("listed", value, failure);
34
+ }
35
+ function listContactsProviderRejected(value, failure) {
36
+ return branchCase("providerRejected", value, failure);
37
+ }
38
+ function listContactsInvalidResponse(value, failure) {
39
+ return branchCase("invalidResponse", value, failure);
40
+ }
41
+ function listContactsDefect(value, failure) {
42
+ return branchCase("defect", value, failure);
43
+ }
44
+ function listContactsRetry(failure, retryAfterMs = 0) {
45
+ return retryCase(failure, retryAfterMs);
46
+ }
47
+ function listContactsListedDefault() {
48
+ const value = ContactsPageSchema.parse({ "contacts": [{ "email": "ada@example.com", "firstName": "Ada", "id": "68", "lastName": "Lovelace" }], "limit": 20, "offset": 0, "total": 1 });
49
+ return branchCase("listed", value);
50
+ }
51
+ function listContactsDefault() {
52
+ return listContactsListedDefault();
53
+ }
54
+ function getContactFound(value, failure) {
55
+ return branchCase("found", value, failure);
56
+ }
57
+ function getContactNotFound(value, failure) {
58
+ return branchCase("notFound", value, failure);
59
+ }
60
+ function getContactProviderRejected(value, failure) {
61
+ return branchCase("providerRejected", value, failure);
62
+ }
63
+ function getContactInvalidResponse(value, failure) {
64
+ return branchCase("invalidResponse", value, failure);
65
+ }
66
+ function getContactDefect(value, failure) {
67
+ return branchCase("defect", value, failure);
68
+ }
69
+ function getContactRetry(failure, retryAfterMs = 0) {
70
+ return retryCase(failure, retryAfterMs);
71
+ }
72
+ function getContactFoundDefault() {
73
+ const value = ContactMetadataSchema.parse({ "email": "ada@example.com", "firstName": "Ada", "id": "68", "lastName": "Lovelace" });
74
+ return branchCase("found", value);
75
+ }
76
+ function getContactDefault() {
77
+ return getContactFoundDefault();
78
+ }
79
+ var GeneratedMock = class {
80
+ #listContacts;
81
+ #getContact;
82
+ #connection;
83
+ constructor(connectionName) {
84
+ this.#listContacts = newQuery(ListContactsDefinition).default(listContactsDefault());
85
+ this.#getContact = newQuery(GetContactDefinition).default(getContactDefault());
86
+ this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
87
+ }
88
+ connection() {
89
+ return this.#connection;
90
+ }
91
+ listContacts() {
92
+ return this.#listContacts;
93
+ }
94
+ getContact() {
95
+ return this.#getContact;
96
+ }
97
+ assertNoFailures() {
98
+ this.#listContacts.assertNoFailures();
99
+ this.#getContact.assertNoFailures();
100
+ }
101
+ };
102
+ export {
103
+ GeneratedMock,
104
+ GeneratedMock as Mock,
105
+ emptyContactMetadata,
106
+ emptyContactsPage,
107
+ emptyGetContactInput,
108
+ emptyListContactsInput,
109
+ getContactDefault,
110
+ getContactDefect,
111
+ getContactFound,
112
+ getContactFoundDefault,
113
+ getContactInvalidResponse,
114
+ getContactNotFound,
115
+ getContactProviderRejected,
116
+ getContactRetry,
117
+ listContactsDefault,
118
+ listContactsDefect,
119
+ listContactsInvalidResponse,
120
+ listContactsListed,
121
+ listContactsListedDefault,
122
+ listContactsProviderRejected,
123
+ listContactsRetry
124
+ };
package/package.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "@superdurable/connector-activecampaign",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "description": "ActiveCampaign connector for Dex TypeScript applications",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/superdurable/dex-connectors-library.git",
9
+ "directory": "connectors/activecampaign/typescript"
10
+ },
11
+ "type": "module",
12
+ "engines": {
13
+ "node": "^22.0.0 || ^24.0.0"
14
+ },
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./mock": {
23
+ "types": "./dist/mock.d.ts",
24
+ "import": "./dist/mock.js"
25
+ },
26
+ "./dex-connector.json": "./dex-connector.json"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "README.md",
31
+ "LICENSE",
32
+ "dex-connector.json"
33
+ ],
34
+ "scripts": {
35
+ "prepack": "npm run build",
36
+ "build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
37
+ "typecheck": "tsc --noEmit",
38
+ "lint": "eslint src test examples",
39
+ "test": "vitest run --exclude test/integration/**",
40
+ "test:integration": "vitest run test/integration/*.integration.test.ts",
41
+ "example:worker": "tsx examples/contact-inspection/worker.ts",
42
+ "example:start": "tsx examples/contact-inspection/start.ts",
43
+ "check": "npm run typecheck && npm run lint && npm test && npm run build"
44
+ },
45
+ "dependencies": {
46
+ "@superdurable/connectors-sdk": "0.1.1",
47
+ "@superdurable/dex": ">=1.28.0",
48
+ "zod": "^4.1.0"
49
+ },
50
+ "devDependencies": {
51
+ "@eslint/js": "^9.0.0",
52
+ "@types/node": "^22.0.0",
53
+ "eslint": "^9.0.0",
54
+ "tsup": "^8.0.0",
55
+ "tsx": "^4.23.15",
56
+ "typescript": "^5.9.0",
57
+ "typescript-eslint": "^8.0.0",
58
+ "vitest": "^3.0.0",
59
+ "yaml": "^2.9.1"
60
+ }
61
+ }