instant-cli 1.0.33 → 1.0.34

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.
Files changed (80) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/__tests__/multiSelect.test.ts +236 -0
  3. package/__tests__/select.test.ts +224 -0
  4. package/__tests__/webhooks.test.ts +728 -0
  5. package/dist/commands/webhooks/add.d.ts +9 -0
  6. package/dist/commands/webhooks/add.d.ts.map +1 -0
  7. package/dist/commands/webhooks/add.js +75 -0
  8. package/dist/commands/webhooks/add.js.map +1 -0
  9. package/dist/commands/webhooks/delete.d.ts +6 -0
  10. package/dist/commands/webhooks/delete.d.ts.map +1 -0
  11. package/dist/commands/webhooks/delete.js +17 -0
  12. package/dist/commands/webhooks/delete.js.map +1 -0
  13. package/dist/commands/webhooks/disable.d.ts +7 -0
  14. package/dist/commands/webhooks/disable.d.ts.map +1 -0
  15. package/dist/commands/webhooks/disable.js +18 -0
  16. package/dist/commands/webhooks/disable.js.map +1 -0
  17. package/dist/commands/webhooks/enable.d.ts +6 -0
  18. package/dist/commands/webhooks/enable.d.ts.map +1 -0
  19. package/dist/commands/webhooks/enable.js +18 -0
  20. package/dist/commands/webhooks/enable.js.map +1 -0
  21. package/dist/commands/webhooks/events/list.d.ts +7 -0
  22. package/dist/commands/webhooks/events/list.d.ts.map +1 -0
  23. package/dist/commands/webhooks/events/list.js +31 -0
  24. package/dist/commands/webhooks/events/list.js.map +1 -0
  25. package/dist/commands/webhooks/events/payload.d.ts +8 -0
  26. package/dist/commands/webhooks/events/payload.d.ts.map +1 -0
  27. package/dist/commands/webhooks/events/payload.js +39 -0
  28. package/dist/commands/webhooks/events/payload.js.map +1 -0
  29. package/dist/commands/webhooks/events/resend.d.ts +8 -0
  30. package/dist/commands/webhooks/events/resend.d.ts.map +1 -0
  31. package/dist/commands/webhooks/events/resend.js +43 -0
  32. package/dist/commands/webhooks/events/resend.js.map +1 -0
  33. package/dist/commands/webhooks/list.d.ts +8 -0
  34. package/dist/commands/webhooks/list.d.ts.map +1 -0
  35. package/dist/commands/webhooks/list.js +29 -0
  36. package/dist/commands/webhooks/list.js.map +1 -0
  37. package/dist/commands/webhooks/shared.d.ts +40 -0
  38. package/dist/commands/webhooks/shared.d.ts.map +1 -0
  39. package/dist/commands/webhooks/shared.js +248 -0
  40. package/dist/commands/webhooks/shared.js.map +1 -0
  41. package/dist/commands/webhooks/update.d.ts +10 -0
  42. package/dist/commands/webhooks/update.d.ts.map +1 -0
  43. package/dist/commands/webhooks/update.js +189 -0
  44. package/dist/commands/webhooks/update.js.map +1 -0
  45. package/dist/index.d.ts +45 -0
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +141 -0
  48. package/dist/index.js.map +1 -1
  49. package/dist/layer.d.ts +2 -2
  50. package/dist/layer.d.ts.map +1 -1
  51. package/dist/layer.js +30 -1
  52. package/dist/layer.js.map +1 -1
  53. package/dist/lib/webhooks.d.ts +28 -0
  54. package/dist/lib/webhooks.d.ts.map +1 -0
  55. package/dist/lib/webhooks.js +102 -0
  56. package/dist/lib/webhooks.js.map +1 -0
  57. package/dist/ui/index.d.ts +39 -1
  58. package/dist/ui/index.d.ts.map +1 -1
  59. package/dist/ui/index.js +387 -25
  60. package/dist/ui/index.js.map +1 -1
  61. package/dist/ui/lib.d.ts +7 -0
  62. package/dist/ui/lib.d.ts.map +1 -1
  63. package/dist/ui/lib.js +40 -1
  64. package/dist/ui/lib.js.map +1 -1
  65. package/package.json +4 -4
  66. package/src/commands/webhooks/add.ts +111 -0
  67. package/src/commands/webhooks/delete.ts +23 -0
  68. package/src/commands/webhooks/disable.ts +24 -0
  69. package/src/commands/webhooks/enable.ts +24 -0
  70. package/src/commands/webhooks/events/list.ts +38 -0
  71. package/src/commands/webhooks/events/payload.ts +56 -0
  72. package/src/commands/webhooks/events/resend.ts +66 -0
  73. package/src/commands/webhooks/list.ts +41 -0
  74. package/src/commands/webhooks/shared.ts +339 -0
  75. package/src/commands/webhooks/update.ts +276 -0
  76. package/src/index.ts +242 -0
  77. package/src/layer.ts +33 -1
  78. package/src/lib/webhooks.ts +127 -0
  79. package/src/ui/index.ts +465 -32
  80. package/src/ui/lib.ts +41 -1
@@ -0,0 +1,9 @@
1
+ import { Effect } from 'effect';
2
+ import { GlobalOpts } from '../../context/globalOpts.ts';
3
+ export declare const webhooksAddCmd: (opts: {
4
+ url?: string | undefined;
5
+ namespaces?: string | undefined;
6
+ actions?: string | undefined;
7
+ app?: string | undefined;
8
+ }) => Effect.Effect<void | undefined, import("../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, GlobalOpts | import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
9
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAchC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,eAAO,MAAM,cAAc;;;;;6RA4F1B,CAAC"}
@@ -0,0 +1,75 @@
1
+ import chalk from 'chalk';
2
+ import { Effect } from 'effect';
3
+ import { Args } from "../../lib/args.js";
4
+ import { runUIEffect } from "../../lib/ui.js";
5
+ import { clearPromptTrail, UI } from "../../ui/index.js";
6
+ import { getRemoteNamespaces, parseActions, parseNamespaces, useWebhooksManager, WEBHOOK_ACTIONS, } from "../../lib/webhooks.js";
7
+ import { BadArgsError } from "../../errors.js";
8
+ import { GlobalOpts } from "../../context/globalOpts.js";
9
+ import { logWebhookEvent, validateWebhookUrl } from "./shared.js";
10
+ export const webhooksAddCmd = Effect.fn(function* (opts) {
11
+ const { yes } = yield* GlobalOpts;
12
+ const url = yield* Args.text(opts, 'url').pipe(Args.prompt({
13
+ prompt: 'Webhook URL:',
14
+ placeholder: 'https://...',
15
+ validate: validateWebhookUrl,
16
+ modifyOutput: UI.modifiers.piped([
17
+ UI.modifiers.topPadding,
18
+ UI.modifiers.dimOnComplete,
19
+ ]),
20
+ }), Args.validate(validateWebhookUrl), Args.required());
21
+ let namespaces = yield* parseNamespaces(opts.namespaces);
22
+ if (!namespaces) {
23
+ if (yes) {
24
+ return yield* BadArgsError.make({
25
+ message: 'Missing required value for --namespaces (comma-separated list)',
26
+ });
27
+ }
28
+ const available = yield* getRemoteNamespaces;
29
+ if (available && available.length > 0) {
30
+ namespaces = yield* runUIEffect(new UI.MultiSelect({
31
+ options: available.map((name) => ({ value: name, label: name })),
32
+ promptText: 'Namespaces to listen to:',
33
+ minSelected: 1,
34
+ modifyOutput: UI.modifiers.dimOnComplete,
35
+ }));
36
+ }
37
+ else {
38
+ const raw = yield* runUIEffect(new UI.TextInput({
39
+ prompt: 'Namespaces (comma-separated):',
40
+ placeholder: 'posts,comments',
41
+ modifyOutput: UI.modifiers.piped([
42
+ UI.modifiers.topPadding,
43
+ UI.modifiers.dimOnComplete,
44
+ ]),
45
+ }));
46
+ namespaces = yield* parseNamespaces(raw);
47
+ if (!namespaces) {
48
+ return yield* BadArgsError.make({
49
+ message: '--namespaces must include at least one namespace',
50
+ });
51
+ }
52
+ }
53
+ }
54
+ let actions = yield* parseActions(opts.actions);
55
+ if (!actions) {
56
+ if (yes) {
57
+ return yield* BadArgsError.make({
58
+ message: 'Missing required value for --actions (comma-separated list of create,update,delete)',
59
+ });
60
+ }
61
+ actions = yield* runUIEffect(new UI.MultiSelect({
62
+ options: WEBHOOK_ACTIONS.map((a) => ({ value: a, label: a })),
63
+ promptText: 'Actions to trigger on:',
64
+ minSelected: 1,
65
+ modifyOutput: UI.modifiers.dimOnComplete,
66
+ }));
67
+ }
68
+ const webhook = yield* useWebhooksManager((m) => m.create({ url, namespaces, actions }), 'Error creating webhook');
69
+ yield* Effect.sync(clearPromptTrail);
70
+ yield* logWebhookEvent('added', webhook);
71
+ }, Effect.catchTag('BadArgsError', (e) => Effect.gen(function* () {
72
+ yield* Effect.logError(e.message);
73
+ yield* Effect.log(chalk.dim('hint: run `instant-cli webhook add --help` for available arguments'));
74
+ })));
75
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/webhooks/add.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CACrC,QAAQ,CAAC,EAAE,IAA4C;IACrD,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;IAElC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,CAC5C,IAAI,CAAC,MAAM,CAAC;QACV,MAAM,EAAE,cAAc;QACtB,WAAW,EAAE,aAAa;QAC1B,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;YAC/B,EAAE,CAAC,SAAS,CAAC,UAAU;YACvB,EAAE,CAAC,SAAS,CAAC,aA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Q,CAAC;IAClB,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CACP,oEAAoE,CACrE,CACF,CAAC;AACJ,CAAC,CAAC,CACH,CACF,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { Effect } from 'effect';\nimport type { WebhookAction } from '@instantdb/platform';\nimport type { OptsFromCommand, webhooksAddDef } from '../../index.ts';\nimport { Args } from '../../lib/args.ts';\nimport { runUIEffect } from '../../lib/ui.ts';\nimport { clearPromptTrail, UI } from '../../ui/index.ts';\nimport {\n getRemoteNamespaces,\n parseActions,\n parseNamespaces,\n useWebhooksManager,\n WEBHOOK_ACTIONS,\n} from '../../lib/webhooks.ts';\nimport { BadArgsError } from '../../errors.ts';\nimport { GlobalOpts } from '../../context/globalOpts.ts';\nimport { logWebhookEvent, validateWebhookUrl } from './shared.ts';\n\nexport const webhooksAddCmd = Effect.fn(\n function* (opts: OptsFromCommand<typeof webhooksAddDef>) {\n const { yes } = yield* GlobalOpts;\n\n const url = yield* Args.text(opts, 'url').pipe(\n Args.prompt({\n prompt: 'Webhook URL:',\n placeholder: 'https://...',\n validate: validateWebhookUrl,\n modifyOutput: UI.modifiers.piped([\n UI.modifiers.topPadding,\n UI.modifiers.dimOnComplete,\n ]),\n }),\n Args.validate(validateWebhookUrl),\n Args.required(),\n );\n\n let namespaces = yield* parseNamespaces(opts.namespaces);\n if (!namespaces) {\n if (yes) {\n return yield* BadArgsError.make({\n message:\n 'Missing required value for --namespaces (comma-separated list)',\n });\n }\n const available = yield* getRemoteNamespaces;\n if (available && available.length > 0) {\n namespaces = yield* runUIEffect(\n new UI.MultiSelect<string>({\n options: available.map((name) => ({ value: name, label: name })),\n promptText: 'Namespaces to listen to:',\n minSelected: 1,\n modifyOutput: UI.modifiers.dimOnComplete,\n }),\n );\n } else {\n const raw = yield* runUIEffect(\n new UI.TextInput({\n prompt: 'Namespaces (comma-separated):',\n placeholder: 'posts,comments',\n modifyOutput: UI.modifiers.piped([\n UI.modifiers.topPadding,\n UI.modifiers.dimOnComplete,\n ]),\n }),\n );\n namespaces = yield* parseNamespaces(raw);\n if (!namespaces) {\n return yield* BadArgsError.make({\n message: '--namespaces must include at least one namespace',\n });\n }\n }\n }\n\n let actions = yield* parseActions(opts.actions);\n if (!actions) {\n if (yes) {\n return yield* BadArgsError.make({\n message:\n 'Missing required value for --actions (comma-separated list of create,update,delete)',\n });\n }\n actions = yield* runUIEffect(\n new UI.MultiSelect<WebhookAction>({\n options: WEBHOOK_ACTIONS.map((a) => ({ value: a, label: a })),\n promptText: 'Actions to trigger on:',\n minSelected: 1,\n modifyOutput: UI.modifiers.dimOnComplete,\n }),\n );\n }\n\n const webhook = yield* useWebhooksManager(\n (m) => m.create({ url, namespaces, actions }),\n 'Error creating webhook',\n );\n\n yield* Effect.sync(clearPromptTrail);\n yield* logWebhookEvent('added', webhook);\n },\n Effect.catchTag('BadArgsError', (e) =>\n Effect.gen(function* () {\n yield* Effect.logError(e.message);\n yield* Effect.log(\n chalk.dim(\n 'hint: run `instant-cli webhook add --help` for available arguments',\n ),\n );\n }),\n ),\n);\n"]}
@@ -0,0 +1,6 @@
1
+ import { Effect } from 'effect';
2
+ export declare const webhooksDeleteCmd: (opts: {
3
+ id?: string | undefined;
4
+ app?: string | undefined;
5
+ }) => Effect.Effect<void, import("../../errors.ts").BadArgsError | import("../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, import("../../context/globalOpts.ts").GlobalOpts | import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
6
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,eAAO,MAAM,iBAAiB;;;gWAiB5B,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Effect } from 'effect';
2
+ import { useWebhooksManager } from "../../lib/webhooks.js";
3
+ import { logWebhookEvent, resolveWebhookId } from "./shared.js";
4
+ export const webhooksDeleteCmd = Effect.fn(function* (opts) {
5
+ const id = yield* resolveWebhookId({
6
+ id: opts.id,
7
+ picker: {
8
+ promptText: 'Select a webhook to delete:',
9
+ emptyMessage: 'No webhooks configured.',
10
+ },
11
+ });
12
+ if (!id)
13
+ return;
14
+ const webhook = yield* useWebhooksManager((m) => m.delete(id), 'Error deleting webhook');
15
+ yield* logWebhookEvent('deleted', webhook);
16
+ });
17
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/webhooks/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAClD,IAA+C;IAE/C,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QACjC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,MAAM,EAAE;YACN,UAAU,EAAE,6BAA6B;YACzC,YAAY,EAAE,yBAAyB;SACxC;KACF,CAAC,CAAC;IACH,IAAI,CAAC,EAAE;QAAE,OAAO;IAEhB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,kBAAkB,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EACnB,wBAAwB,CACzB,CAAC;IACF,KAAK,CAAC,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport type { OptsFromCommand, webhooksDeleteDef } from '../../index.ts';\nimport { useWebhooksManager } from '../../lib/webhooks.ts';\nimport { logWebhookEvent, resolveWebhookId } from './shared.ts';\n\nexport const webhooksDeleteCmd = Effect.fn(function* (\n opts: OptsFromCommand<typeof webhooksDeleteDef>,\n) {\n const id = yield* resolveWebhookId({\n id: opts.id,\n picker: {\n promptText: 'Select a webhook to delete:',\n emptyMessage: 'No webhooks configured.',\n },\n });\n if (!id) return;\n\n const webhook = yield* useWebhooksManager(\n (m) => m.delete(id),\n 'Error deleting webhook',\n );\n yield* logWebhookEvent('deleted', webhook);\n});\n"]}
@@ -0,0 +1,7 @@
1
+ import { Effect } from 'effect';
2
+ export declare const webhooksDisableCmd: (opts: {
3
+ id?: string | undefined;
4
+ reason?: string | undefined;
5
+ app?: string | undefined;
6
+ }) => Effect.Effect<void, import("../../errors.ts").BadArgsError | import("../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, import("../../context/globalOpts.ts").GlobalOpts | import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
7
+ //# sourceMappingURL=disable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/disable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,eAAO,MAAM,kBAAkB;;;;gWAkB7B,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Effect } from 'effect';
2
+ import { useWebhooksManager } from "../../lib/webhooks.js";
3
+ import { logWebhookEvent, resolveWebhookId } from "./shared.js";
4
+ export const webhooksDisableCmd = Effect.fn(function* (opts) {
5
+ const id = yield* resolveWebhookId({
6
+ id: opts.id,
7
+ picker: {
8
+ promptText: 'Select a webhook to disable:',
9
+ emptyMessage: 'No active webhooks.',
10
+ filter: (w) => w.status === 'active',
11
+ },
12
+ });
13
+ if (!id)
14
+ return;
15
+ const webhook = yield* useWebhooksManager((m) => m.disable(id, opts.reason ? { reason: opts.reason } : undefined), 'Error disabling webhook');
16
+ yield* logWebhookEvent('disabled', webhook);
17
+ });
18
+ //# sourceMappingURL=disable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable.js","sourceRoot":"","sources":["../../../src/commands/webhooks/disable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EACnD,IAAgD;IAEhD,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QACjC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,MAAM,EAAE;YACN,UAAU,EAAE,8BAA8B;YAC1C,YAAY,EAAE,qBAAqB;YACnC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ;SACrC;KACF,CAAC,CAAC;IACH,IAAI,CAAC,EAAE;QAAE,OAAO;IAEhB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,kBAAkB,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EACvE,yBAAyB,CAC1B,CAAC;IACF,KAAK,CAAC,CAAC,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport type { OptsFromCommand, webhooksDisableDef } from '../../index.ts';\nimport { useWebhooksManager } from '../../lib/webhooks.ts';\nimport { logWebhookEvent, resolveWebhookId } from './shared.ts';\n\nexport const webhooksDisableCmd = Effect.fn(function* (\n opts: OptsFromCommand<typeof webhooksDisableDef>,\n) {\n const id = yield* resolveWebhookId({\n id: opts.id,\n picker: {\n promptText: 'Select a webhook to disable:',\n emptyMessage: 'No active webhooks.',\n filter: (w) => w.status === 'active',\n },\n });\n if (!id) return;\n\n const webhook = yield* useWebhooksManager(\n (m) => m.disable(id, opts.reason ? { reason: opts.reason } : undefined),\n 'Error disabling webhook',\n );\n yield* logWebhookEvent('disabled', webhook);\n});\n"]}
@@ -0,0 +1,6 @@
1
+ import { Effect } from 'effect';
2
+ export declare const webhooksEnableCmd: (opts: {
3
+ id?: string | undefined;
4
+ app?: string | undefined;
5
+ }) => Effect.Effect<void, import("../../errors.ts").BadArgsError | import("../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, import("../../context/globalOpts.ts").GlobalOpts | import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
6
+ //# sourceMappingURL=enable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/enable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,eAAO,MAAM,iBAAiB;;;gWAkB5B,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Effect } from 'effect';
2
+ import { useWebhooksManager } from "../../lib/webhooks.js";
3
+ import { logWebhookEvent, resolveWebhookId } from "./shared.js";
4
+ export const webhooksEnableCmd = Effect.fn(function* (opts) {
5
+ const id = yield* resolveWebhookId({
6
+ id: opts.id,
7
+ picker: {
8
+ promptText: 'Select a webhook to enable:',
9
+ emptyMessage: 'No disabled webhooks.',
10
+ filter: (w) => w.status === 'disabled',
11
+ },
12
+ });
13
+ if (!id)
14
+ return;
15
+ const webhook = yield* useWebhooksManager((m) => m.enable(id), 'Error enabling webhook');
16
+ yield* logWebhookEvent('enabled', webhook);
17
+ });
18
+ //# sourceMappingURL=enable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.js","sourceRoot":"","sources":["../../../src/commands/webhooks/enable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAClD,IAA+C;IAE/C,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QACjC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,MAAM,EAAE;YACN,UAAU,EAAE,6BAA6B;YACzC,YAAY,EAAE,uBAAuB;YACrC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU;SACvC;KACF,CAAC,CAAC;IACH,IAAI,CAAC,EAAE;QAAE,OAAO;IAEhB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,kBAAkB,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EACnB,wBAAwB,CACzB,CAAC;IACF,KAAK,CAAC,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport type { OptsFromCommand, webhooksEnableDef } from '../../index.ts';\nimport { useWebhooksManager } from '../../lib/webhooks.ts';\nimport { logWebhookEvent, resolveWebhookId } from './shared.ts';\n\nexport const webhooksEnableCmd = Effect.fn(function* (\n opts: OptsFromCommand<typeof webhooksEnableDef>,\n) {\n const id = yield* resolveWebhookId({\n id: opts.id,\n picker: {\n promptText: 'Select a webhook to enable:',\n emptyMessage: 'No disabled webhooks.',\n filter: (w) => w.status === 'disabled',\n },\n });\n if (!id) return;\n\n const webhook = yield* useWebhooksManager(\n (m) => m.enable(id),\n 'Error enabling webhook',\n );\n yield* logWebhookEvent('enabled', webhook);\n});\n"]}
@@ -0,0 +1,7 @@
1
+ import { Effect } from 'effect';
2
+ export declare const webhooksEventsListCmd: (opts: {
3
+ webhookId?: string | undefined;
4
+ json?: true | undefined;
5
+ app?: string | undefined;
6
+ }) => Effect.Effect<void, import("../../../errors.ts").BadArgsError | import("../../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../../context/platformApi.ts").PlatformApiError, import("../../../context/globalOpts.ts").GlobalOpts | import("../../../context/authToken.ts").AuthToken | import("../../../context/currentApp.ts").CurrentApp>;
7
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/webhooks/events/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOhC,eAAO,MAAM,qBAAqB;;;;kXA8BhC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { Effect } from 'effect';
2
+ import { fetchRecentEvents } from "../../../lib/webhooks.js";
3
+ import { logEventDetail, resolveWebhookId } from "../shared.js";
4
+ const EVENT_LIMIT = 100;
5
+ export const webhooksEventsListCmd = Effect.fn(function* (opts) {
6
+ const webhookId = yield* resolveWebhookId({
7
+ id: opts.webhookId,
8
+ flagName: '--webhook-id',
9
+ picker: {
10
+ promptText: 'Select a webhook to inspect:',
11
+ emptyMessage: 'No webhooks configured.',
12
+ },
13
+ });
14
+ if (!webhookId)
15
+ return;
16
+ const events = yield* fetchRecentEvents(webhookId, EVENT_LIMIT);
17
+ if (opts.json) {
18
+ yield* Effect.log(JSON.stringify(events, null, 2));
19
+ return;
20
+ }
21
+ if (events.length === 0) {
22
+ yield* Effect.log('No events for this webhook.');
23
+ return;
24
+ }
25
+ for (const event of events) {
26
+ for (const line of logEventDetail(event)) {
27
+ yield* Effect.log(line);
28
+ }
29
+ }
30
+ });
31
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/webhooks/events/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EACtD,IAAmD;IAEnD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QACxC,EAAE,EAAE,IAAI,CAAC,SAAS;QAClB,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE;YACN,UAAU,EAAE,8BAA8B;YAC1C,YAAY,EAAE,yBAAyB;SACxC;KACF,CAAC,CAAC;IACH,IAAI,CAAC,SAAS;QAAE,OAAO;IAEvB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAEhE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QACjD,OAAO;IACT,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YACzC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { Effect } from 'effect';\nimport type { OptsFromCommand, webhooksEventsListDef } from '../../../index.ts';\nimport { fetchRecentEvents } from '../../../lib/webhooks.ts';\nimport { logEventDetail, resolveWebhookId } from '../shared.ts';\n\nconst EVENT_LIMIT = 100;\n\nexport const webhooksEventsListCmd = Effect.fn(function* (\n opts: OptsFromCommand<typeof webhooksEventsListDef>,\n) {\n const webhookId = yield* resolveWebhookId({\n id: opts.webhookId,\n flagName: '--webhook-id',\n picker: {\n promptText: 'Select a webhook to inspect:',\n emptyMessage: 'No webhooks configured.',\n },\n });\n if (!webhookId) return;\n\n const events = yield* fetchRecentEvents(webhookId, EVENT_LIMIT);\n\n if (opts.json) {\n yield* Effect.log(JSON.stringify(events, null, 2));\n return;\n }\n\n if (events.length === 0) {\n yield* Effect.log('No events for this webhook.');\n return;\n }\n\n for (const event of events) {\n for (const line of logEventDetail(event)) {\n yield* Effect.log(line);\n }\n }\n});\n"]}
@@ -0,0 +1,8 @@
1
+ import { Effect } from 'effect';
2
+ import { GlobalOpts } from '../../../context/globalOpts.ts';
3
+ export declare const webhooksEventsPayloadCmd: (opts: {
4
+ webhookId?: string | undefined;
5
+ isn?: string | undefined;
6
+ app?: string | undefined;
7
+ }) => Effect.Effect<void | undefined, import("../../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../../context/platformApi.ts").PlatformApiError, GlobalOpts | import("../../../context/authToken.ts").AuthToken | import("../../../context/currentApp.ts").CurrentApp>;
8
+ //# sourceMappingURL=payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../../src/commands/webhooks/events/payload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAK5D,eAAO,MAAM,wBAAwB;;;;ySA4CpC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import chalk from 'chalk';
2
+ import { Effect } from 'effect';
3
+ import { GlobalOpts } from "../../../context/globalOpts.js";
4
+ import { BadArgsError } from "../../../errors.js";
5
+ import { useWebhooksManager } from "../../../lib/webhooks.js";
6
+ import { pickEvent, resolveWebhookId } from "../shared.js";
7
+ export const webhooksEventsPayloadCmd = Effect.fn(function* (opts) {
8
+ const { yes } = yield* GlobalOpts;
9
+ const webhookId = yield* resolveWebhookId({
10
+ id: opts.webhookId,
11
+ flagName: '--webhook-id',
12
+ picker: {
13
+ promptText: 'Select a webhook:',
14
+ emptyMessage: 'No webhooks configured.',
15
+ },
16
+ });
17
+ if (!webhookId)
18
+ return;
19
+ let isn = opts.isn;
20
+ if (!isn) {
21
+ if (yes) {
22
+ return yield* BadArgsError.make({ message: 'Must specify --isn' });
23
+ }
24
+ const picked = yield* pickEvent({
25
+ webhookId,
26
+ promptText: 'Select an event:',
27
+ emptyMessage: 'No events for this webhook.',
28
+ });
29
+ if (!picked)
30
+ return;
31
+ isn = picked.isn;
32
+ }
33
+ const payload = yield* useWebhooksManager((m) => m.getPayload(webhookId, isn), 'Error fetching event payload');
34
+ yield* Effect.log(JSON.stringify(payload, null, 2));
35
+ }, Effect.catchTag('BadArgsError', (e) => Effect.gen(function* () {
36
+ yield* Effect.logError(e.message);
37
+ yield* Effect.log(chalk.dim('hint: run `instant-cli webhook event payload --help` for available arguments'));
38
+ })));
39
+ //# sourceMappingURL=payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../../src/commands/webhooks/events/payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAA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,CAAC,UAAU,CAAC,SAAS,EAAE,GAAI,CAAC,EACpC,8BAA8B,CAC/B,CAAC;IACF,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC,EACD,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CACpC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CACP,8EAA8E,CAC/E,CACF,CAAC;AACJ,CAAC,CAAC,CACH,CACF,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { Effect } from 'effect';\nimport type {\n OptsFromCommand,\n webhooksEventsPayloadDef,\n} from '../../../index.ts';\nimport { GlobalOpts } from '../../../context/globalOpts.ts';\nimport { BadArgsError } from '../../../errors.ts';\nimport { useWebhooksManager } from '../../../lib/webhooks.ts';\nimport { pickEvent, resolveWebhookId } from '../shared.ts';\n\nexport const webhooksEventsPayloadCmd = Effect.fn(\n function* (opts: OptsFromCommand<typeof webhooksEventsPayloadDef>) {\n const { yes } = yield* GlobalOpts;\n\n const webhookId = yield* resolveWebhookId({\n id: opts.webhookId,\n flagName: '--webhook-id',\n picker: {\n promptText: 'Select a webhook:',\n emptyMessage: 'No webhooks configured.',\n },\n });\n if (!webhookId) return;\n\n let isn = opts.isn;\n if (!isn) {\n if (yes) {\n return yield* BadArgsError.make({ message: 'Must specify --isn' });\n }\n const picked = yield* pickEvent({\n webhookId,\n promptText: 'Select an event:',\n emptyMessage: 'No events for this webhook.',\n });\n if (!picked) return;\n isn = picked.isn;\n }\n\n const payload = yield* useWebhooksManager(\n (m) => m.getPayload(webhookId, isn!),\n 'Error fetching event payload',\n );\n yield* Effect.log(JSON.stringify(payload, null, 2));\n },\n Effect.catchTag('BadArgsError', (e) =>\n Effect.gen(function* () {\n yield* Effect.logError(e.message);\n yield* Effect.log(\n chalk.dim(\n 'hint: run `instant-cli webhook event payload --help` for available arguments',\n ),\n );\n }),\n ),\n);\n"]}
@@ -0,0 +1,8 @@
1
+ import { Effect } from 'effect';
2
+ import { GlobalOpts } from '../../../context/globalOpts.ts';
3
+ export declare const webhooksEventsResendCmd: (opts: {
4
+ webhookId?: string | undefined;
5
+ isn?: string | undefined;
6
+ app?: string | undefined;
7
+ }) => Effect.Effect<void | undefined, import("../../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../../context/platformApi.ts").PlatformApiError, GlobalOpts | import("../../../context/authToken.ts").AuthToken | import("../../../context/currentApp.ts").CurrentApp>;
8
+ //# sourceMappingURL=resend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resend.d.ts","sourceRoot":"","sources":["../../../../src/commands/webhooks/events/resend.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAU5D,eAAO,MAAM,uBAAuB;;;;ySAiDnC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import chalk from 'chalk';
2
+ import { Effect } from 'effect';
3
+ import { GlobalOpts } from "../../../context/globalOpts.js";
4
+ import { BadArgsError } from "../../../errors.js";
5
+ import { useWebhooksManager } from "../../../lib/webhooks.js";
6
+ import { colorStatus, logEventDetail, pickEvent, resolveWebhookId, } from "../shared.js";
7
+ export const webhooksEventsResendCmd = Effect.fn(function* (opts) {
8
+ const { yes } = yield* GlobalOpts;
9
+ const webhookId = yield* resolveWebhookId({
10
+ id: opts.webhookId,
11
+ flagName: '--webhook-id',
12
+ picker: {
13
+ promptText: 'Select a webhook:',
14
+ emptyMessage: 'No webhooks configured.',
15
+ },
16
+ });
17
+ if (!webhookId)
18
+ return;
19
+ let isn = opts.isn;
20
+ if (!isn) {
21
+ if (yes) {
22
+ return yield* BadArgsError.make({ message: 'Must specify --isn' });
23
+ }
24
+ const picked = yield* pickEvent({
25
+ webhookId,
26
+ promptText: 'Select an event to resend:',
27
+ emptyMessage: 'No events for this webhook.',
28
+ });
29
+ if (!picked)
30
+ return;
31
+ isn = picked.isn;
32
+ }
33
+ const event = yield* useWebhooksManager((m) => m.resendEvent(webhookId, isn), 'Error resending event');
34
+ yield* Effect.log(`Resent event ${chalk.cyan(event.isn)}`);
35
+ yield* Effect.log(`Status: ${colorStatus(event.status)}`);
36
+ for (const line of logEventDetail(event).slice(1)) {
37
+ yield* Effect.log(line);
38
+ }
39
+ }, Effect.catchTag('BadArgsError', (e) => Effect.gen(function* () {
40
+ yield* Effect.logError(e.message);
41
+ yield* Effect.log(chalk.dim('hint: run `instant-cli webhook event resend --help` for available arguments'));
42
+ })));
43
+ //# sourceMappingURL=resend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resend.js","sourceRoot":"","sources":["../../../../src/commands/webhooks/events/resend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,CAC9C,QAAQ,CAAC,EAAE,IAAqD;IAC9D,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;IAElC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;QACxC,E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AQ,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CACpC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CACP,6EAA6E,CAC9E,CACF,CAAC;AACJ,CAAC,CAAC,CACH,CACF,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { Effect } from 'effect';\nimport type {\n OptsFromCommand,\n webhooksEventsResendDef,\n} from '../../../index.ts';\nimport { GlobalOpts } from '../../../context/globalOpts.ts';\nimport { BadArgsError } from '../../../errors.ts';\nimport { useWebhooksManager } from '../../../lib/webhooks.ts';\nimport {\n colorStatus,\n logEventDetail,\n pickEvent,\n resolveWebhookId,\n} from '../shared.ts';\n\nexport const webhooksEventsResendCmd = Effect.fn(\n function* (opts: OptsFromCommand<typeof webhooksEventsResendDef>) {\n const { yes } = yield* GlobalOpts;\n\n const webhookId = yield* resolveWebhookId({\n id: opts.webhookId,\n flagName: '--webhook-id',\n picker: {\n promptText: 'Select a webhook:',\n emptyMessage: 'No webhooks configured.',\n },\n });\n if (!webhookId) return;\n\n let isn = opts.isn;\n if (!isn) {\n if (yes) {\n return yield* BadArgsError.make({ message: 'Must specify --isn' });\n }\n const picked = yield* pickEvent({\n webhookId,\n promptText: 'Select an event to resend:',\n emptyMessage: 'No events for this webhook.',\n });\n if (!picked) return;\n isn = picked.isn;\n }\n\n const event = yield* useWebhooksManager(\n (m) => m.resendEvent(webhookId, isn!),\n 'Error resending event',\n );\n\n yield* Effect.log(`Resent event ${chalk.cyan(event.isn)}`);\n yield* Effect.log(`Status: ${colorStatus(event.status)}`);\n for (const line of logEventDetail(event).slice(1)) {\n yield* Effect.log(line);\n }\n },\n Effect.catchTag('BadArgsError', (e) =>\n Effect.gen(function* () {\n yield* Effect.logError(e.message);\n yield* Effect.log(\n chalk.dim(\n 'hint: run `instant-cli webhook event resend --help` for available arguments',\n ),\n );\n }),\n ),\n);\n"]}
@@ -0,0 +1,8 @@
1
+ import { Effect } from 'effect';
2
+ import type { WebhookInfo } from '@instantdb/platform';
3
+ export declare const renderWebhook: (webhook: WebhookInfo) => Effect.Effect<void, never, never>;
4
+ export declare const webhooksListCmd: (opts: {
5
+ app?: string | undefined;
6
+ json?: true | undefined;
7
+ }) => Effect.Effect<void, import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
8
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,eAAO,MAAM,aAAa,GAAI,SAAS,WAAW,sCAU9C,CAAC;AAEL,eAAO,MAAM,eAAe;;;gOAqB1B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import chalk from 'chalk';
2
+ import { Effect } from 'effect';
3
+ import { useWebhooksManager } from "../../lib/webhooks.js";
4
+ import { joinActions, joinNamespaces } from "./shared.js";
5
+ export const renderWebhook = (webhook) => Effect.gen(function* () {
6
+ yield* Effect.log(chalk.cyan(webhook.sink.url));
7
+ yield* Effect.log(` ID: ${webhook.id}`);
8
+ yield* Effect.log(` Status: ${webhook.status}`);
9
+ yield* Effect.log(` Actions: ${joinActions(webhook.actions)}`);
10
+ yield* Effect.log(` Namespaces: ${joinNamespaces(webhook.namespaces)}`);
11
+ if (webhook.disabledReason) {
12
+ yield* Effect.log(` Disabled reason: ${webhook.disabledReason}`);
13
+ }
14
+ });
15
+ export const webhooksListCmd = Effect.fn(function* (opts) {
16
+ const webhooks = yield* useWebhooksManager((m) => m.list(), 'Error listing webhooks');
17
+ if (opts.json) {
18
+ yield* Effect.log(JSON.stringify(webhooks, null, 2));
19
+ return;
20
+ }
21
+ if (webhooks.length === 0) {
22
+ yield* Effect.log('No webhooks configured.');
23
+ return;
24
+ }
25
+ for (const webhook of webhooks) {
26
+ yield* renderWebhook(webhook);
27
+ }
28
+ });
29
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/webhooks/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAoB,EAAE,EAAE,CACpD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACzC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChE,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACzE,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC3B,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAChD,IAA6C;IAE7C,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,kBAAkB,CACxC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EACf,wBAAwB,CACzB,CAAC;IAEF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACrD,OAAO;IACT,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,KAAK,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { Effect } from 'effect';\nimport type { WebhookInfo } from '@instantdb/platform';\nimport type { OptsFromCommand, webhooksListDef } from '../../index.ts';\nimport { useWebhooksManager } from '../../lib/webhooks.ts';\nimport { joinActions, joinNamespaces } from './shared.ts';\n\nexport const renderWebhook = (webhook: WebhookInfo) =>\n Effect.gen(function* () {\n yield* Effect.log(chalk.cyan(webhook.sink.url));\n yield* Effect.log(` ID: ${webhook.id}`);\n yield* Effect.log(` Status: ${webhook.status}`);\n yield* Effect.log(` Actions: ${joinActions(webhook.actions)}`);\n yield* Effect.log(` Namespaces: ${joinNamespaces(webhook.namespaces)}`);\n if (webhook.disabledReason) {\n yield* Effect.log(` Disabled reason: ${webhook.disabledReason}`);\n }\n });\n\nexport const webhooksListCmd = Effect.fn(function* (\n opts: OptsFromCommand<typeof webhooksListDef>,\n) {\n const webhooks = yield* useWebhooksManager(\n (m) => m.list(),\n 'Error listing webhooks',\n );\n\n if (opts.json) {\n yield* Effect.log(JSON.stringify(webhooks, null, 2));\n return;\n }\n\n if (webhooks.length === 0) {\n yield* Effect.log('No webhooks configured.');\n return;\n }\n\n for (const webhook of webhooks) {\n yield* renderWebhook(webhook);\n }\n});\n"]}
@@ -0,0 +1,40 @@
1
+ import { Effect } from 'effect';
2
+ import type { WebhookEventInfo, WebhookEventStatus, WebhookInfo } from '@instantdb/platform';
3
+ import { GlobalOpts } from '../../context/globalOpts.ts';
4
+ import { BadArgsError } from '../../errors.ts';
5
+ type PickerParams = {
6
+ promptText: string;
7
+ emptyMessage: string;
8
+ filter?: (w: WebhookInfo) => boolean;
9
+ };
10
+ export declare const joinNamespaces: (namespaces: readonly string[]) => string;
11
+ /**
12
+ * Validates a webhook URL: must be non-empty after trim, parse as a URL, and
13
+ * use the `https:` scheme (matches the server's requirement). Returns an error
14
+ * message or undefined. Pass to `Args.prompt({ validate })` for inline
15
+ * feedback, and `Args.validate(...)` to also cover flag-supplied values.
16
+ */
17
+ export declare const validateWebhookUrl: (raw: string) => string | undefined;
18
+ export declare const joinActions: (actions: readonly string[]) => string;
19
+ export declare const resolveWebhookId: (params: {
20
+ id: string | undefined;
21
+ picker: PickerParams;
22
+ flagName?: string;
23
+ }) => Effect.Effect<string | undefined, BadArgsError | import("../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, GlobalOpts | import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
24
+ export declare const logWebhookEvent: (action: string, webhook: WebhookInfo) => Effect.Effect<void, never, never>;
25
+ export declare const colorStatus: (status: WebhookEventStatus) => string;
26
+ export declare const renderEventLabel: (e: WebhookEventInfo) => string;
27
+ export declare const logEventDetail: (e: WebhookEventInfo) => string[];
28
+ export declare const pickEvent: (params: {
29
+ webhookId: string;
30
+ limit?: number;
31
+ promptText: string;
32
+ emptyMessage: string;
33
+ }) => Effect.Effect<WebhookEventInfo | undefined, import("../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
34
+ export declare const resolveWebhook: (params: {
35
+ id: string | undefined;
36
+ picker: PickerParams;
37
+ flagName?: string;
38
+ }) => Effect.Effect<WebhookInfo | undefined, BadArgsError | import("../../lib/ui.ts").UIError | import("effect/ConfigError").ConfigError | import("../../context/platformApi.ts").PlatformApiError, GlobalOpts | import("../../context/authToken.ts").AuthToken | import("../../context/currentApp.ts").CurrentApp>;
39
+ export {};
40
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/shared.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAEV,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,YAAY,SAAS,MAAM,EAAE,WACzB,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAazD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,SAAS,SAAS,M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