@voltro/plugin-notifications 0.86.0 → 0.88.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.
@@ -1,11 +1,11 @@
1
1
  # Third-Party Notices — @voltro/plugin-notifications
2
2
 
3
- This package uses the open-source software listed below. Each is the
3
+ This package uses the third-party software listed below. Each is the
4
4
  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-notifications itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (10 packages).
8
+ Generated from the resolved runtime dependency closure (8 packages).
9
9
 
10
10
  ---
11
11
 
@@ -93,7 +93,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
93
93
  SOFTWARE.
94
94
  ```
95
95
 
96
- ## @tanstack/react-store@0.11.1
96
+ ## @tanstack/react-store@0.11.2
97
97
 
98
98
  License: MIT
99
99
 
@@ -121,7 +121,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
121
121
  SOFTWARE.
122
122
  ```
123
123
 
124
- ## @tanstack/store@0.11.1
124
+ ## @tanstack/store@0.11.2
125
125
 
126
126
  License: MIT
127
127
 
@@ -149,7 +149,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
149
149
  SOFTWARE.
150
150
  ```
151
151
 
152
- ## jose@6.2.12
152
+ ## jose@6.2.13
153
153
 
154
154
  License: MIT
155
155
 
@@ -177,214 +177,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
177
177
  SOFTWARE.
178
178
  ```
179
179
 
180
- ## typeid-js@1.2.0
181
-
182
- License: Apache-2.0
183
-
184
- ```
185
- Apache License
186
- Version 2.0, January 2004
187
- http://www.apache.org/licenses/
188
-
189
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
190
-
191
- 1. Definitions.
192
-
193
- "License" shall mean the terms and conditions for use, reproduction,
194
- and distribution as defined by Sections 1 through 9 of this document.
195
-
196
- "Licensor" shall mean the copyright owner or entity authorized by
197
- the copyright owner that is granting the License.
198
-
199
- "Legal Entity" shall mean the union of the acting entity and all
200
- other entities that control, are controlled by, or are under common
201
- control with that entity. For the purposes of this definition,
202
- "control" means (i) the power, direct or indirect, to cause the
203
- direction or management of such entity, whether by contract or
204
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
205
- outstanding shares, or (iii) beneficial ownership of such entity.
206
-
207
- "You" (or "Your") shall mean an individual or Legal Entity
208
- exercising permissions granted by this License.
209
-
210
- "Source" form shall mean the preferred form for making modifications,
211
- including but not limited to software source code, documentation
212
- source, and configuration files.
213
-
214
- "Object" form shall mean any form resulting from mechanical
215
- transformation or translation of a Source form, including but
216
- not limited to compiled object code, generated documentation,
217
- and conversions to other media types.
218
-
219
- "Work" shall mean the work of authorship, whether in Source or
220
- Object form, made available under the License, as indicated by a
221
- copyright notice that is included in or attached to the work
222
- (an example is provided in the Appendix below).
223
-
224
- "Derivative Works" shall mean any work, whether in Source or Object
225
- form, that is based on (or derived from) the Work and for which the
226
- editorial revisions, annotations, elaborations, or other modifications
227
- represent, as a whole, an original work of authorship. For the purposes
228
- of this License, Derivative Works shall not include works that remain
229
- separable from, or merely link (or bind by name) to the interfaces of,
230
- the Work and Derivative Works thereof.
231
-
232
- "Contribution" shall mean any work of authorship, including
233
- the original version of the Work and any modifications or additions
234
- to that Work or Derivative Works thereof, that is intentionally
235
- submitted to Licensor for inclusion in the Work by the copyright owner
236
- or by an individual or Legal Entity authorized to submit on behalf of
237
- the copyright owner. For the purposes of this definition, "submitted"
238
- means any form of electronic, verbal, or written communication sent
239
- to the Licensor or its representatives, including but not limited to
240
- communication on electronic mailing lists, source code control systems,
241
- and issue tracking systems that are managed by, or on behalf of, the
242
- Licensor for the purpose of discussing and improving the Work, but
243
- excluding communication that is conspicuously marked or otherwise
244
- designated in writing by the copyright owner as "Not a Contribution."
245
-
246
- "Contributor" shall mean Licensor and any individual or Legal Entity
247
- on behalf of whom a Contribution has been received by Licensor and
248
- subsequently incorporated within the Work.
249
-
250
- 2. Grant of Copyright License. Subject to the terms and conditions of
251
- this License, each Contributor hereby grants to You a perpetual,
252
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
253
- copyright license to reproduce, prepare Derivative Works of,
254
- publicly display, publicly perform, sublicense, and distribute the
255
- Work and such Derivative Works in Source or Object form.
256
-
257
- 3. Grant of Patent License. Subject to the terms and conditions of
258
- this License, each Contributor hereby grants to You a perpetual,
259
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
260
- (except as stated in this section) patent license to make, have made,
261
- use, offer to sell, sell, import, and otherwise transfer the Work,
262
- where such license applies only to those patent claims licensable
263
- by such Contributor that are necessarily infringed by their
264
- Contribution(s) alone or by combination of their Contribution(s)
265
- with the Work to which such Contribution(s) was submitted. If You
266
- institute patent litigation against any entity (including a
267
- cross-claim or counterclaim in a lawsuit) alleging that the Work
268
- or a Contribution incorporated within the Work constitutes direct
269
- or contributory patent infringement, then any patent licenses
270
- granted to You under this License for that Work shall terminate
271
- as of the date such litigation is filed.
272
-
273
- 4. Redistribution. You may reproduce and distribute copies of the
274
- Work or Derivative Works thereof in any medium, with or without
275
- modifications, and in Source or Object form, provided that You
276
- meet the following conditions:
277
-
278
- (a) You must give any other recipients of the Work or
279
- Derivative Works a copy of this License; and
280
-
281
- (b) You must cause any modified files to carry prominent notices
282
- stating that You changed the files; and
283
-
284
- (c) You must retain, in the Source form of any Derivative Works
285
- that You distribute, all copyright, patent, trademark, and
286
- attribution notices from the Source form of the Work,
287
- excluding those notices that do not pertain to any part of
288
- the Derivative Works; and
289
-
290
- (d) If the Work includes a "NOTICE" text file as part of its
291
- distribution, then any Derivative Works that You distribute must
292
- include a readable copy of the attribution notices contained
293
- within such NOTICE file, excluding those notices that do not
294
- pertain to any part of the Derivative Works, in at least one
295
- of the following places: within a NOTICE text file distributed
296
- as part of the Derivative Works; within the Source form or
297
- documentation, if provided along with the Derivative Works; or,
298
- within a display generated by the Derivative Works, if and
299
- wherever such third-party notices normally appear. The contents
300
- of the NOTICE file are for informational purposes only and
301
- do not modify the License. You may add Your own attribution
302
- notices within Derivative Works that You distribute, alongside
303
- or as an addendum to the NOTICE text from the Work, provided
304
- that such additional attribution notices cannot be construed
305
- as modifying the License.
306
-
307
- You may add Your own copyright statement to Your modifications and
308
- may provide additional or different license terms and conditions
309
- for use, reproduction, or distribution of Your modifications, or
310
- for any such Derivative Works as a whole, provided Your use,
311
- reproduction, and distribution of the Work otherwise complies with
312
- the conditions stated in this License.
313
-
314
- 5. Submission of Contributions. Unless You explicitly state otherwise,
315
- any Contribution intentionally submitted for inclusion in the Work
316
- by You to the Licensor shall be under the terms and conditions of
317
- this License, without any additional terms or conditions.
318
- Notwithstanding the above, nothing herein shall supersede or modify
319
- the terms of any separate license agreement you may have executed
320
- with Licensor regarding such Contributions.
321
-
322
- 6. Trademarks. This License does not grant permission to use the trade
323
- names, trademarks, service marks, or product names of the Licensor,
324
- except as required for reasonable and customary use in describing the
325
- origin of the Work and reproducing the content of the NOTICE file.
326
-
327
- 7. Disclaimer of Warranty. Unless required by applicable law or
328
- agreed to in writing, Licensor provides the Work (and each
329
- Contributor provides its Contributions) on an "AS IS" BASIS,
330
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
331
- implied, including, without limitation, any warranties or conditions
332
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
333
- PARTICULAR PURPOSE. You are solely responsible for determining the
334
- appropriateness of using or redistributing the Work and assume any
335
- risks associated with Your exercise of permissions under this License.
336
-
337
- 8. Limitation of Liability. In no event and under no legal theory,
338
- whether in tort (including negligence), contract, or otherwise,
339
- unless required by applicable law (such as deliberate and grossly
340
- negligent acts) or agreed to in writing, shall any Contributor be
341
- liable to You for damages, including any direct, indirect, special,
342
- incidental, or consequential damages of any character arising as a
343
- result of this License or out of the use or inability to use the
344
- Work (including but not limited to damages for loss of goodwill,
345
- work stoppage, computer failure or malfunction, or any and all
346
- other commercial damages or losses), even if such Contributor
347
- has been advised of the possibility of such damages.
348
-
349
- 9. Accepting Warranty or Additional Liability. While redistributing
350
- the Work or Derivative Works thereof, You may choose to offer,
351
- and charge a fee for, acceptance of support, warranty, indemnity,
352
- or other liability obligations and/or rights consistent with this
353
- License. However, in accepting such obligations, You may act only
354
- on Your own behalf and on Your sole responsibility, not on behalf
355
- of any other Contributor, and only if You agree to indemnify,
356
- defend, and hold each Contributor harmless for any liability
357
- incurred by, or claims asserted against, such Contributor by reason
358
- of your accepting any such warranty or additional liability.
359
-
360
- END OF TERMS AND CONDITIONS
361
-
362
- APPENDIX: How to apply the Apache License to your work.
363
-
364
- To apply the Apache License to your work, attach the following
365
- boilerplate notice, with the fields enclosed by brackets "[]"
366
- replaced with your own identifying information. (Don't include
367
- the brackets!) The text should be enclosed in the appropriate
368
- comment syntax for the file format. We also recommend that a
369
- file or class name and description of purpose be included on the
370
- same "printed page" as the copyright notice for easier
371
- identification within third-party archives.
372
-
373
- Copyright [yyyy] [name of copyright owner]
374
-
375
- Licensed under the Apache License, Version 2.0 (the "License");
376
- you may not use this file except in compliance with the License.
377
- You may obtain a copy of the License at
378
-
379
- http://www.apache.org/licenses/LICENSE-2.0
380
-
381
- Unless required by applicable law or agreed to in writing, software
382
- distributed under the License is distributed on an "AS IS" BASIS,
383
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
384
- See the License for the specific language governing permissions and
385
- limitations under the License.
386
- ```
387
-
388
180
  ## ulid@3.0.2
389
181
 
390
182
  License: MIT
@@ -413,7 +205,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
413
205
  SOFTWARE.
414
206
  ```
415
207
 
416
- ## use-sync-external-store@1.6.0
208
+ ## use-sync-external-store@1.7.0
417
209
 
418
210
  License: MIT
419
211
 
@@ -441,19 +233,3 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
441
233
  SOFTWARE.
442
234
  ```
443
235
 
444
- ## uuid@11.1.1
445
-
446
- License: MIT
447
-
448
- ```
449
- The MIT License (MIT)
450
-
451
- Copyright (c) 2010-2020 Robert Kieffer and other contributors
452
-
453
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
454
-
455
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
456
-
457
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
458
- ```
459
-
package/dist/apnsPush.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PushTokenRejected as e } from "./errors.js";
2
2
  import { sign as t } from "node:crypto";
3
- //#region src/apnsPush.ts
3
+ // src/apnsPush.ts
4
4
  var n = {
5
5
  production: "https://api.push.apple.com",
6
6
  sandbox: "https://api.sandbox.push.apple.com"
@@ -93,5 +93,4 @@ var n = {
93
93
  }) : Error(`apns: HTTP ${r.status}${a ? ` — ${a}` : ""}`);
94
94
  };
95
95
  };
96
- //#endregion
97
96
  export { n as APNS_HOSTS, i as APNS_TOKEN_REJECTIONS, s as apnsBody, o as apnsProviderToken, l as apnsTransport };
package/dist/channels.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PushTokenRejected as e } from "./errors.js";
2
- //#region src/channels.ts
2
+ // src/channels.ts
3
3
  var t = () => ({
4
4
  id: "console",
5
5
  deliver: async (e) => {
@@ -88,5 +88,4 @@ var t = () => ({
88
88
  let a = n ? e.filter((e) => n.includes(e)) : [...e], o = new Set(r.filter((e) => e.subjectId === i && e.category === t && e.enabled === !1).map((e) => e.channel));
89
89
  return a.filter((e) => !o.has(e));
90
90
  };
91
- //#endregion
92
91
  export { t as consoleChannel, a as customChannel, r as emailChannel, s as pushChannel, c as resolveChannels, o as richPushOf, i as smsChannel, n as webhookChannel };
package/dist/define.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/define.ts
1
+ // src/define.ts
2
2
  var e = (e) => {
3
3
  if (!e.name || !/^[a-z][a-zA-Z0-9._-]*$/.test(e.name)) throw Error(`defineNotification: name must be a dotted identifier (got ${JSON.stringify(e.name)})`);
4
4
  return {
@@ -11,5 +11,4 @@ var e = (e) => {
11
11
  ...e.channels === void 0 ? {} : { channels: e.channels }
12
12
  };
13
13
  };
14
- //#endregion
15
14
  export { e as defineNotification };
package/dist/durable.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defaultRecipients as e, sendInputFor as t } from "./sendNotification.js";
2
2
  import { Schema as n } from "effect";
3
- //#region src/durable.ts
3
+ // src/durable.ts
4
4
  var r = "voltro.notification.send", i = async (t, i, a) => {
5
5
  let o = n.decodeUnknownSync(i.audience)(a.audience), s = n.is(i.payload)(a.payload) ? n.encodeUnknownSync(i.payload)(a.payload) : (n.decodeUnknownSync(i.payload)(a.payload), a.payload), c = a.recipients ? await a.recipients(o) : e(o), l = [];
6
6
  for (let e of c) {
@@ -38,5 +38,4 @@ var r = "voltro.notification.send", i = async (t, i, a) => {
38
38
  }
39
39
  };
40
40
  };
41
- //#endregion
42
41
  export { r as NOTIFICATION_SEND_EFFECT, i as enqueueNotification, o as notificationOutboxHandler };
package/dist/errors.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { Schema as e } from "effect";
2
- //#region src/errors.ts
2
+ // src/errors.ts
3
3
  var t = class extends e.TaggedError()("PushTokenRejected", {
4
4
  token: e.String,
5
5
  reason: e.String
6
6
  }) {};
7
- //#endregion
8
7
  export { t as PushTokenRejected };
package/dist/expoPush.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PushTokenRejected as e } from "./errors.js";
2
- //#region src/expoPush.ts
2
+ // src/expoPush.ts
3
3
  var t = "https://exp.host/--/api/v2/push/send", n = (e) => /^Expo(nent)?PushToken\[[^\]]+\]$/.test(e), r = (t = {}) => async (r) => {
4
4
  if (!n(r.token)) throw new e({
5
5
  token: r.token,
@@ -31,5 +31,4 @@ var t = "https://exp.host/--/api/v2/push/send", n = (e) => /^Expo(nent)?PushToke
31
31
  reason: s
32
32
  }) : Error(`expo push: ${s ?? "error"}${o.message ? ` — ${o.message}` : ""}`);
33
33
  };
34
- //#endregion
35
34
  export { t as EXPO_PUSH_ENDPOINT, r as expoPushTransport, n as isExpoPushToken };
package/dist/fcmPush.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PushTokenRejected as e } from "./errors.js";
2
2
  import { sign as t } from "node:crypto";
3
- //#region src/fcmPush.ts
3
+ // src/fcmPush.ts
4
4
  var n = "https://www.googleapis.com/auth/firebase.messaging", r = "https://oauth2.googleapis.com/token", i = (e) => `https://fcm.googleapis.com/v1/projects/${encodeURIComponent(e)}/messages:send`, a = /* @__PURE__ */ new Set(["UNREGISTERED", "NOT_FOUND"]), o = (e) => Buffer.from(e).toString("base64url"), s = (e) => {
5
5
  let t;
6
6
  if (typeof e == "string") try {
@@ -78,5 +78,4 @@ var n = "https://www.googleapis.com/auth/firebase.messaging", r = "https://oauth
78
78
  }) : Error(`fcm: HTTP ${n.status}${o ? ` — ${o}` : ""}${i.error?.message ? ` — ${i.error.message}` : ""}`);
79
79
  };
80
80
  };
81
- //#endregion
82
81
  export { n as FCM_SCOPE, a as FCM_TOKEN_REJECTIONS, r as GOOGLE_TOKEN_URI, c as fcmAssertion, l as fcmMessage, i as fcmSendEndpoint, u as fcmTransport, s as parseServiceAccount };
package/dist/index.d.ts CHANGED
@@ -65,6 +65,7 @@ export declare const buildNotificationService: (deps: {
65
65
  * a specific `channels:` list coalesce into one digest per subject per window.
66
66
  * 0 (default) disables digesting — every send goes out immediately. */
67
67
  readonly digestWindowMs?: number;
68
+ readonly deliveryGuards?: Readonly<Record<string, NotificationDeliveryGuard>>;
68
69
  }) => NotificationServiceShape;
69
70
 
70
71
  /** A delivery channel. `id` is the channel key prefs target (e.g. 'email',
@@ -410,6 +411,20 @@ export declare const minuteOfDayInZone: (at: Date, tz: string) => number;
410
411
 
411
412
  export declare const NOTIFICATION_SEND_EFFECT = "voltro.notification.send";
412
413
 
414
+ export declare type NotificationDeliveryGuard = (input: NotificationDeliveryGuardInput) => boolean | Promise<boolean>;
415
+
416
+ export declare interface NotificationDeliveryGuardInput {
417
+ readonly recipientId: string;
418
+ readonly tenantId: string | null;
419
+ readonly payload: Readonly<Record<string, unknown>>;
420
+ }
421
+
422
+ /** Persisted authorization reference; never forwarded to delivery channels. */
423
+ export declare interface NotificationDeliveryGuardRef {
424
+ readonly id: string;
425
+ readonly payload: Readonly<Record<string, unknown>>;
426
+ }
427
+
413
428
  export declare interface NotificationDescriptor<Audience = unknown, Payload = unknown> {
414
429
  readonly _tag: 'VoltroNotification';
415
430
  readonly name: string;
@@ -533,6 +548,8 @@ export declare interface NotificationsPluginOptions {
533
548
  * boundary by the scheduled flush). A send that forces its own `channels:`
534
549
  * bypasses the digest. 0 (default) = every send delivers immediately. */
535
550
  readonly digestWindowMs?: number;
551
+ /** Re-evaluated before actual delivery, including persisted quiet/digest holds. Unknown guards refuse. */
552
+ readonly deliveryGuards?: Readonly<Record<string, NotificationDeliveryGuard>>;
536
553
  /** How often the scheduled flush drains due digest windows + quiet-hours
537
554
  * deferrals. Default 30s. Only runs once the store is bound at boot. */
538
555
  readonly flushIntervalMs?: number;
@@ -839,6 +856,7 @@ export declare const richPushOf: (data: Readonly<Record<string, unknown>> | unde
839
856
 
840
857
  /** What a caller asks to send. `channels` overrides the default routing. */
841
858
  export declare interface SendInput {
859
+ readonly deliveryGuard?: NotificationDeliveryGuardRef;
842
860
  readonly to: string;
843
861
  readonly category: string;
844
862
  readonly title: string;