@stacksjs/defaults 0.75.124 → 0.75.127

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.
@@ -8,6 +8,13 @@ allowed-tools: Read Edit Write Bash Grep Glob
8
8
 
9
9
  # Stacks Chat
10
10
 
11
+ Native direct messaging accepts an optional `onMessageSent` callback in its
12
+ messenger options. It receives `{ message, actorId, recipientId, scope,
13
+ participantType }` once for each newly saved message, after an enclosing
14
+ transaction commits. Duplicate send retries and rolled-back messages do not
15
+ run it. Connect notification jobs there; a callback failure is logged without
16
+ turning a saved message into a failed send.
17
+
11
18
  Multi-driver chat messaging with Slack, Discord, and Microsoft Teams support. Each driver supports both webhook and bot token modes, with retry logic and structured message formats.
12
19
 
13
20
  ## Key Paths
@@ -69,7 +69,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
69
69
  | `@stacksjs/pagination` | [`stacks-pagination`](../stacks-pagination/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/pagination/src/index.ts) | 0 |
70
70
  | `@stacksjs/path` | [`stacks-path`](../stacks-path/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/index.ts) | 9 |
71
71
  | `@stacksjs/payments` | [`stacks-payments`](../stacks-payments/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/index.ts) | 20 |
72
- | `@stacksjs/push` | [`stacks-push`](../stacks-push/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/index.ts) | 5 |
72
+ | `@stacksjs/push` | [`stacks-push`](../stacks-push/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/index.ts) | 6 |
73
73
  | `@stacksjs/query-builder` | [`stacks-query-builder`](../stacks-query-builder/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/query-builder/src/index.ts) | 6 |
74
74
  | `@stacksjs/queue` | [`stacks-queue`](../stacks-queue/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/queue/src/index.ts) | 48 |
75
75
  | `@stacksjs/realtime` | [`stacks-realtime`](../stacks-realtime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/realtime/src/index.ts) | 11 |
@@ -607,7 +607,7 @@ Evidence directory: [7 retained tests](https://github.com/stacksjs/stacks/blob/m
607
607
 
608
608
  Guidance: [`stacks-notifications`](../stacks-notifications/SKILL.md). Source: [storage/framework/core/notifications/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/index.ts).
609
609
 
610
- Declared runtime exports: `BroadcastNotificationDriver`, `DatabaseNotificationDriver`, `bulkSetPreferences`, `emailParagraphs`, `ensureSuccessfulEmailResult`, `ensureSuccessfulNotificationResults`, `filterChannelsByPreferences`, `getNotificationPreferences`, `makeDeliveryRecord`, `notification`, `notificationEmailHtml`, `notificationEmailText`, `notify`, `recordNotificationDelivery`, `resolveDeliveryRecipient`, `setNotificationPreference`, `useBroadcast`, `useChat`, `useDatabase`, `useEmail`, `useNotification`, `usePush`, `useSMS`, `wherePreferenceCategory`.
610
+ Declared runtime exports: `BroadcastNotificationDriver`, `DatabaseNotificationDriver`, `bulkSetPreferences`, `emailParagraphs`, `ensureSuccessfulEmailResult`, `ensureSuccessfulNotificationResults`, `filterChannelsByPreferences`, `getNotificationPreferences`, `makeDeliveryRecord`, `notification`, `notificationChannel`, `notificationEmailHtml`, `notificationEmailText`, `notify`, `recordNotificationDelivery`, `resolveDeliveryRecipient`, `setNotificationPreference`, `useBroadcast`, `useChat`, `useDatabase`, `useEmail`, `useNotification`, `usePush`, `useSMS`, `wherePreferenceCategory`.
611
611
 
612
612
  Local source modules: [src/delivery.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/delivery.ts), [src/drivers/broadcast.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/drivers/broadcast.ts), [src/drivers/database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/drivers/database.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/drivers/index.ts), [src/email-body.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/email-body.ts), [src/preferences.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/preferences.ts).
613
613
 
@@ -663,11 +663,11 @@ Evidence directory: [20 retained tests](https://github.com/stacksjs/stacks/blob/
663
663
 
664
664
  Guidance: [`stacks-push`](../stacks-push/SKILL.md). Source: [storage/framework/core/push/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/index.ts).
665
665
 
666
- Declared runtime exports: `buildVapidHeaders`, `configureExpo`, `configureFCM`, `encryptPayload`, `expo`, `fcm`, `generateVapidKeys`, `send`, `sendWebPush`.
666
+ Declared runtime exports: `apns`, `buildVapidHeaders`, `configureAPNS`, `configureExpo`, `configureFCM`, `encryptPayload`, `expo`, `fcm`, `generateVapidKeys`, `send`, `sendWebPush`.
667
667
 
668
- Local source modules: [src/drivers/expo.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/expo.ts), [src/drivers/fcm.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/fcm.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/index.ts), [src/drivers/web-push.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/web-push.ts).
668
+ Local source modules: [src/drivers/apns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/apns.ts), [src/drivers/expo.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/expo.ts), [src/drivers/fcm.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/fcm.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/index.ts), [src/drivers/web-push.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/drivers/web-push.ts).
669
669
 
670
- Evidence directory: [5 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
670
+ Evidence directory: [6 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
671
671
 
672
672
  ### @stacksjs/query-builder
673
673
 
@@ -127,3 +127,17 @@ own their persistence; the query builder is bun-query-builder.
127
127
  `broadcast.test.ts` and `email-body.test.ts` cover retained behavior.
128
128
  For provider status, consult `config/src/capabilities.ts` and each channel
129
129
  skill; a constructed send request is not a live delivery assertion.
130
+
131
+ ## Live, retry-safe database notifications
132
+
133
+ `useDatabase().send()` accepts an optional `idempotencyKey` (1–255 characters).
134
+ Retries for the same user, notification type and producer key return the
135
+ original inbox row, including concurrent retries. It uses the existing uuid
136
+ column and a recipient row lock. Use a stable message/event identifier.
137
+
138
+ New inbox rows broadcast `notifications.created` with `{ id }` on
139
+ `notificationChannel(userId)` (`private-user.{id}`) when the native realtime
140
+ engine is initialized. Delivery waits for transaction commit and carries no
141
+ message body. Duplicated keys do not emit again. Set `broadcast: false` to
142
+ suppress this invalidation. Serve an authenticated native broadcast stream for
143
+ the server-selected user channel and reconcile the durable inbox on reconnect.
@@ -405,3 +405,25 @@ to Expo; explicit FCM selection uses this package's direct send API.
405
405
  Evidence: `core/push/tests/web-push.test.ts`,
406
406
  `config-credentials.test.ts` and `fcm.test.ts`. These tests do not prove
407
407
  live delivery to a registered physical device.
408
+
409
+ ## Native Apple Push Notification Service (APNs)
410
+
411
+ Use `send(deviceToken, notification, { driver: 'apns' })` for the hexadecimal
412
+ Apple device tokens registered by Craft's iOS bridge. These are not FCM or
413
+ Expo tokens. TestFlight uses production APNs; development builds use sandbox.
414
+
415
+ `config/services.ts` supports `apns: { teamId, keyId, privateKey, topic,
416
+ sandbox }`, or call `configureAPNS()` with the same fields. Framework defaults
417
+ read APNS_TEAM_ID, APNS_KEY_ID, APNS_PRIVATE_KEY, APNS_TOPIC and
418
+ APNS_ENVIRONMENT (`production` or `sandbox`). Use a key enabled for APNs, not
419
+ an App Store Connect or Sign in with Apple key.
420
+
421
+ The driver uses HTTP/2, ES256 P-256 provider tokens, raw JOSE signatures and a
422
+ 50-minute token cache. Payloads are limited to 4096 bytes. A collapseId can
423
+ coalesce retries of one notification. Structured per-device results include
424
+ Apple's status, reason and request identifier. Success means Apple accepted
425
+ the request; it does not prove an alert appeared on a physical phone.
426
+
427
+ `notify` accepts `recipient.pushDriver` for explicit native APNs/FCM selection.
428
+ Evidence: `core/push/tests/apns.test.ts` exercises signatures, payloads and
429
+ HTTP/2 success/rejection responses against a local server.
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.124",
5
+ "version": "0.75.127",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.124",
5
+ "version": "0.75.127",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@iconify-json/f7": "^1.2.2",
57
57
  "@iconify-json/hugeicons": "^1.2.35",
58
- "@stacksjs/mobile": "^0.75.124",
58
+ "@stacksjs/mobile": "0.75.127",
59
59
  "@stacksjs/sanitizer": "^0.2.422",
60
60
  "@xterm/addon-fit": "^0.11.0",
61
61
  "@xterm/xterm": "^6.0.0",