@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.
- package/LICENSE +21 -0
- package/README.md +263 -2
- package/THIRD_PARTY_NOTICES.md +850 -0
- package/dist/aggregate.d.ts +63 -0
- package/dist/aggregate.js +147 -0
- package/dist/auth.d.ts +10 -0
- package/dist/auth.js +22 -0
- package/dist/bindings.d.ts +56 -0
- package/dist/bindings.js +277 -0
- package/dist/browser.d.ts +12 -0
- package/dist/browser.js +24 -0
- package/dist/callable.d.ts +48 -0
- package/dist/callable.js +142 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +65 -0
- package/dist/codec.d.ts +32 -0
- package/dist/codec.js +129 -0
- package/dist/codegen.d.ts +19 -0
- package/dist/codegen.js +275 -0
- package/dist/config.d.ts +70 -0
- package/dist/config.js +100 -0
- package/dist/contracts.d.ts +109 -0
- package/dist/contracts.js +1 -0
- package/dist/database-builder.d.ts +19 -0
- package/dist/database-builder.js +183 -0
- package/dist/database.d.ts +69 -0
- package/dist/database.js +128 -0
- package/dist/declarations.d.ts +91 -0
- package/dist/declarations.js +141 -0
- package/dist/dev-worker.d.ts +1 -0
- package/dist/dev-worker.js +47 -0
- package/dist/dev.d.ts +5 -0
- package/dist/dev.js +148 -0
- package/dist/error.d.ts +20 -0
- package/dist/error.js +82 -0
- package/dist/fields.d.ts +36 -0
- package/dist/fields.js +63 -0
- package/dist/filters.d.ts +93 -0
- package/dist/filters.js +220 -0
- package/dist/function-shapes.d.ts +7 -0
- package/dist/function-shapes.js +150 -0
- package/dist/handles.d.ts +27 -0
- package/dist/handles.js +387 -0
- package/dist/http/protocol.d.ts +64 -0
- package/dist/http/protocol.js +77 -0
- package/dist/http/sse.d.ts +7 -0
- package/dist/http/sse.js +70 -0
- package/dist/http.d.ts +44 -0
- package/dist/http.js +911 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -0
- package/dist/internal/client.d.ts +6 -0
- package/dist/internal/client.js +5 -0
- package/dist/json-value.d.ts +21 -0
- package/dist/json-value.js +79 -0
- package/dist/names.d.ts +2 -0
- package/dist/names.js +10 -0
- package/dist/native.d.ts +3 -0
- package/dist/native.js +42 -0
- package/dist/notifications.d.ts +8 -0
- package/dist/notifications.js +70 -0
- package/dist/optimistic.d.ts +46 -0
- package/dist/optimistic.js +140 -0
- package/dist/page.d.ts +11 -0
- package/dist/page.js +1 -0
- package/dist/pagination.d.ts +17 -0
- package/dist/pagination.js +262 -0
- package/dist/project-codegen.d.ts +2 -0
- package/dist/project-codegen.js +68 -0
- package/dist/projection.d.ts +19 -0
- package/dist/projection.js +31 -0
- package/dist/runtime-conditions.d.ts +2 -0
- package/dist/runtime-conditions.js +10 -0
- package/dist/runtime.d.ts +13 -0
- package/dist/runtime.js +47 -0
- package/dist/schema-codegen.d.ts +16 -0
- package/dist/schema-codegen.js +212 -0
- package/dist/schema-contract.d.ts +4 -0
- package/dist/schema-contract.js +42 -0
- package/dist/schema.d.ts +356 -0
- package/dist/schema.js +720 -0
- package/dist/server-database.d.ts +14 -0
- package/dist/server-database.js +386 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +1 -0
- package/dist/service.d.ts +13 -0
- package/dist/service.js +206 -0
- package/dist/sql-check.d.ts +28 -0
- package/dist/sql-check.js +59 -0
- package/dist/validation.d.ts +43 -0
- package/dist/validation.js +21 -0
- package/dist/worker-codegen.d.ts +3 -0
- package/dist/worker-codegen.js +44 -0
- package/dist/worker.d.ts +9 -0
- package/dist/worker.js +92 -0
- package/dist/write-expression.d.ts +72 -0
- package/dist/write-expression.js +122 -0
- package/dist/zod.d.ts +28 -0
- package/dist/zod.js +102 -0
- package/licenses/allocator-api2-0.2.21/LICENSE-APACHE +176 -0
- package/licenses/allocator-api2-0.2.21/LICENSE-MIT +23 -0
- package/licenses/async-trait-0.1.92/LICENSE-APACHE +176 -0
- package/licenses/async-trait-0.1.92/LICENSE-MIT +23 -0
- package/licenses/atomic-waker-1.1.2/LICENSE-APACHE +201 -0
- package/licenses/atomic-waker-1.1.2/LICENSE-MIT +23 -0
- package/licenses/atomic-waker-1.1.2/LICENSE-THIRD-PARTY +45 -0
- package/licenses/axum-0.8.9/LICENSE +25 -0
- package/licenses/axum-core-0.5.6/LICENSE +27 -0
- package/licenses/base64-0.22.1/LICENSE-APACHE +201 -0
- package/licenses/base64-0.22.1/LICENSE-MIT +21 -0
- package/licenses/bitflags-2.13.2/LICENSE-APACHE +201 -0
- package/licenses/bitflags-2.13.2/LICENSE-MIT +25 -0
- package/licenses/block-buffer-0.12.1/LICENSE-APACHE +201 -0
- package/licenses/block-buffer-0.12.1/LICENSE-MIT +25 -0
- package/licenses/byteorder-1.5.0/COPYING +3 -0
- package/licenses/byteorder-1.5.0/LICENSE-MIT +21 -0
- package/licenses/bytes-1.12.1/LICENSE +25 -0
- package/licenses/cc-1.6.0/LICENSE-APACHE +201 -0
- package/licenses/cc-1.6.0/LICENSE-MIT +25 -0
- package/licenses/cfg-if-1.0.5/LICENSE-APACHE +201 -0
- package/licenses/cfg-if-1.0.5/LICENSE-MIT +25 -0
- package/licenses/chacha20-0.10.2/LICENSE-APACHE +201 -0
- package/licenses/chacha20-0.10.2/LICENSE-MIT +25 -0
- package/licenses/cmov-0.5.4/LICENSE-APACHE +202 -0
- package/licenses/cmov-0.5.4/LICENSE-MIT +25 -0
- package/licenses/const-oid-0.10.2/LICENSE-APACHE +201 -0
- package/licenses/const-oid-0.10.2/LICENSE-MIT +25 -0
- package/licenses/const-oid-0.9.6/LICENSE-APACHE +201 -0
- package/licenses/const-oid-0.9.6/LICENSE-MIT +25 -0
- package/licenses/cpufeatures-0.3.1/LICENSE-APACHE +201 -0
- package/licenses/cpufeatures-0.3.1/LICENSE-MIT +25 -0
- package/licenses/crypto-common-0.2.2/LICENSE-APACHE +201 -0
- package/licenses/crypto-common-0.2.2/LICENSE-MIT +25 -0
- package/licenses/ctutils-0.4.2/LICENSE-APACHE +202 -0
- package/licenses/ctutils-0.4.2/LICENSE-MIT +25 -0
- package/licenses/der-0.7.10/LICENSE-APACHE +201 -0
- package/licenses/der-0.7.10/LICENSE-MIT +25 -0
- package/licenses/der_derive-0.7.3/LICENSE-APACHE +201 -0
- package/licenses/der_derive-0.7.3/LICENSE-MIT +25 -0
- package/licenses/deranged-0.5.8/LICENSE-Apache +202 -0
- package/licenses/deranged-0.5.8/LICENSE-MIT +19 -0
- package/licenses/digest-0.11.3/LICENSE-APACHE +201 -0
- package/licenses/digest-0.11.3/LICENSE-MIT +26 -0
- package/licenses/equivalent-1.0.3/LICENSE-APACHE +201 -0
- package/licenses/equivalent-1.0.3/LICENSE-MIT +25 -0
- package/licenses/errno-0.3.14/LICENSE-APACHE +201 -0
- package/licenses/errno-0.3.14/LICENSE-MIT +25 -0
- package/licenses/fallible-iterator-0.2.0/LICENSE-APACHE +202 -0
- package/licenses/fallible-iterator-0.2.0/LICENSE-MIT +19 -0
- package/licenses/find-msvc-tools-0.1.14/LICENSE-APACHE +201 -0
- package/licenses/find-msvc-tools-0.1.14/LICENSE-MIT +25 -0
- package/licenses/flagset-0.4.7/LICENSE +202 -0
- package/licenses/foldhash-0.2.0/LICENSE +19 -0
- package/licenses/futures-channel-0.3.34/LICENSE-APACHE +202 -0
- package/licenses/futures-channel-0.3.34/LICENSE-MIT +26 -0
- package/licenses/futures-core-0.3.34/LICENSE-APACHE +202 -0
- package/licenses/futures-core-0.3.34/LICENSE-MIT +26 -0
- package/licenses/futures-sink-0.3.34/LICENSE-APACHE +202 -0
- package/licenses/futures-sink-0.3.34/LICENSE-MIT +26 -0
- package/licenses/futures-task-0.3.34/LICENSE-APACHE +202 -0
- package/licenses/futures-task-0.3.34/LICENSE-MIT +26 -0
- package/licenses/futures-util-0.3.34/LICENSE-APACHE +202 -0
- package/licenses/futures-util-0.3.34/LICENSE-MIT +26 -0
- package/licenses/getrandom-0.2.17/LICENSE-APACHE +201 -0
- package/licenses/getrandom-0.2.17/LICENSE-MIT +26 -0
- package/licenses/getrandom-0.4.3/LICENSE-APACHE +201 -0
- package/licenses/getrandom-0.4.3/LICENSE-MIT +26 -0
- package/licenses/hashbrown-0.17.1/LICENSE-APACHE +201 -0
- package/licenses/hashbrown-0.17.1/LICENSE-MIT +25 -0
- package/licenses/hmac-0.13.0/LICENSE-APACHE +201 -0
- package/licenses/hmac-0.13.0/LICENSE-MIT +25 -0
- package/licenses/http-1.5.0/LICENSE-APACHE +201 -0
- package/licenses/http-1.5.0/LICENSE-MIT +25 -0
- package/licenses/http-body-1.1.0/LICENSE +25 -0
- package/licenses/http-body-util-0.1.5/LICENSE +25 -0
- package/licenses/httparse-1.10.1/LICENSE-APACHE +201 -0
- package/licenses/httparse-1.10.1/LICENSE-MIT +20 -0
- package/licenses/httpdate-1.0.3/LICENSE-APACHE +201 -0
- package/licenses/httpdate-1.0.3/LICENSE-MIT +19 -0
- package/licenses/hybrid-array-0.4.15/LICENSE-APACHE +201 -0
- package/licenses/hybrid-array-0.4.15/LICENSE-MIT +25 -0
- package/licenses/hyper-1.11.1/LICENSE +19 -0
- package/licenses/hyper-util-0.1.21/LICENSE +19 -0
- package/licenses/itoa-1.0.18/LICENSE-APACHE +176 -0
- package/licenses/itoa-1.0.18/LICENSE-MIT +23 -0
- package/licenses/libc-0.2.189/LICENSE-APACHE +176 -0
- package/licenses/libc-0.2.189/LICENSE-MIT +25 -0
- package/licenses/lock_api-0.4.14/LICENSE-APACHE +201 -0
- package/licenses/lock_api-0.4.14/LICENSE-MIT +25 -0
- package/licenses/log-0.4.34/LICENSE-APACHE +201 -0
- package/licenses/log-0.4.34/LICENSE-MIT +25 -0
- package/licenses/matchit-0.8.4/LICENSE +21 -0
- package/licenses/matchit-0.8.4/LICENSE.httprouter +29 -0
- package/licenses/md-5-0.11.0/LICENSE-APACHE +201 -0
- package/licenses/md-5-0.11.0/LICENSE-MIT +28 -0
- package/licenses/memchr-2.8.3/COPYING +3 -0
- package/licenses/memchr-2.8.3/LICENSE-MIT +21 -0
- package/licenses/mime-0.3.17/LICENSE-APACHE +201 -0
- package/licenses/mime-0.3.17/LICENSE-MIT +20 -0
- package/licenses/mio-1.2.3/LICENSE +19 -0
- package/licenses/num-conv-0.2.2/LICENSE-Apache +177 -0
- package/licenses/num-conv-0.2.2/LICENSE-MIT +19 -0
- package/licenses/objc2-core-foundation-0.3.2/LICENSE.md +34 -0
- package/licenses/objc2-system-configuration-0.3.2/LICENSE.md +34 -0
- package/licenses/once_cell-1.21.4/LICENSE-APACHE +201 -0
- package/licenses/once_cell-1.21.4/LICENSE-MIT +23 -0
- package/licenses/parking_lot-0.12.5/LICENSE-APACHE +201 -0
- package/licenses/parking_lot-0.12.5/LICENSE-MIT +25 -0
- package/licenses/parking_lot_core-0.9.12/LICENSE-APACHE +201 -0
- package/licenses/parking_lot_core-0.9.12/LICENSE-MIT +25 -0
- package/licenses/percent-encoding-2.3.2/LICENSE-APACHE +201 -0
- package/licenses/percent-encoding-2.3.2/LICENSE-MIT +25 -0
- package/licenses/phf-0.13.1/LICENSE +20 -0
- package/licenses/phf_shared-0.13.1/LICENSE +20 -0
- package/licenses/pin-project-lite-0.2.17/LICENSE-APACHE +177 -0
- package/licenses/pin-project-lite-0.2.17/LICENSE-MIT +23 -0
- package/licenses/postgres-protocol-0.6.12/LICENSE-APACHE +201 -0
- package/licenses/postgres-protocol-0.6.12/LICENSE-MIT +22 -0
- package/licenses/postgres-types-0.2.14/LICENSE-APACHE +201 -0
- package/licenses/postgres-types-0.2.14/LICENSE-MIT +22 -0
- package/licenses/powerfmt-0.2.1/LICENSE-Apache +202 -0
- package/licenses/powerfmt-0.2.1/LICENSE-MIT +19 -0
- package/licenses/proc-macro2-1.0.107/LICENSE-APACHE +176 -0
- package/licenses/proc-macro2-1.0.107/LICENSE-MIT +23 -0
- package/licenses/quote-1.0.47/LICENSE-APACHE +176 -0
- package/licenses/quote-1.0.47/LICENSE-MIT +23 -0
- package/licenses/rand-0.10.3/COPYRIGHT +12 -0
- package/licenses/rand-0.10.3/LICENSE-APACHE +176 -0
- package/licenses/rand-0.10.3/LICENSE-MIT +26 -0
- package/licenses/rand_core-0.10.1/COPYRIGHT +9 -0
- package/licenses/rand_core-0.10.1/LICENSE-APACHE +187 -0
- package/licenses/rand_core-0.10.1/LICENSE-MIT +25 -0
- package/licenses/ring-0.17.14/LICENSE +9 -0
- package/licenses/ring-0.17.14/LICENSE-BoringSSL +272 -0
- package/licenses/ring-0.17.14/LICENSE-other-bits +13 -0
- package/licenses/ring-0.17.14/src/polyfill/once_cell/LICENSE-APACHE +201 -0
- package/licenses/ring-0.17.14/src/polyfill/once_cell/LICENSE-MIT +23 -0
- package/licenses/ring-0.17.14/third_party/fiat/LICENSE +15 -0
- package/licenses/rquickjs-0.14.0/LICENSE +22 -0
- package/licenses/rquickjs-core-0.14.0/LICENSE +22 -0
- package/licenses/rquickjs-sys-0.14.0/quickjs/LICENSE +24 -0
- package/licenses/rquickjs-sys-0.14.0/vendor/wasi-libc/NOTICE.md +26 -0
- package/licenses/rustls-0.23.46/LICENSE-APACHE +201 -0
- package/licenses/rustls-0.23.46/LICENSE-ISC +15 -0
- package/licenses/rustls-0.23.46/LICENSE-MIT +25 -0
- package/licenses/rustls-pki-types-1.15.1/LICENSE-APACHE +201 -0
- package/licenses/rustls-pki-types-1.15.1/LICENSE-MIT +25 -0
- package/licenses/rustls-webpki-0.103.15/LICENSE +19 -0
- package/licenses/scopeguard-1.2.0/LICENSE-APACHE +201 -0
- package/licenses/scopeguard-1.2.0/LICENSE-MIT +25 -0
- package/licenses/serde-1.0.229/LICENSE-APACHE +176 -0
- package/licenses/serde-1.0.229/LICENSE-MIT +23 -0
- package/licenses/serde_core-1.0.229/LICENSE-APACHE +176 -0
- package/licenses/serde_core-1.0.229/LICENSE-MIT +23 -0
- package/licenses/serde_derive-1.0.229/LICENSE-APACHE +176 -0
- package/licenses/serde_derive-1.0.229/LICENSE-MIT +23 -0
- package/licenses/serde_json-1.0.151/LICENSE-APACHE +176 -0
- package/licenses/serde_json-1.0.151/LICENSE-MIT +23 -0
- package/licenses/serde_path_to_error-0.1.20/LICENSE-APACHE +176 -0
- package/licenses/serde_path_to_error-0.1.20/LICENSE-MIT +23 -0
- package/licenses/sha2-0.11.0/LICENSE-APACHE +201 -0
- package/licenses/sha2-0.11.0/LICENSE-MIT +28 -0
- package/licenses/shlex-2.0.1/LICENSE-APACHE +13 -0
- package/licenses/shlex-2.0.1/LICENSE-MIT +21 -0
- package/licenses/signal-hook-registry-1.4.8/LICENSE-APACHE +201 -0
- package/licenses/signal-hook-registry-1.4.8/LICENSE-MIT +25 -0
- package/licenses/siphasher-1.0.4/COPYING +7 -0
- package/licenses/siphasher-1.0.4/LICENSE-APACHE +202 -0
- package/licenses/siphasher-1.0.4/LICENSE-MIT +17 -0
- package/licenses/slab-0.4.12/LICENSE +25 -0
- package/licenses/smallvec-1.16.2/LICENSE-APACHE +201 -0
- package/licenses/smallvec-1.16.2/LICENSE-MIT +25 -0
- package/licenses/socket2-0.6.5/LICENSE-APACHE +201 -0
- package/licenses/socket2-0.6.5/LICENSE-MIT +25 -0
- package/licenses/spki-0.7.3/LICENSE-APACHE +201 -0
- package/licenses/spki-0.7.3/LICENSE-MIT +25 -0
- package/licenses/stringprep-0.1.5/LICENSE-APACHE +202 -0
- package/licenses/stringprep-0.1.5/LICENSE-MIT +19 -0
- package/licenses/subtle-2.6.1/LICENSE +29 -0
- package/licenses/syn-2.0.119/LICENSE-APACHE +176 -0
- package/licenses/syn-2.0.119/LICENSE-MIT +23 -0
- package/licenses/syn-3.0.6/LICENSE-APACHE +176 -0
- package/licenses/syn-3.0.6/LICENSE-MIT +23 -0
- package/licenses/sync_wrapper-1.0.2/LICENSE +177 -0
- package/licenses/time-0.3.55/LICENSE-Apache +177 -0
- package/licenses/time-0.3.55/LICENSE-MIT +19 -0
- package/licenses/time-core-0.1.9/LICENSE-Apache +177 -0
- package/licenses/time-core-0.1.9/LICENSE-MIT +19 -0
- package/licenses/time-macros-0.2.32/LICENSE-Apache +177 -0
- package/licenses/time-macros-0.2.32/LICENSE-MIT +19 -0
- package/licenses/tinyvec-1.13.3/LICENSE-APACHE.md +202 -0
- package/licenses/tinyvec-1.13.3/LICENSE-MIT.md +5 -0
- package/licenses/tinyvec-1.13.3/LICENSE-ZLIB.md +11 -0
- package/licenses/tokio-1.53.1/LICENSE +21 -0
- package/licenses/tokio-macros-2.7.2/LICENSE +22 -0
- package/licenses/tokio-postgres-0.7.18/LICENSE-APACHE +201 -0
- package/licenses/tokio-postgres-0.7.18/LICENSE-MIT +22 -0
- package/licenses/tokio-postgres-rustls-0.14.0/LICENSE +21 -0
- package/licenses/tokio-rustls-0.26.6/LICENSE-APACHE +201 -0
- package/licenses/tokio-rustls-0.26.6/LICENSE-MIT +25 -0
- package/licenses/tokio-util-0.7.19/LICENSE +21 -0
- package/licenses/tower-0.5.3/LICENSE +25 -0
- package/licenses/tower-layer-0.3.3/LICENSE +25 -0
- package/licenses/tower-service-0.3.3/LICENSE +25 -0
- package/licenses/typenum-1.20.1/LICENSE +1 -0
- package/licenses/typenum-1.20.1/LICENSE-APACHE +201 -0
- package/licenses/typenum-1.20.1/LICENSE-MIT +21 -0
- package/licenses/unicode-bidi-0.3.18/COPYRIGHT +8 -0
- package/licenses/unicode-bidi-0.3.18/LICENSE-APACHE +201 -0
- package/licenses/unicode-bidi-0.3.18/LICENSE-MIT +25 -0
- package/licenses/unicode-ident-1.0.26/LICENSE-APACHE +176 -0
- package/licenses/unicode-ident-1.0.26/LICENSE-MIT +23 -0
- package/licenses/unicode-ident-1.0.26/LICENSE-UNICODE +39 -0
- package/licenses/unicode-normalization-0.1.25/COPYRIGHT +7 -0
- package/licenses/unicode-normalization-0.1.25/LICENSE-APACHE +201 -0
- package/licenses/unicode-normalization-0.1.25/LICENSE-MIT +25 -0
- package/licenses/unicode-properties-0.1.4/COPYRIGHT +7 -0
- package/licenses/unicode-properties-0.1.4/LICENSE-APACHE +201 -0
- package/licenses/unicode-properties-0.1.4/LICENSE-MIT +25 -0
- package/licenses/untrusted-0.9.0/LICENSE.txt +13 -0
- package/licenses/uuid-1.26.1/LICENSE-APACHE +201 -0
- package/licenses/uuid-1.26.1/LICENSE-MIT +26 -0
- package/licenses/webpki-roots-1.0.9/LICENSE +61 -0
- package/licenses/whoami-2.1.3/LICENSE_APACHE +176 -0
- package/licenses/whoami-2.1.3/LICENSE_BOOST +23 -0
- package/licenses/whoami-2.1.3/LICENSE_MIT +19 -0
- package/licenses/x509-cert-0.2.5/LICENSE-APACHE +201 -0
- package/licenses/x509-cert-0.2.5/LICENSE-MIT +25 -0
- package/licenses/zeroize-1.9.1/LICENSE-APACHE +202 -0
- package/licenses/zeroize-1.9.1/LICENSE-MIT +25 -0
- package/licenses/zmij-1.0.23/LICENSE-MIT +23 -0
- package/native/darwin-arm64/hulladb-bridge +0 -0
- package/native/darwin-arm64/hulladb-js +0 -0
- package/native/darwin-arm64/hulladb-service +0 -0
- package/native/linux-x64/hulladb-bridge +0 -0
- package/native/linux-x64/hulladb-js +0 -0
- package/native/linux-x64/hulladb-service +0 -0
- 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
|
-
#
|
|
1
|
+
# TypeScript function SDK
|
|
2
2
|
|
|
3
|
-
|
|
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).
|