@superdurable/connector-customerio 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 +166 -2
- package/dist/chunk-S6QG7G3I.js +237 -0
- package/dist/connection-D0Rf4T-r.d.ts +155 -0
- package/dist/index.d.ts +179 -5
- package/dist/index.js +328 -28
- package/dist/mock.d.ts +63 -2
- package/dist/mock.js +153 -2
- package/package.json +1 -1
- package/dist/chunk-462ICFCP.js +0 -101
- package/dist/connection-WnPSA5jF.d.ts +0 -69
package/dist/mock.js
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CampaignMetricsSchema,
|
|
3
|
+
CampaignSummarySchema,
|
|
4
|
+
CampaignsPageSchema,
|
|
2
5
|
CustomerLookupPageSchema,
|
|
6
|
+
GetCampaignDefinition,
|
|
7
|
+
GetCampaignInputSchema,
|
|
8
|
+
GetCampaignMetricsDefinition,
|
|
9
|
+
GetCampaignMetricsInputSchema,
|
|
3
10
|
GetCustomersByEmailDefinition,
|
|
4
11
|
GetCustomersByEmailInputSchema,
|
|
12
|
+
ListCampaignsDefinition,
|
|
13
|
+
ListCampaignsInputSchema,
|
|
5
14
|
ProviderID,
|
|
6
15
|
newConnectionWithOperations
|
|
7
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-S6QG7G3I.js";
|
|
8
17
|
|
|
9
18
|
// src/generated/mock.ts
|
|
10
19
|
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
20
|
+
var emptyGetCampaignInput = GetCampaignInputSchema.parse({
|
|
21
|
+
"campaignId": 0
|
|
22
|
+
});
|
|
23
|
+
var emptyCampaignSummary = CampaignSummarySchema.parse({
|
|
24
|
+
"id": 0,
|
|
25
|
+
"name": "",
|
|
26
|
+
"active": false,
|
|
27
|
+
"state": ""
|
|
28
|
+
});
|
|
29
|
+
var emptyListCampaignsInput = ListCampaignsInputSchema.parse({});
|
|
30
|
+
var emptyCampaignsPage = CampaignsPageSchema.parse({
|
|
31
|
+
"campaigns": []
|
|
32
|
+
});
|
|
33
|
+
var emptyGetCampaignMetricsInput = GetCampaignMetricsInputSchema.parse({
|
|
34
|
+
"campaignId": 0,
|
|
35
|
+
"startUnix": 0,
|
|
36
|
+
"endUnix": 0,
|
|
37
|
+
"resolution": ""
|
|
38
|
+
});
|
|
39
|
+
var emptyCampaignMetrics = CampaignMetricsSchema.parse({
|
|
40
|
+
"campaignId": 0,
|
|
41
|
+
"series": {}
|
|
42
|
+
});
|
|
11
43
|
var emptyGetCustomersByEmailInput = GetCustomersByEmailInputSchema.parse({
|
|
12
44
|
"email": ""
|
|
13
45
|
});
|
|
@@ -15,6 +47,78 @@ var emptyCustomerLookupPage = CustomerLookupPageSchema.parse({
|
|
|
15
47
|
"email": "",
|
|
16
48
|
"customerIDs": []
|
|
17
49
|
});
|
|
50
|
+
function getCampaignFound(value, failure) {
|
|
51
|
+
return branchCase("found", value, failure);
|
|
52
|
+
}
|
|
53
|
+
function getCampaignNotFound(value, failure) {
|
|
54
|
+
return branchCase("notFound", value, failure);
|
|
55
|
+
}
|
|
56
|
+
function getCampaignProviderRejected(value, failure) {
|
|
57
|
+
return branchCase("providerRejected", value, failure);
|
|
58
|
+
}
|
|
59
|
+
function getCampaignInvalidResponse(value, failure) {
|
|
60
|
+
return branchCase("invalidResponse", value, failure);
|
|
61
|
+
}
|
|
62
|
+
function getCampaignDefect(value, failure) {
|
|
63
|
+
return branchCase("defect", value, failure);
|
|
64
|
+
}
|
|
65
|
+
function getCampaignRetry(failure, retryAfterMs = 0) {
|
|
66
|
+
return retryCase(failure, retryAfterMs);
|
|
67
|
+
}
|
|
68
|
+
function getCampaignFoundDefault() {
|
|
69
|
+
const value = CampaignSummarySchema.parse({ "active": true, "id": 5, "name": "Welcome series", "state": "running" });
|
|
70
|
+
return branchCase("found", value);
|
|
71
|
+
}
|
|
72
|
+
function getCampaignDefault() {
|
|
73
|
+
return getCampaignFoundDefault();
|
|
74
|
+
}
|
|
75
|
+
function listCampaignsListed(value, failure) {
|
|
76
|
+
return branchCase("listed", value, failure);
|
|
77
|
+
}
|
|
78
|
+
function listCampaignsProviderRejected(value, failure) {
|
|
79
|
+
return branchCase("providerRejected", value, failure);
|
|
80
|
+
}
|
|
81
|
+
function listCampaignsInvalidResponse(value, failure) {
|
|
82
|
+
return branchCase("invalidResponse", value, failure);
|
|
83
|
+
}
|
|
84
|
+
function listCampaignsDefect(value, failure) {
|
|
85
|
+
return branchCase("defect", value, failure);
|
|
86
|
+
}
|
|
87
|
+
function listCampaignsRetry(failure, retryAfterMs = 0) {
|
|
88
|
+
return retryCase(failure, retryAfterMs);
|
|
89
|
+
}
|
|
90
|
+
function listCampaignsListedDefault() {
|
|
91
|
+
const value = CampaignsPageSchema.parse({ "campaigns": [{ "active": true, "id": 5, "name": "Welcome series", "state": "running" }] });
|
|
92
|
+
return branchCase("listed", value);
|
|
93
|
+
}
|
|
94
|
+
function listCampaignsDefault() {
|
|
95
|
+
return listCampaignsListedDefault();
|
|
96
|
+
}
|
|
97
|
+
function getCampaignMetricsFound(value, failure) {
|
|
98
|
+
return branchCase("found", value, failure);
|
|
99
|
+
}
|
|
100
|
+
function getCampaignMetricsNotFound(value, failure) {
|
|
101
|
+
return branchCase("notFound", value, failure);
|
|
102
|
+
}
|
|
103
|
+
function getCampaignMetricsProviderRejected(value, failure) {
|
|
104
|
+
return branchCase("providerRejected", value, failure);
|
|
105
|
+
}
|
|
106
|
+
function getCampaignMetricsInvalidResponse(value, failure) {
|
|
107
|
+
return branchCase("invalidResponse", value, failure);
|
|
108
|
+
}
|
|
109
|
+
function getCampaignMetricsDefect(value, failure) {
|
|
110
|
+
return branchCase("defect", value, failure);
|
|
111
|
+
}
|
|
112
|
+
function getCampaignMetricsRetry(failure, retryAfterMs = 0) {
|
|
113
|
+
return retryCase(failure, retryAfterMs);
|
|
114
|
+
}
|
|
115
|
+
function getCampaignMetricsFoundDefault() {
|
|
116
|
+
const value = CampaignMetricsSchema.parse({ "campaignId": 5, "series": { "delivered": [1], "sent": [1] } });
|
|
117
|
+
return branchCase("found", value);
|
|
118
|
+
}
|
|
119
|
+
function getCampaignMetricsDefault() {
|
|
120
|
+
return getCampaignMetricsFoundDefault();
|
|
121
|
+
}
|
|
18
122
|
function getCustomersByEmailFound(value, failure) {
|
|
19
123
|
return branchCase("found", value, failure);
|
|
20
124
|
}
|
|
@@ -38,32 +142,79 @@ function getCustomersByEmailDefault() {
|
|
|
38
142
|
return getCustomersByEmailFoundDefault();
|
|
39
143
|
}
|
|
40
144
|
var GeneratedMock = class {
|
|
145
|
+
#getCampaign;
|
|
146
|
+
#listCampaigns;
|
|
147
|
+
#getCampaignMetrics;
|
|
41
148
|
#getCustomersByEmail;
|
|
42
149
|
#connection;
|
|
43
150
|
constructor(connectionName) {
|
|
151
|
+
this.#getCampaign = newQuery(GetCampaignDefinition).default(getCampaignDefault());
|
|
152
|
+
this.#listCampaigns = newQuery(ListCampaignsDefinition).default(listCampaignsDefault());
|
|
153
|
+
this.#getCampaignMetrics = newQuery(GetCampaignMetricsDefinition).default(getCampaignMetricsDefault());
|
|
44
154
|
this.#getCustomersByEmail = newQuery(GetCustomersByEmailDefinition).default(getCustomersByEmailDefault());
|
|
45
155
|
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
46
156
|
}
|
|
47
157
|
connection() {
|
|
48
158
|
return this.#connection;
|
|
49
159
|
}
|
|
160
|
+
getCampaign() {
|
|
161
|
+
return this.#getCampaign;
|
|
162
|
+
}
|
|
163
|
+
listCampaigns() {
|
|
164
|
+
return this.#listCampaigns;
|
|
165
|
+
}
|
|
166
|
+
getCampaignMetrics() {
|
|
167
|
+
return this.#getCampaignMetrics;
|
|
168
|
+
}
|
|
50
169
|
getCustomersByEmail() {
|
|
51
170
|
return this.#getCustomersByEmail;
|
|
52
171
|
}
|
|
53
172
|
assertNoFailures() {
|
|
173
|
+
this.#getCampaign.assertNoFailures();
|
|
174
|
+
this.#listCampaigns.assertNoFailures();
|
|
175
|
+
this.#getCampaignMetrics.assertNoFailures();
|
|
54
176
|
this.#getCustomersByEmail.assertNoFailures();
|
|
55
177
|
}
|
|
56
178
|
};
|
|
57
179
|
export {
|
|
58
180
|
GeneratedMock,
|
|
59
181
|
GeneratedMock as Mock,
|
|
182
|
+
emptyCampaignMetrics,
|
|
183
|
+
emptyCampaignSummary,
|
|
184
|
+
emptyCampaignsPage,
|
|
60
185
|
emptyCustomerLookupPage,
|
|
186
|
+
emptyGetCampaignInput,
|
|
187
|
+
emptyGetCampaignMetricsInput,
|
|
61
188
|
emptyGetCustomersByEmailInput,
|
|
189
|
+
emptyListCampaignsInput,
|
|
190
|
+
getCampaignDefault,
|
|
191
|
+
getCampaignDefect,
|
|
192
|
+
getCampaignFound,
|
|
193
|
+
getCampaignFoundDefault,
|
|
194
|
+
getCampaignInvalidResponse,
|
|
195
|
+
getCampaignMetricsDefault,
|
|
196
|
+
getCampaignMetricsDefect,
|
|
197
|
+
getCampaignMetricsFound,
|
|
198
|
+
getCampaignMetricsFoundDefault,
|
|
199
|
+
getCampaignMetricsInvalidResponse,
|
|
200
|
+
getCampaignMetricsNotFound,
|
|
201
|
+
getCampaignMetricsProviderRejected,
|
|
202
|
+
getCampaignMetricsRetry,
|
|
203
|
+
getCampaignNotFound,
|
|
204
|
+
getCampaignProviderRejected,
|
|
205
|
+
getCampaignRetry,
|
|
62
206
|
getCustomersByEmailDefault,
|
|
63
207
|
getCustomersByEmailDefect,
|
|
64
208
|
getCustomersByEmailFound,
|
|
65
209
|
getCustomersByEmailFoundDefault,
|
|
66
210
|
getCustomersByEmailInvalidResponse,
|
|
67
211
|
getCustomersByEmailProviderRejected,
|
|
68
|
-
getCustomersByEmailRetry
|
|
212
|
+
getCustomersByEmailRetry,
|
|
213
|
+
listCampaignsDefault,
|
|
214
|
+
listCampaignsDefect,
|
|
215
|
+
listCampaignsInvalidResponse,
|
|
216
|
+
listCampaignsListed,
|
|
217
|
+
listCampaignsListedDefault,
|
|
218
|
+
listCampaignsProviderRejected,
|
|
219
|
+
listCampaignsRetry
|
|
69
220
|
};
|
package/package.json
CHANGED
package/dist/chunk-462ICFCP.js
DELETED
|
@@ -1,101 +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(["privateKey"]);
|
|
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["privateKey"] != null && !(typeof fields["privateKey"] === "string")) throw new TypeError("credential privateKey has an invalid type");
|
|
15
|
-
const credentials = {};
|
|
16
|
-
if (!fields["privateKey"]) throw new TypeError("credential privateKey is required");
|
|
17
|
-
credentials.privateKey = new SecretString(fields["privateKey"] ?? "");
|
|
18
|
-
return credentials;
|
|
19
|
-
}
|
|
20
|
-
var GetCustomersByEmailInputSchema = z.strictObject({
|
|
21
|
-
"email": z.string()
|
|
22
|
-
});
|
|
23
|
-
var CustomerLookupPageSchema = z.strictObject({
|
|
24
|
-
"email": z.string(),
|
|
25
|
-
"customerIDs": z.array(z.string()).nullable()
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// src/generated/definitions.ts
|
|
29
|
-
var ConnectorID = "customerio";
|
|
30
|
-
var ProviderID = "customerio";
|
|
31
|
-
var GetCustomersByEmailBranch = {
|
|
32
|
-
Found: "found",
|
|
33
|
-
ProviderRejected: "providerRejected",
|
|
34
|
-
InvalidResponse: "invalidResponse",
|
|
35
|
-
Defect: "defect"
|
|
36
|
-
};
|
|
37
|
-
var GetCustomersByEmailBranchFound = GetCustomersByEmailBranch.Found;
|
|
38
|
-
var GetCustomersByEmailBranchProviderRejected = GetCustomersByEmailBranch.ProviderRejected;
|
|
39
|
-
var GetCustomersByEmailBranchInvalidResponse = GetCustomersByEmailBranch.InvalidResponse;
|
|
40
|
-
var GetCustomersByEmailBranchDefect = GetCustomersByEmailBranch.Defect;
|
|
41
|
-
var GetCustomersByEmailDefinition = {
|
|
42
|
-
operation: { connectorId: ConnectorID, operationId: "getCustomersByEmail" },
|
|
43
|
-
branches: [
|
|
44
|
-
{ id: "found", description: "Customer.io returned matching customer IDs, possibly empty." },
|
|
45
|
-
{ id: "providerRejected", description: "Customer.io conclusively rejected the lookup.", optional: true },
|
|
46
|
-
{ id: "invalidResponse", description: "Customer.io returned malformed or oversized JSON.", optional: true },
|
|
47
|
-
{ id: "defect", description: "Local input or credentials are invalid.", optional: true }
|
|
48
|
-
],
|
|
49
|
-
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
50
|
-
};
|
|
51
|
-
var GetCustomersByEmailMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
52
|
-
|
|
53
|
-
// src/generated/connection.ts
|
|
54
|
-
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
55
|
-
var Connection = class {
|
|
56
|
-
/** Stable provider and connection name. */
|
|
57
|
-
reference;
|
|
58
|
-
/** Bound provider operations. */
|
|
59
|
-
operations;
|
|
60
|
-
/** Validate a reference and bind operations. */
|
|
61
|
-
constructor(reference, operations) {
|
|
62
|
-
this.reference = ConnectionRefSchema.parse(reference);
|
|
63
|
-
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
64
|
-
if (!operations) throw new TypeError("connector operations are required");
|
|
65
|
-
this.operations = operations;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
function newConnection(client, reference) {
|
|
69
|
-
if (!client) throw new TypeError("connector client is required");
|
|
70
|
-
return new Connection(reference, client);
|
|
71
|
-
}
|
|
72
|
-
function newConnectionWithOperations(operations, reference) {
|
|
73
|
-
return new Connection(reference, operations);
|
|
74
|
-
}
|
|
75
|
-
function newProjectConnection(project, connectionName, createClient) {
|
|
76
|
-
if (!project) throw new TypeError("loaded project is required");
|
|
77
|
-
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
78
|
-
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
79
|
-
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
80
|
-
return newConnection(createClient(project, connectionName), reference);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
ConfigSchema,
|
|
85
|
-
decodeCredentials,
|
|
86
|
-
GetCustomersByEmailInputSchema,
|
|
87
|
-
CustomerLookupPageSchema,
|
|
88
|
-
ConnectorID,
|
|
89
|
-
ProviderID,
|
|
90
|
-
GetCustomersByEmailBranch,
|
|
91
|
-
GetCustomersByEmailBranchFound,
|
|
92
|
-
GetCustomersByEmailBranchProviderRejected,
|
|
93
|
-
GetCustomersByEmailBranchInvalidResponse,
|
|
94
|
-
GetCustomersByEmailBranchDefect,
|
|
95
|
-
GetCustomersByEmailDefinition,
|
|
96
|
-
GetCustomersByEmailMetadata,
|
|
97
|
-
Connection,
|
|
98
|
-
newConnection,
|
|
99
|
-
newConnectionWithOperations,
|
|
100
|
-
newProjectConnection
|
|
101
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { CredentialProvider, SecretString, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
-
interface Config {
|
|
6
|
-
/** Customer.io App API HTTPS root. Blank uses the displayed US-region default; override with https://api-eu.customer.io for an EU workspace. Do not include path, query, or credentials. */
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
/** Maximum duration of one customer lookup as a positive Go duration. Blank uses the displayed default; increase only for slow responses. Runtime value in milliseconds. */
|
|
9
|
-
timeoutMs?: number;
|
|
10
|
-
/** Maximum complete customer-lookup JSON response in bytes as a positive integer. Blank uses the displayed default; increase if an email has many matching profiles. */
|
|
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 App API private key from Customer.io > Settings > API Credentials > App API > Create API Key. Copy the complete sk_ key or existing App API key, not its label; blank prevents calls. Dex sends it only as a Bearer credential. */
|
|
22
|
-
privateKey: 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
|
-
/** GetCustomersByEmailInput identifies an exact non-secret customer email address. */
|
|
29
|
-
interface GetCustomersByEmailInput {
|
|
30
|
-
/** Email is the complete email address shown on the Customer.io People page. */
|
|
31
|
-
"email": string;
|
|
32
|
-
}
|
|
33
|
-
/** CustomerLookupPage contains Customer.io profile IDs matching an email. */
|
|
34
|
-
interface CustomerLookupPage {
|
|
35
|
-
/** Email is the address supplied to Customer.io. */
|
|
36
|
-
"email": string;
|
|
37
|
-
/** CustomerIDs are the matching cio_id values in provider order. */
|
|
38
|
-
"customerIDs": Array<string> | null;
|
|
39
|
-
}
|
|
40
|
-
/** Runtime validator for GetCustomersByEmailInput. */
|
|
41
|
-
declare const GetCustomersByEmailInputSchema: z.ZodObject<{
|
|
42
|
-
email: z.ZodString;
|
|
43
|
-
}, z.core.$strict>;
|
|
44
|
-
/** Runtime validator for CustomerLookupPage. */
|
|
45
|
-
declare const CustomerLookupPageSchema: z.ZodObject<{
|
|
46
|
-
email: z.ZodString;
|
|
47
|
-
customerIDs: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
|
-
|
|
50
|
-
/** Typed operations supplied by a client or mock. */
|
|
51
|
-
interface Operations {
|
|
52
|
-
/** Invoke getCustomersByEmail through this connection. */
|
|
53
|
-
getCustomersByEmail(): Query<GetCustomersByEmailInput, CustomerLookupPage>;
|
|
54
|
-
}
|
|
55
|
-
/** Named connector connection kept outside Flow state. */
|
|
56
|
-
declare class Connection<BoundOperations = Operations> {
|
|
57
|
-
/** Stable provider and connection name. */
|
|
58
|
-
readonly reference: ConnectionRef;
|
|
59
|
-
/** Bound provider operations. */
|
|
60
|
-
readonly operations: BoundOperations;
|
|
61
|
-
/** Validate a reference and bind operations. */
|
|
62
|
-
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
63
|
-
}
|
|
64
|
-
/** Bind a client to a named connection. */
|
|
65
|
-
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
66
|
-
/** Bind scripted operations to a named connection. */
|
|
67
|
-
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
68
|
-
|
|
69
|
-
export { type CustomerLookupPage as C, type GetCustomersByEmailInput as G, type Operations as O, Connection as a, type Config as b, type Credentials as c, ConfigSchema as d, type CredentialSource as e, CustomerLookupPageSchema as f, GetCustomersByEmailInputSchema as g, decodeCredentials as h, newConnectionWithOperations as i, newConnection as n };
|