Compare commits
8 Commits
aea2cbceba
...
feat/remov
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e84c715f4c | ||
|
|
ecbcc814ed
|
||
|
|
be97387252
|
||
|
|
987ece2a4b
|
||
|
|
8d2e3f006b
|
||
|
|
80d3e117b4
|
||
|
|
8a540522dd
|
||
|
|
a11214072f
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ node_modules/
|
|||||||
# Added by cargo
|
# Added by cargo
|
||||||
|
|
||||||
/target
|
/target
|
||||||
|
.direnv/
|
||||||
|
|||||||
367
Cargo.lock
generated
367
Cargo.lock
generated
@@ -1,176 +1,80 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.2.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "box"
|
name = "box"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "branch"
|
name = "branch"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"glam",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bumpalo"
|
|
||||||
version = "3.16.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "console_error_panic_hook"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "float"
|
name = "float"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glam"
|
name = "glam"
|
||||||
version = "0.27.0"
|
version = "0.30.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e05e7e6723e3455f4818c7b26e855439f7546cf617ef669d1adedb8669e5cb9"
|
checksum = "19fc433e8437a212d1b6f1e68c7824af3aed907da60afa994e7f542d18d12aa9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gravity"
|
name = "gravity"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"glam",
|
"glam",
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"noise",
|
]
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
[[package]]
|
||||||
"wasm-bindgen",
|
name = "instance"
|
||||||
"wasm-bindgen-test",
|
version = "0.1.0"
|
||||||
"web-sys",
|
dependencies = [
|
||||||
|
"glam",
|
||||||
|
"nodarium_macros",
|
||||||
|
"nodarium_utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.11"
|
version = "1.0.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "js-sys"
|
|
||||||
version = "0.3.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
|
||||||
dependencies = [
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "log"
|
|
||||||
version = "0.4.21"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "math"
|
name = "math"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "max-plantarium-triangle"
|
name = "memchr"
|
||||||
version = "0.1.0"
|
version = "2.7.6"
|
||||||
dependencies = [
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"console_error_panic_hook",
|
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||||
"nodarium_macros",
|
|
||||||
"nodarium_utils",
|
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "max-plantarium-vec3"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"console_error_panic_hook",
|
|
||||||
"nodarium_macros",
|
|
||||||
"nodarium_utils",
|
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nodarium_instance"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"console_error_panic_hook",
|
|
||||||
"glam",
|
|
||||||
"nodarium_macros",
|
|
||||||
"nodarium_utils",
|
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nodarium_macros"
|
name = "nodarium_macros"
|
||||||
@@ -180,7 +84,7 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"syn 1.0.109",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -195,29 +99,19 @@ dependencies = [
|
|||||||
name = "nodarium_utils"
|
name = "nodarium_utils"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"glam",
|
"glam",
|
||||||
"noise",
|
"noise 0.9.0",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"wasm-bindgen",
|
|
||||||
"web-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nodes-noise"
|
name = "noise"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"glam",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"noise",
|
"noise 0.9.0",
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -233,48 +127,35 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.18"
|
version = "0.2.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "once_cell"
|
|
||||||
version = "1.19.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "output"
|
name = "output"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"glam",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.81"
|
version = "1.0.105"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
|
checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.36"
|
version = "1.0.43"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@@ -307,103 +188,76 @@ dependencies = [
|
|||||||
name = "random"
|
name = "random"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rotate"
|
name = "rotate"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"glam",
|
"glam",
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
"serde",
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ryu"
|
|
||||||
version = "1.0.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "scoped-tls"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.198"
|
version = "1.0.228"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc"
|
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_core"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde-wasm-bindgen"
|
|
||||||
version = "0.4.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf"
|
|
||||||
dependencies = [
|
|
||||||
"js-sys",
|
|
||||||
"serde",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.198"
|
version = "1.0.228"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9"
|
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.60",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.116"
|
version = "1.0.149"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
|
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"memchr",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_core",
|
||||||
|
"zmij",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stem"
|
name = "stem"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
|
||||||
"nodarium_macros",
|
"nodarium_macros",
|
||||||
"nodarium_utils",
|
"nodarium_utils",
|
||||||
"serde",
|
|
||||||
"serde-wasm-bindgen",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-test",
|
|
||||||
"web-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "2.0.114"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -411,119 +265,30 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "triangle"
|
||||||
version = "2.0.60"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"nodarium_macros",
|
||||||
"quote",
|
"nodarium_utils",
|
||||||
"unicode-ident",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.12"
|
version = "1.0.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "vec3"
|
||||||
version = "0.2.92"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"nodarium_macros",
|
||||||
"wasm-bindgen-macro",
|
"nodarium_utils",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "zmij"
|
||||||
version = "0.2.92"
|
version = "1.0.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
checksum = "94f63c051f4fe3c1509da62131a678643c5b6fbdc9273b2b79d4378ebda003d2"
|
||||||
dependencies = [
|
|
||||||
"bumpalo",
|
|
||||||
"log",
|
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.60",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-futures"
|
|
||||||
version = "0.4.42"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"wasm-bindgen-macro-support",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro-support"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.60",
|
|
||||||
"wasm-bindgen-backend",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-shared"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-test"
|
|
||||||
version = "0.3.42"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b"
|
|
||||||
dependencies = [
|
|
||||||
"console_error_panic_hook",
|
|
||||||
"js-sys",
|
|
||||||
"scoped-tls",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"wasm-bindgen-test-macro",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-test-macro"
|
|
||||||
version = "0.3.42"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.60",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "web-sys"
|
|
||||||
version = "0.3.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
|
|
||||||
dependencies = [
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -14,29 +14,30 @@
|
|||||||
"@nodarium/ui": "link:../packages/ui",
|
"@nodarium/ui": "link:../packages/ui",
|
||||||
"@nodarium/utils": "link:../packages/utils",
|
"@nodarium/utils": "link:../packages/utils",
|
||||||
"@sveltejs/kit": "^2.50.0",
|
"@sveltejs/kit": "^2.50.0",
|
||||||
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
"@threlte/core": "8.3.1",
|
"@threlte/core": "8.3.1",
|
||||||
"@threlte/extras": "9.7.1",
|
"@threlte/extras": "9.7.1",
|
||||||
"@types/three": "^0.182.0",
|
|
||||||
"@unocss/reset": "^66.6.0",
|
|
||||||
"comlink": "^4.4.2",
|
"comlink": "^4.4.2",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"idb": "^8.0.3",
|
"idb": "^8.0.3",
|
||||||
"jsondiffpatch": "^0.7.3",
|
"jsondiffpatch": "^0.7.3",
|
||||||
"three": "^0.182.0"
|
"tailwindcss": "^4.1.18",
|
||||||
|
"three": "^0.182.0",
|
||||||
|
"wabt": "^1.0.39"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/tabler": "^1.2.26",
|
"@iconify-json/tabler": "^1.2.26",
|
||||||
|
"@iconify/tailwind4": "^1.2.1",
|
||||||
"@nodarium/types": "link:../packages/types",
|
"@nodarium/types": "link:../packages/types",
|
||||||
"@sveltejs/adapter-static": "^3.0.10",
|
"@sveltejs/adapter-static": "^3.0.10",
|
||||||
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
||||||
"@tsconfig/svelte": "^5.0.6",
|
"@tsconfig/svelte": "^5.0.6",
|
||||||
"@types/file-saver": "^2.0.7",
|
"@types/file-saver": "^2.0.7",
|
||||||
"@unocss/preset-icons": "^66.6.0",
|
"@types/three": "^0.182.0",
|
||||||
"svelte": "^5.46.4",
|
"svelte": "^5.46.4",
|
||||||
"svelte-check": "^4.3.5",
|
"svelte-check": "^4.3.5",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"unocss": "^66.6.0",
|
|
||||||
"vite": "^7.3.1",
|
"vite": "^7.3.1",
|
||||||
"vite-plugin-comlink": "^5.3.0",
|
"vite-plugin-comlink": "^5.3.0",
|
||||||
"vite-plugin-glsl": "^1.5.5",
|
"vite-plugin-glsl": "^1.5.5",
|
||||||
|
|||||||
6
app/src/app.css
Normal file
6
app/src/app.css
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
@source "../../packages/ui/**/*.svelte";
|
||||||
|
@plugin "@iconify/tailwind4" {
|
||||||
|
prefix: "i";
|
||||||
|
icon-sets: from-folder(custom, "./src/lib/icons")
|
||||||
|
};
|
||||||
@@ -177,9 +177,11 @@
|
|||||||
<EdgeEl z={graphState.cameraPosition[2]} {x1} {y1} {x2} {y2} />
|
<EdgeEl z={graphState.cameraPosition[2]} {x1} {y1} {x2} {y2} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
<HTML>
|
<HTML transform={false}>
|
||||||
<div
|
<div
|
||||||
|
role="tree"
|
||||||
id="graph"
|
id="graph"
|
||||||
|
tabindex="0"
|
||||||
class="wrapper"
|
class="wrapper"
|
||||||
style:transform={`scale(${graphState.cameraPosition[2] * 0.1})`}
|
style:transform={`scale(${graphState.cameraPosition[2] * 0.1})`}
|
||||||
class:hovering-sockets={graphState.activeSocket}
|
class:hovering-sockets={graphState.activeSocket}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from "svelte";
|
import { getContext, type Snippet } from "svelte";
|
||||||
|
|
||||||
let index = -1;
|
let index = $state(-1);
|
||||||
let wrapper: HTMLDivElement;
|
let wrapper: HTMLDivElement;
|
||||||
|
|
||||||
$: if (index === -1) {
|
const { children } = $props<{ children?: Snippet }>();
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (index === -1) {
|
||||||
index = getContext<() => number>("registerCell")();
|
index = getContext<() => number>("registerCell")();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const sizes = getContext<{ value: string[] }>("sizes");
|
const sizes = getContext<{ value: string[] }>("sizes");
|
||||||
|
|
||||||
@@ -31,8 +35,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window
|
<svelte:window
|
||||||
on:mouseup={() => (mouseDown = false)}
|
onmouseup={() => (mouseDown = false)}
|
||||||
on:mousemove={handleMouseMove}
|
onmousemove={handleMouseMove}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if index > 0}
|
{#if index > 0}
|
||||||
@@ -40,12 +44,12 @@
|
|||||||
class="seperator"
|
class="seperator"
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:mousedown={handleMouseDown}
|
onmousedown={handleMouseDown}
|
||||||
></div>
|
></div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="cell" bind:this={wrapper}>
|
<div class="cell" bind:this={wrapper}>
|
||||||
<slot />
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { setContext } from "svelte";
|
import { setContext, type Snippet } from "svelte";
|
||||||
|
|
||||||
export let id = "grid-0";
|
const { children, id } = $props<{ children?: Snippet; id?: string }>();
|
||||||
|
|
||||||
setContext("grid-id", id);
|
setContext("grid-id", id);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<slot {id} />
|
{@render children({ id })}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import fs from "fs/promises";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
export async function getWasm(id: `${string}/${string}/${string}`) {
|
export async function getWasm(id: `${string}/${string}/${string}`) {
|
||||||
const filePath = path.resolve(`../nodes/${id}/pkg/index_bg.wasm`);
|
const filePath = path.resolve(`../nodes/${id}/pkg/node.wasm`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.access(filePath);
|
await fs.access(filePath);
|
||||||
|
|||||||
@@ -14,7 +14,10 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="bars">
|
<div class="bars">
|
||||||
{#each values as value, i}
|
{#each values as value, i}
|
||||||
<div class="bar bg-{colors[i]}" style="width: {(value / total) * 100}%;">
|
<div
|
||||||
|
class="bar bg-{colors[i]}-400"
|
||||||
|
style="width: {(value / total) * 100}%;"
|
||||||
|
>
|
||||||
{Math.round(value)}ms
|
{Math.round(value)}ms
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -22,10 +25,12 @@
|
|||||||
|
|
||||||
<div class="labels mt-2">
|
<div class="labels mt-2">
|
||||||
{#each values as _label, i}
|
{#each values as _label, i}
|
||||||
<div class="text-{colors[i]}">{labels[i]}</div>
|
<div class="text-{colors[i]}-400">{labels[i]}</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<span class="bg-red bg-green bg-blue text-red text-green text-blue"></span>
|
<span
|
||||||
|
class="bg-red-400 bg-green-400 bg-blue-400 text-red-400 text-green-400 text-blue-400"
|
||||||
|
></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -244,13 +244,14 @@ export class MemoryRuntimeExecutor implements RuntimeExecutor {
|
|||||||
}
|
}
|
||||||
this.perf?.addPoint("cache-hit", 0);
|
this.perf?.addPoint("cache-hit", 0);
|
||||||
|
|
||||||
log.group(`executing ${node_type.id || node.id}`);
|
log.group(`executing ${node_type.id}-${node.id}`);
|
||||||
log.log(`Inputs:`, inputs);
|
log.log(`Inputs:`, inputs);
|
||||||
a = performance.now();
|
a = performance.now();
|
||||||
results[node.id] = node_type.execute(encoded_inputs);
|
results[node.id] = node_type.execute(encoded_inputs);
|
||||||
|
log.log("Executed", node.type, node.id)
|
||||||
b = performance.now();
|
b = performance.now();
|
||||||
|
|
||||||
if (this.cache) {
|
if (this.cache && node.id !== outputNode.id) {
|
||||||
this.cache.set(inputHash, results[node.id]);
|
this.cache.set(inputHash, results[node.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import NestedSettings from "./NestedSettings.svelte";
|
import NestedSettings from "./NestedSettings.svelte";
|
||||||
import { localState } from "$lib/helpers/localState.svelte";
|
import { localState } from "$lib/helpers/localState.svelte";
|
||||||
import type { NodeInput } from "@nodarium/types";
|
import type { NodeInput } from "@nodarium/types";
|
||||||
import { Input } from "@nodarium/ui";
|
import Input from "@nodarium/ui";
|
||||||
|
|
||||||
type Button = { type: "button"; callback: () => void; label?: string };
|
type Button = { type: "button"; callback: () => void; label?: string };
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +1,46 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from "svelte";
|
import { getContext, type Snippet } from "svelte";
|
||||||
import type { Readable } from "svelte/store";
|
import type { PanelState } from "./PanelState.svelte";
|
||||||
|
|
||||||
export let id: string;
|
const {
|
||||||
export let icon: string = "";
|
id,
|
||||||
export let title = "";
|
icon = "",
|
||||||
export let classes = "";
|
title = "",
|
||||||
export let hidden: boolean | undefined = undefined;
|
classes = "",
|
||||||
|
hidden,
|
||||||
|
children,
|
||||||
|
} = $props<{
|
||||||
|
id: string;
|
||||||
|
icon?: string;
|
||||||
|
title?: string;
|
||||||
|
classes?: string;
|
||||||
|
hidden?: boolean;
|
||||||
|
children?: Snippet;
|
||||||
|
}>();
|
||||||
|
|
||||||
const setVisibility =
|
const panelState = getContext<PanelState>("panel-state");
|
||||||
getContext<(id: string, visible: boolean) => void>("setVisibility");
|
|
||||||
|
|
||||||
$: if (typeof hidden === "boolean") {
|
const panel = panelState.registerPanel(id, icon, classes, hidden);
|
||||||
setVisibility(id, !hidden);
|
$effect(() => {
|
||||||
}
|
panel.hidden = hidden;
|
||||||
|
});
|
||||||
const registerPanel =
|
|
||||||
getContext<
|
|
||||||
(id: string, icon: string, classes: string) => Readable<boolean>
|
|
||||||
>("registerPanel");
|
|
||||||
|
|
||||||
let visible = registerPanel(id, icon, classes);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $visible}
|
{#if panelState.activePanel.value === id}
|
||||||
<div class="wrapper" class:hidden>
|
<div class="wrapper" class:hidden>
|
||||||
{#if title}
|
{#if title}
|
||||||
<header>
|
<header>
|
||||||
<h3>{title}</h3>
|
<h3>{title}</h3>
|
||||||
</header>
|
</header>
|
||||||
{/if}
|
{/if}
|
||||||
<slot />
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
header {
|
header {
|
||||||
border-bottom: solid thin var(--outline);
|
border-bottom: solid thin var(--outline);
|
||||||
height: 69px;
|
height: 70px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
|
|||||||
35
app/src/lib/sidebar/PanelState.svelte.ts
Normal file
35
app/src/lib/sidebar/PanelState.svelte.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { localState } from "$lib/helpers/localState.svelte";
|
||||||
|
|
||||||
|
type Panel = {
|
||||||
|
icon: string;
|
||||||
|
classes: string;
|
||||||
|
hidden?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PanelState {
|
||||||
|
|
||||||
|
panels = $state<Record<string, Panel>>({});
|
||||||
|
activePanel = localState<string | boolean>("node.activePanel", "")
|
||||||
|
|
||||||
|
get keys() {
|
||||||
|
return Object.keys(this.panels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public registerPanel(id: string, icon: string, classes: string, hidden: boolean): Panel {
|
||||||
|
const state = $state({
|
||||||
|
icon: icon,
|
||||||
|
classes: classes,
|
||||||
|
hidden: hidden,
|
||||||
|
});
|
||||||
|
this.panels[id] = state;
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public toggleOpen() {
|
||||||
|
if (this.activePanel.value) {
|
||||||
|
this.activePanel.value = false;
|
||||||
|
} else {
|
||||||
|
this.activePanel.value = this.keys[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,77 +1,35 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import localStore from "$lib/helpers/localStore";
|
import { setContext, type Snippet } from "svelte";
|
||||||
import { setContext } from "svelte";
|
import { PanelState } from "./PanelState.svelte";
|
||||||
import { derived } from "svelte/store";
|
|
||||||
|
|
||||||
let panels: Record<
|
const state = new PanelState();
|
||||||
string,
|
setContext("panel-state", state);
|
||||||
{
|
|
||||||
icon: string;
|
|
||||||
id: string;
|
|
||||||
classes: string;
|
|
||||||
visible?: boolean;
|
|
||||||
}
|
|
||||||
> = {};
|
|
||||||
|
|
||||||
const activePanel = localStore<keyof typeof panels | false>(
|
const { children } = $props<{ children?: Snippet }>();
|
||||||
"nodes.settings.activePanel",
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
$: keys = panels
|
|
||||||
? (Object.keys(panels) as unknown as (keyof typeof panels)[]).filter(
|
|
||||||
(key) => !!panels[key]?.id,
|
|
||||||
)
|
|
||||||
: [];
|
|
||||||
|
|
||||||
setContext("setVisibility", (id: string, visible: boolean) => {
|
|
||||||
panels[id].visible = visible;
|
|
||||||
panels = { ...panels };
|
|
||||||
});
|
|
||||||
|
|
||||||
setContext("registerPanel", (id: string, icon: string, classes: string) => {
|
|
||||||
panels[id] = { id, icon, classes };
|
|
||||||
return derived(activePanel, ($activePanel) => {
|
|
||||||
return $activePanel === id;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function setActivePanel(panel: keyof typeof panels | false) {
|
|
||||||
if (panel === $activePanel) {
|
|
||||||
$activePanel = false;
|
|
||||||
} else if (panel) {
|
|
||||||
$activePanel = panel;
|
|
||||||
} else {
|
|
||||||
$activePanel = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="wrapper" class:visible={$activePanel}>
|
<div class="wrapper" class:visible={state.activePanel.value}>
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<button
|
<button aria-label="Close" onclick={() => state.toggleOpen()}>
|
||||||
aria-label="Close"
|
<span class="icon-[tabler--settings]"></span>
|
||||||
on:click={() => {
|
<span class="absolute i-[tabler--chevron-left] w-6 h-6 block"></span>
|
||||||
setActivePanel($activePanel ? false : keys[0]);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="absolute i-tabler-chevron-left w-6 h-6 block"></span>
|
|
||||||
</button>
|
</button>
|
||||||
{#each keys as panel (panels[panel].id)}
|
{#each state.keys as panelId (panelId)}
|
||||||
{#if panels[panel].visible !== false}
|
{#if !state.panels[panelId].hidden}
|
||||||
<button
|
<button
|
||||||
aria-label={panel}
|
aria-label={panelId}
|
||||||
class="tab {panels[panel].classes}"
|
class="tab {state.panels[panelId].classes}"
|
||||||
class:active={panel === $activePanel}
|
class:active={panelId === state.activePanel.value}
|
||||||
on:click={() => setActivePanel(panel)}
|
onclick={() => (state.activePanel.value = panelId)}
|
||||||
>
|
>
|
||||||
<span class={`block w-6 h-6 ${panels[panel].icon}`}></span>
|
<span class={`block w-6 h-6 iconify ${state.panels[panelId].icon}`}
|
||||||
|
></span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<slot />
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
FileSaver.saveAs(blob, name + "." + extension);
|
FileSaver.saveAs(blob, name + "." + extension);
|
||||||
};
|
};
|
||||||
|
|
||||||
export let scene: Group;
|
const { scene } = $props<{ scene: Group }>();
|
||||||
|
|
||||||
let gltfExporter: GLTFExporter;
|
let gltfExporter: GLTFExporter;
|
||||||
async function exportGltf() {
|
async function exportGltf() {
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="p-2">
|
<div class="p-4">
|
||||||
<button on:click={exportObj}> export obj </button>
|
<button onclick={exportObj}> export obj </button>
|
||||||
<button on:click={exportGltf}> export gltf </button>
|
<button onclick={exportGltf}> export gltf </button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
let { keymaps }: Props = $props();
|
let { keymaps }: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<table class="wrapper">
|
<div class="p-4">
|
||||||
|
<table class="wrapper">
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each keymaps as keymap}
|
{#each keymaps as keymap}
|
||||||
<tr>
|
<tr>
|
||||||
@@ -38,7 +39,8 @@
|
|||||||
{/each}
|
{/each}
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.wrapper {
|
.wrapper {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import "@nodarium/ui/app.css";
|
import "@nodarium/ui/app.css";
|
||||||
import "virtual:uno.css";
|
import "../app.css";
|
||||||
import "@unocss/reset/normalize.css";
|
import type { Snippet } from "svelte";
|
||||||
|
const { children } = $props<{ children?: Snippet }>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<slot />
|
{@render children?.()}
|
||||||
|
|||||||
@@ -178,7 +178,7 @@
|
|||||||
onsave={(graph) => handleSave(graph)}
|
onsave={(graph) => handleSave(graph)}
|
||||||
/>
|
/>
|
||||||
<Sidebar>
|
<Sidebar>
|
||||||
<Panel id="general" title="General" icon="i-tabler-settings">
|
<Panel id="general" title="General" icon="i-[tabler--settings]">
|
||||||
<NestedSettings
|
<NestedSettings
|
||||||
id="general"
|
id="general"
|
||||||
bind:value={appSettings.value}
|
bind:value={appSettings.value}
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
<Panel
|
<Panel
|
||||||
id="shortcuts"
|
id="shortcuts"
|
||||||
title="Keyboard Shortcuts"
|
title="Keyboard Shortcuts"
|
||||||
icon="i-tabler-keyboard"
|
icon="i-[tabler--keyboard]"
|
||||||
>
|
>
|
||||||
<Keymap
|
<Keymap
|
||||||
keymaps={[
|
keymaps={[
|
||||||
@@ -197,23 +197,21 @@
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel id="exports" title="Exporter" icon="i-tabler-package-export">
|
<Panel id="exports" title="Exporter" icon="i-[tabler--package-export]">
|
||||||
<ExportSettings {scene} />
|
<ExportSettings {scene} />
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel
|
<Panel
|
||||||
id="node-store"
|
id="node-store"
|
||||||
classes="text-green-400"
|
|
||||||
title="Node Store"
|
title="Node Store"
|
||||||
icon="i-tabler-database"
|
icon="i-[tabler--database] bg-green-400"
|
||||||
>
|
>
|
||||||
<NodeStore registry={nodeRegistry} />
|
<NodeStore registry={nodeRegistry} />
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel
|
<Panel
|
||||||
id="performance"
|
id="performance"
|
||||||
title="Performance"
|
title="Performance"
|
||||||
classes="text-red-400"
|
|
||||||
hidden={!appSettings.value.debug.showPerformancePanel}
|
hidden={!appSettings.value.debug.showPerformancePanel}
|
||||||
icon="i-tabler-brand-speedtest"
|
icon="i-[tabler--brand-speedtest] bg-red-400"
|
||||||
>
|
>
|
||||||
{#if $performanceStore}
|
{#if $performanceStore}
|
||||||
<PerformanceViewer data={$performanceStore} />
|
<PerformanceViewer data={$performanceStore} />
|
||||||
@@ -223,24 +221,22 @@
|
|||||||
id="graph-source"
|
id="graph-source"
|
||||||
title="Graph Source"
|
title="Graph Source"
|
||||||
hidden={!appSettings.value.debug.showGraphJson}
|
hidden={!appSettings.value.debug.showGraphJson}
|
||||||
icon="i-tabler-code"
|
icon="i-[tabler--code]"
|
||||||
>
|
>
|
||||||
<GraphSource {graph} />
|
<GraphSource graph={graph && manager.serialize()} />
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel
|
<Panel
|
||||||
id="benchmark"
|
id="benchmark"
|
||||||
title="Benchmark"
|
title="Benchmark"
|
||||||
classes="text-red-400"
|
|
||||||
hidden={!appSettings.value.debug.showBenchmarkPanel}
|
hidden={!appSettings.value.debug.showBenchmarkPanel}
|
||||||
icon="i-tabler-graph"
|
icon="i-[tabler--graph] bg-red-400"
|
||||||
>
|
>
|
||||||
<BenchmarkPanel run={randomGenerate} />
|
<BenchmarkPanel run={randomGenerate} />
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel
|
<Panel
|
||||||
id="graph-settings"
|
id="graph-settings"
|
||||||
title="Graph Settings"
|
title="Graph Settings"
|
||||||
classes="text-blue-400"
|
icon="i-[custom--graph] bg-blue-400"
|
||||||
icon="i-custom-graph"
|
|
||||||
>
|
>
|
||||||
<NestedSettings
|
<NestedSettings
|
||||||
id="graph-settings"
|
id="graph-settings"
|
||||||
@@ -251,8 +247,7 @@
|
|||||||
<Panel
|
<Panel
|
||||||
id="active-node"
|
id="active-node"
|
||||||
title="Node Settings"
|
title="Node Settings"
|
||||||
classes="text-blue-400"
|
icon="i-[tabler--adjustments] bg-blue-400"
|
||||||
icon="i-tabler-adjustments"
|
|
||||||
>
|
>
|
||||||
<ActiveNodeSettings {manager} bind:node={activeNode} />
|
<ActiveNodeSettings {manager} bind:node={activeNode} />
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|||||||
8
app/src/routes/dev/+layout.svelte
Normal file
8
app/src/routes/dev/+layout.svelte
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { Snippet } from "svelte";
|
||||||
|
const { children } = $props<{ children?: Snippet }>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<main class="w-screen overflow-x-hidden">
|
||||||
|
{@render children()}
|
||||||
|
</main>
|
||||||
@@ -1,25 +1,120 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Grid from "$lib/grid";
|
import NodeHTML from "$lib/graph-interface/node/NodeHTML.svelte";
|
||||||
|
import { localState } from "$lib/helpers/localState.svelte";
|
||||||
import Panel from "$lib/sidebar/Panel.svelte";
|
import Panel from "$lib/sidebar/Panel.svelte";
|
||||||
import Sidebar from "$lib/sidebar/Sidebar.svelte";
|
import Sidebar from "$lib/sidebar/Sidebar.svelte";
|
||||||
|
import { IndexDBCache, RemoteNodeRegistry } from "@nodarium/registry";
|
||||||
|
import { type NodeId, type NodeInstance } from "@nodarium/types";
|
||||||
|
import Code from "./Code.svelte";
|
||||||
|
import Grid from "$lib/grid";
|
||||||
|
import {
|
||||||
|
concatEncodedArrays,
|
||||||
|
createWasmWrapper,
|
||||||
|
encodeNestedArray,
|
||||||
|
} from "@nodarium/utils";
|
||||||
|
|
||||||
|
const registryCache = new IndexDBCache("node-registry");
|
||||||
|
const nodeRegistry = new RemoteNodeRegistry("", registryCache);
|
||||||
|
|
||||||
|
let activeNode = localState<NodeId | undefined>(
|
||||||
|
"node.dev.activeNode",
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
|
||||||
|
let nodeWasm = $state<ArrayBuffer>();
|
||||||
|
let nodeInstance = $state<NodeInstance>();
|
||||||
|
let nodeWasmWrapper = $state<ReturnType<typeof createWasmWrapper>>();
|
||||||
|
|
||||||
|
async function fetchNodeData(nodeId?: NodeId) {
|
||||||
|
console.log("FETCHING", { nodeId });
|
||||||
|
nodeWasm = undefined;
|
||||||
|
nodeInstance = undefined;
|
||||||
|
|
||||||
|
if (!nodeId) return;
|
||||||
|
|
||||||
|
const data = await nodeRegistry.fetchNodeDefinition(nodeId);
|
||||||
|
nodeWasm = await nodeRegistry.fetchArrayBuffer("nodes/" + nodeId + ".wasm");
|
||||||
|
nodeInstance = {
|
||||||
|
id: 0,
|
||||||
|
type: nodeId,
|
||||||
|
position: [0, 0] as [number, number],
|
||||||
|
props: {},
|
||||||
|
state: {
|
||||||
|
type: data,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
nodeWasmWrapper = createWasmWrapper(nodeWasm);
|
||||||
|
}
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
fetchNodeData(activeNode.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (nodeInstance?.props && nodeWasmWrapper) {
|
||||||
|
const keys = Object.keys(nodeInstance.state.type?.inputs || {});
|
||||||
|
let ins = Object.values(nodeInstance.props) as number[];
|
||||||
|
if (keys[0] === "plant") {
|
||||||
|
ins = [[0, 0, 0, 0, 0, 0, 0, 0], ...ins];
|
||||||
|
}
|
||||||
|
const inputs = concatEncodedArrays(encodeNestedArray(ins));
|
||||||
|
nodeWasmWrapper?.execute(inputs);
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div class="node-wrapper absolute bottom-8 left-8">
|
||||||
|
{#if nodeInstance}
|
||||||
|
<NodeHTML inView position="relative" z={5} bind:node={nodeInstance} />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<Grid.Row>
|
<Grid.Row>
|
||||||
<Grid.Cell></Grid.Cell>
|
|
||||||
<Grid.Cell>
|
<Grid.Cell>
|
||||||
<Sidebar>
|
<pre>
|
||||||
|
<code>
|
||||||
|
{JSON.stringify(nodeInstance?.props)}
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
</Grid.Cell>
|
||||||
|
|
||||||
|
<Grid.Cell>
|
||||||
|
<div class="h-screen w-[80vw] overflow-y-auto">
|
||||||
|
{#if nodeWasm}
|
||||||
|
<Code wasm={nodeWasm} />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</Grid.Cell>
|
||||||
|
</Grid.Row>
|
||||||
|
|
||||||
|
<Sidebar>
|
||||||
<Panel
|
<Panel
|
||||||
id="node-store"
|
id="node-store"
|
||||||
classes="text-green-400"
|
classes="text-green-400"
|
||||||
title="Node Store"
|
title="Node Store"
|
||||||
icon="i-tabler-database"
|
icon="i-[tabler--database]"
|
||||||
></Panel>
|
>
|
||||||
</Sidebar>
|
<div class="p-4 flex flex-col gap-2">
|
||||||
</Grid.Cell>
|
{#await nodeRegistry.fetchCollection("max/plantarium")}
|
||||||
</Grid.Row>
|
<p>Loading Nodes...</p>
|
||||||
|
{:then result}
|
||||||
|
{#each result.nodes as n}
|
||||||
|
<button
|
||||||
|
class="cursor-pointer p-2 bg-layer-1 {activeNode.value === n.id
|
||||||
|
? 'outline outline-offset-1'
|
||||||
|
: ''}"
|
||||||
|
onclick={() => (activeNode.value = n.id)}>{n.id}</button
|
||||||
|
>
|
||||||
|
{/each}
|
||||||
|
{/await}
|
||||||
|
</div>
|
||||||
|
</Panel>
|
||||||
|
</Sidebar>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
:global body {
|
:global body {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
26
app/src/routes/dev/Code.svelte
Normal file
26
app/src/routes/dev/Code.svelte
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import wabtInit from "wabt";
|
||||||
|
|
||||||
|
const { wasm } = $props<{ wasm: ArrayBuffer }>();
|
||||||
|
|
||||||
|
async function toWat(arrayBuffer: ArrayBuffer) {
|
||||||
|
const wabt = await wabtInit();
|
||||||
|
|
||||||
|
const module = wabt.readWasm(new Uint8Array(arrayBuffer), {
|
||||||
|
readDebugNames: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
module.generateNames();
|
||||||
|
module.applyNames();
|
||||||
|
|
||||||
|
return module.toText({ foldExprs: false, inlineExport: false });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#await toWat(wasm)}
|
||||||
|
<p>Converting to WAT</p>
|
||||||
|
{:then c}
|
||||||
|
<pre>
|
||||||
|
<code class="text-gray-50">{c}</code>
|
||||||
|
</pre>
|
||||||
|
{/await}
|
||||||
@@ -14,6 +14,9 @@ export const entries: EntryGenerator = async () => {
|
|||||||
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async function GET({ params }) {
|
export const GET: RequestHandler = async function GET({ params }) {
|
||||||
|
|
||||||
const namespaces = await registry.getUser(params.user)
|
const namespaces = await registry.getUser(params.user)
|
||||||
|
|
||||||
return json(namespaces);
|
return json(namespaces);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ export const entries: EntryGenerator = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async function GET({ params }) {
|
export const GET: RequestHandler = async function GET({ params }) {
|
||||||
|
|
||||||
const namespaces = await registry.getCollection(`${params.user}/${params.collection}`);
|
const namespaces = await registry.getCollection(`${params.user}/${params.collection}`);
|
||||||
|
|
||||||
return json(namespaces);
|
return json(namespaces);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import * as registry from "$lib/node-registry";
|
|||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
|
|
||||||
export const entries: EntryGenerator = async () => {
|
export const entries: EntryGenerator = async () => {
|
||||||
const users = await registry.getUsers();
|
const users = await registry.getUsers();
|
||||||
return users.map(user => {
|
return users.map(user => {
|
||||||
@@ -17,7 +18,9 @@ export const entries: EntryGenerator = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GET: RequestHandler = async function GET({ params }) {
|
export const GET: RequestHandler = async function GET({ params }) {
|
||||||
|
|
||||||
const nodeId = `${params.user}/${params.collection}/${params.node}` as const;
|
const nodeId = `${params.user}/${params.collection}/${params.node}` as const;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const node = await getNode(nodeId);
|
const node = await getNode(nodeId);
|
||||||
return json(node);
|
return json(node);
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import * as registry from "$lib/node-registry";
|
|||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export const GET: RequestHandler = async function GET() {
|
export const GET: RequestHandler = async function GET() {
|
||||||
|
|
||||||
const users = await registry.getUsers();
|
const users = await registry.getUsers();
|
||||||
|
|
||||||
return json(users);
|
return json(users);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
// uno.config.ts
|
|
||||||
import { defineConfig } from 'unocss'
|
|
||||||
import presetIcons from '@unocss/preset-icons'
|
|
||||||
import fs from 'node:fs'
|
|
||||||
|
|
||||||
const icons = Object.fromEntries(fs.readdirSync('./src/lib/icons')
|
|
||||||
.map(name => [name.replace(".svg", ""), fs.readFileSync(`./src/lib/icons/${name}`, 'utf-8')]))
|
|
||||||
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
presets: [
|
|
||||||
presetIcons({
|
|
||||||
collections: {
|
|
||||||
custom: icons
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
})
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
import UnoCSS from 'unocss/vite';
|
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
import comlink from 'vite-plugin-comlink';
|
import comlink from 'vite-plugin-comlink';
|
||||||
import glsl from "vite-plugin-glsl";
|
import glsl from "vite-plugin-glsl";
|
||||||
import wasm from "vite-plugin-wasm";
|
import wasm from "vite-plugin-wasm";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
tailwindcss(),
|
||||||
comlink(),
|
comlink(),
|
||||||
UnoCSS(),
|
|
||||||
sveltekit(),
|
sveltekit(),
|
||||||
glsl(),
|
glsl(),
|
||||||
wasm()
|
wasm()
|
||||||
|
|||||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1768564909,
|
||||||
|
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
40
flake.nix
Normal file
40
flake.nix
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {nixpkgs, ...}: let
|
||||||
|
systems = ["aarch64-darwin" "x86_64-linux"];
|
||||||
|
eachSystem = function:
|
||||||
|
nixpkgs.lib.genAttrs systems (system:
|
||||||
|
function {
|
||||||
|
inherit system;
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
devShells = eachSystem ({pkgs, ...}: {
|
||||||
|
default = pkgs.mkShellNoCC {
|
||||||
|
packages = [
|
||||||
|
# general deps
|
||||||
|
pkgs.nodejs_24
|
||||||
|
pkgs.pnpm_10
|
||||||
|
|
||||||
|
# wasm/rust stuff
|
||||||
|
pkgs.rustc
|
||||||
|
pkgs.cargo
|
||||||
|
pkgs.rust-analyzer
|
||||||
|
pkgs.rustfmt
|
||||||
|
pkgs.wasm-bindgen-cli
|
||||||
|
pkgs.wasm-pack
|
||||||
|
pkgs.lld
|
||||||
|
|
||||||
|
# frontend
|
||||||
|
pkgs.vscode-langservers-extracted
|
||||||
|
pkgs.typescript-language-server
|
||||||
|
pkgs.prettier
|
||||||
|
pkgs.tailwindcss-language-server
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -11,18 +11,8 @@ crate-type = ["cdylib", "rlib"]
|
|||||||
default = ["console_error_panic_hook"]
|
default = ["console_error_panic_hook"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
console_error_panic_hook = { version = "0.1.7", optional = true }
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
web-sys = { version = "0.3.69", features = ["console"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/out.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,22 +7,6 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/box.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
concat_args, encode_float, evaluate_float, geometry::calculate_normals, log, set_panic_hook,
|
encode_float, evaluate_float, geometry::calculate_normals,log,
|
||||||
split_args, wrap_arg,
|
split_args, wrap_arg,
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[nodarium_execute]
|
||||||
#[wasm_bindgen]
|
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
|
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
|
|
||||||
log!("WASM(cube): input: {:?} -> {:?}", input, args);
|
log!("WASM(cube): input: {:?} -> {:?}", input, args);
|
||||||
@@ -22,7 +19,6 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
|||||||
let p = encode_float(size);
|
let p = encode_float(size);
|
||||||
let n = encode_float(-size);
|
let n = encode_float(-size);
|
||||||
|
|
||||||
|
|
||||||
// [[1,3, x, y, z, x, y,z,x,y,z]];
|
// [[1,3, x, y, z, x, y,z,x,y,z]];
|
||||||
let mut cube_geometry = [
|
let mut cube_geometry = [
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,23 +7,6 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
glam = "0.27.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/branch.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
concat_arg_vecs, evaluate_float, evaluate_int,
|
concat_arg_vecs, evaluate_float, evaluate_int,
|
||||||
geometry::{
|
geometry::{
|
||||||
create_path, interpolate_along_path, rotate_vector_by_angle, wrap_path, wrap_path_mut,
|
create_path, interpolate_along_path, rotate_vector_by_angle, wrap_path, wrap_path_mut,
|
||||||
},
|
},
|
||||||
log, set_panic_hook, split_args,
|
log, split_args,
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
|
|
||||||
let paths = split_args(args[0]);
|
let paths = split_args(args[0]);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,21 +7,6 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/float.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
use wasm_bindgen::prelude::*;
|
use nodarium_macros::nodarium_execute;
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(args: &[i32]) -> Vec<i32> {
|
pub fn execute(args: &[i32]) -> Vec<i32> {
|
||||||
args.into()
|
args.into()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,24 +7,7 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
glam = "0.30.10"
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
noise = "0.9.0"
|
|
||||||
glam = "0.27.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/gravity.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
use glam::Vec3;
|
use glam::Vec3;
|
||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
concat_args, evaluate_float, evaluate_int,
|
concat_args, evaluate_float, evaluate_int,
|
||||||
geometry::{wrap_path, wrap_path_mut},
|
geometry::{wrap_path, wrap_path_mut},
|
||||||
log, reset_call_count, set_panic_hook, split_args,
|
log, reset_call_count, split_args,
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
fn lerp_vec3(a: Vec3, b: Vec3, t: f32) -> Vec3 {
|
fn lerp_vec3(a: Vec3, b: Vec3, t: f32) -> Vec3 {
|
||||||
a + (b - a) * t
|
a + (b - a) * t
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
reset_call_count();
|
reset_call_count();
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nodarium_instance"
|
name = "instance"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Max Richter <jim-x@web.de>"]
|
authors = ["Max Richter <jim-x@web.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -7,23 +7,7 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
glam = "0.30.10"
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
glam = "0.27.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/instance.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
use glam::{Mat4, Quat, Vec3};
|
use glam::{Mat4, Quat, Vec3};
|
||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_execute;
|
||||||
|
use nodarium_macros::nodarium_definition_file;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
concat_args, encode_float, evaluate_float, evaluate_int,
|
concat_args, evaluate_float, evaluate_int,
|
||||||
geometry::{
|
geometry::{
|
||||||
calculate_normals, create_instance_data, wrap_geometry_data, wrap_instance_data, wrap_path,
|
create_instance_data, wrap_geometry_data, wrap_instance_data, wrap_path,
|
||||||
},
|
},
|
||||||
log, set_panic_hook, split_args, wrap_arg,
|
log, split_args,
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
let mut inputs = split_args(args[0]);
|
let mut inputs = split_args(args[0]);
|
||||||
log!("WASM(instance): inputs: {:?}", inputs);
|
log!("WASM(instance): inputs: {:?}", inputs);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,17 +7,6 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/math.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
use nodarium_utils::{concat_args, set_panic_hook, split_args};
|
use nodarium_macros::nodarium_execute;
|
||||||
use wasm_bindgen::prelude::*;
|
use nodarium_utils::{
|
||||||
|
concat_args, split_args
|
||||||
|
};
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
#[nodarium_execute]
|
||||||
|
|
||||||
#[wasm_bindgen]
|
|
||||||
pub fn execute(args: &[i32]) -> Vec<i32> {
|
pub fn execute(args: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
let args = split_args(args);
|
let args = split_args(args);
|
||||||
concat_args(vec![&[0], args[0], args[1], args[2]])
|
concat_args(vec![&[0], args[0], args[1], args[2]])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nodes-noise"
|
name = "noise"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Max Richter <jim-x@web.de>"]
|
authors = ["Max Richter <jim-x@web.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -7,24 +7,8 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
noise = "0.9.0"
|
noise = "0.9.0"
|
||||||
glam = "0.27.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/noise.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
concat_args, evaluate_float, evaluate_int, evaluate_vec3, geometry::wrap_path_mut, log,
|
concat_args, evaluate_float, evaluate_int, evaluate_vec3, geometry::wrap_path_mut,
|
||||||
reset_call_count, set_panic_hook, split_args,
|
reset_call_count, split_args,
|
||||||
};
|
};
|
||||||
use noise::{HybridMulti, MultiFractal, NoiseFn, OpenSimplex};
|
use noise::{HybridMulti, MultiFractal, NoiseFn, OpenSimplex};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
fn lerp(a: f32, b: f32, t: f32) -> f32 {
|
fn lerp(a: f32, b: f32, t: f32) -> f32 {
|
||||||
a + t * (b - a)
|
a + t * (b - a)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
reset_call_count();
|
reset_call_count();
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,24 +7,6 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
console_error_panic_hook = ["dep:console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
glam = "0.27.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/output.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
concat_args, evaluate_int,
|
concat_args, evaluate_int,
|
||||||
geometry::{extrude_path, wrap_path},
|
geometry::{extrude_path, wrap_path},
|
||||||
log, set_panic_hook, split_args,
|
log, split_args,
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/inputs.json");
|
nodarium_definition_file!("src/inputs.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
log!("WASM(output): input: {:?}", input);
|
log!("WASM(output): input: {:?}", input);
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,21 +7,7 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/random.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
use nodarium_utils::{concat_args, set_panic_hook, split_args};
|
use nodarium_macros::nodarium_execute;
|
||||||
use wasm_bindgen::prelude::*;
|
use nodarium_utils::{concat_args, split_args};
|
||||||
|
|
||||||
include_definition_file!("src/definition.json");
|
nodarium_definition_file!("src/definition.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(args: &[i32]) -> Vec<i32> {
|
pub fn execute(args: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
let args = split_args(args);
|
let args = split_args(args);
|
||||||
concat_args(vec![&[1], args[0], args[1], args[2]])
|
concat_args(vec![&[1], args[0], args[1], args[2]])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,23 +7,8 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde-wasm-bindgen = "0.4"
|
glam = "0.30.10"
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
glam = "0.27.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/rotate.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
use glam::{Mat4, Vec3};
|
use glam::{Mat4, Vec3};
|
||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
concat_args, evaluate_float, evaluate_int, geometry::wrap_path_mut, log, set_panic_hook,
|
concat_args, evaluate_float, evaluate_int, geometry::wrap_path_mut, log,
|
||||||
split_args,
|
split_args,
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
log!("DEBUG args: {:?}", input);
|
log!("DEBUG args: {:?}", input);
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -7,23 +7,6 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.release.wasm-bindgen]
|
|
||||||
debug-js-glue = true
|
|
||||||
demangle-name-section = true
|
|
||||||
dwarf-debug-info = false
|
|
||||||
omit-default-module-path = true
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/stem.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
evaluate_float, evaluate_int, evaluate_vec3,
|
evaluate_float, evaluate_int, evaluate_vec3,
|
||||||
geometry::{create_multiple_paths, wrap_multiple_paths},
|
geometry::{create_multiple_paths, wrap_multiple_paths},
|
||||||
log, reset_call_count, set_panic_hook, split_args,
|
log, reset_call_count, split_args,
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
reset_call_count();
|
reset_call_count();
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "max-plantarium-triangle"
|
name = "triangle"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Max Richter <jim-x@web.de>"]
|
authors = ["Max Richter <jim-x@web.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -7,22 +7,6 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/triangle.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{
|
use nodarium_utils::{
|
||||||
decode_float, encode_float, evaluate_int, set_panic_hook, split_args, wrap_arg,
|
decode_float, encode_float, evaluate_int, split_args, wrap_arg, log
|
||||||
};
|
};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
use web_sys::console;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[nodarium_execute]
|
||||||
#[wasm_bindgen]
|
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
|
|
||||||
set_panic_hook();
|
|
||||||
|
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
|
|
||||||
let size = evaluate_int(args[0]);
|
let size = evaluate_int(args[0]);
|
||||||
let decoded = decode_float(size);
|
let decoded = decode_float(size);
|
||||||
let negative_size = encode_float(-decoded);
|
let negative_size = encode_float(-decoded);
|
||||||
|
|
||||||
console::log_1(&format!("WASM(triangle): input: {:?} -> {}", args[0],decoded).into());
|
log!("WASM(triangle): input: {:?} -> {}", args[0],decoded);
|
||||||
|
|
||||||
// [[1,3, x, y, z, x, y,z,x,y,z]];
|
// [[1,3, x, y, z, x, y,z,x,y,z]];
|
||||||
wrap_arg(&[
|
wrap_arg(&[
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "max-plantarium-vec3"
|
name = "vec3"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Max Richter <jim-x@web.de>"]
|
authors = ["Max Richter <jim-x@web.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@@ -7,22 +7,8 @@ edition = "2018"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["console_error_panic_hook"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.84"
|
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
|
||||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
|
||||||
# code size when deploying.
|
|
||||||
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
nodarium_utils = { version = "0.1.0", path = "../../../../packages/utils" }
|
||||||
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
nodarium_macros = { version = "0.1.0", path = "../../../../packages/macros" }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde-wasm-bindgen = "0.4"
|
|
||||||
console_error_panic_hook = { version = "0.1.7", optional = true }
|
|
||||||
web-sys = { version = "0.3.69", features = ["console"] }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wasm-bindgen-test = "0.3.34"
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
"build": "cargo build --target wasm32-unknown-unknown --release && mkdir -p pkg && cp ../../../../target/wasm32-unknown-unknown/release/vec3.wasm ./pkg/node.wasm",
|
||||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use nodarium_macros::include_definition_file;
|
use nodarium_macros::nodarium_definition_file;
|
||||||
|
use nodarium_macros::nodarium_execute;
|
||||||
use nodarium_utils::{concat_args, log, split_args};
|
use nodarium_utils::{concat_args, log, split_args};
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
|
|
||||||
include_definition_file!("src/input.json");
|
nodarium_definition_file!("src/input.json");
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[nodarium_execute]
|
||||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||||
let args = split_args(input);
|
let args = split_args(input);
|
||||||
log!("vec3 input: {:?}", input);
|
log!("vec3 input: {:?}", input);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
//! Test suite for the Web and headless browsers.
|
|
||||||
|
|
||||||
#![cfg(target_arch = "wasm32")]
|
|
||||||
|
|
||||||
extern crate wasm_bindgen_test;
|
|
||||||
use wasm_bindgen_test::*;
|
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
|
||||||
fn pass() {
|
|
||||||
assert_eq!(1 + 1, 2);
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,7 @@ repository = "https://github.com/jim-fx/nodes"
|
|||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
syn = { version = "1.0", features = ["full"] }
|
syn = { version = "2.0", features = ["full"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
|
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
|
|||||||
@@ -5,32 +5,7 @@ use quote::quote;
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use syn::{parse_macro_input, LitStr};
|
use syn::parse_macro_input;
|
||||||
|
|
||||||
#[proc_macro]
|
|
||||||
pub fn node_definition(input: TokenStream) -> TokenStream {
|
|
||||||
let input_string = parse_macro_input!(input as LitStr).value();
|
|
||||||
|
|
||||||
// Validate JSON format
|
|
||||||
let json: NodeDefinition = match serde_json::from_str(&input_string) {
|
|
||||||
Ok(json) => json,
|
|
||||||
Err(e) => panic!("Invalid JSON input: {}", e),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Convert the validated JSON back to a pretty-printed string
|
|
||||||
let formatted_json = serde_json::to_string_pretty(&json).expect("Failed to serialize JSON");
|
|
||||||
|
|
||||||
// Generate the output function
|
|
||||||
let expanded = quote! {
|
|
||||||
#[wasm_bindgen]
|
|
||||||
pub fn get_definition() -> String {
|
|
||||||
String::from(#formatted_json)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Convert the generated code back to a TokenStream
|
|
||||||
TokenStream::from(expanded)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_line_numbers(input: String) -> String {
|
fn add_line_numbers(input: String) -> String {
|
||||||
return input
|
return input
|
||||||
@@ -41,39 +16,120 @@ fn add_line_numbers(input: String) -> String {
|
|||||||
.join("\n");
|
.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[proc_macro]
|
#[proc_macro_attribute]
|
||||||
pub fn include_definition_file(input: TokenStream) -> TokenStream {
|
pub fn nodarium_execute(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
let file_path = syn::parse_macro_input!(input as syn::LitStr).value();
|
let input_fn = parse_macro_input!(item as syn::ItemFn);
|
||||||
|
let _fn_name = &input_fn.sig.ident;
|
||||||
|
let _fn_vis = &input_fn.vis;
|
||||||
|
let fn_body = &input_fn.block;
|
||||||
|
|
||||||
// Retrieve the directory containing the Cargo.toml file
|
let first_arg_ident = if let Some(syn::FnArg::Typed(pat_type)) = input_fn.sig.inputs.first() {
|
||||||
let project_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
if let syn::Pat::Ident(pat_ident) = &*pat_type.pat {
|
||||||
let full_path = Path::new(&project_dir).join(&file_path);
|
&pat_ident.ident
|
||||||
|
} else {
|
||||||
|
panic!("Expected a simple identifier for the first argument");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
panic!("The execute function must have at least one argument (the input slice)");
|
||||||
|
};
|
||||||
|
|
||||||
// Read the JSON file content
|
// We create a wrapper that handles the C ABI and pointer math
|
||||||
let json_content = fs::read_to_string(full_path).unwrap_or_else(|err| {
|
|
||||||
panic!(
|
|
||||||
"Failed to read JSON file at '{}/{}': {}",
|
|
||||||
project_dir, file_path, err
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Optionally, validate that the content is valid JSON
|
|
||||||
let _: NodeDefinition = serde_json::from_str(&json_content).unwrap_or_else(|err| {
|
|
||||||
panic!(
|
|
||||||
"JSON file contains invalid JSON: \n{} \n{}",
|
|
||||||
err,
|
|
||||||
add_line_numbers(json_content.clone())
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Generate the function that returns the JSON string
|
|
||||||
let expanded = quote! {
|
let expanded = quote! {
|
||||||
#[wasm_bindgen]
|
extern "C" {
|
||||||
pub fn get_definition() -> String {
|
fn host_log_panic(ptr: *const u8, len: usize);
|
||||||
String::from(#json_content)
|
fn host_log(ptr: *const u8, len: usize);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn setup_panic_hook() {
|
||||||
|
static SET_HOOK: std::sync::Once = std::sync::Once::new();
|
||||||
|
SET_HOOK.call_once(|| {
|
||||||
|
std::panic::set_hook(Box::new(|info| {
|
||||||
|
let msg = info.to_string();
|
||||||
|
unsafe { host_log_panic(msg.as_ptr(), msg.len()); }
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn __alloc(len: usize) -> *mut i32 {
|
||||||
|
let mut buf = Vec::with_capacity(len);
|
||||||
|
let ptr = buf.as_mut_ptr();
|
||||||
|
std::mem::forget(buf);
|
||||||
|
ptr
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn __free(ptr: *mut i32, len: usize) {
|
||||||
|
unsafe {
|
||||||
|
let _ = Vec::from_raw_parts(ptr, 0, len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static mut OUTPUT_BUFFER: Vec<i32> = Vec::new();
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn execute(ptr: *const i32, len: usize) -> *mut i32 {
|
||||||
|
setup_panic_hook();
|
||||||
|
// 1. Convert raw pointer to slice
|
||||||
|
let input = unsafe { core::slice::from_raw_parts(ptr, len) };
|
||||||
|
|
||||||
|
// 2. Call the logic (which we define below)
|
||||||
|
let result_data: Vec<i32> = internal_logic(input);
|
||||||
|
|
||||||
|
// 3. Use the static buffer for the result
|
||||||
|
let result_len = result_data.len();
|
||||||
|
unsafe {
|
||||||
|
OUTPUT_BUFFER.clear();
|
||||||
|
OUTPUT_BUFFER.reserve(result_len + 1);
|
||||||
|
OUTPUT_BUFFER.push(result_len as i32);
|
||||||
|
OUTPUT_BUFFER.extend(result_data);
|
||||||
|
|
||||||
|
OUTPUT_BUFFER.as_mut_ptr()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn internal_logic(#first_arg_ident: &[i32]) -> Vec<i32> {
|
||||||
|
#fn_body
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TokenStream::from(expanded)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[proc_macro]
|
||||||
|
pub fn nodarium_definition_file(input: TokenStream) -> TokenStream {
|
||||||
|
let path_lit = syn::parse_macro_input!(input as syn::LitStr);
|
||||||
|
let file_path = path_lit.value();
|
||||||
|
|
||||||
|
let project_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
|
let full_path = Path::new(&project_dir).join(&file_path);
|
||||||
|
|
||||||
|
let json_content = fs::read_to_string(&full_path).unwrap_or_else(|err| {
|
||||||
|
panic!("Failed to read JSON file at '{}/{}': {}", project_dir, file_path, err)
|
||||||
|
});
|
||||||
|
|
||||||
|
let _: NodeDefinition = serde_json::from_str(&json_content).unwrap_or_else(|err| {
|
||||||
|
panic!("JSON file contains invalid JSON: \n{} \n{}", err, add_line_numbers(json_content.clone()))
|
||||||
|
});
|
||||||
|
|
||||||
|
// We use the span from the input path literal
|
||||||
|
let bytes = syn::LitByteStr::new(json_content.as_bytes(), path_lit.span());
|
||||||
|
let len = json_content.len();
|
||||||
|
|
||||||
|
let expanded = quote! {
|
||||||
|
#[link_section = "nodarium_definition"]
|
||||||
|
static DEFINITION_DATA: [u8; #len] = *#bytes;
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn get_definition_ptr() -> *const u8 {
|
||||||
|
DEFINITION_DATA.as_ptr()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn get_definition_len() -> usize {
|
||||||
|
DEFINITION_DATA.len()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert the generated code back to a TokenStream
|
|
||||||
TokenStream::from(expanded)
|
TokenStream::from(expanded)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export class RemoteNodeRegistry implements NodeRegistry {
|
|||||||
status: "loading" | "ready" | "error" = "loading";
|
status: "loading" | "ready" | "error" = "loading";
|
||||||
private nodes: Map<string, NodeDefinition> = new Map();
|
private nodes: Map<string, NodeDefinition> = new Map();
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private url: string,
|
private url: string,
|
||||||
private cache?: AsyncCache<ArrayBuffer | string>,
|
private cache?: AsyncCache<ArrayBuffer | string>,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@hey-api/openapi-ts": "^0.90.4"
|
"@hey-api/openapi-ts": "^0.90.4"
|
||||||
}
|
}
|
||||||
|
|||||||
16
packages/store-client/src/client/client.gen.ts
Normal file
16
packages/store-client/src/client/client.gen.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
import { type ClientOptions, type Config, createClient, createConfig } from './client';
|
||||||
|
import type { ClientOptions as ClientOptions2 } from './types.gen';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `createClientConfig()` function will be called on client initialization
|
||||||
|
* and the returned object will become the client's initial configuration.
|
||||||
|
*
|
||||||
|
* You may want to initialize your client this way instead of calling
|
||||||
|
* `setConfig()`. This is useful for example if you're using Next.js
|
||||||
|
* to ensure your client always has the correct values.
|
||||||
|
*/
|
||||||
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
||||||
|
|
||||||
|
export const client = createClient(createConfig<ClientOptions2>());
|
||||||
311
packages/store-client/src/client/client/client.gen.ts
Normal file
311
packages/store-client/src/client/client/client.gen.ts
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
import { createSseClient } from '../core/serverSentEvents.gen';
|
||||||
|
import type { HttpMethod } from '../core/types.gen';
|
||||||
|
import { getValidRequestBody } from '../core/utils.gen';
|
||||||
|
import type {
|
||||||
|
Client,
|
||||||
|
Config,
|
||||||
|
RequestOptions,
|
||||||
|
ResolvedRequestOptions,
|
||||||
|
} from './types.gen';
|
||||||
|
import {
|
||||||
|
buildUrl,
|
||||||
|
createConfig,
|
||||||
|
createInterceptors,
|
||||||
|
getParseAs,
|
||||||
|
mergeConfigs,
|
||||||
|
mergeHeaders,
|
||||||
|
setAuthParams,
|
||||||
|
} from './utils.gen';
|
||||||
|
|
||||||
|
type ReqInit = Omit<RequestInit, 'body' | 'headers'> & {
|
||||||
|
body?: any;
|
||||||
|
headers: ReturnType<typeof mergeHeaders>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createClient = (config: Config = {}): Client => {
|
||||||
|
let _config = mergeConfigs(createConfig(), config);
|
||||||
|
|
||||||
|
const getConfig = (): Config => ({ ..._config });
|
||||||
|
|
||||||
|
const setConfig = (config: Config): Config => {
|
||||||
|
_config = mergeConfigs(_config, config);
|
||||||
|
return getConfig();
|
||||||
|
};
|
||||||
|
|
||||||
|
const interceptors = createInterceptors<
|
||||||
|
Request,
|
||||||
|
Response,
|
||||||
|
unknown,
|
||||||
|
ResolvedRequestOptions
|
||||||
|
>();
|
||||||
|
|
||||||
|
const beforeRequest = async (options: RequestOptions) => {
|
||||||
|
const opts = {
|
||||||
|
..._config,
|
||||||
|
...options,
|
||||||
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
||||||
|
headers: mergeHeaders(_config.headers, options.headers),
|
||||||
|
serializedBody: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (opts.security) {
|
||||||
|
await setAuthParams({
|
||||||
|
...opts,
|
||||||
|
security: opts.security,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.requestValidator) {
|
||||||
|
await opts.requestValidator(opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.body !== undefined && opts.bodySerializer) {
|
||||||
|
opts.serializedBody = opts.bodySerializer(opts.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
||||||
|
if (opts.body === undefined || opts.serializedBody === '') {
|
||||||
|
opts.headers.delete('Content-Type');
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = buildUrl(opts);
|
||||||
|
|
||||||
|
return { opts, url };
|
||||||
|
};
|
||||||
|
|
||||||
|
const request: Client['request'] = async (options) => {
|
||||||
|
// @ts-expect-error
|
||||||
|
const { opts, url } = await beforeRequest(options);
|
||||||
|
const requestInit: ReqInit = {
|
||||||
|
redirect: 'follow',
|
||||||
|
...opts,
|
||||||
|
body: getValidRequestBody(opts),
|
||||||
|
};
|
||||||
|
|
||||||
|
let request = new Request(url, requestInit);
|
||||||
|
|
||||||
|
for (const fn of interceptors.request.fns) {
|
||||||
|
if (fn) {
|
||||||
|
request = await fn(request, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch must be assigned here, otherwise it would throw the error:
|
||||||
|
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
||||||
|
const _fetch = opts.fetch!;
|
||||||
|
let response: Response;
|
||||||
|
|
||||||
|
try {
|
||||||
|
response = await _fetch(request);
|
||||||
|
} catch (error) {
|
||||||
|
// Handle fetch exceptions (AbortError, network errors, etc.)
|
||||||
|
let finalError = error;
|
||||||
|
|
||||||
|
for (const fn of interceptors.error.fns) {
|
||||||
|
if (fn) {
|
||||||
|
finalError = (await fn(
|
||||||
|
error,
|
||||||
|
undefined as any,
|
||||||
|
request,
|
||||||
|
opts,
|
||||||
|
)) as unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finalError = finalError || ({} as unknown);
|
||||||
|
|
||||||
|
if (opts.throwOnError) {
|
||||||
|
throw finalError;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return error response
|
||||||
|
return opts.responseStyle === 'data'
|
||||||
|
? undefined
|
||||||
|
: {
|
||||||
|
error: finalError,
|
||||||
|
request,
|
||||||
|
response: undefined as any,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const fn of interceptors.response.fns) {
|
||||||
|
if (fn) {
|
||||||
|
response = await fn(response, request, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = {
|
||||||
|
request,
|
||||||
|
response,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const parseAs =
|
||||||
|
(opts.parseAs === 'auto'
|
||||||
|
? getParseAs(response.headers.get('Content-Type'))
|
||||||
|
: opts.parseAs) ?? 'json';
|
||||||
|
|
||||||
|
if (
|
||||||
|
response.status === 204 ||
|
||||||
|
response.headers.get('Content-Length') === '0'
|
||||||
|
) {
|
||||||
|
let emptyData: any;
|
||||||
|
switch (parseAs) {
|
||||||
|
case 'arrayBuffer':
|
||||||
|
case 'blob':
|
||||||
|
case 'text':
|
||||||
|
emptyData = await response[parseAs]();
|
||||||
|
break;
|
||||||
|
case 'formData':
|
||||||
|
emptyData = new FormData();
|
||||||
|
break;
|
||||||
|
case 'stream':
|
||||||
|
emptyData = response.body;
|
||||||
|
break;
|
||||||
|
case 'json':
|
||||||
|
default:
|
||||||
|
emptyData = {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return opts.responseStyle === 'data'
|
||||||
|
? emptyData
|
||||||
|
: {
|
||||||
|
data: emptyData,
|
||||||
|
...result,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let data: any;
|
||||||
|
switch (parseAs) {
|
||||||
|
case 'arrayBuffer':
|
||||||
|
case 'blob':
|
||||||
|
case 'formData':
|
||||||
|
case 'text':
|
||||||
|
data = await response[parseAs]();
|
||||||
|
break;
|
||||||
|
case 'json': {
|
||||||
|
// Some servers return 200 with no Content-Length and empty body.
|
||||||
|
// response.json() would throw; read as text and parse if non-empty.
|
||||||
|
const text = await response.text();
|
||||||
|
data = text ? JSON.parse(text) : {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'stream':
|
||||||
|
return opts.responseStyle === 'data'
|
||||||
|
? response.body
|
||||||
|
: {
|
||||||
|
data: response.body,
|
||||||
|
...result,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parseAs === 'json') {
|
||||||
|
if (opts.responseValidator) {
|
||||||
|
await opts.responseValidator(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.responseTransformer) {
|
||||||
|
data = await opts.responseTransformer(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return opts.responseStyle === 'data'
|
||||||
|
? data
|
||||||
|
: {
|
||||||
|
data,
|
||||||
|
...result,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const textError = await response.text();
|
||||||
|
let jsonError: unknown;
|
||||||
|
|
||||||
|
try {
|
||||||
|
jsonError = JSON.parse(textError);
|
||||||
|
} catch {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
const error = jsonError ?? textError;
|
||||||
|
let finalError = error;
|
||||||
|
|
||||||
|
for (const fn of interceptors.error.fns) {
|
||||||
|
if (fn) {
|
||||||
|
finalError = (await fn(error, response, request, opts)) as string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finalError = finalError || ({} as string);
|
||||||
|
|
||||||
|
if (opts.throwOnError) {
|
||||||
|
throw finalError;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: we probably want to return error and improve types
|
||||||
|
return opts.responseStyle === 'data'
|
||||||
|
? undefined
|
||||||
|
: {
|
||||||
|
error: finalError,
|
||||||
|
...result,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const makeMethodFn =
|
||||||
|
(method: Uppercase<HttpMethod>) => (options: RequestOptions) =>
|
||||||
|
request({ ...options, method });
|
||||||
|
|
||||||
|
const makeSseFn =
|
||||||
|
(method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {
|
||||||
|
const { opts, url } = await beforeRequest(options);
|
||||||
|
return createSseClient({
|
||||||
|
...opts,
|
||||||
|
body: opts.body as BodyInit | null | undefined,
|
||||||
|
headers: opts.headers as unknown as Record<string, string>,
|
||||||
|
method,
|
||||||
|
onRequest: async (url, init) => {
|
||||||
|
let request = new Request(url, init);
|
||||||
|
for (const fn of interceptors.request.fns) {
|
||||||
|
if (fn) {
|
||||||
|
request = await fn(request, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return request;
|
||||||
|
},
|
||||||
|
serializedBody: getValidRequestBody(opts) as
|
||||||
|
| BodyInit
|
||||||
|
| null
|
||||||
|
| undefined,
|
||||||
|
url,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
buildUrl,
|
||||||
|
connect: makeMethodFn('CONNECT'),
|
||||||
|
delete: makeMethodFn('DELETE'),
|
||||||
|
get: makeMethodFn('GET'),
|
||||||
|
getConfig,
|
||||||
|
head: makeMethodFn('HEAD'),
|
||||||
|
interceptors,
|
||||||
|
options: makeMethodFn('OPTIONS'),
|
||||||
|
patch: makeMethodFn('PATCH'),
|
||||||
|
post: makeMethodFn('POST'),
|
||||||
|
put: makeMethodFn('PUT'),
|
||||||
|
request,
|
||||||
|
setConfig,
|
||||||
|
sse: {
|
||||||
|
connect: makeSseFn('CONNECT'),
|
||||||
|
delete: makeSseFn('DELETE'),
|
||||||
|
get: makeSseFn('GET'),
|
||||||
|
head: makeSseFn('HEAD'),
|
||||||
|
options: makeSseFn('OPTIONS'),
|
||||||
|
patch: makeSseFn('PATCH'),
|
||||||
|
post: makeSseFn('POST'),
|
||||||
|
put: makeSseFn('PUT'),
|
||||||
|
trace: makeSseFn('TRACE'),
|
||||||
|
},
|
||||||
|
trace: makeMethodFn('TRACE'),
|
||||||
|
} as Client;
|
||||||
|
};
|
||||||
25
packages/store-client/src/client/client/index.ts
Normal file
25
packages/store-client/src/client/client/index.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
export type { Auth } from '../core/auth.gen';
|
||||||
|
export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
||||||
|
export {
|
||||||
|
formDataBodySerializer,
|
||||||
|
jsonBodySerializer,
|
||||||
|
urlSearchParamsBodySerializer,
|
||||||
|
} from '../core/bodySerializer.gen';
|
||||||
|
export { buildClientParams } from '../core/params.gen';
|
||||||
|
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
||||||
|
export { createClient } from './client.gen';
|
||||||
|
export type {
|
||||||
|
Client,
|
||||||
|
ClientOptions,
|
||||||
|
Config,
|
||||||
|
CreateClientConfig,
|
||||||
|
Options,
|
||||||
|
RequestOptions,
|
||||||
|
RequestResult,
|
||||||
|
ResolvedRequestOptions,
|
||||||
|
ResponseStyle,
|
||||||
|
TDataShape,
|
||||||
|
} from './types.gen';
|
||||||
|
export { createConfig, mergeHeaders } from './utils.gen';
|
||||||
241
packages/store-client/src/client/client/types.gen.ts
Normal file
241
packages/store-client/src/client/client/types.gen.ts
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
import type { Auth } from '../core/auth.gen';
|
||||||
|
import type {
|
||||||
|
ServerSentEventsOptions,
|
||||||
|
ServerSentEventsResult,
|
||||||
|
} from '../core/serverSentEvents.gen';
|
||||||
|
import type {
|
||||||
|
Client as CoreClient,
|
||||||
|
Config as CoreConfig,
|
||||||
|
} from '../core/types.gen';
|
||||||
|
import type { Middleware } from './utils.gen';
|
||||||
|
|
||||||
|
export type ResponseStyle = 'data' | 'fields';
|
||||||
|
|
||||||
|
export interface Config<T extends ClientOptions = ClientOptions>
|
||||||
|
extends Omit<RequestInit, 'body' | 'headers' | 'method'>,
|
||||||
|
CoreConfig {
|
||||||
|
/**
|
||||||
|
* Base URL for all requests made by this client.
|
||||||
|
*/
|
||||||
|
baseUrl?: T['baseUrl'];
|
||||||
|
/**
|
||||||
|
* Fetch API implementation. You can use this option to provide a custom
|
||||||
|
* fetch instance.
|
||||||
|
*
|
||||||
|
* @default globalThis.fetch
|
||||||
|
*/
|
||||||
|
fetch?: typeof fetch;
|
||||||
|
/**
|
||||||
|
* Please don't use the Fetch client for Next.js applications. The `next`
|
||||||
|
* options won't have any effect.
|
||||||
|
*
|
||||||
|
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
||||||
|
*/
|
||||||
|
next?: never;
|
||||||
|
/**
|
||||||
|
* Return the response data parsed in a specified format. By default, `auto`
|
||||||
|
* will infer the appropriate method from the `Content-Type` response header.
|
||||||
|
* You can override this behavior with any of the {@link Body} methods.
|
||||||
|
* Select `stream` if you don't want to parse response data at all.
|
||||||
|
*
|
||||||
|
* @default 'auto'
|
||||||
|
*/
|
||||||
|
parseAs?:
|
||||||
|
| 'arrayBuffer'
|
||||||
|
| 'auto'
|
||||||
|
| 'blob'
|
||||||
|
| 'formData'
|
||||||
|
| 'json'
|
||||||
|
| 'stream'
|
||||||
|
| 'text';
|
||||||
|
/**
|
||||||
|
* Should we return only data or multiple fields (data, error, response, etc.)?
|
||||||
|
*
|
||||||
|
* @default 'fields'
|
||||||
|
*/
|
||||||
|
responseStyle?: ResponseStyle;
|
||||||
|
/**
|
||||||
|
* Throw an error instead of returning it in the response?
|
||||||
|
*
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
throwOnError?: T['throwOnError'];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RequestOptions<
|
||||||
|
TData = unknown,
|
||||||
|
TResponseStyle extends ResponseStyle = 'fields',
|
||||||
|
ThrowOnError extends boolean = boolean,
|
||||||
|
Url extends string = string,
|
||||||
|
> extends Config<{
|
||||||
|
responseStyle: TResponseStyle;
|
||||||
|
throwOnError: ThrowOnError;
|
||||||
|
}>,
|
||||||
|
Pick<
|
||||||
|
ServerSentEventsOptions<TData>,
|
||||||
|
| 'onSseError'
|
||||||
|
| 'onSseEvent'
|
||||||
|
| 'sseDefaultRetryDelay'
|
||||||
|
| 'sseMaxRetryAttempts'
|
||||||
|
| 'sseMaxRetryDelay'
|
||||||
|
> {
|
||||||
|
/**
|
||||||
|
* Any body that you want to add to your request.
|
||||||
|
*
|
||||||
|
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
||||||
|
*/
|
||||||
|
body?: unknown;
|
||||||
|
path?: Record<string, unknown>;
|
||||||
|
query?: Record<string, unknown>;
|
||||||
|
/**
|
||||||
|
* Security mechanism(s) to use for the request.
|
||||||
|
*/
|
||||||
|
security?: ReadonlyArray<Auth>;
|
||||||
|
url: Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResolvedRequestOptions<
|
||||||
|
TResponseStyle extends ResponseStyle = 'fields',
|
||||||
|
ThrowOnError extends boolean = boolean,
|
||||||
|
Url extends string = string,
|
||||||
|
> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
||||||
|
serializedBody?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RequestResult<
|
||||||
|
TData = unknown,
|
||||||
|
TError = unknown,
|
||||||
|
ThrowOnError extends boolean = boolean,
|
||||||
|
TResponseStyle extends ResponseStyle = 'fields',
|
||||||
|
> = ThrowOnError extends true
|
||||||
|
? Promise<
|
||||||
|
TResponseStyle extends 'data'
|
||||||
|
? TData extends Record<string, unknown>
|
||||||
|
? TData[keyof TData]
|
||||||
|
: TData
|
||||||
|
: {
|
||||||
|
data: TData extends Record<string, unknown>
|
||||||
|
? TData[keyof TData]
|
||||||
|
: TData;
|
||||||
|
request: Request;
|
||||||
|
response: Response;
|
||||||
|
}
|
||||||
|
>
|
||||||
|
: Promise<
|
||||||
|
TResponseStyle extends 'data'
|
||||||
|
?
|
||||||
|
| (TData extends Record<string, unknown>
|
||||||
|
? TData[keyof TData]
|
||||||
|
: TData)
|
||||||
|
| undefined
|
||||||
|
: (
|
||||||
|
| {
|
||||||
|
data: TData extends Record<string, unknown>
|
||||||
|
? TData[keyof TData]
|
||||||
|
: TData;
|
||||||
|
error: undefined;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
data: undefined;
|
||||||
|
error: TError extends Record<string, unknown>
|
||||||
|
? TError[keyof TError]
|
||||||
|
: TError;
|
||||||
|
}
|
||||||
|
) & {
|
||||||
|
request: Request;
|
||||||
|
response: Response;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
|
||||||
|
export interface ClientOptions {
|
||||||
|
baseUrl?: string;
|
||||||
|
responseStyle?: ResponseStyle;
|
||||||
|
throwOnError?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
type MethodFn = <
|
||||||
|
TData = unknown,
|
||||||
|
TError = unknown,
|
||||||
|
ThrowOnError extends boolean = false,
|
||||||
|
TResponseStyle extends ResponseStyle = 'fields',
|
||||||
|
>(
|
||||||
|
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>,
|
||||||
|
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
||||||
|
|
||||||
|
type SseFn = <
|
||||||
|
TData = unknown,
|
||||||
|
TError = unknown,
|
||||||
|
ThrowOnError extends boolean = false,
|
||||||
|
TResponseStyle extends ResponseStyle = 'fields',
|
||||||
|
>(
|
||||||
|
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>,
|
||||||
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
||||||
|
|
||||||
|
type RequestFn = <
|
||||||
|
TData = unknown,
|
||||||
|
TError = unknown,
|
||||||
|
ThrowOnError extends boolean = false,
|
||||||
|
TResponseStyle extends ResponseStyle = 'fields',
|
||||||
|
>(
|
||||||
|
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> &
|
||||||
|
Pick<
|
||||||
|
Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>,
|
||||||
|
'method'
|
||||||
|
>,
|
||||||
|
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
||||||
|
|
||||||
|
type BuildUrlFn = <
|
||||||
|
TData extends {
|
||||||
|
body?: unknown;
|
||||||
|
path?: Record<string, unknown>;
|
||||||
|
query?: Record<string, unknown>;
|
||||||
|
url: string;
|
||||||
|
},
|
||||||
|
>(
|
||||||
|
options: TData & Options<TData>,
|
||||||
|
) => string;
|
||||||
|
|
||||||
|
export type Client = CoreClient<
|
||||||
|
RequestFn,
|
||||||
|
Config,
|
||||||
|
MethodFn,
|
||||||
|
BuildUrlFn,
|
||||||
|
SseFn
|
||||||
|
> & {
|
||||||
|
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `createClientConfig()` function will be called on client initialization
|
||||||
|
* and the returned object will become the client's initial configuration.
|
||||||
|
*
|
||||||
|
* You may want to initialize your client this way instead of calling
|
||||||
|
* `setConfig()`. This is useful for example if you're using Next.js
|
||||||
|
* to ensure your client always has the correct values.
|
||||||
|
*/
|
||||||
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
||||||
|
override?: Config<ClientOptions & T>,
|
||||||
|
) => Config<Required<ClientOptions> & T>;
|
||||||
|
|
||||||
|
export interface TDataShape {
|
||||||
|
body?: unknown;
|
||||||
|
headers?: unknown;
|
||||||
|
path?: unknown;
|
||||||
|
query?: unknown;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||||
|
|
||||||
|
export type Options<
|
||||||
|
TData extends TDataShape = TDataShape,
|
||||||
|
ThrowOnError extends boolean = boolean,
|
||||||
|
TResponse = unknown,
|
||||||
|
TResponseStyle extends ResponseStyle = 'fields',
|
||||||
|
> = OmitKeys<
|
||||||
|
RequestOptions<TResponse, TResponseStyle, ThrowOnError>,
|
||||||
|
'body' | 'path' | 'query' | 'url'
|
||||||
|
> &
|
||||||
|
([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
||||||
332
packages/store-client/src/client/client/utils.gen.ts
Normal file
332
packages/store-client/src/client/client/utils.gen.ts
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
import { getAuthToken } from '../core/auth.gen';
|
||||||
|
import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
||||||
|
import { jsonBodySerializer } from '../core/bodySerializer.gen';
|
||||||
|
import {
|
||||||
|
serializeArrayParam,
|
||||||
|
serializeObjectParam,
|
||||||
|
serializePrimitiveParam,
|
||||||
|
} from '../core/pathSerializer.gen';
|
||||||
|
import { getUrl } from '../core/utils.gen';
|
||||||
|
import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
|
||||||
|
|
||||||
|
export const createQuerySerializer = <T = unknown>({
|
||||||
|
parameters = {},
|
||||||
|
...args
|
||||||
|
}: QuerySerializerOptions = {}) => {
|
||||||
|
const querySerializer = (queryParams: T) => {
|
||||||
|
const search: string[] = [];
|
||||||
|
if (queryParams && typeof queryParams === 'object') {
|
||||||
|
for (const name in queryParams) {
|
||||||
|
const value = queryParams[name];
|
||||||
|
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = parameters[name] || args;
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
const serializedArray = serializeArrayParam({
|
||||||
|
allowReserved: options.allowReserved,
|
||||||
|
explode: true,
|
||||||
|
name,
|
||||||
|
style: 'form',
|
||||||
|
value,
|
||||||
|
...options.array,
|
||||||
|
});
|
||||||
|
if (serializedArray) search.push(serializedArray);
|
||||||
|
} else if (typeof value === 'object') {
|
||||||
|
const serializedObject = serializeObjectParam({
|
||||||
|
allowReserved: options.allowReserved,
|
||||||
|
explode: true,
|
||||||
|
name,
|
||||||
|
style: 'deepObject',
|
||||||
|
value: value as Record<string, unknown>,
|
||||||
|
...options.object,
|
||||||
|
});
|
||||||
|
if (serializedObject) search.push(serializedObject);
|
||||||
|
} else {
|
||||||
|
const serializedPrimitive = serializePrimitiveParam({
|
||||||
|
allowReserved: options.allowReserved,
|
||||||
|
name,
|
||||||
|
value: value as string,
|
||||||
|
});
|
||||||
|
if (serializedPrimitive) search.push(serializedPrimitive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return search.join('&');
|
||||||
|
};
|
||||||
|
return querySerializer;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infers parseAs value from provided Content-Type header.
|
||||||
|
*/
|
||||||
|
export const getParseAs = (
|
||||||
|
contentType: string | null,
|
||||||
|
): Exclude<Config['parseAs'], 'auto'> => {
|
||||||
|
if (!contentType) {
|
||||||
|
// If no Content-Type header is provided, the best we can do is return the raw response body,
|
||||||
|
// which is effectively the same as the 'stream' option.
|
||||||
|
return 'stream';
|
||||||
|
}
|
||||||
|
|
||||||
|
const cleanContent = contentType.split(';')[0]?.trim();
|
||||||
|
|
||||||
|
if (!cleanContent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
cleanContent.startsWith('application/json') ||
|
||||||
|
cleanContent.endsWith('+json')
|
||||||
|
) {
|
||||||
|
return 'json';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cleanContent === 'multipart/form-data') {
|
||||||
|
return 'formData';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
['application/', 'audio/', 'image/', 'video/'].some((type) =>
|
||||||
|
cleanContent.startsWith(type),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return 'blob';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cleanContent.startsWith('text/')) {
|
||||||
|
return 'text';
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkForExistence = (
|
||||||
|
options: Pick<RequestOptions, 'auth' | 'query'> & {
|
||||||
|
headers: Headers;
|
||||||
|
},
|
||||||
|
name?: string,
|
||||||
|
): boolean => {
|
||||||
|
if (!name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
options.headers.has(name) ||
|
||||||
|
options.query?.[name] ||
|
||||||
|
options.headers.get('Cookie')?.includes(`${name}=`)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setAuthParams = async ({
|
||||||
|
security,
|
||||||
|
...options
|
||||||
|
}: Pick<Required<RequestOptions>, 'security'> &
|
||||||
|
Pick<RequestOptions, 'auth' | 'query'> & {
|
||||||
|
headers: Headers;
|
||||||
|
}) => {
|
||||||
|
for (const auth of security) {
|
||||||
|
if (checkForExistence(options, auth.name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const token = await getAuthToken(auth, options.auth);
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const name = auth.name ?? 'Authorization';
|
||||||
|
|
||||||
|
switch (auth.in) {
|
||||||
|
case 'query':
|
||||||
|
if (!options.query) {
|
||||||
|
options.query = {};
|
||||||
|
}
|
||||||
|
options.query[name] = token;
|
||||||
|
break;
|
||||||
|
case 'cookie':
|
||||||
|
options.headers.append('Cookie', `${name}=${token}`);
|
||||||
|
break;
|
||||||
|
case 'header':
|
||||||
|
default:
|
||||||
|
options.headers.set(name, token);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const buildUrl: Client['buildUrl'] = (options) =>
|
||||||
|
getUrl({
|
||||||
|
baseUrl: options.baseUrl as string,
|
||||||
|
path: options.path,
|
||||||
|
query: options.query,
|
||||||
|
querySerializer:
|
||||||
|
typeof options.querySerializer === 'function'
|
||||||
|
? options.querySerializer
|
||||||
|
: createQuerySerializer(options.querySerializer),
|
||||||
|
url: options.url,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const mergeConfigs = (a: Config, b: Config): Config => {
|
||||||
|
const config = { ...a, ...b };
|
||||||
|
if (config.baseUrl?.endsWith('/')) {
|
||||||
|
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
||||||
|
}
|
||||||
|
config.headers = mergeHeaders(a.headers, b.headers);
|
||||||
|
return config;
|
||||||
|
};
|
||||||
|
|
||||||
|
const headersEntries = (headers: Headers): Array<[string, string]> => {
|
||||||
|
const entries: Array<[string, string]> = [];
|
||||||
|
headers.forEach((value, key) => {
|
||||||
|
entries.push([key, value]);
|
||||||
|
});
|
||||||
|
return entries;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const mergeHeaders = (
|
||||||
|
...headers: Array<Required<Config>['headers'] | undefined>
|
||||||
|
): Headers => {
|
||||||
|
const mergedHeaders = new Headers();
|
||||||
|
for (const header of headers) {
|
||||||
|
if (!header) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const iterator =
|
||||||
|
header instanceof Headers
|
||||||
|
? headersEntries(header)
|
||||||
|
: Object.entries(header);
|
||||||
|
|
||||||
|
for (const [key, value] of iterator) {
|
||||||
|
if (value === null) {
|
||||||
|
mergedHeaders.delete(key);
|
||||||
|
} else if (Array.isArray(value)) {
|
||||||
|
for (const v of value) {
|
||||||
|
mergedHeaders.append(key, v as string);
|
||||||
|
}
|
||||||
|
} else if (value !== undefined) {
|
||||||
|
// assume object headers are meant to be JSON stringified, i.e. their
|
||||||
|
// content value in OpenAPI specification is 'application/json'
|
||||||
|
mergedHeaders.set(
|
||||||
|
key,
|
||||||
|
typeof value === 'object' ? JSON.stringify(value) : (value as string),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mergedHeaders;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ErrInterceptor<Err, Res, Req, Options> = (
|
||||||
|
error: Err,
|
||||||
|
response: Res,
|
||||||
|
request: Req,
|
||||||
|
options: Options,
|
||||||
|
) => Err | Promise<Err>;
|
||||||
|
|
||||||
|
type ReqInterceptor<Req, Options> = (
|
||||||
|
request: Req,
|
||||||
|
options: Options,
|
||||||
|
) => Req | Promise<Req>;
|
||||||
|
|
||||||
|
type ResInterceptor<Res, Req, Options> = (
|
||||||
|
response: Res,
|
||||||
|
request: Req,
|
||||||
|
options: Options,
|
||||||
|
) => Res | Promise<Res>;
|
||||||
|
|
||||||
|
class Interceptors<Interceptor> {
|
||||||
|
fns: Array<Interceptor | null> = [];
|
||||||
|
|
||||||
|
clear(): void {
|
||||||
|
this.fns = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
eject(id: number | Interceptor): void {
|
||||||
|
const index = this.getInterceptorIndex(id);
|
||||||
|
if (this.fns[index]) {
|
||||||
|
this.fns[index] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exists(id: number | Interceptor): boolean {
|
||||||
|
const index = this.getInterceptorIndex(id);
|
||||||
|
return Boolean(this.fns[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
getInterceptorIndex(id: number | Interceptor): number {
|
||||||
|
if (typeof id === 'number') {
|
||||||
|
return this.fns[id] ? id : -1;
|
||||||
|
}
|
||||||
|
return this.fns.indexOf(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(
|
||||||
|
id: number | Interceptor,
|
||||||
|
fn: Interceptor,
|
||||||
|
): number | Interceptor | false {
|
||||||
|
const index = this.getInterceptorIndex(id);
|
||||||
|
if (this.fns[index]) {
|
||||||
|
this.fns[index] = fn;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
use(fn: Interceptor): number {
|
||||||
|
this.fns.push(fn);
|
||||||
|
return this.fns.length - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Middleware<Req, Res, Err, Options> {
|
||||||
|
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
||||||
|
request: Interceptors<ReqInterceptor<Req, Options>>;
|
||||||
|
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createInterceptors = <Req, Res, Err, Options>(): Middleware<
|
||||||
|
Req,
|
||||||
|
Res,
|
||||||
|
Err,
|
||||||
|
Options
|
||||||
|
> => ({
|
||||||
|
error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),
|
||||||
|
request: new Interceptors<ReqInterceptor<Req, Options>>(),
|
||||||
|
response: new Interceptors<ResInterceptor<Res, Req, Options>>(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultQuerySerializer = createQuerySerializer({
|
||||||
|
allowReserved: false,
|
||||||
|
array: {
|
||||||
|
explode: true,
|
||||||
|
style: 'form',
|
||||||
|
},
|
||||||
|
object: {
|
||||||
|
explode: true,
|
||||||
|
style: 'deepObject',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const defaultHeaders = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createConfig = <T extends ClientOptions = ClientOptions>(
|
||||||
|
override: Config<Omit<ClientOptions, keyof T> & T> = {},
|
||||||
|
): Config<Omit<ClientOptions, keyof T> & T> => ({
|
||||||
|
...jsonBodySerializer,
|
||||||
|
headers: defaultHeaders,
|
||||||
|
parseAs: 'auto',
|
||||||
|
querySerializer: defaultQuerySerializer,
|
||||||
|
...override,
|
||||||
|
});
|
||||||
42
packages/store-client/src/client/core/auth.gen.ts
Normal file
42
packages/store-client/src/client/core/auth.gen.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
export type AuthToken = string | undefined;
|
||||||
|
|
||||||
|
export interface Auth {
|
||||||
|
/**
|
||||||
|
* Which part of the request do we use to send the auth?
|
||||||
|
*
|
||||||
|
* @default 'header'
|
||||||
|
*/
|
||||||
|
in?: 'header' | 'query' | 'cookie';
|
||||||
|
/**
|
||||||
|
* Header or query parameter name.
|
||||||
|
*
|
||||||
|
* @default 'Authorization'
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
scheme?: 'basic' | 'bearer';
|
||||||
|
type: 'apiKey' | 'http';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAuthToken = async (
|
||||||
|
auth: Auth,
|
||||||
|
callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
|
||||||
|
): Promise<string | undefined> => {
|
||||||
|
const token =
|
||||||
|
typeof callback === 'function' ? await callback(auth) : callback;
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth.scheme === 'bearer') {
|
||||||
|
return `Bearer ${token}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth.scheme === 'basic') {
|
||||||
|
return `Basic ${btoa(token)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
};
|
||||||
100
packages/store-client/src/client/core/bodySerializer.gen.ts
Normal file
100
packages/store-client/src/client/core/bodySerializer.gen.ts
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ArrayStyle,
|
||||||
|
ObjectStyle,
|
||||||
|
SerializerOptions,
|
||||||
|
} from './pathSerializer.gen';
|
||||||
|
|
||||||
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
||||||
|
|
||||||
|
export type BodySerializer = (body: any) => any;
|
||||||
|
|
||||||
|
type QuerySerializerOptionsObject = {
|
||||||
|
allowReserved?: boolean;
|
||||||
|
array?: Partial<SerializerOptions<ArrayStyle>>;
|
||||||
|
object?: Partial<SerializerOptions<ObjectStyle>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
||||||
|
/**
|
||||||
|
* Per-parameter serialization overrides. When provided, these settings
|
||||||
|
* override the global array/object settings for specific parameter names.
|
||||||
|
*/
|
||||||
|
parameters?: Record<string, QuerySerializerOptionsObject>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const serializeFormDataPair = (
|
||||||
|
data: FormData,
|
||||||
|
key: string,
|
||||||
|
value: unknown,
|
||||||
|
): void => {
|
||||||
|
if (typeof value === 'string' || value instanceof Blob) {
|
||||||
|
data.append(key, value);
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
data.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
data.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const serializeUrlSearchParamsPair = (
|
||||||
|
data: URLSearchParams,
|
||||||
|
key: string,
|
||||||
|
value: unknown,
|
||||||
|
): void => {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
data.append(key, value);
|
||||||
|
} else {
|
||||||
|
data.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const formDataBodySerializer = {
|
||||||
|
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
||||||
|
body: T,
|
||||||
|
): FormData => {
|
||||||
|
const data = new FormData();
|
||||||
|
|
||||||
|
Object.entries(body).forEach(([key, value]) => {
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach((v) => serializeFormDataPair(data, key, v));
|
||||||
|
} else {
|
||||||
|
serializeFormDataPair(data, key, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const jsonBodySerializer = {
|
||||||
|
bodySerializer: <T>(body: T): string =>
|
||||||
|
JSON.stringify(body, (_key, value) =>
|
||||||
|
typeof value === 'bigint' ? value.toString() : value,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const urlSearchParamsBodySerializer = {
|
||||||
|
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
||||||
|
body: T,
|
||||||
|
): string => {
|
||||||
|
const data = new URLSearchParams();
|
||||||
|
|
||||||
|
Object.entries(body).forEach(([key, value]) => {
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));
|
||||||
|
} else {
|
||||||
|
serializeUrlSearchParamsPair(data, key, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return data.toString();
|
||||||
|
},
|
||||||
|
};
|
||||||
176
packages/store-client/src/client/core/params.gen.ts
Normal file
176
packages/store-client/src/client/core/params.gen.ts
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
type Slot = 'body' | 'headers' | 'path' | 'query';
|
||||||
|
|
||||||
|
export type Field =
|
||||||
|
| {
|
||||||
|
in: Exclude<Slot, 'body'>;
|
||||||
|
/**
|
||||||
|
* Field name. This is the name we want the user to see and use.
|
||||||
|
*/
|
||||||
|
key: string;
|
||||||
|
/**
|
||||||
|
* Field mapped name. This is the name we want to use in the request.
|
||||||
|
* If omitted, we use the same value as `key`.
|
||||||
|
*/
|
||||||
|
map?: string;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
in: Extract<Slot, 'body'>;
|
||||||
|
/**
|
||||||
|
* Key isn't required for bodies.
|
||||||
|
*/
|
||||||
|
key?: string;
|
||||||
|
map?: string;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
/**
|
||||||
|
* Field name. This is the name we want the user to see and use.
|
||||||
|
*/
|
||||||
|
key: string;
|
||||||
|
/**
|
||||||
|
* Field mapped name. This is the name we want to use in the request.
|
||||||
|
* If `in` is omitted, `map` aliases `key` to the transport layer.
|
||||||
|
*/
|
||||||
|
map: Slot;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface Fields {
|
||||||
|
allowExtra?: Partial<Record<Slot, boolean>>;
|
||||||
|
args?: ReadonlyArray<Field>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FieldsConfig = ReadonlyArray<Field | Fields>;
|
||||||
|
|
||||||
|
const extraPrefixesMap: Record<string, Slot> = {
|
||||||
|
$body_: 'body',
|
||||||
|
$headers_: 'headers',
|
||||||
|
$path_: 'path',
|
||||||
|
$query_: 'query',
|
||||||
|
};
|
||||||
|
const extraPrefixes = Object.entries(extraPrefixesMap);
|
||||||
|
|
||||||
|
type KeyMap = Map<
|
||||||
|
string,
|
||||||
|
| {
|
||||||
|
in: Slot;
|
||||||
|
map?: string;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
in?: never;
|
||||||
|
map: Slot;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
|
||||||
|
const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
|
||||||
|
if (!map) {
|
||||||
|
map = new Map();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const config of fields) {
|
||||||
|
if ('in' in config) {
|
||||||
|
if (config.key) {
|
||||||
|
map.set(config.key, {
|
||||||
|
in: config.in,
|
||||||
|
map: config.map,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if ('key' in config) {
|
||||||
|
map.set(config.key, {
|
||||||
|
map: config.map,
|
||||||
|
});
|
||||||
|
} else if (config.args) {
|
||||||
|
buildKeyMap(config.args, map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface Params {
|
||||||
|
body: unknown;
|
||||||
|
headers: Record<string, unknown>;
|
||||||
|
path: Record<string, unknown>;
|
||||||
|
query: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stripEmptySlots = (params: Params) => {
|
||||||
|
for (const [slot, value] of Object.entries(params)) {
|
||||||
|
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
||||||
|
delete params[slot as Slot];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const buildClientParams = (
|
||||||
|
args: ReadonlyArray<unknown>,
|
||||||
|
fields: FieldsConfig,
|
||||||
|
) => {
|
||||||
|
const params: Params = {
|
||||||
|
body: {},
|
||||||
|
headers: {},
|
||||||
|
path: {},
|
||||||
|
query: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const map = buildKeyMap(fields);
|
||||||
|
|
||||||
|
let config: FieldsConfig[number] | undefined;
|
||||||
|
|
||||||
|
for (const [index, arg] of args.entries()) {
|
||||||
|
if (fields[index]) {
|
||||||
|
config = fields[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('in' in config) {
|
||||||
|
if (config.key) {
|
||||||
|
const field = map.get(config.key)!;
|
||||||
|
const name = field.map || config.key;
|
||||||
|
if (field.in) {
|
||||||
|
(params[field.in] as Record<string, unknown>)[name] = arg;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
params.body = arg;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const [key, value] of Object.entries(arg ?? {})) {
|
||||||
|
const field = map.get(key);
|
||||||
|
|
||||||
|
if (field) {
|
||||||
|
if (field.in) {
|
||||||
|
const name = field.map || key;
|
||||||
|
(params[field.in] as Record<string, unknown>)[name] = value;
|
||||||
|
} else {
|
||||||
|
params[field.map] = value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const extra = extraPrefixes.find(([prefix]) =>
|
||||||
|
key.startsWith(prefix),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (extra) {
|
||||||
|
const [prefix, slot] = extra;
|
||||||
|
(params[slot] as Record<string, unknown>)[
|
||||||
|
key.slice(prefix.length)
|
||||||
|
] = value;
|
||||||
|
} else if ('allowExtra' in config && config.allowExtra) {
|
||||||
|
for (const [slot, allowed] of Object.entries(config.allowExtra)) {
|
||||||
|
if (allowed) {
|
||||||
|
(params[slot as Slot] as Record<string, unknown>)[key] = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stripEmptySlots(params);
|
||||||
|
|
||||||
|
return params;
|
||||||
|
};
|
||||||
181
packages/store-client/src/client/core/pathSerializer.gen.ts
Normal file
181
packages/store-client/src/client/core/pathSerializer.gen.ts
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
interface SerializeOptions<T>
|
||||||
|
extends SerializePrimitiveOptions,
|
||||||
|
SerializerOptions<T> {}
|
||||||
|
|
||||||
|
interface SerializePrimitiveOptions {
|
||||||
|
allowReserved?: boolean;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SerializerOptions<T> {
|
||||||
|
/**
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
explode: boolean;
|
||||||
|
style: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
||||||
|
export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
|
||||||
|
type MatrixStyle = 'label' | 'matrix' | 'simple';
|
||||||
|
export type ObjectStyle = 'form' | 'deepObject';
|
||||||
|
type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
|
||||||
|
|
||||||
|
interface SerializePrimitiveParam extends SerializePrimitiveOptions {
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
|
||||||
|
switch (style) {
|
||||||
|
case 'label':
|
||||||
|
return '.';
|
||||||
|
case 'matrix':
|
||||||
|
return ';';
|
||||||
|
case 'simple':
|
||||||
|
return ',';
|
||||||
|
default:
|
||||||
|
return '&';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
|
||||||
|
switch (style) {
|
||||||
|
case 'form':
|
||||||
|
return ',';
|
||||||
|
case 'pipeDelimited':
|
||||||
|
return '|';
|
||||||
|
case 'spaceDelimited':
|
||||||
|
return '%20';
|
||||||
|
default:
|
||||||
|
return ',';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const separatorObjectExplode = (style: ObjectSeparatorStyle) => {
|
||||||
|
switch (style) {
|
||||||
|
case 'label':
|
||||||
|
return '.';
|
||||||
|
case 'matrix':
|
||||||
|
return ';';
|
||||||
|
case 'simple':
|
||||||
|
return ',';
|
||||||
|
default:
|
||||||
|
return '&';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const serializeArrayParam = ({
|
||||||
|
allowReserved,
|
||||||
|
explode,
|
||||||
|
name,
|
||||||
|
style,
|
||||||
|
value,
|
||||||
|
}: SerializeOptions<ArraySeparatorStyle> & {
|
||||||
|
value: unknown[];
|
||||||
|
}) => {
|
||||||
|
if (!explode) {
|
||||||
|
const joinedValues = (
|
||||||
|
allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
|
||||||
|
).join(separatorArrayNoExplode(style));
|
||||||
|
switch (style) {
|
||||||
|
case 'label':
|
||||||
|
return `.${joinedValues}`;
|
||||||
|
case 'matrix':
|
||||||
|
return `;${name}=${joinedValues}`;
|
||||||
|
case 'simple':
|
||||||
|
return joinedValues;
|
||||||
|
default:
|
||||||
|
return `${name}=${joinedValues}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const separator = separatorArrayExplode(style);
|
||||||
|
const joinedValues = value
|
||||||
|
.map((v) => {
|
||||||
|
if (style === 'label' || style === 'simple') {
|
||||||
|
return allowReserved ? v : encodeURIComponent(v as string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return serializePrimitiveParam({
|
||||||
|
allowReserved,
|
||||||
|
name,
|
||||||
|
value: v as string,
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.join(separator);
|
||||||
|
return style === 'label' || style === 'matrix'
|
||||||
|
? separator + joinedValues
|
||||||
|
: joinedValues;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const serializePrimitiveParam = ({
|
||||||
|
allowReserved,
|
||||||
|
name,
|
||||||
|
value,
|
||||||
|
}: SerializePrimitiveParam) => {
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
throw new Error(
|
||||||
|
'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const serializeObjectParam = ({
|
||||||
|
allowReserved,
|
||||||
|
explode,
|
||||||
|
name,
|
||||||
|
style,
|
||||||
|
value,
|
||||||
|
valueOnly,
|
||||||
|
}: SerializeOptions<ObjectSeparatorStyle> & {
|
||||||
|
value: Record<string, unknown> | Date;
|
||||||
|
valueOnly?: boolean;
|
||||||
|
}) => {
|
||||||
|
if (value instanceof Date) {
|
||||||
|
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (style !== 'deepObject' && !explode) {
|
||||||
|
let values: string[] = [];
|
||||||
|
Object.entries(value).forEach(([key, v]) => {
|
||||||
|
values = [
|
||||||
|
...values,
|
||||||
|
key,
|
||||||
|
allowReserved ? (v as string) : encodeURIComponent(v as string),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
const joinedValues = values.join(',');
|
||||||
|
switch (style) {
|
||||||
|
case 'form':
|
||||||
|
return `${name}=${joinedValues}`;
|
||||||
|
case 'label':
|
||||||
|
return `.${joinedValues}`;
|
||||||
|
case 'matrix':
|
||||||
|
return `;${name}=${joinedValues}`;
|
||||||
|
default:
|
||||||
|
return joinedValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const separator = separatorObjectExplode(style);
|
||||||
|
const joinedValues = Object.entries(value)
|
||||||
|
.map(([key, v]) =>
|
||||||
|
serializePrimitiveParam({
|
||||||
|
allowReserved,
|
||||||
|
name: style === 'deepObject' ? `${name}[${key}]` : key,
|
||||||
|
value: v as string,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.join(separator);
|
||||||
|
return style === 'label' || style === 'matrix'
|
||||||
|
? separator + joinedValues
|
||||||
|
: joinedValues;
|
||||||
|
};
|
||||||
136
packages/store-client/src/client/core/queryKeySerializer.gen.ts
Normal file
136
packages/store-client/src/client/core/queryKeySerializer.gen.ts
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON-friendly union that mirrors what Pinia Colada can hash.
|
||||||
|
*/
|
||||||
|
export type JsonValue =
|
||||||
|
| null
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| boolean
|
||||||
|
| JsonValue[]
|
||||||
|
| { [key: string]: JsonValue };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
|
||||||
|
*/
|
||||||
|
export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
|
||||||
|
if (
|
||||||
|
value === undefined ||
|
||||||
|
typeof value === 'function' ||
|
||||||
|
typeof value === 'symbol'
|
||||||
|
) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
if (typeof value === 'bigint') {
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
if (value instanceof Date) {
|
||||||
|
return value.toISOString();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safely stringifies a value and parses it back into a JsonValue.
|
||||||
|
*/
|
||||||
|
export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => {
|
||||||
|
try {
|
||||||
|
const json = JSON.stringify(input, queryKeyJsonReplacer);
|
||||||
|
if (json === undefined) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return JSON.parse(json) as JsonValue;
|
||||||
|
} catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects plain objects (including objects with a null prototype).
|
||||||
|
*/
|
||||||
|
const isPlainObject = (value: unknown): value is Record<string, unknown> => {
|
||||||
|
if (value === null || typeof value !== 'object') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const prototype = Object.getPrototypeOf(value as object);
|
||||||
|
return prototype === Object.prototype || prototype === null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns URLSearchParams into a sorted JSON object for deterministic keys.
|
||||||
|
*/
|
||||||
|
const serializeSearchParams = (params: URLSearchParams): JsonValue => {
|
||||||
|
const entries = Array.from(params.entries()).sort(([a], [b]) =>
|
||||||
|
a.localeCompare(b),
|
||||||
|
);
|
||||||
|
const result: Record<string, JsonValue> = {};
|
||||||
|
|
||||||
|
for (const [key, value] of entries) {
|
||||||
|
const existing = result[key];
|
||||||
|
if (existing === undefined) {
|
||||||
|
result[key] = value;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(existing)) {
|
||||||
|
(existing as string[]).push(value);
|
||||||
|
} else {
|
||||||
|
result[key] = [existing, value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes any accepted value into a JSON-friendly shape for query keys.
|
||||||
|
*/
|
||||||
|
export const serializeQueryKeyValue = (
|
||||||
|
value: unknown,
|
||||||
|
): JsonValue | undefined => {
|
||||||
|
if (value === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof value === 'string' ||
|
||||||
|
typeof value === 'number' ||
|
||||||
|
typeof value === 'boolean'
|
||||||
|
) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
value === undefined ||
|
||||||
|
typeof value === 'function' ||
|
||||||
|
typeof value === 'symbol'
|
||||||
|
) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === 'bigint') {
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof Date) {
|
||||||
|
return value.toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return stringifyToJsonValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof URLSearchParams !== 'undefined' &&
|
||||||
|
value instanceof URLSearchParams
|
||||||
|
) {
|
||||||
|
return serializeSearchParams(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPlainObject(value)) {
|
||||||
|
return stringifyToJsonValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
266
packages/store-client/src/client/core/serverSentEvents.gen.ts
Normal file
266
packages/store-client/src/client/core/serverSentEvents.gen.ts
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
|
import type { Config } from './types.gen';
|
||||||
|
|
||||||
|
export type ServerSentEventsOptions<TData = unknown> = Omit<
|
||||||
|
RequestInit,
|
||||||
|
'method'
|
||||||
|
> &
|
||||||
|
Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
||||||
|
/**
|
||||||
|
* Fetch API implementation. You can use this option to provide a custom
|
||||||
|
* fetch instance.
|
||||||
|
*
|
||||||
|
* @default globalThis.fetch
|
||||||
|
*/
|
||||||
|
fetch?: typeof fetch;
|
||||||
|
/**
|
||||||
|
* Implementing clients can call request interceptors inside this hook.
|
||||||
|
*/
|
||||||
|
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
||||||
|
/**
|
||||||
|
* Callback invoked when a network or parsing error occurs during streaming.
|
||||||
|
*
|
||||||
|
* This option applies only if the endpoint returns a stream of events.
|
||||||
|
*
|
||||||
|
* @param error The error that occurred.
|
||||||
|
*/
|
||||||
|
onSseError?: (error: unknown) => void;
|
||||||
|
/**
|
||||||
|
* Callback invoked when an event is streamed from the server.
|
||||||
|
*
|
||||||
|
* This option applies only if the endpoint returns a stream of events.
|
||||||
|
*
|
||||||
|
* @param event Event streamed from the server.
|
||||||
|
* @returns Nothing (void).
|
||||||
|
*/
|
||||||
|
onSseEvent?: (event: StreamEvent<TData>) => void;
|
||||||
|
serializedBody?: RequestInit['body'];
|
||||||
|
/**
|
||||||
|
* Default retry delay in milliseconds.
|
||||||
|
*
|
||||||
|
* This option applies only if the endpoint returns a stream of events.
|
||||||
|
*
|
||||||
|
* @default 3000
|
||||||
|
*/
|
||||||
|
sseDefaultRetryDelay?: number;
|
||||||
|
/**
|
||||||
|
* Maximum number of retry attempts before giving up.
|
||||||
|
*/
|
||||||
|
sseMaxRetryAttempts?: number;
|
||||||
|
/**
|
||||||
|
* Maximum retry delay in milliseconds.
|
||||||
|
*
|
||||||
|
* Applies only when exponential backoff is used.
|
||||||
|
*
|
||||||
|
* This option applies only if the endpoint returns a stream of events.
|
||||||
|
*
|
||||||
|
* @default 30000
|
||||||
|
*/
|
||||||
|
sseMaxRetryDelay?: number;
|
||||||
|
/**
|
||||||
|
* Optional sleep function for retry backoff.
|
||||||
|
*
|
||||||
|
* Defaults to using `setTimeout`.
|
||||||
|
*/
|
||||||
|
sseSleepFn?: (ms: number) => Promise<void>;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface StreamEvent<TData = unknown> {
|
||||||
|
data: TData;
|
||||||
|
event?: string;
|
||||||
|
id?: string;
|
||||||
|
retry?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ServerSentEventsResult<
|
||||||
|
TData = unknown,
|
||||||
|
TReturn = void,
|
||||||
|
TNext = unknown,
|
||||||
|
> = {
|
||||||
|
stream: AsyncGenerator<
|
||||||
|
TData extends Record<string, unknown> ? TData[keyof TData] : TData,
|
||||||
|
TReturn,
|
||||||
|
TNext
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createSseClient = <TData = unknown>({
|
||||||
|
onRequest,
|
||||||
|
onSseError,
|
||||||
|
onSseEvent,
|
||||||
|
responseTransformer,
|
||||||
|
responseValidator,
|
||||||
|
sseDefaultRetryDelay,
|
||||||
|
sseMaxRetryAttempts,
|
||||||
|
sseMaxRetryDelay,
|
||||||
|
sseSleepFn,
|
||||||
|
url,
|
||||||
|
...options
|
||||||
|
}: ServerSentEventsOptions): ServerSentEventsResult<TData> => {
|
||||||
|
let lastEventId: string | undefined;
|
||||||
|
|
||||||
|
const sleep =
|
||||||
|
sseSleepFn ??
|
||||||
|
((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
|
||||||
|
|
||||||
|
const createStream = async function* () {
|
||||||
|
let retryDelay: number = sseDefaultRetryDelay ?? 3000;
|
||||||
|
let attempt = 0;
|
||||||
|
const signal = options.signal ?? new AbortController().signal;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if (signal.aborted) break;
|
||||||
|
|
||||||
|
attempt++;
|
||||||
|
|
||||||
|
const headers =
|
||||||
|
options.headers instanceof Headers
|
||||||
|
? options.headers
|
||||||
|
: new Headers(options.headers as Record<string, string> | undefined);
|
||||||
|
|
||||||
|
if (lastEventId !== undefined) {
|
||||||
|
headers.set('Last-Event-ID', lastEventId);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const requestInit: RequestInit = {
|
||||||
|
redirect: 'follow',
|
||||||
|
...options,
|
||||||
|
body: options.serializedBody,
|
||||||
|
headers,
|
||||||
|
signal,
|
||||||
|
};
|
||||||
|
let request = new Request(url, requestInit);
|
||||||
|
if (onRequest) {
|
||||||
|
request = await onRequest(url, requestInit);
|
||||||
|
}
|
||||||
|
// fetch must be assigned here, otherwise it would throw the error:
|
||||||
|
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
||||||
|
const _fetch = options.fetch ?? globalThis.fetch;
|
||||||
|
const response = await _fetch(request);
|
||||||
|
|
||||||
|
if (!response.ok)
|
||||||
|
throw new Error(
|
||||||
|
`SSE failed: ${response.status} ${response.statusText}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!response.body) throw new Error('No body in SSE response');
|
||||||
|
|
||||||
|
const reader = response.body
|
||||||
|
.pipeThrough(new TextDecoderStream())
|
||||||
|
.getReader();
|
||||||
|
|
||||||
|
let buffer = '';
|
||||||
|
|
||||||
|
const abortHandler = () => {
|
||||||
|
try {
|
||||||
|
reader.cancel();
|
||||||
|
} catch {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
signal.addEventListener('abort', abortHandler);
|
||||||
|
|
||||||
|
try {
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done) break;
|
||||||
|
buffer += value;
|
||||||
|
// Normalize line endings: CRLF -> LF, then CR -> LF
|
||||||
|
buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
||||||
|
|
||||||
|
const chunks = buffer.split('\n\n');
|
||||||
|
buffer = chunks.pop() ?? '';
|
||||||
|
|
||||||
|
for (const chunk of chunks) {
|
||||||
|
const lines = chunk.split('\n');
|
||||||
|
const dataLines: Array<string> = [];
|
||||||
|
let eventName: string | undefined;
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith('data:')) {
|
||||||
|
dataLines.push(line.replace(/^data:\s*/, ''));
|
||||||
|
} else if (line.startsWith('event:')) {
|
||||||
|
eventName = line.replace(/^event:\s*/, '');
|
||||||
|
} else if (line.startsWith('id:')) {
|
||||||
|
lastEventId = line.replace(/^id:\s*/, '');
|
||||||
|
} else if (line.startsWith('retry:')) {
|
||||||
|
const parsed = Number.parseInt(
|
||||||
|
line.replace(/^retry:\s*/, ''),
|
||||||
|
10,
|
||||||
|
);
|
||||||
|
if (!Number.isNaN(parsed)) {
|
||||||
|
retryDelay = parsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let data: unknown;
|
||||||
|
let parsedJson = false;
|
||||||
|
|
||||||
|
if (dataLines.length) {
|
||||||
|
const rawData = dataLines.join('\n');
|
||||||
|
try {
|
||||||
|
data = JSON.parse(rawData);
|
||||||
|
parsedJson = true;
|
||||||
|
} catch {
|
||||||
|
data = rawData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parsedJson) {
|
||||||
|
if (responseValidator) {
|
||||||
|
await responseValidator(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseTransformer) {
|
||||||
|
data = await responseTransformer(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSseEvent?.({
|
||||||
|
data,
|
||||||
|
event: eventName,
|
||||||
|
id: lastEventId,
|
||||||
|
retry: retryDelay,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (dataLines.length) {
|
||||||
|
yield data as any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
signal.removeEventListener('abort', abortHandler);
|
||||||
|
reader.releaseLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
break; // exit loop on normal completion
|
||||||
|
} catch (error) {
|
||||||
|
// connection failed or aborted; retry after delay
|
||||||
|
onSseError?.(error);
|
||||||
|
|
||||||
|
if (
|
||||||
|
sseMaxRetryAttempts !== undefined &&
|
||||||
|
attempt >= sseMaxRetryAttempts
|
||||||
|
) {
|
||||||
|
break; // stop after firing error
|
||||||
|
}
|
||||||
|
|
||||||
|
// exponential backoff: double retry each attempt, cap at 30s
|
||||||
|
const backoff = Math.min(
|
||||||
|
retryDelay * 2 ** (attempt - 1),
|
||||||
|
sseMaxRetryDelay ?? 30000,
|
||||||
|
);
|
||||||
|
await sleep(backoff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const stream = createStream();
|
||||||
|
|
||||||
|
return { stream };
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user