@ssdev-toolkit/nestjs-json-store
v1.0.0
Published
Named JSON documents with create / update / upsert / list. Other modules use `JsonStoreFacade`.
Readme
@ssdev-toolkit/nestjs-json-store
Named JSON documents with create / update / upsert / list. Other modules use JsonStoreFacade.
Install
npm install @ssdev-toolkit/nestjs-core @ssdev-toolkit/nestjs-json-storeThe host registers IJsonDocumentRepository (typically Prisma). Optional IJsonDocumentPayloadValidatorPort (default no-op).
What it does
JsonStoreModule.forRoot- HTTP controller for documents
JsonStoreFacadefor programmatic access (cron payloads, email templates, …)- Errors: not found, duplicate key, invalid document
Usage
await this.jsonStore.upsert(
'cron:purge-notifications',
'cron',
{ /* payload; use CronJobPayloadSchema when storing cron jobs */ },
);Do not inject IJsonDocumentRepository from feature modules.
Build (this repo)
npm run build -w @ssdev-toolkit/nestjs-json-storeOverview: root README.
