@voltro/plugin-webhooks 0.1.0

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.
@@ -0,0 +1,93 @@
1
+ import { Schema } from 'effect';
2
+
3
+ /**
4
+ * Thrown by `WebhooksService.replay` when no delivery row exists for the
5
+ * given `deliveryId` — the row can't be re-triggered because the
6
+ * original payload + target are unknown.
7
+ */
8
+ export declare class WebhookDeliveryNotFound extends WebhookDeliveryNotFound_base {
9
+ }
10
+
11
+ declare const WebhookDeliveryNotFound_base: Schema.TaggedErrorClass<WebhookDeliveryNotFound, "WebhookDeliveryNotFound", {
12
+ readonly _tag: Schema.tag<"WebhookDeliveryNotFound">;
13
+ } & {
14
+ /** The delivery id that did not resolve to a row. */
15
+ deliveryId: typeof Schema.String;
16
+ }>;
17
+
18
+ /**
19
+ * Thrown by `WebhooksService.emit` when the payload does not decode
20
+ * against the outgoing event's declared `payload` schema (from its
21
+ * `defineOutgoingEvent` descriptor). The emit is rejected BEFORE any
22
+ * delivery row is written or workflow triggered — a schema-violating
23
+ * payload never reaches a subscriber.
24
+ */
25
+ export declare class WebhookPayloadInvalid extends WebhookPayloadInvalid_base {
26
+ }
27
+
28
+ declare const WebhookPayloadInvalid_base: Schema.TaggedErrorClass<WebhookPayloadInvalid, "WebhookPayloadInvalid", {
29
+ readonly _tag: Schema.tag<"WebhookPayloadInvalid">;
30
+ } & {
31
+ /** The outgoing event id the payload was emitted for. */
32
+ event: typeof Schema.String;
33
+ /** Tree-formatted schema decode issues (one line per violation). */
34
+ issues: typeof Schema.String;
35
+ }>;
36
+
37
+ /**
38
+ * Raised by the delivery workflow's wire-encoder when the target's
39
+ * `format` (`form` | `xml`) cannot honestly represent the payload
40
+ * shape — e.g. a `form` target whose payload is a bare array/scalar
41
+ * (form encoding is a flat key=value list with no top-level array
42
+ * representation), or an `xml` target whose object key is not a valid
43
+ * XML element name. Surfaced BEFORE any wire POST: the delivery row is
44
+ * written `failed` with this reason, so a mis-formatted target never
45
+ * silently ships JSON bytes under a wrong content-type.
46
+ */
47
+ export declare class WebhookPayloadUnrepresentable extends WebhookPayloadUnrepresentable_base {
48
+ }
49
+
50
+ declare const WebhookPayloadUnrepresentable_base: Schema.TaggedErrorClass<WebhookPayloadUnrepresentable, "WebhookPayloadUnrepresentable", {
51
+ readonly _tag: Schema.tag<"WebhookPayloadUnrepresentable">;
52
+ } & {
53
+ /** The wire format that could not represent the payload. */
54
+ format: Schema.Literal<["json", "form", "xml"]>;
55
+ /** Human-readable detail — which shape/key defeated the encoder. */
56
+ reason: typeof Schema.String;
57
+ }>;
58
+
59
+ /**
60
+ * Thrown by `WebhooksService.updateTargetPayloadVersion` when the
61
+ * requested version is not a positive integer.
62
+ */
63
+ export declare class WebhookPayloadVersionInvalid extends WebhookPayloadVersionInvalid_base {
64
+ }
65
+
66
+ declare const WebhookPayloadVersionInvalid_base: Schema.TaggedErrorClass<WebhookPayloadVersionInvalid, "WebhookPayloadVersionInvalid", {
67
+ readonly _tag: Schema.tag<"WebhookPayloadVersionInvalid">;
68
+ } & {
69
+ /** The rejected version value (as supplied by the caller). */
70
+ version: typeof Schema.Number;
71
+ }>;
72
+
73
+ /**
74
+ * Thrown by `WebhooksService.subscribe` (via `validateSubscribe`) when
75
+ * the subscribe input fails a policy check — a non-http(s) URL, a secret
76
+ * shorter than the minimum, a degenerate retry policy, or an
77
+ * out-of-range rate limit. `field` names the offending input field;
78
+ * `reason` is the human-readable detail (carries the offending value).
79
+ */
80
+ export declare class WebhookSubscribeInvalid extends WebhookSubscribeInvalid_base {
81
+ }
82
+
83
+ declare const WebhookSubscribeInvalid_base: Schema.TaggedErrorClass<WebhookSubscribeInvalid, "WebhookSubscribeInvalid", {
84
+ readonly _tag: Schema.tag<"WebhookSubscribeInvalid">;
85
+ } & {
86
+ /** The offending subscribe-input field: `'url'` | `'event'` |
87
+ * `'secret'` | `'retry'` | `'rateLimitPerMinute'`. */
88
+ field: typeof Schema.String;
89
+ /** Human-readable detail, including the offending value. */
90
+ reason: typeof Schema.String;
91
+ }>;
92
+
93
+ export { }
package/dist/errors.js ADDED
@@ -0,0 +1,14 @@
1
+ import { Schema as e } from "effect";
2
+ //#region src/errors.ts
3
+ var t = class extends e.TaggedError()("WebhookSubscribeInvalid", {
4
+ field: e.String,
5
+ reason: e.String
6
+ }) {}, n = class extends e.TaggedError()("WebhookDeliveryNotFound", { deliveryId: e.String }) {}, r = class extends e.TaggedError()("WebhookPayloadVersionInvalid", { version: e.Number }) {}, i = class extends e.TaggedError()("WebhookPayloadInvalid", {
7
+ event: e.String,
8
+ issues: e.String
9
+ }) {}, a = class extends e.TaggedError()("WebhookPayloadUnrepresentable", {
10
+ format: e.Literal("json", "form", "xml"),
11
+ reason: e.String
12
+ }) {};
13
+ //#endregion
14
+ export { n as WebhookDeliveryNotFound, i as WebhookPayloadInvalid, a as WebhookPayloadUnrepresentable, r as WebhookPayloadVersionInvalid, t as WebhookSubscribeInvalid };