@hulla/db 0.0.0-stage → 0.1.0

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 (338) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +263 -2
  3. package/THIRD_PARTY_NOTICES.md +850 -0
  4. package/dist/aggregate.d.ts +63 -0
  5. package/dist/aggregate.js +147 -0
  6. package/dist/auth.d.ts +10 -0
  7. package/dist/auth.js +22 -0
  8. package/dist/bindings.d.ts +56 -0
  9. package/dist/bindings.js +277 -0
  10. package/dist/browser.d.ts +12 -0
  11. package/dist/browser.js +24 -0
  12. package/dist/callable.d.ts +48 -0
  13. package/dist/callable.js +142 -0
  14. package/dist/cli.d.ts +2 -0
  15. package/dist/cli.js +65 -0
  16. package/dist/codec.d.ts +32 -0
  17. package/dist/codec.js +129 -0
  18. package/dist/codegen.d.ts +19 -0
  19. package/dist/codegen.js +275 -0
  20. package/dist/config.d.ts +70 -0
  21. package/dist/config.js +100 -0
  22. package/dist/contracts.d.ts +109 -0
  23. package/dist/contracts.js +1 -0
  24. package/dist/database-builder.d.ts +19 -0
  25. package/dist/database-builder.js +183 -0
  26. package/dist/database.d.ts +69 -0
  27. package/dist/database.js +128 -0
  28. package/dist/declarations.d.ts +91 -0
  29. package/dist/declarations.js +141 -0
  30. package/dist/dev-worker.d.ts +1 -0
  31. package/dist/dev-worker.js +47 -0
  32. package/dist/dev.d.ts +5 -0
  33. package/dist/dev.js +148 -0
  34. package/dist/error.d.ts +20 -0
  35. package/dist/error.js +82 -0
  36. package/dist/fields.d.ts +36 -0
  37. package/dist/fields.js +63 -0
  38. package/dist/filters.d.ts +93 -0
  39. package/dist/filters.js +220 -0
  40. package/dist/function-shapes.d.ts +7 -0
  41. package/dist/function-shapes.js +150 -0
  42. package/dist/handles.d.ts +27 -0
  43. package/dist/handles.js +387 -0
  44. package/dist/http/protocol.d.ts +64 -0
  45. package/dist/http/protocol.js +77 -0
  46. package/dist/http/sse.d.ts +7 -0
  47. package/dist/http/sse.js +70 -0
  48. package/dist/http.d.ts +44 -0
  49. package/dist/http.js +911 -0
  50. package/dist/index.d.ts +6 -0
  51. package/dist/index.js +1 -0
  52. package/dist/internal/client.d.ts +6 -0
  53. package/dist/internal/client.js +5 -0
  54. package/dist/json-value.d.ts +21 -0
  55. package/dist/json-value.js +79 -0
  56. package/dist/names.d.ts +2 -0
  57. package/dist/names.js +10 -0
  58. package/dist/native.d.ts +3 -0
  59. package/dist/native.js +42 -0
  60. package/dist/notifications.d.ts +8 -0
  61. package/dist/notifications.js +70 -0
  62. package/dist/optimistic.d.ts +46 -0
  63. package/dist/optimistic.js +140 -0
  64. package/dist/page.d.ts +11 -0
  65. package/dist/page.js +1 -0
  66. package/dist/pagination.d.ts +17 -0
  67. package/dist/pagination.js +262 -0
  68. package/dist/project-codegen.d.ts +2 -0
  69. package/dist/project-codegen.js +68 -0
  70. package/dist/projection.d.ts +19 -0
  71. package/dist/projection.js +31 -0
  72. package/dist/runtime-conditions.d.ts +2 -0
  73. package/dist/runtime-conditions.js +10 -0
  74. package/dist/runtime.d.ts +13 -0
  75. package/dist/runtime.js +47 -0
  76. package/dist/schema-codegen.d.ts +16 -0
  77. package/dist/schema-codegen.js +212 -0
  78. package/dist/schema-contract.d.ts +4 -0
  79. package/dist/schema-contract.js +42 -0
  80. package/dist/schema.d.ts +356 -0
  81. package/dist/schema.js +720 -0
  82. package/dist/server-database.d.ts +14 -0
  83. package/dist/server-database.js +386 -0
  84. package/dist/server.d.ts +7 -0
  85. package/dist/server.js +1 -0
  86. package/dist/service.d.ts +13 -0
  87. package/dist/service.js +206 -0
  88. package/dist/sql-check.d.ts +28 -0
  89. package/dist/sql-check.js +59 -0
  90. package/dist/validation.d.ts +43 -0
  91. package/dist/validation.js +21 -0
  92. package/dist/worker-codegen.d.ts +3 -0
  93. package/dist/worker-codegen.js +44 -0
  94. package/dist/worker.d.ts +9 -0
  95. package/dist/worker.js +92 -0
  96. package/dist/write-expression.d.ts +72 -0
  97. package/dist/write-expression.js +122 -0
  98. package/dist/zod.d.ts +28 -0
  99. package/dist/zod.js +102 -0
  100. package/licenses/allocator-api2-0.2.21/LICENSE-APACHE +176 -0
  101. package/licenses/allocator-api2-0.2.21/LICENSE-MIT +23 -0
  102. package/licenses/async-trait-0.1.92/LICENSE-APACHE +176 -0
  103. package/licenses/async-trait-0.1.92/LICENSE-MIT +23 -0
  104. package/licenses/atomic-waker-1.1.2/LICENSE-APACHE +201 -0
  105. package/licenses/atomic-waker-1.1.2/LICENSE-MIT +23 -0
  106. package/licenses/atomic-waker-1.1.2/LICENSE-THIRD-PARTY +45 -0
  107. package/licenses/axum-0.8.9/LICENSE +25 -0
  108. package/licenses/axum-core-0.5.6/LICENSE +27 -0
  109. package/licenses/base64-0.22.1/LICENSE-APACHE +201 -0
  110. package/licenses/base64-0.22.1/LICENSE-MIT +21 -0
  111. package/licenses/bitflags-2.13.2/LICENSE-APACHE +201 -0
  112. package/licenses/bitflags-2.13.2/LICENSE-MIT +25 -0
  113. package/licenses/block-buffer-0.12.1/LICENSE-APACHE +201 -0
  114. package/licenses/block-buffer-0.12.1/LICENSE-MIT +25 -0
  115. package/licenses/byteorder-1.5.0/COPYING +3 -0
  116. package/licenses/byteorder-1.5.0/LICENSE-MIT +21 -0
  117. package/licenses/bytes-1.12.1/LICENSE +25 -0
  118. package/licenses/cc-1.6.0/LICENSE-APACHE +201 -0
  119. package/licenses/cc-1.6.0/LICENSE-MIT +25 -0
  120. package/licenses/cfg-if-1.0.5/LICENSE-APACHE +201 -0
  121. package/licenses/cfg-if-1.0.5/LICENSE-MIT +25 -0
  122. package/licenses/chacha20-0.10.2/LICENSE-APACHE +201 -0
  123. package/licenses/chacha20-0.10.2/LICENSE-MIT +25 -0
  124. package/licenses/cmov-0.5.4/LICENSE-APACHE +202 -0
  125. package/licenses/cmov-0.5.4/LICENSE-MIT +25 -0
  126. package/licenses/const-oid-0.10.2/LICENSE-APACHE +201 -0
  127. package/licenses/const-oid-0.10.2/LICENSE-MIT +25 -0
  128. package/licenses/const-oid-0.9.6/LICENSE-APACHE +201 -0
  129. package/licenses/const-oid-0.9.6/LICENSE-MIT +25 -0
  130. package/licenses/cpufeatures-0.3.1/LICENSE-APACHE +201 -0
  131. package/licenses/cpufeatures-0.3.1/LICENSE-MIT +25 -0
  132. package/licenses/crypto-common-0.2.2/LICENSE-APACHE +201 -0
  133. package/licenses/crypto-common-0.2.2/LICENSE-MIT +25 -0
  134. package/licenses/ctutils-0.4.2/LICENSE-APACHE +202 -0
  135. package/licenses/ctutils-0.4.2/LICENSE-MIT +25 -0
  136. package/licenses/der-0.7.10/LICENSE-APACHE +201 -0
  137. package/licenses/der-0.7.10/LICENSE-MIT +25 -0
  138. package/licenses/der_derive-0.7.3/LICENSE-APACHE +201 -0
  139. package/licenses/der_derive-0.7.3/LICENSE-MIT +25 -0
  140. package/licenses/deranged-0.5.8/LICENSE-Apache +202 -0
  141. package/licenses/deranged-0.5.8/LICENSE-MIT +19 -0
  142. package/licenses/digest-0.11.3/LICENSE-APACHE +201 -0
  143. package/licenses/digest-0.11.3/LICENSE-MIT +26 -0
  144. package/licenses/equivalent-1.0.3/LICENSE-APACHE +201 -0
  145. package/licenses/equivalent-1.0.3/LICENSE-MIT +25 -0
  146. package/licenses/errno-0.3.14/LICENSE-APACHE +201 -0
  147. package/licenses/errno-0.3.14/LICENSE-MIT +25 -0
  148. package/licenses/fallible-iterator-0.2.0/LICENSE-APACHE +202 -0
  149. package/licenses/fallible-iterator-0.2.0/LICENSE-MIT +19 -0
  150. package/licenses/find-msvc-tools-0.1.14/LICENSE-APACHE +201 -0
  151. package/licenses/find-msvc-tools-0.1.14/LICENSE-MIT +25 -0
  152. package/licenses/flagset-0.4.7/LICENSE +202 -0
  153. package/licenses/foldhash-0.2.0/LICENSE +19 -0
  154. package/licenses/futures-channel-0.3.34/LICENSE-APACHE +202 -0
  155. package/licenses/futures-channel-0.3.34/LICENSE-MIT +26 -0
  156. package/licenses/futures-core-0.3.34/LICENSE-APACHE +202 -0
  157. package/licenses/futures-core-0.3.34/LICENSE-MIT +26 -0
  158. package/licenses/futures-sink-0.3.34/LICENSE-APACHE +202 -0
  159. package/licenses/futures-sink-0.3.34/LICENSE-MIT +26 -0
  160. package/licenses/futures-task-0.3.34/LICENSE-APACHE +202 -0
  161. package/licenses/futures-task-0.3.34/LICENSE-MIT +26 -0
  162. package/licenses/futures-util-0.3.34/LICENSE-APACHE +202 -0
  163. package/licenses/futures-util-0.3.34/LICENSE-MIT +26 -0
  164. package/licenses/getrandom-0.2.17/LICENSE-APACHE +201 -0
  165. package/licenses/getrandom-0.2.17/LICENSE-MIT +26 -0
  166. package/licenses/getrandom-0.4.3/LICENSE-APACHE +201 -0
  167. package/licenses/getrandom-0.4.3/LICENSE-MIT +26 -0
  168. package/licenses/hashbrown-0.17.1/LICENSE-APACHE +201 -0
  169. package/licenses/hashbrown-0.17.1/LICENSE-MIT +25 -0
  170. package/licenses/hmac-0.13.0/LICENSE-APACHE +201 -0
  171. package/licenses/hmac-0.13.0/LICENSE-MIT +25 -0
  172. package/licenses/http-1.5.0/LICENSE-APACHE +201 -0
  173. package/licenses/http-1.5.0/LICENSE-MIT +25 -0
  174. package/licenses/http-body-1.1.0/LICENSE +25 -0
  175. package/licenses/http-body-util-0.1.5/LICENSE +25 -0
  176. package/licenses/httparse-1.10.1/LICENSE-APACHE +201 -0
  177. package/licenses/httparse-1.10.1/LICENSE-MIT +20 -0
  178. package/licenses/httpdate-1.0.3/LICENSE-APACHE +201 -0
  179. package/licenses/httpdate-1.0.3/LICENSE-MIT +19 -0
  180. package/licenses/hybrid-array-0.4.15/LICENSE-APACHE +201 -0
  181. package/licenses/hybrid-array-0.4.15/LICENSE-MIT +25 -0
  182. package/licenses/hyper-1.11.1/LICENSE +19 -0
  183. package/licenses/hyper-util-0.1.21/LICENSE +19 -0
  184. package/licenses/itoa-1.0.18/LICENSE-APACHE +176 -0
  185. package/licenses/itoa-1.0.18/LICENSE-MIT +23 -0
  186. package/licenses/libc-0.2.189/LICENSE-APACHE +176 -0
  187. package/licenses/libc-0.2.189/LICENSE-MIT +25 -0
  188. package/licenses/lock_api-0.4.14/LICENSE-APACHE +201 -0
  189. package/licenses/lock_api-0.4.14/LICENSE-MIT +25 -0
  190. package/licenses/log-0.4.34/LICENSE-APACHE +201 -0
  191. package/licenses/log-0.4.34/LICENSE-MIT +25 -0
  192. package/licenses/matchit-0.8.4/LICENSE +21 -0
  193. package/licenses/matchit-0.8.4/LICENSE.httprouter +29 -0
  194. package/licenses/md-5-0.11.0/LICENSE-APACHE +201 -0
  195. package/licenses/md-5-0.11.0/LICENSE-MIT +28 -0
  196. package/licenses/memchr-2.8.3/COPYING +3 -0
  197. package/licenses/memchr-2.8.3/LICENSE-MIT +21 -0
  198. package/licenses/mime-0.3.17/LICENSE-APACHE +201 -0
  199. package/licenses/mime-0.3.17/LICENSE-MIT +20 -0
  200. package/licenses/mio-1.2.3/LICENSE +19 -0
  201. package/licenses/num-conv-0.2.2/LICENSE-Apache +177 -0
  202. package/licenses/num-conv-0.2.2/LICENSE-MIT +19 -0
  203. package/licenses/objc2-core-foundation-0.3.2/LICENSE.md +34 -0
  204. package/licenses/objc2-system-configuration-0.3.2/LICENSE.md +34 -0
  205. package/licenses/once_cell-1.21.4/LICENSE-APACHE +201 -0
  206. package/licenses/once_cell-1.21.4/LICENSE-MIT +23 -0
  207. package/licenses/parking_lot-0.12.5/LICENSE-APACHE +201 -0
  208. package/licenses/parking_lot-0.12.5/LICENSE-MIT +25 -0
  209. package/licenses/parking_lot_core-0.9.12/LICENSE-APACHE +201 -0
  210. package/licenses/parking_lot_core-0.9.12/LICENSE-MIT +25 -0
  211. package/licenses/percent-encoding-2.3.2/LICENSE-APACHE +201 -0
  212. package/licenses/percent-encoding-2.3.2/LICENSE-MIT +25 -0
  213. package/licenses/phf-0.13.1/LICENSE +20 -0
  214. package/licenses/phf_shared-0.13.1/LICENSE +20 -0
  215. package/licenses/pin-project-lite-0.2.17/LICENSE-APACHE +177 -0
  216. package/licenses/pin-project-lite-0.2.17/LICENSE-MIT +23 -0
  217. package/licenses/postgres-protocol-0.6.12/LICENSE-APACHE +201 -0
  218. package/licenses/postgres-protocol-0.6.12/LICENSE-MIT +22 -0
  219. package/licenses/postgres-types-0.2.14/LICENSE-APACHE +201 -0
  220. package/licenses/postgres-types-0.2.14/LICENSE-MIT +22 -0
  221. package/licenses/powerfmt-0.2.1/LICENSE-Apache +202 -0
  222. package/licenses/powerfmt-0.2.1/LICENSE-MIT +19 -0
  223. package/licenses/proc-macro2-1.0.107/LICENSE-APACHE +176 -0
  224. package/licenses/proc-macro2-1.0.107/LICENSE-MIT +23 -0
  225. package/licenses/quote-1.0.47/LICENSE-APACHE +176 -0
  226. package/licenses/quote-1.0.47/LICENSE-MIT +23 -0
  227. package/licenses/rand-0.10.3/COPYRIGHT +12 -0
  228. package/licenses/rand-0.10.3/LICENSE-APACHE +176 -0
  229. package/licenses/rand-0.10.3/LICENSE-MIT +26 -0
  230. package/licenses/rand_core-0.10.1/COPYRIGHT +9 -0
  231. package/licenses/rand_core-0.10.1/LICENSE-APACHE +187 -0
  232. package/licenses/rand_core-0.10.1/LICENSE-MIT +25 -0
  233. package/licenses/ring-0.17.14/LICENSE +9 -0
  234. package/licenses/ring-0.17.14/LICENSE-BoringSSL +272 -0
  235. package/licenses/ring-0.17.14/LICENSE-other-bits +13 -0
  236. package/licenses/ring-0.17.14/src/polyfill/once_cell/LICENSE-APACHE +201 -0
  237. package/licenses/ring-0.17.14/src/polyfill/once_cell/LICENSE-MIT +23 -0
  238. package/licenses/ring-0.17.14/third_party/fiat/LICENSE +15 -0
  239. package/licenses/rquickjs-0.14.0/LICENSE +22 -0
  240. package/licenses/rquickjs-core-0.14.0/LICENSE +22 -0
  241. package/licenses/rquickjs-sys-0.14.0/quickjs/LICENSE +24 -0
  242. package/licenses/rquickjs-sys-0.14.0/vendor/wasi-libc/NOTICE.md +26 -0
  243. package/licenses/rustls-0.23.46/LICENSE-APACHE +201 -0
  244. package/licenses/rustls-0.23.46/LICENSE-ISC +15 -0
  245. package/licenses/rustls-0.23.46/LICENSE-MIT +25 -0
  246. package/licenses/rustls-pki-types-1.15.1/LICENSE-APACHE +201 -0
  247. package/licenses/rustls-pki-types-1.15.1/LICENSE-MIT +25 -0
  248. package/licenses/rustls-webpki-0.103.15/LICENSE +19 -0
  249. package/licenses/scopeguard-1.2.0/LICENSE-APACHE +201 -0
  250. package/licenses/scopeguard-1.2.0/LICENSE-MIT +25 -0
  251. package/licenses/serde-1.0.229/LICENSE-APACHE +176 -0
  252. package/licenses/serde-1.0.229/LICENSE-MIT +23 -0
  253. package/licenses/serde_core-1.0.229/LICENSE-APACHE +176 -0
  254. package/licenses/serde_core-1.0.229/LICENSE-MIT +23 -0
  255. package/licenses/serde_derive-1.0.229/LICENSE-APACHE +176 -0
  256. package/licenses/serde_derive-1.0.229/LICENSE-MIT +23 -0
  257. package/licenses/serde_json-1.0.151/LICENSE-APACHE +176 -0
  258. package/licenses/serde_json-1.0.151/LICENSE-MIT +23 -0
  259. package/licenses/serde_path_to_error-0.1.20/LICENSE-APACHE +176 -0
  260. package/licenses/serde_path_to_error-0.1.20/LICENSE-MIT +23 -0
  261. package/licenses/sha2-0.11.0/LICENSE-APACHE +201 -0
  262. package/licenses/sha2-0.11.0/LICENSE-MIT +28 -0
  263. package/licenses/shlex-2.0.1/LICENSE-APACHE +13 -0
  264. package/licenses/shlex-2.0.1/LICENSE-MIT +21 -0
  265. package/licenses/signal-hook-registry-1.4.8/LICENSE-APACHE +201 -0
  266. package/licenses/signal-hook-registry-1.4.8/LICENSE-MIT +25 -0
  267. package/licenses/siphasher-1.0.4/COPYING +7 -0
  268. package/licenses/siphasher-1.0.4/LICENSE-APACHE +202 -0
  269. package/licenses/siphasher-1.0.4/LICENSE-MIT +17 -0
  270. package/licenses/slab-0.4.12/LICENSE +25 -0
  271. package/licenses/smallvec-1.16.2/LICENSE-APACHE +201 -0
  272. package/licenses/smallvec-1.16.2/LICENSE-MIT +25 -0
  273. package/licenses/socket2-0.6.5/LICENSE-APACHE +201 -0
  274. package/licenses/socket2-0.6.5/LICENSE-MIT +25 -0
  275. package/licenses/spki-0.7.3/LICENSE-APACHE +201 -0
  276. package/licenses/spki-0.7.3/LICENSE-MIT +25 -0
  277. package/licenses/stringprep-0.1.5/LICENSE-APACHE +202 -0
  278. package/licenses/stringprep-0.1.5/LICENSE-MIT +19 -0
  279. package/licenses/subtle-2.6.1/LICENSE +29 -0
  280. package/licenses/syn-2.0.119/LICENSE-APACHE +176 -0
  281. package/licenses/syn-2.0.119/LICENSE-MIT +23 -0
  282. package/licenses/syn-3.0.6/LICENSE-APACHE +176 -0
  283. package/licenses/syn-3.0.6/LICENSE-MIT +23 -0
  284. package/licenses/sync_wrapper-1.0.2/LICENSE +177 -0
  285. package/licenses/time-0.3.55/LICENSE-Apache +177 -0
  286. package/licenses/time-0.3.55/LICENSE-MIT +19 -0
  287. package/licenses/time-core-0.1.9/LICENSE-Apache +177 -0
  288. package/licenses/time-core-0.1.9/LICENSE-MIT +19 -0
  289. package/licenses/time-macros-0.2.32/LICENSE-Apache +177 -0
  290. package/licenses/time-macros-0.2.32/LICENSE-MIT +19 -0
  291. package/licenses/tinyvec-1.13.3/LICENSE-APACHE.md +202 -0
  292. package/licenses/tinyvec-1.13.3/LICENSE-MIT.md +5 -0
  293. package/licenses/tinyvec-1.13.3/LICENSE-ZLIB.md +11 -0
  294. package/licenses/tokio-1.53.1/LICENSE +21 -0
  295. package/licenses/tokio-macros-2.7.2/LICENSE +22 -0
  296. package/licenses/tokio-postgres-0.7.18/LICENSE-APACHE +201 -0
  297. package/licenses/tokio-postgres-0.7.18/LICENSE-MIT +22 -0
  298. package/licenses/tokio-postgres-rustls-0.14.0/LICENSE +21 -0
  299. package/licenses/tokio-rustls-0.26.6/LICENSE-APACHE +201 -0
  300. package/licenses/tokio-rustls-0.26.6/LICENSE-MIT +25 -0
  301. package/licenses/tokio-util-0.7.19/LICENSE +21 -0
  302. package/licenses/tower-0.5.3/LICENSE +25 -0
  303. package/licenses/tower-layer-0.3.3/LICENSE +25 -0
  304. package/licenses/tower-service-0.3.3/LICENSE +25 -0
  305. package/licenses/typenum-1.20.1/LICENSE +1 -0
  306. package/licenses/typenum-1.20.1/LICENSE-APACHE +201 -0
  307. package/licenses/typenum-1.20.1/LICENSE-MIT +21 -0
  308. package/licenses/unicode-bidi-0.3.18/COPYRIGHT +8 -0
  309. package/licenses/unicode-bidi-0.3.18/LICENSE-APACHE +201 -0
  310. package/licenses/unicode-bidi-0.3.18/LICENSE-MIT +25 -0
  311. package/licenses/unicode-ident-1.0.26/LICENSE-APACHE +176 -0
  312. package/licenses/unicode-ident-1.0.26/LICENSE-MIT +23 -0
  313. package/licenses/unicode-ident-1.0.26/LICENSE-UNICODE +39 -0
  314. package/licenses/unicode-normalization-0.1.25/COPYRIGHT +7 -0
  315. package/licenses/unicode-normalization-0.1.25/LICENSE-APACHE +201 -0
  316. package/licenses/unicode-normalization-0.1.25/LICENSE-MIT +25 -0
  317. package/licenses/unicode-properties-0.1.4/COPYRIGHT +7 -0
  318. package/licenses/unicode-properties-0.1.4/LICENSE-APACHE +201 -0
  319. package/licenses/unicode-properties-0.1.4/LICENSE-MIT +25 -0
  320. package/licenses/untrusted-0.9.0/LICENSE.txt +13 -0
  321. package/licenses/uuid-1.26.1/LICENSE-APACHE +201 -0
  322. package/licenses/uuid-1.26.1/LICENSE-MIT +26 -0
  323. package/licenses/webpki-roots-1.0.9/LICENSE +61 -0
  324. package/licenses/whoami-2.1.3/LICENSE_APACHE +176 -0
  325. package/licenses/whoami-2.1.3/LICENSE_BOOST +23 -0
  326. package/licenses/whoami-2.1.3/LICENSE_MIT +19 -0
  327. package/licenses/x509-cert-0.2.5/LICENSE-APACHE +201 -0
  328. package/licenses/x509-cert-0.2.5/LICENSE-MIT +25 -0
  329. package/licenses/zeroize-1.9.1/LICENSE-APACHE +202 -0
  330. package/licenses/zeroize-1.9.1/LICENSE-MIT +25 -0
  331. package/licenses/zmij-1.0.23/LICENSE-MIT +23 -0
  332. package/native/darwin-arm64/hulladb-bridge +0 -0
  333. package/native/darwin-arm64/hulladb-js +0 -0
  334. package/native/darwin-arm64/hulladb-service +0 -0
  335. package/native/linux-x64/hulladb-bridge +0 -0
  336. package/native/linux-x64/hulladb-js +0 -0
  337. package/native/linux-x64/hulladb-service +0 -0
  338. package/package.json +90 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Samuel Hulla
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,264 @@
1
- # Temporary Holding Version
1
+ # TypeScript function SDK
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@hulla/db` provides direct PostgreSQL access and generated reactive
4
+ function calls. The generated server database supports lazy CRUD builders, typed
5
+ filters/projections, grouping and aggregates, conflicts, stable pagination and
6
+ scoped transactions in Node and Bun; see [direct server setup](https://github.com/hulladev/db/blob/main/docs/server-database.md).
7
+ The supplied service and generated browser setup are described in
8
+ [browser service setup](https://github.com/hulladev/db/blob/main/docs/browser-service.md). Handlers execute in the
9
+ [restricted native runtime](https://github.com/hulladev/db/blob/main/docs/typescript-functions.md#supported-handler-code).
10
+ Schema authoring includes scalar constraints, named SQL checks, explicit indexes,
11
+ references/deletion policies, field codecs and optional Zod validation adapters;
12
+ see [schema setup](https://github.com/hulladev/db/blob/main/docs/schema-authoring.md).
13
+
14
+ Separate `@hulla/db-react`, `@hulla/db-vue`, `@hulla/db-svelte` and
15
+ `@hulla/db-solid` packages bind generated callables to UI reactivity. They share
16
+ the core cache, support live pagination and authorized SSR `initialData`; see
17
+ [framework bindings](https://github.com/hulladev/db/blob/main/docs/framework-bindings.md) and the
18
+ [meta-framework recipes](https://github.com/hulladev/db/blob/main/docs/meta-frameworks.md). Core `Input<typeof fn>`
19
+ and `Output<typeof fn>` helpers infer declaration and callable contracts.
20
+ Optional `@hulla/db-better-auth` stores provider data in PostgreSQL; see the
21
+ [Better Auth setup](https://github.com/hulladev/db/blob/main/docs/better-auth.md).
22
+
23
+ Generation and the development watcher use Bun. Production `serve` loads prepared
24
+ artifacts without generation and can run under Node or Bun; see the setup guide for
25
+ installed-package commands. The npm package contains compiled JavaScript,
26
+ declarations and native binaries; see [deployment and packaging](https://github.com/hulladev/db/blob/main/docs/deployment.md).
27
+ There are no required npm runtime dependencies.
28
+ Generation and `dev` use the optional TypeScript 7.0.2 peer; applications using
29
+ those tools install it as a dev dependency (`bun add --dev typescript@7.0.2`).
30
+ Production `serve`, direct database access and browser bindings do not load it.
31
+ See [dependency boundaries](https://github.com/hulladev/db/blob/main/docs/dependencies.md) for the native components.
32
+
33
+ ## Install
34
+
35
+ ```sh
36
+ npm install @hulla/db@0.1.0
37
+ npm install --save-dev typescript@7.0.2
38
+ bun --bun hulla-db generate db.config.ts
39
+ ```
40
+
41
+ The package includes native executables for macOS arm64 and Linux x64/glibc.
42
+ Add the matching `@hulla/db-react`, `@hulla/db-vue`, `@hulla/db-svelte` or
43
+ `@hulla/db-solid` package for framework bindings.
44
+
45
+ ## Declaring functions
46
+
47
+ After schema generation, import `query` and `mutation` from
48
+ `./_generated/functions`. Use `{ input, handler, output? }` with your own Standard
49
+ Schema validator, or pass a callback directly when no options are needed.
50
+ `.extend(...)` adds ordered input validation and context preparation. Output
51
+ validation and transformations finish before commit. See the
52
+ [authoring example](https://github.com/hulladev/db/blob/main/docs/typescript-functions.md#declare-functions).
53
+
54
+ ## Calling and observing functions
55
+
56
+ Generated bindings contain contracts and invocation code, not server handlers:
57
+
58
+ ```ts
59
+ import { pending, create } from './db/_generated/client/notes'
60
+
61
+ const save = create({ title: 'Ship it' }) // Starts immediately.
62
+ const stopSave = save.subscribe(snapshot => {
63
+ renderSaveStatus(snapshot.status)
64
+ })
65
+ const created = await save // Authoritative server result.
66
+ stopSave()
67
+
68
+ const unsubscribe = pending.subscribe(snapshot => {
69
+ if (snapshot.status === 'success') renderNotes(snapshot.data)
70
+ if (snapshot.status === 'error') renderError(snapshot.error)
71
+ })
72
+ // When the view is disposed:
73
+ unsubscribe()
74
+ ```
75
+
76
+ Query and mutation handles start on invocation and expose `status`, `data`, `error`
77
+ and `subscribe`. Repeated awaits reuse the same execution. An awaited query is a
78
+ one-time read; observing keeps results live. `query.subscribe(...)` starts the live
79
+ read directly, without an additional one-shot request. Attaching to an already
80
+ started query handle also attaches live observation. Query data is recursively
81
+ readonly; copy values before editing them.
82
+
83
+ Actively observed queries in one HTTP runtime receive complete updates from one
84
+ database snapshot. All query handles update before application listeners run. A
85
+ one-shot response resolves its await without replacing an observed result outside
86
+ that batch. Unsubscribing removes the query from the live set; changing membership
87
+ discards in-flight updates for the old set. A slow query can delay its siblings.
88
+ Separate runtimes and tabs are independent.
89
+
90
+ Connection failures keep the last complete view as stale. Handler errors affect
91
+ only their query, which stays subscribed and can recover after a database change.
92
+ The current live set is bounded to 128 distinct queries, including loaded pages.
93
+ [Stable live pagination](https://github.com/hulladev/db/blob/main/docs/live-pagination.md) keeps page boundaries fixed
94
+ as rows change. Inactive results stay in memory for at most five
95
+ minutes, bounded to 128 entries and 16 MiB of encoded keys/results; oldest inactive
96
+ entries leave first. Active queries remain pinned. Re-observing always verifies a
97
+ fresh server round. Concurrent one-shot calls are capped at 128, with pending background receipt ACKs
98
+ counted against admission as well.
99
+
100
+ Query states are `pending`, `success` and `error`, with `isStale` and `isOptimistic`
101
+ indicators. Mutations additionally use `recovering` when confirmation is interrupted.
102
+ Query subscription options support `keepPreviousDataOnError`; auth/source retirement
103
+ always clears prior data. Query cancellation uses an AbortSignal. Mutations accept
104
+ only their input, with no cancellation or per-call mode options.
105
+
106
+ ## Optimistic query updates
107
+
108
+ Wrap a mutation once and export that binding where prediction is useful:
109
+
110
+ ```ts
111
+ export const optimisticCreate = create.withOptimistic({
112
+ query: pending,
113
+ update: (notes, input) => [
114
+ ...notes,
115
+ { id: -1, title: input.title, owner: 'alice' },
116
+ ],
117
+ })
118
+
119
+ const saved = await optimisticCreate({ title: 'Ship it' })
120
+ ```
121
+
122
+ This example uses the notes fixture's result shape. Application updates must match
123
+ their query result and use stable provisional identifiers appropriate to that model.
124
+ Capture any generated values outside the updater: updaters must be pure and may run
125
+ again. `saved` is the server result, never the provisional row.
126
+
127
+ Pass additional target objects as separate arguments to update several queries.
128
+ Each object returns a replacement query result. No-input queries need no `input`
129
+ mapper. For a query with input, supply an `input(mutationInput)` mapper for one
130
+ exact input or `match(queryInput, mutationInput)` to select already-cached variants.
131
+ A matching target does not require an input mapper. Missing cached results are
132
+ skipped permanently for that invocation. An updater failure removes that invocation's predictions without
133
+ preventing server execution.
134
+
135
+ Layers replay in submission order over the latest server base. A failure removes
136
+ only its layer; successful predictions remain until query results incorporate the
137
+ commit. Interrupted confirmation removes predictions immediately. Recovery does not
138
+ reapply them. There is no prediction configuration map, mode switch or dependency
139
+ queue; use the base callable when no optimism is wanted.
140
+
141
+ ## Confirmation and errors
142
+
143
+ The HTTP runtime submits each mutation once. If confirmation is interrupted, the
144
+ same handle enters `recovering` and looks up the original receipt. A missing receipt
145
+ never causes resubmission. Reconnect attempts share one overall confirmation window,
146
+ 30 seconds by default, configurable through `database.client.confirmationTimeoutMs`. Checks stop when the handle settles or its auth scope retires.
147
+
148
+ `DatabaseError({ code, message, details? })` is the public error class. Intentional
149
+ handler errors preserve these fields across calls, live-query delivery and mutation
150
+ failure recovery. The serialized payload is limited to 16 KiB; larger errors fail
151
+ with `execution_limit`. Stack traces, causes, ordinary exceptions and database
152
+ diagnostics are never included. Application codes do not control transport retries
153
+ or cache identity. Only declare information safe for the caller. A
154
+ `confirmation_timeout` or `confirmation_interrupted` does not establish rollback:
155
+ the server may have committed. `receipt_expired` and `invalid_result` preserve
156
+ `details.committed: true` when the receipt establishes a commit but its result is
157
+ unavailable or invalid. Never blindly resubmit based on a confirmation error.
158
+
159
+ Results, active handles and optimistic layers stay in memory. There is no browser
160
+ persistence, mutation journal, manual `recoverPending`, or reload recovery. A fresh
161
+ page reads the server. Closing the page does not cancel a server transaction.
162
+
163
+ ## Browser setup and authentication
164
+
165
+ Generate the application with `hulla-db generate` (or use `hulla-db dev` while
166
+ working). Set `database.server` to the PostgreSQL connection and
167
+ `database.client` to public settings in `db.config.ts`:
168
+
169
+ ```ts
170
+ database: {
171
+ server: { url: process.env.DATABASE_URL! },
172
+ client: { url: 'https://db.example.com', credentials: 'include' },
173
+ },
174
+ ```
175
+
176
+ Generated callables initialize lazily; importing them opens no connection. Only
177
+ public settings are emitted, never server configuration or credentials. Root-relative
178
+ URLs such as `/db` resolve against the browser origin. Regenerate when changing
179
+ these build-time settings. Auth changes remain application-owned:
180
+
181
+ ```ts
182
+ import { setAuth } from './db/_generated/client/runtime'
183
+
184
+ // In your existing auth provider's session-change listener:
185
+ setAuth(session ? { key: session.user.id } : null)
186
+ ```
187
+
188
+ Here `session` comes from your auth provider. Applications do not construct an HTTP
189
+ runtime, bind declaration factories or register function contracts themselves.
190
+ Generated imports contain browser callables; handlers and server credentials stay
191
+ on the service. Direct application-server code imports `db` from
192
+ `./db/_generated/server` and owns its authorization checks.
193
+
194
+ Use the actual user/tenant key from your auth subscription. It partitions client
195
+ state; it is never proof of identity. The server verifies credentials and supplies
196
+ the verified context. Applications using bearer tokens can call generated `setHeaders` with a
197
+ callback that reads their auth provider's current token. Cross-origin cookie setups
198
+ use `credentials: 'include'` and an explicitly allowed server origin.
199
+
200
+ The auth provider owns session validity, refresh and revocation. `setAuth` accepts
201
+ `{ key, expiresAt? }`, `null`, or a promise resolving to either. No status field is
202
+ needed: an object supplies the client identity, `null` clears it, and an unresolved
203
+ promise implies loading. `resolveAuth` above is application code using your chosen
204
+ provider; it returns this metadata, not credentials.
205
+
206
+ A promise immediately retires the previous scope. While it resolves, calls fail
207
+ with `authentication_pending` without sending requests. Use
208
+ `await setAuth(resolveAuth())` before calls that depend on that resolution. The
209
+ latest update wins, even if an older promise finishes later. If resolution rejects
210
+ or returns invalid metadata, the returned promise rejects and calls fail with
211
+ `authentication_failed` until another update; failure never silently grants anonymous
212
+ access. Reattach subscriptions once the new scope is ready.
213
+
214
+ The optional `expiresAt` is a Unix timestamp in milliseconds.
215
+ Omit it to rely on the application's existing auth notifications. When supplied,
216
+ its deadline clears local auth-scoped state just like `setAuth(null)`; a past deadline
217
+ clears it immediately. Updating only the deadline preserves a still-valid cache;
218
+ omitting it on a later update removes the timer. Browser timers can be delayed in
219
+ suspended tabs, so handle access and response delivery also check the deadline.
220
+ This does not refresh or revoke credentials, and server verification still applies.
221
+ Changing the key or calling `setAuth(null)` retires old calls, subscriptions, cached
222
+ results and optimistic updates immediately, including completed handles. Reattach
223
+ subscriptions for the new identity. Repeating the same synchronous identity does not clear results.
224
+ A `context_changed` error does not establish that an in-flight write rolled back.
225
+
226
+ When live credentials expire, the adapter can reconnect using credentials already
227
+ refreshed by the provider only if the server verifies the same context. It never
228
+ refreshes credentials itself or silently adopts a different identity. Invalid
229
+ credentials clear protected results even if the application missed an auth update.
230
+
231
+ For ordinary application setup, use `database.client` and `hulla-db
232
+ serve`; [the service guide](https://github.com/hulladev/db/blob/main/docs/browser-service.md) covers config, discovery
233
+ and provider verification. The explicit adapter construction above remains useful
234
+ for transport-level integration. Server request adapters must not share mutable
235
+ identity across requests.
236
+
237
+ The generator supports closed records, arrays, required tuples, literals/unions and
238
+ lossless bigint values and built-in Dates. Unsupported shapes fail generation. Semantic validation
239
+ and authorization still run on the server. Schema authoring and current callback
240
+ registration are described in [schema authoring](https://github.com/hulladev/db/blob/main/docs/schema-authoring.md)
241
+ and [TypeScript execution](https://github.com/hulladev/db/blob/main/docs/typescript-functions.md).
242
+
243
+ Use [field representations and codecs](https://github.com/hulladev/db/blob/main/docs/field-codecs.md) for integer
244
+ modes, dates and explicit application-to-storage conversions. Configure server
245
+ budgets in `defineConfig({ limits })` and override them on final declarations;
246
+ see [execution limits](https://github.com/hulladev/db/blob/main/docs/execution-limits.md) for defaults and browser
247
+ timeout configuration.
248
+
249
+ ## Native runtime
250
+
251
+ The npm package includes macOS arm64 and Linux x64/glibc native
252
+ executables. Browser-only use does not launch them. See the
253
+ [release workflow](https://github.com/hulladev/db/blob/main/docs/releasing.md) for all six npm packages, Rust crates,
254
+ license notices and archive checks.
255
+
256
+ ## Validation
257
+
258
+ Run `bun run check` from this package for generation, typechecking and SDK tests.
259
+ Focused test files can run independently when the change is narrower.
260
+
261
+ The browser harness (`bun tests/browser-check-server.ts`) checks actual browser
262
+ confirmation, fresh reads after reload, int64 and identity cleanup. PostgreSQL-backed
263
+ HTTP/SSE and worker tests are separate and require a running database; see
264
+ [SDK adapter validation](https://github.com/hulladev/db/blob/main/docs/sdk-adapters.md#validation).