@jskit-ai/push-core 0.1.1 → 0.1.2
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- The manifest's `jskit.capabilities.requires` lists `runtime.env` and `runtime.logger`, which `PushFeature` requires; without them an app's server stopped at start-up.
|
|
5
6
|
- A deleted account's devices and settings are forgotten on `account.deleting`.
|
|
6
7
|
- `push.updateLiveActivity({ token, environment, event, data, ... })` updates or ends an iOS Live Activity through APNs' `liveactivity` push type; logged outside production.
|
|
7
8
|
- New package: the `push.core` capability (`PushFeature`). A registry of people's devices (`push_devices`: web push subscriptions, APNs and FCM tokens), each person's notification settings (`push_settings`), and `push.send()`, which reaches every device of the people it names through web push (VAPID, `web-push` 4.0.0), APNs (HTTP/2 with a `.p8` key) or FCM HTTP v1 (a service account), honours each person's settings, forgets gone devices and logs instead of sending outside `APP_ENV=production`. Routes for the signed-in person's devices and settings under `/api/push`. Run `npm run db:migrate` for its two tables.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Knex sorts this file just before push_devices_initial.cjs ("-" sorts before "."), so it runs first on every
|
|
2
|
+
// database that has not run it. It runs that released migration with each table it creates in the collation of
|
|
3
|
+
// users, or of the next table listed that exists, instead of the database's default, and repairs a table that
|
|
4
|
+
// default left: see migrateInExistingCollation. The released migration then finds its tables in place.
|
|
5
|
+
const released = require("./push_devices_initial.cjs");
|
|
6
|
+
|
|
7
|
+
exports.up = async function up(knex) {
|
|
8
|
+
const { migrateInExistingCollation } = await import("@jskit-ai/database-runtime/server/tableCollationMigrations");
|
|
9
|
+
await migrateInExistingCollation(knex, {
|
|
10
|
+
migration: "push_devices_initial.cjs",
|
|
11
|
+
up: released.up,
|
|
12
|
+
tables: ["push_devices"],
|
|
13
|
+
referenceTables: ["users", "auth_local_users"],
|
|
14
|
+
foreignKeys: [
|
|
15
|
+
{ tableName: "push_devices", columnName: "user_id", parentTable: "users",
|
|
16
|
+
name: "fk_push_devices_user", onDelete: "CASCADE" }
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// The released migration's down drops its tables.
|
|
22
|
+
exports.down = async function down() {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Knex sorts this file just before push_settings_initial.cjs ("-" sorts before "."), so it runs first on every
|
|
2
|
+
// database that has not run it. It runs that released migration with each table it creates in the collation of
|
|
3
|
+
// users, or of the next table listed that exists, instead of the database's default, and repairs a table that
|
|
4
|
+
// default left: see migrateInExistingCollation. The released migration then finds its tables in place.
|
|
5
|
+
const released = require("./push_settings_initial.cjs");
|
|
6
|
+
|
|
7
|
+
exports.up = async function up(knex) {
|
|
8
|
+
const { migrateInExistingCollation } = await import("@jskit-ai/database-runtime/server/tableCollationMigrations");
|
|
9
|
+
await migrateInExistingCollation(knex, {
|
|
10
|
+
migration: "push_settings_initial.cjs",
|
|
11
|
+
up: released.up,
|
|
12
|
+
tables: ["push_settings"],
|
|
13
|
+
referenceTables: ["users", "auth_local_users"],
|
|
14
|
+
foreignKeys: [
|
|
15
|
+
{ tableName: "push_settings", columnName: "user_id", parentTable: "users",
|
|
16
|
+
name: "fk_push_settings_user", onDelete: "CASCADE" }
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// The released migration's down drops its tables.
|
|
22
|
+
exports.down = async function down() {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/push-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jskit test"
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"push.core"
|
|
21
21
|
],
|
|
22
22
|
"requires": [
|
|
23
|
+
"runtime.env",
|
|
24
|
+
"runtime.logger",
|
|
23
25
|
"runtime.resources"
|
|
24
26
|
]
|
|
25
27
|
},
|
|
@@ -84,14 +86,14 @@
|
|
|
84
86
|
}
|
|
85
87
|
},
|
|
86
88
|
"dependencies": {
|
|
87
|
-
"@jskit-ai/resource-core": "0.1.
|
|
89
|
+
"@jskit-ai/resource-core": "0.1.233",
|
|
88
90
|
"json-rest-schema": "^1.0.20",
|
|
89
91
|
"web-push": "4.0.0"
|
|
90
92
|
},
|
|
91
93
|
"peerDependencies": {
|
|
92
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
93
|
-
"@jskit-ai/http-runtime": "0.2.
|
|
94
|
-
"@jskit-ai/kernel": "0.2.
|
|
95
|
-
"@jskit-ai/resource-runtime": "0.2.
|
|
94
|
+
"@jskit-ai/database-runtime": "0.1.300",
|
|
95
|
+
"@jskit-ai/http-runtime": "0.2.44",
|
|
96
|
+
"@jskit-ai/kernel": "0.2.42",
|
|
97
|
+
"@jskit-ai/resource-runtime": "0.2.67"
|
|
96
98
|
}
|
|
97
99
|
}
|