@spfn/core 0.3.0-beta.22 → 0.3.0-beta.23
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/dist/authz/index.js +46 -10
- package/dist/authz/index.js.map +1 -1
- package/dist/errors/index.d.ts +18 -1
- package/dist/errors/index.js +46 -10
- package/dist/errors/index.js.map +1 -1
- package/dist/middleware/index.js +46 -10
- package/dist/middleware/index.js.map +1 -1
- package/package.json +1 -1
- package/src/errors/README.md +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spfn/core",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.23",
|
|
4
4
|
"description": "Full-stack TypeScript backend for Next.js: file-based typed routes, Drizzle entities and repositories, PostgreSQL transactions and a generated end-to-end client, in one fixed vertical slice per feature",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
package/src/errors/README.md
CHANGED
|
@@ -276,6 +276,22 @@ const maybe = registry.tryDeserialize(body); // null if __type missing/unknown (
|
|
|
276
276
|
`getRegisteredTypes()`. Constructor accepts an array mixing single classes, arrays of
|
|
277
277
|
classes, and other `ErrorRegistry` instances (`ErrorRegistryInput[]`).
|
|
278
278
|
|
|
279
|
+
### Minified browser bundles
|
|
280
|
+
|
|
281
|
+
A production browser bundle renames classes — `PaymentFailedError` becomes `Q` — but keeps the
|
|
282
|
+
string a constructor assigns to `this.name`. The server is not minified, so `__type` still
|
|
283
|
+
carries the original class name. `append()` therefore keys each class by its constructor name
|
|
284
|
+
and also by the `name` its instances set for themselves, read once by building the class with
|
|
285
|
+
`{}`. A lookup tries the constructor name first, so an unminified registry resolves exactly as
|
|
286
|
+
it always has.
|
|
287
|
+
|
|
288
|
+
For a class to be restored in a minified browser:
|
|
289
|
+
|
|
290
|
+
- **Set `this.name` to the class name in the constructor.** A class that leaves it unset only
|
|
291
|
+
inherits its parent's name, and is not keyed under it — that key belongs to the parent.
|
|
292
|
+
- **Let the constructor build with `{}`.** One that throws without its fields is keyed by its
|
|
293
|
+
constructor name only.
|
|
294
|
+
|
|
279
295
|
---
|
|
280
296
|
|
|
281
297
|
## Custom errors
|