@effect-app/infra 4.0.0-beta.306 → 4.0.0-beta.307

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
@@ -1,5 +1,24 @@
1
1
  # @effect-app/infra
2
2
 
3
+ ## 4.0.0-beta.307
4
+
5
+ ### Patch Changes
6
+
7
+ - 40585ca: Keep tag-aware `ProjectableFromDomain` for `projectComputed` only; restore loose key-presence guard for `project()` so view DTOs with reshaped fields keep typechecking.
8
+ - ad0ede6: Keep tag-aware `ProjectableGuard` on both `project()` and `projectComputed` (no loose key-only paper-over).
9
+
10
+ Hardening:
11
+
12
+ - single-literal tags allow dual same-tag domain variants (KeysOfUnion of matched members)
13
+ - multi-tag / string tags still require keys on every matched member
14
+ - optional projection/domain keys checked by key presence only (not optional-assignability)
15
+
16
+ Call sites must project domain-owned fields per tagged state.
17
+
18
+ - Updated dependencies [40585ca]
19
+ - Updated dependencies [ad0ede6]
20
+ - effect-app@4.0.0-beta.307
21
+
3
22
  ## 4.0.0-beta.306
4
23
 
5
24
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/infra",
3
- "version": "4.0.0-beta.306",
3
+ "version": "4.0.0-beta.307",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "proper-lockfile": "^4.1.2",
16
16
  "pure-rand": "8.4.0",
17
17
  "query-string": "^9.4.0",
18
- "effect-app": "4.0.0-beta.306"
18
+ "effect-app": "4.0.0-beta.307"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@azure/cosmos": "^4.9.3",
@@ -831,6 +831,34 @@ it("ProjectableFromDomain distributes over tagged union Encoded", () => {
831
831
  void _bad
832
832
  })
833
833
 
834
+ it("ProjectableFromDomain allows dual same-tag domain variants", () => {
835
+ // EasyLife packing/closed: two domain shapes share `_tag` with different fields.
836
+ type DomainEnc =
837
+ | { readonly _tag: "packing"; readonly id: string; readonly packages: readonly string[] }
838
+ | { readonly _tag: "packing"; readonly id: string; readonly units: readonly string[] }
839
+ | { readonly _tag: "initial"; readonly id: string }
840
+
841
+ type Good =
842
+ | { readonly _tag: "packing"; readonly id: string; readonly packages: readonly string[] }
843
+ | { readonly _tag: "packing"; readonly id: string; readonly units: readonly string[] }
844
+
845
+ // Flat multi-tag + state-only field must still fail (batchId not on initial).
846
+ type BadFlat = {
847
+ readonly _tag: "packing" | "initial"
848
+ readonly id: string
849
+ readonly packages: readonly string[]
850
+ }
851
+
852
+ type GoodCheck = ProjectableFromDomain<Good, DomainEnc>
853
+ type BadFlatCheck = ProjectableFromDomain<BadFlat, DomainEnc>
854
+
855
+ const _good: GoodCheck = undefined as unknown
856
+ // @ts-expect-error packages is not on domain initial; multi-tag flat intersection rejects it
857
+ const _badFlat: BadFlatCheck = undefined as unknown
858
+ void _good
859
+ void _badFlat
860
+ })
861
+
834
862
  it("projection schema with computed fields fails without computed map", () => {
835
863
  const baseSchema = S.Struct({
836
864
  id: S.String,