@warlock.js/seal 5.32.0 → 5.34.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 +29 -72
- package/cjs/index.cjs +39 -8
- package/cjs/index.cjs.map +1 -1
- package/cjs/{object-BoVGJ68E.cjs → object-Um5Ds4ch.cjs} +9 -6
- package/cjs/{object-BoVGJ68E.cjs.map → object-Um5Ds4ch.cjs.map} +1 -1
- package/cjs/object.cjs +2 -2
- package/cjs/{required-methods-BJlnLnwa.cjs → required-methods-Bh481cKm.cjs} +17 -2
- package/cjs/required-methods-Bh481cKm.cjs.map +1 -0
- package/cjs/{string-CM8x0u2w.cjs → string-BOKt6UtS.cjs} +2 -2
- package/cjs/{string-CM8x0u2w.cjs.map → string-BOKt6UtS.cjs.map} +1 -1
- package/cjs/string.cjs +2 -2
- package/esm/factory/validators.d.mts +10 -3
- package/esm/factory/validators.d.mts.map +1 -1
- package/esm/factory/validators.mjs +9 -1
- package/esm/factory/validators.mjs.map +1 -1
- package/esm/helpers/plain-object.mjs +11 -0
- package/esm/helpers/plain-object.mjs.map +1 -0
- package/esm/rules/common/type-rules.d.mts.map +1 -1
- package/esm/rules/common/type-rules.mjs +3 -2
- package/esm/rules/common/type-rules.mjs.map +1 -1
- package/esm/validators/object-validator.mjs +9 -6
- package/esm/validators/object-validator.mjs.map +1 -1
- package/esm/validators/record-validator.d.mts +3 -1
- package/esm/validators/record-validator.d.mts.map +1 -1
- package/esm/validators/record-validator.mjs +28 -4
- package/esm/validators/record-validator.mjs.map +1 -1
- package/llms-full.txt +21 -2
- package/package.json +1 -1
- package/skills/define-structural-shape/SKILL.md +21 -2
- package/cjs/required-methods-BJlnLnwa.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ 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.34.0 - 2026-10-19
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **BREAKING** `v.object()` requires a plain or null-prototype object; arrays, built-ins, class instances and custom prototypes fail even with unknown-key options enabled.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `v.record(keyValidator, valueValidator, errorMessage?)` validates original property names and values, infers partial literal-key dictionaries, and emits key JSON Schema. Existing value-only and error-message forms remain supported.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Reject malformed record validator arguments at schema definition with a clear `TypeError`.
|
|
20
|
+
|
|
21
|
+
### Upgrading
|
|
22
|
+
|
|
23
|
+
- Convert class instances to explicit plain DTOs before object validation; use array or instance validators for those inputs. No permissive object opt-in is provided because it would recreate accidental array acceptance.
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
- Remove the remaining ESLint, Prettier and typescript-eslint development dependencies; package linting and formatting use Oxlint/Oxfmt.
|
|
28
|
+
|
|
29
|
+
## 5.33.0 - 2026-10-19
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- Use root Oxlint/Oxfmt binaries and configuration for package lint/fix and format scripts. Legacy ESLint/Prettier dependencies and configs remain until the 5.34.0 removal.
|
|
34
|
+
|
|
7
35
|
## 5.32.0 - 2026-10-18
|
|
8
36
|
|
|
9
37
|
### Changed
|
|
@@ -74,7 +102,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
74
102
|
|
|
75
103
|
### Changed
|
|
76
104
|
|
|
77
|
-
-
|
|
105
|
+
- Skills refer to other topics by name instead of file paths, so cross-references keep working after `agent-kit` copies them into an app.
|
|
78
106
|
|
|
79
107
|
## 5.28.0 - 2026-10-01
|
|
80
108
|
|
|
@@ -88,12 +116,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
88
116
|
|
|
89
117
|
- Dependency: @mongez/supportive-is 3.0 (type-predicate checkers).
|
|
90
118
|
|
|
91
|
-
## 5.26.0 - 2026-09-30
|
|
92
|
-
|
|
93
|
-
### Changed
|
|
94
|
-
|
|
95
|
-
- Lockstep release; package APIs are unchanged.
|
|
96
|
-
|
|
97
119
|
## 5.25.0 - 2026-09-28
|
|
98
120
|
|
|
99
121
|
### Fixed
|
|
@@ -105,24 +127,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
105
127
|
|
|
106
128
|
- **Behaviour change:** Empty and whitespace-only form values are treated as missing by non-string validators, so optional fields are omitted, nullable fields resolve to `null`, and required fields report `required`.
|
|
107
129
|
|
|
108
|
-
## 5.24.0 - 2026-09-27
|
|
109
|
-
|
|
110
|
-
### Changed
|
|
111
|
-
|
|
112
|
-
- Lockstep release; package APIs are unchanged.
|
|
113
|
-
|
|
114
|
-
## 5.23.2 - 2026-09-26
|
|
115
|
-
|
|
116
|
-
### Changed
|
|
117
|
-
|
|
118
|
-
- Lockstep patch release; package APIs are unchanged.
|
|
119
|
-
|
|
120
|
-
## 5.23.1 - 2026-09-26
|
|
121
|
-
|
|
122
|
-
### Changed
|
|
123
|
-
|
|
124
|
-
- Lockstep patch release; package APIs are unchanged.
|
|
125
|
-
|
|
126
130
|
## 5.23.0 - 2026-09-25
|
|
127
131
|
|
|
128
132
|
### Added
|
|
@@ -133,24 +137,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
133
137
|
|
|
134
138
|
- An omitted optional field skips its mutators, so `v.string().trim().optional()` no longer reports a missing field as required.
|
|
135
139
|
|
|
136
|
-
## 5.22.1 - 2026-09-25
|
|
137
|
-
|
|
138
|
-
### Changed
|
|
139
|
-
|
|
140
|
-
- Lockstep patch release; package APIs are unchanged.
|
|
141
|
-
|
|
142
|
-
## 5.22.0 - 2026-09-25
|
|
143
|
-
|
|
144
|
-
### Changed
|
|
145
|
-
|
|
146
|
-
- Lockstep release maintenance and dependency refresh.
|
|
147
|
-
|
|
148
|
-
## 5.21.0 - 2026-09-25
|
|
149
|
-
|
|
150
|
-
### Changed
|
|
151
|
-
|
|
152
|
-
- Lockstep release maintenance and dependency refresh.
|
|
153
|
-
|
|
154
140
|
## 5.20.0 - 2026-09-24
|
|
155
141
|
|
|
156
142
|
### Changed
|
|
@@ -218,41 +204,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
218
204
|
|
|
219
205
|
- Documentation shipped in this package's `skills/` told users to run `pnpm`-specific commands. `pnpm <binary>` has no npm equivalent, so those instructions failed outright for anyone not using pnpm. Commands are now package-manager neutral.
|
|
220
206
|
|
|
221
|
-
## 5.2.3 - 2026-09-02
|
|
222
|
-
|
|
223
|
-
### Fixed
|
|
224
|
-
|
|
225
|
-
- Released in exact lockstep with Core's Web generator repairs so every family dependency remains installable at 5.2.3.
|
|
226
|
-
|
|
227
207
|
## 5.2.2
|
|
228
208
|
|
|
229
209
|
### Maintenance
|
|
230
210
|
|
|
231
211
|
- Restored the Warlock family to one exact, installable lockstep version.
|
|
232
212
|
|
|
233
|
-
## 5.2.0
|
|
234
|
-
|
|
235
|
-
No changes to `@warlock.js/seal`. Released in lockstep with the v5.2 routing,
|
|
236
|
-
production-build, security, and diagnostics changes in `@warlock.js/core` and
|
|
237
|
-
`@warlock.js/web`; see those packages' changelogs.
|
|
238
|
-
|
|
239
|
-
## 5.1.0
|
|
240
|
-
|
|
241
|
-
No changes to `@warlock.js/seal`. Released in lockstep with the `@warlock.js/web`
|
|
242
|
-
React-execution fix and the `@warlock.js/core` CLI additions — see those packages'
|
|
243
|
-
changelogs.
|
|
244
|
-
|
|
245
|
-
## 5.0.2 - 2026-08-25
|
|
246
|
-
|
|
247
|
-
No changes to `@warlock.js/seal`. Released in lockstep with the `@warlock.js/web` SSR
|
|
248
|
-
fix (`ssr.noExternal`) — see that package's changelog.
|
|
249
|
-
|
|
250
|
-
## 5.0.1 - 2026-08-25
|
|
251
|
-
|
|
252
|
-
No changes to `@warlock.js/seal`. Released in lockstep with the `create-warlock` vite
|
|
253
|
-
resolution pin and the `@warlock.js/web` peer narrowing — see those packages'
|
|
254
|
-
changelogs.
|
|
255
|
-
|
|
256
213
|
## 5.0.0 - 2026-08-25
|
|
257
214
|
|
|
258
215
|
### Changed
|
package/cjs/index.cjs
CHANGED
|
@@ -26,9 +26,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
}) : target, mod));
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
const require_required_methods = require("./required-methods-
|
|
30
|
-
const require_object = require("./object-
|
|
31
|
-
const require_string = require("./string-
|
|
29
|
+
const require_required_methods = require("./required-methods-Bh481cKm.cjs");
|
|
30
|
+
const require_object = require("./object-Um5Ds4ch.cjs");
|
|
31
|
+
const require_string = require("./string-BOKt6UtS.cjs");
|
|
32
32
|
let _mongez_reinforcements = require("@mongez/reinforcements");
|
|
33
33
|
let _mongez_supportive_is = require("@mongez/supportive-is");
|
|
34
34
|
let dayjs = require("dayjs");
|
|
@@ -2257,10 +2257,17 @@ var NumericValidator = class extends NumberValidator {
|
|
|
2257
2257
|
* ```
|
|
2258
2258
|
*/
|
|
2259
2259
|
var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
2260
|
-
constructor(
|
|
2260
|
+
constructor(first, second, errorMessage) {
|
|
2261
2261
|
super();
|
|
2262
|
-
|
|
2263
|
-
|
|
2262
|
+
if (!(first instanceof require_required_methods.BaseValidator)) throw new TypeError("v.record(): expected a value validator or a key validator followed by a value validator");
|
|
2263
|
+
if (second !== void 0 && typeof second !== "string" && !(second instanceof require_required_methods.BaseValidator)) throw new TypeError("v.record(): second argument must be a value validator or an error message");
|
|
2264
|
+
if (errorMessage !== void 0 && typeof errorMessage !== "string") throw new TypeError("v.record(): error message must be a string");
|
|
2265
|
+
this.keyValidator = second instanceof require_required_methods.BaseValidator ? first : void 0;
|
|
2266
|
+
this.valueValidator = second instanceof require_required_methods.BaseValidator ? second : first;
|
|
2267
|
+
this.addMutableRule(this.keyValidator ? {
|
|
2268
|
+
...require_required_methods.plainObjectRule,
|
|
2269
|
+
name: "object"
|
|
2270
|
+
} : require_required_methods.objectRule, typeof second === "string" ? second : errorMessage);
|
|
2264
2271
|
}
|
|
2265
2272
|
/**
|
|
2266
2273
|
* Validate it as plain object
|
|
@@ -2280,6 +2287,7 @@ var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
|
2280
2287
|
clone() {
|
|
2281
2288
|
const cloned = super.clone();
|
|
2282
2289
|
cloned.valueValidator = this.valueValidator.clone();
|
|
2290
|
+
cloned.keyValidator = this.keyValidator?.clone();
|
|
2283
2291
|
return cloned;
|
|
2284
2292
|
}
|
|
2285
2293
|
/**
|
|
@@ -2289,7 +2297,15 @@ var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
|
2289
2297
|
* so the parent ObjectValidator can omit the key. Without this, optional record
|
|
2290
2298
|
* fields would silently materialise as `{}` in the validated output.
|
|
2291
2299
|
*/
|
|
2292
|
-
async validate(data, context
|
|
2300
|
+
async validate(data, context = {
|
|
2301
|
+
allValues: data,
|
|
2302
|
+
parent: null,
|
|
2303
|
+
value: data,
|
|
2304
|
+
key: "",
|
|
2305
|
+
path: "",
|
|
2306
|
+
translateRule: () => "",
|
|
2307
|
+
translateAttribute: ({ attribute }) => attribute
|
|
2308
|
+
}) {
|
|
2293
2309
|
const valueForRules = data ?? this.getDefaultValue();
|
|
2294
2310
|
const mutatedData = await this.mutate(valueForRules, context);
|
|
2295
2311
|
const result = await this.validateRules(data, context);
|
|
@@ -2305,6 +2321,13 @@ var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
|
2305
2321
|
key,
|
|
2306
2322
|
path: require_object.setKeyPath(context.path, key)
|
|
2307
2323
|
};
|
|
2324
|
+
if (this.keyValidator) {
|
|
2325
|
+
const keyResult = await this.keyValidator.validate(key, {
|
|
2326
|
+
...childContext,
|
|
2327
|
+
value: key
|
|
2328
|
+
});
|
|
2329
|
+
if (!keyResult.isValid) errors.push(...keyResult.errors);
|
|
2330
|
+
}
|
|
2308
2331
|
const childResult = await this.valueValidator.validate(mutatedData[key], childContext);
|
|
2309
2332
|
mutatedData[key] = childResult.data;
|
|
2310
2333
|
if (childResult.isValid === false) errors.push(...childResult.errors);
|
|
@@ -2336,6 +2359,7 @@ var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
|
2336
2359
|
type: "object",
|
|
2337
2360
|
additionalProperties: this.valueValidator.toJsonSchema(target)
|
|
2338
2361
|
};
|
|
2362
|
+
if (this.keyValidator) schema.propertyNames = this.keyValidator.toJsonSchema(target);
|
|
2339
2363
|
if (this.isNullable) require_required_methods.applyNullable(schema, target);
|
|
2340
2364
|
return schema;
|
|
2341
2365
|
}
|
|
@@ -2688,6 +2712,13 @@ var UnionValidator = class extends require_required_methods.BaseValidator {
|
|
|
2688
2712
|
|
|
2689
2713
|
//#endregion
|
|
2690
2714
|
//#region ../../packages/seal/src/factory/validators.ts
|
|
2715
|
+
function record(first, second, errorMessage) {
|
|
2716
|
+
if (second instanceof require_required_methods.BaseValidator) {
|
|
2717
|
+
if (first === void 0) throw new TypeError("v.record(): a key validator is required before the value validator");
|
|
2718
|
+
return new RecordValidator(first, second, errorMessage);
|
|
2719
|
+
}
|
|
2720
|
+
return new RecordValidator(first === void 0 ? new AnyValidator() : first, second);
|
|
2721
|
+
}
|
|
2691
2722
|
/**
|
|
2692
2723
|
* Seal factory object - creates instances of validators
|
|
2693
2724
|
*
|
|
@@ -2701,7 +2732,7 @@ const v = {
|
|
|
2701
2732
|
/** Create an array validator */
|
|
2702
2733
|
array: (validator, errorMessage) => new ArrayValidator(validator, errorMessage),
|
|
2703
2734
|
/** Create a record validator - object with dynamic keys and consistent value types */
|
|
2704
|
-
record
|
|
2735
|
+
record,
|
|
2705
2736
|
/**
|
|
2706
2737
|
* Create a tuple validator - fixed-length array with position-specific types.
|
|
2707
2738
|
*
|