@aria-framework/notify 0.3.0 → 0.3.1
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/package.json +2 -2
- package/store.js +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aria-framework/notify",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Aria App Framework — notify module. In-app notifications: ownership-scoped rows, a per-process SSE hub for live delivery, and a fire-and-forget emitter that needs no request and no actor, so a scheduler can raise one.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"test": "node test/store.js && node test/hub.js && node test/emit.js && node test/bell.js"
|
|
28
|
+
"test": "node test/store.js && node test/schema-parity.js && node test/hub.js && node test/emit.js && node test/bell.js"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/store.js
CHANGED
|
@@ -27,8 +27,19 @@
|
|
|
27
27
|
* boolean would make every `is_read = 0` in this file dialect-dependent for no gain, and
|
|
28
28
|
* INTEGER is valid on both.
|
|
29
29
|
*/
|
|
30
|
+
// The SQLite default, inline. `SCHEMA = schemaFor(null)` runs at module load, so reaching for
|
|
31
|
+
// @aria-framework/db-worker here made merely REQUIRING this package throw MODULE_NOT_FOUND —
|
|
32
|
+
// notify's manifest declares no dependency or peer on db-worker, and the comments elsewhere in
|
|
33
|
+
// this file call passing { driver } "the zero-dependency property". These are the only two
|
|
34
|
+
// dialect calls the schema makes, and both are one-liners on SQLite, so the default costs
|
|
35
|
+
// nothing and the claim becomes true. A caller wanting Postgres passes the dialect in.
|
|
36
|
+
const SQLITE_DEFAULT = {
|
|
37
|
+
autoIncrementPk: () => 'INTEGER PRIMARY KEY AUTOINCREMENT',
|
|
38
|
+
now: () => "datetime('now')"
|
|
39
|
+
};
|
|
40
|
+
|
|
30
41
|
function schemaFor(dialect) {
|
|
31
|
-
const d = dialect ||
|
|
42
|
+
const d = dialect || SQLITE_DEFAULT;
|
|
32
43
|
return `
|
|
33
44
|
id ${d.autoIncrementPk()},
|
|
34
45
|
user_id INTEGER NOT NULL, -- recipient; FK to the app's users table
|