lazypock 0.19.2 → 0.20.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/README.md +36 -0
- package/dist/index.cjs +905 -674
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +232 -82
- package/dist/index.d.ts +232 -82
- package/dist/index.global.js +904 -674
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +904 -674
- package/dist/index.js.map +1 -1
- package/package.json +19 -2
- package/src/auth.ts +29 -0
- package/src/collection/auth.ts +289 -0
- package/src/collection/index.ts +754 -0
- package/src/collection/paths.ts +21 -0
- package/src/collection/query.ts +111 -0
- package/src/collection/realtime.ts +141 -0
- package/src/collection/session.ts +76 -0
- package/src/collections.ts +18 -52
- package/src/expand.ts +286 -0
- package/src/files.ts +15 -2
- package/src/filter.ts +2 -2
- package/src/http.ts +37 -6
- package/src/index.ts +12 -0
- package/src/lazypock.ts +65 -71
- package/src/mail.ts +290 -0
- package/src/paginate.ts +111 -0
- package/src/projection.ts +139 -0
- package/src/query-params.ts +74 -0
- package/src/realtime.ts +6 -0
- package/src/types.ts +1 -1
- package/src/collection.ts +0 -1412
package/README.md
CHANGED
|
@@ -449,6 +449,23 @@ PocketBase-style service for the collections themselves (admin):
|
|
|
449
449
|
- `getThumbUrl(baseUrl, fileId, size)` — Construct a thumbnail URL for a pre-configured thumb size
|
|
450
450
|
- `getScaleUrl(baseUrl, fileId, size)` — Construct an on-demand scaled image URL (e.g. `100x100`, `400x`)
|
|
451
451
|
|
|
452
|
+
### Mail (`client.mail`)
|
|
453
|
+
|
|
454
|
+
Send email through the deployment's SMTP settings, and manage its templates. Sending **queues** a
|
|
455
|
+
job (it does not deliver inline); failures surface on the job in `GET /api/logs`.
|
|
456
|
+
|
|
457
|
+
- `mail.send({ to, template, assigns? }, options?)` — Queue a message from a template (API-keyable)
|
|
458
|
+
- `mail.send({ to, subject, html?, text? }, options?)` — Queue a raw message (API-keyable)
|
|
459
|
+
- `mail.listTemplates(options?)` — Every template, with resolved bodies and the layer each part came from (superuser)
|
|
460
|
+
- `mail.getTemplate(name, options?)` — One template (superuser)
|
|
461
|
+
- `mail.saveTemplate(name, { subject, html, text }, options?)` — Replace all three parts; parsed before it is stored (superuser)
|
|
462
|
+
- `mail.deleteTemplate(name, options?)` — Remove the stored parts, falling back to the file or the built-in (superuser)
|
|
463
|
+
- `mail.preview(name, { assigns?, toName?, subject?, html?, text? }, options?)` — Render without storing or sending (superuser)
|
|
464
|
+
|
|
465
|
+
Defining a template is deliberately **not** API-keyable: a template is rendered with the variables of
|
|
466
|
+
an auth email — a verification or password-reset token — so whoever can write one can mail
|
|
467
|
+
themselves somebody else's token.
|
|
468
|
+
|
|
452
469
|
### Realtime
|
|
453
470
|
|
|
454
471
|
- `realtime.connect(opts)` — Open the SSE stream (`{ url, token }`)
|
|
@@ -751,6 +768,25 @@ const off = client.realtime.subscribe('chat:room1', (event) => {
|
|
|
751
768
|
off(); // or client.realtime.unsubscribe('chat:room1');
|
|
752
769
|
```
|
|
753
770
|
|
|
771
|
+
## Local development
|
|
772
|
+
|
|
773
|
+
```bash
|
|
774
|
+
bun install
|
|
775
|
+
bun run typecheck # tsc --noEmit
|
|
776
|
+
bun test # unit tests (test/*.test.ts, run against src/, no build)
|
|
777
|
+
bun run smoke # build + runtime, realtime, auth-store, oauth2 and type-level suites
|
|
778
|
+
bun run bench # codegen + HTTP-overhead benchmarks
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
CI runs `typecheck`, `bun test` and `smoke` on every pull request and on
|
|
782
|
+
pushes to `main` (`.github/workflows/ci.yml`).
|
|
783
|
+
|
|
784
|
+
The source is split by concern: record CRUD lives in `src/collection/index.ts`
|
|
785
|
+
(the public `CollectionService` facade), while the schema-aware query logic is
|
|
786
|
+
in pure, directly testable modules — `src/expand.ts` (expand/field-selection
|
|
787
|
+
normalisation), `src/projection.ts` (field projection), `src/paginate.ts`
|
|
788
|
+
(full-list paging + dedup keys) and `src/collection/{auth,realtime,query}.ts`.
|
|
789
|
+
|
|
754
790
|
## Releasing (automatic)
|
|
755
791
|
|
|
756
792
|
Releases are fully automatic via [release-please](https://github.com/googleapis/release-please):
|