@superdurable/connector-campaignmonitor 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dex-connector.json +1448 -2
- package/dist/chunk-XSS3TJM2.js +1092 -0
- package/dist/connection-8jj_z6ZP.d.ts +777 -0
- package/dist/index.d.ts +1237 -4
- package/dist/index.js +1606 -39
- package/dist/mock.d.ts +441 -3
- package/dist/mock.js +1111 -5
- package/package.json +5 -4
- package/dist/chunk-VKND2LIG.js +0 -103
- package/dist/connection-CcQeWY_i.d.ts +0 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-campaignmonitor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Campaign Monitor connector for Dex TypeScript applications",
|
|
6
6
|
"repository": {
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
38
|
"lint": "eslint src test examples",
|
|
39
|
-
"test": "vitest run --exclude test/integration
|
|
39
|
+
"test": "vitest run --exclude \"test/integration/**\"",
|
|
40
40
|
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
41
|
"example:worker": "tsx examples/client-discovery/worker.ts",
|
|
42
42
|
"example:start": "tsx examples/client-discovery/start.ts",
|
|
43
43
|
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
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
|
-
"zod": "^4.1.0"
|
|
48
|
+
"zod": "^4.1.0",
|
|
49
|
+
"email-addresses": "5.0.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@eslint/js": "^9.0.0",
|
package/dist/chunk-VKND2LIG.js
DELETED
|
@@ -1,103 +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().optional(),
|
|
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 ListClientsInputSchema = z.strictObject({});
|
|
21
|
-
var ClientMetadataSchema = z.strictObject({
|
|
22
|
-
"id": z.string(),
|
|
23
|
-
"name": z.string()
|
|
24
|
-
});
|
|
25
|
-
var ClientsListSchema = z.strictObject({
|
|
26
|
-
"clients": z.array(ClientMetadataSchema).nullable()
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// src/generated/definitions.ts
|
|
30
|
-
var ConnectorID = "campaignmonitor";
|
|
31
|
-
var ProviderID = "campaignmonitor";
|
|
32
|
-
var ListClientsBranch = {
|
|
33
|
-
Listed: "listed",
|
|
34
|
-
ProviderRejected: "providerRejected",
|
|
35
|
-
InvalidResponse: "invalidResponse",
|
|
36
|
-
Defect: "defect"
|
|
37
|
-
};
|
|
38
|
-
var ListClientsBranchListed = ListClientsBranch.Listed;
|
|
39
|
-
var ListClientsBranchProviderRejected = ListClientsBranch.ProviderRejected;
|
|
40
|
-
var ListClientsBranchInvalidResponse = ListClientsBranch.InvalidResponse;
|
|
41
|
-
var ListClientsBranchDefect = ListClientsBranch.Defect;
|
|
42
|
-
var ListClientsDefinition = {
|
|
43
|
-
operation: { connectorId: ConnectorID, operationId: "listClients" },
|
|
44
|
-
branches: [
|
|
45
|
-
{ id: "listed", description: "Campaign Monitor returned the account's clients." },
|
|
46
|
-
{ id: "providerRejected", description: "Campaign Monitor conclusively rejected the request.", optional: true },
|
|
47
|
-
{ id: "invalidResponse", description: "Campaign Monitor returned malformed or oversized JSON.", optional: true },
|
|
48
|
-
{ id: "defect", description: "Connection credentials are invalid.", optional: true }
|
|
49
|
-
],
|
|
50
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
51
|
-
};
|
|
52
|
-
var ListClientsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
53
|
-
|
|
54
|
-
// src/generated/connection.ts
|
|
55
|
-
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
56
|
-
var Connection = class {
|
|
57
|
-
/** Stable provider and connection name. */
|
|
58
|
-
reference;
|
|
59
|
-
/** Bound provider operations. */
|
|
60
|
-
operations;
|
|
61
|
-
/** Validate a reference and bind operations. */
|
|
62
|
-
constructor(reference, operations) {
|
|
63
|
-
this.reference = ConnectionRefSchema.parse(reference);
|
|
64
|
-
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
65
|
-
if (!operations) throw new TypeError("connector operations are required");
|
|
66
|
-
this.operations = operations;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
function newConnection(client, reference) {
|
|
70
|
-
if (!client) throw new TypeError("connector client is required");
|
|
71
|
-
return new Connection(reference, client);
|
|
72
|
-
}
|
|
73
|
-
function newConnectionWithOperations(operations, reference) {
|
|
74
|
-
return new Connection(reference, operations);
|
|
75
|
-
}
|
|
76
|
-
function newProjectConnection(project, connectionName, createClient) {
|
|
77
|
-
if (!project) throw new TypeError("loaded project is required");
|
|
78
|
-
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
79
|
-
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
80
|
-
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
81
|
-
return newConnection(createClient(project, connectionName), reference);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
ConfigSchema,
|
|
86
|
-
decodeCredentials,
|
|
87
|
-
ListClientsInputSchema,
|
|
88
|
-
ClientMetadataSchema,
|
|
89
|
-
ClientsListSchema,
|
|
90
|
-
ConnectorID,
|
|
91
|
-
ProviderID,
|
|
92
|
-
ListClientsBranch,
|
|
93
|
-
ListClientsBranchListed,
|
|
94
|
-
ListClientsBranchProviderRejected,
|
|
95
|
-
ListClientsBranchInvalidResponse,
|
|
96
|
-
ListClientsBranchDefect,
|
|
97
|
-
ListClientsDefinition,
|
|
98
|
-
ListClientsMetadata,
|
|
99
|
-
Connection,
|
|
100
|
-
newConnection,
|
|
101
|
-
newConnectionWithOperations,
|
|
102
|
-
newProjectConnection
|
|
103
|
-
};
|
|
@@ -1,77 +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
|
-
/** HTTPS Campaign Monitor API v3.3 root. Blank uses the displayed default; override only for a compatible private test endpoint. */
|
|
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 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 accounts with many clients. Oversized responses select invalidResponse. */
|
|
11
|
-
maxResponseBytes?: number;
|
|
12
|
-
}
|
|
13
|
-
/** Runtime schema for manifest configuration. */
|
|
14
|
-
declare const ConfigSchema: z.ZodObject<{
|
|
15
|
-
baseUrl: z.ZodOptional<z.ZodString>;
|
|
16
|
-
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
/** Private connector credentials resolved by the host. */
|
|
20
|
-
interface Credentials {
|
|
21
|
-
/** Secret API key. Sign in at https://login.createsend.com/l, then open Profile image > Account settings > API keys. Generate or show and copy the full key; blank makes calls select defect. Rotate it on that page when retired. */
|
|
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
|
-
/** ListClientsInput selects the account's accessible clients without filters. */
|
|
29
|
-
interface ListClientsInput {
|
|
30
|
-
}
|
|
31
|
-
/** ClientMetadata identifies one Campaign Monitor client without secrets. */
|
|
32
|
-
interface ClientMetadata {
|
|
33
|
-
/** ID is the provider's client identifier. */
|
|
34
|
-
"id": string;
|
|
35
|
-
/** Name is the client display name. */
|
|
36
|
-
"name": string;
|
|
37
|
-
}
|
|
38
|
-
/** ClientsList contains all returned client identities. */
|
|
39
|
-
interface ClientsList {
|
|
40
|
-
/** Clients is the account's accessible client list. */
|
|
41
|
-
"clients": Array<ClientMetadata> | null;
|
|
42
|
-
}
|
|
43
|
-
/** Runtime validator for ListClientsInput. */
|
|
44
|
-
declare const ListClientsInputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
45
|
-
/** Runtime validator for ClientMetadata. */
|
|
46
|
-
declare const ClientMetadataSchema: z.ZodObject<{
|
|
47
|
-
id: z.ZodString;
|
|
48
|
-
name: z.ZodString;
|
|
49
|
-
}, z.core.$strict>;
|
|
50
|
-
/** Runtime validator for ClientsList. */
|
|
51
|
-
declare const ClientsListSchema: z.ZodObject<{
|
|
52
|
-
clients: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
53
|
-
id: z.ZodString;
|
|
54
|
-
name: z.ZodString;
|
|
55
|
-
}, z.core.$strict>>>;
|
|
56
|
-
}, z.core.$strict>;
|
|
57
|
-
|
|
58
|
-
/** Typed operations supplied by a client or mock. */
|
|
59
|
-
interface Operations {
|
|
60
|
-
/** Invoke listClients through this connection. */
|
|
61
|
-
listClients(): Query<ListClientsInput, ClientsList>;
|
|
62
|
-
}
|
|
63
|
-
/** Named connector connection kept outside Flow state. */
|
|
64
|
-
declare class Connection<BoundOperations = Operations> {
|
|
65
|
-
/** Stable provider and connection name. */
|
|
66
|
-
readonly reference: ConnectionRef;
|
|
67
|
-
/** Bound provider operations. */
|
|
68
|
-
readonly operations: BoundOperations;
|
|
69
|
-
/** Validate a reference and bind operations. */
|
|
70
|
-
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
71
|
-
}
|
|
72
|
-
/** Bind a client to a named connection. */
|
|
73
|
-
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
74
|
-
/** Bind scripted operations to a named connection. */
|
|
75
|
-
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
76
|
-
|
|
77
|
-
export { type ClientsList as C, type ListClientsInput as L, type Operations as O, Connection as a, type Config as b, type Credentials as c, type ClientMetadata as d, ClientMetadataSchema as e, ClientsListSchema as f, ConfigSchema as g, type CredentialSource as h, ListClientsInputSchema as i, decodeCredentials as j, newConnectionWithOperations as k, newConnection as n };
|