@walkeros/transformer-validate 4.2.0-next-1780942291149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +99 -0
- package/dist/dev.d.ts +99 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/index.d.mts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/dist/walkerOS.json +228 -0
- package/package.json +67 -0
package/dist/dev.d.mts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import { z } from '@walkeros/core/dev';
|
|
3
|
+
import { Flow, Hint, WalkerOS, Ingest } from '@walkeros/core';
|
|
4
|
+
|
|
5
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
6
|
+
contract: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
7
|
+
format: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
strict: "strict";
|
|
10
|
+
pass: "pass";
|
|
11
|
+
}>>;
|
|
12
|
+
output: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
isValid: z.ZodOptional<z.ZodString>;
|
|
14
|
+
errors: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type Settings = z.infer<typeof SettingsSchema>;
|
|
18
|
+
|
|
19
|
+
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
20
|
+
|
|
21
|
+
type index$1_Settings = Settings;
|
|
22
|
+
declare const index$1_SettingsSchema: typeof SettingsSchema;
|
|
23
|
+
declare const index$1_settings: typeof settings;
|
|
24
|
+
declare namespace index$1 {
|
|
25
|
+
export { type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_settings as settings };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* strict + valid: passes the contract, gets annotated source.valid:true and
|
|
30
|
+
* continues down the chain.
|
|
31
|
+
*/
|
|
32
|
+
declare const strictValidPageView: Flow.StepExample;
|
|
33
|
+
/**
|
|
34
|
+
* strict + invalid: the same contract, but data.title is missing. In strict
|
|
35
|
+
* mode the transformer stops the chain (drops). Errors are still written to the
|
|
36
|
+
* ingest for observers; the drop itself is encoded as `['return', false]`.
|
|
37
|
+
*/
|
|
38
|
+
declare const strictInvalidPageView: Flow.StepExample;
|
|
39
|
+
/**
|
|
40
|
+
* pass + invalid: same failure, but mode:'pass' annotates source.valid:false and
|
|
41
|
+
* continues. Downstream destinations route on event.source.valid. The error list
|
|
42
|
+
* is written to the ingest (default path "validation"), not asserted here.
|
|
43
|
+
*/
|
|
44
|
+
declare const passAnnotateInvalid: Flow.StepExample;
|
|
45
|
+
/**
|
|
46
|
+
* gtm filter via a contract pattern: the contract rejects names matching
|
|
47
|
+
* ^gtm\\. There is no `ignore` field; filtering is a contract that fails. In
|
|
48
|
+
* strict mode a "gtm.js" event is dropped.
|
|
49
|
+
*/
|
|
50
|
+
declare const gtmFilterDropped: Flow.StepExample;
|
|
51
|
+
/** Same gtm-filter contract, but a real "page view" passes the pattern. */
|
|
52
|
+
declare const gtmFilterPasses: Flow.StepExample;
|
|
53
|
+
|
|
54
|
+
declare const step_gtmFilterDropped: typeof gtmFilterDropped;
|
|
55
|
+
declare const step_gtmFilterPasses: typeof gtmFilterPasses;
|
|
56
|
+
declare const step_passAnnotateInvalid: typeof passAnnotateInvalid;
|
|
57
|
+
declare const step_strictInvalidPageView: typeof strictInvalidPageView;
|
|
58
|
+
declare const step_strictValidPageView: typeof strictValidPageView;
|
|
59
|
+
declare namespace step {
|
|
60
|
+
export { step_gtmFilterDropped as gtmFilterDropped, step_gtmFilterPasses as gtmFilterPasses, step_passAnnotateInvalid as passAnnotateInvalid, step_strictInvalidPageView as strictInvalidPageView, step_strictValidPageView as strictValidPageView };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare const index_step: typeof step;
|
|
64
|
+
declare namespace index {
|
|
65
|
+
export { index_step as step };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare const hints: Hint.Hints;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A single source of validation constraints.
|
|
72
|
+
*
|
|
73
|
+
* Either a resolved `$contract.*` rule (a `Flow.ContractRule` with `.events`
|
|
74
|
+
* entity-action schemas and/or a full-event `.schema`), or an inline whole-event
|
|
75
|
+
* JSON Schema applied to the entire event.
|
|
76
|
+
*/
|
|
77
|
+
type ContractSource = Flow.ContractRule | Record<string, unknown>;
|
|
78
|
+
/** A single validation issue. */
|
|
79
|
+
interface ValidationIssue {
|
|
80
|
+
path: string;
|
|
81
|
+
message: string;
|
|
82
|
+
level?: 'error' | 'warn';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The validation verdict authority. Runs the event through every applicable
|
|
87
|
+
* JSON Schema (AND semantics) and aggregates all @cfworker errors.
|
|
88
|
+
*
|
|
89
|
+
* No matching constraint (empty schema set) means no opinion: isValid is true.
|
|
90
|
+
*/
|
|
91
|
+
declare function validateEventAgainstContract(event: WalkerOS.DeepPartialEvent, _ingest: Ingest | undefined, opts: {
|
|
92
|
+
contracts?: ContractSource[];
|
|
93
|
+
format?: boolean;
|
|
94
|
+
}): {
|
|
95
|
+
isValid: boolean;
|
|
96
|
+
errors: ValidationIssue[];
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export { index as examples, hints, index$1 as schemas, validateEventAgainstContract };
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import { z } from '@walkeros/core/dev';
|
|
3
|
+
import { Flow, Hint, WalkerOS, Ingest } from '@walkeros/core';
|
|
4
|
+
|
|
5
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
6
|
+
contract: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
7
|
+
format: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
strict: "strict";
|
|
10
|
+
pass: "pass";
|
|
11
|
+
}>>;
|
|
12
|
+
output: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
isValid: z.ZodOptional<z.ZodString>;
|
|
14
|
+
errors: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type Settings = z.infer<typeof SettingsSchema>;
|
|
18
|
+
|
|
19
|
+
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
20
|
+
|
|
21
|
+
type index$1_Settings = Settings;
|
|
22
|
+
declare const index$1_SettingsSchema: typeof SettingsSchema;
|
|
23
|
+
declare const index$1_settings: typeof settings;
|
|
24
|
+
declare namespace index$1 {
|
|
25
|
+
export { type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_settings as settings };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* strict + valid: passes the contract, gets annotated source.valid:true and
|
|
30
|
+
* continues down the chain.
|
|
31
|
+
*/
|
|
32
|
+
declare const strictValidPageView: Flow.StepExample;
|
|
33
|
+
/**
|
|
34
|
+
* strict + invalid: the same contract, but data.title is missing. In strict
|
|
35
|
+
* mode the transformer stops the chain (drops). Errors are still written to the
|
|
36
|
+
* ingest for observers; the drop itself is encoded as `['return', false]`.
|
|
37
|
+
*/
|
|
38
|
+
declare const strictInvalidPageView: Flow.StepExample;
|
|
39
|
+
/**
|
|
40
|
+
* pass + invalid: same failure, but mode:'pass' annotates source.valid:false and
|
|
41
|
+
* continues. Downstream destinations route on event.source.valid. The error list
|
|
42
|
+
* is written to the ingest (default path "validation"), not asserted here.
|
|
43
|
+
*/
|
|
44
|
+
declare const passAnnotateInvalid: Flow.StepExample;
|
|
45
|
+
/**
|
|
46
|
+
* gtm filter via a contract pattern: the contract rejects names matching
|
|
47
|
+
* ^gtm\\. There is no `ignore` field; filtering is a contract that fails. In
|
|
48
|
+
* strict mode a "gtm.js" event is dropped.
|
|
49
|
+
*/
|
|
50
|
+
declare const gtmFilterDropped: Flow.StepExample;
|
|
51
|
+
/** Same gtm-filter contract, but a real "page view" passes the pattern. */
|
|
52
|
+
declare const gtmFilterPasses: Flow.StepExample;
|
|
53
|
+
|
|
54
|
+
declare const step_gtmFilterDropped: typeof gtmFilterDropped;
|
|
55
|
+
declare const step_gtmFilterPasses: typeof gtmFilterPasses;
|
|
56
|
+
declare const step_passAnnotateInvalid: typeof passAnnotateInvalid;
|
|
57
|
+
declare const step_strictInvalidPageView: typeof strictInvalidPageView;
|
|
58
|
+
declare const step_strictValidPageView: typeof strictValidPageView;
|
|
59
|
+
declare namespace step {
|
|
60
|
+
export { step_gtmFilterDropped as gtmFilterDropped, step_gtmFilterPasses as gtmFilterPasses, step_passAnnotateInvalid as passAnnotateInvalid, step_strictInvalidPageView as strictInvalidPageView, step_strictValidPageView as strictValidPageView };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare const index_step: typeof step;
|
|
64
|
+
declare namespace index {
|
|
65
|
+
export { index_step as step };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare const hints: Hint.Hints;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A single source of validation constraints.
|
|
72
|
+
*
|
|
73
|
+
* Either a resolved `$contract.*` rule (a `Flow.ContractRule` with `.events`
|
|
74
|
+
* entity-action schemas and/or a full-event `.schema`), or an inline whole-event
|
|
75
|
+
* JSON Schema applied to the entire event.
|
|
76
|
+
*/
|
|
77
|
+
type ContractSource = Flow.ContractRule | Record<string, unknown>;
|
|
78
|
+
/** A single validation issue. */
|
|
79
|
+
interface ValidationIssue {
|
|
80
|
+
path: string;
|
|
81
|
+
message: string;
|
|
82
|
+
level?: 'error' | 'warn';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The validation verdict authority. Runs the event through every applicable
|
|
87
|
+
* JSON Schema (AND semantics) and aggregates all @cfworker errors.
|
|
88
|
+
*
|
|
89
|
+
* No matching constraint (empty schema set) means no opinion: isValid is true.
|
|
90
|
+
*/
|
|
91
|
+
declare function validateEventAgainstContract(event: WalkerOS.DeepPartialEvent, _ingest: Ingest | undefined, opts: {
|
|
92
|
+
contracts?: ContractSource[];
|
|
93
|
+
format?: boolean;
|
|
94
|
+
}): {
|
|
95
|
+
isValid: boolean;
|
|
96
|
+
errors: ValidationIssue[];
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export { index as examples, hints, index$1 as schemas, validateEventAgainstContract };
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e,t=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,s=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,a=(e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})},p=(e,t,s,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let p of n(t))o.call(e,p)||p===s||r(e,p,{get:()=>t[p],enumerable:!(a=i(t,p))||a.enumerable});return e},l={};a(l,{examples:()=>f,hints:()=>S,schemas:()=>c,validateEventAgainstContract:()=>N}),module.exports=(e=l,p(r({},"__esModule",{value:!0}),e));var c={};a(c,{SettingsSchema:()=>u,settings:()=>g});var d=require("@walkeros/core/dev"),y=require("@walkeros/core/dev"),u=y.z.object({contract:y.z.array(y.z.record(y.z.string(),y.z.unknown())).optional().describe("Validation constraints. Each entry is a resolved $contract.* rule (with entity-action `events` schemas and/or a full-event `schema`) or an inline whole-event JSON Schema. All entries are AND-ed; every error is aggregated."),format:y.z.boolean().optional().describe("When true, also validate the canonical WalkerOS.Event structural shape (correct field types, no unknown fields). All fields are optional, so this checks structure and types, not presence."),mode:y.z.enum(["strict","pass"]).optional().describe("`strict` drops invalid events (chain-stop) after recording errors; `pass` annotates and continues. Default `pass`."),output:y.z.object({isValid:y.z.string().optional().describe("Event dot-path for the boolean verdict. Default `source.valid`. Empty string = skip."),errors:y.z.string().optional().describe("Ingest dot-path for the issue list. Default `validation`. Empty string = skip.")}).optional().describe("Where the verdict (on the event) and the issue list (on the ingest) are written.")}).describe("Validate transformer: checks events against JSON Schema contracts and annotates a verdict on the event plus issues on the ingest."),g=(0,d.zodToSchema)(u),f={};a(f,{step:()=>m});var m={};a(m,{gtmFilterDropped:()=>b,gtmFilterPasses:()=>w,passAnnotateInvalid:()=>O,strictInvalidPageView:()=>h,strictValidPageView:()=>v});var v={title:"Strict validate against a contract (valid)",description:'A "page view" with the required data.title passes the inline contract. The verdict source.valid:true is written to the event; the chain continues.',in:{name:"page view",entity:"page",action:"view",data:{title:"Home"}},out:[["return",{event:{name:"page view",entity:"page",action:"view",data:{title:"Home"},source:{valid:!0}}}]]},h={public:!1,title:"Strict validate against a contract (invalid, dropped)",description:'A "page view" missing the required data.title fails the contract. In strict mode the chain stops (event dropped). Validation errors are still written to the ingest for observers.',in:{name:"page view",entity:"page",action:"view",data:{}},out:[["return",!1]]},O={public:!1,title:"Pass mode annotates an invalid event",description:'In mode:"pass" an invalid event is not dropped: source.valid:false is written to the event so downstream destinations can route on it, and the error list is written to the ingest path "validation".',in:{name:"page view",entity:"page",action:"view",data:{}},out:[["return",{event:{name:"page view",entity:"page",action:"view",data:{},source:{valid:!1}}}]]},b={public:!1,title:"Filter gtm.* via a contract pattern (dropped)",description:'A contract whose name must NOT match ^gtm\\. rejects "gtm.js". In strict mode the event is dropped. This is how you filter without an "ignore" field.',in:{name:"gtm.js"},out:[["return",!1]]},w={title:"Filter gtm.* via a contract pattern (real event passes)",description:'The same ^gtm\\. rejection contract leaves a real "page view" untouched: it passes and is annotated source.valid:true.',in:{name:"page view",entity:"page",action:"view"},out:[["return",{event:{name:"page view",entity:"page",action:"view",source:{valid:!0}}}]]},S={"contract-resolution":{text:"A $contract.* reference is resolved to a concrete JSON Schema at bundle time. The runtime transformer never sees a string: by the time push runs, settings.contract holds resolved ContractRule objects (entity-action event schemas and/or a full-event schema) or inline schemas. If you author a flow with $contract.web, the bundler inlines the matching schema before deploy.",code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{contract:["$contract.web"],mode:"strict"}}}}},null,2)}]},"mode-strict-vs-pass":{text:'mode:"strict" drops invalid events by stopping the transformer chain (push returns false), so they never reach downstream destinations. mode:"pass" (the default) never drops: it annotates the event with the verdict and continues, and you route downstream on event.source.valid. Use strict to enforce a contract as a hard gate; use pass to observe quality without losing data.',code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{contract:["$contract.web"],mode:"pass"}}}}},null,2)}]},"output-split":{text:"The verdict and the error list are written to two different places by design. The boolean verdict goes to the EVENT (default path source.valid): it is analytics-grade data that travels with the event to destinations, and source.valid stays type-clean under WalkerOS.Source. The error list goes to the INGEST (default path validation): it is observer-visible pipeline diagnostics, never analytics data, written in place so it survives even a strict-mode drop. Override either path via output.isValid / output.errors; set either to an empty string to skip that write.",code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{contract:["$contract.web"],output:{isValid:"source.valid",errors:"validation"}}}}}},null,2)}]},"format-vs-contract":{text:'format:true is a built-in structural check, not an authored schema. It validates the canonical WalkerOS.Event shape (correct field types, no unknown fields). All fields are optional, so it checks structure and types, not presence: a wrong-typed field or malformed structure fails, a missing field does not. It is independent of contract: turn it on to catch malformed events even when you have no contract, or alongside a contract to AND both checks. A contract is the place for your domain rules; format is the place for "is this even a well-formed event".',code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{format:!0,mode:"pass"}}}}},null,2)}]},"gtm-filtering":{text:'There is no ignore field. To filter unwanted events (for example GTM lifecycle pings like gtm.js / gtm.dom), author a contract that REJECTS them and run mode:"strict". A schema where name must NOT match ^gtm\\. fails those events, and strict mode drops them while real events pass. This keeps filtering declarative and contract-driven rather than a separate ad-hoc list.',code:[{lang:"json",code:JSON.stringify({type:"object",properties:{name:{not:{pattern:"^gtm\\."}}}},null,2)}]},"known-limitations":{text:'The errors list may contain an extra parent entry pointing at a properties wrapper per failure, a quirk of the underlying JSON Schema engine output. The isValid verdict is unaffected: a single real failure can surface as more than one error entry, but isValid is still false exactly when there is at least one failure. v1 emits level:"error" only (no warn level yet).'}},k=((e,i,n)=>(n=null!=e?t(s(e)):{},p(!i&&e&&e.__esModule?n:r(n,"default",{value:e,enumerable:!0}),e)))(require("@cfworker/json-schema")),P=Object.freeze({$schema:"http://json-schema.org/draft-07/schema#",description:"Partial event structure with all fields optional",allOf:[{$ref:"#/definitions/WalkerOSPartialEvent"}],definitions:{WalkerOSProperty:{title:"WalkerOS.Property",description:"PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays.",anyOf:[{$ref:"#/definitions/WalkerOSPropertyType"},{type:"array",items:{$ref:"#/definitions/WalkerOSPropertyType"}}]},WalkerOSPropertyType:{title:"WalkerOS.PropertyType",description:"Base property value types (boolean, string, number, or nested Property record).",anyOf:[{type:"boolean"},{type:"string"},{type:"number"},{type:"object",propertyNames:{type:"string"},additionalProperties:{$ref:"#/definitions/WalkerOSProperty"}}]},WalkerOSProperties:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Flexible property collection with optional values."},WalkerOSOrderedProperties:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"array",items:[{$ref:"#/definitions/WalkerOSProperty"},{type:"number"}]},title:"WalkerOS.OrderedProperties",description:"Ordered properties with [value, order] tuples for priority control."},WalkerOSUser:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{id:{description:"User identifier",type:"string"},device:{description:"Device identifier",type:"string"},session:{description:"Session identifier",type:"string"},hash:{description:"Hashed identifier",type:"string"},address:{description:"User address",type:"string"},email:{description:"User email address",type:"string",format:"email",pattern:"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},phone:{description:"User phone number",type:"string"},userAgent:{description:"Browser user agent string",type:"string"},browser:{description:"Browser name",type:"string"},browserVersion:{description:"Browser version",type:"string"},deviceType:{description:"Device type (mobile, desktop, tablet)",type:"string"},os:{description:"Operating system",type:"string"},osVersion:{description:"Operating system version",type:"string"},screenSize:{description:"Screen dimensions",type:"string"},language:{description:"User language",type:"string"},country:{description:"User country",type:"string"},region:{description:"User region/state",type:"string"},city:{description:"User city",type:"string"},zip:{description:"User postal code",type:"string"},timezone:{description:"User timezone",type:"string"},ip:{description:"User IP address",type:"string"},internal:{description:"Internal user flag (employee, test user)",type:"boolean"}},additionalProperties:!1}],title:"WalkerOS.User",description:"User identification and attributes."},__schema0:{description:"Nested entity structure with recursive nesting support",$ref:"#/definitions/WalkerOSEntity"},WalkerOSEntity:{title:"WalkerOS.Entity",description:"Nested entity structure with recursive nesting support.",type:"object",properties:{entity:{type:"string",description:"Entity name"},data:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Entity-specific properties",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},nested:{description:"Nested child entities",type:"array",items:{$ref:"#/definitions/__schema0"}},context:{description:"Entity context data",allOf:[{$ref:"#/definitions/WalkerOSOrderedProperties"}]}},required:["entity","data"],additionalProperties:!1},WalkerOSEntities:{type:"array",items:{$ref:"#/definitions/__schema0"},title:"WalkerOS.Entities",description:"Array of nested entities."},WalkerOSConsent:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"boolean"},title:"WalkerOS.Consent",description:"Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied."},WalkerOSSource:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{type:{type:"string",description:"Source kind (browser, dataLayer, gtag, ...)"},platform:{description:"Runtime platform (web, server, app, ios, android, terminal, ...)",type:"string"},version:{description:"Deployment version of the source emitter",type:"string"},schema:{description:'Event model spec version (collector defaults to "4")',type:"string"},count:{description:"Emission sequence per run",type:"integer",minimum:0,maximum:9007199254740991},trace:{description:"W3C traceparent full string",type:"string"},url:{type:"string"},referrer:{type:"string"},tool:{type:"string"},command:{type:"string"}},required:["type"],additionalProperties:!1}],title:"WalkerOS.Source",description:"Event source information (origin of the event)."},WalkerOSPartialEvent:{type:"object",properties:{name:{type:"string",description:'Event name in "entity action" format (e.g., "page view", "product add")'},data:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Event-specific properties",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},context:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"array",items:[{$ref:"#/definitions/WalkerOSProperty"},{type:"number"}]},title:"WalkerOS.OrderedProperties",description:"Ordered context properties with priorities",allOf:[{$ref:"#/definitions/WalkerOSOrderedProperties"}]},globals:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Global properties shared across events",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},custom:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Custom implementation-specific properties",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},user:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{id:{description:"User identifier",type:"string"},device:{description:"Device identifier",type:"string"},session:{description:"Session identifier",type:"string"},hash:{description:"Hashed identifier",type:"string"},address:{description:"User address",type:"string"},email:{description:"User email address",type:"string",format:"email",pattern:"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},phone:{description:"User phone number",type:"string"},userAgent:{description:"Browser user agent string",type:"string"},browser:{description:"Browser name",type:"string"},browserVersion:{description:"Browser version",type:"string"},deviceType:{description:"Device type (mobile, desktop, tablet)",type:"string"},os:{description:"Operating system",type:"string"},osVersion:{description:"Operating system version",type:"string"},screenSize:{description:"Screen dimensions",type:"string"},language:{description:"User language",type:"string"},country:{description:"User country",type:"string"},region:{description:"User region/state",type:"string"},city:{description:"User city",type:"string"},zip:{description:"User postal code",type:"string"},timezone:{description:"User timezone",type:"string"},ip:{description:"User IP address",type:"string"},internal:{description:"Internal user flag (employee, test user)",type:"boolean"}},additionalProperties:!1}],title:"WalkerOS.User",description:"User identification and attributes"},nested:{type:"array",items:{$ref:"#/definitions/__schema0"},title:"WalkerOS.Entities",description:"Related nested entities",allOf:[{$ref:"#/definitions/WalkerOSEntities"}]},consent:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"boolean"},title:"WalkerOS.Consent",description:"Consent states at event time",allOf:[{$ref:"#/definitions/WalkerOSConsent"}]},id:{type:"string",minLength:1,description:"W3C span_id, 16 lowercase hex characters"},trigger:{type:"string",description:"Event trigger identifier"},entity:{type:"string",description:"Parsed entity from event name"},action:{type:"string",description:"Parsed action from event name"},timestamp:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991,description:"Unix timestamp in milliseconds since epoch"},timing:{type:"number",description:"Event processing timing information"},source:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{type:{type:"string",description:"Source kind (browser, dataLayer, gtag, ...)"},platform:{description:"Runtime platform (web, server, app, ios, android, terminal, ...)",type:"string"},version:{description:"Deployment version of the source emitter",type:"string"},schema:{description:'Event model spec version (collector defaults to "4")',type:"string"},count:{description:"Emission sequence per run",type:"integer",minimum:0,maximum:9007199254740991},trace:{description:"W3C traceparent full string",type:"string"},url:{type:"string"},referrer:{type:"string"},tool:{type:"string"},command:{type:"string"}},required:["type"],additionalProperties:!1}],title:"WalkerOS.Source",description:"Event source information"}},additionalProperties:!1,title:"WalkerOS.PartialEvent",description:"Partial event structure with all fields optional."}}}),W=new Map;function j(e){const t=JSON.stringify(e),r=W.get(t);if(r)return r;const i=JSON.parse(t),n=new k.Validator(i,"2020-12");return W.set(t,n),n}function $(e){return"object"==typeof e&&null!==e&&"events"in e&&"object"==typeof e.events}function E(e,t,r){return e[t]?.[r]??e[t]?.["*"]??e["*"]?.[r]??e["*"]?.["*"]}function N(e,t,r){const i=function(e,t){const r=[];t.format&&r.push(P);for(const i of t.contracts??[])if($(i)){const t="string"==typeof e.entity?e.entity:"",n="string"==typeof e.action?e.action:"",s=E(i.events??{},t,n);s&&r.push(s),i.schema&&r.push(i.schema)}else r.push(i);return r}(e,r),n=[];for(const t of i){const r=j(t).validate(e);if(!r.valid)for(const e of r.errors)n.push({path:e.instanceLocation,message:e.error,level:"error"})}return{isValid:0===n.length,errors:n}}//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/hints.ts","../src/validate.ts","../src/event-format.schema.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\nexport { hints } from './hints';\nexport { validateEventAgainstContract } from './validate';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n contract: z\n .array(z.record(z.string(), z.unknown()))\n .optional()\n .describe(\n 'Validation constraints. Each entry is a resolved $contract.* rule (with entity-action `events` schemas and/or a full-event `schema`) or an inline whole-event JSON Schema. All entries are AND-ed; every error is aggregated.',\n ),\n format: z\n .boolean()\n .optional()\n .describe(\n 'When true, also validate the canonical WalkerOS.Event structural shape (correct field types, no unknown fields). All fields are optional, so this checks structure and types, not presence.',\n ),\n mode: z\n .enum(['strict', 'pass'])\n .optional()\n .describe(\n '`strict` drops invalid events (chain-stop) after recording errors; `pass` annotates and continues. Default `pass`.',\n ),\n output: z\n .object({\n isValid: z\n .string()\n .optional()\n .describe(\n 'Event dot-path for the boolean verdict. Default `source.valid`. Empty string = skip.',\n ),\n errors: z\n .string()\n .optional()\n .describe(\n 'Ingest dot-path for the issue list. Default `validation`. Empty string = skip.',\n ),\n })\n .optional()\n .describe(\n 'Where the verdict (on the event) and the issue list (on the ingest) are written.',\n ),\n })\n .describe(\n 'Validate transformer: checks events against JSON Schema contracts and annotates a verdict on the event plus issues on the ingest.',\n );\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\n","import type { Flow } from '@walkeros/core';\n\n/**\n * strict + valid: passes the contract, gets annotated source.valid:true and\n * continues down the chain.\n */\nexport const strictValidPageView: Flow.StepExample = {\n title: 'Strict validate against a contract (valid)',\n description:\n 'A \"page view\" with the required data.title passes the inline contract. The verdict source.valid:true is written to the event; the chain continues.',\n in: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: { title: 'Home' },\n },\n out: [\n [\n 'return',\n {\n event: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: { title: 'Home' },\n source: { valid: true },\n },\n },\n ],\n ],\n};\n\n/**\n * strict + invalid: the same contract, but data.title is missing. In strict\n * mode the transformer stops the chain (drops). Errors are still written to the\n * ingest for observers; the drop itself is encoded as `['return', false]`.\n */\nexport const strictInvalidPageView: Flow.StepExample = {\n public: false,\n title: 'Strict validate against a contract (invalid, dropped)',\n description:\n 'A \"page view\" missing the required data.title fails the contract. In strict mode the chain stops (event dropped). Validation errors are still written to the ingest for observers.',\n in: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: {},\n },\n out: [['return', false]],\n};\n\n/**\n * pass + invalid: same failure, but mode:'pass' annotates source.valid:false and\n * continues. Downstream destinations route on event.source.valid. The error list\n * is written to the ingest (default path \"validation\"), not asserted here.\n */\nexport const passAnnotateInvalid: Flow.StepExample = {\n public: false,\n title: 'Pass mode annotates an invalid event',\n description:\n 'In mode:\"pass\" an invalid event is not dropped: source.valid:false is written to the event so downstream destinations can route on it, and the error list is written to the ingest path \"validation\".',\n in: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: {},\n },\n out: [\n [\n 'return',\n {\n event: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: {},\n source: { valid: false },\n },\n },\n ],\n ],\n};\n\n/**\n * gtm filter via a contract pattern: the contract rejects names matching\n * ^gtm\\\\. There is no `ignore` field; filtering is a contract that fails. In\n * strict mode a \"gtm.js\" event is dropped.\n */\nexport const gtmFilterDropped: Flow.StepExample = {\n public: false,\n title: 'Filter gtm.* via a contract pattern (dropped)',\n description:\n 'A contract whose name must NOT match ^gtm\\\\. rejects \"gtm.js\". In strict mode the event is dropped. This is how you filter without an \"ignore\" field.',\n in: { name: 'gtm.js' },\n out: [['return', false]],\n};\n\n/** Same gtm-filter contract, but a real \"page view\" passes the pattern. */\nexport const gtmFilterPasses: Flow.StepExample = {\n title: 'Filter gtm.* via a contract pattern (real event passes)',\n description:\n 'The same ^gtm\\\\. rejection contract leaves a real \"page view\" untouched: it passes and is annotated source.valid:true.',\n in: { name: 'page view', entity: 'page', action: 'view' },\n out: [\n [\n 'return',\n {\n event: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n source: { valid: true },\n },\n },\n ],\n ],\n};\n","import type { Hint } from '@walkeros/core';\n\nexport const hints: Hint.Hints = {\n 'contract-resolution': {\n text: 'A $contract.* reference is resolved to a concrete JSON Schema at bundle time. The runtime transformer never sees a string: by the time push runs, settings.contract holds resolved ContractRule objects (entity-action event schemas and/or a full-event schema) or inline schemas. If you author a flow with $contract.web, the bundler inlines the matching schema before deploy.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: {\n settings: {\n contract: ['$contract.web'],\n mode: 'strict',\n },\n },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'mode-strict-vs-pass': {\n text: 'mode:\"strict\" drops invalid events by stopping the transformer chain (push returns false), so they never reach downstream destinations. mode:\"pass\" (the default) never drops: it annotates the event with the verdict and continues, and you route downstream on event.source.valid. Use strict to enforce a contract as a hard gate; use pass to observe quality without losing data.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: {\n settings: { contract: ['$contract.web'], mode: 'pass' },\n },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'output-split': {\n text: 'The verdict and the error list are written to two different places by design. The boolean verdict goes to the EVENT (default path source.valid): it is analytics-grade data that travels with the event to destinations, and source.valid stays type-clean under WalkerOS.Source. The error list goes to the INGEST (default path validation): it is observer-visible pipeline diagnostics, never analytics data, written in place so it survives even a strict-mode drop. Override either path via output.isValid / output.errors; set either to an empty string to skip that write.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: {\n settings: {\n contract: ['$contract.web'],\n output: { isValid: 'source.valid', errors: 'validation' },\n },\n },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'format-vs-contract': {\n text: 'format:true is a built-in structural check, not an authored schema. It validates the canonical WalkerOS.Event shape (correct field types, no unknown fields). All fields are optional, so it checks structure and types, not presence: a wrong-typed field or malformed structure fails, a missing field does not. It is independent of contract: turn it on to catch malformed events even when you have no contract, or alongside a contract to AND both checks. A contract is the place for your domain rules; format is the place for \"is this even a well-formed event\".',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: { settings: { format: true, mode: 'pass' } },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'gtm-filtering': {\n text: 'There is no ignore field. To filter unwanted events (for example GTM lifecycle pings like gtm.js / gtm.dom), author a contract that REJECTS them and run mode:\"strict\". A schema where name must NOT match ^gtm\\\\. fails those events, and strict mode drops them while real events pass. This keeps filtering declarative and contract-driven rather than a separate ad-hoc list.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n type: 'object',\n properties: { name: { not: { pattern: '^gtm\\\\.' } } },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'known-limitations': {\n text: 'The errors list may contain an extra parent entry pointing at a properties wrapper per failure, a quirk of the underlying JSON Schema engine output. The isValid verdict is unaffected: a single real failure can surface as more than one error entry, but isValid is still false exactly when there is at least one failure. v1 emits level:\"error\" only (no warn level yet).',\n },\n};\n","import type { Flow, Ingest, ValidateEvents, WalkerOS } from '@walkeros/core';\nimport * as cfworker from '@cfworker/json-schema';\nimport type { ContractSource, ValidationIssue } from './types';\nimport { eventFormatSchema } from './event-format.schema';\n\n/**\n * Module-level Validator cache keyed by the compact JSON of the schema.\n *\n * A plain Map (not WeakMap): schemas are re-cloned per flow load, so identical\n * structures arrive as distinct object references. Keying on serialized content\n * lets repeated pushes within and across loads share one compiled interpreter.\n */\nconst validatorCache = new Map<string, cfworker.Validator>();\n\nexport function getValidator(\n schema: Record<string, unknown>,\n): cfworker.Validator {\n const key = JSON.stringify(schema);\n const cached = validatorCache.get(key);\n if (cached) return cached;\n // cfworker dereferences $ref by annotating each subschema in place\n // (e.g. __absolute_uri__). Parse a fresh mutable copy from the cache key so a\n // frozen input (the generated eventFormatSchema) stays untouched.\n const mutable = JSON.parse(key) as Record<string, unknown>;\n // Pin draft 2020-12 (the contract authoring draft).\n const validator = new cfworker.Validator(mutable, '2020-12');\n validatorCache.set(key, validator);\n return validator;\n}\n\nfunction isContractRule(source: ContractSource): source is Flow.ContractRule {\n return (\n typeof source === 'object' &&\n source !== null &&\n 'events' in source &&\n typeof (source as { events?: unknown }).events === 'object'\n );\n}\n\n/**\n * Selects the entity-action schema with the documented wildcard fallback:\n * entity.action → entity.* → *.action → *.*.\n */\nfunction selectEventSchema(\n events: ValidateEvents,\n entity: string,\n action: string,\n): Record<string, unknown> | undefined {\n return (\n events[entity]?.[action] ??\n events[entity]?.['*'] ??\n events['*']?.[action] ??\n events['*']?.['*']\n );\n}\n\n/** Collects every JSON Schema that applies to this event. */\nfunction collectSchemas(\n event: WalkerOS.DeepPartialEvent,\n opts: { contracts?: ContractSource[]; format?: boolean },\n): Record<string, unknown>[] {\n const schemas: Record<string, unknown>[] = [];\n\n if (opts.format) schemas.push(eventFormatSchema);\n\n for (const source of opts.contracts ?? []) {\n if (isContractRule(source)) {\n const entity = typeof event.entity === 'string' ? event.entity : '';\n const action = typeof event.action === 'string' ? event.action : '';\n const selected = selectEventSchema(source.events ?? {}, entity, action);\n if (selected) schemas.push(selected);\n if (source.schema) schemas.push(source.schema);\n } else {\n // Inline whole-event JSON Schema.\n schemas.push(source);\n }\n }\n\n return schemas;\n}\n\n/**\n * The validation verdict authority. Runs the event through every applicable\n * JSON Schema (AND semantics) and aggregates all @cfworker errors.\n *\n * No matching constraint (empty schema set) means no opinion: isValid is true.\n */\nexport function validateEventAgainstContract(\n event: WalkerOS.DeepPartialEvent,\n _ingest: Ingest | undefined,\n opts: { contracts?: ContractSource[]; format?: boolean },\n): { isValid: boolean; errors: ValidationIssue[] } {\n const schemas = collectSchemas(event, opts);\n\n const errors: ValidationIssue[] = [];\n for (const schema of schemas) {\n const result = getValidator(schema).validate(event);\n if (!result.valid) {\n for (const unit of result.errors) {\n errors.push({\n path: unit.instanceLocation,\n message: unit.error,\n level: 'error',\n });\n }\n }\n }\n\n return { isValid: errors.length === 0, errors };\n}\n","// GENERATED by scripts/generate-format-schema.mjs: DO NOT EDIT.\n// Source: @walkeros/core partialEventJsonSchema (canonical zod EventSchema).\n// `format: true` validates that the value is a valid WalkerOS.PartialEvent:\n// the canonical event structure with all fields optional, so it checks shape\n// and field types, not presence. Required-field enforcement is the contract\n// arm's job (events/schema with required).\n// Regenerate: npm run generate:format-schema\n\nexport const eventFormatSchema = Object.freeze({\n $schema: 'http://json-schema.org/draft-07/schema#',\n description: 'Partial event structure with all fields optional',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSPartialEvent',\n },\n ],\n definitions: {\n WalkerOSProperty: {\n title: 'WalkerOS.Property',\n description:\n 'PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays.',\n anyOf: [\n {\n $ref: '#/definitions/WalkerOSPropertyType',\n },\n {\n type: 'array',\n items: {\n $ref: '#/definitions/WalkerOSPropertyType',\n },\n },\n ],\n },\n WalkerOSPropertyType: {\n title: 'WalkerOS.PropertyType',\n description:\n 'Base property value types (boolean, string, number, or nested Property record).',\n anyOf: [\n {\n type: 'boolean',\n },\n {\n type: 'string',\n },\n {\n type: 'number',\n },\n {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n $ref: '#/definitions/WalkerOSProperty',\n },\n },\n ],\n },\n WalkerOSProperties: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Flexible property collection with optional values.',\n },\n WalkerOSOrderedProperties: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'array',\n items: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n {\n type: 'number',\n },\n ],\n },\n title: 'WalkerOS.OrderedProperties',\n description:\n 'Ordered properties with [value, order] tuples for priority control.',\n },\n WalkerOSUser: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n id: {\n description: 'User identifier',\n type: 'string',\n },\n device: {\n description: 'Device identifier',\n type: 'string',\n },\n session: {\n description: 'Session identifier',\n type: 'string',\n },\n hash: {\n description: 'Hashed identifier',\n type: 'string',\n },\n address: {\n description: 'User address',\n type: 'string',\n },\n email: {\n description: 'User email address',\n type: 'string',\n format: 'email',\n pattern:\n \"^(?!\\\\.)(?!.*\\\\.\\\\.)([A-Za-z0-9_'+\\\\-\\\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\\\-]*\\\\.)+[A-Za-z]{2,}$\",\n },\n phone: {\n description: 'User phone number',\n type: 'string',\n },\n userAgent: {\n description: 'Browser user agent string',\n type: 'string',\n },\n browser: {\n description: 'Browser name',\n type: 'string',\n },\n browserVersion: {\n description: 'Browser version',\n type: 'string',\n },\n deviceType: {\n description: 'Device type (mobile, desktop, tablet)',\n type: 'string',\n },\n os: {\n description: 'Operating system',\n type: 'string',\n },\n osVersion: {\n description: 'Operating system version',\n type: 'string',\n },\n screenSize: {\n description: 'Screen dimensions',\n type: 'string',\n },\n language: {\n description: 'User language',\n type: 'string',\n },\n country: {\n description: 'User country',\n type: 'string',\n },\n region: {\n description: 'User region/state',\n type: 'string',\n },\n city: {\n description: 'User city',\n type: 'string',\n },\n zip: {\n description: 'User postal code',\n type: 'string',\n },\n timezone: {\n description: 'User timezone',\n type: 'string',\n },\n ip: {\n description: 'User IP address',\n type: 'string',\n },\n internal: {\n description: 'Internal user flag (employee, test user)',\n type: 'boolean',\n },\n },\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.User',\n description: 'User identification and attributes.',\n },\n __schema0: {\n description: 'Nested entity structure with recursive nesting support',\n $ref: '#/definitions/WalkerOSEntity',\n },\n WalkerOSEntity: {\n title: 'WalkerOS.Entity',\n description: 'Nested entity structure with recursive nesting support.',\n type: 'object',\n properties: {\n entity: {\n type: 'string',\n description: 'Entity name',\n },\n data: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Entity-specific properties',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n nested: {\n description: 'Nested child entities',\n type: 'array',\n items: {\n $ref: '#/definitions/__schema0',\n },\n },\n context: {\n description: 'Entity context data',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSOrderedProperties',\n },\n ],\n },\n },\n required: ['entity', 'data'],\n additionalProperties: false,\n },\n WalkerOSEntities: {\n type: 'array',\n items: {\n $ref: '#/definitions/__schema0',\n },\n title: 'WalkerOS.Entities',\n description: 'Array of nested entities.',\n },\n WalkerOSConsent: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'boolean',\n },\n title: 'WalkerOS.Consent',\n description:\n 'Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied.',\n },\n WalkerOSSource: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'Source kind (browser, dataLayer, gtag, ...)',\n },\n platform: {\n description:\n 'Runtime platform (web, server, app, ios, android, terminal, ...)',\n type: 'string',\n },\n version: {\n description: 'Deployment version of the source emitter',\n type: 'string',\n },\n schema: {\n description:\n 'Event model spec version (collector defaults to \"4\")',\n type: 'string',\n },\n count: {\n description: 'Emission sequence per run',\n type: 'integer',\n minimum: 0,\n maximum: 9007199254740991,\n },\n trace: {\n description: 'W3C traceparent full string',\n type: 'string',\n },\n url: {\n type: 'string',\n },\n referrer: {\n type: 'string',\n },\n tool: {\n type: 'string',\n },\n command: {\n type: 'string',\n },\n },\n required: ['type'],\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.Source',\n description: 'Event source information (origin of the event).',\n },\n WalkerOSPartialEvent: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description:\n 'Event name in \"entity action\" format (e.g., \"page view\", \"product add\")',\n },\n data: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Event-specific properties',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n context: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'array',\n items: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n {\n type: 'number',\n },\n ],\n },\n title: 'WalkerOS.OrderedProperties',\n description: 'Ordered context properties with priorities',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSOrderedProperties',\n },\n ],\n },\n globals: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Global properties shared across events',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n custom: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Custom implementation-specific properties',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n user: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n id: {\n description: 'User identifier',\n type: 'string',\n },\n device: {\n description: 'Device identifier',\n type: 'string',\n },\n session: {\n description: 'Session identifier',\n type: 'string',\n },\n hash: {\n description: 'Hashed identifier',\n type: 'string',\n },\n address: {\n description: 'User address',\n type: 'string',\n },\n email: {\n description: 'User email address',\n type: 'string',\n format: 'email',\n pattern:\n \"^(?!\\\\.)(?!.*\\\\.\\\\.)([A-Za-z0-9_'+\\\\-\\\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\\\-]*\\\\.)+[A-Za-z]{2,}$\",\n },\n phone: {\n description: 'User phone number',\n type: 'string',\n },\n userAgent: {\n description: 'Browser user agent string',\n type: 'string',\n },\n browser: {\n description: 'Browser name',\n type: 'string',\n },\n browserVersion: {\n description: 'Browser version',\n type: 'string',\n },\n deviceType: {\n description: 'Device type (mobile, desktop, tablet)',\n type: 'string',\n },\n os: {\n description: 'Operating system',\n type: 'string',\n },\n osVersion: {\n description: 'Operating system version',\n type: 'string',\n },\n screenSize: {\n description: 'Screen dimensions',\n type: 'string',\n },\n language: {\n description: 'User language',\n type: 'string',\n },\n country: {\n description: 'User country',\n type: 'string',\n },\n region: {\n description: 'User region/state',\n type: 'string',\n },\n city: {\n description: 'User city',\n type: 'string',\n },\n zip: {\n description: 'User postal code',\n type: 'string',\n },\n timezone: {\n description: 'User timezone',\n type: 'string',\n },\n ip: {\n description: 'User IP address',\n type: 'string',\n },\n internal: {\n description: 'Internal user flag (employee, test user)',\n type: 'boolean',\n },\n },\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.User',\n description: 'User identification and attributes',\n },\n nested: {\n type: 'array',\n items: {\n $ref: '#/definitions/__schema0',\n },\n title: 'WalkerOS.Entities',\n description: 'Related nested entities',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSEntities',\n },\n ],\n },\n consent: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'boolean',\n },\n title: 'WalkerOS.Consent',\n description: 'Consent states at event time',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSConsent',\n },\n ],\n },\n id: {\n type: 'string',\n minLength: 1,\n description: 'W3C span_id, 16 lowercase hex characters',\n },\n trigger: {\n type: 'string',\n description: 'Event trigger identifier',\n },\n entity: {\n type: 'string',\n description: 'Parsed entity from event name',\n },\n action: {\n type: 'string',\n description: 'Parsed action from event name',\n },\n timestamp: {\n type: 'integer',\n exclusiveMinimum: 0,\n maximum: 9007199254740991,\n description: 'Unix timestamp in milliseconds since epoch',\n },\n timing: {\n type: 'number',\n description: 'Event processing timing information',\n },\n source: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'Source kind (browser, dataLayer, gtag, ...)',\n },\n platform: {\n description:\n 'Runtime platform (web, server, app, ios, android, terminal, ...)',\n type: 'string',\n },\n version: {\n description: 'Deployment version of the source emitter',\n type: 'string',\n },\n schema: {\n description:\n 'Event model spec version (collector defaults to \"4\")',\n type: 'string',\n },\n count: {\n description: 'Emission sequence per run',\n type: 'integer',\n minimum: 0,\n maximum: 9007199254740991,\n },\n trace: {\n description: 'W3C traceparent full string',\n type: 'string',\n },\n url: {\n type: 'string',\n },\n referrer: {\n type: 'string',\n },\n tool: {\n type: 'string',\n },\n command: {\n type: 'string',\n },\n },\n required: ['type'],\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.Source',\n description: 'Event source information',\n },\n },\n additionalProperties: false,\n title: 'WalkerOS.PartialEvent',\n description: 'Partial event structure with all fields optional.',\n },\n },\n} as const);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,UAAU,aACP,MAAM,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,QAAQ,CAAC,CAAC,EACvC,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,aACL,Q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AAEL,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AAEA,SAAO;AACT;AAQO,SAAS,6BACd,OACA,SACA,MACiD;AACjD,QAAM,UAAU,eAAe,OAAO,IAAI;AAE1C,QAAM,SAA4B,CAAC;AACnC,aAAW,UAAU,SAAS;AAC5B,UAAM,SAAS,aAAa,MAAM,EAAE,SAAS,KAAK;AAClD,QAAI,CAAC,OAAO,OAAO;AACjB,iBAAW,QAAQ,OAAO,QAAQ;AAChC,eAAO,KAAK;AAAA,UACV,MAAM,KAAK;AAAA,UACX,SAAS,KAAK;AAAA,UACd,OAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,SAAS,OAAO,WAAW,GAAG,OAAO;AAChD;","names":["import_dev"]}
|
package/dist/dev.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(t,i)=>{for(var r in i)e(t,r,{get:i[r],enumerable:!0})},i={};t(i,{SettingsSchema:()=>s,settings:()=>o});import{zodToSchema as r}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var s=n.object({contract:n.array(n.record(n.string(),n.unknown())).optional().describe("Validation constraints. Each entry is a resolved $contract.* rule (with entity-action `events` schemas and/or a full-event `schema`) or an inline whole-event JSON Schema. All entries are AND-ed; every error is aggregated."),format:n.boolean().optional().describe("When true, also validate the canonical WalkerOS.Event structural shape (correct field types, no unknown fields). All fields are optional, so this checks structure and types, not presence."),mode:n.enum(["strict","pass"]).optional().describe("`strict` drops invalid events (chain-stop) after recording errors; `pass` annotates and continues. Default `pass`."),output:n.object({isValid:n.string().optional().describe("Event dot-path for the boolean verdict. Default `source.valid`. Empty string = skip."),errors:n.string().optional().describe("Ingest dot-path for the issue list. Default `validation`. Empty string = skip.")}).optional().describe("Where the verdict (on the event) and the issue list (on the ingest) are written.")}).describe("Validate transformer: checks events against JSON Schema contracts and annotates a verdict on the event plus issues on the ingest."),o=r(s),a={};t(a,{step:()=>p});var p={};t(p,{gtmFilterDropped:()=>y,gtmFilterPasses:()=>g,passAnnotateInvalid:()=>d,strictInvalidPageView:()=>c,strictValidPageView:()=>l});var l={title:"Strict validate against a contract (valid)",description:'A "page view" with the required data.title passes the inline contract. The verdict source.valid:true is written to the event; the chain continues.',in:{name:"page view",entity:"page",action:"view",data:{title:"Home"}},out:[["return",{event:{name:"page view",entity:"page",action:"view",data:{title:"Home"},source:{valid:!0}}}]]},c={public:!1,title:"Strict validate against a contract (invalid, dropped)",description:'A "page view" missing the required data.title fails the contract. In strict mode the chain stops (event dropped). Validation errors are still written to the ingest for observers.',in:{name:"page view",entity:"page",action:"view",data:{}},out:[["return",!1]]},d={public:!1,title:"Pass mode annotates an invalid event",description:'In mode:"pass" an invalid event is not dropped: source.valid:false is written to the event so downstream destinations can route on it, and the error list is written to the ingest path "validation".',in:{name:"page view",entity:"page",action:"view",data:{}},out:[["return",{event:{name:"page view",entity:"page",action:"view",data:{},source:{valid:!1}}}]]},y={public:!1,title:"Filter gtm.* via a contract pattern (dropped)",description:'A contract whose name must NOT match ^gtm\\. rejects "gtm.js". In strict mode the event is dropped. This is how you filter without an "ignore" field.',in:{name:"gtm.js"},out:[["return",!1]]},g={title:"Filter gtm.* via a contract pattern (real event passes)",description:'The same ^gtm\\. rejection contract leaves a real "page view" untouched: it passes and is annotated source.valid:true.',in:{name:"page view",entity:"page",action:"view"},out:[["return",{event:{name:"page view",entity:"page",action:"view",source:{valid:!0}}}]]},m={"contract-resolution":{text:"A $contract.* reference is resolved to a concrete JSON Schema at bundle time. The runtime transformer never sees a string: by the time push runs, settings.contract holds resolved ContractRule objects (entity-action event schemas and/or a full-event schema) or inline schemas. If you author a flow with $contract.web, the bundler inlines the matching schema before deploy.",code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{contract:["$contract.web"],mode:"strict"}}}}},null,2)}]},"mode-strict-vs-pass":{text:'mode:"strict" drops invalid events by stopping the transformer chain (push returns false), so they never reach downstream destinations. mode:"pass" (the default) never drops: it annotates the event with the verdict and continues, and you route downstream on event.source.valid. Use strict to enforce a contract as a hard gate; use pass to observe quality without losing data.',code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{contract:["$contract.web"],mode:"pass"}}}}},null,2)}]},"output-split":{text:"The verdict and the error list are written to two different places by design. The boolean verdict goes to the EVENT (default path source.valid): it is analytics-grade data that travels with the event to destinations, and source.valid stays type-clean under WalkerOS.Source. The error list goes to the INGEST (default path validation): it is observer-visible pipeline diagnostics, never analytics data, written in place so it survives even a strict-mode drop. Override either path via output.isValid / output.errors; set either to an empty string to skip that write.",code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{contract:["$contract.web"],output:{isValid:"source.valid",errors:"validation"}}}}}},null,2)}]},"format-vs-contract":{text:'format:true is a built-in structural check, not an authored schema. It validates the canonical WalkerOS.Event shape (correct field types, no unknown fields). All fields are optional, so it checks structure and types, not presence: a wrong-typed field or malformed structure fails, a missing field does not. It is independent of contract: turn it on to catch malformed events even when you have no contract, or alongside a contract to AND both checks. A contract is the place for your domain rules; format is the place for "is this even a well-formed event".',code:[{lang:"json",code:JSON.stringify({transformers:{validate:{package:"@walkeros/transformer-validate",config:{settings:{format:!0,mode:"pass"}}}}},null,2)}]},"gtm-filtering":{text:'There is no ignore field. To filter unwanted events (for example GTM lifecycle pings like gtm.js / gtm.dom), author a contract that REJECTS them and run mode:"strict". A schema where name must NOT match ^gtm\\. fails those events, and strict mode drops them while real events pass. This keeps filtering declarative and contract-driven rather than a separate ad-hoc list.',code:[{lang:"json",code:JSON.stringify({type:"object",properties:{name:{not:{pattern:"^gtm\\."}}}},null,2)}]},"known-limitations":{text:'The errors list may contain an extra parent entry pointing at a properties wrapper per failure, a quirk of the underlying JSON Schema engine output. The isValid verdict is unaffected: a single real failure can surface as more than one error entry, but isValid is still false exactly when there is at least one failure. v1 emits level:"error" only (no warn level yet).'}};import*as f from"@cfworker/json-schema";var u=Object.freeze({$schema:"http://json-schema.org/draft-07/schema#",description:"Partial event structure with all fields optional",allOf:[{$ref:"#/definitions/WalkerOSPartialEvent"}],definitions:{WalkerOSProperty:{title:"WalkerOS.Property",description:"PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays.",anyOf:[{$ref:"#/definitions/WalkerOSPropertyType"},{type:"array",items:{$ref:"#/definitions/WalkerOSPropertyType"}}]},WalkerOSPropertyType:{title:"WalkerOS.PropertyType",description:"Base property value types (boolean, string, number, or nested Property record).",anyOf:[{type:"boolean"},{type:"string"},{type:"number"},{type:"object",propertyNames:{type:"string"},additionalProperties:{$ref:"#/definitions/WalkerOSProperty"}}]},WalkerOSProperties:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Flexible property collection with optional values."},WalkerOSOrderedProperties:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"array",items:[{$ref:"#/definitions/WalkerOSProperty"},{type:"number"}]},title:"WalkerOS.OrderedProperties",description:"Ordered properties with [value, order] tuples for priority control."},WalkerOSUser:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{id:{description:"User identifier",type:"string"},device:{description:"Device identifier",type:"string"},session:{description:"Session identifier",type:"string"},hash:{description:"Hashed identifier",type:"string"},address:{description:"User address",type:"string"},email:{description:"User email address",type:"string",format:"email",pattern:"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},phone:{description:"User phone number",type:"string"},userAgent:{description:"Browser user agent string",type:"string"},browser:{description:"Browser name",type:"string"},browserVersion:{description:"Browser version",type:"string"},deviceType:{description:"Device type (mobile, desktop, tablet)",type:"string"},os:{description:"Operating system",type:"string"},osVersion:{description:"Operating system version",type:"string"},screenSize:{description:"Screen dimensions",type:"string"},language:{description:"User language",type:"string"},country:{description:"User country",type:"string"},region:{description:"User region/state",type:"string"},city:{description:"User city",type:"string"},zip:{description:"User postal code",type:"string"},timezone:{description:"User timezone",type:"string"},ip:{description:"User IP address",type:"string"},internal:{description:"Internal user flag (employee, test user)",type:"boolean"}},additionalProperties:!1}],title:"WalkerOS.User",description:"User identification and attributes."},__schema0:{description:"Nested entity structure with recursive nesting support",$ref:"#/definitions/WalkerOSEntity"},WalkerOSEntity:{title:"WalkerOS.Entity",description:"Nested entity structure with recursive nesting support.",type:"object",properties:{entity:{type:"string",description:"Entity name"},data:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Entity-specific properties",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},nested:{description:"Nested child entities",type:"array",items:{$ref:"#/definitions/__schema0"}},context:{description:"Entity context data",allOf:[{$ref:"#/definitions/WalkerOSOrderedProperties"}]}},required:["entity","data"],additionalProperties:!1},WalkerOSEntities:{type:"array",items:{$ref:"#/definitions/__schema0"},title:"WalkerOS.Entities",description:"Array of nested entities."},WalkerOSConsent:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"boolean"},title:"WalkerOS.Consent",description:"Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied."},WalkerOSSource:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{type:{type:"string",description:"Source kind (browser, dataLayer, gtag, ...)"},platform:{description:"Runtime platform (web, server, app, ios, android, terminal, ...)",type:"string"},version:{description:"Deployment version of the source emitter",type:"string"},schema:{description:'Event model spec version (collector defaults to "4")',type:"string"},count:{description:"Emission sequence per run",type:"integer",minimum:0,maximum:9007199254740991},trace:{description:"W3C traceparent full string",type:"string"},url:{type:"string"},referrer:{type:"string"},tool:{type:"string"},command:{type:"string"}},required:["type"],additionalProperties:!1}],title:"WalkerOS.Source",description:"Event source information (origin of the event)."},WalkerOSPartialEvent:{type:"object",properties:{name:{type:"string",description:'Event name in "entity action" format (e.g., "page view", "product add")'},data:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Event-specific properties",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},context:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"array",items:[{$ref:"#/definitions/WalkerOSProperty"},{type:"number"}]},title:"WalkerOS.OrderedProperties",description:"Ordered context properties with priorities",allOf:[{$ref:"#/definitions/WalkerOSOrderedProperties"}]},globals:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Global properties shared across events",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},custom:{type:"object",propertyNames:{type:"string"},additionalProperties:{allOf:[{$ref:"#/definitions/WalkerOSProperty"}]},title:"WalkerOS.Properties",description:"Custom implementation-specific properties",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},user:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{id:{description:"User identifier",type:"string"},device:{description:"Device identifier",type:"string"},session:{description:"Session identifier",type:"string"},hash:{description:"Hashed identifier",type:"string"},address:{description:"User address",type:"string"},email:{description:"User email address",type:"string",format:"email",pattern:"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},phone:{description:"User phone number",type:"string"},userAgent:{description:"Browser user agent string",type:"string"},browser:{description:"Browser name",type:"string"},browserVersion:{description:"Browser version",type:"string"},deviceType:{description:"Device type (mobile, desktop, tablet)",type:"string"},os:{description:"Operating system",type:"string"},osVersion:{description:"Operating system version",type:"string"},screenSize:{description:"Screen dimensions",type:"string"},language:{description:"User language",type:"string"},country:{description:"User country",type:"string"},region:{description:"User region/state",type:"string"},city:{description:"User city",type:"string"},zip:{description:"User postal code",type:"string"},timezone:{description:"User timezone",type:"string"},ip:{description:"User IP address",type:"string"},internal:{description:"Internal user flag (employee, test user)",type:"boolean"}},additionalProperties:!1}],title:"WalkerOS.User",description:"User identification and attributes"},nested:{type:"array",items:{$ref:"#/definitions/__schema0"},title:"WalkerOS.Entities",description:"Related nested entities",allOf:[{$ref:"#/definitions/WalkerOSEntities"}]},consent:{type:"object",propertyNames:{type:"string"},additionalProperties:{type:"boolean"},title:"WalkerOS.Consent",description:"Consent states at event time",allOf:[{$ref:"#/definitions/WalkerOSConsent"}]},id:{type:"string",minLength:1,description:"W3C span_id, 16 lowercase hex characters"},trigger:{type:"string",description:"Event trigger identifier"},entity:{type:"string",description:"Parsed entity from event name"},action:{type:"string",description:"Parsed action from event name"},timestamp:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991,description:"Unix timestamp in milliseconds since epoch"},timing:{type:"number",description:"Event processing timing information"},source:{allOf:[{description:"Flexible property collection with optional values",allOf:[{$ref:"#/definitions/WalkerOSProperties"}]},{type:"object",properties:{type:{type:"string",description:"Source kind (browser, dataLayer, gtag, ...)"},platform:{description:"Runtime platform (web, server, app, ios, android, terminal, ...)",type:"string"},version:{description:"Deployment version of the source emitter",type:"string"},schema:{description:'Event model spec version (collector defaults to "4")',type:"string"},count:{description:"Emission sequence per run",type:"integer",minimum:0,maximum:9007199254740991},trace:{description:"W3C traceparent full string",type:"string"},url:{type:"string"},referrer:{type:"string"},tool:{type:"string"},command:{type:"string"}},required:["type"],additionalProperties:!1}],title:"WalkerOS.Source",description:"Event source information"}},additionalProperties:!1,title:"WalkerOS.PartialEvent",description:"Partial event structure with all fields optional."}}}),v=new Map;function h(e){const t=JSON.stringify(e),i=v.get(t);if(i)return i;const r=JSON.parse(t),n=new f.Validator(r,"2020-12");return v.set(t,n),n}function O(e){return"object"==typeof e&&null!==e&&"events"in e&&"object"==typeof e.events}function w(e,t,i){return e[t]?.[i]??e[t]?.["*"]??e["*"]?.[i]??e["*"]?.["*"]}function b(e,t,i){const r=function(e,t){const i=[];t.format&&i.push(u);for(const r of t.contracts??[])if(O(r)){const t="string"==typeof e.entity?e.entity:"",n="string"==typeof e.action?e.action:"",s=w(r.events??{},t,n);s&&i.push(s),r.schema&&i.push(r.schema)}else i.push(r);return i}(e,i),n=[];for(const t of r){const i=h(t).validate(e);if(!i.valid)for(const e of i.errors)n.push({path:e.instanceLocation,message:e.error,level:"error"})}return{isValid:0===n.length,errors:n}}export{a as examples,m as hints,i as schemas,b as validateEventAgainstContract};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/examples/index.ts","../src/examples/step.ts","../src/hints.ts","../src/validate.ts","../src/event-format.schema.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport const settings = zodToSchema(SettingsSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n contract: z\n .array(z.record(z.string(), z.unknown()))\n .optional()\n .describe(\n 'Validation constraints. Each entry is a resolved $contract.* rule (with entity-action `events` schemas and/or a full-event `schema`) or an inline whole-event JSON Schema. All entries are AND-ed; every error is aggregated.',\n ),\n format: z\n .boolean()\n .optional()\n .describe(\n 'When true, also validate the canonical WalkerOS.Event structural shape (correct field types, no unknown fields). All fields are optional, so this checks structure and types, not presence.',\n ),\n mode: z\n .enum(['strict', 'pass'])\n .optional()\n .describe(\n '`strict` drops invalid events (chain-stop) after recording errors; `pass` annotates and continues. Default `pass`.',\n ),\n output: z\n .object({\n isValid: z\n .string()\n .optional()\n .describe(\n 'Event dot-path for the boolean verdict. Default `source.valid`. Empty string = skip.',\n ),\n errors: z\n .string()\n .optional()\n .describe(\n 'Ingest dot-path for the issue list. Default `validation`. Empty string = skip.',\n ),\n })\n .optional()\n .describe(\n 'Where the verdict (on the event) and the issue list (on the ingest) are written.',\n ),\n })\n .describe(\n 'Validate transformer: checks events against JSON Schema contracts and annotates a verdict on the event plus issues on the ingest.',\n );\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","export * as step from './step';\n","import type { Flow } from '@walkeros/core';\n\n/**\n * strict + valid: passes the contract, gets annotated source.valid:true and\n * continues down the chain.\n */\nexport const strictValidPageView: Flow.StepExample = {\n title: 'Strict validate against a contract (valid)',\n description:\n 'A \"page view\" with the required data.title passes the inline contract. The verdict source.valid:true is written to the event; the chain continues.',\n in: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: { title: 'Home' },\n },\n out: [\n [\n 'return',\n {\n event: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: { title: 'Home' },\n source: { valid: true },\n },\n },\n ],\n ],\n};\n\n/**\n * strict + invalid: the same contract, but data.title is missing. In strict\n * mode the transformer stops the chain (drops). Errors are still written to the\n * ingest for observers; the drop itself is encoded as `['return', false]`.\n */\nexport const strictInvalidPageView: Flow.StepExample = {\n public: false,\n title: 'Strict validate against a contract (invalid, dropped)',\n description:\n 'A \"page view\" missing the required data.title fails the contract. In strict mode the chain stops (event dropped). Validation errors are still written to the ingest for observers.',\n in: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: {},\n },\n out: [['return', false]],\n};\n\n/**\n * pass + invalid: same failure, but mode:'pass' annotates source.valid:false and\n * continues. Downstream destinations route on event.source.valid. The error list\n * is written to the ingest (default path \"validation\"), not asserted here.\n */\nexport const passAnnotateInvalid: Flow.StepExample = {\n public: false,\n title: 'Pass mode annotates an invalid event',\n description:\n 'In mode:\"pass\" an invalid event is not dropped: source.valid:false is written to the event so downstream destinations can route on it, and the error list is written to the ingest path \"validation\".',\n in: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: {},\n },\n out: [\n [\n 'return',\n {\n event: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n data: {},\n source: { valid: false },\n },\n },\n ],\n ],\n};\n\n/**\n * gtm filter via a contract pattern: the contract rejects names matching\n * ^gtm\\\\. There is no `ignore` field; filtering is a contract that fails. In\n * strict mode a \"gtm.js\" event is dropped.\n */\nexport const gtmFilterDropped: Flow.StepExample = {\n public: false,\n title: 'Filter gtm.* via a contract pattern (dropped)',\n description:\n 'A contract whose name must NOT match ^gtm\\\\. rejects \"gtm.js\". In strict mode the event is dropped. This is how you filter without an \"ignore\" field.',\n in: { name: 'gtm.js' },\n out: [['return', false]],\n};\n\n/** Same gtm-filter contract, but a real \"page view\" passes the pattern. */\nexport const gtmFilterPasses: Flow.StepExample = {\n title: 'Filter gtm.* via a contract pattern (real event passes)',\n description:\n 'The same ^gtm\\\\. rejection contract leaves a real \"page view\" untouched: it passes and is annotated source.valid:true.',\n in: { name: 'page view', entity: 'page', action: 'view' },\n out: [\n [\n 'return',\n {\n event: {\n name: 'page view',\n entity: 'page',\n action: 'view',\n source: { valid: true },\n },\n },\n ],\n ],\n};\n","import type { Hint } from '@walkeros/core';\n\nexport const hints: Hint.Hints = {\n 'contract-resolution': {\n text: 'A $contract.* reference is resolved to a concrete JSON Schema at bundle time. The runtime transformer never sees a string: by the time push runs, settings.contract holds resolved ContractRule objects (entity-action event schemas and/or a full-event schema) or inline schemas. If you author a flow with $contract.web, the bundler inlines the matching schema before deploy.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: {\n settings: {\n contract: ['$contract.web'],\n mode: 'strict',\n },\n },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'mode-strict-vs-pass': {\n text: 'mode:\"strict\" drops invalid events by stopping the transformer chain (push returns false), so they never reach downstream destinations. mode:\"pass\" (the default) never drops: it annotates the event with the verdict and continues, and you route downstream on event.source.valid. Use strict to enforce a contract as a hard gate; use pass to observe quality without losing data.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: {\n settings: { contract: ['$contract.web'], mode: 'pass' },\n },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'output-split': {\n text: 'The verdict and the error list are written to two different places by design. The boolean verdict goes to the EVENT (default path source.valid): it is analytics-grade data that travels with the event to destinations, and source.valid stays type-clean under WalkerOS.Source. The error list goes to the INGEST (default path validation): it is observer-visible pipeline diagnostics, never analytics data, written in place so it survives even a strict-mode drop. Override either path via output.isValid / output.errors; set either to an empty string to skip that write.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: {\n settings: {\n contract: ['$contract.web'],\n output: { isValid: 'source.valid', errors: 'validation' },\n },\n },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'format-vs-contract': {\n text: 'format:true is a built-in structural check, not an authored schema. It validates the canonical WalkerOS.Event shape (correct field types, no unknown fields). All fields are optional, so it checks structure and types, not presence: a wrong-typed field or malformed structure fails, a missing field does not. It is independent of contract: turn it on to catch malformed events even when you have no contract, or alongside a contract to AND both checks. A contract is the place for your domain rules; format is the place for \"is this even a well-formed event\".',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n transformers: {\n validate: {\n package: '@walkeros/transformer-validate',\n config: { settings: { format: true, mode: 'pass' } },\n },\n },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'gtm-filtering': {\n text: 'There is no ignore field. To filter unwanted events (for example GTM lifecycle pings like gtm.js / gtm.dom), author a contract that REJECTS them and run mode:\"strict\". A schema where name must NOT match ^gtm\\\\. fails those events, and strict mode drops them while real events pass. This keeps filtering declarative and contract-driven rather than a separate ad-hoc list.',\n code: [\n {\n lang: 'json',\n code: JSON.stringify(\n {\n type: 'object',\n properties: { name: { not: { pattern: '^gtm\\\\.' } } },\n },\n null,\n 2,\n ),\n },\n ],\n },\n 'known-limitations': {\n text: 'The errors list may contain an extra parent entry pointing at a properties wrapper per failure, a quirk of the underlying JSON Schema engine output. The isValid verdict is unaffected: a single real failure can surface as more than one error entry, but isValid is still false exactly when there is at least one failure. v1 emits level:\"error\" only (no warn level yet).',\n },\n};\n","import type { Flow, Ingest, ValidateEvents, WalkerOS } from '@walkeros/core';\nimport * as cfworker from '@cfworker/json-schema';\nimport type { ContractSource, ValidationIssue } from './types';\nimport { eventFormatSchema } from './event-format.schema';\n\n/**\n * Module-level Validator cache keyed by the compact JSON of the schema.\n *\n * A plain Map (not WeakMap): schemas are re-cloned per flow load, so identical\n * structures arrive as distinct object references. Keying on serialized content\n * lets repeated pushes within and across loads share one compiled interpreter.\n */\nconst validatorCache = new Map<string, cfworker.Validator>();\n\nexport function getValidator(\n schema: Record<string, unknown>,\n): cfworker.Validator {\n const key = JSON.stringify(schema);\n const cached = validatorCache.get(key);\n if (cached) return cached;\n // cfworker dereferences $ref by annotating each subschema in place\n // (e.g. __absolute_uri__). Parse a fresh mutable copy from the cache key so a\n // frozen input (the generated eventFormatSchema) stays untouched.\n const mutable = JSON.parse(key) as Record<string, unknown>;\n // Pin draft 2020-12 (the contract authoring draft).\n const validator = new cfworker.Validator(mutable, '2020-12');\n validatorCache.set(key, validator);\n return validator;\n}\n\nfunction isContractRule(source: ContractSource): source is Flow.ContractRule {\n return (\n typeof source === 'object' &&\n source !== null &&\n 'events' in source &&\n typeof (source as { events?: unknown }).events === 'object'\n );\n}\n\n/**\n * Selects the entity-action schema with the documented wildcard fallback:\n * entity.action → entity.* → *.action → *.*.\n */\nfunction selectEventSchema(\n events: ValidateEvents,\n entity: string,\n action: string,\n): Record<string, unknown> | undefined {\n return (\n events[entity]?.[action] ??\n events[entity]?.['*'] ??\n events['*']?.[action] ??\n events['*']?.['*']\n );\n}\n\n/** Collects every JSON Schema that applies to this event. */\nfunction collectSchemas(\n event: WalkerOS.DeepPartialEvent,\n opts: { contracts?: ContractSource[]; format?: boolean },\n): Record<string, unknown>[] {\n const schemas: Record<string, unknown>[] = [];\n\n if (opts.format) schemas.push(eventFormatSchema);\n\n for (const source of opts.contracts ?? []) {\n if (isContractRule(source)) {\n const entity = typeof event.entity === 'string' ? event.entity : '';\n const action = typeof event.action === 'string' ? event.action : '';\n const selected = selectEventSchema(source.events ?? {}, entity, action);\n if (selected) schemas.push(selected);\n if (source.schema) schemas.push(source.schema);\n } else {\n // Inline whole-event JSON Schema.\n schemas.push(source);\n }\n }\n\n return schemas;\n}\n\n/**\n * The validation verdict authority. Runs the event through every applicable\n * JSON Schema (AND semantics) and aggregates all @cfworker errors.\n *\n * No matching constraint (empty schema set) means no opinion: isValid is true.\n */\nexport function validateEventAgainstContract(\n event: WalkerOS.DeepPartialEvent,\n _ingest: Ingest | undefined,\n opts: { contracts?: ContractSource[]; format?: boolean },\n): { isValid: boolean; errors: ValidationIssue[] } {\n const schemas = collectSchemas(event, opts);\n\n const errors: ValidationIssue[] = [];\n for (const schema of schemas) {\n const result = getValidator(schema).validate(event);\n if (!result.valid) {\n for (const unit of result.errors) {\n errors.push({\n path: unit.instanceLocation,\n message: unit.error,\n level: 'error',\n });\n }\n }\n }\n\n return { isValid: errors.length === 0, errors };\n}\n","// GENERATED by scripts/generate-format-schema.mjs: DO NOT EDIT.\n// Source: @walkeros/core partialEventJsonSchema (canonical zod EventSchema).\n// `format: true` validates that the value is a valid WalkerOS.PartialEvent:\n// the canonical event structure with all fields optional, so it checks shape\n// and field types, not presence. Required-field enforcement is the contract\n// arm's job (events/schema with required).\n// Regenerate: npm run generate:format-schema\n\nexport const eventFormatSchema = Object.freeze({\n $schema: 'http://json-schema.org/draft-07/schema#',\n description: 'Partial event structure with all fields optional',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSPartialEvent',\n },\n ],\n definitions: {\n WalkerOSProperty: {\n title: 'WalkerOS.Property',\n description:\n 'PropertyType or an array of PropertyType. Recursive structure for nested objects and arrays.',\n anyOf: [\n {\n $ref: '#/definitions/WalkerOSPropertyType',\n },\n {\n type: 'array',\n items: {\n $ref: '#/definitions/WalkerOSPropertyType',\n },\n },\n ],\n },\n WalkerOSPropertyType: {\n title: 'WalkerOS.PropertyType',\n description:\n 'Base property value types (boolean, string, number, or nested Property record).',\n anyOf: [\n {\n type: 'boolean',\n },\n {\n type: 'string',\n },\n {\n type: 'number',\n },\n {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n $ref: '#/definitions/WalkerOSProperty',\n },\n },\n ],\n },\n WalkerOSProperties: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Flexible property collection with optional values.',\n },\n WalkerOSOrderedProperties: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'array',\n items: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n {\n type: 'number',\n },\n ],\n },\n title: 'WalkerOS.OrderedProperties',\n description:\n 'Ordered properties with [value, order] tuples for priority control.',\n },\n WalkerOSUser: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n id: {\n description: 'User identifier',\n type: 'string',\n },\n device: {\n description: 'Device identifier',\n type: 'string',\n },\n session: {\n description: 'Session identifier',\n type: 'string',\n },\n hash: {\n description: 'Hashed identifier',\n type: 'string',\n },\n address: {\n description: 'User address',\n type: 'string',\n },\n email: {\n description: 'User email address',\n type: 'string',\n format: 'email',\n pattern:\n \"^(?!\\\\.)(?!.*\\\\.\\\\.)([A-Za-z0-9_'+\\\\-\\\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\\\-]*\\\\.)+[A-Za-z]{2,}$\",\n },\n phone: {\n description: 'User phone number',\n type: 'string',\n },\n userAgent: {\n description: 'Browser user agent string',\n type: 'string',\n },\n browser: {\n description: 'Browser name',\n type: 'string',\n },\n browserVersion: {\n description: 'Browser version',\n type: 'string',\n },\n deviceType: {\n description: 'Device type (mobile, desktop, tablet)',\n type: 'string',\n },\n os: {\n description: 'Operating system',\n type: 'string',\n },\n osVersion: {\n description: 'Operating system version',\n type: 'string',\n },\n screenSize: {\n description: 'Screen dimensions',\n type: 'string',\n },\n language: {\n description: 'User language',\n type: 'string',\n },\n country: {\n description: 'User country',\n type: 'string',\n },\n region: {\n description: 'User region/state',\n type: 'string',\n },\n city: {\n description: 'User city',\n type: 'string',\n },\n zip: {\n description: 'User postal code',\n type: 'string',\n },\n timezone: {\n description: 'User timezone',\n type: 'string',\n },\n ip: {\n description: 'User IP address',\n type: 'string',\n },\n internal: {\n description: 'Internal user flag (employee, test user)',\n type: 'boolean',\n },\n },\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.User',\n description: 'User identification and attributes.',\n },\n __schema0: {\n description: 'Nested entity structure with recursive nesting support',\n $ref: '#/definitions/WalkerOSEntity',\n },\n WalkerOSEntity: {\n title: 'WalkerOS.Entity',\n description: 'Nested entity structure with recursive nesting support.',\n type: 'object',\n properties: {\n entity: {\n type: 'string',\n description: 'Entity name',\n },\n data: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Entity-specific properties',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n nested: {\n description: 'Nested child entities',\n type: 'array',\n items: {\n $ref: '#/definitions/__schema0',\n },\n },\n context: {\n description: 'Entity context data',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSOrderedProperties',\n },\n ],\n },\n },\n required: ['entity', 'data'],\n additionalProperties: false,\n },\n WalkerOSEntities: {\n type: 'array',\n items: {\n $ref: '#/definitions/__schema0',\n },\n title: 'WalkerOS.Entities',\n description: 'Array of nested entities.',\n },\n WalkerOSConsent: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'boolean',\n },\n title: 'WalkerOS.Consent',\n description:\n 'Consent state mapping. Keys are consent groups (e.g. marketing, functional), values are booleans for granted/denied.',\n },\n WalkerOSSource: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'Source kind (browser, dataLayer, gtag, ...)',\n },\n platform: {\n description:\n 'Runtime platform (web, server, app, ios, android, terminal, ...)',\n type: 'string',\n },\n version: {\n description: 'Deployment version of the source emitter',\n type: 'string',\n },\n schema: {\n description:\n 'Event model spec version (collector defaults to \"4\")',\n type: 'string',\n },\n count: {\n description: 'Emission sequence per run',\n type: 'integer',\n minimum: 0,\n maximum: 9007199254740991,\n },\n trace: {\n description: 'W3C traceparent full string',\n type: 'string',\n },\n url: {\n type: 'string',\n },\n referrer: {\n type: 'string',\n },\n tool: {\n type: 'string',\n },\n command: {\n type: 'string',\n },\n },\n required: ['type'],\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.Source',\n description: 'Event source information (origin of the event).',\n },\n WalkerOSPartialEvent: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description:\n 'Event name in \"entity action\" format (e.g., \"page view\", \"product add\")',\n },\n data: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Event-specific properties',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n context: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'array',\n items: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n {\n type: 'number',\n },\n ],\n },\n title: 'WalkerOS.OrderedProperties',\n description: 'Ordered context properties with priorities',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSOrderedProperties',\n },\n ],\n },\n globals: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Global properties shared across events',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n custom: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperty',\n },\n ],\n },\n title: 'WalkerOS.Properties',\n description: 'Custom implementation-specific properties',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n user: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n id: {\n description: 'User identifier',\n type: 'string',\n },\n device: {\n description: 'Device identifier',\n type: 'string',\n },\n session: {\n description: 'Session identifier',\n type: 'string',\n },\n hash: {\n description: 'Hashed identifier',\n type: 'string',\n },\n address: {\n description: 'User address',\n type: 'string',\n },\n email: {\n description: 'User email address',\n type: 'string',\n format: 'email',\n pattern:\n \"^(?!\\\\.)(?!.*\\\\.\\\\.)([A-Za-z0-9_'+\\\\-\\\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\\\-]*\\\\.)+[A-Za-z]{2,}$\",\n },\n phone: {\n description: 'User phone number',\n type: 'string',\n },\n userAgent: {\n description: 'Browser user agent string',\n type: 'string',\n },\n browser: {\n description: 'Browser name',\n type: 'string',\n },\n browserVersion: {\n description: 'Browser version',\n type: 'string',\n },\n deviceType: {\n description: 'Device type (mobile, desktop, tablet)',\n type: 'string',\n },\n os: {\n description: 'Operating system',\n type: 'string',\n },\n osVersion: {\n description: 'Operating system version',\n type: 'string',\n },\n screenSize: {\n description: 'Screen dimensions',\n type: 'string',\n },\n language: {\n description: 'User language',\n type: 'string',\n },\n country: {\n description: 'User country',\n type: 'string',\n },\n region: {\n description: 'User region/state',\n type: 'string',\n },\n city: {\n description: 'User city',\n type: 'string',\n },\n zip: {\n description: 'User postal code',\n type: 'string',\n },\n timezone: {\n description: 'User timezone',\n type: 'string',\n },\n ip: {\n description: 'User IP address',\n type: 'string',\n },\n internal: {\n description: 'Internal user flag (employee, test user)',\n type: 'boolean',\n },\n },\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.User',\n description: 'User identification and attributes',\n },\n nested: {\n type: 'array',\n items: {\n $ref: '#/definitions/__schema0',\n },\n title: 'WalkerOS.Entities',\n description: 'Related nested entities',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSEntities',\n },\n ],\n },\n consent: {\n type: 'object',\n propertyNames: {\n type: 'string',\n },\n additionalProperties: {\n type: 'boolean',\n },\n title: 'WalkerOS.Consent',\n description: 'Consent states at event time',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSConsent',\n },\n ],\n },\n id: {\n type: 'string',\n minLength: 1,\n description: 'W3C span_id, 16 lowercase hex characters',\n },\n trigger: {\n type: 'string',\n description: 'Event trigger identifier',\n },\n entity: {\n type: 'string',\n description: 'Parsed entity from event name',\n },\n action: {\n type: 'string',\n description: 'Parsed action from event name',\n },\n timestamp: {\n type: 'integer',\n exclusiveMinimum: 0,\n maximum: 9007199254740991,\n description: 'Unix timestamp in milliseconds since epoch',\n },\n timing: {\n type: 'number',\n description: 'Event processing timing information',\n },\n source: {\n allOf: [\n {\n description: 'Flexible property collection with optional values',\n allOf: [\n {\n $ref: '#/definitions/WalkerOSProperties',\n },\n ],\n },\n {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'Source kind (browser, dataLayer, gtag, ...)',\n },\n platform: {\n description:\n 'Runtime platform (web, server, app, ios, android, terminal, ...)',\n type: 'string',\n },\n version: {\n description: 'Deployment version of the source emitter',\n type: 'string',\n },\n schema: {\n description:\n 'Event model spec version (collector defaults to \"4\")',\n type: 'string',\n },\n count: {\n description: 'Emission sequence per run',\n type: 'integer',\n minimum: 0,\n maximum: 9007199254740991,\n },\n trace: {\n description: 'W3C traceparent full string',\n type: 'string',\n },\n url: {\n type: 'string',\n },\n referrer: {\n type: 'string',\n },\n tool: {\n type: 'string',\n },\n command: {\n type: 'string',\n },\n },\n required: ['type'],\n additionalProperties: false,\n },\n ],\n title: 'WalkerOS.Source',\n description: 'Event source information',\n },\n },\n additionalProperties: false,\n title: 'WalkerOS.PartialEvent',\n description: 'Partial event structure with all fields optional.',\n },\n },\n} as const);\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,UAAU,EACP,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,EACvC,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,EACL,QAAQ,EACR,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,MAAM,EACH,KAAK,CAAC,UAAU,MAAM,CAAC,EACvB,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,EACL,OAAO;AAAA,IACN,SAAS,EACN,OAAO,EACP,SAAS,EACT;AAAA,MACC;AAAA,IACF;AAAA,IACF,QAAQ,EACL,OAAO,EACP,SAAS,EACT;AAAA,MACC;AAAA,IACF;AAAA,EACJ,CAAC,EACA,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA;AAAA,EACC;AACF;;;ADxCK,IAAM,WAAW,YAAY,cAAc;;;AEJlD;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,sBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,MAAM,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* A single source of validation constraints.
|
|
5
|
+
*
|
|
6
|
+
* Either a resolved `$contract.*` rule (a `Flow.ContractRule` with `.events`
|
|
7
|
+
* entity-action schemas and/or a full-event `.schema`), or an inline whole-event
|
|
8
|
+
* JSON Schema applied to the entire event.
|
|
9
|
+
*/
|
|
10
|
+
type ContractSource = Flow.ContractRule | Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Where the validation verdict and the issue list are written.
|
|
13
|
+
*
|
|
14
|
+
* `isValid` is a dot-path on the EVENT. Defaults to `source.valid`: putting the
|
|
15
|
+
* boolean verdict under `event.source` keeps it type-clean, since
|
|
16
|
+
* `WalkerOS.Source extends WalkerOS.Properties` accepts a boolean value, and it
|
|
17
|
+
* travels with the event to downstream destinations as analytics-grade data.
|
|
18
|
+
*
|
|
19
|
+
* `errors` is a dot-path on the INGEST (pipeline scratch). Defaults to
|
|
20
|
+
* `validation`: the issue list is observer-visible diagnostics, never analytics
|
|
21
|
+
* data, so it stays off the event and on the mutable ingest context where other
|
|
22
|
+
* steps and observers can read it.
|
|
23
|
+
*/
|
|
24
|
+
interface ValidateOutput {
|
|
25
|
+
/** Event dot-path for the boolean verdict. Default `source.valid`. Empty string = skip. */
|
|
26
|
+
isValid?: string;
|
|
27
|
+
/** Ingest dot-path for the issue list. Default `validation`. Empty string = skip. */
|
|
28
|
+
errors?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validate transformer settings.
|
|
32
|
+
*
|
|
33
|
+
* Defaults:
|
|
34
|
+
* - `mode`: `pass` (annotate and continue; never drops the event).
|
|
35
|
+
* - `output.isValid`: `source.valid` (verdict written to the EVENT).
|
|
36
|
+
* - `output.errors`: `validation` (issues written to the INGEST, relative root).
|
|
37
|
+
*/
|
|
38
|
+
interface ValidateSettings {
|
|
39
|
+
/** Validation constraints. Each entry is AND-ed; all errors are aggregated. */
|
|
40
|
+
contract?: ContractSource[];
|
|
41
|
+
/** Also validate that the event is a valid `WalkerOS.PartialEvent`: the canonical event structure with all fields optional, so `format` checks shape and field types, not presence. Required-field enforcement is the contract arm's job. */
|
|
42
|
+
format?: boolean;
|
|
43
|
+
/** `strict` drops invalid events (chain-stop); `pass` annotates and continues. Default `pass`. */
|
|
44
|
+
mode?: 'strict' | 'pass';
|
|
45
|
+
/** Where the verdict and issue list are written. */
|
|
46
|
+
output?: ValidateOutput;
|
|
47
|
+
}
|
|
48
|
+
/** A single validation issue. */
|
|
49
|
+
interface ValidationIssue {
|
|
50
|
+
path: string;
|
|
51
|
+
message: string;
|
|
52
|
+
level?: 'error' | 'warn';
|
|
53
|
+
}
|
|
54
|
+
/** Aggregate validation result. */
|
|
55
|
+
interface ValidateResult {
|
|
56
|
+
isValid: boolean;
|
|
57
|
+
errors: ValidationIssue[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare const transformerValidate: Transformer.Init<Transformer.Types<ValidateSettings>>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The validation verdict authority. Runs the event through every applicable
|
|
64
|
+
* JSON Schema (AND semantics) and aggregates all @cfworker errors.
|
|
65
|
+
*
|
|
66
|
+
* No matching constraint (empty schema set) means no opinion: isValid is true.
|
|
67
|
+
*/
|
|
68
|
+
declare function validateEventAgainstContract(event: WalkerOS.DeepPartialEvent, _ingest: Ingest | undefined, opts: {
|
|
69
|
+
contracts?: ContractSource[];
|
|
70
|
+
format?: boolean;
|
|
71
|
+
}): {
|
|
72
|
+
isValid: boolean;
|
|
73
|
+
errors: ValidationIssue[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { type ContractSource, type ValidateOutput, type ValidateResult, type ValidateSettings, type ValidationIssue, transformerValidate as default, transformerValidate, validateEventAgainstContract };
|