diff --git a/.changeset/pre.json b/.changeset/pre.json index 61400572f..3a036d4a3 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -208,6 +208,7 @@ "infra-sentry-node-dep", "invalidation-set-add-shortcut-and-batch", "itchy-mangos-find", + "jitm-json-store-boundary", "khaki-frogs-wave", "kind-lizards-bathe", "large-pugs-strive", diff --git a/packages/e2e/CHANGELOG.md b/packages/e2e/CHANGELOG.md index 69b8d0392..2460ea483 100644 --- a/packages/e2e/CHANGELOG.md +++ b/packages/e2e/CHANGELOG.md @@ -1,5 +1,14 @@ # @effect-app/e2e +## 4.0.0-beta.326 + +### Patch Changes + +- Updated dependencies [2ebf8ae] + - effect-app@4.0.0-beta.326 + - @effect-app/infra@4.0.0-beta.326 + - @effect-app/vue@4.0.0-beta.326 + ## 4.0.0-beta.325 ### Patch Changes diff --git a/packages/e2e/package.json b/packages/e2e/package.json index 483aa02f9..e27524697 100644 --- a/packages/e2e/package.json +++ b/packages/e2e/package.json @@ -1,6 +1,6 @@ { "name": "@effect-app/e2e", - "version": "4.0.0-beta.325", + "version": "4.0.0-beta.326", "license": "MIT", "type": "module", "private": true, diff --git a/packages/effect-app/CHANGELOG.md b/packages/effect-app/CHANGELOG.md index f7a553a12..89fed7943 100644 --- a/packages/effect-app/CHANGELOG.md +++ b/packages/effect-app/CHANGELOG.md @@ -1,5 +1,21 @@ # @effect-app/prelude +## 4.0.0-beta.326 + +### Minor Changes + +- 2ebf8ae: `jitM` runs at the store boundary as JSON → JSON, before the `toCodecJson(toEncoded(schema))` decode; repositories decode the Encoded shape only. + + `jitM` used to be applied by the repository _after_ the store had already decoded the document, and was typed `(pm: Encoded) => Encoded` - a lie, since jitMs are written against the stored JSON and `Encoded` holds native `Date`/`Map`/`Set` values. + + The read pipeline is now: raw JSON document → merge `defaultValues` (unchanged: they only fill _absent_ keys, so an explicitly stored `null` reaches `jitM`) → `jitM` (JSON → JSON) → decode `Schema.toCodecJson(Schema.toEncoded(schema))` → Encoded. The repository then decodes Encoded → the domain type with `schema` and no longer applies `jitM` at all. Because `jitM` now runs before any schema decode sees the document, it can repair legacy shapes including explicit `null`s. + + - `StoreConfig.jitM?: (json: JsonRecord) => JsonRecord` is new, where `JsonRecord` (exported from `effect-app/Store`) is `{ readonly [key: string]: Schema.Json }`. It is not applied on the write/encode path, and never receives `_etag`. + - `RepositoryOptions.jitM` changes type from `(pm: Encoded) => Encoded` to `(json: JsonRecord) => JsonRecord` and is forwarded into the store config. + - **Migrating a jitM:** it now receives and must return JSON. A `Date` field arrives as an ISO string (return a string, not a `Date`), a `ReadonlySet` as an array, a `ReadonlyMap` as an array of `[key, value]` pairs. Field access is index-signature based (`json["x"]`) rather than typed property access. + - The JSON→Encoded decode stays strict: a document `jitM` does not repair fails at the store boundary instead of being read back half-decoded. + - `ValidationError.jitMResult` is deprecated: `validateSample` only ever sees the store's output, so it is identical to `rawData`. + ## 4.0.0-beta.325 ### Patch Changes diff --git a/packages/effect-app/package.json b/packages/effect-app/package.json index 60c188c3f..c582e7822 100644 --- a/packages/effect-app/package.json +++ b/packages/effect-app/package.json @@ -1,6 +1,6 @@ { "name": "effect-app", - "version": "4.0.0-beta.325", + "version": "4.0.0-beta.326", "license": "MIT", "type": "module", "repository": { diff --git a/packages/infra/CHANGELOG.md b/packages/infra/CHANGELOG.md index 9a306d43e..d56954f0c 100644 --- a/packages/infra/CHANGELOG.md +++ b/packages/infra/CHANGELOG.md @@ -1,5 +1,26 @@ # @effect-app/infra +## 4.0.0-beta.326 + +### Minor Changes + +- 2ebf8ae: `jitM` runs at the store boundary as JSON → JSON, before the `toCodecJson(toEncoded(schema))` decode; repositories decode the Encoded shape only. + + `jitM` used to be applied by the repository _after_ the store had already decoded the document, and was typed `(pm: Encoded) => Encoded` - a lie, since jitMs are written against the stored JSON and `Encoded` holds native `Date`/`Map`/`Set` values. + + The read pipeline is now: raw JSON document → merge `defaultValues` (unchanged: they only fill _absent_ keys, so an explicitly stored `null` reaches `jitM`) → `jitM` (JSON → JSON) → decode `Schema.toCodecJson(Schema.toEncoded(schema))` → Encoded. The repository then decodes Encoded → the domain type with `schema` and no longer applies `jitM` at all. Because `jitM` now runs before any schema decode sees the document, it can repair legacy shapes including explicit `null`s. + + - `StoreConfig.jitM?: (json: JsonRecord) => JsonRecord` is new, where `JsonRecord` (exported from `effect-app/Store`) is `{ readonly [key: string]: Schema.Json }`. It is not applied on the write/encode path, and never receives `_etag`. + - `RepositoryOptions.jitM` changes type from `(pm: Encoded) => Encoded` to `(json: JsonRecord) => JsonRecord` and is forwarded into the store config. + - **Migrating a jitM:** it now receives and must return JSON. A `Date` field arrives as an ISO string (return a string, not a `Date`), a `ReadonlySet` as an array, a `ReadonlyMap` as an array of `[key, value]` pairs. Field access is index-signature based (`json["x"]`) rather than typed property access. + - The JSON→Encoded decode stays strict: a document `jitM` does not repair fails at the store boundary instead of being read back half-decoded. + - `ValidationError.jitMResult` is deprecated: `validateSample` only ever sees the store's output, so it is identical to `rawData`. + +### Patch Changes + +- Updated dependencies [2ebf8ae] + - effect-app@4.0.0-beta.326 + ## 4.0.0-beta.325 ### Patch Changes diff --git a/packages/infra/package.json b/packages/infra/package.json index cfd75f4a6..ddd7b9ab0 100644 --- a/packages/infra/package.json +++ b/packages/infra/package.json @@ -1,6 +1,6 @@ { "name": "@effect-app/infra", - "version": "4.0.0-beta.325", + "version": "4.0.0-beta.326", "license": "MIT", "type": "module", "repository": { diff --git a/packages/vue-components/CHANGELOG.md b/packages/vue-components/CHANGELOG.md index e516ab2da..7b05cb05b 100644 --- a/packages/vue-components/CHANGELOG.md +++ b/packages/vue-components/CHANGELOG.md @@ -1,5 +1,13 @@ # @effect-app/vue-components +## 4.0.0-beta.326 + +### Patch Changes + +- Updated dependencies [2ebf8ae] + - effect-app@4.0.0-beta.326 + - @effect-app/vue@4.0.0-beta.326 + ## 4.0.0-beta.325 ### Patch Changes diff --git a/packages/vue-components/package.json b/packages/vue-components/package.json index 4ebbc6216..8e7d5edaa 100644 --- a/packages/vue-components/package.json +++ b/packages/vue-components/package.json @@ -1,6 +1,6 @@ { "name": "@effect-app/vue-components", - "version": "4.0.0-beta.325", + "version": "4.0.0-beta.326", "repository": { "type": "git", "url": "https://github.com/effect-app/libs.git", diff --git a/packages/vue/CHANGELOG.md b/packages/vue/CHANGELOG.md index 8dd16b6d1..1d6776816 100644 --- a/packages/vue/CHANGELOG.md +++ b/packages/vue/CHANGELOG.md @@ -1,5 +1,12 @@ # @effect-app/vue +## 4.0.0-beta.326 + +### Patch Changes + +- Updated dependencies [2ebf8ae] + - effect-app@4.0.0-beta.326 + ## 4.0.0-beta.325 ### Patch Changes diff --git a/packages/vue/package.json b/packages/vue/package.json index 1937c9587..1f412427e 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@effect-app/vue", - "version": "4.0.0-beta.325", + "version": "4.0.0-beta.326", "license": "MIT", "type": "module", "repository": {