@protobase/cli 0.81.7 → 0.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.
|
|
47
|
-
"@protobase/layout": "0.
|
|
48
|
-
"@protobase/query": "0.
|
|
49
|
-
"@protobase/schema": "0.
|
|
50
|
-
"@protobase/server": "0.
|
|
51
|
-
"@protobase/ui": "0.
|
|
52
|
-
"@protobase/workflows": "0.
|
|
46
|
+
"@protobase/config": "0.82.0",
|
|
47
|
+
"@protobase/layout": "0.82.0",
|
|
48
|
+
"@protobase/query": "0.82.0",
|
|
49
|
+
"@protobase/schema": "0.82.0",
|
|
50
|
+
"@protobase/server": "0.82.0",
|
|
51
|
+
"@protobase/ui": "0.82.0",
|
|
52
|
+
"@protobase/workflows": "0.82.0",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -62,7 +62,7 @@ Who may call them:
|
|
|
62
62
|
|
|
63
63
|
A device is one token, or one endpoint for a browser. An Android or iOS token, or a relay handle, someone else had moves to the caller, as a new device with a new id that keeps nothing of the previous user's, so a shared phone notifies whoever signed in on it last. A browser's endpoint never moves: registering one another user holds is a `409` of type `device-held` that stores nothing, and the browser subscribes again for a new endpoint, as [the browser helper](#in-the-browser) does. A user keeps up to 20 devices: registering one more removes their least recently seen. Deleting a user removes their devices.
|
|
64
64
|
|
|
65
|
-
With Protobase's auth, a device belongs to the sign-in session it was registered in. Once that session ends, the device gets no more push and is removed at the next send: when the user signs out, someone signs in on the same browser, the user signs out everywhere, a password change signs out their other devices, an admin ends their sessions or bans them, or the session expires. Registering the device again ties it to the session of that request, which the browser helper does on its own for the same user. With an app's own authenticator, a device stays its user's until it is removed with `DELETE`.
|
|
65
|
+
With Protobase's auth, a device belongs to the sign-in session it was registered in. Once that session ends, the device gets no more push and is removed at the next send: when the user signs out, someone signs in on the same browser, the user signs out everywhere, a password change signs out their other devices, an admin ends their sessions or bans them, or the session expires. A device with no session recorded, such as one registered before devices kept their session, counts as ended too. Registering the device again ties it to the session of that request, which the browser helper does on its own for the same user, so such a device gets push again once its browser registers it. With an app's own authenticator, a device stays its user's until it is removed with `DELETE`. <gap>Devices cannot end with a session of an app's own authenticator because a way for `authenticate` to report that a session ended is not implemented.</gap>
|
|
66
66
|
|
|
67
67
|
The path comes from `devicesPath('/api', id)`, and the name of its id parameter from `deviceIdParam`, both exported by `@protobase/server`.
|
|
68
68
|
|
|
@@ -187,7 +187,7 @@ Without them Web Push is off and the app has no sender for browsers. One or two
|
|
|
187
187
|
|
|
188
188
|
The private key is a secret: keep it out of client code, `VITE_` variables and the repository. Anyone holding it and the stored subscriptions can push to every subscribed browser. Browsers subscribe with the public key, which `/meta` gives every caller as `notifications.webPushKey`, so a new key pair breaks every subscription until its browser registers again.
|
|
189
189
|
|
|
190
|
-
Each message is encrypted for its browser and signed with the key. It goes only to an endpoint on one of the browsers' push services, never through a redirect
|
|
190
|
+
Each message is encrypted for its browser and signed with the key. It goes only to an endpoint on one of the browsers' push services, never through a redirect, and only to the address the endpoint's host resolves to when it is sent, which must be public: an endpoint whose host resolves to a private, loopback or link-local address gets no request and is `refused`; a device stored with any other endpoint, or with keys that are not a subscription's, is `refused`. <gap>Web Push cannot deliver to a push service outside the browsers' own because adding one to the list is not implemented.</gap> A message's `platform.web` sets the request's `ttl`, `urgency` and `topic` and fields merged into the JSON the browser receives (`payload`), in place of those built from the message; every URL in that JSON is checked as the message's `url` is. The JSON also carries `user`, the id of the user the device is registered for, over any `user` in `payload`, and at most 3993 bytes.
|
|
191
191
|
|
|
192
192
|
### In the browser
|
|
193
193
|
|
|
@@ -344,7 +344,7 @@ const store: DeviceStore = {
|
|
|
344
344
|
export default store
|
|
345
345
|
```
|
|
346
346
|
|
|
347
|
-
Every method takes and returns plain data: the user id as text, and devices as `{ id, userId, kind, token, p256dh, auth, environment, appId, userAgent, sessionId, createdAt, lastSeenAt }`, with `token` the endpoint for a browser and `sessionId` the sign-in session it was registered in. A method given an empty user id, id or token throws. `listByIds` and `removeGone` act on any user's devices, for the code that sends; the endpoints never call them. A store missing a method stops startup, naming it.
|
|
347
|
+
Every method takes and returns plain data: the user id as text, and devices as `{ id, userId, kind, token, p256dh, auth, environment, appId, userAgent, sessionId, createdAt, lastSeenAt }`, with `token` the endpoint for a browser and `sessionId` the sign-in session it was registered in. A store keeps `sessionId` as `register` gives it and returns it: with Protobase's auth, a device whose store returns no `sessionId` gets no push and is removed at the next send. A method given an empty user id, id or token throws. `listByIds` and `removeGone` act on any user's devices, for the code that sends; the endpoints never call them. A store missing a method stops startup, naming it.
|
|
348
348
|
|
|
349
349
|
When Protobase's auth deletes a user, by an admin or with `protobase users delete`, it calls the store's `removeAllForUser` before anything is deleted, so a store that throws stops the deletion, and once more afterwards. An app that deletes users otherwise calls `deviceStore(db, notifications).removeAllForUser(userId)` as it deletes one, with the config's `notifications` (the devices table's names), or the `removeAllForUser` of its own `notifications/store.ts`.
|
|
350
350
|
|
|
@@ -386,7 +386,7 @@ const sender: PushSender = {
|
|
|
386
386
|
export default [sender]
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
`send` takes a message and a batch of devices of those kinds, and answers each device by its id with a result:
|
|
389
|
+
`send` takes a message and a batch of devices of those kinds, and answers each device by its id with a result. The send job is what calls it, and only with devices that may get push now: with Protobase's auth, ones whose session stands. Send through [`sendNotification`](#sending), never by calling a sender yourself, which would skip that check. The results:
|
|
390
390
|
|
|
391
391
|
| Result | |
|
|
392
392
|
| --- | --- |
|