@hasna/events 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +48 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -646,6 +646,46 @@ Usage:
|
|
|
646
646
|
Environment:
|
|
647
647
|
HASNA_EVENTS_DIR or HASNA_EVENTS_HOME overrides the default ${getEventsDataDir()}`);
|
|
648
648
|
}
|
|
649
|
+
function printWebhooksHelp() {
|
|
650
|
+
console.log(`events webhooks
|
|
651
|
+
|
|
652
|
+
Usage:
|
|
653
|
+
events [--dir <path>] [--json] webhooks add <url|command> [options]
|
|
654
|
+
events [--dir <path>] [--json] webhooks list
|
|
655
|
+
events [--dir <path>] [--json] webhooks remove <id>
|
|
656
|
+
events [--dir <path>] [--json] webhooks test <id>
|
|
657
|
+
|
|
658
|
+
Options:
|
|
659
|
+
--id <id> Channel id for add
|
|
660
|
+
--type <pattern> Event type filter, supports wildcards
|
|
661
|
+
--source <source> Event source filter
|
|
662
|
+
--subject <subject> Event subject filter
|
|
663
|
+
--severity <severity> Event severity filter
|
|
664
|
+
--transport <kind> webhook or command
|
|
665
|
+
--secret <secret> Webhook signing secret
|
|
666
|
+
--header <name=value> Webhook header, repeatable
|
|
667
|
+
--redact <path> Redaction path, repeatable
|
|
668
|
+
--no-deliver Available on events emit`);
|
|
669
|
+
}
|
|
670
|
+
function printEventsHelp() {
|
|
671
|
+
console.log(`events events
|
|
672
|
+
|
|
673
|
+
Usage:
|
|
674
|
+
events [--dir <path>] [--json] events emit <type> --source <source> [options]
|
|
675
|
+
events [--dir <path>] [--json] events list [--limit <n>]
|
|
676
|
+
events [--dir <path>] [--json] events replay [--id <event-id>] [--dry-run]
|
|
677
|
+
|
|
678
|
+
Options:
|
|
679
|
+
--source <source> Event source
|
|
680
|
+
--subject <subject> Event subject
|
|
681
|
+
--severity <severity> Event severity
|
|
682
|
+
--message <message> Human-readable event message
|
|
683
|
+
--dedupe-key <key> Deduplicate repeated events
|
|
684
|
+
--data <json> JSON object payload
|
|
685
|
+
--metadata <json> JSON object metadata
|
|
686
|
+
--no-deliver Record without delivering webhooks
|
|
687
|
+
--dry-run Preview replay matches without delivery`);
|
|
688
|
+
}
|
|
649
689
|
async function main(argv = process.argv.slice(2)) {
|
|
650
690
|
const parsed = parseGlobalArgs(argv);
|
|
651
691
|
const [group, command, ...tail] = parsed.rest;
|
|
@@ -660,10 +700,18 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
660
700
|
const store = new JsonEventsStore(parsed.dir);
|
|
661
701
|
const client = new EventsClient({ store });
|
|
662
702
|
if (group === "webhooks") {
|
|
703
|
+
if (!command || command === "--help" || command === "-h") {
|
|
704
|
+
printWebhooksHelp();
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
663
707
|
await handleWebhooks(client, command, tail, parsed);
|
|
664
708
|
return;
|
|
665
709
|
}
|
|
666
710
|
if (group === "events") {
|
|
711
|
+
if (!command || command === "--help" || command === "-h") {
|
|
712
|
+
printEventsHelp();
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
667
715
|
await handleEvents(client, command, tail, parsed);
|
|
668
716
|
return;
|
|
669
717
|
}
|