effect 4.0.2 → 4.0.4

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 (389) hide show
  1. package/AGENTS.md +24 -0
  2. package/CLAUDE.md +24 -0
  3. package/ai-docs/package.json +2 -2
  4. package/ai-docs/src/52_graphql/10_basics.ts +111 -0
  5. package/ai-docs/src/52_graphql/20_testing.ts +45 -0
  6. package/ai-docs/src/52_graphql/30_batching.ts +116 -0
  7. package/ai-docs/src/52_graphql/40_aliased-batching.ts +122 -0
  8. package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
  9. package/ai-docs/src/52_graphql/index.md +6 -0
  10. package/dist/Context.d.ts.map +1 -1
  11. package/dist/Context.js +12 -3
  12. package/dist/Context.js.map +1 -1
  13. package/dist/Crypto.d.ts +33 -5
  14. package/dist/Crypto.d.ts.map +1 -1
  15. package/dist/Crypto.js +8 -2
  16. package/dist/Crypto.js.map +1 -1
  17. package/dist/DateTime.d.ts +9 -6
  18. package/dist/DateTime.d.ts.map +1 -1
  19. package/dist/DateTime.js +9 -6
  20. package/dist/DateTime.js.map +1 -1
  21. package/dist/Duration.d.ts +6 -6
  22. package/dist/Duration.d.ts.map +1 -1
  23. package/dist/Duration.js +27 -8
  24. package/dist/Duration.js.map +1 -1
  25. package/dist/FileSystem.d.ts +44 -2
  26. package/dist/FileSystem.d.ts.map +1 -1
  27. package/dist/FileSystem.js.map +1 -1
  28. package/dist/RequestResolver.d.ts.map +1 -1
  29. package/dist/RequestResolver.js +4 -10
  30. package/dist/RequestResolver.js.map +1 -1
  31. package/dist/Scheduler.d.ts +9 -0
  32. package/dist/Scheduler.d.ts.map +1 -1
  33. package/dist/Scheduler.js +9 -0
  34. package/dist/Scheduler.js.map +1 -1
  35. package/dist/Schema.d.ts +481 -1
  36. package/dist/Schema.d.ts.map +1 -1
  37. package/dist/Schema.js +362 -4
  38. package/dist/Schema.js.map +1 -1
  39. package/dist/SchemaGetter.d.ts +4 -0
  40. package/dist/SchemaGetter.d.ts.map +1 -1
  41. package/dist/SchemaGetter.js +52 -33
  42. package/dist/SchemaGetter.js.map +1 -1
  43. package/dist/Sink.d.ts.map +1 -1
  44. package/dist/Sink.js +38 -17
  45. package/dist/Sink.js.map +1 -1
  46. package/dist/Stdio.d.ts +7 -1
  47. package/dist/Stdio.d.ts.map +1 -1
  48. package/dist/Stdio.js +1 -0
  49. package/dist/Stdio.js.map +1 -1
  50. package/dist/Stream.d.ts +22 -11
  51. package/dist/Stream.d.ts.map +1 -1
  52. package/dist/Stream.js +21 -6
  53. package/dist/Stream.js.map +1 -1
  54. package/dist/Utils.js +8 -3
  55. package/dist/Utils.js.map +1 -1
  56. package/dist/ai/AnthropicStructuredOutput.js +0 -2
  57. package/dist/ai/AnthropicStructuredOutput.js.map +1 -1
  58. package/dist/ai/Chat.d.ts +2 -2
  59. package/dist/ai/Chat.d.ts.map +1 -1
  60. package/dist/ai/LanguageModel.d.ts +38 -7
  61. package/dist/ai/LanguageModel.d.ts.map +1 -1
  62. package/dist/ai/LanguageModel.js +25 -7
  63. package/dist/ai/LanguageModel.js.map +1 -1
  64. package/dist/ai/McpServer.d.ts +61 -0
  65. package/dist/ai/McpServer.d.ts.map +1 -1
  66. package/dist/ai/McpServer.js +196 -44
  67. package/dist/ai/McpServer.js.map +1 -1
  68. package/dist/ai/Prompt.d.ts.map +1 -1
  69. package/dist/ai/Prompt.js +28 -5
  70. package/dist/ai/Prompt.js.map +1 -1
  71. package/dist/ai/Response.d.ts +4 -3
  72. package/dist/ai/Response.d.ts.map +1 -1
  73. package/dist/ai/Response.js.map +1 -1
  74. package/dist/ai/internal/mcpProtocol/v2026_07_28.js +5 -0
  75. package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
  76. package/dist/ai/internal/mcpProtocol.js.map +1 -1
  77. package/dist/ai/internal/mcpRuntime.js +1 -0
  78. package/dist/ai/internal/mcpRuntime.js.map +1 -1
  79. package/dist/cli/CliOutput.d.ts +27 -0
  80. package/dist/cli/CliOutput.d.ts.map +1 -1
  81. package/dist/cli/CliOutput.js +33 -10
  82. package/dist/cli/CliOutput.js.map +1 -1
  83. package/dist/cli/Command.d.ts.map +1 -1
  84. package/dist/cli/Command.js +6 -3
  85. package/dist/cli/Command.js.map +1 -1
  86. package/dist/cli/Completions.d.ts +3 -3
  87. package/dist/cli/Completions.d.ts.map +1 -1
  88. package/dist/cli/Completions.js +8 -5
  89. package/dist/cli/Completions.js.map +1 -1
  90. package/dist/cli/GlobalFlag.d.ts +5 -4
  91. package/dist/cli/GlobalFlag.d.ts.map +1 -1
  92. package/dist/cli/GlobalFlag.js +3 -3
  93. package/dist/cli/GlobalFlag.js.map +1 -1
  94. package/dist/cli/Prompt.d.ts +17 -1
  95. package/dist/cli/Prompt.d.ts.map +1 -1
  96. package/dist/cli/Prompt.js +119 -114
  97. package/dist/cli/Prompt.js.map +1 -1
  98. package/dist/cli/internal/ansi.d.ts +0 -1
  99. package/dist/cli/internal/ansi.d.ts.map +1 -1
  100. package/dist/cli/internal/ansi.js +20 -3
  101. package/dist/cli/internal/ansi.js.map +1 -1
  102. package/dist/cli/internal/completions/powershell.d.ts +2 -0
  103. package/dist/cli/internal/completions/powershell.d.ts.map +1 -0
  104. package/dist/cli/internal/completions/powershell.js +273 -0
  105. package/dist/cli/internal/completions/powershell.js.map +1 -0
  106. package/dist/cli/internal/completions/zsh.js +3 -2
  107. package/dist/cli/internal/completions/zsh.js.map +1 -1
  108. package/dist/cli/internal/wizard.d.ts +3 -3
  109. package/dist/cli/internal/wizard.d.ts.map +1 -1
  110. package/dist/cli/internal/wizard.js +21 -18
  111. package/dist/cli/internal/wizard.js.map +1 -1
  112. package/dist/cluster/ClusterSchema.d.ts +28 -0
  113. package/dist/cluster/ClusterSchema.d.ts.map +1 -1
  114. package/dist/cluster/ClusterSchema.js +30 -0
  115. package/dist/cluster/ClusterSchema.js.map +1 -1
  116. package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  117. package/dist/cluster/ClusterWorkflowEngine.js +56 -26
  118. package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
  119. package/dist/cluster/MessageStorage.d.ts +18 -3
  120. package/dist/cluster/MessageStorage.d.ts.map +1 -1
  121. package/dist/cluster/MessageStorage.js +31 -11
  122. package/dist/cluster/MessageStorage.js.map +1 -1
  123. package/dist/cluster/Runners.d.ts.map +1 -1
  124. package/dist/cluster/Runners.js +8 -2
  125. package/dist/cluster/Runners.js.map +1 -1
  126. package/dist/cluster/Sharding.d.ts.map +1 -1
  127. package/dist/cluster/Sharding.js +187 -66
  128. package/dist/cluster/Sharding.js.map +1 -1
  129. package/dist/cluster/SqlMessageStorage.d.ts +59 -19
  130. package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
  131. package/dist/cluster/SqlMessageStorage.js +84 -55
  132. package/dist/cluster/SqlMessageStorage.js.map +1 -1
  133. package/dist/cluster/SqlRunnerStorage.d.ts +68 -19
  134. package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
  135. package/dist/cluster/SqlRunnerStorage.js +191 -113
  136. package/dist/cluster/SqlRunnerStorage.js.map +1 -1
  137. package/dist/cluster/internal/entityManager.js +104 -37
  138. package/dist/cluster/internal/entityManager.js.map +1 -1
  139. package/dist/encoding/Sse.d.ts +6 -0
  140. package/dist/encoding/Sse.d.ts.map +1 -1
  141. package/dist/encoding/Sse.js +62 -70
  142. package/dist/encoding/Sse.js.map +1 -1
  143. package/dist/graphql/GraphQL.d.ts +349 -0
  144. package/dist/graphql/GraphQL.d.ts.map +1 -0
  145. package/dist/graphql/GraphQL.js +207 -0
  146. package/dist/graphql/GraphQL.js.map +1 -0
  147. package/dist/graphql/GraphQLClient.d.ts +562 -0
  148. package/dist/graphql/GraphQLClient.d.ts.map +1 -0
  149. package/dist/graphql/GraphQLClient.js +498 -0
  150. package/dist/graphql/GraphQLClient.js.map +1 -0
  151. package/dist/graphql/GraphQLClientError.d.ts +445 -0
  152. package/dist/graphql/GraphQLClientError.d.ts.map +1 -0
  153. package/dist/graphql/GraphQLClientError.js +479 -0
  154. package/dist/graphql/GraphQLClientError.js.map +1 -0
  155. package/dist/graphql/GraphQLGroup.d.ts +118 -0
  156. package/dist/graphql/GraphQLGroup.d.ts.map +1 -0
  157. package/dist/graphql/GraphQLGroup.js +109 -0
  158. package/dist/graphql/GraphQLGroup.js.map +1 -0
  159. package/dist/graphql/GraphQLMiddleware.d.ts +249 -0
  160. package/dist/graphql/GraphQLMiddleware.d.ts.map +1 -0
  161. package/dist/graphql/GraphQLMiddleware.js +130 -0
  162. package/dist/graphql/GraphQLMiddleware.js.map +1 -0
  163. package/dist/graphql/GraphQLProtocol.d.ts +731 -0
  164. package/dist/graphql/GraphQLProtocol.d.ts.map +1 -0
  165. package/dist/graphql/GraphQLProtocol.js +719 -0
  166. package/dist/graphql/GraphQLProtocol.js.map +1 -0
  167. package/dist/graphql/GraphQLResolver.d.ts +453 -0
  168. package/dist/graphql/GraphQLResolver.d.ts.map +1 -0
  169. package/dist/graphql/GraphQLResolver.js +552 -0
  170. package/dist/graphql/GraphQLResolver.js.map +1 -0
  171. package/dist/graphql/index.d.ts +40 -0
  172. package/dist/graphql/index.d.ts.map +1 -0
  173. package/dist/graphql/index.js +41 -0
  174. package/dist/graphql/index.js.map +1 -0
  175. package/dist/http/FindMyWay/internal/router.js +3 -6
  176. package/dist/http/FindMyWay/internal/router.js.map +1 -1
  177. package/dist/http/HttpClient.d.ts +21 -0
  178. package/dist/http/HttpClient.d.ts.map +1 -1
  179. package/dist/http/HttpClient.js +63 -12
  180. package/dist/http/HttpClient.js.map +1 -1
  181. package/dist/http/HttpEffect.d.ts.map +1 -1
  182. package/dist/http/HttpEffect.js +14 -7
  183. package/dist/http/HttpEffect.js.map +1 -1
  184. package/dist/http/HttpMiddleware.d.ts.map +1 -1
  185. package/dist/http/HttpMiddleware.js +31 -32
  186. package/dist/http/HttpMiddleware.js.map +1 -1
  187. package/dist/http/HttpRouter.d.ts +35 -0
  188. package/dist/http/HttpRouter.d.ts.map +1 -1
  189. package/dist/http/HttpRouter.js +35 -0
  190. package/dist/http/HttpRouter.js.map +1 -1
  191. package/dist/http/HttpServerResponse.d.ts +8 -6
  192. package/dist/http/HttpServerResponse.d.ts.map +1 -1
  193. package/dist/http/HttpServerResponse.js +27 -16
  194. package/dist/http/HttpServerResponse.js.map +1 -1
  195. package/dist/http/HttpTraceContext.d.ts.map +1 -1
  196. package/dist/http/HttpTraceContext.js +4 -2
  197. package/dist/http/HttpTraceContext.js.map +1 -1
  198. package/dist/http/Multipart.d.ts.map +1 -1
  199. package/dist/http/Multipart.js +15 -1
  200. package/dist/http/Multipart.js.map +1 -1
  201. package/dist/http-api/HttpApiScalar.d.ts +5 -0
  202. package/dist/http-api/HttpApiScalar.d.ts.map +1 -1
  203. package/dist/http-api/HttpApiScalar.js.map +1 -1
  204. package/dist/internal/dateTime.js +40 -35
  205. package/dist/internal/dateTime.js.map +1 -1
  206. package/dist/internal/effect.js +19 -9
  207. package/dist/internal/effect.js.map +1 -1
  208. package/dist/internal/graphql.d.ts +2 -0
  209. package/dist/internal/graphql.d.ts.map +1 -0
  210. package/dist/internal/graphql.js +195 -0
  211. package/dist/internal/graphql.js.map +1 -0
  212. package/dist/internal/graphqlHeaders.d.ts +4 -0
  213. package/dist/internal/graphqlHeaders.d.ts.map +1 -0
  214. package/dist/internal/graphqlHeaders.js +11 -0
  215. package/dist/internal/graphqlHeaders.js.map +1 -0
  216. package/dist/internal/request.js +20 -1
  217. package/dist/internal/request.js.map +1 -1
  218. package/dist/internal/schema/toCodeDocument.js +4 -1
  219. package/dist/internal/schema/toCodeDocument.js.map +1 -1
  220. package/dist/internal/schema/toJsonSchemaDocument.js +29 -5
  221. package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
  222. package/dist/internal/version.js +1 -1
  223. package/dist/net/AddressResolver.d.ts +145 -0
  224. package/dist/net/AddressResolver.d.ts.map +1 -0
  225. package/dist/net/AddressResolver.js +114 -0
  226. package/dist/net/AddressResolver.js.map +1 -0
  227. package/dist/net/Dns.d.ts +596 -0
  228. package/dist/net/Dns.d.ts.map +1 -0
  229. package/dist/net/Dns.js +549 -0
  230. package/dist/net/Dns.js.map +1 -0
  231. package/dist/net/Host.d.ts +369 -0
  232. package/dist/net/Host.d.ts.map +1 -0
  233. package/dist/net/Host.js +397 -0
  234. package/dist/net/Host.js.map +1 -0
  235. package/dist/net/IpInterface.d.ts +76 -3
  236. package/dist/net/IpInterface.d.ts.map +1 -1
  237. package/dist/net/IpInterface.js +53 -4
  238. package/dist/net/IpInterface.js.map +1 -1
  239. package/dist/net/IpNetwork.d.ts +82 -8
  240. package/dist/net/IpNetwork.d.ts.map +1 -1
  241. package/dist/net/IpNetwork.js +60 -4
  242. package/dist/net/IpNetwork.js.map +1 -1
  243. package/dist/net/NetAddress.d.ts +396 -35
  244. package/dist/net/NetAddress.d.ts.map +1 -1
  245. package/dist/net/NetAddress.js +358 -34
  246. package/dist/net/NetAddress.js.map +1 -1
  247. package/dist/net/index.d.ts +15 -0
  248. package/dist/net/index.d.ts.map +1 -1
  249. package/dist/net/index.js +15 -0
  250. package/dist/net/index.js.map +1 -1
  251. package/dist/observability/OtlpMetrics.d.ts.map +1 -1
  252. package/dist/observability/OtlpMetrics.js +15 -21
  253. package/dist/observability/OtlpMetrics.js.map +1 -1
  254. package/dist/observability/PrometheusMetrics.js +1 -0
  255. package/dist/observability/PrometheusMetrics.js.map +1 -1
  256. package/dist/persistence/PersistedQueue.d.ts +32 -3
  257. package/dist/persistence/PersistedQueue.d.ts.map +1 -1
  258. package/dist/persistence/PersistedQueue.js +75 -16
  259. package/dist/persistence/PersistedQueue.js.map +1 -1
  260. package/dist/rpc/RpcClient.d.ts +22 -6
  261. package/dist/rpc/RpcClient.d.ts.map +1 -1
  262. package/dist/rpc/RpcClient.js +12 -5
  263. package/dist/rpc/RpcClient.js.map +1 -1
  264. package/dist/rpc/RpcServer.d.ts +6 -0
  265. package/dist/rpc/RpcServer.d.ts.map +1 -1
  266. package/dist/rpc/RpcServer.js +78 -29
  267. package/dist/rpc/RpcServer.js.map +1 -1
  268. package/dist/socket/DatagramSocket.d.ts +456 -0
  269. package/dist/socket/DatagramSocket.d.ts.map +1 -0
  270. package/dist/socket/DatagramSocket.js +535 -0
  271. package/dist/socket/DatagramSocket.js.map +1 -0
  272. package/dist/socket/Socket.d.ts +20 -1
  273. package/dist/socket/Socket.d.ts.map +1 -1
  274. package/dist/socket/Socket.js +9 -1
  275. package/dist/socket/Socket.js.map +1 -1
  276. package/dist/socket/index.d.ts +5 -0
  277. package/dist/socket/index.d.ts.map +1 -1
  278. package/dist/socket/index.js +5 -0
  279. package/dist/socket/index.js.map +1 -1
  280. package/dist/sql/Migrator.d.ts.map +1 -1
  281. package/dist/sql/Migrator.js +7 -2
  282. package/dist/sql/Migrator.js.map +1 -1
  283. package/dist/sql/SqlClient.d.ts +7 -1
  284. package/dist/sql/SqlClient.d.ts.map +1 -1
  285. package/dist/sql/SqlClient.js +31 -6
  286. package/dist/sql/SqlClient.js.map +1 -1
  287. package/dist/testing/TestCrypto.d.ts +73 -0
  288. package/dist/testing/TestCrypto.d.ts.map +1 -0
  289. package/dist/testing/TestCrypto.js +87 -0
  290. package/dist/testing/TestCrypto.js.map +1 -0
  291. package/dist/testing/index.d.ts +5 -0
  292. package/dist/testing/index.d.ts.map +1 -1
  293. package/dist/testing/index.js +5 -0
  294. package/dist/testing/index.js.map +1 -1
  295. package/dist/workflow/DurableDeferred.d.ts +54 -0
  296. package/dist/workflow/DurableDeferred.d.ts.map +1 -1
  297. package/dist/workflow/DurableDeferred.js +108 -50
  298. package/dist/workflow/DurableDeferred.js.map +1 -1
  299. package/dist/workflow/WorkflowEngine.d.ts +24 -2
  300. package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
  301. package/dist/workflow/WorkflowEngine.js +13 -3
  302. package/dist/workflow/WorkflowEngine.js.map +1 -1
  303. package/package.json +6 -3
  304. package/src/Context.ts +12 -3
  305. package/src/Crypto.ts +43 -9
  306. package/src/DateTime.ts +9 -6
  307. package/src/Duration.ts +36 -16
  308. package/src/FileSystem.ts +48 -2
  309. package/src/RequestResolver.ts +4 -10
  310. package/src/Scheduler.ts +9 -0
  311. package/src/Schema.ts +677 -5
  312. package/src/SchemaGetter.ts +47 -35
  313. package/src/Sink.ts +45 -18
  314. package/src/Stdio.ts +9 -2
  315. package/src/Stream.ts +44 -15
  316. package/src/Utils.ts +8 -5
  317. package/src/ai/AnthropicStructuredOutput.ts +2 -2
  318. package/src/ai/Chat.ts +2 -2
  319. package/src/ai/LanguageModel.ts +96 -24
  320. package/src/ai/McpServer.ts +288 -94
  321. package/src/ai/Prompt.ts +24 -10
  322. package/src/ai/Response.ts +6 -3
  323. package/src/ai/internal/mcpProtocol/v2026_07_28.ts +5 -0
  324. package/src/ai/internal/mcpProtocol.ts +3 -0
  325. package/src/ai/internal/mcpRuntime.ts +2 -0
  326. package/src/cli/CliOutput.ts +33 -16
  327. package/src/cli/Command.ts +4 -3
  328. package/src/cli/Completions.ts +9 -6
  329. package/src/cli/GlobalFlag.ts +19 -11
  330. package/src/cli/Prompt.ts +159 -149
  331. package/src/cli/internal/ansi.ts +26 -3
  332. package/src/cli/internal/completions/powershell.ts +322 -0
  333. package/src/cli/internal/completions/zsh.ts +4 -2
  334. package/src/cli/internal/wizard.ts +34 -26
  335. package/src/cluster/ClusterSchema.ts +32 -0
  336. package/src/cluster/ClusterWorkflowEngine.ts +64 -36
  337. package/src/cluster/MessageStorage.ts +45 -14
  338. package/src/cluster/Runners.ts +8 -2
  339. package/src/cluster/Sharding.ts +219 -58
  340. package/src/cluster/SqlMessageStorage.ts +118 -84
  341. package/src/cluster/SqlRunnerStorage.ts +224 -128
  342. package/src/cluster/internal/entityManager.ts +151 -55
  343. package/src/encoding/Sse.ts +69 -79
  344. package/src/graphql/GraphQL.ts +494 -0
  345. package/src/graphql/GraphQLClient.ts +912 -0
  346. package/src/graphql/GraphQLClientError.ts +542 -0
  347. package/src/graphql/GraphQLGroup.ts +167 -0
  348. package/src/graphql/GraphQLMiddleware.ts +253 -0
  349. package/src/graphql/GraphQLProtocol.ts +1286 -0
  350. package/src/graphql/GraphQLResolver.ts +1010 -0
  351. package/src/graphql/index.ts +48 -0
  352. package/src/http/FindMyWay/internal/router.ts +4 -7
  353. package/src/http/HttpClient.ts +110 -12
  354. package/src/http/HttpEffect.ts +11 -5
  355. package/src/http/HttpMiddleware.ts +33 -34
  356. package/src/http/HttpRouter.ts +35 -0
  357. package/src/http/HttpServerResponse.ts +28 -16
  358. package/src/http/HttpTraceContext.ts +8 -2
  359. package/src/http/Multipart.ts +17 -1
  360. package/src/http-api/HttpApiScalar.ts +5 -0
  361. package/src/internal/dateTime.ts +13 -10
  362. package/src/internal/effect.ts +22 -15
  363. package/src/internal/graphql.ts +263 -0
  364. package/src/internal/graphqlHeaders.ts +11 -0
  365. package/src/internal/request.ts +31 -3
  366. package/src/internal/schema/toCodeDocument.ts +7 -1
  367. package/src/internal/schema/toJsonSchemaDocument.ts +34 -2
  368. package/src/internal/version.ts +1 -1
  369. package/src/net/AddressResolver.ts +222 -0
  370. package/src/net/Dns.ts +1035 -0
  371. package/src/net/Host.ts +544 -0
  372. package/src/net/IpInterface.ts +117 -7
  373. package/src/net/IpNetwork.ts +116 -17
  374. package/src/net/NetAddress.ts +620 -76
  375. package/src/net/index.ts +18 -0
  376. package/src/observability/OtlpMetrics.ts +12 -23
  377. package/src/observability/PrometheusMetrics.ts +1 -0
  378. package/src/persistence/PersistedQueue.ts +146 -53
  379. package/src/rpc/RpcClient.ts +41 -19
  380. package/src/rpc/RpcServer.ts +115 -40
  381. package/src/socket/DatagramSocket.ts +919 -0
  382. package/src/socket/Socket.ts +28 -2
  383. package/src/socket/index.ts +6 -0
  384. package/src/sql/Migrator.ts +21 -5
  385. package/src/sql/SqlClient.ts +39 -15
  386. package/src/testing/TestCrypto.ts +94 -0
  387. package/src/testing/index.ts +6 -0
  388. package/src/workflow/DurableDeferred.ts +160 -47
  389. package/src/workflow/WorkflowEngine.ts +50 -5
package/src/Schema.ts CHANGED
@@ -37,6 +37,7 @@ import * as HashSet_ from "./HashSet.ts"
37
37
  import * as Cookies_ from "./http/Cookies.ts"
38
38
  import * as Headers_ from "./http/Headers.ts"
39
39
  import * as UrlParams_ from "./http/UrlParams.ts"
40
+ import { NodeInspectSymbol } from "./Inspectable.ts"
40
41
  import * as core from "./internal/core.ts"
41
42
  import { effectIsExit } from "./internal/effect.ts"
42
43
  import * as InternalGraph from "./internal/graph.ts"
@@ -56,6 +57,8 @@ import { isSchemaError as isSchemaErrorInternal, SchemaErrorTypeId } from "./int
56
57
  import { getStackTraceLimit, setStackTraceLimit } from "./internal/stackTraceLimit.ts"
57
58
  import type * as JsonPatch from "./JsonPatch.ts"
58
59
  import type * as JsonSchema from "./JsonSchema.ts"
60
+ import * as Dns_ from "./net/Dns.ts"
61
+ import * as Host_ from "./net/Host.ts"
59
62
  import * as IpInterface_ from "./net/IpInterface.ts"
60
63
  import * as IpNetwork_ from "./net/IpNetwork.ts"
61
64
  import * as NetAddress_ from "./net/NetAddress.ts"
@@ -1217,6 +1220,15 @@ export class SchemaError extends Data.TaggedError("SchemaError")<{
1217
1220
  override get message() {
1218
1221
  return SchemaIssue.defaultFormatter(this.issue)
1219
1222
  }
1223
+ override toJSON() {
1224
+ return {
1225
+ _tag: this._tag,
1226
+ message: this.message
1227
+ }
1228
+ }
1229
+ override [NodeInspectSymbol]() {
1230
+ return this.toJSON()
1231
+ }
1220
1232
  override toString() {
1221
1233
  return `SchemaError(${this.message})`
1222
1234
  }
@@ -4017,6 +4029,7 @@ export declare namespace StructWithRest {
4017
4029
  */
4018
4030
  type Objects = Constraint & {
4019
4031
  readonly ast: SchemaAST.Objects
4032
+ readonly Encoded: object
4020
4033
  }
4021
4034
  /**
4022
4035
  * Readonly list of record schemas that provide the additional index signatures
@@ -4186,6 +4199,13 @@ export interface StructWithRest<
4186
4199
  *
4187
4200
  * **Gotchas**
4188
4201
  *
4202
+ * The base schema must have an object-shaped encoded type. Whole-object
4203
+ * transformations are not supported, even with an empty rest array. Apply
4204
+ * transformations such as `Schema.fromJsonString` to the completed
4205
+ * `StructWithRest` schema instead. Object-shaped encoded types alone do not
4206
+ * guarantee compatibility: unsupported encodings are still rejected at runtime.
4207
+ * Transformations on individual fields remain supported.
4208
+ *
4189
4209
  * TypeScript index signatures also apply to fixed keys. `StructWithRest` does
4190
4210
  * not reject incompatible fixed fields at the call site; use
4191
4211
  * `StructWithRest.ValidateRecords` when you want an explicit type-level
@@ -7877,7 +7897,8 @@ export function isMultipleOf(
7877
7897
  *
7878
7898
  * JSON Schema:
7879
7899
  *
7880
- * This check corresponds to the `type: "integer"` constraint in JSON Schema.
7900
+ * This check corresponds to `type: "integer"` with `minimum: Number.MIN_SAFE_INTEGER`
7901
+ * and `maximum: Number.MAX_SAFE_INTEGER` in JSON Schema.
7881
7902
  *
7882
7903
  * Arbitrary:
7883
7904
  *
@@ -7896,7 +7917,11 @@ export function isInt(annotations?: Annotations.Filter) {
7896
7917
  id: "effect/schema/isInt",
7897
7918
  payload: null
7898
7919
  },
7899
- toJsonSchema: () => [{ type: "integer" }, true],
7920
+ toJsonSchema: () => ({
7921
+ type: "integer",
7922
+ minimum: globalThis.Number.MIN_SAFE_INTEGER,
7923
+ maximum: globalThis.Number.MAX_SAFE_INTEGER
7924
+ }),
7900
7925
  toCode: () => ({ runtime: "Schema.isInt()" }),
7901
7926
  arbitraryConstraint: {
7902
7927
  number: "integer"
@@ -11978,10 +12003,10 @@ export const DateTimeZonedFromString: DateTimeZonedFromString = DateTimeZonedStr
11978
12003
  decodeTo(DateTimeZoned, dateTimeZonedFromString)
11979
12004
  )
11980
12005
 
11981
- const netAddressFromString = <S extends declare<any>, E extends { readonly message: string }>(
12006
+ const netAddressFromString = <S extends Constraint, E extends { readonly message: string }>(
11982
12007
  declaration: S,
11983
- parse: (input: string) => Result_.Result<S["Type"], E>,
11984
- encode: (value: S["Type"]) => string,
12008
+ parse: (input: string) => Result_.Result<S["Encoded"], E>,
12009
+ encode: (value: S["Encoded"]) => string,
11985
12010
  identifier: string
11986
12011
  ) =>
11987
12012
  String.pipe(decodeTo(
@@ -13332,6 +13357,229 @@ export const SocketAddress: SocketAddress = declare(NetAddress_.isSocketAddress,
13332
13357
  identifier: "SocketAddress"
13333
13358
  })
13334
13359
 
13360
+ /**
13361
+ * Type-level representation of {@link DomainName}.
13362
+ *
13363
+ * @stability experimental
13364
+ * @category models
13365
+ * @since 4.0.0
13366
+ */
13367
+ export interface DomainName extends brand<String, "~effect/net/Host/DomainName"> {
13368
+ readonly "Rebuild": DomainName
13369
+ }
13370
+
13371
+ /**
13372
+ * Schema for normalized DNS domain names.
13373
+ *
13374
+ * **Details**
13375
+ *
13376
+ * Only names already in normalized form (lowercase ASCII, with
13377
+ * internationalized labels in `xn--` form) are accepted. Use
13378
+ * {@link DomainNameFromString} to normalize arbitrary input.
13379
+ *
13380
+ * @stability experimental
13381
+ * @category schemas
13382
+ * @since 4.0.0
13383
+ */
13384
+ export const DomainName: DomainName = String.check(
13385
+ makeFilter(Host_.isDomainName, { expected: "a normalized domain name" })
13386
+ ).pipe(brand("~effect/net/Host/DomainName")).annotate({ identifier: "DomainName" })
13387
+
13388
+ /**
13389
+ * Type-level representation of {@link DomainNameFromString}.
13390
+ *
13391
+ * @stability experimental
13392
+ * @category models
13393
+ * @since 4.0.0
13394
+ */
13395
+ export interface DomainNameFromString extends decodeTo<DomainName, String> {
13396
+ readonly "Rebuild": DomainNameFromString
13397
+ }
13398
+
13399
+ /**
13400
+ * Schema for DNS domain names decoded from strings, normalizing case and
13401
+ * converting internationalized names to their ASCII form.
13402
+ *
13403
+ * @stability experimental
13404
+ * @category schemas
13405
+ * @since 4.0.0
13406
+ */
13407
+ export const DomainNameFromString: DomainNameFromString = netAddressFromString(
13408
+ DomainName,
13409
+ Host_.domainNameFromString,
13410
+ (name) => name,
13411
+ "DomainNameFromString"
13412
+ )
13413
+
13414
+ /**
13415
+ * Type-level representation of {@link ScopedIpv6Literal}.
13416
+ *
13417
+ * @stability experimental
13418
+ * @category models
13419
+ * @since 4.0.0
13420
+ */
13421
+ export interface ScopedIpv6Literal extends brand<String, "~effect/net/NetAddress/ScopedIpv6Literal"> {
13422
+ readonly "Rebuild": ScopedIpv6Literal
13423
+ }
13424
+
13425
+ /**
13426
+ * Schema for canonical scoped IPv6 literals such as `fe80::1%eth0`.
13427
+ *
13428
+ * @stability experimental
13429
+ * @category schemas
13430
+ * @since 4.0.0
13431
+ */
13432
+ export const ScopedIpv6Literal: ScopedIpv6Literal = String.check(
13433
+ makeFilter(NetAddress_.isScopedIpv6Literal, { expected: "a canonical scoped IPv6 literal" })
13434
+ ).pipe(brand("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({ identifier: "ScopedIpv6Literal" })
13435
+
13436
+ /**
13437
+ * Type-level representation of {@link ScopedIpv6LiteralFromString}.
13438
+ *
13439
+ * @stability experimental
13440
+ * @category models
13441
+ * @since 4.0.0
13442
+ */
13443
+ export interface ScopedIpv6LiteralFromString extends decodeTo<ScopedIpv6Literal, String> {
13444
+ readonly "Rebuild": ScopedIpv6LiteralFromString
13445
+ }
13446
+
13447
+ /**
13448
+ * Schema for scoped IPv6 literals decoded from strings, normalizing the address
13449
+ * and numeric zones.
13450
+ *
13451
+ * @stability experimental
13452
+ * @category schemas
13453
+ * @since 4.0.0
13454
+ */
13455
+ export const ScopedIpv6LiteralFromString: ScopedIpv6LiteralFromString = netAddressFromString(
13456
+ ScopedIpv6Literal,
13457
+ NetAddress_.scopedIpv6LiteralFromString,
13458
+ (literal) => literal,
13459
+ "ScopedIpv6LiteralFromString"
13460
+ )
13461
+
13462
+ /**
13463
+ * Type-level representation of {@link Host}.
13464
+ *
13465
+ * @stability experimental
13466
+ * @category models
13467
+ * @since 4.0.0
13468
+ */
13469
+ export interface Host extends Union<readonly [IpAddress, ScopedIpv6Literal, DomainName]> {
13470
+ readonly "Rebuild": Host
13471
+ }
13472
+
13473
+ /**
13474
+ * Schema for hosts: numeric IP addresses, scoped IPv6 literals, or domain names.
13475
+ *
13476
+ * @stability experimental
13477
+ * @category schemas
13478
+ * @since 4.0.0
13479
+ */
13480
+ export const Host: Host = Union([IpAddress, ScopedIpv6Literal, DomainName]).annotate({ identifier: "Host" })
13481
+
13482
+ /**
13483
+ * Type-level representation of {@link HostFromString}.
13484
+ *
13485
+ * @stability experimental
13486
+ * @category models
13487
+ * @since 4.0.0
13488
+ */
13489
+ export interface HostFromString
13490
+ extends Union<readonly [IpAddressFromString, ScopedIpv6LiteralFromString, DomainNameFromString]>
13491
+ {
13492
+ readonly "Rebuild": HostFromString
13493
+ }
13494
+
13495
+ /**
13496
+ * Schema for hosts decoded from strings. Numeric IP strings decode to IP
13497
+ * addresses; other strings decode to scoped IPv6 literals or domain names.
13498
+ *
13499
+ * @stability experimental
13500
+ * @category schemas
13501
+ * @since 4.0.0
13502
+ */
13503
+ export const HostFromString: HostFromString = Union([
13504
+ IpAddressFromString,
13505
+ ScopedIpv6LiteralFromString,
13506
+ DomainNameFromString
13507
+ ]).annotate({ identifier: "HostFromString" })
13508
+
13509
+ /**
13510
+ * Type-level representation of {@link HostPort}.
13511
+ *
13512
+ * @stability experimental
13513
+ * @category models
13514
+ * @since 4.0.0
13515
+ */
13516
+ export interface HostPort extends declare<Host_.HostPort> {
13517
+ readonly "Rebuild": HostPort
13518
+ }
13519
+
13520
+ /**
13521
+ * Schema for already-constructed unresolved host and port values.
13522
+ *
13523
+ * @stability experimental
13524
+ * @category schemas
13525
+ * @since 4.0.0
13526
+ */
13527
+ export const HostPort: HostPort = declare(Host_.isHostPort, {
13528
+ identifier: "HostPort"
13529
+ })
13530
+
13531
+ /**
13532
+ * Type-level representation of {@link HostPortFromString}.
13533
+ *
13534
+ * @stability experimental
13535
+ * @category models
13536
+ * @since 4.0.0
13537
+ */
13538
+ export interface HostPortFromString extends decodeTo<HostPort, String> {
13539
+ readonly "Rebuild": HostPortFromString
13540
+ }
13541
+
13542
+ /**
13543
+ * Schema for unresolved endpoints encoded as `host:port` or `[IPv6]:port`
13544
+ * strings.
13545
+ *
13546
+ * @stability experimental
13547
+ * @category schemas
13548
+ * @since 4.0.0
13549
+ */
13550
+ export const HostPortFromString: HostPortFromString = netAddressFromString(
13551
+ HostPort,
13552
+ Host_.hostPortFromString,
13553
+ Host_.formatHostPort,
13554
+ "HostPortFromString"
13555
+ )
13556
+
13557
+ /**
13558
+ * Type-level representation of {@link Port}.
13559
+ *
13560
+ * @stability experimental
13561
+ * @category models
13562
+ * @since 4.0.0
13563
+ */
13564
+ export interface Port extends Int {
13565
+ readonly "Rebuild": Port
13566
+ }
13567
+
13568
+ /**
13569
+ * Schema for TCP and UDP port numbers from 0 through 65535.
13570
+ *
13571
+ * **Details**
13572
+ *
13573
+ * Port 0 is accepted because it asks the operating system to choose a port
13574
+ * when binding, and it matches the port range of `InetAddress` and `HostPort`.
13575
+ * `Config.Port` accepts only 1 through 65535.
13576
+ *
13577
+ * @stability experimental
13578
+ * @category schemas
13579
+ * @since 4.0.0
13580
+ */
13581
+ export const Port: Port = Int.check(isBetween({ minimum: 0, maximum: 65535 }, { expected: "a port number" }))
13582
+
13335
13583
  // -----------------------------------------------------------------------------
13336
13584
  // Duration schemas
13337
13585
  // -----------------------------------------------------------------------------
@@ -13549,6 +13797,426 @@ export const DurationFromMillis: DurationFromMillis = Number.pipe(
13549
13797
  decodeTo(Duration, durationFromMillis)
13550
13798
  )
13551
13799
 
13800
+ // -----------------------------------------------------------------------------
13801
+ // DNS schemas
13802
+ // -----------------------------------------------------------------------------
13803
+
13804
+ /**
13805
+ * Type-level representation of {@link DnsRecordType}.
13806
+ *
13807
+ * @stability experimental
13808
+ * @category models
13809
+ * @since 4.0.0
13810
+ */
13811
+ export interface DnsRecordType extends Literals<ReadonlyArray<Dns_.RecordType>> {}
13812
+
13813
+ /**
13814
+ * Schema for supported DNS record types such as `"A"` or `"SRV"`.
13815
+ *
13816
+ * @stability experimental
13817
+ * @category schemas
13818
+ * @since 4.0.0
13819
+ */
13820
+ export const DnsRecordType: DnsRecordType = Literals(Dns_.recordTypes)
13821
+
13822
+ // Addresses in JSON records must already be canonical; normalizing input is
13823
+ // left to the `*FromString` schemas.
13824
+ const dnsCanonicalAddress = <A extends NetAddress_.IpAddress>(
13825
+ schema: Codec<A>,
13826
+ parse: (input: string) => Result_.Result<A, NetAddress_.NetAddressError>
13827
+ ) =>
13828
+ String.pipe(decodeTo(
13829
+ schema,
13830
+ SchemaTransformation.transformEffect({
13831
+ decode: (input, options) => {
13832
+ const result = parse(input)
13833
+ if (Result_.isFailure(result)) {
13834
+ return Effect.fail(new SchemaIssue.InvalidValue({ message: result.failure.message }, input, options))
13835
+ }
13836
+ return NetAddress_.formatIp(result.success) === input
13837
+ ? Effect.succeed(result.success)
13838
+ : Effect.fail(new SchemaIssue.InvalidValue({ message: "expected a canonical address" }, input, options))
13839
+ },
13840
+ encode: (address) => Effect.succeed(NetAddress_.formatIp(address))
13841
+ })
13842
+ ))
13843
+
13844
+ const dnsUint8 = Int.check(isBetween({ minimum: 0, maximum: 0xff }))
13845
+
13846
+ const dnsUint16 = Int.check(isBetween({ minimum: 0, maximum: 0xffff }))
13847
+
13848
+ const dnsUint32 = Int.check(isBetween({ minimum: 0, maximum: 0xffffffff }))
13849
+
13850
+ // SOA timers are written as whole seconds, as in zone files.
13851
+ const dnsSeconds = dnsUint32.pipe(decodeTo(
13852
+ Duration,
13853
+ SchemaTransformation.transform({ decode: Duration_.seconds, encode: Duration_.toSeconds })
13854
+ ))
13855
+
13856
+ // Each record type is an opaque value whose JSON form is a plain object tagged
13857
+ // by record type, such as `{ "_tag": "MX", "exchange": "mail.example.com", "priority": 10 }`.
13858
+ const dnsRecordOfType = <T extends Dns_.RecordType>(
13859
+ type: T,
13860
+ fields: { readonly [K in keyof Dns_.RecordFields<T>]-?: Codec<Dns_.RecordFields<T>[K], unknown> }
13861
+ ) =>
13862
+ declare((u): u is Dns_.RecordFor<T> => Dns_.isDnsRecord(u) && u._tag === type, {
13863
+ identifier: `Dns${type.charAt(0)}${type.slice(1).toLowerCase()}Record`,
13864
+ toCodecJson: () => {
13865
+ const json = TaggedStruct(type, fields)
13866
+ return link<Dns_.RecordFor<T>>()(
13867
+ json,
13868
+ SchemaTransformation.transformEffect({
13869
+ decode: (input, options) => {
13870
+ const { _tag, ...rest } = input as { readonly _tag: T }
13871
+ const result = Dns_.makeRecord(type, rest as Dns_.RecordFields<T>)
13872
+ return Result_.isSuccess(result)
13873
+ ? Effect.succeed(result.success)
13874
+ : Effect.fail(new SchemaIssue.InvalidValue({ message: result.failure.message }, input, options))
13875
+ },
13876
+ // Records hold only their tag and fields as own properties.
13877
+ encode: (record) => Effect.succeed({ ...record } as unknown as typeof json["Type"])
13878
+ })
13879
+ )
13880
+ }
13881
+ })
13882
+
13883
+ /**
13884
+ * Type-level representation of {@link DnsARecord}.
13885
+ *
13886
+ * @stability experimental
13887
+ * @category models
13888
+ * @since 4.0.0
13889
+ */
13890
+ export interface DnsARecord extends declare<Dns_.A> {
13891
+ readonly "Rebuild": DnsARecord
13892
+ }
13893
+
13894
+ /**
13895
+ * Schema for already-constructed IPv4 address (`A`) DNS records.
13896
+ *
13897
+ * @stability experimental
13898
+ * @category schemas
13899
+ * @since 4.0.0
13900
+ */
13901
+ export const DnsARecord: DnsARecord = dnsRecordOfType("A", {
13902
+ address: dnsCanonicalAddress(Ipv4Address, NetAddress_.ipv4FromString)
13903
+ })
13904
+
13905
+ /**
13906
+ * Type-level representation of {@link DnsAaaaRecord}.
13907
+ *
13908
+ * @stability experimental
13909
+ * @category models
13910
+ * @since 4.0.0
13911
+ */
13912
+ export interface DnsAaaaRecord extends declare<Dns_.Aaaa> {
13913
+ readonly "Rebuild": DnsAaaaRecord
13914
+ }
13915
+
13916
+ /**
13917
+ * Schema for already-constructed IPv6 address (`AAAA`) DNS records.
13918
+ *
13919
+ * @stability experimental
13920
+ * @category schemas
13921
+ * @since 4.0.0
13922
+ */
13923
+ export const DnsAaaaRecord: DnsAaaaRecord = dnsRecordOfType("AAAA", {
13924
+ address: dnsCanonicalAddress(Ipv6Address, NetAddress_.ipv6FromString)
13925
+ })
13926
+
13927
+ /**
13928
+ * Type-level representation of {@link DnsCaaRecord}.
13929
+ *
13930
+ * @stability experimental
13931
+ * @category models
13932
+ * @since 4.0.0
13933
+ */
13934
+ export interface DnsCaaRecord extends declare<Dns_.Caa> {
13935
+ readonly "Rebuild": DnsCaaRecord
13936
+ }
13937
+
13938
+ /**
13939
+ * Schema for already-constructed certification authority authorization (`CAA`) DNS records.
13940
+ *
13941
+ * @stability experimental
13942
+ * @category schemas
13943
+ * @since 4.0.0
13944
+ */
13945
+ export const DnsCaaRecord: DnsCaaRecord = dnsRecordOfType("CAA", {
13946
+ critical: Boolean,
13947
+ tag: String.check(isPattern(/^[a-z0-9]+$/i)),
13948
+ value: String
13949
+ })
13950
+
13951
+ /**
13952
+ * Type-level representation of {@link DnsCnameRecord}.
13953
+ *
13954
+ * @stability experimental
13955
+ * @category models
13956
+ * @since 4.0.0
13957
+ */
13958
+ export interface DnsCnameRecord extends declare<Dns_.Cname> {
13959
+ readonly "Rebuild": DnsCnameRecord
13960
+ }
13961
+
13962
+ /**
13963
+ * Schema for already-constructed canonical name (`CNAME`) DNS records.
13964
+ *
13965
+ * @stability experimental
13966
+ * @category schemas
13967
+ * @since 4.0.0
13968
+ */
13969
+ export const DnsCnameRecord: DnsCnameRecord = dnsRecordOfType("CNAME", { target: DomainName })
13970
+
13971
+ /**
13972
+ * Type-level representation of {@link DnsMxRecord}.
13973
+ *
13974
+ * @stability experimental
13975
+ * @category models
13976
+ * @since 4.0.0
13977
+ */
13978
+ export interface DnsMxRecord extends declare<Dns_.Mx> {
13979
+ readonly "Rebuild": DnsMxRecord
13980
+ }
13981
+
13982
+ /**
13983
+ * Schema for already-constructed mail exchange (`MX`) DNS records.
13984
+ *
13985
+ * @stability experimental
13986
+ * @category schemas
13987
+ * @since 4.0.0
13988
+ */
13989
+ export const DnsMxRecord: DnsMxRecord = dnsRecordOfType("MX", { exchange: DomainName, priority: dnsUint16 })
13990
+
13991
+ /**
13992
+ * Type-level representation of {@link DnsNaptrRecord}.
13993
+ *
13994
+ * @stability experimental
13995
+ * @category models
13996
+ * @since 4.0.0
13997
+ */
13998
+ export interface DnsNaptrRecord extends declare<Dns_.Naptr> {
13999
+ readonly "Rebuild": DnsNaptrRecord
14000
+ }
14001
+
14002
+ /**
14003
+ * Schema for already-constructed naming authority pointer (`NAPTR`) DNS records.
14004
+ *
14005
+ * @stability experimental
14006
+ * @category schemas
14007
+ * @since 4.0.0
14008
+ */
14009
+ export const DnsNaptrRecord: DnsNaptrRecord = dnsRecordOfType("NAPTR", {
14010
+ order: dnsUint16,
14011
+ preference: dnsUint16,
14012
+ flags: String,
14013
+ service: String,
14014
+ regexp: String,
14015
+ replacement: DomainName
14016
+ })
14017
+
14018
+ /**
14019
+ * Type-level representation of {@link DnsNsRecord}.
14020
+ *
14021
+ * @stability experimental
14022
+ * @category models
14023
+ * @since 4.0.0
14024
+ */
14025
+ export interface DnsNsRecord extends declare<Dns_.Ns> {
14026
+ readonly "Rebuild": DnsNsRecord
14027
+ }
14028
+
14029
+ /**
14030
+ * Schema for already-constructed name server (`NS`) DNS records.
14031
+ *
14032
+ * @stability experimental
14033
+ * @category schemas
14034
+ * @since 4.0.0
14035
+ */
14036
+ export const DnsNsRecord: DnsNsRecord = dnsRecordOfType("NS", { host: DomainName })
14037
+
14038
+ /**
14039
+ * Type-level representation of {@link DnsPtrRecord}.
14040
+ *
14041
+ * @stability experimental
14042
+ * @category models
14043
+ * @since 4.0.0
14044
+ */
14045
+ export interface DnsPtrRecord extends declare<Dns_.Ptr> {
14046
+ readonly "Rebuild": DnsPtrRecord
14047
+ }
14048
+
14049
+ /**
14050
+ * Schema for already-constructed pointer (`PTR`) DNS records.
14051
+ *
14052
+ * @stability experimental
14053
+ * @category schemas
14054
+ * @since 4.0.0
14055
+ */
14056
+ export const DnsPtrRecord: DnsPtrRecord = dnsRecordOfType("PTR", { host: NonEmptyString })
14057
+
14058
+ /**
14059
+ * Type-level representation of {@link DnsSoaRecord}.
14060
+ *
14061
+ * @stability experimental
14062
+ * @category models
14063
+ * @since 4.0.0
14064
+ */
14065
+ export interface DnsSoaRecord extends declare<Dns_.Soa> {
14066
+ readonly "Rebuild": DnsSoaRecord
14067
+ }
14068
+
14069
+ /**
14070
+ * Schema for already-constructed start of authority (`SOA`) DNS records.
14071
+ *
14072
+ * @stability experimental
14073
+ * @category schemas
14074
+ * @since 4.0.0
14075
+ */
14076
+ export const DnsSoaRecord: DnsSoaRecord = dnsRecordOfType("SOA", {
14077
+ primary: DomainName,
14078
+ admin: NonEmptyString,
14079
+ serial: dnsUint32,
14080
+ refresh: dnsSeconds,
14081
+ retry: dnsSeconds,
14082
+ expire: dnsSeconds,
14083
+ minimum: dnsSeconds
14084
+ })
14085
+
14086
+ /**
14087
+ * Type-level representation of {@link DnsSrvRecord}.
14088
+ *
14089
+ * @stability experimental
14090
+ * @category models
14091
+ * @since 4.0.0
14092
+ */
14093
+ export interface DnsSrvRecord extends declare<Dns_.Srv> {
14094
+ readonly "Rebuild": DnsSrvRecord
14095
+ }
14096
+
14097
+ /**
14098
+ * Schema for already-constructed service locator (`SRV`) DNS records.
14099
+ *
14100
+ * @stability experimental
14101
+ * @category schemas
14102
+ * @since 4.0.0
14103
+ */
14104
+ export const DnsSrvRecord: DnsSrvRecord = dnsRecordOfType("SRV", {
14105
+ target: DomainName,
14106
+ port: dnsUint16,
14107
+ priority: dnsUint16,
14108
+ weight: dnsUint16
14109
+ })
14110
+
14111
+ /**
14112
+ * Type-level representation of {@link DnsTlsaRecord}.
14113
+ *
14114
+ * @stability experimental
14115
+ * @category models
14116
+ * @since 4.0.0
14117
+ */
14118
+ export interface DnsTlsaRecord extends declare<Dns_.Tlsa> {
14119
+ readonly "Rebuild": DnsTlsaRecord
14120
+ }
14121
+
14122
+ /**
14123
+ * Schema for already-constructed TLS authentication (`TLSA`) DNS records.
14124
+ *
14125
+ * **Details**
14126
+ *
14127
+ * The default JSON serializer encodes the certificate association `data` as a
14128
+ * hex string.
14129
+ *
14130
+ * @stability experimental
14131
+ * @category schemas
14132
+ * @since 4.0.0
14133
+ */
14134
+ export const DnsTlsaRecord: DnsTlsaRecord = dnsRecordOfType("TLSA", {
14135
+ certUsage: dnsUint8,
14136
+ selector: dnsUint8,
14137
+ matchingType: dnsUint8,
14138
+ data: Uint8ArrayFromHex
14139
+ })
14140
+
14141
+ /**
14142
+ * Type-level representation of {@link DnsTxtRecord}.
14143
+ *
14144
+ * @stability experimental
14145
+ * @category models
14146
+ * @since 4.0.0
14147
+ */
14148
+ export interface DnsTxtRecord extends declare<Dns_.Txt> {
14149
+ readonly "Rebuild": DnsTxtRecord
14150
+ }
14151
+
14152
+ /**
14153
+ * Schema for already-constructed text (`TXT`) DNS records.
14154
+ *
14155
+ * @stability experimental
14156
+ * @category schemas
14157
+ * @since 4.0.0
14158
+ */
14159
+ export const DnsTxtRecord: DnsTxtRecord = dnsRecordOfType("TXT", { chunks: NonEmptyArray(String) })
14160
+
14161
+ /**
14162
+ * Type-level representation of {@link DnsRecord}.
14163
+ *
14164
+ * @stability experimental
14165
+ * @category models
14166
+ * @since 4.0.0
14167
+ */
14168
+ export interface DnsRecord extends
14169
+ Union<
14170
+ readonly [
14171
+ DnsARecord,
14172
+ DnsAaaaRecord,
14173
+ DnsCaaRecord,
14174
+ DnsCnameRecord,
14175
+ DnsMxRecord,
14176
+ DnsNaptrRecord,
14177
+ DnsNsRecord,
14178
+ DnsPtrRecord,
14179
+ DnsSoaRecord,
14180
+ DnsSrvRecord,
14181
+ DnsTlsaRecord,
14182
+ DnsTxtRecord
14183
+ ]
14184
+ >
14185
+ {
14186
+ readonly "Rebuild": DnsRecord
14187
+ }
14188
+
14189
+ /**
14190
+ * Schema for already-constructed DNS records of any supported record type.
14191
+ *
14192
+ * **Details**
14193
+ *
14194
+ * The default JSON serializer encodes records as objects tagged by record type,
14195
+ * with addresses and names as canonical strings, SOA timers as whole seconds,
14196
+ * and TLSA data as hex, such as
14197
+ * `{ "_tag": "SRV", "target": "db.internal", "port": 5432, "priority": 10, "weight": 5 }`.
14198
+ * Decoding accepts only canonical addresses and normalized domain names, and
14199
+ * reports invalid fields with their path.
14200
+ *
14201
+ * @stability experimental
14202
+ * @category schemas
14203
+ * @since 4.0.0
14204
+ */
14205
+ export const DnsRecord: DnsRecord = Union([
14206
+ DnsARecord,
14207
+ DnsAaaaRecord,
14208
+ DnsCaaRecord,
14209
+ DnsCnameRecord,
14210
+ DnsMxRecord,
14211
+ DnsNaptrRecord,
14212
+ DnsNsRecord,
14213
+ DnsPtrRecord,
14214
+ DnsSoaRecord,
14215
+ DnsSrvRecord,
14216
+ DnsTlsaRecord,
14217
+ DnsTxtRecord
14218
+ ]).annotate({ identifier: "DnsRecord" })
14219
+
13552
14220
  // -----------------------------------------------------------------------------
13553
14221
  // Exit schemas
13554
14222
  // -----------------------------------------------------------------------------
@@ -15141,6 +15809,10 @@ export interface Class<Self, S extends Constraint & { readonly fields: Struct.Fi
15141
15809
  *
15142
15810
  * **Gotchas**
15143
15811
  *
15812
+ * Fields with the same name replace inherited fields. Use this to refine
15813
+ * validation or change encoding. Effect does not check compatibility; the
15814
+ * caller must ensure the replacement preserves the base class contract.
15815
+ *
15144
15816
  * Checks from a `Struct` argument are evaluated against the full subclass
15145
15817
  * value after inherited and extension fields are merged. Object-wide checks
15146
15818
  * such as `isMaxProperties` count inherited fields too.