@walkeros/server-destination-rudderstack 4.8.1 → 4.8.2
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/CHANGELOG.md +32 -0
- package/README.md +6 -1
- package/dist/dev.d.mts +41 -11
- package/dist/dev.d.ts +41 -11
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +39 -10
- package/dist/examples/index.d.ts +39 -10
- package/dist/examples/index.js +85 -13
- package/dist/examples/index.mjs +86 -14
- package/dist/index.d.mts +19 -10
- package/dist/index.d.ts +19 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +238 -20
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @walkeros/server-destination-rudderstack
|
|
2
2
|
|
|
3
|
+
## 4.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2374f54: Batches by default (`config.batch` 20 events or 10 seconds) through
|
|
8
|
+
`pushBatch`; each event's own send decides its outcome, so a failed send fails
|
|
9
|
+
that event instead of counting as delivered, and no longer causes an unhandled
|
|
10
|
+
promise rejection. An event without userId or anonymousId fails with
|
|
11
|
+
`missing-input`.
|
|
12
|
+
- acf757d: A silent rule whose identify, group or similar mapping resolves to
|
|
13
|
+
nothing sends nothing, counts as delivered and writes one DEBUG line naming
|
|
14
|
+
the call and mapping key, never the value. HubSpot's warning and Mixpanel's
|
|
15
|
+
error for this case are now DEBUG, because nothing was lost.
|
|
16
|
+
- 7e5fc27: Retries stay inside the destination's `config.timeout`: a quarter of
|
|
17
|
+
it per attempt, at most two retries, and a value set in the settings wins.
|
|
18
|
+
RudderStack gains a `timeout` setting. Events carry `event.id` as the vendor's
|
|
19
|
+
dedup id (PostHog on `capture` only), so at-least-once delivery drops
|
|
20
|
+
duplicates.
|
|
21
|
+
- Updated dependencies [2374f54]
|
|
22
|
+
- Updated dependencies [7e5fc27]
|
|
23
|
+
- Updated dependencies [2374f54]
|
|
24
|
+
- Updated dependencies [964590a]
|
|
25
|
+
- Updated dependencies [4100ede]
|
|
26
|
+
- Updated dependencies [2374f54]
|
|
27
|
+
- Updated dependencies [2374f54]
|
|
28
|
+
- Updated dependencies [15eb7b2]
|
|
29
|
+
- Updated dependencies [33a2779]
|
|
30
|
+
- Updated dependencies [33a2779]
|
|
31
|
+
- Updated dependencies [2374f54]
|
|
32
|
+
- @walkeros/core@4.8.2
|
|
33
|
+
- @walkeros/server-core@4.8.2
|
|
34
|
+
|
|
3
35
|
## 4.8.1
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -33,7 +33,12 @@ npm install @walkeros/server-destination-rudderstack
|
|
|
33
33
|
"destinations": {
|
|
34
34
|
"rudderstack": {
|
|
35
35
|
"package": "@walkeros/server-destination-rudderstack",
|
|
36
|
-
"config": {
|
|
36
|
+
"config": {
|
|
37
|
+
"settings": {
|
|
38
|
+
"writeKey": "YOUR_WRITE_KEY",
|
|
39
|
+
"dataPlaneUrl": "https://your-dataplane.example.com"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
}
|
package/dist/dev.d.mts
CHANGED
|
@@ -15,12 +15,13 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
15
15
|
maxInternalQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
logLevel: z.ZodOptional<z.ZodString>;
|
|
17
17
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
18
19
|
enable: z.ZodOptional<z.ZodBoolean>;
|
|
19
20
|
gzip: z.ZodOptional<z.ZodBoolean>;
|
|
20
21
|
identify: z.ZodOptional<z.ZodUnknown>;
|
|
21
22
|
group: z.ZodOptional<z.ZodUnknown>;
|
|
22
23
|
integrations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
23
|
-
}, z.core.$
|
|
24
|
+
}, z.core.$strict>;
|
|
24
25
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
25
26
|
|
|
26
27
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -71,15 +72,19 @@ interface Settings {
|
|
|
71
72
|
maxInternalQueueSize?: number;
|
|
72
73
|
/** Log level. Default: 'info'. */
|
|
73
74
|
logLevel?: string;
|
|
74
|
-
/**
|
|
75
|
+
/** Retries for a failed request. Default: 2, within config.timeout. */
|
|
75
76
|
retryCount?: number;
|
|
77
|
+
/** Time one request may take (ms). Default: a quarter of config.timeout. */
|
|
78
|
+
timeout?: number;
|
|
76
79
|
/** Completely disable the SDK. Default: false. */
|
|
77
80
|
enable?: boolean;
|
|
78
81
|
/** Enable gzip compression. Default: true. */
|
|
79
82
|
gzip?: boolean;
|
|
80
83
|
/** Runtime state -- not user-facing. Mutated by init/push. */
|
|
81
|
-
_analytics?:
|
|
84
|
+
_analytics?: RudderStackAnalyticsMock;
|
|
82
85
|
_state?: RuntimeState;
|
|
86
|
+
/** The running flush; the next one waits for it. Runtime only. */
|
|
87
|
+
_flushing?: Promise<void>;
|
|
83
88
|
}
|
|
84
89
|
interface RuntimeState {
|
|
85
90
|
lastIdentity?: {
|
|
@@ -105,14 +110,16 @@ interface Env extends DestinationServer.Env {
|
|
|
105
110
|
* destination actually calls. Tests can provide this via env.analytics
|
|
106
111
|
* instead of the real SDK.
|
|
107
112
|
*/
|
|
113
|
+
/** Called once the SDK sent the call, with the error if it failed. */
|
|
114
|
+
type RudderStackCallback = (error?: Error, data?: unknown) => void;
|
|
108
115
|
interface RudderStackAnalyticsMock {
|
|
109
|
-
track: (params: Record<string, unknown
|
|
110
|
-
identify: (params: Record<string, unknown
|
|
111
|
-
group: (params: Record<string, unknown
|
|
112
|
-
page: (params: Record<string, unknown
|
|
113
|
-
screen: (params: Record<string, unknown
|
|
114
|
-
alias: (params: Record<string, unknown
|
|
115
|
-
flush: (callback?:
|
|
116
|
+
track: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
117
|
+
identify: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
118
|
+
group: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
119
|
+
page: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
120
|
+
screen: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
121
|
+
alias: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
122
|
+
flush: (callback?: RudderStackCallback) => Promise<void>;
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
declare const push: Env;
|
|
@@ -181,25 +188,48 @@ declare const aliasUser: RudderStackStepExample;
|
|
|
181
188
|
* AnonymousId only -- no userId resolved. RudderStack accepts anonymousId alone.
|
|
182
189
|
*/
|
|
183
190
|
declare const anonymousOnly: RudderStackStepExample;
|
|
191
|
+
declare const noIdentityProduct: RudderStackStepExample;
|
|
192
|
+
declare const noIdentityOrder: RudderStackStepExample;
|
|
193
|
+
declare const noIdentityPage: RudderStackStepExample;
|
|
194
|
+
declare const noIdentityLogin: RudderStackStepExample;
|
|
195
|
+
declare const noIdentityCompany: RudderStackStepExample;
|
|
196
|
+
declare const noIdentityScreen: RudderStackStepExample;
|
|
197
|
+
declare const noIdentityMerge: RudderStackStepExample;
|
|
198
|
+
/** A silent rule without identify, group, page, screen or alias calls nothing. */
|
|
199
|
+
declare const silentRule: RudderStackStepExample;
|
|
184
200
|
/**
|
|
185
201
|
* Wildcard ignore -- the event matches a mapping rule with ignore: true.
|
|
186
202
|
* The destination fires zero SDK calls.
|
|
187
203
|
*/
|
|
188
204
|
declare const wildcardIgnored: RudderStackStepExample;
|
|
205
|
+
/**
|
|
206
|
+
* The silent group rule of companyGroup on an event without company data: no
|
|
207
|
+
* groupId resolves and the rule suppresses the track, so nothing is sent.
|
|
208
|
+
*/
|
|
209
|
+
declare const companyGroupWithoutData: RudderStackStepExample;
|
|
189
210
|
|
|
190
211
|
type step_RudderStackStepExample = RudderStackStepExample;
|
|
191
212
|
declare const step_aliasUser: typeof aliasUser;
|
|
192
213
|
declare const step_anonymousOnly: typeof anonymousOnly;
|
|
193
214
|
declare const step_companyGroup: typeof companyGroup;
|
|
215
|
+
declare const step_companyGroupWithoutData: typeof companyGroupWithoutData;
|
|
194
216
|
declare const step_defaultTrack: typeof defaultTrack;
|
|
195
217
|
declare const step_destinationIdentify: typeof destinationIdentify;
|
|
196
218
|
declare const step_mappedEventName: typeof mappedEventName;
|
|
219
|
+
declare const step_noIdentityCompany: typeof noIdentityCompany;
|
|
220
|
+
declare const step_noIdentityLogin: typeof noIdentityLogin;
|
|
221
|
+
declare const step_noIdentityMerge: typeof noIdentityMerge;
|
|
222
|
+
declare const step_noIdentityOrder: typeof noIdentityOrder;
|
|
223
|
+
declare const step_noIdentityPage: typeof noIdentityPage;
|
|
224
|
+
declare const step_noIdentityProduct: typeof noIdentityProduct;
|
|
225
|
+
declare const step_noIdentityScreen: typeof noIdentityScreen;
|
|
197
226
|
declare const step_pageView: typeof pageView;
|
|
198
227
|
declare const step_screenView: typeof screenView;
|
|
228
|
+
declare const step_silentRule: typeof silentRule;
|
|
199
229
|
declare const step_userLoginIdentify: typeof userLoginIdentify;
|
|
200
230
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
201
231
|
declare namespace step {
|
|
202
|
-
export { type step_RudderStackStepExample as RudderStackStepExample, step_aliasUser as aliasUser, step_anonymousOnly as anonymousOnly, step_companyGroup as companyGroup, step_defaultTrack as defaultTrack, step_destinationIdentify as destinationIdentify, step_mappedEventName as mappedEventName, step_pageView as pageView, step_screenView as screenView, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
|
|
232
|
+
export { type step_RudderStackStepExample as RudderStackStepExample, step_aliasUser as aliasUser, step_anonymousOnly as anonymousOnly, step_companyGroup as companyGroup, step_companyGroupWithoutData as companyGroupWithoutData, step_defaultTrack as defaultTrack, step_destinationIdentify as destinationIdentify, step_mappedEventName as mappedEventName, step_noIdentityCompany as noIdentityCompany, step_noIdentityLogin as noIdentityLogin, step_noIdentityMerge as noIdentityMerge, step_noIdentityOrder as noIdentityOrder, step_noIdentityPage as noIdentityPage, step_noIdentityProduct as noIdentityProduct, step_noIdentityScreen as noIdentityScreen, step_pageView as pageView, step_screenView as screenView, step_silentRule as silentRule, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
|
|
203
233
|
}
|
|
204
234
|
|
|
205
235
|
declare const index_env: typeof env;
|
package/dist/dev.d.ts
CHANGED
|
@@ -15,12 +15,13 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
15
15
|
maxInternalQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
logLevel: z.ZodOptional<z.ZodString>;
|
|
17
17
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
18
19
|
enable: z.ZodOptional<z.ZodBoolean>;
|
|
19
20
|
gzip: z.ZodOptional<z.ZodBoolean>;
|
|
20
21
|
identify: z.ZodOptional<z.ZodUnknown>;
|
|
21
22
|
group: z.ZodOptional<z.ZodUnknown>;
|
|
22
23
|
integrations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
23
|
-
}, z.core.$
|
|
24
|
+
}, z.core.$strict>;
|
|
24
25
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
25
26
|
|
|
26
27
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -71,15 +72,19 @@ interface Settings {
|
|
|
71
72
|
maxInternalQueueSize?: number;
|
|
72
73
|
/** Log level. Default: 'info'. */
|
|
73
74
|
logLevel?: string;
|
|
74
|
-
/**
|
|
75
|
+
/** Retries for a failed request. Default: 2, within config.timeout. */
|
|
75
76
|
retryCount?: number;
|
|
77
|
+
/** Time one request may take (ms). Default: a quarter of config.timeout. */
|
|
78
|
+
timeout?: number;
|
|
76
79
|
/** Completely disable the SDK. Default: false. */
|
|
77
80
|
enable?: boolean;
|
|
78
81
|
/** Enable gzip compression. Default: true. */
|
|
79
82
|
gzip?: boolean;
|
|
80
83
|
/** Runtime state -- not user-facing. Mutated by init/push. */
|
|
81
|
-
_analytics?:
|
|
84
|
+
_analytics?: RudderStackAnalyticsMock;
|
|
82
85
|
_state?: RuntimeState;
|
|
86
|
+
/** The running flush; the next one waits for it. Runtime only. */
|
|
87
|
+
_flushing?: Promise<void>;
|
|
83
88
|
}
|
|
84
89
|
interface RuntimeState {
|
|
85
90
|
lastIdentity?: {
|
|
@@ -105,14 +110,16 @@ interface Env extends DestinationServer.Env {
|
|
|
105
110
|
* destination actually calls. Tests can provide this via env.analytics
|
|
106
111
|
* instead of the real SDK.
|
|
107
112
|
*/
|
|
113
|
+
/** Called once the SDK sent the call, with the error if it failed. */
|
|
114
|
+
type RudderStackCallback = (error?: Error, data?: unknown) => void;
|
|
108
115
|
interface RudderStackAnalyticsMock {
|
|
109
|
-
track: (params: Record<string, unknown
|
|
110
|
-
identify: (params: Record<string, unknown
|
|
111
|
-
group: (params: Record<string, unknown
|
|
112
|
-
page: (params: Record<string, unknown
|
|
113
|
-
screen: (params: Record<string, unknown
|
|
114
|
-
alias: (params: Record<string, unknown
|
|
115
|
-
flush: (callback?:
|
|
116
|
+
track: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
117
|
+
identify: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
118
|
+
group: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
119
|
+
page: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
120
|
+
screen: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
121
|
+
alias: (params: Record<string, unknown>, callback?: RudderStackCallback) => unknown;
|
|
122
|
+
flush: (callback?: RudderStackCallback) => Promise<void>;
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
declare const push: Env;
|
|
@@ -181,25 +188,48 @@ declare const aliasUser: RudderStackStepExample;
|
|
|
181
188
|
* AnonymousId only -- no userId resolved. RudderStack accepts anonymousId alone.
|
|
182
189
|
*/
|
|
183
190
|
declare const anonymousOnly: RudderStackStepExample;
|
|
191
|
+
declare const noIdentityProduct: RudderStackStepExample;
|
|
192
|
+
declare const noIdentityOrder: RudderStackStepExample;
|
|
193
|
+
declare const noIdentityPage: RudderStackStepExample;
|
|
194
|
+
declare const noIdentityLogin: RudderStackStepExample;
|
|
195
|
+
declare const noIdentityCompany: RudderStackStepExample;
|
|
196
|
+
declare const noIdentityScreen: RudderStackStepExample;
|
|
197
|
+
declare const noIdentityMerge: RudderStackStepExample;
|
|
198
|
+
/** A silent rule without identify, group, page, screen or alias calls nothing. */
|
|
199
|
+
declare const silentRule: RudderStackStepExample;
|
|
184
200
|
/**
|
|
185
201
|
* Wildcard ignore -- the event matches a mapping rule with ignore: true.
|
|
186
202
|
* The destination fires zero SDK calls.
|
|
187
203
|
*/
|
|
188
204
|
declare const wildcardIgnored: RudderStackStepExample;
|
|
205
|
+
/**
|
|
206
|
+
* The silent group rule of companyGroup on an event without company data: no
|
|
207
|
+
* groupId resolves and the rule suppresses the track, so nothing is sent.
|
|
208
|
+
*/
|
|
209
|
+
declare const companyGroupWithoutData: RudderStackStepExample;
|
|
189
210
|
|
|
190
211
|
type step_RudderStackStepExample = RudderStackStepExample;
|
|
191
212
|
declare const step_aliasUser: typeof aliasUser;
|
|
192
213
|
declare const step_anonymousOnly: typeof anonymousOnly;
|
|
193
214
|
declare const step_companyGroup: typeof companyGroup;
|
|
215
|
+
declare const step_companyGroupWithoutData: typeof companyGroupWithoutData;
|
|
194
216
|
declare const step_defaultTrack: typeof defaultTrack;
|
|
195
217
|
declare const step_destinationIdentify: typeof destinationIdentify;
|
|
196
218
|
declare const step_mappedEventName: typeof mappedEventName;
|
|
219
|
+
declare const step_noIdentityCompany: typeof noIdentityCompany;
|
|
220
|
+
declare const step_noIdentityLogin: typeof noIdentityLogin;
|
|
221
|
+
declare const step_noIdentityMerge: typeof noIdentityMerge;
|
|
222
|
+
declare const step_noIdentityOrder: typeof noIdentityOrder;
|
|
223
|
+
declare const step_noIdentityPage: typeof noIdentityPage;
|
|
224
|
+
declare const step_noIdentityProduct: typeof noIdentityProduct;
|
|
225
|
+
declare const step_noIdentityScreen: typeof noIdentityScreen;
|
|
197
226
|
declare const step_pageView: typeof pageView;
|
|
198
227
|
declare const step_screenView: typeof screenView;
|
|
228
|
+
declare const step_silentRule: typeof silentRule;
|
|
199
229
|
declare const step_userLoginIdentify: typeof userLoginIdentify;
|
|
200
230
|
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
201
231
|
declare namespace step {
|
|
202
|
-
export { type step_RudderStackStepExample as RudderStackStepExample, step_aliasUser as aliasUser, step_anonymousOnly as anonymousOnly, step_companyGroup as companyGroup, step_defaultTrack as defaultTrack, step_destinationIdentify as destinationIdentify, step_mappedEventName as mappedEventName, step_pageView as pageView, step_screenView as screenView, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
|
|
232
|
+
export { type step_RudderStackStepExample as RudderStackStepExample, step_aliasUser as aliasUser, step_anonymousOnly as anonymousOnly, step_companyGroup as companyGroup, step_companyGroupWithoutData as companyGroupWithoutData, step_defaultTrack as defaultTrack, step_destinationIdentify as destinationIdentify, step_mappedEventName as mappedEventName, step_noIdentityCompany as noIdentityCompany, step_noIdentityLogin as noIdentityLogin, step_noIdentityMerge as noIdentityMerge, step_noIdentityOrder as noIdentityOrder, step_noIdentityPage as noIdentityPage, step_noIdentityProduct as noIdentityProduct, step_noIdentityScreen as noIdentityScreen, step_pageView as pageView, step_screenView as screenView, step_silentRule as silentRule, step_userLoginIdentify as userLoginIdentify, step_wildcardIgnored as wildcardIgnored };
|
|
203
233
|
}
|
|
204
234
|
|
|
205
235
|
declare const index_env: typeof env;
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(e,s)=>{for(var a in s)t(e,a,{get:s[a],enumerable:!0})},r={};i(r,{examples:()=>g,schemas:()=>o}),module.exports=(e=r,((e,i,r,o)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let l of a(i))n.call(e,l)||l===r||t(e,l,{get:()=>i[l],enumerable:!(o=s(i,l))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};i(o,{MappingSchema:()=>m,SettingsSchema:()=>p,mapping:()=>y,settings:()=>c});var l=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),p=u.z.object({writeKey:u.z.string().min(1).describe("RudderStack source write key. Find it in the RudderStack dashboard under Sources > Setup."),dataPlaneUrl:u.z.string().url().describe("RudderStack data plane URL. Required. Example: https://your-data-plane.rudderstack.com"),userId:u.z.string().describe("walkerOS mapping value path to resolve userId 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(),path:u.z.string().describe("API path route (like /v1/batch).").optional(),flushAt:u.z.number().int().positive().describe("Events to enqueue before flushing a batch. Default: 20.").optional(),flushInterval:u.z.number().int().positive().describe("Max milliseconds before auto-flush. Default: 10000.").optional(),maxQueueSize:u.z.number().int().positive().describe("Maximum batch payload size in bytes. Default: 460800 (~500KB).").optional(),maxInternalQueueSize:u.z.number().int().positive().describe("Maximum in-memory queue length. Default: 20000.").optional(),logLevel:u.z.string().describe("SDK log level: 'info', 'debug', 'error', or 'silly'. Default: 'info'.").optional(),retryCount:u.z.number().int().min(0).describe("Retry attempts for failed batches. Default: 3.").optional(),enable:u.z.boolean().describe("Set to false to no-op all SDK calls. Default: true.").optional(),gzip:u.z.boolean().describe("Enable gzip compression for requests. Default: true.").optional(),identify:u.z.unknown().describe("Destination-level identity mapping. Resolves to { traits } object. Fires identify() on the first push and re-fires when values change.").optional(),group:u.z.unknown().describe("Destination-level group mapping. Resolves to { groupId, traits }. Fires group() on the first push and re-fires on change.").optional(),integrations:u.z.record(u.z.string(),u.z.unknown()).describe('Enable/disable downstream RudderStack destinations. Example: { "All": true, "Mixpanel": false }.').optional()}),d=require("@walkeros/core/dev"),m=d.z.object({identify:d.z.unknown().describe("Per-event identity mapping. Resolves to { userId?, traits? }. Use with rule-level silent: true on login/identify events.").optional(),group:d.z.unknown().describe("Per-event group assignment. Resolves to { groupId, traits? }. Use with rule-level silent: true on company/team events.").optional(),page:d.z.unknown().describe("Per-event page call. Resolves to { name, properties? } or true for minimal page(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),screen:d.z.unknown().describe("Per-event screen call (mobile backends). Resolves to { name, properties? } or true for minimal screen(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),alias:d.z.unknown().describe("Per-event alias call. Resolves to { previousId }. Links anonymous user to identified user. Use with rule-level silent: true.").optional()}),c=(0,l.zodToSchema)(p),y=(0,l.zodToSchema)(m),g={};i(g,{env:()=>v,step:()=>h});var v={};i(v,{push:()=>b,simulation:()=>w});var f=()=>{};var b={analytics:{track:f,identify:f,group:f,page:f,screen:f,alias:f,flush:()=>Promise.resolve()}},w=["call:analytics.track","call:analytics.identify","call:analytics.group","call:analytics.page","call:analytics.screen","call:analytics.alias"],h={};i(h,{aliasUser:()=>O,anonymousOnly:()=>P,companyGroup:()=>R,defaultTrack:()=>I,destinationIdentify:()=>D,mappedEventName:()=>z,pageView:()=>E,screenView:()=>A,userLoginIdentify:()=>S,wildcardIgnored:()=>x});var k=require("@walkeros/core"),I={title:"Default track",description:"A walker event becomes a RudderStack analytics.track call with userId and anonymousId resolved from the event.",in:(0,k.getEvent)("product view",{timestamp:1700000100,user:{id:"us3r",session:"s3ss10n"}}),out:[["analytics.track",{userId:"us3r",anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000100)}]]},z={title:"Renamed event",description:"A mapping renames the event so the RudderStack track call uses a canonical name such as Order Completed.",in:(0,k.getEvent)("order complete",{timestamp:1700000101,user:{id:"us3r",session:"s3ss10n"}}),mapping:{name:"Order Completed"},out:[["analytics.track",{userId:"us3r",anonymousId:"s3ss10n",event:"Order Completed",properties:{},timestamp:new Date(1700000101)}]]},D={title:"Destination identify",description:"Destination-level identify fires analytics.identify with traits on the first push only, then the track call follows.",in:(0,k.getEvent)("page view",{timestamp:1700000102,user:{id:"us3r",session:"s3ss10n",email:"user@example.com"}}),settings:{identify:{map:{traits:{map:{email:"user.email"}}}}},out:[["analytics.identify",{userId:"us3r",anonymousId:"s3ss10n",traits:{email:"user@example.com"},timestamp:new Date(1700000102)}],["analytics.track",{userId:"us3r",anonymousId:"s3ss10n",event:"page view",properties:{},timestamp:new Date(1700000102)}]]},S={title:"User login identify",description:"A user login fires only an analytics.identify call with the resolved userId and traits, skipping the track.",in:(0,k.getEvent)("user login",{timestamp:1700000103,user:{id:"us3r",session:"s3ss10n"},data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan"}}}}}},out:[["analytics.identify",{userId:"new-user-123",anonymousId:"s3ss10n",traits:{email:"user@acme.com",name:"Jane Doe",plan:"premium"},timestamp:new Date(1700000103)}]]},R={title:"Group company",description:"A company update fires analytics.group with the groupId and group traits for B2B account tracking.",in:(0,k.getEvent)("company update",{timestamp:1700000104,user:{id:"us3r",session:"s3ss10n"},data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees"}}}}}},out:[["analytics.group",{userId:"us3r",anonymousId:"s3ss10n",groupId:"comp-456",traits:{name:"Acme",industry:"tech",employees:50},timestamp:new Date(1700000104)}]]},E={title:"Page view",description:"A page view fires analytics.page with a resolved page name and properties instead of a generic track.",in:(0,k.getEvent)("page view",{timestamp:1700000105,user:{id:"us3r",session:"s3ss10n"},data:{title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page",{userId:"us3r",anonymousId:"s3ss10n",name:"Getting Started",properties:{section:"tutorials"},timestamp:new Date(1700000105)}]]},A={title:"Screen view",description:"A screen view from a mobile app backend fires analytics.screen with a screen name and properties.",in:(0,k.getEvent)("screen view",{timestamp:1700000106,user:{id:"us3r",session:"s3ss10n"},data:{screen_name:"Welcome",section:"onboarding",build:"1.2.3"}}),mapping:{silent:!0,settings:{screen:{map:{name:"data.screen_name",properties:{map:{build:"data.build"}}}}}},out:[["analytics.screen",{userId:"us3r",anonymousId:"s3ss10n",name:"Welcome",properties:{build:"1.2.3"},timestamp:new Date(1700000106)}]]},O={title:"Alias user",description:"An identity merge fires analytics.alias to link a previous anonymous id to the newly registered user id.",in:(0,k.getEvent)("identity merge",{timestamp:1700000107,user:{id:"registered-456",session:"s3ss10n"},data:{anonymous_id:"anonymous-123"}}),mapping:{silent:!0,settings:{alias:{map:{previousId:"data.anonymous_id"}}}},out:[["analytics.alias",{userId:"registered-456",previousId:"anonymous-123",timestamp:new Date(1700000107)}]]},P={title:"Anonymous only",description:"When no userId is resolved RudderStack accepts the track call keyed solely by anonymousId.",in:(0,k.getEvent)("product view",{timestamp:1700000108,user:{session:"s3ss10n"}}),settings:{userId:void 0},out:[["analytics.track",{anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000108)}]]},x={public:!1,in:(0,k.getEvent)("debug noise",{timestamp:1700000109,user:{id:"us3r",session:"s3ss10n"}}),mapping:{ignore:!0},out:[]};//# sourceMappingURL=dev.js.map
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,s=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,s)=>{for(var n in s)t(e,n,{get:s[n],enumerable:!0})},r={};a(r,{examples:()=>y,schemas:()=>o}),module.exports=(e=r,((e,a,r,o)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let l of n(a))i.call(e,l)||l===r||t(e,l,{get:()=>a[l],enumerable:!(o=s(a,l))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};a(o,{MappingSchema:()=>m,SettingsSchema:()=>u,mapping:()=>g,settings:()=>c});var l=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),u=d.z.object({writeKey:d.z.string().min(1).describe("RudderStack source write key. Find it in the RudderStack dashboard under Sources > Setup."),dataPlaneUrl:d.z.string().url().describe("RudderStack data plane URL. Required. Example: https://your-data-plane.rudderstack.com"),userId:d.z.string().describe("walkerOS mapping value path to resolve userId from each event (like user.id).").optional(),anonymousId:d.z.string().describe("walkerOS mapping value path to resolve anonymousId from each event (like user.session).").optional(),path:d.z.string().describe("API path route (like /v1/batch).").optional(),flushAt:d.z.number().int().positive().describe("Events the SDK sends in one request. Each push and each config.batch batch flushes the SDK and waits until its calls are sent. Default: 20.").optional(),flushInterval:d.z.number().int().positive().describe("Max milliseconds before auto-flush. Default: 10000.").optional(),maxQueueSize:d.z.number().int().positive().describe("Maximum batch payload size in bytes. Default: 460800 (~500KB).").optional(),maxInternalQueueSize:d.z.number().int().positive().describe("Maximum in-memory queue length. Default: 20000.").optional(),logLevel:d.z.string().describe("SDK log level: 'info', 'debug', 'error', or 'silly'. Default: 'info'.").optional(),retryCount:d.z.number().int().min(0).describe("Retries the SDK makes for a failed request, a tenth of config.timeout apart. Default: 2, which ends within config.timeout. A value set here wins.").optional(),timeout:d.z.number().int().positive().describe("Time one request may take, in milliseconds. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.").optional(),enable:d.z.boolean().describe("Set to false to no-op all SDK calls. Default: true.").optional(),gzip:d.z.boolean().describe("Enable gzip compression for requests. Default: true.").optional(),identify:d.z.unknown().describe("Destination-level identity mapping. Resolves to { traits } object. Fires identify() on the first push and re-fires when values change.").optional(),group:d.z.unknown().describe("Destination-level group mapping. Resolves to { groupId, traits }. Fires group() on the first push and re-fires on change.").optional(),integrations:d.z.record(d.z.string(),d.z.unknown()).describe('Enable/disable downstream RudderStack destinations. Example: { "All": true, "Mixpanel": false }.').optional()}).strict(),p=require("@walkeros/core/dev"),m=p.z.object({identify:p.z.unknown().describe("Per-event identity mapping. Resolves to { userId?, traits? }. Use with rule-level silent: true on login/identify events.").optional(),group:p.z.unknown().describe("Per-event group assignment. Resolves to { groupId, traits? }. Use with rule-level silent: true on company/team events.").optional(),page:p.z.unknown().describe("Per-event page call. Resolves to { name, properties? } or true for minimal page(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),screen:p.z.unknown().describe("Per-event screen call (mobile backends). Resolves to { name, properties? } or true for minimal screen(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),alias:p.z.unknown().describe("Per-event alias call. Resolves to { previousId }. Links anonymous user to identified user. Use with rule-level silent: true.").optional()}),c=(0,l.zodToSchema)(u),g=(0,l.zodToSchema)(m),y={};a(y,{env:()=>v,step:()=>b});var v={};a(v,{push:()=>h,simulation:()=>w});var f=(e,t)=>t?.();var h={analytics:{track:f,identify:f,group:f,page:f,screen:f,alias:f,flush:()=>Promise.resolve()}},w=["call:analytics.track","call:analytics.identify","call:analytics.group","call:analytics.page","call:analytics.screen","call:analytics.alias"],b={};a(b,{aliasUser:()=>P,anonymousOnly:()=>O,companyGroup:()=>R,companyGroupWithoutData:()=>T,defaultTrack:()=>k,destinationIdentify:()=>D,mappedEventName:()=>z,noIdentityCompany:()=>K,noIdentityLogin:()=>j,noIdentityMerge:()=>C,noIdentityOrder:()=>_,noIdentityPage:()=>U,noIdentityProduct:()=>x,noIdentityScreen:()=>M,pageView:()=>A,screenView:()=>E,silentRule:()=>G,userLoginIdentify:()=>S,wildcardIgnored:()=>L});var I=require("@walkeros/core"),k={title:"Default track",description:"A walker event becomes a RudderStack analytics.track call with userId and anonymousId resolved from the event.",in:(0,I.getEvent)("product view",{id:"ev1700000100",timestamp:1700000100,user:{id:"us3r",session:"s3ss10n"}}),out:[["analytics.track",{messageId:"ev1700000100",userId:"us3r",anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000100)}]]},z={title:"Renamed event",description:"A mapping renames the event so the RudderStack track call uses a canonical name such as Order Completed.",in:(0,I.getEvent)("order complete",{id:"ev1700000101",timestamp:1700000101,user:{id:"us3r",session:"s3ss10n"}}),mapping:{name:"Order Completed"},out:[["analytics.track",{messageId:"ev1700000101",userId:"us3r",anonymousId:"s3ss10n",event:"Order Completed",properties:{},timestamp:new Date(1700000101)}]]},D={title:"Destination identify",description:"Destination-level identify fires analytics.identify with traits on the first push only, then the track call follows.",in:(0,I.getEvent)("page view",{id:"ev1700000102",timestamp:1700000102,user:{id:"us3r",session:"s3ss10n",email:"user@example.com"}}),settings:{identify:{map:{traits:{map:{email:"user.email"}}}}},out:[["analytics.identify",{messageId:"ev1700000102-identify",userId:"us3r",anonymousId:"s3ss10n",traits:{email:"user@example.com"},timestamp:new Date(1700000102)}],["analytics.track",{messageId:"ev1700000102",userId:"us3r",anonymousId:"s3ss10n",event:"page view",properties:{},timestamp:new Date(1700000102)}]]},S={title:"User login identify",description:"A user login fires only an analytics.identify call with the resolved userId and traits, skipping the track.",in:(0,I.createEvent)({name:"user login",id:"ev1700000103",timestamp:1700000103,user:{id:"us3r",session:"s3ss10n"},data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan"}}}}}},out:[["analytics.identify",{messageId:"ev1700000103-identify",userId:"new-user-123",anonymousId:"s3ss10n",traits:{email:"user@acme.com",name:"Jane Doe",plan:"premium"},timestamp:new Date(1700000103)}]]},R={title:"Group company",description:"A company update fires analytics.group with the groupId and group traits for B2B account tracking.",in:(0,I.createEvent)({name:"company update",id:"ev1700000104",timestamp:1700000104,user:{id:"us3r",session:"s3ss10n"},data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees"}}}}}},out:[["analytics.group",{messageId:"ev1700000104-group",userId:"us3r",anonymousId:"s3ss10n",groupId:"comp-456",traits:{name:"Acme",industry:"tech",employees:50},timestamp:new Date(1700000104)}]]},A={title:"Page view",description:"A page view fires analytics.page with a resolved page name and properties instead of a generic track.",in:(0,I.getEvent)("page view",{id:"ev1700000105",timestamp:1700000105,user:{id:"us3r",session:"s3ss10n"},data:{title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page",{messageId:"ev1700000105-page",userId:"us3r",anonymousId:"s3ss10n",name:"Getting Started",properties:{section:"tutorials"},timestamp:new Date(1700000105)}]]},E={title:"Screen view",description:"A screen view from a mobile app backend fires analytics.screen with a screen name and properties.",in:(0,I.createEvent)({name:"screen view",id:"ev1700000106",timestamp:1700000106,user:{id:"us3r",session:"s3ss10n"},data:{screen_name:"Welcome",section:"onboarding",build:"1.2.3"}}),mapping:{silent:!0,settings:{screen:{map:{name:"data.screen_name",properties:{map:{build:"data.build"}}}}}},out:[["analytics.screen",{messageId:"ev1700000106-screen",userId:"us3r",anonymousId:"s3ss10n",name:"Welcome",properties:{build:"1.2.3"},timestamp:new Date(1700000106)}]]},P={title:"Alias user",description:"An identity merge fires analytics.alias to link a previous anonymous id to the newly registered user id.",in:(0,I.createEvent)({name:"identity merge",id:"ev1700000107",timestamp:1700000107,user:{id:"registered-456",session:"s3ss10n"},data:{anonymous_id:"anonymous-123"}}),mapping:{silent:!0,settings:{alias:{map:{previousId:"data.anonymous_id"}}}},out:[["analytics.alias",{messageId:"ev1700000107-alias",userId:"registered-456",previousId:"anonymous-123",timestamp:new Date(1700000107)}]]},O={title:"Anonymous only",description:"When no userId is resolved RudderStack accepts the track call keyed solely by anonymousId.",in:(0,I.getEvent)("product view",{id:"ev1700000108",timestamp:1700000108,user:{session:"s3ss10n"}}),settings:{userId:void 0},out:[["analytics.track",{messageId:"ev1700000108",anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000108)}]]};function q(e,t){const[s,n]=e.split(" ");return{public:!1,description:`A ${e} event without userId or anonymousId cannot be sent to RudderStack: the push fails with missing-input instead of counting as delivered.`,in:{name:e,entity:s,action:n,timestamp:t},out:[],outcome:{status:"failed",code:"missing-input",retryable:!1}}}var x=q("product view",1700000110),_=q("order complete",1700000111),U=q("page view",1700000112),j=q("user login",1700000113),K=q("company update",1700000114),M=q("screen view",1700000115),C=q("identity merge",1700000116),G={public:!1,description:"A rule with silent: true and no identify, group, page, screen or alias mapping sends nothing to RudderStack.",in:(0,I.getEvent)("page view",{timestamp:1700000117,user:{id:"us3r",session:"s3ss10n"}}),mapping:{silent:!0},out:[]},L={public:!1,in:(0,I.createEvent)({name:"debug noise",timestamp:1700000109,user:{id:"us3r",session:"s3ss10n"}}),mapping:{ignore:!0},out:[]},T={public:!1,description:"A silent group rule whose groupId finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update",timestamp:1700000120,user:{id:"us3r",session:"s3ss10n"}},mapping:R.mapping,out:[]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +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 writeKey: z\n .string()\n .min(1)\n .describe(\n 'RudderStack source write key. Find it in the RudderStack dashboard under Sources > Setup.',\n ),\n dataPlaneUrl: z\n .string()\n .url()\n .describe(\n 'RudderStack data plane URL. Required. Example: https://your-data-plane.rudderstack.com',\n ),\n userId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve userId 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 path: z.string().describe('API path route (like /v1/batch).').optional(),\n flushAt: z\n .number()\n .int()\n .positive()\n .describe('Events to enqueue before flushing a batch. Default: 20.')\n .optional(),\n flushInterval: z\n .number()\n .int()\n .positive()\n .describe('Max milliseconds before auto-flush. Default: 10000.')\n .optional(),\n maxQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum batch payload size in bytes. Default: 460800 (~500KB).')\n .optional(),\n maxInternalQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum in-memory queue length. Default: 20000.')\n .optional(),\n logLevel: z\n .string()\n .describe(\n \"SDK log level: 'info', 'debug', 'error', or 'silly'. Default: 'info'.\",\n )\n .optional(),\n retryCount: z\n .number()\n .int()\n .min(0)\n .describe('Retry attempts for failed batches. Default: 3.')\n .optional(),\n enable: z\n .boolean()\n .describe('Set to false to no-op all SDK calls. Default: true.')\n .optional(),\n gzip: z\n .boolean()\n .describe('Enable gzip compression for requests. Default: true.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to { traits } object. Fires identify() on the first push and re-fires when values change.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to { groupId, traits }. Fires group() on the first push and re-fires on change.',\n )\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream RudderStack destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\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 identity mapping. Resolves to { userId?, traits? }. Use with rule-level silent: true on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits? }. Use with rule-level silent: true on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call. Resolves to { name, properties? } or true for minimal page(). RudderStack requires name (falls back to empty string). Use with silent: true.',\n )\n .optional(),\n screen: z\n .unknown()\n .describe(\n 'Per-event screen call (mobile backends). Resolves to { name, properties? } or true for minimal screen(). RudderStack requires name (falls back to empty string). Use with silent: true.',\n )\n .optional(),\n alias: z\n .unknown()\n .describe(\n 'Per-event alias call. Resolves to { previousId }. Links anonymous user to identified user. Use with rule-level silent: 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 { Env, RudderStackAnalyticsMock } from '../types';\n\ntype SdkCall = (_params: Record<string, unknown>) => void;\ntype SdkFlush = (\n _callback?: (err?: Error, data?: unknown) => void,\n) => Promise<void>;\n\nconst noop: SdkCall = () => {};\nconst asyncNoop: SdkFlush = () => Promise.resolve();\n\nfunction createMockAnalytics(): RudderStackAnalyticsMock {\n return {\n track: noop,\n identify: noop,\n group: noop,\n page: noop,\n screen: noop,\n alias: noop,\n flush: asyncNoop,\n };\n}\n\nexport const push: Env = {\n analytics: createMockAnalytics(),\n};\n\nexport const simulation = [\n 'call:analytics.track',\n 'call:analytics.identify',\n 'call:analytics.group',\n 'call:analytics.page',\n 'call:analytics.screen',\n 'call:analytics.alias',\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 RudderStackStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * RudderStack server destination invokes the injected `env.analytics` SDK\n * methods (`track`, `identify`, `group`, `page`, `screen`, `alias`) - not a\n * raw HTTP endpoint. Each `out` entry is therefore\n * `[callable, params]` where `callable` is the dotted method name\n * (e.g. `'analytics.track'`) and `params` is the object passed to the SDK.\n *\n * Examples may emit multiple calls in order (e.g. identify + track), so\n * every `out` is wrapped as `[[callable, params], ...]`.\n */\n\n/**\n * Default event forwarding -- analytics.track() with event name and empty\n * properties. userId resolved from default settings.userId = 'user.id'.\n */\nexport const defaultTrack: RudderStackStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a RudderStack analytics.track call with userId and anonymousId resolved from the event.',\n in: getEvent('product view', {\n timestamp: 1700000100,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n out: [\n [\n 'analytics.track',\n {\n userId: 'us3r',\n anonymousId: 's3ss10n',\n event: 'product view',\n properties: {},\n timestamp: new Date(1700000100),\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.name renames the event for RudderStack.\n */\nexport const mappedEventName: RudderStackStepExample = {\n title: 'Renamed event',\n description:\n 'A mapping renames the event so the RudderStack track call uses a canonical name such as Order Completed.',\n in: getEvent('order complete', {\n timestamp: 1700000101,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n name: 'Order Completed',\n },\n out: [\n [\n 'analytics.track',\n {\n userId: 'us3r',\n anonymousId: 's3ss10n',\n event: 'Order Completed',\n properties: {},\n timestamp: new Date(1700000101),\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires analytics.identify() on first push\n * when settings.identify mapping resolves. Then fires analytics.track().\n */\nexport const destinationIdentify: RudderStackStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify fires analytics.identify with traits on the first push only, then the track call follows.',\n in: getEvent('page view', {\n timestamp: 1700000102,\n user: { id: 'us3r', session: 's3ss10n', email: 'user@example.com' },\n }),\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n email: 'user.email',\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n {\n userId: 'us3r',\n anonymousId: 's3ss10n',\n traits: { email: 'user@example.com' },\n timestamp: new Date(1700000102),\n },\n ],\n [\n 'analytics.track',\n {\n userId: 'us3r',\n anonymousId: 's3ss10n',\n event: 'page view',\n properties: {},\n timestamp: new Date(1700000102),\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with silent -- user login fires identify() only.\n */\nexport const userLoginIdentify: RudderStackStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires only an analytics.identify call with the resolved userId and traits, skipping the track.',\n in: getEvent('user login', {\n timestamp: 1700000103,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n {\n userId: 'new-user-123',\n anonymousId: 's3ss10n',\n traits: { email: 'user@acme.com', name: 'Jane Doe', plan: 'premium' },\n timestamp: new Date(1700000103),\n },\n ],\n ],\n};\n\n/**\n * Per-event group with silent -- company update fires group() only.\n */\nexport const companyGroup: RudderStackStepExample = {\n title: 'Group company',\n description:\n 'A company update fires analytics.group with the groupId and group traits for B2B account tracking.',\n in: getEvent('company update', {\n timestamp: 1700000104,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n {\n userId: 'us3r',\n anonymousId: 's3ss10n',\n groupId: 'comp-456',\n traits: { name: 'Acme', industry: 'tech', employees: 50 },\n timestamp: new Date(1700000104),\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call with properties. RudderStack requires name -- resolved\n * from mapping. silent: true suppresses track().\n */\nexport const pageView: RudderStackStepExample = {\n title: 'Page view',\n description:\n 'A page view fires analytics.page with a resolved page name and properties instead of a generic track.',\n in: getEvent('page view', {\n timestamp: 1700000105,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n {\n userId: 'us3r',\n anonymousId: 's3ss10n',\n name: 'Getting Started',\n properties: { section: 'tutorials' },\n timestamp: new Date(1700000105),\n },\n ],\n ],\n};\n\n/**\n * Screen call -- server-only method for mobile app backends.\n * RudderStack requires name -- resolved from mapping.\n */\nexport const screenView: RudderStackStepExample = {\n title: 'Screen view',\n description:\n 'A screen view from a mobile app backend fires analytics.screen with a screen name and properties.',\n in: getEvent('screen view', {\n timestamp: 1700000106,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n screen_name: 'Welcome',\n section: 'onboarding',\n build: '1.2.3',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n screen: {\n map: {\n name: 'data.screen_name',\n properties: {\n map: {\n build: 'data.build',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.screen',\n {\n userId: 'us3r',\n anonymousId: 's3ss10n',\n name: 'Welcome',\n properties: { build: '1.2.3' },\n timestamp: new Date(1700000106),\n },\n ],\n ],\n};\n\n/**\n * Alias call -- links anonymous user identity to registered user.\n * silent: true suppresses track(). Requires previousId from mapping.\n */\nexport const aliasUser: RudderStackStepExample = {\n title: 'Alias user',\n description:\n 'An identity merge fires analytics.alias to link a previous anonymous id to the newly registered user id.',\n in: getEvent('identity merge', {\n timestamp: 1700000107,\n user: { id: 'registered-456', session: 's3ss10n' },\n data: {\n anonymous_id: 'anonymous-123',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n alias: {\n map: {\n previousId: 'data.anonymous_id',\n },\n },\n },\n },\n out: [\n [\n 'analytics.alias',\n {\n userId: 'registered-456',\n previousId: 'anonymous-123',\n timestamp: new Date(1700000107),\n },\n ],\n ],\n};\n\n/**\n * AnonymousId only -- no userId resolved. RudderStack accepts anonymousId alone.\n */\nexport const anonymousOnly: RudderStackStepExample = {\n title: 'Anonymous only',\n description:\n 'When no userId is resolved RudderStack accepts the track call keyed solely by anonymousId.',\n in: getEvent('product view', {\n timestamp: 1700000108,\n user: { session: 's3ss10n' },\n }),\n settings: {\n userId: undefined,\n },\n out: [\n [\n 'analytics.track',\n {\n anonymousId: 's3ss10n',\n event: 'product view',\n properties: {},\n timestamp: new Date(1700000108),\n },\n ],\n ],\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: RudderStackStepExample = {\n public: false,\n in: getEvent('debug noise', {\n timestamp: 1700000109,\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,UAAU,aACP,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,cAAc,aACX,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,aACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,O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C;AAAA,EACD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
|
|
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\n .object({\n writeKey: z\n .string()\n .min(1)\n .describe(\n 'RudderStack source write key. Find it in the RudderStack dashboard under Sources > Setup.',\n ),\n dataPlaneUrl: z\n .string()\n .url()\n .describe(\n 'RudderStack data plane URL. Required. Example: https://your-data-plane.rudderstack.com',\n ),\n userId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve userId 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 path: z.string().describe('API path route (like /v1/batch).').optional(),\n flushAt: z\n .number()\n .int()\n .positive()\n .describe(\n 'Events the SDK sends in one request. Each push and each config.batch batch flushes the SDK and waits until its calls are sent. Default: 20.',\n )\n .optional(),\n flushInterval: z\n .number()\n .int()\n .positive()\n .describe('Max milliseconds before auto-flush. Default: 10000.')\n .optional(),\n maxQueueSize: z\n .number()\n .int()\n .positive()\n .describe(\n 'Maximum batch payload size in bytes. Default: 460800 (~500KB).',\n )\n .optional(),\n maxInternalQueueSize: z\n .number()\n .int()\n .positive()\n .describe('Maximum in-memory queue length. Default: 20000.')\n .optional(),\n logLevel: z\n .string()\n .describe(\n \"SDK log level: 'info', 'debug', 'error', or 'silly'. Default: 'info'.\",\n )\n .optional(),\n retryCount: z\n .number()\n .int()\n .min(0)\n .describe(\n 'Retries the SDK makes for a failed request, a tenth of config.timeout apart. Default: 2, which ends within config.timeout. A value set here wins.',\n )\n .optional(),\n timeout: z\n .number()\n .int()\n .positive()\n .describe(\n 'Time one request may take, in milliseconds. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.',\n )\n .optional(),\n enable: z\n .boolean()\n .describe('Set to false to no-op all SDK calls. Default: true.')\n .optional(),\n gzip: z\n .boolean()\n .describe('Enable gzip compression for requests. Default: true.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to { traits } object. Fires identify() on the first push and re-fires when values change.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Destination-level group mapping. Resolves to { groupId, traits }. Fires group() on the first push and re-fires on change.',\n )\n .optional(),\n integrations: z\n .record(z.string(), z.unknown())\n .describe(\n 'Enable/disable downstream RudderStack destinations. Example: { \"All\": true, \"Mixpanel\": false }.',\n )\n .optional(),\n })\n .strict();\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 identity mapping. Resolves to { userId?, traits? }. Use with rule-level silent: true on login/identify events.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Per-event group assignment. Resolves to { groupId, traits? }. Use with rule-level silent: true on company/team events.',\n )\n .optional(),\n page: z\n .unknown()\n .describe(\n 'Per-event page call. Resolves to { name, properties? } or true for minimal page(). RudderStack requires name (falls back to empty string). Use with silent: true.',\n )\n .optional(),\n screen: z\n .unknown()\n .describe(\n 'Per-event screen call (mobile backends). Resolves to { name, properties? } or true for minimal screen(). RudderStack requires name (falls back to empty string). Use with silent: true.',\n )\n .optional(),\n alias: z\n .unknown()\n .describe(\n 'Per-event alias call. Resolves to { previousId }. Links anonymous user to identified user. Use with rule-level silent: 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 RudderStackAnalyticsMock,\n RudderStackCallback,\n} from '../types';\n\n/** Every call is sent: its callback answers without an error. */\nconst sent = (_params: unknown, callback?: RudderStackCallback) => callback?.();\nconst asyncNoop = () => Promise.resolve();\n\nfunction createMockAnalytics(): RudderStackAnalyticsMock {\n return {\n track: sent,\n identify: sent,\n group: sent,\n page: sent,\n screen: sent,\n alias: sent,\n flush: asyncNoop,\n };\n}\n\nexport const push: Env = {\n analytics: createMockAnalytics(),\n};\n\nexport const simulation = [\n 'call:analytics.track',\n 'call:analytics.identify',\n 'call:analytics.group',\n 'call:analytics.page',\n 'call:analytics.screen',\n 'call:analytics.alias',\n];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, 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 RudderStackStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * RudderStack server destination invokes the injected `env.analytics` SDK\n * methods (`track`, `identify`, `group`, `page`, `screen`, `alias`) - not a\n * raw HTTP endpoint. Each `out` entry is therefore\n * `[callable, params]` where `callable` is the dotted method name\n * (e.g. `'analytics.track'`) and `params` is the object passed to the SDK.\n *\n * Examples may emit multiple calls in order (e.g. identify + track), so\n * every `out` is wrapped as `[[callable, params], ...]`.\n */\n\n/**\n * Default event forwarding -- analytics.track() with event name and empty\n * properties. userId resolved from default settings.userId = 'user.id'.\n */\nexport const defaultTrack: RudderStackStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a RudderStack analytics.track call with userId and anonymousId resolved from the event.',\n in: getEvent('product view', {\n id: 'ev1700000100',\n timestamp: 1700000100,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n out: [\n [\n 'analytics.track',\n {\n messageId: 'ev1700000100',\n userId: 'us3r',\n anonymousId: 's3ss10n',\n event: 'product view',\n properties: {},\n timestamp: new Date(1700000100),\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.name renames the event for RudderStack.\n */\nexport const mappedEventName: RudderStackStepExample = {\n title: 'Renamed event',\n description:\n 'A mapping renames the event so the RudderStack track call uses a canonical name such as Order Completed.',\n in: getEvent('order complete', {\n id: 'ev1700000101',\n timestamp: 1700000101,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: {\n name: 'Order Completed',\n },\n out: [\n [\n 'analytics.track',\n {\n messageId: 'ev1700000101',\n userId: 'us3r',\n anonymousId: 's3ss10n',\n event: 'Order Completed',\n properties: {},\n timestamp: new Date(1700000101),\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires analytics.identify() on first push\n * when settings.identify mapping resolves. Then fires analytics.track().\n */\nexport const destinationIdentify: RudderStackStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify fires analytics.identify with traits on the first push only, then the track call follows.',\n in: getEvent('page view', {\n id: 'ev1700000102',\n timestamp: 1700000102,\n user: { id: 'us3r', session: 's3ss10n', email: 'user@example.com' },\n }),\n settings: {\n identify: {\n map: {\n traits: {\n map: {\n email: 'user.email',\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n {\n messageId: 'ev1700000102-identify',\n userId: 'us3r',\n anonymousId: 's3ss10n',\n traits: { email: 'user@example.com' },\n timestamp: new Date(1700000102),\n },\n ],\n [\n 'analytics.track',\n {\n messageId: 'ev1700000102',\n userId: 'us3r',\n anonymousId: 's3ss10n',\n event: 'page view',\n properties: {},\n timestamp: new Date(1700000102),\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with silent -- user login fires identify() only.\n */\nexport const userLoginIdentify: RudderStackStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires only an analytics.identify call with the resolved userId and traits, skipping the track.',\n in: createEvent({\n name: 'user login',\n id: 'ev1700000103',\n timestamp: 1700000103,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n name: 'Jane Doe',\n plan: 'premium',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n userId: 'data.user_id',\n traits: {\n map: {\n email: 'data.email',\n name: 'data.name',\n plan: 'data.plan',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.identify',\n {\n messageId: 'ev1700000103-identify',\n userId: 'new-user-123',\n anonymousId: 's3ss10n',\n traits: { email: 'user@acme.com', name: 'Jane Doe', plan: 'premium' },\n timestamp: new Date(1700000103),\n },\n ],\n ],\n};\n\n/**\n * Per-event group with silent -- company update fires group() only.\n */\nexport const companyGroup: RudderStackStepExample = {\n title: 'Group company',\n description:\n 'A company update fires analytics.group with the groupId and group traits for B2B account tracking.',\n in: createEvent({\n name: 'company update',\n id: 'ev1700000104',\n timestamp: 1700000104,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n company_id: 'comp-456',\n company_name: 'Acme',\n industry: 'tech',\n employees: 50,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n groupId: 'data.company_id',\n traits: {\n map: {\n name: 'data.company_name',\n industry: 'data.industry',\n employees: 'data.employees',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.group',\n {\n messageId: 'ev1700000104-group',\n userId: 'us3r',\n anonymousId: 's3ss10n',\n groupId: 'comp-456',\n traits: { name: 'Acme', industry: 'tech', employees: 50 },\n timestamp: new Date(1700000104),\n },\n ],\n ],\n};\n\n/**\n * Explicit page() call with properties. RudderStack requires name -- resolved\n * from mapping. silent: true suppresses track().\n */\nexport const pageView: RudderStackStepExample = {\n title: 'Page view',\n description:\n 'A page view fires analytics.page with a resolved page name and properties instead of a generic track.',\n in: getEvent('page view', {\n id: 'ev1700000105',\n timestamp: 1700000105,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n title: 'Getting Started',\n section: 'tutorials',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n page: {\n map: {\n name: 'data.title',\n properties: {\n map: {\n section: 'data.section',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.page',\n {\n messageId: 'ev1700000105-page',\n userId: 'us3r',\n anonymousId: 's3ss10n',\n name: 'Getting Started',\n properties: { section: 'tutorials' },\n timestamp: new Date(1700000105),\n },\n ],\n ],\n};\n\n/**\n * Screen call -- server-only method for mobile app backends.\n * RudderStack requires name -- resolved from mapping.\n */\nexport const screenView: RudderStackStepExample = {\n title: 'Screen view',\n description:\n 'A screen view from a mobile app backend fires analytics.screen with a screen name and properties.',\n in: createEvent({\n name: 'screen view',\n id: 'ev1700000106',\n timestamp: 1700000106,\n user: { id: 'us3r', session: 's3ss10n' },\n data: {\n screen_name: 'Welcome',\n section: 'onboarding',\n build: '1.2.3',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n screen: {\n map: {\n name: 'data.screen_name',\n properties: {\n map: {\n build: 'data.build',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'analytics.screen',\n {\n messageId: 'ev1700000106-screen',\n userId: 'us3r',\n anonymousId: 's3ss10n',\n name: 'Welcome',\n properties: { build: '1.2.3' },\n timestamp: new Date(1700000106),\n },\n ],\n ],\n};\n\n/**\n * Alias call -- links anonymous user identity to registered user.\n * silent: true suppresses track(). Requires previousId from mapping.\n */\nexport const aliasUser: RudderStackStepExample = {\n title: 'Alias user',\n description:\n 'An identity merge fires analytics.alias to link a previous anonymous id to the newly registered user id.',\n in: createEvent({\n name: 'identity merge',\n id: 'ev1700000107',\n timestamp: 1700000107,\n user: { id: 'registered-456', session: 's3ss10n' },\n data: {\n anonymous_id: 'anonymous-123',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n alias: {\n map: {\n previousId: 'data.anonymous_id',\n },\n },\n },\n },\n out: [\n [\n 'analytics.alias',\n {\n messageId: 'ev1700000107-alias',\n userId: 'registered-456',\n previousId: 'anonymous-123',\n timestamp: new Date(1700000107),\n },\n ],\n ],\n};\n\n/**\n * AnonymousId only -- no userId resolved. RudderStack accepts anonymousId alone.\n */\nexport const anonymousOnly: RudderStackStepExample = {\n title: 'Anonymous only',\n description:\n 'When no userId is resolved RudderStack accepts the track call keyed solely by anonymousId.',\n in: getEvent('product view', {\n id: 'ev1700000108',\n timestamp: 1700000108,\n user: { session: 's3ss10n' },\n }),\n settings: {\n userId: undefined,\n },\n out: [\n [\n 'analytics.track',\n {\n messageId: 'ev1700000108',\n anonymousId: 's3ss10n',\n event: 'product view',\n properties: {},\n timestamp: new Date(1700000108),\n },\n ],\n ],\n};\n\n/**\n * No identity -- neither userId nor anonymousId resolves from the event, so\n * RudderStack cannot take it: the push fails with missing-input instead of\n * counting as delivered. One per event name above, so every example's event\n * without identity has its declared outcome.\n */\nfunction withoutIdentity(\n name: string,\n timestamp: number,\n): RudderStackStepExample {\n const [entity, action] = name.split(' ');\n return {\n public: false,\n description: `A ${name} event without userId or anonymousId cannot be sent to RudderStack: the push fails with missing-input instead of counting as delivered.`,\n in: { name, entity, action, timestamp },\n out: [],\n outcome: { status: 'failed', code: 'missing-input', retryable: false },\n };\n}\n\nexport const noIdentityProduct = withoutIdentity('product view', 1700000110);\nexport const noIdentityOrder = withoutIdentity('order complete', 1700000111);\nexport const noIdentityPage = withoutIdentity('page view', 1700000112);\nexport const noIdentityLogin = withoutIdentity('user login', 1700000113);\nexport const noIdentityCompany = withoutIdentity('company update', 1700000114);\nexport const noIdentityScreen = withoutIdentity('screen view', 1700000115);\nexport const noIdentityMerge = withoutIdentity('identity merge', 1700000116);\n\n/** A silent rule without identify, group, page, screen or alias calls nothing. */\nexport const silentRule: RudderStackStepExample = {\n public: false,\n description:\n 'A rule with silent: true and no identify, group, page, screen or alias mapping sends nothing to RudderStack.',\n in: getEvent('page view', {\n timestamp: 1700000117,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: { silent: true },\n out: [],\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: RudderStackStepExample = {\n public: false,\n in: createEvent({\n name: 'debug noise',\n timestamp: 1700000109,\n user: { id: 'us3r', session: 's3ss10n' },\n }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * The silent group rule of companyGroup on an event without company data: no\n * groupId resolves and the rule suppresses the track, so nothing is sent.\n */\nexport const companyGroupWithoutData: RudderStackStepExample = {\n public: false,\n description:\n 'A silent group rule whose groupId finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.',\n in: {\n name: 'company update',\n entity: 'company',\n action: 'update',\n timestamp: 1700000120,\n user: { id: 'us3r', session: 's3ss10n' },\n },\n mapping: companyGroup.mapping,\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,aAC3B,OAAO;AAAA,EACN,UAAU,aACP,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,cAAc,aACX,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,aACL,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,MAAM,aAAE,OAAO,EAAE,SAAS,kCAAkC,EAAE,SAAS;AAAA,EACvE,SAAS,aACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,aACZ,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,qDAAqD,EAC9D,SAAS;AAAA,EACZ,cAAc,aACX,OAAO,EACP,IAAI,EACJ,SAAS,EACT;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,sBAAsB,aACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,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AS,aAAa;AAAA,EACtB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,s=(s,t)=>{for(var a in t)e(s,a,{get:t[a],enumerable:!0})},t={};s(t,{MappingSchema:()=>o,SettingsSchema:()=>n,mapping:()=>p,settings:()=>l});import{zodToSchema as a}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var n=i.object({writeKey:i.string().min(1).describe("RudderStack source write key. Find it in the RudderStack dashboard under Sources > Setup."),dataPlaneUrl:i.string().url().describe("RudderStack data plane URL. Required. Example: https://your-data-plane.rudderstack.com"),userId:i.string().describe("walkerOS mapping value path to resolve userId from each event (like user.id).").optional(),anonymousId:i.string().describe("walkerOS mapping value path to resolve anonymousId from each event (like user.session).").optional(),path:i.string().describe("API path route (like /v1/batch).").optional(),flushAt:i.number().int().positive().describe("Events to enqueue before flushing a batch. Default: 20.").optional(),flushInterval:i.number().int().positive().describe("Max milliseconds before auto-flush. Default: 10000.").optional(),maxQueueSize:i.number().int().positive().describe("Maximum batch payload size in bytes. Default: 460800 (~500KB).").optional(),maxInternalQueueSize:i.number().int().positive().describe("Maximum in-memory queue length. Default: 20000.").optional(),logLevel:i.string().describe("SDK log level: 'info', 'debug', 'error', or 'silly'. Default: 'info'.").optional(),retryCount:i.number().int().min(0).describe("Retry attempts for failed batches. Default: 3.").optional(),enable:i.boolean().describe("Set to false to no-op all SDK calls. Default: true.").optional(),gzip:i.boolean().describe("Enable gzip compression for requests. Default: true.").optional(),identify:i.unknown().describe("Destination-level identity mapping. Resolves to { traits } object. Fires identify() on the first push and re-fires when values change.").optional(),group:i.unknown().describe("Destination-level group mapping. Resolves to { groupId, traits }. Fires group() on the first push and re-fires on change.").optional(),integrations:i.record(i.string(),i.unknown()).describe('Enable/disable downstream RudderStack destinations. Example: { "All": true, "Mixpanel": false }.').optional()});import{z as r}from"@walkeros/core/dev";var o=r.object({identify:r.unknown().describe("Per-event identity mapping. Resolves to { userId?, traits? }. Use with rule-level silent: true on login/identify events.").optional(),group:r.unknown().describe("Per-event group assignment. Resolves to { groupId, traits? }. Use with rule-level silent: true on company/team events.").optional(),page:r.unknown().describe("Per-event page call. Resolves to { name, properties? } or true for minimal page(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),screen:r.unknown().describe("Per-event screen call (mobile backends). Resolves to { name, properties? } or true for minimal screen(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),alias:r.unknown().describe("Per-event alias call. Resolves to { previousId }. Links anonymous user to identified user. Use with rule-level silent: true.").optional()}),l=a(n),p=a(o),u={};s(u,{env:()=>d,step:()=>g});var d={};s(d,{push:()=>c,simulation:()=>y});var m=()=>{};var c={analytics:{track:m,identify:m,group:m,page:m,screen:m,alias:m,flush:()=>Promise.resolve()}},y=["call:analytics.track","call:analytics.identify","call:analytics.group","call:analytics.page","call:analytics.screen","call:analytics.alias"],g={};s(g,{aliasUser:()=>S,anonymousOnly:()=>R,companyGroup:()=>k,defaultTrack:()=>f,destinationIdentify:()=>w,mappedEventName:()=>b,pageView:()=>I,screenView:()=>D,userLoginIdentify:()=>h,wildcardIgnored:()=>A});import{getEvent as v}from"@walkeros/core";var f={title:"Default track",description:"A walker event becomes a RudderStack analytics.track call with userId and anonymousId resolved from the event.",in:v("product view",{timestamp:1700000100,user:{id:"us3r",session:"s3ss10n"}}),out:[["analytics.track",{userId:"us3r",anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000100)}]]},b={title:"Renamed event",description:"A mapping renames the event so the RudderStack track call uses a canonical name such as Order Completed.",in:v("order complete",{timestamp:1700000101,user:{id:"us3r",session:"s3ss10n"}}),mapping:{name:"Order Completed"},out:[["analytics.track",{userId:"us3r",anonymousId:"s3ss10n",event:"Order Completed",properties:{},timestamp:new Date(1700000101)}]]},w={title:"Destination identify",description:"Destination-level identify fires analytics.identify with traits on the first push only, then the track call follows.",in:v("page view",{timestamp:1700000102,user:{id:"us3r",session:"s3ss10n",email:"user@example.com"}}),settings:{identify:{map:{traits:{map:{email:"user.email"}}}}},out:[["analytics.identify",{userId:"us3r",anonymousId:"s3ss10n",traits:{email:"user@example.com"},timestamp:new Date(1700000102)}],["analytics.track",{userId:"us3r",anonymousId:"s3ss10n",event:"page view",properties:{},timestamp:new Date(1700000102)}]]},h={title:"User login identify",description:"A user login fires only an analytics.identify call with the resolved userId and traits, skipping the track.",in:v("user login",{timestamp:1700000103,user:{id:"us3r",session:"s3ss10n"},data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan"}}}}}},out:[["analytics.identify",{userId:"new-user-123",anonymousId:"s3ss10n",traits:{email:"user@acme.com",name:"Jane Doe",plan:"premium"},timestamp:new Date(1700000103)}]]},k={title:"Group company",description:"A company update fires analytics.group with the groupId and group traits for B2B account tracking.",in:v("company update",{timestamp:1700000104,user:{id:"us3r",session:"s3ss10n"},data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees"}}}}}},out:[["analytics.group",{userId:"us3r",anonymousId:"s3ss10n",groupId:"comp-456",traits:{name:"Acme",industry:"tech",employees:50},timestamp:new Date(1700000104)}]]},I={title:"Page view",description:"A page view fires analytics.page with a resolved page name and properties instead of a generic track.",in:v("page view",{timestamp:1700000105,user:{id:"us3r",session:"s3ss10n"},data:{title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page",{userId:"us3r",anonymousId:"s3ss10n",name:"Getting Started",properties:{section:"tutorials"},timestamp:new Date(1700000105)}]]},D={title:"Screen view",description:"A screen view from a mobile app backend fires analytics.screen with a screen name and properties.",in:v("screen view",{timestamp:1700000106,user:{id:"us3r",session:"s3ss10n"},data:{screen_name:"Welcome",section:"onboarding",build:"1.2.3"}}),mapping:{silent:!0,settings:{screen:{map:{name:"data.screen_name",properties:{map:{build:"data.build"}}}}}},out:[["analytics.screen",{userId:"us3r",anonymousId:"s3ss10n",name:"Welcome",properties:{build:"1.2.3"},timestamp:new Date(1700000106)}]]},S={title:"Alias user",description:"An identity merge fires analytics.alias to link a previous anonymous id to the newly registered user id.",in:v("identity merge",{timestamp:1700000107,user:{id:"registered-456",session:"s3ss10n"},data:{anonymous_id:"anonymous-123"}}),mapping:{silent:!0,settings:{alias:{map:{previousId:"data.anonymous_id"}}}},out:[["analytics.alias",{userId:"registered-456",previousId:"anonymous-123",timestamp:new Date(1700000107)}]]},R={title:"Anonymous only",description:"When no userId is resolved RudderStack accepts the track call keyed solely by anonymousId.",in:v("product view",{timestamp:1700000108,user:{session:"s3ss10n"}}),settings:{userId:void 0},out:[["analytics.track",{anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000108)}]]},A={public:!1,in:v("debug noise",{timestamp:1700000109,user:{id:"us3r",session:"s3ss10n"}}),mapping:{ignore:!0},out:[]};export{u as examples,t as schemas};//# sourceMappingURL=dev.mjs.map
|
|
1
|
+
import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,s=(e,s)=>{for(var i in s)t(e,i,{get:s[i],enumerable:!0})},i={};s(i,{MappingSchema:()=>l,SettingsSchema:()=>r,mapping:()=>u,settings:()=>d});import{zodToSchema as n}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var r=a.object({writeKey:a.string().min(1).describe("RudderStack source write key. Find it in the RudderStack dashboard under Sources > Setup."),dataPlaneUrl:a.string().url().describe("RudderStack data plane URL. Required. Example: https://your-data-plane.rudderstack.com"),userId:a.string().describe("walkerOS mapping value path to resolve userId from each event (like user.id).").optional(),anonymousId:a.string().describe("walkerOS mapping value path to resolve anonymousId from each event (like user.session).").optional(),path:a.string().describe("API path route (like /v1/batch).").optional(),flushAt:a.number().int().positive().describe("Events the SDK sends in one request. Each push and each config.batch batch flushes the SDK and waits until its calls are sent. Default: 20.").optional(),flushInterval:a.number().int().positive().describe("Max milliseconds before auto-flush. Default: 10000.").optional(),maxQueueSize:a.number().int().positive().describe("Maximum batch payload size in bytes. Default: 460800 (~500KB).").optional(),maxInternalQueueSize:a.number().int().positive().describe("Maximum in-memory queue length. Default: 20000.").optional(),logLevel:a.string().describe("SDK log level: 'info', 'debug', 'error', or 'silly'. Default: 'info'.").optional(),retryCount:a.number().int().min(0).describe("Retries the SDK makes for a failed request, a tenth of config.timeout apart. Default: 2, which ends within config.timeout. A value set here wins.").optional(),timeout:a.number().int().positive().describe("Time one request may take, in milliseconds. Default: a quarter of config.timeout (2500 at the 10 s default). A value set here wins.").optional(),enable:a.boolean().describe("Set to false to no-op all SDK calls. Default: true.").optional(),gzip:a.boolean().describe("Enable gzip compression for requests. Default: true.").optional(),identify:a.unknown().describe("Destination-level identity mapping. Resolves to { traits } object. Fires identify() on the first push and re-fires when values change.").optional(),group:a.unknown().describe("Destination-level group mapping. Resolves to { groupId, traits }. Fires group() on the first push and re-fires on change.").optional(),integrations:a.record(a.string(),a.unknown()).describe('Enable/disable downstream RudderStack destinations. Example: { "All": true, "Mixpanel": false }.').optional()}).strict();import{z as o}from"@walkeros/core/dev";var l=o.object({identify:o.unknown().describe("Per-event identity mapping. Resolves to { userId?, traits? }. Use with rule-level silent: true on login/identify events.").optional(),group:o.unknown().describe("Per-event group assignment. Resolves to { groupId, traits? }. Use with rule-level silent: true on company/team events.").optional(),page:o.unknown().describe("Per-event page call. Resolves to { name, properties? } or true for minimal page(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),screen:o.unknown().describe("Per-event screen call (mobile backends). Resolves to { name, properties? } or true for minimal screen(). RudderStack requires name (falls back to empty string). Use with silent: true.").optional(),alias:o.unknown().describe("Per-event alias call. Resolves to { previousId }. Links anonymous user to identified user. Use with rule-level silent: true.").optional()}),d=n(r),u=n(l),p={};s(p,{env:()=>m,step:()=>v});var m={};s(m,{push:()=>g,simulation:()=>y});var c=(e,t)=>t?.();var g={analytics:{track:c,identify:c,group:c,page:c,screen:c,alias:c,flush:()=>Promise.resolve()}},y=["call:analytics.track","call:analytics.identify","call:analytics.group","call:analytics.page","call:analytics.screen","call:analytics.alias"],v={};s(v,{aliasUser:()=>A,anonymousOnly:()=>x,companyGroup:()=>D,companyGroupWithoutData:()=>G,defaultTrack:()=>w,destinationIdentify:()=>I,mappedEventName:()=>b,noIdentityCompany:()=>E,noIdentityLogin:()=>O,noIdentityMerge:()=>z,noIdentityOrder:()=>q,noIdentityPage:()=>U,noIdentityProduct:()=>_,noIdentityScreen:()=>K,pageView:()=>S,screenView:()=>R,silentRule:()=>M,userLoginIdentify:()=>k,wildcardIgnored:()=>C});import{createEvent as f,getEvent as h}from"@walkeros/core";var w={title:"Default track",description:"A walker event becomes a RudderStack analytics.track call with userId and anonymousId resolved from the event.",in:h("product view",{id:"ev1700000100",timestamp:1700000100,user:{id:"us3r",session:"s3ss10n"}}),out:[["analytics.track",{messageId:"ev1700000100",userId:"us3r",anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000100)}]]},b={title:"Renamed event",description:"A mapping renames the event so the RudderStack track call uses a canonical name such as Order Completed.",in:h("order complete",{id:"ev1700000101",timestamp:1700000101,user:{id:"us3r",session:"s3ss10n"}}),mapping:{name:"Order Completed"},out:[["analytics.track",{messageId:"ev1700000101",userId:"us3r",anonymousId:"s3ss10n",event:"Order Completed",properties:{},timestamp:new Date(1700000101)}]]},I={title:"Destination identify",description:"Destination-level identify fires analytics.identify with traits on the first push only, then the track call follows.",in:h("page view",{id:"ev1700000102",timestamp:1700000102,user:{id:"us3r",session:"s3ss10n",email:"user@example.com"}}),settings:{identify:{map:{traits:{map:{email:"user.email"}}}}},out:[["analytics.identify",{messageId:"ev1700000102-identify",userId:"us3r",anonymousId:"s3ss10n",traits:{email:"user@example.com"},timestamp:new Date(1700000102)}],["analytics.track",{messageId:"ev1700000102",userId:"us3r",anonymousId:"s3ss10n",event:"page view",properties:{},timestamp:new Date(1700000102)}]]},k={title:"User login identify",description:"A user login fires only an analytics.identify call with the resolved userId and traits, skipping the track.",in:f({name:"user login",id:"ev1700000103",timestamp:1700000103,user:{id:"us3r",session:"s3ss10n"},data:{user_id:"new-user-123",email:"user@acme.com",name:"Jane Doe",plan:"premium"}}),mapping:{silent:!0,settings:{identify:{map:{userId:"data.user_id",traits:{map:{email:"data.email",name:"data.name",plan:"data.plan"}}}}}},out:[["analytics.identify",{messageId:"ev1700000103-identify",userId:"new-user-123",anonymousId:"s3ss10n",traits:{email:"user@acme.com",name:"Jane Doe",plan:"premium"},timestamp:new Date(1700000103)}]]},D={title:"Group company",description:"A company update fires analytics.group with the groupId and group traits for B2B account tracking.",in:f({name:"company update",id:"ev1700000104",timestamp:1700000104,user:{id:"us3r",session:"s3ss10n"},data:{company_id:"comp-456",company_name:"Acme",industry:"tech",employees:50}}),mapping:{silent:!0,settings:{group:{map:{groupId:"data.company_id",traits:{map:{name:"data.company_name",industry:"data.industry",employees:"data.employees"}}}}}},out:[["analytics.group",{messageId:"ev1700000104-group",userId:"us3r",anonymousId:"s3ss10n",groupId:"comp-456",traits:{name:"Acme",industry:"tech",employees:50},timestamp:new Date(1700000104)}]]},S={title:"Page view",description:"A page view fires analytics.page with a resolved page name and properties instead of a generic track.",in:h("page view",{id:"ev1700000105",timestamp:1700000105,user:{id:"us3r",session:"s3ss10n"},data:{title:"Getting Started",section:"tutorials"}}),mapping:{silent:!0,settings:{page:{map:{name:"data.title",properties:{map:{section:"data.section"}}}}}},out:[["analytics.page",{messageId:"ev1700000105-page",userId:"us3r",anonymousId:"s3ss10n",name:"Getting Started",properties:{section:"tutorials"},timestamp:new Date(1700000105)}]]},R={title:"Screen view",description:"A screen view from a mobile app backend fires analytics.screen with a screen name and properties.",in:f({name:"screen view",id:"ev1700000106",timestamp:1700000106,user:{id:"us3r",session:"s3ss10n"},data:{screen_name:"Welcome",section:"onboarding",build:"1.2.3"}}),mapping:{silent:!0,settings:{screen:{map:{name:"data.screen_name",properties:{map:{build:"data.build"}}}}}},out:[["analytics.screen",{messageId:"ev1700000106-screen",userId:"us3r",anonymousId:"s3ss10n",name:"Welcome",properties:{build:"1.2.3"},timestamp:new Date(1700000106)}]]},A={title:"Alias user",description:"An identity merge fires analytics.alias to link a previous anonymous id to the newly registered user id.",in:f({name:"identity merge",id:"ev1700000107",timestamp:1700000107,user:{id:"registered-456",session:"s3ss10n"},data:{anonymous_id:"anonymous-123"}}),mapping:{silent:!0,settings:{alias:{map:{previousId:"data.anonymous_id"}}}},out:[["analytics.alias",{messageId:"ev1700000107-alias",userId:"registered-456",previousId:"anonymous-123",timestamp:new Date(1700000107)}]]},x={title:"Anonymous only",description:"When no userId is resolved RudderStack accepts the track call keyed solely by anonymousId.",in:h("product view",{id:"ev1700000108",timestamp:1700000108,user:{session:"s3ss10n"}}),settings:{userId:void 0},out:[["analytics.track",{messageId:"ev1700000108",anonymousId:"s3ss10n",event:"product view",properties:{},timestamp:new Date(1700000108)}]]};function P(e,t){const[s,i]=e.split(" ");return{public:!1,description:`A ${e} event without userId or anonymousId cannot be sent to RudderStack: the push fails with missing-input instead of counting as delivered.`,in:{name:e,entity:s,action:i,timestamp:t},out:[],outcome:{status:"failed",code:"missing-input",retryable:!1}}}var _=P("product view",1700000110),q=P("order complete",1700000111),U=P("page view",1700000112),O=P("user login",1700000113),E=P("company update",1700000114),K=P("screen view",1700000115),z=P("identity merge",1700000116),M={public:!1,description:"A rule with silent: true and no identify, group, page, screen or alias mapping sends nothing to RudderStack.",in:h("page view",{timestamp:1700000117,user:{id:"us3r",session:"s3ss10n"}}),mapping:{silent:!0},out:[]},C={public:!1,in:f({name:"debug noise",timestamp:1700000109,user:{id:"us3r",session:"s3ss10n"}}),mapping:{ignore:!0},out:[]},G={public:!1,description:"A silent group rule whose groupId finds no data sends nothing: an unmet mapping, not a failure, so the push returns normally.",in:{name:"company update",entity:"company",action:"update",timestamp:1700000120,user:{id:"us3r",session:"s3ss10n"}},mapping:D.mapping,out:[]};export{p as examples,i as schemas};//# sourceMappingURL=dev.mjs.map
|