@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/index.js
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CampaignMetricsSchema,
|
|
3
|
+
CampaignSummarySchema,
|
|
4
|
+
CampaignsPageSchema,
|
|
2
5
|
ConfigSchema,
|
|
3
6
|
Connection,
|
|
4
7
|
ConnectorID,
|
|
8
|
+
CredentialMaterialError,
|
|
5
9
|
CustomerLookupPageSchema,
|
|
10
|
+
GetCampaignBranch,
|
|
11
|
+
GetCampaignBranchDefect,
|
|
12
|
+
GetCampaignBranchFound,
|
|
13
|
+
GetCampaignBranchInvalidResponse,
|
|
14
|
+
GetCampaignBranchNotFound,
|
|
15
|
+
GetCampaignBranchProviderRejected,
|
|
16
|
+
GetCampaignDefinition,
|
|
17
|
+
GetCampaignInputSchema,
|
|
18
|
+
GetCampaignMetadata,
|
|
19
|
+
GetCampaignMetricsBranch,
|
|
20
|
+
GetCampaignMetricsBranchDefect,
|
|
21
|
+
GetCampaignMetricsBranchFound,
|
|
22
|
+
GetCampaignMetricsBranchInvalidResponse,
|
|
23
|
+
GetCampaignMetricsBranchNotFound,
|
|
24
|
+
GetCampaignMetricsBranchProviderRejected,
|
|
25
|
+
GetCampaignMetricsDefinition,
|
|
26
|
+
GetCampaignMetricsInputSchema,
|
|
27
|
+
GetCampaignMetricsMetadata,
|
|
6
28
|
GetCustomersByEmailBranch,
|
|
7
29
|
GetCustomersByEmailBranchDefect,
|
|
8
30
|
GetCustomersByEmailBranchFound,
|
|
@@ -11,15 +33,54 @@ import {
|
|
|
11
33
|
GetCustomersByEmailDefinition,
|
|
12
34
|
GetCustomersByEmailInputSchema,
|
|
13
35
|
GetCustomersByEmailMetadata,
|
|
36
|
+
ListCampaignsBranch,
|
|
37
|
+
ListCampaignsBranchDefect,
|
|
38
|
+
ListCampaignsBranchInvalidResponse,
|
|
39
|
+
ListCampaignsBranchListed,
|
|
40
|
+
ListCampaignsBranchProviderRejected,
|
|
41
|
+
ListCampaignsDefinition,
|
|
42
|
+
ListCampaignsInputSchema,
|
|
43
|
+
ListCampaignsMetadata,
|
|
14
44
|
ProviderID,
|
|
15
45
|
decodeCredentials,
|
|
16
|
-
|
|
17
|
-
newConnectionWithOperations,
|
|
46
|
+
isCredentialMaterialError,
|
|
18
47
|
newProjectConnection
|
|
19
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-S6QG7G3I.js";
|
|
20
49
|
|
|
21
50
|
// src/generated/steps.ts
|
|
22
51
|
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
52
|
+
function newGetCampaignStep(configuration) {
|
|
53
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
54
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
55
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getCampaign(), connection: connection.reference, branches: [
|
|
56
|
+
goToBranch("found", found),
|
|
57
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
58
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
59
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
60
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
function newListCampaignsStep(configuration) {
|
|
64
|
+
const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
65
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
66
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.listCampaigns(), connection: connection.reference, branches: [
|
|
67
|
+
goToBranch("listed", listed),
|
|
68
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
69
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
70
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
function newGetCampaignMetricsStep(configuration) {
|
|
74
|
+
const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
75
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
76
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getCampaignMetrics(), connection: connection.reference, branches: [
|
|
77
|
+
goToBranch("found", found),
|
|
78
|
+
...notFound ? [goToBranch("notFound", notFound)] : [],
|
|
79
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
80
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
81
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
23
84
|
function newGetCustomersByEmailStep(configuration) {
|
|
24
85
|
const { connection, connectionName, found, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
25
86
|
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
@@ -31,19 +92,38 @@ function newGetCustomersByEmailStep(configuration) {
|
|
|
31
92
|
] });
|
|
32
93
|
}
|
|
33
94
|
|
|
95
|
+
// src/connection.ts
|
|
96
|
+
function newConnection(client, reference) {
|
|
97
|
+
return new Connection(reference, client);
|
|
98
|
+
}
|
|
99
|
+
function newConnectionWithOperations(operations, reference) {
|
|
100
|
+
return new Connection(reference, operations);
|
|
101
|
+
}
|
|
102
|
+
|
|
34
103
|
// src/project.ts
|
|
35
104
|
import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
|
|
36
105
|
import { z } from "zod";
|
|
37
106
|
|
|
38
107
|
// src/client.ts
|
|
39
|
-
import {
|
|
40
|
-
|
|
108
|
+
import {
|
|
109
|
+
SecretString,
|
|
110
|
+
newQueryBranch,
|
|
111
|
+
newQueryRetry
|
|
112
|
+
} from "@superdurable/connectors-sdk";
|
|
113
|
+
import {
|
|
114
|
+
BodyTooLargeError,
|
|
115
|
+
isHeaderSafeCredential,
|
|
116
|
+
parseRetryAfter,
|
|
117
|
+
sendProviderRequest,
|
|
118
|
+
validateBaseURL
|
|
119
|
+
} from "@superdurable/connectors-sdk/providerhttp";
|
|
41
120
|
var emptyCustomers = () => ({ email: "", customerIDs: [] });
|
|
42
121
|
var CustomerioClient = class {
|
|
43
122
|
/** Validate provider configuration without contacting Customer.io. */
|
|
44
123
|
constructor(config, credentials, options = {}) {
|
|
45
124
|
this.credentials = credentials;
|
|
46
|
-
if (!config || !credentials)
|
|
125
|
+
if (!config || !credentials)
|
|
126
|
+
throw new TypeError("Customer.io configuration and credentials are required");
|
|
47
127
|
this.baseURL = validateBaseURL(config.baseUrl ?? "https://api.customer.io").replace(/\/$/, "");
|
|
48
128
|
this.timeoutMs = config.timeoutMs ?? 15e3;
|
|
49
129
|
this.maxResponseBytes = config.maxResponseBytes ?? 1048576;
|
|
@@ -60,8 +140,23 @@ var CustomerioClient = class {
|
|
|
60
140
|
getCustomersByEmail() {
|
|
61
141
|
return new GetCustomersByEmailOperation(this);
|
|
62
142
|
}
|
|
143
|
+
/** Bind the GetCampaign App API query. */
|
|
144
|
+
getCampaign() {
|
|
145
|
+
return new GetCampaignOperation((call, path) => this.getPath(call, path));
|
|
146
|
+
}
|
|
147
|
+
/** Bind the ListCampaigns App API query. */
|
|
148
|
+
listCampaigns() {
|
|
149
|
+
return new ListCampaignsOperation((call, path) => this.getPath(call, path));
|
|
150
|
+
}
|
|
151
|
+
/** Bind the GetCampaignMetrics App API query. */
|
|
152
|
+
getCampaignMetrics() {
|
|
153
|
+
return new GetCampaignMetricsOperation((call, path) => this.getPath(call, path));
|
|
154
|
+
}
|
|
63
155
|
/** Resolve credentials and send one bounded customer lookup. */
|
|
64
156
|
async get(call, email) {
|
|
157
|
+
return this.getPath(call, "/v1/customers?" + new URLSearchParams({ email }).toString());
|
|
158
|
+
}
|
|
159
|
+
async getPath(call, path) {
|
|
65
160
|
let privateKey;
|
|
66
161
|
try {
|
|
67
162
|
const credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
@@ -70,10 +165,8 @@ var CustomerioClient = class {
|
|
|
70
165
|
return emptyExchange("credential");
|
|
71
166
|
}
|
|
72
167
|
if (!isHeaderSafeCredential(privateKey)) return emptyExchange("credential");
|
|
73
|
-
const url = new URL(`${this.baseURL}/v1/customers`);
|
|
74
|
-
url.searchParams.set("email", email);
|
|
75
168
|
const request = {
|
|
76
|
-
url:
|
|
169
|
+
url: this.baseURL + path,
|
|
77
170
|
method: "GET",
|
|
78
171
|
headers: { Accept: "application/json", Authorization: `Bearer ${privateKey}` },
|
|
79
172
|
maxResponseBytes: this.maxResponseBytes,
|
|
@@ -110,34 +203,128 @@ var GetCustomersByEmailOperation = class {
|
|
|
110
203
|
/** Classify provider outcomes consistently with Go. */
|
|
111
204
|
async invoke(call, input) {
|
|
112
205
|
if (!isValidEmail(input?.email))
|
|
113
|
-
return
|
|
206
|
+
return newQueryBranch(
|
|
207
|
+
"defect",
|
|
208
|
+
emptyCustomers(),
|
|
209
|
+
{},
|
|
210
|
+
{
|
|
211
|
+
kind: "VALIDATION",
|
|
212
|
+
provider: "customerio",
|
|
213
|
+
operation: "getCustomersByEmail",
|
|
214
|
+
message: "email must be one valid address of at most 320 bytes"
|
|
215
|
+
}
|
|
216
|
+
);
|
|
114
217
|
const exchange = await this.client.get(call, input.email);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (!customers) return terminal("invalidResponse", "PROTOCOL", "Customer.io returned invalid customer-lookup JSON");
|
|
123
|
-
return newQueryBranch("found", customers);
|
|
218
|
+
return classify(
|
|
219
|
+
exchange,
|
|
220
|
+
"getCustomersByEmail",
|
|
221
|
+
emptyCustomers(),
|
|
222
|
+
"found",
|
|
223
|
+
(body) => decodeCustomers(body, input.email)
|
|
224
|
+
);
|
|
124
225
|
}
|
|
125
226
|
};
|
|
227
|
+
function invalidInput(operation, empty) {
|
|
228
|
+
return newQueryBranch(
|
|
229
|
+
"defect",
|
|
230
|
+
empty,
|
|
231
|
+
{},
|
|
232
|
+
{ kind: "VALIDATION", provider: "customerio", operation, message: "Invalid Customer.io query input" }
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function classify(exchange, operation, empty, success, decode, supportsNotFound = false) {
|
|
236
|
+
const failure = (kind, message) => ({
|
|
237
|
+
kind,
|
|
238
|
+
message,
|
|
239
|
+
provider: "customerio",
|
|
240
|
+
operation
|
|
241
|
+
});
|
|
242
|
+
const branch = (name, kind, message) => newQueryBranch(name, empty, {}, failure(kind, message));
|
|
243
|
+
if (exchange.error === "credential")
|
|
244
|
+
return branch("defect", "AUTHENTICATION", "Customer.io credentials are unavailable or invalid");
|
|
245
|
+
if (exchange.error === "request")
|
|
246
|
+
return newQueryRetry(failure("TRANSPORT", "Customer.io request failed"), 0);
|
|
247
|
+
if (exchange.status === 429)
|
|
248
|
+
return newQueryRetry(
|
|
249
|
+
failure("RATE_LIMIT", "Customer.io rate limited the request"),
|
|
250
|
+
exchange.retryAfterMs
|
|
251
|
+
);
|
|
252
|
+
if (exchange.status === 408 || exchange.status >= 500)
|
|
253
|
+
return newQueryRetry(
|
|
254
|
+
failure("AVAILABILITY", "Customer.io is temporarily unavailable"),
|
|
255
|
+
exchange.retryAfterMs
|
|
256
|
+
);
|
|
257
|
+
if (exchange.status === 404 && supportsNotFound)
|
|
258
|
+
return branch("notFound", "NOT_FOUND", "Customer.io campaign was not found");
|
|
259
|
+
if (exchange.status !== 200)
|
|
260
|
+
return branch("providerRejected", "PROVIDER_REJECTION", `Customer.io rejected HTTP ${exchange.status}`);
|
|
261
|
+
if (exchange.error === "tooLarge")
|
|
262
|
+
return branch(
|
|
263
|
+
"invalidResponse",
|
|
264
|
+
"RESPONSE_TOO_LARGE",
|
|
265
|
+
"Customer.io response exceeded the configured limit"
|
|
266
|
+
);
|
|
267
|
+
const output = decode(exchange.body);
|
|
268
|
+
if (output === void 0)
|
|
269
|
+
return branch("invalidResponse", "PROTOCOL", "Customer.io returned invalid query data");
|
|
270
|
+
return newQueryBranch(success, output);
|
|
271
|
+
}
|
|
272
|
+
function campaignSummary(value) {
|
|
273
|
+
const fields = objectFields(value);
|
|
274
|
+
if (!fields || !positiveID(fields.id) || typeof fields.name !== "string" || !fields.name.trim() || fields.active != null && typeof fields.active !== "boolean" || fields.state != null && typeof fields.state !== "string")
|
|
275
|
+
return void 0;
|
|
276
|
+
return { id: fields.id, name: fields.name, active: fields.active ?? false, state: fields.state ?? "" };
|
|
277
|
+
}
|
|
278
|
+
function positiveID(value) {
|
|
279
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
280
|
+
}
|
|
281
|
+
function objectFields(value) {
|
|
282
|
+
return isObject(value) ? Object.fromEntries(Object.entries(value).map(([k, v]) => [k.toLowerCase(), v])) : void 0;
|
|
283
|
+
}
|
|
284
|
+
function envelope(body) {
|
|
285
|
+
try {
|
|
286
|
+
const document = JSON.parse(
|
|
287
|
+
new TextDecoder().decode(body),
|
|
288
|
+
(_key, value, context) => typeof value === "number" && context?.source && !/^-?\d+$/.test(context.source) ? /* @__PURE__ */ Symbol("non-integer") : value
|
|
289
|
+
);
|
|
290
|
+
return objectFields(document);
|
|
291
|
+
} catch {
|
|
292
|
+
return void 0;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function campaignsPage(body) {
|
|
296
|
+
const rows = envelope(body)?.campaigns;
|
|
297
|
+
if (!Array.isArray(rows)) return void 0;
|
|
298
|
+
const campaigns = [];
|
|
299
|
+
for (const row of rows) {
|
|
300
|
+
const campaign = campaignSummary(row);
|
|
301
|
+
if (!campaign) return void 0;
|
|
302
|
+
campaigns.push(campaign);
|
|
303
|
+
}
|
|
304
|
+
return { campaigns };
|
|
305
|
+
}
|
|
306
|
+
function campaignMetrics(body, campaignId) {
|
|
307
|
+
const series = objectFields(envelope(body)?.metric)?.series;
|
|
308
|
+
if (!isObject(series)) return void 0;
|
|
309
|
+
const output = [];
|
|
310
|
+
for (const [name, counts] of Object.entries(series)) {
|
|
311
|
+
if (!name || !Array.isArray(counts)) return void 0;
|
|
312
|
+
const values = [];
|
|
313
|
+
for (const count of counts) {
|
|
314
|
+
if (count !== null && (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0))
|
|
315
|
+
return void 0;
|
|
316
|
+
values.push(count ?? 0);
|
|
317
|
+
}
|
|
318
|
+
output.push([name, values]);
|
|
319
|
+
}
|
|
320
|
+
return { campaignId, series: Object.fromEntries(output) };
|
|
321
|
+
}
|
|
126
322
|
function isValidEmail(value) {
|
|
127
323
|
return typeof value === "string" && value.length > 0 && value.trim() === value && new TextEncoder().encode(value).length <= 320 && /^[^\s@]+@[^\s@]+$/.test(value) && !/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF])/.test(value);
|
|
128
324
|
}
|
|
129
325
|
function emptyExchange(error) {
|
|
130
326
|
return { status: 0, body: new Uint8Array(), retryAfterMs: 0, error };
|
|
131
327
|
}
|
|
132
|
-
function failure(kind, message) {
|
|
133
|
-
return { provider: "customerio", operation: "getCustomersByEmail", kind, message };
|
|
134
|
-
}
|
|
135
|
-
function terminal(branch, kind, message) {
|
|
136
|
-
return newQueryBranch(branch, emptyCustomers(), {}, failure(kind, message));
|
|
137
|
-
}
|
|
138
|
-
function retry(kind, message, delay = 0) {
|
|
139
|
-
return newQueryRetry(failure(kind, message), delay);
|
|
140
|
-
}
|
|
141
328
|
function header(headers, name) {
|
|
142
329
|
const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
143
330
|
return Array.isArray(entry) ? entry[0] ?? "" : entry ?? "";
|
|
@@ -160,6 +347,82 @@ function decodeCustomers(body, email) {
|
|
|
160
347
|
}
|
|
161
348
|
return { email, customerIDs };
|
|
162
349
|
}
|
|
350
|
+
var GetCampaignOperation = class {
|
|
351
|
+
/** Bind the authenticated App API reader. */
|
|
352
|
+
constructor(read) {
|
|
353
|
+
this.read = read;
|
|
354
|
+
}
|
|
355
|
+
read;
|
|
356
|
+
/** Return the manifest query definition. */
|
|
357
|
+
definition() {
|
|
358
|
+
return GetCampaignDefinition;
|
|
359
|
+
}
|
|
360
|
+
/** Classify one bounded provider response. */
|
|
361
|
+
async invoke(call, input) {
|
|
362
|
+
const empty = { id: 0, name: "", active: false, state: "" };
|
|
363
|
+
if (!positiveID(input?.campaignId)) return invalidInput("getCampaign", empty);
|
|
364
|
+
return classify(
|
|
365
|
+
await this.read(call, `/v1/campaigns/${input.campaignId}`),
|
|
366
|
+
"getCampaign",
|
|
367
|
+
empty,
|
|
368
|
+
"found",
|
|
369
|
+
(body) => campaignSummary(envelope(body)?.campaign),
|
|
370
|
+
true
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
var ListCampaignsOperation = class {
|
|
375
|
+
/** Bind the authenticated App API reader. */
|
|
376
|
+
constructor(read) {
|
|
377
|
+
this.read = read;
|
|
378
|
+
}
|
|
379
|
+
read;
|
|
380
|
+
/** Return the manifest query definition. */
|
|
381
|
+
definition() {
|
|
382
|
+
return ListCampaignsDefinition;
|
|
383
|
+
}
|
|
384
|
+
/** Classify one bounded provider response. */
|
|
385
|
+
async invoke(call) {
|
|
386
|
+
return classify(
|
|
387
|
+
await this.read(call, "/v1/campaigns"),
|
|
388
|
+
"listCampaigns",
|
|
389
|
+
{ campaigns: [] },
|
|
390
|
+
"listed",
|
|
391
|
+
campaignsPage
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
var GetCampaignMetricsOperation = class {
|
|
396
|
+
/** Bind the authenticated App API reader. */
|
|
397
|
+
constructor(read) {
|
|
398
|
+
this.read = read;
|
|
399
|
+
}
|
|
400
|
+
read;
|
|
401
|
+
/** Return the manifest query definition. */
|
|
402
|
+
definition() {
|
|
403
|
+
return GetCampaignMetricsDefinition;
|
|
404
|
+
}
|
|
405
|
+
/** Classify one bounded provider response. */
|
|
406
|
+
async invoke(call, input) {
|
|
407
|
+
const empty = { campaignId: 0, series: {} };
|
|
408
|
+
if (!positiveID(input?.campaignId) || !positiveID(input.startUnix) || !positiveID(input.endUnix) || input.startUnix >= input.endUnix || input.endUnix - input.startUnix > 10 * 366 * 86400 || !["hours", "days", "weeks", "months"].includes(input.resolution))
|
|
409
|
+
return invalidInput("getCampaignMetrics", empty);
|
|
410
|
+
const query = new URLSearchParams({
|
|
411
|
+
end: String(input.endUnix),
|
|
412
|
+
res: input.resolution,
|
|
413
|
+
start: String(input.startUnix),
|
|
414
|
+
version: "2"
|
|
415
|
+
});
|
|
416
|
+
return classify(
|
|
417
|
+
await this.read(call, `/v1/campaigns/${input.campaignId}/metrics?${query}`),
|
|
418
|
+
"getCampaignMetrics",
|
|
419
|
+
empty,
|
|
420
|
+
"found",
|
|
421
|
+
(body) => campaignMetrics(body, input.campaignId),
|
|
422
|
+
true
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
163
426
|
|
|
164
427
|
// src/project.ts
|
|
165
428
|
function newProjectConnection2(project, connectionName) {
|
|
@@ -197,11 +460,35 @@ function parseDurationMilliseconds(value) {
|
|
|
197
460
|
return milliseconds;
|
|
198
461
|
}
|
|
199
462
|
export {
|
|
463
|
+
CampaignMetricsSchema,
|
|
464
|
+
CampaignSummarySchema,
|
|
465
|
+
CampaignsPageSchema,
|
|
200
466
|
ConfigSchema,
|
|
201
467
|
Connection,
|
|
202
468
|
ConnectorID,
|
|
469
|
+
CredentialMaterialError,
|
|
203
470
|
CustomerLookupPageSchema,
|
|
204
471
|
CustomerioClient,
|
|
472
|
+
GetCampaignBranch,
|
|
473
|
+
GetCampaignBranchDefect,
|
|
474
|
+
GetCampaignBranchFound,
|
|
475
|
+
GetCampaignBranchInvalidResponse,
|
|
476
|
+
GetCampaignBranchNotFound,
|
|
477
|
+
GetCampaignBranchProviderRejected,
|
|
478
|
+
GetCampaignDefinition,
|
|
479
|
+
GetCampaignInputSchema,
|
|
480
|
+
GetCampaignMetadata,
|
|
481
|
+
GetCampaignMetricsBranch,
|
|
482
|
+
GetCampaignMetricsBranchDefect,
|
|
483
|
+
GetCampaignMetricsBranchFound,
|
|
484
|
+
GetCampaignMetricsBranchInvalidResponse,
|
|
485
|
+
GetCampaignMetricsBranchNotFound,
|
|
486
|
+
GetCampaignMetricsBranchProviderRejected,
|
|
487
|
+
GetCampaignMetricsDefinition,
|
|
488
|
+
GetCampaignMetricsInputSchema,
|
|
489
|
+
GetCampaignMetricsMetadata,
|
|
490
|
+
GetCampaignMetricsOperation,
|
|
491
|
+
GetCampaignOperation,
|
|
205
492
|
GetCustomersByEmailBranch,
|
|
206
493
|
GetCustomersByEmailBranchDefect,
|
|
207
494
|
GetCustomersByEmailBranchFound,
|
|
@@ -211,10 +498,23 @@ export {
|
|
|
211
498
|
GetCustomersByEmailInputSchema,
|
|
212
499
|
GetCustomersByEmailMetadata,
|
|
213
500
|
GetCustomersByEmailOperation,
|
|
501
|
+
ListCampaignsBranch,
|
|
502
|
+
ListCampaignsBranchDefect,
|
|
503
|
+
ListCampaignsBranchInvalidResponse,
|
|
504
|
+
ListCampaignsBranchListed,
|
|
505
|
+
ListCampaignsBranchProviderRejected,
|
|
506
|
+
ListCampaignsDefinition,
|
|
507
|
+
ListCampaignsInputSchema,
|
|
508
|
+
ListCampaignsMetadata,
|
|
509
|
+
ListCampaignsOperation,
|
|
214
510
|
ProviderID,
|
|
215
511
|
decodeCredentials,
|
|
512
|
+
isCredentialMaterialError,
|
|
216
513
|
newConnection,
|
|
217
514
|
newConnectionWithOperations,
|
|
515
|
+
newGetCampaignMetricsStep,
|
|
516
|
+
newGetCampaignStep,
|
|
218
517
|
newGetCustomersByEmailStep,
|
|
518
|
+
newListCampaignsStep,
|
|
219
519
|
newProjectConnection2 as newProjectConnection
|
|
220
520
|
};
|
package/dist/mock.d.ts
CHANGED
|
@@ -1,13 +1,71 @@
|
|
|
1
1
|
import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
2
|
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
-
import { O as Operations, a as Connection, G as
|
|
3
|
+
import { O as Operations, a as Connection, b as GetCampaignInput, c as CampaignSummary, L as ListCampaignsInput, f as CampaignsPage, G as GetCampaignMetricsInput, C as CampaignMetrics, d as GetCustomersByEmailInput, e as CustomerLookupPage } from './connection-D0Rf4T-r.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
|
+
/** Go zero value for GetCampaignInput in scripted cases. */
|
|
7
|
+
declare const emptyGetCampaignInput: GetCampaignInput;
|
|
8
|
+
/** Go zero value for CampaignSummary in scripted cases. */
|
|
9
|
+
declare const emptyCampaignSummary: CampaignSummary;
|
|
10
|
+
/** Go zero value for ListCampaignsInput in scripted cases. */
|
|
11
|
+
declare const emptyListCampaignsInput: ListCampaignsInput;
|
|
12
|
+
/** Go zero value for CampaignsPage in scripted cases. */
|
|
13
|
+
declare const emptyCampaignsPage: CampaignsPage;
|
|
14
|
+
/** Go zero value for GetCampaignMetricsInput in scripted cases. */
|
|
15
|
+
declare const emptyGetCampaignMetricsInput: GetCampaignMetricsInput;
|
|
16
|
+
/** Go zero value for CampaignMetrics in scripted cases. */
|
|
17
|
+
declare const emptyCampaignMetrics: CampaignMetrics;
|
|
6
18
|
/** Go zero value for GetCustomersByEmailInput in scripted cases. */
|
|
7
19
|
declare const emptyGetCustomersByEmailInput: GetCustomersByEmailInput;
|
|
8
20
|
/** Go zero value for CustomerLookupPage in scripted cases. */
|
|
9
21
|
declare const emptyCustomerLookupPage: CustomerLookupPage;
|
|
10
22
|
/** Script the found branch. */
|
|
23
|
+
declare function getCampaignFound(value: CampaignSummary, failure?: Failure): Case<CampaignSummary>;
|
|
24
|
+
/** Script the notFound branch. */
|
|
25
|
+
declare function getCampaignNotFound(value: CampaignSummary, failure?: Failure): Case<CampaignSummary>;
|
|
26
|
+
/** Script the providerRejected branch. */
|
|
27
|
+
declare function getCampaignProviderRejected(value: CampaignSummary, failure?: Failure): Case<CampaignSummary>;
|
|
28
|
+
/** Script the invalidResponse branch. */
|
|
29
|
+
declare function getCampaignInvalidResponse(value: CampaignSummary, failure?: Failure): Case<CampaignSummary>;
|
|
30
|
+
/** Script the defect branch. */
|
|
31
|
+
declare function getCampaignDefect(value: CampaignSummary, failure?: Failure): Case<CampaignSummary>;
|
|
32
|
+
/** Script a safe retry of getCampaign. */
|
|
33
|
+
declare function getCampaignRetry(failure: Failure, retryAfterMs?: number): Case<CampaignSummary>;
|
|
34
|
+
/** Manifest scenario foundDefault for getCampaign. */
|
|
35
|
+
declare function getCampaignFoundDefault(): Case<CampaignSummary>;
|
|
36
|
+
/** Default getCampaign scenario. */
|
|
37
|
+
declare function getCampaignDefault(): Case<CampaignSummary>;
|
|
38
|
+
/** Script the listed branch. */
|
|
39
|
+
declare function listCampaignsListed(value: CampaignsPage, failure?: Failure): Case<CampaignsPage>;
|
|
40
|
+
/** Script the providerRejected branch. */
|
|
41
|
+
declare function listCampaignsProviderRejected(value: CampaignsPage, failure?: Failure): Case<CampaignsPage>;
|
|
42
|
+
/** Script the invalidResponse branch. */
|
|
43
|
+
declare function listCampaignsInvalidResponse(value: CampaignsPage, failure?: Failure): Case<CampaignsPage>;
|
|
44
|
+
/** Script the defect branch. */
|
|
45
|
+
declare function listCampaignsDefect(value: CampaignsPage, failure?: Failure): Case<CampaignsPage>;
|
|
46
|
+
/** Script a safe retry of listCampaigns. */
|
|
47
|
+
declare function listCampaignsRetry(failure: Failure, retryAfterMs?: number): Case<CampaignsPage>;
|
|
48
|
+
/** Manifest scenario listedDefault for listCampaigns. */
|
|
49
|
+
declare function listCampaignsListedDefault(): Case<CampaignsPage>;
|
|
50
|
+
/** Default listCampaigns scenario. */
|
|
51
|
+
declare function listCampaignsDefault(): Case<CampaignsPage>;
|
|
52
|
+
/** Script the found branch. */
|
|
53
|
+
declare function getCampaignMetricsFound(value: CampaignMetrics, failure?: Failure): Case<CampaignMetrics>;
|
|
54
|
+
/** Script the notFound branch. */
|
|
55
|
+
declare function getCampaignMetricsNotFound(value: CampaignMetrics, failure?: Failure): Case<CampaignMetrics>;
|
|
56
|
+
/** Script the providerRejected branch. */
|
|
57
|
+
declare function getCampaignMetricsProviderRejected(value: CampaignMetrics, failure?: Failure): Case<CampaignMetrics>;
|
|
58
|
+
/** Script the invalidResponse branch. */
|
|
59
|
+
declare function getCampaignMetricsInvalidResponse(value: CampaignMetrics, failure?: Failure): Case<CampaignMetrics>;
|
|
60
|
+
/** Script the defect branch. */
|
|
61
|
+
declare function getCampaignMetricsDefect(value: CampaignMetrics, failure?: Failure): Case<CampaignMetrics>;
|
|
62
|
+
/** Script a safe retry of getCampaignMetrics. */
|
|
63
|
+
declare function getCampaignMetricsRetry(failure: Failure, retryAfterMs?: number): Case<CampaignMetrics>;
|
|
64
|
+
/** Manifest scenario foundDefault for getCampaignMetrics. */
|
|
65
|
+
declare function getCampaignMetricsFoundDefault(): Case<CampaignMetrics>;
|
|
66
|
+
/** Default getCampaignMetrics scenario. */
|
|
67
|
+
declare function getCampaignMetricsDefault(): Case<CampaignMetrics>;
|
|
68
|
+
/** Script the found branch. */
|
|
11
69
|
declare function getCustomersByEmailFound(value: CustomerLookupPage, failure?: Failure): Case<CustomerLookupPage>;
|
|
12
70
|
/** Script the providerRejected branch. */
|
|
13
71
|
declare function getCustomersByEmailProviderRejected(value: CustomerLookupPage, failure?: Failure): Case<CustomerLookupPage>;
|
|
@@ -26,8 +84,11 @@ declare class GeneratedMock implements Operations {
|
|
|
26
84
|
#private;
|
|
27
85
|
constructor(connectionName: string);
|
|
28
86
|
connection(): Connection;
|
|
87
|
+
getCampaign(): MockQuery<GetCampaignInput, CampaignSummary>;
|
|
88
|
+
listCampaigns(): MockQuery<ListCampaignsInput, CampaignsPage>;
|
|
89
|
+
getCampaignMetrics(): MockQuery<GetCampaignMetricsInput, CampaignMetrics>;
|
|
29
90
|
getCustomersByEmail(): MockQuery<GetCustomersByEmailInput, CustomerLookupPage>;
|
|
30
91
|
assertNoFailures(): void;
|
|
31
92
|
}
|
|
32
93
|
|
|
33
|
-
export { GeneratedMock, GeneratedMock as Mock, emptyCustomerLookupPage, emptyGetCustomersByEmailInput, getCustomersByEmailDefault, getCustomersByEmailDefect, getCustomersByEmailFound, getCustomersByEmailFoundDefault, getCustomersByEmailInvalidResponse, getCustomersByEmailProviderRejected, getCustomersByEmailRetry };
|
|
94
|
+
export { GeneratedMock, GeneratedMock as Mock, emptyCampaignMetrics, emptyCampaignSummary, emptyCampaignsPage, emptyCustomerLookupPage, emptyGetCampaignInput, emptyGetCampaignMetricsInput, emptyGetCustomersByEmailInput, emptyListCampaignsInput, getCampaignDefault, getCampaignDefect, getCampaignFound, getCampaignFoundDefault, getCampaignInvalidResponse, getCampaignMetricsDefault, getCampaignMetricsDefect, getCampaignMetricsFound, getCampaignMetricsFoundDefault, getCampaignMetricsInvalidResponse, getCampaignMetricsNotFound, getCampaignMetricsProviderRejected, getCampaignMetricsRetry, getCampaignNotFound, getCampaignProviderRejected, getCampaignRetry, getCustomersByEmailDefault, getCustomersByEmailDefect, getCustomersByEmailFound, getCustomersByEmailFoundDefault, getCustomersByEmailInvalidResponse, getCustomersByEmailProviderRejected, getCustomersByEmailRetry, listCampaignsDefault, listCampaignsDefect, listCampaignsInvalidResponse, listCampaignsListed, listCampaignsListedDefault, listCampaignsProviderRejected, listCampaignsRetry };
|