@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.
@@ -0,0 +1,266 @@
1
+ import { G as GetCampaignMetricsInput, C as CampaignMetrics, a as Connection, b as GetCampaignInput, c as CampaignSummary, d as GetCustomersByEmailInput, e as CustomerLookupPage, L as ListCampaignsInput, f as CampaignsPage, O as Operations, g as Config, h as Credentials } from './connection-D0Rf4T-r.js';
2
+ export { i as CampaignMetricsSchema, j as CampaignSummarySchema, k as CampaignsPageSchema, l as ConfigSchema, m as CredentialMaterialError, n as CredentialSource, o as CustomerLookupPageSchema, p as GetCampaignInputSchema, q as GetCampaignMetricsInputSchema, r as GetCustomersByEmailInputSchema, s as ListCampaignsInputSchema, t as decodeCredentials, u as isCredentialMaterialError } from './connection-D0Rf4T-r.js';
3
+ import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, ConnectionRef, CredentialProvider, Call, QueryAttempt } from '@superdurable/connectors-sdk';
4
+ import { StepTarget } from '@superdurable/dex';
5
+ import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
6
+ import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
7
+ import 'zod';
8
+
9
+ /** Stable connector identity. */
10
+ declare const ConnectorID = "customerio";
11
+ /** Provider identity for named connections. */
12
+ declare const ProviderID = "customerio";
13
+ /** Branch IDs for getCampaign. */
14
+ declare const GetCampaignBranch: {
15
+ readonly Found: "found";
16
+ readonly NotFound: "notFound";
17
+ readonly ProviderRejected: "providerRejected";
18
+ readonly InvalidResponse: "invalidResponse";
19
+ readonly Defect: "defect";
20
+ };
21
+ /** Customer.io returned the campaign. */
22
+ declare const GetCampaignBranchFound: "found";
23
+ /** No accessible campaign has this ID. */
24
+ declare const GetCampaignBranchNotFound: "notFound";
25
+ /** Customer.io rejected the campaign lookup. */
26
+ declare const GetCampaignBranchProviderRejected: "providerRejected";
27
+ /** Customer.io returned invalid or oversized JSON. */
28
+ declare const GetCampaignBranchInvalidResponse: "invalidResponse";
29
+ /** Input or App API credentials are invalid. */
30
+ declare const GetCampaignBranchDefect: "defect";
31
+ /** Manifest definition for getCampaign. */
32
+ declare const GetCampaignDefinition: QueryDefinition;
33
+ /** Manifest metadata for getCampaign. */
34
+ declare const GetCampaignMetadata: {
35
+ readonly kind: "query";
36
+ readonly idempotency: "none";
37
+ readonly authorization: "required";
38
+ };
39
+ /** Branch IDs for listCampaigns. */
40
+ declare const ListCampaignsBranch: {
41
+ readonly Listed: "listed";
42
+ readonly ProviderRejected: "providerRejected";
43
+ readonly InvalidResponse: "invalidResponse";
44
+ readonly Defect: "defect";
45
+ };
46
+ /** Customer.io returned the campaign list. */
47
+ declare const ListCampaignsBranchListed: "listed";
48
+ /** Customer.io rejected the campaign list. */
49
+ declare const ListCampaignsBranchProviderRejected: "providerRejected";
50
+ /** Customer.io returned invalid or oversized JSON. */
51
+ declare const ListCampaignsBranchInvalidResponse: "invalidResponse";
52
+ /** App API credentials are invalid. */
53
+ declare const ListCampaignsBranchDefect: "defect";
54
+ /** Manifest definition for listCampaigns. */
55
+ declare const ListCampaignsDefinition: QueryDefinition;
56
+ /** Manifest metadata for listCampaigns. */
57
+ declare const ListCampaignsMetadata: {
58
+ readonly kind: "query";
59
+ readonly idempotency: "none";
60
+ readonly authorization: "required";
61
+ };
62
+ /** Branch IDs for getCampaignMetrics. */
63
+ declare const GetCampaignMetricsBranch: {
64
+ readonly Found: "found";
65
+ readonly NotFound: "notFound";
66
+ readonly ProviderRejected: "providerRejected";
67
+ readonly InvalidResponse: "invalidResponse";
68
+ readonly Defect: "defect";
69
+ };
70
+ /** Customer.io returned campaign metric series. */
71
+ declare const GetCampaignMetricsBranchFound: "found";
72
+ /** No accessible campaign has this ID. */
73
+ declare const GetCampaignMetricsBranchNotFound: "notFound";
74
+ /** Customer.io rejected the metrics request. */
75
+ declare const GetCampaignMetricsBranchProviderRejected: "providerRejected";
76
+ /** Customer.io returned invalid or oversized JSON. */
77
+ declare const GetCampaignMetricsBranchInvalidResponse: "invalidResponse";
78
+ /** Input or App API credentials are invalid. */
79
+ declare const GetCampaignMetricsBranchDefect: "defect";
80
+ /** Manifest definition for getCampaignMetrics. */
81
+ declare const GetCampaignMetricsDefinition: QueryDefinition;
82
+ /** Manifest metadata for getCampaignMetrics. */
83
+ declare const GetCampaignMetricsMetadata: {
84
+ readonly kind: "query";
85
+ readonly idempotency: "none";
86
+ readonly authorization: "required";
87
+ };
88
+ /** Branch IDs for getCustomersByEmail. */
89
+ declare const GetCustomersByEmailBranch: {
90
+ readonly Found: "found";
91
+ readonly ProviderRejected: "providerRejected";
92
+ readonly InvalidResponse: "invalidResponse";
93
+ readonly Defect: "defect";
94
+ };
95
+ /** Customer.io returned matching customer IDs, possibly empty. */
96
+ declare const GetCustomersByEmailBranchFound: "found";
97
+ /** Customer.io conclusively rejected the lookup. */
98
+ declare const GetCustomersByEmailBranchProviderRejected: "providerRejected";
99
+ /** Customer.io returned malformed or oversized JSON. */
100
+ declare const GetCustomersByEmailBranchInvalidResponse: "invalidResponse";
101
+ /** Local input or credentials are invalid. */
102
+ declare const GetCustomersByEmailBranchDefect: "defect";
103
+ /** Manifest definition for getCustomersByEmail. */
104
+ declare const GetCustomersByEmailDefinition: QueryDefinition;
105
+ /** Manifest metadata for getCustomersByEmail. */
106
+ declare const GetCustomersByEmailMetadata: {
107
+ readonly kind: "query";
108
+ readonly idempotency: "none";
109
+ readonly authorization: "required";
110
+ };
111
+
112
+ /** Configuration for the getCampaign connector Step. */
113
+ interface GetCampaignStepConfig<StepInput, OperationInput = GetCampaignInput, OperationOutput = CampaignSummary> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
114
+ /** Named connection supplying this operation. */
115
+ connection: Connection<{
116
+ getCampaign(): Query<OperationInput, OperationOutput>;
117
+ }>;
118
+ /** Name matching the bound connection. */
119
+ connectionName: string;
120
+ /** Customer.io returned the campaign. */
121
+ found: StepTarget<QueryResult<OperationOutput>>;
122
+ /** No accessible campaign has this ID. */
123
+ notFound?: StepTarget<QueryResult<OperationOutput>>;
124
+ /** Customer.io rejected the campaign lookup. */
125
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
126
+ /** Customer.io returned invalid or oversized JSON. */
127
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
128
+ /** Input or App API credentials are invalid. */
129
+ defect?: StepTarget<QueryResult<OperationOutput>>;
130
+ }
131
+ /** Build the getCampaign Step from a named connection. */
132
+ declare function newGetCampaignStep<StepInput, OperationInput = GetCampaignInput, OperationOutput = CampaignSummary>(configuration: GetCampaignStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
133
+ /** Configuration for the listCampaigns connector Step. */
134
+ interface ListCampaignsStepConfig<StepInput, OperationInput = ListCampaignsInput, OperationOutput = CampaignsPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
135
+ /** Named connection supplying this operation. */
136
+ connection: Connection<{
137
+ listCampaigns(): Query<OperationInput, OperationOutput>;
138
+ }>;
139
+ /** Name matching the bound connection. */
140
+ connectionName: string;
141
+ /** Customer.io returned the campaign list. */
142
+ listed: StepTarget<QueryResult<OperationOutput>>;
143
+ /** Customer.io rejected the campaign list. */
144
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
145
+ /** Customer.io returned invalid or oversized JSON. */
146
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
147
+ /** App API credentials are invalid. */
148
+ defect?: StepTarget<QueryResult<OperationOutput>>;
149
+ }
150
+ /** Build the listCampaigns Step from a named connection. */
151
+ declare function newListCampaignsStep<StepInput, OperationInput = ListCampaignsInput, OperationOutput = CampaignsPage>(configuration: ListCampaignsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
152
+ /** Configuration for the getCampaignMetrics connector Step. */
153
+ interface GetCampaignMetricsStepConfig<StepInput, OperationInput = GetCampaignMetricsInput, OperationOutput = CampaignMetrics> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
154
+ /** Named connection supplying this operation. */
155
+ connection: Connection<{
156
+ getCampaignMetrics(): Query<OperationInput, OperationOutput>;
157
+ }>;
158
+ /** Name matching the bound connection. */
159
+ connectionName: string;
160
+ /** Customer.io returned campaign metric series. */
161
+ found: StepTarget<QueryResult<OperationOutput>>;
162
+ /** No accessible campaign has this ID. */
163
+ notFound?: StepTarget<QueryResult<OperationOutput>>;
164
+ /** Customer.io rejected the metrics request. */
165
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
166
+ /** Customer.io returned invalid or oversized JSON. */
167
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
168
+ /** Input or App API credentials are invalid. */
169
+ defect?: StepTarget<QueryResult<OperationOutput>>;
170
+ }
171
+ /** Build the getCampaignMetrics Step from a named connection. */
172
+ declare function newGetCampaignMetricsStep<StepInput, OperationInput = GetCampaignMetricsInput, OperationOutput = CampaignMetrics>(configuration: GetCampaignMetricsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
173
+ /** Configuration for the getCustomersByEmail connector Step. */
174
+ interface GetCustomersByEmailStepConfig<StepInput, OperationInput = GetCustomersByEmailInput, OperationOutput = CustomerLookupPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
175
+ /** Named connection supplying this operation. */
176
+ connection: Connection<{
177
+ getCustomersByEmail(): Query<OperationInput, OperationOutput>;
178
+ }>;
179
+ /** Name matching the bound connection. */
180
+ connectionName: string;
181
+ /** Customer.io returned matching customer IDs, possibly empty. */
182
+ found: StepTarget<QueryResult<OperationOutput>>;
183
+ /** Customer.io conclusively rejected the lookup. */
184
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
185
+ /** Customer.io returned malformed or oversized JSON. */
186
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
187
+ /** Local input or credentials are invalid. */
188
+ defect?: StepTarget<QueryResult<OperationOutput>>;
189
+ }
190
+ /** Build the getCustomersByEmail Step from a named connection. */
191
+ declare function newGetCustomersByEmailStep<StepInput, OperationInput = GetCustomersByEmailInput, OperationOutput = CustomerLookupPage>(configuration: GetCustomersByEmailStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
192
+
193
+ type CustomerReads = Pick<Operations, 'getCustomersByEmail'> & Partial<Operations>;
194
+ /** Bind the operations exposed by a client, including email-only clients. */
195
+ declare function newConnection<T extends CustomerReads>(client: T, reference: ConnectionRef): Connection<T>;
196
+ /** Bind scripted queries without requiring an application to supply unused operations. */
197
+ declare function newConnectionWithOperations<T extends CustomerReads>(operations: T, reference: ConnectionRef): Connection<T>;
198
+
199
+ /** Open one named Customerio connection from Dex project configuration. */
200
+ declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
201
+
202
+ /** Injectable provider sender for tests and local applications. */
203
+ interface CustomerioClientOptions {
204
+ /** Provider sender; omitted uses the SDK transport. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
205
+ }
206
+ interface Exchange {
207
+ status: number;
208
+ body: Uint8Array;
209
+ retryAfterMs: number;
210
+ error?: 'credential' | 'request' | 'tooLarge';
211
+ }
212
+ /** Authenticated Customer.io App API client for customer and campaign reads. */
213
+ declare class CustomerioClient {
214
+ private readonly credentials;
215
+ private readonly baseURL;
216
+ private readonly timeoutMs;
217
+ private readonly maxResponseBytes;
218
+ private readonly send;
219
+ /** Validate provider configuration without contacting Customer.io. */
220
+ constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: CustomerioClientOptions);
221
+ /** Bind the getCustomersByEmail Query. */ getCustomersByEmail(): GetCustomersByEmailOperation;
222
+ /** Bind the GetCampaign App API query. */
223
+ getCampaign(): GetCampaignOperation;
224
+ /** Bind the ListCampaigns App API query. */
225
+ listCampaigns(): ListCampaignsOperation;
226
+ /** Bind the GetCampaignMetrics App API query. */
227
+ getCampaignMetrics(): GetCampaignMetricsOperation;
228
+ /** Resolve credentials and send one bounded customer lookup. */
229
+ get(call: Call, email: string): Promise<Exchange>;
230
+ private getPath;
231
+ }
232
+ /** Look up Customer.io profile IDs by exact email address. */
233
+ declare class GetCustomersByEmailOperation implements Query<GetCustomersByEmailInput, CustomerLookupPage> {
234
+ private readonly client;
235
+ /** Bind the provider client. */ constructor(client: CustomerioClient);
236
+ /** Return the generated Query definition. */ definition(): QueryDefinition;
237
+ /** Classify provider outcomes consistently with Go. */
238
+ invoke(call: Call, input: GetCustomersByEmailInput): Promise<QueryAttempt<CustomerLookupPage>>;
239
+ }
240
+ type ReadAppPath = (call: Call, path: string) => Promise<Exchange>;
241
+ /** Execute the GetCampaign App API query inside a Dex Step. */
242
+ declare class GetCampaignOperation implements Query<GetCampaignInput, CampaignSummary> {
243
+ private readonly read;
244
+ /** Bind the authenticated App API reader. */ constructor(read: ReadAppPath);
245
+ /** Return the manifest query definition. */ definition(): QueryDefinition;
246
+ /** Classify one bounded provider response. */
247
+ invoke(call: Call, input: GetCampaignInput): Promise<QueryAttempt<CampaignSummary>>;
248
+ }
249
+ /** Execute the ListCampaigns App API query inside a Dex Step. */
250
+ declare class ListCampaignsOperation implements Query<ListCampaignsInput, CampaignsPage> {
251
+ private readonly read;
252
+ /** Bind the authenticated App API reader. */ constructor(read: ReadAppPath);
253
+ /** Return the manifest query definition. */ definition(): QueryDefinition;
254
+ /** Classify one bounded provider response. */
255
+ invoke(call: Call): Promise<QueryAttempt<CampaignsPage>>;
256
+ }
257
+ /** Execute the GetCampaignMetrics App API query inside a Dex Step. */
258
+ declare class GetCampaignMetricsOperation implements Query<GetCampaignMetricsInput, CampaignMetrics> {
259
+ private readonly read;
260
+ /** Bind the authenticated App API reader. */ constructor(read: ReadAppPath);
261
+ /** Return the manifest query definition. */ definition(): QueryDefinition;
262
+ /** Classify one bounded provider response. */
263
+ invoke(call: Call, input: GetCampaignMetricsInput): Promise<QueryAttempt<CampaignMetrics>>;
264
+ }
265
+
266
+ export { CampaignMetrics, CampaignSummary, CampaignsPage, Config, Connection, ConnectorID, Credentials, CustomerLookupPage, CustomerioClient, type CustomerioClientOptions, GetCampaignBranch, GetCampaignBranchDefect, GetCampaignBranchFound, GetCampaignBranchInvalidResponse, GetCampaignBranchNotFound, GetCampaignBranchProviderRejected, GetCampaignDefinition, GetCampaignInput, GetCampaignMetadata, GetCampaignMetricsBranch, GetCampaignMetricsBranchDefect, GetCampaignMetricsBranchFound, GetCampaignMetricsBranchInvalidResponse, GetCampaignMetricsBranchNotFound, GetCampaignMetricsBranchProviderRejected, GetCampaignMetricsDefinition, GetCampaignMetricsInput, GetCampaignMetricsMetadata, GetCampaignMetricsOperation, type GetCampaignMetricsStepConfig, GetCampaignOperation, type GetCampaignStepConfig, GetCustomersByEmailBranch, GetCustomersByEmailBranchDefect, GetCustomersByEmailBranchFound, GetCustomersByEmailBranchInvalidResponse, GetCustomersByEmailBranchProviderRejected, GetCustomersByEmailDefinition, GetCustomersByEmailInput, GetCustomersByEmailMetadata, GetCustomersByEmailOperation, type GetCustomersByEmailStepConfig, ListCampaignsBranch, ListCampaignsBranchDefect, ListCampaignsBranchInvalidResponse, ListCampaignsBranchListed, ListCampaignsBranchProviderRejected, ListCampaignsDefinition, ListCampaignsInput, ListCampaignsMetadata, ListCampaignsOperation, type ListCampaignsStepConfig, ProviderID, newConnection, newConnectionWithOperations, newGetCampaignMetricsStep, newGetCampaignStep, newGetCustomersByEmailStep, newListCampaignsStep, newProjectConnection };