@sayoriqwq/effect-harness 0.0.1

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.
Files changed (2055) hide show
  1. package/HARNESS.md +34 -0
  2. package/README.md +113 -0
  3. package/dist/bin/effect-harness.d.ts +2 -0
  4. package/dist/bin/effect-harness.js +39 -0
  5. package/dist/bin/effect-harness.js.map +1 -0
  6. package/dist/src/cli/Main.d.ts +6 -0
  7. package/dist/src/cli/Main.js +141 -0
  8. package/dist/src/cli/Main.js.map +1 -0
  9. package/dist/src/harness/CraftSkills.d.ts +14 -0
  10. package/dist/src/harness/CraftSkills.js +164 -0
  11. package/dist/src/harness/CraftSkills.js.map +1 -0
  12. package/dist/src/harness/Errors.d.ts +24 -0
  13. package/dist/src/harness/Errors.js +26 -0
  14. package/dist/src/harness/Errors.js.map +1 -0
  15. package/dist/src/harness/GuardrailRules.d.ts +6 -0
  16. package/dist/src/harness/GuardrailRules.js +303 -0
  17. package/dist/src/harness/GuardrailRules.js.map +1 -0
  18. package/dist/src/harness/Guardrails.d.ts +10 -0
  19. package/dist/src/harness/Guardrails.js +69 -0
  20. package/dist/src/harness/Guardrails.js.map +1 -0
  21. package/dist/src/harness/Init.d.ts +9 -0
  22. package/dist/src/harness/Init.js +234 -0
  23. package/dist/src/harness/Init.js.map +1 -0
  24. package/dist/src/harness/Model.d.ts +44 -0
  25. package/dist/src/harness/Model.js +169 -0
  26. package/dist/src/harness/Model.js.map +1 -0
  27. package/dist/src/harness/ModuleSources.d.ts +5 -0
  28. package/dist/src/harness/ModuleSources.js +47 -0
  29. package/dist/src/harness/ModuleSources.js.map +1 -0
  30. package/dist/src/harness/PnpmWorkspace.d.ts +2 -0
  31. package/dist/src/harness/PnpmWorkspace.js +23 -0
  32. package/dist/src/harness/PnpmWorkspace.js.map +1 -0
  33. package/dist/src/harness/Publish.d.ts +53 -0
  34. package/dist/src/harness/Publish.js +282 -0
  35. package/dist/src/harness/Publish.js.map +1 -0
  36. package/dist/src/harness/SelfVerify.d.ts +4 -0
  37. package/dist/src/harness/SelfVerify.js +56 -0
  38. package/dist/src/harness/SelfVerify.js.map +1 -0
  39. package/dist/src/harness/SourcePin.d.ts +12 -0
  40. package/dist/src/harness/SourcePin.js +320 -0
  41. package/dist/src/harness/SourcePin.js.map +1 -0
  42. package/dist/src/harness/Status.d.ts +12 -0
  43. package/dist/src/harness/Status.js +88 -0
  44. package/dist/src/harness/Status.js.map +1 -0
  45. package/dist/src/harness/TargetVerify.d.ts +8 -0
  46. package/dist/src/harness/TargetVerify.js +432 -0
  47. package/dist/src/harness/TargetVerify.js.map +1 -0
  48. package/dist/src/harness/TestContract.d.ts +6 -0
  49. package/dist/src/harness/TestContract.js +45 -0
  50. package/dist/src/harness/TestContract.js.map +1 -0
  51. package/dist/src/platform/Json.d.ts +8 -0
  52. package/dist/src/platform/Json.js +35 -0
  53. package/dist/src/platform/Json.js.map +1 -0
  54. package/dist/src/platform/ManagedFiles.d.ts +8 -0
  55. package/dist/src/platform/ManagedFiles.js +59 -0
  56. package/dist/src/platform/ManagedFiles.js.map +1 -0
  57. package/dist/src/platform/Process.d.ts +8 -0
  58. package/dist/src/platform/Process.js +80 -0
  59. package/dist/src/platform/Process.js.map +1 -0
  60. package/guide/default-capabilities.md +38 -0
  61. package/guide/index.md +49 -0
  62. package/guide/setup.md +64 -0
  63. package/harness/default-capabilities.md +32 -0
  64. package/harness/exposure.md +46 -0
  65. package/harness/feedback/index.md +60 -0
  66. package/harness/index.md +22 -0
  67. package/harness/official-inventory.md +85 -0
  68. package/harness/runtime/codex/AGENTS.fragment.md +28 -0
  69. package/harness/runtime/codex/agents/effect-worker.md +26 -0
  70. package/harness/runtime/codex/skills/effect-code/SKILL.md +72 -0
  71. package/harness/runtime/codex/skills/effect-code/agents/openai.yaml +4 -0
  72. package/harness/runtime/codex/skills/effect-feedback/SKILL.md +66 -0
  73. package/harness/runtime/codex/skills/effect-feedback/agents/openai.yaml +4 -0
  74. package/harness/source.md +52 -0
  75. package/harness/target-agent-contract.md +205 -0
  76. package/package.json +68 -0
  77. package/repos/craft-skills.manifest.json +34 -0
  78. package/repos/effect/.agents/skills/grill-me/SKILL.md +43 -0
  79. package/repos/effect/.agents/skills/jsdocs/SKILL.md +203 -0
  80. package/repos/effect/.agents/skills/scratchpad/SKILL.md +44 -0
  81. package/repos/effect/.agents/skills/scratchpad/agents/openai.yaml +7 -0
  82. package/repos/effect/.agents/skills/scratchpad/scripts/extract-example.mjs +260 -0
  83. package/repos/effect/.changeset/add-bigdecimal-sumall-multiplyall.md +5 -0
  84. package/repos/effect/.changeset/add-chunk-schema.md +5 -0
  85. package/repos/effect/.changeset/add-command-hidden.md +19 -0
  86. package/repos/effect/.changeset/add-config-nested.md +5 -0
  87. package/repos/effect/.changeset/add-flag-hidden.md +15 -0
  88. package/repos/effect/.changeset/add-from-string-schemas.md +5 -0
  89. package/repos/effect/.changeset/add-headers-remove-many.md +5 -0
  90. package/repos/effect/.changeset/add-indexeddb-kvs-layer.md +5 -0
  91. package/repos/effect/.changeset/add-make-msgpack.md +5 -0
  92. package/repos/effect/.changeset/add-make-option.md +5 -0
  93. package/repos/effect/.changeset/add-missing-tx-modules.md +11 -0
  94. package/repos/effect/.changeset/add-newtype-module.md +5 -0
  95. package/repos/effect/.changeset/add-scalar-show-operation-id.md +5 -0
  96. package/repos/effect/.changeset/add-schedule-tap.md +5 -0
  97. package/repos/effect/.changeset/add-schema-annotate-encoded.md +5 -0
  98. package/repos/effect/.changeset/add-schema-array-ensure.md +5 -0
  99. package/repos/effect/.changeset/add-schema-bigdecimal.md +5 -0
  100. package/repos/effect/.changeset/add-schema-datetime.md +5 -0
  101. package/repos/effect/.changeset/add-schema-option-from-optional-nullor.md +5 -0
  102. package/repos/effect/.changeset/add-schema-option-from-undefined-nullish.md +5 -0
  103. package/repos/effect/.changeset/add-schema-string-encoding.md +5 -0
  104. package/repos/effect/.changeset/add-sql-pglite.md +5 -0
  105. package/repos/effect/.changeset/add-standard-jsdoc-rule.md +5 -0
  106. package/repos/effect/.changeset/add-stream-broadcastn.md +5 -0
  107. package/repos/effect/.changeset/add-unstable-encoding-export.md +5 -0
  108. package/repos/effect/.changeset/afraid-cobras-like.md +5 -0
  109. package/repos/effect/.changeset/ai-openai-config-field-leak.md +6 -0
  110. package/repos/effect/.changeset/ai-openai-file-nullable-fields.md +5 -0
  111. package/repos/effect/.changeset/anthropic-4-6-structured-output.md +5 -0
  112. package/repos/effect/.changeset/asyncresult-exhaustive.md +5 -0
  113. package/repos/effect/.changeset/atom-stream-error-type.md +5 -0
  114. package/repos/effect/.changeset/beige-paths-sort.md +5 -0
  115. package/repos/effect/.changeset/better-apples-nail.md +5 -0
  116. package/repos/effect/.changeset/better-rocks-arrive.md +5 -0
  117. package/repos/effect/.changeset/big-pans-look.md +5 -0
  118. package/repos/effect/.changeset/blue-dingos-greet.md +5 -0
  119. package/repos/effect/.changeset/blue-ligers-cheat.md +5 -0
  120. package/repos/effect/.changeset/blue-onions-smile.md +5 -0
  121. package/repos/effect/.changeset/blue-ravens-type.md +5 -0
  122. package/repos/effect/.changeset/blue-trams-kiss.md +7 -0
  123. package/repos/effect/.changeset/bold-chairs-yawn.md +5 -0
  124. package/repos/effect/.changeset/bold-planets-shout.md +30 -0
  125. package/repos/effect/.changeset/breezy-meals-see.md +5 -0
  126. package/repos/effect/.changeset/bright-bugs-bow.md +5 -0
  127. package/repos/effect/.changeset/bright-canyons-clean.md +5 -0
  128. package/repos/effect/.changeset/bright-dogs-fail.md +5 -0
  129. package/repos/effect/.changeset/bright-flags-stand.md +5 -0
  130. package/repos/effect/.changeset/bright-laws-teach.md +5 -0
  131. package/repos/effect/.changeset/bright-lemons-dance.md +5 -0
  132. package/repos/effect/.changeset/bright-planes-smash.md +5 -0
  133. package/repos/effect/.changeset/bright-rats-attend.md +5 -0
  134. package/repos/effect/.changeset/bright-toes-rush.md +5 -0
  135. package/repos/effect/.changeset/bumpy-boxes-teach.md +5 -0
  136. package/repos/effect/.changeset/busy-lions-sneeze.md +5 -0
  137. package/repos/effect/.changeset/busy-maps-attend.md +7 -0
  138. package/repos/effect/.changeset/calm-buckets-own.md +5 -0
  139. package/repos/effect/.changeset/calm-carrots-march.md +7 -0
  140. package/repos/effect/.changeset/calm-cars-rest.md +5 -0
  141. package/repos/effect/.changeset/calm-panthers-nail.md +5 -0
  142. package/repos/effect/.changeset/calm-seas-smile.md +5 -0
  143. package/repos/effect/.changeset/calm-squids-hug.md +5 -0
  144. package/repos/effect/.changeset/chatty-poets-type.md +5 -0
  145. package/repos/effect/.changeset/chilled-mice-wash.md +5 -0
  146. package/repos/effect/.changeset/chilly-pumas-rule.md +5 -0
  147. package/repos/effect/.changeset/chubby-buckets-feel.md +5 -0
  148. package/repos/effect/.changeset/chubby-parents-flow.md +5 -0
  149. package/repos/effect/.changeset/chubby-planets-fall.md +5 -0
  150. package/repos/effect/.changeset/clean-balloons-tan.md +5 -0
  151. package/repos/effect/.changeset/clean-bulldogs-care.md +5 -0
  152. package/repos/effect/.changeset/clean-dryers-sneeze.md +5 -0
  153. package/repos/effect/.changeset/clean-geese-work.md +5 -0
  154. package/repos/effect/.changeset/clean-goats-wave.md +5 -0
  155. package/repos/effect/.changeset/clean-needles-shake.md +23 -0
  156. package/repos/effect/.changeset/clean-tires-guess.md +5 -0
  157. package/repos/effect/.changeset/clear-spies-boil.md +5 -0
  158. package/repos/effect/.changeset/cli-help-choices.md +5 -0
  159. package/repos/effect/.changeset/cold-knives-lie.md +35 -0
  160. package/repos/effect/.changeset/cold-rooms-show.md +5 -0
  161. package/repos/effect/.changeset/cold-sloths-wave.md +5 -0
  162. package/repos/effect/.changeset/compact-json-schema-enum.md +25 -0
  163. package/repos/effect/.changeset/config-withdefault-eager.md +7 -0
  164. package/repos/effect/.changeset/config.json +24 -0
  165. package/repos/effect/.changeset/consolidate-encoding.md +5 -0
  166. package/repos/effect/.changeset/consolidate-sql-error.md +16 -0
  167. package/repos/effect/.changeset/crisp-seas-warn.md +5 -0
  168. package/repos/effect/.changeset/cuddly-rooms-bet.md +5 -0
  169. package/repos/effect/.changeset/curly-poems-talk.md +5 -0
  170. package/repos/effect/.changeset/curly-spies-relax.md +5 -0
  171. package/repos/effect/.changeset/curvy-apples-float.md +5 -0
  172. package/repos/effect/.changeset/custom-http-security-openapi-generator.md +5 -0
  173. package/repos/effect/.changeset/cute-heads-thank.md +5 -0
  174. package/repos/effect/.changeset/cyan-loops-grow.md +5 -0
  175. package/repos/effect/.changeset/cyan-radios-switch.md +5 -0
  176. package/repos/effect/.changeset/deep-rivers-spend.md +5 -0
  177. package/repos/effect/.changeset/dirty-lamps-trade.md +5 -0
  178. package/repos/effect/.changeset/dirty-laws-wear.md +5 -0
  179. package/repos/effect/.changeset/duration-temporal-object-input.md +7 -0
  180. package/repos/effect/.changeset/eager-coats-cheat.md +5 -0
  181. package/repos/effect/.changeset/early-birds-dream.md +5 -0
  182. package/repos/effect/.changeset/early-donuts-argue.md +5 -0
  183. package/repos/effect/.changeset/early-peaches-check.md +6 -0
  184. package/repos/effect/.changeset/eff-691-default-logger-ordering.md +5 -0
  185. package/repos/effect/.changeset/eff-693-rpcgroup-handler-deps.md +5 -0
  186. package/repos/effect/.changeset/eff-694-cli-completions-module.md +5 -0
  187. package/repos/effect/.changeset/eff-695-layer-mock-dual-api.md +5 -0
  188. package/repos/effect/.changeset/eff-697-rpcserialization-json-array-decode.md +5 -0
  189. package/repos/effect/.changeset/eff-698-rpcserialization-unreachable-branch.md +5 -0
  190. package/repos/effect/.changeset/eff-700-httpapi-middleware-errors.md +12 -0
  191. package/repos/effect/.changeset/eff-701-httpapierror-respondable.md +5 -0
  192. package/repos/effect/.changeset/eff-704-stream-merge-predicate.md +5 -0
  193. package/repos/effect/.changeset/eff-705-layer-tap-apis.md +5 -0
  194. package/repos/effect/.changeset/eff-706-servicemap-mutate.md +6 -0
  195. package/repos/effect/.changeset/eff-716-response-id-tracker-map.md +5 -0
  196. package/repos/effect/.changeset/eff-717-openai-socket-cancel.md +5 -0
  197. package/repos/effect/.changeset/eff-718-embedding-model-surface.md +13 -0
  198. package/repos/effect/.changeset/eff-725-fix-catch-jsdoc.md +5 -0
  199. package/repos/effect/.changeset/eff-726-model-dimensions.md +7 -0
  200. package/repos/effect/.changeset/eff-727-cli-help-alignment.md +5 -0
  201. package/repos/effect/.changeset/eff-730-language-model-incremental-fallback.md +5 -0
  202. package/repos/effect/.changeset/eff-736-cached-with-ttl.md +5 -0
  203. package/repos/effect/.changeset/eff-738-cron-prev.md +5 -0
  204. package/repos/effect/.changeset/eff-739-openai-function-call-done.md +5 -0
  205. package/repos/effect/.changeset/eff-740-missing-summary-parts.md +5 -0
  206. package/repos/effect/.changeset/eff-742-http-client-request-web.md +5 -0
  207. package/repos/effect/.changeset/eff-744-sqlite-migrator-lock.md +5 -0
  208. package/repos/effect/.changeset/eff-746-fixed-iteration-catchup.md +5 -0
  209. package/repos/effect/.changeset/eff-747-unify-effect.md +5 -0
  210. package/repos/effect/.changeset/eff-754-url-builder-any.md +6 -0
  211. package/repos/effect/.changeset/eff-755-references-core.md +5 -0
  212. package/repos/effect/.changeset/eff-769-select-text-highlight.md +5 -0
  213. package/repos/effect/.changeset/eff-774-mutable-list-append-all-empty-array.md +5 -0
  214. package/repos/effect/.changeset/eff-777-schema-make-effect.md +5 -0
  215. package/repos/effect/.changeset/eff-778-http-middleware-path-logger.md +5 -0
  216. package/repos/effect/.changeset/eff-779-keyvaluestore-layer-sql.md +5 -0
  217. package/repos/effect/.changeset/eff-780-layer-unify.md +5 -0
  218. package/repos/effect/.changeset/eff-781-fix-stream-toqueue-types.md +5 -0
  219. package/repos/effect/.changeset/eff-782-httpapi-status-literals.md +5 -0
  220. package/repos/effect/.changeset/eff-783-atom-http-api-errors.md +5 -0
  221. package/repos/effect/.changeset/eff-819-cluster-workflow-shard-groups.md +5 -0
  222. package/repos/effect/.changeset/eight-turkeys-own.md +7 -0
  223. package/repos/effect/.changeset/eighty-lies-deny.md +5 -0
  224. package/repos/effect/.changeset/eighty-poets-draw.md +9 -0
  225. package/repos/effect/.changeset/eighty-swans-scream.md +5 -0
  226. package/repos/effect/.changeset/eighty-teeth-sniff.md +5 -0
  227. package/repos/effect/.changeset/eleven-apes-share.md +5 -0
  228. package/repos/effect/.changeset/eleven-numbers-bake.md +5 -0
  229. package/repos/effect/.changeset/empty-gifts-beg.md +5 -0
  230. package/repos/effect/.changeset/empty-http-rpc-client.md +5 -0
  231. package/repos/effect/.changeset/eventlog-unencrypted.md +5 -0
  232. package/repos/effect/.changeset/expand-schema-filter-output.md +24 -0
  233. package/repos/effect/.changeset/export-schema-encode-keys-interface.md +7 -0
  234. package/repos/effect/.changeset/extract-semaphore-latch.md +10 -0
  235. package/repos/effect/.changeset/fair-bees-relax.md +5 -0
  236. package/repos/effect/.changeset/fair-buttons-share.md +7 -0
  237. package/repos/effect/.changeset/fair-cooks-stop.md +5 -0
  238. package/repos/effect/.changeset/fair-cups-train.md +5 -0
  239. package/repos/effect/.changeset/fair-dryers-speak.md +5 -0
  240. package/repos/effect/.changeset/fair-forks-shake.md +5 -0
  241. package/repos/effect/.changeset/fair-pandas-prove.md +5 -0
  242. package/repos/effect/.changeset/fair-pants-float.md +5 -0
  243. package/repos/effect/.changeset/fair-poems-visit.md +5 -0
  244. package/repos/effect/.changeset/famous-wolves-lead.md +5 -0
  245. package/repos/effect/.changeset/fancy-glasses-grow.md +5 -0
  246. package/repos/effect/.changeset/fast-times-camp.md +5 -0
  247. package/repos/effect/.changeset/few-birds-matter.md +5 -0
  248. package/repos/effect/.changeset/few-cougars-dig.md +5 -0
  249. package/repos/effect/.changeset/few-foxes-grin.md +5 -0
  250. package/repos/effect/.changeset/few-mirrors-pull.md +14 -0
  251. package/repos/effect/.changeset/few-socks-poke.md +5 -0
  252. package/repos/effect/.changeset/fiber-runtime-start-metrics.md +5 -0
  253. package/repos/effect/.changeset/fiery-jokes-care.md +5 -0
  254. package/repos/effect/.changeset/fiery-mammals-call.md +5 -0
  255. package/repos/effect/.changeset/fine-walls-decide.md +5 -0
  256. package/repos/effect/.changeset/first-success-of.md +5 -0
  257. package/repos/effect/.changeset/five-parents-relax.md +5 -0
  258. package/repos/effect/.changeset/five-worms-rhyme.md +5 -0
  259. package/repos/effect/.changeset/fix-1332.md +5 -0
  260. package/repos/effect/.changeset/fix-1917.md +11 -0
  261. package/repos/effect/.changeset/fix-1927.md +5 -0
  262. package/repos/effect/.changeset/fix-1940.md +7 -0
  263. package/repos/effect/.changeset/fix-1947.md +7 -0
  264. package/repos/effect/.changeset/fix-2002.md +5 -0
  265. package/repos/effect/.changeset/fix-2012.md +5 -0
  266. package/repos/effect/.changeset/fix-2015.md +5 -0
  267. package/repos/effect/.changeset/fix-2260.md +5 -0
  268. package/repos/effect/.changeset/fix-2268.md +5 -0
  269. package/repos/effect/.changeset/fix-2271.md +5 -0
  270. package/repos/effect/.changeset/fix-2384.md +7 -0
  271. package/repos/effect/.changeset/fix-ai-empty-params-structured-output.md +5 -0
  272. package/repos/effect/.changeset/fix-ai-text-toolkit-typing.md +5 -0
  273. package/repos/effect/.changeset/fix-catch-orelse-error-erasure.md +5 -0
  274. package/repos/effect/.changeset/fix-class-constructor-defaults.md +5 -0
  275. package/repos/effect/.changeset/fix-cli-mixed-global-flag-context.md +7 -0
  276. package/repos/effect/.changeset/fix-config-withDefault.md +5 -0
  277. package/repos/effect/.changeset/fix-config-withdefault-filter.md +7 -0
  278. package/repos/effect/.changeset/fix-datetime-gmt.md +5 -0
  279. package/repos/effect/.changeset/fix-devtools-flush-on-teardown.md +10 -0
  280. package/repos/effect/.changeset/fix-duration-symmetric-rounding.md +5 -0
  281. package/repos/effect/.changeset/fix-entity-manager-defect-replay.md +5 -0
  282. package/repos/effect/.changeset/fix-entity-proxy-rpc-handler-context.md +5 -0
  283. package/repos/effect/.changeset/fix-entity-proxy-server-path-params.md +5 -0
  284. package/repos/effect/.changeset/fix-from-readable-stream-cancel-defect.md +5 -0
  285. package/repos/effect/.changeset/fix-graph-undirected-traversal.md +5 -0
  286. package/repos/effect/.changeset/fix-has-interrupts-only-empty.md +5 -0
  287. package/repos/effect/.changeset/fix-hashmap-bit31-ordering.md +5 -0
  288. package/repos/effect/.changeset/fix-headers-proto-enumerability.md +5 -0
  289. package/repos/effect/.changeset/fix-http-incoming-message-parse-options.md +5 -0
  290. package/repos/effect/.changeset/fix-httpapi-endpoint-error-inference.md +5 -0
  291. package/repos/effect/.changeset/fix-httpapi-schema-types.md +5 -0
  292. package/repos/effect/.changeset/fix-httpapi-security-middleware-cache.md +5 -0
  293. package/repos/effect/.changeset/fix-is-json-dag.md +7 -0
  294. package/repos/effect/.changeset/fix-json-schema-anyof-oneof-siblings.md +5 -0
  295. package/repos/effect/.changeset/fix-json-schema-import-json.md +5 -0
  296. package/repos/effect/.changeset/fix-keepalive-blocked-timers.md +5 -0
  297. package/repos/effect/.changeset/fix-mcp-param-name-resolution.md +5 -0
  298. package/repos/effect/.changeset/fix-mermaid-escape-special-chars.md +5 -0
  299. package/repos/effect/.changeset/fix-mutable-list-filter-length.md +5 -0
  300. package/repos/effect/.changeset/fix-object-keyword-json-schema.md +5 -0
  301. package/repos/effect/.changeset/fix-openai-mcp-tool-names.md +5 -0
  302. package/repos/effect/.changeset/fix-openapi-generator-form-urlencoded.md +5 -0
  303. package/repos/effect/.changeset/fix-openapi-generator-swagger2openapi.md +5 -0
  304. package/repos/effect/.changeset/fix-openapi-preserve-multiple-response-content-types.md +5 -0
  305. package/repos/effect/.changeset/fix-openrouter-sparse-array.md +5 -0
  306. package/repos/effect/.changeset/fix-otel-logger-clock-skew.md +7 -0
  307. package/repos/effect/.changeset/fix-otel-logger-severity-number.md +20 -0
  308. package/repos/effect/.changeset/fix-queue-collect-duplication.md +5 -0
  309. package/repos/effect/.changeset/fix-random-string-seeds.md +5 -0
  310. package/repos/effect/.changeset/fix-ratelimiter-tokenbucket-redis-ttl.md +5 -0
  311. package/repos/effect/.changeset/fix-remainder-scientific-notation.md +5 -0
  312. package/repos/effect/.changeset/fix-request-resolver-pending-batches-leak.md +5 -0
  313. package/repos/effect/.changeset/fix-retry-transient-autocomplete.md +5 -0
  314. package/repos/effect/.changeset/fix-rpc-http-requestids-finalizer.md +5 -0
  315. package/repos/effect/.changeset/fix-rpc-json-id-edges.md +5 -0
  316. package/repos/effect/.changeset/fix-schedule-fixed-double-exec.md +9 -0
  317. package/repos/effect/.changeset/fix-schedule-reduce-sync-state.md +5 -0
  318. package/repos/effect/.changeset/fix-schema-arbitrary-exclusive-bounds.md +5 -0
  319. package/repos/effect/.changeset/fix-schema-defect-message.md +5 -0
  320. package/repos/effect/.changeset/fix-schema-encode-keys-property-keys.md +5 -0
  321. package/repos/effect/.changeset/fix-schema-encodekeys-class.md +5 -0
  322. package/repos/effect/.changeset/fix-schema-encodekeys-struct.md +5 -0
  323. package/repos/effect/.changeset/fix-schema-identifier-expected-message.md +5 -0
  324. package/repos/effect/.changeset/fix-schema-is-uuid.md +5 -0
  325. package/repos/effect/.changeset/fix-schema-option-non-schema-failures.md +17 -0
  326. package/repos/effect/.changeset/fix-schema-parser-checks.md +9 -0
  327. package/repos/effect/.changeset/fix-searchparam-initial-decode.md +5 -0
  328. package/repos/effect/.changeset/fix-serializable-wire-transfer.md +7 -0
  329. package/repos/effect/.changeset/fix-stream-grouped-within-flush.md +5 -0
  330. package/repos/effect/.changeset/fix-stream-run-for-each-while.md +5 -0
  331. package/repos/effect/.changeset/fix-stream-scan-effect.md +5 -0
  332. package/repos/effect/.changeset/fix-stream-scoped-scope.md +5 -0
  333. package/repos/effect/.changeset/fix-strip-approval-artifacts-multi-round.md +13 -0
  334. package/repos/effect/.changeset/fix-struct-utility-types-simplify.md +5 -0
  335. package/repos/effect/.changeset/fix-structwithrest-index-signatures.md +6 -0
  336. package/repos/effect/.changeset/fix-tagged-union-class-sentinels.md +5 -0
  337. package/repos/effect/.changeset/fix-tagged-union-match-unify.md +6 -0
  338. package/repos/effect/.changeset/fix-to-tagged-union-isanyof-custom-tags.md +10 -0
  339. package/repos/effect/.changeset/fix-tuple-with-rest-post-rest-index-drift.md +5 -0
  340. package/repos/effect/.changeset/fix-tuple-with-rest-post-rest-validation.md +5 -0
  341. package/repos/effect/.changeset/fix-types-voidifempty.md +5 -0
  342. package/repos/effect/.changeset/fix-void-response-encoding.md +5 -0
  343. package/repos/effect/.changeset/fix-workflow-proxy-rpc-handler-context.md +5 -0
  344. package/repos/effect/.changeset/flat-chicken-remain.md +5 -0
  345. package/repos/effect/.changeset/floppy-cows-spend.md +5 -0
  346. package/repos/effect/.changeset/floppy-items-admire.md +5 -0
  347. package/repos/effect/.changeset/floppy-pigs-kiss.md +5 -0
  348. package/repos/effect/.changeset/fluffy-meals-matter.md +5 -0
  349. package/repos/effect/.changeset/fluffy-pumas-push.md +5 -0
  350. package/repos/effect/.changeset/forked-memo-maps.md +6 -0
  351. package/repos/effect/.changeset/forty-hounds-cheer.md +5 -0
  352. package/repos/effect/.changeset/forty-otters-cry.md +5 -0
  353. package/repos/effect/.changeset/forty-rings-film.md +7 -0
  354. package/repos/effect/.changeset/forty-signs-stay.md +5 -0
  355. package/repos/effect/.changeset/forty-swans-divide.md +5 -0
  356. package/repos/effect/.changeset/forty-trees-pay.md +5 -0
  357. package/repos/effect/.changeset/four-papayas-bow.md +5 -0
  358. package/repos/effect/.changeset/four-points-repeat.md +5 -0
  359. package/repos/effect/.changeset/fresh-cats-smash.md +5 -0
  360. package/repos/effect/.changeset/fresh-emus-cheat.md +5 -0
  361. package/repos/effect/.changeset/fresh-monkeys-smoke.md +9 -0
  362. package/repos/effect/.changeset/fruity-houses-learn.md +6 -0
  363. package/repos/effect/.changeset/full-adults-double.md +5 -0
  364. package/repos/effect/.changeset/funny-crabs-hang.md +6 -0
  365. package/repos/effect/.changeset/funny-forks-move.md +5 -0
  366. package/repos/effect/.changeset/fuzzy-camels-hunt.md +5 -0
  367. package/repos/effect/.changeset/fuzzy-dodos-help.md +5 -0
  368. package/repos/effect/.changeset/fuzzy-lions-perform.md +5 -0
  369. package/repos/effect/.changeset/fuzzy-planets-sneeze.md +5 -0
  370. package/repos/effect/.changeset/gold-meteors-move.md +5 -0
  371. package/repos/effect/.changeset/gold-readers-hug.md +5 -0
  372. package/repos/effect/.changeset/gold-rings-start.md +5 -0
  373. package/repos/effect/.changeset/good-tools-work.md +7 -0
  374. package/repos/effect/.changeset/graph-algorithm-fixes.md +5 -0
  375. package/repos/effect/.changeset/great-trains-mate.md +5 -0
  376. package/repos/effect/.changeset/great-trams-report.md +5 -0
  377. package/repos/effect/.changeset/green-beds-unref.md +7 -0
  378. package/repos/effect/.changeset/green-chips-wash.md +5 -0
  379. package/repos/effect/.changeset/green-moons-smile.md +5 -0
  380. package/repos/effect/.changeset/green-pugs-play.md +5 -0
  381. package/repos/effect/.changeset/green-rings-prove.md +5 -0
  382. package/repos/effect/.changeset/happy-mirrors-dream.md +5 -0
  383. package/repos/effect/.changeset/heavy-loops-cut.md +5 -0
  384. package/repos/effect/.changeset/heavy-trams-fix.md +5 -0
  385. package/repos/effect/.changeset/hip-socks-travel.md +5 -0
  386. package/repos/effect/.changeset/honest-pens-thank.md +5 -0
  387. package/repos/effect/.changeset/honest-rivers-notice.md +5 -0
  388. package/repos/effect/.changeset/hot-taxis-fry.md +5 -0
  389. package/repos/effect/.changeset/httpapi-endpoint-relax-constraints.md +5 -0
  390. package/repos/effect/.changeset/httpapi-schema-service-types.md +6 -0
  391. package/repos/effect/.changeset/huge-moons-rhyme.md +5 -0
  392. package/repos/effect/.changeset/humble-pigs-dig.md +5 -0
  393. package/repos/effect/.changeset/icy-flies-cross.md +5 -0
  394. package/repos/effect/.changeset/itchy-radios-poke.md +5 -0
  395. package/repos/effect/.changeset/itchy-results-bet.md +5 -0
  396. package/repos/effect/.changeset/itchy-shrimps-deny.md +5 -0
  397. package/repos/effect/.changeset/itchy-toes-promise.md +5 -0
  398. package/repos/effect/.changeset/k8s-last-transition-null.md +5 -0
  399. package/repos/effect/.changeset/khaki-cats-learn.md +5 -0
  400. package/repos/effect/.changeset/khaki-melons-appear.md +5 -0
  401. package/repos/effect/.changeset/kind-hounds-float.md +5 -0
  402. package/repos/effect/.changeset/kind-windows-fall.md +5 -0
  403. package/repos/effect/.changeset/late-hotels-rule.md +5 -0
  404. package/repos/effect/.changeset/late-lamps-care.md +5 -0
  405. package/repos/effect/.changeset/late-rivers-applaud.md +5 -0
  406. package/repos/effect/.changeset/layer-map-dynamic-idle-ttl.md +5 -0
  407. package/repos/effect/.changeset/lazy-queens-rush.md +5 -0
  408. package/repos/effect/.changeset/lazy-recursive-forward-refs.md +5 -0
  409. package/repos/effect/.changeset/lazy-timers-exist.md +5 -0
  410. package/repos/effect/.changeset/legal-pants-drop.md +5 -0
  411. package/repos/effect/.changeset/lemon-taxis-sin.md +5 -0
  412. package/repos/effect/.changeset/light-kids-sneeze.md +5 -0
  413. package/repos/effect/.changeset/little-dryers-allow.md +7 -0
  414. package/repos/effect/.changeset/long-cameras-think.md +5 -0
  415. package/repos/effect/.changeset/lovely-cobras-change.md +5 -0
  416. package/repos/effect/.changeset/lovely-frogs-rescue.md +5 -0
  417. package/repos/effect/.changeset/lucky-buttons-jump.md +5 -0
  418. package/repos/effect/.changeset/lucky-phones-listen.md +5 -0
  419. package/repos/effect/.changeset/lucky-worms-type.md +5 -0
  420. package/repos/effect/.changeset/mean-dingos-share.md +5 -0
  421. package/repos/effect/.changeset/mean-trains-smash.md +5 -0
  422. package/repos/effect/.changeset/metal-parts-yell.md +5 -0
  423. package/repos/effect/.changeset/mighty-games-matter.md +5 -0
  424. package/repos/effect/.changeset/modern-uuid-guid-filter.md +5 -0
  425. package/repos/effect/.changeset/nasty-geese-grow.md +5 -0
  426. package/repos/effect/.changeset/neat-goats-wave.md +5 -0
  427. package/repos/effect/.changeset/neat-kings-chew.md +5 -0
  428. package/repos/effect/.changeset/neat-lions-rest.md +5 -0
  429. package/repos/effect/.changeset/neat-snails-wash.md +5 -0
  430. package/repos/effect/.changeset/neat-taxis-notice.md +5 -0
  431. package/repos/effect/.changeset/new-dogs-swim.md +5 -0
  432. package/repos/effect/.changeset/new-toes-stop.md +5 -0
  433. package/repos/effect/.changeset/ninety-geese-exist.md +5 -0
  434. package/repos/effect/.changeset/odd-boats-think.md +5 -0
  435. package/repos/effect/.changeset/odd-bulldogs-sleep.md +5 -0
  436. package/repos/effect/.changeset/odd-fans-glow.md +5 -0
  437. package/repos/effect/.changeset/odd-forks-talk.md +5 -0
  438. package/repos/effect/.changeset/odd-laws-draw.md +5 -0
  439. package/repos/effect/.changeset/odd-owls-smoke.md +5 -0
  440. package/repos/effect/.changeset/odd-socks-boil.md +5 -0
  441. package/repos/effect/.changeset/odd-suns-dance.md +5 -0
  442. package/repos/effect/.changeset/old-brooms-cry.md +5 -0
  443. package/repos/effect/.changeset/old-facts-stand.md +5 -0
  444. package/repos/effect/.changeset/old-mirrors-float.md +5 -0
  445. package/repos/effect/.changeset/olive-poems-visit.md +5 -0
  446. package/repos/effect/.changeset/open-hotels-remain.md +5 -0
  447. package/repos/effect/.changeset/openai-compat-nullable-tool-name.md +7 -0
  448. package/repos/effect/.changeset/openai-compat-reasoning.md +5 -0
  449. package/repos/effect/.changeset/otel-resource-env-precedence.md +5 -0
  450. package/repos/effect/.changeset/perfect-buckets-tickle.md +5 -0
  451. package/repos/effect/.changeset/petite-months-allow.md +6 -0
  452. package/repos/effect/.changeset/platform-crypto-service.md +9 -0
  453. package/repos/effect/.changeset/platform-node-shared-barrel.md +5 -0
  454. package/repos/effect/.changeset/plenty-moons-pull.md +5 -0
  455. package/repos/effect/.changeset/polite-brooms-tickle.md +5 -0
  456. package/repos/effect/.changeset/polite-pigs-speak.md +5 -0
  457. package/repos/effect/.changeset/polite-tables-kneel.md +5 -0
  458. package/repos/effect/.changeset/port-react-hydration.md +8 -0
  459. package/repos/effect/.changeset/pre.json +588 -0
  460. package/repos/effect/.changeset/public-deer-ring.md +5 -0
  461. package/repos/effect/.changeset/public-jeans-stop.md +5 -0
  462. package/repos/effect/.changeset/pubsub-publish-false.md +5 -0
  463. package/repos/effect/.changeset/puny-pens-clap.md +6 -0
  464. package/repos/effect/.changeset/purple-bars-prove.md +5 -0
  465. package/repos/effect/.changeset/purple-schools-float.md +5 -0
  466. package/repos/effect/.changeset/purple-turtles-draw.md +5 -0
  467. package/repos/effect/.changeset/quick-dragons-fix.md +5 -0
  468. package/repos/effect/.changeset/quick-falcons-travel.md +5 -0
  469. package/repos/effect/.changeset/quick-geese-relax.md +5 -0
  470. package/repos/effect/.changeset/quick-lamps-dig.md +5 -0
  471. package/repos/effect/.changeset/quick-lizards-fall.md +5 -0
  472. package/repos/effect/.changeset/quick-trees-join.md +5 -0
  473. package/repos/effect/.changeset/quiet-carpets-grin.md +5 -0
  474. package/repos/effect/.changeset/quiet-files-hunt.md +5 -0
  475. package/repos/effect/.changeset/quiet-lamps-jam.md +5 -0
  476. package/repos/effect/.changeset/quiet-radios-wave.md +5 -0
  477. package/repos/effect/.changeset/quiet-redis-scripts.md +5 -0
  478. package/repos/effect/.changeset/ready-olives-divide.md +5 -0
  479. package/repos/effect/.changeset/real-trains-ring.md +5 -0
  480. package/repos/effect/.changeset/red-pigs-repair.md +5 -0
  481. package/repos/effect/.changeset/redacted-representation-options.md +7 -0
  482. package/repos/effect/.changeset/refactor-cli-global-flags.md +27 -0
  483. package/repos/effect/.changeset/refactor-config-provider.md +23 -0
  484. package/repos/effect/.changeset/refactor-representation-references.md +5 -0
  485. package/repos/effect/.changeset/remove-effect-transactionwith.md +5 -0
  486. package/repos/effect/.changeset/remove-http-span-counter.md +5 -0
  487. package/repos/effect/.changeset/remove-nullor.md +5 -0
  488. package/repos/effect/.changeset/remove-openapi-fromapi-options.md +7 -0
  489. package/repos/effect/.changeset/remove-types-mergerecord.md +5 -0
  490. package/repos/effect/.changeset/remove-unused-utils-apis.md +5 -0
  491. package/repos/effect/.changeset/rename-rebuild-out.md +5 -0
  492. package/repos/effect/.changeset/restore-schema-parse-options.md +5 -0
  493. package/repos/effect/.changeset/rich-dots-push.md +5 -0
  494. package/repos/effect/.changeset/rich-hoops-nail.md +5 -0
  495. package/repos/effect/.changeset/rich-sloths-draw.md +5 -0
  496. package/repos/effect/.changeset/ripe-lies-battle.md +5 -0
  497. package/repos/effect/.changeset/rpc-middleware-provides-fix.md +5 -0
  498. package/repos/effect/.changeset/scalar-custom-fetch.md +5 -0
  499. package/repos/effect/.changeset/schema-as-class.md +17 -0
  500. package/repos/effect/.changeset/schema-asserts-signature.md +5 -0
  501. package/repos/effect/.changeset/schema-clean-up-additionalProperties.md +7 -0
  502. package/repos/effect/.changeset/schema-datetime-utc-from-string.md +5 -0
  503. package/repos/effect/.changeset/schema-decoding-defaults-services.md +7 -0
  504. package/repos/effect/.changeset/schema-defaults-issue-channel.md +7 -0
  505. package/repos/effect/.changeset/schema-dollar-prefix.md +5 -0
  506. package/repos/effect/.changeset/schema-missing-self-generic.md +5 -0
  507. package/repos/effect/.changeset/schema-ordered-arbitrary-constraints.md +12 -0
  508. package/repos/effect/.changeset/schema-parser-adapter-errors.md +5 -0
  509. package/repos/effect/.changeset/schema-refactor-toCodecJson.md +5 -0
  510. package/repos/effect/.changeset/schema-remove-annotate-in.md +5 -0
  511. package/repos/effect/.changeset/schema-rename-makeUnsafe-to-make.md +7 -0
  512. package/repos/effect/.changeset/schema-rename-parser-makeUnsafe.md +5 -0
  513. package/repos/effect/.changeset/schema-result-combinators.md +5 -0
  514. package/repos/effect/.changeset/schema-struct-simplify.md +5 -0
  515. package/repos/effect/.changeset/seven-mugs-marry.md +5 -0
  516. package/repos/effect/.changeset/shaggy-birds-stay.md +5 -0
  517. package/repos/effect/.changeset/shaggy-cities-push.md +5 -0
  518. package/repos/effect/.changeset/shaggy-numbers-accept.md +5 -0
  519. package/repos/effect/.changeset/sharp-emus-applaud.md +5 -0
  520. package/repos/effect/.changeset/sharp-goats-wink.md +5 -0
  521. package/repos/effect/.changeset/sharp-pandas-care.md +5 -0
  522. package/repos/effect/.changeset/sharp-peas-march.md +5 -0
  523. package/repos/effect/.changeset/sharp-rules-draw.md +5 -0
  524. package/repos/effect/.changeset/sharp-singers-sort.md +5 -0
  525. package/repos/effect/.changeset/shiny-trains-hug.md +5 -0
  526. package/repos/effect/.changeset/short-cows-relate.md +5 -0
  527. package/repos/effect/.changeset/short-foxes-admire.md +5 -0
  528. package/repos/effect/.changeset/shy-cycles-flow.md +5 -0
  529. package/repos/effect/.changeset/shy-geckos-sniff.md +30 -0
  530. package/repos/effect/.changeset/silent-geckos-matter.md +5 -0
  531. package/repos/effect/.changeset/silent-needles-design.md +6 -0
  532. package/repos/effect/.changeset/silent-plants-matter.md +8 -0
  533. package/repos/effect/.changeset/silent-spoons-stare.md +5 -0
  534. package/repos/effect/.changeset/silly-loops-tickle.md +5 -0
  535. package/repos/effect/.changeset/silver-bulk-indexeddb.md +5 -0
  536. package/repos/effect/.changeset/silver-emus-smoke.md +5 -0
  537. package/repos/effect/.changeset/silver-kings-poke.md +5 -0
  538. package/repos/effect/.changeset/silver-snails-sqlite.md +17 -0
  539. package/repos/effect/.changeset/silver-wings-watch.md +5 -0
  540. package/repos/effect/.changeset/six-cups-taste.md +5 -0
  541. package/repos/effect/.changeset/sixty-mails-shout.md +5 -0
  542. package/repos/effect/.changeset/sixty-socks-yell.md +5 -0
  543. package/repos/effect/.changeset/slimy-planets-divide.md +5 -0
  544. package/repos/effect/.changeset/slimy-turtles-juggle.md +5 -0
  545. package/repos/effect/.changeset/slow-beans-battle.md +28 -0
  546. package/repos/effect/.changeset/slow-berries-enjoy.md +5 -0
  547. package/repos/effect/.changeset/small-bugs-hunt.md +5 -0
  548. package/repos/effect/.changeset/small-crabs-care.md +9 -0
  549. package/repos/effect/.changeset/small-pets-sit.md +6 -0
  550. package/repos/effect/.changeset/smart-ducks-jump.md +6 -0
  551. package/repos/effect/.changeset/smart-pillows-buy.md +6 -0
  552. package/repos/effect/.changeset/smart-timers-fly.md +5 -0
  553. package/repos/effect/.changeset/smart-tips-sort.md +5 -0
  554. package/repos/effect/.changeset/social-pumas-prove.md +5 -0
  555. package/repos/effect/.changeset/soft-comics-wink.md +5 -0
  556. package/repos/effect/.changeset/soft-delete-sqlmodel.md +5 -0
  557. package/repos/effect/.changeset/soft-seals-allow.md +5 -0
  558. package/repos/effect/.changeset/solid-cougars-attack.md +5 -0
  559. package/repos/effect/.changeset/solid-doors-ring.md +5 -0
  560. package/repos/effect/.changeset/solid-items-tease.md +5 -0
  561. package/repos/effect/.changeset/solid-towns-smoke.md +5 -0
  562. package/repos/effect/.changeset/sour-canyons-rescue.md +5 -0
  563. package/repos/effect/.changeset/sparkly-bears-act.md +5 -0
  564. package/repos/effect/.changeset/sparkly-coins-sit.md +5 -0
  565. package/repos/effect/.changeset/spotty-comics-fry.md +5 -0
  566. package/repos/effect/.changeset/sql-migrator-mjs-mts.md +5 -0
  567. package/repos/effect/.changeset/stale-dots-tell.md +5 -0
  568. package/repos/effect/.changeset/stale-snakes-know.md +5 -0
  569. package/repos/effect/.changeset/strict-areas-end.md +5 -0
  570. package/repos/effect/.changeset/strict-buckets-hug.md +8 -0
  571. package/repos/effect/.changeset/strip-resolved-approvals.md +5 -0
  572. package/repos/effect/.changeset/strong-balloons-tickle.md +5 -0
  573. package/repos/effect/.changeset/strong-bees-queue.md +5 -0
  574. package/repos/effect/.changeset/struct-record.md +5 -0
  575. package/repos/effect/.changeset/sunny-ads-hang.md +5 -0
  576. package/repos/effect/.changeset/sunny-bikes-sleep.md +5 -0
  577. package/repos/effect/.changeset/sunny-rooms-invent.md +5 -0
  578. package/repos/effect/.changeset/sweet-donuts-bet.md +5 -0
  579. package/repos/effect/.changeset/sweet-hotels-give.md +5 -0
  580. package/repos/effect/.changeset/sweet-views-learn.md +5 -0
  581. package/repos/effect/.changeset/swift-spiders-unpack.md +5 -0
  582. package/repos/effect/.changeset/swift-symbols-stand.md +5 -0
  583. package/repos/effect/.changeset/tagged-error-class-optional-empty-props.md +5 -0
  584. package/repos/effect/.changeset/tall-hairs-return.md +5 -0
  585. package/repos/effect/.changeset/tall-mails-listen.md +5 -0
  586. package/repos/effect/.changeset/tall-queens-cheer.md +5 -0
  587. package/repos/effect/.changeset/tall-wombats-wave.md +5 -0
  588. package/repos/effect/.changeset/tangy-colts-lose.md +5 -0
  589. package/repos/effect/.changeset/tasty-comics-send.md +5 -0
  590. package/repos/effect/.changeset/ten-kings-fry.md +5 -0
  591. package/repos/effect/.changeset/thick-pandas-wait.md +5 -0
  592. package/repos/effect/.changeset/thin-ducks-wonder.md +5 -0
  593. package/repos/effect/.changeset/thirty-ducks-go.md +5 -0
  594. package/repos/effect/.changeset/thirty-pans-love.md +5 -0
  595. package/repos/effect/.changeset/three-corners-sort.md +5 -0
  596. package/repos/effect/.changeset/three-ravens-jam.md +5 -0
  597. package/repos/effect/.changeset/three-tomatoes-wave.md +5 -0
  598. package/repos/effect/.changeset/tidy-foxes-own.md +5 -0
  599. package/repos/effect/.changeset/tidy-icons-glow.md +5 -0
  600. package/repos/effect/.changeset/tidy-stacks-encode.md +5 -0
  601. package/repos/effect/.changeset/tidy-stars-drive.md +5 -0
  602. package/repos/effect/.changeset/tiny-buckets-wave.md +5 -0
  603. package/repos/effect/.changeset/tiny-lilies-flash.md +5 -0
  604. package/repos/effect/.changeset/tiny-rabbits-smile.md +5 -0
  605. package/repos/effect/.changeset/tocodecjson-return-json-type.md +10 -0
  606. package/repos/effect/.changeset/tool-get-json-schema-tests.md +5 -0
  607. package/repos/effect/.changeset/true-actors-battle.md +5 -0
  608. package/repos/effect/.changeset/twenty-buttons-cheer.md +5 -0
  609. package/repos/effect/.changeset/two-roses-double.md +5 -0
  610. package/repos/effect/.changeset/unify-error-defect-stack-options.md +23 -0
  611. package/repos/effect/.changeset/update-schema-arbitrary-report.md +22 -0
  612. package/repos/effect/.changeset/upset-colts-stick.md +5 -0
  613. package/repos/effect/.changeset/vast-bananas-send.md +5 -0
  614. package/repos/effect/.changeset/vast-deserts-travel.md +5 -0
  615. package/repos/effect/.changeset/violet-peaches-feel.md +5 -0
  616. package/repos/effect/.changeset/vitest-layer-top-level-options.md +5 -0
  617. package/repos/effect/.changeset/wacky-grapes-poke.md +5 -0
  618. package/repos/effect/.changeset/wacky-rice-add.md +5 -0
  619. package/repos/effect/.changeset/warm-dolls-brake.md +5 -0
  620. package/repos/effect/.changeset/warm-friends-tie.md +5 -0
  621. package/repos/effect/.changeset/warm-snails-shop.md +7 -0
  622. package/repos/effect/.changeset/wet-news-invent.md +5 -0
  623. package/repos/effect/.changeset/wild-readers-clean.md +5 -0
  624. package/repos/effect/.changeset/wild-suns-bearer-space.md +5 -0
  625. package/repos/effect/.changeset/wise-ants-wave.md +6 -0
  626. package/repos/effect/.changeset/wise-flags-shift.md +22 -0
  627. package/repos/effect/.changeset/wise-oranges-stay.md +5 -0
  628. package/repos/effect/.changeset/witty-lobsters-share.md +5 -0
  629. package/repos/effect/.changeset/yellow-adults-study.md +5 -0
  630. package/repos/effect/.changeset/yellow-clocks-dance.md +5 -0
  631. package/repos/effect/.changeset/yellow-dingos-jump.md +5 -0
  632. package/repos/effect/.changeset/young-doors-change.md +5 -0
  633. package/repos/effect/.envrc +1 -0
  634. package/repos/effect/.github/actions/setup/action.yaml +33 -0
  635. package/repos/effect/.github/workflows/ai-codegen.yml +66 -0
  636. package/repos/effect/.github/workflows/bundle-comment.yml +72 -0
  637. package/repos/effect/.github/workflows/check.yml +195 -0
  638. package/repos/effect/.github/workflows/release.yml +47 -0
  639. package/repos/effect/.github/workflows/snapshot.yml +34 -0
  640. package/repos/effect/.oxlintrc.json +25 -0
  641. package/repos/effect/.patterns/effect.md +102 -0
  642. package/repos/effect/.patterns/jsdoc.md +53 -0
  643. package/repos/effect/.patterns/testing.md +44 -0
  644. package/repos/effect/.specs/README.md +2 -0
  645. package/repos/effect/.vscode/extensions.json +6 -0
  646. package/repos/effect/.vscode/settings.json +44 -0
  647. package/repos/effect/AGENTS.md +139 -0
  648. package/repos/effect/LICENSE +21 -0
  649. package/repos/effect/LLMS.md +343 -0
  650. package/repos/effect/MIGRATION.md +83 -0
  651. package/repos/effect/README.md +3 -0
  652. package/repos/effect/TODOS.md +28 -0
  653. package/repos/effect/ai-docs/README.md +44 -0
  654. package/repos/effect/ai-docs/package.json +36 -0
  655. package/repos/effect/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
  656. package/repos/effect/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +39 -0
  657. package/repos/effect/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
  658. package/repos/effect/ai-docs/src/01_effect/01_basics/index.md +5 -0
  659. package/repos/effect/ai-docs/src/01_effect/02_services/01_service.ts +45 -0
  660. package/repos/effect/ai-docs/src/01_effect/02_services/10_reference.ts +10 -0
  661. package/repos/effect/ai-docs/src/01_effect/02_services/20_layer-composition.ts +70 -0
  662. package/repos/effect/ai-docs/src/01_effect/02_services/20_layer-unwrap.ts +66 -0
  663. package/repos/effect/ai-docs/src/01_effect/02_services/index.md +5 -0
  664. package/repos/effect/ai-docs/src/01_effect/03_errors/01_error-handling.ts +30 -0
  665. package/repos/effect/ai-docs/src/01_effect/03_errors/10_catch-tags.ts +24 -0
  666. package/repos/effect/ai-docs/src/01_effect/03_errors/20_reason-errors.ts +64 -0
  667. package/repos/effect/ai-docs/src/01_effect/03_errors/index.md +1 -0
  668. package/repos/effect/ai-docs/src/01_effect/04_resources/10_acquire-release.ts +105 -0
  669. package/repos/effect/ai-docs/src/01_effect/04_resources/20_layer-side-effects.ts +31 -0
  670. package/repos/effect/ai-docs/src/01_effect/04_resources/30_layer-map.ts +86 -0
  671. package/repos/effect/ai-docs/src/01_effect/04_resources/index.md +3 -0
  672. package/repos/effect/ai-docs/src/01_effect/05_running/10_run-main.ts +30 -0
  673. package/repos/effect/ai-docs/src/01_effect/05_running/20_layer-launch.ts +27 -0
  674. package/repos/effect/ai-docs/src/01_effect/05_running/index.md +1 -0
  675. package/repos/effect/ai-docs/src/01_effect/06_pubsub/10_pubsub.ts +56 -0
  676. package/repos/effect/ai-docs/src/01_effect/06_pubsub/index.md +3 -0
  677. package/repos/effect/ai-docs/src/02_stream/10_creating-streams.ts +103 -0
  678. package/repos/effect/ai-docs/src/02_stream/20_consuming-streams.ts +137 -0
  679. package/repos/effect/ai-docs/src/02_stream/30_encoding.ts +165 -0
  680. package/repos/effect/ai-docs/src/02_stream/index.md +4 -0
  681. package/repos/effect/ai-docs/src/03_integration/10_managed-runtime.ts +129 -0
  682. package/repos/effect/ai-docs/src/03_integration/index.md +5 -0
  683. package/repos/effect/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
  684. package/repos/effect/ai-docs/src/05_batching/index.md +3 -0
  685. package/repos/effect/ai-docs/src/06_schedule/10_schedules.ts +102 -0
  686. package/repos/effect/ai-docs/src/06_schedule/index.md +3 -0
  687. package/repos/effect/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
  688. package/repos/effect/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
  689. package/repos/effect/ai-docs/src/07_datetime/index.md +5 -0
  690. package/repos/effect/ai-docs/src/08_observability/10_logging.ts +66 -0
  691. package/repos/effect/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
  692. package/repos/effect/ai-docs/src/08_observability/index.md +7 -0
  693. package/repos/effect/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
  694. package/repos/effect/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
  695. package/repos/effect/ai-docs/src/09_testing/index.md +1 -0
  696. package/repos/effect/ai-docs/src/50_http-client/10_basics.ts +102 -0
  697. package/repos/effect/ai-docs/src/50_http-client/index.md +3 -0
  698. package/repos/effect/ai-docs/src/51_http-server/10_basics.ts +116 -0
  699. package/repos/effect/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
  700. package/repos/effect/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
  701. package/repos/effect/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
  702. package/repos/effect/ai-docs/src/51_http-server/fixtures/api/Users.ts +91 -0
  703. package/repos/effect/ai-docs/src/51_http-server/fixtures/domain/User.ts +12 -0
  704. package/repos/effect/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
  705. package/repos/effect/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +36 -0
  706. package/repos/effect/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +71 -0
  707. package/repos/effect/ai-docs/src/51_http-server/fixtures/server/Users.ts +62 -0
  708. package/repos/effect/ai-docs/src/51_http-server/index.md +3 -0
  709. package/repos/effect/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
  710. package/repos/effect/ai-docs/src/60_child-process/index.md +3 -0
  711. package/repos/effect/ai-docs/src/70_cli/10_basics.ts +136 -0
  712. package/repos/effect/ai-docs/src/70_cli/index.md +5 -0
  713. package/repos/effect/ai-docs/src/71_ai/10_language-model.ts +156 -0
  714. package/repos/effect/ai-docs/src/71_ai/20_tools.ts +226 -0
  715. package/repos/effect/ai-docs/src/71_ai/30_chat.ts +158 -0
  716. package/repos/effect/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
  717. package/repos/effect/ai-docs/src/71_ai/index.md +5 -0
  718. package/repos/effect/ai-docs/src/80_cluster/10_entities.ts +97 -0
  719. package/repos/effect/ai-docs/src/80_cluster/index.md +4 -0
  720. package/repos/effect/ai-docs/src/index.md +12 -0
  721. package/repos/effect/ai-docs/tsconfig.json +24 -0
  722. package/repos/effect/cookbooks/schedule.md +3507 -0
  723. package/repos/effect/deno.json +33 -0
  724. package/repos/effect/docker-compose.yaml +18 -0
  725. package/repos/effect/dprint.json +32 -0
  726. package/repos/effect/flake.lock +27 -0
  727. package/repos/effect/flake.nix +24 -0
  728. package/repos/effect/jsdocs.config.json +16 -0
  729. package/repos/effect/migration/cause.md +163 -0
  730. package/repos/effect/migration/equality.md +72 -0
  731. package/repos/effect/migration/error-handling.md +106 -0
  732. package/repos/effect/migration/fiber-keep-alive.md +74 -0
  733. package/repos/effect/migration/fiberref.md +109 -0
  734. package/repos/effect/migration/forking.md +94 -0
  735. package/repos/effect/migration/generators.md +32 -0
  736. package/repos/effect/migration/layer-memoization.md +98 -0
  737. package/repos/effect/migration/runtime.md +88 -0
  738. package/repos/effect/migration/schema.md +1032 -0
  739. package/repos/effect/migration/scope.md +50 -0
  740. package/repos/effect/migration/services.md +235 -0
  741. package/repos/effect/migration/v3-to-v4.md +421 -0
  742. package/repos/effect/migration/yieldable.md +173 -0
  743. package/repos/effect/package.json +104 -0
  744. package/repos/effect/packages/ai/anthropic/CHANGELOG.md +611 -0
  745. package/repos/effect/packages/ai/anthropic/codegen.yml +63 -0
  746. package/repos/effect/packages/ai/anthropic/docgen.json +26 -0
  747. package/repos/effect/packages/ai/anthropic/package.json +67 -0
  748. package/repos/effect/packages/ai/anthropic/src/AnthropicClient.ts +432 -0
  749. package/repos/effect/packages/ai/anthropic/src/AnthropicConfig.ts +84 -0
  750. package/repos/effect/packages/ai/anthropic/src/AnthropicError.ts +212 -0
  751. package/repos/effect/packages/ai/anthropic/src/AnthropicLanguageModel.ts +3098 -0
  752. package/repos/effect/packages/ai/anthropic/src/AnthropicTelemetry.ts +132 -0
  753. package/repos/effect/packages/ai/anthropic/src/AnthropicTool.ts +2512 -0
  754. package/repos/effect/packages/ai/anthropic/src/Generated.ts +12600 -0
  755. package/repos/effect/packages/ai/anthropic/src/index.ts +40 -0
  756. package/repos/effect/packages/ai/anthropic/src/internal/errors.ts +370 -0
  757. package/repos/effect/packages/ai/anthropic/src/internal/utilities.ts +26 -0
  758. package/repos/effect/packages/ai/anthropic/test/AnthropicLanguageModel.test.ts +300 -0
  759. package/repos/effect/packages/ai/anthropic/tsconfig.json +8 -0
  760. package/repos/effect/packages/ai/anthropic/vitest.config.ts +6 -0
  761. package/repos/effect/packages/ai/openai/CHANGELOG.md +668 -0
  762. package/repos/effect/packages/ai/openai/codegen.yaml +41 -0
  763. package/repos/effect/packages/ai/openai/docgen.json +24 -0
  764. package/repos/effect/packages/ai/openai/package.json +67 -0
  765. package/repos/effect/packages/ai/openai/src/Generated.ts +35774 -0
  766. package/repos/effect/packages/ai/openai/src/OpenAiClient.ts +730 -0
  767. package/repos/effect/packages/ai/openai/src/OpenAiClientGenerated.ts +202 -0
  768. package/repos/effect/packages/ai/openai/src/OpenAiConfig.ts +93 -0
  769. package/repos/effect/packages/ai/openai/src/OpenAiEmbeddingModel.ts +258 -0
  770. package/repos/effect/packages/ai/openai/src/OpenAiError.ts +242 -0
  771. package/repos/effect/packages/ai/openai/src/OpenAiLanguageModel.ts +3133 -0
  772. package/repos/effect/packages/ai/openai/src/OpenAiSchema.ts +1286 -0
  773. package/repos/effect/packages/ai/openai/src/OpenAiTelemetry.ts +162 -0
  774. package/repos/effect/packages/ai/openai/src/OpenAiTool.ts +342 -0
  775. package/repos/effect/packages/ai/openai/src/index.ts +55 -0
  776. package/repos/effect/packages/ai/openai/src/internal/errors.ts +349 -0
  777. package/repos/effect/packages/ai/openai/src/internal/utilities.ts +33 -0
  778. package/repos/effect/packages/ai/openai/test/OpenAiClient.test.ts +798 -0
  779. package/repos/effect/packages/ai/openai/test/OpenAiEmbeddingModel.test.ts +289 -0
  780. package/repos/effect/packages/ai/openai/test/OpenAiLanguageModel.test.ts +1528 -0
  781. package/repos/effect/packages/ai/openai/test/OpenAiSchema.test.ts +273 -0
  782. package/repos/effect/packages/ai/openai/tsconfig.json +8 -0
  783. package/repos/effect/packages/ai/openai/vitest.config.ts +6 -0
  784. package/repos/effect/packages/ai/openai-compat/CHANGELOG.md +626 -0
  785. package/repos/effect/packages/ai/openai-compat/docgen.json +24 -0
  786. package/repos/effect/packages/ai/openai-compat/package.json +69 -0
  787. package/repos/effect/packages/ai/openai-compat/src/OpenAiClient.ts +1221 -0
  788. package/repos/effect/packages/ai/openai-compat/src/OpenAiConfig.ts +87 -0
  789. package/repos/effect/packages/ai/openai-compat/src/OpenAiEmbeddingModel.ts +254 -0
  790. package/repos/effect/packages/ai/openai-compat/src/OpenAiError.ts +178 -0
  791. package/repos/effect/packages/ai/openai-compat/src/OpenAiLanguageModel.ts +1951 -0
  792. package/repos/effect/packages/ai/openai-compat/src/OpenAiTelemetry.ts +164 -0
  793. package/repos/effect/packages/ai/openai-compat/src/index.ts +35 -0
  794. package/repos/effect/packages/ai/openai-compat/src/internal/errors.ts +327 -0
  795. package/repos/effect/packages/ai/openai-compat/src/internal/utilities.ts +33 -0
  796. package/repos/effect/packages/ai/openai-compat/test/OpenAiClient.test.ts +474 -0
  797. package/repos/effect/packages/ai/openai-compat/test/OpenAiEmbeddingModel.test.ts +216 -0
  798. package/repos/effect/packages/ai/openai-compat/test/OpenAiLanguageModel.test.ts +1505 -0
  799. package/repos/effect/packages/ai/openai-compat/tsconfig.json +8 -0
  800. package/repos/effect/packages/ai/openai-compat/vitest.config.ts +6 -0
  801. package/repos/effect/packages/ai/openrouter/CHANGELOG.md +607 -0
  802. package/repos/effect/packages/ai/openrouter/codegen.yml +35 -0
  803. package/repos/effect/packages/ai/openrouter/docgen.json +24 -0
  804. package/repos/effect/packages/ai/openrouter/package.json +67 -0
  805. package/repos/effect/packages/ai/openrouter/src/Generated.ts +10028 -0
  806. package/repos/effect/packages/ai/openrouter/src/OpenRouterClient.ts +357 -0
  807. package/repos/effect/packages/ai/openrouter/src/OpenRouterConfig.ts +99 -0
  808. package/repos/effect/packages/ai/openrouter/src/OpenRouterError.ts +225 -0
  809. package/repos/effect/packages/ai/openrouter/src/OpenRouterLanguageModel.ts +1796 -0
  810. package/repos/effect/packages/ai/openrouter/src/index.ts +30 -0
  811. package/repos/effect/packages/ai/openrouter/src/internal/errors.ts +375 -0
  812. package/repos/effect/packages/ai/openrouter/src/internal/utilities.ts +92 -0
  813. package/repos/effect/packages/ai/openrouter/tsconfig.json +10 -0
  814. package/repos/effect/packages/ai/openrouter/vitest.config.ts +6 -0
  815. package/repos/effect/packages/atom/react/CHANGELOG.md +599 -0
  816. package/repos/effect/packages/atom/react/LICENSE +21 -0
  817. package/repos/effect/packages/atom/react/README.md +7 -0
  818. package/repos/effect/packages/atom/react/docgen.json +25 -0
  819. package/repos/effect/packages/atom/react/package.json +79 -0
  820. package/repos/effect/packages/atom/react/src/Hooks.ts +476 -0
  821. package/repos/effect/packages/atom/react/src/ReactHydration.ts +109 -0
  822. package/repos/effect/packages/atom/react/src/RegistryContext.ts +108 -0
  823. package/repos/effect/packages/atom/react/src/ScopedAtom.ts +151 -0
  824. package/repos/effect/packages/atom/react/src/index.ts +23 -0
  825. package/repos/effect/packages/atom/react/test/index.test.tsx +650 -0
  826. package/repos/effect/packages/atom/react/tsconfig.json +8 -0
  827. package/repos/effect/packages/atom/react/vitest.config.ts +9 -0
  828. package/repos/effect/packages/atom/react/vitest.setup.ts +8 -0
  829. package/repos/effect/packages/atom/solid/CHANGELOG.md +595 -0
  830. package/repos/effect/packages/atom/solid/LICENSE +21 -0
  831. package/repos/effect/packages/atom/solid/README.md +7 -0
  832. package/repos/effect/packages/atom/solid/docgen.json +26 -0
  833. package/repos/effect/packages/atom/solid/package.json +72 -0
  834. package/repos/effect/packages/atom/solid/src/Hooks.ts +359 -0
  835. package/repos/effect/packages/atom/solid/src/RegistryContext.ts +80 -0
  836. package/repos/effect/packages/atom/solid/src/index.ts +13 -0
  837. package/repos/effect/packages/atom/solid/test/index.test.tsx +296 -0
  838. package/repos/effect/packages/atom/solid/tsconfig.json +8 -0
  839. package/repos/effect/packages/atom/solid/vitest.config.ts +15 -0
  840. package/repos/effect/packages/atom/solid/vitest.setup.ts +8 -0
  841. package/repos/effect/packages/atom/vue/CHANGELOG.md +593 -0
  842. package/repos/effect/packages/atom/vue/LICENSE +21 -0
  843. package/repos/effect/packages/atom/vue/README.md +7 -0
  844. package/repos/effect/packages/atom/vue/docgen.json +24 -0
  845. package/repos/effect/packages/atom/vue/package.json +68 -0
  846. package/repos/effect/packages/atom/vue/src/index.ts +211 -0
  847. package/repos/effect/packages/atom/vue/test/index.test.ts +5 -0
  848. package/repos/effect/packages/atom/vue/tsconfig.json +14 -0
  849. package/repos/effect/packages/atom/vue/vitest.config.ts +8 -0
  850. package/repos/effect/packages/effect/CHANGELOG.md +1607 -0
  851. package/repos/effect/packages/effect/CONFIG.md +690 -0
  852. package/repos/effect/packages/effect/HTTPAPI.md +3213 -0
  853. package/repos/effect/packages/effect/LICENSE +21 -0
  854. package/repos/effect/packages/effect/MCP.md +369 -0
  855. package/repos/effect/packages/effect/OPTIC.md +620 -0
  856. package/repos/effect/packages/effect/README.md +53 -0
  857. package/repos/effect/packages/effect/SCHEMA.md +7284 -0
  858. package/repos/effect/packages/effect/benchmark/schema/Enums.ts +40 -0
  859. package/repos/effect/packages/effect/benchmark/schema/Optic.ts +79 -0
  860. package/repos/effect/packages/effect/benchmark/schema/array.ts +74 -0
  861. package/repos/effect/packages/effect/benchmark/schema/filter.ts +74 -0
  862. package/repos/effect/packages/effect/benchmark/schema/object.ts +82 -0
  863. package/repos/effect/packages/effect/benchmark/schema/tagged-union.ts +69 -0
  864. package/repos/effect/packages/effect/benchmark/schema/transformation.ts +91 -0
  865. package/repos/effect/packages/effect/benchmark/stream/splitLines.ts +46 -0
  866. package/repos/effect/packages/effect/docgen.json +38 -0
  867. package/repos/effect/packages/effect/package.json +127 -0
  868. package/repos/effect/packages/effect/src/Array.ts +4908 -0
  869. package/repos/effect/packages/effect/src/BigDecimal.ts +1943 -0
  870. package/repos/effect/packages/effect/src/BigInt.ts +1029 -0
  871. package/repos/effect/packages/effect/src/Boolean.ts +481 -0
  872. package/repos/effect/packages/effect/src/Brand.ts +318 -0
  873. package/repos/effect/packages/effect/src/Cache.ts +1295 -0
  874. package/repos/effect/packages/effect/src/Cause.ts +1939 -0
  875. package/repos/effect/packages/effect/src/Channel.ts +8615 -0
  876. package/repos/effect/packages/effect/src/ChannelSchema.ts +308 -0
  877. package/repos/effect/packages/effect/src/Chunk.ts +2976 -0
  878. package/repos/effect/packages/effect/src/Clock.ts +194 -0
  879. package/repos/effect/packages/effect/src/Combiner.ts +316 -0
  880. package/repos/effect/packages/effect/src/Config.ts +1416 -0
  881. package/repos/effect/packages/effect/src/ConfigProvider.ts +1159 -0
  882. package/repos/effect/packages/effect/src/Console.ts +653 -0
  883. package/repos/effect/packages/effect/src/Context.ts +1339 -0
  884. package/repos/effect/packages/effect/src/Cron.ts +1212 -0
  885. package/repos/effect/packages/effect/src/Crypto.ts +318 -0
  886. package/repos/effect/packages/effect/src/Data.ts +774 -0
  887. package/repos/effect/packages/effect/src/DateTime.ts +2922 -0
  888. package/repos/effect/packages/effect/src/Deferred.ts +917 -0
  889. package/repos/effect/packages/effect/src/Differ.ts +32 -0
  890. package/repos/effect/packages/effect/src/Duration.ts +1827 -0
  891. package/repos/effect/packages/effect/src/Effect.ts +15347 -0
  892. package/repos/effect/packages/effect/src/Effectable.ts +68 -0
  893. package/repos/effect/packages/effect/src/Encoding.ts +1046 -0
  894. package/repos/effect/packages/effect/src/Equal.ts +550 -0
  895. package/repos/effect/packages/effect/src/Equivalence.ts +870 -0
  896. package/repos/effect/packages/effect/src/ErrorReporter.ts +543 -0
  897. package/repos/effect/packages/effect/src/ExecutionPlan.ts +416 -0
  898. package/repos/effect/packages/effect/src/Exit.ts +1085 -0
  899. package/repos/effect/packages/effect/src/Fiber.ts +632 -0
  900. package/repos/effect/packages/effect/src/FiberHandle.ts +815 -0
  901. package/repos/effect/packages/effect/src/FiberMap.ts +1030 -0
  902. package/repos/effect/packages/effect/src/FiberSet.ts +713 -0
  903. package/repos/effect/packages/effect/src/FileSystem.ts +1394 -0
  904. package/repos/effect/packages/effect/src/Filter.ts +827 -0
  905. package/repos/effect/packages/effect/src/Formatter.ts +319 -0
  906. package/repos/effect/packages/effect/src/Function.ts +1415 -0
  907. package/repos/effect/packages/effect/src/Graph.ts +4892 -0
  908. package/repos/effect/packages/effect/src/HKT.ts +213 -0
  909. package/repos/effect/packages/effect/src/Hash.ts +539 -0
  910. package/repos/effect/packages/effect/src/HashMap.ts +1236 -0
  911. package/repos/effect/packages/effect/src/HashRing.ts +426 -0
  912. package/repos/effect/packages/effect/src/HashSet.ts +605 -0
  913. package/repos/effect/packages/effect/src/Inspectable.ts +329 -0
  914. package/repos/effect/packages/effect/src/Iterable.ts +2483 -0
  915. package/repos/effect/packages/effect/src/JsonPatch.ts +469 -0
  916. package/repos/effect/packages/effect/src/JsonPointer.ts +80 -0
  917. package/repos/effect/packages/effect/src/JsonSchema.ts +948 -0
  918. package/repos/effect/packages/effect/src/Latch.ts +373 -0
  919. package/repos/effect/packages/effect/src/Layer.ts +2773 -0
  920. package/repos/effect/packages/effect/src/LayerMap.ts +468 -0
  921. package/repos/effect/packages/effect/src/LogLevel.ts +412 -0
  922. package/repos/effect/packages/effect/src/Logger.ts +1284 -0
  923. package/repos/effect/packages/effect/src/ManagedRuntime.ts +381 -0
  924. package/repos/effect/packages/effect/src/Match.ts +2606 -0
  925. package/repos/effect/packages/effect/src/Metric.ts +4058 -0
  926. package/repos/effect/packages/effect/src/MutableHashMap.ts +845 -0
  927. package/repos/effect/packages/effect/src/MutableHashSet.ts +422 -0
  928. package/repos/effect/packages/effect/src/MutableList.ts +967 -0
  929. package/repos/effect/packages/effect/src/MutableRef.ts +822 -0
  930. package/repos/effect/packages/effect/src/Newtype.ts +319 -0
  931. package/repos/effect/packages/effect/src/NonEmptyIterable.ts +221 -0
  932. package/repos/effect/packages/effect/src/Number.ts +860 -0
  933. package/repos/effect/packages/effect/src/Optic.ts +1701 -0
  934. package/repos/effect/packages/effect/src/Option.ts +2664 -0
  935. package/repos/effect/packages/effect/src/Order.ts +982 -0
  936. package/repos/effect/packages/effect/src/Ordering.ts +182 -0
  937. package/repos/effect/packages/effect/src/PartitionedSemaphore.ts +561 -0
  938. package/repos/effect/packages/effect/src/Path.ts +870 -0
  939. package/repos/effect/packages/effect/src/Pipeable.ts +674 -0
  940. package/repos/effect/packages/effect/src/PlatformError.ts +221 -0
  941. package/repos/effect/packages/effect/src/Pool.ts +699 -0
  942. package/repos/effect/packages/effect/src/Predicate.ts +1872 -0
  943. package/repos/effect/packages/effect/src/PrimaryKey.ts +123 -0
  944. package/repos/effect/packages/effect/src/PubSub.ts +2797 -0
  945. package/repos/effect/packages/effect/src/Pull.ts +376 -0
  946. package/repos/effect/packages/effect/src/Queue.ts +1962 -0
  947. package/repos/effect/packages/effect/src/Random.ts +549 -0
  948. package/repos/effect/packages/effect/src/RcMap.ts +612 -0
  949. package/repos/effect/packages/effect/src/RcRef.ts +225 -0
  950. package/repos/effect/packages/effect/src/Record.ts +1563 -0
  951. package/repos/effect/packages/effect/src/Redactable.ts +168 -0
  952. package/repos/effect/packages/effect/src/Redacted.ts +314 -0
  953. package/repos/effect/packages/effect/src/Reducer.ts +178 -0
  954. package/repos/effect/packages/effect/src/Ref.ts +801 -0
  955. package/repos/effect/packages/effect/src/References.ts +786 -0
  956. package/repos/effect/packages/effect/src/RegExp.ts +82 -0
  957. package/repos/effect/packages/effect/src/Request.ts +598 -0
  958. package/repos/effect/packages/effect/src/RequestResolver.ts +1249 -0
  959. package/repos/effect/packages/effect/src/Resource.ts +184 -0
  960. package/repos/effect/packages/effect/src/Result.ts +1939 -0
  961. package/repos/effect/packages/effect/src/Runtime.ts +432 -0
  962. package/repos/effect/packages/effect/src/Schedule.ts +3564 -0
  963. package/repos/effect/packages/effect/src/Scheduler.ts +285 -0
  964. package/repos/effect/packages/effect/src/Schema.ts +14653 -0
  965. package/repos/effect/packages/effect/src/SchemaAST.ts +3903 -0
  966. package/repos/effect/packages/effect/src/SchemaGetter.ts +1870 -0
  967. package/repos/effect/packages/effect/src/SchemaIssue.ts +1176 -0
  968. package/repos/effect/packages/effect/src/SchemaParser.ts +1105 -0
  969. package/repos/effect/packages/effect/src/SchemaRepresentation.ts +3944 -0
  970. package/repos/effect/packages/effect/src/SchemaTransformation.ts +1818 -0
  971. package/repos/effect/packages/effect/src/SchemaUtils.ts +51 -0
  972. package/repos/effect/packages/effect/src/Scope.ts +572 -0
  973. package/repos/effect/packages/effect/src/ScopedCache.ts +820 -0
  974. package/repos/effect/packages/effect/src/ScopedRef.ts +192 -0
  975. package/repos/effect/packages/effect/src/Semaphore.ts +517 -0
  976. package/repos/effect/packages/effect/src/Sink.ts +2174 -0
  977. package/repos/effect/packages/effect/src/Stdio.ts +143 -0
  978. package/repos/effect/packages/effect/src/Stream.ts +11722 -0
  979. package/repos/effect/packages/effect/src/String.ts +1427 -0
  980. package/repos/effect/packages/effect/src/Struct.ts +979 -0
  981. package/repos/effect/packages/effect/src/SubscriptionRef.ts +1021 -0
  982. package/repos/effect/packages/effect/src/Symbol.ts +31 -0
  983. package/repos/effect/packages/effect/src/SynchronizedRef.ts +668 -0
  984. package/repos/effect/packages/effect/src/Take.ts +46 -0
  985. package/repos/effect/packages/effect/src/Terminal.ts +188 -0
  986. package/repos/effect/packages/effect/src/Tracer.ts +683 -0
  987. package/repos/effect/packages/effect/src/Trie.ts +953 -0
  988. package/repos/effect/packages/effect/src/Tuple.ts +737 -0
  989. package/repos/effect/packages/effect/src/TxChunk.ts +822 -0
  990. package/repos/effect/packages/effect/src/TxDeferred.ts +319 -0
  991. package/repos/effect/packages/effect/src/TxHashMap.ts +2165 -0
  992. package/repos/effect/packages/effect/src/TxHashSet.ts +908 -0
  993. package/repos/effect/packages/effect/src/TxPriorityQueue.ts +567 -0
  994. package/repos/effect/packages/effect/src/TxPubSub.ts +684 -0
  995. package/repos/effect/packages/effect/src/TxQueue.ts +1488 -0
  996. package/repos/effect/packages/effect/src/TxReentrantLock.ts +655 -0
  997. package/repos/effect/packages/effect/src/TxRef.ts +282 -0
  998. package/repos/effect/packages/effect/src/TxSemaphore.ts +707 -0
  999. package/repos/effect/packages/effect/src/TxSubscriptionRef.ts +518 -0
  1000. package/repos/effect/packages/effect/src/Types.ts +1121 -0
  1001. package/repos/effect/packages/effect/src/UndefinedOr.ts +239 -0
  1002. package/repos/effect/packages/effect/src/Unify.ts +314 -0
  1003. package/repos/effect/packages/effect/src/Utils.ts +221 -0
  1004. package/repos/effect/packages/effect/src/index.ts +712 -0
  1005. package/repos/effect/packages/effect/src/internal/array.ts +8 -0
  1006. package/repos/effect/packages/effect/src/internal/concurrency.ts +52 -0
  1007. package/repos/effect/packages/effect/src/internal/core.ts +666 -0
  1008. package/repos/effect/packages/effect/src/internal/dateTime.ts +1264 -0
  1009. package/repos/effect/packages/effect/src/internal/doNotation.ts +117 -0
  1010. package/repos/effect/packages/effect/src/internal/effect.ts +6427 -0
  1011. package/repos/effect/packages/effect/src/internal/equal.ts +28 -0
  1012. package/repos/effect/packages/effect/src/internal/errors.ts +9 -0
  1013. package/repos/effect/packages/effect/src/internal/executionPlan.ts +120 -0
  1014. package/repos/effect/packages/effect/src/internal/hashMap.ts +1309 -0
  1015. package/repos/effect/packages/effect/src/internal/hashSet.ts +190 -0
  1016. package/repos/effect/packages/effect/src/internal/layer.ts +88 -0
  1017. package/repos/effect/packages/effect/src/internal/matcher.ts +637 -0
  1018. package/repos/effect/packages/effect/src/internal/metric.ts +2 -0
  1019. package/repos/effect/packages/effect/src/internal/option.ts +98 -0
  1020. package/repos/effect/packages/effect/src/internal/random.ts +20 -0
  1021. package/repos/effect/packages/effect/src/internal/rcRef.ts +189 -0
  1022. package/repos/effect/packages/effect/src/internal/record.ts +18 -0
  1023. package/repos/effect/packages/effect/src/internal/redacted.ts +19 -0
  1024. package/repos/effect/packages/effect/src/internal/references.ts +72 -0
  1025. package/repos/effect/packages/effect/src/internal/request.ts +205 -0
  1026. package/repos/effect/packages/effect/src/internal/result.ts +112 -0
  1027. package/repos/effect/packages/effect/src/internal/schedule.ts +248 -0
  1028. package/repos/effect/packages/effect/src/internal/schema/annotations.ts +37 -0
  1029. package/repos/effect/packages/effect/src/internal/schema/arbitrary.ts +894 -0
  1030. package/repos/effect/packages/effect/src/internal/schema/cause.ts +26 -0
  1031. package/repos/effect/packages/effect/src/internal/schema/equivalence.ts +154 -0
  1032. package/repos/effect/packages/effect/src/internal/schema/representation.ts +799 -0
  1033. package/repos/effect/packages/effect/src/internal/schema/schema.ts +128 -0
  1034. package/repos/effect/packages/effect/src/internal/stream.ts +28 -0
  1035. package/repos/effect/packages/effect/src/internal/tracer.ts +41 -0
  1036. package/repos/effect/packages/effect/src/internal/trie.ts +733 -0
  1037. package/repos/effect/packages/effect/src/internal/version.ts +2 -0
  1038. package/repos/effect/packages/effect/src/testing/FastCheck.ts +89 -0
  1039. package/repos/effect/packages/effect/src/testing/TestClock.ts +547 -0
  1040. package/repos/effect/packages/effect/src/testing/TestConsole.ts +369 -0
  1041. package/repos/effect/packages/effect/src/testing/TestSchema.ts +567 -0
  1042. package/repos/effect/packages/effect/src/testing/index.ts +25 -0
  1043. package/repos/effect/packages/effect/src/unstable/ai/AiError.ts +1629 -0
  1044. package/repos/effect/packages/effect/src/unstable/ai/AnthropicStructuredOutput.ts +407 -0
  1045. package/repos/effect/packages/effect/src/unstable/ai/Chat.ts +931 -0
  1046. package/repos/effect/packages/effect/src/unstable/ai/EmbeddingModel.ts +269 -0
  1047. package/repos/effect/packages/effect/src/unstable/ai/IdGenerator.ts +300 -0
  1048. package/repos/effect/packages/effect/src/unstable/ai/LanguageModel.ts +2221 -0
  1049. package/repos/effect/packages/effect/src/unstable/ai/McpSchema.ts +2527 -0
  1050. package/repos/effect/packages/effect/src/unstable/ai/McpServer.ts +1468 -0
  1051. package/repos/effect/packages/effect/src/unstable/ai/Model.ts +166 -0
  1052. package/repos/effect/packages/effect/src/unstable/ai/OpenAiStructuredOutput.ts +476 -0
  1053. package/repos/effect/packages/effect/src/unstable/ai/Prompt.ts +2234 -0
  1054. package/repos/effect/packages/effect/src/unstable/ai/Response.ts +2582 -0
  1055. package/repos/effect/packages/effect/src/unstable/ai/ResponseIdTracker.ts +139 -0
  1056. package/repos/effect/packages/effect/src/unstable/ai/Telemetry.ts +515 -0
  1057. package/repos/effect/packages/effect/src/unstable/ai/Tokenizer.ts +176 -0
  1058. package/repos/effect/packages/effect/src/unstable/ai/Tool.ts +2003 -0
  1059. package/repos/effect/packages/effect/src/unstable/ai/Toolkit.ts +554 -0
  1060. package/repos/effect/packages/effect/src/unstable/ai/index.ts +90 -0
  1061. package/repos/effect/packages/effect/src/unstable/ai/internal/codec-transformer.ts +13 -0
  1062. package/repos/effect/packages/effect/src/unstable/cli/Argument.ts +749 -0
  1063. package/repos/effect/packages/effect/src/unstable/cli/CliError.ts +549 -0
  1064. package/repos/effect/packages/effect/src/unstable/cli/CliOutput.ts +607 -0
  1065. package/repos/effect/packages/effect/src/unstable/cli/Command.ts +1610 -0
  1066. package/repos/effect/packages/effect/src/unstable/cli/Completions.ts +123 -0
  1067. package/repos/effect/packages/effect/src/unstable/cli/Flag.ts +986 -0
  1068. package/repos/effect/packages/effect/src/unstable/cli/GlobalFlag.ts +295 -0
  1069. package/repos/effect/packages/effect/src/unstable/cli/HelpDoc.ts +323 -0
  1070. package/repos/effect/packages/effect/src/unstable/cli/Param.ts +2193 -0
  1071. package/repos/effect/packages/effect/src/unstable/cli/Primitive.ts +766 -0
  1072. package/repos/effect/packages/effect/src/unstable/cli/Prompt.ts +3852 -0
  1073. package/repos/effect/packages/effect/src/unstable/cli/SEMANTICS.md +157 -0
  1074. package/repos/effect/packages/effect/src/unstable/cli/index.ts +60 -0
  1075. package/repos/effect/packages/effect/src/unstable/cli/internal/ansi.ts +152 -0
  1076. package/repos/effect/packages/effect/src/unstable/cli/internal/auto-suggest.ts +41 -0
  1077. package/repos/effect/packages/effect/src/unstable/cli/internal/command.ts +340 -0
  1078. package/repos/effect/packages/effect/src/unstable/cli/internal/completions/bash.ts +222 -0
  1079. package/repos/effect/packages/effect/src/unstable/cli/internal/completions/descriptor.ts +133 -0
  1080. package/repos/effect/packages/effect/src/unstable/cli/internal/completions/fish.ts +253 -0
  1081. package/repos/effect/packages/effect/src/unstable/cli/internal/completions/zsh.ts +220 -0
  1082. package/repos/effect/packages/effect/src/unstable/cli/internal/config.ts +272 -0
  1083. package/repos/effect/packages/effect/src/unstable/cli/internal/help.ts +181 -0
  1084. package/repos/effect/packages/effect/src/unstable/cli/internal/lexer.ts +70 -0
  1085. package/repos/effect/packages/effect/src/unstable/cli/internal/parser.ts +932 -0
  1086. package/repos/effect/packages/effect/src/unstable/cluster/ClusterCron.ts +163 -0
  1087. package/repos/effect/packages/effect/src/unstable/cluster/ClusterError.ts +238 -0
  1088. package/repos/effect/packages/effect/src/unstable/cluster/ClusterMetrics.ts +112 -0
  1089. package/repos/effect/packages/effect/src/unstable/cluster/ClusterSchema.ts +170 -0
  1090. package/repos/effect/packages/effect/src/unstable/cluster/ClusterWorkflowEngine.ts +778 -0
  1091. package/repos/effect/packages/effect/src/unstable/cluster/DeliverAt.ts +58 -0
  1092. package/repos/effect/packages/effect/src/unstable/cluster/Entity.ts +779 -0
  1093. package/repos/effect/packages/effect/src/unstable/cluster/EntityAddress.ts +93 -0
  1094. package/repos/effect/packages/effect/src/unstable/cluster/EntityId.ts +50 -0
  1095. package/repos/effect/packages/effect/src/unstable/cluster/EntityProxy.ts +263 -0
  1096. package/repos/effect/packages/effect/src/unstable/cluster/EntityProxyServer.ts +149 -0
  1097. package/repos/effect/packages/effect/src/unstable/cluster/EntityResource.ts +184 -0
  1098. package/repos/effect/packages/effect/src/unstable/cluster/EntityType.ts +52 -0
  1099. package/repos/effect/packages/effect/src/unstable/cluster/Envelope.ts +433 -0
  1100. package/repos/effect/packages/effect/src/unstable/cluster/HttpRunner.ts +345 -0
  1101. package/repos/effect/packages/effect/src/unstable/cluster/K8sHttpClient.ts +297 -0
  1102. package/repos/effect/packages/effect/src/unstable/cluster/MachineId.ts +54 -0
  1103. package/repos/effect/packages/effect/src/unstable/cluster/Message.ts +314 -0
  1104. package/repos/effect/packages/effect/src/unstable/cluster/MessageStorage.ts +1072 -0
  1105. package/repos/effect/packages/effect/src/unstable/cluster/Reply.ts +455 -0
  1106. package/repos/effect/packages/effect/src/unstable/cluster/Runner.ts +129 -0
  1107. package/repos/effect/packages/effect/src/unstable/cluster/RunnerAddress.ts +112 -0
  1108. package/repos/effect/packages/effect/src/unstable/cluster/RunnerHealth.ts +145 -0
  1109. package/repos/effect/packages/effect/src/unstable/cluster/RunnerServer.ts +220 -0
  1110. package/repos/effect/packages/effect/src/unstable/cluster/RunnerStorage.ts +243 -0
  1111. package/repos/effect/packages/effect/src/unstable/cluster/Runners.ts +690 -0
  1112. package/repos/effect/packages/effect/src/unstable/cluster/ShardId.ts +178 -0
  1113. package/repos/effect/packages/effect/src/unstable/cluster/Sharding.ts +1488 -0
  1114. package/repos/effect/packages/effect/src/unstable/cluster/ShardingConfig.ts +367 -0
  1115. package/repos/effect/packages/effect/src/unstable/cluster/ShardingRegistrationEvent.ts +76 -0
  1116. package/repos/effect/packages/effect/src/unstable/cluster/SingleRunner.ts +75 -0
  1117. package/repos/effect/packages/effect/src/unstable/cluster/Singleton.ts +56 -0
  1118. package/repos/effect/packages/effect/src/unstable/cluster/SingletonAddress.ts +49 -0
  1119. package/repos/effect/packages/effect/src/unstable/cluster/Snowflake.ts +282 -0
  1120. package/repos/effect/packages/effect/src/unstable/cluster/SocketRunner.ts +96 -0
  1121. package/repos/effect/packages/effect/src/unstable/cluster/SqlMessageStorage.ts +1045 -0
  1122. package/repos/effect/packages/effect/src/unstable/cluster/SqlRunnerStorage.ts +700 -0
  1123. package/repos/effect/packages/effect/src/unstable/cluster/TestRunner.ts +36 -0
  1124. package/repos/effect/packages/effect/src/unstable/cluster/index.ts +195 -0
  1125. package/repos/effect/packages/effect/src/unstable/cluster/internal/entityManager.ts +678 -0
  1126. package/repos/effect/packages/effect/src/unstable/cluster/internal/entityReaper.ts +58 -0
  1127. package/repos/effect/packages/effect/src/unstable/cluster/internal/hash.ts +23 -0
  1128. package/repos/effect/packages/effect/src/unstable/cluster/internal/interruptors.ts +2 -0
  1129. package/repos/effect/packages/effect/src/unstable/cluster/internal/resourceMap.ts +100 -0
  1130. package/repos/effect/packages/effect/src/unstable/cluster/internal/resourceRef.ts +99 -0
  1131. package/repos/effect/packages/effect/src/unstable/devtools/DevTools.ts +68 -0
  1132. package/repos/effect/packages/effect/src/unstable/devtools/DevToolsClient.ts +236 -0
  1133. package/repos/effect/packages/effect/src/unstable/devtools/DevToolsSchema.ts +558 -0
  1134. package/repos/effect/packages/effect/src/unstable/devtools/DevToolsServer.ts +94 -0
  1135. package/repos/effect/packages/effect/src/unstable/devtools/index.ts +25 -0
  1136. package/repos/effect/packages/effect/src/unstable/encoding/Msgpack.ts +383 -0
  1137. package/repos/effect/packages/effect/src/unstable/encoding/Ndjson.ts +602 -0
  1138. package/repos/effect/packages/effect/src/unstable/encoding/Sse.ts +593 -0
  1139. package/repos/effect/packages/effect/src/unstable/encoding/index.ts +20 -0
  1140. package/repos/effect/packages/effect/src/unstable/eventlog/Event.ts +447 -0
  1141. package/repos/effect/packages/effect/src/unstable/eventlog/EventGroup.ts +193 -0
  1142. package/repos/effect/packages/effect/src/unstable/eventlog/EventJournal.ts +795 -0
  1143. package/repos/effect/packages/effect/src/unstable/eventlog/EventLog.ts +1030 -0
  1144. package/repos/effect/packages/effect/src/unstable/eventlog/EventLogEncryption.ts +169 -0
  1145. package/repos/effect/packages/effect/src/unstable/eventlog/EventLogMessage.ts +354 -0
  1146. package/repos/effect/packages/effect/src/unstable/eventlog/EventLogRemote.ts +377 -0
  1147. package/repos/effect/packages/effect/src/unstable/eventlog/EventLogServer.ts +242 -0
  1148. package/repos/effect/packages/effect/src/unstable/eventlog/EventLogServerEncrypted.ts +268 -0
  1149. package/repos/effect/packages/effect/src/unstable/eventlog/EventLogServerUnencrypted.ts +898 -0
  1150. package/repos/effect/packages/effect/src/unstable/eventlog/EventLogSessionAuth.ts +524 -0
  1151. package/repos/effect/packages/effect/src/unstable/eventlog/SqlEventJournal.ts +353 -0
  1152. package/repos/effect/packages/effect/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +343 -0
  1153. package/repos/effect/packages/effect/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +527 -0
  1154. package/repos/effect/packages/effect/src/unstable/eventlog/index.ts +75 -0
  1155. package/repos/effect/packages/effect/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
  1156. package/repos/effect/packages/effect/src/unstable/http/Cookies.ts +952 -0
  1157. package/repos/effect/packages/effect/src/unstable/http/Etag.ts +141 -0
  1158. package/repos/effect/packages/effect/src/unstable/http/FetchHttpClient.ts +123 -0
  1159. package/repos/effect/packages/effect/src/unstable/http/FindMyWay.ts +15 -0
  1160. package/repos/effect/packages/effect/src/unstable/http/Headers.ts +438 -0
  1161. package/repos/effect/packages/effect/src/unstable/http/HttpBody.ts +545 -0
  1162. package/repos/effect/packages/effect/src/unstable/http/HttpClient.ts +1630 -0
  1163. package/repos/effect/packages/effect/src/unstable/http/HttpClientError.ts +328 -0
  1164. package/repos/effect/packages/effect/src/unstable/http/HttpClientRequest.ts +968 -0
  1165. package/repos/effect/packages/effect/src/unstable/http/HttpClientResponse.ts +408 -0
  1166. package/repos/effect/packages/effect/src/unstable/http/HttpEffect.ts +400 -0
  1167. package/repos/effect/packages/effect/src/unstable/http/HttpIncomingMessage.ts +153 -0
  1168. package/repos/effect/packages/effect/src/unstable/http/HttpMethod.ts +124 -0
  1169. package/repos/effect/packages/effect/src/unstable/http/HttpMiddleware.ts +394 -0
  1170. package/repos/effect/packages/effect/src/unstable/http/HttpPlatform.ts +165 -0
  1171. package/repos/effect/packages/effect/src/unstable/http/HttpRouter.ts +1341 -0
  1172. package/repos/effect/packages/effect/src/unstable/http/HttpServer.ts +329 -0
  1173. package/repos/effect/packages/effect/src/unstable/http/HttpServerError.ts +374 -0
  1174. package/repos/effect/packages/effect/src/unstable/http/HttpServerRequest.ts +1081 -0
  1175. package/repos/effect/packages/effect/src/unstable/http/HttpServerRespondable.ts +115 -0
  1176. package/repos/effect/packages/effect/src/unstable/http/HttpServerResponse.ts +1381 -0
  1177. package/repos/effect/packages/effect/src/unstable/http/HttpStaticServer.ts +464 -0
  1178. package/repos/effect/packages/effect/src/unstable/http/HttpTraceContext.ts +160 -0
  1179. package/repos/effect/packages/effect/src/unstable/http/Multipart.ts +830 -0
  1180. package/repos/effect/packages/effect/src/unstable/http/Multipasta/HeadersParser.ts +14 -0
  1181. package/repos/effect/packages/effect/src/unstable/http/Multipasta/Node.ts +14 -0
  1182. package/repos/effect/packages/effect/src/unstable/http/Multipasta/Search.ts +14 -0
  1183. package/repos/effect/packages/effect/src/unstable/http/Multipasta/Web.ts +14 -0
  1184. package/repos/effect/packages/effect/src/unstable/http/Multipasta.ts +15 -0
  1185. package/repos/effect/packages/effect/src/unstable/http/Template.ts +262 -0
  1186. package/repos/effect/packages/effect/src/unstable/http/Url.ts +330 -0
  1187. package/repos/effect/packages/effect/src/unstable/http/UrlParams.ts +678 -0
  1188. package/repos/effect/packages/effect/src/unstable/http/index.ts +145 -0
  1189. package/repos/effect/packages/effect/src/unstable/http/internal/preResponseHandler.ts +15 -0
  1190. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApi.ts +316 -0
  1191. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiBuilder.ts +1015 -0
  1192. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiClient.ts +1005 -0
  1193. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiEndpoint.ts +1545 -0
  1194. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiError.ts +443 -0
  1195. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiGroup.ts +381 -0
  1196. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiMiddleware.ts +478 -0
  1197. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiScalar.ts +267 -0
  1198. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiSchema.ts +733 -0
  1199. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiSecurity.ts +244 -0
  1200. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiSwagger.ts +68 -0
  1201. package/repos/effect/packages/effect/src/unstable/httpapi/HttpApiTest.ts +112 -0
  1202. package/repos/effect/packages/effect/src/unstable/httpapi/OpenApi.ts +1098 -0
  1203. package/repos/effect/packages/effect/src/unstable/httpapi/index.ts +70 -0
  1204. package/repos/effect/packages/effect/src/unstable/httpapi/internal/html.ts +18 -0
  1205. package/repos/effect/packages/effect/src/unstable/httpapi/internal/httpApiScalar.ts +5 -0
  1206. package/repos/effect/packages/effect/src/unstable/httpapi/internal/httpApiSwagger.ts +9 -0
  1207. package/repos/effect/packages/effect/src/unstable/observability/Otlp.ts +172 -0
  1208. package/repos/effect/packages/effect/src/unstable/observability/OtlpExporter.ts +149 -0
  1209. package/repos/effect/packages/effect/src/unstable/observability/OtlpLogger.ts +340 -0
  1210. package/repos/effect/packages/effect/src/unstable/observability/OtlpMetrics.ts +826 -0
  1211. package/repos/effect/packages/effect/src/unstable/observability/OtlpResource.ts +288 -0
  1212. package/repos/effect/packages/effect/src/unstable/observability/OtlpSerialization.ts +66 -0
  1213. package/repos/effect/packages/effect/src/unstable/observability/OtlpTracer.ts +442 -0
  1214. package/repos/effect/packages/effect/src/unstable/observability/PrometheusMetrics.ts +468 -0
  1215. package/repos/effect/packages/effect/src/unstable/observability/index.ts +45 -0
  1216. package/repos/effect/packages/effect/src/unstable/observability/internal/otlpEnv.ts +39 -0
  1217. package/repos/effect/packages/effect/src/unstable/observability/internal/otlpProtobuf.ts +779 -0
  1218. package/repos/effect/packages/effect/src/unstable/observability/internal/protobuf.ts +262 -0
  1219. package/repos/effect/packages/effect/src/unstable/persistence/KeyValueStore.ts +864 -0
  1220. package/repos/effect/packages/effect/src/unstable/persistence/Persistable.ts +252 -0
  1221. package/repos/effect/packages/effect/src/unstable/persistence/PersistedCache.ts +111 -0
  1222. package/repos/effect/packages/effect/src/unstable/persistence/PersistedQueue.ts +1196 -0
  1223. package/repos/effect/packages/effect/src/unstable/persistence/Persistence.ts +1071 -0
  1224. package/repos/effect/packages/effect/src/unstable/persistence/RateLimiter.ts +748 -0
  1225. package/repos/effect/packages/effect/src/unstable/persistence/Redis.ts +188 -0
  1226. package/repos/effect/packages/effect/src/unstable/persistence/index.ts +40 -0
  1227. package/repos/effect/packages/effect/src/unstable/process/ChildProcess.ts +1036 -0
  1228. package/repos/effect/packages/effect/src/unstable/process/ChildProcessSpawner.ts +285 -0
  1229. package/repos/effect/packages/effect/src/unstable/process/index.ts +15 -0
  1230. package/repos/effect/packages/effect/src/unstable/reactivity/AsyncResult.ts +1081 -0
  1231. package/repos/effect/packages/effect/src/unstable/reactivity/Atom.ts +2520 -0
  1232. package/repos/effect/packages/effect/src/unstable/reactivity/AtomHttpApi.ts +352 -0
  1233. package/repos/effect/packages/effect/src/unstable/reactivity/AtomRef.ts +352 -0
  1234. package/repos/effect/packages/effect/src/unstable/reactivity/AtomRegistry.ts +1127 -0
  1235. package/repos/effect/packages/effect/src/unstable/reactivity/AtomRpc.ts +305 -0
  1236. package/repos/effect/packages/effect/src/unstable/reactivity/Hydration.ts +155 -0
  1237. package/repos/effect/packages/effect/src/unstable/reactivity/Reactivity.ts +348 -0
  1238. package/repos/effect/packages/effect/src/unstable/reactivity/index.ts +45 -0
  1239. package/repos/effect/packages/effect/src/unstable/rpc/Rpc.ts +1255 -0
  1240. package/repos/effect/packages/effect/src/unstable/rpc/RpcClient.ts +1370 -0
  1241. package/repos/effect/packages/effect/src/unstable/rpc/RpcClientError.ts +57 -0
  1242. package/repos/effect/packages/effect/src/unstable/rpc/RpcGroup.ts +409 -0
  1243. package/repos/effect/packages/effect/src/unstable/rpc/RpcMessage.ts +402 -0
  1244. package/repos/effect/packages/effect/src/unstable/rpc/RpcMiddleware.ts +344 -0
  1245. package/repos/effect/packages/effect/src/unstable/rpc/RpcSchema.ts +97 -0
  1246. package/repos/effect/packages/effect/src/unstable/rpc/RpcSerialization.ts +546 -0
  1247. package/repos/effect/packages/effect/src/unstable/rpc/RpcServer.ts +1492 -0
  1248. package/repos/effect/packages/effect/src/unstable/rpc/RpcTest.ts +56 -0
  1249. package/repos/effect/packages/effect/src/unstable/rpc/RpcWorker.ts +118 -0
  1250. package/repos/effect/packages/effect/src/unstable/rpc/Utils.ts +120 -0
  1251. package/repos/effect/packages/effect/src/unstable/rpc/index.ts +65 -0
  1252. package/repos/effect/packages/effect/src/unstable/schema/Model.ts +862 -0
  1253. package/repos/effect/packages/effect/src/unstable/schema/VariantSchema.ts +604 -0
  1254. package/repos/effect/packages/effect/src/unstable/schema/index.ts +15 -0
  1255. package/repos/effect/packages/effect/src/unstable/socket/Socket.ts +911 -0
  1256. package/repos/effect/packages/effect/src/unstable/socket/SocketServer.ts +147 -0
  1257. package/repos/effect/packages/effect/src/unstable/socket/index.ts +15 -0
  1258. package/repos/effect/packages/effect/src/unstable/sql/Migrator.ts +440 -0
  1259. package/repos/effect/packages/effect/src/unstable/sql/SqlClient.ts +342 -0
  1260. package/repos/effect/packages/effect/src/unstable/sql/SqlConnection.ts +83 -0
  1261. package/repos/effect/packages/effect/src/unstable/sql/SqlError.ts +590 -0
  1262. package/repos/effect/packages/effect/src/unstable/sql/SqlModel.ts +359 -0
  1263. package/repos/effect/packages/effect/src/unstable/sql/SqlResolver.ts +380 -0
  1264. package/repos/effect/packages/effect/src/unstable/sql/SqlSchema.ts +172 -0
  1265. package/repos/effect/packages/effect/src/unstable/sql/SqlStream.ts +81 -0
  1266. package/repos/effect/packages/effect/src/unstable/sql/Statement.ts +1500 -0
  1267. package/repos/effect/packages/effect/src/unstable/sql/index.ts +50 -0
  1268. package/repos/effect/packages/effect/src/unstable/workers/Transferable.ts +191 -0
  1269. package/repos/effect/packages/effect/src/unstable/workers/Worker.ts +245 -0
  1270. package/repos/effect/packages/effect/src/unstable/workers/WorkerError.ts +148 -0
  1271. package/repos/effect/packages/effect/src/unstable/workers/WorkerRunner.ts +57 -0
  1272. package/repos/effect/packages/effect/src/unstable/workers/index.ts +25 -0
  1273. package/repos/effect/packages/effect/src/unstable/workflow/Activity.ts +322 -0
  1274. package/repos/effect/packages/effect/src/unstable/workflow/DurableClock.ts +117 -0
  1275. package/repos/effect/packages/effect/src/unstable/workflow/DurableDeferred.ts +653 -0
  1276. package/repos/effect/packages/effect/src/unstable/workflow/DurableQueue.ts +360 -0
  1277. package/repos/effect/packages/effect/src/unstable/workflow/Workflow.ts +898 -0
  1278. package/repos/effect/packages/effect/src/unstable/workflow/WorkflowEngine.ts +759 -0
  1279. package/repos/effect/packages/effect/src/unstable/workflow/WorkflowProxy.ts +212 -0
  1280. package/repos/effect/packages/effect/src/unstable/workflow/WorkflowProxyServer.ts +151 -0
  1281. package/repos/effect/packages/effect/src/unstable/workflow/index.ts +45 -0
  1282. package/repos/effect/packages/effect/src/unstable/workflow/internal/crypto.ts +15 -0
  1283. package/repos/effect/packages/effect/test/Array.test.ts +1579 -0
  1284. package/repos/effect/packages/effect/test/AtomRef.test.ts +27 -0
  1285. package/repos/effect/packages/effect/test/BigDecimal.test.ts +525 -0
  1286. package/repos/effect/packages/effect/test/BigInt.test.ts +57 -0
  1287. package/repos/effect/packages/effect/test/Boolean.test.ts +289 -0
  1288. package/repos/effect/packages/effect/test/Brand.test.ts +160 -0
  1289. package/repos/effect/packages/effect/test/Cache.test.ts +1423 -0
  1290. package/repos/effect/packages/effect/test/Cause.test.ts +834 -0
  1291. package/repos/effect/packages/effect/test/Channel.test.ts +556 -0
  1292. package/repos/effect/packages/effect/test/Chunk.test.ts +874 -0
  1293. package/repos/effect/packages/effect/test/Combiner.test.ts +42 -0
  1294. package/repos/effect/packages/effect/test/Config.test.ts +1416 -0
  1295. package/repos/effect/packages/effect/test/ConfigProvider.test.ts +726 -0
  1296. package/repos/effect/packages/effect/test/Cron.test.ts +401 -0
  1297. package/repos/effect/packages/effect/test/Crypto.test.ts +86 -0
  1298. package/repos/effect/packages/effect/test/Data.test.ts +269 -0
  1299. package/repos/effect/packages/effect/test/DateTime.test.ts +953 -0
  1300. package/repos/effect/packages/effect/test/Deferred.test.ts +165 -0
  1301. package/repos/effect/packages/effect/test/Duration.test.ts +679 -0
  1302. package/repos/effect/packages/effect/test/Effect.test.ts +2658 -0
  1303. package/repos/effect/packages/effect/test/EffectEager.test.ts +678 -0
  1304. package/repos/effect/packages/effect/test/EffectKeepAlive.test.ts +71 -0
  1305. package/repos/effect/packages/effect/test/Equal.test.ts +1278 -0
  1306. package/repos/effect/packages/effect/test/Equivalence.test.ts +170 -0
  1307. package/repos/effect/packages/effect/test/ExecutionPlan.test.ts +117 -0
  1308. package/repos/effect/packages/effect/test/Exit.test.ts +12 -0
  1309. package/repos/effect/packages/effect/test/Fiber.test.ts +9 -0
  1310. package/repos/effect/packages/effect/test/FiberHandle.test.ts +146 -0
  1311. package/repos/effect/packages/effect/test/FiberMap.test.ts +171 -0
  1312. package/repos/effect/packages/effect/test/FiberSet.test.ts +119 -0
  1313. package/repos/effect/packages/effect/test/Formatter.test.ts +247 -0
  1314. package/repos/effect/packages/effect/test/Function.test.ts +333 -0
  1315. package/repos/effect/packages/effect/test/Graph.test.ts +3505 -0
  1316. package/repos/effect/packages/effect/test/HashMap.test.ts +618 -0
  1317. package/repos/effect/packages/effect/test/HashSet.test.ts +298 -0
  1318. package/repos/effect/packages/effect/test/HttpClient.test.ts +131 -0
  1319. package/repos/effect/packages/effect/test/Iterable.test.ts +486 -0
  1320. package/repos/effect/packages/effect/test/JsonPatch.test.ts +948 -0
  1321. package/repos/effect/packages/effect/test/JsonPointer.test.ts +353 -0
  1322. package/repos/effect/packages/effect/test/JsonSchema.test.ts +1253 -0
  1323. package/repos/effect/packages/effect/test/Latch.test.ts +21 -0
  1324. package/repos/effect/packages/effect/test/Layer.test.ts +648 -0
  1325. package/repos/effect/packages/effect/test/LayerMap.test.ts +98 -0
  1326. package/repos/effect/packages/effect/test/LogLevel.test.ts +28 -0
  1327. package/repos/effect/packages/effect/test/Logger.test.ts +154 -0
  1328. package/repos/effect/packages/effect/test/ManagedRuntime.test.ts +58 -0
  1329. package/repos/effect/packages/effect/test/Match.test.ts +27 -0
  1330. package/repos/effect/packages/effect/test/Metric.test.ts +682 -0
  1331. package/repos/effect/packages/effect/test/Migrator.test.ts +69 -0
  1332. package/repos/effect/packages/effect/test/MutableHashMap.test.ts +309 -0
  1333. package/repos/effect/packages/effect/test/MutableHashSet.test.ts +10 -0
  1334. package/repos/effect/packages/effect/test/MutableList.test.ts +58 -0
  1335. package/repos/effect/packages/effect/test/Newtype.test.ts +90 -0
  1336. package/repos/effect/packages/effect/test/Number.test.ts +422 -0
  1337. package/repos/effect/packages/effect/test/Optic.test.ts +452 -0
  1338. package/repos/effect/packages/effect/test/Option.test.ts +564 -0
  1339. package/repos/effect/packages/effect/test/Order.test.ts +163 -0
  1340. package/repos/effect/packages/effect/test/Ordering.test.ts +18 -0
  1341. package/repos/effect/packages/effect/test/PartitionedSemaphore.test.ts +74 -0
  1342. package/repos/effect/packages/effect/test/Pathfinding.test.ts +426 -0
  1343. package/repos/effect/packages/effect/test/Pool.test.ts +422 -0
  1344. package/repos/effect/packages/effect/test/Predicate.test.ts +555 -0
  1345. package/repos/effect/packages/effect/test/PubSub.test.ts +538 -0
  1346. package/repos/effect/packages/effect/test/Queue.test.ts +317 -0
  1347. package/repos/effect/packages/effect/test/Random.test.ts +238 -0
  1348. package/repos/effect/packages/effect/test/RcMap.test.ts +237 -0
  1349. package/repos/effect/packages/effect/test/RcRef.test.ts +97 -0
  1350. package/repos/effect/packages/effect/test/Record.test.ts +395 -0
  1351. package/repos/effect/packages/effect/test/Redacted.test.ts +59 -0
  1352. package/repos/effect/packages/effect/test/Reducer.test.ts +12 -0
  1353. package/repos/effect/packages/effect/test/Ref.test.ts +187 -0
  1354. package/repos/effect/packages/effect/test/Request.test.ts +305 -0
  1355. package/repos/effect/packages/effect/test/Resource.test.ts +59 -0
  1356. package/repos/effect/packages/effect/test/Result.test.ts +517 -0
  1357. package/repos/effect/packages/effect/test/Schedule.test.ts +395 -0
  1358. package/repos/effect/packages/effect/test/Scheduler.test.ts +70 -0
  1359. package/repos/effect/packages/effect/test/Scope.test.ts +19 -0
  1360. package/repos/effect/packages/effect/test/ScopedCache.test.ts +2316 -0
  1361. package/repos/effect/packages/effect/test/ScopedRef.test.ts +80 -0
  1362. package/repos/effect/packages/effect/test/Semaphore.test.ts +469 -0
  1363. package/repos/effect/packages/effect/test/Sink.test.ts +230 -0
  1364. package/repos/effect/packages/effect/test/Stream.test.ts +4712 -0
  1365. package/repos/effect/packages/effect/test/String.test.ts +690 -0
  1366. package/repos/effect/packages/effect/test/Struct.test.ts +216 -0
  1367. package/repos/effect/packages/effect/test/SubscriptionRef.test.ts +90 -0
  1368. package/repos/effect/packages/effect/test/Symbol.test.ts +50 -0
  1369. package/repos/effect/packages/effect/test/SynchronizedRef.test.ts +105 -0
  1370. package/repos/effect/packages/effect/test/TestClock.test.ts +71 -0
  1371. package/repos/effect/packages/effect/test/Tracer.test.ts +410 -0
  1372. package/repos/effect/packages/effect/test/Trie.test.ts +531 -0
  1373. package/repos/effect/packages/effect/test/Tuple.test.ts +127 -0
  1374. package/repos/effect/packages/effect/test/TxChunk.test.ts +342 -0
  1375. package/repos/effect/packages/effect/test/TxDeferred.test.ts +197 -0
  1376. package/repos/effect/packages/effect/test/TxHashMap.test.ts +963 -0
  1377. package/repos/effect/packages/effect/test/TxHashSet.test.ts +442 -0
  1378. package/repos/effect/packages/effect/test/TxPriorityQueue.test.ts +187 -0
  1379. package/repos/effect/packages/effect/test/TxPubSub.test.ts +391 -0
  1380. package/repos/effect/packages/effect/test/TxQueue.test.ts +1260 -0
  1381. package/repos/effect/packages/effect/test/TxReentrantLock.test.ts +413 -0
  1382. package/repos/effect/packages/effect/test/TxSemaphore.test.ts +283 -0
  1383. package/repos/effect/packages/effect/test/TxSubscriptionRef.test.ts +197 -0
  1384. package/repos/effect/packages/effect/test/UndefinedOr.test.ts +65 -0
  1385. package/repos/effect/packages/effect/test/cluster/ClusterWorkflowEngine.test.ts +652 -0
  1386. package/repos/effect/packages/effect/test/cluster/Entity.test.ts +81 -0
  1387. package/repos/effect/packages/effect/test/cluster/K8sHttpClient.test.ts +34 -0
  1388. package/repos/effect/packages/effect/test/cluster/MessageStorage.test.ts +196 -0
  1389. package/repos/effect/packages/effect/test/cluster/Sharding.test.ts +578 -0
  1390. package/repos/effect/packages/effect/test/cluster/TestEntity.ts +132 -0
  1391. package/repos/effect/packages/effect/test/reactivity/AsyncResult.test.ts +41 -0
  1392. package/repos/effect/packages/effect/test/reactivity/Atom.test.ts +2551 -0
  1393. package/repos/effect/packages/effect/test/reactivity/AtomHttpApi.test.ts +86 -0
  1394. package/repos/effect/packages/effect/test/reactivity/AtomRpc.test.ts +70 -0
  1395. package/repos/effect/packages/effect/test/rpc/Rpc.test.ts +73 -0
  1396. package/repos/effect/packages/effect/test/rpc/RpcClient.test.ts +58 -0
  1397. package/repos/effect/packages/effect/test/rpc/RpcSerialization.test.ts +171 -0
  1398. package/repos/effect/packages/effect/test/schema/HMR.test.ts +72 -0
  1399. package/repos/effect/packages/effect/test/schema/Schema.test.ts +9133 -0
  1400. package/repos/effect/packages/effect/test/schema/SchemaAST.test.ts +280 -0
  1401. package/repos/effect/packages/effect/test/schema/SchemaGetter.test.ts +383 -0
  1402. package/repos/effect/packages/effect/test/schema/SchemaIssue.test.ts +9 -0
  1403. package/repos/effect/packages/effect/test/schema/SchemaParser.test.ts +323 -0
  1404. package/repos/effect/packages/effect/test/schema/fixtures/HMR-Class.ts +5 -0
  1405. package/repos/effect/packages/effect/test/schema/fixtures/HMR-sanity-check.ts +3 -0
  1406. package/repos/effect/packages/effect/test/schema/representation/fromASTs.test.ts +820 -0
  1407. package/repos/effect/packages/effect/test/schema/representation/fromJsonSchemaDocument.test.ts +2137 -0
  1408. package/repos/effect/packages/effect/test/schema/representation/toCodeDocument.test.ts +2089 -0
  1409. package/repos/effect/packages/effect/test/schema/representation/toJsonSchemaMultiDocument.test.ts +39 -0
  1410. package/repos/effect/packages/effect/test/schema/representation/toSchema.test.ts +506 -0
  1411. package/repos/effect/packages/effect/test/schema/toArbitrary.test.ts +1693 -0
  1412. package/repos/effect/packages/effect/test/schema/toCodec.test.ts +3149 -0
  1413. package/repos/effect/packages/effect/test/schema/toDifferJsonPatch.test.ts +239 -0
  1414. package/repos/effect/packages/effect/test/schema/toEquivalence.test.ts +519 -0
  1415. package/repos/effect/packages/effect/test/schema/toFormatter.test.ts +565 -0
  1416. package/repos/effect/packages/effect/test/schema/toIso.test.ts +394 -0
  1417. package/repos/effect/packages/effect/test/schema/toJsonSchemaDocument.test.ts +3630 -0
  1418. package/repos/effect/packages/effect/test/schema/toStandardJSONSchemaV1.test.ts +126 -0
  1419. package/repos/effect/packages/effect/test/schema/toStandardSchemaV1.test.ts +495 -0
  1420. package/repos/effect/packages/effect/test/schema/v3-v4.test.ts +250 -0
  1421. package/repos/effect/packages/effect/test/testing/TestSchema.test.ts +78 -0
  1422. package/repos/effect/packages/effect/test/unstable/ai/AiError.test.ts +823 -0
  1423. package/repos/effect/packages/effect/test/unstable/ai/AnthropicStructuredOutput.test.ts +593 -0
  1424. package/repos/effect/packages/effect/test/unstable/ai/Chat.test.ts +147 -0
  1425. package/repos/effect/packages/effect/test/unstable/ai/EmbeddingModel.test.ts +185 -0
  1426. package/repos/effect/packages/effect/test/unstable/ai/LanguageModel.test.ts +1714 -0
  1427. package/repos/effect/packages/effect/test/unstable/ai/LanguageModelTrackerLifecycle.test.ts +413 -0
  1428. package/repos/effect/packages/effect/test/unstable/ai/McpServer.test.ts +82 -0
  1429. package/repos/effect/packages/effect/test/unstable/ai/Model.test.ts +16 -0
  1430. package/repos/effect/packages/effect/test/unstable/ai/OpenAiStructuredOutput.test.ts +723 -0
  1431. package/repos/effect/packages/effect/test/unstable/ai/Prompt.test.ts +346 -0
  1432. package/repos/effect/packages/effect/test/unstable/ai/ResponseIdTracker.test.ts +424 -0
  1433. package/repos/effect/packages/effect/test/unstable/ai/Tool.test.ts +1264 -0
  1434. package/repos/effect/packages/effect/test/unstable/ai/utils.ts +68 -0
  1435. package/repos/effect/packages/effect/test/unstable/cli/Arguments.test.ts +390 -0
  1436. package/repos/effect/packages/effect/test/unstable/cli/Command.test.ts +1801 -0
  1437. package/repos/effect/packages/effect/test/unstable/cli/Errors.test.ts +150 -0
  1438. package/repos/effect/packages/effect/test/unstable/cli/Help.test.ts +572 -0
  1439. package/repos/effect/packages/effect/test/unstable/cli/LogLevel.test.ts +202 -0
  1440. package/repos/effect/packages/effect/test/unstable/cli/Param.test.ts +391 -0
  1441. package/repos/effect/packages/effect/test/unstable/cli/Primitive.test.ts +321 -0
  1442. package/repos/effect/packages/effect/test/unstable/cli/Prompt.test.ts +597 -0
  1443. package/repos/effect/packages/effect/test/unstable/cli/completions/completions.test.ts +656 -0
  1444. package/repos/effect/packages/effect/test/unstable/cli/completions/descriptor.test.ts +245 -0
  1445. package/repos/effect/packages/effect/test/unstable/cli/fixtures/ComprehensiveCli.ts +422 -0
  1446. package/repos/effect/packages/effect/test/unstable/cli/services/MockTerminal.ts +135 -0
  1447. package/repos/effect/packages/effect/test/unstable/cli/services/TestActions.ts +36 -0
  1448. package/repos/effect/packages/effect/test/unstable/encoding/Ndjson.test.ts +18 -0
  1449. package/repos/effect/packages/effect/test/unstable/encoding/Sse.test.ts +62 -0
  1450. package/repos/effect/packages/effect/test/unstable/eventlog/EventJournal.test.ts +25 -0
  1451. package/repos/effect/packages/effect/test/unstable/eventlog/EventLog.test.ts +104 -0
  1452. package/repos/effect/packages/effect/test/unstable/eventlog/EventLogIdentityDerivation.test.ts +85 -0
  1453. package/repos/effect/packages/effect/test/unstable/eventlog/EventLogRemote.test.ts +176 -0
  1454. package/repos/effect/packages/effect/test/unstable/eventlog/EventLogSessionAuth.test.ts +130 -0
  1455. package/repos/effect/packages/effect/test/unstable/eventlog/SqlEventLogServerUnencryptedStorageTest.ts +169 -0
  1456. package/repos/effect/packages/effect/test/unstable/http/Cookies.test.ts +80 -0
  1457. package/repos/effect/packages/effect/test/unstable/http/Headers.test.ts +73 -0
  1458. package/repos/effect/packages/effect/test/unstable/http/HttpClient.test.ts +306 -0
  1459. package/repos/effect/packages/effect/test/unstable/http/HttpClientRequest.test.ts +164 -0
  1460. package/repos/effect/packages/effect/test/unstable/http/HttpEffect.test.ts +254 -0
  1461. package/repos/effect/packages/effect/test/unstable/http/HttpMiddleware.test.ts +57 -0
  1462. package/repos/effect/packages/effect/test/unstable/http/HttpServerError.test.ts +121 -0
  1463. package/repos/effect/packages/effect/test/unstable/http/HttpServerRequest.test.ts +157 -0
  1464. package/repos/effect/packages/effect/test/unstable/http/HttpServerResponse.test.ts +76 -0
  1465. package/repos/effect/packages/effect/test/unstable/http/Multipart.test.ts +69 -0
  1466. package/repos/effect/packages/effect/test/unstable/http/Url.test.ts +98 -0
  1467. package/repos/effect/packages/effect/test/unstable/http/UrlParams.test.ts +30 -0
  1468. package/repos/effect/packages/effect/test/unstable/httpapi/HttpApiBuilder.test.ts +186 -0
  1469. package/repos/effect/packages/effect/test/unstable/httpapi/HttpApiClient.test.ts +446 -0
  1470. package/repos/effect/packages/effect/test/unstable/httpapi/HttpApiEndpoint.test.ts +160 -0
  1471. package/repos/effect/packages/effect/test/unstable/httpapi/HttpApiSchema.test.ts +108 -0
  1472. package/repos/effect/packages/effect/test/unstable/httpapi/HttpApiSecurity.test.ts +41 -0
  1473. package/repos/effect/packages/effect/test/unstable/httpapi/OpenApi.test.ts +39 -0
  1474. package/repos/effect/packages/effect/test/unstable/observability/OtlpConfig.test.ts +151 -0
  1475. package/repos/effect/packages/effect/test/unstable/observability/OtlpExporter.test.ts +108 -0
  1476. package/repos/effect/packages/effect/test/unstable/observability/OtlpMetrics.test.ts +518 -0
  1477. package/repos/effect/packages/effect/test/unstable/observability/OtlpResource.test.ts +84 -0
  1478. package/repos/effect/packages/effect/test/unstable/observability/PrometheusMetrics.test.ts +417 -0
  1479. package/repos/effect/packages/effect/test/unstable/persistence/KeyValueStore.test.ts +164 -0
  1480. package/repos/effect/packages/effect/test/unstable/persistence/KeyValueStoreTest.ts +85 -0
  1481. package/repos/effect/packages/effect/test/unstable/persistence/PersistedCache.test.ts +4 -0
  1482. package/repos/effect/packages/effect/test/unstable/persistence/PersistedCacheTest.ts +111 -0
  1483. package/repos/effect/packages/effect/test/unstable/persistence/PersistedQueue.test.ts +4 -0
  1484. package/repos/effect/packages/effect/test/unstable/persistence/PersistedQueueTest.ts +106 -0
  1485. package/repos/effect/packages/effect/test/unstable/persistence/RateLimiter.test.ts +145 -0
  1486. package/repos/effect/packages/effect/test/unstable/persistence/Redis.test.ts +43 -0
  1487. package/repos/effect/packages/effect/test/unstable/process/ChildProcess.test.ts +352 -0
  1488. package/repos/effect/packages/effect/test/unstable/schema/VariantSchema.test.ts +72 -0
  1489. package/repos/effect/packages/effect/test/unstable/sql/SqlError.test.ts +228 -0
  1490. package/repos/effect/packages/effect/test/unstable/sql/SqlSchema.test.ts +168 -0
  1491. package/repos/effect/packages/effect/test/unstable/workers/WorkerError.test.ts +90 -0
  1492. package/repos/effect/packages/effect/test/unstable/workflow/DurableQueue.test.ts +105 -0
  1493. package/repos/effect/packages/effect/test/unstable/workflow/WorkflowEngine.test.ts +60 -0
  1494. package/repos/effect/packages/effect/test/utils/assert.ts +182 -0
  1495. package/repos/effect/packages/effect/test/utils/chunkCoordination.ts +36 -0
  1496. package/repos/effect/packages/effect/test/utils/counter.ts +54 -0
  1497. package/repos/effect/packages/effect/tsconfig.json +8 -0
  1498. package/repos/effect/packages/effect/typetest/AiError.tst.ts +49 -0
  1499. package/repos/effect/packages/effect/typetest/Array.tst.ts +1289 -0
  1500. package/repos/effect/packages/effect/typetest/Brand.tst.ts +51 -0
  1501. package/repos/effect/packages/effect/typetest/Channel.tst.ts +112 -0
  1502. package/repos/effect/packages/effect/typetest/Config.tst.ts +31 -0
  1503. package/repos/effect/packages/effect/typetest/Data.tst.ts +121 -0
  1504. package/repos/effect/packages/effect/typetest/Effect.tst.ts +976 -0
  1505. package/repos/effect/packages/effect/typetest/Equivalence.tst.ts +19 -0
  1506. package/repos/effect/packages/effect/typetest/Newtype.tst.ts +72 -0
  1507. package/repos/effect/packages/effect/typetest/Optic.tst.ts +130 -0
  1508. package/repos/effect/packages/effect/typetest/Option.tst.ts +72 -0
  1509. package/repos/effect/packages/effect/typetest/Order.tst.ts +19 -0
  1510. package/repos/effect/packages/effect/typetest/Predicate.tst.ts +251 -0
  1511. package/repos/effect/packages/effect/typetest/Result.tst.ts +353 -0
  1512. package/repos/effect/packages/effect/typetest/Schedule.tst.ts +21 -0
  1513. package/repos/effect/packages/effect/typetest/Stream.tst.ts +197 -0
  1514. package/repos/effect/packages/effect/typetest/Struct.tst.ts +422 -0
  1515. package/repos/effect/packages/effect/typetest/Tuple.tst.ts +177 -0
  1516. package/repos/effect/packages/effect/typetest/Types.tst.ts +364 -0
  1517. package/repos/effect/packages/effect/typetest/VariantSchema.tst.ts +76 -0
  1518. package/repos/effect/packages/effect/typetest/schema/Array.tst.ts +46 -0
  1519. package/repos/effect/packages/effect/typetest/schema/Literals.tst.ts +58 -0
  1520. package/repos/effect/packages/effect/typetest/schema/Record.tst.ts +145 -0
  1521. package/repos/effect/packages/effect/typetest/schema/Schema.tst.ts +1854 -0
  1522. package/repos/effect/packages/effect/typetest/schema/Struct.tst.ts +745 -0
  1523. package/repos/effect/packages/effect/typetest/schema/Tuple.tst.ts +199 -0
  1524. package/repos/effect/packages/effect/typetest/schema/Union.tst.ts +198 -0
  1525. package/repos/effect/packages/effect/typetest/schema/api.tst.ts +276 -0
  1526. package/repos/effect/packages/effect/typetest/schema/toArbitrary.tst.ts +65 -0
  1527. package/repos/effect/packages/effect/typetest/schema/toIso.tst.ts +282 -0
  1528. package/repos/effect/packages/effect/typetest/unstable/ai/LanguageModel.tst.ts +191 -0
  1529. package/repos/effect/packages/effect/typetest/unstable/ai/Tool.tst.ts +33 -0
  1530. package/repos/effect/packages/effect/typetest/unstable/cli/Command.tst.ts +124 -0
  1531. package/repos/effect/packages/effect/typetest/unstable/cli/Param.tst.ts +20 -0
  1532. package/repos/effect/packages/effect/typetest/unstable/cli/Prompt.tst.ts +97 -0
  1533. package/repos/effect/packages/effect/typetest/unstable/encoding/Ndjson.tst.ts +24 -0
  1534. package/repos/effect/packages/effect/typetest/unstable/http/HttpClient.tst.ts +143 -0
  1535. package/repos/effect/packages/effect/typetest/unstable/httpapi/HttpApiBuilder.tst.ts +98 -0
  1536. package/repos/effect/packages/effect/typetest/unstable/httpapi/HttpApiClient.tst.ts +677 -0
  1537. package/repos/effect/packages/effect/typetest/unstable/httpapi/HttpApiEndpoint.tst.ts +466 -0
  1538. package/repos/effect/packages/effect/typetest/unstable/httpapi/HttpApiMiddleware.tst.ts +90 -0
  1539. package/repos/effect/packages/effect/typetest/unstable/httpapi/HttpApiSchema.tst.ts +135 -0
  1540. package/repos/effect/packages/effect/typetest/unstable/reactivity/AsyncResult.tst.ts +65 -0
  1541. package/repos/effect/packages/effect/typetest/unstable/reactivity/AtomHttpApi.tst.ts +63 -0
  1542. package/repos/effect/packages/effect/typetest/unstable/rpc/Rpc.tst.ts +74 -0
  1543. package/repos/effect/packages/effect/typetest/unstable/rpc/RpcGroup.tst.ts +61 -0
  1544. package/repos/effect/packages/effect/typetest/unstable/rpc/RpcMiddleware.tst.ts +41 -0
  1545. package/repos/effect/packages/effect/typetest/unstable/rpc/RpcServer.tst.ts +26 -0
  1546. package/repos/effect/packages/effect/typetest/unstable/sql/SqlSchema.tst.ts +75 -0
  1547. package/repos/effect/packages/effect/typetest/unstable/workflow/Workflow.tst.ts +16 -0
  1548. package/repos/effect/packages/effect/vitest.config.ts +11 -0
  1549. package/repos/effect/packages/opentelemetry/CHANGELOG.md +620 -0
  1550. package/repos/effect/packages/opentelemetry/LICENSE +21 -0
  1551. package/repos/effect/packages/opentelemetry/README.md +5 -0
  1552. package/repos/effect/packages/opentelemetry/docgen.json +30 -0
  1553. package/repos/effect/packages/opentelemetry/package.json +126 -0
  1554. package/repos/effect/packages/opentelemetry/src/Logger.ts +193 -0
  1555. package/repos/effect/packages/opentelemetry/src/Metrics.ts +138 -0
  1556. package/repos/effect/packages/opentelemetry/src/NodeSdk.ts +162 -0
  1557. package/repos/effect/packages/opentelemetry/src/Resource.ts +147 -0
  1558. package/repos/effect/packages/opentelemetry/src/Tracer.ts +594 -0
  1559. package/repos/effect/packages/opentelemetry/src/WebSdk.ts +140 -0
  1560. package/repos/effect/packages/opentelemetry/src/index.ts +35 -0
  1561. package/repos/effect/packages/opentelemetry/src/internal/attributes.ts +28 -0
  1562. package/repos/effect/packages/opentelemetry/src/internal/metrics.ts +463 -0
  1563. package/repos/effect/packages/opentelemetry/src/internal/utilities.ts +5 -0
  1564. package/repos/effect/packages/opentelemetry/test/Logger.test.ts +122 -0
  1565. package/repos/effect/packages/opentelemetry/test/Metrics.test.ts +339 -0
  1566. package/repos/effect/packages/opentelemetry/test/Tracer.test.ts +167 -0
  1567. package/repos/effect/packages/opentelemetry/tsconfig.json +8 -0
  1568. package/repos/effect/packages/opentelemetry/vitest.config.ts +6 -0
  1569. package/repos/effect/packages/platform-browser/CHANGELOG.md +637 -0
  1570. package/repos/effect/packages/platform-browser/LICENSE +21 -0
  1571. package/repos/effect/packages/platform-browser/README.md +1 -0
  1572. package/repos/effect/packages/platform-browser/docgen.json +21 -0
  1573. package/repos/effect/packages/platform-browser/package.json +74 -0
  1574. package/repos/effect/packages/platform-browser/src/BrowserCrypto.ts +97 -0
  1575. package/repos/effect/packages/platform-browser/src/BrowserHttpClient.ts +430 -0
  1576. package/repos/effect/packages/platform-browser/src/BrowserKeyValueStore.ts +177 -0
  1577. package/repos/effect/packages/platform-browser/src/BrowserPersistence.ts +334 -0
  1578. package/repos/effect/packages/platform-browser/src/BrowserRuntime.ts +53 -0
  1579. package/repos/effect/packages/platform-browser/src/BrowserSocket.ts +52 -0
  1580. package/repos/effect/packages/platform-browser/src/BrowserStream.ts +56 -0
  1581. package/repos/effect/packages/platform-browser/src/BrowserWorker.ts +98 -0
  1582. package/repos/effect/packages/platform-browser/src/BrowserWorkerRunner.ts +199 -0
  1583. package/repos/effect/packages/platform-browser/src/Clipboard.ts +143 -0
  1584. package/repos/effect/packages/platform-browser/src/Geolocation.ts +233 -0
  1585. package/repos/effect/packages/platform-browser/src/IndexedDb.ts +113 -0
  1586. package/repos/effect/packages/platform-browser/src/IndexedDbDatabase.ts +648 -0
  1587. package/repos/effect/packages/platform-browser/src/IndexedDbQueryBuilder.ts +2032 -0
  1588. package/repos/effect/packages/platform-browser/src/IndexedDbTable.ts +260 -0
  1589. package/repos/effect/packages/platform-browser/src/IndexedDbVersion.ts +138 -0
  1590. package/repos/effect/packages/platform-browser/src/Permissions.ts +146 -0
  1591. package/repos/effect/packages/platform-browser/src/index.ts +90 -0
  1592. package/repos/effect/packages/platform-browser/test/BrowserCrypto.test.ts +74 -0
  1593. package/repos/effect/packages/platform-browser/test/BrowserHttpClient.test.ts +91 -0
  1594. package/repos/effect/packages/platform-browser/test/BrowserKeyValueStore.test.ts +23 -0
  1595. package/repos/effect/packages/platform-browser/test/BrowserPersistence.test.ts +209 -0
  1596. package/repos/effect/packages/platform-browser/test/BrowserPersistencePersistedCache.test.ts +29 -0
  1597. package/repos/effect/packages/platform-browser/test/IndexedDbDatabase.test.ts +253 -0
  1598. package/repos/effect/packages/platform-browser/test/IndexedDbQueryBuilder.test.ts +1459 -0
  1599. package/repos/effect/packages/platform-browser/test/IndexedDbTable.test.ts +101 -0
  1600. package/repos/effect/packages/platform-browser/test/IndexedDbVersion.test.ts +50 -0
  1601. package/repos/effect/packages/platform-browser/test/Permissions.test.ts +12 -0
  1602. package/repos/effect/packages/platform-browser/test/RpcWorker.test.ts +19 -0
  1603. package/repos/effect/packages/platform-browser/test/fixtures/rpc-e2e.ts +141 -0
  1604. package/repos/effect/packages/platform-browser/test/fixtures/rpc-schemas.ts +157 -0
  1605. package/repos/effect/packages/platform-browser/test/fixtures/rpc-worker.ts +12 -0
  1606. package/repos/effect/packages/platform-browser/tsconfig.json +8 -0
  1607. package/repos/effect/packages/platform-browser/vitest.config.ts +17 -0
  1608. package/repos/effect/packages/platform-browser/vitest.setup.ts +5 -0
  1609. package/repos/effect/packages/platform-bun/CHANGELOG.md +691 -0
  1610. package/repos/effect/packages/platform-bun/LICENSE +21 -0
  1611. package/repos/effect/packages/platform-bun/README.md +7 -0
  1612. package/repos/effect/packages/platform-bun/docgen.json +20 -0
  1613. package/repos/effect/packages/platform-bun/package.json +73 -0
  1614. package/repos/effect/packages/platform-bun/src/BunChildProcessSpawner.ts +6 -0
  1615. package/repos/effect/packages/platform-bun/src/BunClusterHttp.ts +174 -0
  1616. package/repos/effect/packages/platform-bun/src/BunClusterSocket.ts +153 -0
  1617. package/repos/effect/packages/platform-bun/src/BunCrypto.ts +24 -0
  1618. package/repos/effect/packages/platform-bun/src/BunFileSystem.ts +20 -0
  1619. package/repos/effect/packages/platform-bun/src/BunHttpClient.ts +9 -0
  1620. package/repos/effect/packages/platform-bun/src/BunHttpPlatform.ts +50 -0
  1621. package/repos/effect/packages/platform-bun/src/BunHttpServer.ts +600 -0
  1622. package/repos/effect/packages/platform-bun/src/BunHttpServerRequest.ts +19 -0
  1623. package/repos/effect/packages/platform-bun/src/BunMultipart.ts +54 -0
  1624. package/repos/effect/packages/platform-bun/src/BunPath.ts +37 -0
  1625. package/repos/effect/packages/platform-bun/src/BunRedis.ts +88 -0
  1626. package/repos/effect/packages/platform-bun/src/BunRuntime.ts +52 -0
  1627. package/repos/effect/packages/platform-bun/src/BunServices.ts +49 -0
  1628. package/repos/effect/packages/platform-bun/src/BunSink.ts +8 -0
  1629. package/repos/effect/packages/platform-bun/src/BunSocket.ts +54 -0
  1630. package/repos/effect/packages/platform-bun/src/BunSocketServer.ts +8 -0
  1631. package/repos/effect/packages/platform-bun/src/BunStdio.ts +22 -0
  1632. package/repos/effect/packages/platform-bun/src/BunStream.ts +68 -0
  1633. package/repos/effect/packages/platform-bun/src/BunTerminal.ts +32 -0
  1634. package/repos/effect/packages/platform-bun/src/BunWorker.ts +92 -0
  1635. package/repos/effect/packages/platform-bun/src/BunWorkerRunner.ts +113 -0
  1636. package/repos/effect/packages/platform-bun/src/index.ts +115 -0
  1637. package/repos/effect/packages/platform-bun/tsconfig.json +12 -0
  1638. package/repos/effect/packages/platform-node/CHANGELOG.md +695 -0
  1639. package/repos/effect/packages/platform-node/LICENSE +21 -0
  1640. package/repos/effect/packages/platform-node/README.md +7 -0
  1641. package/repos/effect/packages/platform-node/docgen.json +24 -0
  1642. package/repos/effect/packages/platform-node/package.json +82 -0
  1643. package/repos/effect/packages/platform-node/src/Mime.ts +25 -0
  1644. package/repos/effect/packages/platform-node/src/NodeChildProcessSpawner.ts +6 -0
  1645. package/repos/effect/packages/platform-node/src/NodeClusterHttp.ts +155 -0
  1646. package/repos/effect/packages/platform-node/src/NodeClusterSocket.ts +176 -0
  1647. package/repos/effect/packages/platform-node/src/NodeCrypto.ts +24 -0
  1648. package/repos/effect/packages/platform-node/src/NodeFileSystem.ts +21 -0
  1649. package/repos/effect/packages/platform-node/src/NodeHttpClient.ts +664 -0
  1650. package/repos/effect/packages/platform-node/src/NodeHttpIncomingMessage.ts +141 -0
  1651. package/repos/effect/packages/platform-node/src/NodeHttpPlatform.ts +70 -0
  1652. package/repos/effect/packages/platform-node/src/NodeHttpServer.ts +646 -0
  1653. package/repos/effect/packages/platform-node/src/NodeHttpServerRequest.ts +33 -0
  1654. package/repos/effect/packages/platform-node/src/NodeMultipart.ts +183 -0
  1655. package/repos/effect/packages/platform-node/src/NodePath.ts +40 -0
  1656. package/repos/effect/packages/platform-node/src/NodeRedis.ts +92 -0
  1657. package/repos/effect/packages/platform-node/src/NodeRuntime.ts +53 -0
  1658. package/repos/effect/packages/platform-node/src/NodeServices.ts +50 -0
  1659. package/repos/effect/packages/platform-node/src/NodeSink.ts +8 -0
  1660. package/repos/effect/packages/platform-node/src/NodeSocket.ts +72 -0
  1661. package/repos/effect/packages/platform-node/src/NodeSocketServer.ts +8 -0
  1662. package/repos/effect/packages/platform-node/src/NodeStdio.ts +22 -0
  1663. package/repos/effect/packages/platform-node/src/NodeStream.ts +8 -0
  1664. package/repos/effect/packages/platform-node/src/NodeTerminal.ts +32 -0
  1665. package/repos/effect/packages/platform-node/src/NodeWorker.ts +121 -0
  1666. package/repos/effect/packages/platform-node/src/NodeWorkerRunner.ts +110 -0
  1667. package/repos/effect/packages/platform-node/src/Undici.ts +29 -0
  1668. package/repos/effect/packages/platform-node/src/index.ts +130 -0
  1669. package/repos/effect/packages/platform-node/test/HttpApi.test.ts +1831 -0
  1670. package/repos/effect/packages/platform-node/test/HttpStaticServer.test.ts +253 -0
  1671. package/repos/effect/packages/platform-node/test/HttpStaticServerConditional.test.ts +296 -0
  1672. package/repos/effect/packages/platform-node/test/NodeCrypto.test.ts +59 -0
  1673. package/repos/effect/packages/platform-node/test/NodeHttpClient.test.ts +157 -0
  1674. package/repos/effect/packages/platform-node/test/NodeHttpPlatform.test.ts +51 -0
  1675. package/repos/effect/packages/platform-node/test/NodeHttpServer.test.ts +598 -0
  1676. package/repos/effect/packages/platform-node/test/NodeRedis.test.ts +31 -0
  1677. package/repos/effect/packages/platform-node/test/NodeSocket.test.ts +153 -0
  1678. package/repos/effect/packages/platform-node/test/OpenApi.test.ts +1573 -0
  1679. package/repos/effect/packages/platform-node/test/RpcServer.test.ts +213 -0
  1680. package/repos/effect/packages/platform-node/test/__snapshots__/HttpApi.test.ts.snap +715 -0
  1681. package/repos/effect/packages/platform-node/test/cluster/MessageStorageTest.ts +196 -0
  1682. package/repos/effect/packages/platform-node/test/cluster/SocketRunner.test.ts +120 -0
  1683. package/repos/effect/packages/platform-node/test/cluster/SqlMessageStorage.test.ts +222 -0
  1684. package/repos/effect/packages/platform-node/test/cluster/SqlRunnerStorage.test.ts +101 -0
  1685. package/repos/effect/packages/platform-node/test/fixtures/http-static-server/conditional.txt +1 -0
  1686. package/repos/effect/packages/platform-node/test/fixtures/http-static-server/custom/home.html +1 -0
  1687. package/repos/effect/packages/platform-node/test/fixtures/http-static-server/file.binx +1 -0
  1688. package/repos/effect/packages/platform-node/test/fixtures/http-static-server/guide/index.html +1 -0
  1689. package/repos/effect/packages/platform-node/test/fixtures/http-static-server/hello.txt +1 -0
  1690. package/repos/effect/packages/platform-node/test/fixtures/http-static-server/index.html +1 -0
  1691. package/repos/effect/packages/platform-node/test/fixtures/http-static-server/range.txt +1 -0
  1692. package/repos/effect/packages/platform-node/test/fixtures/http-static-server-outside.txt +1 -0
  1693. package/repos/effect/packages/platform-node/test/fixtures/mysql2-utils.ts +64 -0
  1694. package/repos/effect/packages/platform-node/test/fixtures/pg-utils.ts +39 -0
  1695. package/repos/effect/packages/platform-node/test/fixtures/rpc-e2e.ts +149 -0
  1696. package/repos/effect/packages/platform-node/test/fixtures/rpc-schemas.ts +175 -0
  1697. package/repos/effect/packages/platform-node/test/fixtures/text.txt +1 -0
  1698. package/repos/effect/packages/platform-node/tsconfig.json +12 -0
  1699. package/repos/effect/packages/platform-node/vitest.config.ts +6 -0
  1700. package/repos/effect/packages/platform-node-shared/CHANGELOG.md +617 -0
  1701. package/repos/effect/packages/platform-node-shared/LICENSE +21 -0
  1702. package/repos/effect/packages/platform-node-shared/README.md +7 -0
  1703. package/repos/effect/packages/platform-node-shared/docgen.json +38 -0
  1704. package/repos/effect/packages/platform-node-shared/package.json +76 -0
  1705. package/repos/effect/packages/platform-node-shared/src/NodeChildProcessSpawner.ts +713 -0
  1706. package/repos/effect/packages/platform-node-shared/src/NodeClusterSocket.ts +70 -0
  1707. package/repos/effect/packages/platform-node-shared/src/NodeCrypto.ts +60 -0
  1708. package/repos/effect/packages/platform-node-shared/src/NodeFileSystem.ts +652 -0
  1709. package/repos/effect/packages/platform-node-shared/src/NodePath.ts +80 -0
  1710. package/repos/effect/packages/platform-node-shared/src/NodeRuntime.ts +59 -0
  1711. package/repos/effect/packages/platform-node-shared/src/NodeSink.ts +116 -0
  1712. package/repos/effect/packages/platform-node-shared/src/NodeSocket.ts +269 -0
  1713. package/repos/effect/packages/platform-node-shared/src/NodeSocketServer.ts +301 -0
  1714. package/repos/effect/packages/platform-node-shared/src/NodeStdio.ts +67 -0
  1715. package/repos/effect/packages/platform-node-shared/src/NodeStream.ts +445 -0
  1716. package/repos/effect/packages/platform-node-shared/src/NodeTerminal.ts +129 -0
  1717. package/repos/effect/packages/platform-node-shared/src/index.ts +65 -0
  1718. package/repos/effect/packages/platform-node-shared/src/internal/utils.ts +51 -0
  1719. package/repos/effect/packages/platform-node-shared/test/NodeChildProcessSpawner.test.ts +1069 -0
  1720. package/repos/effect/packages/platform-node-shared/test/NodeFileSystem.test.ts +214 -0
  1721. package/repos/effect/packages/platform-node-shared/test/NodeSink.test.ts +153 -0
  1722. package/repos/effect/packages/platform-node-shared/test/NodeStream.test.ts +173 -0
  1723. package/repos/effect/packages/platform-node-shared/test/fixtures/bash/no-permissions.sh +3 -0
  1724. package/repos/effect/packages/platform-node-shared/test/fixtures/bash/parent-exits-early.sh +31 -0
  1725. package/repos/effect/packages/platform-node-shared/test/fixtures/bash/spawn-children.sh +32 -0
  1726. package/repos/effect/packages/platform-node-shared/test/fixtures/config/SHOUTING +1 -0
  1727. package/repos/effect/packages/platform-node-shared/test/fixtures/config/integer +1 -0
  1728. package/repos/effect/packages/platform-node-shared/test/fixtures/config/nested/config +1 -0
  1729. package/repos/effect/packages/platform-node-shared/test/fixtures/config/secret +1 -0
  1730. package/repos/effect/packages/platform-node-shared/test/fixtures/helloworld.tar.gz +0 -0
  1731. package/repos/effect/packages/platform-node-shared/test/fixtures/text.txt +1 -0
  1732. package/repos/effect/packages/platform-node-shared/tsconfig.json +11 -0
  1733. package/repos/effect/packages/platform-node-shared/vitest.config.ts +6 -0
  1734. package/repos/effect/packages/sql/clickhouse/CHANGELOG.md +681 -0
  1735. package/repos/effect/packages/sql/clickhouse/LICENSE +21 -0
  1736. package/repos/effect/packages/sql/clickhouse/README.md +7 -0
  1737. package/repos/effect/packages/sql/clickhouse/docgen.json +24 -0
  1738. package/repos/effect/packages/sql/clickhouse/package.json +72 -0
  1739. package/repos/effect/packages/sql/clickhouse/src/ClickhouseClient.ts +546 -0
  1740. package/repos/effect/packages/sql/clickhouse/src/ClickhouseMigrator.ts +51 -0
  1741. package/repos/effect/packages/sql/clickhouse/src/index.ts +15 -0
  1742. package/repos/effect/packages/sql/clickhouse/test/Client.test.ts +6 -0
  1743. package/repos/effect/packages/sql/clickhouse/test/SqlErrorClassification.test.ts +75 -0
  1744. package/repos/effect/packages/sql/clickhouse/tsconfig.json +12 -0
  1745. package/repos/effect/packages/sql/clickhouse/vitest.config.ts +6 -0
  1746. package/repos/effect/packages/sql/d1/CHANGELOG.md +597 -0
  1747. package/repos/effect/packages/sql/d1/LICENSE +21 -0
  1748. package/repos/effect/packages/sql/d1/README.md +7 -0
  1749. package/repos/effect/packages/sql/d1/docgen.json +24 -0
  1750. package/repos/effect/packages/sql/d1/package.json +75 -0
  1751. package/repos/effect/packages/sql/d1/src/D1Client.ts +249 -0
  1752. package/repos/effect/packages/sql/d1/src/index.ts +10 -0
  1753. package/repos/effect/packages/sql/d1/test/Client.test.ts +65 -0
  1754. package/repos/effect/packages/sql/d1/test/Resolver.test.ts +176 -0
  1755. package/repos/effect/packages/sql/d1/test/utils.ts +38 -0
  1756. package/repos/effect/packages/sql/d1/tsconfig.json +8 -0
  1757. package/repos/effect/packages/sql/d1/vitest.config.ts +6 -0
  1758. package/repos/effect/packages/sql/libsql/CHANGELOG.md +601 -0
  1759. package/repos/effect/packages/sql/libsql/LICENSE +21 -0
  1760. package/repos/effect/packages/sql/libsql/README.md +7 -0
  1761. package/repos/effect/packages/sql/libsql/docgen.json +24 -0
  1762. package/repos/effect/packages/sql/libsql/package.json +73 -0
  1763. package/repos/effect/packages/sql/libsql/src/LibsqlClient.ts +381 -0
  1764. package/repos/effect/packages/sql/libsql/src/LibsqlMigrator.ts +46 -0
  1765. package/repos/effect/packages/sql/libsql/src/index.ts +15 -0
  1766. package/repos/effect/packages/sql/libsql/test/Client.test.ts +106 -0
  1767. package/repos/effect/packages/sql/libsql/test/Resolver.test.ts +177 -0
  1768. package/repos/effect/packages/sql/libsql/test/util.ts +54 -0
  1769. package/repos/effect/packages/sql/libsql/tsconfig.json +9 -0
  1770. package/repos/effect/packages/sql/libsql/vitest.config.ts +6 -0
  1771. package/repos/effect/packages/sql/mssql/CHANGELOG.md +601 -0
  1772. package/repos/effect/packages/sql/mssql/LICENSE +21 -0
  1773. package/repos/effect/packages/sql/mssql/README.md +7 -0
  1774. package/repos/effect/packages/sql/mssql/docgen.json +24 -0
  1775. package/repos/effect/packages/sql/mssql/package.json +70 -0
  1776. package/repos/effect/packages/sql/mssql/src/MssqlClient.ts +732 -0
  1777. package/repos/effect/packages/sql/mssql/src/MssqlMigrator.ts +45 -0
  1778. package/repos/effect/packages/sql/mssql/src/Parameter.ts +64 -0
  1779. package/repos/effect/packages/sql/mssql/src/Procedure.ts +213 -0
  1780. package/repos/effect/packages/sql/mssql/src/index.ts +32 -0
  1781. package/repos/effect/packages/sql/mssql/test/Client.test.ts +91 -0
  1782. package/repos/effect/packages/sql/mssql/test/SqlErrorClassification.test.ts +206 -0
  1783. package/repos/effect/packages/sql/mssql/tsconfig.json +8 -0
  1784. package/repos/effect/packages/sql/mssql/vitest.config.ts +6 -0
  1785. package/repos/effect/packages/sql/mysql2/CHANGELOG.md +603 -0
  1786. package/repos/effect/packages/sql/mysql2/LICENSE +21 -0
  1787. package/repos/effect/packages/sql/mysql2/README.md +7 -0
  1788. package/repos/effect/packages/sql/mysql2/docgen.json +24 -0
  1789. package/repos/effect/packages/sql/mysql2/package.json +71 -0
  1790. package/repos/effect/packages/sql/mysql2/src/MysqlClient.ts +517 -0
  1791. package/repos/effect/packages/sql/mysql2/src/MysqlMigrator.ts +102 -0
  1792. package/repos/effect/packages/sql/mysql2/src/index.ts +15 -0
  1793. package/repos/effect/packages/sql/mysql2/test/Client.test.ts +34 -0
  1794. package/repos/effect/packages/sql/mysql2/test/KeyValueStore.test.ts +16 -0
  1795. package/repos/effect/packages/sql/mysql2/test/Model.test.ts +227 -0
  1796. package/repos/effect/packages/sql/mysql2/test/MysqlClient.test.ts +35 -0
  1797. package/repos/effect/packages/sql/mysql2/test/Persistence.test.ts +22 -0
  1798. package/repos/effect/packages/sql/mysql2/test/SqlErrorClassification.test.ts +133 -0
  1799. package/repos/effect/packages/sql/mysql2/test/SqlEventLogServerUnencrypted.test.ts +7 -0
  1800. package/repos/effect/packages/sql/mysql2/test/utils.ts +64 -0
  1801. package/repos/effect/packages/sql/mysql2/tsconfig.json +9 -0
  1802. package/repos/effect/packages/sql/mysql2/vitest.config.ts +6 -0
  1803. package/repos/effect/packages/sql/pg/CHANGELOG.md +3432 -0
  1804. package/repos/effect/packages/sql/pg/LICENSE +21 -0
  1805. package/repos/effect/packages/sql/pg/README.md +7 -0
  1806. package/repos/effect/packages/sql/pg/docgen.json +24 -0
  1807. package/repos/effect/packages/sql/pg/package.json +77 -0
  1808. package/repos/effect/packages/sql/pg/src/PgClient.ts +947 -0
  1809. package/repos/effect/packages/sql/pg/src/PgMigrator.ts +120 -0
  1810. package/repos/effect/packages/sql/pg/src/index.ts +15 -0
  1811. package/repos/effect/packages/sql/pg/test/Client.test.ts +373 -0
  1812. package/repos/effect/packages/sql/pg/test/KeyValueStore.test.ts +16 -0
  1813. package/repos/effect/packages/sql/pg/test/Persistence.test.ts +20 -0
  1814. package/repos/effect/packages/sql/pg/test/SqlErrorClassification.test.ts +81 -0
  1815. package/repos/effect/packages/sql/pg/test/SqlEventLogServerUnencrypted.test.ts +7 -0
  1816. package/repos/effect/packages/sql/pg/test/TransactionAcquire.test.ts +52 -0
  1817. package/repos/effect/packages/sql/pg/test/utils.ts +49 -0
  1818. package/repos/effect/packages/sql/pg/tsconfig.json +9 -0
  1819. package/repos/effect/packages/sql/pg/vitest.config.ts +6 -0
  1820. package/repos/effect/packages/sql/pglite/CHANGELOG.md +198 -0
  1821. package/repos/effect/packages/sql/pglite/LICENSE +21 -0
  1822. package/repos/effect/packages/sql/pglite/README.md +7 -0
  1823. package/repos/effect/packages/sql/pglite/docgen.json +24 -0
  1824. package/repos/effect/packages/sql/pglite/package.json +74 -0
  1825. package/repos/effect/packages/sql/pglite/src/PgliteClient.ts +503 -0
  1826. package/repos/effect/packages/sql/pglite/src/PgliteMigrator.ts +44 -0
  1827. package/repos/effect/packages/sql/pglite/src/index.ts +15 -0
  1828. package/repos/effect/packages/sql/pglite/test/Client.test.ts +149 -0
  1829. package/repos/effect/packages/sql/pglite/test/Migrator.test.ts +45 -0
  1830. package/repos/effect/packages/sql/pglite/test/SqlErrorClassification.test.ts +56 -0
  1831. package/repos/effect/packages/sql/pglite/test/Transaction.test.ts +62 -0
  1832. package/repos/effect/packages/sql/pglite/tsconfig.json +8 -0
  1833. package/repos/effect/packages/sql/pglite/vitest.config.ts +6 -0
  1834. package/repos/effect/packages/sql/sqlite-bun/CHANGELOG.md +601 -0
  1835. package/repos/effect/packages/sql/sqlite-bun/LICENSE +21 -0
  1836. package/repos/effect/packages/sql/sqlite-bun/README.md +7 -0
  1837. package/repos/effect/packages/sql/sqlite-bun/docgen.json +24 -0
  1838. package/repos/effect/packages/sql/sqlite-bun/package.json +69 -0
  1839. package/repos/effect/packages/sql/sqlite-bun/src/SqliteClient.ts +262 -0
  1840. package/repos/effect/packages/sql/sqlite-bun/src/SqliteMigrator.ts +90 -0
  1841. package/repos/effect/packages/sql/sqlite-bun/src/index.ts +15 -0
  1842. package/repos/effect/packages/sql/sqlite-bun/test/Client.test.ts +6 -0
  1843. package/repos/effect/packages/sql/sqlite-bun/tsconfig.json +11 -0
  1844. package/repos/effect/packages/sql/sqlite-bun/vitest.config.ts +6 -0
  1845. package/repos/effect/packages/sql/sqlite-do/CHANGELOG.md +601 -0
  1846. package/repos/effect/packages/sql/sqlite-do/LICENSE +21 -0
  1847. package/repos/effect/packages/sql/sqlite-do/README.md +7 -0
  1848. package/repos/effect/packages/sql/sqlite-do/docgen.json +24 -0
  1849. package/repos/effect/packages/sql/sqlite-do/package.json +68 -0
  1850. package/repos/effect/packages/sql/sqlite-do/src/SqliteClient.ts +249 -0
  1851. package/repos/effect/packages/sql/sqlite-do/src/SqliteMigrator.ts +45 -0
  1852. package/repos/effect/packages/sql/sqlite-do/src/index.ts +15 -0
  1853. package/repos/effect/packages/sql/sqlite-do/test/Client.test.ts +24 -0
  1854. package/repos/effect/packages/sql/sqlite-do/tsconfig.json +8 -0
  1855. package/repos/effect/packages/sql/sqlite-do/vitest.config.ts +6 -0
  1856. package/repos/effect/packages/sql/sqlite-node/CHANGELOG.md +3415 -0
  1857. package/repos/effect/packages/sql/sqlite-node/LICENSE +21 -0
  1858. package/repos/effect/packages/sql/sqlite-node/README.md +7 -0
  1859. package/repos/effect/packages/sql/sqlite-node/docgen.json +24 -0
  1860. package/repos/effect/packages/sql/sqlite-node/package.json +72 -0
  1861. package/repos/effect/packages/sql/sqlite-node/src/SqliteClient.ts +312 -0
  1862. package/repos/effect/packages/sql/sqlite-node/src/SqliteMigrator.ts +90 -0
  1863. package/repos/effect/packages/sql/sqlite-node/src/index.ts +15 -0
  1864. package/repos/effect/packages/sql/sqlite-node/test/Client.test.ts +75 -0
  1865. package/repos/effect/packages/sql/sqlite-node/test/KeyValueStore.test.ts +29 -0
  1866. package/repos/effect/packages/sql/sqlite-node/test/Persistence.test.ts +109 -0
  1867. package/repos/effect/packages/sql/sqlite-node/test/Resolver.test.ts +183 -0
  1868. package/repos/effect/packages/sql/sqlite-node/test/SqlEventJournal.test.ts +84 -0
  1869. package/repos/effect/packages/sql/sqlite-node/test/SqlEventLogServerEncrypted.test.ts +249 -0
  1870. package/repos/effect/packages/sql/sqlite-node/test/SqlEventLogServerUnencrypted.test.ts +110 -0
  1871. package/repos/effect/packages/sql/sqlite-node/test/SqliteMigrator.test.ts +48 -0
  1872. package/repos/effect/packages/sql/sqlite-node/tsconfig.json +8 -0
  1873. package/repos/effect/packages/sql/sqlite-node/vitest.config.ts +6 -0
  1874. package/repos/effect/packages/sql/sqlite-react-native/CHANGELOG.md +601 -0
  1875. package/repos/effect/packages/sql/sqlite-react-native/LICENSE +21 -0
  1876. package/repos/effect/packages/sql/sqlite-react-native/README.md +7 -0
  1877. package/repos/effect/packages/sql/sqlite-react-native/docgen.json +24 -0
  1878. package/repos/effect/packages/sql/sqlite-react-native/package.json +69 -0
  1879. package/repos/effect/packages/sql/sqlite-react-native/src/SqliteClient.ts +354 -0
  1880. package/repos/effect/packages/sql/sqlite-react-native/src/SqliteMigrator.ts +55 -0
  1881. package/repos/effect/packages/sql/sqlite-react-native/src/index.ts +15 -0
  1882. package/repos/effect/packages/sql/sqlite-react-native/test/Client.test.ts +6 -0
  1883. package/repos/effect/packages/sql/sqlite-react-native/tsconfig.json +8 -0
  1884. package/repos/effect/packages/sql/sqlite-react-native/vitest.config.ts +6 -0
  1885. package/repos/effect/packages/sql/sqlite-wasm/CHANGELOG.md +601 -0
  1886. package/repos/effect/packages/sql/sqlite-wasm/LICENSE +21 -0
  1887. package/repos/effect/packages/sql/sqlite-wasm/README.md +7 -0
  1888. package/repos/effect/packages/sql/sqlite-wasm/docgen.json +24 -0
  1889. package/repos/effect/packages/sql/sqlite-wasm/package.json +69 -0
  1890. package/repos/effect/packages/sql/sqlite-wasm/src/OpfsWorker.ts +118 -0
  1891. package/repos/effect/packages/sql/sqlite-wasm/src/SqliteClient.ts +551 -0
  1892. package/repos/effect/packages/sql/sqlite-wasm/src/SqliteMigrator.ts +55 -0
  1893. package/repos/effect/packages/sql/sqlite-wasm/src/index.ts +14 -0
  1894. package/repos/effect/packages/sql/sqlite-wasm/src/internal/opfsWorker.ts +7 -0
  1895. package/repos/effect/packages/sql/sqlite-wasm/src/sqlite-wasm.d.ts +47 -0
  1896. package/repos/effect/packages/sql/sqlite-wasm/test/Client.test.ts +6 -0
  1897. package/repos/effect/packages/sql/sqlite-wasm/tsconfig.json +8 -0
  1898. package/repos/effect/packages/sql/sqlite-wasm/vitest.config.ts +6 -0
  1899. package/repos/effect/packages/tools/ai-codegen/codegen.schema.json +92 -0
  1900. package/repos/effect/packages/tools/ai-codegen/docgen.json +4 -0
  1901. package/repos/effect/packages/tools/ai-codegen/package.json +61 -0
  1902. package/repos/effect/packages/tools/ai-codegen/src/Config.ts +292 -0
  1903. package/repos/effect/packages/tools/ai-codegen/src/Discovery.ts +197 -0
  1904. package/repos/effect/packages/tools/ai-codegen/src/Generator.ts +183 -0
  1905. package/repos/effect/packages/tools/ai-codegen/src/Glob.ts +56 -0
  1906. package/repos/effect/packages/tools/ai-codegen/src/PostProcess.ts +157 -0
  1907. package/repos/effect/packages/tools/ai-codegen/src/SpecFetcher.ts +154 -0
  1908. package/repos/effect/packages/tools/ai-codegen/src/bin.ts +10 -0
  1909. package/repos/effect/packages/tools/ai-codegen/src/main.ts +237 -0
  1910. package/repos/effect/packages/tools/ai-codegen/tsconfig.json +15 -0
  1911. package/repos/effect/packages/tools/ai-docgen/docgen.json +4 -0
  1912. package/repos/effect/packages/tools/ai-docgen/package.json +60 -0
  1913. package/repos/effect/packages/tools/ai-docgen/src/Glob.ts +48 -0
  1914. package/repos/effect/packages/tools/ai-docgen/src/main.ts +186 -0
  1915. package/repos/effect/packages/tools/ai-docgen/tsconfig.json +14 -0
  1916. package/repos/effect/packages/tools/bundle/docgen.json +4 -0
  1917. package/repos/effect/packages/tools/bundle/fixtures/basic.ts +3 -0
  1918. package/repos/effect/packages/tools/bundle/fixtures/batching.ts +25 -0
  1919. package/repos/effect/packages/tools/bundle/fixtures/brand.ts +5 -0
  1920. package/repos/effect/packages/tools/bundle/fixtures/cache.ts +10 -0
  1921. package/repos/effect/packages/tools/bundle/fixtures/config.ts +13 -0
  1922. package/repos/effect/packages/tools/bundle/fixtures/differ.ts +9 -0
  1923. package/repos/effect/packages/tools/bundle/fixtures/http-client.ts +12 -0
  1924. package/repos/effect/packages/tools/bundle/fixtures/logger.ts +5 -0
  1925. package/repos/effect/packages/tools/bundle/fixtures/metric.ts +13 -0
  1926. package/repos/effect/packages/tools/bundle/fixtures/optic.ts +6 -0
  1927. package/repos/effect/packages/tools/bundle/fixtures/pubsub.ts +22 -0
  1928. package/repos/effect/packages/tools/bundle/fixtures/queue.ts +18 -0
  1929. package/repos/effect/packages/tools/bundle/fixtures/schedule.ts +9 -0
  1930. package/repos/effect/packages/tools/bundle/fixtures/schema-fromJsonSchemaDocument.ts +16 -0
  1931. package/repos/effect/packages/tools/bundle/fixtures/schema-representation-roundtrip.ts +16 -0
  1932. package/repos/effect/packages/tools/bundle/fixtures/schema-string-transformation.ts +20 -0
  1933. package/repos/effect/packages/tools/bundle/fixtures/schema-string.ts +8 -0
  1934. package/repos/effect/packages/tools/bundle/fixtures/schema-template-literal.ts +8 -0
  1935. package/repos/effect/packages/tools/bundle/fixtures/schema-toArbitraryLazy.ts +9 -0
  1936. package/repos/effect/packages/tools/bundle/fixtures/schema-toCodeDocument.ts +12 -0
  1937. package/repos/effect/packages/tools/bundle/fixtures/schema-toCodecJson.ts +9 -0
  1938. package/repos/effect/packages/tools/bundle/fixtures/schema-toEquivalence.ts +9 -0
  1939. package/repos/effect/packages/tools/bundle/fixtures/schema-toFormatter.ts +9 -0
  1940. package/repos/effect/packages/tools/bundle/fixtures/schema-toJsonSchemaDocument.ts +9 -0
  1941. package/repos/effect/packages/tools/bundle/fixtures/schema-toRepresentation.ts +9 -0
  1942. package/repos/effect/packages/tools/bundle/fixtures/schema.ts +12 -0
  1943. package/repos/effect/packages/tools/bundle/fixtures/stm.ts +21 -0
  1944. package/repos/effect/packages/tools/bundle/fixtures/stream.ts +7 -0
  1945. package/repos/effect/packages/tools/bundle/package.json +52 -0
  1946. package/repos/effect/packages/tools/bundle/src/Cli.ts +104 -0
  1947. package/repos/effect/packages/tools/bundle/src/Fixtures.ts +51 -0
  1948. package/repos/effect/packages/tools/bundle/src/Plugins.ts +131 -0
  1949. package/repos/effect/packages/tools/bundle/src/Reporter.ts +200 -0
  1950. package/repos/effect/packages/tools/bundle/src/Rollup.ts +179 -0
  1951. package/repos/effect/packages/tools/bundle/src/bin.ts +23 -0
  1952. package/repos/effect/packages/tools/bundle/tsconfig.fixtures.json +13 -0
  1953. package/repos/effect/packages/tools/bundle/tsconfig.json +9 -0
  1954. package/repos/effect/packages/tools/bundle/tsconfig.src.json +13 -0
  1955. package/repos/effect/packages/tools/jsdocs/docgen.json +4 -0
  1956. package/repos/effect/packages/tools/jsdocs/package.json +64 -0
  1957. package/repos/effect/packages/tools/jsdocs/src/Jsdocs.ts +3303 -0
  1958. package/repos/effect/packages/tools/jsdocs/src/bin.ts +23 -0
  1959. package/repos/effect/packages/tools/jsdocs/test/jsdocs.test.ts +979 -0
  1960. package/repos/effect/packages/tools/jsdocs/tsconfig.json +8 -0
  1961. package/repos/effect/packages/tools/jsdocs/vitest.config.ts +6 -0
  1962. package/repos/effect/packages/tools/openapi-generator/CHANGELOG.md +691 -0
  1963. package/repos/effect/packages/tools/openapi-generator/LICENSE +21 -0
  1964. package/repos/effect/packages/tools/openapi-generator/docgen.json +4 -0
  1965. package/repos/effect/packages/tools/openapi-generator/package.json +78 -0
  1966. package/repos/effect/packages/tools/openapi-generator/src/HttpApiTransformer.ts +552 -0
  1967. package/repos/effect/packages/tools/openapi-generator/src/JsonSchemaGenerator.ts +319 -0
  1968. package/repos/effect/packages/tools/openapi-generator/src/OpenApiGenerator.ts +1201 -0
  1969. package/repos/effect/packages/tools/openapi-generator/src/OpenApiPatch.ts +539 -0
  1970. package/repos/effect/packages/tools/openapi-generator/src/OpenApiTransformer.ts +1019 -0
  1971. package/repos/effect/packages/tools/openapi-generator/src/ParsedOperation.ts +277 -0
  1972. package/repos/effect/packages/tools/openapi-generator/src/Utils.ts +111 -0
  1973. package/repos/effect/packages/tools/openapi-generator/src/bin.ts +10 -0
  1974. package/repos/effect/packages/tools/openapi-generator/src/main.ts +116 -0
  1975. package/repos/effect/packages/tools/openapi-generator/test/JsonSchemaGenerator.test.ts +173 -0
  1976. package/repos/effect/packages/tools/openapi-generator/test/OpenApiGenerator.test.ts +2130 -0
  1977. package/repos/effect/packages/tools/openapi-generator/test/OpenApiGeneratorCli.test.ts +147 -0
  1978. package/repos/effect/packages/tools/openapi-generator/test/OpenApiPatch.test.ts +380 -0
  1979. package/repos/effect/packages/tools/openapi-generator/test/Utils.test.ts +33 -0
  1980. package/repos/effect/packages/tools/openapi-generator/test/fixtures/cli-basic-spec.json +35 -0
  1981. package/repos/effect/packages/tools/openapi-generator/test/fixtures/cli-warning-spec.json +57 -0
  1982. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/invalid-op.json +7 -0
  1983. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/missing-path.json +6 -0
  1984. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/missing-value.json +6 -0
  1985. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/valid-add.json +8 -0
  1986. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/valid-multiple.json +17 -0
  1987. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/valid-patch.yaml +6 -0
  1988. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/valid-remove.json +6 -0
  1989. package/repos/effect/packages/tools/openapi-generator/test/fixtures/patches/valid-replace.json +7 -0
  1990. package/repos/effect/packages/tools/openapi-generator/tsconfig.json +9 -0
  1991. package/repos/effect/packages/tools/openapi-generator/vitest.config.ts +6 -0
  1992. package/repos/effect/packages/tools/oxc/docgen.json +4 -0
  1993. package/repos/effect/packages/tools/oxc/oxlintrc.json +83 -0
  1994. package/repos/effect/packages/tools/oxc/package.json +72 -0
  1995. package/repos/effect/packages/tools/oxc/src/oxlint/index.ts +18 -0
  1996. package/repos/effect/packages/tools/oxc/src/oxlint/rules/jsdocs.ts +108 -0
  1997. package/repos/effect/packages/tools/oxc/src/oxlint/rules/no-bigint-literals.ts +25 -0
  1998. package/repos/effect/packages/tools/oxc/src/oxlint/rules/no-import-from-barrel-package.ts +144 -0
  1999. package/repos/effect/packages/tools/oxc/src/oxlint/rules/no-js-extension-imports.ts +73 -0
  2000. package/repos/effect/packages/tools/oxc/src/oxlint/rules/no-opaque-instance-fields.ts +92 -0
  2001. package/repos/effect/packages/tools/oxc/test/jsdocs.test.ts +75 -0
  2002. package/repos/effect/packages/tools/oxc/test/no-import-from-barrel-package.test.ts +182 -0
  2003. package/repos/effect/packages/tools/oxc/test/no-js-extension-imports.test.ts +120 -0
  2004. package/repos/effect/packages/tools/oxc/test/no-opaque-instance-fields.test.ts +276 -0
  2005. package/repos/effect/packages/tools/oxc/test/utils.ts +61 -0
  2006. package/repos/effect/packages/tools/oxc/tsconfig.json +8 -0
  2007. package/repos/effect/packages/tools/oxc/vitest.config.ts +6 -0
  2008. package/repos/effect/packages/tools/utils/docgen.json +4 -0
  2009. package/repos/effect/packages/tools/utils/package.json +59 -0
  2010. package/repos/effect/packages/tools/utils/src/Codegen.ts +214 -0
  2011. package/repos/effect/packages/tools/utils/src/Glob.ts +61 -0
  2012. package/repos/effect/packages/tools/utils/src/bin.ts +16 -0
  2013. package/repos/effect/packages/tools/utils/src/commands/codegen.ts +44 -0
  2014. package/repos/effect/packages/tools/utils/tsconfig.json +9 -0
  2015. package/repos/effect/packages/vitest/CHANGELOG.md +601 -0
  2016. package/repos/effect/packages/vitest/LICENSE +21 -0
  2017. package/repos/effect/packages/vitest/README.md +320 -0
  2018. package/repos/effect/packages/vitest/docgen.json +24 -0
  2019. package/repos/effect/packages/vitest/package.json +60 -0
  2020. package/repos/effect/packages/vitest/src/index.ts +259 -0
  2021. package/repos/effect/packages/vitest/src/internal/internal.ts +374 -0
  2022. package/repos/effect/packages/vitest/src/utils.ts +321 -0
  2023. package/repos/effect/packages/vitest/test/index.test.ts +222 -0
  2024. package/repos/effect/packages/vitest/test/isolation.test.ts +105 -0
  2025. package/repos/effect/packages/vitest/test/nested-isolation.test.ts +212 -0
  2026. package/repos/effect/packages/vitest/tsconfig.json +11 -0
  2027. package/repos/effect/packages/vitest/typetest/index.tst.ts +56 -0
  2028. package/repos/effect/packages/vitest/vitest.config.ts +6 -0
  2029. package/repos/effect/patches/@changesets__assemble-release-plan.patch +26 -0
  2030. package/repos/effect/patches/@changesets__get-github-info.patch +44 -0
  2031. package/repos/effect/pnpm-lock.yaml +13483 -0
  2032. package/repos/effect/pnpm-workspace.yaml +10 -0
  2033. package/repos/effect/scripts/bundle-compare.sh +42 -0
  2034. package/repos/effect/scripts/check-cookbook-schedule.ts +390 -0
  2035. package/repos/effect/scripts/circular.mjs +26 -0
  2036. package/repos/effect/scripts/clean.mjs +19 -0
  2037. package/repos/effect/scripts/codemod.mjs +22 -0
  2038. package/repos/effect/scripts/codemods/jsdoc.ts +79 -0
  2039. package/repos/effect/scripts/docs.mjs +64 -0
  2040. package/repos/effect/scripts/package-scalar.mjs +14 -0
  2041. package/repos/effect/scripts/package-swagger.mjs +23 -0
  2042. package/repos/effect/scripts/package.json +22 -0
  2043. package/repos/effect/scripts/tsconfig.json +18 -0
  2044. package/repos/effect/scripts/version.mjs +9 -0
  2045. package/repos/effect/scripts/version.template.txt +2 -0
  2046. package/repos/effect/scripts/worktree-setup.sh +27 -0
  2047. package/repos/effect/stats.txt +30 -0
  2048. package/repos/effect/tsconfig.base.json +46 -0
  2049. package/repos/effect/tsconfig.json +128 -0
  2050. package/repos/effect/tsconfig.packages.json +39 -0
  2051. package/repos/effect/tstyche.json +7 -0
  2052. package/repos/effect/vitest.config.ts +31 -0
  2053. package/repos/effect/vitest.setup.ts +4 -0
  2054. package/repos/effect/vitest.shared.ts +61 -0
  2055. package/repos/effect.subtree.json +16 -0
@@ -0,0 +1,3944 @@
1
+ /**
2
+ * Plain data structures for describing schemas in a serializable form. A
3
+ * `Representation` is not the original `Schema` object; it is a JSON-friendly
4
+ * description of the schema's types, fields, unions, checks, annotations, and
5
+ * references.
6
+ *
7
+ * This module defines the representation node types, document types, and
8
+ * codecs used to validate those documents. It can build representation
9
+ * documents from schema ASTs, turn representation documents back into schemas,
10
+ * convert them to and from JSON Schema documents, and generate TypeScript code
11
+ * artifacts for schema definitions.
12
+ *
13
+ * @since 4.0.0
14
+ */
15
+ import * as Arr from "./Array.ts"
16
+ import { format, formatPropertyKey } from "./Formatter.ts"
17
+ import { collectBrands } from "./internal/schema/annotations.ts"
18
+ import * as InternalRepresentation from "./internal/schema/representation.ts"
19
+ import { unescapeToken } from "./JsonPointer.ts"
20
+ import type * as JsonSchema from "./JsonSchema.ts"
21
+ import * as Option from "./Option.ts"
22
+ import * as Predicate from "./Predicate.ts"
23
+ import * as Rec from "./Record.ts"
24
+ import * as Schema from "./Schema.ts"
25
+ import * as SchemaAST from "./SchemaAST.ts"
26
+ import * as SchemaGetter from "./SchemaGetter.ts"
27
+
28
+ // -----------------------------------------------------------------------------
29
+ // specification
30
+ // -----------------------------------------------------------------------------
31
+
32
+ /**
33
+ * A custom type declaration, such as `Date`, `Option`, or `ReadonlySet`.
34
+ *
35
+ * **When to use**
36
+ *
37
+ * Use when inspecting or transforming non-primitive schema types.
38
+ *
39
+ * **Details**
40
+ *
41
+ * `typeParameters` holds the inner type arguments, such as the `A` in
42
+ * `Option<A>`. `encodedSchema` is the fallback representation when no
43
+ * {@link Reviver} recognizes this declaration. `annotations.typeConstructor`
44
+ * identifies the declaration kind, such as `{ _tag: "effect/Option" }`.
45
+ *
46
+ * @see {@link Reviver}
47
+ * @see {@link toSchemaDefaultReviver}
48
+ *
49
+ * @category models
50
+ * @since 4.0.0
51
+ */
52
+ export interface Declaration {
53
+ readonly _tag: "Declaration"
54
+ readonly annotations?: Schema.Annotations.Annotations | undefined
55
+ readonly typeParameters: ReadonlyArray<Representation>
56
+ readonly checks: ReadonlyArray<Check<DeclarationMeta>>
57
+ readonly encodedSchema: Representation
58
+ }
59
+
60
+ /**
61
+ * A lazily resolved representation used for recursive schemas.
62
+ *
63
+ * **Details**
64
+ *
65
+ * `thunk` points to the actual representation, possibly via a
66
+ * {@link Reference}. `checks` is always empty on `Suspend` nodes.
67
+ *
68
+ * @see {@link Reference}
69
+ *
70
+ * @category models
71
+ * @since 4.0.0
72
+ */
73
+ export interface Suspend {
74
+ readonly _tag: "Suspend"
75
+ readonly annotations?: Schema.Annotations.Annotations | undefined
76
+ readonly checks: readonly []
77
+ readonly thunk: Representation
78
+ }
79
+
80
+ /**
81
+ * A named reference to a definition in the {@link References} map.
82
+ *
83
+ * **When to use**
84
+ *
85
+ * Use when a representation should point to a named definition instead of
86
+ * embedding the definition inline.
87
+ *
88
+ * **Details**
89
+ *
90
+ * `$ref` is the key into `Document.references` or `MultiDocument.references`.
91
+ * References are resolved lazily by {@link toSchema} and
92
+ * {@link toCodeDocument}.
93
+ *
94
+ * **Gotchas**
95
+ *
96
+ * Resolution throws at runtime if the key is not found in the references map.
97
+ *
98
+ * @see {@link References}
99
+ * @see {@link Document}
100
+ *
101
+ * @category models
102
+ * @since 4.0.0
103
+ */
104
+ export interface Reference {
105
+ readonly _tag: "Reference"
106
+ readonly $ref: string
107
+ }
108
+
109
+ /**
110
+ * The `null` type.
111
+ *
112
+ * @category models
113
+ * @since 4.0.0
114
+ */
115
+ export interface Null {
116
+ readonly _tag: "Null"
117
+ readonly annotations?: Schema.Annotations.Annotations | undefined
118
+ }
119
+
120
+ /**
121
+ * The `undefined` type.
122
+ *
123
+ * @category models
124
+ * @since 4.0.0
125
+ */
126
+ export interface Undefined {
127
+ readonly _tag: "Undefined"
128
+ readonly annotations?: Schema.Annotations.Annotations | undefined
129
+ }
130
+
131
+ /**
132
+ * The `void` type.
133
+ *
134
+ * @category models
135
+ * @since 4.0.0
136
+ */
137
+ export interface Void {
138
+ readonly _tag: "Void"
139
+ readonly annotations?: Schema.Annotations.Annotations | undefined
140
+ }
141
+
142
+ /**
143
+ * The `never` type (no valid values).
144
+ *
145
+ * @category models
146
+ * @since 4.0.0
147
+ */
148
+ export interface Never {
149
+ readonly _tag: "Never"
150
+ readonly annotations?: Schema.Annotations.Annotations | undefined
151
+ }
152
+
153
+ /**
154
+ * The `unknown` type (any value accepted).
155
+ *
156
+ * @category models
157
+ * @since 4.0.0
158
+ */
159
+ export interface Unknown {
160
+ readonly _tag: "Unknown"
161
+ readonly annotations?: Schema.Annotations.Annotations | undefined
162
+ }
163
+
164
+ /**
165
+ * The `any` type.
166
+ *
167
+ * @category models
168
+ * @since 4.0.0
169
+ */
170
+ export interface Any {
171
+ readonly _tag: "Any"
172
+ readonly annotations?: Schema.Annotations.Annotations | undefined
173
+ }
174
+
175
+ /**
176
+ * The `string` type with optional validation checks.
177
+ *
178
+ * **Details**
179
+ *
180
+ * `checks` holds string-specific constraints, such as min/max length, pattern,
181
+ * and UUID checks. `contentMediaType` and `contentSchema` indicate that the
182
+ * string contains encoded data, such as `"application/json"` with a nested
183
+ * schema.
184
+ *
185
+ * @see {@link StringMeta}
186
+ * @see {@link Check}
187
+ *
188
+ * @category models
189
+ * @since 4.0.0
190
+ */
191
+ export interface String {
192
+ readonly _tag: "String"
193
+ readonly annotations?: Schema.Annotations.Annotations | undefined
194
+ readonly checks: ReadonlyArray<Check<StringMeta>>
195
+ readonly contentMediaType?: string | undefined
196
+ readonly contentSchema?: Representation | undefined
197
+ }
198
+
199
+ /**
200
+ * The `number` type with optional validation checks.
201
+ *
202
+ * **Details**
203
+ *
204
+ * `checks` holds number-specific constraints, such as int, finite, min, max,
205
+ * multipleOf, and between checks.
206
+ *
207
+ * @see {@link NumberMeta}
208
+ *
209
+ * @category models
210
+ * @since 4.0.0
211
+ */
212
+ export interface Number {
213
+ readonly _tag: "Number"
214
+ readonly annotations?: Schema.Annotations.Annotations | undefined
215
+ readonly checks: ReadonlyArray<Check<NumberMeta>>
216
+ }
217
+
218
+ /**
219
+ * The `boolean` type.
220
+ *
221
+ * @category models
222
+ * @since 4.0.0
223
+ */
224
+ export interface Boolean {
225
+ readonly _tag: "Boolean"
226
+ readonly annotations?: Schema.Annotations.Annotations | undefined
227
+ }
228
+
229
+ /**
230
+ * The `bigint` type with optional validation checks.
231
+ *
232
+ * @see {@link BigIntMeta}
233
+ *
234
+ * @category models
235
+ * @since 4.0.0
236
+ */
237
+ export interface BigInt {
238
+ readonly _tag: "BigInt"
239
+ readonly annotations?: Schema.Annotations.Annotations | undefined
240
+ readonly checks: ReadonlyArray<Check<BigIntMeta>>
241
+ }
242
+
243
+ /**
244
+ * The `symbol` type.
245
+ *
246
+ * @category models
247
+ * @since 4.0.0
248
+ */
249
+ export interface Symbol {
250
+ readonly _tag: "Symbol"
251
+ readonly annotations?: Schema.Annotations.Annotations | undefined
252
+ }
253
+
254
+ /**
255
+ * A specific literal value (`string`, `number`, `boolean`, or `bigint`).
256
+ *
257
+ * @category models
258
+ * @since 4.0.0
259
+ */
260
+ export interface Literal {
261
+ readonly _tag: "Literal"
262
+ readonly annotations?: Schema.Annotations.Annotations | undefined
263
+ readonly literal: string | number | boolean | bigint
264
+ }
265
+
266
+ /**
267
+ * A specific unique `symbol` value.
268
+ *
269
+ * @category models
270
+ * @since 4.0.0
271
+ */
272
+ export interface UniqueSymbol {
273
+ readonly _tag: "UniqueSymbol"
274
+ readonly annotations?: Schema.Annotations.Annotations | undefined
275
+ readonly symbol: symbol
276
+ }
277
+
278
+ /**
279
+ * The `object` keyword type (matches any non-primitive).
280
+ *
281
+ * @category models
282
+ * @since 4.0.0
283
+ */
284
+ export interface ObjectKeyword {
285
+ readonly _tag: "ObjectKeyword"
286
+ readonly annotations?: Schema.Annotations.Annotations | undefined
287
+ }
288
+
289
+ /**
290
+ * A TypeScript-style enum. Each entry is a `[name, value]` pair.
291
+ *
292
+ * @category models
293
+ * @since 4.0.0
294
+ */
295
+ export interface Enum {
296
+ readonly _tag: "Enum"
297
+ readonly annotations?: Schema.Annotations.Annotations | undefined
298
+ readonly enums: ReadonlyArray<readonly [string, string | number]>
299
+ }
300
+
301
+ /**
302
+ * A template literal type composed of a sequence of parts (literals, strings,
303
+ * numbers, etc.).
304
+ *
305
+ * @category models
306
+ * @since 4.0.0
307
+ */
308
+ export interface TemplateLiteral {
309
+ readonly _tag: "TemplateLiteral"
310
+ readonly annotations?: Schema.Annotations.Annotations | undefined
311
+ readonly parts: ReadonlyArray<Representation>
312
+ }
313
+
314
+ /**
315
+ * An array or tuple type.
316
+ *
317
+ * **Details**
318
+ *
319
+ * `elements` are the fixed positional elements, or tuple prefix, and each may
320
+ * be optional. `rest` contains the variadic tail types; a single-element
321
+ * `rest` with no `elements` produces a plain `Array<T>`. `checks` holds
322
+ * array-specific constraints, such as minLength, maxLength, and unique checks.
323
+ *
324
+ * @see {@link Element}
325
+ * @see {@link ArraysMeta}
326
+ *
327
+ * @category models
328
+ * @since 4.0.0
329
+ */
330
+ export interface Arrays {
331
+ readonly _tag: "Arrays"
332
+ readonly annotations?: Schema.Annotations.Annotations | undefined
333
+ readonly elements: ReadonlyArray<Element>
334
+ readonly rest: ReadonlyArray<Representation>
335
+ readonly checks: ReadonlyArray<Check<ArraysMeta>>
336
+ }
337
+
338
+ /**
339
+ * A positional element within an {@link Arrays} tuple.
340
+ *
341
+ * **Details**
342
+ *
343
+ * `isOptional` indicates whether this element can be absent. `type` is the
344
+ * schema representation for this element's value.
345
+ *
346
+ * @see {@link Arrays}
347
+ *
348
+ * @category models
349
+ * @since 4.0.0
350
+ */
351
+ export interface Element {
352
+ readonly isOptional: boolean
353
+ readonly type: Representation
354
+ readonly annotations?: Schema.Annotations.Annotations | undefined
355
+ }
356
+
357
+ /**
358
+ * An object/struct type with named properties and optional index signatures.
359
+ *
360
+ * **Details**
361
+ *
362
+ * `propertySignatures` are the explicitly named fields. `indexSignatures`
363
+ * define catch-all key/value types, such as `Record<string, T>`. `checks`
364
+ * holds object-specific constraints, such as minProperties and maxProperties.
365
+ *
366
+ * @see {@link PropertySignature}
367
+ * @see {@link IndexSignature}
368
+ * @see {@link ObjectsMeta}
369
+ *
370
+ * @category models
371
+ * @since 4.0.0
372
+ */
373
+ export interface Objects {
374
+ readonly _tag: "Objects"
375
+ readonly annotations?: Schema.Annotations.Annotations | undefined
376
+ readonly propertySignatures: ReadonlyArray<PropertySignature>
377
+ readonly indexSignatures: ReadonlyArray<IndexSignature>
378
+ readonly checks: ReadonlyArray<Check<ObjectsMeta>>
379
+ }
380
+
381
+ /**
382
+ * A named property within an {@link Objects} representation.
383
+ *
384
+ * **Details**
385
+ *
386
+ * `name` is the property key, which can be a string, number, or symbol.
387
+ * `isOptional` indicates whether the key can be absent. `isMutable` indicates
388
+ * whether the property is mutable rather than readonly.
389
+ *
390
+ * @see {@link Objects}
391
+ *
392
+ * @category models
393
+ * @since 4.0.0
394
+ */
395
+ export interface PropertySignature {
396
+ readonly name: PropertyKey
397
+ readonly type: Representation
398
+ readonly isOptional: boolean
399
+ readonly isMutable: boolean
400
+ readonly annotations?: Schema.Annotations.Annotations | undefined
401
+ }
402
+
403
+ /**
404
+ * An index signature, such as `[key: string]: number`, within an
405
+ * {@link Objects}.
406
+ *
407
+ * **Details**
408
+ *
409
+ * `parameter` is the key type representation. `type` is the value type
410
+ * representation.
411
+ *
412
+ * @see {@link Objects}
413
+ *
414
+ * @category models
415
+ * @since 4.0.0
416
+ */
417
+ export interface IndexSignature {
418
+ readonly parameter: Representation
419
+ readonly type: Representation
420
+ }
421
+
422
+ /**
423
+ * A union of multiple representations.
424
+ *
425
+ * **Details**
426
+ *
427
+ * `types` are the union members. `mode` controls JSON Schema output as either
428
+ * `"anyOf"` (the default) or mutually exclusive `"oneOf"`.
429
+ *
430
+ * @category models
431
+ * @since 4.0.0
432
+ */
433
+ export interface Union {
434
+ readonly _tag: "Union"
435
+ readonly annotations?: Schema.Annotations.Annotations | undefined
436
+ readonly types: ReadonlyArray<Representation>
437
+ readonly mode: "anyOf" | "oneOf"
438
+ }
439
+
440
+ /**
441
+ * The core tagged union of all supported schema shapes.
442
+ *
443
+ * **Details**
444
+ *
445
+ * Each variant has a `_tag` discriminator. Switch on `_tag` to handle each
446
+ * shape. Most variants carry optional `annotations` and some carry `checks`
447
+ * for validation constraints.
448
+ *
449
+ * @see {@link Document}
450
+ * @see {@link fromAST}
451
+ *
452
+ * @category models
453
+ * @since 4.0.0
454
+ */
455
+ export type Representation =
456
+ | Declaration
457
+ | Reference
458
+ | Suspend
459
+ | Null
460
+ | Undefined
461
+ | Void
462
+ | Never
463
+ | Unknown
464
+ | Any
465
+ | String
466
+ | Number
467
+ | Boolean
468
+ | BigInt
469
+ | Symbol
470
+ | Literal
471
+ | UniqueSymbol
472
+ | ObjectKeyword
473
+ | Enum
474
+ | TemplateLiteral
475
+ | Arrays
476
+ | Objects
477
+ | Union
478
+
479
+ /**
480
+ * A validation constraint attached to a type. Either a single {@link Filter}
481
+ * or a {@link FilterGroup} combining multiple checks.
482
+ *
483
+ * @see {@link Filter}
484
+ * @see {@link FilterGroup}
485
+ *
486
+ * @category models
487
+ * @since 4.0.0
488
+ */
489
+ export type Check<M> = Filter<M> | FilterGroup<M>
490
+
491
+ /**
492
+ * A single validation constraint with typed metadata describing the check
493
+ * (e.g. `{ _tag: "isMinLength", minLength: 3 }`).
494
+ *
495
+ * @see {@link Check}
496
+ *
497
+ * @category models
498
+ * @since 4.0.0
499
+ */
500
+ export interface Filter<M> {
501
+ readonly _tag: "Filter"
502
+ readonly annotations?: Schema.Annotations.Filter | undefined
503
+ readonly meta: M
504
+ }
505
+
506
+ /**
507
+ * A group of validation constraints that are logically combined. Contains
508
+ * at least one {@link Check}.
509
+ *
510
+ * @see {@link Check}
511
+ *
512
+ * @category models
513
+ * @since 4.0.0
514
+ */
515
+ export interface FilterGroup<M> {
516
+ readonly _tag: "FilterGroup"
517
+ readonly annotations?: Schema.Annotations.Filter | undefined
518
+ readonly checks: readonly [Check<M>, ...Array<Check<M>>]
519
+ }
520
+
521
+ /**
522
+ * Metadata union for string-specific validation checks (minLength, maxLength,
523
+ * pattern, UUID, trimmed, etc.).
524
+ *
525
+ * @see {@link String}
526
+ * @see {@link Check}
527
+ *
528
+ * @category models
529
+ * @since 4.0.0
530
+ */
531
+ export type StringMeta = Schema.Annotations.BuiltInMetaDefinitions[
532
+ | "isStringFinite"
533
+ | "isStringBigInt"
534
+ | "isStringSymbol"
535
+ | "isMinLength"
536
+ | "isMaxLength"
537
+ | "isPattern"
538
+ | "isLengthBetween"
539
+ | "isTrimmed"
540
+ | "isUUID"
541
+ | "isGUID"
542
+ | "isULID"
543
+ | "isBase64"
544
+ | "isBase64Url"
545
+ | "isStartsWith"
546
+ | "isEndsWith"
547
+ | "isIncludes"
548
+ | "isUppercased"
549
+ | "isLowercased"
550
+ | "isCapitalized"
551
+ | "isUncapitalized"
552
+ ]
553
+
554
+ /**
555
+ * Metadata union for number-specific validation checks (int, finite,
556
+ * min, max, multipleOf, between).
557
+ *
558
+ * @see {@link Number}
559
+ * @see {@link Check}
560
+ *
561
+ * @category models
562
+ * @since 4.0.0
563
+ */
564
+ export type NumberMeta = Schema.Annotations.BuiltInMetaDefinitions[
565
+ | "isInt"
566
+ | "isFinite"
567
+ | "isMultipleOf"
568
+ | "isGreaterThanOrEqualTo"
569
+ | "isLessThanOrEqualTo"
570
+ | "isGreaterThan"
571
+ | "isLessThan"
572
+ | "isBetween"
573
+ ]
574
+
575
+ /**
576
+ * Metadata union for bigint-specific validation checks (min, max, between).
577
+ *
578
+ * @see {@link BigInt}
579
+ * @see {@link Check}
580
+ *
581
+ * @category models
582
+ * @since 4.0.0
583
+ */
584
+ export type BigIntMeta = Schema.Annotations.BuiltInMetaDefinitions[
585
+ | "isGreaterThanOrEqualToBigInt"
586
+ | "isLessThanOrEqualToBigInt"
587
+ | "isGreaterThanBigInt"
588
+ | "isLessThanBigInt"
589
+ | "isBetweenBigInt"
590
+ ]
591
+
592
+ /**
593
+ * Metadata union for array-specific validation checks (minLength, maxLength,
594
+ * length, unique).
595
+ *
596
+ * @see {@link Arrays}
597
+ * @see {@link Check}
598
+ *
599
+ * @category models
600
+ * @since 4.0.0
601
+ */
602
+ export type ArraysMeta = Schema.Annotations.BuiltInMetaDefinitions[
603
+ | "isMinLength"
604
+ | "isMaxLength"
605
+ | "isLengthBetween"
606
+ | "isUnique"
607
+ ]
608
+
609
+ /**
610
+ * Metadata union for object-specific validation checks (minProperties,
611
+ * maxProperties, propertiesLength, propertyNames).
612
+ *
613
+ * @see {@link Objects}
614
+ * @see {@link Check}
615
+ *
616
+ * @category models
617
+ * @since 4.0.0
618
+ */
619
+ export type ObjectsMeta =
620
+ | Schema.Annotations.BuiltInMetaDefinitions[
621
+ | "isMinProperties"
622
+ | "isMaxProperties"
623
+ | "isPropertiesLengthBetween"
624
+ ]
625
+ | { readonly _tag: "isPropertyNames"; readonly propertyNames: Representation }
626
+
627
+ /**
628
+ * Metadata union for Date-specific validation checks (valid, min, max, between).
629
+ *
630
+ * @see {@link Declaration}
631
+ * @see {@link DeclarationMeta}
632
+ *
633
+ * @category models
634
+ * @since 4.0.0
635
+ */
636
+ export type DateMeta = Schema.Annotations.BuiltInMetaDefinitions[
637
+ | "isDateValid"
638
+ | "isGreaterThanDate"
639
+ | "isGreaterThanOrEqualToDate"
640
+ | "isLessThanDate"
641
+ | "isLessThanOrEqualToDate"
642
+ | "isBetweenDate"
643
+ ]
644
+
645
+ /**
646
+ * Metadata union for size-based validation checks (minSize, maxSize, size).
647
+ * Used for collection types like `Set`, `Map`.
648
+ *
649
+ * @see {@link Declaration}
650
+ * @see {@link DeclarationMeta}
651
+ *
652
+ * @category models
653
+ * @since 4.0.0
654
+ */
655
+ export type SizeMeta = Schema.Annotations.BuiltInMetaDefinitions[
656
+ | "isMinSize"
657
+ | "isMaxSize"
658
+ | "isSizeBetween"
659
+ ]
660
+
661
+ /**
662
+ * Metadata union for {@link Declaration} checks — either {@link DateMeta}
663
+ * or {@link SizeMeta}.
664
+ *
665
+ * @category models
666
+ * @since 4.0.0
667
+ */
668
+ export type DeclarationMeta = DateMeta | SizeMeta
669
+
670
+ /** @internal */
671
+ export type Meta = StringMeta | NumberMeta | BigIntMeta | ArraysMeta | ObjectsMeta | DeclarationMeta
672
+
673
+ /**
674
+ * A string-keyed map of named {@link Representation} definitions. Used by
675
+ * {@link Document} and {@link MultiDocument} for `$ref` resolution (analogous
676
+ * to JSON Schema `$defs`).
677
+ *
678
+ * @see {@link Reference}
679
+ * @see {@link Document}
680
+ *
681
+ * @category models
682
+ * @since 4.0.0
683
+ */
684
+ export interface References {
685
+ readonly [$ref: string]: Representation
686
+ }
687
+
688
+ /**
689
+ * A single {@link Representation} together with its named {@link References}.
690
+ *
691
+ * **When to use**
692
+ *
693
+ * Use when representing a single Schema AST together with its named references
694
+ * before reconstructing a runtime Schema, converting to JSON Schema, or
695
+ * wrapping it as a {@link MultiDocument}.
696
+ *
697
+ * @see {@link MultiDocument}
698
+ * @see {@link fromAST}
699
+ *
700
+ * @category models
701
+ * @since 4.0.0
702
+ */
703
+ export type Document = {
704
+ readonly representation: Representation
705
+ readonly references: References
706
+ }
707
+
708
+ /**
709
+ * One or more {@link Representation}s sharing a common {@link References} map.
710
+ *
711
+ * **When to use**
712
+ *
713
+ * Use when you use {@link fromASTs} to create this from multiple Schema ASTs,
714
+ * {@link toCodeDocument} to generate TypeScript code, and
715
+ * {@link toJsonSchemaMultiDocument} to convert to JSON Schema.
716
+ *
717
+ * @see {@link Document}
718
+ * @see {@link fromASTs}
719
+ *
720
+ * @category models
721
+ * @since 4.0.0
722
+ */
723
+ export type MultiDocument = {
724
+ readonly representations: readonly [Representation, ...Array<Representation>]
725
+ readonly references: References
726
+ }
727
+
728
+ // -----------------------------------------------------------------------------
729
+ // schemas
730
+ // -----------------------------------------------------------------------------
731
+
732
+ const Representation$ref = Schema.suspend(() => $Representation)
733
+
734
+ const toJsonAnnotationsBlacklist: Set<string> = new Set([
735
+ ...InternalRepresentation.fromASTBlacklist,
736
+ "expected",
737
+ "contentMediaType",
738
+ "contentSchema"
739
+ ])
740
+
741
+ /**
742
+ * A tree of primitive values used to serialize annotations to JSON.
743
+ *
744
+ * @category Tree
745
+ * @since 4.0.0
746
+ */
747
+ export type PrimitiveTree = Schema.Tree<null | number | boolean | bigint | symbol | string>
748
+
749
+ /**
750
+ * Schema for {@link PrimitiveTree}.
751
+ *
752
+ * **When to use**
753
+ *
754
+ * Use to validate recursive annotation metadata trees whose leaves are `null`,
755
+ * `number`, `boolean`, `bigint`, `symbol`, or `string`.
756
+ *
757
+ * @see {@link PrimitiveTree} for the recursive tree type accepted by this codec
758
+ * @see {@link $Annotations} for the annotation codec that filters values through this codec
759
+ *
760
+ * @category schemas
761
+ * @since 4.0.0
762
+ */
763
+ export const $PrimitiveTree: Schema.Codec<PrimitiveTree> = Schema.Tree(
764
+ Schema.Union([
765
+ Schema.Null,
766
+ Schema.Number, // allows NaN, Infinity, -Infinity
767
+ Schema.Boolean,
768
+ Schema.BigInt,
769
+ Schema.Symbol,
770
+ Schema.String
771
+ ])
772
+ )
773
+
774
+ const isPrimitiveTree = Schema.is($PrimitiveTree)
775
+
776
+ /**
777
+ * Schema for serializing public `Schema.Annotations.Annotations` values. It
778
+ * filters out internal annotation keys and non-primitive values during
779
+ * encoding.
780
+ *
781
+ * **When to use**
782
+ *
783
+ * Use to serialize schema annotations in representation schemas while retaining
784
+ * only primitive-tree metadata.
785
+ *
786
+ * **Details**
787
+ *
788
+ * Decoding is passthrough. Encoding removes internal annotation keys and values
789
+ * that are not accepted by `$PrimitiveTree`.
790
+ *
791
+ * @see {@link $PrimitiveTree} for the codec used to filter annotation values
792
+ *
793
+ * @category schemas
794
+ * @since 4.0.0
795
+ */
796
+ export const $Annotations = Schema.Record(Schema.String, Schema.Unknown).pipe(
797
+ Schema.encodeTo(Schema.Record(Schema.String, $PrimitiveTree), {
798
+ decode: SchemaGetter.passthrough(),
799
+ encode: SchemaGetter.transformOptional(Option.flatMap((r) => {
800
+ const out: Record<string, typeof $PrimitiveTree["Type"]> = {}
801
+ for (const [k, v] of Object.entries(r)) {
802
+ if (!toJsonAnnotationsBlacklist.has(k) && isPrimitiveTree(v)) {
803
+ out[k] = v
804
+ }
805
+ }
806
+ return Rec.isEmptyRecord(out) ? Option.none() : Option.some(out)
807
+ }))
808
+ })
809
+ ).annotate({ identifier: "Annotations" })
810
+
811
+ /**
812
+ * Schema for the {@link Null} representation node.
813
+ *
814
+ * @category schemas
815
+ * @since 4.0.0
816
+ */
817
+ export const $Null = Schema.Struct({
818
+ _tag: Schema.tag("Null"),
819
+ annotations: Schema.optional($Annotations)
820
+ }).annotate({ identifier: "Null" })
821
+
822
+ /**
823
+ * Schema for the {@link Undefined} representation node.
824
+ *
825
+ * @category schemas
826
+ * @since 4.0.0
827
+ */
828
+ export const $Undefined = Schema.Struct({
829
+ _tag: Schema.tag("Undefined"),
830
+ annotations: Schema.optional($Annotations)
831
+ }).annotate({ identifier: "Undefined" })
832
+
833
+ /**
834
+ * Schema for the {@link Void} representation node.
835
+ *
836
+ * @category schemas
837
+ * @since 4.0.0
838
+ */
839
+ export const $Void = Schema.Struct({
840
+ _tag: Schema.tag("Void"),
841
+ annotations: Schema.optional($Annotations)
842
+ }).annotate({ identifier: "Void" })
843
+
844
+ /**
845
+ * Schema for the {@link Never} representation node.
846
+ *
847
+ * @category schemas
848
+ * @since 4.0.0
849
+ */
850
+ export const $Never = Schema.Struct({
851
+ _tag: Schema.tag("Never"),
852
+ annotations: Schema.optional($Annotations)
853
+ }).annotate({ identifier: "Never" })
854
+
855
+ /**
856
+ * Schema for the {@link Unknown} representation node.
857
+ *
858
+ * @category schemas
859
+ * @since 4.0.0
860
+ */
861
+ export const $Unknown = Schema.Struct({
862
+ _tag: Schema.tag("Unknown"),
863
+ annotations: Schema.optional($Annotations)
864
+ }).annotate({ identifier: "Unknown" })
865
+
866
+ /**
867
+ * Schema for the {@link Any} representation node.
868
+ *
869
+ * @category schemas
870
+ * @since 4.0.0
871
+ */
872
+ export const $Any = Schema.Struct({
873
+ _tag: Schema.tag("Any"),
874
+ annotations: Schema.optional($Annotations)
875
+ }).annotate({ identifier: "Any" })
876
+
877
+ const $IsStringFinite = Schema.Struct({
878
+ _tag: Schema.tag("isStringFinite"),
879
+ regExp: Schema.RegExp
880
+ }).annotate({ identifier: "IsStringFinite" })
881
+
882
+ const $IsStringBigInt = Schema.Struct({
883
+ _tag: Schema.tag("isStringBigInt"),
884
+ regExp: Schema.RegExp
885
+ }).annotate({ identifier: "IsStringBigInt" })
886
+
887
+ const $IsStringSymbol = Schema.Struct({
888
+ _tag: Schema.tag("isStringSymbol"),
889
+ regExp: Schema.RegExp
890
+ }).annotate({ identifier: "IsStringSymbol" })
891
+
892
+ const $IsTrimmed = Schema.Struct({
893
+ _tag: Schema.tag("isTrimmed"),
894
+ regExp: Schema.RegExp
895
+ }).annotate({ identifier: "IsTrimmed" })
896
+
897
+ const $IsUUID = Schema.Struct({
898
+ _tag: Schema.tag("isUUID"),
899
+ regExp: Schema.RegExp,
900
+ version: Schema.UndefinedOr(Schema.Literals([1, 2, 3, 4, 5, 6, 7, 8]))
901
+ }).annotate({ identifier: "IsUUID" })
902
+
903
+ const $IsGUID = Schema.Struct({
904
+ _tag: Schema.tag("isGUID"),
905
+ regExp: Schema.RegExp
906
+ }).annotate({ identifier: "IsGUID" })
907
+
908
+ const $IsULID = Schema.Struct({
909
+ _tag: Schema.tag("isULID"),
910
+ regExp: Schema.RegExp
911
+ }).annotate({ identifier: "IsULID" })
912
+
913
+ const $IsBase64 = Schema.Struct({
914
+ _tag: Schema.tag("isBase64"),
915
+ regExp: Schema.RegExp
916
+ }).annotate({ identifier: "IsBase64" })
917
+
918
+ const $IsBase64Url = Schema.Struct({
919
+ _tag: Schema.tag("isBase64Url"),
920
+ regExp: Schema.RegExp
921
+ }).annotate({ identifier: "IsBase64Url" })
922
+
923
+ const $IsStartsWith = Schema.Struct({
924
+ _tag: Schema.tag("isStartsWith"),
925
+ startsWith: Schema.String,
926
+ regExp: Schema.RegExp
927
+ }).annotate({ identifier: "IsStartsWith" })
928
+
929
+ const $IsEndsWith = Schema.Struct({
930
+ _tag: Schema.tag("isEndsWith"),
931
+ endsWith: Schema.String,
932
+ regExp: Schema.RegExp
933
+ }).annotate({ identifier: "IsEndsWith" })
934
+
935
+ const $IsIncludes = Schema.Struct({
936
+ _tag: Schema.tag("isIncludes"),
937
+ includes: Schema.String,
938
+ regExp: Schema.RegExp
939
+ }).annotate({ identifier: "IsIncludes" })
940
+
941
+ const $IsUppercased = Schema.Struct({
942
+ _tag: Schema.tag("isUppercased"),
943
+ regExp: Schema.RegExp
944
+ }).annotate({ identifier: "IsUppercased" })
945
+
946
+ const $IsLowercased = Schema.Struct({
947
+ _tag: Schema.tag("isLowercased"),
948
+ regExp: Schema.RegExp
949
+ }).annotate({ identifier: "IsLowercased" })
950
+
951
+ const $IsCapitalized = Schema.Struct({
952
+ _tag: Schema.tag("isCapitalized"),
953
+ regExp: Schema.RegExp
954
+ }).annotate({ identifier: "IsCapitalized" })
955
+
956
+ const $IsUncapitalized = Schema.Struct({
957
+ _tag: Schema.tag("isUncapitalized"),
958
+ regExp: Schema.RegExp
959
+ }).annotate({ identifier: "IsUncapitalized" })
960
+
961
+ const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
962
+
963
+ const $IsMinLength = Schema.Struct({
964
+ _tag: Schema.tag("isMinLength"),
965
+ minLength: NonNegativeInt
966
+ }).annotate({ identifier: "IsMinLength" })
967
+
968
+ const $IsMaxLength = Schema.Struct({
969
+ _tag: Schema.tag("isMaxLength"),
970
+ maxLength: NonNegativeInt
971
+ }).annotate({ identifier: "IsMaxLength" })
972
+
973
+ const $IsLengthBetween = Schema.Struct({
974
+ _tag: Schema.tag("isLengthBetween"),
975
+ minimum: NonNegativeInt,
976
+ maximum: NonNegativeInt
977
+ }).annotate({ identifier: "IsLengthBetween" })
978
+
979
+ const $IsPattern = Schema.Struct({
980
+ _tag: Schema.tag("isPattern"),
981
+ regExp: Schema.RegExp
982
+ }).annotate({ identifier: "IsPattern" })
983
+
984
+ /**
985
+ * Schema for {@link StringMeta}.
986
+ *
987
+ * @category schemas
988
+ * @since 4.0.0
989
+ */
990
+ export const $StringMeta = Schema.Union([
991
+ $IsStringFinite,
992
+ $IsStringBigInt,
993
+ $IsStringSymbol,
994
+ $IsTrimmed,
995
+ $IsUUID,
996
+ $IsGUID,
997
+ $IsULID,
998
+ $IsBase64,
999
+ $IsBase64Url,
1000
+ $IsStartsWith,
1001
+ $IsEndsWith,
1002
+ $IsIncludes,
1003
+ $IsUppercased,
1004
+ $IsLowercased,
1005
+ $IsCapitalized,
1006
+ $IsUncapitalized,
1007
+ $IsMinLength,
1008
+ $IsMaxLength,
1009
+ $IsPattern,
1010
+ $IsLengthBetween
1011
+ ]).annotate({ identifier: "StringMeta" })
1012
+
1013
+ function makeCheck<T>(meta: Schema.Codec<T>, identifier: string) {
1014
+ const Check$ref = Schema.suspend(() => Check)
1015
+ const Check: Schema.Codec<Check<T>> = Schema.Union([
1016
+ Schema.Struct({
1017
+ _tag: Schema.tag("Filter"),
1018
+ annotations: Schema.optional($Annotations),
1019
+ meta
1020
+ }).annotate({ identifier: `${identifier}Filter` }),
1021
+ Schema.Struct({
1022
+ _tag: Schema.tag("FilterGroup"),
1023
+ annotations: Schema.optional($Annotations),
1024
+ checks: Schema.NonEmptyArray(Check$ref)
1025
+ }).annotate({ identifier: `${identifier}FilterGroup` })
1026
+ ]).annotate({ identifier: `${identifier}Check` })
1027
+ return Check
1028
+ }
1029
+
1030
+ /**
1031
+ * Schema for the {@link String} representation node.
1032
+ *
1033
+ * @category schemas
1034
+ * @since 4.0.0
1035
+ */
1036
+ export const $String = Schema.Struct({
1037
+ _tag: Schema.tag("String"),
1038
+ annotations: Schema.optional($Annotations),
1039
+ checks: Schema.Array(makeCheck($StringMeta, "String")),
1040
+ contentMediaType: Schema.optional(Schema.String),
1041
+ contentSchema: Schema.optional(Representation$ref)
1042
+ }).annotate({ identifier: "String" })
1043
+
1044
+ const $IsInt = Schema.Struct({
1045
+ _tag: Schema.tag("isInt")
1046
+ }).annotate({ identifier: "IsInt" })
1047
+
1048
+ const $IsMultipleOf = Schema.Struct({
1049
+ _tag: Schema.tag("isMultipleOf"),
1050
+ divisor: Schema.Finite
1051
+ }).annotate({ identifier: "IsMultipleOf" })
1052
+
1053
+ const $IsFinite = Schema.Struct({
1054
+ _tag: Schema.tag("isFinite")
1055
+ }).annotate({ identifier: "IsFinite" })
1056
+
1057
+ const $IsGreaterThan = Schema.Struct({
1058
+ _tag: Schema.tag("isGreaterThan"),
1059
+ exclusiveMinimum: Schema.Finite
1060
+ }).annotate({ identifier: "IsGreaterThan" })
1061
+
1062
+ const $IsGreaterThanOrEqualTo = Schema.Struct({
1063
+ _tag: Schema.tag("isGreaterThanOrEqualTo"),
1064
+ minimum: Schema.Finite
1065
+ }).annotate({ identifier: "IsGreaterThanOrEqualTo" })
1066
+
1067
+ const $IsLessThan = Schema.Struct({
1068
+ _tag: Schema.tag("isLessThan"),
1069
+ exclusiveMaximum: Schema.Finite
1070
+ }).annotate({ identifier: "IsLessThan" })
1071
+
1072
+ const $IsLessThanOrEqualTo = Schema.Struct({
1073
+ _tag: Schema.tag("isLessThanOrEqualTo"),
1074
+ maximum: Schema.Finite
1075
+ }).annotate({ identifier: "IsLessThanOrEqualTo" })
1076
+
1077
+ const $IsBetween = Schema.Struct({
1078
+ _tag: Schema.tag("isBetween"),
1079
+ minimum: Schema.Finite,
1080
+ maximum: Schema.Finite,
1081
+ exclusiveMinimum: Schema.optional(Schema.Boolean),
1082
+ exclusiveMaximum: Schema.optional(Schema.Boolean)
1083
+ }).annotate({ identifier: "IsBetween" })
1084
+
1085
+ /**
1086
+ * Schema for {@link NumberMeta}.
1087
+ *
1088
+ * @category schemas
1089
+ * @since 4.0.0
1090
+ */
1091
+ export const $NumberMeta = Schema.Union([
1092
+ $IsInt,
1093
+ $IsMultipleOf,
1094
+ $IsFinite,
1095
+ $IsGreaterThan,
1096
+ $IsGreaterThanOrEqualTo,
1097
+ $IsLessThan,
1098
+ $IsLessThanOrEqualTo,
1099
+ $IsBetween
1100
+ ]).annotate({ identifier: "NumberMeta" })
1101
+
1102
+ /**
1103
+ * Schema for the {@link Number} representation node.
1104
+ *
1105
+ * @category schemas
1106
+ * @since 4.0.0
1107
+ */
1108
+ export const $Number = Schema.Struct({
1109
+ _tag: Schema.tag("Number"),
1110
+ annotations: Schema.optional($Annotations),
1111
+ checks: Schema.Array(makeCheck($NumberMeta, "Number"))
1112
+ }).annotate({ identifier: "Number" })
1113
+
1114
+ /**
1115
+ * Schema for the {@link Boolean} representation node.
1116
+ *
1117
+ * @category schemas
1118
+ * @since 4.0.0
1119
+ */
1120
+ export const $Boolean = Schema.Struct({
1121
+ _tag: Schema.tag("Boolean"),
1122
+ annotations: Schema.optional($Annotations)
1123
+ }).annotate({ identifier: "Boolean" })
1124
+
1125
+ const $IsGreaterThanBigInt = Schema.Struct({
1126
+ _tag: Schema.tag("isGreaterThanBigInt"),
1127
+ exclusiveMinimum: Schema.BigInt
1128
+ }).annotate({ identifier: "IsGreaterThanBigInt" })
1129
+
1130
+ const $IsGreaterThanOrEqualToBigInt = Schema.Struct({
1131
+ _tag: Schema.tag("isGreaterThanOrEqualToBigInt"),
1132
+ minimum: Schema.BigInt
1133
+ }).annotate({ identifier: "IsGreaterThanOrEqualToBigInt" })
1134
+
1135
+ const $IsLessThanBigInt = Schema.Struct({
1136
+ _tag: Schema.tag("isLessThanBigInt"),
1137
+ exclusiveMaximum: Schema.BigInt
1138
+ }).annotate({ identifier: "IsLessThanBigInt" })
1139
+
1140
+ const $IsLessThanOrEqualToBigInt = Schema.Struct({
1141
+ _tag: Schema.tag("isLessThanOrEqualToBigInt"),
1142
+ maximum: Schema.BigInt
1143
+ }).annotate({ identifier: "IsLessThanOrEqualToBigInt" })
1144
+
1145
+ const $IsBetweenBigInt = Schema.Struct({
1146
+ _tag: Schema.tag("isBetweenBigInt"),
1147
+ minimum: Schema.BigInt,
1148
+ maximum: Schema.BigInt,
1149
+ exclusiveMinimum: Schema.optional(Schema.Boolean),
1150
+ exclusiveMaximum: Schema.optional(Schema.Boolean)
1151
+ }).annotate({ identifier: "IsBetweenBigInt" })
1152
+
1153
+ const $BigIntMeta = Schema.Union([
1154
+ $IsGreaterThanBigInt,
1155
+ $IsGreaterThanOrEqualToBigInt,
1156
+ $IsLessThanBigInt,
1157
+ $IsLessThanOrEqualToBigInt,
1158
+ $IsBetweenBigInt
1159
+ ]).annotate({ identifier: "BigIntMeta" })
1160
+
1161
+ /**
1162
+ * Schema for the {@link BigInt} representation node.
1163
+ *
1164
+ * **When to use**
1165
+ *
1166
+ * Use to encode, decode, or validate serialized `BigInt` representation nodes,
1167
+ * not application `bigint` values.
1168
+ *
1169
+ * **Details**
1170
+ *
1171
+ * Accepts representation nodes with `_tag: "BigInt"`, optional annotations,
1172
+ * and bigint-specific validation metadata in `checks`.
1173
+ *
1174
+ * @see {@link BigIntMeta} for the metadata accepted by the `checks` array
1175
+ *
1176
+ * @category schemas
1177
+ * @since 4.0.0
1178
+ */
1179
+ export const $BigInt = Schema.Struct({
1180
+ _tag: Schema.tag("BigInt"),
1181
+ annotations: Schema.optional($Annotations),
1182
+ checks: Schema.Array(makeCheck($BigIntMeta, "BigInt"))
1183
+ }).annotate({ identifier: "BigInt" })
1184
+
1185
+ /**
1186
+ * Schema for the {@link Symbol} representation node.
1187
+ *
1188
+ * @category schemas
1189
+ * @since 4.0.0
1190
+ */
1191
+ export const $Symbol = Schema.Struct({
1192
+ _tag: Schema.tag("Symbol"),
1193
+ annotations: Schema.optional($Annotations)
1194
+ }).annotate({ identifier: "Symbol" })
1195
+
1196
+ /**
1197
+ * Schema for the literal value types allowed in a {@link Literal} node
1198
+ * (string, finite number, boolean, or bigint).
1199
+ *
1200
+ * @category schemas
1201
+ * @since 4.0.0
1202
+ */
1203
+ export const $LiteralValue = Schema.Union([
1204
+ Schema.String,
1205
+ Schema.Finite,
1206
+ Schema.Boolean,
1207
+ Schema.BigInt
1208
+ ]).annotate({ identifier: "LiteralValue" })
1209
+
1210
+ /**
1211
+ * Schema for the {@link Literal} representation node.
1212
+ *
1213
+ * @category schemas
1214
+ * @since 4.0.0
1215
+ */
1216
+ export const $Literal = Schema.Struct({
1217
+ _tag: Schema.tag("Literal"),
1218
+ annotations: Schema.optional($Annotations),
1219
+ literal: $LiteralValue
1220
+ }).annotate({ identifier: "Literal" })
1221
+
1222
+ /**
1223
+ * Schema for the {@link UniqueSymbol} representation node.
1224
+ *
1225
+ * @category schemas
1226
+ * @since 4.0.0
1227
+ */
1228
+ export const $UniqueSymbol = Schema.Struct({
1229
+ _tag: Schema.tag("UniqueSymbol"),
1230
+ annotations: Schema.optional($Annotations),
1231
+ symbol: Schema.Symbol
1232
+ }).annotate({ identifier: "UniqueSymbol" })
1233
+
1234
+ /**
1235
+ * Schema for the {@link ObjectKeyword} representation node.
1236
+ *
1237
+ * @category schemas
1238
+ * @since 4.0.0
1239
+ */
1240
+ export const $ObjectKeyword = Schema.Struct({
1241
+ _tag: Schema.tag("ObjectKeyword"),
1242
+ annotations: Schema.optional($Annotations)
1243
+ }).annotate({ identifier: "ObjectKeyword" })
1244
+
1245
+ /**
1246
+ * Schema for the {@link Enum} representation node.
1247
+ *
1248
+ * @category schemas
1249
+ * @since 4.0.0
1250
+ */
1251
+ export const $Enum = Schema.Struct({
1252
+ _tag: Schema.tag("Enum"),
1253
+ annotations: Schema.optional($Annotations),
1254
+ enums: Schema.Array(
1255
+ Schema.Tuple([
1256
+ Schema.String,
1257
+ Schema.Union([
1258
+ Schema.String,
1259
+ Schema.Number // NaN, Infinity, -Infinity are allowed enum values
1260
+ ])
1261
+ ])
1262
+ )
1263
+ }).annotate({ identifier: "Enum" })
1264
+
1265
+ /**
1266
+ * Schema for the {@link TemplateLiteral} representation node.
1267
+ *
1268
+ * @category schemas
1269
+ * @since 4.0.0
1270
+ */
1271
+ export const $TemplateLiteral = Schema.Struct({
1272
+ _tag: Schema.tag("TemplateLiteral"),
1273
+ annotations: Schema.optional($Annotations),
1274
+ parts: Schema.Array(Representation$ref)
1275
+ }).annotate({ identifier: "TemplateLiteral" })
1276
+
1277
+ /**
1278
+ * Schema for the {@link Element} type (positional tuple element).
1279
+ *
1280
+ * @category schemas
1281
+ * @since 4.0.0
1282
+ */
1283
+ export const $Element = Schema.Struct({
1284
+ isOptional: Schema.Boolean,
1285
+ type: Representation$ref,
1286
+ annotations: Schema.optional($Annotations)
1287
+ }).annotate({ identifier: "Element" })
1288
+
1289
+ const $IsUnique = Schema.Struct({
1290
+ _tag: Schema.tag("isUnique")
1291
+ }).annotate({ identifier: "IsUnique" })
1292
+
1293
+ const $ArraysMeta = Schema.Union([
1294
+ $IsMinLength,
1295
+ $IsMaxLength,
1296
+ $IsLengthBetween,
1297
+ $IsUnique
1298
+ ]).annotate({ identifier: "ArraysMeta" })
1299
+
1300
+ /**
1301
+ * Schema for the {@link Arrays} representation node.
1302
+ *
1303
+ * @category schemas
1304
+ * @since 4.0.0
1305
+ */
1306
+ export const $Arrays = Schema.Struct({
1307
+ _tag: Schema.tag("Arrays"),
1308
+ annotations: Schema.optional($Annotations),
1309
+ elements: Schema.Array($Element),
1310
+ rest: Schema.Array(Representation$ref),
1311
+ checks: Schema.Array(makeCheck($ArraysMeta, "Arrays"))
1312
+ }).annotate({ identifier: "Arrays" })
1313
+
1314
+ /**
1315
+ * Schema for the {@link PropertySignature} type.
1316
+ *
1317
+ * @category schemas
1318
+ * @since 4.0.0
1319
+ */
1320
+ export const $PropertySignature = Schema.Struct({
1321
+ annotations: Schema.optional($Annotations),
1322
+ name: Schema.PropertyKey,
1323
+ type: Representation$ref,
1324
+ isOptional: Schema.Boolean,
1325
+ isMutable: Schema.Boolean
1326
+ }).annotate({ identifier: "PropertySignature" })
1327
+
1328
+ /**
1329
+ * Schema for the {@link IndexSignature} type.
1330
+ *
1331
+ * @category schemas
1332
+ * @since 4.0.0
1333
+ */
1334
+ export const $IndexSignature = Schema.Struct({
1335
+ parameter: Representation$ref,
1336
+ type: Representation$ref
1337
+ }).annotate({ identifier: "IndexSignature" })
1338
+
1339
+ const $IsMinProperties = Schema.Struct({
1340
+ _tag: Schema.tag("isMinProperties"),
1341
+ minProperties: NonNegativeInt
1342
+ }).annotate({ identifier: "IsMinProperties" })
1343
+
1344
+ const $IsMaxProperties = Schema.Struct({
1345
+ _tag: Schema.tag("isMaxProperties"),
1346
+ maxProperties: NonNegativeInt
1347
+ }).annotate({ identifier: "IsMaxProperties" })
1348
+
1349
+ const $IsPropertiesLengthBetween = Schema.Struct({
1350
+ _tag: Schema.tag("isPropertiesLengthBetween"),
1351
+ minimum: NonNegativeInt,
1352
+ maximum: NonNegativeInt
1353
+ }).annotate({ identifier: "IsPropertiesLengthBetween" })
1354
+
1355
+ const $IsPropertyNames = Schema.Struct({
1356
+ _tag: Schema.tag("isPropertyNames"),
1357
+ propertyNames: Representation$ref
1358
+ }).annotate({ identifier: "IsPropertyNames" })
1359
+
1360
+ /**
1361
+ * Schema for {@link ObjectsMeta}.
1362
+ *
1363
+ * @category schemas
1364
+ * @since 4.0.0
1365
+ */
1366
+ export const $ObjectsMeta = Schema.Union([
1367
+ $IsMinProperties,
1368
+ $IsMaxProperties,
1369
+ $IsPropertiesLengthBetween,
1370
+ $IsPropertyNames
1371
+ ]).annotate({ identifier: "ObjectsMeta" })
1372
+
1373
+ /**
1374
+ * Schema for the {@link Objects} representation node.
1375
+ *
1376
+ * @category schemas
1377
+ * @since 4.0.0
1378
+ */
1379
+ export const $Objects = Schema.Struct({
1380
+ _tag: Schema.tag("Objects"),
1381
+ annotations: Schema.optional($Annotations),
1382
+ propertySignatures: Schema.Array($PropertySignature),
1383
+ indexSignatures: Schema.Array($IndexSignature),
1384
+ checks: Schema.Array(makeCheck($ObjectsMeta, "Objects"))
1385
+ }).annotate({ identifier: "Objects" })
1386
+
1387
+ /**
1388
+ * Schema for the {@link Union} representation node.
1389
+ *
1390
+ * @category schemas
1391
+ * @since 4.0.0
1392
+ */
1393
+ export const $Union = Schema.Struct({
1394
+ _tag: Schema.tag("Union"),
1395
+ annotations: Schema.optional($Annotations),
1396
+ types: Schema.Array(Representation$ref),
1397
+ mode: Schema.Literals(["anyOf", "oneOf"])
1398
+ }).annotate({ identifier: "Union" })
1399
+
1400
+ /**
1401
+ * Schema for the {@link Reference} representation node.
1402
+ *
1403
+ * @category schemas
1404
+ * @since 4.0.0
1405
+ */
1406
+ export const $Reference = Schema.Struct({
1407
+ _tag: Schema.tag("Reference"),
1408
+ $ref: Schema.String
1409
+ }).annotate({ identifier: "Reference" })
1410
+
1411
+ const $IsDateValid = Schema.Struct({
1412
+ _tag: Schema.tag("isDateValid")
1413
+ }).annotate({ identifier: "IsDateValid" })
1414
+
1415
+ const $IsGreaterThanDate = Schema.Struct({
1416
+ _tag: Schema.tag("isGreaterThanDate"),
1417
+ exclusiveMinimum: Schema.Date
1418
+ }).annotate({ identifier: "IsGreaterThanDate" })
1419
+
1420
+ const $IsGreaterThanOrEqualToDate = Schema.Struct({
1421
+ _tag: Schema.tag("isGreaterThanOrEqualToDate"),
1422
+ minimum: Schema.Date
1423
+ }).annotate({ identifier: "IsGreaterThanOrEqualToDate" })
1424
+
1425
+ const $IsLessThanDate = Schema.Struct({
1426
+ _tag: Schema.tag("isLessThanDate"),
1427
+ exclusiveMaximum: Schema.Date
1428
+ }).annotate({ identifier: "IsLessThanDate" })
1429
+
1430
+ const $IsLessThanOrEqualToDate = Schema.Struct({
1431
+ _tag: Schema.tag("isLessThanOrEqualToDate"),
1432
+ maximum: Schema.Date
1433
+ }).annotate({ identifier: "IsLessThanOrEqualToDate" })
1434
+
1435
+ const $IsBetweenDate = Schema.Struct({
1436
+ _tag: Schema.tag("isBetweenDate"),
1437
+ minimum: Schema.Date,
1438
+ maximum: Schema.Date,
1439
+ exclusiveMinimum: Schema.optional(Schema.Boolean),
1440
+ exclusiveMaximum: Schema.optional(Schema.Boolean)
1441
+ }).annotate({ identifier: "IsBetweenDate" })
1442
+
1443
+ /**
1444
+ * Schema for {@link DateMeta}.
1445
+ *
1446
+ * @category schemas
1447
+ * @since 4.0.0
1448
+ */
1449
+ export const $DateMeta = Schema.Union([
1450
+ $IsDateValid,
1451
+ $IsGreaterThanDate,
1452
+ $IsGreaterThanOrEqualToDate,
1453
+ $IsLessThanDate,
1454
+ $IsLessThanOrEqualToDate,
1455
+ $IsBetweenDate
1456
+ ]).annotate({ identifier: "DateMeta" })
1457
+
1458
+ const $IsMinSize = Schema.Struct({
1459
+ _tag: Schema.tag("isMinSize"),
1460
+ minSize: NonNegativeInt
1461
+ }).annotate({ identifier: "IsMinSize" })
1462
+
1463
+ const $IsMaxSize = Schema.Struct({
1464
+ _tag: Schema.tag("isMaxSize"),
1465
+ maxSize: NonNegativeInt
1466
+ }).annotate({ identifier: "IsMaxSize" })
1467
+
1468
+ const $IsSizeBetween = Schema.Struct({
1469
+ _tag: Schema.tag("isSizeBetween"),
1470
+ minimum: NonNegativeInt,
1471
+ maximum: NonNegativeInt
1472
+ }).annotate({ identifier: "IsSizeBetween" })
1473
+
1474
+ /**
1475
+ * Schema for {@link SizeMeta}.
1476
+ *
1477
+ * @category schemas
1478
+ * @since 4.0.0
1479
+ */
1480
+ export const $SizeMeta = Schema.Union([
1481
+ $IsMinSize,
1482
+ $IsMaxSize,
1483
+ $IsSizeBetween
1484
+ ]).annotate({ identifier: "SizeMeta" })
1485
+
1486
+ /**
1487
+ * Schema for {@link DeclarationMeta}.
1488
+ *
1489
+ * @category schemas
1490
+ * @since 4.0.0
1491
+ */
1492
+ export const $DeclarationMeta = Schema.Union([
1493
+ $DateMeta,
1494
+ $SizeMeta
1495
+ ]).annotate({ identifier: "DeclarationMeta" })
1496
+
1497
+ /**
1498
+ * Schema for the {@link Declaration} representation node.
1499
+ *
1500
+ * @category schemas
1501
+ * @since 4.0.0
1502
+ */
1503
+ export const $Declaration = Schema.Struct({
1504
+ _tag: Schema.tag("Declaration"),
1505
+ annotations: Schema.optional($Annotations),
1506
+ typeParameters: Schema.Array(Representation$ref),
1507
+ checks: Schema.Array(makeCheck($DeclarationMeta, "Declaration")),
1508
+ encodedSchema: Representation$ref
1509
+ }).annotate({ identifier: "Declaration" })
1510
+
1511
+ /**
1512
+ * Schema for the {@link Suspend} representation node.
1513
+ *
1514
+ * @category schemas
1515
+ * @since 4.0.0
1516
+ */
1517
+ export const $Suspend = Schema.Struct({
1518
+ _tag: Schema.tag("Suspend"),
1519
+ annotations: Schema.optional($Annotations),
1520
+ checks: Schema.Tuple([]),
1521
+ thunk: Representation$ref
1522
+ }).annotate({ identifier: "Suspend" })
1523
+
1524
+ /**
1525
+ * Type-level helper for the recursive {@link $Representation} codec.
1526
+ *
1527
+ * @category schemas
1528
+ * @since 4.0.0
1529
+ */
1530
+ export interface $Representation extends Schema.Codec<Representation> {}
1531
+
1532
+ /**
1533
+ * Schema for the full {@link Representation} union. It recursively validates
1534
+ * and encodes any representation node.
1535
+ *
1536
+ * @category schemas
1537
+ * @since 4.0.0
1538
+ */
1539
+ export const $Representation: $Representation = Schema.Union([
1540
+ $Null,
1541
+ $Undefined,
1542
+ $Void,
1543
+ $Never,
1544
+ $Unknown,
1545
+ $Any,
1546
+ $String,
1547
+ $Number,
1548
+ $Boolean,
1549
+ $BigInt,
1550
+ $Symbol,
1551
+ $Literal,
1552
+ $UniqueSymbol,
1553
+ $ObjectKeyword,
1554
+ $Enum,
1555
+ $TemplateLiteral,
1556
+ $Arrays,
1557
+ $Objects,
1558
+ $Union,
1559
+ $Reference,
1560
+ $Declaration,
1561
+ $Suspend
1562
+ ]).annotate({ identifier: "Schema" })
1563
+
1564
+ /**
1565
+ * Schema for {@link Document}.
1566
+ *
1567
+ * **When to use**
1568
+ *
1569
+ * Use to validate or serialize a single schema representation document with
1570
+ * `Schema.decodeUnknownSync` or `Schema.encodeSync`.
1571
+ *
1572
+ * **Gotchas**
1573
+ *
1574
+ * This codec validates document structure but does not resolve `$ref` keys
1575
+ * against `references`.
1576
+ *
1577
+ * @see {@link DocumentFromJson} for the JSON-string codec wrapper
1578
+ * @see {@link $MultiDocument} for validating documents with multiple root representations
1579
+ *
1580
+ * @category schemas
1581
+ * @since 4.0.0
1582
+ */
1583
+ export const $Document = Schema.Struct({
1584
+ representation: $Representation,
1585
+ references: Schema.Record(Schema.String, $Representation)
1586
+ }).annotate({ identifier: "Document" })
1587
+
1588
+ /**
1589
+ * Schema for {@link MultiDocument}.
1590
+ *
1591
+ * @category schemas
1592
+ * @since 4.0.0
1593
+ */
1594
+ export const $MultiDocument = Schema.Struct({
1595
+ representations: Schema.NonEmptyArray($Representation),
1596
+ references: Schema.Record(Schema.String, $Representation)
1597
+ }).annotate({ identifier: "MultiDocument" })
1598
+
1599
+ // -----------------------------------------------------------------------------
1600
+ // APIs
1601
+ // -----------------------------------------------------------------------------
1602
+
1603
+ /**
1604
+ * Converts a Schema AST into a {@link Document}.
1605
+ *
1606
+ * **When to use**
1607
+ *
1608
+ * Use when you have a single Schema AST and need a schema representation
1609
+ * document.
1610
+ *
1611
+ * **Details**
1612
+ *
1613
+ * Shared/recursive sub-schemas are extracted into the `references` map.
1614
+ *
1615
+ * **Example** (Converting a Schema to a Document)
1616
+ *
1617
+ * ```ts
1618
+ * import { Schema, SchemaRepresentation } from "effect"
1619
+ *
1620
+ * const Person = Schema.Struct({
1621
+ * name: Schema.String,
1622
+ * age: Schema.Number
1623
+ * })
1624
+ *
1625
+ * const doc = SchemaRepresentation.fromAST(Person.ast)
1626
+ * console.log(doc.representation._tag)
1627
+ * // "Objects"
1628
+ * ```
1629
+ *
1630
+ * @see {@link Document}
1631
+ * @see {@link fromASTs}
1632
+ *
1633
+ * @category constructors
1634
+ * @since 4.0.0
1635
+ */
1636
+ export const fromAST: (ast: SchemaAST.AST) => Document = InternalRepresentation.fromAST
1637
+
1638
+ /**
1639
+ * Converts one or more Schema ASTs into a {@link MultiDocument}.
1640
+ *
1641
+ * **When to use**
1642
+ *
1643
+ * Use when you have multiple Schema ASTs and need one schema representation
1644
+ * `MultiDocument` with shared references.
1645
+ *
1646
+ * **Details**
1647
+ *
1648
+ * All schemas share a single `references` map.
1649
+ *
1650
+ * @see {@link MultiDocument}
1651
+ * @see {@link fromAST}
1652
+ *
1653
+ * @category constructors
1654
+ * @since 4.0.0
1655
+ */
1656
+ export const fromASTs: (asts: readonly [SchemaAST.AST, ...Array<SchemaAST.AST>]) => MultiDocument =
1657
+ InternalRepresentation.fromASTs
1658
+
1659
+ /**
1660
+ * Schema that decodes a {@link Document} from JSON and encodes it back.
1661
+ *
1662
+ * **When to use**
1663
+ *
1664
+ * Use when you need a JSON codec for schema representation documents with
1665
+ * `Schema.decodeUnknownSync` or `Schema.encodeSync`.
1666
+ *
1667
+ * **Example** (Round-tripping a Document through JSON)
1668
+ *
1669
+ * ```ts
1670
+ * import { Schema, SchemaRepresentation } from "effect"
1671
+ *
1672
+ * const doc = SchemaRepresentation.fromAST(Schema.String.ast)
1673
+ * const json = Schema.encodeSync(SchemaRepresentation.DocumentFromJson)(doc)
1674
+ * const back = Schema.decodeUnknownSync(SchemaRepresentation.DocumentFromJson)(json)
1675
+ * ```
1676
+ *
1677
+ * @see {@link $Document}
1678
+ * @see {@link MultiDocumentFromJson}
1679
+ *
1680
+ * @category schemas
1681
+ * @since 4.0.0
1682
+ */
1683
+ export const DocumentFromJson: Schema.Codec<Document, Schema.Json> = Schema.toCodecJson($Document)
1684
+
1685
+ /**
1686
+ * Schema for `MultiDocument` values encoded as JSON.
1687
+ *
1688
+ * @see {@link $MultiDocument}
1689
+ * @see {@link DocumentFromJson}
1690
+ *
1691
+ * @category schemas
1692
+ * @since 4.0.0
1693
+ */
1694
+ export const MultiDocumentFromJson: Schema.Codec<MultiDocument, Schema.Json> = Schema.toCodecJson($MultiDocument)
1695
+
1696
+ /**
1697
+ * Wraps a single {@link Document} as a {@link MultiDocument} with one
1698
+ * representation.
1699
+ *
1700
+ * **When to use**
1701
+ *
1702
+ * Use when you need to pass a single schema representation `Document` where an
1703
+ * API expects a `MultiDocument`.
1704
+ *
1705
+ * @see {@link Document}
1706
+ * @see {@link MultiDocument}
1707
+ *
1708
+ * @category transforming
1709
+ * @since 4.0.0
1710
+ */
1711
+ export function toMultiDocument(document: Document): MultiDocument {
1712
+ return {
1713
+ representations: [document.representation],
1714
+ references: document.references
1715
+ }
1716
+ }
1717
+
1718
+ /**
1719
+ * A callback that handles {@link Declaration} nodes during reconstruction
1720
+ * ({@link toSchema}) or code generation ({@link toCodeDocument}).
1721
+ *
1722
+ * **Details**
1723
+ *
1724
+ * Return a value to handle the declaration. Return `undefined` to fall back to
1725
+ * default behavior, which uses `encodedSchema` for `toSchema` or the
1726
+ * `generation` annotation for `toCodeDocument`. `recur` processes child
1727
+ * representations recursively.
1728
+ *
1729
+ * @see {@link toSchema}
1730
+ * @see {@link toSchemaDefaultReviver}
1731
+ * @see {@link toCodeDocument}
1732
+ *
1733
+ * @category models
1734
+ * @since 4.0.0
1735
+ */
1736
+ export type Reviver<T> = (declaration: Declaration, recur: (representation: Representation) => T) => T | undefined
1737
+
1738
+ /**
1739
+ * Default {@link Reviver} for {@link toSchema} that handles built-in Effect
1740
+ * types, including Option, Result, Redacted, Cause, Exit, ReadonlyMap, HashMap,
1741
+ * ReadonlySet, Date, Duration, URL, and RegExp.
1742
+ *
1743
+ * **When to use**
1744
+ *
1745
+ * Use when you need the default `options.reviver` for {@link toSchema} to
1746
+ * reconstruct runtime schemas for built-in Effect declarations.
1747
+ *
1748
+ * **Details**
1749
+ *
1750
+ * The reviver returns `undefined` for unrecognized declarations, causing
1751
+ * fallback to `encodedSchema`.
1752
+ *
1753
+ * @see {@link toSchema}
1754
+ * @see {@link Reviver}
1755
+ *
1756
+ * @category transforming
1757
+ * @since 4.0.0
1758
+ */
1759
+ export const toSchemaDefaultReviver: Reviver<Schema.Top> = (s, recur) => {
1760
+ const typeConstructor = s.annotations?.typeConstructor
1761
+ if (Predicate.isObject(typeConstructor) && typeof typeConstructor._tag === "string") {
1762
+ const typeParameters = s.typeParameters.map(recur)
1763
+ switch (typeConstructor._tag) {
1764
+ // built-in types
1765
+ case "Date":
1766
+ return Schema.Date
1767
+ case "Error":
1768
+ return Schema.Error(typeConstructor.options as Schema.ErrorOptions | undefined)
1769
+ case "File":
1770
+ return Schema.File
1771
+ case "FormData":
1772
+ return Schema.FormData
1773
+ case "ReadonlyMap":
1774
+ return Schema.ReadonlyMap(typeParameters[0], typeParameters[1])
1775
+ case "ReadonlySet":
1776
+ return Schema.ReadonlySet(typeParameters[0])
1777
+ case "RegExp":
1778
+ return Schema.RegExp
1779
+ case "Uint8Array":
1780
+ return Schema.Uint8Array
1781
+ case "URL":
1782
+ return Schema.URL
1783
+ case "URLSearchParams":
1784
+ return Schema.URLSearchParams
1785
+ // effect types
1786
+ case "effect/Option":
1787
+ return Schema.Option(typeParameters[0])
1788
+ case "effect/Result":
1789
+ return Schema.Result(typeParameters[0], typeParameters[1])
1790
+ case "effect/Redacted":
1791
+ return Schema.Redacted(typeParameters[0], typeConstructor.options as any)
1792
+ case "effect/DateTime.TimeZone":
1793
+ return Schema.TimeZone
1794
+ case "effect/DateTime.TimeZone.Named":
1795
+ return Schema.TimeZoneNamed
1796
+ case "effect/DateTime.TimeZone.Offset":
1797
+ return Schema.TimeZoneOffset
1798
+ case "effect/DateTime.Utc":
1799
+ return Schema.DateTimeUtc
1800
+ case "effect/DateTime.Zoned":
1801
+ return Schema.DateTimeZoned
1802
+ case "effect/BigDecimal":
1803
+ return Schema.BigDecimal
1804
+ case "effect/Chunk":
1805
+ return Schema.Chunk(typeParameters[0])
1806
+ case "effect/Cause":
1807
+ return Schema.Cause(typeParameters[0], typeParameters[1])
1808
+ case "effect/Cause/Failure":
1809
+ return Schema.CauseReason(typeParameters[0], typeParameters[1])
1810
+ case "effect/Duration":
1811
+ return Schema.Duration
1812
+ case "effect/Exit":
1813
+ return Schema.Exit(typeParameters[0], typeParameters[1], typeParameters[2])
1814
+ case "effect/Json":
1815
+ return Schema.Json
1816
+ case "effect/MutableJson":
1817
+ return Schema.MutableJson
1818
+ case "effect/HashMap":
1819
+ return Schema.HashMap(typeParameters[0], typeParameters[1])
1820
+ case "effect/HashSet":
1821
+ return Schema.HashSet(typeParameters[0])
1822
+ }
1823
+ }
1824
+ }
1825
+
1826
+ /**
1827
+ * Creates a runtime Schema from a {@link Document}.
1828
+ *
1829
+ * **When to use**
1830
+ *
1831
+ * Use when you have a serialized or computed schema representation document and
1832
+ * need a runtime Schema for decoding/encoding.
1833
+ *
1834
+ * **Details**
1835
+ *
1836
+ * Pass `options.reviver`, such as {@link toSchemaDefaultReviver}, to handle
1837
+ * {@link Declaration} nodes for types like `Date` and `Option`. Without a
1838
+ * reviver, declarations fall back to their `encodedSchema`. Circular references
1839
+ * are handled via lazy `Schema.suspend`.
1840
+ *
1841
+ * **Gotchas**
1842
+ *
1843
+ * This throws if a `$ref` is not found in `document.references`.
1844
+ *
1845
+ * **Example** (Reconstructing a Schema)
1846
+ *
1847
+ * ```ts
1848
+ * import { Schema, SchemaRepresentation } from "effect"
1849
+ *
1850
+ * const doc = SchemaRepresentation.fromAST(
1851
+ * Schema.Struct({ name: Schema.String }).ast
1852
+ * )
1853
+ *
1854
+ * const schema = SchemaRepresentation.toSchema(doc)
1855
+ * console.log(JSON.stringify(Schema.toJsonSchemaDocument(schema), null, 2))
1856
+ * ```
1857
+ *
1858
+ * @see {@link Document}
1859
+ * @see {@link Reviver}
1860
+ * @see {@link toSchemaDefaultReviver}
1861
+ *
1862
+ * @category Runtime Generation
1863
+ * @since 4.0.0
1864
+ */
1865
+ export function toSchema<S extends Schema.Top = Schema.Top>(document: Document, options?: {
1866
+ readonly reviver?: Reviver<Schema.Top> | undefined
1867
+ }): S {
1868
+ type Slot = {
1869
+ // 0 = not started, 1 = building, 2 = done
1870
+ state: 0 | 1 | 2
1871
+ value: Schema.Top | undefined
1872
+ ref: Schema.Top
1873
+ }
1874
+
1875
+ const slots = new Map<string, Slot>()
1876
+
1877
+ return recur(document.representation) as S
1878
+
1879
+ function recur(r: Representation): Schema.Top {
1880
+ let out = on(r)
1881
+ if ("annotations" in r && r.annotations) out = out.annotate(r.annotations)
1882
+ out = toSchemaChecks(out, r)
1883
+ return out
1884
+ }
1885
+
1886
+ function getSlot(identifier: string): Slot {
1887
+ const existing = slots.get(identifier)
1888
+ if (existing) return existing
1889
+
1890
+ // Create the slot *before* resolving, so self-references can see it.
1891
+ const slot: Slot = {
1892
+ state: 0,
1893
+ value: undefined,
1894
+ ref: Schema.suspend(() => {
1895
+ if (slot.value === undefined) {
1896
+ return Schema.Unknown
1897
+ }
1898
+ return slot.value
1899
+ })
1900
+ }
1901
+ slots.set(identifier, slot)
1902
+ return slot
1903
+ }
1904
+
1905
+ function resolveReference($ref: string): Schema.Top {
1906
+ const definition = document.references[$ref]
1907
+ if (definition === undefined) {
1908
+ throw new Error(`Reference ${$ref} not found`)
1909
+ }
1910
+
1911
+ const slot = getSlot($ref)
1912
+
1913
+ if (slot.state === 2) {
1914
+ // Already built: return the built schema directly
1915
+ return slot.value!
1916
+ }
1917
+
1918
+ if (slot.state === 1) {
1919
+ // Circular: we're currently building this identifier.
1920
+ return slot.ref
1921
+ }
1922
+
1923
+ // First time: build it.
1924
+ slot.state = 1
1925
+ try {
1926
+ slot.value = recur(definition)
1927
+ slot.state = 2
1928
+ return slot.value
1929
+ } catch (e) {
1930
+ // Leave the slot in a safe state so future thunks don't silently succeed.
1931
+ slot.state = 0
1932
+ slot.value = undefined
1933
+ throw e
1934
+ }
1935
+ }
1936
+
1937
+ function on(r: Representation): Schema.Top {
1938
+ switch (r._tag) {
1939
+ case "Declaration":
1940
+ return options?.reviver?.(r, recur) ?? recur(r.encodedSchema)
1941
+ case "Reference":
1942
+ return resolveReference(r.$ref)
1943
+ case "Suspend":
1944
+ return recur(r.thunk)
1945
+ case "Null":
1946
+ return Schema.Null
1947
+ case "Undefined":
1948
+ return Schema.Undefined
1949
+ case "Void":
1950
+ return Schema.Void
1951
+ case "Never":
1952
+ return Schema.Never
1953
+ case "Unknown":
1954
+ return Schema.Unknown
1955
+ case "Any":
1956
+ return Schema.Any
1957
+ case "String": {
1958
+ const contentMediaType = r.contentMediaType
1959
+ const contentSchema = r.contentSchema
1960
+ if (contentMediaType === "application/json" && contentSchema !== undefined) {
1961
+ return Schema.fromJsonString(recur(contentSchema))
1962
+ }
1963
+ return Schema.String
1964
+ }
1965
+ case "Number":
1966
+ return Schema.Number
1967
+ case "Boolean":
1968
+ return Schema.Boolean
1969
+ case "BigInt":
1970
+ return Schema.BigInt
1971
+ case "Symbol":
1972
+ return Schema.Symbol
1973
+ case "Literal":
1974
+ return Schema.Literal(r.literal)
1975
+ case "UniqueSymbol":
1976
+ return Schema.UniqueSymbol(r.symbol)
1977
+ case "ObjectKeyword":
1978
+ return Schema.ObjectKeyword
1979
+ case "Enum":
1980
+ return Schema.Enum(Object.fromEntries(r.enums))
1981
+ case "TemplateLiteral": {
1982
+ const parts = r.parts.map(recur) as Schema.TemplateLiteral.Parts
1983
+ return Schema.TemplateLiteral(parts)
1984
+ }
1985
+ case "Arrays": {
1986
+ const elements = r.elements.map((e) => {
1987
+ const s = recur(e.type)
1988
+ return e.isOptional ? Schema.optionalKey(s) : s
1989
+ })
1990
+ const rest = r.rest.map(recur)
1991
+ if (Arr.isArrayNonEmpty(rest)) {
1992
+ if (r.elements.length === 0 && r.rest.length === 1) {
1993
+ return Schema.Array(rest[0])
1994
+ }
1995
+ return Schema.TupleWithRest(Schema.Tuple(elements), rest)
1996
+ }
1997
+ return Schema.Tuple(elements)
1998
+ }
1999
+ case "Objects": {
2000
+ const fields: Record<PropertyKey, Schema.Top> = {}
2001
+
2002
+ for (const ps of r.propertySignatures) {
2003
+ const s = recur(ps.type)
2004
+ const withOptional = ps.isOptional ? Schema.optionalKey(s) : s
2005
+ fields[ps.name] = ps.isMutable ? Schema.mutableKey(withOptional) : withOptional
2006
+ }
2007
+
2008
+ const indexSignatures = r.indexSignatures.map((is) =>
2009
+ Schema.Record(recur(is.parameter) as Schema.Record.Key, recur(is.type))
2010
+ )
2011
+
2012
+ if (Arr.isArrayNonEmpty(indexSignatures)) {
2013
+ if (r.propertySignatures.length === 0 && indexSignatures.length === 1) {
2014
+ return indexSignatures[0]
2015
+ }
2016
+ return Schema.StructWithRest(Schema.Struct(fields), indexSignatures)
2017
+ }
2018
+
2019
+ return Schema.Struct(fields)
2020
+ }
2021
+ case "Union": {
2022
+ if (r.types.length === 0) return Schema.Never
2023
+ if (r.types.every((t) => t._tag === "Literal")) {
2024
+ if (r.types.length === 1) {
2025
+ return Schema.Literal(r.types[0].literal)
2026
+ }
2027
+ return Schema.Literals(r.types.map((t) => t.literal))
2028
+ }
2029
+ return Schema.Union(r.types.map(recur), { mode: r.mode })
2030
+ }
2031
+ }
2032
+ }
2033
+
2034
+ function toSchemaChecks(top: Schema.Top, schema: Representation): Schema.Top {
2035
+ switch (schema._tag) {
2036
+ default:
2037
+ return top
2038
+ case "String":
2039
+ case "Number":
2040
+ case "BigInt":
2041
+ case "Arrays":
2042
+ case "Objects":
2043
+ case "Declaration": {
2044
+ const checks = schema.checks.map(toSchemaCheck)
2045
+ return Arr.isArrayNonEmpty(checks) ? top.check(...checks) : top
2046
+ }
2047
+ }
2048
+ }
2049
+
2050
+ function toSchemaCheck(check: Check<Meta>): SchemaAST.Check<any> {
2051
+ switch (check._tag) {
2052
+ case "Filter":
2053
+ return toSchemaFilter(check)
2054
+ case "FilterGroup": {
2055
+ return Schema.makeFilterGroup(Arr.map(check.checks, toSchemaCheck), check.annotations)
2056
+ }
2057
+ }
2058
+ }
2059
+
2060
+ function toSchemaFilter(filter: Filter<Meta>): SchemaAST.Check<any> {
2061
+ const a = filter.annotations
2062
+ switch (filter.meta._tag) {
2063
+ // String Meta
2064
+ case "isStringFinite":
2065
+ return Schema.isStringFinite(a)
2066
+ case "isStringBigInt":
2067
+ return Schema.isStringBigInt(a)
2068
+ case "isStringSymbol":
2069
+ return Schema.isStringSymbol(a)
2070
+ case "isMinLength":
2071
+ return Schema.isMinLength(filter.meta.minLength, a)
2072
+ case "isMaxLength":
2073
+ return Schema.isMaxLength(filter.meta.maxLength, a)
2074
+ case "isLengthBetween":
2075
+ return Schema.isLengthBetween(filter.meta.minimum, filter.meta.maximum, a)
2076
+ case "isPattern":
2077
+ return Schema.isPattern(filter.meta.regExp, a)
2078
+ case "isTrimmed":
2079
+ return Schema.isTrimmed(a)
2080
+ case "isUUID":
2081
+ return Schema.isUUID(filter.meta.version, a)
2082
+ case "isGUID":
2083
+ return Schema.isGUID(a)
2084
+ case "isULID":
2085
+ return Schema.isULID(a)
2086
+ case "isBase64":
2087
+ return Schema.isBase64(a)
2088
+ case "isBase64Url":
2089
+ return Schema.isBase64Url(a)
2090
+ case "isStartsWith":
2091
+ return Schema.isStartsWith(filter.meta.startsWith, a)
2092
+ case "isEndsWith":
2093
+ return Schema.isEndsWith(filter.meta.endsWith, a)
2094
+ case "isIncludes":
2095
+ return Schema.isIncludes(filter.meta.includes, a)
2096
+ case "isUppercased":
2097
+ return Schema.isUppercased(a)
2098
+ case "isLowercased":
2099
+ return Schema.isLowercased(a)
2100
+ case "isCapitalized":
2101
+ return Schema.isCapitalized(a)
2102
+ case "isUncapitalized":
2103
+ return Schema.isUncapitalized(a)
2104
+
2105
+ // Number Meta
2106
+ case "isFinite":
2107
+ return Schema.isFinite(a)
2108
+ case "isInt":
2109
+ return Schema.isInt(a)
2110
+ case "isMultipleOf":
2111
+ return Schema.isMultipleOf(filter.meta.divisor, a)
2112
+ case "isGreaterThan":
2113
+ return Schema.isGreaterThan(filter.meta.exclusiveMinimum, a)
2114
+ case "isGreaterThanOrEqualTo":
2115
+ return Schema.isGreaterThanOrEqualTo(filter.meta.minimum, a)
2116
+ case "isLessThan":
2117
+ return Schema.isLessThan(filter.meta.exclusiveMaximum, a)
2118
+ case "isLessThanOrEqualTo":
2119
+ return Schema.isLessThanOrEqualTo(filter.meta.maximum, a)
2120
+ case "isBetween":
2121
+ return Schema.isBetween(filter.meta, a)
2122
+
2123
+ // BigInt Meta
2124
+ case "isGreaterThanBigInt":
2125
+ return Schema.isGreaterThanBigInt(filter.meta.exclusiveMinimum, a)
2126
+ case "isGreaterThanOrEqualToBigInt":
2127
+ return Schema.isGreaterThanOrEqualToBigInt(filter.meta.minimum, a)
2128
+ case "isLessThanBigInt":
2129
+ return Schema.isLessThanBigInt(filter.meta.exclusiveMaximum, a)
2130
+ case "isLessThanOrEqualToBigInt":
2131
+ return Schema.isLessThanOrEqualToBigInt(filter.meta.maximum, a)
2132
+ case "isBetweenBigInt":
2133
+ return Schema.isBetweenBigInt(filter.meta, a)
2134
+
2135
+ // Object Meta
2136
+ case "isMinProperties":
2137
+ return Schema.isMinProperties(filter.meta.minProperties, a)
2138
+ case "isMaxProperties":
2139
+ return Schema.isMaxProperties(filter.meta.maxProperties, a)
2140
+ case "isPropertiesLengthBetween":
2141
+ return Schema.isPropertiesLengthBetween(filter.meta.minimum, filter.meta.maximum, a)
2142
+ case "isPropertyNames":
2143
+ return Schema.isPropertyNames(recur(filter.meta.propertyNames) as Schema.Record.Key, a)
2144
+
2145
+ // Arrays Meta
2146
+ case "isUnique":
2147
+ return Schema.isUnique(a)
2148
+
2149
+ // Date Meta
2150
+ case "isDateValid":
2151
+ return Schema.isDateValid(a)
2152
+ case "isGreaterThanDate":
2153
+ return Schema.isGreaterThanDate(filter.meta.exclusiveMinimum, a)
2154
+ case "isGreaterThanOrEqualToDate":
2155
+ return Schema.isGreaterThanOrEqualToDate(filter.meta.minimum, a)
2156
+ case "isLessThanDate":
2157
+ return Schema.isLessThanDate(filter.meta.exclusiveMaximum, a)
2158
+ case "isLessThanOrEqualToDate":
2159
+ return Schema.isLessThanOrEqualToDate(filter.meta.maximum, a)
2160
+ case "isBetweenDate":
2161
+ return Schema.isBetweenDate(filter.meta, a)
2162
+
2163
+ // Size Meta
2164
+ case "isMinSize":
2165
+ return Schema.isMinSize(filter.meta.minSize, a)
2166
+ case "isMaxSize":
2167
+ return Schema.isMaxSize(filter.meta.maxSize, a)
2168
+ case "isSizeBetween":
2169
+ return Schema.isSizeBetween(filter.meta.minimum, filter.meta.maximum, a)
2170
+ }
2171
+ }
2172
+ }
2173
+
2174
+ /**
2175
+ * Converts a {@link Document} to a Draft 2020-12 JSON Schema document.
2176
+ *
2177
+ * **When to use**
2178
+ *
2179
+ * Use when you need to produce a standard JSON Schema document from a schema
2180
+ * representation `Document`.
2181
+ *
2182
+ * **Gotchas**
2183
+ *
2184
+ * JSON Schema generation is best-effort. Some Effect schema representation
2185
+ * semantics cannot be represented exactly in JSON Schema, and importing an
2186
+ * emitted JSON Schema may produce an equivalent approximation rather than the
2187
+ * original representation shape.
2188
+ *
2189
+ * **Example** (Generating JSON Schema)
2190
+ *
2191
+ * ```ts
2192
+ * import { Schema, SchemaRepresentation } from "effect"
2193
+ *
2194
+ * const doc = SchemaRepresentation.fromAST(Schema.String.ast)
2195
+ * const jsonSchema = SchemaRepresentation.toJsonSchemaDocument(doc)
2196
+ * console.log(jsonSchema.schema.type)
2197
+ * // "string"
2198
+ * ```
2199
+ *
2200
+ * @see {@link Document}
2201
+ * @see {@link toJsonSchemaMultiDocument}
2202
+ * @see {@link fromJsonSchemaDocument}
2203
+ *
2204
+ * @category transforming
2205
+ * @since 4.0.0
2206
+ */
2207
+ export const toJsonSchemaDocument: (
2208
+ document: Document,
2209
+ options?: Schema.ToJsonSchemaOptions
2210
+ ) => JsonSchema.Document<"draft-2020-12"> = InternalRepresentation.toJsonSchemaDocument
2211
+
2212
+ /**
2213
+ * Converts a {@link MultiDocument} to a Draft 2020-12 JSON Schema
2214
+ * multi-document.
2215
+ *
2216
+ * **When to use**
2217
+ *
2218
+ * Use when you need to export related schema representation documents together
2219
+ * so shared definitions stay in multi-document JSON Schema form.
2220
+ *
2221
+ * **Gotchas**
2222
+ *
2223
+ * JSON Schema generation is best-effort. Some Effect schema representation
2224
+ * semantics cannot be represented exactly in JSON Schema, and importing an
2225
+ * emitted JSON Schema may produce equivalent approximations rather than the
2226
+ * original representation shapes.
2227
+ *
2228
+ * @see {@link MultiDocument}
2229
+ * @see {@link toJsonSchemaDocument}
2230
+ * @see {@link fromJsonSchemaMultiDocument}
2231
+ *
2232
+ * @category transforming
2233
+ * @since 4.0.0
2234
+ */
2235
+ export const toJsonSchemaMultiDocument: (
2236
+ document: MultiDocument,
2237
+ options?: Schema.ToJsonSchemaOptions
2238
+ ) => JsonSchema.MultiDocument<"draft-2020-12"> = InternalRepresentation.toJsonSchemaMultiDocument
2239
+
2240
+ /**
2241
+ * A pair of TypeScript source strings for a schema: `runtime` is the
2242
+ * executable Schema expression, `Type` is the corresponding TypeScript type.
2243
+ *
2244
+ * @see {@link makeCode}
2245
+ * @see {@link CodeDocument}
2246
+ *
2247
+ * @category Code Generation
2248
+ * @since 4.0.0
2249
+ */
2250
+ export type Code = {
2251
+ readonly runtime: string
2252
+ readonly Type: string
2253
+ }
2254
+
2255
+ /**
2256
+ * Constructs a {@link Code} value from a runtime expression string and a
2257
+ * TypeScript type string.
2258
+ *
2259
+ * @see {@link Code}
2260
+ *
2261
+ * @category Code Generation
2262
+ * @since 4.0.0
2263
+ */
2264
+ export function makeCode(runtime: string, Type: string): Code {
2265
+ return { runtime, Type }
2266
+ }
2267
+
2268
+ /**
2269
+ * An auxiliary code artifact produced during code generation — a symbol
2270
+ * declaration, an enum declaration, or an import statement.
2271
+ *
2272
+ * @see {@link CodeDocument}
2273
+ * @see {@link toCodeDocument}
2274
+ *
2275
+ * @category Code Generation
2276
+ * @since 4.0.0
2277
+ */
2278
+ export type Artifact =
2279
+ | {
2280
+ readonly _tag: "Symbol"
2281
+ readonly identifier: string
2282
+ readonly generation: Code
2283
+ }
2284
+ | {
2285
+ readonly _tag: "Enum"
2286
+ readonly identifier: string
2287
+ readonly generation: Code
2288
+ }
2289
+ | {
2290
+ readonly _tag: "Import"
2291
+ readonly importDeclaration: string
2292
+ }
2293
+
2294
+ /**
2295
+ * The output of {@link toCodeDocument}: generated TypeScript code for one or
2296
+ * more schemas plus their shared references and auxiliary artifacts.
2297
+ *
2298
+ * **Details**
2299
+ *
2300
+ * `codes` contains one {@link Code} per input representation.
2301
+ * `references.nonRecursives` contains topologically sorted non-recursive
2302
+ * definitions. `references.recursives` contains definitions involved in cycles.
2303
+ * `artifacts` contains symbols, enums, and import statements needed by the
2304
+ * code.
2305
+ *
2306
+ * @see {@link toCodeDocument}
2307
+ * @see {@link Code}
2308
+ * @see {@link Artifact}
2309
+ *
2310
+ * @category Code Generation
2311
+ * @since 4.0.0
2312
+ */
2313
+ export type CodeDocument = {
2314
+ readonly codes: ReadonlyArray<Code>
2315
+ readonly references: {
2316
+ readonly nonRecursives: ReadonlyArray<{
2317
+ readonly $ref: string
2318
+ readonly code: Code
2319
+ }>
2320
+ readonly recursives: {
2321
+ readonly [$ref: string]: Code
2322
+ }
2323
+ }
2324
+ readonly artifacts: ReadonlyArray<Artifact>
2325
+ }
2326
+
2327
+ /**
2328
+ * Generates TypeScript code strings from a {@link MultiDocument}.
2329
+ *
2330
+ * **When to use**
2331
+ *
2332
+ * Use when you need to produce source code for Effect Schema definitions from a
2333
+ * schema representation `MultiDocument`.
2334
+ *
2335
+ * **Details**
2336
+ *
2337
+ * `options.reviver` can customize code generation for {@link Declaration}
2338
+ * nodes. Return `undefined` to fall back to the default logic, which uses
2339
+ * `generation` annotations or the encoded schema. References are
2340
+ * topologically sorted so non-recursive definitions are emitted before their
2341
+ * dependents. `$ref` keys are converted to sanitized JavaScript identifiers.
2342
+ *
2343
+ * **Example** (Generating TypeScript code)
2344
+ *
2345
+ * ```ts
2346
+ * import { Schema, SchemaRepresentation } from "effect"
2347
+ *
2348
+ * const Person = Schema.Struct({
2349
+ * name: Schema.String,
2350
+ * age: Schema.Int
2351
+ * })
2352
+ *
2353
+ * const multi = SchemaRepresentation.toMultiDocument(
2354
+ * SchemaRepresentation.fromAST(Person.ast)
2355
+ * )
2356
+ * const codeDoc = SchemaRepresentation.toCodeDocument(multi)
2357
+ * console.log(codeDoc.codes[0].runtime)
2358
+ * // Schema.Struct({ ... })
2359
+ * ```
2360
+ *
2361
+ * @see {@link CodeDocument}
2362
+ * @see {@link MultiDocument}
2363
+ * @see {@link Reviver}
2364
+ *
2365
+ * @category Code Generation
2366
+ * @since 4.0.0
2367
+ */
2368
+ export function toCodeDocument(multiDocument: MultiDocument, options?: {
2369
+ /**
2370
+ * The reviver can return `undefined` to indicate that the generation should be generated by the default logic
2371
+ */
2372
+ readonly reviver?: Reviver<Code> | undefined
2373
+ }): CodeDocument {
2374
+ const artifacts: Array<Artifact> = []
2375
+
2376
+ const ts = topologicalSort(multiDocument.references)
2377
+
2378
+ // Phase 1: Build sanitization map with collision handling
2379
+ const sanitizedReferenceMap = new Map<string, string>()
2380
+ const uniqueSanitizedReferences = new Set<string>()
2381
+ const referenceCount = new Map<string, number>()
2382
+
2383
+ // Process all references first to build the map
2384
+ const allRefs = [
2385
+ ...ts.nonRecursives.map(({ $ref }) => $ref),
2386
+ ...Object.keys(ts.recursives)
2387
+ ]
2388
+
2389
+ for (const ref of allRefs) {
2390
+ ensureUniqueSanitized(ref)
2391
+ }
2392
+
2393
+ // Phase 2: Use the map when processing references
2394
+ const nonRecursives = ts.nonRecursives.map(({ $ref, representation }) => ({
2395
+ $ref: sanitizedReferenceMap.get($ref)!,
2396
+ code: recur(representation)
2397
+ }))
2398
+ const recursives = Rec.mapEntries(ts.recursives, (representation, $ref) => [
2399
+ sanitizedReferenceMap.get($ref)!,
2400
+ recur(representation)
2401
+ ])
2402
+
2403
+ const codes = multiDocument.representations.map(recur)
2404
+
2405
+ return {
2406
+ codes,
2407
+ references: {
2408
+ nonRecursives: nonRecursives.filter(({ $ref }) => (referenceCount.get($ref) ?? 0) > 0),
2409
+ recursives: Rec.filter(recursives, (_, $ref) => (referenceCount.get($ref) ?? 0) > 0)
2410
+ },
2411
+ artifacts
2412
+ }
2413
+
2414
+ function ensureUniqueSanitized(originalRef: string): string {
2415
+ // Check if already mapped (consistency)
2416
+ const sanitized = sanitizedReferenceMap.get(originalRef)
2417
+ if (sanitized !== undefined) {
2418
+ return sanitized
2419
+ }
2420
+
2421
+ // Find unique sanitized name
2422
+ const seed = sanitizeJavaScriptIdentifier(originalRef)
2423
+ let candidate = seed
2424
+ let suffix = 0
2425
+
2426
+ while (uniqueSanitizedReferences.has(candidate)) {
2427
+ candidate = `${seed}${++suffix}`
2428
+ }
2429
+
2430
+ uniqueSanitizedReferences.add(candidate)
2431
+ sanitizedReferenceMap.set(originalRef, candidate)
2432
+ return candidate
2433
+ }
2434
+
2435
+ function addSymbol(s: symbol): string {
2436
+ const identifier = ensureUniqueSanitized("_symbol")
2437
+ const key = globalThis.Symbol.keyFor(s)
2438
+ const description = s.description
2439
+ const generation = key === undefined
2440
+ ? makeCode(`Symbol(${description === undefined ? "" : format(description)})`, `typeof ${identifier}`)
2441
+ : makeCode(`Symbol.for(${format(key)})`, `typeof ${identifier}`)
2442
+ artifacts.push({ _tag: "Symbol", identifier, generation })
2443
+ return identifier
2444
+ }
2445
+
2446
+ function addEnum(s: Enum): string {
2447
+ const identifier = ensureUniqueSanitized("_Enum")
2448
+ artifacts.push({
2449
+ _tag: "Enum",
2450
+ identifier,
2451
+ generation: makeCode(
2452
+ `enum ${identifier} { ${s.enums.map(([name, value]) => `${format(name)}: ${format(value)}`).join(", ")} }`,
2453
+ `typeof ${identifier}`
2454
+ )
2455
+ })
2456
+ return identifier
2457
+ }
2458
+
2459
+ function addImport(importDeclaration: string) {
2460
+ if (!artifacts.some((a) => a._tag === "Import" && a.importDeclaration === importDeclaration)) {
2461
+ artifacts.push({ _tag: "Import", importDeclaration })
2462
+ }
2463
+ }
2464
+
2465
+ function recur(s: Representation): Code {
2466
+ const g = on(s)
2467
+ switch (s._tag) {
2468
+ default:
2469
+ return makeCode(
2470
+ g.runtime + toRuntimeAnnotate(s.annotations) + toRuntimeBrand(s.annotations),
2471
+ g.Type + toTypeBrand(s.annotations)
2472
+ )
2473
+ case "Reference":
2474
+ return g
2475
+ case "Declaration":
2476
+ case "String":
2477
+ case "Number":
2478
+ case "BigInt":
2479
+ case "Arrays":
2480
+ case "Objects":
2481
+ case "Suspend":
2482
+ return makeCode(
2483
+ g.runtime + toRuntimeAnnotate(s.annotations) + toRuntimeBrand(s.annotations) + toRuntimeChecks(s.checks),
2484
+ g.Type + toTypeBrand(s.annotations) + toTypeChecks(s.checks)
2485
+ )
2486
+ }
2487
+ }
2488
+
2489
+ function on(s: Representation): Code {
2490
+ switch (s._tag) {
2491
+ case "Declaration": {
2492
+ // if there is a reviver, use it to generate the generation
2493
+ if (options?.reviver !== undefined) {
2494
+ // the reviver can return `undefined` to indicate that the generation should be generated by the default logic
2495
+ const out = options.reviver(s, recur)
2496
+ if (out !== undefined) {
2497
+ return out
2498
+ }
2499
+ }
2500
+ // otherwise, use the generation from the annotations
2501
+ const generation = s.annotations?.generation
2502
+ if (
2503
+ Predicate.isObject(generation) && typeof generation.runtime === "string" &&
2504
+ typeof generation.Type === "string"
2505
+ ) {
2506
+ const typeParameters = s.typeParameters.map(recur)
2507
+ if (typeof generation.importDeclaration === "string") {
2508
+ addImport(generation.importDeclaration)
2509
+ }
2510
+ return makeCode(
2511
+ replacePlaceholders(generation.runtime, typeParameters.map((p) => p.runtime)),
2512
+ replacePlaceholders(generation.Type, typeParameters.map((p) => p.Type))
2513
+ )
2514
+ }
2515
+ // otherwise, use the generation from the encoded schema
2516
+ return recur(s.encodedSchema)
2517
+ }
2518
+ case "Reference": {
2519
+ const sanitized = ensureUniqueSanitized(s.$ref)
2520
+ referenceCount.set(sanitized, (referenceCount.get(sanitized) ?? 0) + 1)
2521
+ return makeCode(sanitized, sanitized)
2522
+ }
2523
+ case "Suspend": {
2524
+ const thunk = recur(s.thunk)
2525
+ return makeCode(
2526
+ `Schema.suspend((): Schema.Codec<${thunk.Type}> => ${thunk.runtime})`,
2527
+ thunk.Type
2528
+ )
2529
+ }
2530
+ case "Null":
2531
+ return makeCode(`Schema.Null`, "null")
2532
+ case "Undefined":
2533
+ return makeCode(`Schema.Undefined`, "undefined")
2534
+ case "Void":
2535
+ return makeCode(`Schema.Void`, "void")
2536
+ case "Never":
2537
+ return makeCode(`Schema.Never`, "never")
2538
+ case "Unknown":
2539
+ return makeCode(`Schema.Unknown`, "unknown")
2540
+ case "Any":
2541
+ return makeCode(`Schema.Any`, "any")
2542
+ case "Number":
2543
+ return makeCode(`Schema.Number`, "number")
2544
+ case "Boolean":
2545
+ return makeCode(`Schema.Boolean`, "boolean")
2546
+ case "BigInt":
2547
+ return makeCode(`Schema.BigInt`, "bigint")
2548
+ case "Symbol":
2549
+ return makeCode(`Schema.Symbol`, "symbol")
2550
+ case "String": {
2551
+ const contentMediaType = s.contentMediaType
2552
+ const contentSchema = s.contentSchema
2553
+ if (contentMediaType === "application/json" && contentSchema !== undefined) {
2554
+ return makeCode(`Schema.fromJsonString(${recur(contentSchema)})`, "string")
2555
+ } else {
2556
+ return makeCode(`Schema.String`, "string")
2557
+ }
2558
+ }
2559
+ case "Literal": {
2560
+ const literal = format(s.literal)
2561
+ return makeCode(`Schema.Literal(${literal})`, literal)
2562
+ }
2563
+ case "UniqueSymbol": {
2564
+ const identifier = addSymbol(s.symbol)
2565
+ return makeCode(`Schema.UniqueSymbol(${identifier})`, `typeof ${identifier}`)
2566
+ }
2567
+ case "ObjectKeyword":
2568
+ return makeCode(`Schema.ObjectKeyword`, "object")
2569
+ case "Enum": {
2570
+ const identifier = addEnum(s)
2571
+ return makeCode(`Schema.Enum(${identifier})`, `typeof ${identifier}`)
2572
+ }
2573
+ case "TemplateLiteral": {
2574
+ const parts = s.parts.map(recur)
2575
+ const type = toTypeParts(s.parts).map((p) => "`" + p + "`").join(" | ")
2576
+ return makeCode(`Schema.TemplateLiteral([${parts.map((p) => p.runtime).join(", ")}])`, type)
2577
+ }
2578
+ case "Arrays": {
2579
+ const elements = s.elements.map((e) => {
2580
+ return {
2581
+ isOptional: e.isOptional,
2582
+ type: recur(e.type),
2583
+ annotations: e.annotations
2584
+ }
2585
+ })
2586
+
2587
+ const rest = s.rest.map(recur)
2588
+
2589
+ if (Arr.isArrayNonEmpty(rest)) {
2590
+ const item = rest[0]
2591
+ if (elements.length === 0 && rest.length === 1) {
2592
+ return makeCode(
2593
+ `Schema.Array(${item.runtime})`,
2594
+ `ReadonlyArray<${item.Type}>`
2595
+ )
2596
+ }
2597
+ const post = rest.slice(1)
2598
+ return makeCode(
2599
+ `Schema.TupleWithRest(Schema.Tuple([${
2600
+ elements.map((e) =>
2601
+ toRuntimeIsOptional(e.isOptional, e.type.runtime) + toRuntimeAnnotateKey(e.annotations)
2602
+ ).join(", ")
2603
+ }]), [${rest.map((r) => r.runtime).join(", ")}])`,
2604
+ `readonly [${
2605
+ elements.map((e) => toTypeIsOptional(e.isOptional, e.type.Type)).join(", ")
2606
+ }, ...Array<${item.Type}>${post.length > 0 ? `, ${post.map((p) => p.Type).join(", ")}` : ""}]`
2607
+ )
2608
+ }
2609
+ return makeCode(
2610
+ `Schema.Tuple([${
2611
+ elements.map((e) => toRuntimeIsOptional(e.isOptional, e.type.runtime) + toRuntimeAnnotateKey(e.annotations))
2612
+ .join(", ")
2613
+ }])`,
2614
+ `readonly [${elements.map((e) => toTypeIsOptional(e.isOptional, e.type.Type)).join(", ")}]`
2615
+ )
2616
+ }
2617
+ case "Objects": {
2618
+ const pss = s.propertySignatures.map((p) => {
2619
+ const isSymbol = typeof p.name === "symbol"
2620
+ const name = isSymbol ? addSymbol(p.name) : formatPropertyKey(p.name)
2621
+ const nameType = toTypeIsOptional(
2622
+ p.isOptional,
2623
+ toTypeIsMutable(p.isMutable, isSymbol ? `[typeof ${name}]` : name)
2624
+ )
2625
+ const type = recur(p.type)
2626
+ return makeCode(
2627
+ `${isSymbol ? `[${name}]` : name}: ${
2628
+ toRuntimeIsOptional(p.isOptional, toRuntimeIsMutable(p.isMutable, type.runtime))
2629
+ }` +
2630
+ toRuntimeAnnotateKey(p.annotations),
2631
+ `${nameType}: ${type.Type}`
2632
+ )
2633
+ })
2634
+
2635
+ const iss = s.indexSignatures.map((is) => {
2636
+ return {
2637
+ parameter: recur(is.parameter),
2638
+ type: recur(is.type)
2639
+ }
2640
+ })
2641
+
2642
+ if (iss.length === 0) {
2643
+ // 1) Only properties -> Struct
2644
+ return makeCode(
2645
+ `Schema.Struct({ ${pss.map((p) => p.runtime).join(", ")} })`,
2646
+ `{ ${pss.map((p) => p.Type).join(", ")} }`
2647
+ )
2648
+ } else if (pss.length === 0 && iss.length === 1) {
2649
+ // 2) Only one index signature and no properties -> Record
2650
+ return makeCode(
2651
+ `Schema.Record(${iss[0].parameter.runtime}, ${iss[0].type.runtime})`,
2652
+ `{ readonly [x: ${iss[0].parameter.Type}]: ${iss[0].type.Type} }`
2653
+ )
2654
+ } else {
2655
+ // 3) Properties + index signatures -> StructWithRest
2656
+ return makeCode(
2657
+ `Schema.StructWithRest(Schema.Struct({ ${pss.map((p) => p.runtime).join(", ")} }), [${
2658
+ iss.map((is) => `Schema.Record(${is.parameter.runtime}, ${is.type.runtime})`).join(", ")
2659
+ }])`,
2660
+ `{ ${pss.map((p) => p.Type).join(", ")}, ${
2661
+ iss.map((is) => `readonly [x: ${is.parameter.Type}]: ${is.type.Type}`).join(", ")
2662
+ } }`
2663
+ )
2664
+ }
2665
+ }
2666
+ case "Union": {
2667
+ if (s.types.length === 0) {
2668
+ return makeCode("Schema.Never", "never")
2669
+ }
2670
+ if (s.types.every((t) => t._tag === "Literal")) {
2671
+ const literals = s.types.map((l) => format(l.literal))
2672
+ if (literals.length === 1) {
2673
+ return makeCode(`Schema.Literal(${literals[0]})`, literals[0])
2674
+ }
2675
+ return makeCode(`Schema.Literals([${literals.join(", ")}])`, literals.join(" | "))
2676
+ }
2677
+ const mode = s.mode === "anyOf" ? "" : `, { mode: "oneOf" }`
2678
+ const types = s.types.map((t) => recur(t))
2679
+ return makeCode(
2680
+ `Schema.Union([${types.map((t) => t.runtime).join(", ")}]${mode})`,
2681
+ types.map((t) => t.Type).join(" | ")
2682
+ )
2683
+ }
2684
+ }
2685
+ }
2686
+
2687
+ function toTypeBrand(annotations: Schema.Annotations.Annotations | undefined): string {
2688
+ const brands = collectBrands(annotations)
2689
+ if (brands.length === 0) return ""
2690
+ addImport(`import type * as Brand from "effect/Brand"`)
2691
+ return brands.map((b) => ` & Brand.Brand<${format(b)}>`).join("")
2692
+ }
2693
+
2694
+ function toTypeChecks(checks: ReadonlyArray<Check<Meta>>): string {
2695
+ return checks.map((c) => toTypeCheck(c)).join("")
2696
+ }
2697
+
2698
+ function toTypeCheck(check: Check<Meta>): string {
2699
+ switch (check._tag) {
2700
+ case "Filter":
2701
+ return toTypeBrand(check.annotations)
2702
+ case "FilterGroup": {
2703
+ return toTypeChecks(check.checks)
2704
+ }
2705
+ }
2706
+ }
2707
+
2708
+ function toRuntimeChecks(checks: ReadonlyArray<Check<Meta>>): string {
2709
+ return checks.map((c) => `.check(${toRuntimeCheck(c)})` + toRuntimeBrand(c.annotations)).join("")
2710
+ }
2711
+
2712
+ function toRuntimeCheck(check: Check<Meta>): string {
2713
+ switch (check._tag) {
2714
+ case "Filter":
2715
+ return toRuntimeFilter(check)
2716
+ case "FilterGroup": {
2717
+ const a = toRuntimeAnnotations(check.annotations)
2718
+ const ca = a === "" ? "" : `, ${a}`
2719
+ return `Schema.makeFilterGroup([${check.checks.map((c) => toRuntimeCheck(c)).join(", ")}]${ca})`
2720
+ }
2721
+ }
2722
+ }
2723
+
2724
+ function toRuntimeFilter(filter: Filter<Meta>): string {
2725
+ const a = toRuntimeAnnotations(filter.annotations)
2726
+ const ca = a === "" ? "" : `, ${a}`
2727
+ switch (filter.meta._tag) {
2728
+ case "isTrimmed":
2729
+ case "isGUID":
2730
+ case "isULID":
2731
+ case "isBase64":
2732
+ case "isBase64Url":
2733
+ case "isUppercased":
2734
+ case "isLowercased":
2735
+ case "isCapitalized":
2736
+ case "isUncapitalized":
2737
+ case "isFinite":
2738
+ case "isInt":
2739
+ case "isUnique":
2740
+ case "isDateValid":
2741
+ return `Schema.${filter.meta._tag}(${a})`
2742
+
2743
+ case "isStringFinite":
2744
+ case "isStringBigInt":
2745
+ case "isStringSymbol":
2746
+ case "isPattern":
2747
+ return `Schema.${filter.meta._tag}(${toRuntimeRegExp(filter.meta.regExp)}${ca})`
2748
+
2749
+ case "isMinLength":
2750
+ return `Schema.isMinLength(${filter.meta.minLength}${ca})`
2751
+ case "isMaxLength":
2752
+ return `Schema.isMaxLength(${filter.meta.maxLength}${ca})`
2753
+ case "isLengthBetween":
2754
+ return `Schema.isLengthBetween(${filter.meta.minimum}, ${filter.meta.maximum}${ca})`
2755
+ case "isUUID":
2756
+ return `Schema.isUUID(${filter.meta.version}${ca})`
2757
+ case "isStartsWith":
2758
+ return `Schema.isStartsWith(${format(filter.meta.startsWith)}${ca})`
2759
+ case "isEndsWith":
2760
+ return `Schema.isEndsWith(${format(filter.meta.endsWith)}${ca})`
2761
+ case "isIncludes":
2762
+ return `Schema.isIncludes(${format(filter.meta.includes)}${ca})`
2763
+
2764
+ case "isGreaterThan":
2765
+ case "isGreaterThanBigInt":
2766
+ case "isGreaterThanDate":
2767
+ return `Schema.${filter.meta._tag}(${toRuntimeValue(filter.meta.exclusiveMinimum)}${ca})`
2768
+ case "isGreaterThanOrEqualTo":
2769
+ case "isGreaterThanOrEqualToBigInt":
2770
+ case "isGreaterThanOrEqualToDate":
2771
+ return `Schema.${filter.meta._tag}(${toRuntimeValue(filter.meta.minimum)}${ca})`
2772
+ case "isLessThan":
2773
+ case "isLessThanBigInt":
2774
+ case "isLessThanDate":
2775
+ return `Schema.${filter.meta._tag}(${toRuntimeValue(filter.meta.exclusiveMaximum)}${ca})`
2776
+ case "isLessThanOrEqualTo":
2777
+ case "isLessThanOrEqualToBigInt":
2778
+ case "isLessThanOrEqualToDate":
2779
+ return `Schema.${filter.meta._tag}(${toRuntimeValue(filter.meta.maximum)}${ca})`
2780
+ case "isBetween":
2781
+ case "isBetweenBigInt":
2782
+ case "isBetweenDate":
2783
+ return `Schema.${filter.meta._tag}({ minimum: ${toRuntimeValue(filter.meta.minimum)}, maximum: ${
2784
+ toRuntimeValue(filter.meta.maximum)
2785
+ }, exclusiveMinimum: ${toRuntimeValue(filter.meta.exclusiveMinimum)}, exclusiveMaximum: ${
2786
+ toRuntimeValue(filter.meta.exclusiveMaximum)
2787
+ }${ca})`
2788
+
2789
+ case "isMultipleOf":
2790
+ return `Schema.isMultipleOf(${filter.meta.divisor}${ca})`
2791
+
2792
+ case "isMinProperties":
2793
+ return `Schema.isMinProperties(${filter.meta.minProperties}${ca})`
2794
+ case "isMaxProperties":
2795
+ return `Schema.isMaxProperties(${filter.meta.maxProperties}${ca})`
2796
+ case "isPropertiesLengthBetween":
2797
+ return `Schema.isPropertiesLengthBetween(${filter.meta.minimum}, ${filter.meta.maximum}${ca})`
2798
+ case "isPropertyNames":
2799
+ return `Schema.isPropertyNames(${recur(filter.meta.propertyNames).runtime}${ca})`
2800
+
2801
+ case "isMinSize":
2802
+ return `Schema.isMinSize(${filter.meta.minSize}${ca})`
2803
+ case "isMaxSize":
2804
+ return `Schema.isMaxSize(${filter.meta.maxSize}${ca})`
2805
+ case "isSizeBetween":
2806
+ return `Schema.isSizeBetween(${filter.meta.minimum}, ${filter.meta.maximum}${ca})`
2807
+ }
2808
+ }
2809
+ }
2810
+
2811
+ const VALID_ASCII_UPPER_JAVASCRIPT_IDENTIFIER_REGEXP = /^[A-Z_$][A-Za-z0-9_$]*$/
2812
+
2813
+ /**
2814
+ * Converts an arbitrary string into a valid (ASCII) JavaScript identifier
2815
+ * starting with an uppercase letter, `$`, or `_`.
2816
+ *
2817
+ * - Replaces invalid identifier characters with `_`
2818
+ * - Uppercases a leading ASCII letter
2819
+ * - If the first character is a digit, prefixes `_`
2820
+ * - Empty input becomes `_`
2821
+ *
2822
+ * @internal
2823
+ */
2824
+ export function sanitizeJavaScriptIdentifier(s: string): string {
2825
+ if (s.length === 0) return "_"
2826
+ if (VALID_ASCII_UPPER_JAVASCRIPT_IDENTIFIER_REGEXP.test(s)) return s
2827
+
2828
+ const out: Array<string> = []
2829
+ let needsPrefix = false
2830
+ let i = 0
2831
+
2832
+ for (const ch of s) {
2833
+ if (i === 0) {
2834
+ if (ch === "_" || ch === "$" || (ch >= "A" && ch <= "Z")) {
2835
+ out.push(ch)
2836
+ } else if (ch >= "a" && ch <= "z") {
2837
+ out.push(ch.toUpperCase())
2838
+ } else if (ch >= "0" && ch <= "9") {
2839
+ out.push(ch)
2840
+ needsPrefix = true
2841
+ } else {
2842
+ out.push("_")
2843
+ }
2844
+ } else {
2845
+ out.push(isAsciiIdPart(ch) ? ch : "_")
2846
+ }
2847
+ i++
2848
+ }
2849
+
2850
+ return needsPrefix ? "_" + out.join("") : out.join("")
2851
+ }
2852
+
2853
+ function isAsciiIdStart(ch: string): boolean {
2854
+ return (
2855
+ ch === "_" ||
2856
+ ch === "$" ||
2857
+ (ch >= "A" && ch <= "Z") ||
2858
+ (ch >= "a" && ch <= "z")
2859
+ )
2860
+ }
2861
+
2862
+ function isAsciiIdPart(ch: string): boolean {
2863
+ return isAsciiIdStart(ch) || (ch >= "0" && ch <= "9")
2864
+ }
2865
+
2866
+ function replacePlaceholders(template: string, items: ReadonlyArray<string>) {
2867
+ let i = 0
2868
+ return template.replace(/\?/g, () => items[i++])
2869
+ }
2870
+
2871
+ function toTypeParts(parts: ReadonlyArray<Representation>): ReadonlyArray<string> {
2872
+ if (parts.length === 0) {
2873
+ return [""]
2874
+ }
2875
+ const [first, ...rest] = parts
2876
+ const restPatterns = toTypeParts(rest)
2877
+ return toTypePart(first).flatMap((f) => restPatterns.map((r) => f + r))
2878
+ }
2879
+
2880
+ function toTypePart(r: Representation): ReadonlyArray<string> {
2881
+ switch (r._tag) {
2882
+ case "Literal":
2883
+ return [globalThis.String(r.literal)]
2884
+ case "String":
2885
+ return ["${string}"]
2886
+ case "Number":
2887
+ return ["${number}"]
2888
+ case "BigInt":
2889
+ return ["${bigint}"]
2890
+ case "TemplateLiteral":
2891
+ return toTypeParts(r.parts)
2892
+ case "Union":
2893
+ return r.types.flatMap(toTypePart)
2894
+ default:
2895
+ return []
2896
+ }
2897
+ }
2898
+
2899
+ const toCodeAnnotationsBlacklist: Set<string> = new Set([
2900
+ ...toJsonAnnotationsBlacklist,
2901
+ "typeConstructor",
2902
+ "generation",
2903
+ "brands"
2904
+ ])
2905
+
2906
+ function toRuntimeAnnotations(annotations: Schema.Annotations.Annotations | undefined): string {
2907
+ if (!annotations) return ""
2908
+ const entries: Array<string> = []
2909
+ for (const [key, value] of Object.entries(annotations)) {
2910
+ if (toCodeAnnotationsBlacklist.has(key)) continue
2911
+ entries.push(`${formatPropertyKey(key)}: ${format(value)}`)
2912
+ }
2913
+ if (entries.length === 0) return ""
2914
+ return `{ ${entries.join(", ")} }`
2915
+ }
2916
+
2917
+ function toRuntimeBrand(annotations: Schema.Annotations.Annotations | undefined): string {
2918
+ const brands = collectBrands(annotations)
2919
+ return brands.length > 0 ? `.pipe(${brands.map((b) => `Schema.brand(${format(b)})`).join(", ")})` : ""
2920
+ }
2921
+
2922
+ function toRuntimeAnnotate(annotations: Schema.Annotations.Annotations | undefined): string {
2923
+ const s = toRuntimeAnnotations(annotations)
2924
+ return s === "" ? "" : `.annotate(${s})`
2925
+ }
2926
+
2927
+ function toRuntimeAnnotateKey(annotations: Schema.Annotations.Annotations | undefined): string {
2928
+ const s = toRuntimeAnnotations(annotations)
2929
+ return s === "" ? "" : `.annotateKey(${s})`
2930
+ }
2931
+
2932
+ function toRuntimeIsOptional(isOptional: boolean, runtime: string): string {
2933
+ return isOptional ? `Schema.optionalKey(${runtime})` : runtime
2934
+ }
2935
+
2936
+ function toTypeIsOptional(isOptional: boolean, type: string): string {
2937
+ return isOptional ? `${type}?` : type
2938
+ }
2939
+
2940
+ function toRuntimeIsMutable(isMutable: boolean, runtime: string): string {
2941
+ return isMutable ? `Schema.mutableKey(${runtime})` : runtime
2942
+ }
2943
+
2944
+ function toTypeIsMutable(isMutable: boolean, type: string): string {
2945
+ return isMutable ? type : `readonly ${type}`
2946
+ }
2947
+
2948
+ function toRuntimeValue(value: undefined | number | boolean | bigint | Date): string {
2949
+ if (value instanceof Date) {
2950
+ return `new Date(${value.getTime()})`
2951
+ }
2952
+ return format(value)
2953
+ }
2954
+
2955
+ function toRuntimeRegExp(regExp: RegExp): string {
2956
+ const args = [format(regExp.source)]
2957
+ const flags = regExp.flags.trim()
2958
+ if (flags !== "") {
2959
+ args.push(format(flags))
2960
+ }
2961
+ return `new RegExp(${args.join(", ")})`
2962
+ }
2963
+
2964
+ /**
2965
+ * Parses a Draft 2020-12 JSON Schema document into a {@link Document}.
2966
+ *
2967
+ * **When to use**
2968
+ *
2969
+ * Use when you need to import a Draft 2020-12 JSON Schema document into the
2970
+ * Effect schema representation system.
2971
+ *
2972
+ * **Details**
2973
+ *
2974
+ * `options.onEnter` is an optional hook called on each JSON Schema node before
2975
+ * processing, allowing pre-transformation.
2976
+ *
2977
+ * **Gotchas**
2978
+ *
2979
+ * JSON Schema import is best-effort. Some JSON Schema constructs do not map
2980
+ * exactly to Effect schema representations, and importing a schema previously
2981
+ * emitted by `toJsonSchemaDocument` may produce an equivalent approximation
2982
+ * rather than the original representation shape.
2983
+ *
2984
+ * This throws if a `$ref` cannot be resolved within the document's definitions.
2985
+ * Circular `$ref`s are detected and cause an error.
2986
+ *
2987
+ * @see {@link Document}
2988
+ * @see {@link toJsonSchemaDocument}
2989
+ * @see {@link fromJsonSchemaMultiDocument}
2990
+ *
2991
+ * @category constructors
2992
+ * @since 4.0.0
2993
+ */
2994
+ export function fromJsonSchemaDocument(document: JsonSchema.Document<"draft-2020-12">, options?: {
2995
+ readonly onEnter?: ((js: JsonSchema.JsonSchema) => JsonSchema.JsonSchema) | undefined
2996
+ }): Document {
2997
+ const { references, representations: schemas } = fromJsonSchemaMultiDocument({
2998
+ dialect: document.dialect,
2999
+ schemas: [document.schema],
3000
+ definitions: document.definitions
3001
+ }, options)
3002
+ return {
3003
+ representation: schemas[0],
3004
+ references
3005
+ }
3006
+ }
3007
+
3008
+ /**
3009
+ * Parses a Draft 2020-12 JSON Schema multi-document into a
3010
+ * {@link MultiDocument}.
3011
+ *
3012
+ * **When to use**
3013
+ *
3014
+ * Use when you need to import a Draft 2020-12 JSON Schema multi-document whose
3015
+ * schemas share definitions.
3016
+ *
3017
+ * **Details**
3018
+ *
3019
+ * `options.onEnter` is an optional hook called on each JSON Schema node before
3020
+ * processing.
3021
+ *
3022
+ * **Gotchas**
3023
+ *
3024
+ * JSON Schema import is best-effort. Some JSON Schema constructs do not map
3025
+ * exactly to Effect schema representations, and importing schemas previously
3026
+ * emitted by `toJsonSchemaMultiDocument` may produce equivalent approximations
3027
+ * rather than the original representation shapes.
3028
+ *
3029
+ * This throws if a `$ref` cannot be resolved.
3030
+ *
3031
+ * @see {@link MultiDocument}
3032
+ * @see {@link toJsonSchemaMultiDocument}
3033
+ * @see {@link fromJsonSchemaDocument}
3034
+ *
3035
+ * @category constructors
3036
+ * @since 4.0.0
3037
+ */
3038
+ export function fromJsonSchemaMultiDocument(document: JsonSchema.MultiDocument<"draft-2020-12">, options?: {
3039
+ readonly onEnter?: ((js: JsonSchema.JsonSchema) => JsonSchema.JsonSchema) | undefined
3040
+ }): MultiDocument {
3041
+ let visited: Set<string>
3042
+ const references: Record<string, Representation> = {}
3043
+
3044
+ type Slot = {
3045
+ // 0 = not started, 1 = building, 2 = done
3046
+ state: 0 | 1 | 2
3047
+ value: Exclude<Representation, { _tag: "Reference" }> | undefined
3048
+ }
3049
+
3050
+ const slots = new Map<string, Slot>()
3051
+
3052
+ function getSlot(identifier: string): Slot {
3053
+ const existing = slots.get(identifier)
3054
+ if (existing) return existing
3055
+
3056
+ // Create the slot *before* resolving, so self-references can see it.
3057
+ const slot: Slot = {
3058
+ state: 0,
3059
+ value: undefined
3060
+ }
3061
+ slots.set(identifier, slot)
3062
+ return slot
3063
+ }
3064
+
3065
+ function resolveReference($ref: string): Exclude<Representation, { _tag: "Reference" }> {
3066
+ const definition = document.definitions[$ref]
3067
+ if (definition === undefined) {
3068
+ throw new Error(`Reference ${$ref} not found`)
3069
+ }
3070
+
3071
+ const slot = getSlot($ref)
3072
+
3073
+ if (slot.state === 2) {
3074
+ // Already built: return the built schema directly
3075
+ return slot.value!
3076
+ }
3077
+
3078
+ if (slot.state === 1) {
3079
+ // Circular: we're currently building this identifier.
3080
+ throw new Error(`Circular reference detected: ${$ref}`)
3081
+ }
3082
+
3083
+ // First time: build it.
3084
+ slot.state = 1
3085
+ const value = recur(definition)
3086
+
3087
+ slot.value = value._tag === "Reference" ? resolveReference(value.$ref) : value
3088
+ slot.state = 2
3089
+ return slot.value
3090
+ }
3091
+
3092
+ Object.entries(document.definitions).forEach(([identifier, definition]) => {
3093
+ visited = new Set<string>([identifier])
3094
+ references[identifier] = unknownToJson(recur(definition))
3095
+ })
3096
+
3097
+ visited = new Set<string>()
3098
+ const representations = Arr.map(document.schemas, (schema) => unknownToJson(recur(schema)))
3099
+ return {
3100
+ representations,
3101
+ references
3102
+ }
3103
+
3104
+ function recur(u: unknown): Representation {
3105
+ if (u === false) return never
3106
+ if (!Predicate.isObject(u)) return unknown
3107
+
3108
+ let js: JsonSchema.JsonSchema = options?.onEnter?.(u) ?? u
3109
+ if (Array.isArray(js.type)) {
3110
+ if (js.type.every(isType)) {
3111
+ const { type, ...rest } = js
3112
+ js = {
3113
+ anyOf: type.map((type) => ({ type })),
3114
+ ...rest
3115
+ }
3116
+ } else {
3117
+ js = {}
3118
+ }
3119
+ }
3120
+
3121
+ let out = on(js)
3122
+
3123
+ const annotations = collectAnnotations(js)
3124
+ if (annotations !== undefined) {
3125
+ out = combine(out, { _tag: "Unknown", annotations })
3126
+ }
3127
+
3128
+ if (Array.isArray(js.allOf)) {
3129
+ out = js.allOf.reduce((acc, curr) => combine(acc, recur(curr)), out)
3130
+ }
3131
+ if (Array.isArray(js.anyOf)) {
3132
+ out = combine({ _tag: "Union", types: js.anyOf.map((type) => recur(type)), mode: "anyOf" }, out)
3133
+ }
3134
+ if (Array.isArray(js.oneOf)) {
3135
+ out = combine({ _tag: "Union", types: js.oneOf.map((type) => recur(type)), mode: "oneOf" }, out)
3136
+ }
3137
+
3138
+ return out
3139
+ }
3140
+
3141
+ function on(js: JsonSchema.JsonSchema): Representation {
3142
+ if (typeof js.$ref === "string") {
3143
+ const $ref = js.$ref.slice(2).split("/").at(-1)
3144
+ if ($ref !== undefined) {
3145
+ const reference: Reference = { _tag: "Reference", $ref: unescapeToken($ref) }
3146
+ if (visited.has($ref)) {
3147
+ return { _tag: "Suspend", thunk: reference, checks: [] }
3148
+ } else {
3149
+ return reference
3150
+ }
3151
+ }
3152
+ } else if ("const" in js) {
3153
+ if (isLiteralValue(js.const)) {
3154
+ return { _tag: "Literal", literal: js.const }
3155
+ } else if (js.const === null) {
3156
+ return null_
3157
+ }
3158
+ } else if (Array.isArray(js.enum)) {
3159
+ const types: Array<Representation> = []
3160
+ for (const e of js.enum) {
3161
+ if (isLiteralValue(e)) {
3162
+ types.push({ _tag: "Literal", literal: e })
3163
+ } else if (e === null) {
3164
+ types.push(null_)
3165
+ } else {
3166
+ types.push(recur(e))
3167
+ }
3168
+ }
3169
+ if (types.length === 1) {
3170
+ return types[0]
3171
+ } else {
3172
+ return { _tag: "Union", types, mode: "anyOf" }
3173
+ }
3174
+ }
3175
+
3176
+ const type = isType(js.type) ? js.type : getType(js)
3177
+ if (type !== undefined) {
3178
+ switch (type) {
3179
+ case "null":
3180
+ return null_
3181
+ case "string": {
3182
+ const checks = collectStringChecks(js)
3183
+ if (checks.length > 0) {
3184
+ return { ...string, checks }
3185
+ }
3186
+ return string
3187
+ }
3188
+ case "number":
3189
+ return {
3190
+ _tag: "Number",
3191
+ checks: [{ _tag: "Filter", meta: { _tag: "isFinite" } }, ...collectNumberChecks(js)]
3192
+ }
3193
+ case "integer":
3194
+ return {
3195
+ _tag: "Number",
3196
+ checks: [{ _tag: "Filter", meta: { _tag: "isInt" } }, ...collectNumberChecks(js)]
3197
+ }
3198
+ case "boolean":
3199
+ return boolean
3200
+ case "array": {
3201
+ const minItems = typeof js.minItems === "number" ? js.minItems : 0
3202
+
3203
+ const elements: Array<Element> = (Array.isArray(js.prefixItems) ? js.prefixItems : []).map((e, i) => ({
3204
+ isOptional: i + 1 > minItems,
3205
+ type: recur(e)
3206
+ }))
3207
+
3208
+ const rest: Array<Representation> = js.items !== undefined ?
3209
+ [recur(js.items)]
3210
+ : js.prefixItems !== undefined && typeof js.maxItems === "number"
3211
+ ? []
3212
+ : [unknown]
3213
+
3214
+ return { _tag: "Arrays", elements, rest, checks: collectArraysChecks(js) }
3215
+ }
3216
+ case "object": {
3217
+ return {
3218
+ _tag: "Objects",
3219
+ propertySignatures: collectProperties(js),
3220
+ indexSignatures: collectIndexSignatures(js),
3221
+ checks: collectObjectsChecks(js)
3222
+ }
3223
+ }
3224
+ }
3225
+ }
3226
+
3227
+ return { _tag: "Unknown" }
3228
+ }
3229
+
3230
+ function collectObjectsChecks(js: JsonSchema.JsonSchema): Array<Check<ObjectsMeta>> {
3231
+ const checks: Array<Check<ObjectsMeta>> = []
3232
+ if (typeof js.minProperties === "number") {
3233
+ checks.push({ _tag: "Filter", meta: { _tag: "isMinProperties", minProperties: js.minProperties } })
3234
+ }
3235
+ if (typeof js.maxProperties === "number") {
3236
+ checks.push({ _tag: "Filter", meta: { _tag: "isMaxProperties", maxProperties: js.maxProperties } })
3237
+ }
3238
+ if (js.propertyNames !== undefined) {
3239
+ const propertyNames = recur(js.propertyNames)
3240
+ checks.push({ _tag: "Filter", meta: { _tag: "isPropertyNames", propertyNames } })
3241
+ }
3242
+ return checks
3243
+ }
3244
+
3245
+ function combine(a: Representation, b: Representation): Representation {
3246
+ switch (a._tag) {
3247
+ default:
3248
+ return never
3249
+ case "Reference":
3250
+ return combine(resolveReference(a.$ref), b)
3251
+ case "Never":
3252
+ return a
3253
+ case "Unknown":
3254
+ switch (b._tag) {
3255
+ case "Reference":
3256
+ return combine(a, resolveReference(b.$ref))
3257
+ default:
3258
+ return { ...b, ...combineAnnotations(a.annotations, b.annotations) }
3259
+ }
3260
+ case "Null":
3261
+ switch (b._tag) {
3262
+ case "Unknown":
3263
+ case "Null":
3264
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3265
+ case "Union":
3266
+ return combine(b, a)
3267
+ case "Reference":
3268
+ return combine(a, resolveReference(b.$ref))
3269
+ default:
3270
+ return never
3271
+ }
3272
+ case "String":
3273
+ switch (b._tag) {
3274
+ case "Unknown":
3275
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3276
+ case "String": {
3277
+ const checks = combineChecks(a.checks, b.checks, b.annotations)
3278
+ return {
3279
+ _tag: "String",
3280
+ checks: checks ?? a.checks,
3281
+ ...combineAnnotations(a.annotations, checks ? undefined : b.annotations)
3282
+ }
3283
+ }
3284
+ case "Literal":
3285
+ return typeof b.literal === "string" ? { ...b, ...combineAnnotations(a.annotations, b.annotations) } : never
3286
+ case "Union":
3287
+ return combine(b, a)
3288
+ case "Reference":
3289
+ return combine(a, resolveReference(b.$ref))
3290
+ default:
3291
+ return never
3292
+ }
3293
+ case "Number":
3294
+ switch (b._tag) {
3295
+ case "Unknown":
3296
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3297
+ case "Number": {
3298
+ const checks = combineNumberChecks(a.checks, b.checks, b.annotations)
3299
+ return {
3300
+ _tag: "Number",
3301
+ checks: checks ?? a.checks,
3302
+ ...combineAnnotations(a.annotations, checks ? undefined : b.annotations)
3303
+ }
3304
+ }
3305
+ case "Literal":
3306
+ return typeof b.literal === "number" ? { ...b, ...combineAnnotations(a.annotations, b.annotations) } : never
3307
+ case "Union":
3308
+ return combine(b, a)
3309
+ case "Reference":
3310
+ return combine(a, resolveReference(b.$ref))
3311
+ default:
3312
+ return never
3313
+ }
3314
+ case "Boolean":
3315
+ switch (b._tag) {
3316
+ case "Unknown":
3317
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3318
+ case "Boolean":
3319
+ return { _tag: "Boolean", ...combineAnnotations(a.annotations, b.annotations) }
3320
+ case "Literal":
3321
+ return typeof b.literal === "boolean"
3322
+ ? { ...b, ...combineAnnotations(a.annotations, b.annotations) }
3323
+ : never
3324
+ case "Union":
3325
+ return combine(b, a)
3326
+ case "Reference":
3327
+ return combine(a, resolveReference(b.$ref))
3328
+ default:
3329
+ return never
3330
+ }
3331
+ case "Literal":
3332
+ switch (b._tag) {
3333
+ case "Unknown":
3334
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3335
+ case "Literal":
3336
+ return a.literal === b.literal
3337
+ ? { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3338
+ : never
3339
+ case "String":
3340
+ return typeof a.literal === "string" ? { ...a, ...combineAnnotations(a.annotations, b.annotations) } : never
3341
+ case "Number":
3342
+ return typeof a.literal === "number" ? { ...a, ...combineAnnotations(a.annotations, b.annotations) } : never
3343
+ case "Boolean":
3344
+ return typeof a.literal === "boolean"
3345
+ ? { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3346
+ : never
3347
+ case "Union":
3348
+ return combine(b, a)
3349
+ case "Reference":
3350
+ return combine(a, resolveReference(b.$ref))
3351
+ default:
3352
+ return never
3353
+ }
3354
+ case "Arrays":
3355
+ switch (b._tag) {
3356
+ case "Unknown":
3357
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3358
+ case "Arrays": {
3359
+ const checks = combineArraysChecks(a.checks, b.checks, b.annotations)
3360
+ return {
3361
+ _tag: "Arrays",
3362
+ elements: combineElements(a.elements, b.elements),
3363
+ rest: combineRest(a.rest, b.rest),
3364
+ checks: checks ?? a.checks,
3365
+ ...combineAnnotations(a.annotations, checks ? undefined : b.annotations)
3366
+ }
3367
+ }
3368
+ case "Union":
3369
+ return combine(b, a)
3370
+ case "Reference":
3371
+ return combine(a, resolveReference(b.$ref))
3372
+ default:
3373
+ return never
3374
+ }
3375
+ case "Objects":
3376
+ switch (b._tag) {
3377
+ case "Unknown":
3378
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3379
+ case "Objects": {
3380
+ const checks = combineChecks(a.checks, b.checks, b.annotations)
3381
+ return {
3382
+ _tag: "Objects",
3383
+ propertySignatures: combinePropertySignatures(a.propertySignatures, b.propertySignatures),
3384
+ indexSignatures: combineIndexSignatures(a.indexSignatures, b.indexSignatures),
3385
+ checks: checks ?? a.checks,
3386
+ ...combineAnnotations(a.annotations, checks ? undefined : b.annotations)
3387
+ }
3388
+ }
3389
+ case "Union":
3390
+ return combine(b, a)
3391
+ case "Reference":
3392
+ return combine(a, resolveReference(b.$ref))
3393
+ default:
3394
+ return never
3395
+ }
3396
+ case "Union": {
3397
+ switch (b._tag) {
3398
+ case "Unknown":
3399
+ return { ...a, ...combineAnnotations(a.annotations, b.annotations) }
3400
+ default: {
3401
+ const types = a.types.map((s) => combine(s, b)).filter((s) => s !== never)
3402
+ if (types.length === 0) return never
3403
+ return {
3404
+ _tag: "Union",
3405
+ types,
3406
+ mode: a.mode,
3407
+ ...makeAnnotations(a.annotations)
3408
+ }
3409
+ }
3410
+ }
3411
+ }
3412
+ }
3413
+ }
3414
+
3415
+ function collectProperties(js: JsonSchema.JsonSchema): Array<PropertySignature> {
3416
+ const properties: Record<string, unknown> = Predicate.isObject(js.properties) ? js.properties : {}
3417
+ const required = Array.isArray(js.required) ? js.required : []
3418
+ required.forEach((key) => {
3419
+ if (!Object.hasOwn(properties, key)) {
3420
+ properties[key] = {}
3421
+ }
3422
+ })
3423
+ return Object.entries(properties).map(([key, v]) => ({
3424
+ name: key,
3425
+ type: recur(v),
3426
+ isOptional: !required.includes(key),
3427
+ isMutable: false
3428
+ }))
3429
+ }
3430
+
3431
+ function collectIndexSignatures(js: JsonSchema.JsonSchema): Array<IndexSignature> {
3432
+ const out: Array<IndexSignature> = []
3433
+
3434
+ if (Predicate.isObject(js.patternProperties)) {
3435
+ for (const [pattern, value] of Object.entries(js.patternProperties)) {
3436
+ out.push({ parameter: recur({ pattern }), type: recur(value) })
3437
+ }
3438
+ }
3439
+
3440
+ if (js.additionalProperties === undefined || js.additionalProperties === true) {
3441
+ out.push({ parameter: string, type: unknown })
3442
+ } else if (Predicate.isObject(js.additionalProperties)) {
3443
+ out.push({ parameter: string, type: recur(js.additionalProperties) })
3444
+ }
3445
+
3446
+ return out
3447
+ }
3448
+
3449
+ function combineElements(a: ReadonlyArray<Element>, b: ReadonlyArray<Element>): Array<Element> {
3450
+ const len = Math.max(a.length, b.length)
3451
+ let out: Array<Element> = []
3452
+ for (let i = 0; i < len; i++) {
3453
+ out.push({
3454
+ isOptional: a[i].isOptional && b[i].isOptional,
3455
+ type: combine(a[i].type, b[i].type)
3456
+ })
3457
+ }
3458
+ if (a.length > len) {
3459
+ out = [...out, ...a.slice(len)]
3460
+ } else if (b.length > len) {
3461
+ out = [...out, ...b.slice(len)]
3462
+ }
3463
+ return out
3464
+ }
3465
+
3466
+ function combineRest(a: ReadonlyArray<Representation>, b: ReadonlyArray<Representation>): Array<Representation> {
3467
+ const len = Math.max(a.length, b.length)
3468
+ let out: Array<Representation> = []
3469
+ for (let i = 0; i < len; i++) {
3470
+ out.push(combine(a[i], b[i]))
3471
+ }
3472
+ if (a.length > len) {
3473
+ out = [...out, ...a.slice(len)]
3474
+ } else if (b.length > len) {
3475
+ out = [...out, ...b.slice(len)]
3476
+ }
3477
+ return out
3478
+ }
3479
+
3480
+ function combinePropertySignatures(
3481
+ a: ReadonlyArray<PropertySignature>,
3482
+ b: ReadonlyArray<PropertySignature>
3483
+ ): Array<PropertySignature> {
3484
+ const propertySignatures: Array<PropertySignature> = []
3485
+ const thatPropertiesMap: Record<PropertyKey, PropertySignature> = {}
3486
+ for (const p of b) {
3487
+ thatPropertiesMap[p.name] = p
3488
+ }
3489
+ const keys = new Set<PropertyKey>()
3490
+ for (const p of a) {
3491
+ keys.add(p.name)
3492
+ const thatp = thatPropertiesMap[p.name]
3493
+ if (thatp) {
3494
+ propertySignatures.push(
3495
+ {
3496
+ name: p.name,
3497
+ type: combine(p.type, thatp.type),
3498
+ isOptional: p.isOptional && thatp.isOptional,
3499
+ isMutable: p.isMutable
3500
+ }
3501
+ )
3502
+ } else {
3503
+ propertySignatures.push(p)
3504
+ }
3505
+ }
3506
+ for (const p of b) {
3507
+ if (!keys.has(p.name)) propertySignatures.push(p)
3508
+ }
3509
+ return propertySignatures
3510
+ }
3511
+
3512
+ function combineIndexSignatures(
3513
+ a: ReadonlyArray<IndexSignature>,
3514
+ b: ReadonlyArray<IndexSignature>
3515
+ ): Array<IndexSignature> {
3516
+ if (a.length === 0 || b.length === 0) return []
3517
+ const out: Array<IndexSignature> = [...a]
3518
+ for (const is of b) {
3519
+ if (is.parameter === string) {
3520
+ const i = a.findIndex((is) => is.parameter === string)
3521
+ if (i !== -1) {
3522
+ out[i] = { parameter: string, type: combine(a[i].type, is.type) }
3523
+ } else {
3524
+ out.push(is)
3525
+ }
3526
+ } else {
3527
+ out.push(is)
3528
+ }
3529
+ }
3530
+ return out
3531
+ }
3532
+
3533
+ function unknownToJson(representation: Representation): Representation {
3534
+ switch (representation._tag) {
3535
+ case "Unknown":
3536
+ return representation.annotations === undefined ?
3537
+ json :
3538
+ {
3539
+ ...json,
3540
+ annotations: {
3541
+ ...json.annotations,
3542
+ ...representation.annotations
3543
+ }
3544
+ }
3545
+ case "Suspend": {
3546
+ const thunk = unknownToJson(representation.thunk)
3547
+ return thunk === representation.thunk ? representation : { ...representation, thunk }
3548
+ }
3549
+ case "String": {
3550
+ if (representation.contentSchema === undefined) return representation
3551
+ const contentSchema = unknownToJson(representation.contentSchema)
3552
+ return contentSchema === representation.contentSchema ? representation : { ...representation, contentSchema }
3553
+ }
3554
+ case "Arrays": {
3555
+ const elements = SchemaAST.mapOrSame(representation.elements, (element) => {
3556
+ const type = unknownToJson(element.type)
3557
+ return type === element.type ? element : { ...element, type }
3558
+ })
3559
+ const rest = SchemaAST.mapOrSame(representation.rest, unknownToJson)
3560
+ return elements === representation.elements && rest === representation.rest ?
3561
+ representation :
3562
+ { ...representation, elements, rest }
3563
+ }
3564
+ case "Objects": {
3565
+ const propertySignatures = SchemaAST.mapOrSame(representation.propertySignatures, (propertySignature) => {
3566
+ const type = unknownToJson(propertySignature.type)
3567
+ return type === propertySignature.type ? propertySignature : { ...propertySignature, type }
3568
+ })
3569
+ const indexSignatures = SchemaAST.mapOrSame(representation.indexSignatures, (indexSignature) => {
3570
+ const type = unknownToJson(indexSignature.type)
3571
+ return type === indexSignature.type ? indexSignature : { ...indexSignature, type }
3572
+ })
3573
+ return propertySignatures === representation.propertySignatures &&
3574
+ indexSignatures === representation.indexSignatures ?
3575
+ representation :
3576
+ { ...representation, propertySignatures, indexSignatures }
3577
+ }
3578
+ case "Union": {
3579
+ const types = SchemaAST.mapOrSame(representation.types, unknownToJson)
3580
+ return types === representation.types ? representation : { ...representation, types }
3581
+ }
3582
+ default:
3583
+ return representation
3584
+ }
3585
+ }
3586
+ }
3587
+
3588
+ function asChecks<M>(
3589
+ checks: ReadonlyArray<Check<M>>,
3590
+ annotations: Schema.Annotations.Annotations | undefined
3591
+ ): ReadonlyArray<Check<M>> | undefined {
3592
+ if (Arr.isReadonlyArrayNonEmpty(checks)) {
3593
+ if (annotations !== undefined) {
3594
+ if (checks.length === 1) {
3595
+ const check = checks[0]
3596
+ if (check.annotations === undefined) {
3597
+ return [{ ...check, annotations }]
3598
+ } else {
3599
+ return [{ _tag: "FilterGroup", checks, annotations }]
3600
+ }
3601
+ } else {
3602
+ return [{ _tag: "FilterGroup", checks, annotations }]
3603
+ }
3604
+ }
3605
+ return checks
3606
+ }
3607
+ }
3608
+
3609
+ function combineChecks<M>(
3610
+ a: ReadonlyArray<Check<M>>,
3611
+ b: ReadonlyArray<Check<M>>,
3612
+ annotations: Schema.Annotations.Annotations | undefined
3613
+ ): Array<Check<M>> | undefined {
3614
+ const checks = asChecks(b, annotations)
3615
+ if (checks) {
3616
+ return [...a, ...checks]
3617
+ }
3618
+ }
3619
+
3620
+ function combineNumberChecks(
3621
+ a: ReadonlyArray<Check<NumberMeta>>,
3622
+ b: ReadonlyArray<Check<NumberMeta>>,
3623
+ annotations: Schema.Annotations.Annotations | undefined
3624
+ ): Array<Check<NumberMeta>> | undefined {
3625
+ if (a.some((c) => c._tag === "Filter" && c.meta._tag === "isFinite")) {
3626
+ b = b.filter((c) => c._tag !== "Filter" || c.meta._tag !== "isFinite")
3627
+ }
3628
+ if (a.some((c) => c._tag === "Filter" && c.meta._tag === "isInt")) {
3629
+ b = b.filter((c) => c._tag !== "Filter" || c.meta._tag !== "isInt")
3630
+ }
3631
+ return combineChecks(a, b, annotations)
3632
+ }
3633
+
3634
+ function combineArraysChecks(
3635
+ a: ReadonlyArray<Check<ArraysMeta>>,
3636
+ b: ReadonlyArray<Check<ArraysMeta>>,
3637
+ annotations: Schema.Annotations.Annotations | undefined
3638
+ ): Array<Check<ArraysMeta>> | undefined {
3639
+ if (a.some((c) => c._tag === "Filter" && c.meta._tag === "isUnique")) {
3640
+ b = b.filter((c) => c._tag !== "Filter" || c.meta._tag !== "isUnique")
3641
+ }
3642
+ return combineChecks(a, b, annotations)
3643
+ }
3644
+
3645
+ function makeAnnotations(
3646
+ annotations: Schema.Annotations.Annotations | undefined
3647
+ ): { annotations: Schema.Annotations.Annotations } | undefined {
3648
+ return annotations ? { annotations } : undefined
3649
+ }
3650
+
3651
+ function combineAnnotations(
3652
+ a: Schema.Annotations.Annotations | undefined,
3653
+ b: Schema.Annotations.Annotations | undefined
3654
+ ): { annotations: Schema.Annotations.Annotations } | undefined {
3655
+ if (a === undefined) return makeAnnotations(b)
3656
+ if (b === undefined) return makeAnnotations(a)
3657
+ return { annotations: { ...a, ...b } } // TODO: better merge
3658
+ }
3659
+
3660
+ function collectStringChecks(js: JsonSchema.JsonSchema): Array<Check<StringMeta>> {
3661
+ const checks: Array<Check<StringMeta>> = []
3662
+ if (typeof js.minLength === "number") {
3663
+ checks.push({ _tag: "Filter", meta: { _tag: "isMinLength", minLength: js.minLength } })
3664
+ }
3665
+ if (typeof js.maxLength === "number") {
3666
+ checks.push({ _tag: "Filter", meta: { _tag: "isMaxLength", maxLength: js.maxLength } })
3667
+ }
3668
+ if (typeof js.pattern === "string") {
3669
+ checks.push({ _tag: "Filter", meta: { _tag: "isPattern", regExp: new RegExp(js.pattern) } })
3670
+ }
3671
+ return checks
3672
+ }
3673
+
3674
+ function collectNumberChecks(js: JsonSchema.JsonSchema): Array<Check<NumberMeta>> {
3675
+ const checks: Array<Check<NumberMeta>> = []
3676
+ if (typeof js.minimum === "number") {
3677
+ checks.push({ _tag: "Filter", meta: { _tag: "isGreaterThanOrEqualTo", minimum: js.minimum } })
3678
+ }
3679
+ if (typeof js.maximum === "number") {
3680
+ checks.push({ _tag: "Filter", meta: { _tag: "isLessThanOrEqualTo", maximum: js.maximum } })
3681
+ }
3682
+ if (typeof js.exclusiveMinimum === "number") {
3683
+ checks.push({ _tag: "Filter", meta: { _tag: "isGreaterThan", exclusiveMinimum: js.exclusiveMinimum } })
3684
+ }
3685
+ if (typeof js.exclusiveMaximum === "number") {
3686
+ checks.push({ _tag: "Filter", meta: { _tag: "isLessThan", exclusiveMaximum: js.exclusiveMaximum } })
3687
+ }
3688
+ if (typeof js.multipleOf === "number") {
3689
+ checks.push({ _tag: "Filter", meta: { _tag: "isMultipleOf", divisor: js.multipleOf } })
3690
+ }
3691
+ return checks
3692
+ }
3693
+
3694
+ function collectArraysChecks(js: JsonSchema.JsonSchema): Array<Check<ArraysMeta>> {
3695
+ const checks: Array<Check<ArraysMeta>> = []
3696
+ if (js.prefixItems === undefined) {
3697
+ if (typeof js.minItems === "number") {
3698
+ checks.push({ _tag: "Filter", meta: { _tag: "isMinLength", minLength: js.minItems } })
3699
+ }
3700
+ if (typeof js.maxItems === "number") {
3701
+ checks.push({ _tag: "Filter", meta: { _tag: "isMaxLength", maxLength: js.maxItems } })
3702
+ }
3703
+ }
3704
+ if (typeof js.uniqueItems === "boolean") {
3705
+ checks.push({ _tag: "Filter", meta: { _tag: "isUnique" } })
3706
+ }
3707
+ return checks
3708
+ }
3709
+
3710
+ const unknown: Unknown = { _tag: "Unknown" }
3711
+ const json: Declaration = {
3712
+ _tag: "Declaration",
3713
+ annotations: {
3714
+ expected: "JSON value",
3715
+ generation: {
3716
+ Type: "Schema.Json",
3717
+ runtime: "Schema.Json"
3718
+ },
3719
+ typeConstructor: {
3720
+ _tag: "effect/Json"
3721
+ }
3722
+ },
3723
+ checks: [],
3724
+ encodedSchema: unknown,
3725
+ typeParameters: []
3726
+ }
3727
+ const never: Never = { _tag: "Never" }
3728
+ const null_: Null = { _tag: "Null" }
3729
+ const string: String = { _tag: "String", checks: [] }
3730
+ const boolean: Boolean = { _tag: "Boolean" }
3731
+
3732
+ function collectAnnotations(
3733
+ schema: JsonSchema.JsonSchema
3734
+ ): Schema.Annotations.Annotations | undefined {
3735
+ const as: Record<string, unknown> = {}
3736
+
3737
+ if (typeof schema.title === "string") as.title = schema.title
3738
+ if (typeof schema.description === "string") as.description = schema.description
3739
+ if (schema.default !== undefined) as.default = schema.default
3740
+ if (Array.isArray(schema.examples)) as.examples = schema.examples
3741
+ if (typeof schema.readOnly === "boolean") as.readOnly = schema.readOnly
3742
+ if (typeof schema.writeOnly === "boolean") as.writeOnly = schema.writeOnly
3743
+ if (typeof schema.format === "string") as.format = schema.format
3744
+ if (typeof schema.contentEncoding === "string") as.contentEncoding = schema.contentEncoding
3745
+ if (typeof schema.contentMediaType === "string") as.contentMediaType = schema.contentMediaType
3746
+
3747
+ return Rec.isEmptyRecord(as) ? undefined : as
3748
+ }
3749
+
3750
+ function isLiteralValue(value: unknown): value is SchemaAST.LiteralValue {
3751
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean"
3752
+ }
3753
+
3754
+ const stringKeys = ["minLength", "maxLength", "pattern", "format", "contentMediaType", "contentSchema"]
3755
+ const numberKeys = ["minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf"]
3756
+ const objectKeys = [
3757
+ "properties",
3758
+ "required",
3759
+ "additionalProperties",
3760
+ "patternProperties",
3761
+ "propertyNames",
3762
+ "minProperties",
3763
+ "maxProperties"
3764
+ ]
3765
+ const arrayKeys = ["items", "prefixItems", "additionalItems", "minItems", "maxItems", "uniqueItems"]
3766
+
3767
+ function getType(js: JsonSchema.JsonSchema): JsonSchema.Type | undefined {
3768
+ if (stringKeys.some((key) => js[key] !== undefined)) {
3769
+ return "string"
3770
+ }
3771
+ if (numberKeys.some((key) => js[key] !== undefined)) {
3772
+ return "number"
3773
+ }
3774
+ if (objectKeys.some((key) => js[key] !== undefined)) {
3775
+ return "object"
3776
+ }
3777
+ if (arrayKeys.some((key) => js[key] !== undefined)) {
3778
+ return "array"
3779
+ }
3780
+ }
3781
+
3782
+ const types = ["null", "string", "number", "integer", "boolean", "object", "array"]
3783
+
3784
+ function isType(type: unknown): type is JsonSchema.Type {
3785
+ return typeof type === "string" && types.includes(type)
3786
+ }
3787
+
3788
+ /** @internal */
3789
+ export type TopologicalSort = {
3790
+ /**
3791
+ * The definitions that are not recursive.
3792
+ * The definitions that depends on other definitions are placed after the definitions they depend on
3793
+ */
3794
+ readonly nonRecursives: ReadonlyArray<{
3795
+ readonly $ref: string
3796
+ readonly representation: Representation
3797
+ }>
3798
+ /**
3799
+ * The recursive definitions (with no particular order).
3800
+ */
3801
+ readonly recursives: {
3802
+ readonly [$ref: string]: Representation
3803
+ }
3804
+ }
3805
+
3806
+ /** @internal */
3807
+ export function topologicalSort(references: References): TopologicalSort {
3808
+ const identifiers = Object.keys(references)
3809
+ const identifierSet = new Set(identifiers)
3810
+
3811
+ const collectRefs = (root: Representation): Set<string> => {
3812
+ const refs = new Set<string>()
3813
+ const visited = new WeakSet<object>()
3814
+ const stack: Array<Representation> = [root]
3815
+
3816
+ while (stack.length > 0) {
3817
+ const r = stack.pop()!
3818
+ if (visited.has(r)) continue
3819
+ visited.add(r)
3820
+
3821
+ if (r._tag === "Reference") {
3822
+ if (identifierSet.has(r.$ref)) {
3823
+ refs.add(r.$ref)
3824
+ }
3825
+ }
3826
+
3827
+ // Push nested Representation schemas onto the stack
3828
+ switch (r._tag) {
3829
+ case "Declaration":
3830
+ for (const typeParam of r.typeParameters) stack.push(typeParam)
3831
+ stack.push(r.encodedSchema)
3832
+ break
3833
+ case "Suspend":
3834
+ stack.push(r.thunk)
3835
+ break
3836
+ case "String":
3837
+ if (r.contentSchema !== undefined) stack.push(r.contentSchema)
3838
+ break
3839
+ case "TemplateLiteral":
3840
+ for (const part of r.parts) stack.push(part)
3841
+ break
3842
+ case "Arrays":
3843
+ for (const element of r.elements) stack.push(element.type)
3844
+ for (const rest of r.rest) stack.push(rest)
3845
+ break
3846
+ case "Objects":
3847
+ for (const propertySignature of r.propertySignatures) stack.push(propertySignature.type)
3848
+ for (const indexSignature of r.indexSignatures) {
3849
+ stack.push(indexSignature.parameter)
3850
+ stack.push(indexSignature.type)
3851
+ }
3852
+ break
3853
+ case "Union":
3854
+ for (const type of r.types) stack.push(type)
3855
+ break
3856
+ }
3857
+ }
3858
+
3859
+ return refs
3860
+ }
3861
+
3862
+ // identifier -> internal identifiers it depends on
3863
+ const dependencies = new Map<string, Set<string>>(
3864
+ identifiers.map((id) => [id, collectRefs(references[id])])
3865
+ )
3866
+
3867
+ // Mark only nodes that are part of cycles
3868
+ const recursive = new Set<string>()
3869
+ const state = new Map<string, 0 | 1 | 2>() // 0 = new, 1 = visiting, 2 = done
3870
+ const stack: Array<string> = []
3871
+ const indexInStack = new Map<string, number>()
3872
+
3873
+ const dfs = (id: string): void => {
3874
+ const s = state.get(id) ?? 0
3875
+ if (s === 1) {
3876
+ const start = indexInStack.get(id)
3877
+ if (start !== undefined) {
3878
+ for (let i = start; i < stack.length; i++) {
3879
+ recursive.add(stack[i])
3880
+ }
3881
+ }
3882
+ return
3883
+ }
3884
+ if (s === 2) return
3885
+
3886
+ state.set(id, 1)
3887
+ indexInStack.set(id, stack.length)
3888
+ stack.push(id)
3889
+
3890
+ for (const dep of dependencies.get(id) ?? []) {
3891
+ dfs(dep)
3892
+ }
3893
+
3894
+ stack.pop()
3895
+ indexInStack.delete(id)
3896
+ state.set(id, 2)
3897
+ }
3898
+
3899
+ for (const id of identifiers) dfs(id)
3900
+
3901
+ // Topologically sort the non-recursive nodes (ignoring edges to recursive nodes)
3902
+ const inDegree = new Map<string, number>()
3903
+ const dependents = new Map<string, Set<string>>() // dep -> nodes that depend on it
3904
+
3905
+ for (const id of identifiers) {
3906
+ if (!recursive.has(id)) {
3907
+ inDegree.set(id, 0)
3908
+ dependents.set(id, new Set())
3909
+ }
3910
+ }
3911
+
3912
+ for (const [id, deps] of dependencies) {
3913
+ if (recursive.has(id)) continue
3914
+ for (const dep of deps) {
3915
+ if (recursive.has(dep)) continue
3916
+ inDegree.set(id, (inDegree.get(id) ?? 0) + 1)
3917
+ dependents.get(dep)?.add(id)
3918
+ }
3919
+ }
3920
+
3921
+ const queue: Array<string> = []
3922
+ for (const [id, deg] of inDegree) {
3923
+ if (deg === 0) queue.push(id)
3924
+ }
3925
+
3926
+ const nonRecursives: Array<{ readonly $ref: string; readonly representation: Representation }> = []
3927
+ for (let i = 0; i < queue.length; i++) {
3928
+ const $ref = queue[i]
3929
+ nonRecursives.push({ $ref, representation: references[$ref] })
3930
+
3931
+ for (const next of dependents.get($ref) ?? []) {
3932
+ const deg = (inDegree.get(next) ?? 0) - 1
3933
+ inDegree.set(next, deg)
3934
+ if (deg === 0) queue.push(next)
3935
+ }
3936
+ }
3937
+
3938
+ const recursives: Record<string, Representation> = {}
3939
+ for (const $ref of recursive) {
3940
+ recursives[$ref] = references[$ref]
3941
+ }
3942
+
3943
+ return { nonRecursives, recursives }
3944
+ }