Commit Graph
76 Commits
Author SHA1 Message Date
Jose Olarte III c75060a7f1 Use singular “update” when the digest has one item so FCM and SMS bodies stay grammatical. 2026-09-18 16:54:09 +08:00
Jose Olarte III 77df676d6e Accept POST on /notifications/alert-authorization instead of PUT.
The path and payload stay the same; this matches how the client submits a batch.
2026-09-18 15:05:30 +08:00
Jose Olarte III 226925278f Move remaining alertSearch tests under test/.
Keep them beside the existing SMS alertSearch tests and update imports so they still load src/.
2026-09-18 14:53:41 +08:00
trentlarson 93168ae360 make the boolean checks consistent, and guard against mistakes 2026-09-14 11:43:22 -06:00
trentlarson 885c6ced42 bump version and add '-beta' 2026-09-09 21:09:44 -06:00
trentlarson 4c2e6491db bump to version 0.2.1, for relase on test server 2026-09-09 21:09:09 -06:00
Jose Olarte III 657fd9c530 Count the SMS digest cap by UTC calendar day so a send just before midnight does not block the next day’s text. 2026-09-09 21:19:49 +08:00
trentlarson 65eb1bee1e add notify hour-minute setting, and a DELETE for an existing alert 2026-09-07 18:55:52 -06:00
trentlarson 9e5b8bbd59 Merge branch 'endpoint-query' into endpoint-query-sms 2026-09-07 17:02:18 -06:00
trentlarson 6cea0e9b67 sms: create explicit allow & block management 2026-09-06 12:20:04 -06:00
trentlarson 2e34bed700 sms: more debugging info 2026-09-06 09:32:03 -06:00
trentlarson bfac283690 add tests -- which have worked on Trent's machine... SMS sent! 2026-09-06 09:22:15 -06:00
trentlarson f967db7373 Add SMS notifications. The PLAN is executed but this isn't tested yet. 2026-09-05 20:52:34 -06:00
trentlarson adf5e6166d add a flag for the debug endpoints, and distinguish unavailable errors 2026-09-05 16:54:23 -06:00
trentlarson 776558b230 remove debug endpoints that are unsafe in final version 2026-09-05 13:21:03 -06:00
Jose Olarte III d0a3951689 Allow the ngrok browser-warning skip header in CORS so a WebView can reach the local tunnel without failing preflight. 2026-09-03 21:12:59 +08:00
Jose Olarte III c9df679ac2 Document the real Docker/node dist/index.js production path, durable SQLite, single replica, and Firebase credential options so deploys are not treated as equivalent to tsx. 2026-09-01 16:07:21 +08:00
Jose Olarte III cfc2cdefa3 Send a TimeSafari FCM digest after a completed daily alertSearch with updates, using JWT consumption to avoid repeat sends without changing WAKEUP_PING. 2026-08-31 21:41:34 +08:00
Jose Olarte III 10e80c6f41 Attach the alertSearch digest to each daily run so a completed retrieve is notification-ready without changing JWT consumption or cursor rules. 2026-08-31 20:44:04 +08:00
Jose Olarte III 49f50e36b7 Add a structured alertSearch digest of the six result buckets so the app can build a daily notification from records and counts, not a server-hardcoded message. 2026-08-28 20:58:13 +08:00
Jose Olarte III 209b346d16 Add a user-level alertSearch scheduler that runs each authorization-batch user once per pass, with an in-flight guard, without changing FCM wakeup. 2026-08-28 16:39:22 +08:00
Jose Olarte III d45ea26bca Add a callable daily alertSearch run that picks today’s unused delegated JWT from the batch timezone and consumes it only after both sources complete. 2026-08-28 15:46:39 +08:00
Jose Olarte III 131d2fc9d9 Add an explicit alertSearch cycle that loads cursors, retrieves, and advances only complete sources so scheduler integration can reuse a proven path.
Treat Partner LIMIT-50 pages with a tied oldest updatedAt as incomplete so exclusive beforeDate paging cannot skip remaining rows.
2026-08-27 20:55:13 +08:00
Jose Olarte III eb5b286476 Persist independent Endorser and Partner alertSearch cursors per user so later daily runs can resume after the last complete retrieval.
Advance each cursor only on success, leave empty/pagination/error results unchanged, and keep this unwired from the scheduler.
2026-08-27 20:20:51 +08:00
Jose Olarte III caeca10910 Fix Endorser alertSearch pagination so the next beforeId is the max of per-bucket minima, not the global min.
Treat a full plansNearby page as incomplete because the server orders that bucket by rowid while filtering jwtId.
2026-08-27 16:34:36 +08:00
Jose Olarte III 74e9c02669 Add an alertSearch retrieval layer so notify-api can query Endorser and Partner with a delegated JWT.
Keep Endorser and Partner cursors independent, paginate with the real beforeId/beforeDate contract, and leave scheduling and notification delivery for later.
2026-08-27 15:16:04 +08:00
Jose Olarte III 00cd0cf8f4 Add PUT /notifications/alert-authorization so the app can install a 100-JWT delegated batch without overloading device registration.
Store the batch atomically under the authenticated DID, replace unused JWTs on each setup, and reject Passkey identities that cannot mint future credentials.
2026-08-26 20:40:52 +08:00
Jose Olarte IIIandCursor 9c7c7fa271 bump version to 0.1.4 and add to CHANGELOG
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 15:49:28 +08:00
jose 76d3447d78 Merge pull request 'chore: rename FCM_TOKEN_DATA_DIR env var to NOTIFY_DATA_DIR' (#4) from data-dir-rename into master
Reviewed-on: #4
2026-08-07 06:26:36 +00:00
Jose Olarte III 6e4e1e7f1b chore: rename FCM_TOKEN_DATA_DIR env var to NOTIFY_DATA_DIR
Align the data-directory env name with notify.sqlite; default path remains ./data.
2026-08-04 17:31:14 +08:00
trentlarson a45150e25f bump version to 0.1.3 and add to CHANGELOG 2026-07-30 20:21:03 -06:00
jose d8989f587e Merge pull request 'Convert JSON storage to SQLite' (#3) from sqlite-storage into master
Reviewed-on: #3
2026-07-29 11:40:59 +00:00
Jose Olarte III 9e6597638e chore(db): rename SQLite database file to notify.sqlite
Use a generic database filename for future notification-related storage, and update docs and env comments to match.
2026-07-27 16:53:53 +08:00
Jose Olarte III 06ec0f63e4 docs: document SQLite storage for FCM registrations
Update README and .env.example for the SQLite database location, schema overview, backup/WAL notes, and clarify that JSON data is not migrated.
2026-07-24 20:52:38 +08:00
Jose Olarte III ddb969c26d chore(db): remove obsolete JSON FCM token repository
Delete the unused JSON storage implementation now that SQLite is the sole persistence backend.
2026-07-24 17:57:44 +08:00
Jose Olarte III e79d55fac6 perf(db): tighten SQLite FCM registration queries
Drop the upsert pre-read, project only needed columns, and add a (user_id, fcm_token) index for token lookups and dedupe deletes.
2026-07-24 17:31:23 +08:00
Jose Olarte III 11bd45b460 feat(db): switch runtime storage to SQLite repository
Point routes, scheduler, and push service at fcmTokensSqlite so the service no longer reads or writes the JSON store.
2026-07-23 18:55:17 +08:00
Jose Olarte III 5a3c22a4e3 feat(db): add SQLite FCM registration repository
Mirror the JSON repository API on SQLite without switching callers; clarify that SQLite is the storage backend and there is no JSON data migration.
2026-07-23 18:36:10 +08:00
Jose Olarte III fa8ab86cdb feat(db): add SQLite foundation for FCM registration storage
Introduce better-sqlite3 and a schema-init module so we can migrate off JSON storage without changing runtime behavior yet.
2026-07-23 17:44:27 +08:00
trentlarson 55d43a1a20 bump version to 0.1.2 2026-07-16 22:46:09 -06:00
jose c4f34c8882 Merge pull request 'endorser-authentication' (#2) from endorser-authentication into master
Reviewed-on: #2
2026-07-16 12:32:40 +00:00
Jose Olarte III 9634c3422e docs: document Endorser auth flow and ENDORSER_URL
Describe when register/refresh verify with Endorser, keep the testMode bypass notes, and list ENDORSER_URL in the env table.
2026-07-10 21:09:22 +08:00
Jose Olarte III 2343cece5c fix(auth): distinguish Endorser unavailability from auth rejection
Return 503 when Endorser cannot be reached and keep 401 for rejected JWTs, with clearer server-side diagnostics and generic client messages.
2026-07-10 19:06:40 +08:00
Jose Olarte III f2f0732ef5 feat(auth): share Endorser verification across register and refresh
Extract requireEndorserAuth middleware and apply it to /notifications/refresh so both endpoints use the same check while keeping the local test bypass.
2026-07-10 18:58:52 +08:00
Jose Olarte III 764c89c071 feat(auth): require Endorser verification on device registration
Gate /notifications/register on Endorser JWT acceptance while leaving the local testMode bypass unchanged.
2026-07-10 18:44:35 +08:00
Jose Olarte III e5415280bd feat(endorser): add client helper to check JWT via rateLimits
Introduce checkAuth so callers can verify Endorser acceptance of a JWT without dealing with HTTP details.
2026-07-10 18:05:16 +08:00
Jose Olarte III 0758c4192f feat(config): add ENDORSER_URL for upcoming Endorser auth
Expose the Endorser API base URL from the environment (defaulting to production) so later auth work can call it without hardcoding.
2026-07-10 16:09:57 +08:00
Jose Olarte III fcf3fb9aa0 chore: ignore .DS_Store files 2026-07-02 17:14:11 +08:00
trentlarson a99117dc98 bump to v 0.1.1, change default port to 3003, fix Dockerfile to build & run separately 2026-06-28 17:29:21 -06:00
trentlarson 85301135c7 fix type errors 2026-06-28 17:28:54 -06:00