charon-hooks 0.2.6 → 0.2.7

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.
@@ -1464,8 +1464,7 @@ async function reloadConfig(configPath2) {
1464
1464
  // src/lib/config/writer.ts
1465
1465
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
1466
1466
  import { parse as parseYaml2, stringify as stringifyYaml } from "yaml";
1467
- var DEFAULT_CONFIG_PATH = "config/triggers.yaml";
1468
- async function writeTrigger(trigger, configPath2 = DEFAULT_CONFIG_PATH) {
1467
+ async function writeTrigger(trigger, configPath2 = triggersPath) {
1469
1468
  const validation = validateTrigger(trigger);
1470
1469
  if (!validation.success) {
1471
1470
  const messages = validation.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join(", ");
@@ -1512,7 +1511,7 @@ async function writeTrigger(trigger, configPath2 = DEFAULT_CONFIG_PATH) {
1512
1511
  return { success: false, error: `Write failed: ${err instanceof Error ? err.message : String(err)}` };
1513
1512
  }
1514
1513
  }
1515
- async function deleteTrigger2(id, configPath2 = DEFAULT_CONFIG_PATH) {
1514
+ async function deleteTrigger2(id, configPath2 = triggersPath) {
1516
1515
  try {
1517
1516
  const content = readFileSync3(configPath2, "utf-8");
1518
1517
  const config = parseYaml2(content) || {};
@@ -1535,7 +1534,7 @@ async function deleteTrigger2(id, configPath2 = DEFAULT_CONFIG_PATH) {
1535
1534
  return { success: false, error: `Delete failed: ${err instanceof Error ? err.message : String(err)}` };
1536
1535
  }
1537
1536
  }
1538
- async function listTriggerIds(configPath2 = DEFAULT_CONFIG_PATH) {
1537
+ async function listTriggerIds(configPath2 = triggersPath) {
1539
1538
  try {
1540
1539
  const content = readFileSync3(configPath2, "utf-8");
1541
1540
  const config = parseYaml2(content) || {};
@@ -1547,7 +1546,7 @@ async function listTriggerIds(configPath2 = DEFAULT_CONFIG_PATH) {
1547
1546
  return [];
1548
1547
  }
1549
1548
  }
1550
- async function writeTunnelConfig(tunnel, configPath2 = DEFAULT_CONFIG_PATH) {
1549
+ async function writeTunnelConfig(tunnel, configPath2 = triggersPath) {
1551
1550
  try {
1552
1551
  const content = readFileSync3(configPath2, "utf-8");
1553
1552
  const config = parseYaml2(content) || {};
@@ -1574,7 +1573,7 @@ async function writeTunnelConfig(tunnel, configPath2 = DEFAULT_CONFIG_PATH) {
1574
1573
  return { success: false, error: `Write failed: ${err instanceof Error ? err.message : String(err)}` };
1575
1574
  }
1576
1575
  }
1577
- async function getTunnelConfig(configPath2 = DEFAULT_CONFIG_PATH) {
1576
+ async function getTunnelConfig(configPath2 = triggersPath) {
1578
1577
  try {
1579
1578
  const content = readFileSync3(configPath2, "utf-8");
1580
1579
  const config = parseYaml2(content) || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "charon-hooks",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Autonomous task triggering service - webhooks and cron to AI agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,8 @@
9
9
  "files": [
10
10
  "bin/",
11
11
  "config/*.dist",
12
- "dist/"
12
+ "dist/",
13
+ "sanitizers/"
13
14
  ],
14
15
  "scripts": {
15
16
  "dev": "CHARON_DEV=1 bun run dev:server",
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Passthrough sanitizer - passes the payload through unchanged.
3
+ * Object payloads are spread so their keys become template placeholders.
4
+ */
5
+ const passthrough = (payload: unknown) => {
6
+ // Spread object payloads so their keys are available as template placeholders
7
+ if (typeof payload === 'object' && payload !== null && !Array.isArray(payload)) {
8
+ return payload as Record<string, unknown>;
9
+ }
10
+ // Non-object payloads get wrapped as { payload: value }
11
+ return { payload };
12
+ };
13
+
14
+ export default passthrough;