@voltro/plugin-webhooks 0.27.0 → 0.29.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.
@@ -5,7 +5,7 @@ property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/plugin-webhooks itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (49 packages).
8
+ Generated from the resolved runtime dependency closure (52 packages).
9
9
 
10
10
  ---
11
11
 
@@ -3956,6 +3956,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3956
3956
  THE SOFTWARE.
3957
3957
  ```
3958
3958
 
3959
+ ## isomorphic.js@0.2.5
3960
+
3961
+ License: MIT
3962
+
3963
+ ```
3964
+ The MIT License (MIT)
3965
+
3966
+ Copyright (c) 2020 Kevin Jahns <kevin.jahns@protonmail.com>.
3967
+
3968
+ Permission is hereby granted, free of charge, to any person obtaining a copy
3969
+ of this software and associated documentation files (the "Software"), to deal
3970
+ in the Software without restriction, including without limitation the rights
3971
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3972
+ copies of the Software, and to permit persons to whom the Software is
3973
+ furnished to do so, subject to the following conditions:
3974
+
3975
+ The above copyright notice and this permission notice shall be included in all
3976
+ copies or substantial portions of the Software.
3977
+
3978
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3979
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3980
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3981
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3982
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3983
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3984
+ SOFTWARE.
3985
+ ```
3986
+
3959
3987
  ## jose@6.2.4
3960
3988
 
3961
3989
  License: MIT
@@ -4018,6 +4046,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4018
4046
  SOFTWARE.
4019
4047
  ```
4020
4048
 
4049
+ ## lib0@0.2.117
4050
+
4051
+ License: MIT
4052
+
4053
+ ```
4054
+ The MIT License (MIT)
4055
+
4056
+ Copyright (c) 2019 Kevin Jahns <kevin.jahns@protonmail.com>.
4057
+
4058
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4059
+ of this software and associated documentation files (the "Software"), to deal
4060
+ in the Software without restriction, including without limitation the rights
4061
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4062
+ copies of the Software, and to permit persons to whom the Software is
4063
+ furnished to do so, subject to the following conditions:
4064
+
4065
+ The above copyright notice and this permission notice shall be included in all
4066
+ copies or substantial portions of the Software.
4067
+
4068
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4069
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4070
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4071
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4072
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4073
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4074
+ SOFTWARE.
4075
+ ```
4076
+
4021
4077
  ## mime@3.0.0
4022
4078
 
4023
4079
  License: MIT
@@ -4566,3 +4622,33 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4566
4622
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4567
4623
  ```
4568
4624
 
4625
+ ## yjs@13.6.31
4626
+
4627
+ License: MIT
4628
+
4629
+ ```
4630
+ The MIT License (MIT)
4631
+
4632
+ Copyright (c) 2023
4633
+ - Kevin Jahns <kevin.jahns@protonmail.com>.
4634
+ - Chair of Computer Science 5 (Databases & Information Systems), RWTH Aachen University, Germany
4635
+
4636
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4637
+ of this software and associated documentation files (the "Software"), to deal
4638
+ in the Software without restriction, including without limitation the rights
4639
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4640
+ copies of the Software, and to permit persons to whom the Software is
4641
+ furnished to do so, subject to the following conditions:
4642
+
4643
+ The above copyright notice and this permission notice shall be included in all
4644
+ copies or substantial portions of the Software.
4645
+
4646
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4647
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4648
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4649
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4650
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4651
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4652
+ SOFTWARE.
4653
+ ```
4654
+
package/dist/index.d.ts CHANGED
@@ -196,6 +196,31 @@ export declare interface DeliverySummary {
196
196
  * Covers ms / s / m / h / d. Default seconds (no suffix). */
197
197
  export declare type DurationLiteral = `${number}${'ms' | 's' | 'm' | 'h' | 'd'}` | `${number}`;
198
198
 
199
+ /**
200
+ * Per-emit scoping.
201
+ *
202
+ * **The outgoing fan-out was NOT tenant-scoped, and this is what closes it.**
203
+ * The service is built once at boot with the app-level store, so the `tenant()`
204
+ * mixin on `_voltro_webhook_targets` had no request subject to scope by — the
205
+ * target lookup was `eq('event', name)` and nothing else. Confinement therefore
206
+ * rested entirely on each target's own `filter`, i.e. on the app remembering.
207
+ *
208
+ * A consumer found this by reading the CLI, and named exactly why it had looked
209
+ * safe: target filters usually predicate on a globally unique app id, so a
210
+ * cross-tenant match is impossible **by accident**. It stopped being accidental
211
+ * for them the moment they introduced a value deliberately equal across teams
212
+ * (a tenant-wide audience marker).
213
+ *
214
+ * `ctx.webhooks` binds this from the request subject, so an emit inside a
215
+ * handler is scoped without the handler saying anything. Absent — a background
216
+ * job, a schedule, a replay — keeps the unscoped behaviour, because there is no
217
+ * tenant to scope BY and refusing would break every system emit.
218
+ */
219
+ export declare interface EmitOptions {
220
+ /** Only deliver to targets of this tenant. Absent ⇒ every target. */
221
+ readonly tenantId?: string | null;
222
+ }
223
+
199
224
  export declare interface EmitResult {
200
225
  /** Stable id matching the row(s) the deliverWebhook workflow
201
226
  * writes to `_voltro_webhook_deliveries`. Use as the foreign
@@ -421,7 +446,7 @@ export declare const isWebhookDescriptor: (value: unknown) => value is WebhookDe
421
446
  * when the target should receive this delivery. Supports the
422
447
  * simple key-path form `'payload.field': value` for v1; future
423
448
  * versions can grow operators ({ gt, lt, in, … }). */
424
- export declare const matchesFilter: (filter: Readonly<Record<string, unknown>> | null, payload: unknown) => boolean;
449
+ export declare const matchesFilter: (filter: WebhookFilter | Readonly<Record<string, unknown>> | null, payload: unknown) => boolean;
425
450
 
426
451
  /**
427
452
  * Build a request handler for a specific `IncomingWebhookDescriptor`.
@@ -636,10 +661,12 @@ export declare interface SubscribeInput {
636
661
  readonly secret?: string;
637
662
  readonly signing?: SignatureScheme;
638
663
  readonly retry?: RetryPolicy;
639
- /** Optional predicate filter — only emits whose payload matches
640
- * this predicate fan-out to this target. The shape mirrors the
641
- * schema-builder's `Predicate` from `@voltro/database`. */
642
- readonly filter?: Readonly<Record<string, unknown>>;
664
+ /**
665
+ * Optional routing filter only emits whose payload matches fan out to this
666
+ * target. See {@link WebhookFilter}: dotted paths into `{ payload }`, a bare
667
+ * value for equality, or `{ eq | in | gt | gte | lt | lte }`.
668
+ */
669
+ readonly filter?: WebhookFilter;
643
670
  /**
644
671
  * Subscribe ONE url to SEVERAL events at once.
645
672
  *
@@ -701,7 +728,7 @@ export declare interface SubscribeResult {
701
728
  export declare interface TargetPatch {
702
729
  readonly url?: string;
703
730
  readonly description?: string | null;
704
- readonly filter?: Readonly<Record<string, unknown>> | null;
731
+ readonly filter?: WebhookFilter | null;
705
732
  readonly scope?: Readonly<Record<string, unknown>> | null;
706
733
  readonly headers?: Readonly<Record<string, string>> | null;
707
734
  readonly rateLimitPerMinute?: number | null;
@@ -1019,6 +1046,24 @@ declare const WebhookDeliveryNotFound_base: Schema.TaggedErrorClass<WebhookDeliv
1019
1046
 
1020
1047
  export declare type WebhookDescriptor = OutgoingEventDescriptor<unknown> | IncomingWebhookDescriptor<unknown> | WebhookProviderDescriptor;
1021
1048
 
1049
+ /**
1050
+ * A target's routing filter: dotted paths INTO the emitted envelope.
1051
+ *
1052
+ * The root is `{ payload }`, so every path starts `payload.` — a path that does
1053
+ * not resolve reads as `undefined` and the comparison fails, which is how a
1054
+ * typo'd path silently routes nothing.
1055
+ */
1056
+ export declare type WebhookFilter = Readonly<Record<string, WebhookFilterValue>>;
1057
+
1058
+ export declare type WebhookFilterValue = string | number | boolean | null | {
1059
+ readonly eq?: string | number | boolean | null;
1060
+ readonly in?: ReadonlyArray<string | number | boolean | null>;
1061
+ readonly gt?: number | string;
1062
+ readonly gte?: number | string;
1063
+ readonly lt?: number | string;
1064
+ readonly lte?: number | string;
1065
+ };
1066
+
1022
1067
  /** Stable identifier for an event or webhook. Drives the database
1023
1068
  * primary key, the inspect endpoint URL, the dashboard listing. Use
1024
1069
  * dotted-camelCase (`order.completed`, `user.signedUp`). */
@@ -1115,7 +1160,7 @@ export declare interface WebhooksServiceShape {
1115
1160
  * discovered-events registry) the payload is DECODED against its
1116
1161
  * schema and a mismatch throws `WebhookPayloadInvalid` before any
1117
1162
  * delivery is created. */
1118
- readonly emit: <P>(event: string | OutgoingEventDescriptor<P> | DeclaredEventLike, payload: P) => Promise<EmitResult>;
1163
+ readonly emit: <P>(event: string | OutgoingEventDescriptor<P> | DeclaredEventLike, payload: P, options?: EmitOptions) => Promise<EmitResult>;
1119
1164
  /** Manual re-trigger for the dashboard's "Replay" button on a
1120
1165
  * failed delivery row. Re-runs the workflow at attempt 1 with
1121
1166
  * the original payload. */