@walkeros/server-destination-slack 4.8.1 → 4.8.2

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,31 @@
1
1
  # @walkeros/server-destination-slack
2
2
 
3
+ ## 4.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7e5fc27: `reply_broadcast` is sent only together with a thread. A broadcast
8
+ flag set on a message that has no thread to reply to is no longer passed on to
9
+ Slack, so the message is posted as an ordinary message.
10
+ - 2374f54: A failed request is reported as a failed push (dead-letter queue, one
11
+ ERROR line with the status) instead of counting as delivered or being logged
12
+ at debug. Events a destination cannot send, such as a missing user identifier,
13
+ fail with `missing-input`. Rules with `silent: true` send no event of their
14
+ own.
15
+ - Updated dependencies [2374f54]
16
+ - Updated dependencies [7e5fc27]
17
+ - Updated dependencies [2374f54]
18
+ - Updated dependencies [964590a]
19
+ - Updated dependencies [4100ede]
20
+ - Updated dependencies [2374f54]
21
+ - Updated dependencies [2374f54]
22
+ - Updated dependencies [15eb7b2]
23
+ - Updated dependencies [33a2779]
24
+ - Updated dependencies [33a2779]
25
+ - Updated dependencies [2374f54]
26
+ - @walkeros/core@4.8.2
27
+ - @walkeros/server-core@4.8.2
28
+
3
29
  ## 4.8.1
4
30
 
5
31
  ### Patch Changes
package/README.md CHANGED
@@ -31,7 +31,11 @@ npm install @walkeros/server-destination-slack
31
31
  "destinations": {
32
32
  "slack": {
33
33
  "package": "@walkeros/server-destination-slack",
34
- "config": {}
34
+ "config": {
35
+ "settings": {
36
+ "webhookUrl": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
37
+ }
38
+ }
35
39
  }
36
40
  }
37
41
  }
package/dist/dev.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
3
  import { DestinationServer, sendServer } from '@walkeros/server-core';
4
- import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, WebClient } from '@slack/web-api';
4
+ import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, KnownBlock, Block, WebClient } from '@slack/web-api';
5
5
  import { Flow } from '@walkeros/core';
6
6
 
7
7
  declare const SettingsSchema: z.ZodObject<{
@@ -20,7 +20,7 @@ declare const SettingsSchema: z.ZodObject<{
20
20
  fiveRetriesInFiveMinutes: "fiveRetriesInFiveMinutes";
21
21
  none: "none";
22
22
  }>>;
23
- }, z.core.$strip>;
23
+ }, z.core.$strict>;
24
24
  type Settings$1 = z.infer<typeof SettingsSchema>;
25
25
 
26
26
  declare const MappingSchema: z.ZodObject<{
@@ -47,8 +47,8 @@ declare namespace index$1 {
47
47
  export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
48
48
  }
49
49
 
50
- /** A single Block Kit block (kept loose -- Slack does not export a union type). */
51
- type SlackBlock = Record<string, unknown>;
50
+ /** A single Block Kit block, as the Slack SDK types it. */
51
+ type SlackBlock = KnownBlock | Block;
52
52
  interface Settings {
53
53
  /** Slack Bot token (xoxb-...). Enables Web API mode. */
54
54
  token?: string;
@@ -160,6 +160,8 @@ declare const defaultBlocks: SlackStepExample;
160
160
  * URL by Slack.
161
161
  */
162
162
  declare const deployNotification: SlackStepExample;
163
+ /** A silent rule posts nothing to Slack. */
164
+ declare const silentRule: SlackStepExample;
163
165
 
164
166
  type step_SlackStepExample = SlackStepExample;
165
167
  declare const step_defaultBlocks: typeof defaultBlocks;
@@ -167,10 +169,11 @@ declare const step_deployNotification: typeof deployNotification;
167
169
  declare const step_ephemeralMessage: typeof ephemeralMessage;
168
170
  declare const step_errorAlert: typeof errorAlert;
169
171
  declare const step_purchaseAlert: typeof purchaseAlert;
172
+ declare const step_silentRule: typeof silentRule;
170
173
  declare const step_threadedCheckoutStep: typeof threadedCheckoutStep;
171
174
  declare const step_welcomeDM: typeof welcomeDM;
172
175
  declare namespace step {
173
- 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_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
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 };
174
177
  }
175
178
 
176
179
  declare const index_env: typeof env;
package/dist/dev.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
3
  import { DestinationServer, sendServer } from '@walkeros/server-core';
4
- import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, WebClient } from '@slack/web-api';
4
+ import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, KnownBlock, Block, WebClient } from '@slack/web-api';
5
5
  import { Flow } from '@walkeros/core';
6
6
 
7
7
  declare const SettingsSchema: z.ZodObject<{
@@ -20,7 +20,7 @@ declare const SettingsSchema: z.ZodObject<{
20
20
  fiveRetriesInFiveMinutes: "fiveRetriesInFiveMinutes";
21
21
  none: "none";
22
22
  }>>;
23
- }, z.core.$strip>;
23
+ }, z.core.$strict>;
24
24
  type Settings$1 = z.infer<typeof SettingsSchema>;
25
25
 
26
26
  declare const MappingSchema: z.ZodObject<{
@@ -47,8 +47,8 @@ declare namespace index$1 {
47
47
  export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
48
48
  }
49
49
 
50
- /** A single Block Kit block (kept loose -- Slack does not export a union type). */
51
- type SlackBlock = Record<string, unknown>;
50
+ /** A single Block Kit block, as the Slack SDK types it. */
51
+ type SlackBlock = KnownBlock | Block;
52
52
  interface Settings {
53
53
  /** Slack Bot token (xoxb-...). Enables Web API mode. */
54
54
  token?: string;
@@ -160,6 +160,8 @@ declare const defaultBlocks: SlackStepExample;
160
160
  * URL by Slack.
161
161
  */
162
162
  declare const deployNotification: SlackStepExample;
163
+ /** A silent rule posts nothing to Slack. */
164
+ declare const silentRule: SlackStepExample;
163
165
 
164
166
  type step_SlackStepExample = SlackStepExample;
165
167
  declare const step_defaultBlocks: typeof defaultBlocks;
@@ -167,10 +169,11 @@ declare const step_deployNotification: typeof deployNotification;
167
169
  declare const step_ephemeralMessage: typeof ephemeralMessage;
168
170
  declare const step_errorAlert: typeof errorAlert;
169
171
  declare const step_purchaseAlert: typeof purchaseAlert;
172
+ declare const step_silentRule: typeof silentRule;
170
173
  declare const step_threadedCheckoutStep: typeof threadedCheckoutStep;
171
174
  declare const step_welcomeDM: typeof welcomeDM;
172
175
  declare namespace step {
173
- 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_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
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 };
174
177
  }
175
178
 
176
179
  declare const index_env: typeof env;
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:()=>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('Retry policy passed to WebClient. Default: "default".').optional()}).refine(e=>Boolean(e.token)!==Boolean(e.webhookUrl),{message:"Provide exactly one of `token` or `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 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()}),m=(0,l.zodToSchema)(d),h=(0,l.zodToSchema)(u),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({ok:!0})},w=["call:slackClient.chat.postMessage","call:slackClient.chat.postEphemeral","call:slackClient.conversations.open","call:sendServer"],x={};o(x,{defaultBlocks:()=>C,deployNotification:()=>P,ephemeralMessage:()=>_,errorAlert:()=>M,purchaseAlert:()=>E,threadedCheckoutStep:()=>D,welcomeDM:()=>S});var z=require("@walkeros/core"),E={title:"Purchase alert",description:"A completed order posts a templated message to a sales channel via the Slack Web API.",in:(0,z.getEvent)("order complete",{timestamp:1700000100,data:{id:"ORD-500",total:299.99,currency:"EUR",product:"Pro Plan"},user:{id:"buyer-42"}}),mapping:{settings:{channel:"#sales",text:":moneybag: New order: ${data.id} - ${data.total} ${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}]]},M={title:"Error alert",description:"An error event posts a critical alert to an engineering channel using a mapping-level channel override.",in:(0,z.getEvent)("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}]]},S={title:"Welcome DM",description:"A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",in:(0,z.getEvent)("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,z.getEvent)("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,z.getEvent)("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,z.getEvent)("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}]]},P={title:"Webhook deploy",description:"Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",in:(0,z.getEvent)("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})]]};//# 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:()=>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
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 .refine((v) => Boolean(v.token) !== Boolean(v.webhookUrl), {\n message: 'Provide exactly one of `token` or `webhookUrl`.',\n });\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: (() =>\n Promise.resolve({ ok: true } as never)) as Env['sendServer'],\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 { 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 total: 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.total} ${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: getEvent('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: getEvent('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: getEvent('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: getEvent('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: getEvent('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: getEvent('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"],"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,EAC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C,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU;AAAA,MACR,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,UACN;AAAA,YACE,MAAM;AAAA,YACN,MAAM,EAAE,MAAM,cAAc,MAAM,cAAc;AAAA,UAClD;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,EAAE,MAAM,UAAU,MAAM,gBAAgB;AAAA,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,sBAAS,mBAAmB;AAAA,IAC9B,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;","names":["import_dev","import_dev"]}
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\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;AAA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AAM;AAAA,YACN,MAAM,EAAE,MAAM,cAAc,MAAM,cAAc;AAAA,UAClD;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,EAAE,MAAM,UAAU,MAAM,gBAAgB;AAAA,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"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,a)=>{for(var n in a)e(t,n,{get:a[n],enumerable:!0})},a={};t(a,{MappingSchema:()=>i,SettingsSchema:()=>r,mapping:()=>c,settings:()=>l});import{zodToSchema as n}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var r=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()}).refine(e=>Boolean(e.token)!==Boolean(e.webhookUrl),{message:"Provide exactly one of `token` or `webhookUrl`."});import{z as s}from"@walkeros/core/dev";var i=s.object({channel:s.string().describe("Override the destination channel for this rule. Web API mode only -- ignored in webhook mode.").optional(),text:s.string().describe("Override the text template for this rule. Supports `${data.field}` interpolation.").optional(),blocks:s.array(s.record(s.string(),s.unknown())).describe("Override Block Kit blocks for this rule.").optional(),threadTs:s.string().describe("thread_ts for posting as a reply in a thread.").optional(),replyBroadcast:s.boolean().describe("Also broadcast the threaded reply back to the channel.").optional(),ephemeral:s.boolean().describe("Send via chat.postEphemeral. Requires `user`.").optional(),user:s.string().describe("Slack user ID for ephemeral or DM delivery.").optional(),dm:s.boolean().describe("Send as DM via conversations.open + chat.postMessage. Requires `user`.").optional()}),l=n(r),c=n(i),d={};t(d,{env:()=>p,step:()=>b});var p={};t(p,{push:()=>g,simulation:()=>k});var m={ok:!0,channel:"CMOCK",ts:"1700000000.000100"},u={ok:!0},h={ok:!0,channel:{id:"D-MOCK-DM"}};var g={slackClient:{chat:{postMessage:()=>Promise.resolve(m),postEphemeral:()=>Promise.resolve(u)},conversations:{open:()=>Promise.resolve(h)}},sendServer:()=>Promise.resolve({ok:!0})},k=["call:slackClient.chat.postMessage","call:slackClient.chat.postEphemeral","call:slackClient.conversations.open","call:sendServer"],b={};t(b,{defaultBlocks:()=>D,deployNotification:()=>S,ephemeralMessage:()=>M,errorAlert:()=>y,purchaseAlert:()=>v,threadedCheckoutStep:()=>x,welcomeDM:()=>w});import{getEvent as f}from"@walkeros/core";var v={title:"Purchase alert",description:"A completed order posts a templated message to a sales channel via the Slack Web API.",in:f("order complete",{timestamp:1700000100,data:{id:"ORD-500",total:299.99,currency:"EUR",product:"Pro Plan"},user:{id:"buyer-42"}}),mapping:{settings:{channel:"#sales",text:":moneybag: New order: ${data.id} - ${data.total} ${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}]]},y={title:"Error alert",description:"An error event posts a critical alert to an engineering channel using a mapping-level channel override.",in:f("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}]]},w={title:"Welcome DM",description:"A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",in:f("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}]]},x={title:"Threaded reply",description:"A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.",in:f("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}]]},M={title:"Ephemeral message",description:"A quota warning posts an ephemeral Slack message visible only to a target admin user.",in:f("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"}]]},D={title:"Default blocks",description:"With no custom text the destination auto-generates a Block Kit message from event data and source.",in:f("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}]]},S={title:"Webhook deploy",description:"Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",in:f("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})]]};export{d as examples,a 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:()=>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
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 .refine((v) => Boolean(v.token) !== Boolean(v.webhookUrl), {\n message: 'Provide exactly one of `token` or `webhookUrl`.',\n });\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: (() =>\n Promise.resolve({ ok: true } as never)) as Env['sendServer'],\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 { 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 total: 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.total} ${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: getEvent('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: getEvent('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: getEvent('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: getEvent('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: getEvent('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: getEvent('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"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,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A,MACA,KAAK,UAAU;AAAA,QACb,MAAM;AAAA,QACN,cAAc;AAAA,QACd,cAAc;AAAA,QACd,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["z"]}
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\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,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,QAAQ,EACL,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,EACvC;AAAA,IACC;AAAA,EACF,EAC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EACxB,KAAK,CAAC;AACR;","names":["z"]}
@@ -1,9 +1,9 @@
1
1
  import { DestinationServer, sendServer } from '@walkeros/server-core';
2
- import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, WebClient } from '@slack/web-api';
2
+ import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, KnownBlock, Block, WebClient } from '@slack/web-api';
3
3
  import { Flow } from '@walkeros/core';
4
4
 
5
- /** A single Block Kit block (kept loose -- Slack does not export a union type). */
6
- type SlackBlock = Record<string, unknown>;
5
+ /** A single Block Kit block, as the Slack SDK types it. */
6
+ type SlackBlock = KnownBlock | Block;
7
7
  interface Settings {
8
8
  /** Slack Bot token (xoxb-...). Enables Web API mode. */
9
9
  token?: string;
@@ -115,6 +115,8 @@ declare const defaultBlocks: SlackStepExample;
115
115
  * URL by Slack.
116
116
  */
117
117
  declare const deployNotification: SlackStepExample;
118
+ /** A silent rule posts nothing to Slack. */
119
+ declare const silentRule: SlackStepExample;
118
120
 
119
121
  type step_SlackStepExample = SlackStepExample;
120
122
  declare const step_defaultBlocks: typeof defaultBlocks;
@@ -122,10 +124,11 @@ declare const step_deployNotification: typeof deployNotification;
122
124
  declare const step_ephemeralMessage: typeof ephemeralMessage;
123
125
  declare const step_errorAlert: typeof errorAlert;
124
126
  declare const step_purchaseAlert: typeof purchaseAlert;
127
+ declare const step_silentRule: typeof silentRule;
125
128
  declare const step_threadedCheckoutStep: typeof threadedCheckoutStep;
126
129
  declare const step_welcomeDM: typeof welcomeDM;
127
130
  declare namespace step {
128
- 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_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
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 };
129
132
  }
130
133
 
131
134
  export { env, step };
@@ -1,9 +1,9 @@
1
1
  import { DestinationServer, sendServer } from '@walkeros/server-core';
2
- import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, WebClient } from '@slack/web-api';
2
+ import { ChatPostMessageArguments, ChatPostMessageResponse, ChatPostEphemeralArguments, ChatPostEphemeralResponse, ConversationsOpenArguments, ConversationsOpenResponse, KnownBlock, Block, WebClient } from '@slack/web-api';
3
3
  import { Flow } from '@walkeros/core';
4
4
 
5
- /** A single Block Kit block (kept loose -- Slack does not export a union type). */
6
- type SlackBlock = Record<string, unknown>;
5
+ /** A single Block Kit block, as the Slack SDK types it. */
6
+ type SlackBlock = KnownBlock | Block;
7
7
  interface Settings {
8
8
  /** Slack Bot token (xoxb-...). Enables Web API mode. */
9
9
  token?: string;
@@ -115,6 +115,8 @@ declare const defaultBlocks: SlackStepExample;
115
115
  * URL by Slack.
116
116
  */
117
117
  declare const deployNotification: SlackStepExample;
118
+ /** A silent rule posts nothing to Slack. */
119
+ declare const silentRule: SlackStepExample;
118
120
 
119
121
  type step_SlackStepExample = SlackStepExample;
120
122
  declare const step_defaultBlocks: typeof defaultBlocks;
@@ -122,10 +124,11 @@ declare const step_deployNotification: typeof deployNotification;
122
124
  declare const step_ephemeralMessage: typeof ephemeralMessage;
123
125
  declare const step_errorAlert: typeof errorAlert;
124
126
  declare const step_purchaseAlert: typeof purchaseAlert;
127
+ declare const step_silentRule: typeof silentRule;
125
128
  declare const step_threadedCheckoutStep: typeof threadedCheckoutStep;
126
129
  declare const step_welcomeDM: typeof welcomeDM;
127
130
  declare namespace step {
128
- 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_threadedCheckoutStep as threadedCheckoutStep, step_welcomeDM as welcomeDM };
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 };
129
132
  }
130
133
 
131
134
  export { env, step };
@@ -54,7 +54,7 @@ function createMockClient() {
54
54
  }
55
55
  var push = {
56
56
  slackClient: createMockClient(),
57
- sendServer: (() => Promise.resolve({ ok: true }))
57
+ sendServer: () => Promise.resolve({})
58
58
  };
59
59
  var simulation = [
60
60
  "call:slackClient.chat.postMessage",
@@ -71,6 +71,7 @@ __export(step_exports, {
71
71
  ephemeralMessage: () => ephemeralMessage,
72
72
  errorAlert: () => errorAlert,
73
73
  purchaseAlert: () => purchaseAlert,
74
+ silentRule: () => silentRule,
74
75
  threadedCheckoutStep: () => threadedCheckoutStep,
75
76
  welcomeDM: () => welcomeDM
76
77
  });
@@ -82,7 +83,7 @@ var purchaseAlert = {
82
83
  timestamp: 1700000100,
83
84
  data: {
84
85
  id: "ORD-500",
85
- total: 299.99,
86
+ value: 299.99,
86
87
  currency: "EUR",
87
88
  product: "Pro Plan"
88
89
  },
@@ -91,7 +92,7 @@ var purchaseAlert = {
91
92
  mapping: {
92
93
  settings: {
93
94
  channel: "#sales",
94
- text: ":moneybag: New order: ${data.id} - ${data.total} ${data.currency}"
95
+ text: ":moneybag: New order: ${data.id} - ${data.value} ${data.currency}"
95
96
  }
96
97
  },
97
98
  out: [
@@ -110,7 +111,8 @@ var purchaseAlert = {
110
111
  var errorAlert = {
111
112
  title: "Error alert",
112
113
  description: "An error event posts a critical alert to an engineering channel using a mapping-level channel override.",
113
- in: (0, import_core.getEvent)("error occur", {
114
+ in: (0, import_core.createEvent)({
115
+ name: "error occur",
114
116
  timestamp: 1700000200,
115
117
  data: {
116
118
  message: "Payment gateway timeout",
@@ -140,7 +142,8 @@ var errorAlert = {
140
142
  var welcomeDM = {
141
143
  title: "Welcome DM",
142
144
  description: "A user signup opens a Slack DM channel and posts a welcome message with the selected plan.",
143
- in: (0, import_core.getEvent)("user signup", {
145
+ in: (0, import_core.createEvent)({
146
+ name: "user signup",
144
147
  timestamp: 1700000300,
145
148
  data: { plan: "enterprise" },
146
149
  user: { id: "U-NEW-USER" }
@@ -169,7 +172,8 @@ var welcomeDM = {
169
172
  var threadedCheckoutStep = {
170
173
  title: "Threaded reply",
171
174
  description: "A checkout step posts as a threaded reply in Slack via thread_ts with broadcast to the channel.",
172
- in: (0, import_core.getEvent)("checkout step", {
175
+ in: (0, import_core.createEvent)({
176
+ name: "checkout step",
173
177
  timestamp: 1700000400,
174
178
  data: { step: "payment", sessionTs: "1700000000.000050" }
175
179
  }),
@@ -199,7 +203,8 @@ var threadedCheckoutStep = {
199
203
  var ephemeralMessage = {
200
204
  title: "Ephemeral message",
201
205
  description: "A quota warning posts an ephemeral Slack message visible only to a target admin user.",
202
- in: (0, import_core.getEvent)("quota warning", {
206
+ in: (0, import_core.createEvent)({
207
+ name: "quota warning",
203
208
  timestamp: 1700000500,
204
209
  data: { remaining: 5 }
205
210
  }),
@@ -228,7 +233,8 @@ var ephemeralMessage = {
228
233
  var defaultBlocks = {
229
234
  title: "Default blocks",
230
235
  description: "With no custom text the destination auto-generates a Block Kit message from event data and source.",
231
- in: (0, import_core.getEvent)("lead submit", {
236
+ in: (0, import_core.createEvent)({
237
+ name: "lead submit",
232
238
  timestamp: 1700000600,
233
239
  data: { name: "Acme", email: "sales@acme.test" },
234
240
  source: { type: "crm", platform: "server" }
@@ -271,7 +277,8 @@ var defaultBlocks = {
271
277
  var deployNotification = {
272
278
  title: "Webhook deploy",
273
279
  description: "Without a token the destination posts to an incoming Slack webhook URL with the rendered message body.",
274
- in: (0, import_core.getEvent)("deploy complete", {
280
+ in: (0, import_core.createEvent)({
281
+ name: "deploy complete",
275
282
  timestamp: 1700000700,
276
283
  data: { version: "1.4.2", environment: "prod" }
277
284
  }),
@@ -297,6 +304,13 @@ var deployNotification = {
297
304
  ]
298
305
  ]
299
306
  };
307
+ var silentRule = {
308
+ public: false,
309
+ description: "A rule with silent: true posts no message to Slack.",
310
+ in: (0, import_core.getEvent)("page view", { timestamp: 170000099e4 }),
311
+ mapping: { silent: true },
312
+ out: []
313
+ };
300
314
  // Annotate the CommonJS export names for ESM import in node:
301
315
  0 && (module.exports = {
302
316
  env,