@walkeros/server-destination-meta 2.2.0-next-1773136823705 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.d.mts +3 -1
- package/dist/dev.d.ts +3 -1
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +3 -1
- package/dist/examples/index.d.ts +3 -1
- package/dist/examples/index.js +41 -1
- package/dist/examples/index.mjs +41 -1
- package/dist/walkerOS.json +130 -2
- package/package.json +6 -6
package/dist/dev.d.mts
CHANGED
|
@@ -110,11 +110,13 @@ declare namespace env {
|
|
|
110
110
|
|
|
111
111
|
declare const purchase: Flow.StepExample;
|
|
112
112
|
declare const lead: Flow.StepExample;
|
|
113
|
+
declare const purchaseWithClickAttribution: Flow.StepExample;
|
|
113
114
|
|
|
114
115
|
declare const step_lead: typeof lead;
|
|
115
116
|
declare const step_purchase: typeof purchase;
|
|
117
|
+
declare const step_purchaseWithClickAttribution: typeof purchaseWithClickAttribution;
|
|
116
118
|
declare namespace step {
|
|
117
|
-
export { step_lead as lead, step_purchase as purchase };
|
|
119
|
+
export { step_lead as lead, step_purchase as purchase, step_purchaseWithClickAttribution as purchaseWithClickAttribution };
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
declare const index_env: typeof env;
|
package/dist/dev.d.ts
CHANGED
|
@@ -110,11 +110,13 @@ declare namespace env {
|
|
|
110
110
|
|
|
111
111
|
declare const purchase: Flow.StepExample;
|
|
112
112
|
declare const lead: Flow.StepExample;
|
|
113
|
+
declare const purchaseWithClickAttribution: Flow.StepExample;
|
|
113
114
|
|
|
114
115
|
declare const step_lead: typeof lead;
|
|
115
116
|
declare const step_purchase: typeof purchase;
|
|
117
|
+
declare const step_purchaseWithClickAttribution: typeof purchaseWithClickAttribution;
|
|
116
118
|
declare namespace step {
|
|
117
|
-
export { step_lead as lead, step_purchase as purchase };
|
|
119
|
+
export { step_lead as lead, step_purchase as purchase, step_purchaseWithClickAttribution as purchaseWithClickAttribution };
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
declare const index_env: typeof env;
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},n={};o(n,{examples:()=>g,schemas:()=>s}),module.exports=(e=n,((e,o,n,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of r(o))i.call(e,c)||c===n||t(e,c,{get:()=>o[c],enumerable:!(s=a(o,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{ActionSourceSchema:()=>p,EventNameSchema:()=>l,MappingSchema:()=>v,SettingsSchema:()=>m,mapping:()=>h,settings:()=>_});var c=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),p=u.z.enum(["email","website","app","phone_call","chat","physical_store","system_generated","business_messaging","other"]),l=u.z.union([u.z.enum(["AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),u.z.string()]),m=d.z.object({accessToken:d.z.string().min(1).describe("Meta access token for Conversions API authentication (like your_access_token)"),pixelId:d.z.string().regex(/^[0-9]+$/,"Pixel ID must contain only digits").describe("Meta Pixel ID from your Facebook Business account (like 1234567890)"),action_source:p.describe("Source of the event (website, app, phone_call, etc.) (like website)").optional(),doNotHash:d.z.array(d.z.string()).describe("Array of user_data fields that should not be hashed (like ['client_ip_address', 'client_user_agent'])").optional(),test_event_code:d.z.string().describe("Test event code for debugging Meta Conversions API events (like TEST12345)").optional(),url:d.z.string().url().describe("Custom URL for Meta Conversions API endpoint (like https://graph.facebook.com/v17.0)").optional(),user_data:d.z.record(d.z.string(),d.z.string()).describe("Mapping configuration for user data fields (like { email: 'user.email', phone: 'user.phone' })").optional()}),v=require("@walkeros/core/dev").z.object({}),_=(0,c.zodToSchema)(m),h=(0,c.zodToSchema)(v),g={};o(g,{env:()=>b,step:()=>k});var b={};o(b,{push:()=>y,simulation:()=>f});var y={sendServer:async function(e,t,a){return{ok:!0,data:{events_received:1,messages:[],fbtrace_id:"mock-trace-id"}}}},f=["sendServer"],k={};o(k,{lead:()=>z,purchase:()=>x,purchaseWithClickAttribution:()=>w});var S=require("@walkeros/core"),x={in:(0,S.getEvent)("order complete",{timestamp:1700000900,data:{id:"ORD-300",total:249.99,currency:"EUR"},nested:[{entity:"product",data:{id:"SKU-A1",price:129.99,quantity:2}}],user:{id:"user-123",device:"device-456"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{name:"Purchase",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},value:"data.total",contents:{loop:["nested",{condition:e=>(0,S.isObject)(e)&&"product"===e.entity,map:{id:"data.id",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:{data:[{event_name:"Purchase",event_time:1700000900,event_id:"1700000900-gr0up-1",event_source_url:"https://shop.example.com",action_source:"website",user_data:{external_id:["user-123"]},currency:"EUR",value:249.99,contents:[{id:"SKU-A1",quantity:2,item_price:129.99}]}]}},z={in:(0,S.getEvent)("form submit",{timestamp:1700000901,data:{type:"newsletter"},user:{email:"user@example.com"},source:{type:"server",id:"https://example.com",previous_id:""}}),mapping:void 0,out:{data:[{event_name:"Lead",event_time:1700000901,event_id:"1700000901-gr0up-1",event_source_url:"https://example.com",action_source:"website",user_data:{email:["user@example.com"]}}]}},w={in:(0,S.getEvent)("order complete",{timestamp:1700000902,data:{id:"ORD-700",total:89.99,currency:"USD"},user:{id:"cust-42"},context:{fbclid:["abc123xyz",0]},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{name:"Purchase",data:{map:{currency:{key:"data.currency",value:"EUR"},value:"data.total",order_id:"data.id",user_data:{map:{external_id:"user.id",fbclid:"context.fbclid"}}}}},out:{data:[{event_name:"Purchase",event_time:1700000902,event_id:"1700000902-gr0up-1",event_source_url:"https://shop.example.com",action_source:"website",currency:"USD",value:89.99,order_id:"ORD-700"}]}};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Meta access token for Conversions API authentication (like your_access_token)',\n ),\n pixelId: z\n .string()\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits')\n .describe(\n 'Meta Pixel ID from your Facebook Business account (like 1234567890)',\n ),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (website, app, phone_call, etc.) (like website)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['client_ip_address', 'client_user_agent'])\",\n )\n .optional(),\n test_event_code: z\n .string()\n .describe(\n 'Test event code for debugging Meta Conversions API events (like TEST12345)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Meta Conversions API endpoint (like https://graph.facebook.com/v17.0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { email: 'user.email', phone: 'user.phone' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event\n */\nexport const ActionSourceSchema = z.enum([\n 'email',\n 'website',\n 'app',\n 'phone_call',\n 'chat',\n 'physical_store',\n 'system_generated',\n 'business_messaging',\n 'other',\n]);\n\n/**\n * Event Name\n * Standard Meta event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'AddPaymentInfo',\n 'AddToCart',\n 'AddToWishlist',\n 'CompleteRegistration',\n 'Contact',\n 'CustomizeProduct',\n 'Donate',\n 'FindLocation',\n 'InitiateCheckout',\n 'Lead',\n 'Purchase',\n 'Schedule',\n 'Search',\n 'StartTrial',\n 'SubmitApplication',\n 'Subscribe',\n 'ViewContent',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Conversions API Mapping Schema\n * Meta CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Meta API response\n return {\n ok: true,\n data: {\n events_received: 1,\n messages: [],\n fbtrace_id: 'mock-trace-id',\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Meta Conversions API events without making\n * actual HTTP requests to Facebook's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n { entity: 'product', data: { id: 'SKU-A1', price: 129.99, quantity: 2 } },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.total',\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'Purchase',\n event_time: 1700000900,\n event_id: '1700000900-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'website',\n user_data: {\n external_id: ['user-123'],\n },\n currency: 'EUR',\n value: 249.99,\n contents: [{ id: 'SKU-A1', quantity: 2, item_price: 129.99 }],\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000901,\n data: { type: 'newsletter' },\n user: { email: 'user@example.com' },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: {\n data: [\n {\n event_name: 'Lead',\n event_time: 1700000901,\n event_id: '1700000901-gr0up-1',\n event_source_url: 'https://example.com',\n action_source: 'website',\n user_data: {\n email: ['user@example.com'],\n },\n },\n ],\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAOX,IAAM,qBAAqB,aAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,aAAE,MAAM;AAAA,EACrC,aAAE,KAAK;AAAA,IACL;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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,aAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiB,cAAE,OAAO;AAAA,EACrC,aAAa,cACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,cACN,OAAO,EACP,MAAM,YAAY,mCAAmC,EACrD;AAAA,IACC;AAAA,EACF;AAAA,EACF,eAAe,mBAAmB;AAAA,IAChC;AAAA,EACF,EAAE,SAAS;AAAA,EACX,WAAW,cACR,MAAM,cAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,cACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,cACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,cACR,OAAO,cAAE,OAAO,GAA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AAAA,gBACH,IAAI;AAAA,gBACJ,YAAY;AAAA,gBACZ,UAAU,EAAE,KAAK,iBAAiB,OAAO,EAAE;AAAA,cAC7C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,QACA,WAAW;AAAA,UACT,IAAI,CAAC,UACF,MAAyB,OAAO;AAAA,YAC/B,CAAC,SAAS,KAAK,WAAW;AAAA,UAC5B,EAAE;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,MACJ;AAAA,QACE,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,WAAW;AAAA,UACT,aAAa,CAAC,UAAU;AAAA,QAC1B;AAAA,QACA,UAAU;AAAA,QACV,OAAO;AAAA,QACP,UAAU,CAAC,EAAE,IAAI,UAAU,UAAU,GAAG,YAAY,OAAO,CAAC;AAAA,MAC9D;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,OAAyB;AAAA,EACpC,QAAI,sBAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,aAAa;AAAA,IAC3B,MAAM,EAAE,OAAO,mBAAmB;AAAA,IAClC,QAAQ,EAAE,MAAM,UAAU,IAAI,uBAAuB,aAAa,GAAG;AAAA,EACvE,CAAC;AAAA,EACD,SAAS;AAAA,EACT,KAAK;AAAA,IACH,MAAM;AAAA,MACJ;AAAA,QACE,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,WAAW;AAAA,UACT,OAAO,CAAC,kBAAkB;AAAA,QAC5B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Meta access token for Conversions API authentication (like your_access_token)',\n ),\n pixelId: z\n .string()\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits')\n .describe(\n 'Meta Pixel ID from your Facebook Business account (like 1234567890)',\n ),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (website, app, phone_call, etc.) (like website)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['client_ip_address', 'client_user_agent'])\",\n )\n .optional(),\n test_event_code: z\n .string()\n .describe(\n 'Test event code for debugging Meta Conversions API events (like TEST12345)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Meta Conversions API endpoint (like https://graph.facebook.com/v17.0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { email: 'user.email', phone: 'user.phone' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event\n */\nexport const ActionSourceSchema = z.enum([\n 'email',\n 'website',\n 'app',\n 'phone_call',\n 'chat',\n 'physical_store',\n 'system_generated',\n 'business_messaging',\n 'other',\n]);\n\n/**\n * Event Name\n * Standard Meta event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'AddPaymentInfo',\n 'AddToCart',\n 'AddToWishlist',\n 'CompleteRegistration',\n 'Contact',\n 'CustomizeProduct',\n 'Donate',\n 'FindLocation',\n 'InitiateCheckout',\n 'Lead',\n 'Purchase',\n 'Schedule',\n 'Search',\n 'StartTrial',\n 'SubmitApplication',\n 'Subscribe',\n 'ViewContent',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Conversions API Mapping Schema\n * Meta CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Meta API response\n return {\n ok: true,\n data: {\n events_received: 1,\n messages: [],\n fbtrace_id: 'mock-trace-id',\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Meta Conversions API events without making\n * actual HTTP requests to Facebook's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n { entity: 'product', data: { id: 'SKU-A1', price: 129.99, quantity: 2 } },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.total',\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'Purchase',\n event_time: 1700000900,\n event_id: '1700000900-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'website',\n user_data: {\n external_id: ['user-123'],\n },\n currency: 'EUR',\n value: 249.99,\n contents: [{ id: 'SKU-A1', quantity: 2, item_price: 129.99 }],\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000901,\n data: { type: 'newsletter' },\n user: { email: 'user@example.com' },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: {\n data: [\n {\n event_name: 'Lead',\n event_time: 1700000901,\n event_id: '1700000901-gr0up-1',\n event_source_url: 'https://example.com',\n action_source: 'website',\n user_data: {\n email: ['user@example.com'],\n },\n },\n ],\n },\n};\n\nexport const purchaseWithClickAttribution: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000902,\n data: { id: 'ORD-700', total: 89.99, currency: 'USD' },\n user: { id: 'cust-42' },\n context: { fbclid: ['abc123xyz', 0] },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.total',\n order_id: 'data.id',\n user_data: {\n map: {\n external_id: 'user.id',\n fbclid: 'context.fbclid',\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'Purchase',\n event_time: 1700000902,\n event_id: '1700000902-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'website',\n currency: 'USD',\n value: 89.99,\n order_id: 'ORD-700',\n },\n ],\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,IAAAC,cAAkB;;;ACAlB,iBAAkB;AAOX,IAAM,qBAAqB,aAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,aAAE,MAAM;AAAA,EACrC,aAAE,KAAK;AAAA,IACL;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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,aAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiB,cAAE,OAAO;AAAA,EACrC,aAAa,cACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAAS,cACN,OAAO,EACP,MAAM,YAAY,mCAAmC,EACrD;AAAA,IACC;AAAA,EACF;AAAA,EACF,eAAe,mBAAmB;AAAA,IAChC;AAAA,EACF,EAAE,SAAS;AAAA,EACX,WAAW,cACR,MAAM,cAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,cACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,cACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,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IAC7B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,OAAO,UAAU,MAAM;AAAA,IACrD,MAAM,EAAE,IAAI,UAAU;AAAA,IACtB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE;AAAA,IACpC,QAAQ,EAAE,MAAM,UAAU,IAAI,4BAA4B,aAAa,GAAG;AAAA,EAC5E,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU,EAAE,KAAK,iBAAiB,OAAO,MAAM;AAAA,QAC/C,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,UACT,KAAK;AAAA,YACH,aAAa;AAAA,YACb,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,MACJ;AAAA,QACE,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,UAAU;AAAA,QACV,OAAO;AAAA,QACP,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a)=>{for(var r in a)e(t,r,{get:a[r],enumerable:!0})},a={};t(a,{ActionSourceSchema:()=>s,EventNameSchema:()=>n,MappingSchema:()=>u,SettingsSchema:()=>c,mapping:()=>m,settings:()=>p});import{zodToSchema as r}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var s=o.enum(["email","website","app","phone_call","chat","physical_store","system_generated","business_messaging","other"]),n=o.union([o.enum(["AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),o.string()]),c=i.object({accessToken:i.string().min(1).describe("Meta access token for Conversions API authentication (like your_access_token)"),pixelId:i.string().regex(/^[0-9]+$/,"Pixel ID must contain only digits").describe("Meta Pixel ID from your Facebook Business account (like 1234567890)"),action_source:s.describe("Source of the event (website, app, phone_call, etc.) (like website)").optional(),doNotHash:i.array(i.string()).describe("Array of user_data fields that should not be hashed (like ['client_ip_address', 'client_user_agent'])").optional(),test_event_code:i.string().describe("Test event code for debugging Meta Conversions API events (like TEST12345)").optional(),url:i.string().url().describe("Custom URL for Meta Conversions API endpoint (like https://graph.facebook.com/v17.0)").optional(),user_data:i.record(i.string(),i.string()).describe("Mapping configuration for user data fields (like { email: 'user.email', phone: 'user.phone' })").optional()});import{z as d}from"@walkeros/core/dev";var u=d.object({}),p=r(c),m=r(u),l={};t(l,{env:()=>v,step:()=>g});var v={};t(v,{push:()=>_,simulation:()=>h});var _={sendServer:async function(e,t,a){return{ok:!0,data:{events_received:1,messages:[],fbtrace_id:"mock-trace-id"}}}},h=["sendServer"],g={};t(g,{lead:()=>k,purchase:()=>f});import{getEvent as
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var r in a)e(t,r,{get:a[r],enumerable:!0})},a={};t(a,{ActionSourceSchema:()=>s,EventNameSchema:()=>n,MappingSchema:()=>u,SettingsSchema:()=>c,mapping:()=>m,settings:()=>p});import{zodToSchema as r}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var s=o.enum(["email","website","app","phone_call","chat","physical_store","system_generated","business_messaging","other"]),n=o.union([o.enum(["AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"]),o.string()]),c=i.object({accessToken:i.string().min(1).describe("Meta access token for Conversions API authentication (like your_access_token)"),pixelId:i.string().regex(/^[0-9]+$/,"Pixel ID must contain only digits").describe("Meta Pixel ID from your Facebook Business account (like 1234567890)"),action_source:s.describe("Source of the event (website, app, phone_call, etc.) (like website)").optional(),doNotHash:i.array(i.string()).describe("Array of user_data fields that should not be hashed (like ['client_ip_address', 'client_user_agent'])").optional(),test_event_code:i.string().describe("Test event code for debugging Meta Conversions API events (like TEST12345)").optional(),url:i.string().url().describe("Custom URL for Meta Conversions API endpoint (like https://graph.facebook.com/v17.0)").optional(),user_data:i.record(i.string(),i.string()).describe("Mapping configuration for user data fields (like { email: 'user.email', phone: 'user.phone' })").optional()});import{z as d}from"@walkeros/core/dev";var u=d.object({}),p=r(c),m=r(u),l={};t(l,{env:()=>v,step:()=>g});var v={};t(v,{push:()=>_,simulation:()=>h});var _={sendServer:async function(e,t,a){return{ok:!0,data:{events_received:1,messages:[],fbtrace_id:"mock-trace-id"}}}},h=["sendServer"],g={};t(g,{lead:()=>k,purchase:()=>f,purchaseWithClickAttribution:()=>x});import{getEvent as y,isObject as b}from"@walkeros/core";var f={in:y("order complete",{timestamp:1700000900,data:{id:"ORD-300",total:249.99,currency:"EUR"},nested:[{entity:"product",data:{id:"SKU-A1",price:129.99,quantity:2}}],user:{id:"user-123",device:"device-456"},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{name:"Purchase",data:{map:{order_id:"data.id",currency:{key:"data.currency",value:"EUR"},value:"data.total",contents:{loop:["nested",{condition:e=>b(e)&&"product"===e.entity,map:{id:"data.id",item_price:"data.price",quantity:{key:"data.quantity",value:1}}}]},num_items:{fn:e=>e.nested.filter(e=>"product"===e.entity).length}}}},out:{data:[{event_name:"Purchase",event_time:1700000900,event_id:"1700000900-gr0up-1",event_source_url:"https://shop.example.com",action_source:"website",user_data:{external_id:["user-123"]},currency:"EUR",value:249.99,contents:[{id:"SKU-A1",quantity:2,item_price:129.99}]}]}},k={in:y("form submit",{timestamp:1700000901,data:{type:"newsletter"},user:{email:"user@example.com"},source:{type:"server",id:"https://example.com",previous_id:""}}),mapping:void 0,out:{data:[{event_name:"Lead",event_time:1700000901,event_id:"1700000901-gr0up-1",event_source_url:"https://example.com",action_source:"website",user_data:{email:["user@example.com"]}}]}},x={in:y("order complete",{timestamp:1700000902,data:{id:"ORD-700",total:89.99,currency:"USD"},user:{id:"cust-42"},context:{fbclid:["abc123xyz",0]},source:{type:"server",id:"https://shop.example.com",previous_id:""}}),mapping:{name:"Purchase",data:{map:{currency:{key:"data.currency",value:"EUR"},value:"data.total",order_id:"data.id",user_data:{map:{external_id:"user.id",fbclid:"context.fbclid"}}}}},out:{data:[{event_name:"Purchase",event_time:1700000902,event_id:"1700000902-gr0up-1",event_source_url:"https://shop.example.com",action_source:"website",currency:"USD",value:89.99,order_id:"ORD-700"}]}};export{l as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Meta access token for Conversions API authentication (like your_access_token)',\n ),\n pixelId: z\n .string()\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits')\n .describe(\n 'Meta Pixel ID from your Facebook Business account (like 1234567890)',\n ),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (website, app, phone_call, etc.) (like website)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['client_ip_address', 'client_user_agent'])\",\n )\n .optional(),\n test_event_code: z\n .string()\n .describe(\n 'Test event code for debugging Meta Conversions API events (like TEST12345)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Meta Conversions API endpoint (like https://graph.facebook.com/v17.0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { email: 'user.email', phone: 'user.phone' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event\n */\nexport const ActionSourceSchema = z.enum([\n 'email',\n 'website',\n 'app',\n 'phone_call',\n 'chat',\n 'physical_store',\n 'system_generated',\n 'business_messaging',\n 'other',\n]);\n\n/**\n * Event Name\n * Standard Meta event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'AddPaymentInfo',\n 'AddToCart',\n 'AddToWishlist',\n 'CompleteRegistration',\n 'Contact',\n 'CustomizeProduct',\n 'Donate',\n 'FindLocation',\n 'InitiateCheckout',\n 'Lead',\n 'Purchase',\n 'Schedule',\n 'Search',\n 'StartTrial',\n 'SubmitApplication',\n 'Subscribe',\n 'ViewContent',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Conversions API Mapping Schema\n * Meta CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Meta API response\n return {\n ok: true,\n data: {\n events_received: 1,\n messages: [],\n fbtrace_id: 'mock-trace-id',\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Meta Conversions API events without making\n * actual HTTP requests to Facebook's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n { entity: 'product', data: { id: 'SKU-A1', price: 129.99, quantity: 2 } },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.total',\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'Purchase',\n event_time: 1700000900,\n event_id: '1700000900-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'website',\n user_data: {\n external_id: ['user-123'],\n },\n currency: 'EUR',\n value: 249.99,\n contents: [{ id: 'SKU-A1', quantity: 2, item_price: 129.99 }],\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000901,\n data: { type: 'newsletter' },\n user: { email: 'user@example.com' },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: {\n data: [\n {\n event_name: 'Lead',\n event_time: 1700000901,\n event_id: '1700000901-gr0up-1',\n event_source_url: 'https://example.com',\n action_source: 'website',\n user_data: {\n email: ['user@example.com'],\n },\n },\n ],\n },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAOX,IAAM,qBAAqB,EAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,EAAE,MAAM;AAAA,EACrC,EAAE,KAAK;AAAA,IACL;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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,EAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,aAAaA,GACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAASA,GACN,OAAO,EACP,MAAM,YAAY,mCAAmC,EACrD;AAAA,IACC;AAAA,EACF;AAAA,EACF,eAAe,mBAAmB;AAAA,IAChC;AAAA,EACF,EAAE,SAAS;AAAA,EACX,WAAWA,GACR,MAAMA,GAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiBA,GACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAKA,GACF,O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","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/primitives.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport * from './primitives';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\nimport { ActionSourceSchema } from './primitives';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'Meta access token for Conversions API authentication (like your_access_token)',\n ),\n pixelId: z\n .string()\n .regex(/^[0-9]+$/, 'Pixel ID must contain only digits')\n .describe(\n 'Meta Pixel ID from your Facebook Business account (like 1234567890)',\n ),\n action_source: ActionSourceSchema.describe(\n 'Source of the event (website, app, phone_call, etc.) (like website)',\n ).optional(),\n doNotHash: z\n .array(z.string())\n .describe(\n \"Array of user_data fields that should not be hashed (like ['client_ip_address', 'client_user_agent'])\",\n )\n .optional(),\n test_event_code: z\n .string()\n .describe(\n 'Test event code for debugging Meta Conversions API events (like TEST12345)',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Custom URL for Meta Conversions API endpoint (like https://graph.facebook.com/v17.0)',\n )\n .optional(),\n user_data: z\n .record(z.string(), z.string())\n .describe(\n \"Mapping configuration for user data fields (like { email: 'user.email', phone: 'user.phone' })\",\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Action Source Enum\n * Where the conversion event took place\n * https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event\n */\nexport const ActionSourceSchema = z.enum([\n 'email',\n 'website',\n 'app',\n 'phone_call',\n 'chat',\n 'physical_store',\n 'system_generated',\n 'business_messaging',\n 'other',\n]);\n\n/**\n * Event Name\n * Standard Meta event names or custom event identifiers\n */\nexport const EventNameSchema = z.union([\n z.enum([\n 'AddPaymentInfo',\n 'AddToCart',\n 'AddToWishlist',\n 'CompleteRegistration',\n 'Contact',\n 'CustomizeProduct',\n 'Donate',\n 'FindLocation',\n 'InitiateCheckout',\n 'Lead',\n 'Purchase',\n 'Schedule',\n 'Search',\n 'StartTrial',\n 'SubmitApplication',\n 'Subscribe',\n 'ViewContent',\n ]),\n z.string(), // Allow custom event names\n]);\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Meta Conversions API Mapping Schema\n * Meta CAPI has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { SendDataValue, SendResponse } from '@walkeros/core';\nimport type { SendServerOptions } from '@walkeros/server-core';\nimport type { Env } from '../types';\n\n/**\n * Example environment configurations for Meta Conversions API destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual HTTP requests.\n */\n\n/**\n * Mock sendServer function that simulates successful HTTP responses\n */\nasync function mockSendServer(\n url: string,\n data?: SendDataValue,\n options?: SendServerOptions,\n): Promise<SendResponse> {\n // Simulate successful Meta API response\n return {\n ok: true,\n data: {\n events_received: 1,\n messages: [],\n fbtrace_id: 'mock-trace-id',\n },\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing Meta Conversions API events without making\n * actual HTTP requests to Facebook's servers.\n */\nexport const push: Env = {\n sendServer: mockSendServer,\n};\n\nexport const simulation = ['sendServer'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\nexport const purchase: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000900,\n data: { id: 'ORD-300', total: 249.99, currency: 'EUR' },\n nested: [\n { entity: 'product', data: { id: 'SKU-A1', price: 129.99, quantity: 2 } },\n ],\n user: { id: 'user-123', device: 'device-456' },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n order_id: 'data.id',\n currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.total',\n contents: {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n id: 'data.id',\n item_price: 'data.price',\n quantity: { key: 'data.quantity', value: 1 },\n },\n },\n ],\n },\n num_items: {\n fn: (event: unknown) =>\n (event as WalkerOS.Event).nested.filter(\n (item) => item.entity === 'product',\n ).length,\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'Purchase',\n event_time: 1700000900,\n event_id: '1700000900-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'website',\n user_data: {\n external_id: ['user-123'],\n },\n currency: 'EUR',\n value: 249.99,\n contents: [{ id: 'SKU-A1', quantity: 2, item_price: 129.99 }],\n },\n ],\n },\n};\n\nexport const lead: Flow.StepExample = {\n in: getEvent('form submit', {\n timestamp: 1700000901,\n data: { type: 'newsletter' },\n user: { email: 'user@example.com' },\n source: { type: 'server', id: 'https://example.com', previous_id: '' },\n }),\n mapping: undefined,\n out: {\n data: [\n {\n event_name: 'Lead',\n event_time: 1700000901,\n event_id: '1700000901-gr0up-1',\n event_source_url: 'https://example.com',\n action_source: 'website',\n user_data: {\n email: ['user@example.com'],\n },\n },\n ],\n },\n};\n\nexport const purchaseWithClickAttribution: Flow.StepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000902,\n data: { id: 'ORD-700', total: 89.99, currency: 'USD' },\n user: { id: 'cust-42' },\n context: { fbclid: ['abc123xyz', 0] },\n source: { type: 'server', id: 'https://shop.example.com', previous_id: '' },\n }),\n mapping: {\n name: 'Purchase',\n data: {\n map: {\n currency: { key: 'data.currency', value: 'EUR' },\n value: 'data.total',\n order_id: 'data.id',\n user_data: {\n map: {\n external_id: 'user.id',\n fbclid: 'context.fbclid',\n },\n },\n },\n },\n },\n out: {\n data: [\n {\n event_name: 'Purchase',\n event_time: 1700000902,\n event_id: '1700000902-gr0up-1',\n event_source_url: 'https://shop.example.com',\n action_source: 'website',\n currency: 'USD',\n value: 89.99,\n order_id: 'ORD-700',\n },\n ],\n },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAOX,IAAM,qBAAqB,EAAE,KAAK;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,kBAAkB,EAAE,MAAM;AAAA,EACrC,EAAE,KAAK;AAAA,IACL;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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAAA,EACD,EAAE,OAAO;AAAA;AACX,CAAC;;;ADzCM,IAAM,iBAAiBC,GAAE,OAAO;AAAA,EACrC,aAAaA,GACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,SAASA,GACN,OAAO,EACP,MAAM,YAAY,mCAAmC,EACrD;AAAA,IACC;AAAA,EACF;AAAA,EACF,eAAe,mBAAmB;AAAA,IAChC;AAAA,EACF,EAAE,SAAS;AAAA,EACX,WAAWA,GACR,MAAMA,GAAE,OAAO,CAAC,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiBA,GACd,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAKA,GACF,OAAO,EACP,IAAI,EACJ;A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,EAC5D,IAAI,SAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,WAAW,OAAO,OAAO,UAAU,MAAM;AAAA,IACrD,MAAM,EAAE,IAAI,UAAU;AAAA,IACtB,SAAS,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE;AAAA,IACpC,QAAQ,EAAE,MAAM,UAAU,IAAI,4BAA4B,aAAa,GAAG;AAAA,EAC5E,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,UAAU,EAAE,KAAK,iBAAiB,OAAO,MAAM;AAAA,QAC/C,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,UACT,KAAK;AAAA,YACH,aAAa;AAAA,YACb,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,MACJ;AAAA,QACE,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,UAAU;AAAA,QACV,OAAO;AAAA,QACP,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z"]}
|
|
@@ -22,11 +22,13 @@ declare namespace env {
|
|
|
22
22
|
|
|
23
23
|
declare const purchase: Flow.StepExample;
|
|
24
24
|
declare const lead: Flow.StepExample;
|
|
25
|
+
declare const purchaseWithClickAttribution: Flow.StepExample;
|
|
25
26
|
|
|
26
27
|
declare const step_lead: typeof lead;
|
|
27
28
|
declare const step_purchase: typeof purchase;
|
|
29
|
+
declare const step_purchaseWithClickAttribution: typeof purchaseWithClickAttribution;
|
|
28
30
|
declare namespace step {
|
|
29
|
-
export { step_lead as lead, step_purchase as purchase };
|
|
31
|
+
export { step_lead as lead, step_purchase as purchase, step_purchaseWithClickAttribution as purchaseWithClickAttribution };
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export { env, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -22,11 +22,13 @@ declare namespace env {
|
|
|
22
22
|
|
|
23
23
|
declare const purchase: Flow.StepExample;
|
|
24
24
|
declare const lead: Flow.StepExample;
|
|
25
|
+
declare const purchaseWithClickAttribution: Flow.StepExample;
|
|
25
26
|
|
|
26
27
|
declare const step_lead: typeof lead;
|
|
27
28
|
declare const step_purchase: typeof purchase;
|
|
29
|
+
declare const step_purchaseWithClickAttribution: typeof purchaseWithClickAttribution;
|
|
28
30
|
declare namespace step {
|
|
29
|
-
export { step_lead as lead, step_purchase as purchase };
|
|
31
|
+
export { step_lead as lead, step_purchase as purchase, step_purchaseWithClickAttribution as purchaseWithClickAttribution };
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export { env, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -50,7 +50,8 @@ var simulation = ["sendServer"];
|
|
|
50
50
|
var step_exports = {};
|
|
51
51
|
__export(step_exports, {
|
|
52
52
|
lead: () => lead,
|
|
53
|
-
purchase: () => purchase
|
|
53
|
+
purchase: () => purchase,
|
|
54
|
+
purchaseWithClickAttribution: () => purchaseWithClickAttribution
|
|
54
55
|
});
|
|
55
56
|
var import_core = require("@walkeros/core");
|
|
56
57
|
var purchase = {
|
|
@@ -132,6 +133,45 @@ var lead = {
|
|
|
132
133
|
]
|
|
133
134
|
}
|
|
134
135
|
};
|
|
136
|
+
var purchaseWithClickAttribution = {
|
|
137
|
+
in: (0, import_core.getEvent)("order complete", {
|
|
138
|
+
timestamp: 1700000902,
|
|
139
|
+
data: { id: "ORD-700", total: 89.99, currency: "USD" },
|
|
140
|
+
user: { id: "cust-42" },
|
|
141
|
+
context: { fbclid: ["abc123xyz", 0] },
|
|
142
|
+
source: { type: "server", id: "https://shop.example.com", previous_id: "" }
|
|
143
|
+
}),
|
|
144
|
+
mapping: {
|
|
145
|
+
name: "Purchase",
|
|
146
|
+
data: {
|
|
147
|
+
map: {
|
|
148
|
+
currency: { key: "data.currency", value: "EUR" },
|
|
149
|
+
value: "data.total",
|
|
150
|
+
order_id: "data.id",
|
|
151
|
+
user_data: {
|
|
152
|
+
map: {
|
|
153
|
+
external_id: "user.id",
|
|
154
|
+
fbclid: "context.fbclid"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
out: {
|
|
161
|
+
data: [
|
|
162
|
+
{
|
|
163
|
+
event_name: "Purchase",
|
|
164
|
+
event_time: 1700000902,
|
|
165
|
+
event_id: "1700000902-gr0up-1",
|
|
166
|
+
event_source_url: "https://shop.example.com",
|
|
167
|
+
action_source: "website",
|
|
168
|
+
currency: "USD",
|
|
169
|
+
value: 89.99,
|
|
170
|
+
order_id: "ORD-700"
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
};
|
|
135
175
|
// Annotate the CommonJS export names for ESM import in node:
|
|
136
176
|
0 && (module.exports = {
|
|
137
177
|
env,
|
package/dist/examples/index.mjs
CHANGED
|
@@ -29,7 +29,8 @@ var simulation = ["sendServer"];
|
|
|
29
29
|
var step_exports = {};
|
|
30
30
|
__export(step_exports, {
|
|
31
31
|
lead: () => lead,
|
|
32
|
-
purchase: () => purchase
|
|
32
|
+
purchase: () => purchase,
|
|
33
|
+
purchaseWithClickAttribution: () => purchaseWithClickAttribution
|
|
33
34
|
});
|
|
34
35
|
import { getEvent, isObject } from "@walkeros/core";
|
|
35
36
|
var purchase = {
|
|
@@ -111,6 +112,45 @@ var lead = {
|
|
|
111
112
|
]
|
|
112
113
|
}
|
|
113
114
|
};
|
|
115
|
+
var purchaseWithClickAttribution = {
|
|
116
|
+
in: getEvent("order complete", {
|
|
117
|
+
timestamp: 1700000902,
|
|
118
|
+
data: { id: "ORD-700", total: 89.99, currency: "USD" },
|
|
119
|
+
user: { id: "cust-42" },
|
|
120
|
+
context: { fbclid: ["abc123xyz", 0] },
|
|
121
|
+
source: { type: "server", id: "https://shop.example.com", previous_id: "" }
|
|
122
|
+
}),
|
|
123
|
+
mapping: {
|
|
124
|
+
name: "Purchase",
|
|
125
|
+
data: {
|
|
126
|
+
map: {
|
|
127
|
+
currency: { key: "data.currency", value: "EUR" },
|
|
128
|
+
value: "data.total",
|
|
129
|
+
order_id: "data.id",
|
|
130
|
+
user_data: {
|
|
131
|
+
map: {
|
|
132
|
+
external_id: "user.id",
|
|
133
|
+
fbclid: "context.fbclid"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
out: {
|
|
140
|
+
data: [
|
|
141
|
+
{
|
|
142
|
+
event_name: "Purchase",
|
|
143
|
+
event_time: 1700000902,
|
|
144
|
+
event_id: "1700000902-gr0up-1",
|
|
145
|
+
event_source_url: "https://shop.example.com",
|
|
146
|
+
action_source: "website",
|
|
147
|
+
currency: "USD",
|
|
148
|
+
value: 89.99,
|
|
149
|
+
order_id: "ORD-700"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
};
|
|
114
154
|
export {
|
|
115
155
|
env_exports as env,
|
|
116
156
|
step_exports as step
|
package/dist/walkerOS.json
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
"package": "@walkeros/server-destination-meta",
|
|
4
4
|
"version": "2.1.1",
|
|
5
5
|
"type": "destination",
|
|
6
|
-
"platform": "server"
|
|
6
|
+
"platform": "server",
|
|
7
|
+
"docs": "https://www.walkeros.io/docs/destinations/server/meta-capi",
|
|
8
|
+
"source": "https://github.com/elbwalker/walkerOS/tree/main/packages/server/destinations/meta/src"
|
|
7
9
|
},
|
|
8
10
|
"schemas": {
|
|
9
11
|
"mapping": {
|
|
@@ -231,7 +233,7 @@
|
|
|
231
233
|
"nested",
|
|
232
234
|
{
|
|
233
235
|
"condition": {
|
|
234
|
-
"$code": "e=>
|
|
236
|
+
"$code": "e=>b(e)&&\"product\"===e.entity"
|
|
235
237
|
},
|
|
236
238
|
"map": {
|
|
237
239
|
"id": "data.id",
|
|
@@ -277,6 +279,132 @@
|
|
|
277
279
|
}
|
|
278
280
|
]
|
|
279
281
|
}
|
|
282
|
+
},
|
|
283
|
+
"purchaseWithClickAttribution": {
|
|
284
|
+
"in": {
|
|
285
|
+
"name": "order complete",
|
|
286
|
+
"data": {
|
|
287
|
+
"id": "ORD-700",
|
|
288
|
+
"total": 89.99,
|
|
289
|
+
"currency": "USD"
|
|
290
|
+
},
|
|
291
|
+
"context": {
|
|
292
|
+
"fbclid": [
|
|
293
|
+
"abc123xyz",
|
|
294
|
+
0
|
|
295
|
+
]
|
|
296
|
+
},
|
|
297
|
+
"globals": {
|
|
298
|
+
"pagegroup": "shop"
|
|
299
|
+
},
|
|
300
|
+
"custom": {
|
|
301
|
+
"completely": "random"
|
|
302
|
+
},
|
|
303
|
+
"user": {
|
|
304
|
+
"id": "cust-42"
|
|
305
|
+
},
|
|
306
|
+
"nested": [
|
|
307
|
+
{
|
|
308
|
+
"entity": "product",
|
|
309
|
+
"data": {
|
|
310
|
+
"id": "ers",
|
|
311
|
+
"name": "Everyday Ruck Snack",
|
|
312
|
+
"color": "black",
|
|
313
|
+
"size": "l",
|
|
314
|
+
"price": 420
|
|
315
|
+
},
|
|
316
|
+
"context": {
|
|
317
|
+
"shopping": [
|
|
318
|
+
"complete",
|
|
319
|
+
0
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
"nested": []
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"entity": "product",
|
|
326
|
+
"data": {
|
|
327
|
+
"id": "cc",
|
|
328
|
+
"name": "Cool Cap",
|
|
329
|
+
"size": "one size",
|
|
330
|
+
"price": 42
|
|
331
|
+
},
|
|
332
|
+
"context": {
|
|
333
|
+
"shopping": [
|
|
334
|
+
"complete",
|
|
335
|
+
0
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
"nested": []
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"entity": "gift",
|
|
342
|
+
"data": {
|
|
343
|
+
"name": "Surprise"
|
|
344
|
+
},
|
|
345
|
+
"context": {
|
|
346
|
+
"shopping": [
|
|
347
|
+
"complete",
|
|
348
|
+
0
|
|
349
|
+
]
|
|
350
|
+
},
|
|
351
|
+
"nested": []
|
|
352
|
+
}
|
|
353
|
+
],
|
|
354
|
+
"consent": {
|
|
355
|
+
"functional": true
|
|
356
|
+
},
|
|
357
|
+
"id": "1700000902-gr0up-1",
|
|
358
|
+
"trigger": "load",
|
|
359
|
+
"entity": "order",
|
|
360
|
+
"action": "complete",
|
|
361
|
+
"timestamp": 1700000902,
|
|
362
|
+
"timing": 3.14,
|
|
363
|
+
"group": "gr0up",
|
|
364
|
+
"count": 1,
|
|
365
|
+
"version": {
|
|
366
|
+
"source": "2.1.1",
|
|
367
|
+
"tagging": 1
|
|
368
|
+
},
|
|
369
|
+
"source": {
|
|
370
|
+
"type": "server",
|
|
371
|
+
"id": "https://shop.example.com",
|
|
372
|
+
"previous_id": ""
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"mapping": {
|
|
376
|
+
"name": "Purchase",
|
|
377
|
+
"data": {
|
|
378
|
+
"map": {
|
|
379
|
+
"currency": {
|
|
380
|
+
"key": "data.currency",
|
|
381
|
+
"value": "EUR"
|
|
382
|
+
},
|
|
383
|
+
"value": "data.total",
|
|
384
|
+
"order_id": "data.id",
|
|
385
|
+
"user_data": {
|
|
386
|
+
"map": {
|
|
387
|
+
"external_id": "user.id",
|
|
388
|
+
"fbclid": "context.fbclid"
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"out": {
|
|
395
|
+
"data": [
|
|
396
|
+
{
|
|
397
|
+
"event_name": "Purchase",
|
|
398
|
+
"event_time": 1700000902,
|
|
399
|
+
"event_id": "1700000902-gr0up-1",
|
|
400
|
+
"event_source_url": "https://shop.example.com",
|
|
401
|
+
"action_source": "website",
|
|
402
|
+
"currency": "USD",
|
|
403
|
+
"value": 89.99,
|
|
404
|
+
"order_id": "ORD-700"
|
|
405
|
+
}
|
|
406
|
+
]
|
|
407
|
+
}
|
|
280
408
|
}
|
|
281
409
|
}
|
|
282
410
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-meta",
|
|
3
3
|
"description": "Meta server destination for walkerOS",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"sideEffects": false,
|
|
7
6
|
"exports": {
|
|
8
7
|
".": {
|
|
9
8
|
"types": "./dist/index.d.ts",
|
|
@@ -34,11 +33,11 @@
|
|
|
34
33
|
"update": "npx npm-check-updates -u && npm update"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@walkeros/core": "
|
|
38
|
-
"@walkeros/server-core": "
|
|
36
|
+
"@walkeros/core": "^3.0.0",
|
|
37
|
+
"@walkeros/server-core": "^3.0.0"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@walkeros/collector": "
|
|
40
|
+
"@walkeros/collector": "^3.0.0"
|
|
42
41
|
},
|
|
43
42
|
"repository": {
|
|
44
43
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|
|
@@ -51,7 +50,8 @@
|
|
|
51
50
|
},
|
|
52
51
|
"walkerOS": {
|
|
53
52
|
"type": "destination",
|
|
54
|
-
"platform": "server"
|
|
53
|
+
"platform": "server",
|
|
54
|
+
"docs": "https://www.walkeros.io/docs/destinations/server/meta-capi"
|
|
55
55
|
},
|
|
56
56
|
"keywords": [
|
|
57
57
|
"walkerOS",
|