@warlock.js/seal 5.33.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 CHANGED
@@ -4,6 +4,28 @@ 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
+
7
29
  ## 5.33.0 - 2026-10-19
8
30
 
9
31
  ### Changed
@@ -80,7 +102,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
80
102
 
81
103
  ### Changed
82
104
 
83
- - Lockstep release; package APIs are unchanged. Skills refer to other topics by name instead of file paths, so cross-references keep working after `agent-kit` copies them into an app.
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.
84
106
 
85
107
  ## 5.28.0 - 2026-10-01
86
108
 
@@ -94,12 +116,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
94
116
 
95
117
  - Dependency: @mongez/supportive-is 3.0 (type-predicate checkers).
96
118
 
97
- ## 5.26.0 - 2026-09-30
98
-
99
- ### Changed
100
-
101
- - Lockstep release; package APIs are unchanged.
102
-
103
119
  ## 5.25.0 - 2026-09-28
104
120
 
105
121
  ### Fixed
@@ -111,24 +127,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
111
127
 
112
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`.
113
129
 
114
- ## 5.24.0 - 2026-09-27
115
-
116
- ### Changed
117
-
118
- - Lockstep release; package APIs are unchanged.
119
-
120
- ## 5.23.2 - 2026-09-26
121
-
122
- ### Changed
123
-
124
- - Lockstep patch release; package APIs are unchanged.
125
-
126
- ## 5.23.1 - 2026-09-26
127
-
128
- ### Changed
129
-
130
- - Lockstep patch release; package APIs are unchanged.
131
-
132
130
  ## 5.23.0 - 2026-09-25
133
131
 
134
132
  ### Added
@@ -139,24 +137,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
139
137
 
140
138
  - An omitted optional field skips its mutators, so `v.string().trim().optional()` no longer reports a missing field as required.
141
139
 
142
- ## 5.22.1 - 2026-09-25
143
-
144
- ### Changed
145
-
146
- - Lockstep patch release; package APIs are unchanged.
147
-
148
- ## 5.22.0 - 2026-09-25
149
-
150
- ### Changed
151
-
152
- - Lockstep release maintenance and dependency refresh.
153
-
154
- ## 5.21.0 - 2026-09-25
155
-
156
- ### Changed
157
-
158
- - Lockstep release maintenance and dependency refresh.
159
-
160
140
  ## 5.20.0 - 2026-09-24
161
141
 
162
142
  ### Changed
@@ -224,41 +204,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
224
204
 
225
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.
226
206
 
227
- ## 5.2.3 - 2026-09-02
228
-
229
- ### Fixed
230
-
231
- - Released in exact lockstep with Core's Web generator repairs so every family dependency remains installable at 5.2.3.
232
-
233
207
  ## 5.2.2
234
208
 
235
209
  ### Maintenance
236
210
 
237
211
  - Restored the Warlock family to one exact, installable lockstep version.
238
212
 
239
- ## 5.2.0
240
-
241
- No changes to `@warlock.js/seal`. Released in lockstep with the v5.2 routing,
242
- production-build, security, and diagnostics changes in `@warlock.js/core` and
243
- `@warlock.js/web`; see those packages' changelogs.
244
-
245
- ## 5.1.0
246
-
247
- No changes to `@warlock.js/seal`. Released in lockstep with the `@warlock.js/web`
248
- React-execution fix and the `@warlock.js/core` CLI additions — see those packages'
249
- changelogs.
250
-
251
- ## 5.0.2 - 2026-08-25
252
-
253
- No changes to `@warlock.js/seal`. Released in lockstep with the `@warlock.js/web` SSR
254
- fix (`ssr.noExternal`) — see that package's changelog.
255
-
256
- ## 5.0.1 - 2026-08-25
257
-
258
- No changes to `@warlock.js/seal`. Released in lockstep with the `create-warlock` vite
259
- resolution pin and the `@warlock.js/web` peer narrowing — see those packages'
260
- changelogs.
261
-
262
213
  ## 5.0.0 - 2026-08-25
263
214
 
264
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-BJlnLnwa.cjs");
30
- const require_object = require("./object-BoVGJ68E.cjs");
31
- const require_string = require("./string-CM8x0u2w.cjs");
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(valueValidator, errorMessage) {
2260
+ constructor(first, second, errorMessage) {
2261
2261
  super();
2262
- this.valueValidator = valueValidator;
2263
- this.addMutableRule(require_required_methods.objectRule, errorMessage);
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: (validator, errorMessage) => new RecordValidator(validator || v.any(), errorMessage),
2735
+ record,
2705
2736
  /**
2706
2737
  * Create a tuple validator - fixed-length array with position-specific types.
2707
2738
  *