@binblink/wasmnest-plugin-sdk-desktop 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -4
- package/README_en.md +1 -1
- package/bin/cli.js +5 -5
- package/bin/manifest-gen.js +4 -0
- package/bin/manifest-validate.js +68 -6
- package/bin/permission-vocabulary.json +2 -2
- package/dev-shell/README.md +6 -5
- package/dev-shell/src/loader.ts +0 -5
- package/dev-shell/src/mock/commands.ts +1 -1
- package/dev-shell/src/mock/domain-context.ts +1 -1
- package/dev-shell/src/shell/types.ts +21 -32
- package/dev-shell/src/styles/shell.css +208 -2
- package/dev-shell/src/styles/style.css +72 -26
- package/dist/index.d.ts +44 -3
- package/dist/index.js +69 -1
- package/dist/types.d.ts +52 -5
- package/go/.gitignore +5 -0
- package/go/README.md +80 -0
- package/go/gen/wasmnest/api-call/host-api-call/empty.s +3 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wasm.go +13 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wit.go +34 -0
- package/go/gen/wasmnest/app/host-app/empty.s +3 -0
- package/go/gen/wasmnest/app/host-app/host-app.wasm.go +29 -0
- package/go/gen/wasmnest/app/host-app/host-app.wit.go +108 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/abi.go +14 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/empty.s +3 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wasm.go +49 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wit.go +225 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/abi.go +14 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/empty.s +3 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wasm.go +17 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wit.go +68 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/empty.s +3 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wasm.go +13 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wit.go +50 -0
- package/go/gen/wasmnest/crypto/host-crypto/abi.go +18 -0
- package/go/gen/wasmnest/crypto/host-crypto/empty.s +3 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wasm.go +37 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wit.go +139 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/abi.go +14 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/empty.s +3 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wit.go +62 -0
- package/go/gen/wasmnest/http/host-http/abi.go +14 -0
- package/go/gen/wasmnest/http/host-http/empty.s +3 -0
- package/go/gen/wasmnest/http/host-http/host-http.wasm.go +13 -0
- package/go/gen/wasmnest/http/host-http/host-http.wit.go +40 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/empty.s +3 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wasm.go +17 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wit.go +69 -0
- package/go/gen/wasmnest/mdns/host-mdns/empty.s +3 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wasm.go +29 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wit.go +101 -0
- package/go/gen/wasmnest/notify/host-notify/empty.s +3 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wasm.go +13 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wit.go +64 -0
- package/go/gen/wasmnest/peer/host-peer/abi.go +14 -0
- package/go/gen/wasmnest/peer/host-peer/empty.s +3 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wasm.go +85 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wit.go +357 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/empty.s +3 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wit.go +70 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.exports.go +11 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wit.go +7 -0
- package/go/gen/wasmnest/plugin/abi-form/empty.s +3 -0
- package/go/gen/wasmnest/plugin/command/command.exports.go +11 -0
- package/go/gen/wasmnest/plugin/command/command.wasm.go +19 -0
- package/go/gen/wasmnest/plugin/command/command.wit.go +6 -0
- package/go/gen/wasmnest/plugin/command/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/events.exports.go +52 -0
- package/go/gen/wasmnest/plugin/events/events.wasm.go +74 -0
- package/go/gen/wasmnest/plugin/events/events.wit.go +195 -0
- package/go/gen/wasmnest/plugin/host-bus/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wit.go +94 -0
- package/go/gen/wasmnest/plugin/host-config/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-config/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wit.go +21 -0
- package/go/gen/wasmnest/plugin/host-events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wasm.go +9 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wit.go +27 -0
- package/go/gen/wasmnest/plugin/host-fs/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-fs/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wasm.go +33 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wit.go +86 -0
- package/go/gen/wasmnest/plugin/host-log/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wasm.go +25 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wit.go +65 -0
- package/go/gen/wasmnest/plugin/host-metrics/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wit.go +34 -0
- package/go/gen/wasmnest/plugin/host-platform/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wit.go +85 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wit.go +70 -0
- package/go/gen/wasmnest/plugin/host-storage/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-storage/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wit.go +44 -0
- package/go/gen/wasmnest/plugin/host-worker/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wasm.go +17 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wit.go +50 -0
- package/go/gen/wasmnest/plugin/lifecycle/empty.s +3 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.exports.go +32 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wasm.go +41 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wit.go +9 -0
- package/go/gen/wasmnest/plugin/manifest/empty.s +3 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.exports.go +11 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wit.go +6 -0
- package/go/gen/wasmnest/plugin/plugin/plugin.wit.go +4 -0
- package/go/gen/wasmnest/process/host-process/empty.s +3 -0
- package/go/gen/wasmnest/process/host-process/host-process.wasm.go +21 -0
- package/go/gen/wasmnest/process/host-process/host-process.wit.go +56 -0
- package/go/gen/wasmnest/pty/host-pty/abi.go +14 -0
- package/go/gen/wasmnest/pty/host-pty/empty.s +3 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wasm.go +33 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wit.go +164 -0
- package/go/gen/wasmnest/task/host-task/abi.go +14 -0
- package/go/gen/wasmnest/task/host-task/empty.s +3 -0
- package/go/gen/wasmnest/task/host-task/host-task.wasm.go +29 -0
- package/go/gen/wasmnest/task/host-task/host-task.wit.go +110 -0
- package/go/gen/wasmnest/timer/host-timer/empty.s +3 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wasm.go +13 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wit.go +25 -0
- package/go/gen/wasmnest/ws/host-websocket/empty.s +3 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wasm.go +29 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wit.go +109 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/empty.s +3 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wasm.go +49 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wit.go +220 -0
- package/go/go.mod +14 -0
- package/go/go.sum +2 -0
- package/go/sdk/dispatch.go +49 -0
- package/go/sdk/dispatch_test.go +81 -0
- package/go/sdk/entry_native.go +13 -0
- package/go/sdk/entry_wasip2.go +188 -0
- package/go/sdk/host_http_wasip2.go +42 -0
- package/go/sdk/host_wasip2.go +251 -0
- package/go/sdk/plugin.go +103 -0
- package/go/testplugin/index.js +1 -0
- package/go/testplugin/main.go +67 -0
- package/go/testplugin/plugin.json +24 -0
- package/go/tools/assemble-wit.mjs +152 -0
- package/go/tools/gen-bindings.mjs +51 -0
- package/go/wit/core.wit +273 -0
- package/go/wit/deps/api-call/cap-api-call.wit +20 -0
- package/go/wit/deps/app/cap-app.wit +54 -0
- package/go/wit/deps/auth-center/cap-auth-center.wit +124 -0
- package/go/wit/deps/clipboard/clipboard.wit +48 -0
- package/go/wit/deps/clocks/monotonic-clock.wit +45 -0
- package/go/wit/deps/clocks/wall-clock.wit +42 -0
- package/go/wit/deps/clocks/world.wit +6 -0
- package/go/wit/deps/connection-registry/cap-connection-registry.wit +40 -0
- package/go/wit/deps/crypto/cap-crypto.wit +68 -0
- package/go/wit/deps/filesystem/preopens.wit +8 -0
- package/go/wit/deps/filesystem/types.wit +634 -0
- package/go/wit/deps/filesystem/world.wit +6 -0
- package/go/wit/deps/fs-desktop/cap-fs-desktop.wit +29 -0
- package/go/wit/deps/http/http.wit +28 -0
- package/go/wit/deps/http-endpoint/cap-http.wit +44 -0
- package/go/wit/deps/io/error.wit +34 -0
- package/go/wit/deps/io/poll.wit +41 -0
- package/go/wit/deps/io/streams.wit +262 -0
- package/go/wit/deps/io/world.wit +6 -0
- package/go/wit/deps/mdns/mdns.wit +45 -0
- package/go/wit/deps/notify/notify.wit +51 -0
- package/go/wit/deps/peer/peer.wit +126 -0
- package/go/wit/deps/platform-desktop/cap-platform-desktop.wit +38 -0
- package/go/wit/deps/process/cap-process.wit +25 -0
- package/go/wit/deps/pty/pty.wit +80 -0
- package/go/wit/deps/random/insecure-seed.wit +25 -0
- package/go/wit/deps/random/insecure.wit +22 -0
- package/go/wit/deps/random/random.wit +26 -0
- package/go/wit/deps/random/world.wit +7 -0
- package/go/wit/deps/sockets/instance-network.wit +9 -0
- package/go/wit/deps/sockets/ip-name-lookup.wit +51 -0
- package/go/wit/deps/sockets/network.wit +145 -0
- package/go/wit/deps/sockets/tcp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/tcp.wit +353 -0
- package/go/wit/deps/sockets/udp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/udp.wit +266 -0
- package/go/wit/deps/sockets/world.wit +11 -0
- package/go/wit/deps/task/cap-task.wit +56 -0
- package/go/wit/deps/timer/cap-timer.wit +14 -0
- package/go/wit/deps/wasi-cli/command.wit +7 -0
- package/go/wit/deps/wasi-cli/environment.wit +18 -0
- package/go/wit/deps/wasi-cli/exit.wit +4 -0
- package/go/wit/deps/wasi-cli/imports.wit +20 -0
- package/go/wit/deps/wasi-cli/run.wit +4 -0
- package/go/wit/deps/wasi-cli/stdio.wit +17 -0
- package/go/wit/deps/wasi-cli/terminal.wit +49 -0
- package/go/wit/deps/ws/ws.wit +50 -0
- package/go/wit/deps/ws-server/cap-ws.wit +99 -0
- package/go/wit/go-plugin.wit +28 -0
- package/go/wit/plugin-face.wit +355 -0
- package/go/wit/wasmnest.wit +25 -0
- package/package.json +12 -1
- package/src/index.ts +8 -0
- package/src/types.ts +681 -630
- package/src/ui/AppUpdateSection.d.ts +44 -0
- package/src/ui/AppUpdateSection.vue +253 -0
- package/src/ui/NumberField.d.ts +49 -0
- package/src/ui/NumberField.vue +390 -0
- package/src/ui/Select.vue +4 -4
- package/src/update.ts +123 -0
- package/template/README.md +39 -39
- package/tools/componentize/Cargo.lock +30 -1
- package/tools/componentize/Cargo.toml +3 -0
- package/tools/componentize/src/main.rs +197 -94
- package/dev-shell/src/mock/agent-hub-commands.ts +0 -1065
- package/dev-shell/src/mock/agent-hub.ts +0 -42
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostconfig
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionStringShape is used for storage in variant or result types.
|
|
11
|
+
type OptionStringShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[string]{})]byte
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostconfig
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:plugin/host-config@0.1.0 get
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Get(key0 *uint8, key1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostconfig represents the imported interface "wasmnest:plugin/host-config@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 宿主配置读取(原 config.rs:config_get,key 为 ConfigKey::as_str 的字符串)
|
|
6
|
+
package hostconfig
|
|
7
|
+
|
|
8
|
+
import (
|
|
9
|
+
"go.bytecodealliance.org/cm"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
// Get represents the imported function "get".
|
|
13
|
+
//
|
|
14
|
+
// get: func(key: string) -> result<option<string>, string>
|
|
15
|
+
//
|
|
16
|
+
//go:nosplit
|
|
17
|
+
func Get(key string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
18
|
+
key0, key1 := cm.LowerString(key)
|
|
19
|
+
wasmimport_Get((*uint8)(key0), (uint32)(key1), &result)
|
|
20
|
+
return
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostevents
|
|
4
|
+
|
|
5
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
6
|
+
|
|
7
|
+
//go:wasmimport wasmnest:plugin/host-events@0.1.0 emit
|
|
8
|
+
//go:noescape
|
|
9
|
+
func wasmimport_Emit(eventName0 *uint8, eventName1 uint32, payloadJson0 *uint8, payloadJson1 uint32)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostevents represents the imported interface "wasmnest:plugin/host-events@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 事件(原 events.rs:emit_event;broadcast-sync 随 websocket 业务下沉
|
|
6
|
+
// 退役——插件事件走 bus/emit,宿主不再持同步广播面)
|
|
7
|
+
//
|
|
8
|
+
// 双端交集切片:原桌面独有 `notify` 已按功能级交集统一进共享域契约
|
|
9
|
+
// `host-notify`(真源 `packages/wasmnest-notify-engine/wit/notify.wit`,ADR 0052 D3;
|
|
10
|
+
// 桌面 `host-events-desktop` 随之退役),本接口只剩双端交集 `emit`。
|
|
11
|
+
package hostevents
|
|
12
|
+
|
|
13
|
+
import (
|
|
14
|
+
"go.bytecodealliance.org/cm"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
// Emit represents the imported function "emit".
|
|
18
|
+
//
|
|
19
|
+
// emit: func(event-name: string, payload-json: string)
|
|
20
|
+
//
|
|
21
|
+
//go:nosplit
|
|
22
|
+
func Emit(eventName string, payloadJSON string) {
|
|
23
|
+
eventName0, eventName1 := cm.LowerString(eventName)
|
|
24
|
+
payloadJson0, payloadJson1 := cm.LowerString(payloadJSON)
|
|
25
|
+
wasmimport_Emit((*uint8)(eventName0), (uint32)(eventName1), (*uint8)(payloadJson0), (uint32)(payloadJson1))
|
|
26
|
+
return
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostfs
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionStringShape is used for storage in variant or result types.
|
|
11
|
+
type OptionStringShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[string]{})]byte
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostfs
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:plugin/host-fs@0.1.0 read
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Read(path0 *uint8, path1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-fs@0.1.0 write
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Write(path0 *uint8, path1 uint32, data0 *uint8, data1 uint32, result *cm.Result[string, struct{}, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-fs@0.1.0 copy
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Copy(src0 *uint8, src1 uint32, dst0 *uint8, dst1 uint32, result *cm.Result[string, struct{}, string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:plugin/host-fs@0.1.0 delete
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_Delete(path0 *uint8, path1 uint32, result *cm.Result[string, struct{}, string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:plugin/host-fs@0.1.0 exists
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_Exists(path0 *uint8, path1 uint32, result *cm.Result[string, bool, string])
|
|
30
|
+
|
|
31
|
+
//go:wasmimport wasmnest:plugin/host-fs@0.1.0 request-auth
|
|
32
|
+
//go:noescape
|
|
33
|
+
func wasmimport_RequestAuth(pathsJson0 *uint8, pathsJson1 uint32, result *cm.Result[string, bool, string])
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostfs represents the imported interface "wasmnest:plugin/host-fs@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 文件系统访问(原 fs.rs:fs_read/write/copy/delete/exists;双端交集 6 函数)
|
|
6
|
+
//
|
|
7
|
+
// 双端交集切片:桌面独有 `read-dir` / `canonicalize` / `stat`
|
|
8
|
+
// (文件浏览域)拆入 [`host-fs-desktop`](cap-desktop 分片),移动端独有
|
|
9
|
+
// `save-to-document` / `write-media-downloads` 拆入 [`host-fs-mobile`]
|
|
10
|
+
// (cap-mobile 分片),本接口只剩双端交集。
|
|
11
|
+
package hostfs
|
|
12
|
+
|
|
13
|
+
import (
|
|
14
|
+
"go.bytecodealliance.org/cm"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
// Read represents the imported function "read".
|
|
18
|
+
//
|
|
19
|
+
// read: func(path: string) -> result<option<string>, string>
|
|
20
|
+
//
|
|
21
|
+
//go:nosplit
|
|
22
|
+
func Read(path string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
23
|
+
path0, path1 := cm.LowerString(path)
|
|
24
|
+
wasmimport_Read((*uint8)(path0), (uint32)(path1), &result)
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Write represents the imported function "write".
|
|
29
|
+
//
|
|
30
|
+
// write: func(path: string, data: string) -> result<_, string>
|
|
31
|
+
//
|
|
32
|
+
//go:nosplit
|
|
33
|
+
func Write(path string, data string) (result cm.Result[string, struct{}, string]) {
|
|
34
|
+
path0, path1 := cm.LowerString(path)
|
|
35
|
+
data0, data1 := cm.LowerString(data)
|
|
36
|
+
wasmimport_Write((*uint8)(path0), (uint32)(path1), (*uint8)(data0), (uint32)(data1), &result)
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Copy represents the imported function "copy".
|
|
41
|
+
//
|
|
42
|
+
// copy: func(src: string, dst: string) -> result<_, string>
|
|
43
|
+
//
|
|
44
|
+
//go:nosplit
|
|
45
|
+
func Copy(src string, dst string) (result cm.Result[string, struct{}, string]) {
|
|
46
|
+
src0, src1 := cm.LowerString(src)
|
|
47
|
+
dst0, dst1 := cm.LowerString(dst)
|
|
48
|
+
wasmimport_Copy((*uint8)(src0), (uint32)(src1), (*uint8)(dst0), (uint32)(dst1), &result)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Delete represents the imported function "delete".
|
|
53
|
+
//
|
|
54
|
+
// delete: func(path: string) -> result<_, string>
|
|
55
|
+
//
|
|
56
|
+
//go:nosplit
|
|
57
|
+
func Delete(path string) (result cm.Result[string, struct{}, string]) {
|
|
58
|
+
path0, path1 := cm.LowerString(path)
|
|
59
|
+
wasmimport_Delete((*uint8)(path0), (uint32)(path1), &result)
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Exists represents the imported function "exists".
|
|
64
|
+
//
|
|
65
|
+
// exists: func(path: string) -> result<bool, string>
|
|
66
|
+
//
|
|
67
|
+
//go:nosplit
|
|
68
|
+
func Exists(path string) (result cm.Result[string, bool, string]) {
|
|
69
|
+
path0, path1 := cm.LowerString(path)
|
|
70
|
+
wasmimport_Exists((*uint8)(path0), (uint32)(path1), &result)
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// RequestAuth represents the imported function "request-auth".
|
|
75
|
+
//
|
|
76
|
+
// 批量请求目录授权:未授权路径合并为一次用户弹窗,阻塞等待答复
|
|
77
|
+
// (paths-json 为 JSON 字符串数组;返回是否全部同意)
|
|
78
|
+
//
|
|
79
|
+
// request-auth: func(paths-json: string) -> result<bool, string>
|
|
80
|
+
//
|
|
81
|
+
//go:nosplit
|
|
82
|
+
func RequestAuth(pathsJSON string) (result cm.Result[string, bool, string]) {
|
|
83
|
+
pathsJson0, pathsJson1 := cm.LowerString(pathsJSON)
|
|
84
|
+
wasmimport_RequestAuth((*uint8)(pathsJson0), (uint32)(pathsJson1), &result)
|
|
85
|
+
return
|
|
86
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostlog
|
|
4
|
+
|
|
5
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
6
|
+
|
|
7
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 info
|
|
8
|
+
//go:noescape
|
|
9
|
+
func wasmimport_Info(message0 *uint8, message1 uint32)
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 debug
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Debug(message0 *uint8, message1 uint32)
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 warn
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Warn(message0 *uint8, message1 uint32)
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 error
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Error(message0 *uint8, message1 uint32)
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:plugin/host-log@0.1.0 mark-plugin-error
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_MarkPluginError(error0 *uint8, error1 uint32)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostlog represents the imported interface "wasmnest:plugin/host-log@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 宿主日志与插件状态上报(原 log.rs + status.rs)
|
|
6
|
+
package hostlog
|
|
7
|
+
|
|
8
|
+
import (
|
|
9
|
+
"go.bytecodealliance.org/cm"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
// Info represents the imported function "info".
|
|
13
|
+
//
|
|
14
|
+
// info: func(message: string)
|
|
15
|
+
//
|
|
16
|
+
//go:nosplit
|
|
17
|
+
func Info(message string) {
|
|
18
|
+
message0, message1 := cm.LowerString(message)
|
|
19
|
+
wasmimport_Info((*uint8)(message0), (uint32)(message1))
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Debug represents the imported function "debug".
|
|
24
|
+
//
|
|
25
|
+
// debug: func(message: string)
|
|
26
|
+
//
|
|
27
|
+
//go:nosplit
|
|
28
|
+
func Debug(message string) {
|
|
29
|
+
message0, message1 := cm.LowerString(message)
|
|
30
|
+
wasmimport_Debug((*uint8)(message0), (uint32)(message1))
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Warn represents the imported function "warn".
|
|
35
|
+
//
|
|
36
|
+
// warn: func(message: string)
|
|
37
|
+
//
|
|
38
|
+
//go:nosplit
|
|
39
|
+
func Warn(message string) {
|
|
40
|
+
message0, message1 := cm.LowerString(message)
|
|
41
|
+
wasmimport_Warn((*uint8)(message0), (uint32)(message1))
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Error represents the imported function "error".
|
|
46
|
+
//
|
|
47
|
+
// error: func(message: string)
|
|
48
|
+
//
|
|
49
|
+
//go:nosplit
|
|
50
|
+
func Error(message string) {
|
|
51
|
+
message0, message1 := cm.LowerString(message)
|
|
52
|
+
wasmimport_Error((*uint8)(message0), (uint32)(message1))
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// MarkPluginError represents the imported function "mark-plugin-error".
|
|
57
|
+
//
|
|
58
|
+
// mark-plugin-error: func(error: string)
|
|
59
|
+
//
|
|
60
|
+
//go:nosplit
|
|
61
|
+
func MarkPluginError(error_ string) {
|
|
62
|
+
error0, error1 := cm.LowerString(error_)
|
|
63
|
+
wasmimport_MarkPluginError((*uint8)(error0), (uint32)(error1))
|
|
64
|
+
return
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostmetrics
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:plugin/host-metrics@0.1.0 snapshot
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Snapshot(result *cm.Result[string, string, string])
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostmetrics represents the imported interface "wasmnest:plugin/host-metrics@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 运行监控(core-monitor):只读运行时指标快照
|
|
6
|
+
//
|
|
7
|
+
// **权限 `metrics:read`(manifest 必须单独声明)**:未声明即 `Err`。
|
|
8
|
+
// 返回 JSON 字符串,形状与内核 `MetricsRegistry::snapshot()` 逐字一致:
|
|
9
|
+
// `{ "plugins": { "<plugin_id>": {...} }, "<source>": {...} }`——每插件段含
|
|
10
|
+
// 内存 current/peak、调用次数/在飞数、燃料总量、耗时 total/max/直方图、
|
|
11
|
+
// trap 原因分布、生命周期计数与最近时间、授权决策、总线背压、配额上限。
|
|
12
|
+
//
|
|
13
|
+
// 语义边界:
|
|
14
|
+
// - **只读**:不重置任何计数器,不影响被观测插件;
|
|
15
|
+
// - **无业务内容**:只有数值计数与 plugin_id / 枚举键,不含会话文本、文件内容、
|
|
16
|
+
// 凭据或任何应用数据;
|
|
17
|
+
// - **全局可见**:授权一次即可读**所有已加载插件**的聚合指标(监控用途所需),
|
|
18
|
+
// 因此可据此推断其他应用的活跃度(侧信道)——权限描述已写明;
|
|
19
|
+
// - 快照源未装配(无头 / 测试上下文)时 `Err`(fail-visible,不返回空对象冒充)。
|
|
20
|
+
package hostmetrics
|
|
21
|
+
|
|
22
|
+
import (
|
|
23
|
+
"go.bytecodealliance.org/cm"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
// Snapshot represents the imported function "snapshot".
|
|
27
|
+
//
|
|
28
|
+
// snapshot: func() -> result<string, string>
|
|
29
|
+
//
|
|
30
|
+
//go:nosplit
|
|
31
|
+
func Snapshot() (result cm.Result[string, string, string]) {
|
|
32
|
+
wasmimport_Snapshot(&result)
|
|
33
|
+
return
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostplatform
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:plugin/host-platform@0.1.0 pick-files
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_PickFiles(result *cm.Result[string, string, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-platform@0.1.0 pick-folders
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_PickFolders(result *cm.Result[string, string, string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-platform@0.1.0 platform
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_Platform(result *string)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostplatform represents the imported interface "wasmnest:plugin/host-platform@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 通用平台能力域(ADR 0022 v2):系统对话框/授权等与领域无关的平台交互
|
|
6
|
+
//
|
|
7
|
+
// 双端交集切片:桌面独有 `wsl-distros` / `local-ipv4-addresses` /
|
|
8
|
+
// `reveal-in-dir` 拆入 [`host-platform-desktop`](cap-desktop 分片),
|
|
9
|
+
// 本接口承载双端交集的 `pick-files` / `pick-folders`,外加双端全等的
|
|
10
|
+
// `platform`(宿主平台标识探测)。
|
|
11
|
+
//
|
|
12
|
+
// **目录选择已按功能级统一**(2026-10-13,ADR 0052 D3):原 `pick-folder`
|
|
13
|
+
// (单目录字符串,双端)与桌面 `host-platform-desktop.pick-folders`
|
|
14
|
+
// (多目录 JSON)是同一功能的两种形状 → 统一为本接口的 `pick-folders`
|
|
15
|
+
// (`string[]` JSON;移动 SAF 目录树选择器为单选语义,返回 0/1 项)。
|
|
16
|
+
package hostplatform
|
|
17
|
+
|
|
18
|
+
import (
|
|
19
|
+
"go.bytecodealliance.org/cm"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
// PickFiles represents the imported function "pick-files".
|
|
23
|
+
//
|
|
24
|
+
// 系统多文件选择器 → string[] JSON(用户取消为空数组)。
|
|
25
|
+
//
|
|
26
|
+
// **权限 `fs:pick`(manifest 必须单独声明)**:未声明即 `Err`,且**不弹对话框**
|
|
27
|
+
// ——「能调起选择器」与「能读写任意路径」是两种权力,合成一位会让只想让用户
|
|
28
|
+
// 挑一个文件的插件被动获得全盘读取面(权限位判据见 SDK `PERMISSION_FS_PICK`)。
|
|
29
|
+
//
|
|
30
|
+
// **浏览面不设限、结果面设门**:系统原生对话框(Windows IFileDialog /
|
|
31
|
+
// Linux xdg-desktop-portal)允许用户浏览**任意**位置——浏览由用户在系统
|
|
32
|
+
// 对话框里驱动,宿主不读任何数据;选择结束后宿主才对**选中的路径**做
|
|
33
|
+
// `fs_auth` 授权校验(见下)。
|
|
34
|
+
//
|
|
35
|
+
// **选择后的授权校验**(本原语契约的另一半,缺一不可):
|
|
36
|
+
// - 选中路径命中**已授权目录**前缀(或第一方归属目录)→ 静默放行,不再弹框;
|
|
37
|
+
// - 存在未授权路径 → 就未授权部分弹**一次**授权框(多路径合并一次询问);
|
|
38
|
+
// - 用户拒绝 / 超时 / 无弹窗通道(无头上下文)→ `Err`,**不回传任何路径**
|
|
39
|
+
// (fail-visible:不得把「弹了框被拒」降级成空数组)。
|
|
40
|
+
// 「记住」按**所在目录**落账(文件 → 父目录,目录 → 自身),使同目录下的
|
|
41
|
+
// 后续选择免弹。
|
|
42
|
+
//
|
|
43
|
+
// 授权只交付「可访问用户亲手选中的路径」这一层;实际读 / 写仍分别要
|
|
44
|
+
// `fs:read` / `fs:write`(`pick-*` 不隐含读写位)。
|
|
45
|
+
//
|
|
46
|
+
// pick-files: func() -> result<string, string>
|
|
47
|
+
//
|
|
48
|
+
//go:nosplit
|
|
49
|
+
func PickFiles() (result cm.Result[string, string, string]) {
|
|
50
|
+
wasmimport_PickFiles(&result)
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// PickFolders represents the imported function "pick-folders".
|
|
55
|
+
//
|
|
56
|
+
// 系统文件夹选择器(多选)→ string[] JSON;用户取消返回空数组。
|
|
57
|
+
// 权限 `fs:pick` + 选择后授权校验(授权落账到所选目录本身),口径同
|
|
58
|
+
// `pick-files`。移动端为 SAF 目录树选择器(单选语义),返回 0/1 个
|
|
59
|
+
// 树 URI。
|
|
60
|
+
//
|
|
61
|
+
// pick-folders: func() -> result<string, string>
|
|
62
|
+
//
|
|
63
|
+
//go:nosplit
|
|
64
|
+
func PickFolders() (result cm.Result[string, string, string]) {
|
|
65
|
+
wasmimport_PickFolders(&result)
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Platform represents the imported function "platform".
|
|
70
|
+
//
|
|
71
|
+
// 宿主平台标识探测(双端全等;**无权限门**——平台事实不是能力,ADR 0022 裁剪线)。
|
|
72
|
+
//
|
|
73
|
+
// 取值由各端宿主定义(当前约定:桌面 `desktop` / 移动 `mobile`);guest 用于
|
|
74
|
+
// 运行期平台分支——双端共享 wasm 产物(如 file-transfer 单产物,规格
|
|
75
|
+
// `.scratch/2026-10-13-file-transfer-single-wasm/spec.md`)据此在同一 trait
|
|
76
|
+
// 的双实现间选择,无需双份产物。空/未知取值时 guest 侧按 fail-visible
|
|
77
|
+
// 处理(显性报错,不猜默认平台——猜错会把桌面分支静默跑在移动宿主上)。
|
|
78
|
+
//
|
|
79
|
+
// platform: func() -> string
|
|
80
|
+
//
|
|
81
|
+
//go:nosplit
|
|
82
|
+
func Platform() (result string) {
|
|
83
|
+
wasmimport_Platform(&result)
|
|
84
|
+
return
|
|
85
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostplugindatabase
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionStringShape is used for storage in variant or result types.
|
|
11
|
+
type OptionStringShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[string]{})]byte
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hostplugindatabase
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// This file contains wasmimport and wasmexport declarations for "wasmnest:plugin@0.1.0".
|
|
10
|
+
|
|
11
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 execute
|
|
12
|
+
//go:noescape
|
|
13
|
+
func wasmimport_Execute(sql0 *uint8, sql1 uint32, result *cm.Result[string, uint32, string])
|
|
14
|
+
|
|
15
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 query
|
|
16
|
+
//go:noescape
|
|
17
|
+
func wasmimport_Query(sql0 *uint8, sql1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
18
|
+
|
|
19
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 execute-params
|
|
20
|
+
//go:noescape
|
|
21
|
+
func wasmimport_ExecuteParams(sql0 *uint8, sql1 uint32, paramsJson0 *uint8, paramsJson1 uint32, result *cm.Result[string, uint32, string])
|
|
22
|
+
|
|
23
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 query-params
|
|
24
|
+
//go:noescape
|
|
25
|
+
func wasmimport_QueryParams(sql0 *uint8, sql1 uint32, paramsJson0 *uint8, paramsJson1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], string])
|
|
26
|
+
|
|
27
|
+
//go:wasmimport wasmnest:plugin/host-plugin-database@0.1.0 execute-batch
|
|
28
|
+
//go:noescape
|
|
29
|
+
func wasmimport_ExecuteBatch(sqlsJson0 *uint8, sqlsJson1 uint32, result *cm.Result[string, uint32, string])
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
// Package hostplugindatabase represents the imported interface "wasmnest:plugin/host-plugin-database@0.1.0".
|
|
4
|
+
//
|
|
5
|
+
// 插件独立数据库(原 database.rs:plugin_db_*)
|
|
6
|
+
package hostplugindatabase
|
|
7
|
+
|
|
8
|
+
import (
|
|
9
|
+
"go.bytecodealliance.org/cm"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
// Execute represents the imported function "execute".
|
|
13
|
+
//
|
|
14
|
+
// execute: func(sql: string) -> result<u32, string>
|
|
15
|
+
//
|
|
16
|
+
//go:nosplit
|
|
17
|
+
func Execute(sql string) (result cm.Result[string, uint32, string]) {
|
|
18
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
19
|
+
wasmimport_Execute((*uint8)(sql0), (uint32)(sql1), &result)
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Query represents the imported function "query".
|
|
24
|
+
//
|
|
25
|
+
// query: func(sql: string) -> result<option<string>, string>
|
|
26
|
+
//
|
|
27
|
+
//go:nosplit
|
|
28
|
+
func Query(sql string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
29
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
30
|
+
wasmimport_Query((*uint8)(sql0), (uint32)(sql1), &result)
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ExecuteParams represents the imported function "execute-params".
|
|
35
|
+
//
|
|
36
|
+
// execute-params: func(sql: string, params-json: string) -> result<u32, string>
|
|
37
|
+
//
|
|
38
|
+
//go:nosplit
|
|
39
|
+
func ExecuteParams(sql string, paramsJSON string) (result cm.Result[string, uint32, string]) {
|
|
40
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
41
|
+
paramsJson0, paramsJson1 := cm.LowerString(paramsJSON)
|
|
42
|
+
wasmimport_ExecuteParams((*uint8)(sql0), (uint32)(sql1), (*uint8)(paramsJson0), (uint32)(paramsJson1), &result)
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// QueryParams represents the imported function "query-params".
|
|
47
|
+
//
|
|
48
|
+
// query-params: func(sql: string, params-json: string) -> result<option<string>,
|
|
49
|
+
// string>
|
|
50
|
+
//
|
|
51
|
+
//go:nosplit
|
|
52
|
+
func QueryParams(sql string, paramsJSON string) (result cm.Result[OptionStringShape, cm.Option[string], string]) {
|
|
53
|
+
sql0, sql1 := cm.LowerString(sql)
|
|
54
|
+
paramsJson0, paramsJson1 := cm.LowerString(paramsJSON)
|
|
55
|
+
wasmimport_QueryParams((*uint8)(sql0), (uint32)(sql1), (*uint8)(paramsJson0), (uint32)(paramsJson1), &result)
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ExecuteBatch represents the imported function "execute-batch".
|
|
60
|
+
//
|
|
61
|
+
// 事务内顺序执行多语句(sqls-json 为 SQL 字符串数组),返回受影响行数合计
|
|
62
|
+
//
|
|
63
|
+
// execute-batch: func(sqls-json: string) -> result<u32, string>
|
|
64
|
+
//
|
|
65
|
+
//go:nosplit
|
|
66
|
+
func ExecuteBatch(sqlsJSON string) (result cm.Result[string, uint32, string]) {
|
|
67
|
+
sqlsJson0, sqlsJson1 := cm.LowerString(sqlsJSON)
|
|
68
|
+
wasmimport_ExecuteBatch((*uint8)(sqlsJson0), (uint32)(sqlsJson1), &result)
|
|
69
|
+
return
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
package hoststorage
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"go.bytecodealliance.org/cm"
|
|
7
|
+
"unsafe"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// OptionStringShape is used for storage in variant or result types.
|
|
11
|
+
type OptionStringShape struct {
|
|
12
|
+
_ cm.HostLayout
|
|
13
|
+
shape [unsafe.Sizeof(cm.Option[string]{})]byte
|
|
14
|
+
}
|