@walkeros/server-destination-slack 4.8.2 → 4.8.3-next-1793115089237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @walkeros/server-destination-slack
2
2
 
3
+ ## 4.8.3-next-1793115089237
4
+
5
+ ### Patch Changes
6
+
7
+ - 5313635: The sample events from `getEvent` now use the standard event names:
8
+ `checkout start` replaces `checkout view`, an order carries `tax` and `total`,
9
+ a promotion names its placement `slot`, and product events carry `currency`.
10
+ Order `value` is now the merchandise value: the `order complete` sample goes
11
+ from 555 to 462, and the gross amount charged is `total` (467.22). The
12
+ destination examples read `data.tax`, `data.slot` and the search keys
13
+ `data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
14
+ read `data.total` first, then `data.value`. The CLI ships default event
15
+ contracts for common site types in `examples/contracts/`.
16
+ - 5313635: The `threadTs` and `user` descriptions say that both are fixed
17
+ values, not read from the event, and `retryConfig` describes each policy and
18
+ that retries go on after the destination timeout has failed the push. Step
19
+ example descriptions name the fixed values and settings they use, and the
20
+ examples' events carry millisecond timestamps.
21
+ - 5313635: The package publishes a minimal example: the incoming webhook URL,
22
+ read as the `SLACK_WEBHOOK_URL` secret. The docs page renders the install
23
+ line, the integrated code and the flow from it, and the package test runs the
24
+ same settings.
25
+ - Updated dependencies [34fd225]
26
+ - Updated dependencies [5313635]
27
+ - Updated dependencies [5313635]
28
+ - Updated dependencies [5313635]
29
+ - Updated dependencies [5313635]
30
+ - Updated dependencies [5313635]
31
+ - Updated dependencies [34fd225]
32
+ - Updated dependencies [5313635]
33
+ - @walkeros/core@4.8.3-next-1793115089237
34
+ - @walkeros/server-core@4.8.3-next-1793115089237
35
+
3
36
  ## 4.8.2
4
37
 
5
38
  ### Patch Changes
@@ -265,9 +298,6 @@
265
298
  and `event.context` remain required.
266
299
  - Each source self-registers via TypeScript module augmentation of `SourceMap`
267
300
  in `@walkeros/core`.
268
- - App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
269
- part of this release. Telemetry from v4 CLI/MCP will not validate against
270
- the existing app schema until that follow-up ships.
271
301
  - `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
272
302
  configs using `skip: true` in mapping rules must rename to `silent: true`.
273
303
  Hard cut: no legacy alias, the field is gone.
package/dist/dev.d.mts CHANGED
@@ -176,10 +176,17 @@ declare namespace step {
176
176
  export { type step_SlackStepExample as SlackStepExample, step_defaultBlocks as defaultBlocks, step_deployNotification as deployNotification, step_ephemeralMessage as ephemeralMessage, step_errorAlert as errorAlert, step_purchaseAlert as purchaseAlert, step_silentRule as silentRule, step_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
177
177
  }
178
178
 
179
+ /**
180
+ * The setting Slack needs to deliver: the incoming webhook URL, read from
181
+ * the environment.
182
+ */
183
+ declare const minimal: Flow.MinimalExample;
184
+
179
185
  declare const index_env: typeof env;
186
+ declare const index_minimal: typeof minimal;
180
187
  declare const index_step: typeof step;
181
188
  declare namespace index {
182
- export { index_env as env, index_step as step };
189
+ export { index_env as env, index_minimal as minimal, index_step as step };
183
190
  }
184
191
 
185
192
  export { index as examples, index$1 as schemas };
package/dist/dev.d.ts CHANGED
@@ -176,10 +176,17 @@ declare namespace step {
176
176
  export { type step_SlackStepExample as SlackStepExample, step_defaultBlocks as defaultBlocks, step_deployNotification as deployNotification, step_ephemeralMessage as ephemeralMessage, step_errorAlert as errorAlert, step_purchaseAlert as purchaseAlert, step_silentRule as silentRule, step_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
177
177
  }
178
178
 
179
+ /**
180
+ * The setting Slack needs to deliver: the incoming webhook URL, read from
181
+ * the environment.
182
+ */
183
+ declare const minimal: Flow.MinimalExample;
184
+
179
185
  declare const index_env: typeof env;
186
+ declare const index_minimal: typeof minimal;
180
187
  declare const index_step: typeof step;
181
188
  declare namespace index {
182
- export { index_env as env, index_step as step };
189
+ export { index_env as env, index_minimal as minimal, index_step as step };
183
190
  }
184
191
 
185
192
  export { index as examples, index$1 as schemas };
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},s={};o(s,{examples:()=>g,schemas:()=>i}),module.exports=(e=s,((e,o,s,i)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))r.call(e,l)||l===s||t(e,l,{get:()=>o[l],enumerable:!(i=a(o,l))||i.enumerable});return e})(t({},"__esModule",{value:!0}),e));var i={};o(i,{MappingSchema:()=>m,SettingsSchema:()=>d,mapping:()=>h,settings:()=>u});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=c.z.object({token:c.z.string().startsWith("xoxb-").describe("Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.").optional(),webhookUrl:c.z.string().url().describe("Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.").optional(),channel:c.z.string().describe('Default Slack channel ID or name (e.g. "#alerts" or "C024BE91L"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.').optional(),text:c.z.string().describe("Default text template. Supports `${data.field}` interpolation against the walkerOS event.").optional(),blocks:c.z.array(c.z.record(c.z.string(),c.z.unknown())).describe("Default Block Kit blocks applied when no mapping override is set.").optional(),includeHeader:c.z.boolean().describe("Auto-add an event-name header block when generating default blocks. Default: true.").optional(),unfurlLinks:c.z.boolean().describe("Enable link unfurling. Default: false (cleaner for automated alerts).").optional(),unfurlMedia:c.z.boolean().describe("Enable media unfurling. Default: false.").optional(),mrkdwn:c.z.boolean().describe("Use mrkdwn formatting in text. Default: true.").optional(),threadTs:c.z.string().describe("Static thread_ts for replies (rarely set at destination level).").optional(),retryConfig:c.z.enum(["default","fiveRetriesInFiveMinutes","none"]).describe('Retry policy passed to WebClient. Default: "default".').optional()}).strict().refine(e=>Boolean(e.token)!==Boolean(e.webhookUrl),{message:"Provide exactly one of `token` or `webhookUrl`."}).meta({oneOf:[{required:["token"]},{required:["webhookUrl"]}]}),p=require("@walkeros/core/dev"),m=p.z.object({channel:p.z.string().describe("Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.").optional(),text:p.z.string().describe("Override the text template for this rule. Supports `${data.field}` interpolation.").optional(),blocks:p.z.array(p.z.record(p.z.string(),p.z.unknown())).describe("Override Block Kit blocks for this rule.").optional(),threadTs:p.z.string().describe("thread_ts for posting as a reply in a thread.").optional(),replyBroadcast:p.z.boolean().describe("Also broadcast the threaded reply back to the channel.").optional(),ephemeral:p.z.boolean().describe("Send via chat.postEphemeral. Requires `user`.").optional(),user:p.z.string().describe("Slack user ID for ephemeral or DM delivery.").optional(),dm:p.z.boolean().describe("Send as DM via conversations.open + chat.postMessage. Requires `user`.").optional()}),u=(0,l.zodToSchema)(d),h=(0,l.zodToSchema)(m),g={};o(g,{env:()=>k,step:()=>x});var k={};o(k,{push:()=>y,simulation:()=>w});var b={ok:!0,channel:"CMOCK",ts:"1700000000.000100"},v={ok:!0},f={ok:!0,channel:{id:"D-MOCK-DM"}};var y={slackClient:{chat:{postMessage:()=>Promise.resolve(b),postEphemeral:()=>Promise.resolve(v)},conversations:{open:()=>Promise.resolve(f)}},sendServer:()=>Promise.resolve({})},w=["call:slackClient.chat.postMessage","call:slackClient.chat.postEphemeral","call:slackClient.conversations.open","call:sendServer"],x={};o(x,{defaultBlocks:()=>C,deployNotification:()=>U,ephemeralMessage:()=>_,errorAlert:()=>S,purchaseAlert:()=>z,silentRule:()=>O,threadedCheckoutStep:()=>D,welcomeDM:()=>M});var E=require("@walkeros/core"),z={title:"Purchase alert",description:"A completed order posts a templated message to a sales channel via the Slack Web API.",in:(0,E.getEvent)("order complete",{timestamp:1700000100,data:{id:"ORD-500",value:299.99,currency:"EUR",product:"Pro Plan"},user:{id:"buyer-42"}}),mapping:{settings:{channel:"#sales",text:":moneybag: New order: ${data.id} - ${data.value} ${data.currency}"}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:":moneybag: New order: ORD-500 - 299.99 EUR",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},S={title:"Error alert",description:"An error event posts a critical alert to an engineering channel using a mapping-level channel override.",in:(0,E.createEvent)({name:"error occur",timestamp:1700000200,data:{message:"Payment gateway timeout",code:"PGW_TIMEOUT",severity:"critical"}}),mapping:{settings:{channel:"#engineering-alerts",text:":rotating_light: Error: ${data.message}"}},out:[["slackClient.chat.postMessage",{channel:"#engineering-alerts",text:":rotating_light: Error: Payment gateway timeout",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},M={title:"Welcome DM",description:"A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",in:(0,E.createEvent)({name:"user signup",timestamp:1700000300,data:{plan:"enterprise"},user:{id:"U-NEW-USER"}}),mapping:{settings:{dm:!0,user:"U-NEW-USER",text:":wave: Welcome aboard! You signed up for the ${data.plan} plan."}},out:[["slackClient.conversations.open",{users:"U-NEW-USER"}],["slackClient.chat.postMessage",{channel:"D-MOCK-DM",text:":wave: Welcome aboard! You signed up for the enterprise plan.",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},D={title:"Threaded reply",description:"A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.",in:(0,E.createEvent)({name:"checkout step",timestamp:1700000400,data:{step:"payment",sessionTs:"1700000000.000050"}}),mapping:{settings:{channel:"#sales",text:"Checkout step: ${data.step}",threadTs:"1700000000.000050",replyBroadcast:!0}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:"Checkout step: payment",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,thread_ts:"1700000000.000050",reply_broadcast:!0}]]},_={title:"Ephemeral message",description:"A quota warning posts an ephemeral Slack message visible only to a target admin user.",in:(0,E.createEvent)({name:"quota warning",timestamp:1700000500,data:{remaining:5}}),mapping:{settings:{channel:"#admin",ephemeral:!0,user:"U-ADMIN-1",text:"Heads up: ${data.remaining} requests remaining"}},out:[["slackClient.chat.postEphemeral",{channel:"#admin",text:"Heads up: 5 requests remaining",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,user:"U-ADMIN-1"}]]},C={title:"Default blocks",description:"With no custom text the destination auto-generates a Block Kit message from event data and source.",in:(0,E.createEvent)({name:"lead submit",timestamp:1700000600,data:{name:"Acme",email:"sales@acme.test"},source:{type:"crm",platform:"server"}}),mapping:{settings:{channel:"#growth"}},out:[["slackClient.chat.postMessage",{channel:"#growth",text:"lead submit",blocks:[{type:"header",text:{type:"plain_text",text:"lead submit"}},{type:"section",fields:[{type:"mrkdwn",text:"*name:*\nAcme"},{type:"mrkdwn",text:"*email:*\nsales@acme.test"}]},{type:"context",elements:[{type:"mrkdwn",text:"Source: crm"}]}],unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},U={title:"Webhook deploy",description:"Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",in:(0,E.createEvent)({name:"deploy complete",timestamp:1700000700,data:{version:"1.4.2",environment:"prod"}}),settings:{token:void 0,webhookUrl:"https://hooks.slack.com/services/T00/B00/xxx"},mapping:{settings:{text:":rocket: Deployment complete: ${data.version} to ${data.environment}"}},out:[["sendServer","https://hooks.slack.com/services/T00/B00/xxx",JSON.stringify({text:":rocket: Deployment complete: 1.4.2 to prod",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0})]]},O={public:!1,description:"A rule with silent: true posts no message to Slack.",in:(0,E.getEvent)("page view",{timestamp:170000099e4}),mapping:{silent:!0},out:[]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},s={};o(s,{examples:()=>g,schemas:()=>i}),module.exports=(e=s,((e,o,s,i)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))r.call(e,l)||l===s||t(e,l,{get:()=>o[l],enumerable:!(i=a(o,l))||i.enumerable});return e})(t({},"__esModule",{value:!0}),e));var i={};o(i,{MappingSchema:()=>u,SettingsSchema:()=>d,mapping:()=>h,settings:()=>m});var l=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),d=c.z.object({token:c.z.string().startsWith("xoxb-").describe("Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.").optional(),webhookUrl:c.z.string().url().describe("Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.").optional(),channel:c.z.string().describe('Default Slack channel ID or name (e.g. "#alerts" or "C024BE91L"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.').optional(),text:c.z.string().describe("Default text template. Supports `${data.field}` interpolation against the walkerOS event.").optional(),blocks:c.z.array(c.z.record(c.z.string(),c.z.unknown())).describe("Default Block Kit blocks applied when no mapping override is set.").optional(),includeHeader:c.z.boolean().describe("Auto-add an event-name header block when generating default blocks. Default: true.").optional(),unfurlLinks:c.z.boolean().describe("Enable link unfurling. Default: false (cleaner for automated alerts).").optional(),unfurlMedia:c.z.boolean().describe("Enable media unfurling. Default: false.").optional(),mrkdwn:c.z.boolean().describe("Use mrkdwn formatting in text. Default: true.").optional(),threadTs:c.z.string().describe("Static thread_ts for replies (rarely set at destination level).").optional(),retryConfig:c.z.enum(["default","fiveRetriesInFiveMinutes","none"]).describe('Web API retry policy. "default" is the SDK policy (up to 10 retries over about 30 minutes), "fiveRetriesInFiveMinutes" 5 retries, "none" no retry. Retries continue after the destination timeout has failed the push. Default: "default".').optional()}).strict().refine(e=>Boolean(e.token)!==Boolean(e.webhookUrl),{message:"Provide exactly one of `token` or `webhookUrl`."}).meta({oneOf:[{required:["token"]},{required:["webhookUrl"]}]}),p=require("@walkeros/core/dev"),u=p.z.object({channel:p.z.string().describe("Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.").optional(),text:p.z.string().describe("Override the text template for this rule. Supports `${data.field}` interpolation.").optional(),blocks:p.z.array(p.z.record(p.z.string(),p.z.unknown())).describe("Override Block Kit blocks for this rule.").optional(),threadTs:p.z.string().describe("thread_ts of the parent message, to post as a reply in its thread. A fixed value, sent as written (not read from the event).").optional(),replyBroadcast:p.z.boolean().describe("Also broadcast the threaded reply back to the channel.").optional(),ephemeral:p.z.boolean().describe("Send via chat.postEphemeral. Requires `user`.").optional(),user:p.z.string().describe("Slack user ID for ephemeral or DM delivery. A fixed value, sent as written (not read from the event).").optional(),dm:p.z.boolean().describe("Send as DM via conversations.open + chat.postMessage. Requires `user`.").optional()}),m=(0,l.zodToSchema)(d),h=(0,l.zodToSchema)(u),g={};o(g,{env:()=>k,minimal:()=>O,step:()=>x});var k={};o(k,{push:()=>w,simulation:()=>y});var b={ok:!0,channel:"CMOCK",ts:"1700000000.000100"},v={ok:!0},f={ok:!0,channel:{id:"D-MOCK-DM"}};var w={slackClient:{chat:{postMessage:()=>Promise.resolve(b),postEphemeral:()=>Promise.resolve(v)},conversations:{open:()=>Promise.resolve(f)}},sendServer:()=>Promise.resolve({})},y=["call:slackClient.chat.postMessage","call:slackClient.chat.postEphemeral","call:slackClient.conversations.open","call:sendServer"],x={};o(x,{defaultBlocks:()=>U,deployNotification:()=>A,ephemeralMessage:()=>_,errorAlert:()=>S,purchaseAlert:()=>z,silentRule:()=>C,threadedCheckoutStep:()=>D,welcomeDM:()=>M});var E=require("@walkeros/core"),z={title:"Purchase alert",description:"A completed order posts a templated message to a sales channel via the Slack Web API.",in:(0,E.getEvent)("order complete",{timestamp:17000001e5,data:{id:"ORD-500",value:299.99,currency:"EUR",product:"Pro Plan"},user:{id:"buyer-42"}}),mapping:{settings:{channel:"#sales",text:":moneybag: New order: ${data.id} - ${data.value} ${data.currency}"}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:":moneybag: New order: ORD-500 - 299.99 EUR",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},S={title:"Error alert",description:"An error event posts a critical alert to an engineering channel using a mapping-level channel override.",in:(0,E.createEvent)({name:"error occur",timestamp:17000002e5,data:{message:"Payment gateway timeout",code:"PGW_TIMEOUT",severity:"critical"}}),mapping:{settings:{channel:"#engineering-alerts",text:":rotating_light: Error: ${data.message}"}},out:[["slackClient.chat.postMessage",{channel:"#engineering-alerts",text:":rotating_light: Error: Payment gateway timeout",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},M={title:"Welcome DM",description:"A user signup opens a DM with the fixed Slack user U-NEW-USER set in the rule (user is not read from the event) and posts a welcome message with the selected plan.",in:(0,E.createEvent)({name:"user signup",timestamp:17000003e5,data:{plan:"enterprise"},user:{id:"U-NEW-USER"}}),mapping:{settings:{dm:!0,user:"U-NEW-USER",text:":wave: Welcome aboard! You signed up for the ${data.plan} plan."}},out:[["slackClient.conversations.open",{users:"U-NEW-USER"}],["slackClient.chat.postMessage",{channel:"D-MOCK-DM",text:":wave: Welcome aboard! You signed up for the enterprise plan.",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},D={title:"Threaded reply",description:"A checkout step posts as a threaded reply under the fixed thread_ts set in the rule, broadcast to the channel.",in:(0,E.createEvent)({name:"checkout step",timestamp:17000004e5,data:{step:2,sessionTs:"1700000000.000050"}}),mapping:{settings:{channel:"#sales",text:"Checkout step: ${data.step}",threadTs:"1700000000.000050",replyBroadcast:!0}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:"Checkout step: 2",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,thread_ts:"1700000000.000050",reply_broadcast:!0}]]},_={title:"Ephemeral message",description:"A quota warning posts an ephemeral Slack message visible only to a target admin user.",in:(0,E.createEvent)({name:"quota warning",timestamp:17000005e5,data:{remaining:5}}),mapping:{settings:{channel:"#admin",ephemeral:!0,user:"U-ADMIN-1",text:"Heads up: ${data.remaining} requests remaining"}},out:[["slackClient.chat.postEphemeral",{channel:"#admin",text:"Heads up: 5 requests remaining",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,user:"U-ADMIN-1"}]]},U={title:"Default blocks",description:"With no custom text the destination auto-generates a Block Kit message from event data and source.",in:(0,E.createEvent)({name:"lead submit",timestamp:17000006e5,data:{name:"Acme",email:"sales@acme.test"},source:{type:"crm",platform:"server"}}),mapping:{settings:{channel:"#growth"}},out:[["slackClient.chat.postMessage",{channel:"#growth",text:"lead submit",blocks:[{type:"header",text:{type:"plain_text",text:"lead submit"}},{type:"section",fields:[{type:"mrkdwn",text:"*name:*\nAcme"},{type:"mrkdwn",text:"*email:*\nsales@acme.test"}]},{type:"context",elements:[{type:"mrkdwn",text:"Source: crm"}]}],unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},A={title:"Webhook deploy",description:"With settings.webhookUrl instead of a token, the destination posts the rendered message body to that incoming webhook.",in:(0,E.createEvent)({name:"deploy complete",timestamp:17000007e5,data:{version:"1.4.2",environment:"prod"}}),settings:{token:void 0,webhookUrl:"https://hooks.slack.com/services/T00/B00/xxx"},mapping:{settings:{text:":rocket: Deployment complete: ${data.version} to ${data.environment}"}},out:[["sendServer","https://hooks.slack.com/services/T00/B00/xxx",JSON.stringify({text:":rocket: Deployment complete: 1.4.2 to prod",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0})]]},C={public:!1,description:"A rule with silent: true posts no message to Slack.",in:(0,E.getEvent)("page view",{timestamp:170000099e4}),mapping:{silent:!0},out:[]},O={settings:{webhookUrl:"https://hooks.slack.com/services/x/y/z"},secrets:{webhookUrl:"SLACK_WEBHOOK_URL"}};//# 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\n .object({\n token: z\n .string()\n .startsWith('xoxb-')\n .describe(\n 'Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.',\n )\n .optional(),\n webhookUrl: z\n .string()\n .url()\n .describe(\n 'Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.',\n )\n .optional(),\n channel: z\n .string()\n .describe(\n 'Default Slack channel ID or name (e.g. \"#alerts\" or \"C024BE91L\"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Default text template. Supports `${data.field}` interpolation against the walkerOS event.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe(\n 'Default Block Kit blocks applied when no mapping override is set.',\n )\n .optional(),\n includeHeader: z\n .boolean()\n .describe(\n 'Auto-add an event-name header block when generating default blocks. Default: true.',\n )\n .optional(),\n unfurlLinks: z\n .boolean()\n .describe(\n 'Enable link unfurling. Default: false (cleaner for automated alerts).',\n )\n .optional(),\n unfurlMedia: z\n .boolean()\n .describe('Enable media unfurling. Default: false.')\n .optional(),\n mrkdwn: z\n .boolean()\n .describe('Use mrkdwn formatting in text. Default: true.')\n .optional(),\n threadTs: z\n .string()\n .describe(\n 'Static thread_ts for replies (rarely set at destination level).',\n )\n .optional(),\n retryConfig: z\n .enum(['default', 'fiveRetriesInFiveMinutes', 'none'])\n .describe('Retry policy passed to WebClient. Default: \"default\".')\n .optional(),\n })\n .strict()\n .refine((v) => Boolean(v.token) !== Boolean(v.webhookUrl), {\n message: 'Provide exactly one of `token` or `webhookUrl`.',\n })\n // The same rule in JSON Schema: each alternative requires one credential.\n .meta({ oneOf: [{ required: ['token'] }, { required: ['webhookUrl'] }] });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n channel: z\n .string()\n .describe(\n 'Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Override the text template for this rule. Supports `${data.field}` interpolation.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe('Override Block Kit blocks for this rule.')\n .optional(),\n threadTs: z\n .string()\n .describe('thread_ts for posting as a reply in a thread.')\n .optional(),\n replyBroadcast: z\n .boolean()\n .describe('Also broadcast the threaded reply back to the channel.')\n .optional(),\n ephemeral: z\n .boolean()\n .describe('Send via chat.postEphemeral. Requires `user`.')\n .optional(),\n user: z\n .string()\n .describe('Slack user ID for ephemeral or DM delivery.')\n .optional(),\n dm: z\n .boolean()\n .describe(\n 'Send as DM via conversations.open + chat.postMessage. Requires `user`.',\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, SlackClientMock } from '../types';\n\nconst okMessageResponse = {\n ok: true as const,\n channel: 'CMOCK',\n ts: '1700000000.000100',\n};\n\nconst okEphemeralResponse = { ok: true as const };\n\nconst okOpenResponse = {\n ok: true as const,\n channel: { id: 'D-MOCK-DM' },\n};\n\nfunction createMockClient(): SlackClientMock {\n return {\n chat: {\n postMessage: () => Promise.resolve(okMessageResponse as never),\n postEphemeral: () => Promise.resolve(okEphemeralResponse as never),\n },\n conversations: {\n open: () => Promise.resolve(okOpenResponse as never),\n },\n };\n}\n\nexport const push: Env = {\n slackClient: createMockClient(),\n sendServer: () => Promise.resolve({}),\n};\n\nexport const simulation = [\n 'call:slackClient.chat.postMessage',\n 'call:slackClient.chat.postEphemeral',\n 'call:slackClient.conversations.open',\n 'call:sendServer',\n];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type SlackStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Slack server destination operates in two modes:\n *\n * 1. Web API mode - calls the injected `env.slackClient` SDK methods\n * (`chat.postMessage`, `chat.postEphemeral`, `conversations.open`).\n * Captured as `[callable, args]` with dotted callable names such as\n * `'slackClient.chat.postMessage'`.\n *\n * 2. Webhook mode - calls `env.sendServer(url, JSON.stringify(body))`.\n * Captured as `['sendServer', url, bodyAsString]` where `bodyAsString`\n * is the already-stringified JSON body. Key insertion order in the\n * source object matters for string equality.\n *\n * A single push may emit multiple calls (e.g. a DM opens a conversation\n * then posts to the returned channel id), so every `out` is wrapped as\n * `[[callable, ...args], ...]`.\n */\n\n/**\n * Purchase notification -- Web API mode, channel from mapping override,\n * text template interpolated against event.data.\n */\nexport const purchaseAlert: SlackStepExample = {\n title: 'Purchase alert',\n description:\n 'A completed order posts a templated message to a sales channel via the Slack Web API.',\n in: getEvent('order complete', {\n timestamp: 1700000100,\n data: {\n id: 'ORD-500',\n value: 299.99,\n currency: 'EUR',\n product: 'Pro Plan',\n },\n user: { id: 'buyer-42' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: ':moneybag: New order: ${data.id} - ${data.value} ${data.currency}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: ':moneybag: New order: ORD-500 - 299.99 EUR',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Error alert -- routes to a different channel via mapping override.\n */\nexport const errorAlert: SlackStepExample = {\n title: 'Error alert',\n description:\n 'An error event posts a critical alert to an engineering channel using a mapping-level channel override.',\n in: createEvent({\n name: 'error occur',\n timestamp: 1700000200,\n data: {\n message: 'Payment gateway timeout',\n code: 'PGW_TIMEOUT',\n severity: 'critical',\n },\n }),\n mapping: {\n settings: {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: ${data.message}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: Payment gateway timeout',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Welcome DM -- conversations.open(users) -> chat.postMessage(channel: D-id).\n */\nexport const welcomeDM: SlackStepExample = {\n title: 'Welcome DM',\n description:\n 'A user signup opens a Slack DM channel and posts a welcome message with the selected plan.',\n in: createEvent({\n name: 'user signup',\n timestamp: 1700000300,\n data: { plan: 'enterprise' },\n user: { id: 'U-NEW-USER' },\n }),\n mapping: {\n settings: {\n dm: true,\n user: 'U-NEW-USER',\n text: ':wave: Welcome aboard! You signed up for the ${data.plan} plan.',\n },\n },\n out: [\n ['slackClient.conversations.open', { users: 'U-NEW-USER' }],\n [\n 'slackClient.chat.postMessage',\n {\n channel: 'D-MOCK-DM',\n text: ':wave: Welcome aboard! You signed up for the enterprise plan.',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Threaded checkout step -- thread_ts override puts the reply into a thread.\n */\nexport const threadedCheckoutStep: SlackStepExample = {\n title: 'Threaded reply',\n description:\n 'A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.',\n in: createEvent({\n name: 'checkout step',\n timestamp: 1700000400,\n data: { step: 'payment', sessionTs: '1700000000.000050' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: 'Checkout step: ${data.step}',\n threadTs: '1700000000.000050',\n replyBroadcast: true,\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: 'Checkout step: payment',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n thread_ts: '1700000000.000050',\n reply_broadcast: true,\n },\n ],\n ],\n};\n\n/**\n * Ephemeral message -- visible to one user in the target channel.\n */\nexport const ephemeralMessage: SlackStepExample = {\n title: 'Ephemeral message',\n description:\n 'A quota warning posts an ephemeral Slack message visible only to a target admin user.',\n in: createEvent({\n name: 'quota warning',\n timestamp: 1700000500,\n data: { remaining: 5 },\n }),\n mapping: {\n settings: {\n channel: '#admin',\n ephemeral: true,\n user: 'U-ADMIN-1',\n text: 'Heads up: ${data.remaining} requests remaining',\n },\n },\n out: [\n [\n 'slackClient.chat.postEphemeral',\n {\n channel: '#admin',\n text: 'Heads up: 5 requests remaining',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n user: 'U-ADMIN-1',\n },\n ],\n ],\n};\n\n/**\n * Default blocks -- no custom text/blocks, destination auto-generates a\n * Block Kit message from the event data.\n */\nexport const defaultBlocks: SlackStepExample = {\n title: 'Default blocks',\n description:\n 'With no custom text the destination auto-generates a Block Kit message from event data and source.',\n in: createEvent({\n name: 'lead submit',\n timestamp: 1700000600,\n data: { name: 'Acme', email: 'sales@acme.test' },\n source: { type: 'crm', platform: 'server' },\n }),\n mapping: {\n settings: {\n channel: '#growth',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#growth',\n text: 'lead submit',\n blocks: [\n {\n type: 'header',\n text: { type: 'plain_text', text: 'lead submit' },\n },\n {\n type: 'section',\n fields: [\n { type: 'mrkdwn', text: '*name:*\\nAcme' },\n { type: 'mrkdwn', text: '*email:*\\nsales@acme.test' },\n ],\n },\n {\n type: 'context',\n elements: [{ type: 'mrkdwn', text: 'Source: crm' }],\n },\n ],\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Webhook mode -- no token, just webhookUrl. The destination calls\n * `env.sendServer(url, JSON.stringify(body))`. Channel is baked into the\n * URL by Slack.\n */\nexport const deployNotification: SlackStepExample = {\n title: 'Webhook deploy',\n description:\n 'Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.',\n in: createEvent({\n name: 'deploy complete',\n timestamp: 1700000700,\n data: { version: '1.4.2', environment: 'prod' },\n }),\n settings: {\n token: undefined,\n webhookUrl: 'https://hooks.slack.com/services/T00/B00/xxx',\n },\n mapping: {\n settings: {\n text: ':rocket: Deployment complete: ${data.version} to ${data.environment}',\n },\n },\n out: [\n [\n 'sendServer',\n 'https://hooks.slack.com/services/T00/B00/xxx',\n JSON.stringify({\n text: ':rocket: Deployment complete: 1.4.2 to prod',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n }),\n ],\n ],\n};\n\n/** A silent rule posts nothing to Slack. */\nexport const silentRule: SlackStepExample = {\n public: false,\n description: 'A rule with silent: true posts no message to Slack.',\n in: getEvent('page view', { timestamp: 1700000990000 }),\n mapping: { silent: 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,aAC3B,OAAO;AAAA,EACN,OAAO,aACJ,OAAO,EACP,WAAW,OAAO,EAClB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,aACT,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,MAAM,aACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQ,aACL,MAAM,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,QAAQ,CAAC,CAAC,EACvC;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,eAAe,aACZ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,QAAQ,EACR,SAAS,yCAAyC,EAClD,SAAS;AAAA,EACZ,QAAQ,aACL,QAAQ,EACR,SAAS,+CAA+C,EACxD,SAAS;AAAA,EACZ,UAAU,aACP,OAAO,EACP;AAA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,cACxC,EAAE,MAAM,UAAU,MAAM,4BAA4B;AAAA,YACtD;AAAA,UACF;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,UAAU,CAAC,EAAE,MAAM,UAAU,MAAM,cAAc,CAAC;AAAA,UACpD;AAAA,QACF;AAAA,QACA,cAAc;AAAA,QACd,cAAc;AAAA,QACd,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,qBAAuC;AAAA,EAClD,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,yBAAY;AAAA,IACd,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM,EAAE,SAAS,SAAS,aAAa,OAAO;AAAA,EAChD,CAAC;AAAA,EACD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,MAAM;AAAA,QACN,cAAc;AAAA,QACd,cAAc;AAAA,QACd,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAI,sBAAS,aAAa,EAAE,WAAW,YAAc,CAAC;AAAA,EACtD,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","../src/examples/minimal.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n token: z\n .string()\n .startsWith('xoxb-')\n .describe(\n 'Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.',\n )\n .optional(),\n webhookUrl: z\n .string()\n .url()\n .describe(\n 'Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.',\n )\n .optional(),\n channel: z\n .string()\n .describe(\n 'Default Slack channel ID or name (e.g. \"#alerts\" or \"C024BE91L\"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Default text template. Supports `${data.field}` interpolation against the walkerOS event.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe(\n 'Default Block Kit blocks applied when no mapping override is set.',\n )\n .optional(),\n includeHeader: z\n .boolean()\n .describe(\n 'Auto-add an event-name header block when generating default blocks. Default: true.',\n )\n .optional(),\n unfurlLinks: z\n .boolean()\n .describe(\n 'Enable link unfurling. Default: false (cleaner for automated alerts).',\n )\n .optional(),\n unfurlMedia: z\n .boolean()\n .describe('Enable media unfurling. Default: false.')\n .optional(),\n mrkdwn: z\n .boolean()\n .describe('Use mrkdwn formatting in text. Default: true.')\n .optional(),\n threadTs: z\n .string()\n .describe(\n 'Static thread_ts for replies (rarely set at destination level).',\n )\n .optional(),\n retryConfig: z\n .enum(['default', 'fiveRetriesInFiveMinutes', 'none'])\n .describe(\n 'Web API retry policy. \"default\" is the SDK policy (up to 10 retries over about 30 minutes), \"fiveRetriesInFiveMinutes\" 5 retries, \"none\" no retry. Retries continue after the destination timeout has failed the push. Default: \"default\".',\n )\n .optional(),\n })\n .strict()\n .refine((v) => Boolean(v.token) !== Boolean(v.webhookUrl), {\n message: 'Provide exactly one of `token` or `webhookUrl`.',\n })\n // The same rule in JSON Schema: each alternative requires one credential.\n .meta({ oneOf: [{ required: ['token'] }, { required: ['webhookUrl'] }] });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n channel: z\n .string()\n .describe(\n 'Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Override the text template for this rule. Supports `${data.field}` interpolation.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe('Override Block Kit blocks for this rule.')\n .optional(),\n threadTs: z\n .string()\n .describe(\n 'thread_ts of the parent message, to post as a reply in its thread. A fixed value, sent as written (not read from the event).',\n )\n .optional(),\n replyBroadcast: z\n .boolean()\n .describe('Also broadcast the threaded reply back to the channel.')\n .optional(),\n ephemeral: z\n .boolean()\n .describe('Send via chat.postEphemeral. Requires `user`.')\n .optional(),\n user: z\n .string()\n .describe(\n 'Slack user ID for ephemeral or DM delivery. A fixed value, sent as written (not read from the event).',\n )\n .optional(),\n dm: z\n .boolean()\n .describe(\n 'Send as DM via conversations.open + chat.postMessage. Requires `user`.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env, SlackClientMock } from '../types';\n\nconst okMessageResponse = {\n ok: true as const,\n channel: 'CMOCK',\n ts: '1700000000.000100',\n};\n\nconst okEphemeralResponse = { ok: true as const };\n\nconst okOpenResponse = {\n ok: true as const,\n channel: { id: 'D-MOCK-DM' },\n};\n\nfunction createMockClient(): SlackClientMock {\n return {\n chat: {\n postMessage: () => Promise.resolve(okMessageResponse as never),\n postEphemeral: () => Promise.resolve(okEphemeralResponse as never),\n },\n conversations: {\n open: () => Promise.resolve(okOpenResponse as never),\n },\n };\n}\n\nexport const push: Env = {\n slackClient: createMockClient(),\n sendServer: () => Promise.resolve({}),\n};\n\nexport const simulation = [\n 'call:slackClient.chat.postMessage',\n 'call:slackClient.chat.postEphemeral',\n 'call:slackClient.conversations.open',\n 'call:sendServer',\n];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type SlackStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Slack server destination operates in two modes:\n *\n * 1. Web API mode - calls the injected `env.slackClient` SDK methods\n * (`chat.postMessage`, `chat.postEphemeral`, `conversations.open`).\n * Captured as `[callable, args]` with dotted callable names such as\n * `'slackClient.chat.postMessage'`.\n *\n * 2. Webhook mode - calls `env.sendServer(url, JSON.stringify(body))`.\n * Captured as `['sendServer', url, bodyAsString]` where `bodyAsString`\n * is the already-stringified JSON body. Key insertion order in the\n * source object matters for string equality.\n *\n * A single push may emit multiple calls (e.g. a DM opens a conversation\n * then posts to the returned channel id), so every `out` is wrapped as\n * `[[callable, ...args], ...]`.\n */\n\n/**\n * Purchase notification -- Web API mode, channel from mapping override,\n * text template interpolated against event.data.\n */\nexport const purchaseAlert: SlackStepExample = {\n title: 'Purchase alert',\n description:\n 'A completed order posts a templated message to a sales channel via the Slack Web API.',\n in: getEvent('order complete', {\n timestamp: 1700000100000,\n data: {\n id: 'ORD-500',\n value: 299.99,\n currency: 'EUR',\n product: 'Pro Plan',\n },\n user: { id: 'buyer-42' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: ':moneybag: New order: ${data.id} - ${data.value} ${data.currency}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: ':moneybag: New order: ORD-500 - 299.99 EUR',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Error alert -- routes to a different channel via mapping override.\n */\nexport const errorAlert: SlackStepExample = {\n title: 'Error alert',\n description:\n 'An error event posts a critical alert to an engineering channel using a mapping-level channel override.',\n in: createEvent({\n name: 'error occur',\n timestamp: 1700000200000,\n data: {\n message: 'Payment gateway timeout',\n code: 'PGW_TIMEOUT',\n severity: 'critical',\n },\n }),\n mapping: {\n settings: {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: ${data.message}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: Payment gateway timeout',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Welcome DM -- conversations.open(users) -> chat.postMessage(channel: D-id).\n */\nexport const welcomeDM: SlackStepExample = {\n title: 'Welcome DM',\n description:\n 'A user signup opens a DM with the fixed Slack user U-NEW-USER set in the rule (user is not read from the event) and posts a welcome message with the selected plan.',\n in: createEvent({\n name: 'user signup',\n timestamp: 1700000300000,\n data: { plan: 'enterprise' },\n user: { id: 'U-NEW-USER' },\n }),\n mapping: {\n settings: {\n dm: true,\n user: 'U-NEW-USER',\n text: ':wave: Welcome aboard! You signed up for the ${data.plan} plan.',\n },\n },\n out: [\n ['slackClient.conversations.open', { users: 'U-NEW-USER' }],\n [\n 'slackClient.chat.postMessage',\n {\n channel: 'D-MOCK-DM',\n text: ':wave: Welcome aboard! You signed up for the enterprise plan.',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Threaded checkout step -- thread_ts override puts the reply into a thread.\n */\nexport const threadedCheckoutStep: SlackStepExample = {\n title: 'Threaded reply',\n description:\n 'A checkout step posts as a threaded reply under the fixed thread_ts set in the rule, broadcast to the channel.',\n in: createEvent({\n name: 'checkout step',\n timestamp: 1700000400000,\n data: { step: 2, sessionTs: '1700000000.000050' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: 'Checkout step: ${data.step}',\n threadTs: '1700000000.000050',\n replyBroadcast: true,\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: 'Checkout step: 2',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n thread_ts: '1700000000.000050',\n reply_broadcast: true,\n },\n ],\n ],\n};\n\n/**\n * Ephemeral message -- visible to one user in the target channel.\n */\nexport const ephemeralMessage: SlackStepExample = {\n title: 'Ephemeral message',\n description:\n 'A quota warning posts an ephemeral Slack message visible only to a target admin user.',\n in: createEvent({\n name: 'quota warning',\n timestamp: 1700000500000,\n data: { remaining: 5 },\n }),\n mapping: {\n settings: {\n channel: '#admin',\n ephemeral: true,\n user: 'U-ADMIN-1',\n text: 'Heads up: ${data.remaining} requests remaining',\n },\n },\n out: [\n [\n 'slackClient.chat.postEphemeral',\n {\n channel: '#admin',\n text: 'Heads up: 5 requests remaining',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n user: 'U-ADMIN-1',\n },\n ],\n ],\n};\n\n/**\n * Default blocks -- no custom text/blocks, destination auto-generates a\n * Block Kit message from the event data.\n */\nexport const defaultBlocks: SlackStepExample = {\n title: 'Default blocks',\n description:\n 'With no custom text the destination auto-generates a Block Kit message from event data and source.',\n in: createEvent({\n name: 'lead submit',\n timestamp: 1700000600000,\n data: { name: 'Acme', email: 'sales@acme.test' },\n source: { type: 'crm', platform: 'server' },\n }),\n mapping: {\n settings: {\n channel: '#growth',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#growth',\n text: 'lead submit',\n blocks: [\n {\n type: 'header',\n text: { type: 'plain_text', text: 'lead submit' },\n },\n {\n type: 'section',\n fields: [\n { type: 'mrkdwn', text: '*name:*\\nAcme' },\n { type: 'mrkdwn', text: '*email:*\\nsales@acme.test' },\n ],\n },\n {\n type: 'context',\n elements: [{ type: 'mrkdwn', text: 'Source: crm' }],\n },\n ],\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Webhook mode -- no token, just webhookUrl. The destination calls\n * `env.sendServer(url, JSON.stringify(body))`. Channel is baked into the\n * URL by Slack.\n */\nexport const deployNotification: SlackStepExample = {\n title: 'Webhook deploy',\n description:\n 'With settings.webhookUrl instead of a token, the destination posts the rendered message body to that incoming webhook.',\n in: createEvent({\n name: 'deploy complete',\n timestamp: 1700000700000,\n data: { version: '1.4.2', environment: 'prod' },\n }),\n settings: {\n token: undefined,\n webhookUrl: 'https://hooks.slack.com/services/T00/B00/xxx',\n },\n mapping: {\n settings: {\n text: ':rocket: Deployment complete: ${data.version} to ${data.environment}',\n },\n },\n out: [\n [\n 'sendServer',\n 'https://hooks.slack.com/services/T00/B00/xxx',\n JSON.stringify({\n text: ':rocket: Deployment complete: 1.4.2 to prod',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n }),\n ],\n ],\n};\n\n/** A silent rule posts nothing to Slack. */\nexport const silentRule: SlackStepExample = {\n public: false,\n description: 'A rule with silent: true posts no message to Slack.',\n in: getEvent('page view', { timestamp: 1700000990000 }),\n mapping: { silent: true },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting Slack needs to deliver: the incoming webhook URL, read from\n * the environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { webhookUrl: 'https://hooks.slack.com/services/x/y/z' },\n secrets: { webhookUrl: 'SLACK_WEBHOOK_URL' },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,OAAO,aACJ,OAAO,EACP,WAAW,OAAO,EAClB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,aACT,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,MAAM,aACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,E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AAAA,EACR,aAAa;AAAA,EACb,QAAI,sBAAS,aAAa,EAAE,WAAW,YAAc,CAAC;AAAA,EACtD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;;;ACzSO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,YAAY,yCAAyC;AAAA,EACjE,SAAS,EAAE,YAAY,oBAAoB;AAC7C;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,a=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},n={};a(n,{MappingSchema:()=>l,SettingsSchema:()=>s,mapping:()=>p,settings:()=>c});import{zodToSchema as r}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var s=o.object({token:o.string().startsWith("xoxb-").describe("Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.").optional(),webhookUrl:o.string().url().describe("Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.").optional(),channel:o.string().describe('Default Slack channel ID or name (e.g. "#alerts" or "C024BE91L"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.').optional(),text:o.string().describe("Default text template. Supports `${data.field}` interpolation against the walkerOS event.").optional(),blocks:o.array(o.record(o.string(),o.unknown())).describe("Default Block Kit blocks applied when no mapping override is set.").optional(),includeHeader:o.boolean().describe("Auto-add an event-name header block when generating default blocks. Default: true.").optional(),unfurlLinks:o.boolean().describe("Enable link unfurling. Default: false (cleaner for automated alerts).").optional(),unfurlMedia:o.boolean().describe("Enable media unfurling. Default: false.").optional(),mrkdwn:o.boolean().describe("Use mrkdwn formatting in text. Default: true.").optional(),threadTs:o.string().describe("Static thread_ts for replies (rarely set at destination level).").optional(),retryConfig:o.enum(["default","fiveRetriesInFiveMinutes","none"]).describe('Retry policy passed to WebClient. Default: "default".').optional()}).strict().refine(e=>Boolean(e.token)!==Boolean(e.webhookUrl),{message:"Provide exactly one of `token` or `webhookUrl`."}).meta({oneOf:[{required:["token"]},{required:["webhookUrl"]}]});import{z as i}from"@walkeros/core/dev";var l=i.object({channel:i.string().describe("Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.").optional(),text:i.string().describe("Override the text template for this rule. Supports `${data.field}` interpolation.").optional(),blocks:i.array(i.record(i.string(),i.unknown())).describe("Override Block Kit blocks for this rule.").optional(),threadTs:i.string().describe("thread_ts for posting as a reply in a thread.").optional(),replyBroadcast:i.boolean().describe("Also broadcast the threaded reply back to the channel.").optional(),ephemeral:i.boolean().describe("Send via chat.postEphemeral. Requires `user`.").optional(),user:i.string().describe("Slack user ID for ephemeral or DM delivery.").optional(),dm:i.boolean().describe("Send as DM via conversations.open + chat.postMessage. Requires `user`.").optional()}),c=r(s),p=r(l),d={};a(d,{env:()=>m,step:()=>f});var m={};a(m,{push:()=>k,simulation:()=>b});var u={ok:!0,channel:"CMOCK",ts:"1700000000.000100"},h={ok:!0},g={ok:!0,channel:{id:"D-MOCK-DM"}};var k={slackClient:{chat:{postMessage:()=>Promise.resolve(u),postEphemeral:()=>Promise.resolve(h)},conversations:{open:()=>Promise.resolve(g)}},sendServer:()=>Promise.resolve({})},b=["call:slackClient.chat.postMessage","call:slackClient.chat.postEphemeral","call:slackClient.conversations.open","call:sendServer"],f={};a(f,{defaultBlocks:()=>_,deployNotification:()=>E,ephemeralMessage:()=>D,errorAlert:()=>x,purchaseAlert:()=>y,silentRule:()=>C,threadedCheckoutStep:()=>S,welcomeDM:()=>M});import{createEvent as v,getEvent as w}from"@walkeros/core";var y={title:"Purchase alert",description:"A completed order posts a templated message to a sales channel via the Slack Web API.",in:w("order complete",{timestamp:1700000100,data:{id:"ORD-500",value:299.99,currency:"EUR",product:"Pro Plan"},user:{id:"buyer-42"}}),mapping:{settings:{channel:"#sales",text:":moneybag: New order: ${data.id} - ${data.value} ${data.currency}"}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:":moneybag: New order: ORD-500 - 299.99 EUR",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},x={title:"Error alert",description:"An error event posts a critical alert to an engineering channel using a mapping-level channel override.",in:v({name:"error occur",timestamp:1700000200,data:{message:"Payment gateway timeout",code:"PGW_TIMEOUT",severity:"critical"}}),mapping:{settings:{channel:"#engineering-alerts",text:":rotating_light: Error: ${data.message}"}},out:[["slackClient.chat.postMessage",{channel:"#engineering-alerts",text:":rotating_light: Error: Payment gateway timeout",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},M={title:"Welcome DM",description:"A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",in:v({name:"user signup",timestamp:1700000300,data:{plan:"enterprise"},user:{id:"U-NEW-USER"}}),mapping:{settings:{dm:!0,user:"U-NEW-USER",text:":wave: Welcome aboard! You signed up for the ${data.plan} plan."}},out:[["slackClient.conversations.open",{users:"U-NEW-USER"}],["slackClient.chat.postMessage",{channel:"D-MOCK-DM",text:":wave: Welcome aboard! You signed up for the enterprise plan.",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},S={title:"Threaded reply",description:"A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.",in:v({name:"checkout step",timestamp:1700000400,data:{step:"payment",sessionTs:"1700000000.000050"}}),mapping:{settings:{channel:"#sales",text:"Checkout step: ${data.step}",threadTs:"1700000000.000050",replyBroadcast:!0}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:"Checkout step: payment",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,thread_ts:"1700000000.000050",reply_broadcast:!0}]]},D={title:"Ephemeral message",description:"A quota warning posts an ephemeral Slack message visible only to a target admin user.",in:v({name:"quota warning",timestamp:1700000500,data:{remaining:5}}),mapping:{settings:{channel:"#admin",ephemeral:!0,user:"U-ADMIN-1",text:"Heads up: ${data.remaining} requests remaining"}},out:[["slackClient.chat.postEphemeral",{channel:"#admin",text:"Heads up: 5 requests remaining",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,user:"U-ADMIN-1"}]]},_={title:"Default blocks",description:"With no custom text the destination auto-generates a Block Kit message from event data and source.",in:v({name:"lead submit",timestamp:1700000600,data:{name:"Acme",email:"sales@acme.test"},source:{type:"crm",platform:"server"}}),mapping:{settings:{channel:"#growth"}},out:[["slackClient.chat.postMessage",{channel:"#growth",text:"lead submit",blocks:[{type:"header",text:{type:"plain_text",text:"lead submit"}},{type:"section",fields:[{type:"mrkdwn",text:"*name:*\nAcme"},{type:"mrkdwn",text:"*email:*\nsales@acme.test"}]},{type:"context",elements:[{type:"mrkdwn",text:"Source: crm"}]}],unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},E={title:"Webhook deploy",description:"Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",in:v({name:"deploy complete",timestamp:1700000700,data:{version:"1.4.2",environment:"prod"}}),settings:{token:void 0,webhookUrl:"https://hooks.slack.com/services/T00/B00/xxx"},mapping:{settings:{text:":rocket: Deployment complete: ${data.version} to ${data.environment}"}},out:[["sendServer","https://hooks.slack.com/services/T00/B00/xxx",JSON.stringify({text:":rocket: Deployment complete: 1.4.2 to prod",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0})]]},C={public:!1,description:"A rule with silent: true posts no message to Slack.",in:w("page view",{timestamp:170000099e4}),mapping:{silent:!0},out:[]};export{d as examples,n as schemas};//# sourceMappingURL=dev.mjs.map
1
+ import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,a=(e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})},n={};a(n,{MappingSchema:()=>l,SettingsSchema:()=>s,mapping:()=>c,settings:()=>d});import{zodToSchema as r}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var s=o.object({token:o.string().startsWith("xoxb-").describe("Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.").optional(),webhookUrl:o.string().url().describe("Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.").optional(),channel:o.string().describe('Default Slack channel ID or name (e.g. "#alerts" or "C024BE91L"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.').optional(),text:o.string().describe("Default text template. Supports `${data.field}` interpolation against the walkerOS event.").optional(),blocks:o.array(o.record(o.string(),o.unknown())).describe("Default Block Kit blocks applied when no mapping override is set.").optional(),includeHeader:o.boolean().describe("Auto-add an event-name header block when generating default blocks. Default: true.").optional(),unfurlLinks:o.boolean().describe("Enable link unfurling. Default: false (cleaner for automated alerts).").optional(),unfurlMedia:o.boolean().describe("Enable media unfurling. Default: false.").optional(),mrkdwn:o.boolean().describe("Use mrkdwn formatting in text. Default: true.").optional(),threadTs:o.string().describe("Static thread_ts for replies (rarely set at destination level).").optional(),retryConfig:o.enum(["default","fiveRetriesInFiveMinutes","none"]).describe('Web API retry policy. "default" is the SDK policy (up to 10 retries over about 30 minutes), "fiveRetriesInFiveMinutes" 5 retries, "none" no retry. Retries continue after the destination timeout has failed the push. Default: "default".').optional()}).strict().refine(e=>Boolean(e.token)!==Boolean(e.webhookUrl),{message:"Provide exactly one of `token` or `webhookUrl`."}).meta({oneOf:[{required:["token"]},{required:["webhookUrl"]}]});import{z as i}from"@walkeros/core/dev";var l=i.object({channel:i.string().describe("Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.").optional(),text:i.string().describe("Override the text template for this rule. Supports `${data.field}` interpolation.").optional(),blocks:i.array(i.record(i.string(),i.unknown())).describe("Override Block Kit blocks for this rule.").optional(),threadTs:i.string().describe("thread_ts of the parent message, to post as a reply in its thread. A fixed value, sent as written (not read from the event).").optional(),replyBroadcast:i.boolean().describe("Also broadcast the threaded reply back to the channel.").optional(),ephemeral:i.boolean().describe("Send via chat.postEphemeral. Requires `user`.").optional(),user:i.string().describe("Slack user ID for ephemeral or DM delivery. A fixed value, sent as written (not read from the event).").optional(),dm:i.boolean().describe("Send as DM via conversations.open + chat.postMessage. Requires `user`.").optional()}),d=r(s),c=r(l),p={};a(p,{env:()=>m,minimal:()=>A,step:()=>f});var m={};a(m,{push:()=>k,simulation:()=>b});var u={ok:!0,channel:"CMOCK",ts:"1700000000.000100"},h={ok:!0},g={ok:!0,channel:{id:"D-MOCK-DM"}};var k={slackClient:{chat:{postMessage:()=>Promise.resolve(u),postEphemeral:()=>Promise.resolve(h)},conversations:{open:()=>Promise.resolve(g)}},sendServer:()=>Promise.resolve({})},b=["call:slackClient.chat.postMessage","call:slackClient.chat.postEphemeral","call:slackClient.conversations.open","call:sendServer"],f={};a(f,{defaultBlocks:()=>E,deployNotification:()=>U,ephemeralMessage:()=>D,errorAlert:()=>x,purchaseAlert:()=>y,silentRule:()=>_,threadedCheckoutStep:()=>S,welcomeDM:()=>M});import{createEvent as v,getEvent as w}from"@walkeros/core";var y={title:"Purchase alert",description:"A completed order posts a templated message to a sales channel via the Slack Web API.",in:w("order complete",{timestamp:17000001e5,data:{id:"ORD-500",value:299.99,currency:"EUR",product:"Pro Plan"},user:{id:"buyer-42"}}),mapping:{settings:{channel:"#sales",text:":moneybag: New order: ${data.id} - ${data.value} ${data.currency}"}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:":moneybag: New order: ORD-500 - 299.99 EUR",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},x={title:"Error alert",description:"An error event posts a critical alert to an engineering channel using a mapping-level channel override.",in:v({name:"error occur",timestamp:17000002e5,data:{message:"Payment gateway timeout",code:"PGW_TIMEOUT",severity:"critical"}}),mapping:{settings:{channel:"#engineering-alerts",text:":rotating_light: Error: ${data.message}"}},out:[["slackClient.chat.postMessage",{channel:"#engineering-alerts",text:":rotating_light: Error: Payment gateway timeout",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},M={title:"Welcome DM",description:"A user signup opens a DM with the fixed Slack user U-NEW-USER set in the rule (user is not read from the event) and posts a welcome message with the selected plan.",in:v({name:"user signup",timestamp:17000003e5,data:{plan:"enterprise"},user:{id:"U-NEW-USER"}}),mapping:{settings:{dm:!0,user:"U-NEW-USER",text:":wave: Welcome aboard! You signed up for the ${data.plan} plan."}},out:[["slackClient.conversations.open",{users:"U-NEW-USER"}],["slackClient.chat.postMessage",{channel:"D-MOCK-DM",text:":wave: Welcome aboard! You signed up for the enterprise plan.",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},S={title:"Threaded reply",description:"A checkout step posts as a threaded reply under the fixed thread_ts set in the rule, broadcast to the channel.",in:v({name:"checkout step",timestamp:17000004e5,data:{step:2,sessionTs:"1700000000.000050"}}),mapping:{settings:{channel:"#sales",text:"Checkout step: ${data.step}",threadTs:"1700000000.000050",replyBroadcast:!0}},out:[["slackClient.chat.postMessage",{channel:"#sales",text:"Checkout step: 2",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,thread_ts:"1700000000.000050",reply_broadcast:!0}]]},D={title:"Ephemeral message",description:"A quota warning posts an ephemeral Slack message visible only to a target admin user.",in:v({name:"quota warning",timestamp:17000005e5,data:{remaining:5}}),mapping:{settings:{channel:"#admin",ephemeral:!0,user:"U-ADMIN-1",text:"Heads up: ${data.remaining} requests remaining"}},out:[["slackClient.chat.postEphemeral",{channel:"#admin",text:"Heads up: 5 requests remaining",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0,user:"U-ADMIN-1"}]]},E={title:"Default blocks",description:"With no custom text the destination auto-generates a Block Kit message from event data and source.",in:v({name:"lead submit",timestamp:17000006e5,data:{name:"Acme",email:"sales@acme.test"},source:{type:"crm",platform:"server"}}),mapping:{settings:{channel:"#growth"}},out:[["slackClient.chat.postMessage",{channel:"#growth",text:"lead submit",blocks:[{type:"header",text:{type:"plain_text",text:"lead submit"}},{type:"section",fields:[{type:"mrkdwn",text:"*name:*\nAcme"},{type:"mrkdwn",text:"*email:*\nsales@acme.test"}]},{type:"context",elements:[{type:"mrkdwn",text:"Source: crm"}]}],unfurl_links:!1,unfurl_media:!1,mrkdwn:!0}]]},U={title:"Webhook deploy",description:"With settings.webhookUrl instead of a token, the destination posts the rendered message body to that incoming webhook.",in:v({name:"deploy complete",timestamp:17000007e5,data:{version:"1.4.2",environment:"prod"}}),settings:{token:void 0,webhookUrl:"https://hooks.slack.com/services/T00/B00/xxx"},mapping:{settings:{text:":rocket: Deployment complete: ${data.version} to ${data.environment}"}},out:[["sendServer","https://hooks.slack.com/services/T00/B00/xxx",JSON.stringify({text:":rocket: Deployment complete: 1.4.2 to prod",unfurl_links:!1,unfurl_media:!1,mrkdwn:!0})]]},_={public:!1,description:"A rule with silent: true posts no message to Slack.",in:w("page view",{timestamp:170000099e4}),mapping:{silent:!0},out:[]},A={settings:{webhookUrl:"https://hooks.slack.com/services/x/y/z"},secrets:{webhookUrl:"SLACK_WEBHOOK_URL"}};export{p as examples,n 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\n .object({\n token: z\n .string()\n .startsWith('xoxb-')\n .describe(\n 'Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.',\n )\n .optional(),\n webhookUrl: z\n .string()\n .url()\n .describe(\n 'Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.',\n )\n .optional(),\n channel: z\n .string()\n .describe(\n 'Default Slack channel ID or name (e.g. \"#alerts\" or \"C024BE91L\"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Default text template. Supports `${data.field}` interpolation against the walkerOS event.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe(\n 'Default Block Kit blocks applied when no mapping override is set.',\n )\n .optional(),\n includeHeader: z\n .boolean()\n .describe(\n 'Auto-add an event-name header block when generating default blocks. Default: true.',\n )\n .optional(),\n unfurlLinks: z\n .boolean()\n .describe(\n 'Enable link unfurling. Default: false (cleaner for automated alerts).',\n )\n .optional(),\n unfurlMedia: z\n .boolean()\n .describe('Enable media unfurling. Default: false.')\n .optional(),\n mrkdwn: z\n .boolean()\n .describe('Use mrkdwn formatting in text. Default: true.')\n .optional(),\n threadTs: z\n .string()\n .describe(\n 'Static thread_ts for replies (rarely set at destination level).',\n )\n .optional(),\n retryConfig: z\n .enum(['default', 'fiveRetriesInFiveMinutes', 'none'])\n .describe('Retry policy passed to WebClient. Default: \"default\".')\n .optional(),\n })\n .strict()\n .refine((v) => Boolean(v.token) !== Boolean(v.webhookUrl), {\n message: 'Provide exactly one of `token` or `webhookUrl`.',\n })\n // The same rule in JSON Schema: each alternative requires one credential.\n .meta({ oneOf: [{ required: ['token'] }, { required: ['webhookUrl'] }] });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n channel: z\n .string()\n .describe(\n 'Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Override the text template for this rule. Supports `${data.field}` interpolation.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe('Override Block Kit blocks for this rule.')\n .optional(),\n threadTs: z\n .string()\n .describe('thread_ts for posting as a reply in a thread.')\n .optional(),\n replyBroadcast: z\n .boolean()\n .describe('Also broadcast the threaded reply back to the channel.')\n .optional(),\n ephemeral: z\n .boolean()\n .describe('Send via chat.postEphemeral. Requires `user`.')\n .optional(),\n user: z\n .string()\n .describe('Slack user ID for ephemeral or DM delivery.')\n .optional(),\n dm: z\n .boolean()\n .describe(\n 'Send as DM via conversations.open + chat.postMessage. Requires `user`.',\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, SlackClientMock } from '../types';\n\nconst okMessageResponse = {\n ok: true as const,\n channel: 'CMOCK',\n ts: '1700000000.000100',\n};\n\nconst okEphemeralResponse = { ok: true as const };\n\nconst okOpenResponse = {\n ok: true as const,\n channel: { id: 'D-MOCK-DM' },\n};\n\nfunction createMockClient(): SlackClientMock {\n return {\n chat: {\n postMessage: () => Promise.resolve(okMessageResponse as never),\n postEphemeral: () => Promise.resolve(okEphemeralResponse as never),\n },\n conversations: {\n open: () => Promise.resolve(okOpenResponse as never),\n },\n };\n}\n\nexport const push: Env = {\n slackClient: createMockClient(),\n sendServer: () => Promise.resolve({}),\n};\n\nexport const simulation = [\n 'call:slackClient.chat.postMessage',\n 'call:slackClient.chat.postEphemeral',\n 'call:slackClient.conversations.open',\n 'call:sendServer',\n];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type SlackStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Slack server destination operates in two modes:\n *\n * 1. Web API mode - calls the injected `env.slackClient` SDK methods\n * (`chat.postMessage`, `chat.postEphemeral`, `conversations.open`).\n * Captured as `[callable, args]` with dotted callable names such as\n * `'slackClient.chat.postMessage'`.\n *\n * 2. Webhook mode - calls `env.sendServer(url, JSON.stringify(body))`.\n * Captured as `['sendServer', url, bodyAsString]` where `bodyAsString`\n * is the already-stringified JSON body. Key insertion order in the\n * source object matters for string equality.\n *\n * A single push may emit multiple calls (e.g. a DM opens a conversation\n * then posts to the returned channel id), so every `out` is wrapped as\n * `[[callable, ...args], ...]`.\n */\n\n/**\n * Purchase notification -- Web API mode, channel from mapping override,\n * text template interpolated against event.data.\n */\nexport const purchaseAlert: SlackStepExample = {\n title: 'Purchase alert',\n description:\n 'A completed order posts a templated message to a sales channel via the Slack Web API.',\n in: getEvent('order complete', {\n timestamp: 1700000100,\n data: {\n id: 'ORD-500',\n value: 299.99,\n currency: 'EUR',\n product: 'Pro Plan',\n },\n user: { id: 'buyer-42' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: ':moneybag: New order: ${data.id} - ${data.value} ${data.currency}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: ':moneybag: New order: ORD-500 - 299.99 EUR',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Error alert -- routes to a different channel via mapping override.\n */\nexport const errorAlert: SlackStepExample = {\n title: 'Error alert',\n description:\n 'An error event posts a critical alert to an engineering channel using a mapping-level channel override.',\n in: createEvent({\n name: 'error occur',\n timestamp: 1700000200,\n data: {\n message: 'Payment gateway timeout',\n code: 'PGW_TIMEOUT',\n severity: 'critical',\n },\n }),\n mapping: {\n settings: {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: ${data.message}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: Payment gateway timeout',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Welcome DM -- conversations.open(users) -> chat.postMessage(channel: D-id).\n */\nexport const welcomeDM: SlackStepExample = {\n title: 'Welcome DM',\n description:\n 'A user signup opens a Slack DM channel and posts a welcome message with the selected plan.',\n in: createEvent({\n name: 'user signup',\n timestamp: 1700000300,\n data: { plan: 'enterprise' },\n user: { id: 'U-NEW-USER' },\n }),\n mapping: {\n settings: {\n dm: true,\n user: 'U-NEW-USER',\n text: ':wave: Welcome aboard! You signed up for the ${data.plan} plan.',\n },\n },\n out: [\n ['slackClient.conversations.open', { users: 'U-NEW-USER' }],\n [\n 'slackClient.chat.postMessage',\n {\n channel: 'D-MOCK-DM',\n text: ':wave: Welcome aboard! You signed up for the enterprise plan.',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Threaded checkout step -- thread_ts override puts the reply into a thread.\n */\nexport const threadedCheckoutStep: SlackStepExample = {\n title: 'Threaded reply',\n description:\n 'A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.',\n in: createEvent({\n name: 'checkout step',\n timestamp: 1700000400,\n data: { step: 'payment', sessionTs: '1700000000.000050' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: 'Checkout step: ${data.step}',\n threadTs: '1700000000.000050',\n replyBroadcast: true,\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: 'Checkout step: payment',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n thread_ts: '1700000000.000050',\n reply_broadcast: true,\n },\n ],\n ],\n};\n\n/**\n * Ephemeral message -- visible to one user in the target channel.\n */\nexport const ephemeralMessage: SlackStepExample = {\n title: 'Ephemeral message',\n description:\n 'A quota warning posts an ephemeral Slack message visible only to a target admin user.',\n in: createEvent({\n name: 'quota warning',\n timestamp: 1700000500,\n data: { remaining: 5 },\n }),\n mapping: {\n settings: {\n channel: '#admin',\n ephemeral: true,\n user: 'U-ADMIN-1',\n text: 'Heads up: ${data.remaining} requests remaining',\n },\n },\n out: [\n [\n 'slackClient.chat.postEphemeral',\n {\n channel: '#admin',\n text: 'Heads up: 5 requests remaining',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n user: 'U-ADMIN-1',\n },\n ],\n ],\n};\n\n/**\n * Default blocks -- no custom text/blocks, destination auto-generates a\n * Block Kit message from the event data.\n */\nexport const defaultBlocks: SlackStepExample = {\n title: 'Default blocks',\n description:\n 'With no custom text the destination auto-generates a Block Kit message from event data and source.',\n in: createEvent({\n name: 'lead submit',\n timestamp: 1700000600,\n data: { name: 'Acme', email: 'sales@acme.test' },\n source: { type: 'crm', platform: 'server' },\n }),\n mapping: {\n settings: {\n channel: '#growth',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#growth',\n text: 'lead submit',\n blocks: [\n {\n type: 'header',\n text: { type: 'plain_text', text: 'lead submit' },\n },\n {\n type: 'section',\n fields: [\n { type: 'mrkdwn', text: '*name:*\\nAcme' },\n { type: 'mrkdwn', text: '*email:*\\nsales@acme.test' },\n ],\n },\n {\n type: 'context',\n elements: [{ type: 'mrkdwn', text: 'Source: crm' }],\n },\n ],\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Webhook mode -- no token, just webhookUrl. The destination calls\n * `env.sendServer(url, JSON.stringify(body))`. Channel is baked into the\n * URL by Slack.\n */\nexport const deployNotification: SlackStepExample = {\n title: 'Webhook deploy',\n description:\n 'Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.',\n in: createEvent({\n name: 'deploy complete',\n timestamp: 1700000700,\n data: { version: '1.4.2', environment: 'prod' },\n }),\n settings: {\n token: undefined,\n webhookUrl: 'https://hooks.slack.com/services/T00/B00/xxx',\n },\n mapping: {\n settings: {\n text: ':rocket: Deployment complete: ${data.version} to ${data.environment}',\n },\n },\n out: [\n [\n 'sendServer',\n 'https://hooks.slack.com/services/T00/B00/xxx',\n JSON.stringify({\n text: ':rocket: Deployment complete: 1.4.2 to prod',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n }),\n ],\n ],\n};\n\n/** A silent rule posts nothing to Slack. */\nexport const silentRule: SlackStepExample = {\n public: false,\n description: 'A rule with silent: true posts no message to Slack.',\n in: getEvent('page view', { timestamp: 1700000990000 }),\n mapping: { silent: true },\n out: [],\n};\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,OAAO,EACJ,OAAO,EACP,WAAW,OAAO,EAClB;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,EACT,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MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,MAAM;AAAA,QACN,cAAc;AAAA,QACd,cAAc;AAAA,QACd,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,SAAS,aAAa,EAAE,WAAW,YAAc,CAAC;AAAA,EACtD,SAAS,EAAE,QAAQ,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","../src/examples/minimal.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\n .object({\n token: z\n .string()\n .startsWith('xoxb-')\n .describe(\n 'Slack Bot token (xoxb-...). Enables Web API mode. Mutually exclusive with webhookUrl.',\n )\n .optional(),\n webhookUrl: z\n .string()\n .url()\n .describe(\n 'Incoming Webhook URL. Enables webhook mode. Mutually exclusive with token.',\n )\n .optional(),\n channel: z\n .string()\n .describe(\n 'Default Slack channel ID or name (e.g. \"#alerts\" or \"C024BE91L\"). Required for Web API mode unless every rule supplies one. Ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Default text template. Supports `${data.field}` interpolation against the walkerOS event.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe(\n 'Default Block Kit blocks applied when no mapping override is set.',\n )\n .optional(),\n includeHeader: z\n .boolean()\n .describe(\n 'Auto-add an event-name header block when generating default blocks. Default: true.',\n )\n .optional(),\n unfurlLinks: z\n .boolean()\n .describe(\n 'Enable link unfurling. Default: false (cleaner for automated alerts).',\n )\n .optional(),\n unfurlMedia: z\n .boolean()\n .describe('Enable media unfurling. Default: false.')\n .optional(),\n mrkdwn: z\n .boolean()\n .describe('Use mrkdwn formatting in text. Default: true.')\n .optional(),\n threadTs: z\n .string()\n .describe(\n 'Static thread_ts for replies (rarely set at destination level).',\n )\n .optional(),\n retryConfig: z\n .enum(['default', 'fiveRetriesInFiveMinutes', 'none'])\n .describe(\n 'Web API retry policy. \"default\" is the SDK policy (up to 10 retries over about 30 minutes), \"fiveRetriesInFiveMinutes\" 5 retries, \"none\" no retry. Retries continue after the destination timeout has failed the push. Default: \"default\".',\n )\n .optional(),\n })\n .strict()\n .refine((v) => Boolean(v.token) !== Boolean(v.webhookUrl), {\n message: 'Provide exactly one of `token` or `webhookUrl`.',\n })\n // The same rule in JSON Schema: each alternative requires one credential.\n .meta({ oneOf: [{ required: ['token'] }, { required: ['webhookUrl'] }] });\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n channel: z\n .string()\n .describe(\n 'Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.',\n )\n .optional(),\n text: z\n .string()\n .describe(\n 'Override the text template for this rule. Supports `${data.field}` interpolation.',\n )\n .optional(),\n blocks: z\n .array(z.record(z.string(), z.unknown()))\n .describe('Override Block Kit blocks for this rule.')\n .optional(),\n threadTs: z\n .string()\n .describe(\n 'thread_ts of the parent message, to post as a reply in its thread. A fixed value, sent as written (not read from the event).',\n )\n .optional(),\n replyBroadcast: z\n .boolean()\n .describe('Also broadcast the threaded reply back to the channel.')\n .optional(),\n ephemeral: z\n .boolean()\n .describe('Send via chat.postEphemeral. Requires `user`.')\n .optional(),\n user: z\n .string()\n .describe(\n 'Slack user ID for ephemeral or DM delivery. A fixed value, sent as written (not read from the event).',\n )\n .optional(),\n dm: z\n .boolean()\n .describe(\n 'Send as DM via conversations.open + chat.postMessage. Requires `user`.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env, SlackClientMock } from '../types';\n\nconst okMessageResponse = {\n ok: true as const,\n channel: 'CMOCK',\n ts: '1700000000.000100',\n};\n\nconst okEphemeralResponse = { ok: true as const };\n\nconst okOpenResponse = {\n ok: true as const,\n channel: { id: 'D-MOCK-DM' },\n};\n\nfunction createMockClient(): SlackClientMock {\n return {\n chat: {\n postMessage: () => Promise.resolve(okMessageResponse as never),\n postEphemeral: () => Promise.resolve(okEphemeralResponse as never),\n },\n conversations: {\n open: () => Promise.resolve(okOpenResponse as never),\n },\n };\n}\n\nexport const push: Env = {\n slackClient: createMockClient(),\n sendServer: () => Promise.resolve({}),\n};\n\nexport const simulation = [\n 'call:slackClient.chat.postMessage',\n 'call:slackClient.chat.postEphemeral',\n 'call:slackClient.conversations.open',\n 'call:sendServer',\n];\n","import type { Flow } from '@walkeros/core';\nimport { createEvent, getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Extended step example that may carry destination-level settings overrides.\n */\nexport type SlackStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n};\n\n/**\n * Slack server destination operates in two modes:\n *\n * 1. Web API mode - calls the injected `env.slackClient` SDK methods\n * (`chat.postMessage`, `chat.postEphemeral`, `conversations.open`).\n * Captured as `[callable, args]` with dotted callable names such as\n * `'slackClient.chat.postMessage'`.\n *\n * 2. Webhook mode - calls `env.sendServer(url, JSON.stringify(body))`.\n * Captured as `['sendServer', url, bodyAsString]` where `bodyAsString`\n * is the already-stringified JSON body. Key insertion order in the\n * source object matters for string equality.\n *\n * A single push may emit multiple calls (e.g. a DM opens a conversation\n * then posts to the returned channel id), so every `out` is wrapped as\n * `[[callable, ...args], ...]`.\n */\n\n/**\n * Purchase notification -- Web API mode, channel from mapping override,\n * text template interpolated against event.data.\n */\nexport const purchaseAlert: SlackStepExample = {\n title: 'Purchase alert',\n description:\n 'A completed order posts a templated message to a sales channel via the Slack Web API.',\n in: getEvent('order complete', {\n timestamp: 1700000100000,\n data: {\n id: 'ORD-500',\n value: 299.99,\n currency: 'EUR',\n product: 'Pro Plan',\n },\n user: { id: 'buyer-42' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: ':moneybag: New order: ${data.id} - ${data.value} ${data.currency}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: ':moneybag: New order: ORD-500 - 299.99 EUR',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Error alert -- routes to a different channel via mapping override.\n */\nexport const errorAlert: SlackStepExample = {\n title: 'Error alert',\n description:\n 'An error event posts a critical alert to an engineering channel using a mapping-level channel override.',\n in: createEvent({\n name: 'error occur',\n timestamp: 1700000200000,\n data: {\n message: 'Payment gateway timeout',\n code: 'PGW_TIMEOUT',\n severity: 'critical',\n },\n }),\n mapping: {\n settings: {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: ${data.message}',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#engineering-alerts',\n text: ':rotating_light: Error: Payment gateway timeout',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Welcome DM -- conversations.open(users) -> chat.postMessage(channel: D-id).\n */\nexport const welcomeDM: SlackStepExample = {\n title: 'Welcome DM',\n description:\n 'A user signup opens a DM with the fixed Slack user U-NEW-USER set in the rule (user is not read from the event) and posts a welcome message with the selected plan.',\n in: createEvent({\n name: 'user signup',\n timestamp: 1700000300000,\n data: { plan: 'enterprise' },\n user: { id: 'U-NEW-USER' },\n }),\n mapping: {\n settings: {\n dm: true,\n user: 'U-NEW-USER',\n text: ':wave: Welcome aboard! You signed up for the ${data.plan} plan.',\n },\n },\n out: [\n ['slackClient.conversations.open', { users: 'U-NEW-USER' }],\n [\n 'slackClient.chat.postMessage',\n {\n channel: 'D-MOCK-DM',\n text: ':wave: Welcome aboard! You signed up for the enterprise plan.',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Threaded checkout step -- thread_ts override puts the reply into a thread.\n */\nexport const threadedCheckoutStep: SlackStepExample = {\n title: 'Threaded reply',\n description:\n 'A checkout step posts as a threaded reply under the fixed thread_ts set in the rule, broadcast to the channel.',\n in: createEvent({\n name: 'checkout step',\n timestamp: 1700000400000,\n data: { step: 2, sessionTs: '1700000000.000050' },\n }),\n mapping: {\n settings: {\n channel: '#sales',\n text: 'Checkout step: ${data.step}',\n threadTs: '1700000000.000050',\n replyBroadcast: true,\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#sales',\n text: 'Checkout step: 2',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n thread_ts: '1700000000.000050',\n reply_broadcast: true,\n },\n ],\n ],\n};\n\n/**\n * Ephemeral message -- visible to one user in the target channel.\n */\nexport const ephemeralMessage: SlackStepExample = {\n title: 'Ephemeral message',\n description:\n 'A quota warning posts an ephemeral Slack message visible only to a target admin user.',\n in: createEvent({\n name: 'quota warning',\n timestamp: 1700000500000,\n data: { remaining: 5 },\n }),\n mapping: {\n settings: {\n channel: '#admin',\n ephemeral: true,\n user: 'U-ADMIN-1',\n text: 'Heads up: ${data.remaining} requests remaining',\n },\n },\n out: [\n [\n 'slackClient.chat.postEphemeral',\n {\n channel: '#admin',\n text: 'Heads up: 5 requests remaining',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n user: 'U-ADMIN-1',\n },\n ],\n ],\n};\n\n/**\n * Default blocks -- no custom text/blocks, destination auto-generates a\n * Block Kit message from the event data.\n */\nexport const defaultBlocks: SlackStepExample = {\n title: 'Default blocks',\n description:\n 'With no custom text the destination auto-generates a Block Kit message from event data and source.',\n in: createEvent({\n name: 'lead submit',\n timestamp: 1700000600000,\n data: { name: 'Acme', email: 'sales@acme.test' },\n source: { type: 'crm', platform: 'server' },\n }),\n mapping: {\n settings: {\n channel: '#growth',\n },\n },\n out: [\n [\n 'slackClient.chat.postMessage',\n {\n channel: '#growth',\n text: 'lead submit',\n blocks: [\n {\n type: 'header',\n text: { type: 'plain_text', text: 'lead submit' },\n },\n {\n type: 'section',\n fields: [\n { type: 'mrkdwn', text: '*name:*\\nAcme' },\n { type: 'mrkdwn', text: '*email:*\\nsales@acme.test' },\n ],\n },\n {\n type: 'context',\n elements: [{ type: 'mrkdwn', text: 'Source: crm' }],\n },\n ],\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n },\n ],\n ],\n};\n\n/**\n * Webhook mode -- no token, just webhookUrl. The destination calls\n * `env.sendServer(url, JSON.stringify(body))`. Channel is baked into the\n * URL by Slack.\n */\nexport const deployNotification: SlackStepExample = {\n title: 'Webhook deploy',\n description:\n 'With settings.webhookUrl instead of a token, the destination posts the rendered message body to that incoming webhook.',\n in: createEvent({\n name: 'deploy complete',\n timestamp: 1700000700000,\n data: { version: '1.4.2', environment: 'prod' },\n }),\n settings: {\n token: undefined,\n webhookUrl: 'https://hooks.slack.com/services/T00/B00/xxx',\n },\n mapping: {\n settings: {\n text: ':rocket: Deployment complete: ${data.version} to ${data.environment}',\n },\n },\n out: [\n [\n 'sendServer',\n 'https://hooks.slack.com/services/T00/B00/xxx',\n JSON.stringify({\n text: ':rocket: Deployment complete: 1.4.2 to prod',\n unfurl_links: false,\n unfurl_media: false,\n mrkdwn: true,\n }),\n ],\n ],\n};\n\n/** A silent rule posts nothing to Slack. */\nexport const silentRule: SlackStepExample = {\n public: false,\n description: 'A rule with silent: true posts no message to Slack.',\n in: getEvent('page view', { timestamp: 1700000990000 }),\n mapping: { silent: true },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting Slack needs to deliver: the incoming webhook URL, read from\n * the environment.\n */\nexport const minimal: Flow.MinimalExample = {\n sett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F;AACF;AAOO,IAAM,qBAAuC;AAAA,EAClD,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,YAAY;AAAA,IACd,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM,EAAE,SAAS,SAAS,aAAa,OAAO;AAAA,EAChD,CAAC;AAAA,EACD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA,KAAK,UAAU;AAAA,QACb,MAAM;AAAA,QACN,cAAc;AAAA,QACd,cAAc;AAAA,QACd,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,SAAS,aAAa,EAAE,WAAW,YAAc,CAAC;AAAA,EACtD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;;;ACzSO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,YAAY,yCAAyC;AAAA,EACjE,SAAS,EAAE,YAAY,oBAAoB;AAC7C;","names":["z"]}
@@ -131,4 +131,10 @@ declare namespace step {
131
131
  export { type step_SlackStepExample as SlackStepExample, step_defaultBlocks as defaultBlocks, step_deployNotification as deployNotification, step_ephemeralMessage as ephemeralMessage, step_errorAlert as errorAlert, step_purchaseAlert as purchaseAlert, step_silentRule as silentRule, step_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
132
132
  }
133
133
 
134
- export { env, step };
134
+ /**
135
+ * The setting Slack needs to deliver: the incoming webhook URL, read from
136
+ * the environment.
137
+ */
138
+ declare const minimal: Flow.MinimalExample;
139
+
140
+ export { env, minimal, step };
@@ -131,4 +131,10 @@ declare namespace step {
131
131
  export { type step_SlackStepExample as SlackStepExample, step_defaultBlocks as defaultBlocks, step_deployNotification as deployNotification, step_ephemeralMessage as ephemeralMessage, step_errorAlert as errorAlert, step_purchaseAlert as purchaseAlert, step_silentRule as silentRule, step_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
132
132
  }
133
133
 
134
- export { env, step };
134
+ /**
135
+ * The setting Slack needs to deliver: the incoming webhook URL, read from
136
+ * the environment.
137
+ */
138
+ declare const minimal: Flow.MinimalExample;
139
+
140
+ export { env, minimal, step };
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
23
  env: () => env_exports,
24
+ minimal: () => minimal,
24
25
  step: () => step_exports
25
26
  });
26
27
  module.exports = __toCommonJS(examples_exports);
@@ -80,7 +81,7 @@ var purchaseAlert = {
80
81
  title: "Purchase alert",
81
82
  description: "A completed order posts a templated message to a sales channel via the Slack Web API.",
82
83
  in: (0, import_core.getEvent)("order complete", {
83
- timestamp: 1700000100,
84
+ timestamp: 17000001e5,
84
85
  data: {
85
86
  id: "ORD-500",
86
87
  value: 299.99,
@@ -113,7 +114,7 @@ var errorAlert = {
113
114
  description: "An error event posts a critical alert to an engineering channel using a mapping-level channel override.",
114
115
  in: (0, import_core.createEvent)({
115
116
  name: "error occur",
116
- timestamp: 1700000200,
117
+ timestamp: 17000002e5,
117
118
  data: {
118
119
  message: "Payment gateway timeout",
119
120
  code: "PGW_TIMEOUT",
@@ -141,10 +142,10 @@ var errorAlert = {
141
142
  };
142
143
  var welcomeDM = {
143
144
  title: "Welcome DM",
144
- description: "A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",
145
+ description: "A user signup opens a DM with the fixed Slack user U-NEW-USER set in the rule (user is not read from the event) and posts a welcome message with the selected plan.",
145
146
  in: (0, import_core.createEvent)({
146
147
  name: "user signup",
147
- timestamp: 1700000300,
148
+ timestamp: 17000003e5,
148
149
  data: { plan: "enterprise" },
149
150
  user: { id: "U-NEW-USER" }
150
151
  }),
@@ -171,11 +172,11 @@ var welcomeDM = {
171
172
  };
172
173
  var threadedCheckoutStep = {
173
174
  title: "Threaded reply",
174
- description: "A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.",
175
+ description: "A checkout step posts as a threaded reply under the fixed thread_ts set in the rule, broadcast to the channel.",
175
176
  in: (0, import_core.createEvent)({
176
177
  name: "checkout step",
177
- timestamp: 1700000400,
178
- data: { step: "payment", sessionTs: "1700000000.000050" }
178
+ timestamp: 17000004e5,
179
+ data: { step: 2, sessionTs: "1700000000.000050" }
179
180
  }),
180
181
  mapping: {
181
182
  settings: {
@@ -190,7 +191,7 @@ var threadedCheckoutStep = {
190
191
  "slackClient.chat.postMessage",
191
192
  {
192
193
  channel: "#sales",
193
- text: "Checkout step: payment",
194
+ text: "Checkout step: 2",
194
195
  unfurl_links: false,
195
196
  unfurl_media: false,
196
197
  mrkdwn: true,
@@ -205,7 +206,7 @@ var ephemeralMessage = {
205
206
  description: "A quota warning posts an ephemeral Slack message visible only to a target admin user.",
206
207
  in: (0, import_core.createEvent)({
207
208
  name: "quota warning",
208
- timestamp: 1700000500,
209
+ timestamp: 17000005e5,
209
210
  data: { remaining: 5 }
210
211
  }),
211
212
  mapping: {
@@ -235,7 +236,7 @@ var defaultBlocks = {
235
236
  description: "With no custom text the destination auto-generates a Block Kit message from event data and source.",
236
237
  in: (0, import_core.createEvent)({
237
238
  name: "lead submit",
238
- timestamp: 1700000600,
239
+ timestamp: 17000006e5,
239
240
  data: { name: "Acme", email: "sales@acme.test" },
240
241
  source: { type: "crm", platform: "server" }
241
242
  }),
@@ -276,10 +277,10 @@ var defaultBlocks = {
276
277
  };
277
278
  var deployNotification = {
278
279
  title: "Webhook deploy",
279
- description: "Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",
280
+ description: "With settings.webhookUrl instead of a token, the destination posts the rendered message body to that incoming webhook.",
280
281
  in: (0, import_core.createEvent)({
281
282
  name: "deploy complete",
282
- timestamp: 1700000700,
283
+ timestamp: 17000007e5,
283
284
  data: { version: "1.4.2", environment: "prod" }
284
285
  }),
285
286
  settings: {
@@ -311,8 +312,15 @@ var silentRule = {
311
312
  mapping: { silent: true },
312
313
  out: []
313
314
  };
315
+
316
+ // src/examples/minimal.ts
317
+ var minimal = {
318
+ settings: { webhookUrl: "https://hooks.slack.com/services/x/y/z" },
319
+ secrets: { webhookUrl: "SLACK_WEBHOOK_URL" }
320
+ };
314
321
  // Annotate the CommonJS export names for ESM import in node:
315
322
  0 && (module.exports = {
316
323
  env,
324
+ minimal,
317
325
  step
318
326
  });
@@ -59,7 +59,7 @@ var purchaseAlert = {
59
59
  title: "Purchase alert",
60
60
  description: "A completed order posts a templated message to a sales channel via the Slack Web API.",
61
61
  in: getEvent("order complete", {
62
- timestamp: 1700000100,
62
+ timestamp: 17000001e5,
63
63
  data: {
64
64
  id: "ORD-500",
65
65
  value: 299.99,
@@ -92,7 +92,7 @@ var errorAlert = {
92
92
  description: "An error event posts a critical alert to an engineering channel using a mapping-level channel override.",
93
93
  in: createEvent({
94
94
  name: "error occur",
95
- timestamp: 1700000200,
95
+ timestamp: 17000002e5,
96
96
  data: {
97
97
  message: "Payment gateway timeout",
98
98
  code: "PGW_TIMEOUT",
@@ -120,10 +120,10 @@ var errorAlert = {
120
120
  };
121
121
  var welcomeDM = {
122
122
  title: "Welcome DM",
123
- description: "A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",
123
+ description: "A user signup opens a DM with the fixed Slack user U-NEW-USER set in the rule (user is not read from the event) and posts a welcome message with the selected plan.",
124
124
  in: createEvent({
125
125
  name: "user signup",
126
- timestamp: 1700000300,
126
+ timestamp: 17000003e5,
127
127
  data: { plan: "enterprise" },
128
128
  user: { id: "U-NEW-USER" }
129
129
  }),
@@ -150,11 +150,11 @@ var welcomeDM = {
150
150
  };
151
151
  var threadedCheckoutStep = {
152
152
  title: "Threaded reply",
153
- description: "A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.",
153
+ description: "A checkout step posts as a threaded reply under the fixed thread_ts set in the rule, broadcast to the channel.",
154
154
  in: createEvent({
155
155
  name: "checkout step",
156
- timestamp: 1700000400,
157
- data: { step: "payment", sessionTs: "1700000000.000050" }
156
+ timestamp: 17000004e5,
157
+ data: { step: 2, sessionTs: "1700000000.000050" }
158
158
  }),
159
159
  mapping: {
160
160
  settings: {
@@ -169,7 +169,7 @@ var threadedCheckoutStep = {
169
169
  "slackClient.chat.postMessage",
170
170
  {
171
171
  channel: "#sales",
172
- text: "Checkout step: payment",
172
+ text: "Checkout step: 2",
173
173
  unfurl_links: false,
174
174
  unfurl_media: false,
175
175
  mrkdwn: true,
@@ -184,7 +184,7 @@ var ephemeralMessage = {
184
184
  description: "A quota warning posts an ephemeral Slack message visible only to a target admin user.",
185
185
  in: createEvent({
186
186
  name: "quota warning",
187
- timestamp: 1700000500,
187
+ timestamp: 17000005e5,
188
188
  data: { remaining: 5 }
189
189
  }),
190
190
  mapping: {
@@ -214,7 +214,7 @@ var defaultBlocks = {
214
214
  description: "With no custom text the destination auto-generates a Block Kit message from event data and source.",
215
215
  in: createEvent({
216
216
  name: "lead submit",
217
- timestamp: 1700000600,
217
+ timestamp: 17000006e5,
218
218
  data: { name: "Acme", email: "sales@acme.test" },
219
219
  source: { type: "crm", platform: "server" }
220
220
  }),
@@ -255,10 +255,10 @@ var defaultBlocks = {
255
255
  };
256
256
  var deployNotification = {
257
257
  title: "Webhook deploy",
258
- description: "Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",
258
+ description: "With settings.webhookUrl instead of a token, the destination posts the rendered message body to that incoming webhook.",
259
259
  in: createEvent({
260
260
  name: "deploy complete",
261
- timestamp: 1700000700,
261
+ timestamp: 17000007e5,
262
262
  data: { version: "1.4.2", environment: "prod" }
263
263
  }),
264
264
  settings: {
@@ -290,7 +290,14 @@ var silentRule = {
290
290
  mapping: { silent: true },
291
291
  out: []
292
292
  };
293
+
294
+ // src/examples/minimal.ts
295
+ var minimal = {
296
+ settings: { webhookUrl: "https://hooks.slack.com/services/x/y/z" },
297
+ secrets: { webhookUrl: "SLACK_WEBHOOK_URL" }
298
+ };
293
299
  export {
294
300
  env_exports as env,
301
+ minimal,
295
302
  step_exports as step
296
303
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-destination-slack",
4
- "version": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "server"
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "threadTs": {
38
38
  "type": "string",
39
- "description": "thread_ts for posting as a reply in a thread."
39
+ "description": "thread_ts of the parent message, to post as a reply in its thread. A fixed value, sent as written (not read from the event)."
40
40
  },
41
41
  "replyBroadcast": {
42
42
  "type": "boolean",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "user": {
50
50
  "type": "string",
51
- "description": "Slack user ID for ephemeral or DM delivery."
51
+ "description": "Slack user ID for ephemeral or DM delivery. A fixed value, sent as written (not read from the event)."
52
52
  },
53
53
  "dm": {
54
54
  "type": "boolean",
@@ -117,7 +117,7 @@
117
117
  "fiveRetriesInFiveMinutes",
118
118
  "none"
119
119
  ],
120
- "description": "Retry policy passed to WebClient. Default: \"default\"."
120
+ "description": "Web API retry policy. \"default\" is the SDK policy (up to 10 retries over about 30 minutes), \"fiveRetriesInFiveMinutes\" 5 retries, \"none\" no retry. Retries continue after the destination timeout has failed the push. Default: \"default\"."
121
121
  }
122
122
  },
123
123
  "additionalProperties": false,
@@ -164,6 +164,14 @@
164
164
  "call:sendServer"
165
165
  ]
166
166
  },
167
+ "minimal": {
168
+ "settings": {
169
+ "webhookUrl": "https://hooks.slack.com/services/x/y/z"
170
+ },
171
+ "secrets": {
172
+ "webhookUrl": "SLACK_WEBHOOK_URL"
173
+ }
174
+ },
167
175
  "step": {
168
176
  "defaultBlocks": {
169
177
  "title": "Default blocks",
@@ -202,11 +210,11 @@
202
210
  "consent": {
203
211
  "functional": true
204
212
  },
205
- "id": "e74f550c197d997c",
213
+ "id": "078f46ae2e1c113e",
206
214
  "trigger": "test",
207
215
  "entity": "lead",
208
216
  "action": "submit",
209
- "timestamp": 1700000600,
217
+ "timestamp": 1700000600000,
210
218
  "timing": 3.14,
211
219
  "source": {
212
220
  "count": 1,
@@ -266,7 +274,7 @@
266
274
  },
267
275
  "deployNotification": {
268
276
  "title": "Webhook deploy",
269
- "description": "Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",
277
+ "description": "With settings.webhookUrl instead of a token, the destination posts the rendered message body to that incoming webhook.",
270
278
  "in": {
271
279
  "name": "deploy complete",
272
280
  "data": {
@@ -301,11 +309,11 @@
301
309
  "consent": {
302
310
  "functional": true
303
311
  },
304
- "id": "0218f7a59b2c24d4",
312
+ "id": "164bf834bc312a82",
305
313
  "trigger": "test",
306
314
  "entity": "deploy",
307
315
  "action": "complete",
308
- "timestamp": 1700000700,
316
+ "timestamp": 1700000700000,
309
317
  "timing": 3.14,
310
318
  "source": {
311
319
  "count": 1,
@@ -366,11 +374,11 @@
366
374
  "consent": {
367
375
  "functional": true
368
376
  },
369
- "id": "25983bb3fd060d40",
377
+ "id": "255795f47bf0755c",
370
378
  "trigger": "test",
371
379
  "entity": "quota",
372
380
  "action": "warning",
373
- "timestamp": 1700000500,
381
+ "timestamp": 1700000500000,
374
382
  "timing": 3.14,
375
383
  "source": {
376
384
  "count": 1,
@@ -439,11 +447,11 @@
439
447
  "consent": {
440
448
  "functional": true
441
449
  },
442
- "id": "caeb8fc45f763cda",
450
+ "id": "dc61f8ae2c750dcc",
443
451
  "trigger": "test",
444
452
  "entity": "error",
445
453
  "action": "occur",
446
- "timestamp": 1700000200,
454
+ "timestamp": 1700000200000,
447
455
  "timing": 3.14,
448
456
  "source": {
449
457
  "count": 1,
@@ -552,7 +560,7 @@
552
560
  "trigger": "load",
553
561
  "entity": "order",
554
562
  "action": "complete",
555
- "timestamp": 1700000100,
563
+ "timestamp": 1700000100000,
556
564
  "timing": 3.14,
557
565
  "source": {
558
566
  "count": 1,
@@ -641,11 +649,11 @@
641
649
  },
642
650
  "threadedCheckoutStep": {
643
651
  "title": "Threaded reply",
644
- "description": "A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.",
652
+ "description": "A checkout step posts as a threaded reply under the fixed thread_ts set in the rule, broadcast to the channel.",
645
653
  "in": {
646
654
  "name": "checkout step",
647
655
  "data": {
648
- "step": "payment",
656
+ "step": 2,
649
657
  "sessionTs": "1700000000.000050"
650
658
  },
651
659
  "context": {
@@ -676,11 +684,11 @@
676
684
  "consent": {
677
685
  "functional": true
678
686
  },
679
- "id": "142ae04a44a433df",
687
+ "id": "ef46708988472011",
680
688
  "trigger": "test",
681
689
  "entity": "checkout",
682
690
  "action": "step",
683
- "timestamp": 1700000400,
691
+ "timestamp": 1700000400000,
684
692
  "timing": 3.14,
685
693
  "source": {
686
694
  "count": 1,
@@ -702,7 +710,7 @@
702
710
  "slackClient.chat.postMessage",
703
711
  {
704
712
  "channel": "#sales",
705
- "text": "Checkout step: payment",
713
+ "text": "Checkout step: 2",
706
714
  "unfurl_links": false,
707
715
  "unfurl_media": false,
708
716
  "mrkdwn": true,
@@ -714,7 +722,7 @@
714
722
  },
715
723
  "welcomeDM": {
716
724
  "title": "Welcome DM",
717
- "description": "A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",
725
+ "description": "A user signup opens a DM with the fixed Slack user U-NEW-USER set in the rule (user is not read from the event) and posts a welcome message with the selected plan.",
718
726
  "in": {
719
727
  "name": "user signup",
720
728
  "data": {
@@ -746,11 +754,11 @@
746
754
  "consent": {
747
755
  "functional": true
748
756
  },
749
- "id": "6864535cad7521a7",
757
+ "id": "a0a54009934a7339",
750
758
  "trigger": "test",
751
759
  "entity": "user",
752
760
  "action": "signup",
753
- "timestamp": 1700000300,
761
+ "timestamp": 1700000300000,
754
762
  "timing": 3.14,
755
763
  "source": {
756
764
  "count": 1,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-slack",
3
3
  "description": "Slack server destination for walkerOS (Incoming Webhook + @slack/web-api, Block Kit, channel routing, threading, DMs)",
4
- "version": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
5
5
  "license": "MIT",
6
6
  "exports": {
7
7
  ".": {
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@slack/web-api": "^7.0.0",
39
- "@walkeros/core": "4.8.2",
40
- "@walkeros/server-core": "4.8.2"
39
+ "@walkeros/core": "4.8.3-next-1793115089237",
40
+ "@walkeros/server-core": "4.8.3-next-1793115089237"
41
41
  },
42
42
  "devDependencies": {
43
- "@walkeros/collector": "4.8.2"
43
+ "@walkeros/collector": "4.8.3-next-1793115089237"
44
44
  },
45
45
  "repository": {
46
46
  "url": "git+https://github.com/elbwalker/walkerOS.git",