@superdurable/connector-customerio 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +2 -2
- package/dex-connector.json +224 -0
- package/dist/chunk-S6QG7G3I.js +237 -0
- package/dist/connection-D0Rf4T-r.d.ts +155 -0
- package/dist/index.d.ts +266 -0
- package/dist/index.js +520 -0
- package/dist/mock.d.ts +94 -0
- package/dist/mock.js +220 -0
- package/package.json +59 -4
package/dist/mock.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CampaignMetricsSchema,
|
|
3
|
+
CampaignSummarySchema,
|
|
4
|
+
CampaignsPageSchema,
|
|
5
|
+
CustomerLookupPageSchema,
|
|
6
|
+
GetCampaignDefinition,
|
|
7
|
+
GetCampaignInputSchema,
|
|
8
|
+
GetCampaignMetricsDefinition,
|
|
9
|
+
GetCampaignMetricsInputSchema,
|
|
10
|
+
GetCustomersByEmailDefinition,
|
|
11
|
+
GetCustomersByEmailInputSchema,
|
|
12
|
+
ListCampaignsDefinition,
|
|
13
|
+
ListCampaignsInputSchema,
|
|
14
|
+
ProviderID,
|
|
15
|
+
newConnectionWithOperations
|
|
16
|
+
} from "./chunk-S6QG7G3I.js";
|
|
17
|
+
|
|
18
|
+
// src/generated/mock.ts
|
|
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
|
+
});
|
|
43
|
+
var emptyGetCustomersByEmailInput = GetCustomersByEmailInputSchema.parse({
|
|
44
|
+
"email": ""
|
|
45
|
+
});
|
|
46
|
+
var emptyCustomerLookupPage = CustomerLookupPageSchema.parse({
|
|
47
|
+
"email": "",
|
|
48
|
+
"customerIDs": []
|
|
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
|
+
}
|
|
122
|
+
function getCustomersByEmailFound(value, failure) {
|
|
123
|
+
return branchCase("found", value, failure);
|
|
124
|
+
}
|
|
125
|
+
function getCustomersByEmailProviderRejected(value, failure) {
|
|
126
|
+
return branchCase("providerRejected", value, failure);
|
|
127
|
+
}
|
|
128
|
+
function getCustomersByEmailInvalidResponse(value, failure) {
|
|
129
|
+
return branchCase("invalidResponse", value, failure);
|
|
130
|
+
}
|
|
131
|
+
function getCustomersByEmailDefect(value, failure) {
|
|
132
|
+
return branchCase("defect", value, failure);
|
|
133
|
+
}
|
|
134
|
+
function getCustomersByEmailRetry(failure, retryAfterMs = 0) {
|
|
135
|
+
return retryCase(failure, retryAfterMs);
|
|
136
|
+
}
|
|
137
|
+
function getCustomersByEmailFoundDefault() {
|
|
138
|
+
const value = CustomerLookupPageSchema.parse({ "customerIDs": ["a3000001"], "email": "person@example.com" });
|
|
139
|
+
return branchCase("found", value);
|
|
140
|
+
}
|
|
141
|
+
function getCustomersByEmailDefault() {
|
|
142
|
+
return getCustomersByEmailFoundDefault();
|
|
143
|
+
}
|
|
144
|
+
var GeneratedMock = class {
|
|
145
|
+
#getCampaign;
|
|
146
|
+
#listCampaigns;
|
|
147
|
+
#getCampaignMetrics;
|
|
148
|
+
#getCustomersByEmail;
|
|
149
|
+
#connection;
|
|
150
|
+
constructor(connectionName) {
|
|
151
|
+
this.#getCampaign = newQuery(GetCampaignDefinition).default(getCampaignDefault());
|
|
152
|
+
this.#listCampaigns = newQuery(ListCampaignsDefinition).default(listCampaignsDefault());
|
|
153
|
+
this.#getCampaignMetrics = newQuery(GetCampaignMetricsDefinition).default(getCampaignMetricsDefault());
|
|
154
|
+
this.#getCustomersByEmail = newQuery(GetCustomersByEmailDefinition).default(getCustomersByEmailDefault());
|
|
155
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
156
|
+
}
|
|
157
|
+
connection() {
|
|
158
|
+
return this.#connection;
|
|
159
|
+
}
|
|
160
|
+
getCampaign() {
|
|
161
|
+
return this.#getCampaign;
|
|
162
|
+
}
|
|
163
|
+
listCampaigns() {
|
|
164
|
+
return this.#listCampaigns;
|
|
165
|
+
}
|
|
166
|
+
getCampaignMetrics() {
|
|
167
|
+
return this.#getCampaignMetrics;
|
|
168
|
+
}
|
|
169
|
+
getCustomersByEmail() {
|
|
170
|
+
return this.#getCustomersByEmail;
|
|
171
|
+
}
|
|
172
|
+
assertNoFailures() {
|
|
173
|
+
this.#getCampaign.assertNoFailures();
|
|
174
|
+
this.#listCampaigns.assertNoFailures();
|
|
175
|
+
this.#getCampaignMetrics.assertNoFailures();
|
|
176
|
+
this.#getCustomersByEmail.assertNoFailures();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
export {
|
|
180
|
+
GeneratedMock,
|
|
181
|
+
GeneratedMock as Mock,
|
|
182
|
+
emptyCampaignMetrics,
|
|
183
|
+
emptyCampaignSummary,
|
|
184
|
+
emptyCampaignsPage,
|
|
185
|
+
emptyCustomerLookupPage,
|
|
186
|
+
emptyGetCampaignInput,
|
|
187
|
+
emptyGetCampaignMetricsInput,
|
|
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,
|
|
206
|
+
getCustomersByEmailDefault,
|
|
207
|
+
getCustomersByEmailDefect,
|
|
208
|
+
getCustomersByEmailFound,
|
|
209
|
+
getCustomersByEmailFoundDefault,
|
|
210
|
+
getCustomersByEmailInvalidResponse,
|
|
211
|
+
getCustomersByEmailProviderRejected,
|
|
212
|
+
getCustomersByEmailRetry,
|
|
213
|
+
listCampaignsDefault,
|
|
214
|
+
listCampaignsDefect,
|
|
215
|
+
listCampaignsInvalidResponse,
|
|
216
|
+
listCampaignsListed,
|
|
217
|
+
listCampaignsListedDefault,
|
|
218
|
+
listCampaignsProviderRejected,
|
|
219
|
+
listCampaignsRetry
|
|
220
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-customerio",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Customerio connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/customerio/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/customer-lookup/worker.ts",
|
|
42
|
+
"example:start": "tsx examples/customer-lookup/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
|
+
}
|