@voltro/plugin-notifications 0.87.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.
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.js CHANGED
@@ -14,7 +14,7 @@ import { EXPO_PUSH_ENDPOINT as ze, expoPushTransport as Be, isExpoPushToken as V
14
14
  import { Context as He, Effect as P, Layer as Ue } from "effect";
15
15
  import { boolean as We, id as F, integer as I, isNotNull as Ge, json as L, registerRetention as R, retentionTtlMsFromEnv as z, table as B, text as V, timestamp as H } from "@voltro/database";
16
16
  import { definePlugin as Ke, pluginInstanceName as qe, publishReactivity as U } from "@voltro/protocol";
17
- //#region src/index.ts
17
+ // src/index.ts
18
18
  var W = B("_voltro_notification_inbox", {
19
19
  id: F({ prefix: "notif" }),
20
20
  subjectId: V(),
@@ -366,5 +366,4 @@ var W = B("_voltro_notification_inbox", {
366
366
  })
367
367
  });
368
368
  };
369
- //#endregion
370
369
  export { De as APNS_HOSTS, Oe as APNS_TOKEN_REJECTIONS, ze as EXPO_PUSH_ENDPOINT, Me as FCM_SCOPE, N as FCM_TOKEN_REJECTIONS, Ne as GOOGLE_TOKEN_URI, we as NOTIFICATION_SEND_EFFECT, X as NotificationService, e as PushTokenRejected, ke as apnsBody, Ae as apnsProviderToken, je as apnsTransport, d as buildNotificationService, t as consoleChannel, n as customChannel, l as dataStoreNotificationStore, T as dataStorePushSubscriptionStore, y as decryptWebPushPayload, Se as defineNotification, K as deliveriesTable, r as emailChannel, b as encryptWebPushPayload, E as endpointHashOf, Te as enqueueNotification, Be as expoPushTransport, Pe as fcmAssertion, Fe as fcmMessage, Ie as fcmSendEndpoint, Le as fcmTransport, x as generateVapidPrivateKey, Y as heldTable, f as inAppChannel, p as inQuietHours, W as inboxTable, Ve as isExpoPushToken, Z as makeSubjectId, u as memoryNotificationStore, D as memoryPushSubscriptionStore, m as minuteOfDayInZone, Ee as notificationOutboxHandler, Ye as notificationsPlugin, Re as parseServiceAccount, G as preferencesTable, i as pushChannel, O as pushSubscriptionsTable, h as quietHoursEnd, J as quietHoursTable, k as resetWebPushStoreForTest, a as resolveChannels, o as richPushOf, Ce as sendNotification, S as sendWebPush, s as smsChannel, q as topicSubscriptionsTable, C as vapidAuthorization, w as vapidPublicKeyFor, j as webPushChannel, M as webPushPublicKey, c as webhookChannel };
package/dist/rpc.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Schema as e } from "effect";
2
2
  import { defineMutation as t, defineQuery as n, reactivityChannel as r } from "@voltro/protocol";
3
- //#region src/rpc.ts
3
+ // src/rpc.ts
4
4
  var i = "@voltro/plugin-notifications", a = r("notifications-inbox"), o = r("notifications-preferences"), s = e.Struct({
5
5
  subjectId: e.String,
6
6
  category: e.String,
@@ -250,5 +250,4 @@ var i = "@voltro/plugin-notifications", a = r("notifications-inbox"), o = r("not
250
250
  }
251
251
  }
252
252
  ];
253
- //#endregion
254
253
  export { i as BASE_NAME, s as ChannelPreferenceSchema, p as archiveDescriptor, b as clearQuietHoursDescriptor, c as inboxDescriptor, a as inboxFeed, f as markAllReadDescriptor, u as markReadDescriptor, d as markUnreadDescriptor, E as notificationsRpcClientImports, h as preferencesDescriptor, o as preferencesFeed, g as setPreferenceDescriptor, y as setQuietHoursDescriptor, _ as subscribeDescriptor, m as unarchiveDescriptor, l as unreadCountDescriptor, v as unsubscribeDescriptor, x as webPushPublicKeyDescriptor, T as webPushRpcClientImports, w as webPushStatusDescriptor, S as webPushSubscribeDescriptor, C as webPushUnsubscribeDescriptor };
@@ -1,5 +1,5 @@
1
1
  import { Schema as e } from "effect";
2
- //#region src/sendNotification.ts
2
+ // src/sendNotification.ts
3
3
  var t = (e) => {
4
4
  if (typeof e == "object" && e) {
5
5
  let t = e;
@@ -38,5 +38,4 @@ var t = (e) => {
38
38
  ...i === void 0 ? {} : { tenantId: i }
39
39
  };
40
40
  };
41
- //#endregion
42
41
  export { t as defaultRecipients, r as sendInputFor, n as sendNotification };
package/dist/service.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolveChannels as e } from "./channels.js";
2
2
  import { randomUUID as t } from "node:crypto";
3
- //#region src/service.ts
3
+ // src/service.ts
4
4
  var n = (e) => ({
5
5
  id: "inApp",
6
6
  deliver: async (n) => {
@@ -242,5 +242,4 @@ var n = (e) => ({
242
242
  tenantId: t[0].send.tenantId ?? null
243
243
  };
244
244
  };
245
- //#endregion
246
245
  export { o as buildNotificationService, n as inAppChannel, i as inQuietHours, r as minuteOfDayInZone, a as quietHoursEnd };
package/dist/store.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { and as e, eq as t, generateId as n, isNull as r, lte as i } from "@voltro/database";
2
- //#region src/store.ts
2
+ // src/store.ts
3
3
  var a = () => {
4
4
  let e = [], t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = [], o = (e) => `${e.subjectId}|${e.category}|${e.channel}`, s = (e, t) => `${e}|${t}`;
5
5
  return {
@@ -299,5 +299,4 @@ var a = () => {
299
299
  }
300
300
  };
301
301
  };
302
- //#endregion
303
302
  export { s as dataStoreNotificationStore, a as memoryNotificationStore };
package/dist/web.js CHANGED
@@ -2,7 +2,7 @@ import { BASE_NAME as e } from "./rpc.js";
2
2
  import { pluginTag as t } from "@voltro/protocol";
3
3
  import { useEffect as n, useState as r } from "react";
4
4
  import { useMutation as i, useSubscription as a } from "@voltro/client";
5
- //#region src/web.ts
5
+ // src/web.ts
6
6
  var o = (n) => t(e, n), s = (e = {}, t = "app") => {
7
7
  let { data: n } = a(t, o("inbox"), e);
8
8
  return n ?? [];
@@ -95,5 +95,4 @@ var o = (n) => t(e, n), s = (e = {}, t = "app") => {
95
95
  clear: () => n.mutate({})
96
96
  };
97
97
  };
98
- //#endregion
99
98
  export { s as useInbox, l as useMarkRead, m as useQuietHours, u as useSetNotificationPreference, d as useTopicSubscription, c as useUnreadCount, p as useWebPush };
package/dist/webPush.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { sendWebPush as e, vapidPublicKeyFor as t } from "./webPushProtocol.js";
2
2
  import { and as n, eq as r, generateId as i, id as a, table as o, text as s, timestamp as c } from "@voltro/database";
3
3
  import { createHash as l, randomBytes as u } from "node:crypto";
4
- //#region src/webPush.ts
4
+ // src/webPush.ts
5
5
  var d = o("_voltro_notification_push_subscriptions", {
6
6
  id: a({ prefix: "notifpush" }),
7
7
  subjectId: s(),
@@ -157,5 +157,4 @@ var d = o("_voltro_notification_push_subscriptions", {
157
157
  }
158
158
  return a;
159
159
  }, D = (e) => t(b(e));
160
- //#endregion
161
160
  export { w as assertWebPushConfigured, v as bindWebPushStore, S as buildPushPayload, h as dataStorePushSubscriptionStore, f as endpointHashOf, p as memoryPushSubscriptionStore, d as pushSubscriptionsTable, y as resetWebPushStoreForTest, b as resolveVapidPrivateKey, _ as webPushCell, C as webPushChannel, D as webPushPublicKey };
@@ -1,5 +1,5 @@
1
1
  import { createCipheriv as e, createDecipheriv as t, createECDH as n, createHmac as r, createPrivateKey as i, randomBytes as a, sign as o, timingSafeEqual as s } from "node:crypto";
2
- //#region src/webPushProtocol.ts
2
+ // src/webPushProtocol.ts
3
3
  var c = (e) => e.toString("base64url"), l = (e) => Buffer.from(e, "base64url"), u = (e, t) => r("sha256", e).update(t).digest(), d = (e, t, n) => u(e, Buffer.concat([t, Buffer.from([1])])).subarray(0, n), f = () => {
4
4
  let e = n("prime256v1");
5
5
  return e.generateKeys(), c(p(e.getPrivateKey()));
@@ -113,5 +113,4 @@ var c = (e) => e.toString("base64url"), l = (e) => Buffer.from(e, "base64url"),
113
113
  let n = Buffer.from(e), r = Buffer.from(t);
114
114
  return n.length === r.length && s(n, r);
115
115
  };
116
- //#endregion
117
116
  export { T as clickTokenMatches, C as decryptWebPushPayload, S as encryptWebPushPayload, f as generateVapidPrivateKey, w as sendWebPush, _ as vapidAuthorization, h as vapidPublicKeyFor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-notifications",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
4
4
  "description": "One unified notification surface — email, Slack/webhook, SMS, push, in-app — with per-subject preference routing, an in-app inbox, and a delivery log. NotificationService + typed routes + useInbox/useUnreadCount hooks.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -49,12 +49,12 @@
49
49
  "node": ">=24.0.0"
50
50
  },
51
51
  "dependencies": {
52
- "@voltro/client": "0.87.0",
53
- "@voltro/database": "0.87.0",
54
- "@voltro/protocol": "0.87.0"
52
+ "@voltro/client": "0.88.0",
53
+ "@voltro/database": "0.88.0",
54
+ "@voltro/protocol": "0.88.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "effect": "4.0.1",
57
+ "effect": "4.1.0",
58
58
  "react": "^19.0.0"
59
59
  },
60
60
  "publishConfig": {