@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
@@ -0,0 +1,6 @@
1
+ export type { MutationCallable, QueryCallable, OptimisticTarget } from "./callable.ts";
2
+ export { DatabaseError } from "./error.ts";
3
+ export type { DatabaseErrorDetails, DatabaseErrorOptions } from "./error.ts";
4
+ export type { ClientAuthState, ClientAuthInput } from "./auth.ts";
5
+ export type { Input, Output, QueryHandle, PageHandle, MutationHandle, MutationState, ReadonlyResult, QuerySubscriptionOptions, QueryState, QueryOptions, } from "./contracts.ts";
6
+ export type { Page } from "./page.ts";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { DatabaseError } from "./error.js";
@@ -0,0 +1,6 @@
1
+ /** Generated browser bindings only; not an application configuration API. */
2
+ export { mutationBinding, queryBinding } from "../callable.ts";
3
+ export { createRuntimeScope } from "../runtime.ts";
4
+ export { createBrowserRuntime } from "../browser.ts";
5
+ export type { BrowserOptions } from "../browser.ts";
6
+ export { valueCodec } from "../codec.ts";
@@ -0,0 +1,5 @@
1
+ /** Generated browser bindings only; not an application configuration API. */
2
+ export { mutationBinding, queryBinding } from "../callable.js";
3
+ export { createRuntimeScope } from "../runtime.js";
4
+ export { createBrowserRuntime } from "../browser.js";
5
+ export { valueCodec } from "../codec.js";
@@ -0,0 +1,21 @@
1
+ /** JSON values have no implicit conversions or absent array/object values. */
2
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
3
+ [key: string]: JsonValue;
4
+ };
5
+ export type JsonShape = {
6
+ readonly kind: "any" | "string" | "boolean" | "number";
7
+ } | {
8
+ readonly kind: "nullable";
9
+ readonly inner: JsonShape;
10
+ } | {
11
+ readonly kind: "array";
12
+ readonly item: JsonShape;
13
+ } | {
14
+ readonly kind: "object";
15
+ readonly fields: Readonly<Record<string, {
16
+ readonly shape: JsonShape;
17
+ readonly optional: boolean;
18
+ }>>;
19
+ };
20
+ /** Validate and copy before storage; never invoke accessors or toJSON. */
21
+ export declare function validateJson(value: unknown, shape?: JsonShape, path?: string): JsonValue;
@@ -0,0 +1,79 @@
1
+ /** Validate and copy before storage; never invoke accessors or toJSON. */
2
+ export function validateJson(value, shape = { kind: "any" }, path = "$") {
3
+ let nodes = 0;
4
+ const ancestors = new Set();
5
+ function visit(value, shape, path, depth) {
6
+ const fail = (message) => { throw new TypeError(`${path}: ${message}`); };
7
+ if (++nodes > 100000 || depth > 64)
8
+ fail("JSON value exceeds budget");
9
+ if (shape.kind === "nullable")
10
+ return value === null ? null : visit(value, shape.inner, path, depth + 1);
11
+ if (value === null) {
12
+ if (shape.kind !== "any")
13
+ fail("Expected " + shape.kind);
14
+ return null;
15
+ }
16
+ if (typeof value === "string") {
17
+ if (shape.kind !== "any" && shape.kind !== "string")
18
+ fail("Expected " + shape.kind);
19
+ if (/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(value))
20
+ fail("Invalid Unicode");
21
+ return value;
22
+ }
23
+ if (typeof value === "boolean") {
24
+ if (shape.kind !== "any" && shape.kind !== "boolean")
25
+ fail("Expected " + shape.kind);
26
+ return value;
27
+ }
28
+ if (typeof value === "number") {
29
+ if (!Number.isFinite(value) || (shape.kind !== "any" && shape.kind !== "number"))
30
+ fail("Expected finite JSON number");
31
+ return value;
32
+ }
33
+ if (typeof value !== "object")
34
+ return fail("Expected JSON value");
35
+ if (ancestors.has(value))
36
+ fail("Circular JSON value");
37
+ ancestors.add(value);
38
+ try {
39
+ if (Object.getOwnPropertySymbols(value).length)
40
+ fail("Symbol properties are not JSON");
41
+ if (Array.isArray(value)) {
42
+ if (shape.kind !== "any" && shape.kind !== "array")
43
+ fail("Expected " + shape.kind);
44
+ if (Object.getOwnPropertyNames(value).length !== value.length + 1)
45
+ fail("Invalid JSON array properties");
46
+ return Array.from({ length: value.length }, (_, i) => {
47
+ const descriptor = Object.getOwnPropertyDescriptor(value, String(i));
48
+ if (!descriptor || !("value" in descriptor))
49
+ fail("Sparse arrays and accessors are not JSON");
50
+ return visit(descriptor.value, shape.kind === "array" ? shape.item : { kind: "any" }, `${path}[${i}]`, depth + 1);
51
+ });
52
+ }
53
+ if (![Object.prototype, null].includes(Object.getPrototypeOf(value)))
54
+ fail("Expected plain JSON object");
55
+ if (shape.kind !== "any" && shape.kind !== "object")
56
+ fail("Expected " + shape.kind);
57
+ const result = Object.create(null);
58
+ for (const key of Object.getOwnPropertyNames(value)) {
59
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
60
+ if (!descriptor.enumerable || !("value" in descriptor))
61
+ fail(`Non-JSON property ${key}`);
62
+ if (shape.kind === "object" && !Object.hasOwn(shape.fields, key))
63
+ throw new TypeError(`${path}.${key}: Unknown property`);
64
+ if (/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(key))
65
+ fail("Invalid Unicode property");
66
+ result[key] = visit(descriptor.value, shape.kind === "object" ? shape.fields[key].shape : { kind: "any" }, `${path}.${key}`, depth + 1);
67
+ }
68
+ if (shape.kind === "object")
69
+ for (const [key, field] of Object.entries(shape.fields))
70
+ if (!field.optional && !Object.hasOwn(result, key))
71
+ throw new TypeError(`${path}.${key}: Missing property`);
72
+ return result;
73
+ }
74
+ finally {
75
+ ancestors.delete(value);
76
+ }
77
+ }
78
+ return visit(value, shape, path, 0);
79
+ }
@@ -0,0 +1,2 @@
1
+ export declare function validExportName(name: string): boolean;
2
+ export declare function assertModuleName(name: string): void;
package/dist/names.js ADDED
@@ -0,0 +1,10 @@
1
+ const identifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
2
+ const reserved = new Set("default class function var const let import export return new delete await yield enum implements interface package private protected public static null true false if else for while do switch case break continue throw try catch finally extends super this void typeof in instanceof with debugger".split(" "));
3
+ export function validExportName(name) {
4
+ return identifier.test(name) && !reserved.has(name);
5
+ }
6
+ export function assertModuleName(name) {
7
+ // Module identities are relative file paths, not JavaScript identifiers.
8
+ if (!name.split("/").every(segment => /^[A-Za-z0-9_$-]+$/.test(segment)) || name === "runtime")
9
+ throw new Error(`Invalid function module name: ${name}`);
10
+ }
@@ -0,0 +1,3 @@
1
+ type Executable = "bridge" | "service" | "js";
2
+ export declare function resolveNativeExecutable(kind: Executable): string;
3
+ export {};
package/dist/native.js ADDED
@@ -0,0 +1,42 @@
1
+ import { existsSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+ // Literal URLs keep native assets visible to framework file tracing.
4
+ const assets = {
5
+ "darwin-arm64": {
6
+ bridge: new URL("../native/darwin-arm64/hulladb-bridge", import.meta.url),
7
+ service: new URL("../native/darwin-arm64/hulladb-service", import.meta.url),
8
+ js: new URL("../native/darwin-arm64/hulladb-js", import.meta.url),
9
+ },
10
+ "darwin-x64": {
11
+ bridge: new URL("../native/darwin-x64/hulladb-bridge", import.meta.url),
12
+ service: new URL("../native/darwin-x64/hulladb-service", import.meta.url),
13
+ js: new URL("../native/darwin-x64/hulladb-js", import.meta.url),
14
+ },
15
+ "linux-x64": {
16
+ bridge: new URL("../native/linux-x64/hulladb-bridge", import.meta.url),
17
+ service: new URL("../native/linux-x64/hulladb-service", import.meta.url),
18
+ js: new URL("../native/linux-x64/hulladb-js", import.meta.url),
19
+ },
20
+ "linux-arm64": {
21
+ bridge: new URL("../native/linux-arm64/hulladb-bridge", import.meta.url),
22
+ service: new URL("../native/linux-arm64/hulladb-service", import.meta.url),
23
+ js: new URL("../native/linux-arm64/hulladb-js", import.meta.url),
24
+ },
25
+ };
26
+ export function resolveNativeExecutable(kind) {
27
+ const override = process.env[{ bridge: "HULLADB_ENGINE", service: "HULLADB_SERVICE", js: "HULLADB_JS" }[kind]];
28
+ if (override)
29
+ return override;
30
+ const platform = `${process.platform}-${process.arch}`;
31
+ const binaries = assets[platform];
32
+ if (binaries && existsSync(binaries[kind]))
33
+ return fileURLToPath(binaries[kind]);
34
+ // Only a source checkout can use developer-built binaries. Published modules
35
+ // are always in dist and never consult the application's cwd or run Cargo.
36
+ if (import.meta.url.endsWith("/src/native.ts")) {
37
+ const development = new URL(`../../../target/debug/hulladb-${kind}`, import.meta.url);
38
+ if (existsSync(development))
39
+ return fileURLToPath(development);
40
+ }
41
+ throw new Error(`No packaged hulladb-${kind} executable for ${platform}. Install an @hulla/db artifact containing native/${platform}, or set ${{ bridge: "HULLADB_ENGINE", service: "HULLADB_SERVICE", js: "HULLADB_JS" }[kind]} to a compatible executable.`);
42
+ }
@@ -0,0 +1,8 @@
1
+ /** Derived state joins the adapter transaction before any application observer runs. */
2
+ export declare function afterBatch(work: () => void): void;
3
+ export declare function stagedObserver<T extends Function>(observer: T): T;
4
+ /** Preserve internal staging through a subscription's retention wrapper. */
5
+ export declare function derivedObserver<T extends Function>(source: Function, observer: T): T;
6
+ export declare function notifyObserver(observer: Function, deliver: () => void): void;
7
+ export declare function notification(deliver: () => void): void;
8
+ export declare function batchNotifications(work: () => void): void;
@@ -0,0 +1,70 @@
1
+ // Stage adapter and handle state before delivering any application callback.
2
+ let depth = 0;
3
+ let pending = [];
4
+ let staged = [];
5
+ /** Derived state joins the adapter transaction before any application observer runs. */
6
+ export function afterBatch(work) {
7
+ if (depth)
8
+ staged.push(work);
9
+ else
10
+ work();
11
+ }
12
+ const internal = new WeakSet();
13
+ export function stagedObserver(observer) { internal.add(observer); return observer; }
14
+ /** Preserve internal staging through a subscription's retention wrapper. */
15
+ export function derivedObserver(source, observer) {
16
+ if (internal.has(source))
17
+ internal.add(observer);
18
+ return observer;
19
+ }
20
+ export function notifyObserver(observer, deliver) {
21
+ if (internal.has(observer))
22
+ deliver();
23
+ else
24
+ notification(deliver);
25
+ }
26
+ export function notification(deliver) {
27
+ if (depth)
28
+ pending.push(deliver);
29
+ else
30
+ deliver();
31
+ }
32
+ export function batchNotifications(work) {
33
+ depth++;
34
+ try {
35
+ work();
36
+ }
37
+ finally {
38
+ let failed = false;
39
+ let failure;
40
+ try {
41
+ if (depth === 1) {
42
+ while (staged.length) {
43
+ const work = staged;
44
+ staged = [];
45
+ for (const stage of work) {
46
+ try {
47
+ stage();
48
+ }
49
+ catch (error) {
50
+ if (!failed) {
51
+ failed = true;
52
+ failure = error;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ finally {
60
+ if (--depth === 0) {
61
+ const callbacks = pending;
62
+ pending = [];
63
+ for (const callback of callbacks)
64
+ callback();
65
+ }
66
+ }
67
+ if (failed)
68
+ throw failure;
69
+ }
70
+ }
@@ -0,0 +1,46 @@
1
+ import type { Operation } from "./contracts.ts";
2
+ /** Internal cache bridge used by generated withOptimistic wrappers. */
3
+ export interface PredictionQuery {
4
+ readonly name: string;
5
+ readonly input?: unknown;
6
+ }
7
+ export interface PendingPrediction {
8
+ readonly requestId: string;
9
+ readonly name: string;
10
+ readonly input: unknown;
11
+ }
12
+ export interface PredictionContext {
13
+ readonly requestId: string;
14
+ get(query: PredictionQuery): unknown | undefined;
15
+ set(query: PredictionQuery, result: unknown): void;
16
+ queries(name: string): readonly PredictionQuery[];
17
+ }
18
+ export type Predictor = (input: unknown, context: PredictionContext) => void;
19
+ /** Predictions replay in submission order over the latest server base. Each
20
+ * invocation publishes all of its target updates together or none of them. */
21
+ export declare class OptimisticResults {
22
+ #private;
23
+ constructor(resolve: (query: PredictionQuery) => {
24
+ key: string;
25
+ operation: Operation;
26
+ }, limit?: number);
27
+ confirm(key: string, operation: Operation, data: unknown, source: string, revision: string): void;
28
+ confirmRound(results: readonly {
29
+ key: string;
30
+ operation: Operation;
31
+ data: unknown;
32
+ source: string;
33
+ revision: string;
34
+ }[]): void;
35
+ removeResult(key: string): void;
36
+ clear(): void;
37
+ begin(requestId: string, name: string, input: unknown, predictor: Predictor): void;
38
+ commit(requestId: string, source: string, revision: string): void;
39
+ reject(requestId: string): void;
40
+ queries(requestId: string): readonly Operation[];
41
+ unconfirmed(): readonly PendingPrediction[];
42
+ view(key: string): {
43
+ data: unknown;
44
+ isOptimistic: boolean;
45
+ } | undefined;
46
+ }
@@ -0,0 +1,140 @@
1
+ const copy = (value) => structuredClone(value);
2
+ function warn() {
3
+ if (typeof process !== "undefined" && process.env.NODE_ENV === "development")
4
+ console.warn("@hulla/db: optimistic update failed; its cache changes were removed");
5
+ }
6
+ /** Predictions replay in submission order over the latest server base. Each
7
+ * invocation publishes all of its target updates together or none of them. */
8
+ export class OptimisticResults {
9
+ #resolve;
10
+ #base = new Map();
11
+ #layers = new Map();
12
+ #limit;
13
+ constructor(resolve, limit = 128) {
14
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 1024)
15
+ throw new TypeError("Invalid optimistic layer budget");
16
+ this.#resolve = resolve;
17
+ this.#limit = limit;
18
+ }
19
+ confirm(key, operation, data, source, revision) {
20
+ this.confirmRound([{ key, operation, data, source, revision }]);
21
+ }
22
+ confirmRound(results) {
23
+ for (const { key, operation, data, source, revision } of results) {
24
+ const previous = this.#base.get(key), sequence = BigInt(revision);
25
+ if (previous && previous.source === source && previous.revision > sequence)
26
+ continue;
27
+ this.#base.set(key, { operation, data: copy(data), source, revision: sequence });
28
+ }
29
+ this.#rebuild();
30
+ }
31
+ removeResult(key) {
32
+ this.#base.delete(key);
33
+ for (const [id, layer] of this.#layers) {
34
+ layer.targets?.delete(key);
35
+ if (!layer.targets?.size)
36
+ this.#layers.delete(id);
37
+ }
38
+ }
39
+ clear() { this.#base.clear(); this.#layers.clear(); }
40
+ begin(requestId, name, input, predictor) {
41
+ if (this.#layers.size >= this.#limit)
42
+ throw new Error("Optimistic layer budget exceeded");
43
+ if (this.#layers.has(requestId))
44
+ throw new Error("Duplicate optimistic request ID");
45
+ this.#layers.set(requestId, { requestId, name, input: copy(input), predictor });
46
+ this.#rebuild();
47
+ }
48
+ commit(requestId, source, revision) {
49
+ const layer = this.#layers.get(requestId);
50
+ if (!layer)
51
+ return;
52
+ if (layer.fence && (layer.fence.source !== source || layer.fence.revision !== BigInt(revision)))
53
+ throw new Error("Conflicting optimistic receipt fence");
54
+ layer.fence = { source, revision: BigInt(revision) };
55
+ this.#rebuild();
56
+ }
57
+ reject(requestId) { this.#layers.delete(requestId); this.#rebuild(); }
58
+ queries(requestId) {
59
+ const layer = this.#layers.get(requestId);
60
+ return layer ? [...layer.targets ?? []].filter(key => this.#base.has(key) && !this.#visible(layer, key)).map(key => this.#base.get(key).operation) : [];
61
+ }
62
+ unconfirmed() {
63
+ return [...this.#layers.values()].filter(layer => !layer.fence).map(({ requestId, name, input }) => ({ requestId, name, input: copy(input) }));
64
+ }
65
+ view(key) {
66
+ const views = this.#rebuild();
67
+ if (!views.has(key))
68
+ return undefined;
69
+ const isOptimistic = [...this.#layers.values()].some(layer => layer.targets?.has(key) && !this.#visible(layer, key));
70
+ return { data: copy(views.get(key)), isOptimistic };
71
+ }
72
+ #visible(layer, key) {
73
+ const base = this.#base.get(key);
74
+ return !!base && !!layer.fence && base.source === layer.fence.source && base.revision >= layer.fence.revision;
75
+ }
76
+ #rebuild() {
77
+ const views = new Map([...this.#base].map(([key, base]) => [key, copy(base.data)]));
78
+ for (const [id, layer] of this.#layers) {
79
+ if (layer.fence && [...layer.targets ?? []].every(key => this.#visible(layer, key))) {
80
+ this.#layers.delete(id);
81
+ continue;
82
+ }
83
+ const staged = new Map();
84
+ // Enumeration preserves each owned cache entry without exposing cache keys
85
+ // or pagination range metadata to application selectors.
86
+ const identities = new WeakMap();
87
+ const resolve = (query) => identities.get(query) ?? this.#resolve(query);
88
+ const eligible = (key) => this.#base.has(key) && (!layer.targets || layer.targets.has(key));
89
+ try {
90
+ const result = layer.predictor(copy(layer.input), {
91
+ requestId: layer.requestId,
92
+ get: query => {
93
+ const { key } = resolve(query);
94
+ return eligible(key) ? copy(staged.has(key) ? staged.get(key) : views.get(key)) : undefined;
95
+ },
96
+ set: (query, value) => {
97
+ const { key, operation } = resolve(query);
98
+ if (!eligible(key))
99
+ return;
100
+ if (!operation.codecs)
101
+ throw new Error("Prediction requires generated result validation");
102
+ let parsed = operation.codecs.result.parse(copy(value));
103
+ if (operation.page) {
104
+ const base = this.#base.get(key).data;
105
+ // Continuation belongs to the confirmed range, never a prediction.
106
+ parsed = { ...parsed, cursor: base.cursor };
107
+ }
108
+ staged.set(key, parsed);
109
+ },
110
+ queries: name => [...this.#base].filter(([key, base]) => base.operation.name === name && eligible(key))
111
+ .map(([key, base]) => {
112
+ const query = { name, input: copy(base.operation.input) };
113
+ identities.set(query, { key, operation: base.operation });
114
+ return query;
115
+ }),
116
+ });
117
+ if (result !== undefined) {
118
+ if (typeof result?.then === "function")
119
+ void Promise.resolve(result).catch(() => { });
120
+ throw new TypeError("Optimistic updaters must be synchronous");
121
+ }
122
+ // The target set is fixed at invocation; missing results cannot receive
123
+ // this prediction later merely because they enter the cache.
124
+ layer.targets ??= new Set(staged.keys());
125
+ if (!layer.targets.size) {
126
+ this.#layers.delete(id);
127
+ continue;
128
+ }
129
+ for (const [key, value] of staged)
130
+ if (!this.#visible(layer, key))
131
+ views.set(key, value);
132
+ }
133
+ catch {
134
+ this.#layers.delete(id);
135
+ warn();
136
+ }
137
+ }
138
+ return views;
139
+ }
140
+ }
package/dist/page.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /** Type-only marker identifying direct database page results. */
2
+ export declare const pageEligibility: unique symbol;
3
+ export interface Page<R> {
4
+ readonly page: R[];
5
+ readonly cursor: string | null;
6
+ readonly [pageEligibility]: true;
7
+ }
8
+ export interface PageOptions {
9
+ readonly limit: number;
10
+ readonly cursor?: string | null;
11
+ }
package/dist/page.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { FunctionCodecs } from "./codec.ts";
2
+ import type { FunctionRuntime, PageHandle, QueryState, QuerySubscriptionOptions, ReadonlyResult } from "./contracts.ts";
3
+ /** A list owns its ranges and publishes only complete adapter rounds. */
4
+ export declare class PaginationOperation<I, T> implements PageHandle<T> {
5
+ #private;
6
+ constructor(runtime: FunctionRuntime, name: string, mapper: (cursor: string | null) => I, codecs?: FunctionCodecs);
7
+ get status(): "error" | "pending" | "success";
8
+ get data(): readonly ReadonlyResult<T>[] | undefined;
9
+ get error(): unknown;
10
+ get isStale(): boolean;
11
+ get isOptimistic(): boolean;
12
+ get hasMore(): boolean;
13
+ then<A = ReadonlyResult<readonly T[]>, B = never>(fulfilled?: ((value: ReadonlyResult<readonly T[]>) => A | PromiseLike<A>) | null, rejected?: ((reason: unknown) => B | PromiseLike<B>) | null): Promise<A | B>;
14
+ next(pages?: number): Promise<void>;
15
+ subscribe(listener: (state: QueryState<readonly T[]>) => void, options?: QuerySubscriptionOptions): () => void;
16
+ dispose(): void;
17
+ }