@warlock.js/seal 5.25.0 → 5.26.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/CHANGELOG.md +6 -0
- package/llms-full.txt +6 -8
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to `@warlock.js/seal` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.26.0 - 2026-09-30
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Lockstep release; package APIs are unchanged.
|
|
12
|
+
|
|
7
13
|
## 5.25.0 - 2026-09-28
|
|
8
14
|
|
|
9
15
|
### Fixed
|
package/llms-full.txt
CHANGED
|
@@ -189,10 +189,9 @@ v.string().min(3).trim()
|
|
|
189
189
|
## `.required()` / `.optional()` / `.present()`
|
|
190
190
|
|
|
191
191
|
```ts
|
|
192
|
-
v.string() // already required inside v.object
|
|
192
|
+
v.string() // already required inside v.object
|
|
193
193
|
v.string().optional() // type: string | undefined — { isOptional: true } brand
|
|
194
194
|
v.string().present() // must exist, may be "" / null
|
|
195
|
-
v.string().required() // explicit form — same behavior, redundant
|
|
196
195
|
```
|
|
197
196
|
|
|
198
197
|
**Required is the default inside `v.object`.** Most schemas read cleaner without `.required()` — `Infer<>` already shows what's required (no `?`) vs optional (`?`). Calling `.required()` explicitly is harmless and accepted, but the canonical seal style is to skip it. Keep `.optional()` explicit (it changes behavior); skip `.required()` (it doesn't).
|
|
@@ -200,7 +199,6 @@ v.string().required() // explicit form — same behavior, redundant
|
|
|
200
199
|
The `{ isOptional: true }` brand survives chaining (`.optional().min(3)` is still optional) and `Infer<>` reads it to make the key optional.
|
|
201
200
|
|
|
202
201
|
**When `.required()` is still useful:**
|
|
203
|
-
- Visual contrast next to `.optional()` siblings when you want the asymmetry to be loud — style call.
|
|
204
202
|
- It's not needed for conditional rules — `.requiredIf(field, value)` and friends *replace* the default required-condition slot, so they work standalone.
|
|
205
203
|
|
|
206
204
|
Conditional variants (run inside `v.object` only):
|
|
@@ -397,7 +395,7 @@ Validators are **immutable by default**. Every chain method returns a clone:
|
|
|
397
395
|
|
|
398
396
|
```ts
|
|
399
397
|
const baseString = v.string();
|
|
400
|
-
const
|
|
398
|
+
const short = baseString.min(3);
|
|
401
399
|
// baseString is unchanged
|
|
402
400
|
```
|
|
403
401
|
|
|
@@ -406,7 +404,7 @@ This matters because schemas are often shared (`Model.schema = v.object({...})`)
|
|
|
406
404
|
Toggle in-place with the `.mutable` getter (rare):
|
|
407
405
|
|
|
408
406
|
```ts
|
|
409
|
-
const schema = v.string().mutable.
|
|
407
|
+
const schema = v.string().mutable.min(3);
|
|
410
408
|
// Same instance throughout — useful when building dynamically
|
|
411
409
|
```
|
|
412
410
|
|
|
@@ -749,8 +747,8 @@ The default is to **reject** unknown keys, which is what you want for inbound pa
|
|
|
749
747
|
|
|
750
748
|
```ts
|
|
751
749
|
const publicArticle = v.object({
|
|
752
|
-
id: v.string()
|
|
753
|
-
title: v.string()
|
|
750
|
+
id: v.string(),
|
|
751
|
+
title: v.string(),
|
|
754
752
|
}).stripUnknown();
|
|
755
753
|
|
|
756
754
|
const { isValid, data } = await v.validate(publicArticle, record);
|
|
@@ -2200,7 +2198,7 @@ import { object } from "@warlock.js/seal/object";
|
|
|
2200
2198
|
import { string } from "@warlock.js/seal/string";
|
|
2201
2199
|
|
|
2202
2200
|
const commentSchema = object({
|
|
2203
|
-
comment: string().trim().
|
|
2201
|
+
comment: string().trim().minLength(3),
|
|
2204
2202
|
});
|
|
2205
2203
|
|
|
2206
2204
|
const result = await commentSchema["~standard"].validate({
|
package/llms.txt
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
## Skills
|
|
8
8
|
|
|
9
9
|
- [bridge-standard-schema](@warlock.js/seal/bridge-standard-schema/SKILL.md): (no description)
|
|
10
|
-
- [compose-seal-modifiers](@warlock.js/seal/compose-seal-modifiers/SKILL.md):
|
|
10
|
+
- [compose-seal-modifiers](@warlock.js/seal/compose-seal-modifiers/SKILL.md): Apply cross-cutting modifiers — `.optional` / `.nullable` / `.default` / `.catch` / `.omit` / membership rules — plus the mutator-vs-transformer pipeline and `Infer.Input` vs `Infer.Output`. Triggers: `.optional`, `.required`, `.nullable`, `.default`, `.catch`, `.present`, `.requiredIf`, `.requiredWith`, `.in`, `.oneOf`, `.notIn`, `.omit`, `.attribute`, `.mutable`, `.addMutator`, `Infer.Input`, `Infer.Output`; "mark field optional in seal", "default value in schema", "mutator vs transformer", "when does .catch fire"; typical import `import { v, type Infer } from "@warlock.js/seal"`. Skip: primitives — `@warlock.js/seal/pick-seal-primitive/SKILL.md`; containers — `@warlock.js/seal/define-structural-shape/SKILL.md`; errors — `@warlock.js/seal/handle-seal-errors/SKILL.md`; competing `zod` `.optional`/`.default`.
|
|
11
11
|
- [define-structural-shape](@warlock.js/seal/define-structural-shape/SKILL.md): (no description)
|
|
12
12
|
- [extend-seal-with-plugins](@warlock.js/seal/extend-seal-with-plugins/SKILL.md): (no description)
|
|
13
13
|
- [generate-json-schema](@warlock.js/seal/generate-json-schema/SKILL.md): (no description)
|