Skip to content

Commit 7e4b969

Browse files
committed
docs(push,spec): name origin in the PushMessage data docblock and finish the refresh list
Claude-Session: https://claude.ai/code/session_016WV4czbHcjvoBYWDw2gRAq Co-authored-by: Claude <noreply@anthropic.com>
1 parent 48036dd commit 7e4b969

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎.changeset/29768-push-device-origin-stored.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
'@objectstack/service-messaging': patch
33
'@objectstack/spec': patch
4+
'@objectstack/service-push': patch
45
---
56

67
feat(messaging,spec): a push device's `origin` is stored at registration and every push to the device carries it back
@@ -10,3 +11,4 @@ Metadata-protocol: none
1011

1112
- **`@objectstack/service-messaging`**: `sys_user_device` gains an optional `origin` column. `POST /api/v1/notifications/devices` stores the registration's `origin` on the device row (`null` when the registration names none, and a refresh replaces it as it does `appId` and `locale`); `listDevices` answers it; and the push channel, which already copied a device's `origin` into the push data, now finds one to copy. A mobile shell with several saved servers can therefore open a tapped push on the server that sent it. Registrations without `origin` behave exactly as before.
1213
- **`@objectstack/spec`**: `RegisterDeviceRequestSchema.origin` and `UserDeviceSchema.origin` drop their `[PLANNED — not yet stored]` prefix, since the server now stores the value. The push server origin docblock names where its pattern is knowingly narrower than a URL origin (an underscore in a label, a trailing-dot host) and looser (a written-out default port, a leading zero or an out-of-range port, any bracketed run of hex digits, colons and dots), and that a dotted IPv4 host is accepted. Description and docblock text only; nothing a caller sends is accepted or refused differently.
14+
- **`@objectstack/service-push`**: the `PushMessage` docblock names `origin` among the delivery data the transports forward. Docblock only; both transports already forward `data` whole.

‎packages/services/service-push/src/push-service.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import type { PushVendor } from '@objectstack/spec/system';
66
* One push to one device, as the push channel hands it over.
77
*
88
* `data` is the push's delivery data (`PushDeliveryDataSchema`,
9-
* `@objectstack/spec/api`): the notification id and, when it is a same-server
10-
* path, its `route`. Every value is a string, because FCM's `message.data`
9+
* `@objectstack/spec/api`): the notification id; when it is a same-server
10+
* path, its `route`; and, when the device registered one, its `origin` (the
11+
* server the Console was loaded from, by which a shell with several saved
12+
* servers opens the push). Every value is a string, because FCM's `message.data`
1113
* takes only strings. Each transport places it where its vendor reads it: FCM
1214
* in `message.data`, APNs at the top level of the payload beside `aps`.
1315
*/

‎packages/spec/src/api/protocol.zod.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,10 +3689,11 @@ export const GetPresenceResponseSchema = lazySchema(() => z.object({
36893689
* `DELETE /api/v1/notifications/devices/:deviceId`.
36903690
*
36913691
* One request does both: registering a `deviceId` the user already has
3692-
* refreshes that device (its token, vendor, app, locale and origin) instead of adding
3693-
* a second one. A request without `deviceId` gets one minted by the server
3694-
* and answered in {@link RegisterDeviceResponseSchema}; the client keeps it
3695-
* and sends it on every later registration and on unregister.
3692+
* refreshes that device (its token, vendor, platform, app, locale, origin and
3693+
* name) instead of adding a second one. A request without `deviceId` gets
3694+
* one minted by the server and answered in {@link RegisterDeviceResponseSchema};
3695+
* the client keeps it and sends it on every later registration and on
3696+
* unregister.
36963697
*
36973698
* The members after `name` (`vendor`, `appId`, `locale`) were added for the
36983699
* push channel, all optional, so the body a client sent before still parses

0 commit comments

Comments
 (0)