@superdurable/connector-activecampaign 0.2.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/README.md +13 -1
- package/dex-connector.json +2914 -2
- package/dist/chunk-KJZQXWCV.js +2231 -0
- package/dist/connection-Du4VXO6B.d.ts +1532 -0
- package/dist/index.d.ts +2970 -29
- package/dist/index.js +4463 -143
- package/dist/mock.d.ts +964 -3
- package/dist/mock.js +2401 -6
- package/package.json +3 -3
- package/dist/chunk-5OQDSH4F.js +0 -147
- package/dist/connection-B6zAs6BA.d.ts +0 -112
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-activecampaign",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ActiveCampaign connector for Dex TypeScript applications",
|
|
6
6
|
"repository": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
41
|
"example:worker": "tsx examples/contact-inspection/worker.ts",
|
|
42
42
|
"example:start": "tsx examples/contact-inspection/start.ts",
|
|
43
|
-
"check": "npm run typecheck && npm run lint && npm
|
|
43
|
+
"check": "npm run typecheck && npm run lint && npm run build && npm test"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@superdurable/connectors-sdk": "0.
|
|
46
|
+
"@superdurable/connectors-sdk": "0.13.0",
|
|
47
47
|
"@superdurable/dex": ">=1.28.0",
|
|
48
48
|
"zod": "^4.1.0"
|
|
49
49
|
},
|
package/dist/chunk-5OQDSH4F.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
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().optional(),
|
|
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
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
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; zero starts at the first contact. */
|
|
31
|
-
"offset"?: number | undefined;
|
|
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.ZodOptional<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 };
|