@walkeros/server-destination-hubspot 3.4.0 → 3.4.1
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/examples/index.js +14 -0
- package/dist/examples/index.mjs +14 -0
- package/dist/walkerOS.json +23 -9
- package/package.json +4 -4
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,r=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},n={};r(n,{examples:()=>b,schemas:()=>o}),module.exports=(e=n,((e,r,n,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let p of i(r))s.call(e,p)||p===n||t(e,p,{get:()=>r[p],enumerable:!(o=a(r,p))||o.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={};r(o,{MappingSchema:()=>d,SettingsSchema:()=>l,mapping:()=>v,settings:()=>u});var p=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),l=c.z.object({accessToken:c.z.string().min(1).describe("HubSpot private app access token. Create one in HubSpot Settings > Integrations > Private Apps. Requires analytics.behavioral_events.send scope."),eventNamePrefix:c.z.string().min(1).describe("Fully qualified event name prefix: pe{HubID}_ (e.g. pe12345678_). Find it in HubSpot under Data Management > Custom Events."),email:c.z.string().describe("walkerOS mapping value path to resolve contact email from events (like user.email). Required for contact association.").optional(),objectId:c.z.string().describe("walkerOS mapping value path to resolve HubSpot CRM objectId from events. Alternative to email for contact association.").optional(),identify:c.z.unknown().describe("Destination-level contact upsert mapping. Resolves to { email, properties }. Fires contact update on first push and re-fires when values change.").optional(),defaultProperties:c.z.record(c.z.string(),c.z.string()).describe("Static event properties added to every event occurrence. Useful for hs_touchpoint_source, hs_page_content_type, etc.").optional(),batch:c.z.boolean().describe("Use batch API for events (accumulate and flush). Default: false.").optional(),batchSize:c.z.number().int().positive().max(500).describe("Batch size before auto-flush. Only used when batch: true. Default: 50. Max: 500.").optional()}),m=require("@walkeros/core/dev"),d=m.z.object({eventName:m.z.string().describe("Override eventName for this rule. Without the prefix -- just the event name part (e.g. purchase_completed). The eventNamePrefix is prepended automatically.").optional(),identify:m.z.unknown().describe("Per-event contact upsert. Resolves to { email, properties }. Overrides destination-level identify. Use with skip: true on login/identify events.").optional(),properties:m.z.unknown().describe("Additional event properties mapping. Resolved values are merged with defaultProperties and serialized to strings.").optional()}),u=(0,p.zodToSchema)(l),v=(0,p.zodToSchema)(d),b={};r(b,{env:()=>f,step:()=>_});var f={};r(f,{push:()=>h,simulation:()=>y});var g=()=>Promise.resolve();var h={client:{events:{send:{basicApi:{send:g},batchApi:{send:g}}},crm:{contacts:{basicApi:{update:g}}}}},y=["call:events.send.basicApi.send","call:events.send.batchApi.send","call:crm.contacts.basicApi.update"],_={};r(_,{defaultEvent:()=>A,defaultProperties:()=>S,destinationIdentify:()=>k,mappedEventName:()=>D,noIdentity:()=>N,objectIdAssociation:()=>x,userLoginIdentify:()=>z,wildcardIgnored:()=>P});var w=require("@walkeros/core"),A={title:"Default event",description:"A walker event is sent to HubSpot as a custom behavioral event keyed by the user email.",in:(0,w.getEvent)("product view",{timestamp:1700000100,user:{email:"user@example.com"}}),out:[["events.send.basicApi.send",{eventName:"pe12345678_product_view",email:"user@example.com",occurredAt:new Date(1700000100),properties:{}}]]},D={title:"Custom event name",description:"A mapping supplies a custom HubSpot event name and maps order data into properties for the behavioral event.",in:(0,w.getEvent)("order complete",{timestamp:1700000101,user:{email:"user@example.com"},data:{total:99.5,currency:"EUR",id:"ord-123"}}),mapping:{name:"order complete",settings:{eventName:"purchase_completed",properties:{map:{revenue:"data.total",currency:"data.currency",order_id:"data.id"}}}},out:[["events.send.basicApi.send",{eventName:"pe12345678_purchase_completed",email:"user@example.com",occurredAt:new Date(1700000101),properties:{revenue:"99.5",currency:"EUR",order_id:"ord-123"}}]]},S={title:"Default properties",description:"Destination-level default properties are merged into every HubSpot event payload, such as traffic source metadata.",in:(0,w.getEvent)("page view",{timestamp:1700000102,user:{email:"user@example.com"}}),settings:{defaultProperties:{hs_touchpoint_source:"walkerOS",hs_page_content_type:"STANDARD_PAGE"}},out:[["events.send.basicApi.send",{eventName:"pe12345678_page_view",email:"user@example.com",occurredAt:new Date(1700000102),properties:{hs_touchpoint_source:"walkerOS",hs_page_content_type:"STANDARD_PAGE"}}]]},k={title:"Destination identify",description:"Destination-level identify upserts the HubSpot contact with mapped properties before sending the behavioral event.",in:(0,w.getEvent)("page view",{timestamp:1700000103,user:{email:"user@example.com",firstName:"Jane",lastName:"Doe"}}),settings:{identify:{map:{email:"user.email",properties:{map:{firstname:"user.firstName",lastname:"user.lastName"}}}}},out:[["crm.contacts.basicApi.update","user@example.com",{properties:{firstname:"Jane",lastname:"Doe"}},"email"],["events.send.basicApi.send",{eventName:"pe12345678_page_view",email:"user@example.com",occurredAt:new Date(1700000103),properties:{}}]]},z={title:"User login identify",description:"A user login only upserts the HubSpot contact with profile and lifecycle properties, skipping the event send.",in:(0,w.getEvent)("user login",{timestamp:1700000104,user:{email:"user@example.com"},data:{email:"login@acme.com",first_name:"Jane",last_name:"Doe",lifecycle:"lead"}}),mapping:{skip:!0,settings:{identify:{map:{email:"data.email",properties:{map:{firstname:"data.first_name",lastname:"data.last_name",lifecyclestage:"data.lifecycle"}}}}}},out:[["crm.contacts.basicApi.update","login@acme.com",{properties:{firstname:"Jane",lastname:"Doe",lifecyclestage:"lead"}},"email"]]},x={title:"Object id association",description:"The HubSpot event is associated via objectId instead of email, resolved from the walker user id.",in:(0,w.getEvent)("product view",{timestamp:1700000105,user:{id:"hs-contact-789"}}),settings:{email:void 0,objectId:"user.id"},out:[["events.send.basicApi.send",{eventName:"pe12345678_product_view",objectId:"hs-contact-789",occurredAt:new Date(1700000105),properties:{}}]]},N={public:!1,in:(0,w.getEvent)("product view",{timestamp:1700000106,user:{}}),out:[]},P={public:!1,in:(0,w.getEvent)("debug noise",{timestamp:1700000107,user:{email:"user@example.com"}}),mapping:{ignore:!0},out:[]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'HubSpot private app access token. Create one in HubSpot Settings > Integrations > Private Apps. Requires analytics.behavioral_events.send scope.',\n ),\n eventNamePrefix: z\n .string()\n .min(1)\n .describe(\n 'Fully qualified event name prefix: pe{HubID}_ (e.g. pe12345678_). Find it in HubSpot under Data Management > Custom Events.',\n ),\n email: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve contact email from events (like user.email). Required for contact association.',\n )\n .optional(),\n objectId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve HubSpot CRM objectId from events. Alternative to email for contact association.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level contact upsert mapping. Resolves to { email, properties }. Fires contact update on first push and re-fires when values change.',\n )\n .optional(),\n defaultProperties: z\n .record(z.string(), z.string())\n .describe(\n 'Static event properties added to every event occurrence. Useful for hs_touchpoint_source, hs_page_content_type, etc.',\n )\n .optional(),\n batch: z\n .boolean()\n .describe(\n 'Use batch API for events (accumulate and flush). Default: false.',\n )\n .optional(),\n batchSize: z\n .number()\n .int()\n .positive()\n .max(500)\n .describe(\n 'Batch size before auto-flush. Only used when batch: true. Default: 50. Max: 500.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n eventName: z\n .string()\n .describe(\n 'Override eventName for this rule. Without the prefix -- just the event name part (e.g. purchase_completed). The eventNamePrefix is prepended automatically.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Per-event contact upsert. Resolves to { email, properties }. Overrides destination-level identify. Use with skip: true on login/identify events.',\n )\n .optional(),\n properties: z\n .unknown()\n .describe(\n 'Additional event properties mapping. Resolved values are merged with defaultProperties and serialized to strings.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, HubSpotClientMock } from '../types';\n\nconst asyncNoop = () => Promise.resolve();\n\nfunction createMockClient(): HubSpotClientMock {\n return {\n events: {\n send: {\n basicApi: { send: asyncNoop },\n batchApi: { send: asyncNoop },\n },\n },\n crm: {\n contacts: {\n basicApi: { update: asyncNoop },\n },\n },\n };\n}\n\nexport const push: Env = {\n client: createMockClient(),\n};\n\nexport const simulation = [\n 'call:events.send.basicApi.send',\n 'call:events.send.batchApi.send',\n 'call:crm.contacts.basicApi.update',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * HubSpot SDK step examples.\n *\n * At push time, the destination invokes the `@hubspot/api-client` SDK. The\n * public method paths users see on the client are:\n *\n * - `events.send.basicApi.send(eventRequest)` — fires an event\n * - `events.send.batchApi.send({ inputs: [...] })` — flushes a batch\n * - `crm.contacts.basicApi.update(id, data, idProperty)` — contact upsert\n *\n * Each `out` is therefore a list of tuples `[['method.path', ...args], ...]`\n * matching the actual SDK call order. `identify` fires before the event.\n * When the destination skips an event (`skip: true`, `ignore: true`, or\n * missing identity), `out` is `[]`.\n */\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type HubSpotStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Default event forwarding -- events.send.basicApi.send() with auto-generated\n * event name. Email resolved from default settings.email = 'user.email'.\n */\nexport const defaultEvent: HubSpotStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000100,\n user: { email: 'user@example.com' },\n }),\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000100),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.settings.eventName overrides the auto-generated\n * name. The prefix is still prepended.\n */\nexport const mappedEventName: HubSpotStepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000101,\n user: { email: 'user@example.com' },\n data: { total: 99.5, currency: 'EUR', id: 'ord-123' },\n }),\n mapping: {\n name: 'order complete',\n settings: {\n eventName: 'purchase_completed',\n properties: {\n map: {\n revenue: 'data.total',\n currency: 'data.currency',\n order_id: 'data.id',\n },\n },\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_purchase_completed',\n email: 'user@example.com',\n occurredAt: new Date(1700000101),\n properties: {\n revenue: '99.5',\n currency: 'EUR',\n order_id: 'ord-123',\n },\n },\n ],\n ],\n};\n\n/**\n * Event with defaultProperties -- settings.defaultProperties are merged\n * into every event. Per-event properties override defaults.\n */\nexport const defaultProperties: HubSpotStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000102,\n user: { email: 'user@example.com' },\n }),\n settings: {\n defaultProperties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000102),\n properties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires crm.contacts.basicApi.update() on\n * first push when settings.identify mapping resolves. Then fires the event.\n */\nexport const destinationIdentify: HubSpotStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000103,\n user: { email: 'user@example.com', firstName: 'Jane', lastName: 'Doe' },\n }),\n settings: {\n identify: {\n map: {\n email: 'user.email',\n properties: {\n map: {\n firstname: 'user.firstName',\n lastname: 'user.lastName',\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'user@example.com',\n { properties: { firstname: 'Jane', lastname: 'Doe' } },\n 'email',\n ],\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000103),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with skip -- user login fires contact upsert only,\n * no custom event sent.\n */\nexport const userLoginIdentify: HubSpotStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000104,\n user: { email: 'user@example.com' },\n data: {\n email: 'login@acme.com',\n first_name: 'Jane',\n last_name: 'Doe',\n lifecycle: 'lead',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n email: 'data.email',\n properties: {\n map: {\n firstname: 'data.first_name',\n lastname: 'data.last_name',\n lifecyclestage: 'data.lifecycle',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'login@acme.com',\n {\n properties: {\n firstname: 'Jane',\n lastname: 'Doe',\n lifecyclestage: 'lead',\n },\n },\n 'email',\n ],\n ],\n};\n\n/**\n * objectId association -- use objectId instead of email for contact\n * association on the event.\n */\nexport const objectIdAssociation: HubSpotStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000105,\n user: { id: 'hs-contact-789' },\n }),\n settings: {\n email: undefined,\n objectId: 'user.id',\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n objectId: 'hs-contact-789',\n occurredAt: new Date(1700000105),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * No identity resolved -- event is skipped with a warning. Neither email\n * nor objectId can be resolved from the event.\n */\nexport const noIdentity: HubSpotStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000106,\n user: {},\n }),\n out: [],\n};\n\n/**\n * Wildcard ignore -- the event matches a mapping rule with ignore: true.\n * The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: HubSpotStepExample = {\n in: getEvent('debug noise', {\n timestamp: 1700000107,\n user: { email: 'user@example.com' },\n }),\n mapping: { ignore: true },\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,aAAa,aACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,iBAAiB,aACd,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,OAAO,aACJ,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,aACP,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,mBAAmB,aAChB,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,aACJ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,aACR,OAAO,EACP,IAAI,EACJ,SAAS,EACT,IAAI,GAAG,EACP;AAAA,IACC;AAAA,E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AAAA,IACX,MAAM,EAAE,IAAI,iBAAiB;AAAA,EAC/B,CAAC;AAAA,EACD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,UAAU;AAAA,QACV,YAAY,oBAAI,KAAK,UAAU;AAAA,QAC/B,YAAY,CAAC;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAMO,IAAM,aAAiC;AAAA,EAC5C,QAAI,sBAAS,gBAAgB;AAAA,IAC3B,WAAW;AAAA,IACX,MAAM,CAAC;AAAA,EACT,CAAC;AAAA,EACD,KAAK,CAAC;AACR;AAMO,IAAM,kBAAsC;AAAA,EACjD,QAAI,sBAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,mBAAmB;AAAA,EACpC,CAAC;AAAA,EACD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'HubSpot private app access token. Create one in HubSpot Settings > Integrations > Private Apps. Requires analytics.behavioral_events.send scope.',\n ),\n eventNamePrefix: z\n .string()\n .min(1)\n .describe(\n 'Fully qualified event name prefix: pe{HubID}_ (e.g. pe12345678_). Find it in HubSpot under Data Management > Custom Events.',\n ),\n email: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve contact email from events (like user.email). Required for contact association.',\n )\n .optional(),\n objectId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve HubSpot CRM objectId from events. Alternative to email for contact association.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level contact upsert mapping. Resolves to { email, properties }. Fires contact update on first push and re-fires when values change.',\n )\n .optional(),\n defaultProperties: z\n .record(z.string(), z.string())\n .describe(\n 'Static event properties added to every event occurrence. Useful for hs_touchpoint_source, hs_page_content_type, etc.',\n )\n .optional(),\n batch: z\n .boolean()\n .describe(\n 'Use batch API for events (accumulate and flush). Default: false.',\n )\n .optional(),\n batchSize: z\n .number()\n .int()\n .positive()\n .max(500)\n .describe(\n 'Batch size before auto-flush. Only used when batch: true. Default: 50. Max: 500.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n eventName: z\n .string()\n .describe(\n 'Override eventName for this rule. Without the prefix -- just the event name part (e.g. purchase_completed). The eventNamePrefix is prepended automatically.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Per-event contact upsert. Resolves to { email, properties }. Overrides destination-level identify. Use with skip: true on login/identify events.',\n )\n .optional(),\n properties: z\n .unknown()\n .describe(\n 'Additional event properties mapping. Resolved values are merged with defaultProperties and serialized to strings.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, HubSpotClientMock } from '../types';\n\nconst asyncNoop = () => Promise.resolve();\n\nfunction createMockClient(): HubSpotClientMock {\n return {\n events: {\n send: {\n basicApi: { send: asyncNoop },\n batchApi: { send: asyncNoop },\n },\n },\n crm: {\n contacts: {\n basicApi: { update: asyncNoop },\n },\n },\n };\n}\n\nexport const push: Env = {\n client: createMockClient(),\n};\n\nexport const simulation = [\n 'call:events.send.basicApi.send',\n 'call:events.send.batchApi.send',\n 'call:crm.contacts.basicApi.update',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * HubSpot SDK step examples.\n *\n * At push time, the destination invokes the `@hubspot/api-client` SDK. The\n * public method paths users see on the client are:\n *\n * - `events.send.basicApi.send(eventRequest)` — fires an event\n * - `events.send.batchApi.send({ inputs: [...] })` — flushes a batch\n * - `crm.contacts.basicApi.update(id, data, idProperty)` — contact upsert\n *\n * Each `out` is therefore a list of tuples `[['method.path', ...args], ...]`\n * matching the actual SDK call order. `identify` fires before the event.\n * When the destination skips an event (`skip: true`, `ignore: true`, or\n * missing identity), `out` is `[]`.\n */\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type HubSpotStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Default event forwarding -- events.send.basicApi.send() with auto-generated\n * event name. Email resolved from default settings.email = 'user.email'.\n */\nexport const defaultEvent: HubSpotStepExample = {\n title: 'Default event',\n description:\n 'A walker event is sent to HubSpot as a custom behavioral event keyed by the user email.',\n in: getEvent('product view', {\n timestamp: 1700000100,\n user: { email: 'user@example.com' },\n }),\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000100),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.settings.eventName overrides the auto-generated\n * name. The prefix is still prepended.\n */\nexport const mappedEventName: HubSpotStepExample = {\n title: 'Custom event name',\n description:\n 'A mapping supplies a custom HubSpot event name and maps order data into properties for the behavioral event.',\n in: getEvent('order complete', {\n timestamp: 1700000101,\n user: { email: 'user@example.com' },\n data: { total: 99.5, currency: 'EUR', id: 'ord-123' },\n }),\n mapping: {\n name: 'order complete',\n settings: {\n eventName: 'purchase_completed',\n properties: {\n map: {\n revenue: 'data.total',\n currency: 'data.currency',\n order_id: 'data.id',\n },\n },\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_purchase_completed',\n email: 'user@example.com',\n occurredAt: new Date(1700000101),\n properties: {\n revenue: '99.5',\n currency: 'EUR',\n order_id: 'ord-123',\n },\n },\n ],\n ],\n};\n\n/**\n * Event with defaultProperties -- settings.defaultProperties are merged\n * into every event. Per-event properties override defaults.\n */\nexport const defaultProperties: HubSpotStepExample = {\n title: 'Default properties',\n description:\n 'Destination-level default properties are merged into every HubSpot event payload, such as traffic source metadata.',\n in: getEvent('page view', {\n timestamp: 1700000102,\n user: { email: 'user@example.com' },\n }),\n settings: {\n defaultProperties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000102),\n properties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires crm.contacts.basicApi.update() on\n * first push when settings.identify mapping resolves. Then fires the event.\n */\nexport const destinationIdentify: HubSpotStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify upserts the HubSpot contact with mapped properties before sending the behavioral event.',\n in: getEvent('page view', {\n timestamp: 1700000103,\n user: { email: 'user@example.com', firstName: 'Jane', lastName: 'Doe' },\n }),\n settings: {\n identify: {\n map: {\n email: 'user.email',\n properties: {\n map: {\n firstname: 'user.firstName',\n lastname: 'user.lastName',\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'user@example.com',\n { properties: { firstname: 'Jane', lastname: 'Doe' } },\n 'email',\n ],\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000103),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with skip -- user login fires contact upsert only,\n * no custom event sent.\n */\nexport const userLoginIdentify: HubSpotStepExample = {\n title: 'User login identify',\n description:\n 'A user login only upserts the HubSpot contact with profile and lifecycle properties, skipping the event send.',\n in: getEvent('user login', {\n timestamp: 1700000104,\n user: { email: 'user@example.com' },\n data: {\n email: 'login@acme.com',\n first_name: 'Jane',\n last_name: 'Doe',\n lifecycle: 'lead',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n email: 'data.email',\n properties: {\n map: {\n firstname: 'data.first_name',\n lastname: 'data.last_name',\n lifecyclestage: 'data.lifecycle',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'login@acme.com',\n {\n properties: {\n firstname: 'Jane',\n lastname: 'Doe',\n lifecyclestage: 'lead',\n },\n },\n 'email',\n ],\n ],\n};\n\n/**\n * objectId association -- use objectId instead of email for contact\n * association on the event.\n */\nexport const objectIdAssociation: HubSpotStepExample = {\n title: 'Object id association',\n description:\n 'The HubSpot event is associated via objectId instead of email, resolved from the walker user id.',\n in: getEvent('product view', {\n timestamp: 1700000105,\n user: { id: 'hs-contact-789' },\n }),\n settings: {\n email: undefined,\n objectId: 'user.id',\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n objectId: 'hs-contact-789',\n occurredAt: new Date(1700000105),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * No identity resolved -- event is skipped with a warning. Neither email\n * nor objectId can be resolved from the event.\n */\nexport const noIdentity: HubSpotStepExample = {\n public: false,\n in: getEvent('product view', {\n timestamp: 1700000106,\n user: {},\n }),\n out: [],\n};\n\n/**\n * Wildcard ignore -- the event matches a mapping rule with ignore: true.\n * The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: HubSpotStepExample = {\n public: false,\n in: getEvent('debug noise', {\n timestamp: 1700000107,\n user: { email: 'user@example.com' },\n }),\n mapping: { ignore: true },\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;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A,MACf;AAAA,IACF;AAAA,EACF;AACF;AAMO,IAAM,aAAiC;AAAA,EAC5C,QAAQ;AAAA,EACR,QAAI,sBAAS,gBAAgB;AAAA,IAC3B,WAAW;AAAA,IACX,MAAM,CAAC;AAAA,EACT,CAAC;AAAA,EACD,KAAK,CAAC;AACR;AAMO,IAAM,kBAAsC;AAAA,EACjD,QAAQ;AAAA,EACR,QAAI,sBAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,mBAAmB;AAAA,EACpC,CAAC;AAAA,EACD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>o,SettingsSchema:()=>r,mapping:()=>c,settings:()=>p});import{zodToSchema as i}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var r=s.object({accessToken:s.string().min(1).describe("HubSpot private app access token. Create one in HubSpot Settings > Integrations > Private Apps. Requires analytics.behavioral_events.send scope."),eventNamePrefix:s.string().min(1).describe("Fully qualified event name prefix: pe{HubID}_ (e.g. pe12345678_). Find it in HubSpot under Data Management > Custom Events."),email:s.string().describe("walkerOS mapping value path to resolve contact email from events (like user.email). Required for contact association.").optional(),objectId:s.string().describe("walkerOS mapping value path to resolve HubSpot CRM objectId from events. Alternative to email for contact association.").optional(),identify:s.unknown().describe("Destination-level contact upsert mapping. Resolves to { email, properties }. Fires contact update on first push and re-fires when values change.").optional(),defaultProperties:s.record(s.string(),s.string()).describe("Static event properties added to every event occurrence. Useful for hs_touchpoint_source, hs_page_content_type, etc.").optional(),batch:s.boolean().describe("Use batch API for events (accumulate and flush). Default: false.").optional(),batchSize:s.number().int().positive().max(500).describe("Batch size before auto-flush. Only used when batch: true. Default: 50. Max: 500.").optional()});import{z as n}from"@walkeros/core/dev";var o=n.object({eventName:n.string().describe("Override eventName for this rule. Without the prefix -- just the event name part (e.g. purchase_completed). The eventNamePrefix is prepended automatically.").optional(),identify:n.unknown().describe("Per-event contact upsert. Resolves to { email, properties }. Overrides destination-level identify. Use with skip: true on login/identify events.").optional(),properties:n.unknown().describe("Additional event properties mapping. Resolved values are merged with defaultProperties and serialized to strings.").optional()}),p=i(r),c=i(o),
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>o,SettingsSchema:()=>r,mapping:()=>c,settings:()=>p});import{zodToSchema as i}from"@walkeros/core/dev";import{z as s}from"@walkeros/core/dev";var r=s.object({accessToken:s.string().min(1).describe("HubSpot private app access token. Create one in HubSpot Settings > Integrations > Private Apps. Requires analytics.behavioral_events.send scope."),eventNamePrefix:s.string().min(1).describe("Fully qualified event name prefix: pe{HubID}_ (e.g. pe12345678_). Find it in HubSpot under Data Management > Custom Events."),email:s.string().describe("walkerOS mapping value path to resolve contact email from events (like user.email). Required for contact association.").optional(),objectId:s.string().describe("walkerOS mapping value path to resolve HubSpot CRM objectId from events. Alternative to email for contact association.").optional(),identify:s.unknown().describe("Destination-level contact upsert mapping. Resolves to { email, properties }. Fires contact update on first push and re-fires when values change.").optional(),defaultProperties:s.record(s.string(),s.string()).describe("Static event properties added to every event occurrence. Useful for hs_touchpoint_source, hs_page_content_type, etc.").optional(),batch:s.boolean().describe("Use batch API for events (accumulate and flush). Default: false.").optional(),batchSize:s.number().int().positive().max(500).describe("Batch size before auto-flush. Only used when batch: true. Default: 50. Max: 500.").optional()});import{z as n}from"@walkeros/core/dev";var o=n.object({eventName:n.string().describe("Override eventName for this rule. Without the prefix -- just the event name part (e.g. purchase_completed). The eventNamePrefix is prepended automatically.").optional(),identify:n.unknown().describe("Per-event contact upsert. Resolves to { email, properties }. Overrides destination-level identify. Use with skip: true on login/identify events.").optional(),properties:n.unknown().describe("Additional event properties mapping. Resolved values are merged with defaultProperties and serialized to strings.").optional()}),p=i(r),c=i(o),l={};t(l,{env:()=>m,step:()=>f});var m={};t(m,{push:()=>u,simulation:()=>v});var d=()=>Promise.resolve();var u={client:{events:{send:{basicApi:{send:d},batchApi:{send:d}}},crm:{contacts:{basicApi:{update:d}}}}},v=["call:events.send.basicApi.send","call:events.send.batchApi.send","call:crm.contacts.basicApi.update"],f={};t(f,{defaultEvent:()=>g,defaultProperties:()=>_,destinationIdentify:()=>y,mappedEventName:()=>h,noIdentity:()=>D,objectIdAssociation:()=>A,userLoginIdentify:()=>w,wildcardIgnored:()=>S});import{getEvent as b}from"@walkeros/core";var g={title:"Default event",description:"A walker event is sent to HubSpot as a custom behavioral event keyed by the user email.",in:b("product view",{timestamp:1700000100,user:{email:"user@example.com"}}),out:[["events.send.basicApi.send",{eventName:"pe12345678_product_view",email:"user@example.com",occurredAt:new Date(1700000100),properties:{}}]]},h={title:"Custom event name",description:"A mapping supplies a custom HubSpot event name and maps order data into properties for the behavioral event.",in:b("order complete",{timestamp:1700000101,user:{email:"user@example.com"},data:{total:99.5,currency:"EUR",id:"ord-123"}}),mapping:{name:"order complete",settings:{eventName:"purchase_completed",properties:{map:{revenue:"data.total",currency:"data.currency",order_id:"data.id"}}}},out:[["events.send.basicApi.send",{eventName:"pe12345678_purchase_completed",email:"user@example.com",occurredAt:new Date(1700000101),properties:{revenue:"99.5",currency:"EUR",order_id:"ord-123"}}]]},_={title:"Default properties",description:"Destination-level default properties are merged into every HubSpot event payload, such as traffic source metadata.",in:b("page view",{timestamp:1700000102,user:{email:"user@example.com"}}),settings:{defaultProperties:{hs_touchpoint_source:"walkerOS",hs_page_content_type:"STANDARD_PAGE"}},out:[["events.send.basicApi.send",{eventName:"pe12345678_page_view",email:"user@example.com",occurredAt:new Date(1700000102),properties:{hs_touchpoint_source:"walkerOS",hs_page_content_type:"STANDARD_PAGE"}}]]},y={title:"Destination identify",description:"Destination-level identify upserts the HubSpot contact with mapped properties before sending the behavioral event.",in:b("page view",{timestamp:1700000103,user:{email:"user@example.com",firstName:"Jane",lastName:"Doe"}}),settings:{identify:{map:{email:"user.email",properties:{map:{firstname:"user.firstName",lastname:"user.lastName"}}}}},out:[["crm.contacts.basicApi.update","user@example.com",{properties:{firstname:"Jane",lastname:"Doe"}},"email"],["events.send.basicApi.send",{eventName:"pe12345678_page_view",email:"user@example.com",occurredAt:new Date(1700000103),properties:{}}]]},w={title:"User login identify",description:"A user login only upserts the HubSpot contact with profile and lifecycle properties, skipping the event send.",in:b("user login",{timestamp:1700000104,user:{email:"user@example.com"},data:{email:"login@acme.com",first_name:"Jane",last_name:"Doe",lifecycle:"lead"}}),mapping:{skip:!0,settings:{identify:{map:{email:"data.email",properties:{map:{firstname:"data.first_name",lastname:"data.last_name",lifecyclestage:"data.lifecycle"}}}}}},out:[["crm.contacts.basicApi.update","login@acme.com",{properties:{firstname:"Jane",lastname:"Doe",lifecyclestage:"lead"}},"email"]]},A={title:"Object id association",description:"The HubSpot event is associated via objectId instead of email, resolved from the walker user id.",in:b("product view",{timestamp:1700000105,user:{id:"hs-contact-789"}}),settings:{email:void 0,objectId:"user.id"},out:[["events.send.basicApi.send",{eventName:"pe12345678_product_view",objectId:"hs-contact-789",occurredAt:new Date(1700000105),properties:{}}]]},D={public:!1,in:b("product view",{timestamp:1700000106,user:{}}),out:[]},S={public:!1,in:b("debug noise",{timestamp:1700000107,user:{email:"user@example.com"}}),mapping:{ignore:!0},out:[]};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/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'HubSpot private app access token. Create one in HubSpot Settings > Integrations > Private Apps. Requires analytics.behavioral_events.send scope.',\n ),\n eventNamePrefix: z\n .string()\n .min(1)\n .describe(\n 'Fully qualified event name prefix: pe{HubID}_ (e.g. pe12345678_). Find it in HubSpot under Data Management > Custom Events.',\n ),\n email: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve contact email from events (like user.email). Required for contact association.',\n )\n .optional(),\n objectId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve HubSpot CRM objectId from events. Alternative to email for contact association.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level contact upsert mapping. Resolves to { email, properties }. Fires contact update on first push and re-fires when values change.',\n )\n .optional(),\n defaultProperties: z\n .record(z.string(), z.string())\n .describe(\n 'Static event properties added to every event occurrence. Useful for hs_touchpoint_source, hs_page_content_type, etc.',\n )\n .optional(),\n batch: z\n .boolean()\n .describe(\n 'Use batch API for events (accumulate and flush). Default: false.',\n )\n .optional(),\n batchSize: z\n .number()\n .int()\n .positive()\n .max(500)\n .describe(\n 'Batch size before auto-flush. Only used when batch: true. Default: 50. Max: 500.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n eventName: z\n .string()\n .describe(\n 'Override eventName for this rule. Without the prefix -- just the event name part (e.g. purchase_completed). The eventNamePrefix is prepended automatically.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Per-event contact upsert. Resolves to { email, properties }. Overrides destination-level identify. Use with skip: true on login/identify events.',\n )\n .optional(),\n properties: z\n .unknown()\n .describe(\n 'Additional event properties mapping. Resolved values are merged with defaultProperties and serialized to strings.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, HubSpotClientMock } from '../types';\n\nconst asyncNoop = () => Promise.resolve();\n\nfunction createMockClient(): HubSpotClientMock {\n return {\n events: {\n send: {\n basicApi: { send: asyncNoop },\n batchApi: { send: asyncNoop },\n },\n },\n crm: {\n contacts: {\n basicApi: { update: asyncNoop },\n },\n },\n };\n}\n\nexport const push: Env = {\n client: createMockClient(),\n};\n\nexport const simulation = [\n 'call:events.send.basicApi.send',\n 'call:events.send.batchApi.send',\n 'call:crm.contacts.basicApi.update',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * HubSpot SDK step examples.\n *\n * At push time, the destination invokes the `@hubspot/api-client` SDK. The\n * public method paths users see on the client are:\n *\n * - `events.send.basicApi.send(eventRequest)` — fires an event\n * - `events.send.batchApi.send({ inputs: [...] })` — flushes a batch\n * - `crm.contacts.basicApi.update(id, data, idProperty)` — contact upsert\n *\n * Each `out` is therefore a list of tuples `[['method.path', ...args], ...]`\n * matching the actual SDK call order. `identify` fires before the event.\n * When the destination skips an event (`skip: true`, `ignore: true`, or\n * missing identity), `out` is `[]`.\n */\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type HubSpotStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Default event forwarding -- events.send.basicApi.send() with auto-generated\n * event name. Email resolved from default settings.email = 'user.email'.\n */\nexport const defaultEvent: HubSpotStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000100,\n user: { email: 'user@example.com' },\n }),\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000100),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.settings.eventName overrides the auto-generated\n * name. The prefix is still prepended.\n */\nexport const mappedEventName: HubSpotStepExample = {\n in: getEvent('order complete', {\n timestamp: 1700000101,\n user: { email: 'user@example.com' },\n data: { total: 99.5, currency: 'EUR', id: 'ord-123' },\n }),\n mapping: {\n name: 'order complete',\n settings: {\n eventName: 'purchase_completed',\n properties: {\n map: {\n revenue: 'data.total',\n currency: 'data.currency',\n order_id: 'data.id',\n },\n },\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_purchase_completed',\n email: 'user@example.com',\n occurredAt: new Date(1700000101),\n properties: {\n revenue: '99.5',\n currency: 'EUR',\n order_id: 'ord-123',\n },\n },\n ],\n ],\n};\n\n/**\n * Event with defaultProperties -- settings.defaultProperties are merged\n * into every event. Per-event properties override defaults.\n */\nexport const defaultProperties: HubSpotStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000102,\n user: { email: 'user@example.com' },\n }),\n settings: {\n defaultProperties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000102),\n properties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires crm.contacts.basicApi.update() on\n * first push when settings.identify mapping resolves. Then fires the event.\n */\nexport const destinationIdentify: HubSpotStepExample = {\n in: getEvent('page view', {\n timestamp: 1700000103,\n user: { email: 'user@example.com', firstName: 'Jane', lastName: 'Doe' },\n }),\n settings: {\n identify: {\n map: {\n email: 'user.email',\n properties: {\n map: {\n firstname: 'user.firstName',\n lastname: 'user.lastName',\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'user@example.com',\n { properties: { firstname: 'Jane', lastname: 'Doe' } },\n 'email',\n ],\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000103),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with skip -- user login fires contact upsert only,\n * no custom event sent.\n */\nexport const userLoginIdentify: HubSpotStepExample = {\n in: getEvent('user login', {\n timestamp: 1700000104,\n user: { email: 'user@example.com' },\n data: {\n email: 'login@acme.com',\n first_name: 'Jane',\n last_name: 'Doe',\n lifecycle: 'lead',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n email: 'data.email',\n properties: {\n map: {\n firstname: 'data.first_name',\n lastname: 'data.last_name',\n lifecyclestage: 'data.lifecycle',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'login@acme.com',\n {\n properties: {\n firstname: 'Jane',\n lastname: 'Doe',\n lifecyclestage: 'lead',\n },\n },\n 'email',\n ],\n ],\n};\n\n/**\n * objectId association -- use objectId instead of email for contact\n * association on the event.\n */\nexport const objectIdAssociation: HubSpotStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000105,\n user: { id: 'hs-contact-789' },\n }),\n settings: {\n email: undefined,\n objectId: 'user.id',\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n objectId: 'hs-contact-789',\n occurredAt: new Date(1700000105),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * No identity resolved -- event is skipped with a warning. Neither email\n * nor objectId can be resolved from the event.\n */\nexport const noIdentity: HubSpotStepExample = {\n in: getEvent('product view', {\n timestamp: 1700000106,\n user: {},\n }),\n out: [],\n};\n\n/**\n * Wildcard ignore -- the event matches a mapping rule with ignore: true.\n * The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: HubSpotStepExample = {\n in: getEvent('debug noise', {\n timestamp: 1700000107,\n user: { email: 'user@example.com' },\n }),\n mapping: { ignore: true },\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBA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KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["z"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n accessToken: z\n .string()\n .min(1)\n .describe(\n 'HubSpot private app access token. Create one in HubSpot Settings > Integrations > Private Apps. Requires analytics.behavioral_events.send scope.',\n ),\n eventNamePrefix: z\n .string()\n .min(1)\n .describe(\n 'Fully qualified event name prefix: pe{HubID}_ (e.g. pe12345678_). Find it in HubSpot under Data Management > Custom Events.',\n ),\n email: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve contact email from events (like user.email). Required for contact association.',\n )\n .optional(),\n objectId: z\n .string()\n .describe(\n 'walkerOS mapping value path to resolve HubSpot CRM objectId from events. Alternative to email for contact association.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level contact upsert mapping. Resolves to { email, properties }. Fires contact update on first push and re-fires when values change.',\n )\n .optional(),\n defaultProperties: z\n .record(z.string(), z.string())\n .describe(\n 'Static event properties added to every event occurrence. Useful for hs_touchpoint_source, hs_page_content_type, etc.',\n )\n .optional(),\n batch: z\n .boolean()\n .describe(\n 'Use batch API for events (accumulate and flush). Default: false.',\n )\n .optional(),\n batchSize: z\n .number()\n .int()\n .positive()\n .max(500)\n .describe(\n 'Batch size before auto-flush. Only used when batch: true. Default: 50. Max: 500.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n eventName: z\n .string()\n .describe(\n 'Override eventName for this rule. Without the prefix -- just the event name part (e.g. purchase_completed). The eventNamePrefix is prepended automatically.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Per-event contact upsert. Resolves to { email, properties }. Overrides destination-level identify. Use with skip: true on login/identify events.',\n )\n .optional(),\n properties: z\n .unknown()\n .describe(\n 'Additional event properties mapping. Resolved values are merged with defaultProperties and serialized to strings.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, HubSpotClientMock } from '../types';\n\nconst asyncNoop = () => Promise.resolve();\n\nfunction createMockClient(): HubSpotClientMock {\n return {\n events: {\n send: {\n basicApi: { send: asyncNoop },\n batchApi: { send: asyncNoop },\n },\n },\n crm: {\n contacts: {\n basicApi: { update: asyncNoop },\n },\n },\n };\n}\n\nexport const push: Env = {\n client: createMockClient(),\n};\n\nexport const simulation = [\n 'call:events.send.basicApi.send',\n 'call:events.send.batchApi.send',\n 'call:crm.contacts.basicApi.update',\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * HubSpot SDK step examples.\n *\n * At push time, the destination invokes the `@hubspot/api-client` SDK. The\n * public method paths users see on the client are:\n *\n * - `events.send.basicApi.send(eventRequest)` — fires an event\n * - `events.send.batchApi.send({ inputs: [...] })` — flushes a batch\n * - `crm.contacts.basicApi.update(id, data, idProperty)` — contact upsert\n *\n * Each `out` is therefore a list of tuples `[['method.path', ...args], ...]`\n * matching the actual SDK call order. `identify` fires before the event.\n * When the destination skips an event (`skip: true`, `ignore: true`, or\n * missing identity), `out` is `[]`.\n */\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type HubSpotStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Default event forwarding -- events.send.basicApi.send() with auto-generated\n * event name. Email resolved from default settings.email = 'user.email'.\n */\nexport const defaultEvent: HubSpotStepExample = {\n title: 'Default event',\n description:\n 'A walker event is sent to HubSpot as a custom behavioral event keyed by the user email.',\n in: getEvent('product view', {\n timestamp: 1700000100,\n user: { email: 'user@example.com' },\n }),\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000100),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Mapped event name -- mapping.settings.eventName overrides the auto-generated\n * name. The prefix is still prepended.\n */\nexport const mappedEventName: HubSpotStepExample = {\n title: 'Custom event name',\n description:\n 'A mapping supplies a custom HubSpot event name and maps order data into properties for the behavioral event.',\n in: getEvent('order complete', {\n timestamp: 1700000101,\n user: { email: 'user@example.com' },\n data: { total: 99.5, currency: 'EUR', id: 'ord-123' },\n }),\n mapping: {\n name: 'order complete',\n settings: {\n eventName: 'purchase_completed',\n properties: {\n map: {\n revenue: 'data.total',\n currency: 'data.currency',\n order_id: 'data.id',\n },\n },\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_purchase_completed',\n email: 'user@example.com',\n occurredAt: new Date(1700000101),\n properties: {\n revenue: '99.5',\n currency: 'EUR',\n order_id: 'ord-123',\n },\n },\n ],\n ],\n};\n\n/**\n * Event with defaultProperties -- settings.defaultProperties are merged\n * into every event. Per-event properties override defaults.\n */\nexport const defaultProperties: HubSpotStepExample = {\n title: 'Default properties',\n description:\n 'Destination-level default properties are merged into every HubSpot event payload, such as traffic source metadata.',\n in: getEvent('page view', {\n timestamp: 1700000102,\n user: { email: 'user@example.com' },\n }),\n settings: {\n defaultProperties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000102),\n properties: {\n hs_touchpoint_source: 'walkerOS',\n hs_page_content_type: 'STANDARD_PAGE',\n },\n },\n ],\n ],\n};\n\n/**\n * Destination-level identify -- fires crm.contacts.basicApi.update() on\n * first push when settings.identify mapping resolves. Then fires the event.\n */\nexport const destinationIdentify: HubSpotStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify upserts the HubSpot contact with mapped properties before sending the behavioral event.',\n in: getEvent('page view', {\n timestamp: 1700000103,\n user: { email: 'user@example.com', firstName: 'Jane', lastName: 'Doe' },\n }),\n settings: {\n identify: {\n map: {\n email: 'user.email',\n properties: {\n map: {\n firstname: 'user.firstName',\n lastname: 'user.lastName',\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'user@example.com',\n { properties: { firstname: 'Jane', lastname: 'Doe' } },\n 'email',\n ],\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_page_view',\n email: 'user@example.com',\n occurredAt: new Date(1700000103),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * Per-event identify with skip -- user login fires contact upsert only,\n * no custom event sent.\n */\nexport const userLoginIdentify: HubSpotStepExample = {\n title: 'User login identify',\n description:\n 'A user login only upserts the HubSpot contact with profile and lifecycle properties, skipping the event send.',\n in: getEvent('user login', {\n timestamp: 1700000104,\n user: { email: 'user@example.com' },\n data: {\n email: 'login@acme.com',\n first_name: 'Jane',\n last_name: 'Doe',\n lifecycle: 'lead',\n },\n }),\n mapping: {\n skip: true,\n settings: {\n identify: {\n map: {\n email: 'data.email',\n properties: {\n map: {\n firstname: 'data.first_name',\n lastname: 'data.last_name',\n lifecyclestage: 'data.lifecycle',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'crm.contacts.basicApi.update',\n 'login@acme.com',\n {\n properties: {\n firstname: 'Jane',\n lastname: 'Doe',\n lifecyclestage: 'lead',\n },\n },\n 'email',\n ],\n ],\n};\n\n/**\n * objectId association -- use objectId instead of email for contact\n * association on the event.\n */\nexport const objectIdAssociation: HubSpotStepExample = {\n title: 'Object id association',\n description:\n 'The HubSpot event is associated via objectId instead of email, resolved from the walker user id.',\n in: getEvent('product view', {\n timestamp: 1700000105,\n user: { id: 'hs-contact-789' },\n }),\n settings: {\n email: undefined,\n objectId: 'user.id',\n },\n out: [\n [\n 'events.send.basicApi.send',\n {\n eventName: 'pe12345678_product_view',\n objectId: 'hs-contact-789',\n occurredAt: new Date(1700000105),\n properties: {},\n },\n ],\n ],\n};\n\n/**\n * No identity resolved -- event is skipped with a warning. Neither email\n * nor objectId can be resolved from the event.\n */\nexport const noIdentity: HubSpotStepExample = {\n public: false,\n in: getEvent('product view', {\n timestamp: 1700000106,\n user: {},\n }),\n out: [],\n};\n\n/**\n * Wildcard ignore -- the event matches a mapping rule with ignore: true.\n * The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: HubSpotStepExample = {\n public: false,\n in: getEvent('debug noise', {\n timestamp: 1700000107,\n user: { email: 'user@example.com' },\n }),\n mapping: { ignore: true },\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,aAAa,EACV,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,iBAAiB,EACd,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,OAAO,EACJ,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,mBAAmB,EAChB,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,EACJ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,WAAW,EACR,O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;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,YAAY;AAAA,UACV,WAAW;AAAA,UACX,UAAU;AAAA,UACV,gBAAgB;AAAA,QAClB;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAMO,IAAM,sBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,gBAAgB;AAAA,IAC3B,WAAW;AAAA,IACX,MAAM,EAAE,IAAI,iBAAiB;AAAA,EAC/B,CAAC;AAAA,EACD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,QACE,WAAW;AAAA,QACX,UAAU;AAAA,QACV,YAAY,oBAAI,KAAK,UAAU;AAAA,QAC/B,YAAY,CAAC;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAMO,IAAM,aAAiC;AAAA,EAC5C,QAAQ;AAAA,EACR,IAAI,SAAS,gBAAgB;AAAA,IAC3B,WAAW;AAAA,IACX,MAAM,CAAC;AAAA,EACT,CAAC;AAAA,EACD,KAAK,CAAC;AACR;AAMO,IAAM,kBAAsC;AAAA,EACjD,QAAQ;AAAA,EACR,IAAI,SAAS,eAAe;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,mBAAmB;AAAA,EACpC,CAAC;AAAA,EACD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;","names":["z"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -70,6 +70,8 @@ __export(step_exports, {
|
|
|
70
70
|
});
|
|
71
71
|
var import_core = require("@walkeros/core");
|
|
72
72
|
var defaultEvent = {
|
|
73
|
+
title: "Default event",
|
|
74
|
+
description: "A walker event is sent to HubSpot as a custom behavioral event keyed by the user email.",
|
|
73
75
|
in: (0, import_core.getEvent)("product view", {
|
|
74
76
|
timestamp: 1700000100,
|
|
75
77
|
user: { email: "user@example.com" }
|
|
@@ -87,6 +89,8 @@ var defaultEvent = {
|
|
|
87
89
|
]
|
|
88
90
|
};
|
|
89
91
|
var mappedEventName = {
|
|
92
|
+
title: "Custom event name",
|
|
93
|
+
description: "A mapping supplies a custom HubSpot event name and maps order data into properties for the behavioral event.",
|
|
90
94
|
in: (0, import_core.getEvent)("order complete", {
|
|
91
95
|
timestamp: 1700000101,
|
|
92
96
|
user: { email: "user@example.com" },
|
|
@@ -122,6 +126,8 @@ var mappedEventName = {
|
|
|
122
126
|
]
|
|
123
127
|
};
|
|
124
128
|
var defaultProperties = {
|
|
129
|
+
title: "Default properties",
|
|
130
|
+
description: "Destination-level default properties are merged into every HubSpot event payload, such as traffic source metadata.",
|
|
125
131
|
in: (0, import_core.getEvent)("page view", {
|
|
126
132
|
timestamp: 1700000102,
|
|
127
133
|
user: { email: "user@example.com" }
|
|
@@ -148,6 +154,8 @@ var defaultProperties = {
|
|
|
148
154
|
]
|
|
149
155
|
};
|
|
150
156
|
var destinationIdentify = {
|
|
157
|
+
title: "Destination identify",
|
|
158
|
+
description: "Destination-level identify upserts the HubSpot contact with mapped properties before sending the behavioral event.",
|
|
151
159
|
in: (0, import_core.getEvent)("page view", {
|
|
152
160
|
timestamp: 1700000103,
|
|
153
161
|
user: { email: "user@example.com", firstName: "Jane", lastName: "Doe" }
|
|
@@ -184,6 +192,8 @@ var destinationIdentify = {
|
|
|
184
192
|
]
|
|
185
193
|
};
|
|
186
194
|
var userLoginIdentify = {
|
|
195
|
+
title: "User login identify",
|
|
196
|
+
description: "A user login only upserts the HubSpot contact with profile and lifecycle properties, skipping the event send.",
|
|
187
197
|
in: (0, import_core.getEvent)("user login", {
|
|
188
198
|
timestamp: 1700000104,
|
|
189
199
|
user: { email: "user@example.com" },
|
|
@@ -227,6 +237,8 @@ var userLoginIdentify = {
|
|
|
227
237
|
]
|
|
228
238
|
};
|
|
229
239
|
var objectIdAssociation = {
|
|
240
|
+
title: "Object id association",
|
|
241
|
+
description: "The HubSpot event is associated via objectId instead of email, resolved from the walker user id.",
|
|
230
242
|
in: (0, import_core.getEvent)("product view", {
|
|
231
243
|
timestamp: 1700000105,
|
|
232
244
|
user: { id: "hs-contact-789" }
|
|
@@ -248,6 +260,7 @@ var objectIdAssociation = {
|
|
|
248
260
|
]
|
|
249
261
|
};
|
|
250
262
|
var noIdentity = {
|
|
263
|
+
public: false,
|
|
251
264
|
in: (0, import_core.getEvent)("product view", {
|
|
252
265
|
timestamp: 1700000106,
|
|
253
266
|
user: {}
|
|
@@ -255,6 +268,7 @@ var noIdentity = {
|
|
|
255
268
|
out: []
|
|
256
269
|
};
|
|
257
270
|
var wildcardIgnored = {
|
|
271
|
+
public: false,
|
|
258
272
|
in: (0, import_core.getEvent)("debug noise", {
|
|
259
273
|
timestamp: 1700000107,
|
|
260
274
|
user: { email: "user@example.com" }
|
package/dist/examples/index.mjs
CHANGED
|
@@ -49,6 +49,8 @@ __export(step_exports, {
|
|
|
49
49
|
});
|
|
50
50
|
import { getEvent } from "@walkeros/core";
|
|
51
51
|
var defaultEvent = {
|
|
52
|
+
title: "Default event",
|
|
53
|
+
description: "A walker event is sent to HubSpot as a custom behavioral event keyed by the user email.",
|
|
52
54
|
in: getEvent("product view", {
|
|
53
55
|
timestamp: 1700000100,
|
|
54
56
|
user: { email: "user@example.com" }
|
|
@@ -66,6 +68,8 @@ var defaultEvent = {
|
|
|
66
68
|
]
|
|
67
69
|
};
|
|
68
70
|
var mappedEventName = {
|
|
71
|
+
title: "Custom event name",
|
|
72
|
+
description: "A mapping supplies a custom HubSpot event name and maps order data into properties for the behavioral event.",
|
|
69
73
|
in: getEvent("order complete", {
|
|
70
74
|
timestamp: 1700000101,
|
|
71
75
|
user: { email: "user@example.com" },
|
|
@@ -101,6 +105,8 @@ var mappedEventName = {
|
|
|
101
105
|
]
|
|
102
106
|
};
|
|
103
107
|
var defaultProperties = {
|
|
108
|
+
title: "Default properties",
|
|
109
|
+
description: "Destination-level default properties are merged into every HubSpot event payload, such as traffic source metadata.",
|
|
104
110
|
in: getEvent("page view", {
|
|
105
111
|
timestamp: 1700000102,
|
|
106
112
|
user: { email: "user@example.com" }
|
|
@@ -127,6 +133,8 @@ var defaultProperties = {
|
|
|
127
133
|
]
|
|
128
134
|
};
|
|
129
135
|
var destinationIdentify = {
|
|
136
|
+
title: "Destination identify",
|
|
137
|
+
description: "Destination-level identify upserts the HubSpot contact with mapped properties before sending the behavioral event.",
|
|
130
138
|
in: getEvent("page view", {
|
|
131
139
|
timestamp: 1700000103,
|
|
132
140
|
user: { email: "user@example.com", firstName: "Jane", lastName: "Doe" }
|
|
@@ -163,6 +171,8 @@ var destinationIdentify = {
|
|
|
163
171
|
]
|
|
164
172
|
};
|
|
165
173
|
var userLoginIdentify = {
|
|
174
|
+
title: "User login identify",
|
|
175
|
+
description: "A user login only upserts the HubSpot contact with profile and lifecycle properties, skipping the event send.",
|
|
166
176
|
in: getEvent("user login", {
|
|
167
177
|
timestamp: 1700000104,
|
|
168
178
|
user: { email: "user@example.com" },
|
|
@@ -206,6 +216,8 @@ var userLoginIdentify = {
|
|
|
206
216
|
]
|
|
207
217
|
};
|
|
208
218
|
var objectIdAssociation = {
|
|
219
|
+
title: "Object id association",
|
|
220
|
+
description: "The HubSpot event is associated via objectId instead of email, resolved from the walker user id.",
|
|
209
221
|
in: getEvent("product view", {
|
|
210
222
|
timestamp: 1700000105,
|
|
211
223
|
user: { id: "hs-contact-789" }
|
|
@@ -227,6 +239,7 @@ var objectIdAssociation = {
|
|
|
227
239
|
]
|
|
228
240
|
};
|
|
229
241
|
var noIdentity = {
|
|
242
|
+
public: false,
|
|
230
243
|
in: getEvent("product view", {
|
|
231
244
|
timestamp: 1700000106,
|
|
232
245
|
user: {}
|
|
@@ -234,6 +247,7 @@ var noIdentity = {
|
|
|
234
247
|
out: []
|
|
235
248
|
};
|
|
236
249
|
var wildcardIgnored = {
|
|
250
|
+
public: false,
|
|
237
251
|
in: getEvent("debug noise", {
|
|
238
252
|
timestamp: 1700000107,
|
|
239
253
|
user: { email: "user@example.com" }
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-hubspot",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
@@ -117,6 +117,8 @@
|
|
|
117
117
|
},
|
|
118
118
|
"step": {
|
|
119
119
|
"defaultEvent": {
|
|
120
|
+
"title": "Default event",
|
|
121
|
+
"description": "A walker event is sent to HubSpot as a custom behavioral event keyed by the user email.",
|
|
120
122
|
"in": {
|
|
121
123
|
"name": "product view",
|
|
122
124
|
"data": {
|
|
@@ -154,7 +156,7 @@
|
|
|
154
156
|
"group": "gr0up",
|
|
155
157
|
"count": 1,
|
|
156
158
|
"version": {
|
|
157
|
-
"source": "3.4.
|
|
159
|
+
"source": "3.4.1",
|
|
158
160
|
"tagging": 1
|
|
159
161
|
},
|
|
160
162
|
"source": {
|
|
@@ -176,6 +178,8 @@
|
|
|
176
178
|
]
|
|
177
179
|
},
|
|
178
180
|
"defaultProperties": {
|
|
181
|
+
"title": "Default properties",
|
|
182
|
+
"description": "Destination-level default properties are merged into every HubSpot event payload, such as traffic source metadata.",
|
|
179
183
|
"in": {
|
|
180
184
|
"name": "page view",
|
|
181
185
|
"data": {
|
|
@@ -228,7 +232,7 @@
|
|
|
228
232
|
"group": "gr0up",
|
|
229
233
|
"count": 1,
|
|
230
234
|
"version": {
|
|
231
|
-
"source": "3.4.
|
|
235
|
+
"source": "3.4.1",
|
|
232
236
|
"tagging": 1
|
|
233
237
|
},
|
|
234
238
|
"source": {
|
|
@@ -259,6 +263,8 @@
|
|
|
259
263
|
]
|
|
260
264
|
},
|
|
261
265
|
"destinationIdentify": {
|
|
266
|
+
"title": "Destination identify",
|
|
267
|
+
"description": "Destination-level identify upserts the HubSpot contact with mapped properties before sending the behavioral event.",
|
|
262
268
|
"in": {
|
|
263
269
|
"name": "page view",
|
|
264
270
|
"data": {
|
|
@@ -313,7 +319,7 @@
|
|
|
313
319
|
"group": "gr0up",
|
|
314
320
|
"count": 1,
|
|
315
321
|
"version": {
|
|
316
|
-
"source": "3.4.
|
|
322
|
+
"source": "3.4.1",
|
|
317
323
|
"tagging": 1
|
|
318
324
|
},
|
|
319
325
|
"source": {
|
|
@@ -359,6 +365,8 @@
|
|
|
359
365
|
]
|
|
360
366
|
},
|
|
361
367
|
"mappedEventName": {
|
|
368
|
+
"title": "Custom event name",
|
|
369
|
+
"description": "A mapping supplies a custom HubSpot event name and maps order data into properties for the behavioral event.",
|
|
362
370
|
"in": {
|
|
363
371
|
"name": "order complete",
|
|
364
372
|
"data": {
|
|
@@ -441,7 +449,7 @@
|
|
|
441
449
|
"group": "gr0up",
|
|
442
450
|
"count": 1,
|
|
443
451
|
"version": {
|
|
444
|
-
"source": "3.4.
|
|
452
|
+
"source": "3.4.1",
|
|
445
453
|
"tagging": 1
|
|
446
454
|
},
|
|
447
455
|
"source": {
|
|
@@ -480,6 +488,7 @@
|
|
|
480
488
|
]
|
|
481
489
|
},
|
|
482
490
|
"noIdentity": {
|
|
491
|
+
"public": false,
|
|
483
492
|
"in": {
|
|
484
493
|
"name": "product view",
|
|
485
494
|
"data": {
|
|
@@ -515,7 +524,7 @@
|
|
|
515
524
|
"group": "gr0up",
|
|
516
525
|
"count": 1,
|
|
517
526
|
"version": {
|
|
518
|
-
"source": "3.4.
|
|
527
|
+
"source": "3.4.1",
|
|
519
528
|
"tagging": 1
|
|
520
529
|
},
|
|
521
530
|
"source": {
|
|
@@ -527,6 +536,8 @@
|
|
|
527
536
|
"out": []
|
|
528
537
|
},
|
|
529
538
|
"objectIdAssociation": {
|
|
539
|
+
"title": "Object id association",
|
|
540
|
+
"description": "The HubSpot event is associated via objectId instead of email, resolved from the walker user id.",
|
|
530
541
|
"in": {
|
|
531
542
|
"name": "product view",
|
|
532
543
|
"data": {
|
|
@@ -564,7 +575,7 @@
|
|
|
564
575
|
"group": "gr0up",
|
|
565
576
|
"count": 1,
|
|
566
577
|
"version": {
|
|
567
|
-
"source": "3.4.
|
|
578
|
+
"source": "3.4.1",
|
|
568
579
|
"tagging": 1
|
|
569
580
|
},
|
|
570
581
|
"source": {
|
|
@@ -589,6 +600,8 @@
|
|
|
589
600
|
]
|
|
590
601
|
},
|
|
591
602
|
"userLoginIdentify": {
|
|
603
|
+
"title": "User login identify",
|
|
604
|
+
"description": "A user login only upserts the HubSpot contact with profile and lifecycle properties, skipping the event send.",
|
|
592
605
|
"in": {
|
|
593
606
|
"name": "user login",
|
|
594
607
|
"data": {
|
|
@@ -639,7 +652,7 @@
|
|
|
639
652
|
"group": "gr0up",
|
|
640
653
|
"count": 1,
|
|
641
654
|
"version": {
|
|
642
|
-
"source": "3.4.
|
|
655
|
+
"source": "3.4.1",
|
|
643
656
|
"tagging": 1
|
|
644
657
|
},
|
|
645
658
|
"source": {
|
|
@@ -681,6 +694,7 @@
|
|
|
681
694
|
]
|
|
682
695
|
},
|
|
683
696
|
"wildcardIgnored": {
|
|
697
|
+
"public": false,
|
|
684
698
|
"in": {
|
|
685
699
|
"name": "debug noise",
|
|
686
700
|
"data": {
|
|
@@ -735,7 +749,7 @@
|
|
|
735
749
|
"group": "gr0up",
|
|
736
750
|
"count": 1,
|
|
737
751
|
"version": {
|
|
738
|
-
"source": "3.4.
|
|
752
|
+
"source": "3.4.1",
|
|
739
753
|
"tagging": 1
|
|
740
754
|
},
|
|
741
755
|
"source": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-hubspot",
|
|
3
3
|
"description": "HubSpot CRM server destination for walkerOS (@hubspot/api-client, custom events + contact upsert)",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@hubspot/api-client": "^13.0.0",
|
|
38
|
-
"@walkeros/core": "3.4.
|
|
39
|
-
"@walkeros/server-core": "3.4.
|
|
38
|
+
"@walkeros/core": "3.4.1",
|
|
39
|
+
"@walkeros/server-core": "3.4.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@walkeros/collector": "3.4.
|
|
42
|
+
"@walkeros/collector": "3.4.1"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|