@polotno/schema 0.10.0 → 0.12.0
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 +1 -0
- package/lib/defaults.d.ts +14 -16
- package/lib/defaults.js +5 -7
- package/lib/design.schema.json +1 -3147
- package/lib/errors.d.ts +2 -2
- package/lib/errors.js +2 -2
- package/lib/migrate.js +1 -1
- package/lib/schema.d.ts +246 -166
- package/lib/schema.js +95 -10
- package/lib/types.d.ts +17 -7
- package/package.json +4 -5
package/lib/errors.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* `code` property (branch on it, like `err.code === 'ENOENT'`) and optional
|
|
4
4
|
* JSON-serializable `details`. Messages are for humans and may change in any
|
|
5
5
|
* release — never match on them. No classes, no instanceof — a code check
|
|
6
|
-
* works on any copy of any package.
|
|
7
|
-
*
|
|
6
|
+
* works on any copy of any package. The rules live in the header of
|
|
7
|
+
* `@polotno/core`'s `src/errors.ts`, beside the canonical map.
|
|
8
8
|
*
|
|
9
9
|
* `@polotno/schema` is the layer *below* `@polotno/core`, so it can't import
|
|
10
10
|
* core's shared error map — it defines its own. It only ever throws
|
package/lib/errors.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* `code` property (branch on it, like `err.code === 'ENOENT'`) and optional
|
|
4
4
|
* JSON-serializable `details`. Messages are for humans and may change in any
|
|
5
5
|
* release — never match on them. No classes, no instanceof — a code check
|
|
6
|
-
* works on any copy of any package.
|
|
7
|
-
*
|
|
6
|
+
* works on any copy of any package. The rules live in the header of
|
|
7
|
+
* `@polotno/core`'s `src/errors.ts`, beside the canonical map.
|
|
8
8
|
*
|
|
9
9
|
* `@polotno/schema` is the layer *below* `@polotno/core`, so it can't import
|
|
10
10
|
* core's shared error map — it defines its own. It only ever throws
|
package/lib/migrate.js
CHANGED
|
@@ -123,7 +123,7 @@ export function migrateDesign(json, options = {}) {
|
|
|
123
123
|
// Guard BEFORE the round-trip: JSON.parse(JSON.stringify(undefined)) throws a
|
|
124
124
|
// raw SyntaxError, and a circular object throws TypeError. Non-designs must
|
|
125
125
|
// reach the zod pass untouched so they surface as a structured
|
|
126
|
-
// DESIGN_INVALID, per the error contract in
|
|
126
|
+
// DESIGN_INVALID, per the error contract in core's errors.ts header.
|
|
127
127
|
if (!json || typeof json !== 'object')
|
|
128
128
|
return json;
|
|
129
129
|
const data = JSON.parse(JSON.stringify(json));
|