@walkeros/transformer-validator 3.4.2 → 4.0.0-next-1777463920154
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.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +40 -71
- package/package.json +3 -3
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})},n={};i(n,{examples:()=>s,formatSchema:()=>p,schemas:()=>b,settingsSchema:()=>y}),module.exports=(e=n,((e,i,n,p)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of o(i))a.call(e,s)||s===n||t(e,s,{get:()=>i[s],enumerable:!(p=r(i,s))||p.enumerable});return e})(t({},"__esModule",{value:!0}),e));var p={type:"object",required:["name","entity","action","data","globals","custom","user","consent","id","trigger","timestamp","timing","source"],properties:{name:{type:"string",pattern:"^\\S+ \\S+$"},entity:{type:"string"},action:{type:"string"},data:{type:"object"},context:{type:"object"},globals:{type:"object"},custom:{type:"object"},user:{type:"object"},nested:{type:"array"},consent:{type:"object"},id:{type:"string"},trigger:{type:"string"},timestamp:{type:"number"},timing:{type:"number"},source:{type:"object",required:["type"],properties:{type:{type:"string"},platform:{type:"string"},url:{type:"string"},referrer:{type:"string"},schema:{type:"string"},version:{type:"string"},count:{type:"number"},trace:{type:"string"},tool:{type:"string"},command:{type:"string"}}}}},s={};i(s,{step:()=>c});var c={};i(c,{contractValidationPass:()=>u,invalidFormat:()=>l,validEvent:()=>d});var m=require("@walkeros/core"),d={title:"Valid event",description:"A well-formed product view passes validation and is returned unchanged for downstream destinations.",in:(0,m.getEvent)("product view",{id:"ev-1700000700",timestamp:1700000700,data:{id:"SKU-100",name:"Trail Runner Pro",price:129.99},source:{type:"browser",platform:"web",url:"https://example.com/"}}),out:[["return",(0,m.getEvent)("product view",{id:"ev-1700000700",timestamp:1700000700,data:{id:"SKU-100",name:"Trail Runner Pro",price:129.99},source:{type:"browser",platform:"web",url:"https://example.com/"}})]]},l={public:!1,in:{name:"invalid",data:{}},out:[["return",!1]]},u={title:"Contract validation",description:"Contract validation passes when event data matches the entity.action JSON Schema",in:(0,m.getEvent)("order complete",{id:"ev-1700000800",timestamp:1700000800,data:{id:"0rd3r1d",total:555,currency:"EUR"},source:{type:"browser",platform:"web",url:"https://shop.example.com/"}}),out:[["return",(0,m.getEvent)("order complete",{id:"ev-1700000800",timestamp:1700000800,data:{id:"0rd3r1d",total:555,currency:"EUR"},source:{type:"browser",platform:"web",url:"https://shop.example.com/"}})]]},y={type:"object",properties:{format:{type:"boolean",description:"Validate full WalkerOS.Event structure. Pre-compiled at init.",default:!0},contract:{type:"object",description:"Event-specific validation rules. Entity/action keyed, supports wildcards."}}},b={format:p,settings:y};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/format-schema.ts","../src/examples/index.ts","../src/examples/step.ts"],"sourcesContent":["/**\n * Development exports for transformer-validator\n * Used by website documentation and examples\n */\nimport { formatSchema } from './format-schema';\nimport type { JsonSchema } from './types';\n\nexport { formatSchema };\n\n/**\n * JSON Schema describing ValidatorSettings for documentation.\n */\nexport const settingsSchema: JsonSchema = {\n type: 'object',\n properties: {\n format: {\n type: 'boolean',\n description:\n 'Validate full WalkerOS.Event structure. Pre-compiled at init.',\n default: true,\n },\n contract: {\n type: 'object',\n description:\n 'Event-specific validation rules. Entity/action keyed, supports wildcards.',\n },\n },\n};\n\n// Re-export for convenience\nexport const schemas: { format: JsonSchema; settings: JsonSchema } = {\n format: formatSchema,\n settings: settingsSchema,\n};\n\nexport * as examples from './examples';\n","import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n '
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/format-schema.ts","../src/examples/index.ts","../src/examples/step.ts"],"sourcesContent":["/**\n * Development exports for transformer-validator\n * Used by website documentation and examples\n */\nimport { formatSchema } from './format-schema';\nimport type { JsonSchema } from './types';\n\nexport { formatSchema };\n\n/**\n * JSON Schema describing ValidatorSettings for documentation.\n */\nexport const settingsSchema: JsonSchema = {\n type: 'object',\n properties: {\n format: {\n type: 'boolean',\n description:\n 'Validate full WalkerOS.Event structure. Pre-compiled at init.',\n default: true,\n },\n contract: {\n type: 'object',\n description:\n 'Event-specific validation rules. Entity/action keyed, supports wildcards.',\n },\n },\n};\n\n// Re-export for convenience\nexport const schemas: { format: JsonSchema; settings: JsonSchema } = {\n format: formatSchema,\n settings: settingsSchema,\n};\n\nexport * as examples from './examples';\n","import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n 'globals',\n 'custom',\n 'user',\n 'consent',\n 'id',\n 'trigger',\n 'timestamp',\n 'timing',\n 'source',\n ],\n properties: {\n name: { type: 'string', pattern: '^\\\\S+ \\\\S+$' }, // \"entity action\"\n entity: { type: 'string' },\n action: { type: 'string' },\n data: { type: 'object' },\n context: { type: 'object' },\n globals: { type: 'object' },\n custom: { type: 'object' },\n user: { type: 'object' },\n nested: { type: 'array' },\n consent: { type: 'object' },\n id: { type: 'string' },\n trigger: { type: 'string' },\n timestamp: { type: 'number' },\n timing: { type: 'number' },\n source: {\n type: 'object',\n required: ['type'],\n properties: {\n type: { type: 'string' },\n platform: { type: 'string' },\n url: { type: 'string' },\n referrer: { type: 'string' },\n schema: { type: 'string' },\n version: { type: 'string' },\n count: { type: 'number' },\n trace: { type: 'string' },\n tool: { type: 'string' },\n command: { type: 'string' },\n },\n },\n },\n};\n","export * as step from './step';\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const validEvent: Flow.StepExample = {\n title: 'Valid event',\n description:\n 'A well-formed product view passes validation and is returned unchanged for downstream destinations.',\n in: getEvent('product view', {\n id: 'ev-1700000700',\n timestamp: 1700000700,\n data: { id: 'SKU-100', name: 'Trail Runner Pro', price: 129.99 },\n source: { type: 'browser', platform: 'web', url: 'https://example.com/' },\n }),\n out: [\n [\n 'return',\n getEvent('product view', {\n id: 'ev-1700000700',\n timestamp: 1700000700,\n data: { id: 'SKU-100', name: 'Trail Runner Pro', price: 129.99 },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://example.com/',\n },\n }),\n ],\n ],\n};\n\nexport const invalidFormat: Flow.StepExample = {\n public: false,\n in: {\n name: 'invalid',\n data: {},\n },\n out: [['return', false]],\n};\n\nexport const contractValidationPass: Flow.StepExample = {\n title: 'Contract validation',\n description:\n 'Contract validation passes when event data matches the entity.action JSON Schema',\n in: getEvent('order complete', {\n id: 'ev-1700000800',\n timestamp: 1700000800,\n data: { id: '0rd3r1d', total: 555, currency: 'EUR' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://shop.example.com/',\n },\n }),\n out: [\n [\n 'return',\n getEvent('order complete', {\n id: 'ev-1700000800',\n timestamp: 1700000800,\n data: { id: '0rd3r1d', total: 555, currency: 'EUR' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://shop.example.com/',\n },\n }),\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAA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A,QACX,MAAM,EAAE,IAAI,WAAW,OAAO,KAAK,UAAU,MAAM;AAAA,QACnD,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,UAAU;AAAA,UACV,KAAK;AAAA,QACP;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AHxDO,IAAM,iBAA6B;AAAA,EACxC,MAAM;AAAA,EACN,YAAY;AAAA,IACV,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aACE;AAAA,MACF,SAAS;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,aACE;AAAA,IACJ;AAAA,EACF;AACF;AAGO,IAAM,UAAwD;AAAA,EACnE,QAAQ;AAAA,EACR,UAAU;AACZ;","names":[]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=Object.defineProperty,e=(e,r)=>{for(var i in r)t(e,i,{get:r[i],enumerable:!0})},r={type:"object",required:["name","entity","action","data","globals","custom","user","consent","id","trigger","timestamp","timing","source"],properties:{name:{type:"string",pattern:"^\\S+ \\S+$"},entity:{type:"string"},action:{type:"string"},data:{type:"object"},context:{type:"object"},globals:{type:"object"},custom:{type:"object"},user:{type:"object"},nested:{type:"array"},consent:{type:"object"},id:{type:"string"},trigger:{type:"string"},timestamp:{type:"number"},timing:{type:"number"},source:{type:"object",required:["type"],properties:{type:{type:"string"},platform:{type:"string"},url:{type:"string"},referrer:{type:"string"},schema:{type:"string"},version:{type:"string"},count:{type:"number"},trace:{type:"string"},tool:{type:"string"},command:{type:"string"}}}}},i={};e(i,{step:()=>a});var a={};e(a,{contractValidationPass:()=>s,invalidFormat:()=>p,validEvent:()=>n});import{getEvent as o}from"@walkeros/core";var n={title:"Valid event",description:"A well-formed product view passes validation and is returned unchanged for downstream destinations.",in:o("product view",{id:"ev-1700000700",timestamp:1700000700,data:{id:"SKU-100",name:"Trail Runner Pro",price:129.99},source:{type:"browser",platform:"web",url:"https://example.com/"}}),out:[["return",o("product view",{id:"ev-1700000700",timestamp:1700000700,data:{id:"SKU-100",name:"Trail Runner Pro",price:129.99},source:{type:"browser",platform:"web",url:"https://example.com/"}})]]},p={public:!1,in:{name:"invalid",data:{}},out:[["return",!1]]},s={title:"Contract validation",description:"Contract validation passes when event data matches the entity.action JSON Schema",in:o("order complete",{id:"ev-1700000800",timestamp:1700000800,data:{id:"0rd3r1d",total:555,currency:"EUR"},source:{type:"browser",platform:"web",url:"https://shop.example.com/"}}),out:[["return",o("order complete",{id:"ev-1700000800",timestamp:1700000800,data:{id:"0rd3r1d",total:555,currency:"EUR"},source:{type:"browser",platform:"web",url:"https://shop.example.com/"}})]]},c={type:"object",properties:{format:{type:"boolean",description:"Validate full WalkerOS.Event structure. Pre-compiled at init.",default:!0},contract:{type:"object",description:"Event-specific validation rules. Entity/action keyed, supports wildcards."}}},d={format:r,settings:c};export{i as examples,r as formatSchema,d as schemas,c as settingsSchema};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/format-schema.ts","../src/examples/index.ts","../src/examples/step.ts","../src/dev.ts"],"sourcesContent":["import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n '
|
|
1
|
+
{"version":3,"sources":["../src/format-schema.ts","../src/examples/index.ts","../src/examples/step.ts","../src/dev.ts"],"sourcesContent":["import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n 'globals',\n 'custom',\n 'user',\n 'consent',\n 'id',\n 'trigger',\n 'timestamp',\n 'timing',\n 'source',\n ],\n properties: {\n name: { type: 'string', pattern: '^\\\\S+ \\\\S+$' }, // \"entity action\"\n entity: { type: 'string' },\n action: { type: 'string' },\n data: { type: 'object' },\n context: { type: 'object' },\n globals: { type: 'object' },\n custom: { type: 'object' },\n user: { type: 'object' },\n nested: { type: 'array' },\n consent: { type: 'object' },\n id: { type: 'string' },\n trigger: { type: 'string' },\n timestamp: { type: 'number' },\n timing: { type: 'number' },\n source: {\n type: 'object',\n required: ['type'],\n properties: {\n type: { type: 'string' },\n platform: { type: 'string' },\n url: { type: 'string' },\n referrer: { type: 'string' },\n schema: { type: 'string' },\n version: { type: 'string' },\n count: { type: 'number' },\n trace: { type: 'string' },\n tool: { type: 'string' },\n command: { type: 'string' },\n },\n },\n },\n};\n","export * as step from './step';\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nexport const validEvent: Flow.StepExample = {\n title: 'Valid event',\n description:\n 'A well-formed product view passes validation and is returned unchanged for downstream destinations.',\n in: getEvent('product view', {\n id: 'ev-1700000700',\n timestamp: 1700000700,\n data: { id: 'SKU-100', name: 'Trail Runner Pro', price: 129.99 },\n source: { type: 'browser', platform: 'web', url: 'https://example.com/' },\n }),\n out: [\n [\n 'return',\n getEvent('product view', {\n id: 'ev-1700000700',\n timestamp: 1700000700,\n data: { id: 'SKU-100', name: 'Trail Runner Pro', price: 129.99 },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://example.com/',\n },\n }),\n ],\n ],\n};\n\nexport const invalidFormat: Flow.StepExample = {\n public: false,\n in: {\n name: 'invalid',\n data: {},\n },\n out: [['return', false]],\n};\n\nexport const contractValidationPass: Flow.StepExample = {\n title: 'Contract validation',\n description:\n 'Contract validation passes when event data matches the entity.action JSON Schema',\n in: getEvent('order complete', {\n id: 'ev-1700000800',\n timestamp: 1700000800,\n data: { id: '0rd3r1d', total: 555, currency: 'EUR' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://shop.example.com/',\n },\n }),\n out: [\n [\n 'return',\n getEvent('order complete', {\n id: 'ev-1700000800',\n timestamp: 1700000800,\n data: { id: '0rd3r1d', total: 555, currency: 'EUR' },\n source: {\n type: 'browser',\n platform: 'web',\n url: 'https://shop.example.com/',\n },\n }),\n ],\n ],\n};\n","/**\n * Development exports for transformer-validator\n * Used by website documentation and examples\n */\nimport { formatSchema } from './format-schema';\nimport type { JsonSchema } from './types';\n\nexport { formatSchema };\n\n/**\n * JSON Schema describing ValidatorSettings for documentation.\n */\nexport const settingsSchema: JsonSchema = {\n type: 'object',\n properties: {\n format: {\n type: 'boolean',\n description:\n 'Validate full WalkerOS.Event structure. Pre-compiled at init.',\n default: true,\n },\n contract: {\n type: 'object',\n description:\n 'Event-specific validation rules. Entity/action keyed, supports wildcards.',\n },\n },\n};\n\n// Re-export for convenience\nexport const schemas: { format: JsonSchema; settings: JsonSchema } = {\n format: formatSchema,\n settings: settingsSchema,\n};\n\nexport * as examples from './examples';\n"],"mappings":";;;;;;;AAMO,IAAM,eAA2B;AAAA,EACtC,MAAM;AAAA,EACN,UAAU;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,MAAM,EAAE,MAAM,UAAU,SAAS,cAAc;AAAA;AAAA,IAC/C,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,MAAM,EAAE,MAAM,SAAS;AAAA,IACvB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,MAAM,EAAE,MAAM,SAAS;AAAA,IACvB,QAAQ,EAAE,MAAM,QAAQ;AAAA,IACxB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,IAAI,EAAE,MAAM,S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A,EACF;AACF;AAEO,IAAM,gBAAkC;AAAA,EAC7C,QAAQ;AAAA,EACR,IAAI;AAAA,IACF,MAAM;AAAA,IACN,MAAM,CAAC;AAAA,EACT;AAAA,EACA,KAAK,CAAC,CAAC,UAAU,KAAK,CAAC;AACzB;AAEO,IAAM,yBAA2C;AAAA,EACtD,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,kBAAkB;AAAA,IAC7B,IAAI;AAAA,IACJ,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,KAAK,UAAU,MAAM;AAAA,IACnD,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,KAAK;AAAA,IACP;AAAA,EACF,CAAC;AAAA,EACD,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,SAAS,kBAAkB;AAAA,QACzB,IAAI;AAAA,QACJ,WAAW;AAAA,QACX,MAAM,EAAE,IAAI,WAAW,OAAO,KAAK,UAAU,MAAM;AAAA,QACnD,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,UAAU;AAAA,UACV,KAAK;AAAA,QACP;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;ACxDO,IAAM,iBAA6B;AAAA,EACxC,MAAM;AAAA,EACN,YAAY;AAAA,IACV,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aACE;AAAA,MACF,SAAS;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,aACE;AAAA,IACJ;AAAA,EACF;AACF;AAGO,IAAM,UAAwD;AAAA,EACnE,QAAQ;AAAA,EACR,UAAU;AACZ;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.create,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var e,t=Object.create,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,s=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,a=(e,t,s,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of n(t))i.call(e,c)||c===s||r(e,c,{get:()=>t[c],enumerable:!(a=o(t,c))||a.enumerable});return e},c={};((e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})})(c,{default:()=>l,transformerValidator:()=>l}),module.exports=(e=c,a(r({},"__esModule",{value:!0}),e));var p=((e,o,n)=>(n=null!=e?t(s(e)):{},a(!o&&e&&e.__esModule?n:r(n,"default",{value:e,enumerable:!0}),e)))(require("ajv")),y={type:"object",required:["name","entity","action","data","globals","custom","user","consent","id","trigger","timestamp","timing","source"],properties:{name:{type:"string",pattern:"^\\S+ \\S+$"},entity:{type:"string"},action:{type:"string"},data:{type:"object"},context:{type:"object"},globals:{type:"object"},custom:{type:"object"},user:{type:"object"},nested:{type:"array"},consent:{type:"object"},id:{type:"string"},trigger:{type:"string"},timestamp:{type:"number"},timing:{type:"number"},source:{type:"object",required:["type"],properties:{type:{type:"string"},platform:{type:"string"},url:{type:"string"},referrer:{type:"string"},schema:{type:"string"},version:{type:"string"},count:{type:"number"},trace:{type:"string"},tool:{type:"string"},command:{type:"string"}}}}},l=e=>{const{config:t}=e,r=t.settings||{},{format:o=!0,events:n,globals:s,context:i,custom:a,user:c,consent:l}=r,u=new p.default({allErrors:!0,strict:!1}),m=o?u.compile(y):null,g=[],f={globals:s,context:i,custom:a,user:c,consent:l};for(const[e,t]of Object.entries(f))t&&g.push({name:e,field:e,validate:u.compile({type:"object",...t})});const b=new Map;return{type:"validator",config:t,async push(e,t){const{logger:r}=t;if(m&&!m(e))return r.error("Event format invalid",{errors:u.errorsText(m.errors)}),!1;for(const{name:t,field:o,validate:n}of g){if(!n(e[o]))return r.error(`${t} validation failed`,{errors:u.errorsText(n.errors)}),!1}if(n&&e.entity&&e.action){const t=function(e,t){if(n)return n[e]?.[t]?{schema:n[e][t],key:`${e} ${t}`}:n[e]?.["*"]?{schema:n[e]["*"],key:`${e} *`}:n["*"]?.[t]?{schema:n["*"][t],key:`* ${t}`}:n["*"]?.["*"]?{schema:n["*"]["*"],key:"* *"}:void 0}(e.entity,e.action);if(t){const o=function(e,t,r){const o=`${e}.${t}`;return b.has(o)||b.set(o,u.compile({type:"object",...r})),b.get(o)}(e.entity,e.action,t.schema);if(!o(e))return r.error("Contract validation failed",{rule:t.key,errors:u.errorsText(o.errors)}),!1;r.debug("Contract validation passed",{rule:t.key})}}return{event:e}}}};//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/transformer.ts","../src/format-schema.ts"],"sourcesContent":["export { transformerValidator } from './transformer';\nexport type { ValidatorSettings, ContractEvents, JsonSchema } from './types';\n\nexport { transformerValidator as default } from './transformer';\n","import Ajv, { ValidateFunction } from 'ajv';\nimport type { Transformer } from '@walkeros/core';\nimport { formatSchema } from './format-schema';\nimport type { ValidatorSettings, JsonSchema } from './types';\n\nexport const transformerValidator: Transformer.Init<\n Transformer.Types<ValidatorSettings>\n> = (context) => {\n const { config } = context;\n const settings = config.settings || {};\n const {\n format = true,\n events,\n globals,\n context: ctx,\n custom,\n user,\n consent,\n } = settings;\n\n const ajv = new Ajv({ allErrors: true, strict: false });\n\n // Pre-compile format validator\n const formatValidator = format ? ajv.compile(formatSchema) : null;\n\n // Pre-compile section validators (run on every event)\n const sectionValidators: Array<{\n name: string;\n field: string;\n validate: ValidateFunction;\n }> = [];\n\n const sectionSchemas = { globals, context: ctx, custom, user, consent };\n for (const [name, schema] of Object.entries(sectionSchemas)) {\n if (schema) {\n sectionValidators.push({\n name,\n field: name,\n validate: ajv.compile({ type: 'object', ...schema }),\n });\n }\n }\n\n // Lazy-compiled event validators\n const eventValidators = new Map<string, ValidateFunction>();\n\n function getEventValidator(\n entity: string,\n action: string,\n schema: JsonSchema,\n ) {\n const key = `${entity}.${action}`;\n if (!eventValidators.has(key)) {\n eventValidators.set(key, ajv.compile({ type: 'object', ...schema }));\n }\n return eventValidators.get(key)!;\n }\n\n /**\n * Find matching event schema using wildcard fallback.\n * Checks: entity.action → entity.* → *.action → *.*\n */\n function findEventSchema(\n entity: string,\n action: string,\n ): { schema: JsonSchema; key: string } | undefined {\n if (!events) return undefined;\n\n // Direct match\n if (events[entity]?.[action]) {\n return { schema: events[entity][action], key: `${entity} ${action}` };\n }\n // Entity wildcard\n if (events[entity]?.['*']) {\n return { schema: events[entity]['*'], key: `${entity} *` };\n }\n // Action wildcard\n if (events['*']?.[action]) {\n return { schema: events['*'][action], key: `* ${action}` };\n }\n // Global wildcard\n if (events['*']?.['*']) {\n return { schema: events['*']['*'], key: '* *' };\n }\n return undefined;\n }\n\n return {\n type: 'validator',\n config,\n\n async push(event, context) {\n const { logger } = context;\n\n // 1. Format validation (pre-compiled, fast)\n if (formatValidator && !formatValidator(event)) {\n logger.error('Event format invalid', {\n errors: ajv.errorsText(formatValidator.errors),\n });\n return false;\n }\n\n // 2. Section validation (pre-compiled, runs on every event)\n for (const { name, field, validate } of sectionValidators) {\n const value = (event as Record<string, unknown>)[field];\n if (!validate(value)) {\n logger.error(`${name} validation failed`, {\n errors: ajv.errorsText(validate.errors),\n });\n return false;\n }\n }\n\n // 3. Event validation (lazy compiled)\n if (events && event.entity && event.action) {\n const match = findEventSchema(event.entity, event.action);\n\n if (match) {\n const validator = getEventValidator(\n event.entity,\n event.action,\n match.schema,\n );\n\n if (!validator(event)) {\n logger.error('Contract validation failed', {\n rule: match.key,\n errors: ajv.errorsText(validator.errors),\n });\n return false;\n }\n\n logger.debug('Contract validation passed', { rule: match.key });\n }\n }\n\n return { event };\n },\n };\n};\n","import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n '
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/transformer.ts","../src/format-schema.ts"],"sourcesContent":["export { transformerValidator } from './transformer';\nexport type { ValidatorSettings, ContractEvents, JsonSchema } from './types';\n\nexport { transformerValidator as default } from './transformer';\n","import Ajv, { ValidateFunction } from 'ajv';\nimport type { Transformer } from '@walkeros/core';\nimport { formatSchema } from './format-schema';\nimport type { ValidatorSettings, JsonSchema } from './types';\n\nexport const transformerValidator: Transformer.Init<\n Transformer.Types<ValidatorSettings>\n> = (context) => {\n const { config } = context;\n const settings = config.settings || {};\n const {\n format = true,\n events,\n globals,\n context: ctx,\n custom,\n user,\n consent,\n } = settings;\n\n const ajv = new Ajv({ allErrors: true, strict: false });\n\n // Pre-compile format validator\n const formatValidator = format ? ajv.compile(formatSchema) : null;\n\n // Pre-compile section validators (run on every event)\n const sectionValidators: Array<{\n name: string;\n field: string;\n validate: ValidateFunction;\n }> = [];\n\n const sectionSchemas = { globals, context: ctx, custom, user, consent };\n for (const [name, schema] of Object.entries(sectionSchemas)) {\n if (schema) {\n sectionValidators.push({\n name,\n field: name,\n validate: ajv.compile({ type: 'object', ...schema }),\n });\n }\n }\n\n // Lazy-compiled event validators\n const eventValidators = new Map<string, ValidateFunction>();\n\n function getEventValidator(\n entity: string,\n action: string,\n schema: JsonSchema,\n ) {\n const key = `${entity}.${action}`;\n if (!eventValidators.has(key)) {\n eventValidators.set(key, ajv.compile({ type: 'object', ...schema }));\n }\n return eventValidators.get(key)!;\n }\n\n /**\n * Find matching event schema using wildcard fallback.\n * Checks: entity.action → entity.* → *.action → *.*\n */\n function findEventSchema(\n entity: string,\n action: string,\n ): { schema: JsonSchema; key: string } | undefined {\n if (!events) return undefined;\n\n // Direct match\n if (events[entity]?.[action]) {\n return { schema: events[entity][action], key: `${entity} ${action}` };\n }\n // Entity wildcard\n if (events[entity]?.['*']) {\n return { schema: events[entity]['*'], key: `${entity} *` };\n }\n // Action wildcard\n if (events['*']?.[action]) {\n return { schema: events['*'][action], key: `* ${action}` };\n }\n // Global wildcard\n if (events['*']?.['*']) {\n return { schema: events['*']['*'], key: '* *' };\n }\n return undefined;\n }\n\n return {\n type: 'validator',\n config,\n\n async push(event, context) {\n const { logger } = context;\n\n // 1. Format validation (pre-compiled, fast)\n if (formatValidator && !formatValidator(event)) {\n logger.error('Event format invalid', {\n errors: ajv.errorsText(formatValidator.errors),\n });\n return false;\n }\n\n // 2. Section validation (pre-compiled, runs on every event)\n for (const { name, field, validate } of sectionValidators) {\n const value = (event as Record<string, unknown>)[field];\n if (!validate(value)) {\n logger.error(`${name} validation failed`, {\n errors: ajv.errorsText(validate.errors),\n });\n return false;\n }\n }\n\n // 3. Event validation (lazy compiled)\n if (events && event.entity && event.action) {\n const match = findEventSchema(event.entity, event.action);\n\n if (match) {\n const validator = getEventValidator(\n event.entity,\n event.action,\n match.schema,\n );\n\n if (!validator(event)) {\n logger.error('Contract validation failed', {\n rule: match.key,\n errors: ajv.errorsText(validator.errors),\n });\n return false;\n }\n\n logger.debug('Contract validation passed', { rule: match.key });\n }\n }\n\n return { event };\n },\n };\n};\n","import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n 'globals',\n 'custom',\n 'user',\n 'consent',\n 'id',\n 'trigger',\n 'timestamp',\n 'timing',\n 'source',\n ],\n properties: {\n name: { type: 'string', pattern: '^\\\\S+ \\\\S+$' }, // \"entity action\"\n entity: { type: 'string' },\n action: { type: 'string' },\n data: { type: 'object' },\n context: { type: 'object' },\n globals: { type: 'object' },\n custom: { type: 'object' },\n user: { type: 'object' },\n nested: { type: 'array' },\n consent: { type: 'object' },\n id: { type: 'string' },\n trigger: { type: 'string' },\n timestamp: { type: 'number' },\n timing: { type: 'number' },\n source: {\n type: 'object',\n required: ['type'],\n properties: {\n type: { type: 'string' },\n platform: { type: 'string' },\n url: { type: 'string' },\n referrer: { type: 'string' },\n schema: { type: 'string' },\n version: { type: 'string' },\n count: { type: 'number' },\n trace: { type: 'string' },\n tool: { type: 'string' },\n command: { type: 'string' },\n },\n },\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAsC;;;ACM/B,IAAM,eAA2B;AAAA,EACtC,MAAM;AAAA,EACN,UAAU;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,MAAM,EAAE,MAAM,UAAU,SAAS,cAAc;AAAA;AAAA,IAC/C,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,MAAM,EAAE,MAAM,SAAS;AAAA,IACvB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,MAAM,EAAE,MAAM,SAAS;AAAA,IACvB,QAAQ,EAAE,MAAM,QAAQ;AAAA,IACxB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,IAAI,EAAE,MAAM,SAAS;AAAA,IACrB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,WAAW,EAAE,MAAM,SAAS;AAAA,IAC5B,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU,CAAC,MAAM;AAAA,MACjB,YAAY;AAAA,QACV,MAAM,EAAE,MAAM,SAAS;AAAA,QACvB,UAAU,EAAE,MAAM,SAAS;AAAA,QAC3B,KAAK,EAAE,MAAM,SAAS;AAAA,QACtB,UAAU,EAAE,MAAM,SAAS;AAAA,QAC3B,QAAQ,EA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ACT,gBAAM,YAAY;AAAA,YAChB,MAAM;AAAA,YACN,MAAM;AAAA,YACN,MAAM;AAAA,UACR;AAEA,cAAI,CAAC,UAAU,KAAK,GAAG;AACrB,mBAAO,MAAM,8BAA8B;AAAA,cACzC,MAAM,MAAM;AAAA,cACZ,QAAQ,IAAI,WAAW,UAAU,MAAM;AAAA,YACzC,CAAC;AACD,mBAAO;AAAA,UACT;AAEA,iBAAO,MAAM,8BAA8B,EAAE,MAAM,MAAM,IAAI,CAAC;AAAA,QAChE;AAAA,MACF;AAEA,aAAO,EAAE,MAAM;AAAA,IACjB;AAAA,EACF;AACF;","names":["Ajv","context"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"ajv";var t={type:"object",required:["name","entity","action","data","
|
|
1
|
+
import e from"ajv";var t={type:"object",required:["name","entity","action","data","globals","custom","user","consent","id","trigger","timestamp","timing","source"],properties:{name:{type:"string",pattern:"^\\S+ \\S+$"},entity:{type:"string"},action:{type:"string"},data:{type:"object"},context:{type:"object"},globals:{type:"object"},custom:{type:"object"},user:{type:"object"},nested:{type:"array"},consent:{type:"object"},id:{type:"string"},trigger:{type:"string"},timestamp:{type:"number"},timing:{type:"number"},source:{type:"object",required:["type"],properties:{type:{type:"string"},platform:{type:"string"},url:{type:"string"},referrer:{type:"string"},schema:{type:"string"},version:{type:"string"},count:{type:"number"},trace:{type:"string"},tool:{type:"string"},command:{type:"string"}}}}},r=r=>{const{config:n}=r,o=n.settings||{},{format:s=!0,events:i,globals:a,context:c,custom:p,user:y,consent:l}=o,m=new e({allErrors:!0,strict:!1}),u=s?m.compile(t):null,g=[],f={globals:a,context:c,custom:p,user:y,consent:l};for(const[e,t]of Object.entries(f))t&&g.push({name:e,field:e,validate:m.compile({type:"object",...t})});const d=new Map;return{type:"validator",config:n,async push(e,t){const{logger:r}=t;if(u&&!u(e))return r.error("Event format invalid",{errors:m.errorsText(u.errors)}),!1;for(const{name:t,field:n,validate:o}of g){if(!o(e[n]))return r.error(`${t} validation failed`,{errors:m.errorsText(o.errors)}),!1}if(i&&e.entity&&e.action){const t=function(e,t){if(i)return i[e]?.[t]?{schema:i[e][t],key:`${e} ${t}`}:i[e]?.["*"]?{schema:i[e]["*"],key:`${e} *`}:i["*"]?.[t]?{schema:i["*"][t],key:`* ${t}`}:i["*"]?.["*"]?{schema:i["*"]["*"],key:"* *"}:void 0}(e.entity,e.action);if(t){const n=function(e,t,r){const n=`${e}.${t}`;return d.has(n)||d.set(n,m.compile({type:"object",...r})),d.get(n)}(e.entity,e.action,t.schema);if(!n(e))return r.error("Contract validation failed",{rule:t.key,errors:m.errorsText(n.errors)}),!1;r.debug("Contract validation passed",{rule:t.key})}}return{event:e}}}};export{r as default,r as transformerValidator};//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/transformer.ts","../src/format-schema.ts"],"sourcesContent":["import Ajv, { ValidateFunction } from 'ajv';\nimport type { Transformer } from '@walkeros/core';\nimport { formatSchema } from './format-schema';\nimport type { ValidatorSettings, JsonSchema } from './types';\n\nexport const transformerValidator: Transformer.Init<\n Transformer.Types<ValidatorSettings>\n> = (context) => {\n const { config } = context;\n const settings = config.settings || {};\n const {\n format = true,\n events,\n globals,\n context: ctx,\n custom,\n user,\n consent,\n } = settings;\n\n const ajv = new Ajv({ allErrors: true, strict: false });\n\n // Pre-compile format validator\n const formatValidator = format ? ajv.compile(formatSchema) : null;\n\n // Pre-compile section validators (run on every event)\n const sectionValidators: Array<{\n name: string;\n field: string;\n validate: ValidateFunction;\n }> = [];\n\n const sectionSchemas = { globals, context: ctx, custom, user, consent };\n for (const [name, schema] of Object.entries(sectionSchemas)) {\n if (schema) {\n sectionValidators.push({\n name,\n field: name,\n validate: ajv.compile({ type: 'object', ...schema }),\n });\n }\n }\n\n // Lazy-compiled event validators\n const eventValidators = new Map<string, ValidateFunction>();\n\n function getEventValidator(\n entity: string,\n action: string,\n schema: JsonSchema,\n ) {\n const key = `${entity}.${action}`;\n if (!eventValidators.has(key)) {\n eventValidators.set(key, ajv.compile({ type: 'object', ...schema }));\n }\n return eventValidators.get(key)!;\n }\n\n /**\n * Find matching event schema using wildcard fallback.\n * Checks: entity.action → entity.* → *.action → *.*\n */\n function findEventSchema(\n entity: string,\n action: string,\n ): { schema: JsonSchema; key: string } | undefined {\n if (!events) return undefined;\n\n // Direct match\n if (events[entity]?.[action]) {\n return { schema: events[entity][action], key: `${entity} ${action}` };\n }\n // Entity wildcard\n if (events[entity]?.['*']) {\n return { schema: events[entity]['*'], key: `${entity} *` };\n }\n // Action wildcard\n if (events['*']?.[action]) {\n return { schema: events['*'][action], key: `* ${action}` };\n }\n // Global wildcard\n if (events['*']?.['*']) {\n return { schema: events['*']['*'], key: '* *' };\n }\n return undefined;\n }\n\n return {\n type: 'validator',\n config,\n\n async push(event, context) {\n const { logger } = context;\n\n // 1. Format validation (pre-compiled, fast)\n if (formatValidator && !formatValidator(event)) {\n logger.error('Event format invalid', {\n errors: ajv.errorsText(formatValidator.errors),\n });\n return false;\n }\n\n // 2. Section validation (pre-compiled, runs on every event)\n for (const { name, field, validate } of sectionValidators) {\n const value = (event as Record<string, unknown>)[field];\n if (!validate(value)) {\n logger.error(`${name} validation failed`, {\n errors: ajv.errorsText(validate.errors),\n });\n return false;\n }\n }\n\n // 3. Event validation (lazy compiled)\n if (events && event.entity && event.action) {\n const match = findEventSchema(event.entity, event.action);\n\n if (match) {\n const validator = getEventValidator(\n event.entity,\n event.action,\n match.schema,\n );\n\n if (!validator(event)) {\n logger.error('Contract validation failed', {\n rule: match.key,\n errors: ajv.errorsText(validator.errors),\n });\n return false;\n }\n\n logger.debug('Contract validation passed', { rule: match.key });\n }\n }\n\n return { event };\n },\n };\n};\n","import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n '
|
|
1
|
+
{"version":3,"sources":["../src/transformer.ts","../src/format-schema.ts"],"sourcesContent":["import Ajv, { ValidateFunction } from 'ajv';\nimport type { Transformer } from '@walkeros/core';\nimport { formatSchema } from './format-schema';\nimport type { ValidatorSettings, JsonSchema } from './types';\n\nexport const transformerValidator: Transformer.Init<\n Transformer.Types<ValidatorSettings>\n> = (context) => {\n const { config } = context;\n const settings = config.settings || {};\n const {\n format = true,\n events,\n globals,\n context: ctx,\n custom,\n user,\n consent,\n } = settings;\n\n const ajv = new Ajv({ allErrors: true, strict: false });\n\n // Pre-compile format validator\n const formatValidator = format ? ajv.compile(formatSchema) : null;\n\n // Pre-compile section validators (run on every event)\n const sectionValidators: Array<{\n name: string;\n field: string;\n validate: ValidateFunction;\n }> = [];\n\n const sectionSchemas = { globals, context: ctx, custom, user, consent };\n for (const [name, schema] of Object.entries(sectionSchemas)) {\n if (schema) {\n sectionValidators.push({\n name,\n field: name,\n validate: ajv.compile({ type: 'object', ...schema }),\n });\n }\n }\n\n // Lazy-compiled event validators\n const eventValidators = new Map<string, ValidateFunction>();\n\n function getEventValidator(\n entity: string,\n action: string,\n schema: JsonSchema,\n ) {\n const key = `${entity}.${action}`;\n if (!eventValidators.has(key)) {\n eventValidators.set(key, ajv.compile({ type: 'object', ...schema }));\n }\n return eventValidators.get(key)!;\n }\n\n /**\n * Find matching event schema using wildcard fallback.\n * Checks: entity.action → entity.* → *.action → *.*\n */\n function findEventSchema(\n entity: string,\n action: string,\n ): { schema: JsonSchema; key: string } | undefined {\n if (!events) return undefined;\n\n // Direct match\n if (events[entity]?.[action]) {\n return { schema: events[entity][action], key: `${entity} ${action}` };\n }\n // Entity wildcard\n if (events[entity]?.['*']) {\n return { schema: events[entity]['*'], key: `${entity} *` };\n }\n // Action wildcard\n if (events['*']?.[action]) {\n return { schema: events['*'][action], key: `* ${action}` };\n }\n // Global wildcard\n if (events['*']?.['*']) {\n return { schema: events['*']['*'], key: '* *' };\n }\n return undefined;\n }\n\n return {\n type: 'validator',\n config,\n\n async push(event, context) {\n const { logger } = context;\n\n // 1. Format validation (pre-compiled, fast)\n if (formatValidator && !formatValidator(event)) {\n logger.error('Event format invalid', {\n errors: ajv.errorsText(formatValidator.errors),\n });\n return false;\n }\n\n // 2. Section validation (pre-compiled, runs on every event)\n for (const { name, field, validate } of sectionValidators) {\n const value = (event as Record<string, unknown>)[field];\n if (!validate(value)) {\n logger.error(`${name} validation failed`, {\n errors: ajv.errorsText(validate.errors),\n });\n return false;\n }\n }\n\n // 3. Event validation (lazy compiled)\n if (events && event.entity && event.action) {\n const match = findEventSchema(event.entity, event.action);\n\n if (match) {\n const validator = getEventValidator(\n event.entity,\n event.action,\n match.schema,\n );\n\n if (!validator(event)) {\n logger.error('Contract validation failed', {\n rule: match.key,\n errors: ajv.errorsText(validator.errors),\n });\n return false;\n }\n\n logger.debug('Contract validation passed', { rule: match.key });\n }\n }\n\n return { event };\n },\n };\n};\n","import type { JsonSchema } from './types';\n\n/**\n * Pre-compiled JSON Schema for WalkerOS.Event structure validation.\n * Validates that all required fields exist with correct types.\n */\nexport const formatSchema: JsonSchema = {\n type: 'object',\n required: [\n 'name',\n 'entity',\n 'action',\n 'data',\n 'globals',\n 'custom',\n 'user',\n 'consent',\n 'id',\n 'trigger',\n 'timestamp',\n 'timing',\n 'source',\n ],\n properties: {\n name: { type: 'string', pattern: '^\\\\S+ \\\\S+$' }, // \"entity action\"\n entity: { type: 'string' },\n action: { type: 'string' },\n data: { type: 'object' },\n context: { type: 'object' },\n globals: { type: 'object' },\n custom: { type: 'object' },\n user: { type: 'object' },\n nested: { type: 'array' },\n consent: { type: 'object' },\n id: { type: 'string' },\n trigger: { type: 'string' },\n timestamp: { type: 'number' },\n timing: { type: 'number' },\n source: {\n type: 'object',\n required: ['type'],\n properties: {\n type: { type: 'string' },\n platform: { type: 'string' },\n url: { type: 'string' },\n referrer: { type: 'string' },\n schema: { type: 'string' },\n version: { type: 'string' },\n count: { type: 'number' },\n trace: { type: 'string' },\n tool: { type: 'string' },\n command: { type: 'string' },\n },\n },\n },\n};\n"],"mappings":";AAAA,OAAO,SAA+B;;;ACM/B,IAAM,eAA2B;AAAA,EACtC,MAAM;AAAA,EACN,UAAU;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,MAAM,EAAE,MAAM,UAAU,SAAS,cAAc;AAAA;AAAA,IAC/C,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,MAAM,EAAE,MAAM,SAAS;AAAA,IACvB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,MAAM,EAAE,MAAM,SAAS;AAAA,IACvB,QAAQ,EAAE,MAAM,QAAQ;AAAA,IACxB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,IAAI,EAAE,MAAM,SAAS;AAAA,IACrB,SAAS,EAAE,MAAM,SAAS;AAAA,IAC1B,WAAW,EAAE,MAAM,SAAS;AAAA,IAC5B,QAAQ,EAAE,MAAM,SAAS;AAAA,IACzB,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU,CAAC,MAAM;AAAA,MACjB,YAAY;AAAA,QACV,MAAM,EAAE,MAAM,SAAS;AAAA,QACvB,UAAU,EAAE,MAAM,SAAS;AAAA,QAC3B,KAAK,EAAE,MAAM,SAAS;AAAA,QACtB,UAAU,EAAE,MAAM,SAAS;AAAA,QAC3B,QAAQ,EAAE,MAAM,SAAS;AAAA,QACzB,SAAS,EAAE,MAAM,SAAS;AAAA,QAC1B,OAAO,EAAE,MAAM,SAAS;AAAA,QAC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AAK,GAAG;AACrB,mBAAO,MAAM,8BAA8B;AAAA,cACzC,MAAM,MAAM;AAAA,cACZ,QAAQ,IAAI,WAAW,UAAU,MAAM;AAAA,YACzC,CAAC;AACD,mBAAO;AAAA,UACT;AAEA,iBAAO,MAAM,8BAA8B,EAAE,MAAM,MAAM,IAAI,CAAC;AAAA,QAChE;AAAA,MACF;AAEA,aAAO,EAAE,MAAM;AAAA,IACjB;AAAA,EACF;AACF;","names":["context"]}
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/transformer-validator",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0-next-1777463920154",
|
|
5
5
|
"type": "transformer",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web",
|
|
@@ -18,19 +18,14 @@
|
|
|
18
18
|
"entity",
|
|
19
19
|
"action",
|
|
20
20
|
"data",
|
|
21
|
-
"context",
|
|
22
21
|
"globals",
|
|
23
22
|
"custom",
|
|
24
23
|
"user",
|
|
25
|
-
"nested",
|
|
26
24
|
"consent",
|
|
27
25
|
"id",
|
|
28
26
|
"trigger",
|
|
29
27
|
"timestamp",
|
|
30
28
|
"timing",
|
|
31
|
-
"group",
|
|
32
|
-
"count",
|
|
33
|
-
"version",
|
|
34
29
|
"source"
|
|
35
30
|
],
|
|
36
31
|
"properties": {
|
|
@@ -77,42 +72,40 @@
|
|
|
77
72
|
"timing": {
|
|
78
73
|
"type": "number"
|
|
79
74
|
},
|
|
80
|
-
"
|
|
81
|
-
"type": "string"
|
|
82
|
-
},
|
|
83
|
-
"count": {
|
|
84
|
-
"type": "number"
|
|
85
|
-
},
|
|
86
|
-
"version": {
|
|
75
|
+
"source": {
|
|
87
76
|
"type": "object",
|
|
88
77
|
"required": [
|
|
89
|
-
"
|
|
90
|
-
"tagging"
|
|
78
|
+
"type"
|
|
91
79
|
],
|
|
92
80
|
"properties": {
|
|
93
|
-
"
|
|
81
|
+
"type": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"platform": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
},
|
|
87
|
+
"url": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"referrer": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
},
|
|
93
|
+
"schema": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"version": {
|
|
94
97
|
"type": "string"
|
|
95
98
|
},
|
|
96
|
-
"
|
|
99
|
+
"count": {
|
|
97
100
|
"type": "number"
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
"source": {
|
|
102
|
-
"type": "object",
|
|
103
|
-
"required": [
|
|
104
|
-
"type",
|
|
105
|
-
"id",
|
|
106
|
-
"previous_id"
|
|
107
|
-
],
|
|
108
|
-
"properties": {
|
|
109
|
-
"type": {
|
|
101
|
+
},
|
|
102
|
+
"trace": {
|
|
110
103
|
"type": "string"
|
|
111
104
|
},
|
|
112
|
-
"
|
|
105
|
+
"tool": {
|
|
113
106
|
"type": "string"
|
|
114
107
|
},
|
|
115
|
-
"
|
|
108
|
+
"command": {
|
|
116
109
|
"type": "string"
|
|
117
110
|
}
|
|
118
111
|
}
|
|
@@ -214,22 +207,16 @@
|
|
|
214
207
|
"consent": {
|
|
215
208
|
"functional": true
|
|
216
209
|
},
|
|
217
|
-
"id": "1700000800
|
|
210
|
+
"id": "ev-1700000800",
|
|
218
211
|
"trigger": "load",
|
|
219
212
|
"entity": "order",
|
|
220
213
|
"action": "complete",
|
|
221
214
|
"timestamp": 1700000800,
|
|
222
215
|
"timing": 3.14,
|
|
223
|
-
"group": "gr0up",
|
|
224
|
-
"count": 1,
|
|
225
|
-
"version": {
|
|
226
|
-
"source": "3.4.2",
|
|
227
|
-
"tagging": 1
|
|
228
|
-
},
|
|
229
216
|
"source": {
|
|
230
|
-
"type": "
|
|
231
|
-
"
|
|
232
|
-
"
|
|
217
|
+
"type": "browser",
|
|
218
|
+
"platform": "web",
|
|
219
|
+
"url": "https://shop.example.com/"
|
|
233
220
|
}
|
|
234
221
|
},
|
|
235
222
|
"out": [
|
|
@@ -310,22 +297,16 @@
|
|
|
310
297
|
"consent": {
|
|
311
298
|
"functional": true
|
|
312
299
|
},
|
|
313
|
-
"id": "1700000800
|
|
300
|
+
"id": "ev-1700000800",
|
|
314
301
|
"trigger": "load",
|
|
315
302
|
"entity": "order",
|
|
316
303
|
"action": "complete",
|
|
317
304
|
"timestamp": 1700000800,
|
|
318
305
|
"timing": 3.14,
|
|
319
|
-
"group": "gr0up",
|
|
320
|
-
"count": 1,
|
|
321
|
-
"version": {
|
|
322
|
-
"source": "3.4.2",
|
|
323
|
-
"tagging": 1
|
|
324
|
-
},
|
|
325
306
|
"source": {
|
|
326
|
-
"type": "
|
|
327
|
-
"
|
|
328
|
-
"
|
|
307
|
+
"type": "browser",
|
|
308
|
+
"platform": "web",
|
|
309
|
+
"url": "https://shop.example.com/"
|
|
329
310
|
}
|
|
330
311
|
}
|
|
331
312
|
]
|
|
@@ -375,22 +356,16 @@
|
|
|
375
356
|
"consent": {
|
|
376
357
|
"functional": true
|
|
377
358
|
},
|
|
378
|
-
"id": "1700000700
|
|
359
|
+
"id": "ev-1700000700",
|
|
379
360
|
"trigger": "load",
|
|
380
361
|
"entity": "product",
|
|
381
362
|
"action": "view",
|
|
382
363
|
"timestamp": 1700000700,
|
|
383
364
|
"timing": 3.14,
|
|
384
|
-
"group": "gr0up",
|
|
385
|
-
"count": 1,
|
|
386
|
-
"version": {
|
|
387
|
-
"source": "3.4.2",
|
|
388
|
-
"tagging": 1
|
|
389
|
-
},
|
|
390
365
|
"source": {
|
|
391
|
-
"type": "
|
|
392
|
-
"
|
|
393
|
-
"
|
|
366
|
+
"type": "browser",
|
|
367
|
+
"platform": "web",
|
|
368
|
+
"url": "https://example.com/"
|
|
394
369
|
}
|
|
395
370
|
},
|
|
396
371
|
"out": [
|
|
@@ -424,22 +399,16 @@
|
|
|
424
399
|
"consent": {
|
|
425
400
|
"functional": true
|
|
426
401
|
},
|
|
427
|
-
"id": "1700000700
|
|
402
|
+
"id": "ev-1700000700",
|
|
428
403
|
"trigger": "load",
|
|
429
404
|
"entity": "product",
|
|
430
405
|
"action": "view",
|
|
431
406
|
"timestamp": 1700000700,
|
|
432
407
|
"timing": 3.14,
|
|
433
|
-
"group": "gr0up",
|
|
434
|
-
"count": 1,
|
|
435
|
-
"version": {
|
|
436
|
-
"source": "3.4.2",
|
|
437
|
-
"tagging": 1
|
|
438
|
-
},
|
|
439
408
|
"source": {
|
|
440
|
-
"type": "
|
|
441
|
-
"
|
|
442
|
-
"
|
|
409
|
+
"type": "browser",
|
|
410
|
+
"platform": "web",
|
|
411
|
+
"url": "https://example.com/"
|
|
443
412
|
}
|
|
444
413
|
}
|
|
445
414
|
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/transformer-validator",
|
|
3
3
|
"description": "Event validation transformer for walkerOS using AJV and JSON Schema",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0-next-1777463920154",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"ajv": "^8.17.1",
|
|
36
|
-
"@walkeros/core": "
|
|
36
|
+
"@walkeros/core": "4.0.0-next-1777463920154"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@walkeros/core": "
|
|
39
|
+
"@walkeros/core": "4.0.0-next-1777463920154"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
42
42
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|