@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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { G as GetCustomersByEmailInput, C as CustomerLookupPage, a as Connection, O as Operations, b as Config, c as Credentials } from './connection-WnPSA5jF.js';
2
- export { d as ConfigSchema, e as CredentialSource, f as CustomerLookupPageSchema, g as GetCustomersByEmailInputSchema, h as decodeCredentials, n as newConnection, i as newConnectionWithOperations } from './connection-WnPSA5jF.js';
3
- import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, CredentialProvider, Call, QueryAttempt } from '@superdurable/connectors-sdk';
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
4
  import { StepTarget } from '@superdurable/dex';
5
5
  import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
6
6
  import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
@@ -10,6 +10,81 @@ import 'zod';
10
10
  declare const ConnectorID = "customerio";
11
11
  /** Provider identity for named connections. */
12
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
+ };
13
88
  /** Branch IDs for getCustomersByEmail. */
14
89
  declare const GetCustomersByEmailBranch: {
15
90
  readonly Found: "found";
@@ -34,6 +109,67 @@ declare const GetCustomersByEmailMetadata: {
34
109
  readonly authorization: "required";
35
110
  };
36
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>;
37
173
  /** Configuration for the getCustomersByEmail connector Step. */
38
174
  interface GetCustomersByEmailStepConfig<StepInput, OperationInput = GetCustomersByEmailInput, OperationOutput = CustomerLookupPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
39
175
  /** Named connection supplying this operation. */
@@ -54,6 +190,12 @@ interface GetCustomersByEmailStepConfig<StepInput, OperationInput = GetCustomers
54
190
  /** Build the getCustomersByEmail Step from a named connection. */
55
191
  declare function newGetCustomersByEmailStep<StepInput, OperationInput = GetCustomersByEmailInput, OperationOutput = CustomerLookupPage>(configuration: GetCustomersByEmailStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
56
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
+
57
199
  /** Open one named Customerio connection from Dex project configuration. */
58
200
  declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
59
201
 
@@ -67,7 +209,7 @@ interface Exchange {
67
209
  retryAfterMs: number;
68
210
  error?: 'credential' | 'request' | 'tooLarge';
69
211
  }
70
- /** Authenticated Customer.io App API client for customer lookups. */
212
+ /** Authenticated Customer.io App API client for customer and campaign reads. */
71
213
  declare class CustomerioClient {
72
214
  private readonly credentials;
73
215
  private readonly baseURL;
@@ -77,8 +219,15 @@ declare class CustomerioClient {
77
219
  /** Validate provider configuration without contacting Customer.io. */
78
220
  constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: CustomerioClientOptions);
79
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;
80
228
  /** Resolve credentials and send one bounded customer lookup. */
81
229
  get(call: Call, email: string): Promise<Exchange>;
230
+ private getPath;
82
231
  }
83
232
  /** Look up Customer.io profile IDs by exact email address. */
84
233
  declare class GetCustomersByEmailOperation implements Query<GetCustomersByEmailInput, CustomerLookupPage> {
@@ -88,5 +237,30 @@ declare class GetCustomersByEmailOperation implements Query<GetCustomersByEmailI
88
237
  /** Classify provider outcomes consistently with Go. */
89
238
  invoke(call: Call, input: GetCustomersByEmailInput): Promise<QueryAttempt<CustomerLookupPage>>;
90
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
+ }
91
265
 
92
- export { Config, Connection, ConnectorID, Credentials, CustomerLookupPage, CustomerioClient, type CustomerioClientOptions, GetCustomersByEmailBranch, GetCustomersByEmailBranchDefect, GetCustomersByEmailBranchFound, GetCustomersByEmailBranchInvalidResponse, GetCustomersByEmailBranchProviderRejected, GetCustomersByEmailDefinition, GetCustomersByEmailInput, GetCustomersByEmailMetadata, GetCustomersByEmailOperation, type GetCustomersByEmailStepConfig, ProviderID, newGetCustomersByEmailStep, newProjectConnection };
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 };