@venturekit/notify 0.0.46 → 0.0.48

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.
Files changed (79) hide show
  1. package/README.md +127 -3
  2. package/dist/client.d.ts +11 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +118 -13
  5. package/dist/client.js.map +1 -1
  6. package/dist/devices/devices.d.ts +136 -0
  7. package/dist/devices/devices.d.ts.map +1 -0
  8. package/dist/devices/devices.js +179 -0
  9. package/dist/devices/devices.js.map +1 -0
  10. package/dist/devices/index.d.ts +6 -0
  11. package/dist/devices/index.d.ts.map +1 -0
  12. package/dist/devices/index.js +3 -0
  13. package/dist/devices/index.js.map +1 -0
  14. package/dist/devices/push.d.ts +154 -0
  15. package/dist/devices/push.d.ts.map +1 -0
  16. package/dist/devices/push.js +171 -0
  17. package/dist/devices/push.js.map +1 -0
  18. package/dist/dispatcher.d.ts.map +1 -1
  19. package/dist/dispatcher.js +6 -1
  20. package/dist/dispatcher.js.map +1 -1
  21. package/dist/inbox/inbox.d.ts +3 -2
  22. package/dist/inbox/inbox.d.ts.map +1 -1
  23. package/dist/inbox/inbox.js.map +1 -1
  24. package/dist/index.d.ts +4 -2
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +4 -2
  27. package/dist/index.js.map +1 -1
  28. package/dist/migrations/0000_vk_notify_push_devices.sql +73 -0
  29. package/dist/migrations/0000_vk_notify_templates.sql +75 -0
  30. package/dist/migrations/vk_notify_006_dedupe_key.sql +19 -0
  31. package/dist/providers/index.d.ts +3 -1
  32. package/dist/providers/index.d.ts.map +1 -1
  33. package/dist/providers/index.js +3 -1
  34. package/dist/providers/index.js.map +1 -1
  35. package/dist/providers/push-apns.d.ts +117 -0
  36. package/dist/providers/push-apns.d.ts.map +1 -0
  37. package/dist/providers/push-apns.js +279 -0
  38. package/dist/providers/push-apns.js.map +1 -0
  39. package/dist/providers/push-expo.d.ts +3 -1
  40. package/dist/providers/push-expo.d.ts.map +1 -1
  41. package/dist/providers/push-expo.js +5 -3
  42. package/dist/providers/push-expo.js.map +1 -1
  43. package/dist/providers/push-fcm.d.ts +92 -0
  44. package/dist/providers/push-fcm.d.ts.map +1 -0
  45. package/dist/providers/push-fcm.js +299 -0
  46. package/dist/providers/push-fcm.js.map +1 -0
  47. package/dist/providers/types.d.ts +59 -0
  48. package/dist/providers/types.d.ts.map +1 -1
  49. package/dist/providers/types.js +16 -0
  50. package/dist/providers/types.js.map +1 -1
  51. package/dist/querier.d.ts +20 -0
  52. package/dist/querier.d.ts.map +1 -0
  53. package/dist/querier.js +16 -0
  54. package/dist/querier.js.map +1 -0
  55. package/dist/store/index.d.ts +1 -0
  56. package/dist/store/index.d.ts.map +1 -1
  57. package/dist/store/index.js +1 -0
  58. package/dist/store/index.js.map +1 -1
  59. package/dist/store/postgres.d.ts.map +1 -1
  60. package/dist/store/postgres.js +23 -4
  61. package/dist/store/postgres.js.map +1 -1
  62. package/dist/store/types.d.ts +18 -1
  63. package/dist/store/types.d.ts.map +1 -1
  64. package/dist/store/types.js +14 -1
  65. package/dist/store/types.js.map +1 -1
  66. package/dist/templates/index.d.ts +5 -0
  67. package/dist/templates/index.d.ts.map +1 -0
  68. package/dist/templates/index.js +3 -0
  69. package/dist/templates/index.js.map +1 -0
  70. package/dist/templates/stored.d.ts +200 -0
  71. package/dist/templates/stored.d.ts.map +1 -0
  72. package/dist/templates/stored.js +248 -0
  73. package/dist/templates/stored.js.map +1 -0
  74. package/dist/types.d.ts +22 -0
  75. package/dist/types.d.ts.map +1 -1
  76. package/package.json +22 -6
  77. package/src/migrations/0000_vk_notify_push_devices.sql +73 -0
  78. package/src/migrations/0000_vk_notify_templates.sql +75 -0
  79. package/src/migrations/vk_notify_006_dedupe_key.sql +19 -0
@@ -1 +1 @@
1
- {"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/inbox/inbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;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B,CAAC,CAAC;IAC3D,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;aAC1D,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,OAAO,CACxB,4CAA4C,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAC9E,MAAM,CACP,CAAC;IACF,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAgB,EAChB,UAAoE,EAAE;IAEtE,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;IAC7C,MAAM,UAAU,GAAG,CAAC,0EAA0E,CAAC,CAAC;IAChG,MAAM,MAAM,GAAc,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACzC,UAAU,CAAC,IAAI,CAAC,oEAAoE,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IACzG,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,OAAO,CACxB,4CAA4C,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAClF,MAAM,CACP,CAAC;IACF,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -54,8 +54,10 @@
54
54
  export type { NotifyChannel, NotificationStatus, NotifyAddress, NotificationRow, NotificationPreferenceRow, NotificationEventLogRow, EnqueueInput, EnqueueResult, SendNowInput, SendNowResult, RenderedMessage, NotifyTemplate, NotifyBudget, BudgetRequest, BudgetReservation, } from './types.js';
55
55
  export { createNotifyClient, type NotifyClient, type CreateNotifyClientOptions, type AddressResolver, } from './client.js';
56
56
  export { createTemplateRegistry, TemplateNotFoundError, type TemplateRegistry, } from './templates/registry.js';
57
- export { createPostgresNotifyStore, type CreatePostgresNotifyStoreOptions, type NotifyStore, type CreateNotificationInput, type UpdateNotificationStatusInput, type ListForUserOptions, type AdminListOptions, } from './store/index.js';
58
- export { ProviderHardError, ProviderSendError, type NotifyProvider, type ProviderSendRequest, type ProviderSendResult, createSesEmailProvider, type SesEmailProviderConfig, __resetSesClientForTests, createMetaWhatsAppProvider, createSecretsTokenResolver, type MetaWhatsAppProvider, type MetaWhatsAppProviderConfig, type WhatsAppTemplateCategory, type WhatsAppTemplateCategoryReported, type WhatsAppTemplateStatus, type WhatsAppTemplateRejectedReason, type WhatsAppTemplateComponent, type WhatsAppTemplateInput, type WhatsAppTemplateCreateResult, type WhatsAppTemplateStatusResult, type WhatsAppTemplateUpdateInput, type WhatsAppTemplateUpdateResult, type WhatsAppTemplateDeleteInput, type WhatsAppTemplateDeleteResult, toMetaLanguage, fromMetaLanguage, DEFAULT_META_LANGUAGE_MAP, metaTemplateParameter, metaTemplateBody, normalizeMetaCategory, metaCategoryCost, META_TEMPLATE_BODY_MAX, META_FLAT_COSTS, type MetaTemplateTextParameter, type MetaTemplateBodyComponent, type MetaCategoryCosts, verifyMetaWebhookSignature, handleMetaWebhookVerification, parseMetaWebhookEvents, MetaWebhookSignatureError, MetaWebhookVerificationError, MetaWebhookPayloadError, META_SIGNATURE_HEADER, type VerifyMetaWebhookSignatureInput, type HandleMetaWebhookVerificationInput, type MetaWebhookQuery, type MetaWebhookEvent, type MetaTemplateWebhookEventBase, type MetaTemplateCategoryChangedEvent, type MetaTemplateCategoryChangeScheduledEvent, type MetaTemplateStatusUpdatedEvent, type MetaUnknownWebhookEvent, type WhatsAppTemplateStatusEvent, createMetaWhatsAppWebhookHandler, type MetaWhatsAppWebhookHandler, type MetaWhatsAppWebhookHandlerConfig, WHATSAPP_APP_SECRET_ENV, WHATSAPP_VERIFY_TOKEN_SECRET_ENV, createSmsNoopProvider, createPushNoopProvider, createEmailNoopProvider, type EmailNoopOptions, createMailHogProvider, type MailHogProviderConfig, } from './providers/index.js';
57
+ export type { PushDeviceDirectory } from './devices/devices.js';
58
+ export type { Querier as NotifyQuerier } from './querier.js';
59
+ export { createPostgresNotifyStore, DuplicateNotificationError, type CreatePostgresNotifyStoreOptions, type NotifyStore, type CreateNotificationInput, type UpdateNotificationStatusInput, type ListForUserOptions, type AdminListOptions, } from './store/index.js';
60
+ export { ProviderHardError, ProviderSendError, PushDeviceGoneError, type NotifyProvider, type ProviderSendRequest, type ProviderSendResult, createSesEmailProvider, type SesEmailProviderConfig, __resetSesClientForTests, createMetaWhatsAppProvider, createSecretsTokenResolver, type MetaWhatsAppProvider, type MetaWhatsAppProviderConfig, type WhatsAppTemplateCategory, type WhatsAppTemplateCategoryReported, type WhatsAppTemplateStatus, type WhatsAppTemplateRejectedReason, type WhatsAppTemplateComponent, type WhatsAppTemplateInput, type WhatsAppTemplateCreateResult, type WhatsAppTemplateStatusResult, type WhatsAppTemplateUpdateInput, type WhatsAppTemplateUpdateResult, type WhatsAppTemplateDeleteInput, type WhatsAppTemplateDeleteResult, toMetaLanguage, fromMetaLanguage, DEFAULT_META_LANGUAGE_MAP, metaTemplateParameter, metaTemplateBody, normalizeMetaCategory, metaCategoryCost, META_TEMPLATE_BODY_MAX, META_FLAT_COSTS, type MetaTemplateTextParameter, type MetaTemplateBodyComponent, type MetaCategoryCosts, verifyMetaWebhookSignature, handleMetaWebhookVerification, parseMetaWebhookEvents, MetaWebhookSignatureError, MetaWebhookVerificationError, MetaWebhookPayloadError, META_SIGNATURE_HEADER, type VerifyMetaWebhookSignatureInput, type HandleMetaWebhookVerificationInput, type MetaWebhookQuery, type MetaWebhookEvent, type MetaTemplateWebhookEventBase, type MetaTemplateCategoryChangedEvent, type MetaTemplateCategoryChangeScheduledEvent, type MetaTemplateStatusUpdatedEvent, type MetaUnknownWebhookEvent, type WhatsAppTemplateStatusEvent, createMetaWhatsAppWebhookHandler, type MetaWhatsAppWebhookHandler, type MetaWhatsAppWebhookHandlerConfig, WHATSAPP_APP_SECRET_ENV, WHATSAPP_VERIFY_TOKEN_SECRET_ENV, createSmsNoopProvider, createPushNoopProvider, createEmailNoopProvider, type EmailNoopOptions, createMailHogProvider, type MailHogProviderConfig, } from './providers/index.js';
59
61
  export { dispatchOnce, makeDispatchHandler, type DispatchOutcome, type DispatchSummary, type DispatchOnceOptions, } from './dispatcher.js';
60
62
  export { makeBounceHandler, type BounceHandlerOutcome, } from './bounce-handler.js';
61
63
  export { adminListNotifications, adminGetNotification, adminSendNotification, adminRetryNotification, adminCancelNotification, adminClearSuppression, listUserPreferences, upsertUserPreference, listNotificationsForUser, type AdminListResult, type AdminSendInput, } from './admin/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAGH,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,gBAAgB,GACtB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,yBAAyB,EACzB,KAAK,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B,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,iBAAiB,EACjB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -54,11 +54,13 @@
54
54
  // Client ------------------------------------------------------------
55
55
  export { createNotifyClient, } from './client.js';
56
56
  // Templates ---------------------------------------------------------
57
+ // (Templates stored as data — defaults, tenants' copies, approval — are
58
+ // `@venturekit/notify/templates`; push devices are `@venturekit/notify/devices`.)
57
59
  export { createTemplateRegistry, TemplateNotFoundError, } from './templates/registry.js';
58
60
  // Store -------------------------------------------------------------
59
- export { createPostgresNotifyStore, } from './store/index.js';
61
+ export { createPostgresNotifyStore, DuplicateNotificationError, } from './store/index.js';
60
62
  // Providers ---------------------------------------------------------
61
- export { ProviderHardError, ProviderSendError, createSesEmailProvider, __resetSesClientForTests, createMetaWhatsAppProvider, createSecretsTokenResolver, toMetaLanguage, fromMetaLanguage, DEFAULT_META_LANGUAGE_MAP, metaTemplateParameter, metaTemplateBody, normalizeMetaCategory, metaCategoryCost, META_TEMPLATE_BODY_MAX, META_FLAT_COSTS, verifyMetaWebhookSignature, handleMetaWebhookVerification, parseMetaWebhookEvents, MetaWebhookSignatureError, MetaWebhookVerificationError, MetaWebhookPayloadError, META_SIGNATURE_HEADER, createMetaWhatsAppWebhookHandler, WHATSAPP_APP_SECRET_ENV, WHATSAPP_VERIFY_TOKEN_SECRET_ENV, createSmsNoopProvider, createPushNoopProvider, createEmailNoopProvider, createMailHogProvider, } from './providers/index.js';
63
+ export { ProviderHardError, ProviderSendError, PushDeviceGoneError, createSesEmailProvider, __resetSesClientForTests, createMetaWhatsAppProvider, createSecretsTokenResolver, toMetaLanguage, fromMetaLanguage, DEFAULT_META_LANGUAGE_MAP, metaTemplateParameter, metaTemplateBody, normalizeMetaCategory, metaCategoryCost, META_TEMPLATE_BODY_MAX, META_FLAT_COSTS, verifyMetaWebhookSignature, handleMetaWebhookVerification, parseMetaWebhookEvents, MetaWebhookSignatureError, MetaWebhookVerificationError, MetaWebhookPayloadError, META_SIGNATURE_HEADER, createMetaWhatsAppWebhookHandler, WHATSAPP_APP_SECRET_ENV, WHATSAPP_VERIFY_TOKEN_SECRET_ENV, createSmsNoopProvider, createPushNoopProvider, createEmailNoopProvider, createMailHogProvider, } from './providers/index.js';
62
64
  // Dispatcher --------------------------------------------------------
63
65
  export { dispatchOnce, makeDispatchHandler, } from './dispatcher.js';
64
66
  // Bounce handler ----------------------------------------------------
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAqBH,sEAAsE;AACtE,OAAO,EACL,kBAAkB,GAInB,MAAM,aAAa,CAAC;AAErB,sEAAsE;AACtE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAEjC,sEAAsE;AACtE,OAAO,EACL,yBAAyB,GAO1B,MAAM,kBAAkB,CAAC;AAE1B,sEAAsE;AACtE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAIjB,sBAAsB,EAEtB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAe1B,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,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gB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EAIf,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EAWrB,gCAAgC,EAGhC,uBAAuB,EACvB,gCAAgC,EAChC,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EAEvB,qBAAqB,GAEtB,MAAM,sBAAsB,CAAC;AAE9B,sEAAsE;AACtE,OAAO,EACL,YAAY,EACZ,mBAAmB,GAIpB,MAAM,iBAAiB,CAAC;AAEzB,sEAAsE;AACtE,OAAO,EACL,iBAAiB,GAElB,MAAM,qBAAqB,CAAC;AAE7B,sEAAsE;AACtE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,GAGzB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,73 @@
1
+ -- @venturekit/notify — the phones a person can be pushed to.
2
+ --
3
+ -- Tables created by this migration:
4
+ -- vk_push_devices — one row per (tenant, push token): whose it is, which app, live or revoked
5
+ --
6
+ -- # Why the package owns it
7
+ --
8
+ -- Push is the one channel whose address the person does not type and the product cannot
9
+ -- look up: the app hands its token over when it is signed in, the token changes when the
10
+ -- app is reinstalled, a phone passes from one person to another, and the provider says when
11
+ -- a token is dead. Every product with an app wrote this table, the register / revoke routes
12
+ -- and the "revoke what Expo says is gone" loop for itself, and the copies differed in the one
13
+ -- place that matters — what happens to a token that changed hands. `devices/` is the one
14
+ -- implementation; `pushToUsers` and the outbox's fan-out (`createNotifyClient({ pushDevices })`)
15
+ -- read it.
16
+ --
17
+ -- # Shape
18
+ --
19
+ -- * `token` is the key, per tenant: Expo hands the same token back on every launch, so a
20
+ -- re-registration is a `last_seen_at`, and a token registered by someone else is RE-POINTED
21
+ -- to them (the phone was handed over) rather than duplicated. "No tenant" is one key
22
+ -- (`COALESCE` to the nil uuid), so a product without tenants gets one row per token too.
23
+ -- * `user_id` is whatever the product names a person by (a platform user id, a profile id),
24
+ -- TEXT like `vk_inbox_notifications.user_id`.
25
+ -- * `tenant_id` is `uuid`, like `vk_tenants.id` and `vk_tenant_scope()`, so a multi-tenant
26
+ -- project guards this table the way it guards its own:
27
+ -- SELECT vk_install_tenant_guards('public', 'vk_push_devices', '<tenant role>');
28
+ -- NULL is a device outside any tenant (a platform's own staff).
29
+ -- * Revoked, never deleted, so "why does my phone not ring" has an answer
30
+ -- (`revoked_reason`); `prunePushDevices` deletes what has been revoked long enough, and
31
+ -- `forgetPushDevices` deletes a person's rows outright for an erasure request.
32
+ --
33
+ -- # Why the `0000_` filename prefix
34
+ --
35
+ -- The runner applies every installed package's files and the project's own in one
36
+ -- alphabetic order, which puts `vk_notify_00N_*` after a project's `0xx_*` files. A project
37
+ -- adopting this table needs its own migration to run AFTER it — to install its tenant guards
38
+ -- on it, to add a foreign key to its tenants, to copy the rows of the table it replaces — so
39
+ -- this file takes the same one-character departure as `@venturekit/data`'s
40
+ -- `0000_vk_data_foundation.sql`. It depends on nothing a later migration creates
41
+ -- (`gen_random_uuid()` is core Postgres from 13), and an existing database simply gains the
42
+ -- table on its next migrate.
43
+
44
+ CREATE TABLE IF NOT EXISTS vk_push_devices (
45
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
46
+ tenant_id uuid,
47
+ user_id text NOT NULL CHECK (length(user_id) BETWEEN 1 AND 200),
48
+ token text NOT NULL CHECK (length(token) BETWEEN 8 AND 512),
49
+ provider text NOT NULL DEFAULT 'expo' CHECK (provider ~ '^[a-z][a-z0-9_-]{0,31}$'),
50
+ platform text NOT NULL CHECK (platform IN ('ios', 'android', 'web')),
51
+ -- Which of the product's apps registered it, when it has several (a parent app, a crew app).
52
+ app text CHECK (app IS NULL OR length(app) BETWEEN 1 AND 64),
53
+ locale text CHECK (locale IS NULL OR length(locale) BETWEEN 2 AND 35),
54
+ created_at timestamptz NOT NULL DEFAULT now(),
55
+ last_seen_at timestamptz NOT NULL DEFAULT now(),
56
+ revoked_at timestamptz,
57
+ -- signed_out: the person signed out on it; device_gone: the provider said the token is dead;
58
+ -- user_removed: the person's account went; stale: not seen for longer than the product keeps tokens.
59
+ revoked_reason text CHECK (revoked_reason IN ('signed_out', 'device_gone', 'user_removed', 'stale')),
60
+ CONSTRAINT vk_push_devices_revocation_chk CHECK ((revoked_at IS NULL) = (revoked_reason IS NULL))
61
+ );
62
+
63
+ -- The key: one row per token per tenant (the upsert target of `registerPushDevice`).
64
+ CREATE UNIQUE INDEX IF NOT EXISTS vk_push_devices_token_uidx
65
+ ON vk_push_devices ((COALESCE(tenant_id, '00000000-0000-0000-0000-000000000000'::uuid)), token);
66
+
67
+ -- A person's live phones — what every send reads.
68
+ CREATE INDEX IF NOT EXISTS vk_push_devices_live_idx
69
+ ON vk_push_devices (user_id, tenant_id)
70
+ WHERE revoked_at IS NULL;
71
+
72
+ COMMENT ON TABLE vk_push_devices IS
73
+ 'Push tokens per person (one per tenant and token; revoked, never deleted). Structure owned by @venturekit/notify; written through its devices helpers.';
@@ -0,0 +1,75 @@
1
+ -- @venturekit/notify — templates stored as data: the product's defaults and each tenant's own.
2
+ --
3
+ -- Tables created by this migration:
4
+ -- vk_notification_templates — versions of a template per (tenant, key, locale)
5
+ --
6
+ -- # Why the package owns it
7
+ --
8
+ -- `NotifyTemplate.render` is code, which is right for a message the developers own and wrong
9
+ -- for one a customer edits in a form (`policy/string-templates.ts` says as much, and ships
10
+ -- the renderer for the data-shaped half). This is the storage that renderer was missing — the
11
+ -- "Phase 2" the registry has promised — and every product that let a tenant reword a message
12
+ -- had written it: defaults shipped by the product, a tenant's own copy, drafts, an approval,
13
+ -- versions kept so what went out can be read back. `templates/` is the one implementation.
14
+ --
15
+ -- # Shape
16
+ --
17
+ -- * A row with `tenant_id` NULL is the product's DEFAULT for a key in a locale; a row with a
18
+ -- tenant is that tenant's COPY. The send path reads approved rows only, the tenant's copy
19
+ -- first (`resolveStoredTemplate`).
20
+ -- * `approved_at` NULL is a DRAFT. An approved row is never changed again: rewording it writes
21
+ -- the next `version`, itself a draft, so a message that went out under version 2 can always
22
+ -- be read back. At most one draft per (tenant, key, locale) — the partial unique index.
23
+ -- * `variables` are the placeholders the author declared (`{child_name}`); approval refuses a
24
+ -- text that uses one it did not declare (`undeclaredPlaceholders`). A tenant's copy inherits
25
+ -- its default's set: it cannot invent a placeholder the sender never fills.
26
+ -- * `overridable` false on a default: the product's own words, which no tenant may replace
27
+ -- (an operator notice, a legal text). Meaningless on a tenant's row.
28
+ -- * `category` is the product's grouping (preferences, approval rights), free text here; a
29
+ -- project that has a fixed set adds its CHECK.
30
+ -- * `tenant_id` is `uuid` (see `0000_vk_notify_push_devices.sql`). Defaults must stay readable by
31
+ -- every tenant, so the standard `vk_install_tenant_guards` policy (which hides NULL tenants)
32
+ -- is not the one to install here: read `tenant_id IS NULL OR tenant_id = ANY
33
+ -- (vk_tenant_scope())`, write `tenant_id = vk_acting_tenant()` — the project's migration, as
34
+ -- it names its own role.
35
+ --
36
+ -- # Why the `0000_` filename prefix
37
+ --
38
+ -- Same as `0000_vk_notify_push_devices.sql`: a project's own migration installs its policy and
39
+ -- foreign key on this table, seeds its defaults into it and copies the rows of the table it
40
+ -- replaces, so the table must exist before the project's files run.
41
+
42
+ CREATE TABLE IF NOT EXISTS vk_notification_templates (
43
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
44
+ tenant_id uuid,
45
+ key text NOT NULL CHECK (key ~ '^[A-Za-z0-9][A-Za-z0-9_.:-]{0,119}$'),
46
+ locale text NOT NULL CHECK (locale ~ '^[A-Za-z]{2,3}([_-][A-Za-z0-9]{2,8})*$'),
47
+ version integer NOT NULL DEFAULT 1 CHECK (version >= 1),
48
+ category text CHECK (category IS NULL OR length(category) BETWEEN 1 AND 64),
49
+ title text NOT NULL,
50
+ body text NOT NULL,
51
+ variables text[] NOT NULL DEFAULT '{}',
52
+ overridable boolean NOT NULL DEFAULT true,
53
+ approved_at timestamptz,
54
+ approved_by text,
55
+ created_by text,
56
+ created_at timestamptz NOT NULL DEFAULT now(),
57
+ updated_at timestamptz NOT NULL DEFAULT now()
58
+ );
59
+
60
+ -- One row per version.
61
+ CREATE UNIQUE INDEX IF NOT EXISTS vk_notification_templates_version_uidx
62
+ ON vk_notification_templates ((COALESCE(tenant_id, '00000000-0000-0000-0000-000000000000'::uuid)), key, locale, version);
63
+
64
+ -- At most one draft per (tenant, key, locale): rewording edits it in place.
65
+ CREATE UNIQUE INDEX IF NOT EXISTS vk_notification_templates_draft_uidx
66
+ ON vk_notification_templates ((COALESCE(tenant_id, '00000000-0000-0000-0000-000000000000'::uuid)), key, locale)
67
+ WHERE approved_at IS NULL;
68
+
69
+ -- The send path: a key's approved versions, the default's and one tenant's.
70
+ CREATE INDEX IF NOT EXISTS vk_notification_templates_approved_idx
71
+ ON vk_notification_templates (key, tenant_id, locale, version DESC)
72
+ WHERE approved_at IS NOT NULL;
73
+
74
+ COMMENT ON TABLE vk_notification_templates IS
75
+ 'Stored templates: the product''s defaults (tenant NULL) and tenants'' copies, versioned, draft until approved. Structure owned by @venturekit/notify; written through its templates helpers.';
@@ -0,0 +1,19 @@
1
+ -- @venturekit/notify — an outbox row once per key.
2
+ --
3
+ -- A message that must go out once however often the code that sends it runs — a weekly digest
4
+ -- retried by its cron, a webhook delivered twice, a request replayed — had nothing to hold on to:
5
+ -- the outbox took every enqueue as a new row. Products wrote the guard themselves (an advisory
6
+ -- lock and a scan of `related_kind` / `related_id`), each a little differently. Now
7
+ -- `enqueue({ dedupeKey })` writes the row only if no row holds that key yet; a second call gets
8
+ -- the earlier row back (`EnqueueResult.duplicate`), and two calls at once cannot both write, since
9
+ -- this index decides.
10
+ --
11
+ -- The key is the caller's and global to the table (`vk_notifications` has no tenant): a
12
+ -- multi-tenant product puts the tenant in it. NULL — every row written before, and every enqueue
13
+ -- without a key — is never a duplicate. Additive: no existing row or file changes.
14
+
15
+ ALTER TABLE vk_notifications ADD COLUMN IF NOT EXISTS dedupe_key TEXT;
16
+
17
+ CREATE UNIQUE INDEX IF NOT EXISTS notifications_dedupe_key_uidx
18
+ ON vk_notifications (dedupe_key)
19
+ WHERE dedupe_key IS NOT NULL;
@@ -11,13 +11,15 @@
11
11
  * // ↑ direct subpath — useful when bundling and you want
12
12
  * // precise tree-shaking control.
13
13
  */
14
- export { ProviderHardError, ProviderSendError, type NotifyProvider, type ProviderSendRequest, type ProviderSendResult, } from './types.js';
14
+ export { ProviderHardError, ProviderSendError, PushDeviceGoneError, type NotifyProvider, type ProviderSendRequest, type ProviderSendResult, type PushSendMessage, type PushSendOutcome, type PushPayloadFormat, } from './types.js';
15
15
  export { createSesEmailProvider, type SesEmailProviderConfig, __resetSesClientForTests, } from './email-ses.js';
16
16
  export { createMetaWhatsAppProvider, createSecretsTokenResolver, type MetaWhatsAppProvider, type MetaWhatsAppProviderConfig, type WhatsAppTemplateCategory, type WhatsAppTemplateCategoryReported, type WhatsAppTemplateStatus, type WhatsAppTemplateRejectedReason, type WhatsAppTemplateComponent, type WhatsAppTemplateInput, type WhatsAppTemplateCreateResult, type WhatsAppTemplateStatusResult, type WhatsAppTemplateUpdateInput, type WhatsAppTemplateUpdateResult, type WhatsAppTemplateDeleteInput, type WhatsAppTemplateDeleteResult, } from './whatsapp-meta.js';
17
17
  export { toMetaLanguage, fromMetaLanguage, DEFAULT_META_LANGUAGE_MAP, } from './whatsapp-meta-language.js';
18
18
  export { metaTemplateParameter, metaTemplateBody, normalizeMetaCategory, metaCategoryCost, META_TEMPLATE_BODY_MAX, META_FLAT_COSTS, type MetaTemplateTextParameter, type MetaTemplateBodyComponent, type MetaCategoryCosts, } from './whatsapp-meta-template.js';
19
19
  export { verifyMetaWebhookSignature, handleMetaWebhookVerification, parseMetaWebhookEvents, MetaWebhookSignatureError, MetaWebhookVerificationError, MetaWebhookPayloadError, META_SIGNATURE_HEADER, type VerifyMetaWebhookSignatureInput, type HandleMetaWebhookVerificationInput, type MetaWebhookQuery, type MetaWebhookEvent, type MetaTemplateWebhookEventBase, type MetaTemplateCategoryChangedEvent, type MetaTemplateCategoryChangeScheduledEvent, type MetaTemplateStatusUpdatedEvent, type MetaUnknownWebhookEvent, type WhatsAppTemplateStatusEvent, createMetaWhatsAppWebhookHandler, type MetaWhatsAppWebhookHandler, type MetaWhatsAppWebhookHandlerConfig, WHATSAPP_APP_SECRET_ENV, WHATSAPP_VERIFY_TOKEN_SECRET_ENV, } from './whatsapp-meta-webhook.js';
20
20
  export { createExpoPushProvider, sendExpoPush, fetchExpoPushReceipts, isDeviceGone, type ExpoPushConfig, type ExpoPushProviderConfig, type ExpoPushMessage, type ExpoPushTicket, type ExpoPushTicketFor, type ExpoPushReceipt, type FetchLike, } from './push-expo.js';
21
+ export { createFcmPushProvider, sendFcmPush, prepareFcmPush, parseFcmServiceAccount, fcmAccessToken, fcmRequestBody, fcmOutcome, type FcmPushConfig, type FcmPushProviderConfig, type FcmServiceAccount, } from './push-fcm.js';
22
+ export { createApnsPushProvider, sendApnsPush, prepareApnsPush, parseApnsKey, apnsProviderToken, apnsPayload, apnsOutcome, createHttp2ApnsTransport, type ApnsKey, type ApnsPushConfig, type ApnsPushMessage, type ApnsRequest, type ApnsResponse, type ApnsTransport, } from './push-apns.js';
21
23
  export { createSmsNoopProvider } from './sms-noop.js';
22
24
  export { createPushNoopProvider } from './push-noop.js';
23
25
  export { createEmailNoopProvider, type EmailNoopOptions } from './email-noop.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,wB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AAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -11,13 +11,15 @@
11
11
  * // ↑ direct subpath — useful when bundling and you want
12
12
  * // precise tree-shaking control.
13
13
  */
14
- export { ProviderHardError, ProviderSendError, } from './types.js';
14
+ export { ProviderHardError, ProviderSendError, PushDeviceGoneError, } from './types.js';
15
15
  export { createSesEmailProvider, __resetSesClientForTests, } from './email-ses.js';
16
16
  export { createMetaWhatsAppProvider, createSecretsTokenResolver, } from './whatsapp-meta.js';
17
17
  export { toMetaLanguage, fromMetaLanguage, DEFAULT_META_LANGUAGE_MAP, } from './whatsapp-meta-language.js';
18
18
  export { metaTemplateParameter, metaTemplateBody, normalizeMetaCategory, metaCategoryCost, META_TEMPLATE_BODY_MAX, META_FLAT_COSTS, } from './whatsapp-meta-template.js';
19
19
  export { verifyMetaWebhookSignature, handleMetaWebhookVerification, parseMetaWebhookEvents, MetaWebhookSignatureError, MetaWebhookVerificationError, MetaWebhookPayloadError, META_SIGNATURE_HEADER, createMetaWhatsAppWebhookHandler, WHATSAPP_APP_SECRET_ENV, WHATSAPP_VERIFY_TOKEN_SECRET_ENV, } from './whatsapp-meta-webhook.js';
20
20
  export { createExpoPushProvider, sendExpoPush, fetchExpoPushReceipts, isDeviceGone, } from './push-expo.js';
21
+ export { createFcmPushProvider, sendFcmPush, prepareFcmPush, parseFcmServiceAccount, fcmAccessToken, fcmRequestBody, fcmOutcome, } from './push-fcm.js';
22
+ export { createApnsPushProvider, sendApnsPush, prepareApnsPush, parseApnsKey, apnsProviderToken, apnsPayload, apnsOutcome, createHttp2ApnsTransport, } from './push-apns.js';
21
23
  export { createSmsNoopProvider } from './sms-noop.js';
22
24
  export { createPushNoopProvider } from './push-noop.js';
23
25
  export { createEmailNoopProvider } from './email-noop.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAIlB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,sBAAsB,EAEtB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAe3B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAIhB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EAWrB,gCAAgC,EAGhC,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,YAAY,GAQb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAyB,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAA8B,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GAOpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,sBAAsB,EAEtB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAe3B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAIhB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,qBAAqB,EAWrB,gCAAgC,EAGhC,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,YAAY,GAQb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,UAAU,GAIX,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,wBAAwB,GAOzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAyB,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAA8B,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @venturekit/notify — Apple Push Notification service provider (token-based, HTTP/2).
3
+ *
4
+ * iOS push is APNs whatever sits in front of it; this talks to it directly with an **APNs
5
+ * auth key** (developer.apple.com › Keys, *Apple Push Notifications service*): the `.p8`
6
+ * file, its key id and the team id. One key serves every app of the team, in both
7
+ * environments; the app a push is for is its **topic** (the bundle id), per message.
8
+ *
9
+ * ### Authorisation
10
+ *
11
+ * Each request carries a provider token — an ES256 JWT `{ iss: teamId, iat }` with the key id
12
+ * in its header, signed here with `node:crypto`. Apple refuses one older than an hour and
13
+ * throttles one renewed more often than every twenty minutes, so it is cached per key for
14
+ * forty minutes, process-wide.
15
+ *
16
+ * ### The connection
17
+ *
18
+ * APNs speaks HTTP/2 only (`node:http2`; `fetch` cannot reach it). A send opens one session,
19
+ * multiplexes its requests on it, and closes it when the last answer is in — an open session
20
+ * would keep a Lambda's event loop alive until its timeout. Tests inject an
21
+ * {@link ApnsTransport} instead.
22
+ *
23
+ * ### Environments
24
+ *
25
+ * A token belongs to the environment of the build that registered it: `production` for a
26
+ * TestFlight or App Store build, `sandbox` for a development build run from Xcode. Sending
27
+ * to the other one answers `BadDeviceToken`. Pick the environment per deployment (production
28
+ * on the deployed stages, sandbox locally).
29
+ *
30
+ * ### What the answer means
31
+ *
32
+ * Final, like FCM's — no receipt to ask for later. `410 Unregistered` and `BadDeviceToken`
33
+ * are `gone` (revoke the token); 429, 5xx and an expired provider token are `retryable`; an
34
+ * expired or refused provider token drops the cached JWT so the next send signs a new one
35
+ * (`InvalidProviderToken` — the wrong key id or team — is not worth a retry). `DeviceTokenNotForTopic` is a
36
+ * configuration mistake (the wrong bundle id for the app) and is reported, never revoked.
37
+ */
38
+ import { type NotifyProvider, type PushPayloadFormat, type PushSendMessage, type PushSendOutcome } from './types.js';
39
+ /** An APNs auth key: the `.p8` text, its key id, the team it belongs to. */
40
+ export interface ApnsKey {
41
+ teamId: string;
42
+ keyId: string;
43
+ /** The `.p8` file's text (`-----BEGIN PRIVATE KEY-----…`). */
44
+ privateKey: string;
45
+ }
46
+ /** One HTTP/2 request to APNs, and its answer — the seam tests replace. */
47
+ export interface ApnsRequest {
48
+ origin: string;
49
+ path: string;
50
+ headers: Record<string, string>;
51
+ body: string;
52
+ }
53
+ export interface ApnsResponse {
54
+ status: number;
55
+ headers: Record<string, string | undefined>;
56
+ body: string;
57
+ }
58
+ export interface ApnsTransport {
59
+ request(request: ApnsRequest): Promise<ApnsResponse>;
60
+ close(): void;
61
+ }
62
+ export interface ApnsPushConfig {
63
+ /** The key: {@link ApnsKey}, or JSON text `{ "teamId", "keyId", "privateKey" }` (`key` is accepted for `privateKey`). */
64
+ key: ApnsKey | string;
65
+ /** Default `'production'`. */
66
+ environment?: 'production' | 'sandbox';
67
+ /** The bundle id for messages that do not name their own `topic`. */
68
+ topic?: string;
69
+ /** Payload layout for the receiving app. Default `'standard'`. */
70
+ format?: PushPayloadFormat;
71
+ /** Requests in flight at once on the session. Default 8. */
72
+ concurrency?: number;
73
+ /** Injected for tests; the caller then owns it (it is not closed). Default: a `node:http2` session per send. */
74
+ transport?: ApnsTransport;
75
+ /** Injected for tests. Defaults to `Date.now`. */
76
+ now?: () => number;
77
+ }
78
+ /** A message for APNs: the common fields, and the app it is for. */
79
+ export interface ApnsPushMessage extends PushSendMessage {
80
+ /** The app's bundle id (`apns-topic`); falls back to {@link ApnsPushConfig.topic}. */
81
+ topic?: string;
82
+ }
83
+ /** Read an APNs key, refusing one that cannot sign. */
84
+ export declare function parseApnsKey(input: ApnsPushConfig['key']): ApnsKey;
85
+ /** Forget every cached provider token. For tests. */
86
+ export declare function __resetApnsTokensForTests(): void;
87
+ /** The provider token for this key: the cached one while it is under forty minutes old. */
88
+ export declare function apnsProviderToken(key: ApnsKey, now?: () => number): string;
89
+ /** The JSON body APNs is sent for one message, in the app's payload layout. */
90
+ export declare function apnsPayload(message: PushSendMessage, format?: PushPayloadFormat): Record<string, unknown>;
91
+ /** What one APNs answer means for the token it was about. */
92
+ export declare function apnsOutcome(to: string, response: ApnsResponse): PushSendOutcome;
93
+ /** One `node:http2` session to an APNs origin, opened on the first request. */
94
+ export declare function createHttp2ApnsTransport(): ApnsTransport;
95
+ /**
96
+ * Read the key and sign a provider token — everything that can fail for the whole send — and
97
+ * return the sender. Throws {@link ProviderHardError} for a key that cannot sign; having
98
+ * returned, the sender never throws: each token's fate is in its {@link PushSendOutcome}. Each
99
+ * call of the sender opens its own HTTP/2 session (unless a transport was injected) and closes
100
+ * it before resolving.
101
+ */
102
+ export declare function prepareApnsPush(config: ApnsPushConfig): (messages: readonly ApnsPushMessage[]) => Promise<PushSendOutcome[]>;
103
+ /**
104
+ * Send to many APNs device tokens, one outcome per token, in order. Throws only what
105
+ * {@link prepareApnsPush} throws — before anything is sent.
106
+ */
107
+ export declare function sendApnsPush(messages: readonly ApnsPushMessage[], config: ApnsPushConfig): Promise<PushSendOutcome[]>;
108
+ /**
109
+ * A `NotifyProvider` for the `push` channel, where `to` is one APNs device token of the app
110
+ * named by `config.topic` — for the outbox and its dispatcher. A dead token is a
111
+ * {@link PushDeviceGoneError}, a retryable refusal a {@link ProviderSendError}, anything else
112
+ * a {@link ProviderHardError}.
113
+ */
114
+ export declare function createApnsPushProvider(config: ApnsPushConfig & {
115
+ topic: string;
116
+ }): NotifyProvider;
117
+ //# sourceMappingURL=push-apns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-apns.d.ts","sourceRoot":"","sources":["../../src/providers/push-apns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH,OAAO,EAIL,KAAK,cAAc,EAGnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAYpB,4EAA4E;AAC5E,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC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