Skip to content

feat: native Date/Map/Set Encoded; query adapters convert to JSON - #874

Open
omegent-app[bot] wants to merge 7 commits into
mainfrom
feat/query-native-encoded-types
Open

feat: native Date/Map/Set Encoded; query adapters convert to JSON#874
omegent-app[bot] wants to merge 7 commits into
mainfrom
feat/query-native-encoded-types

Conversation

@omegent-app

@omegent-app omegent-app Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Schema.Date, ReadonlySet, and ReadonlyMap no longer rewrite Encoded to JSON (string / array). Encoded is the native value (Date / Set / Map).

The query DSL already types filter values as Encoded, so where("n", "gt", new Date(...)) typechecks. Document-store adapters convert those values to JSON when building queries:

  • Date → ISO string (Schema.toCodecJson(Schema.Date))
  • Set → array
  • Map → array of entries

Repository persistence also round-trips through Schema.toCodecJson, so Cosmos / SQL / disk JSON documents stay compatible. Memory and Disk use the same codec instead of JSON.parse/stringify (which dropped Map/Set). Store defaultValues are JSON-lowered before document decode.

JSON Encoded codecs remain as explicit helpers: DateFromString, ReadonlySetFromArray, ReadonlyMapFromArray. OmegaForm date inputs that take strings should use DateFromString.

Map query ops

JSON-encoded maps are arrays of [key, value] tuples. Query DSL additions on ReadonlyMap fields:

  • hasKey / notHasKey
  • hasValue / notHasValue
  • hasKeyValue / notHasKeyValue (pair is readonly [K, V])
  • *-any / *-all variants for multiple keys, values, or pairs

Adapters compile these against the encoded tuple array (EXISTS / p[0] / p[1] in Cosmos, json_each + $[0]/$[1] in SQLite, jsonb_array_elements in Postgres, in-memory after toCodecJson).

Breaking

  • S.Date Encoded is Date, not string
  • S.ReadonlySet Encoded is Set, not array
  • S.ReadonlyMap Encoded is Map, not array of tuples
  • Query filters on those fields take native values, not JSON

opened by patroza in chat thread Discord · Discord · T3


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

omegent-app Bot and others added 2 commits August 22, 2026 08:20
Query filters now take Date/Set/Map values. Cosmos/SQL/memory adapters
lower those to JSON (ISO strings, arrays, entries), and repository
persistence round-trips through Schema.toCodecJson.

Use DateFromString / ReadonlySetFromArray / ReadonlyMapFromArray when
Encoded must be JSON.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
@omegent-app
omegent-app Bot marked this pull request as ready for review August 22, 2026 08:22
@pkg-pr-new

pkg-pr-new Bot commented Aug 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@effect-app/cli

npm i https://pkg.pr.new/effect-app/libs/@effect-app/cli@874

effect-app

npm i https://pkg.pr.new/effect-app/libs/effect-app@874

@effect-app/eslint-codegen-model

npm i https://pkg.pr.new/effect-app/libs/@effect-app/eslint-codegen-model@874

@effect-app/eslint-shared-config

npm i https://pkg.pr.new/effect-app/libs/@effect-app/eslint-shared-config@874

@effect-app/infra

npm i https://pkg.pr.new/effect-app/libs/@effect-app/infra@874

@effect-app/vue

npm i https://pkg.pr.new/effect-app/libs/@effect-app/vue@874

@effect-app/vue-components

npm i https://pkg.pr.new/effect-app/libs/@effect-app/vue-components@874

commit: 98f4384

omegent-app Bot and others added 3 commits August 22, 2026 09:25
Unwrap ReadonlySet in includes/includes-any and accept Set or array
needles for in. Adapters already JSON-convert those values.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Memory and Disk now convert documents with Schema.toCodecJson(toEncoded)
instead of JSON.parse/stringify (which dropped Map/Set). SQL and Cosmos
use the same codec on write/read. Repository encode stays Type→Encoded;
adapters own JSON.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
JSON-encoded maps are arrays of [key, value] tuples. Add hasKey,
hasValue, hasKeyValue (and not*/any/all variants) on the query DSL,
implemented in memory, SQLite, Postgres, and Cosmos.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
omegent-app Bot and others added 2 commits September 2, 2026 12:00
Cosmos/SQL merged StoreConfig.defaultValues (now native Date/Map/Set)
into stored JSON before toCodecJson decode. Lower defaults the same way
Memory already does. Also use globalThis.Date in schema helpers, Reflect
for Error.stackTraceLimit, and Sendgrid send ReturnType so linked-source
app typechecks.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Restore Error.stackTraceLimit assignment and Sendgrid ClientResponse
callback types. They are unrelated to native Encoded query work.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants