@walkeros/server-destination-customerio 3.4.0-next-1776749829492

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 ADDED
@@ -0,0 +1,73 @@
1
+ # @walkeros/server-destination-customerio
2
+
3
+ Server-side Customer.io destination for
4
+ [walkerOS](https://github.com/elbwalker/walkerOS). Forwards events to
5
+ Customer.io via the official `customerio-node` SDK with support for Track,
6
+ Identify, Page View, Transactional Messaging, and Customer Lifecycle management.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @walkeros/server-destination-customerio
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```json
17
+ {
18
+ "destinations": {
19
+ "customerio": {
20
+ "package": "@walkeros/server-destination-customerio",
21
+ "config": {
22
+ "settings": {
23
+ "siteId": "YOUR_SITE_ID",
24
+ "apiKey": "YOUR_API_KEY",
25
+ "customerId": "user.id",
26
+ "anonymousId": "user.session"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ## Settings
35
+
36
+ | Setting | Type | Required | Default | Description |
37
+ | ------------- | ---------------- | -------- | ---------------- | ------------------------------------------------------------ |
38
+ | `siteId` | string | Yes | -- | Customer.io Site ID |
39
+ | `apiKey` | string | Yes | -- | Customer.io API Key |
40
+ | `appApiKey` | string | No | -- | App API Key for transactional messaging (sendEmail/sendPush) |
41
+ | `region` | `'us'` \| `'eu'` | No | `'us'` | Data center region |
42
+ | `timeout` | number | No | `10000` | HTTP request timeout in ms |
43
+ | `customerId` | string | No | `'user.id'` | Mapping path to resolve customerId from events |
44
+ | `anonymousId` | string | No | `'user.session'` | Mapping path to resolve anonymousId from events |
45
+ | `identify` | MappingValue | No | -- | Destination-level identity mapping |
46
+
47
+ ## Mapping Settings
48
+
49
+ Per-event mapping settings control which Customer.io methods are called:
50
+
51
+ | Setting | Effect | Use with `skip: true` |
52
+ | -------------- | ---------------------------------------------- | --------------------- |
53
+ | `identify` | Calls `identify()` with attributes | Yes, for login events |
54
+ | `page` | Calls `trackPageView()` with url | Yes, for page views |
55
+ | `destroy` | Permanently deletes person | Yes |
56
+ | `suppress` | Stops messaging (keeps data) | Yes |
57
+ | `unsuppress` | Resumes messaging | Yes |
58
+ | `addDevice` | Registers push device | Yes |
59
+ | `deleteDevice` | Removes push device | Yes |
60
+ | `merge` | Merges duplicate profiles | Yes |
61
+ | `sendEmail` | Sends transactional email (requires appApiKey) | Yes |
62
+ | `sendPush` | Sends transactional push (requires appApiKey) | Yes |
63
+
64
+ ## Identity
65
+
66
+ Customer.io uses `customerId` as the primary identifier. When `customerId`
67
+ cannot be resolved but `anonymousId` is available, the destination automatically
68
+ falls back to `trackAnonymous()` for data preservation.
69
+
70
+ ## Shutdown
71
+
72
+ The destination implements `destroy()` by clearing SDK client references. No
73
+ flush is needed since `customerio-node` does not batch internally.
package/dist/dev.d.mts ADDED
@@ -0,0 +1,205 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { Mapping as Mapping$1, Flow } from '@walkeros/core';
4
+ import { DestinationServer } from '@walkeros/server-core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ siteId: z.ZodString;
8
+ apiKey: z.ZodString;
9
+ appApiKey: z.ZodOptional<z.ZodString>;
10
+ region: z.ZodOptional<z.ZodEnum<{
11
+ us: "us";
12
+ eu: "eu";
13
+ }>>;
14
+ timeout: z.ZodOptional<z.ZodNumber>;
15
+ customerId: z.ZodOptional<z.ZodString>;
16
+ anonymousId: z.ZodOptional<z.ZodString>;
17
+ identify: z.ZodOptional<z.ZodUnknown>;
18
+ }, z.core.$strip>;
19
+ type Settings$1 = z.infer<typeof SettingsSchema>;
20
+
21
+ declare const MappingSchema: z.ZodObject<{
22
+ identify: z.ZodOptional<z.ZodUnknown>;
23
+ page: z.ZodOptional<z.ZodUnknown>;
24
+ destroy: z.ZodOptional<z.ZodBoolean>;
25
+ suppress: z.ZodOptional<z.ZodBoolean>;
26
+ unsuppress: z.ZodOptional<z.ZodBoolean>;
27
+ addDevice: z.ZodOptional<z.ZodUnknown>;
28
+ deleteDevice: z.ZodOptional<z.ZodUnknown>;
29
+ merge: z.ZodOptional<z.ZodUnknown>;
30
+ sendEmail: z.ZodOptional<z.ZodUnknown>;
31
+ sendPush: z.ZodOptional<z.ZodUnknown>;
32
+ }, z.core.$strip>;
33
+ type Mapping = z.infer<typeof MappingSchema>;
34
+
35
+ declare const settings: _walkeros_core_dev.JSONSchema;
36
+ declare const mapping: _walkeros_core_dev.JSONSchema;
37
+
38
+ type index$1_Mapping = Mapping;
39
+ declare const index$1_MappingSchema: typeof MappingSchema;
40
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
41
+ declare const index$1_mapping: typeof mapping;
42
+ declare const index$1_settings: typeof settings;
43
+ declare namespace index$1 {
44
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
45
+ }
46
+
47
+ /**
48
+ * Mock-friendly interface for the TrackClient methods the
49
+ * destination actually calls. Tests provide this via env.trackClient
50
+ * instead of the real SDK.
51
+ */
52
+ interface CustomerIoTrackClientMock {
53
+ identify: (customerId: string | number, attributes: Record<string, unknown>) => Promise<void>;
54
+ track: (customerId: string | number, eventData: {
55
+ name: string;
56
+ data?: Record<string, unknown>;
57
+ timestamp?: number;
58
+ }) => Promise<void>;
59
+ trackAnonymous: (anonymousId: string, eventData: {
60
+ name: string;
61
+ data?: Record<string, unknown>;
62
+ timestamp?: number;
63
+ }) => Promise<void>;
64
+ trackPageView: (customerId: string | number, url: string, data?: Record<string, unknown>) => Promise<void>;
65
+ destroy: (customerId: string | number) => Promise<void>;
66
+ suppress: (customerId: string | number) => Promise<void>;
67
+ unsuppress: (customerId: string | number) => Promise<void>;
68
+ addDevice: (customerId: string | number, deviceId: string, platform: string, data?: Record<string, unknown>) => Promise<void>;
69
+ deleteDevice: (customerId: string | number, deviceId: string, platform: string) => Promise<void>;
70
+ mergeCustomers: (primaryType: string, primaryId: string, secondaryType: string, secondaryId: string) => Promise<void>;
71
+ }
72
+ /**
73
+ * Mock-friendly interface for the APIClient methods the
74
+ * destination actually calls. Tests provide this via env.apiClient
75
+ * instead of the real SDK.
76
+ */
77
+ interface CustomerIoApiClientMock {
78
+ sendEmail: (request: unknown) => Promise<void>;
79
+ sendPush: (request: unknown) => Promise<void>;
80
+ }
81
+ interface Settings {
82
+ /** Customer.io Site ID (required for Track API). */
83
+ siteId: string;
84
+ /** Customer.io API Key (required for Track API). */
85
+ apiKey: string;
86
+ /** App API Key for transactional messaging (optional). */
87
+ appApiKey?: string;
88
+ /** Region: 'us' or 'eu'. Default: 'us'. */
89
+ region?: 'us' | 'eu';
90
+ /** HTTP request timeout in ms. Default: 10000. */
91
+ timeout?: number;
92
+ /** walkerOS mapping value path to resolve customerId from each event. */
93
+ customerId?: string;
94
+ /** walkerOS mapping value path to resolve anonymousId from each event. */
95
+ anonymousId?: string;
96
+ /** Destination-level identify mapping (fires identify() on first push / change). */
97
+ identify?: Mapping$1.Value;
98
+ /** Runtime state -- not user-facing. */
99
+ _trackClient?: CustomerIoTrackClientMock;
100
+ _apiClient?: CustomerIoApiClientMock;
101
+ _state?: RuntimeState;
102
+ }
103
+ interface RuntimeState {
104
+ lastIdentity?: {
105
+ customerId?: string;
106
+ attributesHash?: string;
107
+ };
108
+ }
109
+ /**
110
+ * Env -- optional SDK override. Production leaves this undefined and the
111
+ * destination creates real TrackClient/APIClient instances. Tests provide
112
+ * mocks via env.trackClient and env.apiClient.
113
+ */
114
+ interface Env extends DestinationServer.Env {
115
+ trackClient?: CustomerIoTrackClientMock;
116
+ apiClient?: CustomerIoApiClientMock;
117
+ }
118
+
119
+ declare const push: Env;
120
+ declare const simulation: string[];
121
+
122
+ declare const env_push: typeof push;
123
+ declare const env_simulation: typeof simulation;
124
+ declare namespace env {
125
+ export { env_push as push, env_simulation as simulation };
126
+ }
127
+
128
+ /**
129
+ * Extended step example that may carry destination-level settings overrides.
130
+ */
131
+ type CustomerIoStepExample = Flow.StepExample & {
132
+ settings?: Partial<Settings>;
133
+ };
134
+ /**
135
+ * Default event forwarding -- trackClient.track() with event name and data.
136
+ * customerId resolved from default settings.customerId = 'user.id'.
137
+ */
138
+ declare const defaultTrack: CustomerIoStepExample;
139
+ /**
140
+ * Mapped event name -- mapping.name renames the event for Customer.io.
141
+ */
142
+ declare const mappedEventName: CustomerIoStepExample;
143
+ /**
144
+ * Track with mapped data properties.
145
+ */
146
+ declare const mappedData: CustomerIoStepExample;
147
+ /**
148
+ * Anonymous event -- no customerId resolved, falls back to trackAnonymous().
149
+ */
150
+ declare const anonymousTrack: CustomerIoStepExample;
151
+ /**
152
+ * Destination-level identify -- fires trackClient.identify() on first push
153
+ * when settings.identify mapping resolves. Then fires trackClient.track().
154
+ */
155
+ declare const destinationIdentify: CustomerIoStepExample;
156
+ /**
157
+ * Per-event identify with skip -- user login fires identify() only.
158
+ */
159
+ declare const userLoginIdentify: CustomerIoStepExample;
160
+ /**
161
+ * Page view -- fires trackClient.trackPageView() with url.
162
+ * skip: true suppresses track(); settings.page fires trackPageView().
163
+ */
164
+ declare const pageView: CustomerIoStepExample;
165
+ /**
166
+ * Destroy -- permanently deletes a person from Customer.io.
167
+ */
168
+ declare const destroyPerson: CustomerIoStepExample;
169
+ /**
170
+ * Suppress -- stops messaging without deleting data.
171
+ */
172
+ declare const suppressPerson: CustomerIoStepExample;
173
+ /**
174
+ * Unsuppress -- resumes messaging for a suppressed person.
175
+ */
176
+ declare const unsuppressPerson: CustomerIoStepExample;
177
+ /**
178
+ * Wildcard ignore -- the event matches a mapping rule with ignore: true.
179
+ * The destination fires zero SDK calls.
180
+ */
181
+ declare const wildcardIgnored: CustomerIoStepExample;
182
+
183
+ type step_CustomerIoStepExample = CustomerIoStepExample;
184
+ declare const step_anonymousTrack: typeof anonymousTrack;
185
+ declare const step_defaultTrack: typeof defaultTrack;
186
+ declare const step_destinationIdentify: typeof destinationIdentify;
187
+ declare const step_destroyPerson: typeof destroyPerson;
188
+ declare const step_mappedData: typeof mappedData;
189
+ declare const step_mappedEventName: typeof mappedEventName;
190
+ declare const step_pageView: typeof pageView;
191
+ declare const step_suppressPerson: typeof suppressPerson;
192
+ declare const step_unsuppressPerson: typeof unsuppressPerson;
193
+ declare const step_userLoginIdentify: typeof userLoginIdentify;
194
+ declare const step_wildcardIgnored: typeof wildcardIgnored;
195
+ declare namespace step {
196
+ export { type step_CustomerIoStepExample as CustomerIoStepExample, step_anonymousTrack as anonymousTrack, step_defaultTrack as defaultTrack, step_destinationIdentify as destinationIdentify, step_destroyPerson as destroyPerson, step_mappedData as mappedData, step_mappedEventName as mappedEventName, step_pageView as pageView, step_suppressPerson as suppressPerson, step_unsuppressPerson as unsuppressPerson, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
197
+ }
198
+
199
+ declare const index_env: typeof env;
200
+ declare const index_step: typeof step;
201
+ declare namespace index {
202
+ export { index_env as env, index_step as step };
203
+ }
204
+
205
+ export { index as examples, index$1 as schemas };
package/dist/dev.d.ts ADDED
@@ -0,0 +1,205 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { Mapping as Mapping$1, Flow } from '@walkeros/core';
4
+ import { DestinationServer } from '@walkeros/server-core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ siteId: z.ZodString;
8
+ apiKey: z.ZodString;
9
+ appApiKey: z.ZodOptional<z.ZodString>;
10
+ region: z.ZodOptional<z.ZodEnum<{
11
+ us: "us";
12
+ eu: "eu";
13
+ }>>;
14
+ timeout: z.ZodOptional<z.ZodNumber>;
15
+ customerId: z.ZodOptional<z.ZodString>;
16
+ anonymousId: z.ZodOptional<z.ZodString>;
17
+ identify: z.ZodOptional<z.ZodUnknown>;
18
+ }, z.core.$strip>;
19
+ type Settings$1 = z.infer<typeof SettingsSchema>;
20
+
21
+ declare const MappingSchema: z.ZodObject<{
22
+ identify: z.ZodOptional<z.ZodUnknown>;
23
+ page: z.ZodOptional<z.ZodUnknown>;
24
+ destroy: z.ZodOptional<z.ZodBoolean>;
25
+ suppress: z.ZodOptional<z.ZodBoolean>;
26
+ unsuppress: z.ZodOptional<z.ZodBoolean>;
27
+ addDevice: z.ZodOptional<z.ZodUnknown>;
28
+ deleteDevice: z.ZodOptional<z.ZodUnknown>;
29
+ merge: z.ZodOptional<z.ZodUnknown>;
30
+ sendEmail: z.ZodOptional<z.ZodUnknown>;
31
+ sendPush: z.ZodOptional<z.ZodUnknown>;
32
+ }, z.core.$strip>;
33
+ type Mapping = z.infer<typeof MappingSchema>;
34
+
35
+ declare const settings: _walkeros_core_dev.JSONSchema;
36
+ declare const mapping: _walkeros_core_dev.JSONSchema;
37
+
38
+ type index$1_Mapping = Mapping;
39
+ declare const index$1_MappingSchema: typeof MappingSchema;
40
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
41
+ declare const index$1_mapping: typeof mapping;
42
+ declare const index$1_settings: typeof settings;
43
+ declare namespace index$1 {
44
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
45
+ }
46
+
47
+ /**
48
+ * Mock-friendly interface for the TrackClient methods the
49
+ * destination actually calls. Tests provide this via env.trackClient
50
+ * instead of the real SDK.
51
+ */
52
+ interface CustomerIoTrackClientMock {
53
+ identify: (customerId: string | number, attributes: Record<string, unknown>) => Promise<void>;
54
+ track: (customerId: string | number, eventData: {
55
+ name: string;
56
+ data?: Record<string, unknown>;
57
+ timestamp?: number;
58
+ }) => Promise<void>;
59
+ trackAnonymous: (anonymousId: string, eventData: {
60
+ name: string;
61
+ data?: Record<string, unknown>;
62
+ timestamp?: number;
63
+ }) => Promise<void>;
64
+ trackPageView: (customerId: string | number, url: string, data?: Record<string, unknown>) => Promise<void>;
65
+ destroy: (customerId: string | number) => Promise<void>;
66
+ suppress: (customerId: string | number) => Promise<void>;
67
+ unsuppress: (customerId: string | number) => Promise<void>;
68
+ addDevice: (customerId: string | number, deviceId: string, platform: string, data?: Record<string, unknown>) => Promise<void>;
69
+ deleteDevice: (customerId: string | number, deviceId: string, platform: string) => Promise<void>;
70
+ mergeCustomers: (primaryType: string, primaryId: string, secondaryType: string, secondaryId: string) => Promise<void>;
71
+ }
72
+ /**
73
+ * Mock-friendly interface for the APIClient methods the
74
+ * destination actually calls. Tests provide this via env.apiClient
75
+ * instead of the real SDK.
76
+ */
77
+ interface CustomerIoApiClientMock {
78
+ sendEmail: (request: unknown) => Promise<void>;
79
+ sendPush: (request: unknown) => Promise<void>;
80
+ }
81
+ interface Settings {
82
+ /** Customer.io Site ID (required for Track API). */
83
+ siteId: string;
84
+ /** Customer.io API Key (required for Track API). */
85
+ apiKey: string;
86
+ /** App API Key for transactional messaging (optional). */
87
+ appApiKey?: string;
88
+ /** Region: 'us' or 'eu'. Default: 'us'. */
89
+ region?: 'us' | 'eu';
90
+ /** HTTP request timeout in ms. Default: 10000. */
91
+ timeout?: number;
92
+ /** walkerOS mapping value path to resolve customerId from each event. */
93
+ customerId?: string;
94
+ /** walkerOS mapping value path to resolve anonymousId from each event. */
95
+ anonymousId?: string;
96
+ /** Destination-level identify mapping (fires identify() on first push / change). */
97
+ identify?: Mapping$1.Value;
98
+ /** Runtime state -- not user-facing. */
99
+ _trackClient?: CustomerIoTrackClientMock;
100
+ _apiClient?: CustomerIoApiClientMock;
101
+ _state?: RuntimeState;
102
+ }
103
+ interface RuntimeState {
104
+ lastIdentity?: {
105
+ customerId?: string;
106
+ attributesHash?: string;
107
+ };
108
+ }
109
+ /**
110
+ * Env -- optional SDK override. Production leaves this undefined and the
111
+ * destination creates real TrackClient/APIClient instances. Tests provide
112
+ * mocks via env.trackClient and env.apiClient.
113
+ */
114
+ interface Env extends DestinationServer.Env {
115
+ trackClient?: CustomerIoTrackClientMock;
116
+ apiClient?: CustomerIoApiClientMock;
117
+ }
118
+
119
+ declare const push: Env;
120
+ declare const simulation: string[];
121
+
122
+ declare const env_push: typeof push;
123
+ declare const env_simulation: typeof simulation;
124
+ declare namespace env {
125
+ export { env_push as push, env_simulation as simulation };
126
+ }
127
+
128
+ /**
129
+ * Extended step example that may carry destination-level settings overrides.
130
+ */
131
+ type CustomerIoStepExample = Flow.StepExample & {
132
+ settings?: Partial<Settings>;
133
+ };
134
+ /**
135
+ * Default event forwarding -- trackClient.track() with event name and data.
136
+ * customerId resolved from default settings.customerId = 'user.id'.
137
+ */
138
+ declare const defaultTrack: CustomerIoStepExample;
139
+ /**
140
+ * Mapped event name -- mapping.name renames the event for Customer.io.
141
+ */
142
+ declare const mappedEventName: CustomerIoStepExample;
143
+ /**
144
+ * Track with mapped data properties.
145
+ */
146
+ declare const mappedData: CustomerIoStepExample;
147
+ /**
148
+ * Anonymous event -- no customerId resolved, falls back to trackAnonymous().
149
+ */
150
+ declare const anonymousTrack: CustomerIoStepExample;
151
+ /**
152
+ * Destination-level identify -- fires trackClient.identify() on first push
153
+ * when settings.identify mapping resolves. Then fires trackClient.track().
154
+ */
155
+ declare const destinationIdentify: CustomerIoStepExample;
156
+ /**
157
+ * Per-event identify with skip -- user login fires identify() only.
158
+ */
159
+ declare const userLoginIdentify: CustomerIoStepExample;
160
+ /**
161
+ * Page view -- fires trackClient.trackPageView() with url.
162
+ * skip: true suppresses track(); settings.page fires trackPageView().
163
+ */
164
+ declare const pageView: CustomerIoStepExample;
165
+ /**
166
+ * Destroy -- permanently deletes a person from Customer.io.
167
+ */
168
+ declare const destroyPerson: CustomerIoStepExample;
169
+ /**
170
+ * Suppress -- stops messaging without deleting data.
171
+ */
172
+ declare const suppressPerson: CustomerIoStepExample;
173
+ /**
174
+ * Unsuppress -- resumes messaging for a suppressed person.
175
+ */
176
+ declare const unsuppressPerson: CustomerIoStepExample;
177
+ /**
178
+ * Wildcard ignore -- the event matches a mapping rule with ignore: true.
179
+ * The destination fires zero SDK calls.
180
+ */
181
+ declare const wildcardIgnored: CustomerIoStepExample;
182
+
183
+ type step_CustomerIoStepExample = CustomerIoStepExample;
184
+ declare const step_anonymousTrack: typeof anonymousTrack;
185
+ declare const step_defaultTrack: typeof defaultTrack;
186
+ declare const step_destinationIdentify: typeof destinationIdentify;
187
+ declare const step_destroyPerson: typeof destroyPerson;
188
+ declare const step_mappedData: typeof mappedData;
189
+ declare const step_mappedEventName: typeof mappedEventName;
190
+ declare const step_pageView: typeof pageView;
191
+ declare const step_suppressPerson: typeof suppressPerson;
192
+ declare const step_unsuppressPerson: typeof unsuppressPerson;
193
+ declare const step_userLoginIdentify: typeof userLoginIdentify;
194
+ declare const step_wildcardIgnored: typeof wildcardIgnored;
195
+ declare namespace step {
196
+ export { type step_CustomerIoStepExample as CustomerIoStepExample, step_anonymousTrack as anonymousTrack, step_defaultTrack as defaultTrack, step_destinationIdentify as destinationIdentify, step_destroyPerson as destroyPerson, step_mappedData as mappedData, step_mappedEventName as mappedEventName, step_pageView as pageView, step_suppressPerson as suppressPerson, step_unsuppressPerson as unsuppressPerson, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
197
+ }
198
+
199
+ declare const index_env: typeof env;
200
+ declare const index_step: typeof step;
201
+ declare namespace index {
202
+ export { index_env as env, index_step as step };
203
+ }
204
+
205
+ export { index as examples, index$1 as schemas };
package/dist/dev.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,s=Object.defineProperty,t=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(e,t)=>{for(var i in t)s(e,i,{get:t[i],enumerable:!0})},n={};a(n,{examples:()=>v,schemas:()=>o}),module.exports=(e=n,((e,a,n,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let p of i(a))r.call(e,p)||p===n||s(e,p,{get:()=>a[p],enumerable:!(o=t(a,p))||o.enumerable});return e})(s({},"__esModule",{value:!0}),e));var o={};a(o,{MappingSchema:()=>d,SettingsSchema:()=>l,mapping:()=>g,settings:()=>c});var p=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),l=u.z.object({siteId:u.z.string().min(1).describe("Customer.io Site ID. Find it in Settings > Workspace Settings > API Credentials."),apiKey:u.z.string().min(1).describe("Customer.io API Key. Find it in Settings > Workspace Settings > API Credentials."),appApiKey:u.z.string().describe("App API Key for transactional messaging (sendEmail/sendPush). Find it in Settings > Workspace Settings > API Credentials > App API Keys.").optional(),region:u.z.enum(["us","eu"]).describe("Data center region. Must match where your Customer.io workspace was created. Default: us.").optional(),timeout:u.z.number().int().positive().describe("HTTP request timeout in milliseconds. Default: 10000.").optional(),customerId:u.z.string().describe("walkerOS mapping value path to resolve customerId from each event (like user.id).").optional(),anonymousId:u.z.string().describe("walkerOS mapping value path to resolve anonymousId from each event (like user.session).").optional(),identify:u.z.unknown().describe("Destination-level identity mapping. Resolves to { email?, first_name?, ... } attributes. Fires identify() on first push and re-fires when values change.").optional()}),m=require("@walkeros/core/dev"),d=m.z.object({identify:m.z.unknown().describe("Per-event identify attributes. Resolves to { email?, first_name?, ... }. Use with skip: true on login/identify events.").optional(),page:m.z.unknown().describe("Per-event page view. Resolves to { url, ... }. Calls trackPageView(). Use with skip: true.").optional(),destroy:m.z.boolean().describe("Permanently delete person from Customer.io. Set true on delete events with skip: true.").optional(),suppress:m.z.boolean().describe("Suppress person (stop messaging without deleting data). Set true with skip: true.").optional(),unsuppress:m.z.boolean().describe("Unsuppress person (resume messaging). Set true with skip: true.").optional(),addDevice:m.z.unknown().describe("Register push device. Resolves to { deviceId, platform, data? }. Use with skip: true.").optional(),deleteDevice:m.z.unknown().describe("Remove push device. Resolves to { deviceId, platform }. Use with skip: true.").optional(),merge:m.z.unknown().describe("Merge duplicate profiles. Resolves to { primaryType, primaryId, secondaryType, secondaryId }. Use with skip: true.").optional(),sendEmail:m.z.unknown().describe("Send transactional email. Resolves to { to, transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.").optional(),sendPush:m.z.unknown().describe("Send transactional push. Resolves to { transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.").optional()}),c=(0,p.zodToSchema)(l),g=(0,p.zodToSchema)(d),v={};a(v,{env:()=>k,step:()=>b});var k={};a(k,{push:()=>f,simulation:()=>h});var y=()=>Promise.resolve(),w=()=>Promise.resolve();var f={trackClient:{identify:()=>Promise.resolve(),track:()=>Promise.resolve(),trackAnonymous:()=>Promise.resolve(),trackPageView:()=>Promise.resolve(),destroy:y,suppress:y,unsuppress:y,addDevice:()=>Promise.resolve(),deleteDevice:()=>Promise.resolve(),mergeCustomers:()=>Promise.resolve()},apiClient:{sendEmail:w,sendPush:w}},h=["call:trackClient.identify","call:trackClient.track","call:trackClient.trackAnonymous","call:trackClient.trackPageView","call:trackClient.destroy","call:trackClient.suppress","call:trackClient.unsuppress","call:trackClient.addDevice","call:trackClient.deleteDevice","call:trackClient.mergeCustomers","call:apiClient.sendEmail","call:apiClient.sendPush"],b={};a(b,{anonymousTrack:()=>S,defaultTrack:()=>P,destinationIdentify:()=>E,destroyPerson:()=>R,mappedData:()=>I,mappedEventName:()=>z,pageView:()=>A,suppressPerson:()=>D,unsuppressPerson:()=>U,userLoginIdentify:()=>_,wildcardIgnored:()=>O});var C=require("@walkeros/core"),P={in:(0,C.getEvent)("product view",{timestamp:1700000100,user:{id:"us3r",session:"s3ss10n"}}),out:[["trackClient.track","us3r",{name:"product view",data:{},timestamp:17e5}]]},z={in:(0,C.getEvent)("order complete",{timestamp:1700000101,user:{id:"us3r",session:"s3ss10n"}}),mapping:{name:"purchase"},out:[["trackClient.track","us3r",{name:"purchase",data:{},timestamp:17e5}]]},I={in:(0,C.getEvent)("order complete",{timestamp:1700000102,user:{id:"us3r",session:"s3ss10n"},data:{id:"0rd3r1d",total:555,currency:"EUR"}}),mapping:{name:"purchase",data:{map:{order_id:"data.id",value:"data.total",currency:"data.currency"}}},out:[["trackClient.track","us3r",{name:"purchase",data:{order_id:"0rd3r1d",value:555,currency:"EUR"},timestamp:17e5}]]},S={in:(0,C.getEvent)("product view",{timestamp:1700000103,user:{session:"s3ss10n"}}),settings:{customerId:void 0},out:[["trackClient.trackAnonymous","s3ss10n",{name:"product view",data:{},timestamp:17e5}]]},E={in:(0,C.getEvent)("page view",{timestamp:1700000104,user:{id:"us3r",session:"s3ss10n",email:"user@example.com"}}),settings:{identify:{map:{email:"user.email"}}},out:[["trackClient.identify","us3r",{email:"user@example.com"}],["trackClient.track","us3r",{name:"page view",data:{},timestamp:17e5}]]},_={in:(0,C.getEvent)("user login",{timestamp:1700000105,user:{id:"us3r",session:"s3ss10n"},data:{email:"user@acme.com",first_name:"Jane",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{email:"data.email",first_name:"data.first_name",plan:"data.plan"}}}},out:[["trackClient.identify","us3r",{email:"user@acme.com",first_name:"Jane",plan:"premium"}]]},A={in:(0,C.getEvent)("page view",{timestamp:1700000106,user:{id:"us3r",session:"s3ss10n"},data:{url:"https://example.com/pricing",referrer:"https://google.com"}}),mapping:{skip:!0,settings:{page:{map:{url:"data.url",referrer:"data.referrer"}}}},out:[["trackClient.trackPageView","us3r","https://example.com/pricing",{referrer:"https://google.com"}]]},R={in:(0,C.getEvent)("user delete",{timestamp:1700000107,user:{id:"us3r",session:"s3ss10n"}}),mapping:{skip:!0,settings:{destroy:!0}},out:[["trackClient.destroy","us3r"]]},D={in:(0,C.getEvent)("user suppress",{timestamp:1700000108,user:{id:"us3r",session:"s3ss10n"}}),mapping:{skip:!0,settings:{suppress:!0}},out:[["trackClient.suppress","us3r"]]},U={in:(0,C.getEvent)("user unsuppress",{timestamp:1700000109,user:{id:"us3r",session:"s3ss10n"}}),mapping:{skip:!0,settings:{unsuppress:!0}},out:[["trackClient.unsuppress","us3r"]]},O={in:(0,C.getEvent)("debug noise",{timestamp:1700000110,user:{id:"us3r",session:"s3ss10n"}}),mapping:{ignore:!0},out:[]};//# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Customer.io Site ID. Find it in Settings > Workspace Settings > API Credentials.',\n ),\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Customer.io API Key. Find it in Settings > Workspace Settings > API Credentials.',\n ),\n appApiKey: z\n .string()\n .describe(\n 'App API Key for transactional messaging (sendEmail/sendPush). Find it in Settings > Workspace Settings > API Credentials > App API Keys.',\n )\n .optional(),\n region: z\n .enum(['us', 'eu'])\n .describe(\n 'Data center region. Must match where your Customer.io workspace was created. Default: us.',\n )\n .optional(),\n timeout: z\n .number()\n .int()\n .positive()\n .describe('HTTP request timeout in milliseconds. Default: 10000.')\n .optional(),\n customerId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve customerId from each event (like user.id).',\n )\n .optional(),\n anonymousId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve anonymousId from each event (like user.session).',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to { email?, first_name?, ... } attributes. Fires identify() on first push and re-fires when values change.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identify attributes. Resolves to { email?, first_name?, ... }. Use with skip: true on login/identify events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page view. Resolves to { url, ... }. Calls trackPageView(). Use with skip: true.',\n )\n .optional(),\n destroy: z\n .boolean()\n .describe(\n 'Permanently delete person from Customer.io. Set true on delete events with skip: true.',\n )\n .optional(),\n suppress: z\n .boolean()\n .describe(\n 'Suppress person (stop messaging without deleting data). Set true with skip: true.',\n )\n .optional(),\n unsuppress: z\n .boolean()\n .describe('Unsuppress person (resume messaging). Set true with skip: true.')\n .optional(),\n addDevice: z\n .unknown()\n .describe(\n 'Register push device. Resolves to { deviceId, platform, data? }. Use with skip: true.',\n )\n .optional(),\n deleteDevice: z\n .unknown()\n .describe(\n 'Remove push device. Resolves to { deviceId, platform }. Use with skip: true.',\n )\n .optional(),\n merge: z\n .unknown()\n .describe(\n 'Merge duplicate profiles. Resolves to { primaryType, primaryId, secondaryType, secondaryId }. Use with skip: true.',\n )\n .optional(),\n sendEmail: z\n .unknown()\n .describe(\n 'Send transactional email. Resolves to { to, transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.',\n )\n .optional(),\n sendPush: z\n .unknown()\n .describe(\n 'Send transactional push. Resolves to { transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type {\n Env,\n CustomerIoTrackClientMock,\n CustomerIoApiClientMock,\n} from '../types';\n\ntype TrackNoArg = () => Promise<void>;\ntype TrackOne = (_id: string | number) => Promise<void>;\ntype TrackIdentify = (\n _id: string | number,\n _attrs: Record<string, unknown>,\n) => Promise<void>;\ntype TrackEvent = (\n _id: string | number,\n _event: {\n name: string;\n data?: Record<string, unknown>;\n timestamp?: number;\n },\n) => Promise<void>;\ntype TrackAnonymous = (\n _id: string,\n _event: {\n name: string;\n data?: Record<string, unknown>;\n timestamp?: number;\n },\n) => Promise<void>;\ntype TrackPage = (\n _id: string | number,\n _url: string,\n _data?: Record<string, unknown>,\n) => Promise<void>;\ntype TrackAddDevice = (\n _id: string | number,\n _deviceId: string,\n _platform: string,\n _data?: Record<string, unknown>,\n) => Promise<void>;\ntype TrackDeleteDevice = (\n _id: string | number,\n _deviceId: string,\n _platform: string,\n) => Promise<void>;\ntype TrackMerge = (\n _pt: string,\n _pi: string,\n _st: string,\n _si: string,\n) => Promise<void>;\ntype ApiSend = (_request: unknown) => Promise<void>;\n\nconst asyncIdentify: TrackIdentify = () => Promise.resolve();\nconst asyncEvent: TrackEvent = () => Promise.resolve();\nconst asyncAnonymous: TrackAnonymous = () => Promise.resolve();\nconst asyncPage: TrackPage = () => Promise.resolve();\nconst asyncOne: TrackOne = () => Promise.resolve();\nconst asyncAddDevice: TrackAddDevice = () => Promise.resolve();\nconst asyncDeleteDevice: TrackDeleteDevice = () => Promise.resolve();\nconst asyncMerge: TrackMerge = () => Promise.resolve();\nconst asyncSend: ApiSend = () => Promise.resolve();\n\n// Suppress unused warning for narrow helper aliases used below.\nvoid (null as unknown as TrackNoArg);\n\nfunction createMockTrackClient(): CustomerIoTrackClientMock {\n return {\n identify: asyncIdentify,\n track: asyncEvent,\n trackAnonymous: asyncAnonymous,\n trackPageView: asyncPage,\n destroy: asyncOne,\n suppress: asyncOne,\n unsuppress: asyncOne,\n addDevice: asyncAddDevice,\n deleteDevice: asyncDeleteDevice,\n mergeCustomers: asyncMerge,\n };\n}\n\nfunction createMockApiClient(): CustomerIoApiClientMock {\n return {\n sendEmail: asyncSend,\n sendPush: asyncSend,\n };\n}\n\nexport const push: Env = {\n trackClient: createMockTrackClient(),\n apiClient: createMockApiClient(),\n};\n\nexport const simulation = [\n 'call:trackClient.identify',\n 'call:trackClient.track',\n 'call:trackClient.trackAnonymous',\n 'call:trackClient.trackPageView',\n 'call:trackClient.destroy',\n 'call:trackClient.suppress',\n 'call:trackClient.unsuppress',\n 'call:trackClient.addDevice',\n 'call:trackClient.deleteDevice',\n 'call:trackClient.mergeCustomers',\n 'call:apiClient.sendEmail',\n 'call:apiClient.sendPush',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type CustomerIoStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Default event forwarding -- trackClient.track() with event name and data.\n * customerId resolved from default settings.customerId = 'user.id'.\n */\nexport const defaultTrack: CustomerIoStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000100,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n out: [\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'product view',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.name renames the event for Customer.io.\n */\nexport const mappedEventName: CustomerIoStepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000101,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n name: 'purchase',\n },\n out: [\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'purchase',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Track with mapped data properties.\n */\nexport const mappedData: CustomerIoStepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000102,\n user: { id: 'us3r', session: 's3ss10n' },\n data: { id: '0rd3r1d', total: 555, currency: 'EUR' },\n }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n order_id: 'data.id',\n value: 'data.total',\n currency: 'data.currency',\n },\n },\n },\n out: [\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'purchase',\n data: { order_id: '0rd3r1d', value: 555, currency: 'EUR' },\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Anonymous event -- no customerId resolved, falls back to trackAnonymous().\n */\nexport const anonymousTrack: CustomerIoStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000103,\n user: { session: 's3ss10n' },\n }),\n settings: {\n customerId: undefined,\n },\n out: [\n [\n 'trackClient.trackAnonymous',\n 's3ss10n',\n {\n name: 'product view',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires trackClient.identify() on first push\n * when settings.identify mapping resolves. Then fires trackClient.track().\n */\nexport const destinationIdentify: CustomerIoStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n user: { id: 'us3r', session: 's3ss10n', email: 'user@example.com' },\n }),\n settings: {\n identify: {\n map: {\n email: 'user.email',\n },\n },\n },\n out: [\n ['trackClient.identify', 'us3r', { email: 'user@example.com' }],\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'page view',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with skip -- user login fires identify() only.\n */\nexport const userLoginIdentify: CustomerIoStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n email: 'user@acme.com',\n first_name: 'Jane',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n email: 'data.email',\n first_name: 'data.first_name',\n plan: 'data.plan',\n },\n },\n },\n },\n out: [\n [\n 'trackClient.identify',\n 'us3r',\n { email: 'user@acme.com', first_name: 'Jane', plan: 'premium' },\n ],\n ],\n};\n\n/**\n * Page view -- fires trackClient.trackPageView() with url.\n * skip: true suppresses track(); settings.page fires trackPageView().\n */\nexport const pageView: CustomerIoStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000106,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n url: 'https://example.com/pricing',\n referrer: 'https://google.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n page: {\n map: {\n url: 'data.url',\n referrer: 'data.referrer',\n },\n },\n },\n },\n out: [\n [\n 'trackClient.trackPageView',\n 'us3r',\n 'https://example.com/pricing',\n { referrer: 'https://google.com' },\n ],\n ],\n};\n\n/**\n * Destroy -- permanently deletes a person from Customer.io.\n */\nexport const destroyPerson: CustomerIoStepExample = {\n in: getEvent('user delete', {\n timestamp: 1700000107,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n skip: true,\n settings: {\n destroy: true,\n },\n },\n out: [['trackClient.destroy', 'us3r']],\n};\n\n/**\n * Suppress -- stops messaging without deleting data.\n */\nexport const suppressPerson: CustomerIoStepExample = {\n in: getEvent('user suppress', {\n timestamp: 1700000108,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n skip: true,\n settings: {\n suppress: true,\n },\n },\n out: [['trackClient.suppress', 'us3r']],\n};\n\n/**\n * Unsuppress -- resumes messaging for a suppressed person.\n */\nexport const unsuppressPerson: CustomerIoStepExample = {\n in: getEvent('user unsuppress', {\n timestamp: 1700000109,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n skip: true,\n settings: {\n unsuppress: true,\n },\n },\n out: [['trackClient.unsuppress', 'us3r']],\n};\n\n/**\n * Wildcard ignore -- the event matches a mapping rule with ignore: true.\n * The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: CustomerIoStepExample = {\n in: getEvent('debug noise', {\n timestamp: 1700000110,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: { ignore: true },\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAW,aACR,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQ,aACL,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;A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AAAA,EACD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
package/dist/dev.mjs ADDED
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,s=(s,t)=>{for(var i in t)e(s,i,{get:t[i],enumerable:!0})},t={};s(t,{MappingSchema:()=>o,SettingsSchema:()=>a,mapping:()=>l,settings:()=>p});import{zodToSchema as i}from"@walkeros/core/dev";import{z as r}from"@walkeros/core/dev";var a=r.object({siteId:r.string().min(1).describe("Customer.io Site ID. Find it in Settings > Workspace Settings > API Credentials."),apiKey:r.string().min(1).describe("Customer.io API Key. Find it in Settings > Workspace Settings > API Credentials."),appApiKey:r.string().describe("App API Key for transactional messaging (sendEmail/sendPush). Find it in Settings > Workspace Settings > API Credentials > App API Keys.").optional(),region:r.enum(["us","eu"]).describe("Data center region. Must match where your Customer.io workspace was created. Default: us.").optional(),timeout:r.number().int().positive().describe("HTTP request timeout in milliseconds. Default: 10000.").optional(),customerId:r.string().describe("walkerOS mapping value path to resolve customerId from each event (like user.id).").optional(),anonymousId:r.string().describe("walkerOS mapping value path to resolve anonymousId from each event (like user.session).").optional(),identify:r.unknown().describe("Destination-level identity mapping. Resolves to { email?, first_name?, ... } attributes. Fires identify() on first push and re-fires when values change.").optional()});import{z as n}from"@walkeros/core/dev";var o=n.object({identify:n.unknown().describe("Per-event identify attributes. Resolves to { email?, first_name?, ... }. Use with skip: true on login/identify events.").optional(),page:n.unknown().describe("Per-event page view. Resolves to { url, ... }. Calls trackPageView(). Use with skip: true.").optional(),destroy:n.boolean().describe("Permanently delete person from Customer.io. Set true on delete events with skip: true.").optional(),suppress:n.boolean().describe("Suppress person (stop messaging without deleting data). Set true with skip: true.").optional(),unsuppress:n.boolean().describe("Unsuppress person (resume messaging). Set true with skip: true.").optional(),addDevice:n.unknown().describe("Register push device. Resolves to { deviceId, platform, data? }. Use with skip: true.").optional(),deleteDevice:n.unknown().describe("Remove push device. Resolves to { deviceId, platform }. Use with skip: true.").optional(),merge:n.unknown().describe("Merge duplicate profiles. Resolves to { primaryType, primaryId, secondaryType, secondaryId }. Use with skip: true.").optional(),sendEmail:n.unknown().describe("Send transactional email. Resolves to { to, transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.").optional(),sendPush:n.unknown().describe("Send transactional push. Resolves to { transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.").optional()}),p=i(a),l=i(o),u={};s(u,{env:()=>m,step:()=>v});var m={};s(m,{push:()=>g,simulation:()=>k});var d=()=>Promise.resolve(),c=()=>Promise.resolve();var g={trackClient:{identify:()=>Promise.resolve(),track:()=>Promise.resolve(),trackAnonymous:()=>Promise.resolve(),trackPageView:()=>Promise.resolve(),destroy:d,suppress:d,unsuppress:d,addDevice:()=>Promise.resolve(),deleteDevice:()=>Promise.resolve(),mergeCustomers:()=>Promise.resolve()},apiClient:{sendEmail:c,sendPush:c}},k=["call:trackClient.identify","call:trackClient.track","call:trackClient.trackAnonymous","call:trackClient.trackPageView","call:trackClient.destroy","call:trackClient.suppress","call:trackClient.unsuppress","call:trackClient.addDevice","call:trackClient.deleteDevice","call:trackClient.mergeCustomers","call:apiClient.sendEmail","call:apiClient.sendPush"],v={};s(v,{anonymousTrack:()=>C,defaultTrack:()=>f,destinationIdentify:()=>P,destroyPerson:()=>S,mappedData:()=>h,mappedEventName:()=>w,pageView:()=>I,suppressPerson:()=>A,unsuppressPerson:()=>R,userLoginIdentify:()=>b,wildcardIgnored:()=>_});import{getEvent as y}from"@walkeros/core";var f={in:y("product view",{timestamp:1700000100,user:{id:"us3r",session:"s3ss10n"}}),out:[["trackClient.track","us3r",{name:"product view",data:{},timestamp:17e5}]]},w={in:y("order complete",{timestamp:1700000101,user:{id:"us3r",session:"s3ss10n"}}),mapping:{name:"purchase"},out:[["trackClient.track","us3r",{name:"purchase",data:{},timestamp:17e5}]]},h={in:y("order complete",{timestamp:1700000102,user:{id:"us3r",session:"s3ss10n"},data:{id:"0rd3r1d",total:555,currency:"EUR"}}),mapping:{name:"purchase",data:{map:{order_id:"data.id",value:"data.total",currency:"data.currency"}}},out:[["trackClient.track","us3r",{name:"purchase",data:{order_id:"0rd3r1d",value:555,currency:"EUR"},timestamp:17e5}]]},C={in:y("product view",{timestamp:1700000103,user:{session:"s3ss10n"}}),settings:{customerId:void 0},out:[["trackClient.trackAnonymous","s3ss10n",{name:"product view",data:{},timestamp:17e5}]]},P={in:y("page view",{timestamp:1700000104,user:{id:"us3r",session:"s3ss10n",email:"user@example.com"}}),settings:{identify:{map:{email:"user.email"}}},out:[["trackClient.identify","us3r",{email:"user@example.com"}],["trackClient.track","us3r",{name:"page view",data:{},timestamp:17e5}]]},b={in:y("user login",{timestamp:1700000105,user:{id:"us3r",session:"s3ss10n"},data:{email:"user@acme.com",first_name:"Jane",plan:"premium"}}),mapping:{skip:!0,settings:{identify:{map:{email:"data.email",first_name:"data.first_name",plan:"data.plan"}}}},out:[["trackClient.identify","us3r",{email:"user@acme.com",first_name:"Jane",plan:"premium"}]]},I={in:y("page view",{timestamp:1700000106,user:{id:"us3r",session:"s3ss10n"},data:{url:"https://example.com/pricing",referrer:"https://google.com"}}),mapping:{skip:!0,settings:{page:{map:{url:"data.url",referrer:"data.referrer"}}}},out:[["trackClient.trackPageView","us3r","https://example.com/pricing",{referrer:"https://google.com"}]]},S={in:y("user delete",{timestamp:1700000107,user:{id:"us3r",session:"s3ss10n"}}),mapping:{skip:!0,settings:{destroy:!0}},out:[["trackClient.destroy","us3r"]]},A={in:y("user suppress",{timestamp:1700000108,user:{id:"us3r",session:"s3ss10n"}}),mapping:{skip:!0,settings:{suppress:!0}},out:[["trackClient.suppress","us3r"]]},R={in:y("user unsuppress",{timestamp:1700000109,user:{id:"us3r",session:"s3ss10n"}}),mapping:{skip:!0,settings:{unsuppress:!0}},out:[["trackClient.unsuppress","us3r"]]},_={in:y("debug noise",{timestamp:1700000110,user:{id:"us3r",session:"s3ss10n"}}),mapping:{ignore:!0},out:[]};export{u as examples,t as schemas};//# sourceMappingURL=dev.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Customer.io Site ID. Find it in Settings > Workspace Settings > API Credentials.',\n ),\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Customer.io API Key. Find it in Settings > Workspace Settings > API Credentials.',\n ),\n appApiKey: z\n .string()\n .describe(\n 'App API Key for transactional messaging (sendEmail/sendPush). Find it in Settings > Workspace Settings > API Credentials > App API Keys.',\n )\n .optional(),\n region: z\n .enum(['us', 'eu'])\n .describe(\n 'Data center region. Must match where your Customer.io workspace was created. Default: us.',\n )\n .optional(),\n timeout: z\n .number()\n .int()\n .positive()\n .describe('HTTP request timeout in milliseconds. Default: 10000.')\n .optional(),\n customerId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve customerId from each event (like user.id).',\n )\n .optional(),\n anonymousId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve anonymousId from each event (like user.session).',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to { email?, first_name?, ... } attributes. Fires identify() on first push and re-fires when values change.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identify attributes. Resolves to { email?, first_name?, ... }. Use with skip: true on login/identify events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page view. Resolves to { url, ... }. Calls trackPageView(). Use with skip: true.',\n )\n .optional(),\n destroy: z\n .boolean()\n .describe(\n 'Permanently delete person from Customer.io. Set true on delete events with skip: true.',\n )\n .optional(),\n suppress: z\n .boolean()\n .describe(\n 'Suppress person (stop messaging without deleting data). Set true with skip: true.',\n )\n .optional(),\n unsuppress: z\n .boolean()\n .describe('Unsuppress person (resume messaging). Set true with skip: true.')\n .optional(),\n addDevice: z\n .unknown()\n .describe(\n 'Register push device. Resolves to { deviceId, platform, data? }. Use with skip: true.',\n )\n .optional(),\n deleteDevice: z\n .unknown()\n .describe(\n 'Remove push device. Resolves to { deviceId, platform }. Use with skip: true.',\n )\n .optional(),\n merge: z\n .unknown()\n .describe(\n 'Merge duplicate profiles. Resolves to { primaryType, primaryId, secondaryType, secondaryId }. Use with skip: true.',\n )\n .optional(),\n sendEmail: z\n .unknown()\n .describe(\n 'Send transactional email. Resolves to { to, transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.',\n )\n .optional(),\n sendPush: z\n .unknown()\n .describe(\n 'Send transactional push. Resolves to { transactional_message_id, message_data?, identifiers? }. Requires appApiKey. Use with skip: true.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type {\n Env,\n CustomerIoTrackClientMock,\n CustomerIoApiClientMock,\n} from '../types';\n\ntype TrackNoArg = () => Promise<void>;\ntype TrackOne = (_id: string | number) => Promise<void>;\ntype TrackIdentify = (\n _id: string | number,\n _attrs: Record<string, unknown>,\n) => Promise<void>;\ntype TrackEvent = (\n _id: string | number,\n _event: {\n name: string;\n data?: Record<string, unknown>;\n timestamp?: number;\n },\n) => Promise<void>;\ntype TrackAnonymous = (\n _id: string,\n _event: {\n name: string;\n data?: Record<string, unknown>;\n timestamp?: number;\n },\n) => Promise<void>;\ntype TrackPage = (\n _id: string | number,\n _url: string,\n _data?: Record<string, unknown>,\n) => Promise<void>;\ntype TrackAddDevice = (\n _id: string | number,\n _deviceId: string,\n _platform: string,\n _data?: Record<string, unknown>,\n) => Promise<void>;\ntype TrackDeleteDevice = (\n _id: string | number,\n _deviceId: string,\n _platform: string,\n) => Promise<void>;\ntype TrackMerge = (\n _pt: string,\n _pi: string,\n _st: string,\n _si: string,\n) => Promise<void>;\ntype ApiSend = (_request: unknown) => Promise<void>;\n\nconst asyncIdentify: TrackIdentify = () => Promise.resolve();\nconst asyncEvent: TrackEvent = () => Promise.resolve();\nconst asyncAnonymous: TrackAnonymous = () => Promise.resolve();\nconst asyncPage: TrackPage = () => Promise.resolve();\nconst asyncOne: TrackOne = () => Promise.resolve();\nconst asyncAddDevice: TrackAddDevice = () => Promise.resolve();\nconst asyncDeleteDevice: TrackDeleteDevice = () => Promise.resolve();\nconst asyncMerge: TrackMerge = () => Promise.resolve();\nconst asyncSend: ApiSend = () => Promise.resolve();\n\n// Suppress unused warning for narrow helper aliases used below.\nvoid (null as unknown as TrackNoArg);\n\nfunction createMockTrackClient(): CustomerIoTrackClientMock {\n return {\n identify: asyncIdentify,\n track: asyncEvent,\n trackAnonymous: asyncAnonymous,\n trackPageView: asyncPage,\n destroy: asyncOne,\n suppress: asyncOne,\n unsuppress: asyncOne,\n addDevice: asyncAddDevice,\n deleteDevice: asyncDeleteDevice,\n mergeCustomers: asyncMerge,\n };\n}\n\nfunction createMockApiClient(): CustomerIoApiClientMock {\n return {\n sendEmail: asyncSend,\n sendPush: asyncSend,\n };\n}\n\nexport const push: Env = {\n trackClient: createMockTrackClient(),\n apiClient: createMockApiClient(),\n};\n\nexport const simulation = [\n 'call:trackClient.identify',\n 'call:trackClient.track',\n 'call:trackClient.trackAnonymous',\n 'call:trackClient.trackPageView',\n 'call:trackClient.destroy',\n 'call:trackClient.suppress',\n 'call:trackClient.unsuppress',\n 'call:trackClient.addDevice',\n 'call:trackClient.deleteDevice',\n 'call:trackClient.mergeCustomers',\n 'call:apiClient.sendEmail',\n 'call:apiClient.sendPush',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type CustomerIoStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Default event forwarding -- trackClient.track() with event name and data.\n * customerId resolved from default settings.customerId = 'user.id'.\n */\nexport const defaultTrack: CustomerIoStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000100,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n out: [\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'product view',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.name renames the event for Customer.io.\n */\nexport const mappedEventName: CustomerIoStepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000101,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n name: 'purchase',\n },\n out: [\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'purchase',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Track with mapped data properties.\n */\nexport const mappedData: CustomerIoStepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000102,\n user: { id: 'us3r', session: 's3ss10n' },\n data: { id: '0rd3r1d', total: 555, currency: 'EUR' },\n }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n order_id: 'data.id',\n value: 'data.total',\n currency: 'data.currency',\n },\n },\n },\n out: [\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'purchase',\n data: { order_id: '0rd3r1d', value: 555, currency: 'EUR' },\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Anonymous event -- no customerId resolved, falls back to trackAnonymous().\n */\nexport const anonymousTrack: CustomerIoStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000103,\n user: { session: 's3ss10n' },\n }),\n settings: {\n customerId: undefined,\n },\n out: [\n [\n 'trackClient.trackAnonymous',\n 's3ss10n',\n {\n name: 'product view',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires trackClient.identify() on first push\n * when settings.identify mapping resolves. Then fires trackClient.track().\n */\nexport const destinationIdentify: CustomerIoStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000104,\n user: { id: 'us3r', session: 's3ss10n', email: 'user@example.com' },\n }),\n settings: {\n identify: {\n map: {\n email: 'user.email',\n },\n },\n },\n out: [\n ['trackClient.identify', 'us3r', { email: 'user@example.com' }],\n [\n 'trackClient.track',\n 'us3r',\n {\n name: 'page view',\n data: {},\n timestamp: 1700000,\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with skip -- user login fires identify() only.\n */\nexport const userLoginIdentify: CustomerIoStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000105,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n email: 'user@acme.com',\n first_name: 'Jane',\n plan: 'premium',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n email: 'data.email',\n first_name: 'data.first_name',\n plan: 'data.plan',\n },\n },\n },\n },\n out: [\n [\n 'trackClient.identify',\n 'us3r',\n { email: 'user@acme.com', first_name: 'Jane', plan: 'premium' },\n ],\n ],\n};\n\n/**\n * Page view -- fires trackClient.trackPageView() with url.\n * skip: true suppresses track(); settings.page fires trackPageView().\n */\nexport const pageView: CustomerIoStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000106,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n url: 'https://example.com/pricing',\n referrer: 'https://google.com',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n page: {\n map: {\n url: 'data.url',\n referrer: 'data.referrer',\n },\n },\n },\n },\n out: [\n [\n 'trackClient.trackPageView',\n 'us3r',\n 'https://example.com/pricing',\n { referrer: 'https://google.com' },\n ],\n ],\n};\n\n/**\n * Destroy -- permanently deletes a person from Customer.io.\n */\nexport const destroyPerson: CustomerIoStepExample = {\n in: getEvent('user delete', {\n timestamp: 1700000107,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n skip: true,\n settings: {\n destroy: true,\n },\n },\n out: [['trackClient.destroy', 'us3r']],\n};\n\n/**\n * Suppress -- stops messaging without deleting data.\n */\nexport const suppressPerson: CustomerIoStepExample = {\n in: getEvent('user suppress', {\n timestamp: 1700000108,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n skip: true,\n settings: {\n suppress: true,\n },\n },\n out: [['trackClient.suppress', 'us3r']],\n};\n\n/**\n * Unsuppress -- resumes messaging for a suppressed person.\n */\nexport const unsuppressPerson: CustomerIoStepExample = {\n in: getEvent('user unsuppress', {\n timestamp: 1700000109,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n skip: true,\n settings: {\n unsuppress: true,\n },\n },\n out: [['trackClient.unsuppress', 'us3r']],\n};\n\n/**\n * Wildcard ignore -- the event matches a mapping rule with ignore: true.\n * The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: CustomerIoStepExample = {\n in: getEvent('debug noise', {\n timestamp: 1700000110,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: { ignore: true },\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAW,EACR,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQ,EACL,KAAK,CAAC,MAAM,IAAI,CAAC,EACjB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP,IAAI,EACJ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