chore: version packages - #40
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@zipbul/baker@5.2.0
Minor Changes
f768694: Fix four correctness bugs found in a package-wide audit. Two of them change observable behavior for
input that previously "worked", so review before upgrading:
@IsEnumwith numeric enums (behavior change). TypeScript numeric enums compile to a reverse-mappedobject (
{ 0: 'Inactive', 1: 'Active', Active: 1, Inactive: 0 }), so the previousObject.values()lookup wrongly accepted the member-name strings (e.g.
'Active') as valid values. Values are now readthrough the non-numeric keys, so only real members pass — correct for string, numeric, and heterogeneous
enums. Input that relied on the member-name strings being accepted will now be rejected.
momentTransformerparses in UTC (behavior change). It now usesmoment.utc(value)so a zonelessdatetime string resolves to the same instant on every host; previously local-time parsing made the
serialized output depend on the machine timezone. Zoneless inputs that were parsed in local time will now
be parsed as UTC. Matches
luxonTransformer's UTC default.luxonTransformerinvalid-date passthrough. An unparseable date string /Datenow passes throughuntouched instead of being laundered into an Invalid
DateTime(which serialized tonull/"Invalid DateTime"and corrupted data). MatchesmomentTransformer's pass-through contract.Per-call
groupsoption validation. A non-string[]groupsvalue now throws a clearBakerErrorat the call boundary instead of silently misbehaving inside the generated executor.
26e13af: Fix declared-collection element validation (RED tests added first), speed up collection
validate, andland an internal layering cleanup. One item changes observable behavior — review before upgrading:
Declared
@Type(() => Set)/@Type(() => Map)now validate their elements (behavior change). Thedeclared-collection codegen path hand-rolled its per-element loop separately from the canonical
(
type: null) path and had three defects: a declared Map dropped every per-elementeachruleentirely; declared Set/Map
eachrules ignored the runtimegroupsfilter; and a functionmessageonan
eachrule received the whole collection asvalueinstead of the failing element. All four sites(Set/Map × deserialize/validate) now route through one shared emitter with the same rule-major ordering,
group filtering, per-element
valuebinding, andfield[i]paths as the canonical path. Input that wassilently accepted because a Map's element rules never ran will now be validated.
Collection
validateis ~4.7× faster on large arrays. The inline-nested validate path eagerlyallocated a per-element error-path string (
field[i].) on every element even for valid input; it is nowbuilt only at the (cold) error-push sites. A 1000-element nested-DTO
validatedrops from ~10µs to~2.2µs (now on par with TypeBox and ahead of Ajv).
deserializeand all error paths are byte-identical.createRuleis now also exported from the@zipbul/baker/rulessubpath (it was already exported fromthe package root).
luxonTransformer/momentTransformerpeer-dep error is now precise. A genuinely-missing peer stillthrows the "install it"
BakerError; a peer that IS installed but throws during evaluation now surfacesits real error instead of the misleading install hint.
Internal-only (no API change): the seal stage's TypeDef normalization was extracted out of the
sealOnegod-function, large static lookup tables and the
string-formatvalidators were split into cohesivemodules, and several stateless helpers were simplified. Public surface is unchanged except the
createRulesubpath export above (verified by an export-diff).
96ed92c: Fix five reproduced correctness bugs (each added as a RED test first) and unify the unknown-key failure
model. Several change observable behavior — review before upgrading:
Discriminated arrays now work (was broken). A field typed
type: () => [Base]with adiscriminatorpreviously read the discriminator off the array itself (
undefined) and rejected every valid input withinvalidDiscriminator.deserialize/validatenow dispatch the discriminator switch per element,reporting nested errors at
field[i].pathand the invalid-discriminator error at thefield[i]elementpath. (serialize already handled arrays.)
serialize throws on an unmatched discriminator subtype (behavior change). When an instance matched no
instanceofbranch, serialize silently emitted the raw, un-serialized object (leaking undeclared fields).It now throws a
BakerError, symmetric with deserialize rejecting an unknown discriminator value.eachrule messages receive the failing element (behavior change). Amessage/contextfunction onan
arrayOf(...)rule was passed the whole collection asvaluewhile the path pointed atfield[i].It now receives the failing element, consistent with the element-level path.
isDateString/isISO8601({ strict: true })leap-year for years 0–99. Calendar validity usednew Date(year, …), which remaps a 0–99 year argument to 1900–1999 — so0000-02-29(a valid leap dateby the 400 rule) was wrongly rejected. Now computed with the proleptic Gregorian rule for all years (and
without allocating a
Date).isHash/isTaxIdreject an unknown algorithm/locale at construction (behavior change). Theypreviously returned a rule that always failed at runtime; they now throw a
BakerErrorwhen called withan unsupported key, matching
isMobilePhone/isPostalCode/isIdentityCard/isPassportNumber.isURLno longer shares its default-protocols array across rules. With default protocols, everyisURL()rule exposed the same module-level['http','https','ftp']array onrule.constraints;mutating one rule's constraints would have corrupted every other. Each rule now owns an independent copy.