@venturekit/notify 0.0.0-dev.20260627215235 → 0.0.0-dev.20260701113915

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,19 +1,19 @@
1
1
  -- @venturekit/notify — initial schema
2
2
  --
3
3
  -- Tables created by this migration:
4
- -- notifications — outbox / audit log
5
- -- notification_preferences — per-(user, channel, category) opt-in
6
- -- notification_event_log — bounce / complaint / delivery events
4
+ -- vk_notifications — outbox / audit log
5
+ -- vk_notification_preferences — per-(user, channel, category) opt-in
6
+ -- vk_notification_event_log — bounce / complaint / delivery events
7
7
  --
8
8
  -- The migration is idempotent (CREATE … IF NOT EXISTS / EXCEPTION
9
- -- WHEN duplicate_object) so re-applying after a partial failure or
10
- -- a Phase 3 rename never breaks the deploy.
9
+ -- WHEN duplicate_object) so re-applying after a partial failure
10
+ -- never breaks the deploy.
11
11
  --
12
- -- Naming: prefixed with `vk_notify_001_` so the bundled-migration
13
- -- runner (which sorts alphabetically) interleaves VentureKit-shipped
14
- -- migrations after the project's own `0xx_*.sql` files. Project SQL
15
- -- using these table names will collide; consumers either let the
16
- -- runner own the schema (recommended) or rename their own tables.
12
+ -- Naming: package-owned tables carry the `vk_` prefix so they never
13
+ -- collide with a consumer project's own tables. The file is prefixed
14
+ -- with `vk_notify_001_` so the bundled-migration runner (which sorts
15
+ -- alphabetically) interleaves VentureKit-shipped migrations after the
16
+ -- project's own `0xx_*.sql` files.
17
17
 
18
18
  -- Channel enum -------------------------------------------------------
19
19
  DO $$ BEGIN
@@ -36,7 +36,7 @@ EXCEPTION
36
36
  END $$;
37
37
 
38
38
  -- Outbox -------------------------------------------------------------
39
- CREATE TABLE IF NOT EXISTS notifications (
39
+ CREATE TABLE IF NOT EXISTS vk_notifications (
40
40
  id TEXT PRIMARY KEY,
41
41
  recipient_user_id TEXT,
42
42
  address TEXT,
@@ -62,21 +62,21 @@ CREATE TABLE IF NOT EXISTS notifications (
62
62
  -- Outbox scanner hot path: claimPending() with status='pending' AND
63
63
  -- (scheduled_for IS NULL OR scheduled_for <= NOW()).
64
64
  CREATE INDEX IF NOT EXISTS notifications_pending_idx
65
- ON notifications (created_at ASC)
65
+ ON vk_notifications (created_at ASC)
66
66
  WHERE status = 'pending';
67
67
 
68
68
  -- Per-user inbox view.
69
69
  CREATE INDEX IF NOT EXISTS notifications_recipient_idx
70
- ON notifications (recipient_user_id, created_at DESC)
70
+ ON vk_notifications (recipient_user_id, created_at DESC)
71
71
  WHERE recipient_user_id IS NOT NULL;
72
72
 
73
73
  -- Bounce/complaint correlation by provider message id.
74
74
  CREATE INDEX IF NOT EXISTS notifications_provider_msg_idx
75
- ON notifications (provider_message_id)
75
+ ON vk_notifications (provider_message_id)
76
76
  WHERE provider_message_id IS NOT NULL;
77
77
 
78
78
  -- Preferences (§6.3) -------------------------------------------------
79
- CREATE TABLE IF NOT EXISTS notification_preferences (
79
+ CREATE TABLE IF NOT EXISTS vk_notification_preferences (
80
80
  user_id TEXT NOT NULL,
81
81
  channel notify_channel NOT NULL,
82
82
  category TEXT NOT NULL,
@@ -86,7 +86,7 @@ CREATE TABLE IF NOT EXISTS notification_preferences (
86
86
  );
87
87
 
88
88
  -- Bounce / complaint / delivery event log ---------------------------
89
- CREATE TABLE IF NOT EXISTS notification_event_log (
89
+ CREATE TABLE IF NOT EXISTS vk_notification_event_log (
90
90
  id TEXT PRIMARY KEY,
91
91
  channel notify_channel NOT NULL,
92
92
  address TEXT NOT NULL,
@@ -101,9 +101,9 @@ CREATE TABLE IF NOT EXISTS notification_event_log (
101
101
  -- A partial unique index ensures one active suppression per
102
102
  -- (channel, address) without restricting historical event rows.
103
103
  CREATE INDEX IF NOT EXISTS notification_event_log_suppress_idx
104
- ON notification_event_log (channel, address)
104
+ ON vk_notification_event_log (channel, address)
105
105
  WHERE suppress = TRUE;
106
106
 
107
107
  CREATE INDEX IF NOT EXISTS notification_event_log_provider_msg_idx
108
- ON notification_event_log (provider_message_id)
108
+ ON vk_notification_event_log (provider_message_id)
109
109
  WHERE provider_message_id IS NOT NULL;
@@ -13,7 +13,6 @@
13
13
  export function createEmailNoopProvider(opts = {}) {
14
14
  const sink = opts.sink ??
15
15
  ((entry) => {
16
- // eslint-disable-next-line no-console
17
16
  console.info('[notify:email-noop]', entry);
18
17
  });
19
18
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"email-noop.js","sourceRoot":"","sources":["../../src/providers/email-noop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwBH,MAAM,UAAU,uBAAuB,CACrC,OAAyB,EAAE;IAE3B,MAAM,IAAI,GACR,IAAI,CAAC,IAAI;QACT,CAAC,CAAC,KAAK,EAAE,EAAE;YACT,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IAEL,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,YAAY;QAElB,KAAK,CAAC,IAAI,CAAC,OAA4B;YACrC,IAAI,CAAC;gBACH,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;gBAChC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;gBAC1B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;aAC3B,CAAC,CAAC;YAEH,OAAO;gBACL,iBAAiB,EAAE,cAAc,OAAO,CAAC,cAAc,EAAE;gBACzD,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,OAAO;aACjB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"email-noop.js","sourceRoot":"","sources":["../../src/providers/email-noop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwBH,MAAM,UAAU,uBAAuB,CACrC,OAAyB,EAAE;IAE3B,MAAM,IAAI,GACR,IAAI,CAAC,IAAI;QACT,CAAC,CAAC,KAAK,EAAE,EAAE;YAET,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IAEL,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,YAAY;QAElB,KAAK,CAAC,IAAI,CAAC,OAA4B;YACrC,IAAI,CAAC;gBACH,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;gBAChC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;gBAC1B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;aAC3B,CAAC,CAAC;YAEH,OAAO;gBACL,iBAAiB,EAAE,cAAc,OAAO,CAAC,cAAc,EAAE;gBACzD,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,OAAO;aACjB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -12,7 +12,6 @@ export function createPushNoopProvider() {
12
12
  channel: 'push',
13
13
  name: 'noop-push',
14
14
  async send(request) {
15
- // eslint-disable-next-line no-console
16
15
  console.info('[notify:push-noop]', {
17
16
  notificationId: request.notificationId,
18
17
  endpoint: request.to,
@@ -1 +1 @@
1
- {"version":3,"file":"push-noop.js","sourceRoot":"","sources":["../../src/providers/push-noop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,WAAW;QAEjB,KAAK,CAAC,IAAI,CAAC,OAA4B;YACrC,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBACjC,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,QAAQ,EAAE,OAAO,CAAC,EAAE;gBACpB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;gBAChC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;aAChD,CAAC,CAAC;YAEH,OAAO;gBACL,iBAAiB,EAAE,aAAa,OAAO,CAAC,cAAc,EAAE;gBACxD,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,MAAM;aAChB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"push-noop.js","sourceRoot":"","sources":["../../src/providers/push-noop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,WAAW;QAEjB,KAAK,CAAC,IAAI,CAAC,OAA4B;YAErC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBACjC,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,QAAQ,EAAE,OAAO,CAAC,EAAE;gBACpB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;gBAChC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;aAChD,CAAC,CAAC;YAEH,OAAO;gBACL,iBAAiB,EAAE,aAAa,OAAO,CAAC,cAAc,EAAE;gBACxD,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,MAAM;aAChB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -24,7 +24,6 @@ export function createSmsNoopProvider() {
24
24
  // Visibility for development & paper trail in production. Body
25
25
  // is clipped to 160 chars to keep log lines bounded — full body
26
26
  // remains in the outbox row.
27
- // eslint-disable-next-line no-console
28
27
  console.info('[notify:sms-noop]', {
29
28
  notificationId: request.notificationId,
30
29
  to: request.to,
@@ -1 +1 @@
1
- {"version":3,"file":"sms-noop.js","sourceRoot":"","sources":["../../src/providers/sms-noop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,UAAU;QAEhB,KAAK,CAAC,IAAI,CAAC,OAA4B;YACrC,+DAA+D;YAC/D,gEAAgE;YAChE,6BAA6B;YAC7B,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE;gBAChC,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;aAChD,CAAC,CAAC;YAEH,OAAO;gBACL,iBAAiB,EAAE,YAAY,OAAO,CAAC,cAAc,EAAE;gBACvD,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,KAAK;aACf,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"sms-noop.js","sourceRoot":"","sources":["../../src/providers/sms-noop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,UAAU;QAEhB,KAAK,CAAC,IAAI,CAAC,OAA4B;YACrC,+DAA+D;YAC/D,gEAAgE;YAChE,6BAA6B;YAE7B,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE;gBAChC,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;aAChD,CAAC,CAAC;YAEH,OAAO;gBACL,iBAAiB,EAAE,YAAY,OAAO,CAAC,cAAc,EAAE;gBACvD,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,KAAK;aACf,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -140,7 +140,7 @@ export function createPostgresNotifyStore(options = {}) {
140
140
  async createNotification(input) {
141
141
  const q = await resolveQuerier();
142
142
  const id = generateId();
143
- const rows = await q(`INSERT INTO notifications (
143
+ const rows = await q(`INSERT INTO vk_notifications (
144
144
  id, recipient_user_id, address, channel, template_key, payload,
145
145
  scheduled_for, related_kind, related_id
146
146
  )
@@ -174,11 +174,11 @@ export function createPostgresNotifyStore(options = {}) {
174
174
  // recovery just retries the row, and the outbox runs at low
175
175
  // enough volume that the duplicate-send risk is acceptable.
176
176
  const q = await resolveQuerier();
177
- const rows = await q(`UPDATE notifications
177
+ const rows = await q(`UPDATE vk_notifications
178
178
  SET scheduled_for = COALESCE(scheduled_for, NOW()),
179
179
  attempts = attempts + 1
180
180
  WHERE id IN (
181
- SELECT id FROM notifications
181
+ SELECT id FROM vk_notifications
182
182
  WHERE status = 'pending'
183
183
  AND (scheduled_for IS NULL OR scheduled_for <= NOW())
184
184
  ORDER BY created_at ASC
@@ -190,7 +190,7 @@ export function createPostgresNotifyStore(options = {}) {
190
190
  },
191
191
  async updateStatus(input) {
192
192
  const q = await resolveQuerier();
193
- const rows = await q(`UPDATE notifications
193
+ const rows = await q(`UPDATE vk_notifications
194
194
  SET status = $1::notify_status,
195
195
  provider_message_id = COALESCE($2, provider_message_id),
196
196
  error = $3,
@@ -208,7 +208,7 @@ export function createPostgresNotifyStore(options = {}) {
208
208
  },
209
209
  async findById(id) {
210
210
  const q = await resolveQuerier();
211
- const rows = await q(`SELECT ${NOTIFICATION_COLUMNS} FROM notifications WHERE id = $1 LIMIT 1`, [id]);
211
+ const rows = await q(`SELECT ${NOTIFICATION_COLUMNS} FROM vk_notifications WHERE id = $1 LIMIT 1`, [id]);
212
212
  return rows[0] ? rowToNotification(rows[0]) : null;
213
213
  },
214
214
  async listForUser(userId, opts = {}) {
@@ -226,7 +226,7 @@ export function createPostgresNotifyStore(options = {}) {
226
226
  }
227
227
  params.push(limit);
228
228
  const rows = await q(`SELECT ${NOTIFICATION_COLUMNS}
229
- FROM notifications
229
+ FROM vk_notifications
230
230
  WHERE ${conds.join(' AND ')}
231
231
  ORDER BY created_at DESC
232
232
  LIMIT $${params.length}`, params);
@@ -259,12 +259,12 @@ export function createPostgresNotifyStore(options = {}) {
259
259
  // Two queries — count + page. The count is unindexed but at admin
260
260
  // volumes (low thousands) this is fine; switch to keyset pagination
261
261
  // before `notifications` exceeds ~1M rows.
262
- const totalRows = await q(`SELECT COUNT(*)::text AS count FROM notifications ${where}`, params);
262
+ const totalRows = await q(`SELECT COUNT(*)::text AS count FROM vk_notifications ${where}`, params);
263
263
  const total = Number(totalRows[0]?.count ?? 0);
264
264
  params.push(limit);
265
265
  params.push(offset);
266
266
  const rows = await q(`SELECT ${NOTIFICATION_COLUMNS}
267
- FROM notifications
267
+ FROM vk_notifications
268
268
  ${where}
269
269
  ORDER BY created_at DESC
270
270
  LIMIT $${params.length - 1} OFFSET $${params.length}`, params);
@@ -272,7 +272,7 @@ export function createPostgresNotifyStore(options = {}) {
272
272
  },
273
273
  async retry(id) {
274
274
  const q = await resolveQuerier();
275
- const rows = await q(`UPDATE notifications
275
+ const rows = await q(`UPDATE vk_notifications
276
276
  SET status = 'pending',
277
277
  error = NULL,
278
278
  scheduled_for = NULL
@@ -282,7 +282,7 @@ export function createPostgresNotifyStore(options = {}) {
282
282
  },
283
283
  async cancel(id) {
284
284
  const q = await resolveQuerier();
285
- const rows = await q(`UPDATE notifications
285
+ const rows = await q(`UPDATE vk_notifications
286
286
  SET status = 'cancelled'
287
287
  WHERE id = $1 AND status = 'pending'
288
288
  RETURNING ${NOTIFICATION_COLUMNS}`, [id]);
@@ -292,14 +292,14 @@ export function createPostgresNotifyStore(options = {}) {
292
292
  async listPreferences(userId) {
293
293
  const q = await resolveQuerier();
294
294
  const rows = await q(`SELECT ${PREFERENCE_COLUMNS}
295
- FROM notification_preferences
295
+ FROM vk_notification_preferences
296
296
  WHERE user_id = $1
297
297
  ORDER BY channel, category`, [userId]);
298
298
  return rows.map(rowToPreference);
299
299
  },
300
300
  async upsertPreference(input) {
301
301
  const q = await resolveQuerier();
302
- const rows = await q(`INSERT INTO notification_preferences (user_id, channel, category, opted_in, updated_at)
302
+ const rows = await q(`INSERT INTO vk_notification_preferences (user_id, channel, category, opted_in, updated_at)
303
303
  VALUES ($1, $2, $3, $4, NOW())
304
304
  ON CONFLICT (user_id, channel, category)
305
305
  DO UPDATE SET opted_in = EXCLUDED.opted_in, updated_at = NOW()
@@ -308,7 +308,7 @@ export function createPostgresNotifyStore(options = {}) {
308
308
  },
309
309
  async isOptedIn(userId, channel, category) {
310
310
  const q = await resolveQuerier();
311
- const rows = await q(`SELECT opted_in FROM notification_preferences
311
+ const rows = await q(`SELECT opted_in FROM vk_notification_preferences
312
312
  WHERE user_id = $1 AND channel = $2 AND category = $3
313
313
  LIMIT 1`, [userId, channel, category]);
314
314
  // No row => default opt-in.
@@ -320,7 +320,7 @@ export function createPostgresNotifyStore(options = {}) {
320
320
  async recordEvent(input) {
321
321
  const q = await resolveQuerier();
322
322
  const id = generateEvtId();
323
- const rows = await q(`INSERT INTO notification_event_log (
323
+ const rows = await q(`INSERT INTO vk_notification_event_log (
324
324
  id, channel, address, event_type, provider_message_id, suppress, raw, received_at
325
325
  )
326
326
  VALUES ($1, $2, $3, $4, $5, $6, $7, NOW())
@@ -338,14 +338,14 @@ export function createPostgresNotifyStore(options = {}) {
338
338
  async isAddressSuppressed(channel, address) {
339
339
  const q = await resolveQuerier();
340
340
  const rows = await q(`SELECT EXISTS(
341
- SELECT 1 FROM notification_event_log
341
+ SELECT 1 FROM vk_notification_event_log
342
342
  WHERE channel = $1 AND address = $2 AND suppress = TRUE
343
343
  ) AS exists`, [channel, address]);
344
344
  return Boolean(rows[0]?.exists);
345
345
  },
346
346
  async clearSuppression(channel, address) {
347
347
  const q = await resolveQuerier();
348
- await q(`UPDATE notification_event_log
348
+ await q(`UPDATE vk_notification_event_log
349
349
  SET suppress = FALSE
350
350
  WHERE channel = $1 AND address = $2 AND suppress = TRUE`, [channel, address]);
351
351
  },
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../src/store/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAiBH,yEAAyE;AAEzE;;;;;;GAMG;AACH,SAAS,kBAAkB;IACzB,MAAM,IAAI,GAAI,UAAyD;SACpE,MAAM,EAAE,UAAU,EAAE,EAAE;WACpB,YAAY,EAAE,CAAC;IACpB,OAAO,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,SAAS,WAAW;IAClB,MAAM,IAAI,GAAI,UAAyD;SACpE,MAAM,EAAE,UAAU,EAAE,EAAE;WACpB,YAAY,EAAE,CAAC;IACpB,OAAO,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,yEAAyE;AACzE,SAAS,YAAY;IACnB,MAAM,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxD,OAAO,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,CA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B,CAAC;YACF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC;QAED,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO;YACrC,MAAM,CAAC,GAAG,MAAM,cAAc,EAAE,CAAC;YACjC,MAAM,CAAC,CACL;;kEAE0D,EAC1D,CAAC,OAAO,EAAE,OAAO,CAAC,CACnB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,27 +1,31 @@
1
1
  {
2
2
  "name": "@venturekit/notify",
3
- "version": "0.0.0-dev.20260627215235",
3
+ "version": "0.0.0-dev.20260701113915",
4
4
  "description": "Transactional notifications for VentureKit — email (SES), WhatsApp (Meta Cloud), with a Postgres outbox + cron dispatcher.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "files": [
9
9
  "dist",
10
- "migrations",
10
+ "src/migrations/*.sql",
11
11
  "runtime"
12
12
  ],
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/venturekit-dev/venturekit.private.git",
15
+ "url": "https://github.com/venturekit-dev/venturekit.git",
16
16
  "directory": "packages/notify"
17
17
  },
18
+ "homepage": "https://venturekit.dev",
19
+ "bugs": {
20
+ "url": "https://github.com/venturekit-dev/venturekit/issues"
21
+ },
18
22
  "publishConfig": {
19
23
  "registry": "https://registry.npmjs.org",
20
24
  "access": "public"
21
25
  },
22
26
  "license": "Apache-2.0",
23
27
  "vk": {
24
- "migrations": "migrations"
28
+ "migrations": "src/migrations"
25
29
  },
26
30
  "exports": {
27
31
  ".": {
@@ -53,7 +57,7 @@
53
57
  "types": "./dist/store/postgres.d.ts"
54
58
  },
55
59
  "./migrations": {
56
- "default": "./migrations"
60
+ "default": "./src/migrations"
57
61
  },
58
62
  "./runtime/dispatcher-stub": {
59
63
  "default": "./runtime/dispatcher-stub.ts"
@@ -72,11 +76,11 @@
72
76
  "outbox"
73
77
  ],
74
78
  "dependencies": {
75
- "@venturekit/core": "0.0.0-dev.20260627215235"
79
+ "@venturekit/core": "0.0.0-dev.20260701113915"
76
80
  },
77
81
  "peerDependencies": {
78
- "@venturekit/data": "0.0.0-dev.20260627215235",
79
- "@venturekit/runtime": "0.0.0-dev.20260627215235",
82
+ "@venturekit/data": "0.0.0-dev.20260701113915",
83
+ "@venturekit/runtime": "0.0.0-dev.20260701113915",
80
84
  "@aws-sdk/client-sesv2": "^3.1068.0",
81
85
  "@aws-sdk/client-secrets-manager": "^3.1068.0"
82
86
  },
@@ -95,8 +99,8 @@
95
99
  }
96
100
  },
97
101
  "devDependencies": {
98
- "@venturekit/data": "0.0.0-dev.20260627215235",
99
- "@venturekit/runtime": "0.0.0-dev.20260627215235",
102
+ "@venturekit/data": "0.0.0-dev.20260701113915",
103
+ "@venturekit/runtime": "0.0.0-dev.20260701113915",
100
104
  "@aws-sdk/client-sesv2": "^3.1068.0",
101
105
  "@aws-sdk/client-secrets-manager": "^3.1068.0",
102
106
  "@types/aws-lambda": "^8.10.131",
@@ -105,7 +109,7 @@
105
109
  "vitest": "^4.1.5"
106
110
  },
107
111
  "scripts": {
108
- "build": "tsc",
112
+ "build": "tsc && node -e \"require('fs').cpSync('src/migrations','dist/migrations',{recursive:true})\"",
109
113
  "dev": "tsc --watch",
110
114
  "clean": "rm -rf dist"
111
115
  }
@@ -0,0 +1,109 @@
1
+ -- @venturekit/notify — initial schema
2
+ --
3
+ -- Tables created by this migration:
4
+ -- vk_notifications — outbox / audit log
5
+ -- vk_notification_preferences — per-(user, channel, category) opt-in
6
+ -- vk_notification_event_log — bounce / complaint / delivery events
7
+ --
8
+ -- The migration is idempotent (CREATE … IF NOT EXISTS / EXCEPTION
9
+ -- WHEN duplicate_object) so re-applying after a partial failure
10
+ -- never breaks the deploy.
11
+ --
12
+ -- Naming: package-owned tables carry the `vk_` prefix so they never
13
+ -- collide with a consumer project's own tables. The file is prefixed
14
+ -- with `vk_notify_001_` so the bundled-migration runner (which sorts
15
+ -- alphabetically) interleaves VentureKit-shipped migrations after the
16
+ -- project's own `0xx_*.sql` files.
17
+
18
+ -- Channel enum -------------------------------------------------------
19
+ DO $$ BEGIN
20
+ CREATE TYPE notify_channel AS ENUM ('email', 'whatsapp', 'sms', 'push');
21
+ EXCEPTION
22
+ WHEN duplicate_object THEN NULL;
23
+ END $$;
24
+
25
+ -- Notification status enum ------------------------------------------
26
+ DO $$ BEGIN
27
+ CREATE TYPE notify_status AS ENUM (
28
+ 'pending',
29
+ 'sent',
30
+ 'failed',
31
+ 'bounced',
32
+ 'cancelled'
33
+ );
34
+ EXCEPTION
35
+ WHEN duplicate_object THEN NULL;
36
+ END $$;
37
+
38
+ -- Outbox -------------------------------------------------------------
39
+ CREATE TABLE IF NOT EXISTS vk_notifications (
40
+ id TEXT PRIMARY KEY,
41
+ recipient_user_id TEXT,
42
+ address TEXT,
43
+ channel notify_channel NOT NULL,
44
+ template_key TEXT NOT NULL,
45
+ payload JSONB NOT NULL DEFAULT '{}'::jsonb,
46
+ status notify_status NOT NULL DEFAULT 'pending',
47
+ scheduled_for TIMESTAMPTZ,
48
+ sent_at TIMESTAMPTZ,
49
+ related_kind TEXT,
50
+ related_id TEXT,
51
+ provider_message_id TEXT,
52
+ error TEXT,
53
+ attempts INTEGER NOT NULL DEFAULT 0,
54
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
55
+ -- One of recipient_user_id or address must be set; both is allowed
56
+ -- (address overrides resolver lookup).
57
+ CONSTRAINT notifications_addressable_chk CHECK (
58
+ recipient_user_id IS NOT NULL OR address IS NOT NULL
59
+ )
60
+ );
61
+
62
+ -- Outbox scanner hot path: claimPending() with status='pending' AND
63
+ -- (scheduled_for IS NULL OR scheduled_for <= NOW()).
64
+ CREATE INDEX IF NOT EXISTS notifications_pending_idx
65
+ ON vk_notifications (created_at ASC)
66
+ WHERE status = 'pending';
67
+
68
+ -- Per-user inbox view.
69
+ CREATE INDEX IF NOT EXISTS notifications_recipient_idx
70
+ ON vk_notifications (recipient_user_id, created_at DESC)
71
+ WHERE recipient_user_id IS NOT NULL;
72
+
73
+ -- Bounce/complaint correlation by provider message id.
74
+ CREATE INDEX IF NOT EXISTS notifications_provider_msg_idx
75
+ ON vk_notifications (provider_message_id)
76
+ WHERE provider_message_id IS NOT NULL;
77
+
78
+ -- Preferences (§6.3) -------------------------------------------------
79
+ CREATE TABLE IF NOT EXISTS vk_notification_preferences (
80
+ user_id TEXT NOT NULL,
81
+ channel notify_channel NOT NULL,
82
+ category TEXT NOT NULL,
83
+ opted_in BOOLEAN NOT NULL DEFAULT TRUE,
84
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
85
+ PRIMARY KEY (user_id, channel, category)
86
+ );
87
+
88
+ -- Bounce / complaint / delivery event log ---------------------------
89
+ CREATE TABLE IF NOT EXISTS vk_notification_event_log (
90
+ id TEXT PRIMARY KEY,
91
+ channel notify_channel NOT NULL,
92
+ address TEXT NOT NULL,
93
+ event_type TEXT NOT NULL,
94
+ provider_message_id TEXT,
95
+ suppress BOOLEAN NOT NULL DEFAULT FALSE,
96
+ raw JSONB NOT NULL DEFAULT '{}'::jsonb,
97
+ received_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
98
+ );
99
+
100
+ -- Suppression lookup hot path: isAddressSuppressed(channel, address).
101
+ -- A partial unique index ensures one active suppression per
102
+ -- (channel, address) without restricting historical event rows.
103
+ CREATE INDEX IF NOT EXISTS notification_event_log_suppress_idx
104
+ ON vk_notification_event_log (channel, address)
105
+ WHERE suppress = TRUE;
106
+
107
+ CREATE INDEX IF NOT EXISTS notification_event_log_provider_msg_idx
108
+ ON vk_notification_event_log (provider_message_id)
109
+ WHERE provider_message_id IS NOT NULL;
package/LICENSE DELETED
@@ -1,191 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to the Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by the Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding any notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- Copyright 2025 VentureKit Contributors
180
-
181
- Licensed under the Apache License, Version 2.0 (the "License");
182
- you may not use this file except in compliance with the License.
183
- You may obtain a copy of the License at
184
-
185
- http://www.apache.org/licenses/LICENSE-2.0
186
-
187
- Unless required by applicable law or agreed to in writing, software
188
- distributed under the License is distributed on an "AS IS" BASIS,
189
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
- See the License for the specific language governing permissions and
191
- limitations under the License.