Conversation
Copilot
AI
changed the title
[WIP] Refactor ReiStandard to single-package SDK implementation
Restructure ReiStandard as single-package SDK with pluggable database adapters
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
packages/rei-standard-amsg/server/src/server/handlers/schedule-message.js
Show resolved
Hide resolved
Tosd0
requested changes
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
reviewed
Feb 22, 2026
Tosd0
requested changes
Feb 22, 2026
52f1b2a to
ef29c41
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ReiStandard required copy-pasting 10 files, manually swapping database drivers, and re-implementing client-side encryption per project. This converts the repo to a monorepo with a publishable SDK package while preserving
examples/as-is.Monorepo & Build
package.jsonwithworkspaces: ["packages/*", "examples"]tsupbuilds 3 entry points (server,client,sw) to CJS + ESM +.d.tsbrowserfield in package exports blocks bundlers from pulling Node.js server code into frontend buildsDatabase Adapter Layer
DbAdapterinterface with 13 methods extracted from the 7 API handlerscreateAdapter({ driver, connectionString })) withneonandpgimplementations — uses dynamicimport()to lazily load only the selected driver, so projects only need to install the adapter they useschema.jsfor DDL/index definitionsServer SDK
createReiServer(config)(async) injects a context object (adapter, encryption key, VAPID, secrets) into all 7 handler factories — no moreprocess.envscattered across filesmasterKeyas a parameter instead of reading env directlymessage-processorreceives its dependencies via context, not module-level globals; usescrypto.randomUUID()for guaranteed-unique notification message IDsinitSecretis required for the init-database handler — the handler returns 500INIT_SECRET_MISSINGwhen not configured (no hardcoded fallback)messageshandler validateslimitandoffsetquery parameters, returning 400 for invalid valuesupdate-messagehandler returns 409UPDATE_CONFLICTwhen the database update yields no result (race condition / concurrent deletion), and returns 400INVALID_JSONfor malformed request bodiesschedule-messagehandler checks VAPID configuration before inserting the task row for instant messages, preventing orphaned pending rows when VAPID is missingClient SDK & SW Plugin
ReiClient— Web Crypto API encryption, auto-encrypted requests, push subscription helperinstallReiSW(self)— drop-in push/notification-click handlers for Service WorkersSecurity
cleanupOldTasks— replaced string-interpolatedINTERVAL '${days} days'with parameterizedmake_interval(days => $1)💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.