diff --git a/component/cm/README.md b/component/cm/README.md new file mode 100644 index 00000000..3ee7cfbe --- /dev/null +++ b/component/cm/README.md @@ -0,0 +1,10 @@ +Vendored version of `go.bytecodealliance.org/cm` and published under `go.wasmcloud.dev/component/cm`. + +This package is included in bindings generated by `go.wasmcloud.dev/component/wit-bindgen`. + +Do not use it if you generate bindings with the upstream `go.bytecodealliance.org/cmd/wit-bindgen-go`. + +## Differences + +- codegen & cm packages locked to wasmcloud component-sdk version +- JSON marshaling for Option types diff --git a/component/cm/abi.go b/component/cm/abi.go new file mode 100644 index 00000000..4d630367 --- /dev/null +++ b/component/cm/abi.go @@ -0,0 +1,142 @@ +package cm + +import "unsafe" + +// AnyInteger is a type constraint for any integer type. +type AnyInteger interface { + ~int | ~uint | ~uintptr | ~int8 | ~uint8 | ~int16 | ~uint16 | ~int32 | ~uint32 | ~int64 | ~uint64 +} + +// Reinterpret reinterprets the bits of type From into type T. +// Will panic if the size of From is smaller than the size of To. +func Reinterpret[T, From any](from From) (to T) { + if unsafe.Sizeof(to) > unsafe.Sizeof(from) { + panic("reinterpret: size of to > from") + } + return *(*T)(unsafe.Pointer(&from)) +} + +// LowerString lowers a [string] into a pair of Core WebAssembly types. +// +// [string]: https://pkg.go.dev/builtin#string +func LowerString[S ~string](s S) (*byte, uint32) { + return unsafe.StringData(string(s)), uint32(len(s)) +} + +// LiftString lifts Core WebAssembly types into a [string]. +func LiftString[T ~string, Data unsafe.Pointer | uintptr | *uint8, Len AnyInteger](data Data, len Len) T { + return T(unsafe.String((*uint8)(unsafe.Pointer(data)), int(len))) +} + +// LowerList lowers a [List] into a pair of Core WebAssembly types. +func LowerList[L AnyList[T], T any](list L) (*T, uint32) { + l := (*List[T])(unsafe.Pointer(&list)) + return l.data, uint32(l.len) +} + +// LiftList lifts Core WebAssembly types into a [List]. +func LiftList[L AnyList[T], T any, Data unsafe.Pointer | uintptr | *T, Len AnyInteger](data Data, len Len) L { + return L(NewList((*T)(unsafe.Pointer(data)), len)) +} + +// BoolToU32 converts a value whose underlying type is [bool] into a [uint32]. +// Used to lower a [bool] into a Core WebAssembly i32 as specified in the [Canonical ABI]. +// +// [bool]: https://pkg.go.dev/builtin#bool +// [uint32]: https://pkg.go.dev/builtin#uint32 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func BoolToU32[B ~bool](v B) uint32 { return uint32(*(*uint8)(unsafe.Pointer(&v))) } + +// U32ToBool converts a [uint32] into a [bool]. +// Used to lift a Core WebAssembly i32 into a [bool] as specified in the [Canonical ABI]. +// +// [uint32]: https://pkg.go.dev/builtin#uint32 +// [bool]: https://pkg.go.dev/builtin#bool +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func U32ToBool(v uint32) bool { tmp := uint8(v); return *(*bool)(unsafe.Pointer(&tmp)) } + +// F32ToU32 maps the bits of a [float32] into a [uint32]. +// Used to lower a [float32] into a Core WebAssembly i32 as specified in the [Canonical ABI]. +// +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +// [float32]: https://pkg.go.dev/builtin#float32 +// [uint32]: https://pkg.go.dev/builtin#uint32 +func F32ToU32(v float32) uint32 { return *(*uint32)(unsafe.Pointer(&v)) } + +// U32ToF32 maps the bits of a [uint32] into a [float32]. +// Used to lift a Core WebAssembly i32 into a [float32] as specified in the [Canonical ABI]. +// +// [uint32]: https://pkg.go.dev/builtin#uint32 +// [float32]: https://pkg.go.dev/builtin#float32 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func U32ToF32(v uint32) float32 { return *(*float32)(unsafe.Pointer(&v)) } + +// F64ToU64 maps the bits of a [float64] into a [uint64]. +// Used to lower a [float64] into a Core WebAssembly i64 as specified in the [Canonical ABI]. +// +// [float64]: https://pkg.go.dev/builtin#float64 +// [uint64]: https://pkg.go.dev/builtin#uint64 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +// +// [uint32]: https://pkg.go.dev/builtin#uint32 +func F64ToU64(v float64) uint64 { return *(*uint64)(unsafe.Pointer(&v)) } + +// U64ToF64 maps the bits of a [uint64] into a [float64]. +// Used to lift a Core WebAssembly i64 into a [float64] as specified in the [Canonical ABI]. +// +// [uint64]: https://pkg.go.dev/builtin#uint64 +// [float64]: https://pkg.go.dev/builtin#float64 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func U64ToF64(v uint64) float64 { return *(*float64)(unsafe.Pointer(&v)) } + +// F32ToU64 maps the bits of a [float32] into a [uint64]. +// Used to lower a [float32] into a Core WebAssembly i64 when required by the [Canonical ABI]. +// +// [float32]: https://pkg.go.dev/builtin#float32 +// [uint64]: https://pkg.go.dev/builtin#uint64 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func F32ToU64(v float32) uint64 { return uint64(*(*uint32)(unsafe.Pointer(&v))) } + +// U64ToF32 maps the bits of a [uint64] into a [float32]. +// Used to lift a Core WebAssembly i64 into a [float32] when required by the [Canonical ABI]. +// +// [uint64]: https://pkg.go.dev/builtin#uint64 +// [float32]: https://pkg.go.dev/builtin#float32 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func U64ToF32(v uint64) float32 { + truncated := uint32(v) + return *(*float32)(unsafe.Pointer(&truncated)) +} + +// PointerToU32 converts a pointer of type *T into a [uint32]. +// Used to lower a pointer into a Core WebAssembly i32 as specified in the [Canonical ABI]. +// +// [uint32]: https://pkg.go.dev/builtin#uint32 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func PointerToU32[T any](v *T) uint32 { return uint32(uintptr(unsafe.Pointer(v))) } + +// U32ToPointer converts a [uint32] into a pointer of type *T. +// Used to lift a Core WebAssembly i32 into a pointer as specified in the [Canonical ABI]. +// +// [uint32]: https://pkg.go.dev/builtin#uint32 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func U32ToPointer[T any](v uint32) *T { return (*T)(unsafePointer(uintptr(v))) } + +// PointerToU64 converts a pointer of type *T into a [uint64]. +// Used to lower a pointer into a Core WebAssembly i64 as specified in the [Canonical ABI]. +// +// [uint64]: https://pkg.go.dev/builtin#uint64 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func PointerToU64[T any](v *T) uint64 { return uint64(uintptr(unsafe.Pointer(v))) } + +// U64ToPointer converts a [uint64] into a pointer of type *T. +// Used to lift a Core WebAssembly i64 into a pointer as specified in the [Canonical ABI]. +// +// [uint64]: https://pkg.go.dev/builtin#uint64 +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +func U64ToPointer[T any](v uint64) *T { return (*T)(unsafePointer(uintptr(v))) } + +// Appease vet, see https://github.com/golang/go/issues/58625 +func unsafePointer(p uintptr) unsafe.Pointer { + return *(*unsafe.Pointer)(unsafe.Pointer(&p)) +} diff --git a/component/cm/abi_test.go b/component/cm/abi_test.go new file mode 100644 index 00000000..5c00fde5 --- /dev/null +++ b/component/cm/abi_test.go @@ -0,0 +1,83 @@ +package cm + +import ( + "math" + "testing" +) + +func TestIntConversions(t *testing.T) { + for i := int8(math.MinInt8); i < math.MaxInt8; i++ { + testIntRoundTrip[uint32](t, i) + testIntRoundTrip[uint64](t, i) + } + + for i := uint8(0); i < math.MaxUint8; i++ { + testIntRoundTrip[uint32](t, i) + testIntRoundTrip[uint64](t, i) + } + + for i := int16(math.MinInt16); i < math.MaxInt16; i++ { + testIntRoundTrip[uint32](t, i) + testIntRoundTrip[uint64](t, i) + } + + for i := uint16(0); i < math.MaxUint16; i++ { + testIntRoundTrip[uint32](t, i) + testIntRoundTrip[uint64](t, i) + } + + // int32/uint32 into uint32 + testIntRoundTrip[uint32](t, int32(0)) + testIntRoundTrip[uint32](t, int32(math.MinInt8)) + testIntRoundTrip[uint32](t, int32(math.MinInt16)) + testIntRoundTrip[uint32](t, int32(math.MinInt32)) + testIntRoundTrip[uint32](t, int32(math.MaxInt8)) + testIntRoundTrip[uint32](t, int32(math.MaxInt16)) + testIntRoundTrip[uint32](t, int32(math.MaxInt32)) + testIntRoundTrip[uint32](t, uint32(0)) + testIntRoundTrip[uint32](t, uint32(math.MaxUint8)) + testIntRoundTrip[uint32](t, uint32(math.MaxUint16)) + testIntRoundTrip[uint32](t, uint32(math.MaxUint32)) + + // int32/uint32 into uint64 + testIntRoundTrip[uint64](t, int32(0)) + testIntRoundTrip[uint64](t, int32(math.MinInt8)) + testIntRoundTrip[uint64](t, int32(math.MinInt16)) + testIntRoundTrip[uint64](t, int32(math.MinInt32)) + testIntRoundTrip[uint64](t, int32(math.MaxInt8)) + testIntRoundTrip[uint64](t, int32(math.MaxInt16)) + testIntRoundTrip[uint64](t, int32(math.MaxInt32)) + testIntRoundTrip[uint64](t, uint32(0)) + testIntRoundTrip[uint64](t, uint32(math.MaxUint8)) + testIntRoundTrip[uint64](t, uint32(math.MaxUint16)) + testIntRoundTrip[uint64](t, uint32(math.MaxUint32)) + + // int64/uint64 into uint64 + testIntRoundTrip[uint64](t, int64(0)) + testIntRoundTrip[uint64](t, int64(math.MinInt8)) + testIntRoundTrip[uint64](t, int64(math.MinInt16)) + testIntRoundTrip[uint64](t, int64(math.MinInt32)) + testIntRoundTrip[uint64](t, int64(math.MaxInt8)) + testIntRoundTrip[uint64](t, int64(math.MaxInt16)) + testIntRoundTrip[uint64](t, int64(math.MaxInt32)) + testIntRoundTrip[uint64](t, uint64(0)) + testIntRoundTrip[uint64](t, uint64(math.MaxUint8)) + testIntRoundTrip[uint64](t, uint64(math.MaxUint16)) + testIntRoundTrip[uint64](t, uint64(math.MaxUint32)) +} + +func testIntRoundTrip[Core CoreIntegers, From Integers](t *testing.T, want From) { + core := Core(want) // Convert to a core integer type + got := From(core) // Convert back to original type + if got != want { + t.Errorf("testLowerLift[%T, %T](t, %v): got %v, expected %v", want, core, want, got, want) + } +} + +type Integers interface { + int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | uintptr +} + +type CoreIntegers interface { + uint32 | uint64 +} diff --git a/component/cm/case.go b/component/cm/case.go new file mode 100644 index 00000000..2ca7c28d --- /dev/null +++ b/component/cm/case.go @@ -0,0 +1,51 @@ +package cm + +// CaseUnmarshaler returns an function that can unmarshal text into +// [variant] or [enum] case T. +// +// [enum]: https://component-model.bytecodealliance.org/design/wit.html#enums +// [variant]: https://component-model.bytecodealliance.org/design/wit.html#variants +func CaseUnmarshaler[T ~uint8 | ~uint16 | ~uint32](cases []string) func(v *T, text []byte) error { + if len(cases) <= linearScanThreshold { + return func(v *T, text []byte) error { + if len(text) == 0 { + return &emptyTextError{} + } + s := string(text) + for i := 0; i < len(cases); i++ { + if cases[i] == s { + *v = T(i) + return nil + } + } + return &noMatchingCaseError{} + } + } + + m := make(map[string]T, len(cases)) + for i, v := range cases { + m[v] = T(i) + } + + return func(v *T, text []byte) error { + if len(text) == 0 { + return &emptyTextError{} + } + c, ok := m[string(text)] + if !ok { + return &noMatchingCaseError{} + } + *v = c + return nil + } +} + +const linearScanThreshold = 16 + +type emptyTextError struct{} + +func (*emptyTextError) Error() string { return "empty text" } + +type noMatchingCaseError struct{} + +func (*noMatchingCaseError) Error() string { return "no matching case" } diff --git a/component/cm/case_test.go b/component/cm/case_test.go new file mode 100644 index 00000000..4711684d --- /dev/null +++ b/component/cm/case_test.go @@ -0,0 +1,34 @@ +package cm + +import ( + "strings" + "testing" +) + +func TestCaseUnmarshaler(t *testing.T) { + tests := []struct { + name string + cases []string + }{ + {"nil", nil}, + {"empty slice", []string{}}, + {"a b c", strings.SplitAfter("abc", "")}, + {"a b c d e f g", strings.SplitAfter("abcdefg", "")}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := CaseUnmarshaler[uint8](tt.cases) + for want, c := range tt.cases { + var got uint8 + err := f(&got, []byte(c)) + if err != nil { + t.Error(err) + return + } + if got != uint8(want) { + t.Errorf("f(%q): got %d, expected %d", c, got, want) + } + } + }) + } +} diff --git a/component/cm/debug_test.go b/component/cm/debug_test.go new file mode 100644 index 00000000..d26e0fea --- /dev/null +++ b/component/cm/debug_test.go @@ -0,0 +1,61 @@ +package cm + +import ( + "reflect" + "strings" + "unsafe" +) + +func typeName(v any) string { + var name string + if t := reflect.TypeOf(v); t.Kind() == reflect.Ptr { + name = "*" + t.Elem().String() + } else { + name = t.String() + } + return strings.ReplaceAll(name, " ", "") +} + +func sizePlusAlignOf[T any]() uintptr { + var v T + return unsafe.Sizeof(v) + unsafe.Alignof(v) +} + +func alignOf[T any]() uintptr { + var v T + return unsafe.Alignof(v) +} + +func zeroPtr[T any]() *T { + var zero T + return &zero +} + +// TODO: remove this when TinyGo supports unsafe.Offsetof +func offsetOf[Struct any, Field any](s *Struct, f *Field) uintptr { + return uintptr(unsafe.Pointer(f)) - uintptr(unsafe.Pointer(s)) +} + +// VariantDebug is an interface used in tests to validate layout of variant types. +type VariantDebug interface { + Size() uintptr + DataAlign() uintptr + DataOffset() uintptr +} + +func (v variant[Disc, Shape, Align]) Size() uintptr { return unsafe.Sizeof(v) } +func (v variant[Disc, Shape, Align]) DataAlign() uintptr { return unsafe.Alignof(v.data) } +func (v variant[Disc, Shape, Align]) DataOffset() uintptr { return offsetOf(&v, &v.data) } + +// ResultDebug is an interface used in tests to validate layout of result types. +type ResultDebug interface { + VariantDebug +} + +func (r BoolResult) Size() uintptr { return unsafe.Sizeof(r) } +func (r BoolResult) DataAlign() uintptr { return 0 } +func (r BoolResult) DataOffset() uintptr { return 0 } + +func (r result[Shape, OK, Err]) Size() uintptr { return unsafe.Sizeof(r) } +func (r result[Shape, OK, Err]) DataAlign() uintptr { return unsafe.Alignof(r.data) } +func (r result[Shape, OK, Err]) DataOffset() uintptr { return offsetOf(&r, &r.data) } diff --git a/component/cm/dependencies_test.go b/component/cm/dependencies_test.go new file mode 100644 index 00000000..33be40ef --- /dev/null +++ b/component/cm/dependencies_test.go @@ -0,0 +1,28 @@ +//go:build !wasip1 && !wasip2 && !tinygo + +package cm + +import ( + "bytes" + "os/exec" + "strings" + "testing" +) + +func TestDependencies(t *testing.T) { + cmd := exec.Command("go", "list", "-f", "{{.Imports}}", "-tags", "module.std", ".") + stdout := &bytes.Buffer{} + cmd.Stdout = stdout + err := cmd.Run() + if err != nil { + t.Error(err) + return + } + + got := strings.TrimSpace(stdout.String()) + // const want = "[structs unsafe]" // Should not include "encoding/json" + const want = "[encoding/json structs unsafe]" // NOTE(lxf):wasmcloud vendored + if got != want { + t.Errorf("Expected dependencies %s, got %s", want, got) + } +} diff --git a/component/cm/docs.go b/component/cm/docs.go new file mode 100644 index 00000000..5522cf94 --- /dev/null +++ b/component/cm/docs.go @@ -0,0 +1,8 @@ +// Package cm provides types and functions for interfacing with the WebAssembly Component Model. +// +// The types in this package (such as [List], [Option], [Result], and [Variant]) are designed to match the memory layout +// of [Component Model] types as specified in the [Canonical ABI]. +// +// [Component Model]: https://component-model.bytecodealliance.org/introduction.html +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#alignment +package cm diff --git a/component/cm/empty.s b/component/cm/empty.s new file mode 100644 index 00000000..5444f200 --- /dev/null +++ b/component/cm/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. diff --git a/component/cm/error.go b/component/cm/error.go new file mode 100644 index 00000000..84b7fa4b --- /dev/null +++ b/component/cm/error.go @@ -0,0 +1,40 @@ +package cm + +import "unsafe" + +// ErrorContext represents the Component Model [error-context] type, +// an immutable, non-deterministic, host-defined value meant to aid in debugging. +// +// [error-context]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-context-type +type ErrorContext struct { + _ HostLayout + errorContext +} + +type errorContext uint32 + +// Error implements the [error] interface. It returns the debug message associated with err. +func (err errorContext) Error() string { + return err.DebugMessage() +} + +// String implements [fmt.Stringer]. +func (err errorContext) String() string { + return err.DebugMessage() +} + +// DebugMessage represents the Canonical ABI [error-context.debug-message] function. +// +// [error-context.debug-message]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdebug-message +func (err errorContext) DebugMessage() string { + var s string + wasmimport_errorContextDebugMessage(uint32(err), unsafe.Pointer(&s)) + return s +} + +// Drop represents the Canonical ABI [error-context.drop] function. +// +// [error-context.drop]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdrop +func (err errorContext) Drop() { + wasmimport_errorContextDrop(uint32(err)) +} diff --git a/component/cm/error.wasm.go b/component/cm/error.wasm.go new file mode 100644 index 00000000..63826734 --- /dev/null +++ b/component/cm/error.wasm.go @@ -0,0 +1,13 @@ +package cm + +import "unsafe" + +// msg uses unsafe.Pointer for compatibility with go1.23 and lower. +// +//go:wasmimport canon error-context.debug-message +//go:noescape +func wasmimport_errorContextDebugMessage(err uint32, msg unsafe.Pointer) + +//go:wasmimport canon error-context.drop +//go:noescape +func wasmimport_errorContextDrop(err uint32) diff --git a/component/cm/future.go b/component/cm/future.go new file mode 100644 index 00000000..e82183f6 --- /dev/null +++ b/component/cm/future.go @@ -0,0 +1,15 @@ +package cm + +// Future represents the Component Model [future] type. +// A future is a special case of stream. In non-error cases, +// a future delivers exactly one value before being automatically closed. +// +// [future]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#asynchronous-value-types +type Future[T any] struct { + _ HostLayout + future[T] +} + +type future[T any] uint32 + +// TODO: implement methods on type future diff --git a/component/cm/hostlayout.go b/component/cm/hostlayout.go new file mode 100644 index 00000000..60a2c4a5 --- /dev/null +++ b/component/cm/hostlayout.go @@ -0,0 +1,7 @@ +package cm + +import "structs" + +// HostLayout marks a struct as using host memory layout. +// See [structs.HostLayout] in Go 1.23 or later. +type HostLayout = structs.HostLayout diff --git a/component/cm/hostlayout_test.go b/component/cm/hostlayout_test.go new file mode 100644 index 00000000..84a2cdcd --- /dev/null +++ b/component/cm/hostlayout_test.go @@ -0,0 +1,122 @@ +package cm + +import ( + "runtime" + "testing" + "unsafe" +) + +func TestFieldAlignment(t *testing.T) { + var v1 struct { + _ HostLayout + _ bool + _ [0][7]byte + u64 uint64 + } + if got, want := unsafe.Sizeof(v1), uintptr(16); got != want { + t.Errorf("unsafe.Sizeof(v1): %d, expected %d", got, want) + } + if got, want := offsetOf(&v1, &v1.u64), uintptr(8); got != want { + t.Errorf("unsafe.Offsetof(v1.u64): %d, expected %d", got, want) + } + + var v2 struct { + _ HostLayout + _ bool + _ [0][7]byte + _ [0][51]float64 + _ [0]struct { + uint64 + _ []byte + } + u64 uint64 + } + if got, want := unsafe.Sizeof(v2), uintptr(16); got != want { + t.Errorf("unsafe.Sizeof(v2): %d, expected %d", got, want) + } + if got, want := offsetOf(&v2, &v2.u64), uintptr(8); got != want { + t.Errorf("unsafe.Offsetof(v2.u64): %d, expected %d", got, want) + } + + // size 1 + var v3 struct { + _ HostLayout + _ struct{} + b bool // offset 0 + } + if got, want := unsafe.Sizeof(v3), uintptr(1); got != want { + t.Errorf("unsafe.Sizeof(v3): %d, expected %d", got, want) + } + if got, want := offsetOf(&v3, &v3.b), uintptr(0); got != want { + t.Errorf("unsafe.Offsetof(v3.b): %d, expected %d", got, want) + } + + // size 0 + var v4 struct { + _ HostLayout + _ [0]uint32 + b bool // offset 0! + } + if got, want := unsafe.Sizeof(v4), uintptr(4); got != want { + t.Errorf("unsafe.Sizeof(v4): %d, expected %d", got, want) + } + if got, want := offsetOf(&v4, &v4.b), uintptr(0); got != want { + t.Errorf("unsafe.Offsetof(v4.b): %d, expected %d", got, want) + } +} + +// TestBool verifies that Go bool size, alignment, and values are consistent +// with the Component Model Canonical ABI. +func TestBool(t *testing.T) { + var b bool + if got, want := unsafe.Sizeof(b), uintptr(1); got != want { + t.Errorf("unsafe.Sizeof(b): %d, expected %d", got, want) + } + if got, want := unsafe.Alignof(b), uintptr(1); got != want { + t.Errorf("unsafe.Alignof(b): %d, expected %d", got, want) + } + + // uint8(false) == 0 + b = false + if got, want := *(*uint8)(unsafe.Pointer(&b)), uint8(0); got != want { + t.Errorf("uint8(b): %d, expected %d", got, want) + } + + // uint8(true) == 1 + b = true + if got, want := *(*uint8)(unsafe.Pointer(&b)), uint8(1); got != want { + t.Errorf("uint8(b): %d, expected %d", got, want) + } + + // low bit 1 == true + *(*uint8)(unsafe.Pointer(&b)) = 1 + if got, want := b, true; got != want { + t.Errorf("b == %t, expected %t", got, want) + } + + // low bit 1 == true + *(*uint8)(unsafe.Pointer(&b)) = 3 + if got, want := b, true; got != want { + t.Errorf("b == %t, expected %t", got, want) + } + + // low bit 1 == true + *(*uint8)(unsafe.Pointer(&b)) = 255 + if got, want := b, true; got != want { + t.Errorf("b == %t, expected %t", got, want) + } + + if runtime.GOARCH == "arm64" { + // low bit 0 == false + *(*uint8)(unsafe.Pointer(&b)) = 2 + if got, want := b, false; got != want { + t.Errorf("b == %t, expected %t", got, want) + } + + // low bit 0 == false + *(*uint8)(unsafe.Pointer(&b)) = 254 + if got, want := b, false; got != want { + t.Errorf("b == %t, expected %t", got, want) + } + } +} diff --git a/component/cm/list.go b/component/cm/list.go new file mode 100644 index 00000000..22d9d31f --- /dev/null +++ b/component/cm/list.go @@ -0,0 +1,62 @@ +package cm + +import ( + "unsafe" +) + +// List represents a Component Model list. +// The binary representation of list is similar to a Go slice minus the cap field. +type List[T any] struct { + _ HostLayout + list[T] +} + +// AnyList is a type constraint for generic functions that accept any [List] type. +type AnyList[T any] interface { + ~struct { + _ HostLayout + list[T] + } +} + +// NewList returns a List[T] from data and len. +func NewList[T any, Len AnyInteger](data *T, len Len) List[T] { + return List[T]{ + list: list[T]{ + data: data, + len: uintptr(len), + }, + } +} + +// ToList returns a List[T] equivalent to the Go slice s. +// The underlying slice data is not copied, and the resulting List points at the +// same array storage as the slice. +func ToList[S ~[]T, T any](s S) List[T] { + return NewList[T](unsafe.SliceData([]T(s)), uintptr(len(s))) +} + +// list represents the internal representation of a Component Model list. +// It is intended to be embedded in a [List], so embedding types maintain +// the methods defined on this type. +type list[T any] struct { + _ HostLayout + data *T + len uintptr +} + +// Slice returns a Go slice representing the List. +func (l list[T]) Slice() []T { + return unsafe.Slice(l.data, l.len) +} + +// Data returns the data pointer for the list. +func (l list[T]) Data() *T { + return l.data +} + +// Len returns the length of the list. +// TODO: should this return an int instead of a uintptr? +func (l list[T]) Len() uintptr { + return l.len +} diff --git a/component/cm/list_json.go b/component/cm/list_json.go new file mode 100644 index 00000000..af2a03d2 --- /dev/null +++ b/component/cm/list_json.go @@ -0,0 +1,67 @@ +//go:build !module.std + +package cm + +// This file contains JSON-related functionality for Component Model list types. +// To avoid a cyclical dependency on package encoding/json when using this package +// in a Go or TinyGo standard library, do not include files named *_json.go. + +import ( + "bytes" + "encoding/json" + "unsafe" +) + +// MarshalJSON implements json.Marshaler. +func (l list[T]) MarshalJSON() ([]byte, error) { + if l.len == 0 { + return []byte("[]"), nil + } + + s := l.Slice() + var zero T + if unsafe.Sizeof(zero) == 1 { + // The default Go json.Encoder will marshal []byte as base64. + // We override that behavior so all int types have the same serialization format. + // []uint8{1,2,3} -> [1,2,3] + // []uint32{1,2,3} -> [1,2,3] + return json.Marshal(sliceOf(s)) + } + return json.Marshal(s) +} + +type slice[T any] []entry[T] + +func sliceOf[S ~[]E, E any](s S) slice[E] { + return *(*slice[E])(unsafe.Pointer(&s)) +} + +type entry[T any] [1]T + +func (v entry[T]) MarshalJSON() ([]byte, error) { + return json.Marshal(v[0]) +} + +// UnmarshalJSON implements json.Unmarshaler. +func (l *list[T]) UnmarshalJSON(data []byte) error { + if bytes.Equal(data, nullLiteral) { + return nil + } + + var s []T + err := json.Unmarshal(data, &s) + if err != nil { + return err + } + + l.data = unsafe.SliceData([]T(s)) + l.len = uintptr(len(s)) + + return nil +} + +// nullLiteral is the JSON representation of a null literal. +// By convention, to approximate the behavior of Unmarshal itself, +// Unmarshalers implement UnmarshalJSON([]byte("null")) as a no-op. +// See https://pkg.go.dev/encoding/json#Unmarshaler for more information. +var nullLiteral = []byte("null") diff --git a/component/cm/list_json_test.go b/component/cm/list_json_test.go new file mode 100644 index 00000000..2b726f2b --- /dev/null +++ b/component/cm/list_json_test.go @@ -0,0 +1,325 @@ +//go:build !module.std + +package cm + +import ( + "bytes" + "encoding/json" + "errors" + "math" + "reflect" + "runtime" + "strings" + "testing" +) + +func TestListMarshalJSON(t *testing.T) { + tests := []struct { + name string + w listTester + }{ + { + name: "encode error", + w: listMarshalTest(``, []errorEntry{{}}, true), + }, + { + name: "f32 nan", + w: listMarshalTest(``, []float32{float32(math.NaN())}, true), + }, + { + name: "f64 nan", + w: listMarshalTest(``, []float64{float64(math.NaN())}, true), + }, + { + name: "nil", + w: listMarshalTest[string](`[]`, nil, false), + }, + { + name: "empty", + w: listMarshalTest(`[]`, []string{}, false), + }, + { + name: "bool", + w: listMarshalTest(`[true,false]`, []bool{true, false}, false), + }, + { + name: "string", + w: listMarshalTest(`["one","two","three"]`, []string{"one", "two", "three"}, false), + }, + { + name: "char", + w: listMarshalTest(`[104,105,127942]`, []rune{'h', 'i', '🏆'}, false), + }, + { + name: "s8", + w: listMarshalTest(`[123,-123,127]`, []int8{123, -123, math.MaxInt8}, false), + }, + { + name: "u8", + w: listMarshalTest(`[123,0,255]`, []uint8{123, 0, math.MaxUint8}, false), + }, + { + name: "s16", + w: listMarshalTest(`[123,-123,32767]`, []int16{123, -123, math.MaxInt16}, false), + }, + { + name: "u16", + w: listMarshalTest(`[123,0,65535]`, []uint16{123, 0, math.MaxUint16}, false), + }, + { + name: "s32", + w: listMarshalTest(`[123,-123,2147483647]`, []int32{123, -123, math.MaxInt32}, false), + }, + { + name: "u32", + w: listMarshalTest(`[123,0,4294967295]`, []uint32{123, 0, math.MaxUint32}, false), + }, + { + name: "s64", + w: listMarshalTest(`[123,-123,9223372036854775807]`, []int64{123, -123, math.MaxInt64}, false), + }, + { + name: "u64", + w: listMarshalTest(`[123,0,18446744073709551615]`, []uint64{123, 0, math.MaxUint64}, false), + }, + { + name: "f32", + w: listMarshalTest(`[1.01,2,3.4028235e+38]`, []float32{1.01, 2, math.MaxFloat32}, false), + }, + { + name: "f64", + w: listMarshalTest(`[1.01,2,1.7976931348623157e+308]`, []float64{1.01, 2, math.MaxFloat64}, false), + }, + { + name: "struct", + w: listMarshalTest(`[{"name":"joe","age":10},{"name":"jane","age":20}]`, []testEntry{{Name: "joe", Age: 10}, {Name: "jane", Age: 20}}, false), + }, + { + name: "list", + w: listMarshalTest(`[["one","two","three"],["four","five","six"]]`, []List[string]{ToList([]string{"one", "two", "three"}), ToList([]string{"four", "five", "six"})}, false), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // NOTE(lxf): skip marshal errors in tinygo as it uses 'defer' + // needs tinygo 0.35-dev + if tt.w.WantErr() && runtime.Compiler == "tinygo" && strings.Contains(runtime.GOARCH, "wasm") { + return + } + + data, err := json.Marshal(tt.w.List()) + if err != nil { + if tt.w.WantErr() { + return + } + + t.Error(err) + return + } + + if tt.w.WantErr() { + t.Errorf("expected error, but got none. got (%s)", string(data)) + return + } + + if got, want := data, tt.w.JSON(); !bytes.Equal(got, want) { + t.Errorf("got (%v) != want (%v)", string(got), string(want)) + } + }) + } +} + +func TestListUnmarshalJSON(t *testing.T) { + tests := []struct { + name string + w listTester + }{ + { + name: "decode error", + w: listUnmarshalTest(`["joe"]`, []errorEntry{}, true), + }, + { + name: "invalid json", + w: listUnmarshalTest(`[joe]`, []string{}, true), + }, + { + name: "incompatible type", + w: listUnmarshalTest(`[123,456]`, []string{}, true), + }, + { + name: "incompatible bool", + w: listUnmarshalTest(`["true","false"]`, []bool{true, false}, true), + }, + { + name: "incompatible s32", + w: listUnmarshalTest(`["123","-123","2147483647"]`, []int32{}, true), + }, + { + name: "incompatible u32", + w: listUnmarshalTest(`["123","0","4294967295"]`, []uint32{}, true), + }, + + { + name: "null", + w: listUnmarshalTest[string](`null`, nil, false), + }, + { + name: "empty", + w: listUnmarshalTest(`[]`, []string{}, false), + }, + { + name: "bool", + w: listUnmarshalTest(`[true,false]`, []bool{true, false}, false), + }, + { + name: "string", + w: listUnmarshalTest(`["one","two","three"]`, []string{"one", "two", "three"}, false), + }, + { + name: "char", + w: listUnmarshalTest(`[104,105,127942]`, []rune{'h', 'i', '🏆'}, false), + }, + { + name: "s8", + w: listUnmarshalTest(`[123,-123,127]`, []int8{123, -123, math.MaxInt8}, false), + }, + { + name: "u8", + w: listUnmarshalTest(`[123,0,255]`, []uint8{123, 0, math.MaxUint8}, false), + }, + { + name: "s16", + w: listUnmarshalTest(`[123,-123,32767]`, []int16{123, -123, math.MaxInt16}, false), + }, + { + name: "u16", + w: listUnmarshalTest(`[123,0,65535]`, []uint16{123, 0, math.MaxUint16}, false), + }, + { + name: "s32", + w: listUnmarshalTest(`[123,-123,2147483647]`, []int32{123, -123, math.MaxInt32}, false), + }, + { + name: "u32", + w: listUnmarshalTest(`[123,0,4294967295]`, []uint32{123, 0, math.MaxUint32}, false), + }, + { + name: "s64", + w: listUnmarshalTest(`[123,-123,9223372036854775807]`, []int64{123, -123, math.MaxInt64}, false), + }, + { + name: "u64", + w: listUnmarshalTest(`[123,0,18446744073709551615]`, []uint64{123, 0, math.MaxUint64}, false), + }, + { + name: "f32", + w: listUnmarshalTest(`[1.01,2,3.4028235e+38]`, []float32{1.01, 2, math.MaxFloat32}, false), + }, + { + name: "f32 nan", + w: listUnmarshalTest(`[null]`, []float32{0}, false), + }, + { + name: "f64", + w: listUnmarshalTest(`[1.01,2,1.7976931348623157e+308]`, []float64{1.01, 2, math.MaxFloat64}, false), + }, + { + name: "f64 nan", + w: listUnmarshalTest(`[null]`, []float64{0}, false), + }, + { + name: "struct", + w: listUnmarshalTest(`[{"name":"joe","age":10},{"name":"jane","age":20}]`, []testEntry{{Name: "joe", Age: 10}, {Name: "jane", Age: 20}}, false), + }, + { + name: "list", + w: listUnmarshalTest(`[["one","two","three"],["four","five","six"]]`, []List[string]{ToList([]string{"one", "two", "three"}), ToList([]string{"four", "five", "six"})}, false), + }, + // tuple, result, option, and variant needs json implementation + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := json.Unmarshal(tt.w.JSON(), tt.w.List()) + if err != nil { + if tt.w.WantErr() { + return + } + + t.Error(err) + return + } + + if tt.w.WantErr() { + t.Errorf("expected error, but got none. got (%v)", tt.w.Slice()) + return + } + + if got, want := tt.w.Slice(), tt.w.WantSlice(); !reflect.DeepEqual(got, want) { + t.Errorf("got (%v) != want (%v)", got, want) + } + }) + } +} + +type listTester interface { + List() any + WantSlice() any + Slice() any + WantErr() bool + JSON() []byte +} + +type listWrapper[T comparable] struct { + json string + list List[T] + slice []T + wantErr bool +} + +func (w *listWrapper[T]) WantErr() bool { + return w.wantErr +} + +func (w *listWrapper[T]) List() any { + return &w.list +} + +func (w *listWrapper[T]) Slice() any { + return w.list.Slice() +} + +func (w *listWrapper[T]) WantSlice() any { + return w.slice +} + +func (w *listWrapper[T]) JSON() []byte { + return []byte(w.json) +} + +func listMarshalTest[T comparable](json string, want []T, wantErr bool) *listWrapper[T] { + return &listWrapper[T]{json: json, list: ToList(want), wantErr: wantErr} +} + +func listUnmarshalTest[T comparable](json string, want []T, wantErr bool) *listWrapper[T] { + return &listWrapper[T]{json: json, slice: want, wantErr: wantErr} +} + +type testEntry struct { + Name string `json:"name"` + Age int `json:"age"` +} + +type errorEntry struct { + Name string `json:"name"` + Age int `json:"age"` +} + +func (errorEntry) MarshalJSON() ([]byte, error) { + return nil, errors.New("MarshalJSON") +} + +func (*errorEntry) UnmarshalJSON(_ []byte) error { + return errors.New("UnmarshalJSON") +} diff --git a/component/cm/list_test.go b/component/cm/list_test.go new file mode 100644 index 00000000..34d674ac --- /dev/null +++ b/component/cm/list_test.go @@ -0,0 +1,16 @@ +package cm + +import ( + "bytes" + "testing" +) + +func TestListMethods(t *testing.T) { + want := []byte("hello world") + type myList List[uint8] + l := myList(ToList(want)) + got := l.Slice() + if !bytes.Equal(want, got) { + t.Errorf("got (%s) != want (%s)", string(got), string(want)) + } +} diff --git a/component/cm/option.go b/component/cm/option.go new file mode 100644 index 00000000..041cdbe4 --- /dev/null +++ b/component/cm/option.go @@ -0,0 +1,99 @@ +package cm + +import "encoding/json" + +// Option represents a Component Model [option] type. +// +// [option]: https://component-model.bytecodealliance.org/design/wit.html#options +type Option[T any] struct { + _ HostLayout + option[T] +} + +// None returns an [Option] representing the none case, +// equivalent to the zero value. +func None[T any]() Option[T] { + return Option[T]{} +} + +// Some returns an [Option] representing the some case. +func Some[T any](v T) Option[T] { + return Option[T]{ + option: option[T]{ + isSome: true, + some: v, + }, + } +} + +// option represents the internal representation of a Component Model option type. +// The first byte is a bool representing none or some, +// followed by storage for the associated type T. +type option[T any] struct { + _ HostLayout + isSome bool + some T +} + +// None returns true if o represents the none case. +func (o *option[T]) None() bool { + return !o.isSome +} + +// Some returns a non-nil *T if o represents the some case, +// or nil if o represents the none case. +func (o *option[T]) Some() *T { + if o.isSome { + return &o.some + } + return nil +} + +// Value returns T if o represents the some case, +// or the zero value of T if o represents the none case. +// This does not have a pointer receiver, so it can be chained. +func (o option[T]) Value() T { + if !o.isSome { + var zero T + return zero + } + return o.some +} + +// MarshalJSON implements the json.Marshaler interface for the public option type. +func (o Option[T]) MarshalJSON() ([]byte, error) { + return json.Marshal(o.Some()) +} + +// UnmarshalJSON implements the json.Unmarshaler interface for the public option type. +func (o *Option[T]) UnmarshalJSON(data []byte) error { + if string(data) == "null" { + *o = None[T]() + return nil + } + var v T + if err := json.Unmarshal(data, &v); err != nil { + return err + } + *o = Some(v) + return nil +} + +// MarshalJSON implements the json.Marshaler interface for the internal option type. +func (o option[T]) MarshalJSON() ([]byte, error) { + return json.Marshal(o.Some()) +} + +// UnmarshalJSON implements the json.Unmarshaler interface for the internal option type. +func (o *option[T]) UnmarshalJSON(data []byte) error { + if string(data) == "null" { + o = &option[T]{isSome: false} + return nil + } + var v T + if err := json.Unmarshal(data, &v); err != nil { + return err + } + o = &option[T]{isSome: true, some: v} + return nil +} diff --git a/component/cm/option_test.go b/component/cm/option_test.go new file mode 100644 index 00000000..354178a0 --- /dev/null +++ b/component/cm/option_test.go @@ -0,0 +1,183 @@ +package cm + +import ( + "encoding/json" + "testing" +) + +func TestOption(t *testing.T) { + o1 := None[string]() + if got, want := o1.None(), true; got != want { + t.Errorf("o1.None: %t, expected %t", got, want) + } + if got, want := o1.Some(), (*string)(nil); got != want { + t.Errorf("o1.Some: %v, expected %v", got, want) + } + if got, want := o1.Value(), (string)(""); got != want { + t.Errorf("o1.Value: %v, expected %v", got, want) + } + + var o2 Option[uint32] + if got, want := o2.None(), true; got != want { + t.Errorf("o2.None: %t, expected %t", got, want) + } + if got, want := o2.Some(), (*uint32)(nil); got != want { + t.Errorf("o2.Some: %v, expected %v", got, want) + } + if got, want := o2.Value(), (uint32)(0); got != want { + t.Errorf("o2.Value: %v, expected %v", got, want) + } + + o3 := Some(true) + if got, want := o3.None(), false; got != want { + t.Errorf("o3.None: %t, expected %t", got, want) + } + if got, want := o3.Some(), &o3.some; got != want { + t.Errorf("o3.Some: %v, expected %v", got, want) + } + if got, want := o3.Value(), true; got != want { + t.Errorf("o3.Value: %v, expected %v", got, want) + } + + o4 := Some("hello") + if got, want := o4.None(), false; got != want { + t.Errorf("o4.None: %t, expected %t", got, want) + } + if got, want := o4.Some(), &o4.some; got != want { + t.Errorf("o4.Some: %v, expected %v", got, want) + } + if got, want := o4.Value(), "hello"; got != want { + t.Errorf("o4.Value: %v, expected %v", got, want) + } + + o5 := Some(List[string]{}) + if got, want := o5.None(), false; got != want { + t.Errorf("o5.None: %t, expected %t", got, want) + } + if got, want := o5.Some(), &o5.some; got != want { + t.Errorf("o5.Some: %v, expected %v", got, want) + } + if got, want := o5.Value(), (List[string]{}); got != want { + t.Errorf("o4.Value: %v, expected %v", got, want) + } + + f := func(s string) Option[string] { + return Some(s) + } + if got, want := f("hello").Value(), "hello"; got != want { + t.Errorf("Value: %v, expected %v", got, want) + } +} + +func TestOptionMarshalJSON(t *testing.T) { + type TestStruct struct { + Field Option[string] `json:"field"` + } + + // Test marshaling None + ts1 := TestStruct{Field: None[string]()} + data1, err := json.Marshal(ts1) + if err != nil { + t.Fatalf("json.Marshal failed: %v", err) + } + expected1 := `{"field":null}` + if string(data1) != expected1 { + t.Errorf("json.Marshal: got %s, expected %s", data1, expected1) + } + + // Test marshaling Some + ts2 := TestStruct{Field: Some("hello")} + data2, err := json.Marshal(ts2) + if err != nil { + t.Fatalf("json.Marshal failed: %v", err) + } + expected2 := `{"field":"hello"}` + if string(data2) != expected2 { + t.Errorf("json.Marshal: got %s, expected %s", data2, expected2) + } + + // Test marshaling custom option type + type OptionalI32 Option[int32] + ts3 := OptionalI32(Some(int32(42))) + data3, err := json.Marshal(ts3) + if err != nil { + t.Fatalf("json.Marshal failed: %v", err) + } + expected3 := `42` + if string(data3) != expected3 { + t.Errorf("json.Marshal: got %s, expected %s", data3, expected3) + } + + // Test marshaling nested option type + type NestedStruct struct { + Field Option[Option[int32]] `json:"field"` + } + ts4 := NestedStruct{Field: Some(Some(int32(42)))} + data4, err := json.Marshal(ts4) + if err != nil { + t.Fatalf("json.Marshal failed: %v", err) + } + expected4 := `{"field":42}` + if string(data4) != expected4 { + t.Errorf("json.Marshal: got %s, expected %s", data4, expected4) + } +} + +func TestOptionUnmarshalJSON(t *testing.T) { + type TestStruct struct { + Field Option[string] `json:"field"` + } + + // Test unmarshaling None + data1 := []byte(`{"field":null}`) + var ts1 TestStruct + if err := json.Unmarshal(data1, &ts1); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if got, want := ts1.Field.None(), true; got != want { + t.Errorf("ts1.Field.None: %t, expected %t", got, want) + } + + // Test unmarshaling None (not present) + data2 := []byte(`{}`) + var ts2 TestStruct + if err := json.Unmarshal(data2, &ts2); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if got, want := ts2.Field.None(), true; got != want { + t.Errorf("ts1.Field.None: %t, expected %t", got, want) + } + + // Test unmarshaling Some + data3 := []byte(`{"field":"hello"}`) + var ts3 TestStruct + if err := json.Unmarshal(data3, &ts3); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if got, want := ts3.Field.isSome, true; got != want { + t.Errorf("ts2.Field.Some: %t, expected %t", got, want) + } + if got, want := ts3.Field.Value(), "hello"; got != want { + t.Errorf("ts2.Field.Value: %v, expected %v", got, want) + } + + // Test unmarshaling nested option type + type NestedStruct struct { + Field Option[Option[int32]] `json:"field"` + } + data5 := []byte(`{"field":42}`) + var ns NestedStruct + if err := json.Unmarshal(data5, &ns); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if got, want := ns.Field.isSome, true; got != want { + t.Errorf("ns.Field.Some: %t, expected %t", got, want) + } + if got, want := ns.Field.Value(), Some(int32(42)); got != want { + t.Errorf("ns.Field.Value: %v, expected %v", got, want) + } + // Deref the inner option to get the value + if got, want := ns.Field.Value().Value(), int32(42); got != want { + t.Errorf("ns.Field.Value.Value: %v, expected %v", got, want) + } +} diff --git a/component/cm/resource.go b/component/cm/resource.go new file mode 100644 index 00000000..830d7659 --- /dev/null +++ b/component/cm/resource.go @@ -0,0 +1,21 @@ +package cm + +// Resource represents an opaque Component Model [resource handle]. +// It is represented in the [Canonical ABI] as an 32-bit integer. +// +// [resource handle]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#handle-types +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +type Resource uint32 + +// Rep represents a Component Model [resource rep], the core representation type of a resource. +// It is represented in the [Canonical ABI] as an 32-bit integer. +// +// [resource rep]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#canon-resourcerep +// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md +type Rep uint32 + +// ResourceNone is a sentinel value indicating a null or uninitialized resource. +// This is a reserved value specified in the [Canonical ABI runtime state]. +// +// [Canonical ABI runtime state]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#runtime-state +const ResourceNone = 0 diff --git a/component/cm/result.go b/component/cm/result.go new file mode 100644 index 00000000..a047c670 --- /dev/null +++ b/component/cm/result.go @@ -0,0 +1,143 @@ +package cm + +import "unsafe" + +const ( + // ResultOK represents the OK case of a result. + ResultOK = false + + // ResultErr represents the error case of a result. + ResultErr = true +) + +// BoolResult represents a result with no OK or error type. +// False represents the OK case and true represents the error case. +type BoolResult bool + +// Result represents a result sized to hold the Shape type. +// The size of the Shape type must be greater than or equal to the size of OK and Err types. +// For results with two zero-length types, use [BoolResult]. +type Result[Shape, OK, Err any] struct { + _ HostLayout + result[Shape, OK, Err] +} + +// AnyResult is a type constraint for generic functions that accept any [Result] type. +type AnyResult[Shape, OK, Err any] interface { + ~struct { + _ HostLayout + result[Shape, OK, Err] + } +} + +// result represents the internal representation of a Component Model result type. +type result[Shape, OK, Err any] struct { + _ HostLayout + isErr bool + _ [0]OK + _ [0]Err + data Shape // [unsafe.Sizeof(*(*Shape)(unsafe.Pointer(nil)))]byte +} + +// OK returns an OK result with shape Shape and type OK and Err. +// Pass Result[OK, OK, Err] or Result[Err, OK, Err] as the first type argument. +func OK[R AnyResult[Shape, OK, Err], Shape, OK, Err any](ok OK) R { + var r Result[Shape, OK, Err] + r.validate() + r.isErr = ResultOK + *((*OK)(unsafe.Pointer(&r.data))) = ok + return R(r) +} + +// Err returns an error result with shape Shape and type OK and Err. +// Pass Result[OK, OK, Err] or Result[Err, OK, Err] as the first type argument. +func Err[R AnyResult[Shape, OK, Err], Shape, OK, Err any](err Err) R { + var r Result[Shape, OK, Err] + r.validate() + r.isErr = ResultErr + *((*Err)(unsafe.Pointer(&r.data))) = err + return R(r) +} + +// SetOK sets r to an OK result. +func (r *result[Shape, OK, Err]) SetOK(ok OK) { + r.validate() + r.isErr = ResultOK + *((*OK)(unsafe.Pointer(&r.data))) = ok +} + +// SetErr sets r to an error result. +func (r *result[Shape, OK, Err]) SetErr(err Err) { + r.validate() + r.isErr = ResultErr + *((*Err)(unsafe.Pointer(&r.data))) = err +} + +// IsOK returns true if r represents the OK case. +func (r *result[Shape, OK, Err]) IsOK() bool { + r.validate() + return !r.isErr +} + +// IsErr returns true if r represents the error case. +func (r *result[Shape, OK, Err]) IsErr() bool { + r.validate() + return r.isErr +} + +// OK returns a non-nil *OK pointer if r represents the OK case. +// If r represents an error, then it returns nil. +func (r *result[Shape, OK, Err]) OK() *OK { + r.validate() + if r.isErr { + return nil + } + return (*OK)(unsafe.Pointer(&r.data)) +} + +// Err returns a non-nil *Err pointer if r represents the error case. +// If r represents the OK case, then it returns nil. +func (r *result[Shape, OK, Err]) Err() *Err { + r.validate() + if !r.isErr { + return nil + } + return (*Err)(unsafe.Pointer(&r.data)) +} + +// Result returns (OK, zero value of Err, false) if r represents the OK case, +// or (zero value of OK, Err, true) if r represents the error case. +// This does not have a pointer receiver, so it can be chained. +func (r result[Shape, OK, Err]) Result() (ok OK, err Err, isErr bool) { + if r.isErr { + return ok, *(*Err)(unsafe.Pointer(&r.data)), true + } + return *(*OK)(unsafe.Pointer(&r.data)), err, false +} + +// This function is sized so it can be inlined and optimized away. +func (r *result[Shape, OK, Err]) validate() { + var shape Shape + var ok OK + var err Err + + // Check if size of Shape is greater than both OK and Err + if unsafe.Sizeof(shape) > unsafe.Sizeof(ok) && unsafe.Sizeof(shape) > unsafe.Sizeof(err) { + panic("result: size of data type > OK and Err types") + } + + // Check if size of OK is greater than Shape + if unsafe.Sizeof(ok) > unsafe.Sizeof(shape) { + panic("result: size of OK type > data type") + } + + // Check if size of Err is greater than Shape + if unsafe.Sizeof(err) > unsafe.Sizeof(shape) { + panic("result: size of Err type > data type") + } + + // Check if Shape is zero-sized, but size of result != 1 + if unsafe.Sizeof(shape) == 0 && unsafe.Sizeof(*r) != 1 { + panic("result: size of data type == 0, but result size != 1") + } +} diff --git a/component/cm/result_test.go b/component/cm/result_test.go new file mode 100644 index 00000000..d6e8d3e2 --- /dev/null +++ b/component/cm/result_test.go @@ -0,0 +1,352 @@ +package cm + +import ( + "fmt" + "runtime" + "testing" + "unsafe" +) + +var ( + _ resulter[string, bool] = &Result[string, string, bool]{} + _ resulter[bool, string] = &Result[string, bool, string]{} +) + +type resulter[OK, Err any] interface { + SetOK(OK) + SetErr(Err) + IsOK() bool + IsErr() bool + OK() *OK + Err() *Err + Result() (OK, Err, bool) +} + +func TestResultSetOKSetErr(t *testing.T) { + var r Result[string, int32, string] + + r.SetOK(12345) + if want, got := int32(12345), r.OK(); *got != want { + t.Errorf("OK(): %v, expected %v", got, want) + } + + r.SetErr("error") + if want, got := "error", r.Err(); *got != want { + t.Errorf("Err(): %v, expected %v", got, want) + } +} + +func TestResultOKOrErr(t *testing.T) { + r1 := OK[Result[string, string, struct{}]]("hello") + if ok := r1.OK(); ok == nil { + t.Errorf("OK(): %v, expected non-nil OK", ok) + } + if err := r1.Err(); err != nil { + t.Errorf("Err(): %v, expected nil Err", err) + } + + r2 := Err[Result[bool, struct{}, bool]](true) + if ok := r2.OK(); ok != nil { + t.Errorf("OK(): %v, expected nil OK", ok) + } + if err := r2.Err(); err == nil { + t.Errorf("Err(): %v, expected non-nil Err", err) + } +} + +func TestResultResult(t *testing.T) { + ok, err, isErr := OK[Result[string, string, int]]("hello").Result() + if got, want := ok, "hello"; got != want { + t.Errorf("Result(): ok = %v; expected %v", got, want) + } + if got, want := err, 0; got != want { + t.Errorf("Result(): err = %v; expected %v", got, want) + } + if got, want := isErr, false; got != want { + t.Errorf("Result(): isErr = %v; expected %v", got, want) + } + ok, err, isErr = Err[Result[string, string, int]](42).Result() + if got, want := ok, ""; got != want { + t.Errorf("Result(): ok = %v; expected %v", got, want) + } + if got, want := err, 42; got != want { + t.Errorf("Result(): err = %v; expected %v", got, want) + } + if got, want := isErr, true; got != want { + t.Errorf("Result(): isErr = %v; expected %v", got, want) + } +} + +func TestResultLayout(t *testing.T) { + // 8 on 64-bit, 4 on 32-bit + ptrSize := unsafe.Sizeof(uintptr(0)) + + tests := []struct { + name string + r ResultDebug + size uintptr + offset uintptr + }{ + {"result", BoolResult(false), 1, 0}, + {"ok", BoolResult(ResultOK), 1, 0}, + {"err", BoolResult(ResultErr), 1, 0}, + + {"result", Result[string, string, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"result", Result[string, bool, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"result", Result[string, string, struct{}]{}, sizePlusAlignOf[string](), ptrSize}, + {"result<_, string>", Result[string, struct{}, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"result", Result[uint64, uint64, uint64]{}, 16, alignOf[uint64]()}, + {"result", Result[uint64, uint32, uint64]{}, 16, alignOf[uint64]()}, + {"result", Result[uint64, uint64, uint32]{}, 16, alignOf[uint64]()}, + {"result", Result[uint64, uint8, uint64]{}, 16, alignOf[uint64]()}, + {"result", Result[uint64, uint64, uint8]{}, 16, alignOf[uint64]()}, + {"result", Result[uint32, uint8, uint32]{}, 8, alignOf[uint32]()}, + {"result", Result[uint32, uint32, uint8]{}, 8, alignOf[uint32]()}, + {"result<[9]u8, u64>", Result[[9]byte, [9]byte, uint64]{}, 24, alignOf[uint64]()}, + + {"result", Result[string, string, struct{}]{}, sizePlusAlignOf[string](), ptrSize}, + {"result", Result[string, string, struct{}]{}, sizePlusAlignOf[string](), ptrSize}, + {"result", Result[string, string, bool]{}, sizePlusAlignOf[string](), ptrSize}, + {"result<[9]u8, u64>", Result[[9]byte, [9]byte, uint64]{}, 24, alignOf[uint64]()}, + + {"result<_, string>", Result[string, struct{}, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"result<_, string>", Result[string, struct{}, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"result", Result[string, bool, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"result", Result[[9]byte, uint64, [9]byte]{}, 24, alignOf[uint64]()}, + } + + for _, tt := range tests { + typ := typeName(tt.r) + t.Run(tt.name, func(t *testing.T) { + if got, want := tt.r.Size(), tt.size; got != want { + t.Errorf("(%s).Size(): %v, expected %v", typ, got, want) + } + if got, want := tt.r.DataOffset(), tt.offset; got != want { + t.Errorf("(%s).DataOffset(): %v, expected %v", typ, got, want) + } + }) + } +} + +func TestAltResult1(t *testing.T) { + type alt1[Shape, OK, Err any] struct { + _ [0]OK + _ [0]Err + data Shape + isErr bool + } + + equalSize(t, result[uint8, struct{}, uint8]{}, alt1[uint8, struct{}, uint8]{}) + equalSize(t, result[uint16, struct{}, uint16]{}, alt1[uint16, struct{}, uint16]{}) + equalSize(t, result[uint32, struct{}, uint32]{}, alt1[uint32, struct{}, uint32]{}) + equalSize(t, result[uint64, struct{}, uint64]{}, alt1[uint64, struct{}, uint64]{}) + equalSize(t, result[uint64, [5]uint8, uint64]{}, alt1[uint64, [5]uint8, uint64]{}) + equalSize(t, result[uint64, [6]uint8, uint64]{}, alt1[uint64, [6]uint8, uint64]{}) + + // Go adds padding to structs with zero-length trailing fields. + // TinyGo does not. + if runtime.Compiler != "tinygo" { + unequalSize(t, result[struct{}, struct{}, struct{}]{}, alt1[struct{}, struct{}, struct{}]{}) + + // zero-length arrays have alignment of their associated type + // TODO: document why zero-length arrays are not allowed as result or variant associated types + unequalSize(t, result[[0]uint64, [0]uint64, struct{}]{}, alt1[[0]uint64, [0]uint64, struct{}]{}) + } +} + +func equalSize[A, B any](t *testing.T, a A, b B) { + if unsafe.Sizeof(a) != unsafe.Sizeof(b) { + t.Errorf("unsafe.Sizeof(%T) (%d) != unsafe.Sizeof(%T) (%d)", a, unsafe.Sizeof(a), b, unsafe.Sizeof(b)) + } +} + +func unequalSize[A, B any](t *testing.T, a A, b B) { + if unsafe.Sizeof(a) == unsafe.Sizeof(b) { + t.Errorf("unsafe.Sizeof(%T) (%d) == unsafe.Sizeof(%T) (%d)", a, unsafe.Sizeof(a), b, unsafe.Sizeof(b)) + } +} + +func BenchmarkResultInlines(b *testing.B) { + var ok *struct{} + var err *string + r1 := Err[Result[string, struct{}, string]]("hello") + for i := 0; i < b.N; i++ { + ok = r1.OK() + } + _ = ok + _ = err +} + +func TestIssue95String(t *testing.T) { + type ( + magic struct { + data *byte + len [unsafe.Sizeof(uintptr(0))]byte + } + stringVariant Variant[uint8, string, string] + // stringVariant Variant[uint8, [unsafe.Sizeof("")]byte, string] + // stringVariant Variant[uint8, magic, string] + // stringResult Result[stringVariant, string, stringVariant] + stringResult Result[[unsafe.Sizeof(*(*stringVariant)(nil))]byte, string, stringVariant] + ) + + want := "hello" + res := OK[stringResult](want) + got := *res.OK() + // fmt.Printf("unsafe.Sizeof(res): %d\n", unsafe.Sizeof(res)) + // fmt.Printf("got: %v (%d) want: %v (%d)\n", + // unsafe.StringData(got), len(got), unsafe.StringData(want), len(want)) + if got != want { + t.Errorf("*res.OK(): %v, expected %v", got, want) + } +} + +func TestIssue95Uint64(t *testing.T) { + type ( + uint64Variant Variant[uint8, uint64, uint64] + // uint64Variant Variant[uint8, [unsafe.Sizeof(uint64(0))]byte, uint64] + // uint64Result Result[uint64Variant, uint64, uint64Variant] + uint64Result Result[[unsafe.Sizeof(uint64Variant{})]byte, uint64, uint64Variant] + ) + + want := uint64(123) + res := OK[uint64Result](want) + got := *res.OK() + // fmt.Printf("unsafe.Sizeof(res): %d\n", unsafe.Sizeof(res)) + // fmt.Printf("got: %v want: %v\n", got, want) + if got != want { + t.Errorf("*res.OK(): %v, expected %v", got, want) + } +} + +func TestIssue95Struct(t *testing.T) { + type ( + // structResult Result[structVariant, stringStruct, structVariant] + stringStruct struct { + _ HostLayout + // i int + s string + } + structVariant Variant[uint8, stringStruct, stringStruct] + // structVariant Variant[uint8, [1]stringStruct, [2]stringStruct] + // structResult Result[structVariant, stringStruct, structVariant] + structResult Result[[unsafe.Sizeof(*(*structVariant)(nil))]byte, stringStruct, structVariant] + // structResult Result[[2]uintptr, stringStruct, structVariant] + ) + + want := stringStruct{s: "hello"} + res := OK[structResult](want) + got := *res.OK() + // fmt.Printf("unsafe.Sizeof(res): %d\n", unsafe.Sizeof(res)) + // fmt.Printf("got: %v want: %v\n", got, want) + if got != want { + t.Errorf("*res.OK(): %v, expected %v", got, want) + } +} + +func TestIssue95BoolInt64(t *testing.T) { + type boolInt64Result Result[int64, bool, int64] + want := int64(1234567890) + res := Err[boolInt64Result](1234567890) + got := *res.Err() + // fmt.Printf("unsafe.Sizeof(res): %d\n", unsafe.Sizeof(res)) + // fmt.Printf("got: %v want: %v\n", got, want) + if got != want { + t.Errorf("*res.OK(): %v, expected %v", got, want) + } +} + +func TestIssue284(t *testing.T) { + // Using int8 instead of bool for shape works on Go and TinyGo. + // See https://github.com/bytecodealliance/go-modules/issues/284 + type BoolS8Result Result[int8, bool, int8] + + tests := []struct { + isErr bool + ok bool + err int8 + }{ + {false, false, 0}, + {false, true, 0}, + {true, false, 0}, + {true, false, 1}, + {true, false, 5}, + {true, false, 126}, + {true, false, 127}, + } + for _, tt := range tests { + if !tt.isErr { + t.Run(fmt.Sprintf("OK[BoolS8Result](%t)", tt.ok), func(t *testing.T) { + r := OK[BoolS8Result](tt.ok) + ok, _, isErr := r.Result() + if isErr != tt.isErr { + t.Errorf("isErr == %t, expected %t", isErr, tt.isErr) + } + if ok != tt.ok { + t.Errorf("ok == %t, expected %t", ok, tt.ok) + } + }) + } else { + t.Run(fmt.Sprintf("Err[BoolS8Result](%d)", tt.err), func(t *testing.T) { + r := Err[BoolS8Result](tt.err) + _, err, isErr := r.Result() + if isErr != tt.isErr { + t.Errorf("isErr == %t, expected %t", isErr, tt.isErr) + } + if err != tt.err { + t.Errorf("err == %d, expected %d", err, tt.err) + } + }) + } + } +} + +func TestIssue284NotTinyGo(t *testing.T) { + if runtime.Compiler == "tinygo" { + return + } + + // Using bool as result shape changes how [OK] returns the result by value. + // This works on Go, but breaks on TinyGo / LLVM. + // See https://github.com/bytecodealliance/go-modules/issues/284 + type BoolS8Result Result[bool, bool, int8] + + tests := []struct { + isErr bool + ok bool + err int8 + }{ + {false, false, 0}, + {false, true, 0}, + {true, false, 0}, + {true, false, 1}, + {true, false, 5}, + {true, false, 126}, + {true, false, 127}, + } + for _, tt := range tests { + if !tt.isErr { + t.Run(fmt.Sprintf("OK[BoolS8Result](%t)", tt.ok), func(t *testing.T) { + r := OK[BoolS8Result](tt.ok) + ok, _, isErr := r.Result() + if isErr != tt.isErr { + t.Errorf("isErr == %t, expected %t", isErr, tt.isErr) + } + if ok != tt.ok { + t.Errorf("ok == %t, expected %t", ok, tt.ok) + } + }) + } else { + t.Run(fmt.Sprintf("Err[BoolS8Result](%d)", tt.err), func(t *testing.T) { + r := Err[BoolS8Result](tt.err) + _, err, isErr := r.Result() + if isErr != tt.isErr { + t.Errorf("isErr == %t, expected %t", isErr, tt.isErr) + } + if err != tt.err { + t.Errorf("err == %d, expected %d", err, tt.err) + } + }) + } + } +} diff --git a/component/cm/stream.go b/component/cm/stream.go new file mode 100644 index 00000000..80ef062e --- /dev/null +++ b/component/cm/stream.go @@ -0,0 +1,15 @@ +package cm + +// Stream represents the Component Model [stream] type. +// A stream is a special case of stream. In non-error cases, +// a stream delivers exactly one value before being automatically closed. +// +// [stream]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#asynchronous-value-types +type Stream[T any] struct { + _ HostLayout + stream[T] +} + +type stream[T any] uint32 + +// TODO: implement methods on type stream diff --git a/component/cm/tuple.go b/component/cm/tuple.go new file mode 100644 index 00000000..610a19be --- /dev/null +++ b/component/cm/tuple.go @@ -0,0 +1,245 @@ +package cm + +// Tuple represents a [Component Model tuple] with 2 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple[T0, T1 any] struct { + _ HostLayout + F0 T0 + F1 T1 +} + +// Tuple3 represents a [Component Model tuple] with 3 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple3[T0, T1, T2 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 +} + +// Tuple4 represents a [Component Model tuple] with 4 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple4[T0, T1, T2, T3 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 +} + +// Tuple5 represents a [Component Model tuple] with 5 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple5[T0, T1, T2, T3, T4 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 +} + +// Tuple6 represents a [Component Model tuple] with 6 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple6[T0, T1, T2, T3, T4, T5 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 +} + +// Tuple7 represents a [Component Model tuple] with 7 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple7[T0, T1, T2, T3, T4, T5, T6 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 +} + +// Tuple8 represents a [Component Model tuple] with 8 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple8[T0, T1, T2, T3, T4, T5, T6, T7 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 +} + +// Tuple9 represents a [Component Model tuple] with 9 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple9[T0, T1, T2, T3, T4, T5, T6, T7, T8 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 +} + +// Tuple10 represents a [Component Model tuple] with 10 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple10[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 + F9 T9 +} + +// Tuple11 represents a [Component Model tuple] with 11 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple11[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 + F9 T9 + F10 T10 +} + +// Tuple12 represents a [Component Model tuple] with 12 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple12[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 + F9 T9 + F10 T10 + F11 T11 +} + +// Tuple13 represents a [Component Model tuple] with 13 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple13[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 + F9 T9 + F10 T10 + F11 T11 + F12 T12 +} + +// Tuple14 represents a [Component Model tuple] with 14 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple14[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 + F9 T9 + F10 T10 + F11 T11 + F12 T12 + F13 T13 +} + +// Tuple15 represents a [Component Model tuple] with 15 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple15[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 + F9 T9 + F10 T10 + F11 T11 + F12 T12 + F13 T13 + F14 T14 +} + +// Tuple16 represents a [Component Model tuple] with 16 fields. +// +// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples +type Tuple16[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 any] struct { + _ HostLayout + F0 T0 + F1 T1 + F2 T2 + F3 T3 + F4 T4 + F5 T5 + F6 T6 + F7 T7 + F8 T8 + F9 T9 + F10 T10 + F11 T11 + F12 T12 + F13 T13 + F14 T14 + F15 T15 +} + +// MaxTuple specifies the maximum number of fields in a Tuple* type, currently [Tuple16]. +// See https://github.com/WebAssembly/component-model/issues/373 for more information. +const MaxTuple = 16 diff --git a/component/cm/tuple_test.go b/component/cm/tuple_test.go new file mode 100644 index 00000000..9ff9a3b2 --- /dev/null +++ b/component/cm/tuple_test.go @@ -0,0 +1,17 @@ +package cm + +import ( + "math" + "testing" +) + +func TestTuple(t *testing.T) { + var HL HostLayout + _ = Tuple[string, bool]{HL, "hello", false} + _ = Tuple3[string, bool, uint8]{HL, "hello", false, 1} + _ = Tuple4[string, bool, uint8, uint16]{HL, "hello", false, 1, 32000} + _ = Tuple5[string, bool, uint8, uint16, uint32]{HL, "hello", false, 1, 32000, 1_000_000} + _ = Tuple6[string, bool, uint8, uint16, uint32, uint64]{HL, "hello", false, 1, 32000, 1_000_000, 5_000_000_000} + _ = Tuple7[string, bool, uint8, uint16, uint32, uint64, float32]{HL, "hello", false, math.MaxUint8, math.MaxUint16, math.MaxUint32, math.MaxUint64, math.MaxFloat32} + _ = Tuple8[string, bool, uint8, uint16, uint32, uint64, float32, float64]{HL, "hello", false, math.MaxUint8, math.MaxUint16, math.MaxUint32, math.MaxUint64, math.MaxFloat32, math.MaxFloat64} +} diff --git a/component/cm/variant.go b/component/cm/variant.go new file mode 100644 index 00000000..d0def34b --- /dev/null +++ b/component/cm/variant.go @@ -0,0 +1,85 @@ +package cm + +import "unsafe" + +// Discriminant is the set of types that can represent the tag or discriminator of a variant. +// Use uint8 where there are 256 or fewer cases, uint16 for up to 65,536 cases, or uint32 for anything greater. +type Discriminant interface { + uint8 | uint16 | uint32 +} + +// Variant represents a loosely-typed Component Model variant. +// Shape and Align must be non-zero sized types. To create a variant with no associated +// types, use an enum. +type Variant[Tag Discriminant, Shape, Align any] struct { + _ HostLayout + variant[Tag, Shape, Align] +} + +// AnyVariant is a type constraint for generic functions that accept any [Variant] type. +type AnyVariant[Tag Discriminant, Shape, Align any] interface { + ~struct { + _ HostLayout + variant[Tag, Shape, Align] + } +} + +// NewVariant returns a [Variant] with tag of type Disc, storage and GC shape of type Shape, +// aligned to type Align, with a value of type T. +func NewVariant[Tag Discriminant, Shape, Align any, T any](tag Tag, data T) Variant[Tag, Shape, Align] { + validateVariant[Tag, Shape, Align, T]() + var v Variant[Tag, Shape, Align] + v.tag = tag + *(*T)(unsafe.Pointer(&v.data)) = data + return v +} + +// New returns a [Variant] with tag of type Disc, storage and GC shape of type Shape, +// aligned to type Align, with a value of type T. +func New[V AnyVariant[Tag, Shape, Align], Tag Discriminant, Shape, Align any, T any](tag Tag, data T) V { + validateVariant[Tag, Shape, Align, T]() + var v variant[Tag, Shape, Align] + v.tag = tag + *(*T)(unsafe.Pointer(&v.data)) = data + return *(*V)(unsafe.Pointer(&v)) +} + +// Case returns a non-nil *T if the [Variant] case is equal to tag, otherwise it returns nil. +func Case[T any, V AnyVariant[Tag, Shape, Align], Tag Discriminant, Shape, Align any](v *V, tag Tag) *T { + validateVariant[Tag, Shape, Align, T]() + v2 := (*variant[Tag, Shape, Align])(unsafe.Pointer(v)) + if v2.tag == tag { + return (*T)(unsafe.Pointer(&v2.data)) + } + return nil +} + +// variant is the internal representation of a Component Model variant. +// Shape and Align must be non-zero sized types. +type variant[Tag Discriminant, Shape, Align any] struct { + _ HostLayout + tag Tag + _ [0]Align + data Shape // [unsafe.Sizeof(*(*Shape)(unsafe.Pointer(nil)))]byte +} + +// Tag returns the tag (discriminant) of variant v. +func (v *variant[Tag, Shape, Align]) Tag() Tag { + return v.tag +} + +// This function is sized so it can be inlined and optimized away. +func validateVariant[Disc Discriminant, Shape, Align any, T any]() { + var v variant[Disc, Shape, Align] + var t T + + // Check if size of T is greater than Shape + if unsafe.Sizeof(t) > unsafe.Sizeof(v.data) { + panic("variant: size of requested type > data type") + } + + // Check if Shape is zero-sized, but size of result != 1 + if unsafe.Sizeof(v.data) == 0 && unsafe.Sizeof(v) != 1 { + panic("variant: size of data type == 0, but variant size != 1") + } +} diff --git a/component/cm/variant_test.go b/component/cm/variant_test.go new file mode 100644 index 00000000..0978e45c --- /dev/null +++ b/component/cm/variant_test.go @@ -0,0 +1,70 @@ +package cm + +import ( + "runtime" + "strings" + "testing" + "unsafe" +) + +func TestVariantLayout(t *testing.T) { + // 8 on 64-bit, 4 on 32-bit + ptrSize := unsafe.Sizeof(uintptr(0)) + + tests := []struct { + name string + v VariantDebug + size uintptr + offset uintptr + }{ + {"variant { string; string }", Variant[uint8, string, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"variant { bool; string }", Variant[uint8, string, bool]{}, sizePlusAlignOf[string](), ptrSize}, + {"variant { string; _ }", Variant[uint8, string, string]{}, sizePlusAlignOf[string](), ptrSize}, + {"variant { _; _ }", Variant[uint8, string, struct{}]{}, sizePlusAlignOf[string](), ptrSize}, + {"variant { u64; u64 }", Variant[uint8, uint64, uint64]{}, 16, alignOf[uint64]()}, + {"variant { u32; u64 }", Variant[uint8, uint64, uint32]{}, 16, alignOf[uint64]()}, + {"variant { u64; u32 }", Variant[uint8, uint64, uint32]{}, 16, alignOf[uint64]()}, + {"variant { u8; u64 }", Variant[uint8, uint64, uint8]{}, 16, alignOf[uint64]()}, + {"variant { u64; u8 }", Variant[uint8, uint64, uint8]{}, 16, alignOf[uint64]()}, + {"variant { u8; u32 }", Variant[uint8, uint32, uint8]{}, 8, alignOf[uint32]()}, + {"variant { u32; u8 }", Variant[uint8, uint32, uint8]{}, 8, alignOf[uint32]()}, + {"variant { [9]u8, u64 }", Variant[uint8, [9]byte, uint64]{}, 24, alignOf[uint64]()}, + } + + for _, tt := range tests { + typ := typeName(tt.v) + t.Run(tt.name, func(t *testing.T) { + if got, want := tt.v.Size(), tt.size; got != want { + t.Errorf("(%s).Size(): %v, expected %v", typ, got, want) + } + if got, want := tt.v.DataOffset(), tt.offset; got != want { + t.Errorf("(%s).DataOffset(): %v, expected %v", typ, got, want) + } + }) + } +} + +func TestGetValidates(t *testing.T) { + if runtime.Compiler == "tinygo" && strings.Contains(runtime.GOARCH, "wasm") { + return + } + defer func() { + if recover() == nil { + t.Errorf("Get did not panic") + } + }() + var v Variant[uint8, uint8, uint8] + _ = Case[string](&v, 0) +} + +func TestNewVariantValidates(t *testing.T) { + if runtime.Compiler == "tinygo" && strings.Contains(runtime.GOARCH, "wasm") { + return + } + defer func() { + if recover() == nil { + t.Errorf("NewVariant did not panic") + } + }() + _ = NewVariant[uint8, uint8, uint8](0, "hello world") +} diff --git a/component/gen/wasi/cli/environment/empty.s b/component/gen/wasi/cli/environment/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/environment/environment.wasm.go b/component/gen/wasi/cli/environment/environment.wasm.go old mode 100755 new mode 100644 index 89bb596b..08cd452e --- a/component/gen/wasi/cli/environment/environment.wasm.go +++ b/component/gen/wasi/cli/environment/environment.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package environment import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". diff --git a/component/gen/wasi/cli/environment/environment.wit.go b/component/gen/wasi/cli/environment/environment.wit.go old mode 100755 new mode 100644 index 3a3b6247..6d8b28db --- a/component/gen/wasi/cli/environment/environment.wit.go +++ b/component/gen/wasi/cli/environment/environment.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package environment represents the imported interface "wasi:cli/environment@0.2.0". package environment import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetEnvironment represents the imported function "get-environment". diff --git a/component/gen/wasi/cli/exit/empty.s b/component/gen/wasi/cli/exit/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/exit/exit.wasm.go b/component/gen/wasi/cli/exit/exit.wasm.go old mode 100755 new mode 100644 index 849d5f50..eb875244 --- a/component/gen/wasi/cli/exit/exit.wasm.go +++ b/component/gen/wasi/cli/exit/exit.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package exit diff --git a/component/gen/wasi/cli/exit/exit.wit.go b/component/gen/wasi/cli/exit/exit.wit.go old mode 100755 new mode 100644 index 947fa253..7b41cbf4 --- a/component/gen/wasi/cli/exit/exit.wit.go +++ b/component/gen/wasi/cli/exit/exit.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package exit represents the imported interface "wasi:cli/exit@0.2.0". package exit import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Exit represents the imported function "exit". diff --git a/component/gen/wasi/cli/stderr/empty.s b/component/gen/wasi/cli/stderr/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/stderr/stderr.wasm.go b/component/gen/wasi/cli/stderr/stderr.wasm.go old mode 100755 new mode 100644 index 462cf172..4f71e47a --- a/component/gen/wasi/cli/stderr/stderr.wasm.go +++ b/component/gen/wasi/cli/stderr/stderr.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stderr diff --git a/component/gen/wasi/cli/stderr/stderr.wit.go b/component/gen/wasi/cli/stderr/stderr.wit.go old mode 100755 new mode 100644 index b4828d97..7f22fa54 --- a/component/gen/wasi/cli/stderr/stderr.wit.go +++ b/component/gen/wasi/cli/stderr/stderr.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stderr represents the imported interface "wasi:cli/stderr@0.2.0". package stderr import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/io/streams" ) diff --git a/component/gen/wasi/cli/stdin/empty.s b/component/gen/wasi/cli/stdin/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/stdin/stdin.wasm.go b/component/gen/wasi/cli/stdin/stdin.wasm.go old mode 100755 new mode 100644 index 374eb253..e23cbf3d --- a/component/gen/wasi/cli/stdin/stdin.wasm.go +++ b/component/gen/wasi/cli/stdin/stdin.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdin diff --git a/component/gen/wasi/cli/stdin/stdin.wit.go b/component/gen/wasi/cli/stdin/stdin.wit.go old mode 100755 new mode 100644 index f249ec10..ed8cc9d6 --- a/component/gen/wasi/cli/stdin/stdin.wit.go +++ b/component/gen/wasi/cli/stdin/stdin.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdin represents the imported interface "wasi:cli/stdin@0.2.0". package stdin import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/io/streams" ) diff --git a/component/gen/wasi/cli/stdout/empty.s b/component/gen/wasi/cli/stdout/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/stdout/stdout.wasm.go b/component/gen/wasi/cli/stdout/stdout.wasm.go old mode 100755 new mode 100644 index 68e4a3da..c184dcca --- a/component/gen/wasi/cli/stdout/stdout.wasm.go +++ b/component/gen/wasi/cli/stdout/stdout.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdout diff --git a/component/gen/wasi/cli/stdout/stdout.wit.go b/component/gen/wasi/cli/stdout/stdout.wit.go old mode 100755 new mode 100644 index bbfeb20b..8a5a056d --- a/component/gen/wasi/cli/stdout/stdout.wit.go +++ b/component/gen/wasi/cli/stdout/stdout.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdout represents the imported interface "wasi:cli/stdout@0.2.0". package stdout import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/io/streams" ) diff --git a/component/gen/wasi/cli/terminal-input/empty.s b/component/gen/wasi/cli/terminal-input/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/terminal-input/terminalinput.wasm.go b/component/gen/wasi/cli/terminal-input/terminal-input.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from component/gen/wasi/cli/terminal-input/terminalinput.wasm.go rename to component/gen/wasi/cli/terminal-input/terminal-input.wasm.go index 1df3794f..d1271efa --- a/component/gen/wasi/cli/terminal-input/terminalinput.wasm.go +++ b/component/gen/wasi/cli/terminal-input/terminal-input.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalinput diff --git a/component/gen/wasi/cli/terminal-input/terminal-input.wit.go b/component/gen/wasi/cli/terminal-input/terminal-input.wit.go old mode 100755 new mode 100644 index fa12e90c..79cafa98 --- a/component/gen/wasi/cli/terminal-input/terminal-input.wit.go +++ b/component/gen/wasi/cli/terminal-input/terminal-input.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalinput represents the imported interface "wasi:cli/terminal-input@0.2.0". // @@ -10,7 +10,7 @@ package terminalinput import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalInput represents the imported resource "wasi:cli/terminal-input@0.2.0#terminal-input". diff --git a/component/gen/wasi/cli/terminal-output/empty.s b/component/gen/wasi/cli/terminal-output/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/terminal-output/terminaloutput.wasm.go b/component/gen/wasi/cli/terminal-output/terminal-output.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from examples/component/http-server/gen/wasi/cli/terminal-output/terminaloutput.wasm.go rename to component/gen/wasi/cli/terminal-output/terminal-output.wasm.go index fb35fc41..e2b1717c --- a/examples/component/http-server/gen/wasi/cli/terminal-output/terminaloutput.wasm.go +++ b/component/gen/wasi/cli/terminal-output/terminal-output.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminaloutput diff --git a/component/gen/wasi/cli/terminal-output/terminal-output.wit.go b/component/gen/wasi/cli/terminal-output/terminal-output.wit.go old mode 100755 new mode 100644 index 199e0cc0..12220659 --- a/component/gen/wasi/cli/terminal-output/terminal-output.wit.go +++ b/component/gen/wasi/cli/terminal-output/terminal-output.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminaloutput represents the imported interface "wasi:cli/terminal-output@0.2.0". // @@ -10,7 +10,7 @@ package terminaloutput import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalOutput represents the imported resource "wasi:cli/terminal-output@0.2.0#terminal-output". diff --git a/component/gen/wasi/cli/terminal-stderr/empty.s b/component/gen/wasi/cli/terminal-stderr/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go b/component/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go old mode 100755 new mode 100644 similarity index 75% rename from component/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go rename to component/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go index be9af72f..f7491c65 --- a/component/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go +++ b/component/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstderr import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". diff --git a/component/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go b/component/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go old mode 100755 new mode 100644 index eb75a4a9..472483bd --- a/component/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go +++ b/component/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstderr represents the imported interface "wasi:cli/terminal-stderr@0.2.0". // @@ -7,7 +7,7 @@ package terminalstderr import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" terminaloutput "go.wasmcloud.dev/component/gen/wasi/cli/terminal-output" ) diff --git a/component/gen/wasi/cli/terminal-stdin/empty.s b/component/gen/wasi/cli/terminal-stdin/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go b/component/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go old mode 100755 new mode 100644 similarity index 74% rename from component/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go rename to component/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go index e3b3ac61..1337d58c --- a/component/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go +++ b/component/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstdin import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". diff --git a/component/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go b/component/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go old mode 100755 new mode 100644 index b8d62de4..51548b4c --- a/component/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go +++ b/component/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdin represents the imported interface "wasi:cli/terminal-stdin@0.2.0". // @@ -7,7 +7,7 @@ package terminalstdin import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" terminalinput "go.wasmcloud.dev/component/gen/wasi/cli/terminal-input" ) diff --git a/component/gen/wasi/cli/terminal-stdout/empty.s b/component/gen/wasi/cli/terminal-stdout/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go b/component/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go old mode 100755 new mode 100644 similarity index 75% rename from examples/component/http-client/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go rename to component/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go index fa750ad9..aaf931c9 --- a/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go +++ b/component/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstdout import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". diff --git a/component/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go b/component/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go old mode 100755 new mode 100644 index 560586a7..62533215 --- a/component/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go +++ b/component/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdout represents the imported interface "wasi:cli/terminal-stdout@0.2.0". // @@ -7,7 +7,7 @@ package terminalstdout import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" terminaloutput "go.wasmcloud.dev/component/gen/wasi/cli/terminal-output" ) diff --git a/component/gen/wasi/clocks/monotonic-clock/empty.s b/component/gen/wasi/clocks/monotonic-clock/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go b/component/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go old mode 100755 new mode 100644 similarity index 91% rename from examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go rename to component/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go index 36a1720a..aae90f4a --- a/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go +++ b/component/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package monotonicclock diff --git a/component/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go b/component/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go old mode 100755 new mode 100644 index 62821e5e..30a0f6d0 --- a/component/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go +++ b/component/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package monotonicclock represents the imported interface "wasi:clocks/monotonic-clock@0.2.0". package monotonicclock import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/io/poll" ) diff --git a/component/gen/wasi/clocks/wall-clock/empty.s b/component/gen/wasi/clocks/wall-clock/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/clocks/wall-clock/wallclock.wasm.go b/component/gen/wasi/clocks/wall-clock/wall-clock.wasm.go old mode 100755 new mode 100644 similarity index 85% rename from examples/component/http-server/gen/wasi/clocks/wall-clock/wallclock.wasm.go rename to component/gen/wasi/clocks/wall-clock/wall-clock.wasm.go index 321ff3f1..662ea1e5 --- a/examples/component/http-server/gen/wasi/clocks/wall-clock/wallclock.wasm.go +++ b/component/gen/wasi/clocks/wall-clock/wall-clock.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package wallclock diff --git a/component/gen/wasi/clocks/wall-clock/wall-clock.wit.go b/component/gen/wasi/clocks/wall-clock/wall-clock.wit.go old mode 100755 new mode 100644 index e3f35395..b97eddd8 --- a/component/gen/wasi/clocks/wall-clock/wall-clock.wit.go +++ b/component/gen/wasi/clocks/wall-clock/wall-clock.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package wallclock represents the imported interface "wasi:clocks/wall-clock@0.2.0". package wallclock import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // DateTime represents the record "wasi:clocks/wall-clock@0.2.0#datetime". @@ -14,9 +14,9 @@ import ( // nanoseconds: u32, // } type DateTime struct { - _ cm.HostLayout - Seconds uint64 - Nanoseconds uint32 + _ cm.HostLayout `json:"-"` + Seconds uint64 `json:"seconds"` + Nanoseconds uint32 `json:"nanoseconds"` } // Now represents the imported function "now". diff --git a/component/gen/wasi/config/runtime/abi.go b/component/gen/wasi/config/runtime/abi.go old mode 100755 new mode 100644 index 61412cbe..a99a45a9 --- a/component/gen/wasi/config/runtime/abi.go +++ b/component/gen/wasi/config/runtime/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/component/gen/wasi/config/runtime/empty.s b/component/gen/wasi/config/runtime/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/config/runtime/runtime.wasm.go b/component/gen/wasi/config/runtime/runtime.wasm.go old mode 100755 new mode 100644 index 8ce17d5e..b9e129da --- a/component/gen/wasi/config/runtime/runtime.wasm.go +++ b/component/gen/wasi/config/runtime/runtime.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:config@0.2.0-draft". diff --git a/component/gen/wasi/config/runtime/runtime.wit.go b/component/gen/wasi/config/runtime/runtime.wit.go old mode 100755 new mode 100644 index 8fbbe37b..8fded2d6 --- a/component/gen/wasi/config/runtime/runtime.wit.go +++ b/component/gen/wasi/config/runtime/runtime.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package runtime represents the imported interface "wasi:config/runtime@0.2.0-draft". package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // ConfigError represents the variant "wasi:config/runtime@0.2.0-draft#config-error". @@ -50,14 +50,14 @@ func (self *ConfigError) IO() *string { return cm.Case[string](self, 1) } -var stringsConfigError = [2]string{ +var _ConfigErrorStrings = [2]string{ "upstream", "io", } // String implements [fmt.Stringer], returning the variant case name of v. func (v ConfigError) String() string { - return stringsConfigError[v.Tag()] + return _ConfigErrorStrings[v.Tag()] } // Get represents the imported function "get". diff --git a/component/gen/wasi/filesystem/preopens/empty.s b/component/gen/wasi/filesystem/preopens/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/filesystem/preopens/preopens.wasm.go b/component/gen/wasi/filesystem/preopens/preopens.wasm.go old mode 100755 new mode 100644 index 1bcd416a..6aebe453 --- a/component/gen/wasi/filesystem/preopens/preopens.wasm.go +++ b/component/gen/wasi/filesystem/preopens/preopens.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package preopens import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0". diff --git a/component/gen/wasi/filesystem/preopens/preopens.wit.go b/component/gen/wasi/filesystem/preopens/preopens.wit.go old mode 100755 new mode 100644 index 8221e0ae..f07aad18 --- a/component/gen/wasi/filesystem/preopens/preopens.wit.go +++ b/component/gen/wasi/filesystem/preopens/preopens.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package preopens represents the imported interface "wasi:filesystem/preopens@0.2.0". package preopens import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/filesystem/types" ) diff --git a/component/gen/wasi/filesystem/types/abi.go b/component/gen/wasi/filesystem/types/abi.go old mode 100755 new mode 100644 index aff0f9ae..fc6be794 --- a/component/gen/wasi/filesystem/types/abi.go +++ b/component/gen/wasi/filesystem/types/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" wallclock "go.wasmcloud.dev/component/gen/wasi/clocks/wall-clock" "unsafe" ) diff --git a/component/gen/wasi/filesystem/types/empty.s b/component/gen/wasi/filesystem/types/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/filesystem/types/types.wasm.go b/component/gen/wasi/filesystem/types/types.wasm.go old mode 100755 new mode 100644 index b97dad84..9c919e5e --- a/component/gen/wasi/filesystem/types/types.wasm.go +++ b/component/gen/wasi/filesystem/types/types.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0". diff --git a/component/gen/wasi/filesystem/types/types.wit.go b/component/gen/wasi/filesystem/types/types.wit.go old mode 100755 new mode 100644 index b21852f9..1676ed7b --- a/component/gen/wasi/filesystem/types/types.wit.go +++ b/component/gen/wasi/filesystem/types/types.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:filesystem/types@0.2.0". package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" wallclock "go.wasmcloud.dev/component/gen/wasi/clocks/wall-clock" "go.wasmcloud.dev/component/gen/wasi/io/streams" ) @@ -59,7 +59,7 @@ const ( DescriptorTypeSocket ) -var stringsDescriptorType = [8]string{ +var _DescriptorTypeStrings = [8]string{ "unknown", "block-device", "character-device", @@ -72,9 +72,22 @@ var stringsDescriptorType = [8]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e DescriptorType) String() string { - return stringsDescriptorType[e] + return _DescriptorTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e DescriptorType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *DescriptorType) UnmarshalText(text []byte) error { + return _DescriptorTypeUnmarshalCase(e, text) +} + +var _DescriptorTypeUnmarshalCase = cm.CaseUnmarshaler[DescriptorType](_DescriptorTypeStrings[:]) + // DescriptorFlags represents the flags "wasi:filesystem/types@0.2.0#descriptor-flags". // // flags descriptor-flags { @@ -140,13 +153,13 @@ type LinkCount uint64 // status-change-timestamp: option, // } type DescriptorStat struct { - _ cm.HostLayout - Type DescriptorType - LinkCount LinkCount - Size FileSize - DataAccessTimestamp cm.Option[DateTime] - DataModificationTimestamp cm.Option[DateTime] - StatusChangeTimestamp cm.Option[DateTime] + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + LinkCount LinkCount `json:"link-count"` + Size FileSize `json:"size"` + DataAccessTimestamp cm.Option[DateTime] `json:"data-access-timestamp"` + DataModificationTimestamp cm.Option[DateTime] `json:"data-modification-timestamp"` + StatusChangeTimestamp cm.Option[DateTime] `json:"status-change-timestamp"` } // NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp". @@ -190,7 +203,7 @@ func (self *NewTimestamp) Timestamp() *DateTime { return cm.Case[DateTime](self, 2) } -var stringsNewTimestamp = [3]string{ +var _NewTimestampStrings = [3]string{ "no-change", "now", "timestamp", @@ -198,7 +211,7 @@ var stringsNewTimestamp = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v NewTimestamp) String() string { - return stringsNewTimestamp[v.Tag()] + return _NewTimestampStrings[v.Tag()] } // DirectoryEntry represents the record "wasi:filesystem/types@0.2.0#directory-entry". @@ -208,9 +221,9 @@ func (v NewTimestamp) String() string { // name: string, // } type DirectoryEntry struct { - _ cm.HostLayout - Type DescriptorType - Name string + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + Name string `json:"name"` } // ErrorCode represents the enum "wasi:filesystem/types@0.2.0#error-code". @@ -296,7 +309,7 @@ const ( ErrorCodeCrossDevice ) -var stringsErrorCode = [37]string{ +var _ErrorCodeStrings = [37]string{ "access", "would-block", "already", @@ -338,9 +351,22 @@ var stringsErrorCode = [37]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // Advice represents the enum "wasi:filesystem/types@0.2.0#advice". // // enum advice { @@ -362,7 +388,7 @@ const ( AdviceNoReuse ) -var stringsAdvice = [6]string{ +var _AdviceStrings = [6]string{ "normal", "sequential", "random", @@ -373,9 +399,22 @@ var stringsAdvice = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Advice) String() string { - return stringsAdvice[e] + return _AdviceStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e Advice) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Advice) UnmarshalText(text []byte) error { + return _AdviceUnmarshalCase(e, text) +} + +var _AdviceUnmarshalCase = cm.CaseUnmarshaler[Advice](_AdviceStrings[:]) + // MetadataHashValue represents the record "wasi:filesystem/types@0.2.0#metadata-hash-value". // // record metadata-hash-value { @@ -383,9 +422,9 @@ func (e Advice) String() string { // upper: u64, // } type MetadataHashValue struct { - _ cm.HostLayout - Lower uint64 - Upper uint64 + _ cm.HostLayout `json:"-"` + Lower uint64 `json:"lower"` + Upper uint64 `json:"upper"` } // Descriptor represents the imported resource "wasi:filesystem/types@0.2.0#descriptor". diff --git a/component/gen/wasi/http/incoming-handler/empty.s b/component/gen/wasi/http/incoming-handler/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/http/incoming-handler/incoming-handler.exports.go b/component/gen/wasi/http/incoming-handler/incoming-handler.exports.go old mode 100755 new mode 100644 index 673ccb48..6447d62b --- a/component/gen/wasi/http/incoming-handler/incoming-handler.exports.go +++ b/component/gen/wasi/http/incoming-handler/incoming-handler.exports.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package incominghandler diff --git a/component/gen/wasi/http/incoming-handler/incominghandler.wasm.go b/component/gen/wasi/http/incoming-handler/incoming-handler.wasm.go old mode 100755 new mode 100644 similarity index 84% rename from component/gen/wasi/http/incoming-handler/incominghandler.wasm.go rename to component/gen/wasi/http/incoming-handler/incoming-handler.wasm.go index eae429f3..abeca9ae --- a/component/gen/wasi/http/incoming-handler/incominghandler.wasm.go +++ b/component/gen/wasi/http/incoming-handler/incoming-handler.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package incominghandler import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". diff --git a/component/gen/wasi/http/incoming-handler/incoming-handler.wit.go b/component/gen/wasi/http/incoming-handler/incoming-handler.wit.go old mode 100755 new mode 100644 index 312fa23c..55c25806 --- a/component/gen/wasi/http/incoming-handler/incoming-handler.wit.go +++ b/component/gen/wasi/http/incoming-handler/incoming-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package incominghandler represents the exported interface "wasi:http/incoming-handler@0.2.0". // diff --git a/component/gen/wasi/http/outgoing-handler/abi.go b/component/gen/wasi/http/outgoing-handler/abi.go old mode 100755 new mode 100644 index 8fadfc32..89fa94be --- a/component/gen/wasi/http/outgoing-handler/abi.go +++ b/component/gen/wasi/http/outgoing-handler/abi.go @@ -1,17 +1,16 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler import ( - "go.bytecodealliance.org/cm" - "go.wasmcloud.dev/component/gen/wasi/http/types" + "go.wasmcloud.dev/component/cm" "unsafe" ) // ErrorCodeShape is used for storage in variant or result types. type ErrorCodeShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(types.ErrorCode{})]byte + shape [unsafe.Sizeof(ErrorCode{})]byte } func lower_OptionRequestOptions(v cm.Option[RequestOptions]) (f0 uint32, f1 uint32) { diff --git a/component/gen/wasi/http/outgoing-handler/empty.s b/component/gen/wasi/http/outgoing-handler/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go b/component/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go old mode 100755 new mode 100644 similarity index 78% rename from examples/component/http-server/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go rename to component/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go index 6b3f3828..efbfdb74 --- a/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go +++ b/component/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". diff --git a/component/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go b/component/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go old mode 100755 new mode 100644 index b4dc554b..7b548884 --- a/component/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go +++ b/component/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package outgoinghandler represents the imported interface "wasi:http/outgoing-handler@0.2.0". // @@ -7,7 +7,7 @@ package outgoinghandler import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/http/types" ) diff --git a/component/gen/wasi/http/types/abi.go b/component/gen/wasi/http/types/abi.go old mode 100755 new mode 100644 index 6ffb1fdd..7c24d70f --- a/component/gen/wasi/http/types/abi.go +++ b/component/gen/wasi/http/types/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/component/gen/wasi/http/types/empty.s b/component/gen/wasi/http/types/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/http/types/types.wasm.go b/component/gen/wasi/http/types/types.wasm.go old mode 100755 new mode 100644 index b025b2af..1d4810cf --- a/component/gen/wasi/http/types/types.wasm.go +++ b/component/gen/wasi/http/types/types.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". diff --git a/component/gen/wasi/http/types/types.wit.go b/component/gen/wasi/http/types/types.wit.go old mode 100755 new mode 100644 index 62474968..ab0bb657 --- a/component/gen/wasi/http/types/types.wit.go +++ b/component/gen/wasi/http/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:http/types@0.2.0". // @@ -8,7 +8,7 @@ package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" monotonicclock "go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock" ioerror "go.wasmcloud.dev/component/gen/wasi/io/error" "go.wasmcloud.dev/component/gen/wasi/io/poll" @@ -167,7 +167,7 @@ func (self *Method) Other() *string { return cm.Case[string](self, 9) } -var stringsMethod = [10]string{ +var _MethodStrings = [10]string{ "get", "head", "post", @@ -182,7 +182,7 @@ var stringsMethod = [10]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Method) String() string { - return stringsMethod[v.Tag()] + return _MethodStrings[v.Tag()] } // Scheme represents the variant "wasi:http/types@0.2.0#scheme". @@ -228,7 +228,7 @@ func (self *Scheme) Other() *string { return cm.Case[string](self, 2) } -var stringsScheme = [3]string{ +var _SchemeStrings = [3]string{ "HTTP", "HTTPS", "other", @@ -236,7 +236,7 @@ var stringsScheme = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Scheme) String() string { - return stringsScheme[v.Tag()] + return _SchemeStrings[v.Tag()] } // DNSErrorPayload represents the record "wasi:http/types@0.2.0#DNS-error-payload". @@ -248,9 +248,9 @@ func (v Scheme) String() string { // info-code: option, // } type DNSErrorPayload struct { - _ cm.HostLayout - Rcode cm.Option[string] - InfoCode cm.Option[uint16] + _ cm.HostLayout `json:"-"` + Rcode cm.Option[string] `json:"rcode"` + InfoCode cm.Option[uint16] `json:"info-code"` } // TLSAlertReceivedPayload represents the record "wasi:http/types@0.2.0#TLS-alert-received-payload". @@ -262,9 +262,9 @@ type DNSErrorPayload struct { // alert-message: option, // } type TLSAlertReceivedPayload struct { - _ cm.HostLayout - AlertID cm.Option[uint8] - AlertMessage cm.Option[string] + _ cm.HostLayout `json:"-"` + AlertID cm.Option[uint8] `json:"alert-id"` + AlertMessage cm.Option[string] `json:"alert-message"` } // FieldSizePayload represents the record "wasi:http/types@0.2.0#field-size-payload". @@ -276,9 +276,9 @@ type TLSAlertReceivedPayload struct { // field-size: option, // } type FieldSizePayload struct { - _ cm.HostLayout - FieldName cm.Option[string] - FieldSize cm.Option[uint32] + _ cm.HostLayout `json:"-"` + FieldName cm.Option[string] `json:"field-name"` + FieldSize cm.Option[uint32] `json:"field-size"` } // ErrorCode represents the variant "wasi:http/types@0.2.0#error-code". @@ -749,7 +749,7 @@ func (self *ErrorCode) InternalError() *cm.Option[string] { return cm.Case[cm.Option[string]](self, 38) } -var stringsErrorCode = [39]string{ +var _ErrorCodeStrings = [39]string{ "DNS-timeout", "DNS-error", "destination-not-found", @@ -793,7 +793,7 @@ var stringsErrorCode = [39]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v ErrorCode) String() string { - return stringsErrorCode[v.Tag()] + return _ErrorCodeStrings[v.Tag()] } // HeaderError represents the variant "wasi:http/types@0.2.0#header-error". @@ -823,7 +823,7 @@ const ( HeaderErrorImmutable ) -var stringsHeaderError = [3]string{ +var _HeaderErrorStrings = [3]string{ "invalid-syntax", "forbidden", "immutable", @@ -831,9 +831,22 @@ var stringsHeaderError = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e HeaderError) String() string { - return stringsHeaderError[e] + return _HeaderErrorStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e HeaderError) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *HeaderError) UnmarshalText(text []byte) error { + return _HeaderErrorUnmarshalCase(e, text) +} + +var _HeaderErrorUnmarshalCase = cm.CaseUnmarshaler[HeaderError](_HeaderErrorStrings[:]) + // FieldKey represents the string "wasi:http/types@0.2.0#field-key". // // Field keys are always strings. diff --git a/component/gen/wasi/io/error/empty.s b/component/gen/wasi/io/error/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/io/error/ioerror.wasm.go b/component/gen/wasi/io/error/error.wasm.go old mode 100755 new mode 100644 similarity index 86% rename from component/gen/wasi/io/error/ioerror.wasm.go rename to component/gen/wasi/io/error/error.wasm.go index e254b5d8..eee2750b --- a/component/gen/wasi/io/error/ioerror.wasm.go +++ b/component/gen/wasi/io/error/error.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ioerror diff --git a/component/gen/wasi/io/error/error.wit.go b/component/gen/wasi/io/error/error.wit.go old mode 100755 new mode 100644 index 828e977e..ed84ae22 --- a/component/gen/wasi/io/error/error.wit.go +++ b/component/gen/wasi/io/error/error.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ioerror represents the imported interface "wasi:io/error@0.2.0". package ioerror import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Error represents the imported resource "wasi:io/error@0.2.0#error". diff --git a/component/gen/wasi/io/poll/empty.s b/component/gen/wasi/io/poll/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/io/poll/poll.wasm.go b/component/gen/wasi/io/poll/poll.wasm.go old mode 100755 new mode 100644 index f7c55c3d..ab811b32 --- a/component/gen/wasi/io/poll/poll.wasm.go +++ b/component/gen/wasi/io/poll/poll.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package poll import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". diff --git a/component/gen/wasi/io/poll/poll.wit.go b/component/gen/wasi/io/poll/poll.wit.go old mode 100755 new mode 100644 index ad9e9564..cb8f618f --- a/component/gen/wasi/io/poll/poll.wit.go +++ b/component/gen/wasi/io/poll/poll.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package poll represents the imported interface "wasi:io/poll@0.2.0". package poll import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Pollable represents the imported resource "wasi:io/poll@0.2.0#pollable". diff --git a/component/gen/wasi/io/streams/empty.s b/component/gen/wasi/io/streams/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/io/streams/streams.wasm.go b/component/gen/wasi/io/streams/streams.wasm.go old mode 100755 new mode 100644 index eec56645..a754dbcf --- a/component/gen/wasi/io/streams/streams.wasm.go +++ b/component/gen/wasi/io/streams/streams.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package streams import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". diff --git a/component/gen/wasi/io/streams/streams.wit.go b/component/gen/wasi/io/streams/streams.wit.go old mode 100755 new mode 100644 index 264e2348..4509f5f8 --- a/component/gen/wasi/io/streams/streams.wit.go +++ b/component/gen/wasi/io/streams/streams.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package streams represents the imported interface "wasi:io/streams@0.2.0". package streams import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ioerror "go.wasmcloud.dev/component/gen/wasi/io/error" "go.wasmcloud.dev/component/gen/wasi/io/poll" ) @@ -48,14 +48,14 @@ func (self *StreamError) Closed() bool { return self.Tag() == 1 } -var stringsStreamError = [2]string{ +var _StreamErrorStrings = [2]string{ "last-operation-failed", "closed", } // String implements [fmt.Stringer], returning the variant case name of v. func (v StreamError) String() string { - return stringsStreamError[v.Tag()] + return _StreamErrorStrings[v.Tag()] } // InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream". diff --git a/component/gen/wasi/logging/logging/empty.s b/component/gen/wasi/logging/logging/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/logging/logging/logging.wasm.go b/component/gen/wasi/logging/logging/logging.wasm.go old mode 100755 new mode 100644 index d2d27098..bc430bd6 --- a/component/gen/wasi/logging/logging/logging.wasm.go +++ b/component/gen/wasi/logging/logging/logging.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package logging diff --git a/component/gen/wasi/logging/logging/logging.wit.go b/component/gen/wasi/logging/logging/logging.wit.go old mode 100755 new mode 100644 index aaa2e532..ed5b1fe4 --- a/component/gen/wasi/logging/logging/logging.wit.go +++ b/component/gen/wasi/logging/logging/logging.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package logging represents the imported interface "wasi:logging/logging@0.1.0-draft". // @@ -7,7 +7,7 @@ package logging import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Level represents the enum "wasi:logging/logging@0.1.0-draft#level". @@ -47,7 +47,7 @@ const ( LevelCritical ) -var stringsLevel = [6]string{ +var _LevelStrings = [6]string{ "trace", "debug", "info", @@ -58,9 +58,22 @@ var stringsLevel = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Level) String() string { - return stringsLevel[e] + return _LevelStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e Level) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Level) UnmarshalText(text []byte) error { + return _LevelUnmarshalCase(e, text) +} + +var _LevelUnmarshalCase = cm.CaseUnmarshaler[Level](_LevelStrings[:]) + // Log represents the imported function "log". // // Emit a log message. diff --git a/component/gen/wasi/random/insecure-seed/empty.s b/component/gen/wasi/random/insecure-seed/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/random/insecure-seed/insecureseed.wasm.go b/component/gen/wasi/random/insecure-seed/insecure-seed.wasm.go old mode 100755 new mode 100644 similarity index 80% rename from examples/component/http-client/gen/wasi/random/insecure-seed/insecureseed.wasm.go rename to component/gen/wasi/random/insecure-seed/insecure-seed.wasm.go index e94356df..2c1d8b4a --- a/examples/component/http-client/gen/wasi/random/insecure-seed/insecureseed.wasm.go +++ b/component/gen/wasi/random/insecure-seed/insecure-seed.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecureseed diff --git a/component/gen/wasi/random/insecure-seed/insecure-seed.wit.go b/component/gen/wasi/random/insecure-seed/insecure-seed.wit.go old mode 100755 new mode 100644 index e701d1b4..856b2cc7 --- a/component/gen/wasi/random/insecure-seed/insecure-seed.wit.go +++ b/component/gen/wasi/random/insecure-seed/insecure-seed.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecureseed represents the imported interface "wasi:random/insecure-seed@0.2.0". package insecureseed diff --git a/component/gen/wasi/random/insecure/empty.s b/component/gen/wasi/random/insecure/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/random/insecure/insecure.wasm.go b/component/gen/wasi/random/insecure/insecure.wasm.go old mode 100755 new mode 100644 index 498bfe4a..cfcd23b9 --- a/component/gen/wasi/random/insecure/insecure.wasm.go +++ b/component/gen/wasi/random/insecure/insecure.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecure import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". diff --git a/component/gen/wasi/random/insecure/insecure.wit.go b/component/gen/wasi/random/insecure/insecure.wit.go old mode 100755 new mode 100644 index f32282c6..6195f9a6 --- a/component/gen/wasi/random/insecure/insecure.wit.go +++ b/component/gen/wasi/random/insecure/insecure.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecure represents the imported interface "wasi:random/insecure@0.2.0". package insecure import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetInsecureRandomBytes represents the imported function "get-insecure-random-bytes". diff --git a/component/gen/wasi/random/random/empty.s b/component/gen/wasi/random/random/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/random/random/random.wasm.go b/component/gen/wasi/random/random/random.wasm.go old mode 100755 new mode 100644 index 9096457b..d7885ae4 --- a/component/gen/wasi/random/random/random.wasm.go +++ b/component/gen/wasi/random/random/random.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package random import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". diff --git a/component/gen/wasi/random/random/random.wit.go b/component/gen/wasi/random/random/random.wit.go old mode 100755 new mode 100644 index 98bb7779..392341aa --- a/component/gen/wasi/random/random/random.wit.go +++ b/component/gen/wasi/random/random/random.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package random represents the imported interface "wasi:random/random@0.2.0". package random import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetRandomBytes represents the imported function "get-random-bytes". diff --git a/component/gen/wasi/sockets/instance-network/empty.s b/component/gen/wasi/sockets/instance-network/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/instance-network/instancenetwork.wasm.go b/component/gen/wasi/sockets/instance-network/instance-network.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from examples/component/http-client/gen/wasi/sockets/instance-network/instancenetwork.wasm.go rename to component/gen/wasi/sockets/instance-network/instance-network.wasm.go index eb113e21..aca75114 --- a/examples/component/http-client/gen/wasi/sockets/instance-network/instancenetwork.wasm.go +++ b/component/gen/wasi/sockets/instance-network/instance-network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package instancenetwork diff --git a/component/gen/wasi/sockets/instance-network/instance-network.wit.go b/component/gen/wasi/sockets/instance-network/instance-network.wit.go old mode 100755 new mode 100644 index 293c15db..725d33d3 --- a/component/gen/wasi/sockets/instance-network/instance-network.wit.go +++ b/component/gen/wasi/sockets/instance-network/instance-network.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package instancenetwork represents the imported interface "wasi:sockets/instance-network@0.2.0". package instancenetwork import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/sockets/network" ) diff --git a/component/gen/wasi/sockets/ip-name-lookup/abi.go b/component/gen/wasi/sockets/ip-name-lookup/abi.go old mode 100755 new mode 100644 index a63f0d01..87ab2794 --- a/component/gen/wasi/sockets/ip-name-lookup/abi.go +++ b/component/gen/wasi/sockets/ip-name-lookup/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/component/gen/wasi/sockets/ip-name-lookup/empty.s b/component/gen/wasi/sockets/ip-name-lookup/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go b/component/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go old mode 100755 new mode 100644 similarity index 91% rename from component/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go rename to component/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go index da5fb000..24edd5cb --- a/component/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go +++ b/component/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". diff --git a/component/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go b/component/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go old mode 100755 new mode 100644 index 093ca5b2..3e741688 --- a/component/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go +++ b/component/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ipnamelookup represents the imported interface "wasi:sockets/ip-name-lookup@0.2.0". package ipnamelookup import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/io/poll" "go.wasmcloud.dev/component/gen/wasi/sockets/network" ) diff --git a/component/gen/wasi/sockets/network/abi.go b/component/gen/wasi/sockets/network/abi.go old mode 100755 new mode 100644 index a088bd1d..3d09cbe2 --- a/component/gen/wasi/sockets/network/abi.go +++ b/component/gen/wasi/sockets/network/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/component/gen/wasi/sockets/network/empty.s b/component/gen/wasi/sockets/network/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/sockets/network/network.wasm.go b/component/gen/wasi/sockets/network/network.wasm.go old mode 100755 new mode 100644 index 012a79ff..23f02bdd --- a/component/gen/wasi/sockets/network/network.wasm.go +++ b/component/gen/wasi/sockets/network/network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network diff --git a/component/gen/wasi/sockets/network/network.wit.go b/component/gen/wasi/sockets/network/network.wit.go old mode 100755 new mode 100644 index f0fb7eef..17d70aeb --- a/component/gen/wasi/sockets/network/network.wit.go +++ b/component/gen/wasi/sockets/network/network.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package network represents the imported interface "wasi:sockets/network@0.2.0". package network import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Network represents the imported resource "wasi:sockets/network@0.2.0#network". @@ -74,7 +74,7 @@ const ( ErrorCodePermanentResolverFailure ) -var stringsErrorCode = [21]string{ +var _ErrorCodeStrings = [21]string{ "unknown", "access-denied", "not-supported", @@ -100,9 +100,22 @@ var stringsErrorCode = [21]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // IPAddressFamily represents the enum "wasi:sockets/network@0.2.0#ip-address-family". // // enum ip-address-family { @@ -116,16 +129,29 @@ const ( IPAddressFamilyIPv6 ) -var stringsIPAddressFamily = [2]string{ +var _IPAddressFamilyStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the enum case name of e. func (e IPAddressFamily) String() string { - return stringsIPAddressFamily[e] + return _IPAddressFamilyStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e IPAddressFamily) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *IPAddressFamily) UnmarshalText(text []byte) error { + return _IPAddressFamilyUnmarshalCase(e, text) +} + +var _IPAddressFamilyUnmarshalCase = cm.CaseUnmarshaler[IPAddressFamily](_IPAddressFamilyStrings[:]) + // IPv4Address represents the tuple "wasi:sockets/network@0.2.0#ipv4-address". // // type ipv4-address = tuple @@ -164,14 +190,14 @@ func (self *IPAddress) IPv6() *IPv6Address { return cm.Case[IPv6Address](self, 1) } -var stringsIPAddress = [2]string{ +var _IPAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPAddress) String() string { - return stringsIPAddress[v.Tag()] + return _IPAddressStrings[v.Tag()] } // IPv4SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv4-socket-address". @@ -181,9 +207,9 @@ func (v IPAddress) String() string { // address: ipv4-address, // } type IPv4SocketAddress struct { - _ cm.HostLayout - Port uint16 - Address IPv4Address + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + Address IPv4Address `json:"address"` } // IPv6SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv6-socket-address". @@ -195,11 +221,11 @@ type IPv4SocketAddress struct { // scope-id: u32, // } type IPv6SocketAddress struct { - _ cm.HostLayout - Port uint16 - FlowInfo uint32 - Address IPv6Address - ScopeID uint32 + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + FlowInfo uint32 `json:"flow-info"` + Address IPv6Address `json:"address"` + ScopeID uint32 `json:"scope-id"` } // IPSocketAddress represents the variant "wasi:sockets/network@0.2.0#ip-socket-address". @@ -230,12 +256,12 @@ func (self *IPSocketAddress) IPv6() *IPv6SocketAddress { return cm.Case[IPv6SocketAddress](self, 1) } -var stringsIPSocketAddress = [2]string{ +var _IPSocketAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPSocketAddress) String() string { - return stringsIPSocketAddress[v.Tag()] + return _IPSocketAddressStrings[v.Tag()] } diff --git a/component/gen/wasi/sockets/tcp-create-socket/empty.s b/component/gen/wasi/sockets/tcp-create-socket/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go b/component/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go old mode 100755 new mode 100644 similarity index 77% rename from examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go rename to component/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go index b7b43155..5124c0c0 --- a/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go +++ b/component/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcpcreatesocket import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". diff --git a/component/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go b/component/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go old mode 100755 new mode 100644 index 5cc95cd1..b19c98cc --- a/component/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go +++ b/component/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcpcreatesocket represents the imported interface "wasi:sockets/tcp-create-socket@0.2.0". package tcpcreatesocket import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/sockets/network" "go.wasmcloud.dev/component/gen/wasi/sockets/tcp" ) diff --git a/component/gen/wasi/sockets/tcp/abi.go b/component/gen/wasi/sockets/tcp/abi.go old mode 100755 new mode 100644 index 3fde982e..3dfc2458 --- a/component/gen/wasi/sockets/tcp/abi.go +++ b/component/gen/wasi/sockets/tcp/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/sockets/network" "unsafe" ) @@ -23,7 +23,7 @@ type TupleInputStreamOutputStreamShape struct { // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/component/gen/wasi/sockets/tcp/empty.s b/component/gen/wasi/sockets/tcp/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/sockets/tcp/tcp.wasm.go b/component/gen/wasi/sockets/tcp/tcp.wasm.go old mode 100755 new mode 100644 index 56247525..b833ba41 --- a/component/gen/wasi/sockets/tcp/tcp.wasm.go +++ b/component/gen/wasi/sockets/tcp/tcp.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". @@ -46,7 +46,7 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32, //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-enabled //go:noescape -func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool, bool, ErrorCode]) +func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[ErrorCode, bool, ErrorCode]) //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-idle-time //go:noescape diff --git a/component/gen/wasi/sockets/tcp/tcp.wit.go b/component/gen/wasi/sockets/tcp/tcp.wit.go old mode 100755 new mode 100644 index e9a0094c..502ae41b --- a/component/gen/wasi/sockets/tcp/tcp.wit.go +++ b/component/gen/wasi/sockets/tcp/tcp.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcp represents the imported interface "wasi:sockets/tcp@0.2.0". package tcp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" monotonicclock "go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock" "go.wasmcloud.dev/component/gen/wasi/io/poll" "go.wasmcloud.dev/component/gen/wasi/io/streams" @@ -66,7 +66,7 @@ const ( ShutdownTypeBoth ) -var stringsShutdownType = [3]string{ +var _ShutdownTypeStrings = [3]string{ "receive", "send", "both", @@ -74,9 +74,22 @@ var stringsShutdownType = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ShutdownType) String() string { - return stringsShutdownType[e] + return _ShutdownTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ShutdownType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ShutdownType) UnmarshalText(text []byte) error { + return _ShutdownTypeUnmarshalCase(e, text) +} + +var _ShutdownTypeUnmarshalCase = cm.CaseUnmarshaler[ShutdownType](_ShutdownTypeStrings[:]) + // TCPSocket represents the imported resource "wasi:sockets/tcp@0.2.0#tcp-socket". // // resource tcp-socket @@ -188,7 +201,7 @@ func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCo // keep-alive-enabled: func() -> result // //go:nosplit -func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) { +func (self TCPSocket) KeepAliveEnabled() (result cm.Result[ErrorCode, bool, ErrorCode]) { self0 := cm.Reinterpret[uint32](self) wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result) return diff --git a/component/gen/wasi/sockets/udp-create-socket/empty.s b/component/gen/wasi/sockets/udp-create-socket/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go b/component/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go old mode 100755 new mode 100644 similarity index 77% rename from examples/component/http-client/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go rename to component/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go index 94b1ab67..bbae0015 --- a/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go +++ b/component/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udpcreatesocket import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". diff --git a/component/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go b/component/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go old mode 100755 new mode 100644 index 1a152d99..fa400b88 --- a/component/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go +++ b/component/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udpcreatesocket represents the imported interface "wasi:sockets/udp-create-socket@0.2.0". package udpcreatesocket import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/sockets/network" "go.wasmcloud.dev/component/gen/wasi/sockets/udp" ) diff --git a/component/gen/wasi/sockets/udp/abi.go b/component/gen/wasi/sockets/udp/abi.go old mode 100755 new mode 100644 index ffe391ca..b6b1f795 --- a/component/gen/wasi/sockets/udp/abi.go +++ b/component/gen/wasi/sockets/udp/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/sockets/network" "unsafe" ) @@ -11,7 +11,7 @@ import ( // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/component/gen/wasi/sockets/udp/empty.s b/component/gen/wasi/sockets/udp/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/sockets/udp/udp.wasm.go b/component/gen/wasi/sockets/udp/udp.wasm.go old mode 100755 new mode 100644 index 83ce8ca7..662148ba --- a/component/gen/wasi/sockets/udp/udp.wasm.go +++ b/component/gen/wasi/sockets/udp/udp.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". diff --git a/component/gen/wasi/sockets/udp/udp.wit.go b/component/gen/wasi/sockets/udp/udp.wit.go old mode 100755 new mode 100644 index 1ca58b28..c389235a --- a/component/gen/wasi/sockets/udp/udp.wit.go +++ b/component/gen/wasi/sockets/udp/udp.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udp represents the imported interface "wasi:sockets/udp@0.2.0". package udp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/io/poll" "go.wasmcloud.dev/component/gen/wasi/sockets/network" ) @@ -41,9 +41,9 @@ type IPAddressFamily = network.IPAddressFamily // remote-address: ip-socket-address, // } type IncomingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress IPSocketAddress + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress IPSocketAddress `json:"remote-address"` } // OutgoingDatagram represents the record "wasi:sockets/udp@0.2.0#outgoing-datagram". @@ -53,9 +53,9 @@ type IncomingDatagram struct { // remote-address: option, // } type OutgoingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress cm.Option[IPSocketAddress] + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress cm.Option[IPSocketAddress] `json:"remote-address"` } // UDPSocket represents the imported resource "wasi:sockets/udp@0.2.0#udp-socket". diff --git a/component/gen/wasmcloud/bus/lattice/empty.s b/component/gen/wasmcloud/bus/lattice/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasmcloud/bus/lattice/lattice.wasm.go b/component/gen/wasmcloud/bus/lattice/lattice.wasm.go old mode 100755 new mode 100644 index 7c7b9094..a7e9df88 --- a/component/gen/wasmcloud/bus/lattice/lattice.wasm.go +++ b/component/gen/wasmcloud/bus/lattice/lattice.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package lattice diff --git a/component/gen/wasmcloud/bus/lattice/lattice.wit.go b/component/gen/wasmcloud/bus/lattice/lattice.wit.go old mode 100755 new mode 100644 index b8d320da..394f038c --- a/component/gen/wasmcloud/bus/lattice/lattice.wit.go +++ b/component/gen/wasmcloud/bus/lattice/lattice.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package lattice represents the imported interface "wasmcloud:bus/lattice@1.0.0". package lattice import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // CallTargetInterface represents the imported resource "wasmcloud:bus/lattice@1.0.0#call-target-interface". diff --git a/component/gen/wasmcloud/component-go/sdk/sdk.wit b/component/gen/wasmcloud/component-go/sdk/sdk.wit deleted file mode 100755 index 5bd0b190..00000000 --- a/component/gen/wasmcloud/component-go/sdk/sdk.wit +++ /dev/null @@ -1,1250 +0,0 @@ -package wasmcloud:component-go@0.1.0; - -world sdk { - import wasi:io/poll@0.2.0; - import wasi:clocks/monotonic-clock@0.2.0; - import wasi:io/error@0.2.0; - import wasi:io/streams@0.2.0; - import wasi:http/types@0.2.0; - import wasi:logging/logging@0.1.0-draft; - import wasi:config/runtime@0.2.0-draft; - import wasi:http/outgoing-handler@0.2.0; - import wasmcloud:bus/lattice@1.0.0; - import wasmcloud:secrets/store@0.1.0-draft; - import wasmcloud:secrets/reveal@0.1.0-draft; - import wasi:cli/environment@0.2.0; - import wasi:cli/exit@0.2.0; - import wasi:cli/stdin@0.2.0; - import wasi:cli/stdout@0.2.0; - import wasi:cli/stderr@0.2.0; - import wasi:cli/terminal-input@0.2.0; - import wasi:cli/terminal-output@0.2.0; - import wasi:cli/terminal-stdin@0.2.0; - import wasi:cli/terminal-stdout@0.2.0; - import wasi:cli/terminal-stderr@0.2.0; - import wasi:clocks/wall-clock@0.2.0; - import wasi:filesystem/types@0.2.0; - import wasi:filesystem/preopens@0.2.0; - import wasi:sockets/network@0.2.0; - import wasi:sockets/instance-network@0.2.0; - import wasi:sockets/udp@0.2.0; - import wasi:sockets/udp-create-socket@0.2.0; - import wasi:sockets/tcp@0.2.0; - import wasi:sockets/tcp-create-socket@0.2.0; - import wasi:sockets/ip-name-lookup@0.2.0; - import wasi:random/random@0.2.0; - import wasi:random/insecure@0.2.0; - import wasi:random/insecure-seed@0.2.0; - export wasi:http/incoming-handler@0.2.0; -} - -package wasi:cli@0.2.0 { - interface environment { - /// Get the POSIX-style environment variables. - /// - /// Each environment variable is provided as a pair of string variable names - /// and string value. - /// - /// Morally, these are a value import, but until value imports are available - /// in the component model, this import function should return the same - /// values each time it is called. - get-environment: func() -> list>; - - /// Get the POSIX-style arguments to the program. - get-arguments: func() -> list; - - /// Return a path that programs should use as their initial current working - /// directory, interpreting `.` as shorthand for this. - initial-cwd: func() -> option; - } - - interface exit { - /// Exit the current instance and any linked instances. - exit: func(status: result); - } - - interface stdin { - use wasi:io/streams@0.2.0.{input-stream}; - get-stdin: func() -> input-stream; - } - - interface stdout { - use wasi:io/streams@0.2.0.{output-stream}; - get-stdout: func() -> output-stream; - } - - interface stderr { - use wasi:io/streams@0.2.0.{output-stream}; - get-stderr: func() -> output-stream; - } - - /// Terminal input. - /// - /// In the future, this may include functions for disabling echoing, - /// disabling input buffering so that keyboard events are sent through - /// immediately, querying supported features, and so on. - interface terminal-input { - /// The input side of a terminal. - resource terminal-input; - } - - /// Terminal output. - /// - /// In the future, this may include functions for querying the terminal - /// size, being notified of terminal size changes, querying supported - /// features, and so on. - interface terminal-output { - /// The output side of a terminal. - resource terminal-output; - } - - /// An interface providing an optional `terminal-input` for stdin as a - /// link-time authority. - interface terminal-stdin { - use terminal-input.{terminal-input}; - - /// If stdin is connected to a terminal, return a `terminal-input` handle - /// allowing further interaction with it. - get-terminal-stdin: func() -> option; - } - - /// An interface providing an optional `terminal-output` for stdout as a - /// link-time authority. - interface terminal-stdout { - use terminal-output.{terminal-output}; - - /// If stdout is connected to a terminal, return a `terminal-output` handle - /// allowing further interaction with it. - get-terminal-stdout: func() -> option; - } - - /// An interface providing an optional `terminal-output` for stderr as a - /// link-time authority. - interface terminal-stderr { - use terminal-output.{terminal-output}; - - /// If stderr is connected to a terminal, return a `terminal-output` handle - /// allowing further interaction with it. - get-terminal-stderr: func() -> option; - } -} - -package wasi:filesystem@0.2.0 { - interface types { - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/streams@0.2.0.{error}; - use wasi:clocks/wall-clock@0.2.0.{datetime}; - type filesize = u64; - enum descriptor-type { - unknown, - block-device, - character-device, - directory, - fifo, - symbolic-link, - regular-file, - socket - } - flags descriptor-flags { - read, - write, - file-integrity-sync, - data-integrity-sync, - requested-write-sync, - mutate-directory, - } - flags path-flags { symlink-follow } - flags open-flags { - create, - directory, - exclusive, - truncate, - } - type link-count = u64; - record descriptor-stat { - %type: descriptor-type, - link-count: link-count, - size: filesize, - data-access-timestamp: option, - data-modification-timestamp: option, - status-change-timestamp: option, - } - variant new-timestamp { - no-change, - now, - timestamp(datetime), - } - record directory-entry { - %type: descriptor-type, - name: string, - } - enum error-code { - access, - would-block, - already, - bad-descriptor, - busy, - deadlock, - quota, - exist, - file-too-large, - illegal-byte-sequence, - in-progress, - interrupted, - invalid, - io, - is-directory, - loop, - too-many-links, - message-size, - name-too-long, - no-device, - no-entry, - no-lock, - insufficient-memory, - insufficient-space, - not-directory, - not-empty, - not-recoverable, - unsupported, - no-tty, - no-such-device, - overflow, - not-permitted, - pipe, - read-only, - invalid-seek, - text-file-busy, - cross-device - } - enum advice { - normal, - sequential, - random, - will-need, - dont-need, - no-reuse - } - record metadata-hash-value { - lower: u64, - upper: u64, - } - resource descriptor { - advise: func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; - append-via-stream: func() -> result; - create-directory-at: func(path: string) -> result<_, error-code>; - get-flags: func() -> result; - get-type: func() -> result; - is-same-object: func(other: borrow) -> bool; - link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - metadata-hash: func() -> result; - metadata-hash-at: func(path-flags: path-flags, path: string) -> result; - open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; - read: func(length: filesize, offset: filesize) -> result, bool>, error-code>; - read-directory: func() -> result; - read-via-stream: func(offset: filesize) -> result; - readlink-at: func(path: string) -> result; - remove-directory-at: func(path: string) -> result<_, error-code>; - rename-at: func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - set-size: func(size: filesize) -> result<_, error-code>; - set-times: func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - stat: func() -> result; - stat-at: func(path-flags: path-flags, path: string) -> result; - symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>; - sync: func() -> result<_, error-code>; - sync-data: func() -> result<_, error-code>; - unlink-file-at: func(path: string) -> result<_, error-code>; - write: func(buffer: list, offset: filesize) -> result; - write-via-stream: func(offset: filesize) -> result; - } - resource directory-entry-stream { - read-directory-entry: func() -> result, error-code>; - } - filesystem-error-code: func(err: borrow) -> option; - } - - interface preopens { - use types.{descriptor}; - get-directories: func() -> list>; - } -} - -package wasi:sockets@0.2.0 { - interface network { - resource network; - enum error-code { - unknown, - access-denied, - not-supported, - invalid-argument, - out-of-memory, - timeout, - concurrency-conflict, - not-in-progress, - would-block, - invalid-state, - new-socket-limit, - address-not-bindable, - address-in-use, - remote-unreachable, - connection-refused, - connection-reset, - connection-aborted, - datagram-too-large, - name-unresolvable, - temporary-resolver-failure, - permanent-resolver-failure - } - enum ip-address-family { ipv4, ipv6 } - type ipv4-address = tuple; - type ipv6-address = tuple; - variant ip-address { - ipv4(ipv4-address), - ipv6(ipv6-address), - } - record ipv4-socket-address { - port: u16, - address: ipv4-address, - } - record ipv6-socket-address { - port: u16, - flow-info: u32, - address: ipv6-address, - scope-id: u32, - } - variant ip-socket-address { - ipv4(ipv4-socket-address), - ipv6(ipv6-socket-address), - } - } - - interface instance-network { - use network.{network}; - instance-network: func() -> network; - } - - interface udp { - use wasi:io/poll@0.2.0.{pollable}; - use network.{network}; - use network.{error-code}; - use network.{ip-socket-address}; - use network.{ip-address-family}; - record incoming-datagram { - data: list, - remote-address: ip-socket-address, - } - record outgoing-datagram { - data: list, - remote-address: option, - } - resource udp-socket { - address-family: func() -> ip-address-family; - finish-bind: func() -> result<_, error-code>; - local-address: func() -> result; - receive-buffer-size: func() -> result; - remote-address: func() -> result; - send-buffer-size: func() -> result; - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; - start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; - %stream: func(remote-address: option) -> result, error-code>; - subscribe: func() -> pollable; - unicast-hop-limit: func() -> result; - } - resource incoming-datagram-stream { - receive: func(max-results: u64) -> result, error-code>; - subscribe: func() -> pollable; - } - resource outgoing-datagram-stream { - check-send: func() -> result; - send: func(datagrams: list) -> result; - subscribe: func() -> pollable; - } - } - - interface udp-create-socket { - use network.{network}; - use network.{error-code}; - use network.{ip-address-family}; - use udp.{udp-socket}; - create-udp-socket: func(address-family: ip-address-family) -> result; - } - - interface tcp { - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/poll@0.2.0.{pollable}; - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use network.{network}; - use network.{error-code}; - use network.{ip-socket-address}; - use network.{ip-address-family}; - enum shutdown-type { receive, send, both } - resource tcp-socket { - accept: func() -> result, error-code>; - address-family: func() -> ip-address-family; - finish-bind: func() -> result<_, error-code>; - finish-connect: func() -> result, error-code>; - finish-listen: func() -> result<_, error-code>; - hop-limit: func() -> result; - is-listening: func() -> bool; - keep-alive-count: func() -> result; - keep-alive-enabled: func() -> result; - keep-alive-idle-time: func() -> result; - keep-alive-interval: func() -> result; - local-address: func() -> result; - receive-buffer-size: func() -> result; - remote-address: func() -> result; - send-buffer-size: func() -> result; - set-hop-limit: func(value: u8) -> result<_, error-code>; - set-keep-alive-count: func(value: u32) -> result<_, error-code>; - set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; - set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; - set-keep-alive-interval: func(value: duration) -> result<_, error-code>; - set-listen-backlog-size: func(value: u64) -> result<_, error-code>; - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>; - start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; - start-connect: func(network: borrow, remote-address: ip-socket-address) -> result<_, error-code>; - start-listen: func() -> result<_, error-code>; - subscribe: func() -> pollable; - } - } - - interface tcp-create-socket { - use network.{network}; - use network.{error-code}; - use network.{ip-address-family}; - use tcp.{tcp-socket}; - create-tcp-socket: func(address-family: ip-address-family) -> result; - } - - interface ip-name-lookup { - use wasi:io/poll@0.2.0.{pollable}; - use network.{network}; - use network.{error-code}; - use network.{ip-address}; - resource resolve-address-stream { - resolve-next-address: func() -> result, error-code>; - subscribe: func() -> pollable; - } - resolve-addresses: func(network: borrow, name: string) -> result; - } -} - -package wasi:clocks@0.2.0 { - interface monotonic-clock { - use wasi:io/poll@0.2.0.{pollable}; - type instant = u64; - type duration = u64; - now: func() -> instant; - resolution: func() -> duration; - subscribe-instant: func(when: instant) -> pollable; - subscribe-duration: func(when: duration) -> pollable; - } - - interface wall-clock { - record datetime { - seconds: u64, - nanoseconds: u32, - } - now: func() -> datetime; - resolution: func() -> datetime; - } -} - -package wasi:config@0.2.0-draft { - interface runtime { - /// An error type that encapsulates the different errors that can occur fetching config - variant config-error { - /// This indicates an error from an "upstream" config source. - /// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue - /// buckets, etc), - /// the error message is a string. - upstream(string), - /// This indicates an error from an I/O operation. - /// As this could be almost _anything_ (such as a file read, network connection, etc), - /// the error message is a string. - /// Depending on how this ends up being consumed, - /// we may consider moving this to use the `wasi:io/error` type instead. - /// For simplicity right now in supporting multiple implementations, it is being left - /// as a string. - io(string), - } - - /// Gets a single opaque config value set at the given key if it exists - get: func(key: string) -> result, config-error>; - - /// Gets a list of all set config data - get-all: func() -> result>, config-error>; - } -} - -package wasi:http@0.2.0 { - /// This interface defines all of the types and methods for implementing - /// HTTP Requests and Responses, both incoming and outgoing, as well as - /// their headers, trailers, and bodies. - interface types { - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/error@0.2.0.{error as io-error}; - use wasi:io/poll@0.2.0.{pollable}; - - /// This type corresponds to HTTP standard Methods. - variant method { - get, - head, - post, - put, - delete, - connect, - options, - trace, - patch, - other(string), - } - - /// This type corresponds to HTTP standard Related Schemes. - variant scheme { HTTP, HTTPS, other(string) } - - /// Defines the case payload type for `DNS-error` above: - record DNS-error-payload { - rcode: option, - info-code: option, - } - - /// Defines the case payload type for `TLS-alert-received` above: - record TLS-alert-received-payload { - alert-id: option, - alert-message: option, - } - - /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - record field-size-payload { - field-name: option, - field-size: option, - } - - /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types - variant error-code { - DNS-timeout, - DNS-error(DNS-error-payload), - destination-not-found, - destination-unavailable, - destination-IP-prohibited, - destination-IP-unroutable, - connection-refused, - connection-terminated, - connection-timeout, - connection-read-timeout, - connection-write-timeout, - connection-limit-reached, - TLS-protocol-error, - TLS-certificate-error, - TLS-alert-received(TLS-alert-received-payload), - HTTP-request-denied, - HTTP-request-length-required, - HTTP-request-body-size(option), - HTTP-request-method-invalid, - HTTP-request-URI-invalid, - HTTP-request-URI-too-long, - HTTP-request-header-section-size(option), - HTTP-request-header-size(option), - HTTP-request-trailer-section-size(option), - HTTP-request-trailer-size(field-size-payload), - HTTP-response-incomplete, - HTTP-response-header-section-size(option), - HTTP-response-header-size(field-size-payload), - HTTP-response-body-size(option), - HTTP-response-trailer-section-size(option), - HTTP-response-trailer-size(field-size-payload), - HTTP-response-transfer-coding(option), - HTTP-response-content-coding(option), - HTTP-response-timeout, - HTTP-upgrade-failed, - HTTP-protocol-error, - loop-detected, - configuration-error, - /// This is a catch-all error for anything that doesn't fit cleanly into a - /// more specific case. It also includes an optional string for an - /// unstructured description of the error. Users should not depend on the - /// string for diagnosing errors, as it's not required to be consistent - /// between implementations. - internal-error(option), - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting or appending to a `fields` resource. - variant header-error { - /// This error indicates that a `field-key` or `field-value` was - /// syntactically invalid when used with an operation that sets headers in a - /// `fields`. - invalid-syntax, - /// This error indicates that a forbidden `field-key` was used when trying - /// to set a header in a `fields`. - forbidden, - /// This error indicates that the operation on the `fields` was not - /// permitted because the fields are immutable. - immutable, - } - - /// Field keys are always strings. - type field-key = string; - - /// Field values should always be ASCII strings. However, in - /// reality, HTTP implementations often have to interpret malformed values, - /// so they are provided as a list of bytes. - type field-value = list; - - /// This following block defines the `fields` resource which corresponds to - /// HTTP standard Fields. Fields are a common representation used for both - /// Headers and Trailers. - /// - /// A `fields` may be mutable or immutable. A `fields` created using the - /// constructor, `from-list`, or `clone` will be mutable, but a `fields` - /// resource given by other means (including, but not limited to, - /// `incoming-request.headers`, `outgoing-request.headers`) might be be - /// immutable. In an immutable fields, the `set`, `append`, and `delete` - /// operations will fail with `header-error.immutable`. - resource fields { - /// Construct an empty HTTP Fields. - /// - /// The resulting `fields` is mutable. - constructor(); - - /// Append a value for a key. Does not change or delete any existing - /// values for that key. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - append: func(name: field-key, value: field-value) -> result<_, header-error>; - - /// Make a deep copy of the Fields. Equivelant in behavior to calling the - /// `fields` constructor on the return value of `entries`. The resulting - /// `fields` is mutable. - clone: func() -> fields; - - /// Delete all values for a key. Does nothing if no values for the key - /// exist. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - delete: func(name: field-key) -> result<_, header-error>; - - /// Retrieve the full set of keys and values in the Fields. Like the - /// constructor, the list represents each key-value pair. - /// - /// The outer list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - entries: func() -> list>; - - /// Get all of the values corresponding to a key. If the key is not present - /// in this `fields`, an empty list is returned. However, if the key is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - get: func(name: field-key) -> list; - - /// Returns `true` when the key is present in this `fields`. If the key is - /// syntactically invalid, `false` is returned. - has: func(name: field-key) -> bool; - - /// Set all of the values for a key. Clears any existing values for that - /// key, if they have been set. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - set: func(name: field-key, value: list) -> result<_, header-error>; - - /// Construct an HTTP Fields. - /// - /// The resulting `fields` is mutable. - /// - /// The list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - /// - /// The tuple is a pair of the field key, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all keys - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. - /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. - from-list: static func(entries: list>) -> result; - } - - /// Headers is an alias for Fields. - type headers = fields; - - /// Trailers is an alias for Fields. - type trailers = fields; - - /// Represents an incoming HTTP Request. - resource incoming-request { - - /// Returns the authority from the request, if it was present. - authority: func() -> option; - - /// Gives the `incoming-body` associated with this request. Will only - /// return success at most once, and subsequent calls will return error. - consume: func() -> result; - - /// Get the `headers` associated with the request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// The `headers` returned are a child resource: it must be dropped before - /// the parent `incoming-request` is dropped. Dropping this - /// `incoming-request` before all children are dropped will trap. - headers: func() -> headers; - - /// Returns the method of the incoming request. - method: func() -> method; - - /// Returns the path with query parameters from the request, as a string. - path-with-query: func() -> option; - - /// Returns the protocol scheme from the request. - scheme: func() -> option; - } - - /// Represents an outgoing HTTP Request. - resource outgoing-request { - /// Construct a new `outgoing-request` with a default `method` of `GET`, and - /// `none` values for `path-with-query`, `scheme`, and `authority`. - /// - /// * `headers` is the HTTP Headers for the Request. - /// - /// It is possible to construct, or manipulate with the accessor functions - /// below, an `outgoing-request` with an invalid combination of `scheme` - /// and `authority`, or `headers` which are not permitted to be sent. - /// It is the obligation of the `outgoing-handler.handle` implementation - /// to reject invalid constructions of `outgoing-request`. - constructor(headers: headers); - - /// Get the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. - authority: func() -> option; - - /// Returns the resource corresponding to the outgoing Body for this - /// Request. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-request` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - - /// Get the Method for the Request. - method: func() -> method; - - /// Get the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. - path-with-query: func() -> option; - - /// Get the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. - scheme: func() -> option; - - /// Set the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid uri authority. - set-authority: func(authority: option) -> result; - - /// Set the Method for the Request. Fails if the string present in a - /// `method.other` argument is not a syntactically valid method. - set-method: func(method: method) -> result; - - /// Set the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. Fails is the - /// string given is not a syntactically valid path and query uri component. - set-path-with-query: func(path-with-query: option) -> result; - - /// Set the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. Fails if the - /// string given is not a syntactically valid uri scheme. - set-scheme: func(scheme: option) -> result; - } - - /// Parameters for making an HTTP Request. Each of these parameters is - /// currently an optional timeout applicable to the transport layer of the - /// HTTP protocol. - /// - /// These timeouts are separate from any the user may use to bound a - /// blocking call to `wasi:io/poll.poll`. - resource request-options { - /// Construct a default `request-options` value. - constructor(); - - /// The timeout for receiving subsequent chunks of bytes in the Response - /// body stream. - between-bytes-timeout: func() -> option; - - /// The timeout for the initial connect to the HTTP Server. - connect-timeout: func() -> option; - - /// The timeout for receiving the first byte of the Response body. - first-byte-timeout: func() -> option; - - /// Set the timeout for receiving subsequent chunks of bytes in the Response - /// body stream. An error return value indicates that this timeout is not - /// supported. - set-between-bytes-timeout: func(duration: option) -> result; - - /// Set the timeout for the initial connect to the HTTP Server. An error - /// return value indicates that this timeout is not supported. - set-connect-timeout: func(duration: option) -> result; - - /// Set the timeout for receiving the first byte of the Response body. An - /// error return value indicates that this timeout is not supported. - set-first-byte-timeout: func(duration: option) -> result; - } - - /// Represents the ability to send an HTTP Response. - /// - /// This resource is used by the `wasi:http/incoming-handler` interface to - /// allow a Response to be sent corresponding to the Request provided as the - /// other argument to `incoming-handler.handle`. - resource response-outparam { - - /// Set the value of the `response-outparam` to either send a response, - /// or indicate an error. - /// - /// This method consumes the `response-outparam` to ensure that it is - /// called at most once. If it is never called, the implementation - /// will respond with an error. - /// - /// The user may provide an `error` to `response` to allow the - /// implementation determine how to respond with an HTTP error response. - set: static func(param: response-outparam, response: result); - } - - /// This type corresponds to the HTTP standard Status Code. - type status-code = u16; - - /// Represents an incoming HTTP Response. - resource incoming-response { - - /// Returns the incoming body. May be called at most once. Returns error - /// if called additional times. - consume: func() -> result; - - /// Returns the headers from the incoming response. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `incoming-response` is dropped. - headers: func() -> headers; - - /// Returns the status code from the incoming response. - status: func() -> status-code; - } - - /// Represents an incoming HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, indicating that the full contents of the - /// body have been received. This resource represents the contents as - /// an `input-stream` and the delivery of trailers as a `future-trailers`, - /// and ensures that the user of this interface may only be consuming either - /// the body contents or waiting on trailers at any given time. - resource incoming-body { - - /// Returns the contents of the body, as a stream of bytes. - /// - /// Returns success on first call: the stream representing the contents - /// can be retrieved at most once. Subsequent calls will return error. - /// - /// The returned `input-stream` resource is a child: it must be dropped - /// before the parent `incoming-body` is dropped, or consumed by - /// `incoming-body.finish`. - /// - /// This invariant ensures that the implementation can determine whether - /// the user is consuming the contents of the body, waiting on the - /// `future-trailers` to be ready, or neither. This allows for network - /// backpressure is to be applied when the user is consuming the body, - /// and for that backpressure to not inhibit delivery of the trailers if - /// the user does not read the entire body. - %stream: func() -> result; - - /// Takes ownership of `incoming-body`, and returns a `future-trailers`. - /// This function will trap if the `input-stream` child is still alive. - finish: static func(this: incoming-body) -> future-trailers; - } - - /// Represents a future which may eventaully return trailers, or an error. - /// - /// In the case that the incoming HTTP Request or Response did not have any - /// trailers, this future will resolve to the empty set of trailers once the - /// complete Request or Response body has been received. - resource future-trailers { - - /// Returns the contents of the trailers, or an error which occured, - /// once the future is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the trailers or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the HTTP Request or Response - /// body, as well as any trailers, were received successfully, or that an - /// error occured receiving them. The optional `trailers` indicates whether - /// or not trailers were present in the body. - /// - /// When some `trailers` are returned by this method, the `trailers` - /// resource is immutable, and a child. Use of the `set`, `append`, or - /// `delete` methods will return an error, and the resource must be - /// dropped before the parent `future-trailers` is dropped. - get: func() -> option, error-code>>>; - - /// Returns a pollable which becomes ready when either the trailers have - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - } - - /// Represents an outgoing HTTP Response. - resource outgoing-response { - /// Construct an `outgoing-response`, with a default `status-code` of `200`. - /// If a different `status-code` is needed, it must be set via the - /// `set-status-code` method. - /// - /// * `headers` is the HTTP Headers for the Response. - constructor(headers: headers); - - /// Returns the resource corresponding to the outgoing Body for this Response. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-response` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - - /// Set the HTTP Status Code for the Response. Fails if the status-code - /// given is not a valid http status code. - set-status-code: func(status-code: status-code) -> result; - - /// Get the HTTP Status Code for the Response. - status-code: func() -> status-code; - } - - /// Represents an outgoing HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, inducating the full contents of the body - /// have been sent. This resource represents the contents as an - /// `output-stream` child resource, and the completion of the body (with - /// optional trailers) with a static function that consumes the - /// `outgoing-body` resource, and ensures that the user of this interface - /// may not write to the body contents after the body has been finished. - /// - /// If the user code drops this resource, as opposed to calling the static - /// method `finish`, the implementation should treat the body as incomplete, - /// and that an error has occured. The implementation should propogate this - /// error to the HTTP protocol by whatever means it has available, - /// including: corrupting the body on the wire, aborting the associated - /// Request, or sending a late status code for the Response. - resource outgoing-body { - - /// Returns a stream for writing the body contents. - /// - /// The returned `output-stream` is a child resource: it must be dropped - /// before the parent `outgoing-body` resource is dropped (or finished), - /// otherwise the `outgoing-body` drop or `finish` will trap. - /// - /// Returns success on the first call: the `output-stream` resource for - /// this `outgoing-body` may be retrieved at most once. Subsequent calls - /// will return error. - write: func() -> result; - - /// Finalize an outgoing body, optionally providing trailers. This must be - /// called to signal that the response is complete. If the `outgoing-body` - /// is dropped without calling `outgoing-body.finalize`, the implementation - /// should treat the body as corrupted. - /// - /// Fails if the body's `outgoing-request` or `outgoing-response` was - /// constructed with a Content-Length header, and the contents written - /// to the body (via `write`) does not match the value given in the - /// Content-Length. - finish: static func(this: outgoing-body, trailers: option) -> result<_, error-code>; - } - - /// Represents a future which may eventaully return an incoming HTTP - /// Response, or an error. - /// - /// This resource is returned by the `wasi:http/outgoing-handler` interface to - /// provide the HTTP Response corresponding to the sent Request. - resource future-incoming-response { - - /// Returns the incoming HTTP Response, or an error, once one is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the response or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the incoming HTTP Response - /// status and headers have recieved successfully, or that an error - /// occured. Errors may also occur while consuming the response body, - /// but those will be reported by the `incoming-body` and its - /// `output-stream` child. - get: func() -> option>>; - - /// Returns a pollable which becomes ready when either the Response has - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - } - - /// Attempts to extract a http-related `error` from the wasi:io `error` - /// provided. - /// - /// Stream operations which return - /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of - /// type `wasi:io/error/error` with more information about the operation - /// that failed. This payload can be passed through to this function to see - /// if there's http-related information about the error to return. - /// - /// Note that this function is fallible because not all io-errors are - /// http-related errors. - http-error-code: func(err: borrow) -> option; - } - - /// This interface defines a handler of incoming HTTP Requests. It should - /// be exported by components which can respond to HTTP Requests. - interface incoming-handler { - use types.{incoming-request}; - use types.{response-outparam}; - - /// This function is invoked with an incoming HTTP Request, and a resource - /// `response-outparam` which provides the capability to reply with an HTTP - /// Response. The response is sent by calling the `response-outparam.set` - /// method, which allows execution to continue after the response has been - /// sent. This enables both streaming to the response body, and performing other - /// work. - /// - /// The implementor of this function must write a response to the - /// `response-outparam` before returning, or else the caller will respond - /// with an error on its behalf. - handle: func(request: incoming-request, response-out: response-outparam); - } - - /// This interface defines a handler of outgoing HTTP Requests. It should be - /// imported by components which wish to make HTTP Requests. - interface outgoing-handler { - use types.{outgoing-request}; - use types.{request-options}; - use types.{future-incoming-response}; - use types.{error-code}; - - /// This function is invoked with an outgoing HTTP Request, and it returns - /// a resource `future-incoming-response` which represents an HTTP Response - /// which may arrive in the future. - /// - /// The `options` argument accepts optional parameters for the HTTP - /// protocol's transport layer. - /// - /// This function may return an error if the `outgoing-request` is invalid - /// or not allowed to be made. Otherwise, protocol errors are reported - /// through the `future-incoming-response`. - handle: func(request: outgoing-request, options: option) -> result; - } -} - -package wasi:io@0.2.0 { - interface error { - resource error { - to-debug-string: func() -> string; - } - } - - interface poll { - resource pollable { - block: func(); - ready: func() -> bool; - } - poll: func(in: list>) -> list; - } - - interface streams { - use error.{error}; - use poll.{pollable}; - variant stream-error { - last-operation-failed(error), - closed, - } - resource input-stream { - blocking-read: func(len: u64) -> result, stream-error>; - blocking-skip: func(len: u64) -> result; - read: func(len: u64) -> result, stream-error>; - skip: func(len: u64) -> result; - subscribe: func() -> pollable; - } - resource output-stream { - blocking-flush: func() -> result<_, stream-error>; - blocking-splice: func(src: borrow, len: u64) -> result; - blocking-write-and-flush: func(contents: list) -> result<_, stream-error>; - blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>; - check-write: func() -> result; - flush: func() -> result<_, stream-error>; - splice: func(src: borrow, len: u64) -> result; - subscribe: func() -> pollable; - write: func(contents: list) -> result<_, stream-error>; - write-zeroes: func(len: u64) -> result<_, stream-error>; - } - } -} - -package wasi:logging@0.1.0-draft { - /// WASI Logging is a logging API intended to let users emit log messages with - /// simple priority levels and context values. - interface logging { - /// A log level, describing a kind of message. - enum level { - /// Describes messages about the values of variables and the flow of - /// control within a program. - trace, - /// Describes messages likely to be of interest to someone debugging a - /// program. - debug, - /// Describes messages likely to be of interest to someone monitoring a - /// program. - info, - /// Describes messages indicating hazardous situations. - warn, - /// Describes messages indicating serious errors. - error, - /// Describes messages indicating fatal errors. - critical - } - - /// Emit a log message. - /// - /// A log message has a `level` describing what kind of message is being - /// sent, a context, which is an uninterpreted string meant to help - /// consumers group similar messages, and a string containing the message - /// text. - log: func(level: level, context: string, message: string); - } -} - -package wasi:random@0.2.0 { - interface random { - get-random-bytes: func(len: u64) -> list; - get-random-u64: func() -> u64; - } - - interface insecure { - get-insecure-random-bytes: func(len: u64) -> list; - get-insecure-random-u64: func() -> u64; - } - - interface insecure-seed { - insecure-seed: func() -> tuple; - } -} - -package wasmcloud:bus@1.0.0 { - interface lattice { - /// Interface target. This represents an interface, which can be selected by `set-link-name`. - resource call-target-interface { - constructor(namespace: string, %package: string, %interface: string); - } - - /// Set an optional link name to use for all interfaces specified. This is advanced - /// functionality only available within wasmcloud and, as such, is exposed here as - /// part of the - /// wasmcloud:bus package. This is used when you are linking multiple of the same - /// interfaces - /// (i.e. a keyvalue implementation for caching and another one for secrets) to a - /// component - set-link-name: func(name: string, interfaces: list); - } -} - -/// This WIT interface powers secret support in wasmCloud -/// -/// See RFC #2190 https://github.com/wasmCloud/wasmCloud/issues/2190 -package wasmcloud:secrets@0.1.0-draft { - interface store { - /// An error type that encapsulates the different errors that can occur fetching secrets - variant secrets-error { - /// This indicates an error from an "upstream" secrets source. - /// As this could be almost _anything_ (such as Vault, Kubernetes Secrets, KeyValue - /// buckets, etc), - /// the error message is a string. - upstream(string), - /// This indicates an error from an I/O operation. - /// As this could be almost _anything_ (such as a file read, network connection, etc), - /// the error message is a string. - /// Depending on how this ends up being consumed, - /// we may consider moving this to use the `wasi:io/error` type instead. - /// For simplicity right now in supporting multiple implementations, it is being left - /// as a string. - io(string), - /// This indicates that the secret was not found. Generally "not found" errors will - /// be handled by the upstream secrets backend, but there are cases where the host - /// may need to return this error. - not-found, - } - - /// A secret value can be either a string or a byte array, which lets you - /// store binary data as a secret. - variant secret-value { - /// A string value - %string(string), - /// A byte array value - bytes(list), - } - - /// A secret is a resource that can only be borrowed. This allows you to - /// pass around handles to secrets and not reveal the values until a - /// component needs them. - /// You need to use the reveal interface to get the value. - resource secret; - - /// Gets a single opaque secrets value set at the given key if it exists - get: func(key: string) -> result; - } - - interface reveal { - use store.{secret}; - use store.{secret-value}; - - /// Reveals the value of a secret to the caller. - /// This lets you easily audit your code to discover where secrets are being used. - reveal: func(s: borrow) -> secret-value; - } -} diff --git a/component/gen/wasmcloud/component-go/sdk/sdk.wit.go b/component/gen/wasmcloud/component-go/sdk/sdk.wit.go old mode 100755 new mode 100644 index 70e1c5ed..b9f84442 --- a/component/gen/wasmcloud/component-go/sdk/sdk.wit.go +++ b/component/gen/wasmcloud/component-go/sdk/sdk.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package sdk represents the world "wasmcloud:component-go/sdk@0.1.0". package sdk diff --git a/component/gen/wasmcloud/secrets/reveal/empty.s b/component/gen/wasmcloud/secrets/reveal/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasmcloud/secrets/reveal/reveal.wasm.go b/component/gen/wasmcloud/secrets/reveal/reveal.wasm.go old mode 100755 new mode 100644 index 65404eb3..2bd8c561 --- a/component/gen/wasmcloud/secrets/reveal/reveal.wasm.go +++ b/component/gen/wasmcloud/secrets/reveal/reveal.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package reveal diff --git a/component/gen/wasmcloud/secrets/reveal/reveal.wit.go b/component/gen/wasmcloud/secrets/reveal/reveal.wit.go old mode 100755 new mode 100644 index 3922decd..227fe4d8 --- a/component/gen/wasmcloud/secrets/reveal/reveal.wit.go +++ b/component/gen/wasmcloud/secrets/reveal/reveal.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package reveal represents the imported interface "wasmcloud:secrets/reveal@0.1.0-draft". package reveal import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasmcloud/secrets/store" ) diff --git a/component/gen/wasmcloud/secrets/store/abi.go b/component/gen/wasmcloud/secrets/store/abi.go old mode 100755 new mode 100644 index 20affd6c..e5ff5543 --- a/component/gen/wasmcloud/secrets/store/abi.go +++ b/component/gen/wasmcloud/secrets/store/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/component/gen/wasmcloud/secrets/store/empty.s b/component/gen/wasmcloud/secrets/store/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasmcloud/secrets/store/store.wasm.go b/component/gen/wasmcloud/secrets/store/store.wasm.go old mode 100755 new mode 100644 index cc94c517..d2208168 --- a/component/gen/wasmcloud/secrets/store/store.wasm.go +++ b/component/gen/wasmcloud/secrets/store/store.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasmcloud:secrets@0.1.0-draft". diff --git a/component/gen/wasmcloud/secrets/store/store.wit.go b/component/gen/wasmcloud/secrets/store/store.wit.go old mode 100755 new mode 100644 index 86158034..31fcc367 --- a/component/gen/wasmcloud/secrets/store/store.wit.go +++ b/component/gen/wasmcloud/secrets/store/store.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package store represents the imported interface "wasmcloud:secrets/store@0.1.0-draft". package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // SecretsError represents the variant "wasmcloud:secrets/store@0.1.0-draft#secrets-error". @@ -66,7 +66,7 @@ func (self *SecretsError) NotFound() bool { return self.Tag() == 2 } -var stringsSecretsError = [3]string{ +var _SecretsErrorStrings = [3]string{ "upstream", "io", "not-found", @@ -74,7 +74,7 @@ var stringsSecretsError = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretsError) String() string { - return stringsSecretsError[v.Tag()] + return _SecretsErrorStrings[v.Tag()] } // SecretValue represents the variant "wasmcloud:secrets/store@0.1.0-draft#secret-value". @@ -86,7 +86,7 @@ func (v SecretsError) String() string { // %string(string), // bytes(list), // } -type SecretValue cm.Variant[uint8, string, cm.List[uint8]] +type SecretValue cm.Variant[uint8, string, string] // SecretValueString_ returns a [SecretValue] of case "string". // @@ -112,14 +112,14 @@ func (self *SecretValue) Bytes() *cm.List[uint8] { return cm.Case[cm.List[uint8]](self, 1) } -var stringsSecretValue = [2]string{ +var _SecretValueStrings = [2]string{ "string", "bytes", } // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretValue) String() string { - return stringsSecretValue[v.Tag()] + return _SecretValueStrings[v.Tag()] } // Secret represents the imported resource "wasmcloud:secrets/store@0.1.0-draft#secret". diff --git a/component/go.mod b/component/go.mod index 6d4acd2b..0456dbe1 100644 --- a/component/go.mod +++ b/component/go.mod @@ -4,8 +4,8 @@ go 1.24 require ( github.com/samber/slog-common v0.18.1 - go.bytecodealliance.org v0.5.0 - go.bytecodealliance.org/cm v0.1.0 + github.com/urfave/cli/v3 v3.0.0-beta1 + go.bytecodealliance.org v0.6.2 ) require ( @@ -13,14 +13,15 @@ require ( github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/regclient/regclient v0.8.0 // indirect + github.com/regclient/regclient v0.8.2 // indirect github.com/samber/lo v1.49.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tetratelabs/wazero v1.9.0 // indirect github.com/ulikunitz/xz v0.5.12 // indirect - github.com/urfave/cli/v3 v3.0.0-beta1 // indirect - golang.org/x/mod v0.22.0 // indirect - golang.org/x/sys v0.29.0 // indirect + go.bytecodealliance.org/cm v0.2.2 // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/sys v0.30.0 // indirect golang.org/x/text v0.21.0 // indirect ) -tool go.bytecodealliance.org/cmd/wit-bindgen-go +tool go.wasmcloud.dev/component/wit-bindgen diff --git a/component/go.sum b/component/go.sum index 7869ff7e..2d1887b1 100644 --- a/component/go.sum +++ b/component/go.sum @@ -13,8 +13,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/regclient/regclient v0.8.0 h1:xNAMDlADcyMvFAlGXoqDOxlSUBG4mqWBFgjQqVTP8Og= -github.com/regclient/regclient v0.8.0/go.mod h1:h9+Y6dBvqBkdlrj6EIhbTOv0xUuIFl7CdI1bZvEB42g= +github.com/regclient/regclient v0.8.2 h1:23BQ3jWgKYHHIXUhp/S9laVJDHDoOQaQCzXMJ4undVE= +github.com/regclient/regclient v0.8.2/go.mod h1:uGyetv0o6VLyRDjtfeBqp/QBwRLJ3Hcn07/+8QbhNcM= github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew= github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o= github.com/samber/slog-common v0.18.1 h1:c0EipD/nVY9HG5shgm/XAs67mgpWDMF+MmtptdJNCkQ= @@ -27,25 +27,27 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= +github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg= github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y= -go.bytecodealliance.org v0.5.0 h1:ywhCpF0JdqGkqct5JqSY1Me8lz001UIJXUaCSS32cew= -go.bytecodealliance.org v0.5.0/go.mod h1:8kYTSxmQr8DU3dKOKCOHH1Ap1gWX/61qlFSbIuIno2Q= -go.bytecodealliance.org/cm v0.1.0 h1:78Rk4d5rgir5Hm+LMFpDWhjmFBWrKDFPSKUwDBj+nwo= -go.bytecodealliance.org/cm v0.1.0/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +go.bytecodealliance.org v0.6.2 h1:Jy4u5DVmSkXgsnwojBhJ+AD/YsJsR3VzVnxF0xRCqTQ= +go.bytecodealliance.org v0.6.2/go.mod h1:gqjTJm0y9NSksG4py/lSjIQ/SNuIlOQ+hCIEPQwtJgA= +go.bytecodealliance.org/cm v0.2.2 h1:M9iHS6qs884mbQbIjtLX1OifgyPG9DuMs2iwz8G4WQA= +go.bytecodealliance.org/cm v0.2.2/go.mod h1:JD5vtVNZv7sBoQQkvBvAAVKJPhR/bqBH7yYXTItMfZI= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= -golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/component/net/wasihttp/adapter.go b/component/net/wasihttp/adapter.go index 5888fb6f..c7ae9197 100644 --- a/component/net/wasihttp/adapter.go +++ b/component/net/wasihttp/adapter.go @@ -8,7 +8,7 @@ import ( "net/http" "sync" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/http/types" "go.wasmcloud.dev/component/gen/wasi/io/streams" ) diff --git a/component/net/wasihttp/roundtripper.go b/component/net/wasihttp/roundtripper.go index a15bf497..4dad5f70 100644 --- a/component/net/wasihttp/roundtripper.go +++ b/component/net/wasihttp/roundtripper.go @@ -7,7 +7,7 @@ import ( "runtime" "time" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" monotonicclock "go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock" outgoinghandler "go.wasmcloud.dev/component/gen/wasi/http/outgoing-handler" "go.wasmcloud.dev/component/gen/wasi/http/types" diff --git a/component/net/wasihttp/server.go b/component/net/wasihttp/server.go index 59e5f00c..d70741e6 100644 --- a/component/net/wasihttp/server.go +++ b/component/net/wasihttp/server.go @@ -5,7 +5,7 @@ import ( "net/http" "os" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" incominghandler "go.wasmcloud.dev/component/gen/wasi/http/incoming-handler" "go.wasmcloud.dev/component/gen/wasi/http/types" ) diff --git a/component/net/wasihttp/streams.go b/component/net/wasihttp/streams.go index 49b72d2a..d6c94ab2 100644 --- a/component/net/wasihttp/streams.go +++ b/component/net/wasihttp/streams.go @@ -8,7 +8,7 @@ import ( "runtime" "sync" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "go.wasmcloud.dev/component/gen/wasi/http/types" "go.wasmcloud.dev/component/gen/wasi/io/streams" ) diff --git a/component/sdk.go b/component/sdk.go index 74249c9d..45f86803 100644 --- a/component/sdk.go +++ b/component/sdk.go @@ -1,6 +1,6 @@ package component -//go:generate go tool wit-bindgen-go generate --world sdk --out gen ./wit +//go:generate go tool wit-bindgen --world sdk --out gen ./wit import ( "embed" diff --git a/component/wit-bindgen/main.go b/component/wit-bindgen/main.go new file mode 100644 index 00000000..31b36def --- /dev/null +++ b/component/wit-bindgen/main.go @@ -0,0 +1,40 @@ +package main + +import ( + "context" + "fmt" + "os" + + "github.com/urfave/cli/v3" + + "go.bytecodealliance.org/cmd/wit-bindgen-go/cmd/generate" +) + +// wrapper around bytecodealliance wit-bindgen-go +// Uses the component sdk 'cm' package if one is not provided +// prevents cm package version mismatches at build time + +func main() { + cmd := generateCommand() + err := cmd.Run(context.Background(), os.Args) + if err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } +} + +func generateCommand() *cli.Command { + gen := generate.Command + gen.Name = "wasmcloud-wit-bindgen" + gen.Before = func(ctx context.Context, cmd *cli.Command) (context.Context, error) { + if cmd.String("cm") == "" { + if err := gen.Set("cm", "go.wasmcloud.dev/component/cm"); err != nil { + return ctx, err + } + } + + return ctx, nil + } + + return gen +} diff --git a/examples/component/http-client/gen/example/http-client/example/example.wit b/examples/component/http-client/gen/example/http-client/example/example.wit deleted file mode 100755 index 8402d63f..00000000 --- a/examples/component/http-client/gen/example/http-client/example/example.wit +++ /dev/null @@ -1,1132 +0,0 @@ -package example:http-client; - -world example { - import wasi:io/poll@0.2.0; - import wasi:clocks/monotonic-clock@0.2.0; - import wasi:io/error@0.2.0; - import wasi:io/streams@0.2.0; - import wasi:http/types@0.2.0; - import wasi:http/outgoing-handler@0.2.0; - import wasi:logging/logging@0.1.0-draft; - import wasi:config/runtime@0.2.0-draft; - import wasmcloud:bus/lattice@1.0.0; - import wasmcloud:secrets/store@0.1.0-draft; - import wasmcloud:secrets/reveal@0.1.0-draft; - import wasi:cli/environment@0.2.0; - import wasi:cli/exit@0.2.0; - import wasi:cli/stdin@0.2.0; - import wasi:cli/stdout@0.2.0; - import wasi:cli/stderr@0.2.0; - import wasi:cli/terminal-input@0.2.0; - import wasi:cli/terminal-output@0.2.0; - import wasi:cli/terminal-stdin@0.2.0; - import wasi:cli/terminal-stdout@0.2.0; - import wasi:cli/terminal-stderr@0.2.0; - import wasi:clocks/wall-clock@0.2.0; - import wasi:filesystem/types@0.2.0; - import wasi:filesystem/preopens@0.2.0; - import wasi:sockets/network@0.2.0; - import wasi:sockets/instance-network@0.2.0; - import wasi:sockets/udp@0.2.0; - import wasi:sockets/udp-create-socket@0.2.0; - import wasi:sockets/tcp@0.2.0; - import wasi:sockets/tcp-create-socket@0.2.0; - import wasi:sockets/ip-name-lookup@0.2.0; - import wasi:random/random@0.2.0; - import wasi:random/insecure@0.2.0; - import wasi:random/insecure-seed@0.2.0; - export wasi:http/incoming-handler@0.2.0; -} - -package wasi:cli@0.2.0 { - interface stdout { - use wasi:io/streams@0.2.0.{output-stream}; - get-stdout: func() -> output-stream; - } - - interface stderr { - use wasi:io/streams@0.2.0.{output-stream}; - get-stderr: func() -> output-stream; - } - - interface stdin { - use wasi:io/streams@0.2.0.{input-stream}; - get-stdin: func() -> input-stream; - } - - interface environment { - get-environment: func() -> list>; - get-arguments: func() -> list; - initial-cwd: func() -> option; - } - - interface exit { - exit: func(status: result); - } - - interface terminal-input { - resource terminal-input; - } - - interface terminal-output { - resource terminal-output; - } - - interface terminal-stdin { - use terminal-input.{terminal-input}; - get-terminal-stdin: func() -> option; - } - - interface terminal-stdout { - use terminal-output.{terminal-output}; - get-terminal-stdout: func() -> option; - } - - interface terminal-stderr { - use terminal-output.{terminal-output}; - get-terminal-stderr: func() -> option; - } -} - -package wasi:clocks@0.2.0 { - interface monotonic-clock { - use wasi:io/poll@0.2.0.{pollable}; - type instant = u64; - type duration = u64; - now: func() -> instant; - resolution: func() -> duration; - subscribe-instant: func(when: instant) -> pollable; - subscribe-duration: func(when: duration) -> pollable; - } - - interface wall-clock { - record datetime { - seconds: u64, - nanoseconds: u32, - } - now: func() -> datetime; - resolution: func() -> datetime; - } -} - -package wasi:config@0.2.0-draft { - interface runtime { - variant config-error { - upstream(string), - io(string), - } - get: func(key: string) -> result, config-error>; - get-all: func() -> result>, config-error>; - } -} - -package wasi:filesystem@0.2.0 { - interface types { - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/streams@0.2.0.{error}; - use wasi:clocks/wall-clock@0.2.0.{datetime}; - type filesize = u64; - enum descriptor-type { - unknown, - block-device, - character-device, - directory, - fifo, - symbolic-link, - regular-file, - socket - } - flags descriptor-flags { - read, - write, - file-integrity-sync, - data-integrity-sync, - requested-write-sync, - mutate-directory, - } - flags path-flags { symlink-follow } - flags open-flags { - create, - directory, - exclusive, - truncate, - } - type link-count = u64; - record descriptor-stat { - %type: descriptor-type, - link-count: link-count, - size: filesize, - data-access-timestamp: option, - data-modification-timestamp: option, - status-change-timestamp: option, - } - variant new-timestamp { - no-change, - now, - timestamp(datetime), - } - record directory-entry { - %type: descriptor-type, - name: string, - } - enum error-code { - access, - would-block, - already, - bad-descriptor, - busy, - deadlock, - quota, - exist, - file-too-large, - illegal-byte-sequence, - in-progress, - interrupted, - invalid, - io, - is-directory, - loop, - too-many-links, - message-size, - name-too-long, - no-device, - no-entry, - no-lock, - insufficient-memory, - insufficient-space, - not-directory, - not-empty, - not-recoverable, - unsupported, - no-tty, - no-such-device, - overflow, - not-permitted, - pipe, - read-only, - invalid-seek, - text-file-busy, - cross-device - } - enum advice { - normal, - sequential, - random, - will-need, - dont-need, - no-reuse - } - record metadata-hash-value { - lower: u64, - upper: u64, - } - resource descriptor { - advise: func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; - append-via-stream: func() -> result; - create-directory-at: func(path: string) -> result<_, error-code>; - get-flags: func() -> result; - get-type: func() -> result; - is-same-object: func(other: borrow) -> bool; - link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - metadata-hash: func() -> result; - metadata-hash-at: func(path-flags: path-flags, path: string) -> result; - open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; - read: func(length: filesize, offset: filesize) -> result, bool>, error-code>; - read-directory: func() -> result; - read-via-stream: func(offset: filesize) -> result; - readlink-at: func(path: string) -> result; - remove-directory-at: func(path: string) -> result<_, error-code>; - rename-at: func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - set-size: func(size: filesize) -> result<_, error-code>; - set-times: func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - stat: func() -> result; - stat-at: func(path-flags: path-flags, path: string) -> result; - symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>; - sync: func() -> result<_, error-code>; - sync-data: func() -> result<_, error-code>; - unlink-file-at: func(path: string) -> result<_, error-code>; - write: func(buffer: list, offset: filesize) -> result; - write-via-stream: func(offset: filesize) -> result; - } - resource directory-entry-stream { - read-directory-entry: func() -> result, error-code>; - } - filesystem-error-code: func(err: borrow) -> option; - } - - interface preopens { - use types.{descriptor}; - get-directories: func() -> list>; - } -} - -package wasi:http@0.2.0 { - /// This interface defines all of the types and methods for implementing - /// HTTP Requests and Responses, both incoming and outgoing, as well as - /// their headers, trailers, and bodies. - interface types { - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/error@0.2.0.{error as io-error}; - use wasi:io/poll@0.2.0.{pollable}; - - /// This type corresponds to HTTP standard Methods. - variant method { - get, - head, - post, - put, - delete, - connect, - options, - trace, - patch, - other(string), - } - - /// This type corresponds to HTTP standard Related Schemes. - variant scheme { HTTP, HTTPS, other(string) } - - /// Defines the case payload type for `DNS-error` above: - record DNS-error-payload { - rcode: option, - info-code: option, - } - - /// Defines the case payload type for `TLS-alert-received` above: - record TLS-alert-received-payload { - alert-id: option, - alert-message: option, - } - - /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - record field-size-payload { - field-name: option, - field-size: option, - } - - /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types - variant error-code { - DNS-timeout, - DNS-error(DNS-error-payload), - destination-not-found, - destination-unavailable, - destination-IP-prohibited, - destination-IP-unroutable, - connection-refused, - connection-terminated, - connection-timeout, - connection-read-timeout, - connection-write-timeout, - connection-limit-reached, - TLS-protocol-error, - TLS-certificate-error, - TLS-alert-received(TLS-alert-received-payload), - HTTP-request-denied, - HTTP-request-length-required, - HTTP-request-body-size(option), - HTTP-request-method-invalid, - HTTP-request-URI-invalid, - HTTP-request-URI-too-long, - HTTP-request-header-section-size(option), - HTTP-request-header-size(option), - HTTP-request-trailer-section-size(option), - HTTP-request-trailer-size(field-size-payload), - HTTP-response-incomplete, - HTTP-response-header-section-size(option), - HTTP-response-header-size(field-size-payload), - HTTP-response-body-size(option), - HTTP-response-trailer-section-size(option), - HTTP-response-trailer-size(field-size-payload), - HTTP-response-transfer-coding(option), - HTTP-response-content-coding(option), - HTTP-response-timeout, - HTTP-upgrade-failed, - HTTP-protocol-error, - loop-detected, - configuration-error, - /// This is a catch-all error for anything that doesn't fit cleanly into a - /// more specific case. It also includes an optional string for an - /// unstructured description of the error. Users should not depend on the - /// string for diagnosing errors, as it's not required to be consistent - /// between implementations. - internal-error(option), - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting or appending to a `fields` resource. - variant header-error { - /// This error indicates that a `field-key` or `field-value` was - /// syntactically invalid when used with an operation that sets headers in a - /// `fields`. - invalid-syntax, - /// This error indicates that a forbidden `field-key` was used when trying - /// to set a header in a `fields`. - forbidden, - /// This error indicates that the operation on the `fields` was not - /// permitted because the fields are immutable. - immutable, - } - - /// Field keys are always strings. - type field-key = string; - - /// Field values should always be ASCII strings. However, in - /// reality, HTTP implementations often have to interpret malformed values, - /// so they are provided as a list of bytes. - type field-value = list; - - /// This following block defines the `fields` resource which corresponds to - /// HTTP standard Fields. Fields are a common representation used for both - /// Headers and Trailers. - /// - /// A `fields` may be mutable or immutable. A `fields` created using the - /// constructor, `from-list`, or `clone` will be mutable, but a `fields` - /// resource given by other means (including, but not limited to, - /// `incoming-request.headers`, `outgoing-request.headers`) might be be - /// immutable. In an immutable fields, the `set`, `append`, and `delete` - /// operations will fail with `header-error.immutable`. - resource fields { - /// Construct an empty HTTP Fields. - /// - /// The resulting `fields` is mutable. - constructor(); - - /// Append a value for a key. Does not change or delete any existing - /// values for that key. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - append: func(name: field-key, value: field-value) -> result<_, header-error>; - - /// Make a deep copy of the Fields. Equivelant in behavior to calling the - /// `fields` constructor on the return value of `entries`. The resulting - /// `fields` is mutable. - clone: func() -> fields; - - /// Delete all values for a key. Does nothing if no values for the key - /// exist. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - delete: func(name: field-key) -> result<_, header-error>; - - /// Retrieve the full set of keys and values in the Fields. Like the - /// constructor, the list represents each key-value pair. - /// - /// The outer list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - entries: func() -> list>; - - /// Get all of the values corresponding to a key. If the key is not present - /// in this `fields`, an empty list is returned. However, if the key is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - get: func(name: field-key) -> list; - - /// Returns `true` when the key is present in this `fields`. If the key is - /// syntactically invalid, `false` is returned. - has: func(name: field-key) -> bool; - - /// Set all of the values for a key. Clears any existing values for that - /// key, if they have been set. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - set: func(name: field-key, value: list) -> result<_, header-error>; - - /// Construct an HTTP Fields. - /// - /// The resulting `fields` is mutable. - /// - /// The list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - /// - /// The tuple is a pair of the field key, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all keys - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. - /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. - from-list: static func(entries: list>) -> result; - } - - /// Headers is an alias for Fields. - type headers = fields; - - /// Trailers is an alias for Fields. - type trailers = fields; - - /// Represents an incoming HTTP Request. - resource incoming-request { - - /// Returns the authority from the request, if it was present. - authority: func() -> option; - - /// Gives the `incoming-body` associated with this request. Will only - /// return success at most once, and subsequent calls will return error. - consume: func() -> result; - - /// Get the `headers` associated with the request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// The `headers` returned are a child resource: it must be dropped before - /// the parent `incoming-request` is dropped. Dropping this - /// `incoming-request` before all children are dropped will trap. - headers: func() -> headers; - - /// Returns the method of the incoming request. - method: func() -> method; - - /// Returns the path with query parameters from the request, as a string. - path-with-query: func() -> option; - - /// Returns the protocol scheme from the request. - scheme: func() -> option; - } - - /// Represents an outgoing HTTP Request. - resource outgoing-request { - /// Construct a new `outgoing-request` with a default `method` of `GET`, and - /// `none` values for `path-with-query`, `scheme`, and `authority`. - /// - /// * `headers` is the HTTP Headers for the Request. - /// - /// It is possible to construct, or manipulate with the accessor functions - /// below, an `outgoing-request` with an invalid combination of `scheme` - /// and `authority`, or `headers` which are not permitted to be sent. - /// It is the obligation of the `outgoing-handler.handle` implementation - /// to reject invalid constructions of `outgoing-request`. - constructor(headers: headers); - - /// Get the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. - authority: func() -> option; - - /// Returns the resource corresponding to the outgoing Body for this - /// Request. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-request` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - - /// Get the Method for the Request. - method: func() -> method; - - /// Get the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. - path-with-query: func() -> option; - - /// Get the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. - scheme: func() -> option; - - /// Set the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid uri authority. - set-authority: func(authority: option) -> result; - - /// Set the Method for the Request. Fails if the string present in a - /// `method.other` argument is not a syntactically valid method. - set-method: func(method: method) -> result; - - /// Set the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. Fails is the - /// string given is not a syntactically valid path and query uri component. - set-path-with-query: func(path-with-query: option) -> result; - - /// Set the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. Fails if the - /// string given is not a syntactically valid uri scheme. - set-scheme: func(scheme: option) -> result; - } - - /// Parameters for making an HTTP Request. Each of these parameters is - /// currently an optional timeout applicable to the transport layer of the - /// HTTP protocol. - /// - /// These timeouts are separate from any the user may use to bound a - /// blocking call to `wasi:io/poll.poll`. - resource request-options { - /// Construct a default `request-options` value. - constructor(); - - /// The timeout for receiving subsequent chunks of bytes in the Response - /// body stream. - between-bytes-timeout: func() -> option; - - /// The timeout for the initial connect to the HTTP Server. - connect-timeout: func() -> option; - - /// The timeout for receiving the first byte of the Response body. - first-byte-timeout: func() -> option; - - /// Set the timeout for receiving subsequent chunks of bytes in the Response - /// body stream. An error return value indicates that this timeout is not - /// supported. - set-between-bytes-timeout: func(duration: option) -> result; - - /// Set the timeout for the initial connect to the HTTP Server. An error - /// return value indicates that this timeout is not supported. - set-connect-timeout: func(duration: option) -> result; - - /// Set the timeout for receiving the first byte of the Response body. An - /// error return value indicates that this timeout is not supported. - set-first-byte-timeout: func(duration: option) -> result; - } - - /// Represents the ability to send an HTTP Response. - /// - /// This resource is used by the `wasi:http/incoming-handler` interface to - /// allow a Response to be sent corresponding to the Request provided as the - /// other argument to `incoming-handler.handle`. - resource response-outparam { - - /// Set the value of the `response-outparam` to either send a response, - /// or indicate an error. - /// - /// This method consumes the `response-outparam` to ensure that it is - /// called at most once. If it is never called, the implementation - /// will respond with an error. - /// - /// The user may provide an `error` to `response` to allow the - /// implementation determine how to respond with an HTTP error response. - set: static func(param: response-outparam, response: result); - } - - /// This type corresponds to the HTTP standard Status Code. - type status-code = u16; - - /// Represents an incoming HTTP Response. - resource incoming-response { - - /// Returns the incoming body. May be called at most once. Returns error - /// if called additional times. - consume: func() -> result; - - /// Returns the headers from the incoming response. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `incoming-response` is dropped. - headers: func() -> headers; - - /// Returns the status code from the incoming response. - status: func() -> status-code; - } - - /// Represents an incoming HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, indicating that the full contents of the - /// body have been received. This resource represents the contents as - /// an `input-stream` and the delivery of trailers as a `future-trailers`, - /// and ensures that the user of this interface may only be consuming either - /// the body contents or waiting on trailers at any given time. - resource incoming-body { - - /// Returns the contents of the body, as a stream of bytes. - /// - /// Returns success on first call: the stream representing the contents - /// can be retrieved at most once. Subsequent calls will return error. - /// - /// The returned `input-stream` resource is a child: it must be dropped - /// before the parent `incoming-body` is dropped, or consumed by - /// `incoming-body.finish`. - /// - /// This invariant ensures that the implementation can determine whether - /// the user is consuming the contents of the body, waiting on the - /// `future-trailers` to be ready, or neither. This allows for network - /// backpressure is to be applied when the user is consuming the body, - /// and for that backpressure to not inhibit delivery of the trailers if - /// the user does not read the entire body. - %stream: func() -> result; - - /// Takes ownership of `incoming-body`, and returns a `future-trailers`. - /// This function will trap if the `input-stream` child is still alive. - finish: static func(this: incoming-body) -> future-trailers; - } - - /// Represents a future which may eventaully return trailers, or an error. - /// - /// In the case that the incoming HTTP Request or Response did not have any - /// trailers, this future will resolve to the empty set of trailers once the - /// complete Request or Response body has been received. - resource future-trailers { - - /// Returns the contents of the trailers, or an error which occured, - /// once the future is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the trailers or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the HTTP Request or Response - /// body, as well as any trailers, were received successfully, or that an - /// error occured receiving them. The optional `trailers` indicates whether - /// or not trailers were present in the body. - /// - /// When some `trailers` are returned by this method, the `trailers` - /// resource is immutable, and a child. Use of the `set`, `append`, or - /// `delete` methods will return an error, and the resource must be - /// dropped before the parent `future-trailers` is dropped. - get: func() -> option, error-code>>>; - - /// Returns a pollable which becomes ready when either the trailers have - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - } - - /// Represents an outgoing HTTP Response. - resource outgoing-response { - /// Construct an `outgoing-response`, with a default `status-code` of `200`. - /// If a different `status-code` is needed, it must be set via the - /// `set-status-code` method. - /// - /// * `headers` is the HTTP Headers for the Response. - constructor(headers: headers); - - /// Returns the resource corresponding to the outgoing Body for this Response. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-response` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - - /// Set the HTTP Status Code for the Response. Fails if the status-code - /// given is not a valid http status code. - set-status-code: func(status-code: status-code) -> result; - - /// Get the HTTP Status Code for the Response. - status-code: func() -> status-code; - } - - /// Represents an outgoing HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, inducating the full contents of the body - /// have been sent. This resource represents the contents as an - /// `output-stream` child resource, and the completion of the body (with - /// optional trailers) with a static function that consumes the - /// `outgoing-body` resource, and ensures that the user of this interface - /// may not write to the body contents after the body has been finished. - /// - /// If the user code drops this resource, as opposed to calling the static - /// method `finish`, the implementation should treat the body as incomplete, - /// and that an error has occured. The implementation should propogate this - /// error to the HTTP protocol by whatever means it has available, - /// including: corrupting the body on the wire, aborting the associated - /// Request, or sending a late status code for the Response. - resource outgoing-body { - - /// Returns a stream for writing the body contents. - /// - /// The returned `output-stream` is a child resource: it must be dropped - /// before the parent `outgoing-body` resource is dropped (or finished), - /// otherwise the `outgoing-body` drop or `finish` will trap. - /// - /// Returns success on the first call: the `output-stream` resource for - /// this `outgoing-body` may be retrieved at most once. Subsequent calls - /// will return error. - write: func() -> result; - - /// Finalize an outgoing body, optionally providing trailers. This must be - /// called to signal that the response is complete. If the `outgoing-body` - /// is dropped without calling `outgoing-body.finalize`, the implementation - /// should treat the body as corrupted. - /// - /// Fails if the body's `outgoing-request` or `outgoing-response` was - /// constructed with a Content-Length header, and the contents written - /// to the body (via `write`) does not match the value given in the - /// Content-Length. - finish: static func(this: outgoing-body, trailers: option) -> result<_, error-code>; - } - - /// Represents a future which may eventaully return an incoming HTTP - /// Response, or an error. - /// - /// This resource is returned by the `wasi:http/outgoing-handler` interface to - /// provide the HTTP Response corresponding to the sent Request. - resource future-incoming-response { - - /// Returns the incoming HTTP Response, or an error, once one is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the response or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the incoming HTTP Response - /// status and headers have recieved successfully, or that an error - /// occured. Errors may also occur while consuming the response body, - /// but those will be reported by the `incoming-body` and its - /// `output-stream` child. - get: func() -> option>>; - - /// Returns a pollable which becomes ready when either the Response has - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - } - - /// Attempts to extract a http-related `error` from the wasi:io `error` - /// provided. - /// - /// Stream operations which return - /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of - /// type `wasi:io/error/error` with more information about the operation - /// that failed. This payload can be passed through to this function to see - /// if there's http-related information about the error to return. - /// - /// Note that this function is fallible because not all io-errors are - /// http-related errors. - http-error-code: func(err: borrow) -> option; - } - - /// This interface defines a handler of incoming HTTP Requests. It should - /// be exported by components which can respond to HTTP Requests. - interface incoming-handler { - use types.{incoming-request}; - use types.{response-outparam}; - - /// This function is invoked with an incoming HTTP Request, and a resource - /// `response-outparam` which provides the capability to reply with an HTTP - /// Response. The response is sent by calling the `response-outparam.set` - /// method, which allows execution to continue after the response has been - /// sent. This enables both streaming to the response body, and performing other - /// work. - /// - /// The implementor of this function must write a response to the - /// `response-outparam` before returning, or else the caller will respond - /// with an error on its behalf. - handle: func(request: incoming-request, response-out: response-outparam); - } - - /// This interface defines a handler of outgoing HTTP Requests. It should be - /// imported by components which wish to make HTTP Requests. - interface outgoing-handler { - use types.{outgoing-request}; - use types.{request-options}; - use types.{future-incoming-response}; - use types.{error-code}; - - /// This function is invoked with an outgoing HTTP Request, and it returns - /// a resource `future-incoming-response` which represents an HTTP Response - /// which may arrive in the future. - /// - /// The `options` argument accepts optional parameters for the HTTP - /// protocol's transport layer. - /// - /// This function may return an error if the `outgoing-request` is invalid - /// or not allowed to be made. Otherwise, protocol errors are reported - /// through the `future-incoming-response`. - handle: func(request: outgoing-request, options: option) -> result; - } -} - -package wasi:io@0.2.0 { - interface poll { - resource pollable { - block: func(); - ready: func() -> bool; - } - poll: func(in: list>) -> list; - } - - interface error { - resource error { - to-debug-string: func() -> string; - } - } - - interface streams { - use error.{error}; - use poll.{pollable}; - variant stream-error { - last-operation-failed(error), - closed, - } - resource input-stream { - blocking-read: func(len: u64) -> result, stream-error>; - blocking-skip: func(len: u64) -> result; - read: func(len: u64) -> result, stream-error>; - skip: func(len: u64) -> result; - subscribe: func() -> pollable; - } - resource output-stream { - blocking-flush: func() -> result<_, stream-error>; - blocking-splice: func(src: borrow, len: u64) -> result; - blocking-write-and-flush: func(contents: list) -> result<_, stream-error>; - blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>; - check-write: func() -> result; - flush: func() -> result<_, stream-error>; - splice: func(src: borrow, len: u64) -> result; - subscribe: func() -> pollable; - write: func(contents: list) -> result<_, stream-error>; - write-zeroes: func(len: u64) -> result<_, stream-error>; - } - } -} - -package wasi:logging@0.1.0-draft { - interface logging { - enum level { - trace, - debug, - info, - warn, - error, - critical - } - log: func(level: level, context: string, message: string); - } -} - -package wasi:random@0.2.0 { - interface random { - get-random-bytes: func(len: u64) -> list; - get-random-u64: func() -> u64; - } - - interface insecure { - get-insecure-random-bytes: func(len: u64) -> list; - get-insecure-random-u64: func() -> u64; - } - - interface insecure-seed { - insecure-seed: func() -> tuple; - } -} - -package wasi:sockets@0.2.0 { - interface network { - resource network; - enum error-code { - unknown, - access-denied, - not-supported, - invalid-argument, - out-of-memory, - timeout, - concurrency-conflict, - not-in-progress, - would-block, - invalid-state, - new-socket-limit, - address-not-bindable, - address-in-use, - remote-unreachable, - connection-refused, - connection-reset, - connection-aborted, - datagram-too-large, - name-unresolvable, - temporary-resolver-failure, - permanent-resolver-failure - } - enum ip-address-family { ipv4, ipv6 } - type ipv4-address = tuple; - type ipv6-address = tuple; - variant ip-address { - ipv4(ipv4-address), - ipv6(ipv6-address), - } - record ipv4-socket-address { - port: u16, - address: ipv4-address, - } - record ipv6-socket-address { - port: u16, - flow-info: u32, - address: ipv6-address, - scope-id: u32, - } - variant ip-socket-address { - ipv4(ipv4-socket-address), - ipv6(ipv6-socket-address), - } - } - - interface instance-network { - use network.{network}; - instance-network: func() -> network; - } - - interface udp { - use wasi:io/poll@0.2.0.{pollable}; - use network.{network}; - use network.{error-code}; - use network.{ip-socket-address}; - use network.{ip-address-family}; - record incoming-datagram { - data: list, - remote-address: ip-socket-address, - } - record outgoing-datagram { - data: list, - remote-address: option, - } - resource udp-socket { - address-family: func() -> ip-address-family; - finish-bind: func() -> result<_, error-code>; - local-address: func() -> result; - receive-buffer-size: func() -> result; - remote-address: func() -> result; - send-buffer-size: func() -> result; - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; - start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; - %stream: func(remote-address: option) -> result, error-code>; - subscribe: func() -> pollable; - unicast-hop-limit: func() -> result; - } - resource incoming-datagram-stream { - receive: func(max-results: u64) -> result, error-code>; - subscribe: func() -> pollable; - } - resource outgoing-datagram-stream { - check-send: func() -> result; - send: func(datagrams: list) -> result; - subscribe: func() -> pollable; - } - } - - interface udp-create-socket { - use network.{network}; - use network.{error-code}; - use network.{ip-address-family}; - use udp.{udp-socket}; - create-udp-socket: func(address-family: ip-address-family) -> result; - } - - interface tcp { - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/poll@0.2.0.{pollable}; - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use network.{network}; - use network.{error-code}; - use network.{ip-socket-address}; - use network.{ip-address-family}; - enum shutdown-type { receive, send, both } - resource tcp-socket { - accept: func() -> result, error-code>; - address-family: func() -> ip-address-family; - finish-bind: func() -> result<_, error-code>; - finish-connect: func() -> result, error-code>; - finish-listen: func() -> result<_, error-code>; - hop-limit: func() -> result; - is-listening: func() -> bool; - keep-alive-count: func() -> result; - keep-alive-enabled: func() -> result; - keep-alive-idle-time: func() -> result; - keep-alive-interval: func() -> result; - local-address: func() -> result; - receive-buffer-size: func() -> result; - remote-address: func() -> result; - send-buffer-size: func() -> result; - set-hop-limit: func(value: u8) -> result<_, error-code>; - set-keep-alive-count: func(value: u32) -> result<_, error-code>; - set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; - set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; - set-keep-alive-interval: func(value: duration) -> result<_, error-code>; - set-listen-backlog-size: func(value: u64) -> result<_, error-code>; - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>; - start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; - start-connect: func(network: borrow, remote-address: ip-socket-address) -> result<_, error-code>; - start-listen: func() -> result<_, error-code>; - subscribe: func() -> pollable; - } - } - - interface tcp-create-socket { - use network.{network}; - use network.{error-code}; - use network.{ip-address-family}; - use tcp.{tcp-socket}; - create-tcp-socket: func(address-family: ip-address-family) -> result; - } - - interface ip-name-lookup { - use wasi:io/poll@0.2.0.{pollable}; - use network.{network}; - use network.{error-code}; - use network.{ip-address}; - resource resolve-address-stream { - resolve-next-address: func() -> result, error-code>; - subscribe: func() -> pollable; - } - resolve-addresses: func(network: borrow, name: string) -> result; - } -} - -package wasmcloud:bus@1.0.0 { - interface lattice { - resource call-target-interface { - constructor(namespace: string, %package: string, %interface: string); - } - set-link-name: func(name: string, interfaces: list); - } -} - -package wasmcloud:secrets@0.1.0-draft { - interface store { - variant secrets-error { - upstream(string), - io(string), - not-found, - } - variant secret-value { - %string(string), - bytes(list), - } - resource secret; - get: func(key: string) -> result; - } - - interface reveal { - use store.{secret}; - use store.{secret-value}; - reveal: func(s: borrow) -> secret-value; - } -} diff --git a/examples/component/http-client/gen/example/http-client/example/example.wit.go b/examples/component/http-client/gen/example/http-client/example/example.wit.go old mode 100755 new mode 100644 index 0b592383..e229e6bb --- a/examples/component/http-client/gen/example/http-client/example/example.wit.go +++ b/examples/component/http-client/gen/example/http-client/example/example.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package example represents the world "example:http-client/example". package example diff --git a/examples/component/http-client/gen/wasi/cli/environment/empty.s b/examples/component/http-client/gen/wasi/cli/environment/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/environment/environment.wasm.go b/examples/component/http-client/gen/wasi/cli/environment/environment.wasm.go old mode 100755 new mode 100644 index 89bb596b..08cd452e --- a/examples/component/http-client/gen/wasi/cli/environment/environment.wasm.go +++ b/examples/component/http-client/gen/wasi/cli/environment/environment.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package environment import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". diff --git a/examples/component/http-client/gen/wasi/cli/environment/environment.wit.go b/examples/component/http-client/gen/wasi/cli/environment/environment.wit.go old mode 100755 new mode 100644 index 068bed33..eefe4386 --- a/examples/component/http-client/gen/wasi/cli/environment/environment.wit.go +++ b/examples/component/http-client/gen/wasi/cli/environment/environment.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package environment represents the imported interface "wasi:cli/environment@0.2.0". package environment import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetEnvironment represents the imported function "get-environment". diff --git a/examples/component/http-client/gen/wasi/cli/exit/empty.s b/examples/component/http-client/gen/wasi/cli/exit/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/exit/exit.wasm.go b/examples/component/http-client/gen/wasi/cli/exit/exit.wasm.go old mode 100755 new mode 100644 index 849d5f50..eb875244 --- a/examples/component/http-client/gen/wasi/cli/exit/exit.wasm.go +++ b/examples/component/http-client/gen/wasi/cli/exit/exit.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package exit diff --git a/examples/component/http-client/gen/wasi/cli/exit/exit.wit.go b/examples/component/http-client/gen/wasi/cli/exit/exit.wit.go old mode 100755 new mode 100644 index 7a347b60..90433404 --- a/examples/component/http-client/gen/wasi/cli/exit/exit.wit.go +++ b/examples/component/http-client/gen/wasi/cli/exit/exit.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package exit represents the imported interface "wasi:cli/exit@0.2.0". package exit import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Exit represents the imported function "exit". diff --git a/examples/component/http-client/gen/wasi/cli/stderr/empty.s b/examples/component/http-client/gen/wasi/cli/stderr/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/stderr/stderr.wasm.go b/examples/component/http-client/gen/wasi/cli/stderr/stderr.wasm.go old mode 100755 new mode 100644 index 462cf172..4f71e47a --- a/examples/component/http-client/gen/wasi/cli/stderr/stderr.wasm.go +++ b/examples/component/http-client/gen/wasi/cli/stderr/stderr.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stderr diff --git a/examples/component/http-client/gen/wasi/cli/stderr/stderr.wit.go b/examples/component/http-client/gen/wasi/cli/stderr/stderr.wit.go old mode 100755 new mode 100644 index d00a972a..449716c9 --- a/examples/component/http-client/gen/wasi/cli/stderr/stderr.wit.go +++ b/examples/component/http-client/gen/wasi/cli/stderr/stderr.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stderr represents the imported interface "wasi:cli/stderr@0.2.0". package stderr import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/streams" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // OutputStream represents the imported type alias "wasi:cli/stderr@0.2.0#output-stream". diff --git a/examples/component/http-client/gen/wasi/cli/stdin/empty.s b/examples/component/http-client/gen/wasi/cli/stdin/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/stdin/stdin.wasm.go b/examples/component/http-client/gen/wasi/cli/stdin/stdin.wasm.go old mode 100755 new mode 100644 index 374eb253..e23cbf3d --- a/examples/component/http-client/gen/wasi/cli/stdin/stdin.wasm.go +++ b/examples/component/http-client/gen/wasi/cli/stdin/stdin.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdin diff --git a/examples/component/http-client/gen/wasi/cli/stdin/stdin.wit.go b/examples/component/http-client/gen/wasi/cli/stdin/stdin.wit.go old mode 100755 new mode 100644 index 2d7cfd2d..6a67e14b --- a/examples/component/http-client/gen/wasi/cli/stdin/stdin.wit.go +++ b/examples/component/http-client/gen/wasi/cli/stdin/stdin.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdin represents the imported interface "wasi:cli/stdin@0.2.0". package stdin import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/streams" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // InputStream represents the imported type alias "wasi:cli/stdin@0.2.0#input-stream". diff --git a/examples/component/http-client/gen/wasi/cli/stdout/empty.s b/examples/component/http-client/gen/wasi/cli/stdout/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/stdout/stdout.wasm.go b/examples/component/http-client/gen/wasi/cli/stdout/stdout.wasm.go old mode 100755 new mode 100644 index 68e4a3da..c184dcca --- a/examples/component/http-client/gen/wasi/cli/stdout/stdout.wasm.go +++ b/examples/component/http-client/gen/wasi/cli/stdout/stdout.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdout diff --git a/examples/component/http-client/gen/wasi/cli/stdout/stdout.wit.go b/examples/component/http-client/gen/wasi/cli/stdout/stdout.wit.go old mode 100755 new mode 100644 index 9564b8ae..64bd0c6c --- a/examples/component/http-client/gen/wasi/cli/stdout/stdout.wit.go +++ b/examples/component/http-client/gen/wasi/cli/stdout/stdout.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdout represents the imported interface "wasi:cli/stdout@0.2.0". package stdout import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/streams" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // OutputStream represents the imported type alias "wasi:cli/stdout@0.2.0#output-stream". diff --git a/examples/component/http-client/gen/wasi/cli/terminal-input/empty.s b/examples/component/http-client/gen/wasi/cli/terminal-input/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/terminal-input/terminalinput.wasm.go b/examples/component/http-client/gen/wasi/cli/terminal-input/terminal-input.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from examples/component/http-server/gen/wasi/cli/terminal-input/terminalinput.wasm.go rename to examples/component/http-client/gen/wasi/cli/terminal-input/terminal-input.wasm.go index 1df3794f..d1271efa --- a/examples/component/http-server/gen/wasi/cli/terminal-input/terminalinput.wasm.go +++ b/examples/component/http-client/gen/wasi/cli/terminal-input/terminal-input.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalinput diff --git a/examples/component/http-client/gen/wasi/cli/terminal-input/terminal-input.wit.go b/examples/component/http-client/gen/wasi/cli/terminal-input/terminal-input.wit.go old mode 100755 new mode 100644 index 18b9a9d7..f4270e53 --- a/examples/component/http-client/gen/wasi/cli/terminal-input/terminal-input.wit.go +++ b/examples/component/http-client/gen/wasi/cli/terminal-input/terminal-input.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalinput represents the imported interface "wasi:cli/terminal-input@0.2.0". package terminalinput import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalInput represents the imported resource "wasi:cli/terminal-input@0.2.0#terminal-input". diff --git a/examples/component/http-client/gen/wasi/cli/terminal-output/empty.s b/examples/component/http-client/gen/wasi/cli/terminal-output/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/terminal-output/terminaloutput.wasm.go b/examples/component/http-client/gen/wasi/cli/terminal-output/terminal-output.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from component/gen/wasi/cli/terminal-output/terminaloutput.wasm.go rename to examples/component/http-client/gen/wasi/cli/terminal-output/terminal-output.wasm.go index fb35fc41..e2b1717c --- a/component/gen/wasi/cli/terminal-output/terminaloutput.wasm.go +++ b/examples/component/http-client/gen/wasi/cli/terminal-output/terminal-output.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminaloutput diff --git a/examples/component/http-client/gen/wasi/cli/terminal-output/terminal-output.wit.go b/examples/component/http-client/gen/wasi/cli/terminal-output/terminal-output.wit.go old mode 100755 new mode 100644 index 823aaf52..0f30de01 --- a/examples/component/http-client/gen/wasi/cli/terminal-output/terminal-output.wit.go +++ b/examples/component/http-client/gen/wasi/cli/terminal-output/terminal-output.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminaloutput represents the imported interface "wasi:cli/terminal-output@0.2.0". package terminaloutput import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalOutput represents the imported resource "wasi:cli/terminal-output@0.2.0#terminal-output". diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stderr/empty.s b/examples/component/http-client/gen/wasi/cli/terminal-stderr/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go b/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go new file mode 100644 index 00000000..f7491c65 --- /dev/null +++ b/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalstderr + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-stderr@0.2.0 get-terminal-stderr +//go:noescape +func wasmimport_GetTerminalStderr(result *cm.Option[TerminalOutput]) diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go b/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go old mode 100755 new mode 100644 index 3f1c4e28..cae05668 --- a/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go +++ b/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstderr represents the imported interface "wasi:cli/terminal-stderr@0.2.0". package terminalstderr import ( terminaloutput "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/cli/terminal-output" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalOutput represents the imported type alias "wasi:cli/terminal-stderr@0.2.0#terminal-output". diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdin/empty.s b/examples/component/http-client/gen/wasi/cli/terminal-stdin/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go b/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go new file mode 100644 index 00000000..1337d58c --- /dev/null +++ b/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalstdin + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-stdin@0.2.0 get-terminal-stdin +//go:noescape +func wasmimport_GetTerminalStdin(result *cm.Option[TerminalInput]) diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go b/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go old mode 100755 new mode 100644 index c5e5aea1..24c2dbf1 --- a/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go +++ b/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdin represents the imported interface "wasi:cli/terminal-stdin@0.2.0". package terminalstdin import ( terminalinput "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/cli/terminal-input" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalInput represents the imported type alias "wasi:cli/terminal-stdin@0.2.0#terminal-input". diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdout/empty.s b/examples/component/http-client/gen/wasi/cli/terminal-stdout/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go b/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go new file mode 100644 index 00000000..aaf931c9 --- /dev/null +++ b/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalstdout + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-stdout@0.2.0 get-terminal-stdout +//go:noescape +func wasmimport_GetTerminalStdout(result *cm.Option[TerminalOutput]) diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go b/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go old mode 100755 new mode 100644 index 533f1f18..ee98b762 --- a/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go +++ b/examples/component/http-client/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdout represents the imported interface "wasi:cli/terminal-stdout@0.2.0". package terminalstdout import ( terminaloutput "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/cli/terminal-output" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalOutput represents the imported type alias "wasi:cli/terminal-stdout@0.2.0#terminal-output". diff --git a/examples/component/http-client/gen/wasi/clocks/monotonic-clock/empty.s b/examples/component/http-client/gen/wasi/clocks/monotonic-clock/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go b/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go old mode 100755 new mode 100644 similarity index 91% rename from component/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go rename to examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go index 36a1720a..aae90f4a --- a/component/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go +++ b/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package monotonicclock diff --git a/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go b/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go old mode 100755 new mode 100644 index 2a2ffcb7..625bc3c2 --- a/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go +++ b/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package monotonicclock represents the imported interface "wasi:clocks/monotonic-clock@0.2.0". package monotonicclock import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/poll" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Pollable represents the imported type alias "wasi:clocks/monotonic-clock@0.2.0#pollable". diff --git a/examples/component/http-client/gen/wasi/clocks/wall-clock/empty.s b/examples/component/http-client/gen/wasi/clocks/wall-clock/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/clocks/wall-clock/wallclock.wasm.go b/examples/component/http-client/gen/wasi/clocks/wall-clock/wall-clock.wasm.go old mode 100755 new mode 100644 similarity index 85% rename from component/gen/wasi/clocks/wall-clock/wallclock.wasm.go rename to examples/component/http-client/gen/wasi/clocks/wall-clock/wall-clock.wasm.go index 321ff3f1..662ea1e5 --- a/component/gen/wasi/clocks/wall-clock/wallclock.wasm.go +++ b/examples/component/http-client/gen/wasi/clocks/wall-clock/wall-clock.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package wallclock diff --git a/examples/component/http-client/gen/wasi/clocks/wall-clock/wall-clock.wit.go b/examples/component/http-client/gen/wasi/clocks/wall-clock/wall-clock.wit.go old mode 100755 new mode 100644 index e3f35395..b97eddd8 --- a/examples/component/http-client/gen/wasi/clocks/wall-clock/wall-clock.wit.go +++ b/examples/component/http-client/gen/wasi/clocks/wall-clock/wall-clock.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package wallclock represents the imported interface "wasi:clocks/wall-clock@0.2.0". package wallclock import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // DateTime represents the record "wasi:clocks/wall-clock@0.2.0#datetime". @@ -14,9 +14,9 @@ import ( // nanoseconds: u32, // } type DateTime struct { - _ cm.HostLayout - Seconds uint64 - Nanoseconds uint32 + _ cm.HostLayout `json:"-"` + Seconds uint64 `json:"seconds"` + Nanoseconds uint32 `json:"nanoseconds"` } // Now represents the imported function "now". diff --git a/examples/component/http-client/gen/wasi/config/runtime/abi.go b/examples/component/http-client/gen/wasi/config/runtime/abi.go old mode 100755 new mode 100644 index 61412cbe..a99a45a9 --- a/examples/component/http-client/gen/wasi/config/runtime/abi.go +++ b/examples/component/http-client/gen/wasi/config/runtime/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/http-client/gen/wasi/config/runtime/empty.s b/examples/component/http-client/gen/wasi/config/runtime/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/config/runtime/runtime.wasm.go b/examples/component/http-client/gen/wasi/config/runtime/runtime.wasm.go old mode 100755 new mode 100644 index 8ce17d5e..b9e129da --- a/examples/component/http-client/gen/wasi/config/runtime/runtime.wasm.go +++ b/examples/component/http-client/gen/wasi/config/runtime/runtime.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:config@0.2.0-draft". diff --git a/examples/component/http-client/gen/wasi/config/runtime/runtime.wit.go b/examples/component/http-client/gen/wasi/config/runtime/runtime.wit.go old mode 100755 new mode 100644 index 99a739d1..5a02be62 --- a/examples/component/http-client/gen/wasi/config/runtime/runtime.wit.go +++ b/examples/component/http-client/gen/wasi/config/runtime/runtime.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package runtime represents the imported interface "wasi:config/runtime@0.2.0-draft". package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // ConfigError represents the variant "wasi:config/runtime@0.2.0-draft#config-error". @@ -35,14 +35,14 @@ func (self *ConfigError) IO() *string { return cm.Case[string](self, 1) } -var stringsConfigError = [2]string{ +var _ConfigErrorStrings = [2]string{ "upstream", "io", } // String implements [fmt.Stringer], returning the variant case name of v. func (v ConfigError) String() string { - return stringsConfigError[v.Tag()] + return _ConfigErrorStrings[v.Tag()] } // Get represents the imported function "get". diff --git a/examples/component/http-client/gen/wasi/filesystem/preopens/empty.s b/examples/component/http-client/gen/wasi/filesystem/preopens/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wasm.go b/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wasm.go old mode 100755 new mode 100644 index 1bcd416a..6aebe453 --- a/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wasm.go +++ b/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package preopens import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0". diff --git a/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wit.go b/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wit.go old mode 100755 new mode 100644 index 628f25e1..922e7ada --- a/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wit.go +++ b/examples/component/http-client/gen/wasi/filesystem/preopens/preopens.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package preopens represents the imported interface "wasi:filesystem/preopens@0.2.0". package preopens import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/filesystem/types" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Descriptor represents the imported type alias "wasi:filesystem/preopens@0.2.0#descriptor". diff --git a/examples/component/http-client/gen/wasi/filesystem/types/abi.go b/examples/component/http-client/gen/wasi/filesystem/types/abi.go old mode 100755 new mode 100644 index 4ef3d4c2..44260a4e --- a/examples/component/http-client/gen/wasi/filesystem/types/abi.go +++ b/examples/component/http-client/gen/wasi/filesystem/types/abi.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( wallclock "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/clocks/wall-clock" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/http-client/gen/wasi/filesystem/types/empty.s b/examples/component/http-client/gen/wasi/filesystem/types/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/filesystem/types/types.wasm.go b/examples/component/http-client/gen/wasi/filesystem/types/types.wasm.go old mode 100755 new mode 100644 index b97dad84..9c919e5e --- a/examples/component/http-client/gen/wasi/filesystem/types/types.wasm.go +++ b/examples/component/http-client/gen/wasi/filesystem/types/types.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0". diff --git a/examples/component/http-client/gen/wasi/filesystem/types/types.wit.go b/examples/component/http-client/gen/wasi/filesystem/types/types.wit.go old mode 100755 new mode 100644 index d47ee607..ef479a94 --- a/examples/component/http-client/gen/wasi/filesystem/types/types.wit.go +++ b/examples/component/http-client/gen/wasi/filesystem/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:filesystem/types@0.2.0". package types @@ -6,7 +6,7 @@ package types import ( wallclock "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/clocks/wall-clock" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/streams" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // InputStream represents the imported type alias "wasi:filesystem/types@0.2.0#input-stream". @@ -59,7 +59,7 @@ const ( DescriptorTypeSocket ) -var stringsDescriptorType = [8]string{ +var _DescriptorTypeStrings = [8]string{ "unknown", "block-device", "character-device", @@ -72,9 +72,22 @@ var stringsDescriptorType = [8]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e DescriptorType) String() string { - return stringsDescriptorType[e] + return _DescriptorTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e DescriptorType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *DescriptorType) UnmarshalText(text []byte) error { + return _DescriptorTypeUnmarshalCase(e, text) +} + +var _DescriptorTypeUnmarshalCase = cm.CaseUnmarshaler[DescriptorType](_DescriptorTypeStrings[:]) + // DescriptorFlags represents the flags "wasi:filesystem/types@0.2.0#descriptor-flags". // // flags descriptor-flags { @@ -140,13 +153,13 @@ type LinkCount uint64 // status-change-timestamp: option, // } type DescriptorStat struct { - _ cm.HostLayout - Type DescriptorType - LinkCount LinkCount - Size FileSize - DataAccessTimestamp cm.Option[DateTime] - DataModificationTimestamp cm.Option[DateTime] - StatusChangeTimestamp cm.Option[DateTime] + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + LinkCount LinkCount `json:"link-count"` + Size FileSize `json:"size"` + DataAccessTimestamp cm.Option[DateTime] `json:"data-access-timestamp"` + DataModificationTimestamp cm.Option[DateTime] `json:"data-modification-timestamp"` + StatusChangeTimestamp cm.Option[DateTime] `json:"status-change-timestamp"` } // NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp". @@ -190,7 +203,7 @@ func (self *NewTimestamp) Timestamp() *DateTime { return cm.Case[DateTime](self, 2) } -var stringsNewTimestamp = [3]string{ +var _NewTimestampStrings = [3]string{ "no-change", "now", "timestamp", @@ -198,7 +211,7 @@ var stringsNewTimestamp = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v NewTimestamp) String() string { - return stringsNewTimestamp[v.Tag()] + return _NewTimestampStrings[v.Tag()] } // DirectoryEntry represents the record "wasi:filesystem/types@0.2.0#directory-entry". @@ -208,9 +221,9 @@ func (v NewTimestamp) String() string { // name: string, // } type DirectoryEntry struct { - _ cm.HostLayout - Type DescriptorType - Name string + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + Name string `json:"name"` } // ErrorCode represents the enum "wasi:filesystem/types@0.2.0#error-code". @@ -296,7 +309,7 @@ const ( ErrorCodeCrossDevice ) -var stringsErrorCode = [37]string{ +var _ErrorCodeStrings = [37]string{ "access", "would-block", "already", @@ -338,9 +351,22 @@ var stringsErrorCode = [37]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // Advice represents the enum "wasi:filesystem/types@0.2.0#advice". // // enum advice { @@ -362,7 +388,7 @@ const ( AdviceNoReuse ) -var stringsAdvice = [6]string{ +var _AdviceStrings = [6]string{ "normal", "sequential", "random", @@ -373,9 +399,22 @@ var stringsAdvice = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Advice) String() string { - return stringsAdvice[e] + return _AdviceStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e Advice) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Advice) UnmarshalText(text []byte) error { + return _AdviceUnmarshalCase(e, text) +} + +var _AdviceUnmarshalCase = cm.CaseUnmarshaler[Advice](_AdviceStrings[:]) + // MetadataHashValue represents the record "wasi:filesystem/types@0.2.0#metadata-hash-value". // // record metadata-hash-value { @@ -383,9 +422,9 @@ func (e Advice) String() string { // upper: u64, // } type MetadataHashValue struct { - _ cm.HostLayout - Lower uint64 - Upper uint64 + _ cm.HostLayout `json:"-"` + Lower uint64 `json:"lower"` + Upper uint64 `json:"upper"` } // Descriptor represents the imported resource "wasi:filesystem/types@0.2.0#descriptor". diff --git a/examples/component/http-client/gen/wasi/http/incoming-handler/empty.s b/examples/component/http-client/gen/wasi/http/incoming-handler/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.exports.go b/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.exports.go old mode 100755 new mode 100644 index 673ccb48..6447d62b --- a/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.exports.go +++ b/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.exports.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package incominghandler diff --git a/examples/component/http-client/gen/wasi/http/incoming-handler/incominghandler.wasm.go b/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.wasm.go old mode 100755 new mode 100644 similarity index 84% rename from examples/component/http-client/gen/wasi/http/incoming-handler/incominghandler.wasm.go rename to examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.wasm.go index eae429f3..abeca9ae --- a/examples/component/http-client/gen/wasi/http/incoming-handler/incominghandler.wasm.go +++ b/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package incominghandler import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". diff --git a/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.wit.go b/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.wit.go old mode 100755 new mode 100644 index 7491198f..59efe14a --- a/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.wit.go +++ b/examples/component/http-client/gen/wasi/http/incoming-handler/incoming-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package incominghandler represents the exported interface "wasi:http/incoming-handler@0.2.0". // diff --git a/examples/component/http-client/gen/wasi/http/outgoing-handler/abi.go b/examples/component/http-client/gen/wasi/http/outgoing-handler/abi.go old mode 100755 new mode 100644 index 7f91a7ac..89fa94be --- a/examples/component/http-client/gen/wasi/http/outgoing-handler/abi.go +++ b/examples/component/http-client/gen/wasi/http/outgoing-handler/abi.go @@ -1,17 +1,16 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler import ( - "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/http/types" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) // ErrorCodeShape is used for storage in variant or result types. type ErrorCodeShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(types.ErrorCode{})]byte + shape [unsafe.Sizeof(ErrorCode{})]byte } func lower_OptionRequestOptions(v cm.Option[RequestOptions]) (f0 uint32, f1 uint32) { diff --git a/examples/component/http-client/gen/wasi/http/outgoing-handler/empty.s b/examples/component/http-client/gen/wasi/http/outgoing-handler/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go b/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go new file mode 100644 index 00000000..efbfdb74 --- /dev/null +++ b/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package outgoinghandler + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". + +//go:wasmimport wasi:http/outgoing-handler@0.2.0 handle +//go:noescape +func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result *cm.Result[ErrorCodeShape, FutureIncomingResponse, ErrorCode]) diff --git a/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go b/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go old mode 100755 new mode 100644 index 6ad820eb..209a90a6 --- a/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go +++ b/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package outgoinghandler represents the imported interface "wasi:http/outgoing-handler@0.2.0". // @@ -8,7 +8,7 @@ package outgoinghandler import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/http/types" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // OutgoingRequest represents the imported type alias "wasi:http/outgoing-handler@0.2.0#outgoing-request". diff --git a/examples/component/http-client/gen/wasi/http/types/abi.go b/examples/component/http-client/gen/wasi/http/types/abi.go old mode 100755 new mode 100644 index 6ffb1fdd..7c24d70f --- a/examples/component/http-client/gen/wasi/http/types/abi.go +++ b/examples/component/http-client/gen/wasi/http/types/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/http-client/gen/wasi/http/types/empty.s b/examples/component/http-client/gen/wasi/http/types/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/http/types/types.wasm.go b/examples/component/http-client/gen/wasi/http/types/types.wasm.go old mode 100755 new mode 100644 index b025b2af..1d4810cf --- a/examples/component/http-client/gen/wasi/http/types/types.wasm.go +++ b/examples/component/http-client/gen/wasi/http/types/types.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". diff --git a/examples/component/http-client/gen/wasi/http/types/types.wit.go b/examples/component/http-client/gen/wasi/http/types/types.wit.go old mode 100755 new mode 100644 index 4361149d..5e9050d7 --- a/examples/component/http-client/gen/wasi/http/types/types.wit.go +++ b/examples/component/http-client/gen/wasi/http/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:http/types@0.2.0". // @@ -12,7 +12,7 @@ import ( ioerror "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/error" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/poll" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/streams" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Duration represents the type alias "wasi:http/types@0.2.0#duration". @@ -167,7 +167,7 @@ func (self *Method) Other() *string { return cm.Case[string](self, 9) } -var stringsMethod = [10]string{ +var _MethodStrings = [10]string{ "get", "head", "post", @@ -182,7 +182,7 @@ var stringsMethod = [10]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Method) String() string { - return stringsMethod[v.Tag()] + return _MethodStrings[v.Tag()] } // Scheme represents the variant "wasi:http/types@0.2.0#scheme". @@ -228,7 +228,7 @@ func (self *Scheme) Other() *string { return cm.Case[string](self, 2) } -var stringsScheme = [3]string{ +var _SchemeStrings = [3]string{ "HTTP", "HTTPS", "other", @@ -236,7 +236,7 @@ var stringsScheme = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Scheme) String() string { - return stringsScheme[v.Tag()] + return _SchemeStrings[v.Tag()] } // DNSErrorPayload represents the record "wasi:http/types@0.2.0#DNS-error-payload". @@ -248,9 +248,9 @@ func (v Scheme) String() string { // info-code: option, // } type DNSErrorPayload struct { - _ cm.HostLayout - Rcode cm.Option[string] - InfoCode cm.Option[uint16] + _ cm.HostLayout `json:"-"` + Rcode cm.Option[string] `json:"rcode"` + InfoCode cm.Option[uint16] `json:"info-code"` } // TLSAlertReceivedPayload represents the record "wasi:http/types@0.2.0#TLS-alert-received-payload". @@ -262,9 +262,9 @@ type DNSErrorPayload struct { // alert-message: option, // } type TLSAlertReceivedPayload struct { - _ cm.HostLayout - AlertID cm.Option[uint8] - AlertMessage cm.Option[string] + _ cm.HostLayout `json:"-"` + AlertID cm.Option[uint8] `json:"alert-id"` + AlertMessage cm.Option[string] `json:"alert-message"` } // FieldSizePayload represents the record "wasi:http/types@0.2.0#field-size-payload". @@ -276,9 +276,9 @@ type TLSAlertReceivedPayload struct { // field-size: option, // } type FieldSizePayload struct { - _ cm.HostLayout - FieldName cm.Option[string] - FieldSize cm.Option[uint32] + _ cm.HostLayout `json:"-"` + FieldName cm.Option[string] `json:"field-name"` + FieldSize cm.Option[uint32] `json:"field-size"` } // ErrorCode represents the variant "wasi:http/types@0.2.0#error-code". @@ -749,7 +749,7 @@ func (self *ErrorCode) InternalError() *cm.Option[string] { return cm.Case[cm.Option[string]](self, 38) } -var stringsErrorCode = [39]string{ +var _ErrorCodeStrings = [39]string{ "DNS-timeout", "DNS-error", "destination-not-found", @@ -793,7 +793,7 @@ var stringsErrorCode = [39]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v ErrorCode) String() string { - return stringsErrorCode[v.Tag()] + return _ErrorCodeStrings[v.Tag()] } // HeaderError represents the variant "wasi:http/types@0.2.0#header-error". @@ -823,7 +823,7 @@ const ( HeaderErrorImmutable ) -var stringsHeaderError = [3]string{ +var _HeaderErrorStrings = [3]string{ "invalid-syntax", "forbidden", "immutable", @@ -831,9 +831,22 @@ var stringsHeaderError = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e HeaderError) String() string { - return stringsHeaderError[e] + return _HeaderErrorStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e HeaderError) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *HeaderError) UnmarshalText(text []byte) error { + return _HeaderErrorUnmarshalCase(e, text) +} + +var _HeaderErrorUnmarshalCase = cm.CaseUnmarshaler[HeaderError](_HeaderErrorStrings[:]) + // FieldKey represents the string "wasi:http/types@0.2.0#field-key". // // Field keys are always strings. diff --git a/examples/component/http-client/gen/wasi/io/error/empty.s b/examples/component/http-client/gen/wasi/io/error/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/io/error/ioerror.wasm.go b/examples/component/http-client/gen/wasi/io/error/error.wasm.go old mode 100755 new mode 100644 similarity index 86% rename from examples/component/http-server/gen/wasi/io/error/ioerror.wasm.go rename to examples/component/http-client/gen/wasi/io/error/error.wasm.go index e254b5d8..eee2750b --- a/examples/component/http-server/gen/wasi/io/error/ioerror.wasm.go +++ b/examples/component/http-client/gen/wasi/io/error/error.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ioerror diff --git a/examples/component/http-client/gen/wasi/io/error/error.wit.go b/examples/component/http-client/gen/wasi/io/error/error.wit.go old mode 100755 new mode 100644 index 828e977e..ed84ae22 --- a/examples/component/http-client/gen/wasi/io/error/error.wit.go +++ b/examples/component/http-client/gen/wasi/io/error/error.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ioerror represents the imported interface "wasi:io/error@0.2.0". package ioerror import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Error represents the imported resource "wasi:io/error@0.2.0#error". diff --git a/examples/component/http-client/gen/wasi/io/poll/empty.s b/examples/component/http-client/gen/wasi/io/poll/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/io/poll/poll.wasm.go b/examples/component/http-client/gen/wasi/io/poll/poll.wasm.go old mode 100755 new mode 100644 index f7c55c3d..ab811b32 --- a/examples/component/http-client/gen/wasi/io/poll/poll.wasm.go +++ b/examples/component/http-client/gen/wasi/io/poll/poll.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package poll import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". diff --git a/examples/component/http-client/gen/wasi/io/poll/poll.wit.go b/examples/component/http-client/gen/wasi/io/poll/poll.wit.go old mode 100755 new mode 100644 index ad9e9564..cb8f618f --- a/examples/component/http-client/gen/wasi/io/poll/poll.wit.go +++ b/examples/component/http-client/gen/wasi/io/poll/poll.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package poll represents the imported interface "wasi:io/poll@0.2.0". package poll import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Pollable represents the imported resource "wasi:io/poll@0.2.0#pollable". diff --git a/examples/component/http-client/gen/wasi/io/streams/empty.s b/examples/component/http-client/gen/wasi/io/streams/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/io/streams/streams.wasm.go b/examples/component/http-client/gen/wasi/io/streams/streams.wasm.go old mode 100755 new mode 100644 index eec56645..a754dbcf --- a/examples/component/http-client/gen/wasi/io/streams/streams.wasm.go +++ b/examples/component/http-client/gen/wasi/io/streams/streams.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package streams import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". diff --git a/examples/component/http-client/gen/wasi/io/streams/streams.wit.go b/examples/component/http-client/gen/wasi/io/streams/streams.wit.go old mode 100755 new mode 100644 index 24a71fc1..e9b2d661 --- a/examples/component/http-client/gen/wasi/io/streams/streams.wit.go +++ b/examples/component/http-client/gen/wasi/io/streams/streams.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package streams represents the imported interface "wasi:io/streams@0.2.0". package streams @@ -6,7 +6,7 @@ package streams import ( ioerror "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/error" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/poll" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Error represents the imported type alias "wasi:io/streams@0.2.0#error". @@ -48,14 +48,14 @@ func (self *StreamError) Closed() bool { return self.Tag() == 1 } -var stringsStreamError = [2]string{ +var _StreamErrorStrings = [2]string{ "last-operation-failed", "closed", } // String implements [fmt.Stringer], returning the variant case name of v. func (v StreamError) String() string { - return stringsStreamError[v.Tag()] + return _StreamErrorStrings[v.Tag()] } // InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream". diff --git a/examples/component/http-client/gen/wasi/logging/logging/empty.s b/examples/component/http-client/gen/wasi/logging/logging/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/logging/logging/logging.wasm.go b/examples/component/http-client/gen/wasi/logging/logging/logging.wasm.go old mode 100755 new mode 100644 index d2d27098..bc430bd6 --- a/examples/component/http-client/gen/wasi/logging/logging/logging.wasm.go +++ b/examples/component/http-client/gen/wasi/logging/logging/logging.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package logging diff --git a/examples/component/http-client/gen/wasi/logging/logging/logging.wit.go b/examples/component/http-client/gen/wasi/logging/logging/logging.wit.go old mode 100755 new mode 100644 index 96e406ed..064814a5 --- a/examples/component/http-client/gen/wasi/logging/logging/logging.wit.go +++ b/examples/component/http-client/gen/wasi/logging/logging/logging.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package logging represents the imported interface "wasi:logging/logging@0.1.0-draft". package logging import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Level represents the enum "wasi:logging/logging@0.1.0-draft#level". @@ -28,7 +28,7 @@ const ( LevelCritical ) -var stringsLevel = [6]string{ +var _LevelStrings = [6]string{ "trace", "debug", "info", @@ -39,9 +39,22 @@ var stringsLevel = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Level) String() string { - return stringsLevel[e] + return _LevelStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e Level) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Level) UnmarshalText(text []byte) error { + return _LevelUnmarshalCase(e, text) +} + +var _LevelUnmarshalCase = cm.CaseUnmarshaler[Level](_LevelStrings[:]) + // Log represents the imported function "log". // // log: func(level: level, context: string, message: string) diff --git a/examples/component/http-client/gen/wasi/random/insecure-seed/empty.s b/examples/component/http-client/gen/wasi/random/insecure-seed/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/random/insecure-seed/insecureseed.wasm.go b/examples/component/http-client/gen/wasi/random/insecure-seed/insecure-seed.wasm.go old mode 100755 new mode 100644 similarity index 80% rename from examples/component/http-server/gen/wasi/random/insecure-seed/insecureseed.wasm.go rename to examples/component/http-client/gen/wasi/random/insecure-seed/insecure-seed.wasm.go index e94356df..2c1d8b4a --- a/examples/component/http-server/gen/wasi/random/insecure-seed/insecureseed.wasm.go +++ b/examples/component/http-client/gen/wasi/random/insecure-seed/insecure-seed.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecureseed diff --git a/examples/component/http-client/gen/wasi/random/insecure-seed/insecure-seed.wit.go b/examples/component/http-client/gen/wasi/random/insecure-seed/insecure-seed.wit.go old mode 100755 new mode 100644 index e701d1b4..856b2cc7 --- a/examples/component/http-client/gen/wasi/random/insecure-seed/insecure-seed.wit.go +++ b/examples/component/http-client/gen/wasi/random/insecure-seed/insecure-seed.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecureseed represents the imported interface "wasi:random/insecure-seed@0.2.0". package insecureseed diff --git a/examples/component/http-client/gen/wasi/random/insecure/empty.s b/examples/component/http-client/gen/wasi/random/insecure/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/random/insecure/insecure.wasm.go b/examples/component/http-client/gen/wasi/random/insecure/insecure.wasm.go old mode 100755 new mode 100644 index 498bfe4a..cfcd23b9 --- a/examples/component/http-client/gen/wasi/random/insecure/insecure.wasm.go +++ b/examples/component/http-client/gen/wasi/random/insecure/insecure.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecure import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". diff --git a/examples/component/http-client/gen/wasi/random/insecure/insecure.wit.go b/examples/component/http-client/gen/wasi/random/insecure/insecure.wit.go old mode 100755 new mode 100644 index f32282c6..6195f9a6 --- a/examples/component/http-client/gen/wasi/random/insecure/insecure.wit.go +++ b/examples/component/http-client/gen/wasi/random/insecure/insecure.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecure represents the imported interface "wasi:random/insecure@0.2.0". package insecure import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetInsecureRandomBytes represents the imported function "get-insecure-random-bytes". diff --git a/examples/component/http-client/gen/wasi/random/random/empty.s b/examples/component/http-client/gen/wasi/random/random/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/random/random/random.wasm.go b/examples/component/http-client/gen/wasi/random/random/random.wasm.go old mode 100755 new mode 100644 index 9096457b..d7885ae4 --- a/examples/component/http-client/gen/wasi/random/random/random.wasm.go +++ b/examples/component/http-client/gen/wasi/random/random/random.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package random import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". diff --git a/examples/component/http-client/gen/wasi/random/random/random.wit.go b/examples/component/http-client/gen/wasi/random/random/random.wit.go old mode 100755 new mode 100644 index 98bb7779..392341aa --- a/examples/component/http-client/gen/wasi/random/random/random.wit.go +++ b/examples/component/http-client/gen/wasi/random/random/random.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package random represents the imported interface "wasi:random/random@0.2.0". package random import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetRandomBytes represents the imported function "get-random-bytes". diff --git a/examples/component/http-client/gen/wasi/sockets/instance-network/empty.s b/examples/component/http-client/gen/wasi/sockets/instance-network/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/sockets/instance-network/instancenetwork.wasm.go b/examples/component/http-client/gen/wasi/sockets/instance-network/instance-network.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from examples/component/http-server/gen/wasi/sockets/instance-network/instancenetwork.wasm.go rename to examples/component/http-client/gen/wasi/sockets/instance-network/instance-network.wasm.go index eb113e21..aca75114 --- a/examples/component/http-server/gen/wasi/sockets/instance-network/instancenetwork.wasm.go +++ b/examples/component/http-client/gen/wasi/sockets/instance-network/instance-network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package instancenetwork diff --git a/examples/component/http-client/gen/wasi/sockets/instance-network/instance-network.wit.go b/examples/component/http-client/gen/wasi/sockets/instance-network/instance-network.wit.go old mode 100755 new mode 100644 index c727d7e1..0f7df0b8 --- a/examples/component/http-client/gen/wasi/sockets/instance-network/instance-network.wit.go +++ b/examples/component/http-client/gen/wasi/sockets/instance-network/instance-network.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package instancenetwork represents the imported interface "wasi:sockets/instance-network@0.2.0". package instancenetwork import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Network represents the imported type alias "wasi:sockets/instance-network@0.2.0#network". diff --git a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/abi.go b/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/abi.go old mode 100755 new mode 100644 index a63f0d01..87ab2794 --- a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/abi.go +++ b/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/empty.s b/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go b/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go new file mode 100644 index 00000000..24edd5cb --- /dev/null +++ b/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go @@ -0,0 +1,25 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package ipnamelookup + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [resource-drop]resolve-address-stream +//go:noescape +func wasmimport_ResolveAddressStreamResourceDrop(self0 uint32) + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [method]resolve-address-stream.resolve-next-address +//go:noescape +func wasmimport_ResolveAddressStreamResolveNextAddress(self0 uint32, result *cm.Result[OptionIPAddressShape, cm.Option[IPAddress], ErrorCode]) + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [method]resolve-address-stream.subscribe +//go:noescape +func wasmimport_ResolveAddressStreamSubscribe(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 resolve-addresses +//go:noescape +func wasmimport_ResolveAddresses(network0 uint32, name0 *uint8, name1 uint32, result *cm.Result[ResolveAddressStream, ResolveAddressStream, ErrorCode]) diff --git a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go b/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go old mode 100755 new mode 100644 index 99c12f55..2febbde6 --- a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go +++ b/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ipnamelookup represents the imported interface "wasi:sockets/ip-name-lookup@0.2.0". package ipnamelookup @@ -6,7 +6,7 @@ package ipnamelookup import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/poll" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Pollable represents the imported type alias "wasi:sockets/ip-name-lookup@0.2.0#pollable". diff --git a/examples/component/http-client/gen/wasi/sockets/network/abi.go b/examples/component/http-client/gen/wasi/sockets/network/abi.go old mode 100755 new mode 100644 index a088bd1d..3d09cbe2 --- a/examples/component/http-client/gen/wasi/sockets/network/abi.go +++ b/examples/component/http-client/gen/wasi/sockets/network/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/http-client/gen/wasi/sockets/network/empty.s b/examples/component/http-client/gen/wasi/sockets/network/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/network/network.wasm.go b/examples/component/http-client/gen/wasi/sockets/network/network.wasm.go old mode 100755 new mode 100644 index 012a79ff..23f02bdd --- a/examples/component/http-client/gen/wasi/sockets/network/network.wasm.go +++ b/examples/component/http-client/gen/wasi/sockets/network/network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network diff --git a/examples/component/http-client/gen/wasi/sockets/network/network.wit.go b/examples/component/http-client/gen/wasi/sockets/network/network.wit.go old mode 100755 new mode 100644 index f0fb7eef..17d70aeb --- a/examples/component/http-client/gen/wasi/sockets/network/network.wit.go +++ b/examples/component/http-client/gen/wasi/sockets/network/network.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package network represents the imported interface "wasi:sockets/network@0.2.0". package network import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Network represents the imported resource "wasi:sockets/network@0.2.0#network". @@ -74,7 +74,7 @@ const ( ErrorCodePermanentResolverFailure ) -var stringsErrorCode = [21]string{ +var _ErrorCodeStrings = [21]string{ "unknown", "access-denied", "not-supported", @@ -100,9 +100,22 @@ var stringsErrorCode = [21]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // IPAddressFamily represents the enum "wasi:sockets/network@0.2.0#ip-address-family". // // enum ip-address-family { @@ -116,16 +129,29 @@ const ( IPAddressFamilyIPv6 ) -var stringsIPAddressFamily = [2]string{ +var _IPAddressFamilyStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the enum case name of e. func (e IPAddressFamily) String() string { - return stringsIPAddressFamily[e] + return _IPAddressFamilyStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e IPAddressFamily) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *IPAddressFamily) UnmarshalText(text []byte) error { + return _IPAddressFamilyUnmarshalCase(e, text) +} + +var _IPAddressFamilyUnmarshalCase = cm.CaseUnmarshaler[IPAddressFamily](_IPAddressFamilyStrings[:]) + // IPv4Address represents the tuple "wasi:sockets/network@0.2.0#ipv4-address". // // type ipv4-address = tuple @@ -164,14 +190,14 @@ func (self *IPAddress) IPv6() *IPv6Address { return cm.Case[IPv6Address](self, 1) } -var stringsIPAddress = [2]string{ +var _IPAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPAddress) String() string { - return stringsIPAddress[v.Tag()] + return _IPAddressStrings[v.Tag()] } // IPv4SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv4-socket-address". @@ -181,9 +207,9 @@ func (v IPAddress) String() string { // address: ipv4-address, // } type IPv4SocketAddress struct { - _ cm.HostLayout - Port uint16 - Address IPv4Address + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + Address IPv4Address `json:"address"` } // IPv6SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv6-socket-address". @@ -195,11 +221,11 @@ type IPv4SocketAddress struct { // scope-id: u32, // } type IPv6SocketAddress struct { - _ cm.HostLayout - Port uint16 - FlowInfo uint32 - Address IPv6Address - ScopeID uint32 + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + FlowInfo uint32 `json:"flow-info"` + Address IPv6Address `json:"address"` + ScopeID uint32 `json:"scope-id"` } // IPSocketAddress represents the variant "wasi:sockets/network@0.2.0#ip-socket-address". @@ -230,12 +256,12 @@ func (self *IPSocketAddress) IPv6() *IPv6SocketAddress { return cm.Case[IPv6SocketAddress](self, 1) } -var stringsIPSocketAddress = [2]string{ +var _IPSocketAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPSocketAddress) String() string { - return stringsIPSocketAddress[v.Tag()] + return _IPSocketAddressStrings[v.Tag()] } diff --git a/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/empty.s b/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go b/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go new file mode 100644 index 00000000..5124c0c0 --- /dev/null +++ b/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package tcpcreatesocket + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/tcp-create-socket@0.2.0 create-tcp-socket +//go:noescape +func wasmimport_CreateTCPSocket(addressFamily0 uint32, result *cm.Result[TCPSocket, TCPSocket, ErrorCode]) diff --git a/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go b/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go old mode 100755 new mode 100644 index 2dd653c8..c0c90050 --- a/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go +++ b/examples/component/http-client/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcpcreatesocket represents the imported interface "wasi:sockets/tcp-create-socket@0.2.0". package tcpcreatesocket @@ -6,7 +6,7 @@ package tcpcreatesocket import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/tcp" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Network represents the imported type alias "wasi:sockets/tcp-create-socket@0.2.0#network". diff --git a/examples/component/http-client/gen/wasi/sockets/tcp/abi.go b/examples/component/http-client/gen/wasi/sockets/tcp/abi.go old mode 100755 new mode 100644 index db36f756..eb846a2b --- a/examples/component/http-client/gen/wasi/sockets/tcp/abi.go +++ b/examples/component/http-client/gen/wasi/sockets/tcp/abi.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) @@ -23,7 +23,7 @@ type TupleInputStreamOutputStreamShape struct { // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/http-client/gen/wasi/sockets/tcp/empty.s b/examples/component/http-client/gen/wasi/sockets/tcp/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wasm.go b/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wasm.go old mode 100755 new mode 100644 index 56247525..b833ba41 --- a/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wasm.go +++ b/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". @@ -46,7 +46,7 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32, //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-enabled //go:noescape -func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool, bool, ErrorCode]) +func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[ErrorCode, bool, ErrorCode]) //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-idle-time //go:noescape diff --git a/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wit.go b/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wit.go old mode 100755 new mode 100644 index 9216a68d..6c4ea096 --- a/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wit.go +++ b/examples/component/http-client/gen/wasi/sockets/tcp/tcp.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcp represents the imported interface "wasi:sockets/tcp@0.2.0". package tcp @@ -8,7 +8,7 @@ import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/poll" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/streams" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // InputStream represents the imported type alias "wasi:sockets/tcp@0.2.0#input-stream". @@ -66,7 +66,7 @@ const ( ShutdownTypeBoth ) -var stringsShutdownType = [3]string{ +var _ShutdownTypeStrings = [3]string{ "receive", "send", "both", @@ -74,9 +74,22 @@ var stringsShutdownType = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ShutdownType) String() string { - return stringsShutdownType[e] + return _ShutdownTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ShutdownType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ShutdownType) UnmarshalText(text []byte) error { + return _ShutdownTypeUnmarshalCase(e, text) +} + +var _ShutdownTypeUnmarshalCase = cm.CaseUnmarshaler[ShutdownType](_ShutdownTypeStrings[:]) + // TCPSocket represents the imported resource "wasi:sockets/tcp@0.2.0#tcp-socket". // // resource tcp-socket @@ -188,7 +201,7 @@ func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCo // keep-alive-enabled: func() -> result // //go:nosplit -func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) { +func (self TCPSocket) KeepAliveEnabled() (result cm.Result[ErrorCode, bool, ErrorCode]) { self0 := cm.Reinterpret[uint32](self) wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result) return diff --git a/examples/component/http-client/gen/wasi/sockets/udp-create-socket/empty.s b/examples/component/http-client/gen/wasi/sockets/udp-create-socket/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go b/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go new file mode 100644 index 00000000..bbae0015 --- /dev/null +++ b/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package udpcreatesocket + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/udp-create-socket@0.2.0 create-udp-socket +//go:noescape +func wasmimport_CreateUDPSocket(addressFamily0 uint32, result *cm.Result[UDPSocket, UDPSocket, ErrorCode]) diff --git a/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go b/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go old mode 100755 new mode 100644 index 573125f6..f4925636 --- a/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go +++ b/examples/component/http-client/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udpcreatesocket represents the imported interface "wasi:sockets/udp-create-socket@0.2.0". package udpcreatesocket @@ -6,7 +6,7 @@ package udpcreatesocket import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/udp" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Network represents the imported type alias "wasi:sockets/udp-create-socket@0.2.0#network". diff --git a/examples/component/http-client/gen/wasi/sockets/udp/abi.go b/examples/component/http-client/gen/wasi/sockets/udp/abi.go old mode 100755 new mode 100644 index 540b8f45..8266c12c --- a/examples/component/http-client/gen/wasi/sockets/udp/abi.go +++ b/examples/component/http-client/gen/wasi/sockets/udp/abi.go @@ -1,17 +1,17 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/http-client/gen/wasi/sockets/udp/empty.s b/examples/component/http-client/gen/wasi/sockets/udp/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/sockets/udp/udp.wasm.go b/examples/component/http-client/gen/wasi/sockets/udp/udp.wasm.go old mode 100755 new mode 100644 index 83ce8ca7..662148ba --- a/examples/component/http-client/gen/wasi/sockets/udp/udp.wasm.go +++ b/examples/component/http-client/gen/wasi/sockets/udp/udp.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". diff --git a/examples/component/http-client/gen/wasi/sockets/udp/udp.wit.go b/examples/component/http-client/gen/wasi/sockets/udp/udp.wit.go old mode 100755 new mode 100644 index b10aa02f..1021a996 --- a/examples/component/http-client/gen/wasi/sockets/udp/udp.wit.go +++ b/examples/component/http-client/gen/wasi/sockets/udp/udp.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udp represents the imported interface "wasi:sockets/udp@0.2.0". package udp @@ -6,7 +6,7 @@ package udp import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/io/poll" "github.com/wasmCloud/go/examples/component/http-client/gen/wasi/sockets/network" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Pollable represents the imported type alias "wasi:sockets/udp@0.2.0#pollable". @@ -41,9 +41,9 @@ type IPAddressFamily = network.IPAddressFamily // remote-address: ip-socket-address, // } type IncomingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress IPSocketAddress + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress IPSocketAddress `json:"remote-address"` } // OutgoingDatagram represents the record "wasi:sockets/udp@0.2.0#outgoing-datagram". @@ -53,9 +53,9 @@ type IncomingDatagram struct { // remote-address: option, // } type OutgoingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress cm.Option[IPSocketAddress] + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress cm.Option[IPSocketAddress] `json:"remote-address"` } // UDPSocket represents the imported resource "wasi:sockets/udp@0.2.0#udp-socket". diff --git a/examples/component/http-client/gen/wasmcloud/bus/lattice/empty.s b/examples/component/http-client/gen/wasmcloud/bus/lattice/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wasm.go b/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wasm.go old mode 100755 new mode 100644 index 7c7b9094..a7e9df88 --- a/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wasm.go +++ b/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package lattice diff --git a/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wit.go b/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wit.go old mode 100755 new mode 100644 index ba34d30c..684468cf --- a/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wit.go +++ b/examples/component/http-client/gen/wasmcloud/bus/lattice/lattice.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package lattice represents the imported interface "wasmcloud:bus/lattice@1.0.0". package lattice import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // CallTargetInterface represents the imported resource "wasmcloud:bus/lattice@1.0.0#call-target-interface". diff --git a/examples/component/http-client/gen/wasmcloud/secrets/reveal/empty.s b/examples/component/http-client/gen/wasmcloud/secrets/reveal/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wasm.go b/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wasm.go old mode 100755 new mode 100644 index 65404eb3..2bd8c561 --- a/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wasm.go +++ b/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package reveal diff --git a/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wit.go b/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wit.go old mode 100755 new mode 100644 index a16d9dbc..b2e75da9 --- a/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wit.go +++ b/examples/component/http-client/gen/wasmcloud/secrets/reveal/reveal.wit.go @@ -1,11 +1,11 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package reveal represents the imported interface "wasmcloud:secrets/reveal@0.1.0-draft". package reveal import ( "github.com/wasmCloud/go/examples/component/http-client/gen/wasmcloud/secrets/store" - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Secret represents the imported type alias "wasmcloud:secrets/reveal@0.1.0-draft#secret". diff --git a/examples/component/http-client/gen/wasmcloud/secrets/store/abi.go b/examples/component/http-client/gen/wasmcloud/secrets/store/abi.go old mode 100755 new mode 100644 index 20affd6c..e5ff5543 --- a/examples/component/http-client/gen/wasmcloud/secrets/store/abi.go +++ b/examples/component/http-client/gen/wasmcloud/secrets/store/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/http-client/gen/wasmcloud/secrets/store/empty.s b/examples/component/http-client/gen/wasmcloud/secrets/store/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasmcloud/secrets/store/store.wasm.go b/examples/component/http-client/gen/wasmcloud/secrets/store/store.wasm.go old mode 100755 new mode 100644 index cc94c517..d2208168 --- a/examples/component/http-client/gen/wasmcloud/secrets/store/store.wasm.go +++ b/examples/component/http-client/gen/wasmcloud/secrets/store/store.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasmcloud:secrets@0.1.0-draft". diff --git a/examples/component/http-client/gen/wasmcloud/secrets/store/store.wit.go b/examples/component/http-client/gen/wasmcloud/secrets/store/store.wit.go old mode 100755 new mode 100644 index d3465e4f..aeb006a6 --- a/examples/component/http-client/gen/wasmcloud/secrets/store/store.wit.go +++ b/examples/component/http-client/gen/wasmcloud/secrets/store/store.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package store represents the imported interface "wasmcloud:secrets/store@0.1.0-draft". package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // SecretsError represents the variant "wasmcloud:secrets/store@0.1.0-draft#secrets-error". @@ -47,7 +47,7 @@ func (self *SecretsError) NotFound() bool { return self.Tag() == 2 } -var stringsSecretsError = [3]string{ +var _SecretsErrorStrings = [3]string{ "upstream", "io", "not-found", @@ -55,7 +55,7 @@ var stringsSecretsError = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretsError) String() string { - return stringsSecretsError[v.Tag()] + return _SecretsErrorStrings[v.Tag()] } // SecretValue represents the variant "wasmcloud:secrets/store@0.1.0-draft#secret-value". @@ -64,7 +64,7 @@ func (v SecretsError) String() string { // %string(string), // bytes(list), // } -type SecretValue cm.Variant[uint8, string, cm.List[uint8]] +type SecretValue cm.Variant[uint8, string, string] // SecretValueString_ returns a [SecretValue] of case "string". func SecretValueString_(data string) SecretValue { @@ -86,14 +86,14 @@ func (self *SecretValue) Bytes() *cm.List[uint8] { return cm.Case[cm.List[uint8]](self, 1) } -var stringsSecretValue = [2]string{ +var _SecretValueStrings = [2]string{ "string", "bytes", } // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretValue) String() string { - return stringsSecretValue[v.Tag()] + return _SecretValueStrings[v.Tag()] } // Secret represents the imported resource "wasmcloud:secrets/store@0.1.0-draft#secret". diff --git a/examples/component/http-client/go.mod b/examples/component/http-client/go.mod index 827b512b..e0fcc690 100644 --- a/examples/component/http-client/go.mod +++ b/examples/component/http-client/go.mod @@ -2,26 +2,25 @@ module github.com/wasmCloud/go/examples/component/http-client go 1.24 -require ( - go.bytecodealliance.org v0.5.0 - go.bytecodealliance.org/cm v0.1.0 - go.wasmcloud.dev/component v0.0.6 -) +require go.wasmcloud.dev/component v0.0.6 require ( github.com/coreos/go-semver v0.3.1 // indirect github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/regclient/regclient v0.8.0 // indirect + github.com/regclient/regclient v0.8.2 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tetratelabs/wazero v1.9.0 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/urfave/cli/v3 v3.0.0-beta1 // indirect - golang.org/x/mod v0.22.0 // indirect - golang.org/x/sys v0.29.0 // indirect + go.bytecodealliance.org v0.6.2 // indirect + go.bytecodealliance.org/cm v0.2.2 // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/sys v0.30.0 // indirect ) -tool go.bytecodealliance.org/cmd/wit-bindgen-go +tool go.wasmcloud.dev/component/wit-bindgen // NOTE(lxf): Remove this line if running outside of wasmCloud/go repository replace go.wasmcloud.dev/component => ../../../component diff --git a/examples/component/http-client/go.sum b/examples/component/http-client/go.sum index 52387cf3..9bab03b9 100644 --- a/examples/component/http-client/go.sum +++ b/examples/component/http-client/go.sum @@ -13,8 +13,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/regclient/regclient v0.8.0 h1:xNAMDlADcyMvFAlGXoqDOxlSUBG4mqWBFgjQqVTP8Og= -github.com/regclient/regclient v0.8.0/go.mod h1:h9+Y6dBvqBkdlrj6EIhbTOv0xUuIFl7CdI1bZvEB42g= +github.com/regclient/regclient v0.8.2 h1:23BQ3jWgKYHHIXUhp/S9laVJDHDoOQaQCzXMJ4undVE= +github.com/regclient/regclient v0.8.2/go.mod h1:uGyetv0o6VLyRDjtfeBqp/QBwRLJ3Hcn07/+8QbhNcM= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -23,23 +23,25 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= +github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg= github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y= -go.bytecodealliance.org v0.5.0 h1:ywhCpF0JdqGkqct5JqSY1Me8lz001UIJXUaCSS32cew= -go.bytecodealliance.org v0.5.0/go.mod h1:8kYTSxmQr8DU3dKOKCOHH1Ap1gWX/61qlFSbIuIno2Q= -go.bytecodealliance.org/cm v0.1.0 h1:78Rk4d5rgir5Hm+LMFpDWhjmFBWrKDFPSKUwDBj+nwo= -go.bytecodealliance.org/cm v0.1.0/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +go.bytecodealliance.org v0.6.2 h1:Jy4u5DVmSkXgsnwojBhJ+AD/YsJsR3VzVnxF0xRCqTQ= +go.bytecodealliance.org v0.6.2/go.mod h1:gqjTJm0y9NSksG4py/lSjIQ/SNuIlOQ+hCIEPQwtJgA= +go.bytecodealliance.org/cm v0.2.2 h1:M9iHS6qs884mbQbIjtLX1OifgyPG9DuMs2iwz8G4WQA= +go.bytecodealliance.org/cm v0.2.2/go.mod h1:JD5vtVNZv7sBoQQkvBvAAVKJPhR/bqBH7yYXTItMfZI= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= -golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/component/http-client/main.go b/examples/component/http-client/main.go index be6bce03..627f0e49 100644 --- a/examples/component/http-client/main.go +++ b/examples/component/http-client/main.go @@ -1,6 +1,6 @@ package main -//go:generate go tool wit-bindgen-go generate --world example --out gen ./wit +//go:generate go tool wit-bindgen --world example --out gen ./wit import ( "io" diff --git a/examples/component/http-server/bindings.wadge_test.go b/examples/component/http-server/bindings.wadge_test.go index 91934977..71bbd841 100644 --- a/examples/component/http-server/bindings.wadge_test.go +++ b/examples/component/http-server/bindings.wadge_test.go @@ -5,12 +5,12 @@ package main_test import ( - go_bytecodealliance_org__cm "go.bytecodealliance.org/cm" - go_wasmcloud_dev__component__gen__wasi__clocks__monotonic___clock "go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock" - go_wasmcloud_dev__component__gen__wasi__http__outgoing___handler "go.wasmcloud.dev/component/gen/wasi/http/outgoing-handler" - go_wasmcloud_dev__component__gen__wasi__http__types "go.wasmcloud.dev/component/gen/wasi/http/types" - go_wasmcloud_dev__component__gen__wasi__io__poll "go.wasmcloud.dev/component/gen/wasi/io/poll" - go_wasmcloud_dev__component__gen__wasi__io__streams "go.wasmcloud.dev/component/gen/wasi/io/streams" + go_wasmcloud_dev__component__cm "go.wasmcloud.dev/component/cm" + go_wasmcloud_dev__component__internal__gen__wasi__clocks__monotonic___clock "go.wasmcloud.dev/component/internal/gen/wasi/clocks/monotonic-clock" + go_wasmcloud_dev__component__internal__gen__wasi__http__outgoing___handler "go.wasmcloud.dev/component/internal/gen/wasi/http/outgoing-handler" + go_wasmcloud_dev__component__internal__gen__wasi__http__types "go.wasmcloud.dev/component/internal/gen/wasi/http/types" + go_wasmcloud_dev__component__internal__gen__wasi__io__poll "go.wasmcloud.dev/component/internal/gen/wasi/io/poll" + go_wasmcloud_dev__component__internal__gen__wasi__io__streams "go.wasmcloud.dev/component/internal/gen/wasi/io/streams" wadge "go.wasmcloud.dev/wadge" "runtime" "unsafe" @@ -20,7 +20,43 @@ const _ string = runtime.Compiler var _ unsafe.Pointer -//go:linkname wasmimport_Now go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock.wasmimport_Now +//go:linkname wasmimport_errorContextDebugMessage go.wasmcloud.dev/component/cm.wasmimport_errorContextDebugMessage +func wasmimport_errorContextDebugMessage(err go_wasmcloud_dev__component__cm.errorContext, msg unsafe.Pointer) { + var __p runtime.Pinner + defer __p.Unpin() + if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { + return __instance.Call("canon", "error-context.debug-message", func() unsafe.Pointer { + ptr := unsafe.Pointer(&err) + __p.Pin(ptr) + return ptr + }(), func() unsafe.Pointer { + ptr := unsafe.Pointer(&msg) + __p.Pin(ptr) + return ptr + }()) + }); __err != nil { + wadge.CurrentErrorHandler()(__err) + } + return +} + +//go:linkname wasmimport_errorContextDrop go.wasmcloud.dev/component/cm.wasmimport_errorContextDrop +func wasmimport_errorContextDrop(err go_wasmcloud_dev__component__cm.errorContext) { + var __p runtime.Pinner + defer __p.Unpin() + if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { + return __instance.Call("canon", "error-context.drop", func() unsafe.Pointer { + ptr := unsafe.Pointer(&err) + __p.Pin(ptr) + return ptr + }()) + }); __err != nil { + wadge.CurrentErrorHandler()(__err) + } + return +} + +//go:linkname wasmimport_Now go.wasmcloud.dev/component/internal/gen/wasi/clocks/monotonic-clock.wasmimport_Now func wasmimport_Now() (result0 uint64) { var __p runtime.Pinner defer __p.Unpin() @@ -36,7 +72,7 @@ func wasmimport_Now() (result0 uint64) { return } -//go:linkname wasmimport_Resolution go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock.wasmimport_Resolution +//go:linkname wasmimport_Resolution go.wasmcloud.dev/component/internal/gen/wasi/clocks/monotonic-clock.wasmimport_Resolution func wasmimport_Resolution() (result0 uint64) { var __p runtime.Pinner defer __p.Unpin() @@ -52,7 +88,7 @@ func wasmimport_Resolution() (result0 uint64) { return } -//go:linkname wasmimport_SubscribeDuration go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock.wasmimport_SubscribeDuration +//go:linkname wasmimport_SubscribeDuration go.wasmcloud.dev/component/internal/gen/wasi/clocks/monotonic-clock.wasmimport_SubscribeDuration func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -72,7 +108,7 @@ func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32) { return } -//go:linkname wasmimport_SubscribeInstant go.wasmcloud.dev/component/gen/wasi/clocks/monotonic-clock.wasmimport_SubscribeInstant +//go:linkname wasmimport_SubscribeInstant go.wasmcloud.dev/component/internal/gen/wasi/clocks/monotonic-clock.wasmimport_SubscribeInstant func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -92,8 +128,8 @@ func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32) { return } -//go:linkname wasmimport_Handle go.wasmcloud.dev/component/gen/wasi/http/outgoing-handler.wasmimport_Handle -func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__outgoing___handler.ErrorCodeShape, go_wasmcloud_dev__component__gen__wasi__http__types.FutureIncomingResponse, go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode]) { +//go:linkname wasmimport_Handle go.wasmcloud.dev/component/internal/gen/wasi/http/outgoing-handler.wasmimport_Handle +func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__outgoing___handler.ErrorCodeShape, go_wasmcloud_dev__component__internal__gen__wasi__http__types.FutureIncomingResponse, go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -120,7 +156,7 @@ func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result return } -//go:linkname wasmimport_NewFields go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_NewFields +//go:linkname wasmimport_NewFields go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_NewFields func wasmimport_NewFields() (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -136,7 +172,7 @@ func wasmimport_NewFields() (result0 uint32) { return } -//go:linkname wasmimport_NewOutgoingRequest go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_NewOutgoingRequest +//go:linkname wasmimport_NewOutgoingRequest go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_NewOutgoingRequest func wasmimport_NewOutgoingRequest(headers0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -156,7 +192,7 @@ func wasmimport_NewOutgoingRequest(headers0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_NewOutgoingResponse go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_NewOutgoingResponse +//go:linkname wasmimport_NewOutgoingResponse go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_NewOutgoingResponse func wasmimport_NewOutgoingResponse(headers0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -176,7 +212,7 @@ func wasmimport_NewOutgoingResponse(headers0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_NewRequestOptions go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_NewRequestOptions +//go:linkname wasmimport_NewRequestOptions go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_NewRequestOptions func wasmimport_NewRequestOptions() (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -192,8 +228,8 @@ func wasmimport_NewRequestOptions() (result0 uint32) { return } -//go:linkname wasmimport_FieldsAppend go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsAppend -func wasmimport_FieldsAppend(self0 uint32, name0 *uint8, name1 uint32, value0 *uint8, value1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.HeaderError, struct{}, go_wasmcloud_dev__component__gen__wasi__http__types.HeaderError]) { +//go:linkname wasmimport_FieldsAppend go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsAppend +func wasmimport_FieldsAppend(self0 uint32, name0 *uint8, name1 uint32, value0 *uint8, value1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.HeaderError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__http__types.HeaderError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -228,7 +264,7 @@ func wasmimport_FieldsAppend(self0 uint32, name0 *uint8, name1 uint32, value0 *u return } -//go:linkname wasmimport_FieldsClone go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsClone +//go:linkname wasmimport_FieldsClone go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsClone func wasmimport_FieldsClone(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -248,8 +284,8 @@ func wasmimport_FieldsClone(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_FieldsDelete go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsDelete -func wasmimport_FieldsDelete(self0 uint32, name0 *uint8, name1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.HeaderError, struct{}, go_wasmcloud_dev__component__gen__wasi__http__types.HeaderError]) { +//go:linkname wasmimport_FieldsDelete go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsDelete +func wasmimport_FieldsDelete(self0 uint32, name0 *uint8, name1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.HeaderError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__http__types.HeaderError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -276,8 +312,8 @@ func wasmimport_FieldsDelete(self0 uint32, name0 *uint8, name1 uint32, result *g return } -//go:linkname wasmimport_FieldsEntries go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsEntries -func wasmimport_FieldsEntries(self0 uint32, result *go_bytecodealliance_org__cm.List[go_bytecodealliance_org__cm.Tuple[go_wasmcloud_dev__component__gen__wasi__http__types.FieldKey, go_wasmcloud_dev__component__gen__wasi__http__types.FieldValue]]) { +//go:linkname wasmimport_FieldsEntries go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsEntries +func wasmimport_FieldsEntries(self0 uint32, result *go_wasmcloud_dev__component__cm.List[go_wasmcloud_dev__component__cm.Tuple[go_wasmcloud_dev__component__internal__gen__wasi__http__types.FieldKey, go_wasmcloud_dev__component__internal__gen__wasi__http__types.FieldValue]]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -296,8 +332,8 @@ func wasmimport_FieldsEntries(self0 uint32, result *go_bytecodealliance_org__cm. return } -//go:linkname wasmimport_FieldsGet go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsGet -func wasmimport_FieldsGet(self0 uint32, name0 *uint8, name1 uint32, result *go_bytecodealliance_org__cm.List[go_wasmcloud_dev__component__gen__wasi__http__types.FieldValue]) { +//go:linkname wasmimport_FieldsGet go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsGet +func wasmimport_FieldsGet(self0 uint32, name0 *uint8, name1 uint32, result *go_wasmcloud_dev__component__cm.List[go_wasmcloud_dev__component__internal__gen__wasi__http__types.FieldValue]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -324,7 +360,7 @@ func wasmimport_FieldsGet(self0 uint32, name0 *uint8, name1 uint32, result *go_b return } -//go:linkname wasmimport_FieldsHas go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsHas +//go:linkname wasmimport_FieldsHas go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsHas func wasmimport_FieldsHas(self0 uint32, name0 *uint8, name1 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -352,8 +388,8 @@ func wasmimport_FieldsHas(self0 uint32, name0 *uint8, name1 uint32) (result0 uin return } -//go:linkname wasmimport_FieldsSet go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsSet -func wasmimport_FieldsSet(self0 uint32, name0 *uint8, name1 uint32, value0 *go_wasmcloud_dev__component__gen__wasi__http__types.FieldValue, value1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.HeaderError, struct{}, go_wasmcloud_dev__component__gen__wasi__http__types.HeaderError]) { +//go:linkname wasmimport_FieldsSet go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsSet +func wasmimport_FieldsSet(self0 uint32, name0 *uint8, name1 uint32, value0 *go_wasmcloud_dev__component__internal__gen__wasi__http__types.FieldValue, value1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.HeaderError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__http__types.HeaderError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -388,8 +424,8 @@ func wasmimport_FieldsSet(self0 uint32, name0 *uint8, name1 uint32, value0 *go_w return } -//go:linkname wasmimport_FutureIncomingResponseGet go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FutureIncomingResponseGet -func wasmimport_FutureIncomingResponseGet(self0 uint32, result *go_bytecodealliance_org__cm.Option[go_bytecodealliance_org__cm.Result[go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCodeShape, go_wasmcloud_dev__component__gen__wasi__http__types.IncomingResponse, go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode], go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCodeShape, go_wasmcloud_dev__component__gen__wasi__http__types.IncomingResponse, go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode], struct{}]]) { +//go:linkname wasmimport_FutureIncomingResponseGet go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FutureIncomingResponseGet +func wasmimport_FutureIncomingResponseGet(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCodeShape, go_wasmcloud_dev__component__internal__gen__wasi__http__types.IncomingResponse, go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode], go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCodeShape, go_wasmcloud_dev__component__internal__gen__wasi__http__types.IncomingResponse, go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode], struct{}]]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -408,7 +444,7 @@ func wasmimport_FutureIncomingResponseGet(self0 uint32, result *go_bytecodeallia return } -//go:linkname wasmimport_FutureIncomingResponseSubscribe go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FutureIncomingResponseSubscribe +//go:linkname wasmimport_FutureIncomingResponseSubscribe go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FutureIncomingResponseSubscribe func wasmimport_FutureIncomingResponseSubscribe(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -428,8 +464,8 @@ func wasmimport_FutureIncomingResponseSubscribe(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_FutureTrailersGet go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FutureTrailersGet -func wasmimport_FutureTrailersGet(self0 uint32, result *go_bytecodealliance_org__cm.Option[go_bytecodealliance_org__cm.Result[go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCodeShape, go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__http__types.Trailers], go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode], go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCodeShape, go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__http__types.Trailers], go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode], struct{}]]) { +//go:linkname wasmimport_FutureTrailersGet go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FutureTrailersGet +func wasmimport_FutureTrailersGet(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCodeShape, go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__http__types.Trailers], go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode], go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCodeShape, go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__http__types.Trailers], go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode], struct{}]]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -448,7 +484,7 @@ func wasmimport_FutureTrailersGet(self0 uint32, result *go_bytecodealliance_org_ return } -//go:linkname wasmimport_FutureTrailersSubscribe go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FutureTrailersSubscribe +//go:linkname wasmimport_FutureTrailersSubscribe go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FutureTrailersSubscribe func wasmimport_FutureTrailersSubscribe(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -468,8 +504,8 @@ func wasmimport_FutureTrailersSubscribe(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_IncomingBodyStream go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingBodyStream -func wasmimport_IncomingBodyStream(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.InputStream, go_wasmcloud_dev__component__gen__wasi__io__streams.InputStream, struct{}]) { +//go:linkname wasmimport_IncomingBodyStream go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingBodyStream +func wasmimport_IncomingBodyStream(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.InputStream, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.InputStream, struct{}]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -488,8 +524,8 @@ func wasmimport_IncomingBodyStream(self0 uint32, result *go_bytecodealliance_org return } -//go:linkname wasmimport_IncomingRequestAuthority go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingRequestAuthority -func wasmimport_IncomingRequestAuthority(self0 uint32, result *go_bytecodealliance_org__cm.Option[string]) { +//go:linkname wasmimport_IncomingRequestAuthority go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingRequestAuthority +func wasmimport_IncomingRequestAuthority(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[string]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -508,8 +544,8 @@ func wasmimport_IncomingRequestAuthority(self0 uint32, result *go_bytecodeallian return } -//go:linkname wasmimport_IncomingRequestConsume go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingRequestConsume -func wasmimport_IncomingRequestConsume(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.IncomingBody, go_wasmcloud_dev__component__gen__wasi__http__types.IncomingBody, struct{}]) { +//go:linkname wasmimport_IncomingRequestConsume go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingRequestConsume +func wasmimport_IncomingRequestConsume(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.IncomingBody, go_wasmcloud_dev__component__internal__gen__wasi__http__types.IncomingBody, struct{}]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -528,7 +564,7 @@ func wasmimport_IncomingRequestConsume(self0 uint32, result *go_bytecodealliance return } -//go:linkname wasmimport_IncomingRequestHeaders go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingRequestHeaders +//go:linkname wasmimport_IncomingRequestHeaders go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingRequestHeaders func wasmimport_IncomingRequestHeaders(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -548,8 +584,8 @@ func wasmimport_IncomingRequestHeaders(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_IncomingRequestMethod go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingRequestMethod -func wasmimport_IncomingRequestMethod(self0 uint32, result *go_wasmcloud_dev__component__gen__wasi__http__types.Method) { +//go:linkname wasmimport_IncomingRequestMethod go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingRequestMethod +func wasmimport_IncomingRequestMethod(self0 uint32, result *go_wasmcloud_dev__component__internal__gen__wasi__http__types.Method) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -568,8 +604,8 @@ func wasmimport_IncomingRequestMethod(self0 uint32, result *go_wasmcloud_dev__co return } -//go:linkname wasmimport_IncomingRequestPathWithQuery go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingRequestPathWithQuery -func wasmimport_IncomingRequestPathWithQuery(self0 uint32, result *go_bytecodealliance_org__cm.Option[string]) { +//go:linkname wasmimport_IncomingRequestPathWithQuery go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingRequestPathWithQuery +func wasmimport_IncomingRequestPathWithQuery(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[string]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -588,8 +624,8 @@ func wasmimport_IncomingRequestPathWithQuery(self0 uint32, result *go_bytecodeal return } -//go:linkname wasmimport_IncomingRequestScheme go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingRequestScheme -func wasmimport_IncomingRequestScheme(self0 uint32, result *go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__http__types.Scheme]) { +//go:linkname wasmimport_IncomingRequestScheme go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingRequestScheme +func wasmimport_IncomingRequestScheme(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__http__types.Scheme]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -608,8 +644,8 @@ func wasmimport_IncomingRequestScheme(self0 uint32, result *go_bytecodealliance_ return } -//go:linkname wasmimport_IncomingResponseConsume go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingResponseConsume -func wasmimport_IncomingResponseConsume(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.IncomingBody, go_wasmcloud_dev__component__gen__wasi__http__types.IncomingBody, struct{}]) { +//go:linkname wasmimport_IncomingResponseConsume go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingResponseConsume +func wasmimport_IncomingResponseConsume(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.IncomingBody, go_wasmcloud_dev__component__internal__gen__wasi__http__types.IncomingBody, struct{}]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -628,7 +664,7 @@ func wasmimport_IncomingResponseConsume(self0 uint32, result *go_bytecodeallianc return } -//go:linkname wasmimport_IncomingResponseHeaders go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingResponseHeaders +//go:linkname wasmimport_IncomingResponseHeaders go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingResponseHeaders func wasmimport_IncomingResponseHeaders(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -648,7 +684,7 @@ func wasmimport_IncomingResponseHeaders(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_IncomingResponseStatus go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingResponseStatus +//go:linkname wasmimport_IncomingResponseStatus go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingResponseStatus func wasmimport_IncomingResponseStatus(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -668,8 +704,8 @@ func wasmimport_IncomingResponseStatus(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_OutgoingBodyWrite go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingBodyWrite -func wasmimport_OutgoingBodyWrite(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.OutputStream, go_wasmcloud_dev__component__gen__wasi__io__streams.OutputStream, struct{}]) { +//go:linkname wasmimport_OutgoingBodyWrite go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingBodyWrite +func wasmimport_OutgoingBodyWrite(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.OutputStream, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.OutputStream, struct{}]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -688,8 +724,8 @@ func wasmimport_OutgoingBodyWrite(self0 uint32, result *go_bytecodealliance_org_ return } -//go:linkname wasmimport_OutgoingRequestAuthority go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestAuthority -func wasmimport_OutgoingRequestAuthority(self0 uint32, result *go_bytecodealliance_org__cm.Option[string]) { +//go:linkname wasmimport_OutgoingRequestAuthority go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestAuthority +func wasmimport_OutgoingRequestAuthority(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[string]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -708,8 +744,8 @@ func wasmimport_OutgoingRequestAuthority(self0 uint32, result *go_bytecodeallian return } -//go:linkname wasmimport_OutgoingRequestBody go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestBody -func wasmimport_OutgoingRequestBody(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.OutgoingBody, go_wasmcloud_dev__component__gen__wasi__http__types.OutgoingBody, struct{}]) { +//go:linkname wasmimport_OutgoingRequestBody go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestBody +func wasmimport_OutgoingRequestBody(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.OutgoingBody, go_wasmcloud_dev__component__internal__gen__wasi__http__types.OutgoingBody, struct{}]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -728,7 +764,7 @@ func wasmimport_OutgoingRequestBody(self0 uint32, result *go_bytecodealliance_or return } -//go:linkname wasmimport_OutgoingRequestHeaders go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestHeaders +//go:linkname wasmimport_OutgoingRequestHeaders go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestHeaders func wasmimport_OutgoingRequestHeaders(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -748,8 +784,8 @@ func wasmimport_OutgoingRequestHeaders(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_OutgoingRequestMethod go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestMethod -func wasmimport_OutgoingRequestMethod(self0 uint32, result *go_wasmcloud_dev__component__gen__wasi__http__types.Method) { +//go:linkname wasmimport_OutgoingRequestMethod go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestMethod +func wasmimport_OutgoingRequestMethod(self0 uint32, result *go_wasmcloud_dev__component__internal__gen__wasi__http__types.Method) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -768,8 +804,8 @@ func wasmimport_OutgoingRequestMethod(self0 uint32, result *go_wasmcloud_dev__co return } -//go:linkname wasmimport_OutgoingRequestPathWithQuery go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestPathWithQuery -func wasmimport_OutgoingRequestPathWithQuery(self0 uint32, result *go_bytecodealliance_org__cm.Option[string]) { +//go:linkname wasmimport_OutgoingRequestPathWithQuery go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestPathWithQuery +func wasmimport_OutgoingRequestPathWithQuery(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[string]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -788,8 +824,8 @@ func wasmimport_OutgoingRequestPathWithQuery(self0 uint32, result *go_bytecodeal return } -//go:linkname wasmimport_OutgoingRequestScheme go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestScheme -func wasmimport_OutgoingRequestScheme(self0 uint32, result *go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__http__types.Scheme]) { +//go:linkname wasmimport_OutgoingRequestScheme go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestScheme +func wasmimport_OutgoingRequestScheme(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__http__types.Scheme]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -808,7 +844,7 @@ func wasmimport_OutgoingRequestScheme(self0 uint32, result *go_bytecodealliance_ return } -//go:linkname wasmimport_OutgoingRequestSetAuthority go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestSetAuthority +//go:linkname wasmimport_OutgoingRequestSetAuthority go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestSetAuthority func wasmimport_OutgoingRequestSetAuthority(self0 uint32, authority0 uint32, authority1 *uint8, authority2 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -840,7 +876,7 @@ func wasmimport_OutgoingRequestSetAuthority(self0 uint32, authority0 uint32, aut return } -//go:linkname wasmimport_OutgoingRequestSetMethod go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestSetMethod +//go:linkname wasmimport_OutgoingRequestSetMethod go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestSetMethod func wasmimport_OutgoingRequestSetMethod(self0 uint32, method0 uint32, method1 *uint8, method2 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -872,7 +908,7 @@ func wasmimport_OutgoingRequestSetMethod(self0 uint32, method0 uint32, method1 * return } -//go:linkname wasmimport_OutgoingRequestSetPathWithQuery go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestSetPathWithQuery +//go:linkname wasmimport_OutgoingRequestSetPathWithQuery go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestSetPathWithQuery func wasmimport_OutgoingRequestSetPathWithQuery(self0 uint32, pathWithQuery0 uint32, pathWithQuery1 *uint8, pathWithQuery2 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -904,7 +940,7 @@ func wasmimport_OutgoingRequestSetPathWithQuery(self0 uint32, pathWithQuery0 uin return } -//go:linkname wasmimport_OutgoingRequestSetScheme go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestSetScheme +//go:linkname wasmimport_OutgoingRequestSetScheme go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestSetScheme func wasmimport_OutgoingRequestSetScheme(self0 uint32, scheme0 uint32, scheme1 uint32, scheme2 *uint8, scheme3 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -940,8 +976,8 @@ func wasmimport_OutgoingRequestSetScheme(self0 uint32, scheme0 uint32, scheme1 u return } -//go:linkname wasmimport_OutgoingResponseBody go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingResponseBody -func wasmimport_OutgoingResponseBody(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.OutgoingBody, go_wasmcloud_dev__component__gen__wasi__http__types.OutgoingBody, struct{}]) { +//go:linkname wasmimport_OutgoingResponseBody go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingResponseBody +func wasmimport_OutgoingResponseBody(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.OutgoingBody, go_wasmcloud_dev__component__internal__gen__wasi__http__types.OutgoingBody, struct{}]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -960,7 +996,7 @@ func wasmimport_OutgoingResponseBody(self0 uint32, result *go_bytecodealliance_o return } -//go:linkname wasmimport_OutgoingResponseHeaders go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingResponseHeaders +//go:linkname wasmimport_OutgoingResponseHeaders go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingResponseHeaders func wasmimport_OutgoingResponseHeaders(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -980,7 +1016,7 @@ func wasmimport_OutgoingResponseHeaders(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_OutgoingResponseSetStatusCode go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingResponseSetStatusCode +//go:linkname wasmimport_OutgoingResponseSetStatusCode go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingResponseSetStatusCode func wasmimport_OutgoingResponseSetStatusCode(self0 uint32, statusCode0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1004,7 +1040,7 @@ func wasmimport_OutgoingResponseSetStatusCode(self0 uint32, statusCode0 uint32) return } -//go:linkname wasmimport_OutgoingResponseStatusCode go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingResponseStatusCode +//go:linkname wasmimport_OutgoingResponseStatusCode go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingResponseStatusCode func wasmimport_OutgoingResponseStatusCode(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1024,8 +1060,8 @@ func wasmimport_OutgoingResponseStatusCode(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_RequestOptionsBetweenBytesTimeout go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_RequestOptionsBetweenBytesTimeout -func wasmimport_RequestOptionsBetweenBytesTimeout(self0 uint32, result *go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__clocks__monotonic___clock.Duration]) { +//go:linkname wasmimport_RequestOptionsBetweenBytesTimeout go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_RequestOptionsBetweenBytesTimeout +func wasmimport_RequestOptionsBetweenBytesTimeout(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__clocks__monotonic___clock.Duration]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1044,8 +1080,8 @@ func wasmimport_RequestOptionsBetweenBytesTimeout(self0 uint32, result *go_bytec return } -//go:linkname wasmimport_RequestOptionsConnectTimeout go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_RequestOptionsConnectTimeout -func wasmimport_RequestOptionsConnectTimeout(self0 uint32, result *go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__clocks__monotonic___clock.Duration]) { +//go:linkname wasmimport_RequestOptionsConnectTimeout go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_RequestOptionsConnectTimeout +func wasmimport_RequestOptionsConnectTimeout(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__clocks__monotonic___clock.Duration]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1064,8 +1100,8 @@ func wasmimport_RequestOptionsConnectTimeout(self0 uint32, result *go_bytecodeal return } -//go:linkname wasmimport_RequestOptionsFirstByteTimeout go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_RequestOptionsFirstByteTimeout -func wasmimport_RequestOptionsFirstByteTimeout(self0 uint32, result *go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__clocks__monotonic___clock.Duration]) { +//go:linkname wasmimport_RequestOptionsFirstByteTimeout go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_RequestOptionsFirstByteTimeout +func wasmimport_RequestOptionsFirstByteTimeout(self0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__clocks__monotonic___clock.Duration]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1084,7 +1120,7 @@ func wasmimport_RequestOptionsFirstByteTimeout(self0 uint32, result *go_bytecode return } -//go:linkname wasmimport_RequestOptionsSetBetweenBytesTimeout go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_RequestOptionsSetBetweenBytesTimeout +//go:linkname wasmimport_RequestOptionsSetBetweenBytesTimeout go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_RequestOptionsSetBetweenBytesTimeout func wasmimport_RequestOptionsSetBetweenBytesTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1112,7 +1148,7 @@ func wasmimport_RequestOptionsSetBetweenBytesTimeout(self0 uint32, duration0 uin return } -//go:linkname wasmimport_RequestOptionsSetConnectTimeout go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_RequestOptionsSetConnectTimeout +//go:linkname wasmimport_RequestOptionsSetConnectTimeout go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_RequestOptionsSetConnectTimeout func wasmimport_RequestOptionsSetConnectTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1140,7 +1176,7 @@ func wasmimport_RequestOptionsSetConnectTimeout(self0 uint32, duration0 uint32, return } -//go:linkname wasmimport_RequestOptionsSetFirstByteTimeout go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_RequestOptionsSetFirstByteTimeout +//go:linkname wasmimport_RequestOptionsSetFirstByteTimeout go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_RequestOptionsSetFirstByteTimeout func wasmimport_RequestOptionsSetFirstByteTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1168,7 +1204,7 @@ func wasmimport_RequestOptionsSetFirstByteTimeout(self0 uint32, duration0 uint32 return } -//go:linkname wasmimport_FieldsResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsResourceDrop +//go:linkname wasmimport_FieldsResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsResourceDrop func wasmimport_FieldsResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1184,7 +1220,7 @@ func wasmimport_FieldsResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_FutureIncomingResponseResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FutureIncomingResponseResourceDrop +//go:linkname wasmimport_FutureIncomingResponseResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FutureIncomingResponseResourceDrop func wasmimport_FutureIncomingResponseResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1200,7 +1236,7 @@ func wasmimport_FutureIncomingResponseResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_FutureTrailersResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FutureTrailersResourceDrop +//go:linkname wasmimport_FutureTrailersResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FutureTrailersResourceDrop func wasmimport_FutureTrailersResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1216,7 +1252,7 @@ func wasmimport_FutureTrailersResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_IncomingBodyResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingBodyResourceDrop +//go:linkname wasmimport_IncomingBodyResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingBodyResourceDrop func wasmimport_IncomingBodyResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1232,7 +1268,7 @@ func wasmimport_IncomingBodyResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_IncomingRequestResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingRequestResourceDrop +//go:linkname wasmimport_IncomingRequestResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingRequestResourceDrop func wasmimport_IncomingRequestResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1248,7 +1284,7 @@ func wasmimport_IncomingRequestResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_IncomingResponseResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingResponseResourceDrop +//go:linkname wasmimport_IncomingResponseResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingResponseResourceDrop func wasmimport_IncomingResponseResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1264,7 +1300,7 @@ func wasmimport_IncomingResponseResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_OutgoingBodyResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingBodyResourceDrop +//go:linkname wasmimport_OutgoingBodyResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingBodyResourceDrop func wasmimport_OutgoingBodyResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1280,7 +1316,7 @@ func wasmimport_OutgoingBodyResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_OutgoingRequestResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingRequestResourceDrop +//go:linkname wasmimport_OutgoingRequestResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingRequestResourceDrop func wasmimport_OutgoingRequestResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1296,7 +1332,7 @@ func wasmimport_OutgoingRequestResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_OutgoingResponseResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingResponseResourceDrop +//go:linkname wasmimport_OutgoingResponseResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingResponseResourceDrop func wasmimport_OutgoingResponseResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1312,7 +1348,7 @@ func wasmimport_OutgoingResponseResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_RequestOptionsResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_RequestOptionsResourceDrop +//go:linkname wasmimport_RequestOptionsResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_RequestOptionsResourceDrop func wasmimport_RequestOptionsResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1328,7 +1364,7 @@ func wasmimport_RequestOptionsResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_ResponseOutparamResourceDrop go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_ResponseOutparamResourceDrop +//go:linkname wasmimport_ResponseOutparamResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_ResponseOutparamResourceDrop func wasmimport_ResponseOutparamResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1344,8 +1380,8 @@ func wasmimport_ResponseOutparamResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_FieldsFromList go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_FieldsFromList -func wasmimport_FieldsFromList(entries0 *go_bytecodealliance_org__cm.Tuple[go_wasmcloud_dev__component__gen__wasi__http__types.FieldKey, go_wasmcloud_dev__component__gen__wasi__http__types.FieldValue], entries1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.Fields, go_wasmcloud_dev__component__gen__wasi__http__types.Fields, go_wasmcloud_dev__component__gen__wasi__http__types.HeaderError]) { +//go:linkname wasmimport_FieldsFromList go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_FieldsFromList +func wasmimport_FieldsFromList(entries0 *go_wasmcloud_dev__component__cm.Tuple[go_wasmcloud_dev__component__internal__gen__wasi__http__types.FieldKey, go_wasmcloud_dev__component__internal__gen__wasi__http__types.FieldValue], entries1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.Fields, go_wasmcloud_dev__component__internal__gen__wasi__http__types.Fields, go_wasmcloud_dev__component__internal__gen__wasi__http__types.HeaderError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1368,7 +1404,7 @@ func wasmimport_FieldsFromList(entries0 *go_bytecodealliance_org__cm.Tuple[go_wa return } -//go:linkname wasmimport_IncomingBodyFinish go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_IncomingBodyFinish +//go:linkname wasmimport_IncomingBodyFinish go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_IncomingBodyFinish func wasmimport_IncomingBodyFinish(this0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1388,8 +1424,8 @@ func wasmimport_IncomingBodyFinish(this0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_OutgoingBodyFinish go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_OutgoingBodyFinish -func wasmimport_OutgoingBodyFinish(this0 uint32, trailers0 uint32, trailers1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode, struct{}, go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode]) { +//go:linkname wasmimport_OutgoingBodyFinish go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_OutgoingBodyFinish +func wasmimport_OutgoingBodyFinish(this0 uint32, trailers0 uint32, trailers1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1416,7 +1452,7 @@ func wasmimport_OutgoingBodyFinish(this0 uint32, trailers0 uint32, trailers1 uin return } -//go:linkname wasmimport_ResponseOutparamSet go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_ResponseOutparamSet +//go:linkname wasmimport_ResponseOutparamSet go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_ResponseOutparamSet func wasmimport_ResponseOutparamSet(param0 uint32, response0 uint32, response1 uint32, response2 uint32, response3 uint64, response4 uint32, response5 uint32, response6 uint32, response7 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1464,8 +1500,8 @@ func wasmimport_ResponseOutparamSet(param0 uint32, response0 uint32, response1 u return } -//go:linkname wasmimport_HTTPErrorCode go.wasmcloud.dev/component/gen/wasi/http/types.wasmimport_HTTPErrorCode -func wasmimport_HTTPErrorCode(err0 uint32, result *go_bytecodealliance_org__cm.Option[go_wasmcloud_dev__component__gen__wasi__http__types.ErrorCode]) { +//go:linkname wasmimport_HTTPErrorCode go.wasmcloud.dev/component/internal/gen/wasi/http/types.wasmimport_HTTPErrorCode +func wasmimport_HTTPErrorCode(err0 uint32, result *go_wasmcloud_dev__component__cm.Option[go_wasmcloud_dev__component__internal__gen__wasi__http__types.ErrorCode]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1484,7 +1520,7 @@ func wasmimport_HTTPErrorCode(err0 uint32, result *go_bytecodealliance_org__cm.O return } -//go:linkname wasmimport_ErrorToDebugString go.wasmcloud.dev/component/gen/wasi/io/error.wasmimport_ErrorToDebugString +//go:linkname wasmimport_ErrorToDebugString go.wasmcloud.dev/component/internal/gen/wasi/io/error.wasmimport_ErrorToDebugString func wasmimport_ErrorToDebugString(self0 uint32, result *string) { var __p runtime.Pinner defer __p.Unpin() @@ -1504,7 +1540,7 @@ func wasmimport_ErrorToDebugString(self0 uint32, result *string) { return } -//go:linkname wasmimport_ErrorResourceDrop go.wasmcloud.dev/component/gen/wasi/io/error.wasmimport_ErrorResourceDrop +//go:linkname wasmimport_ErrorResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/io/error.wasmimport_ErrorResourceDrop func wasmimport_ErrorResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1520,7 +1556,7 @@ func wasmimport_ErrorResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_PollableBlock go.wasmcloud.dev/component/gen/wasi/io/poll.wasmimport_PollableBlock +//go:linkname wasmimport_PollableBlock go.wasmcloud.dev/component/internal/gen/wasi/io/poll.wasmimport_PollableBlock func wasmimport_PollableBlock(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1536,7 +1572,7 @@ func wasmimport_PollableBlock(self0 uint32) { return } -//go:linkname wasmimport_PollableReady go.wasmcloud.dev/component/gen/wasi/io/poll.wasmimport_PollableReady +//go:linkname wasmimport_PollableReady go.wasmcloud.dev/component/internal/gen/wasi/io/poll.wasmimport_PollableReady func wasmimport_PollableReady(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1556,7 +1592,7 @@ func wasmimport_PollableReady(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_PollableResourceDrop go.wasmcloud.dev/component/gen/wasi/io/poll.wasmimport_PollableResourceDrop +//go:linkname wasmimport_PollableResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/io/poll.wasmimport_PollableResourceDrop func wasmimport_PollableResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1572,8 +1608,8 @@ func wasmimport_PollableResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_Poll go.wasmcloud.dev/component/gen/wasi/io/poll.wasmimport_Poll -func wasmimport_Poll(in0 *go_wasmcloud_dev__component__gen__wasi__io__poll.Pollable, in1 uint32, result *go_bytecodealliance_org__cm.List[uint32]) { +//go:linkname wasmimport_Poll go.wasmcloud.dev/component/internal/gen/wasi/io/poll.wasmimport_Poll +func wasmimport_Poll(in0 *go_wasmcloud_dev__component__internal__gen__wasi__io__poll.Pollable, in1 uint32, result *go_wasmcloud_dev__component__cm.List[uint32]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1596,8 +1632,8 @@ func wasmimport_Poll(in0 *go_wasmcloud_dev__component__gen__wasi__io__poll.Polla return } -//go:linkname wasmimport_InputStreamBlockingRead go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_InputStreamBlockingRead -func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[go_bytecodealliance_org__cm.List[uint8], go_bytecodealliance_org__cm.List[uint8], go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_InputStreamBlockingRead go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_InputStreamBlockingRead +func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__cm.List[uint8], go_wasmcloud_dev__component__cm.List[uint8], go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1620,8 +1656,8 @@ func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *go_by return } -//go:linkname wasmimport_InputStreamBlockingSkip go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_InputStreamBlockingSkip -func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[uint64, uint64, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_InputStreamBlockingSkip go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_InputStreamBlockingSkip +func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[uint64, uint64, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1644,8 +1680,8 @@ func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *go_by return } -//go:linkname wasmimport_InputStreamRead go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_InputStreamRead -func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[go_bytecodealliance_org__cm.List[uint8], go_bytecodealliance_org__cm.List[uint8], go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_InputStreamRead go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_InputStreamRead +func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__cm.List[uint8], go_wasmcloud_dev__component__cm.List[uint8], go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1668,8 +1704,8 @@ func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *go_bytecodeal return } -//go:linkname wasmimport_InputStreamSkip go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_InputStreamSkip -func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[uint64, uint64, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_InputStreamSkip go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_InputStreamSkip +func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[uint64, uint64, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1692,7 +1728,7 @@ func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *go_bytecodeal return } -//go:linkname wasmimport_InputStreamSubscribe go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_InputStreamSubscribe +//go:linkname wasmimport_InputStreamSubscribe go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_InputStreamSubscribe func wasmimport_InputStreamSubscribe(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1712,8 +1748,8 @@ func wasmimport_InputStreamSubscribe(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_OutputStreamBlockingFlush go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamBlockingFlush -func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamBlockingFlush go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamBlockingFlush +func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1732,8 +1768,8 @@ func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *go_bytecodeallia return } -//go:linkname wasmimport_OutputStreamBlockingSplice go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamBlockingSplice -func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[uint64, uint64, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamBlockingSplice go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamBlockingSplice +func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[uint64, uint64, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1760,8 +1796,8 @@ func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint6 return } -//go:linkname wasmimport_OutputStreamBlockingWriteAndFlush go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamBlockingWriteAndFlush -func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8, contents1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamBlockingWriteAndFlush go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamBlockingWriteAndFlush +func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8, contents1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1788,8 +1824,8 @@ func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8 return } -//go:linkname wasmimport_OutputStreamBlockingWriteZeroesAndFlush go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamBlockingWriteZeroesAndFlush -func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamBlockingWriteZeroesAndFlush go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamBlockingWriteZeroesAndFlush +func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1812,8 +1848,8 @@ func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint6 return } -//go:linkname wasmimport_OutputStreamCheckWrite go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamCheckWrite -func wasmimport_OutputStreamCheckWrite(self0 uint32, result *go_bytecodealliance_org__cm.Result[uint64, uint64, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamCheckWrite go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamCheckWrite +func wasmimport_OutputStreamCheckWrite(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[uint64, uint64, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1832,8 +1868,8 @@ func wasmimport_OutputStreamCheckWrite(self0 uint32, result *go_bytecodealliance return } -//go:linkname wasmimport_OutputStreamFlush go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamFlush -func wasmimport_OutputStreamFlush(self0 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamFlush go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamFlush +func wasmimport_OutputStreamFlush(self0 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1852,8 +1888,8 @@ func wasmimport_OutputStreamFlush(self0 uint32, result *go_bytecodealliance_org_ return } -//go:linkname wasmimport_OutputStreamSplice go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamSplice -func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[uint64, uint64, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamSplice go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamSplice +func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[uint64, uint64, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1880,7 +1916,7 @@ func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, resul return } -//go:linkname wasmimport_OutputStreamSubscribe go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamSubscribe +//go:linkname wasmimport_OutputStreamSubscribe go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamSubscribe func wasmimport_OutputStreamSubscribe(self0 uint32) (result0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1900,8 +1936,8 @@ func wasmimport_OutputStreamSubscribe(self0 uint32) (result0 uint32) { return } -//go:linkname wasmimport_OutputStreamWrite go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamWrite -func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamWrite go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamWrite +func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1928,8 +1964,8 @@ func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint return } -//go:linkname wasmimport_OutputStreamWriteZeroes go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamWriteZeroes -func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *go_bytecodealliance_org__cm.Result[go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__gen__wasi__io__streams.StreamError]) { +//go:linkname wasmimport_OutputStreamWriteZeroes go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamWriteZeroes +func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *go_wasmcloud_dev__component__cm.Result[go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError, struct{}, go_wasmcloud_dev__component__internal__gen__wasi__io__streams.StreamError]) { var __p runtime.Pinner defer __p.Unpin() if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { @@ -1952,7 +1988,7 @@ func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *go_by return } -//go:linkname wasmimport_InputStreamResourceDrop go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_InputStreamResourceDrop +//go:linkname wasmimport_InputStreamResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_InputStreamResourceDrop func wasmimport_InputStreamResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1968,7 +2004,7 @@ func wasmimport_InputStreamResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_OutputStreamResourceDrop go.wasmcloud.dev/component/gen/wasi/io/streams.wasmimport_OutputStreamResourceDrop +//go:linkname wasmimport_OutputStreamResourceDrop go.wasmcloud.dev/component/internal/gen/wasi/io/streams.wasmimport_OutputStreamResourceDrop func wasmimport_OutputStreamResourceDrop(self0 uint32) { var __p runtime.Pinner defer __p.Unpin() @@ -1984,7 +2020,7 @@ func wasmimport_OutputStreamResourceDrop(self0 uint32) { return } -//go:linkname wasmimport_Log go.wasmcloud.dev/component/gen/wasi/logging/logging.wasmimport_Log +//go:linkname wasmimport_Log go.wasmcloud.dev/component/internal/gen/wasi/logging/logging.wasmimport_Log func wasmimport_Log(level0 uint32, context0 *uint8, context1 uint32, message0 *uint8, message1 uint32) { var __p runtime.Pinner defer __p.Unpin() diff --git a/examples/component/http-server/gen/example/http-server/example/example.wit b/examples/component/http-server/gen/example/http-server/example/example.wit deleted file mode 100755 index a41117b5..00000000 --- a/examples/component/http-server/gen/example/http-server/example/example.wit +++ /dev/null @@ -1,1132 +0,0 @@ -package example:http-server; - -world example { - import wasi:logging/logging@0.1.0-draft; - import wasi:config/runtime@0.2.0-draft; - import wasi:io/poll@0.2.0; - import wasi:clocks/monotonic-clock@0.2.0; - import wasi:io/error@0.2.0; - import wasi:io/streams@0.2.0; - import wasi:http/types@0.2.0; - import wasi:http/outgoing-handler@0.2.0; - import wasmcloud:bus/lattice@1.0.0; - import wasmcloud:secrets/store@0.1.0-draft; - import wasmcloud:secrets/reveal@0.1.0-draft; - import wasi:cli/environment@0.2.0; - import wasi:cli/exit@0.2.0; - import wasi:cli/stdin@0.2.0; - import wasi:cli/stdout@0.2.0; - import wasi:cli/stderr@0.2.0; - import wasi:cli/terminal-input@0.2.0; - import wasi:cli/terminal-output@0.2.0; - import wasi:cli/terminal-stdin@0.2.0; - import wasi:cli/terminal-stdout@0.2.0; - import wasi:cli/terminal-stderr@0.2.0; - import wasi:clocks/wall-clock@0.2.0; - import wasi:filesystem/types@0.2.0; - import wasi:filesystem/preopens@0.2.0; - import wasi:sockets/network@0.2.0; - import wasi:sockets/instance-network@0.2.0; - import wasi:sockets/udp@0.2.0; - import wasi:sockets/udp-create-socket@0.2.0; - import wasi:sockets/tcp@0.2.0; - import wasi:sockets/tcp-create-socket@0.2.0; - import wasi:sockets/ip-name-lookup@0.2.0; - import wasi:random/random@0.2.0; - import wasi:random/insecure@0.2.0; - import wasi:random/insecure-seed@0.2.0; - export wasi:http/incoming-handler@0.2.0; -} - -package wasi:cli@0.2.0 { - interface stdout { - use wasi:io/streams@0.2.0.{output-stream}; - get-stdout: func() -> output-stream; - } - - interface stderr { - use wasi:io/streams@0.2.0.{output-stream}; - get-stderr: func() -> output-stream; - } - - interface stdin { - use wasi:io/streams@0.2.0.{input-stream}; - get-stdin: func() -> input-stream; - } - - interface environment { - get-environment: func() -> list>; - get-arguments: func() -> list; - initial-cwd: func() -> option; - } - - interface exit { - exit: func(status: result); - } - - interface terminal-input { - resource terminal-input; - } - - interface terminal-output { - resource terminal-output; - } - - interface terminal-stdin { - use terminal-input.{terminal-input}; - get-terminal-stdin: func() -> option; - } - - interface terminal-stdout { - use terminal-output.{terminal-output}; - get-terminal-stdout: func() -> option; - } - - interface terminal-stderr { - use terminal-output.{terminal-output}; - get-terminal-stderr: func() -> option; - } -} - -package wasi:clocks@0.2.0 { - interface monotonic-clock { - use wasi:io/poll@0.2.0.{pollable}; - type instant = u64; - type duration = u64; - now: func() -> instant; - resolution: func() -> duration; - subscribe-instant: func(when: instant) -> pollable; - subscribe-duration: func(when: duration) -> pollable; - } - - interface wall-clock { - record datetime { - seconds: u64, - nanoseconds: u32, - } - now: func() -> datetime; - resolution: func() -> datetime; - } -} - -package wasi:config@0.2.0-draft { - interface runtime { - variant config-error { - upstream(string), - io(string), - } - get: func(key: string) -> result, config-error>; - get-all: func() -> result>, config-error>; - } -} - -package wasi:filesystem@0.2.0 { - interface types { - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/streams@0.2.0.{error}; - use wasi:clocks/wall-clock@0.2.0.{datetime}; - type filesize = u64; - enum descriptor-type { - unknown, - block-device, - character-device, - directory, - fifo, - symbolic-link, - regular-file, - socket - } - flags descriptor-flags { - read, - write, - file-integrity-sync, - data-integrity-sync, - requested-write-sync, - mutate-directory, - } - flags path-flags { symlink-follow } - flags open-flags { - create, - directory, - exclusive, - truncate, - } - type link-count = u64; - record descriptor-stat { - %type: descriptor-type, - link-count: link-count, - size: filesize, - data-access-timestamp: option, - data-modification-timestamp: option, - status-change-timestamp: option, - } - variant new-timestamp { - no-change, - now, - timestamp(datetime), - } - record directory-entry { - %type: descriptor-type, - name: string, - } - enum error-code { - access, - would-block, - already, - bad-descriptor, - busy, - deadlock, - quota, - exist, - file-too-large, - illegal-byte-sequence, - in-progress, - interrupted, - invalid, - io, - is-directory, - loop, - too-many-links, - message-size, - name-too-long, - no-device, - no-entry, - no-lock, - insufficient-memory, - insufficient-space, - not-directory, - not-empty, - not-recoverable, - unsupported, - no-tty, - no-such-device, - overflow, - not-permitted, - pipe, - read-only, - invalid-seek, - text-file-busy, - cross-device - } - enum advice { - normal, - sequential, - random, - will-need, - dont-need, - no-reuse - } - record metadata-hash-value { - lower: u64, - upper: u64, - } - resource descriptor { - advise: func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; - append-via-stream: func() -> result; - create-directory-at: func(path: string) -> result<_, error-code>; - get-flags: func() -> result; - get-type: func() -> result; - is-same-object: func(other: borrow) -> bool; - link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - metadata-hash: func() -> result; - metadata-hash-at: func(path-flags: path-flags, path: string) -> result; - open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; - read: func(length: filesize, offset: filesize) -> result, bool>, error-code>; - read-directory: func() -> result; - read-via-stream: func(offset: filesize) -> result; - readlink-at: func(path: string) -> result; - remove-directory-at: func(path: string) -> result<_, error-code>; - rename-at: func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; - set-size: func(size: filesize) -> result<_, error-code>; - set-times: func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; - stat: func() -> result; - stat-at: func(path-flags: path-flags, path: string) -> result; - symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>; - sync: func() -> result<_, error-code>; - sync-data: func() -> result<_, error-code>; - unlink-file-at: func(path: string) -> result<_, error-code>; - write: func(buffer: list, offset: filesize) -> result; - write-via-stream: func(offset: filesize) -> result; - } - resource directory-entry-stream { - read-directory-entry: func() -> result, error-code>; - } - filesystem-error-code: func(err: borrow) -> option; - } - - interface preopens { - use types.{descriptor}; - get-directories: func() -> list>; - } -} - -package wasi:http@0.2.0 { - /// This interface defines all of the types and methods for implementing - /// HTTP Requests and Responses, both incoming and outgoing, as well as - /// their headers, trailers, and bodies. - interface types { - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/error@0.2.0.{error as io-error}; - use wasi:io/poll@0.2.0.{pollable}; - - /// This type corresponds to HTTP standard Methods. - variant method { - get, - head, - post, - put, - delete, - connect, - options, - trace, - patch, - other(string), - } - - /// This type corresponds to HTTP standard Related Schemes. - variant scheme { HTTP, HTTPS, other(string) } - - /// Defines the case payload type for `DNS-error` above: - record DNS-error-payload { - rcode: option, - info-code: option, - } - - /// Defines the case payload type for `TLS-alert-received` above: - record TLS-alert-received-payload { - alert-id: option, - alert-message: option, - } - - /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - record field-size-payload { - field-name: option, - field-size: option, - } - - /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types - variant error-code { - DNS-timeout, - DNS-error(DNS-error-payload), - destination-not-found, - destination-unavailable, - destination-IP-prohibited, - destination-IP-unroutable, - connection-refused, - connection-terminated, - connection-timeout, - connection-read-timeout, - connection-write-timeout, - connection-limit-reached, - TLS-protocol-error, - TLS-certificate-error, - TLS-alert-received(TLS-alert-received-payload), - HTTP-request-denied, - HTTP-request-length-required, - HTTP-request-body-size(option), - HTTP-request-method-invalid, - HTTP-request-URI-invalid, - HTTP-request-URI-too-long, - HTTP-request-header-section-size(option), - HTTP-request-header-size(option), - HTTP-request-trailer-section-size(option), - HTTP-request-trailer-size(field-size-payload), - HTTP-response-incomplete, - HTTP-response-header-section-size(option), - HTTP-response-header-size(field-size-payload), - HTTP-response-body-size(option), - HTTP-response-trailer-section-size(option), - HTTP-response-trailer-size(field-size-payload), - HTTP-response-transfer-coding(option), - HTTP-response-content-coding(option), - HTTP-response-timeout, - HTTP-upgrade-failed, - HTTP-protocol-error, - loop-detected, - configuration-error, - /// This is a catch-all error for anything that doesn't fit cleanly into a - /// more specific case. It also includes an optional string for an - /// unstructured description of the error. Users should not depend on the - /// string for diagnosing errors, as it's not required to be consistent - /// between implementations. - internal-error(option), - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting or appending to a `fields` resource. - variant header-error { - /// This error indicates that a `field-key` or `field-value` was - /// syntactically invalid when used with an operation that sets headers in a - /// `fields`. - invalid-syntax, - /// This error indicates that a forbidden `field-key` was used when trying - /// to set a header in a `fields`. - forbidden, - /// This error indicates that the operation on the `fields` was not - /// permitted because the fields are immutable. - immutable, - } - - /// Field keys are always strings. - type field-key = string; - - /// Field values should always be ASCII strings. However, in - /// reality, HTTP implementations often have to interpret malformed values, - /// so they are provided as a list of bytes. - type field-value = list; - - /// This following block defines the `fields` resource which corresponds to - /// HTTP standard Fields. Fields are a common representation used for both - /// Headers and Trailers. - /// - /// A `fields` may be mutable or immutable. A `fields` created using the - /// constructor, `from-list`, or `clone` will be mutable, but a `fields` - /// resource given by other means (including, but not limited to, - /// `incoming-request.headers`, `outgoing-request.headers`) might be be - /// immutable. In an immutable fields, the `set`, `append`, and `delete` - /// operations will fail with `header-error.immutable`. - resource fields { - /// Construct an empty HTTP Fields. - /// - /// The resulting `fields` is mutable. - constructor(); - - /// Append a value for a key. Does not change or delete any existing - /// values for that key. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - append: func(name: field-key, value: field-value) -> result<_, header-error>; - - /// Make a deep copy of the Fields. Equivelant in behavior to calling the - /// `fields` constructor on the return value of `entries`. The resulting - /// `fields` is mutable. - clone: func() -> fields; - - /// Delete all values for a key. Does nothing if no values for the key - /// exist. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - delete: func(name: field-key) -> result<_, header-error>; - - /// Retrieve the full set of keys and values in the Fields. Like the - /// constructor, the list represents each key-value pair. - /// - /// The outer list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - entries: func() -> list>; - - /// Get all of the values corresponding to a key. If the key is not present - /// in this `fields`, an empty list is returned. However, if the key is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - get: func(name: field-key) -> list; - - /// Returns `true` when the key is present in this `fields`. If the key is - /// syntactically invalid, `false` is returned. - has: func(name: field-key) -> bool; - - /// Set all of the values for a key. Clears any existing values for that - /// key, if they have been set. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - set: func(name: field-key, value: list) -> result<_, header-error>; - - /// Construct an HTTP Fields. - /// - /// The resulting `fields` is mutable. - /// - /// The list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - /// - /// The tuple is a pair of the field key, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all keys - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. - /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. - from-list: static func(entries: list>) -> result; - } - - /// Headers is an alias for Fields. - type headers = fields; - - /// Trailers is an alias for Fields. - type trailers = fields; - - /// Represents an incoming HTTP Request. - resource incoming-request { - - /// Returns the authority from the request, if it was present. - authority: func() -> option; - - /// Gives the `incoming-body` associated with this request. Will only - /// return success at most once, and subsequent calls will return error. - consume: func() -> result; - - /// Get the `headers` associated with the request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// The `headers` returned are a child resource: it must be dropped before - /// the parent `incoming-request` is dropped. Dropping this - /// `incoming-request` before all children are dropped will trap. - headers: func() -> headers; - - /// Returns the method of the incoming request. - method: func() -> method; - - /// Returns the path with query parameters from the request, as a string. - path-with-query: func() -> option; - - /// Returns the protocol scheme from the request. - scheme: func() -> option; - } - - /// Represents an outgoing HTTP Request. - resource outgoing-request { - /// Construct a new `outgoing-request` with a default `method` of `GET`, and - /// `none` values for `path-with-query`, `scheme`, and `authority`. - /// - /// * `headers` is the HTTP Headers for the Request. - /// - /// It is possible to construct, or manipulate with the accessor functions - /// below, an `outgoing-request` with an invalid combination of `scheme` - /// and `authority`, or `headers` which are not permitted to be sent. - /// It is the obligation of the `outgoing-handler.handle` implementation - /// to reject invalid constructions of `outgoing-request`. - constructor(headers: headers); - - /// Get the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. - authority: func() -> option; - - /// Returns the resource corresponding to the outgoing Body for this - /// Request. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-request` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - - /// Get the Method for the Request. - method: func() -> method; - - /// Get the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. - path-with-query: func() -> option; - - /// Get the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. - scheme: func() -> option; - - /// Set the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid uri authority. - set-authority: func(authority: option) -> result; - - /// Set the Method for the Request. Fails if the string present in a - /// `method.other` argument is not a syntactically valid method. - set-method: func(method: method) -> result; - - /// Set the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. Fails is the - /// string given is not a syntactically valid path and query uri component. - set-path-with-query: func(path-with-query: option) -> result; - - /// Set the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. Fails if the - /// string given is not a syntactically valid uri scheme. - set-scheme: func(scheme: option) -> result; - } - - /// Parameters for making an HTTP Request. Each of these parameters is - /// currently an optional timeout applicable to the transport layer of the - /// HTTP protocol. - /// - /// These timeouts are separate from any the user may use to bound a - /// blocking call to `wasi:io/poll.poll`. - resource request-options { - /// Construct a default `request-options` value. - constructor(); - - /// The timeout for receiving subsequent chunks of bytes in the Response - /// body stream. - between-bytes-timeout: func() -> option; - - /// The timeout for the initial connect to the HTTP Server. - connect-timeout: func() -> option; - - /// The timeout for receiving the first byte of the Response body. - first-byte-timeout: func() -> option; - - /// Set the timeout for receiving subsequent chunks of bytes in the Response - /// body stream. An error return value indicates that this timeout is not - /// supported. - set-between-bytes-timeout: func(duration: option) -> result; - - /// Set the timeout for the initial connect to the HTTP Server. An error - /// return value indicates that this timeout is not supported. - set-connect-timeout: func(duration: option) -> result; - - /// Set the timeout for receiving the first byte of the Response body. An - /// error return value indicates that this timeout is not supported. - set-first-byte-timeout: func(duration: option) -> result; - } - - /// Represents the ability to send an HTTP Response. - /// - /// This resource is used by the `wasi:http/incoming-handler` interface to - /// allow a Response to be sent corresponding to the Request provided as the - /// other argument to `incoming-handler.handle`. - resource response-outparam { - - /// Set the value of the `response-outparam` to either send a response, - /// or indicate an error. - /// - /// This method consumes the `response-outparam` to ensure that it is - /// called at most once. If it is never called, the implementation - /// will respond with an error. - /// - /// The user may provide an `error` to `response` to allow the - /// implementation determine how to respond with an HTTP error response. - set: static func(param: response-outparam, response: result); - } - - /// This type corresponds to the HTTP standard Status Code. - type status-code = u16; - - /// Represents an incoming HTTP Response. - resource incoming-response { - - /// Returns the incoming body. May be called at most once. Returns error - /// if called additional times. - consume: func() -> result; - - /// Returns the headers from the incoming response. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `incoming-response` is dropped. - headers: func() -> headers; - - /// Returns the status code from the incoming response. - status: func() -> status-code; - } - - /// Represents an incoming HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, indicating that the full contents of the - /// body have been received. This resource represents the contents as - /// an `input-stream` and the delivery of trailers as a `future-trailers`, - /// and ensures that the user of this interface may only be consuming either - /// the body contents or waiting on trailers at any given time. - resource incoming-body { - - /// Returns the contents of the body, as a stream of bytes. - /// - /// Returns success on first call: the stream representing the contents - /// can be retrieved at most once. Subsequent calls will return error. - /// - /// The returned `input-stream` resource is a child: it must be dropped - /// before the parent `incoming-body` is dropped, or consumed by - /// `incoming-body.finish`. - /// - /// This invariant ensures that the implementation can determine whether - /// the user is consuming the contents of the body, waiting on the - /// `future-trailers` to be ready, or neither. This allows for network - /// backpressure is to be applied when the user is consuming the body, - /// and for that backpressure to not inhibit delivery of the trailers if - /// the user does not read the entire body. - %stream: func() -> result; - - /// Takes ownership of `incoming-body`, and returns a `future-trailers`. - /// This function will trap if the `input-stream` child is still alive. - finish: static func(this: incoming-body) -> future-trailers; - } - - /// Represents a future which may eventaully return trailers, or an error. - /// - /// In the case that the incoming HTTP Request or Response did not have any - /// trailers, this future will resolve to the empty set of trailers once the - /// complete Request or Response body has been received. - resource future-trailers { - - /// Returns the contents of the trailers, or an error which occured, - /// once the future is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the trailers or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the HTTP Request or Response - /// body, as well as any trailers, were received successfully, or that an - /// error occured receiving them. The optional `trailers` indicates whether - /// or not trailers were present in the body. - /// - /// When some `trailers` are returned by this method, the `trailers` - /// resource is immutable, and a child. Use of the `set`, `append`, or - /// `delete` methods will return an error, and the resource must be - /// dropped before the parent `future-trailers` is dropped. - get: func() -> option, error-code>>>; - - /// Returns a pollable which becomes ready when either the trailers have - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - } - - /// Represents an outgoing HTTP Response. - resource outgoing-response { - /// Construct an `outgoing-response`, with a default `status-code` of `200`. - /// If a different `status-code` is needed, it must be set via the - /// `set-status-code` method. - /// - /// * `headers` is the HTTP Headers for the Response. - constructor(headers: headers); - - /// Returns the resource corresponding to the outgoing Body for this Response. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-response` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - - /// Set the HTTP Status Code for the Response. Fails if the status-code - /// given is not a valid http status code. - set-status-code: func(status-code: status-code) -> result; - - /// Get the HTTP Status Code for the Response. - status-code: func() -> status-code; - } - - /// Represents an outgoing HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, inducating the full contents of the body - /// have been sent. This resource represents the contents as an - /// `output-stream` child resource, and the completion of the body (with - /// optional trailers) with a static function that consumes the - /// `outgoing-body` resource, and ensures that the user of this interface - /// may not write to the body contents after the body has been finished. - /// - /// If the user code drops this resource, as opposed to calling the static - /// method `finish`, the implementation should treat the body as incomplete, - /// and that an error has occured. The implementation should propogate this - /// error to the HTTP protocol by whatever means it has available, - /// including: corrupting the body on the wire, aborting the associated - /// Request, or sending a late status code for the Response. - resource outgoing-body { - - /// Returns a stream for writing the body contents. - /// - /// The returned `output-stream` is a child resource: it must be dropped - /// before the parent `outgoing-body` resource is dropped (or finished), - /// otherwise the `outgoing-body` drop or `finish` will trap. - /// - /// Returns success on the first call: the `output-stream` resource for - /// this `outgoing-body` may be retrieved at most once. Subsequent calls - /// will return error. - write: func() -> result; - - /// Finalize an outgoing body, optionally providing trailers. This must be - /// called to signal that the response is complete. If the `outgoing-body` - /// is dropped without calling `outgoing-body.finalize`, the implementation - /// should treat the body as corrupted. - /// - /// Fails if the body's `outgoing-request` or `outgoing-response` was - /// constructed with a Content-Length header, and the contents written - /// to the body (via `write`) does not match the value given in the - /// Content-Length. - finish: static func(this: outgoing-body, trailers: option) -> result<_, error-code>; - } - - /// Represents a future which may eventaully return an incoming HTTP - /// Response, or an error. - /// - /// This resource is returned by the `wasi:http/outgoing-handler` interface to - /// provide the HTTP Response corresponding to the sent Request. - resource future-incoming-response { - - /// Returns the incoming HTTP Response, or an error, once one is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the response or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the incoming HTTP Response - /// status and headers have recieved successfully, or that an error - /// occured. Errors may also occur while consuming the response body, - /// but those will be reported by the `incoming-body` and its - /// `output-stream` child. - get: func() -> option>>; - - /// Returns a pollable which becomes ready when either the Response has - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - } - - /// Attempts to extract a http-related `error` from the wasi:io `error` - /// provided. - /// - /// Stream operations which return - /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of - /// type `wasi:io/error/error` with more information about the operation - /// that failed. This payload can be passed through to this function to see - /// if there's http-related information about the error to return. - /// - /// Note that this function is fallible because not all io-errors are - /// http-related errors. - http-error-code: func(err: borrow) -> option; - } - - /// This interface defines a handler of incoming HTTP Requests. It should - /// be exported by components which can respond to HTTP Requests. - interface incoming-handler { - use types.{incoming-request}; - use types.{response-outparam}; - - /// This function is invoked with an incoming HTTP Request, and a resource - /// `response-outparam` which provides the capability to reply with an HTTP - /// Response. The response is sent by calling the `response-outparam.set` - /// method, which allows execution to continue after the response has been - /// sent. This enables both streaming to the response body, and performing other - /// work. - /// - /// The implementor of this function must write a response to the - /// `response-outparam` before returning, or else the caller will respond - /// with an error on its behalf. - handle: func(request: incoming-request, response-out: response-outparam); - } - - /// This interface defines a handler of outgoing HTTP Requests. It should be - /// imported by components which wish to make HTTP Requests. - interface outgoing-handler { - use types.{outgoing-request}; - use types.{request-options}; - use types.{future-incoming-response}; - use types.{error-code}; - - /// This function is invoked with an outgoing HTTP Request, and it returns - /// a resource `future-incoming-response` which represents an HTTP Response - /// which may arrive in the future. - /// - /// The `options` argument accepts optional parameters for the HTTP - /// protocol's transport layer. - /// - /// This function may return an error if the `outgoing-request` is invalid - /// or not allowed to be made. Otherwise, protocol errors are reported - /// through the `future-incoming-response`. - handle: func(request: outgoing-request, options: option) -> result; - } -} - -package wasi:io@0.2.0 { - interface poll { - resource pollable { - block: func(); - ready: func() -> bool; - } - poll: func(in: list>) -> list; - } - - interface error { - resource error { - to-debug-string: func() -> string; - } - } - - interface streams { - use error.{error}; - use poll.{pollable}; - variant stream-error { - last-operation-failed(error), - closed, - } - resource input-stream { - blocking-read: func(len: u64) -> result, stream-error>; - blocking-skip: func(len: u64) -> result; - read: func(len: u64) -> result, stream-error>; - skip: func(len: u64) -> result; - subscribe: func() -> pollable; - } - resource output-stream { - blocking-flush: func() -> result<_, stream-error>; - blocking-splice: func(src: borrow, len: u64) -> result; - blocking-write-and-flush: func(contents: list) -> result<_, stream-error>; - blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>; - check-write: func() -> result; - flush: func() -> result<_, stream-error>; - splice: func(src: borrow, len: u64) -> result; - subscribe: func() -> pollable; - write: func(contents: list) -> result<_, stream-error>; - write-zeroes: func(len: u64) -> result<_, stream-error>; - } - } -} - -package wasi:logging@0.1.0-draft { - interface logging { - enum level { - trace, - debug, - info, - warn, - error, - critical - } - log: func(level: level, context: string, message: string); - } -} - -package wasi:random@0.2.0 { - interface random { - get-random-bytes: func(len: u64) -> list; - get-random-u64: func() -> u64; - } - - interface insecure { - get-insecure-random-bytes: func(len: u64) -> list; - get-insecure-random-u64: func() -> u64; - } - - interface insecure-seed { - insecure-seed: func() -> tuple; - } -} - -package wasi:sockets@0.2.0 { - interface network { - resource network; - enum error-code { - unknown, - access-denied, - not-supported, - invalid-argument, - out-of-memory, - timeout, - concurrency-conflict, - not-in-progress, - would-block, - invalid-state, - new-socket-limit, - address-not-bindable, - address-in-use, - remote-unreachable, - connection-refused, - connection-reset, - connection-aborted, - datagram-too-large, - name-unresolvable, - temporary-resolver-failure, - permanent-resolver-failure - } - enum ip-address-family { ipv4, ipv6 } - type ipv4-address = tuple; - type ipv6-address = tuple; - variant ip-address { - ipv4(ipv4-address), - ipv6(ipv6-address), - } - record ipv4-socket-address { - port: u16, - address: ipv4-address, - } - record ipv6-socket-address { - port: u16, - flow-info: u32, - address: ipv6-address, - scope-id: u32, - } - variant ip-socket-address { - ipv4(ipv4-socket-address), - ipv6(ipv6-socket-address), - } - } - - interface instance-network { - use network.{network}; - instance-network: func() -> network; - } - - interface udp { - use wasi:io/poll@0.2.0.{pollable}; - use network.{network}; - use network.{error-code}; - use network.{ip-socket-address}; - use network.{ip-address-family}; - record incoming-datagram { - data: list, - remote-address: ip-socket-address, - } - record outgoing-datagram { - data: list, - remote-address: option, - } - resource udp-socket { - address-family: func() -> ip-address-family; - finish-bind: func() -> result<_, error-code>; - local-address: func() -> result; - receive-buffer-size: func() -> result; - remote-address: func() -> result; - send-buffer-size: func() -> result; - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; - start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; - %stream: func(remote-address: option) -> result, error-code>; - subscribe: func() -> pollable; - unicast-hop-limit: func() -> result; - } - resource incoming-datagram-stream { - receive: func(max-results: u64) -> result, error-code>; - subscribe: func() -> pollable; - } - resource outgoing-datagram-stream { - check-send: func() -> result; - send: func(datagrams: list) -> result; - subscribe: func() -> pollable; - } - } - - interface udp-create-socket { - use network.{network}; - use network.{error-code}; - use network.{ip-address-family}; - use udp.{udp-socket}; - create-udp-socket: func(address-family: ip-address-family) -> result; - } - - interface tcp { - use wasi:io/streams@0.2.0.{input-stream}; - use wasi:io/streams@0.2.0.{output-stream}; - use wasi:io/poll@0.2.0.{pollable}; - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use network.{network}; - use network.{error-code}; - use network.{ip-socket-address}; - use network.{ip-address-family}; - enum shutdown-type { receive, send, both } - resource tcp-socket { - accept: func() -> result, error-code>; - address-family: func() -> ip-address-family; - finish-bind: func() -> result<_, error-code>; - finish-connect: func() -> result, error-code>; - finish-listen: func() -> result<_, error-code>; - hop-limit: func() -> result; - is-listening: func() -> bool; - keep-alive-count: func() -> result; - keep-alive-enabled: func() -> result; - keep-alive-idle-time: func() -> result; - keep-alive-interval: func() -> result; - local-address: func() -> result; - receive-buffer-size: func() -> result; - remote-address: func() -> result; - send-buffer-size: func() -> result; - set-hop-limit: func(value: u8) -> result<_, error-code>; - set-keep-alive-count: func(value: u32) -> result<_, error-code>; - set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; - set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; - set-keep-alive-interval: func(value: duration) -> result<_, error-code>; - set-listen-backlog-size: func(value: u64) -> result<_, error-code>; - set-receive-buffer-size: func(value: u64) -> result<_, error-code>; - set-send-buffer-size: func(value: u64) -> result<_, error-code>; - shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>; - start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; - start-connect: func(network: borrow, remote-address: ip-socket-address) -> result<_, error-code>; - start-listen: func() -> result<_, error-code>; - subscribe: func() -> pollable; - } - } - - interface tcp-create-socket { - use network.{network}; - use network.{error-code}; - use network.{ip-address-family}; - use tcp.{tcp-socket}; - create-tcp-socket: func(address-family: ip-address-family) -> result; - } - - interface ip-name-lookup { - use wasi:io/poll@0.2.0.{pollable}; - use network.{network}; - use network.{error-code}; - use network.{ip-address}; - resource resolve-address-stream { - resolve-next-address: func() -> result, error-code>; - subscribe: func() -> pollable; - } - resolve-addresses: func(network: borrow, name: string) -> result; - } -} - -package wasmcloud:bus@1.0.0 { - interface lattice { - resource call-target-interface { - constructor(namespace: string, %package: string, %interface: string); - } - set-link-name: func(name: string, interfaces: list); - } -} - -package wasmcloud:secrets@0.1.0-draft { - interface store { - variant secrets-error { - upstream(string), - io(string), - not-found, - } - variant secret-value { - %string(string), - bytes(list), - } - resource secret; - get: func(key: string) -> result; - } - - interface reveal { - use store.{secret}; - use store.{secret-value}; - reveal: func(s: borrow) -> secret-value; - } -} diff --git a/examples/component/http-server/gen/example/http-server/example/example.wit.go b/examples/component/http-server/gen/example/http-server/example/example.wit.go old mode 100755 new mode 100644 index 7368b9bd..6c154767 --- a/examples/component/http-server/gen/example/http-server/example/example.wit.go +++ b/examples/component/http-server/gen/example/http-server/example/example.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package example represents the world "example:http-server/example". package example diff --git a/examples/component/http-server/gen/wasi/cli/environment/empty.s b/examples/component/http-server/gen/wasi/cli/environment/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/environment/environment.wasm.go b/examples/component/http-server/gen/wasi/cli/environment/environment.wasm.go old mode 100755 new mode 100644 index 89bb596b..4f63e76c --- a/examples/component/http-server/gen/wasi/cli/environment/environment.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/environment/environment.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package environment diff --git a/examples/component/http-server/gen/wasi/cli/environment/environment.wit.go b/examples/component/http-server/gen/wasi/cli/environment/environment.wit.go old mode 100755 new mode 100644 index 068bed33..b793cb1e --- a/examples/component/http-server/gen/wasi/cli/environment/environment.wit.go +++ b/examples/component/http-server/gen/wasi/cli/environment/environment.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package environment represents the imported interface "wasi:cli/environment@0.2.0". package environment diff --git a/examples/component/http-server/gen/wasi/cli/exit/empty.s b/examples/component/http-server/gen/wasi/cli/exit/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/exit/exit.wasm.go b/examples/component/http-server/gen/wasi/cli/exit/exit.wasm.go old mode 100755 new mode 100644 index 849d5f50..eb875244 --- a/examples/component/http-server/gen/wasi/cli/exit/exit.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/exit/exit.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package exit diff --git a/examples/component/http-server/gen/wasi/cli/exit/exit.wit.go b/examples/component/http-server/gen/wasi/cli/exit/exit.wit.go old mode 100755 new mode 100644 index 7a347b60..3ca7f56b --- a/examples/component/http-server/gen/wasi/cli/exit/exit.wit.go +++ b/examples/component/http-server/gen/wasi/cli/exit/exit.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package exit represents the imported interface "wasi:cli/exit@0.2.0". package exit diff --git a/examples/component/http-server/gen/wasi/cli/stderr/empty.s b/examples/component/http-server/gen/wasi/cli/stderr/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/stderr/stderr.wasm.go b/examples/component/http-server/gen/wasi/cli/stderr/stderr.wasm.go old mode 100755 new mode 100644 index 462cf172..4f71e47a --- a/examples/component/http-server/gen/wasi/cli/stderr/stderr.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/stderr/stderr.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stderr diff --git a/examples/component/http-server/gen/wasi/cli/stderr/stderr.wit.go b/examples/component/http-server/gen/wasi/cli/stderr/stderr.wit.go old mode 100755 new mode 100644 index 3d53a114..2581b516 --- a/examples/component/http-server/gen/wasi/cli/stderr/stderr.wit.go +++ b/examples/component/http-server/gen/wasi/cli/stderr/stderr.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stderr represents the imported interface "wasi:cli/stderr@0.2.0". package stderr diff --git a/examples/component/http-server/gen/wasi/cli/stdin/empty.s b/examples/component/http-server/gen/wasi/cli/stdin/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/stdin/stdin.wasm.go b/examples/component/http-server/gen/wasi/cli/stdin/stdin.wasm.go old mode 100755 new mode 100644 index 374eb253..e23cbf3d --- a/examples/component/http-server/gen/wasi/cli/stdin/stdin.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/stdin/stdin.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdin diff --git a/examples/component/http-server/gen/wasi/cli/stdin/stdin.wit.go b/examples/component/http-server/gen/wasi/cli/stdin/stdin.wit.go old mode 100755 new mode 100644 index 0469ced1..4aaae1b4 --- a/examples/component/http-server/gen/wasi/cli/stdin/stdin.wit.go +++ b/examples/component/http-server/gen/wasi/cli/stdin/stdin.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdin represents the imported interface "wasi:cli/stdin@0.2.0". package stdin diff --git a/examples/component/http-server/gen/wasi/cli/stdout/empty.s b/examples/component/http-server/gen/wasi/cli/stdout/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/stdout/stdout.wasm.go b/examples/component/http-server/gen/wasi/cli/stdout/stdout.wasm.go old mode 100755 new mode 100644 index 68e4a3da..c184dcca --- a/examples/component/http-server/gen/wasi/cli/stdout/stdout.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/stdout/stdout.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdout diff --git a/examples/component/http-server/gen/wasi/cli/stdout/stdout.wit.go b/examples/component/http-server/gen/wasi/cli/stdout/stdout.wit.go old mode 100755 new mode 100644 index 8d9d7fda..b9fa8275 --- a/examples/component/http-server/gen/wasi/cli/stdout/stdout.wit.go +++ b/examples/component/http-server/gen/wasi/cli/stdout/stdout.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdout represents the imported interface "wasi:cli/stdout@0.2.0". package stdout diff --git a/examples/component/http-server/gen/wasi/cli/terminal-input/empty.s b/examples/component/http-server/gen/wasi/cli/terminal-input/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/terminal-input/terminalinput.wasm.go b/examples/component/http-server/gen/wasi/cli/terminal-input/terminal-input.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from examples/component/http-client/gen/wasi/cli/terminal-input/terminalinput.wasm.go rename to examples/component/http-server/gen/wasi/cli/terminal-input/terminal-input.wasm.go index 1df3794f..d1271efa --- a/examples/component/http-client/gen/wasi/cli/terminal-input/terminalinput.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-input/terminal-input.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalinput diff --git a/examples/component/http-server/gen/wasi/cli/terminal-input/terminal-input.wit.go b/examples/component/http-server/gen/wasi/cli/terminal-input/terminal-input.wit.go old mode 100755 new mode 100644 index 18b9a9d7..2d1034ab --- a/examples/component/http-server/gen/wasi/cli/terminal-input/terminal-input.wit.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-input/terminal-input.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalinput represents the imported interface "wasi:cli/terminal-input@0.2.0". package terminalinput diff --git a/examples/component/http-server/gen/wasi/cli/terminal-output/empty.s b/examples/component/http-server/gen/wasi/cli/terminal-output/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/terminal-output/terminaloutput.wasm.go b/examples/component/http-server/gen/wasi/cli/terminal-output/terminal-output.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from examples/component/http-client/gen/wasi/cli/terminal-output/terminaloutput.wasm.go rename to examples/component/http-server/gen/wasi/cli/terminal-output/terminal-output.wasm.go index fb35fc41..e2b1717c --- a/examples/component/http-client/gen/wasi/cli/terminal-output/terminaloutput.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-output/terminal-output.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminaloutput diff --git a/examples/component/http-server/gen/wasi/cli/terminal-output/terminal-output.wit.go b/examples/component/http-server/gen/wasi/cli/terminal-output/terminal-output.wit.go old mode 100755 new mode 100644 index 823aaf52..55f0400f --- a/examples/component/http-server/gen/wasi/cli/terminal-output/terminal-output.wit.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-output/terminal-output.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminaloutput represents the imported interface "wasi:cli/terminal-output@0.2.0". package terminaloutput diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stderr/empty.s b/examples/component/http-server/gen/wasi/cli/terminal-stderr/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go b/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go old mode 100755 new mode 100644 similarity index 84% rename from examples/component/http-server/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go rename to examples/component/http-server/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go index be9af72f..86c0791e --- a/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstderr diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go b/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go old mode 100755 new mode 100644 index d6a1585a..e7a37fa3 --- a/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstderr represents the imported interface "wasi:cli/terminal-stderr@0.2.0". package terminalstderr diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stdin/empty.s b/examples/component/http-server/gen/wasi/cli/terminal-stdin/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go b/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go old mode 100755 new mode 100644 similarity index 83% rename from examples/component/http-client/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go rename to examples/component/http-server/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go index e3b3ac61..3f657f5b --- a/examples/component/http-client/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstdin diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go b/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go old mode 100755 new mode 100644 index 1d37efee..31206769 --- a/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdin represents the imported interface "wasi:cli/terminal-stdin@0.2.0". package terminalstdin diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stdout/empty.s b/examples/component/http-server/gen/wasi/cli/terminal-stdout/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go b/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go old mode 100755 new mode 100644 similarity index 84% rename from component/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go rename to examples/component/http-server/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go index fa750ad9..705fcf9d --- a/component/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstdout diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go b/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go old mode 100755 new mode 100644 index a45762ea..2b7e8960 --- a/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go +++ b/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdout represents the imported interface "wasi:cli/terminal-stdout@0.2.0". package terminalstdout diff --git a/examples/component/http-server/gen/wasi/clocks/monotonic-clock/empty.s b/examples/component/http-server/gen/wasi/clocks/monotonic-clock/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go b/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go old mode 100755 new mode 100644 similarity index 91% rename from examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go rename to examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go index 36a1720a..aae90f4a --- a/examples/component/http-client/gen/wasi/clocks/monotonic-clock/monotonicclock.wasm.go +++ b/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package monotonicclock diff --git a/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go b/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go old mode 100755 new mode 100644 index 1dffa9d9..b911955f --- a/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go +++ b/examples/component/http-server/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package monotonicclock represents the imported interface "wasi:clocks/monotonic-clock@0.2.0". package monotonicclock diff --git a/examples/component/http-server/gen/wasi/clocks/wall-clock/empty.s b/examples/component/http-server/gen/wasi/clocks/wall-clock/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/clocks/wall-clock/wallclock.wasm.go b/examples/component/http-server/gen/wasi/clocks/wall-clock/wall-clock.wasm.go old mode 100755 new mode 100644 similarity index 85% rename from examples/component/http-client/gen/wasi/clocks/wall-clock/wallclock.wasm.go rename to examples/component/http-server/gen/wasi/clocks/wall-clock/wall-clock.wasm.go index 321ff3f1..662ea1e5 --- a/examples/component/http-client/gen/wasi/clocks/wall-clock/wallclock.wasm.go +++ b/examples/component/http-server/gen/wasi/clocks/wall-clock/wall-clock.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package wallclock diff --git a/examples/component/http-server/gen/wasi/clocks/wall-clock/wall-clock.wit.go b/examples/component/http-server/gen/wasi/clocks/wall-clock/wall-clock.wit.go old mode 100755 new mode 100644 index e3f35395..752ffdd9 --- a/examples/component/http-server/gen/wasi/clocks/wall-clock/wall-clock.wit.go +++ b/examples/component/http-server/gen/wasi/clocks/wall-clock/wall-clock.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package wallclock represents the imported interface "wasi:clocks/wall-clock@0.2.0". package wallclock @@ -14,9 +14,9 @@ import ( // nanoseconds: u32, // } type DateTime struct { - _ cm.HostLayout - Seconds uint64 - Nanoseconds uint32 + _ cm.HostLayout `json:"-"` + Seconds uint64 `json:"seconds"` + Nanoseconds uint32 `json:"nanoseconds"` } // Now represents the imported function "now". diff --git a/examples/component/http-server/gen/wasi/config/runtime/abi.go b/examples/component/http-server/gen/wasi/config/runtime/abi.go old mode 100755 new mode 100644 index 61412cbe..45139366 --- a/examples/component/http-server/gen/wasi/config/runtime/abi.go +++ b/examples/component/http-server/gen/wasi/config/runtime/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime diff --git a/examples/component/http-server/gen/wasi/config/runtime/empty.s b/examples/component/http-server/gen/wasi/config/runtime/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/config/runtime/runtime.wasm.go b/examples/component/http-server/gen/wasi/config/runtime/runtime.wasm.go old mode 100755 new mode 100644 index 8ce17d5e..bf6a60c6 --- a/examples/component/http-server/gen/wasi/config/runtime/runtime.wasm.go +++ b/examples/component/http-server/gen/wasi/config/runtime/runtime.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime diff --git a/examples/component/http-server/gen/wasi/config/runtime/runtime.wit.go b/examples/component/http-server/gen/wasi/config/runtime/runtime.wit.go old mode 100755 new mode 100644 index 99a739d1..4de65a40 --- a/examples/component/http-server/gen/wasi/config/runtime/runtime.wit.go +++ b/examples/component/http-server/gen/wasi/config/runtime/runtime.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package runtime represents the imported interface "wasi:config/runtime@0.2.0-draft". package runtime @@ -35,14 +35,14 @@ func (self *ConfigError) IO() *string { return cm.Case[string](self, 1) } -var stringsConfigError = [2]string{ +var _ConfigErrorStrings = [2]string{ "upstream", "io", } // String implements [fmt.Stringer], returning the variant case name of v. func (v ConfigError) String() string { - return stringsConfigError[v.Tag()] + return _ConfigErrorStrings[v.Tag()] } // Get represents the imported function "get". diff --git a/examples/component/http-server/gen/wasi/filesystem/preopens/empty.s b/examples/component/http-server/gen/wasi/filesystem/preopens/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wasm.go b/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wasm.go old mode 100755 new mode 100644 index 1bcd416a..c95831c0 --- a/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wasm.go +++ b/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package preopens diff --git a/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wit.go b/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wit.go old mode 100755 new mode 100644 index e287b2b3..d2aa7b84 --- a/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wit.go +++ b/examples/component/http-server/gen/wasi/filesystem/preopens/preopens.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package preopens represents the imported interface "wasi:filesystem/preopens@0.2.0". package preopens diff --git a/examples/component/http-server/gen/wasi/filesystem/types/abi.go b/examples/component/http-server/gen/wasi/filesystem/types/abi.go old mode 100755 new mode 100644 index f5ed743a..c39f1fc4 --- a/examples/component/http-server/gen/wasi/filesystem/types/abi.go +++ b/examples/component/http-server/gen/wasi/filesystem/types/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/http-server/gen/wasi/filesystem/types/empty.s b/examples/component/http-server/gen/wasi/filesystem/types/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/filesystem/types/types.wasm.go b/examples/component/http-server/gen/wasi/filesystem/types/types.wasm.go old mode 100755 new mode 100644 index b97dad84..1daa0062 --- a/examples/component/http-server/gen/wasi/filesystem/types/types.wasm.go +++ b/examples/component/http-server/gen/wasi/filesystem/types/types.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/http-server/gen/wasi/filesystem/types/types.wit.go b/examples/component/http-server/gen/wasi/filesystem/types/types.wit.go old mode 100755 new mode 100644 index d55c5790..0f631dbc --- a/examples/component/http-server/gen/wasi/filesystem/types/types.wit.go +++ b/examples/component/http-server/gen/wasi/filesystem/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:filesystem/types@0.2.0". package types @@ -59,7 +59,7 @@ const ( DescriptorTypeSocket ) -var stringsDescriptorType = [8]string{ +var _DescriptorTypeStrings = [8]string{ "unknown", "block-device", "character-device", @@ -72,9 +72,22 @@ var stringsDescriptorType = [8]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e DescriptorType) String() string { - return stringsDescriptorType[e] + return _DescriptorTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e DescriptorType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *DescriptorType) UnmarshalText(text []byte) error { + return _DescriptorTypeUnmarshalCase(e, text) +} + +var _DescriptorTypeUnmarshalCase = cm.CaseUnmarshaler[DescriptorType](_DescriptorTypeStrings[:]) + // DescriptorFlags represents the flags "wasi:filesystem/types@0.2.0#descriptor-flags". // // flags descriptor-flags { @@ -140,13 +153,13 @@ type LinkCount uint64 // status-change-timestamp: option, // } type DescriptorStat struct { - _ cm.HostLayout - Type DescriptorType - LinkCount LinkCount - Size FileSize - DataAccessTimestamp cm.Option[DateTime] - DataModificationTimestamp cm.Option[DateTime] - StatusChangeTimestamp cm.Option[DateTime] + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + LinkCount LinkCount `json:"link-count"` + Size FileSize `json:"size"` + DataAccessTimestamp cm.Option[DateTime] `json:"data-access-timestamp"` + DataModificationTimestamp cm.Option[DateTime] `json:"data-modification-timestamp"` + StatusChangeTimestamp cm.Option[DateTime] `json:"status-change-timestamp"` } // NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp". @@ -190,7 +203,7 @@ func (self *NewTimestamp) Timestamp() *DateTime { return cm.Case[DateTime](self, 2) } -var stringsNewTimestamp = [3]string{ +var _NewTimestampStrings = [3]string{ "no-change", "now", "timestamp", @@ -198,7 +211,7 @@ var stringsNewTimestamp = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v NewTimestamp) String() string { - return stringsNewTimestamp[v.Tag()] + return _NewTimestampStrings[v.Tag()] } // DirectoryEntry represents the record "wasi:filesystem/types@0.2.0#directory-entry". @@ -208,9 +221,9 @@ func (v NewTimestamp) String() string { // name: string, // } type DirectoryEntry struct { - _ cm.HostLayout - Type DescriptorType - Name string + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + Name string `json:"name"` } // ErrorCode represents the enum "wasi:filesystem/types@0.2.0#error-code". @@ -296,7 +309,7 @@ const ( ErrorCodeCrossDevice ) -var stringsErrorCode = [37]string{ +var _ErrorCodeStrings = [37]string{ "access", "would-block", "already", @@ -338,9 +351,22 @@ var stringsErrorCode = [37]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // Advice represents the enum "wasi:filesystem/types@0.2.0#advice". // // enum advice { @@ -362,7 +388,7 @@ const ( AdviceNoReuse ) -var stringsAdvice = [6]string{ +var _AdviceStrings = [6]string{ "normal", "sequential", "random", @@ -373,9 +399,22 @@ var stringsAdvice = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Advice) String() string { - return stringsAdvice[e] + return _AdviceStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e Advice) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Advice) UnmarshalText(text []byte) error { + return _AdviceUnmarshalCase(e, text) +} + +var _AdviceUnmarshalCase = cm.CaseUnmarshaler[Advice](_AdviceStrings[:]) + // MetadataHashValue represents the record "wasi:filesystem/types@0.2.0#metadata-hash-value". // // record metadata-hash-value { @@ -383,9 +422,9 @@ func (e Advice) String() string { // upper: u64, // } type MetadataHashValue struct { - _ cm.HostLayout - Lower uint64 - Upper uint64 + _ cm.HostLayout `json:"-"` + Lower uint64 `json:"lower"` + Upper uint64 `json:"upper"` } // Descriptor represents the imported resource "wasi:filesystem/types@0.2.0#descriptor". diff --git a/examples/component/http-server/gen/wasi/http/incoming-handler/empty.s b/examples/component/http-server/gen/wasi/http/incoming-handler/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.exports.go b/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.exports.go old mode 100755 new mode 100644 index 673ccb48..6447d62b --- a/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.exports.go +++ b/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.exports.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package incominghandler diff --git a/examples/component/http-server/gen/wasi/http/incoming-handler/incominghandler.wasm.go b/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.wasm.go old mode 100755 new mode 100644 similarity index 89% rename from examples/component/http-server/gen/wasi/http/incoming-handler/incominghandler.wasm.go rename to examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.wasm.go index eae429f3..a62ef301 --- a/examples/component/http-server/gen/wasi/http/incoming-handler/incominghandler.wasm.go +++ b/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package incominghandler diff --git a/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.wit.go b/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.wit.go old mode 100755 new mode 100644 index 0c114e19..2e4bb609 --- a/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.wit.go +++ b/examples/component/http-server/gen/wasi/http/incoming-handler/incoming-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package incominghandler represents the exported interface "wasi:http/incoming-handler@0.2.0". // diff --git a/examples/component/http-server/gen/wasi/http/outgoing-handler/abi.go b/examples/component/http-server/gen/wasi/http/outgoing-handler/abi.go old mode 100755 new mode 100644 index 334f455c..4fe90d79 --- a/examples/component/http-server/gen/wasi/http/outgoing-handler/abi.go +++ b/examples/component/http-server/gen/wasi/http/outgoing-handler/abi.go @@ -1,9 +1,8 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler import ( - "github.com/wasmCloud/go/examples/component/http-server/gen/wasi/http/types" "go.bytecodealliance.org/cm" "unsafe" ) @@ -11,7 +10,7 @@ import ( // ErrorCodeShape is used for storage in variant or result types. type ErrorCodeShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(types.ErrorCode{})]byte + shape [unsafe.Sizeof(ErrorCode{})]byte } func lower_OptionRequestOptions(v cm.Option[RequestOptions]) (f0 uint32, f1 uint32) { diff --git a/examples/component/http-server/gen/wasi/http/outgoing-handler/empty.s b/examples/component/http-server/gen/wasi/http/outgoing-handler/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go b/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go old mode 100755 new mode 100644 similarity index 86% rename from examples/component/http-client/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go rename to examples/component/http-server/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go index 6b3f3828..754b1aed --- a/examples/component/http-client/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go +++ b/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler diff --git a/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go b/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go old mode 100755 new mode 100644 index 48d756fb..8cf26e87 --- a/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go +++ b/examples/component/http-server/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package outgoinghandler represents the imported interface "wasi:http/outgoing-handler@0.2.0". // diff --git a/examples/component/http-server/gen/wasi/http/types/abi.go b/examples/component/http-server/gen/wasi/http/types/abi.go old mode 100755 new mode 100644 index 6ffb1fdd..05889832 --- a/examples/component/http-server/gen/wasi/http/types/abi.go +++ b/examples/component/http-server/gen/wasi/http/types/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/http-server/gen/wasi/http/types/empty.s b/examples/component/http-server/gen/wasi/http/types/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/http/types/types.wasm.go b/examples/component/http-server/gen/wasi/http/types/types.wasm.go old mode 100755 new mode 100644 index b025b2af..5f1a9c66 --- a/examples/component/http-server/gen/wasi/http/types/types.wasm.go +++ b/examples/component/http-server/gen/wasi/http/types/types.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/http-server/gen/wasi/http/types/types.wit.go b/examples/component/http-server/gen/wasi/http/types/types.wit.go old mode 100755 new mode 100644 index a1b516dc..b9f552aa --- a/examples/component/http-server/gen/wasi/http/types/types.wit.go +++ b/examples/component/http-server/gen/wasi/http/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:http/types@0.2.0". // @@ -167,7 +167,7 @@ func (self *Method) Other() *string { return cm.Case[string](self, 9) } -var stringsMethod = [10]string{ +var _MethodStrings = [10]string{ "get", "head", "post", @@ -182,7 +182,7 @@ var stringsMethod = [10]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Method) String() string { - return stringsMethod[v.Tag()] + return _MethodStrings[v.Tag()] } // Scheme represents the variant "wasi:http/types@0.2.0#scheme". @@ -228,7 +228,7 @@ func (self *Scheme) Other() *string { return cm.Case[string](self, 2) } -var stringsScheme = [3]string{ +var _SchemeStrings = [3]string{ "HTTP", "HTTPS", "other", @@ -236,7 +236,7 @@ var stringsScheme = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Scheme) String() string { - return stringsScheme[v.Tag()] + return _SchemeStrings[v.Tag()] } // DNSErrorPayload represents the record "wasi:http/types@0.2.0#DNS-error-payload". @@ -248,9 +248,9 @@ func (v Scheme) String() string { // info-code: option, // } type DNSErrorPayload struct { - _ cm.HostLayout - Rcode cm.Option[string] - InfoCode cm.Option[uint16] + _ cm.HostLayout `json:"-"` + Rcode cm.Option[string] `json:"rcode"` + InfoCode cm.Option[uint16] `json:"info-code"` } // TLSAlertReceivedPayload represents the record "wasi:http/types@0.2.0#TLS-alert-received-payload". @@ -262,9 +262,9 @@ type DNSErrorPayload struct { // alert-message: option, // } type TLSAlertReceivedPayload struct { - _ cm.HostLayout - AlertID cm.Option[uint8] - AlertMessage cm.Option[string] + _ cm.HostLayout `json:"-"` + AlertID cm.Option[uint8] `json:"alert-id"` + AlertMessage cm.Option[string] `json:"alert-message"` } // FieldSizePayload represents the record "wasi:http/types@0.2.0#field-size-payload". @@ -276,9 +276,9 @@ type TLSAlertReceivedPayload struct { // field-size: option, // } type FieldSizePayload struct { - _ cm.HostLayout - FieldName cm.Option[string] - FieldSize cm.Option[uint32] + _ cm.HostLayout `json:"-"` + FieldName cm.Option[string] `json:"field-name"` + FieldSize cm.Option[uint32] `json:"field-size"` } // ErrorCode represents the variant "wasi:http/types@0.2.0#error-code". @@ -749,7 +749,7 @@ func (self *ErrorCode) InternalError() *cm.Option[string] { return cm.Case[cm.Option[string]](self, 38) } -var stringsErrorCode = [39]string{ +var _ErrorCodeStrings = [39]string{ "DNS-timeout", "DNS-error", "destination-not-found", @@ -793,7 +793,7 @@ var stringsErrorCode = [39]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v ErrorCode) String() string { - return stringsErrorCode[v.Tag()] + return _ErrorCodeStrings[v.Tag()] } // HeaderError represents the variant "wasi:http/types@0.2.0#header-error". @@ -823,7 +823,7 @@ const ( HeaderErrorImmutable ) -var stringsHeaderError = [3]string{ +var _HeaderErrorStrings = [3]string{ "invalid-syntax", "forbidden", "immutable", @@ -831,9 +831,22 @@ var stringsHeaderError = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e HeaderError) String() string { - return stringsHeaderError[e] + return _HeaderErrorStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e HeaderError) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *HeaderError) UnmarshalText(text []byte) error { + return _HeaderErrorUnmarshalCase(e, text) +} + +var _HeaderErrorUnmarshalCase = cm.CaseUnmarshaler[HeaderError](_HeaderErrorStrings[:]) + // FieldKey represents the string "wasi:http/types@0.2.0#field-key". // // Field keys are always strings. diff --git a/examples/component/http-server/gen/wasi/io/error/empty.s b/examples/component/http-server/gen/wasi/io/error/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-client/gen/wasi/io/error/ioerror.wasm.go b/examples/component/http-server/gen/wasi/io/error/error.wasm.go old mode 100755 new mode 100644 similarity index 86% rename from examples/component/http-client/gen/wasi/io/error/ioerror.wasm.go rename to examples/component/http-server/gen/wasi/io/error/error.wasm.go index e254b5d8..eee2750b --- a/examples/component/http-client/gen/wasi/io/error/ioerror.wasm.go +++ b/examples/component/http-server/gen/wasi/io/error/error.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ioerror diff --git a/examples/component/http-server/gen/wasi/io/error/error.wit.go b/examples/component/http-server/gen/wasi/io/error/error.wit.go old mode 100755 new mode 100644 index 828e977e..33ec33e6 --- a/examples/component/http-server/gen/wasi/io/error/error.wit.go +++ b/examples/component/http-server/gen/wasi/io/error/error.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ioerror represents the imported interface "wasi:io/error@0.2.0". package ioerror diff --git a/examples/component/http-server/gen/wasi/io/poll/empty.s b/examples/component/http-server/gen/wasi/io/poll/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/io/poll/poll.wasm.go b/examples/component/http-server/gen/wasi/io/poll/poll.wasm.go old mode 100755 new mode 100644 index f7c55c3d..6b2ac35b --- a/examples/component/http-server/gen/wasi/io/poll/poll.wasm.go +++ b/examples/component/http-server/gen/wasi/io/poll/poll.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package poll diff --git a/examples/component/http-server/gen/wasi/io/poll/poll.wit.go b/examples/component/http-server/gen/wasi/io/poll/poll.wit.go old mode 100755 new mode 100644 index ad9e9564..32ee50e4 --- a/examples/component/http-server/gen/wasi/io/poll/poll.wit.go +++ b/examples/component/http-server/gen/wasi/io/poll/poll.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package poll represents the imported interface "wasi:io/poll@0.2.0". package poll diff --git a/examples/component/http-server/gen/wasi/io/streams/empty.s b/examples/component/http-server/gen/wasi/io/streams/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/io/streams/streams.wasm.go b/examples/component/http-server/gen/wasi/io/streams/streams.wasm.go old mode 100755 new mode 100644 index eec56645..a6664884 --- a/examples/component/http-server/gen/wasi/io/streams/streams.wasm.go +++ b/examples/component/http-server/gen/wasi/io/streams/streams.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package streams diff --git a/examples/component/http-server/gen/wasi/io/streams/streams.wit.go b/examples/component/http-server/gen/wasi/io/streams/streams.wit.go old mode 100755 new mode 100644 index 59250d81..8faf36f8 --- a/examples/component/http-server/gen/wasi/io/streams/streams.wit.go +++ b/examples/component/http-server/gen/wasi/io/streams/streams.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package streams represents the imported interface "wasi:io/streams@0.2.0". package streams @@ -48,14 +48,14 @@ func (self *StreamError) Closed() bool { return self.Tag() == 1 } -var stringsStreamError = [2]string{ +var _StreamErrorStrings = [2]string{ "last-operation-failed", "closed", } // String implements [fmt.Stringer], returning the variant case name of v. func (v StreamError) String() string { - return stringsStreamError[v.Tag()] + return _StreamErrorStrings[v.Tag()] } // InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream". diff --git a/examples/component/http-server/gen/wasi/logging/logging/empty.s b/examples/component/http-server/gen/wasi/logging/logging/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/logging/logging/logging.wasm.go b/examples/component/http-server/gen/wasi/logging/logging/logging.wasm.go old mode 100755 new mode 100644 index d2d27098..bc430bd6 --- a/examples/component/http-server/gen/wasi/logging/logging/logging.wasm.go +++ b/examples/component/http-server/gen/wasi/logging/logging/logging.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package logging diff --git a/examples/component/http-server/gen/wasi/logging/logging/logging.wit.go b/examples/component/http-server/gen/wasi/logging/logging/logging.wit.go old mode 100755 new mode 100644 index 96e406ed..58b38a84 --- a/examples/component/http-server/gen/wasi/logging/logging/logging.wit.go +++ b/examples/component/http-server/gen/wasi/logging/logging/logging.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package logging represents the imported interface "wasi:logging/logging@0.1.0-draft". package logging @@ -28,7 +28,7 @@ const ( LevelCritical ) -var stringsLevel = [6]string{ +var _LevelStrings = [6]string{ "trace", "debug", "info", @@ -39,9 +39,22 @@ var stringsLevel = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Level) String() string { - return stringsLevel[e] + return _LevelStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e Level) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Level) UnmarshalText(text []byte) error { + return _LevelUnmarshalCase(e, text) +} + +var _LevelUnmarshalCase = cm.CaseUnmarshaler[Level](_LevelStrings[:]) + // Log represents the imported function "log". // // log: func(level: level, context: string, message: string) diff --git a/examples/component/http-server/gen/wasi/random/insecure-seed/empty.s b/examples/component/http-server/gen/wasi/random/insecure-seed/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/random/insecure-seed/insecureseed.wasm.go b/examples/component/http-server/gen/wasi/random/insecure-seed/insecure-seed.wasm.go old mode 100755 new mode 100644 similarity index 80% rename from component/gen/wasi/random/insecure-seed/insecureseed.wasm.go rename to examples/component/http-server/gen/wasi/random/insecure-seed/insecure-seed.wasm.go index e94356df..2c1d8b4a --- a/component/gen/wasi/random/insecure-seed/insecureseed.wasm.go +++ b/examples/component/http-server/gen/wasi/random/insecure-seed/insecure-seed.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecureseed diff --git a/examples/component/http-server/gen/wasi/random/insecure-seed/insecure-seed.wit.go b/examples/component/http-server/gen/wasi/random/insecure-seed/insecure-seed.wit.go old mode 100755 new mode 100644 index e701d1b4..856b2cc7 --- a/examples/component/http-server/gen/wasi/random/insecure-seed/insecure-seed.wit.go +++ b/examples/component/http-server/gen/wasi/random/insecure-seed/insecure-seed.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecureseed represents the imported interface "wasi:random/insecure-seed@0.2.0". package insecureseed diff --git a/examples/component/http-server/gen/wasi/random/insecure/empty.s b/examples/component/http-server/gen/wasi/random/insecure/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/random/insecure/insecure.wasm.go b/examples/component/http-server/gen/wasi/random/insecure/insecure.wasm.go old mode 100755 new mode 100644 index 498bfe4a..f5c82d7b --- a/examples/component/http-server/gen/wasi/random/insecure/insecure.wasm.go +++ b/examples/component/http-server/gen/wasi/random/insecure/insecure.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecure diff --git a/examples/component/http-server/gen/wasi/random/insecure/insecure.wit.go b/examples/component/http-server/gen/wasi/random/insecure/insecure.wit.go old mode 100755 new mode 100644 index f32282c6..c150d4a6 --- a/examples/component/http-server/gen/wasi/random/insecure/insecure.wit.go +++ b/examples/component/http-server/gen/wasi/random/insecure/insecure.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecure represents the imported interface "wasi:random/insecure@0.2.0". package insecure diff --git a/examples/component/http-server/gen/wasi/random/random/empty.s b/examples/component/http-server/gen/wasi/random/random/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/random/random/random.wasm.go b/examples/component/http-server/gen/wasi/random/random/random.wasm.go old mode 100755 new mode 100644 index 9096457b..0bbdd1aa --- a/examples/component/http-server/gen/wasi/random/random/random.wasm.go +++ b/examples/component/http-server/gen/wasi/random/random/random.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package random diff --git a/examples/component/http-server/gen/wasi/random/random/random.wit.go b/examples/component/http-server/gen/wasi/random/random/random.wit.go old mode 100755 new mode 100644 index 98bb7779..600913ad --- a/examples/component/http-server/gen/wasi/random/random/random.wit.go +++ b/examples/component/http-server/gen/wasi/random/random/random.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package random represents the imported interface "wasi:random/random@0.2.0". package random diff --git a/examples/component/http-server/gen/wasi/sockets/instance-network/empty.s b/examples/component/http-server/gen/wasi/sockets/instance-network/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/sockets/instance-network/instancenetwork.wasm.go b/examples/component/http-server/gen/wasi/sockets/instance-network/instance-network.wasm.go old mode 100755 new mode 100644 similarity index 81% rename from component/gen/wasi/sockets/instance-network/instancenetwork.wasm.go rename to examples/component/http-server/gen/wasi/sockets/instance-network/instance-network.wasm.go index eb113e21..aca75114 --- a/component/gen/wasi/sockets/instance-network/instancenetwork.wasm.go +++ b/examples/component/http-server/gen/wasi/sockets/instance-network/instance-network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package instancenetwork diff --git a/examples/component/http-server/gen/wasi/sockets/instance-network/instance-network.wit.go b/examples/component/http-server/gen/wasi/sockets/instance-network/instance-network.wit.go old mode 100755 new mode 100644 index 3c126a50..7eea64fd --- a/examples/component/http-server/gen/wasi/sockets/instance-network/instance-network.wit.go +++ b/examples/component/http-server/gen/wasi/sockets/instance-network/instance-network.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package instancenetwork represents the imported interface "wasi:sockets/instance-network@0.2.0". package instancenetwork diff --git a/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/abi.go b/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/abi.go old mode 100755 new mode 100644 index a63f0d01..5d8d473a --- a/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/abi.go +++ b/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup diff --git a/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/empty.s b/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go b/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go old mode 100755 new mode 100644 similarity index 94% rename from examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go rename to examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go index da5fb000..d895d45f --- a/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go +++ b/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup diff --git a/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go b/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go old mode 100755 new mode 100644 index e446da73..d43b9f56 --- a/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go +++ b/examples/component/http-server/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ipnamelookup represents the imported interface "wasi:sockets/ip-name-lookup@0.2.0". package ipnamelookup diff --git a/examples/component/http-server/gen/wasi/sockets/network/abi.go b/examples/component/http-server/gen/wasi/sockets/network/abi.go old mode 100755 new mode 100644 index a088bd1d..67f17115 --- a/examples/component/http-server/gen/wasi/sockets/network/abi.go +++ b/examples/component/http-server/gen/wasi/sockets/network/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network diff --git a/examples/component/http-server/gen/wasi/sockets/network/empty.s b/examples/component/http-server/gen/wasi/sockets/network/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/sockets/network/network.wasm.go b/examples/component/http-server/gen/wasi/sockets/network/network.wasm.go old mode 100755 new mode 100644 index 012a79ff..23f02bdd --- a/examples/component/http-server/gen/wasi/sockets/network/network.wasm.go +++ b/examples/component/http-server/gen/wasi/sockets/network/network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network diff --git a/examples/component/http-server/gen/wasi/sockets/network/network.wit.go b/examples/component/http-server/gen/wasi/sockets/network/network.wit.go old mode 100755 new mode 100644 index f0fb7eef..3b3d1768 --- a/examples/component/http-server/gen/wasi/sockets/network/network.wit.go +++ b/examples/component/http-server/gen/wasi/sockets/network/network.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package network represents the imported interface "wasi:sockets/network@0.2.0". package network @@ -74,7 +74,7 @@ const ( ErrorCodePermanentResolverFailure ) -var stringsErrorCode = [21]string{ +var _ErrorCodeStrings = [21]string{ "unknown", "access-denied", "not-supported", @@ -100,9 +100,22 @@ var stringsErrorCode = [21]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // IPAddressFamily represents the enum "wasi:sockets/network@0.2.0#ip-address-family". // // enum ip-address-family { @@ -116,16 +129,29 @@ const ( IPAddressFamilyIPv6 ) -var stringsIPAddressFamily = [2]string{ +var _IPAddressFamilyStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the enum case name of e. func (e IPAddressFamily) String() string { - return stringsIPAddressFamily[e] + return _IPAddressFamilyStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e IPAddressFamily) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *IPAddressFamily) UnmarshalText(text []byte) error { + return _IPAddressFamilyUnmarshalCase(e, text) +} + +var _IPAddressFamilyUnmarshalCase = cm.CaseUnmarshaler[IPAddressFamily](_IPAddressFamilyStrings[:]) + // IPv4Address represents the tuple "wasi:sockets/network@0.2.0#ipv4-address". // // type ipv4-address = tuple @@ -164,14 +190,14 @@ func (self *IPAddress) IPv6() *IPv6Address { return cm.Case[IPv6Address](self, 1) } -var stringsIPAddress = [2]string{ +var _IPAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPAddress) String() string { - return stringsIPAddress[v.Tag()] + return _IPAddressStrings[v.Tag()] } // IPv4SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv4-socket-address". @@ -181,9 +207,9 @@ func (v IPAddress) String() string { // address: ipv4-address, // } type IPv4SocketAddress struct { - _ cm.HostLayout - Port uint16 - Address IPv4Address + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + Address IPv4Address `json:"address"` } // IPv6SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv6-socket-address". @@ -195,11 +221,11 @@ type IPv4SocketAddress struct { // scope-id: u32, // } type IPv6SocketAddress struct { - _ cm.HostLayout - Port uint16 - FlowInfo uint32 - Address IPv6Address - ScopeID uint32 + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + FlowInfo uint32 `json:"flow-info"` + Address IPv6Address `json:"address"` + ScopeID uint32 `json:"scope-id"` } // IPSocketAddress represents the variant "wasi:sockets/network@0.2.0#ip-socket-address". @@ -230,12 +256,12 @@ func (self *IPSocketAddress) IPv6() *IPv6SocketAddress { return cm.Case[IPv6SocketAddress](self, 1) } -var stringsIPSocketAddress = [2]string{ +var _IPSocketAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPSocketAddress) String() string { - return stringsIPSocketAddress[v.Tag()] + return _IPSocketAddressStrings[v.Tag()] } diff --git a/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/empty.s b/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go b/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go old mode 100755 new mode 100644 similarity index 85% rename from examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go rename to examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go index b7b43155..dc473c1b --- a/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go +++ b/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcpcreatesocket diff --git a/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go b/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go old mode 100755 new mode 100644 index fd65d0f0..dbe2e1e2 --- a/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go +++ b/examples/component/http-server/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcpcreatesocket represents the imported interface "wasi:sockets/tcp-create-socket@0.2.0". package tcpcreatesocket diff --git a/examples/component/http-server/gen/wasi/sockets/tcp/abi.go b/examples/component/http-server/gen/wasi/sockets/tcp/abi.go old mode 100755 new mode 100644 index 16eda7fd..5f7de2fe --- a/examples/component/http-server/gen/wasi/sockets/tcp/abi.go +++ b/examples/component/http-server/gen/wasi/sockets/tcp/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp @@ -23,7 +23,7 @@ type TupleInputStreamOutputStreamShape struct { // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/http-server/gen/wasi/sockets/tcp/empty.s b/examples/component/http-server/gen/wasi/sockets/tcp/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wasm.go b/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wasm.go old mode 100755 new mode 100644 index 56247525..3da96a47 --- a/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wasm.go +++ b/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp @@ -46,7 +46,7 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32, //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-enabled //go:noescape -func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool, bool, ErrorCode]) +func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[ErrorCode, bool, ErrorCode]) //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-idle-time //go:noescape diff --git a/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wit.go b/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wit.go old mode 100755 new mode 100644 index 9b3ef629..a3ce6317 --- a/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wit.go +++ b/examples/component/http-server/gen/wasi/sockets/tcp/tcp.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcp represents the imported interface "wasi:sockets/tcp@0.2.0". package tcp @@ -66,7 +66,7 @@ const ( ShutdownTypeBoth ) -var stringsShutdownType = [3]string{ +var _ShutdownTypeStrings = [3]string{ "receive", "send", "both", @@ -74,9 +74,22 @@ var stringsShutdownType = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ShutdownType) String() string { - return stringsShutdownType[e] + return _ShutdownTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ShutdownType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ShutdownType) UnmarshalText(text []byte) error { + return _ShutdownTypeUnmarshalCase(e, text) +} + +var _ShutdownTypeUnmarshalCase = cm.CaseUnmarshaler[ShutdownType](_ShutdownTypeStrings[:]) + // TCPSocket represents the imported resource "wasi:sockets/tcp@0.2.0#tcp-socket". // // resource tcp-socket @@ -188,7 +201,7 @@ func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCo // keep-alive-enabled: func() -> result // //go:nosplit -func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) { +func (self TCPSocket) KeepAliveEnabled() (result cm.Result[ErrorCode, bool, ErrorCode]) { self0 := cm.Reinterpret[uint32](self) wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result) return diff --git a/examples/component/http-server/gen/wasi/sockets/udp-create-socket/empty.s b/examples/component/http-server/gen/wasi/sockets/udp-create-socket/empty.s old mode 100755 new mode 100644 diff --git a/component/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go b/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go old mode 100755 new mode 100644 similarity index 85% rename from component/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go rename to examples/component/http-server/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go index 94b1ab67..2318cd58 --- a/component/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go +++ b/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udpcreatesocket diff --git a/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go b/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go old mode 100755 new mode 100644 index fc351ff3..d6dfccfe --- a/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go +++ b/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udpcreatesocket represents the imported interface "wasi:sockets/udp-create-socket@0.2.0". package udpcreatesocket diff --git a/examples/component/http-server/gen/wasi/sockets/udp/abi.go b/examples/component/http-server/gen/wasi/sockets/udp/abi.go old mode 100755 new mode 100644 index e340f347..978fa031 --- a/examples/component/http-server/gen/wasi/sockets/udp/abi.go +++ b/examples/component/http-server/gen/wasi/sockets/udp/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp @@ -11,7 +11,7 @@ import ( // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/http-server/gen/wasi/sockets/udp/empty.s b/examples/component/http-server/gen/wasi/sockets/udp/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasi/sockets/udp/udp.wasm.go b/examples/component/http-server/gen/wasi/sockets/udp/udp.wasm.go old mode 100755 new mode 100644 index 83ce8ca7..b9204765 --- a/examples/component/http-server/gen/wasi/sockets/udp/udp.wasm.go +++ b/examples/component/http-server/gen/wasi/sockets/udp/udp.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp diff --git a/examples/component/http-server/gen/wasi/sockets/udp/udp.wit.go b/examples/component/http-server/gen/wasi/sockets/udp/udp.wit.go old mode 100755 new mode 100644 index ecb44be0..8928b269 --- a/examples/component/http-server/gen/wasi/sockets/udp/udp.wit.go +++ b/examples/component/http-server/gen/wasi/sockets/udp/udp.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udp represents the imported interface "wasi:sockets/udp@0.2.0". package udp @@ -41,9 +41,9 @@ type IPAddressFamily = network.IPAddressFamily // remote-address: ip-socket-address, // } type IncomingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress IPSocketAddress + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress IPSocketAddress `json:"remote-address"` } // OutgoingDatagram represents the record "wasi:sockets/udp@0.2.0#outgoing-datagram". @@ -53,9 +53,9 @@ type IncomingDatagram struct { // remote-address: option, // } type OutgoingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress cm.Option[IPSocketAddress] + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress cm.Option[IPSocketAddress] `json:"remote-address"` } // UDPSocket represents the imported resource "wasi:sockets/udp@0.2.0#udp-socket". diff --git a/examples/component/http-server/gen/wasmcloud/bus/lattice/empty.s b/examples/component/http-server/gen/wasmcloud/bus/lattice/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wasm.go b/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wasm.go old mode 100755 new mode 100644 index 7c7b9094..a7e9df88 --- a/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wasm.go +++ b/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package lattice diff --git a/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wit.go b/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wit.go old mode 100755 new mode 100644 index ba34d30c..38324335 --- a/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wit.go +++ b/examples/component/http-server/gen/wasmcloud/bus/lattice/lattice.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package lattice represents the imported interface "wasmcloud:bus/lattice@1.0.0". package lattice diff --git a/examples/component/http-server/gen/wasmcloud/secrets/reveal/empty.s b/examples/component/http-server/gen/wasmcloud/secrets/reveal/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wasm.go b/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wasm.go old mode 100755 new mode 100644 index 65404eb3..2bd8c561 --- a/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wasm.go +++ b/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package reveal diff --git a/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wit.go b/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wit.go old mode 100755 new mode 100644 index a588f52d..c69b3f98 --- a/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wit.go +++ b/examples/component/http-server/gen/wasmcloud/secrets/reveal/reveal.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package reveal represents the imported interface "wasmcloud:secrets/reveal@0.1.0-draft". package reveal diff --git a/examples/component/http-server/gen/wasmcloud/secrets/store/abi.go b/examples/component/http-server/gen/wasmcloud/secrets/store/abi.go old mode 100755 new mode 100644 index 20affd6c..ea41541d --- a/examples/component/http-server/gen/wasmcloud/secrets/store/abi.go +++ b/examples/component/http-server/gen/wasmcloud/secrets/store/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store diff --git a/examples/component/http-server/gen/wasmcloud/secrets/store/empty.s b/examples/component/http-server/gen/wasmcloud/secrets/store/empty.s old mode 100755 new mode 100644 diff --git a/examples/component/http-server/gen/wasmcloud/secrets/store/store.wasm.go b/examples/component/http-server/gen/wasmcloud/secrets/store/store.wasm.go old mode 100755 new mode 100644 index cc94c517..c2e9413a --- a/examples/component/http-server/gen/wasmcloud/secrets/store/store.wasm.go +++ b/examples/component/http-server/gen/wasmcloud/secrets/store/store.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store diff --git a/examples/component/http-server/gen/wasmcloud/secrets/store/store.wit.go b/examples/component/http-server/gen/wasmcloud/secrets/store/store.wit.go old mode 100755 new mode 100644 index d3465e4f..ddedcfc8 --- a/examples/component/http-server/gen/wasmcloud/secrets/store/store.wit.go +++ b/examples/component/http-server/gen/wasmcloud/secrets/store/store.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package store represents the imported interface "wasmcloud:secrets/store@0.1.0-draft". package store @@ -47,7 +47,7 @@ func (self *SecretsError) NotFound() bool { return self.Tag() == 2 } -var stringsSecretsError = [3]string{ +var _SecretsErrorStrings = [3]string{ "upstream", "io", "not-found", @@ -55,7 +55,7 @@ var stringsSecretsError = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretsError) String() string { - return stringsSecretsError[v.Tag()] + return _SecretsErrorStrings[v.Tag()] } // SecretValue represents the variant "wasmcloud:secrets/store@0.1.0-draft#secret-value". @@ -64,7 +64,7 @@ func (v SecretsError) String() string { // %string(string), // bytes(list), // } -type SecretValue cm.Variant[uint8, string, cm.List[uint8]] +type SecretValue cm.Variant[uint8, string, string] // SecretValueString_ returns a [SecretValue] of case "string". func SecretValueString_(data string) SecretValue { @@ -86,14 +86,14 @@ func (self *SecretValue) Bytes() *cm.List[uint8] { return cm.Case[cm.List[uint8]](self, 1) } -var stringsSecretValue = [2]string{ +var _SecretValueStrings = [2]string{ "string", "bytes", } // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretValue) String() string { - return stringsSecretValue[v.Tag()] + return _SecretValueStrings[v.Tag()] } // Secret represents the imported resource "wasmcloud:secrets/store@0.1.0-draft#secret". diff --git a/examples/component/http-server/go.mod b/examples/component/http-server/go.mod index 76c2a3d0..562bc53b 100644 --- a/examples/component/http-server/go.mod +++ b/examples/component/http-server/go.mod @@ -4,12 +4,15 @@ go 1.24 require ( github.com/stretchr/testify v1.10.0 - go.bytecodealliance.org/cm v0.1.0 + go.bytecodealliance.org/cm v0.2.2 go.wasmcloud.dev/component v0.0.6 go.wasmcloud.dev/wadge v0.7.0 ) -require go.bytecodealliance.org v0.5.0 // indirect +require ( + github.com/tetratelabs/wazero v1.9.0 // indirect + go.bytecodealliance.org v0.6.2 // indirect +) require ( github.com/bytecodealliance/wasm-tools-go v0.3.2 // indirect @@ -20,17 +23,17 @@ require ( github.com/klauspost/compress v1.17.11 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/regclient/regclient v0.8.0 // indirect + github.com/regclient/regclient v0.8.2 // indirect github.com/samber/lo v1.49.1 // indirect github.com/samber/slog-common v0.18.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/urfave/cli/v3 v3.0.0-beta1 // indirect - golang.org/x/mod v0.22.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.29.0 // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect golang.org/x/text v0.21.0 // indirect - golang.org/x/tools v0.29.0 // indirect + golang.org/x/tools v0.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -38,6 +41,6 @@ require ( replace go.wasmcloud.dev/component => ../../../component tool ( - go.bytecodealliance.org/cmd/wit-bindgen-go + go.wasmcloud.dev/component/wit-bindgen go.wasmcloud.dev/wadge/cmd/wadge-bindgen-go ) diff --git a/examples/component/http-server/go.sum b/examples/component/http-server/go.sum index 3162ff1c..39d07fea 100644 --- a/examples/component/http-server/go.sum +++ b/examples/component/http-server/go.sum @@ -23,8 +23,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/regclient/regclient v0.8.0 h1:xNAMDlADcyMvFAlGXoqDOxlSUBG4mqWBFgjQqVTP8Og= -github.com/regclient/regclient v0.8.0/go.mod h1:h9+Y6dBvqBkdlrj6EIhbTOv0xUuIFl7CdI1bZvEB42g= +github.com/regclient/regclient v0.8.2 h1:23BQ3jWgKYHHIXUhp/S9laVJDHDoOQaQCzXMJ4undVE= +github.com/regclient/regclient v0.8.2/go.mod h1:uGyetv0o6VLyRDjtfeBqp/QBwRLJ3Hcn07/+8QbhNcM= github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew= github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o= github.com/samber/slog-common v0.18.1 h1:c0EipD/nVY9HG5shgm/XAs67mgpWDMF+MmtptdJNCkQ= @@ -37,27 +37,29 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= +github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg= github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y= -go.bytecodealliance.org v0.5.0 h1:ywhCpF0JdqGkqct5JqSY1Me8lz001UIJXUaCSS32cew= -go.bytecodealliance.org v0.5.0/go.mod h1:8kYTSxmQr8DU3dKOKCOHH1Ap1gWX/61qlFSbIuIno2Q= -go.bytecodealliance.org/cm v0.1.0 h1:78Rk4d5rgir5Hm+LMFpDWhjmFBWrKDFPSKUwDBj+nwo= -go.bytecodealliance.org/cm v0.1.0/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= +go.bytecodealliance.org v0.6.2 h1:Jy4u5DVmSkXgsnwojBhJ+AD/YsJsR3VzVnxF0xRCqTQ= +go.bytecodealliance.org v0.6.2/go.mod h1:gqjTJm0y9NSksG4py/lSjIQ/SNuIlOQ+hCIEPQwtJgA= +go.bytecodealliance.org/cm v0.2.2 h1:M9iHS6qs884mbQbIjtLX1OifgyPG9DuMs2iwz8G4WQA= +go.bytecodealliance.org/cm v0.2.2/go.mod h1:JD5vtVNZv7sBoQQkvBvAAVKJPhR/bqBH7yYXTItMfZI= go.wasmcloud.dev/wadge v0.7.0 h1:eUt0jODh6xQ5HEof1PFSgDp+evrNs+lD1LYCYeRR2Cg= go.wasmcloud.dev/wadge v0.7.0/go.mod h1:SMnPSWZFTkXyUX0GJ11mcdc7ZoMITtbAlPLlpvGJd4M= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= -golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/examples/component/http-server/main.go b/examples/component/http-server/main.go index df9b5b12..f707a735 100644 --- a/examples/component/http-server/main.go +++ b/examples/component/http-server/main.go @@ -1,4 +1,4 @@ -//go:generate go tool wit-bindgen-go generate --world example --out gen ./wit +//go:generate go tool wit-bindgen --cm go.bytecodealliance.org/cm --world example --out gen ./wit package main diff --git a/examples/component/invoke/bindings.wadge_test.go b/examples/component/invoke/bindings.wadge_test.go index 780343f2..3e73b1e8 100644 --- a/examples/component/invoke/bindings.wadge_test.go +++ b/examples/component/invoke/bindings.wadge_test.go @@ -5,6 +5,7 @@ package main_test import ( + go_wasmcloud_dev__component__cm "go.wasmcloud.dev/component/cm" wadge "go.wasmcloud.dev/wadge" "runtime" "unsafe" @@ -14,7 +15,43 @@ const _ string = runtime.Compiler var _ unsafe.Pointer -//go:linkname wasmimport_Log go.wasmcloud.dev/component/gen/wasi/logging/logging.wasmimport_Log +//go:linkname wasmimport_errorContextDebugMessage go.wasmcloud.dev/component/cm.wasmimport_errorContextDebugMessage +func wasmimport_errorContextDebugMessage(err go_wasmcloud_dev__component__cm.errorContext, msg unsafe.Pointer) { + var __p runtime.Pinner + defer __p.Unpin() + if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { + return __instance.Call("canon", "error-context.debug-message", func() unsafe.Pointer { + ptr := unsafe.Pointer(&err) + __p.Pin(ptr) + return ptr + }(), func() unsafe.Pointer { + ptr := unsafe.Pointer(&msg) + __p.Pin(ptr) + return ptr + }()) + }); __err != nil { + wadge.CurrentErrorHandler()(__err) + } + return +} + +//go:linkname wasmimport_errorContextDrop go.wasmcloud.dev/component/cm.wasmimport_errorContextDrop +func wasmimport_errorContextDrop(err go_wasmcloud_dev__component__cm.errorContext) { + var __p runtime.Pinner + defer __p.Unpin() + if __err := wadge.WithCurrentInstance(func(__instance *wadge.Instance) error { + return __instance.Call("canon", "error-context.drop", func() unsafe.Pointer { + ptr := unsafe.Pointer(&err) + __p.Pin(ptr) + return ptr + }()) + }); __err != nil { + wadge.CurrentErrorHandler()(__err) + } + return +} + +//go:linkname wasmimport_Log go.wasmcloud.dev/component/internal/gen/wasi/logging/logging.wasmimport_Log func wasmimport_Log(level0 uint32, context0 *uint8, context1 uint32, message0 *uint8, message1 uint32) { var __p runtime.Pinner defer __p.Unpin() diff --git a/examples/component/invoke/gen/example/invoker/example/example.wit.go b/examples/component/invoke/gen/example/invoker/example/example.wit.go index 292720f1..43bdda39 100644 --- a/examples/component/invoke/gen/example/invoker/example/example.wit.go +++ b/examples/component/invoke/gen/example/invoker/example/example.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package example represents the world "example:invoker/example". package example diff --git a/examples/component/invoke/gen/example/invoker/invoker/invoker.exports.go b/examples/component/invoke/gen/example/invoker/invoker/invoker.exports.go index a7000266..220e98ee 100644 --- a/examples/component/invoke/gen/example/invoker/invoker/invoker.exports.go +++ b/examples/component/invoke/gen/example/invoker/invoker/invoker.exports.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package invoker diff --git a/examples/component/invoke/gen/example/invoker/invoker/invoker.wasm.go b/examples/component/invoke/gen/example/invoker/invoker/invoker.wasm.go index ada6c4c9..e04e15da 100755 --- a/examples/component/invoke/gen/example/invoker/invoker/invoker.wasm.go +++ b/examples/component/invoke/gen/example/invoker/invoker/invoker.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package invoker diff --git a/examples/component/invoke/gen/example/invoker/invoker/invoker.wit.go b/examples/component/invoke/gen/example/invoker/invoker/invoker.wit.go index 304d5ed7..2d54ae31 100644 --- a/examples/component/invoke/gen/example/invoker/invoker/invoker.wit.go +++ b/examples/component/invoke/gen/example/invoker/invoker/invoker.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package invoker represents the exported interface "example:invoker/invoker". package invoker diff --git a/examples/component/invoke/gen/wasi/cli/environment/environment.wasm.go b/examples/component/invoke/gen/wasi/cli/environment/environment.wasm.go index 89bb596b..4f63e76c 100755 --- a/examples/component/invoke/gen/wasi/cli/environment/environment.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/environment/environment.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package environment diff --git a/examples/component/invoke/gen/wasi/cli/environment/environment.wit.go b/examples/component/invoke/gen/wasi/cli/environment/environment.wit.go index 068bed33..b793cb1e 100644 --- a/examples/component/invoke/gen/wasi/cli/environment/environment.wit.go +++ b/examples/component/invoke/gen/wasi/cli/environment/environment.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package environment represents the imported interface "wasi:cli/environment@0.2.0". package environment diff --git a/examples/component/invoke/gen/wasi/cli/exit/exit.wasm.go b/examples/component/invoke/gen/wasi/cli/exit/exit.wasm.go index 849d5f50..eb875244 100755 --- a/examples/component/invoke/gen/wasi/cli/exit/exit.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/exit/exit.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package exit diff --git a/examples/component/invoke/gen/wasi/cli/exit/exit.wit.go b/examples/component/invoke/gen/wasi/cli/exit/exit.wit.go index 7a347b60..3ca7f56b 100644 --- a/examples/component/invoke/gen/wasi/cli/exit/exit.wit.go +++ b/examples/component/invoke/gen/wasi/cli/exit/exit.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package exit represents the imported interface "wasi:cli/exit@0.2.0". package exit diff --git a/examples/component/invoke/gen/wasi/cli/stderr/stderr.wasm.go b/examples/component/invoke/gen/wasi/cli/stderr/stderr.wasm.go index 462cf172..4f71e47a 100755 --- a/examples/component/invoke/gen/wasi/cli/stderr/stderr.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/stderr/stderr.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stderr diff --git a/examples/component/invoke/gen/wasi/cli/stderr/stderr.wit.go b/examples/component/invoke/gen/wasi/cli/stderr/stderr.wit.go index 521ede56..731f357b 100644 --- a/examples/component/invoke/gen/wasi/cli/stderr/stderr.wit.go +++ b/examples/component/invoke/gen/wasi/cli/stderr/stderr.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stderr represents the imported interface "wasi:cli/stderr@0.2.0". package stderr diff --git a/examples/component/invoke/gen/wasi/cli/stdin/stdin.wasm.go b/examples/component/invoke/gen/wasi/cli/stdin/stdin.wasm.go index 374eb253..e23cbf3d 100755 --- a/examples/component/invoke/gen/wasi/cli/stdin/stdin.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/stdin/stdin.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdin diff --git a/examples/component/invoke/gen/wasi/cli/stdin/stdin.wit.go b/examples/component/invoke/gen/wasi/cli/stdin/stdin.wit.go index 5879e407..271f1c19 100644 --- a/examples/component/invoke/gen/wasi/cli/stdin/stdin.wit.go +++ b/examples/component/invoke/gen/wasi/cli/stdin/stdin.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdin represents the imported interface "wasi:cli/stdin@0.2.0". package stdin diff --git a/examples/component/invoke/gen/wasi/cli/stdout/stdout.wasm.go b/examples/component/invoke/gen/wasi/cli/stdout/stdout.wasm.go index 68e4a3da..c184dcca 100755 --- a/examples/component/invoke/gen/wasi/cli/stdout/stdout.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/stdout/stdout.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdout diff --git a/examples/component/invoke/gen/wasi/cli/stdout/stdout.wit.go b/examples/component/invoke/gen/wasi/cli/stdout/stdout.wit.go index 3cb97304..dd479382 100644 --- a/examples/component/invoke/gen/wasi/cli/stdout/stdout.wit.go +++ b/examples/component/invoke/gen/wasi/cli/stdout/stdout.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdout represents the imported interface "wasi:cli/stdout@0.2.0". package stdout diff --git a/examples/component/invoke/gen/wasi/cli/terminal-input/terminal-input.wasm.go b/examples/component/invoke/gen/wasi/cli/terminal-input/terminal-input.wasm.go new file mode 100644 index 00000000..d1271efa --- /dev/null +++ b/examples/component/invoke/gen/wasi/cli/terminal-input/terminal-input.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalinput + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-input@0.2.0 [resource-drop]terminal-input +//go:noescape +func wasmimport_TerminalInputResourceDrop(self0 uint32) diff --git a/examples/component/invoke/gen/wasi/cli/terminal-input/terminal-input.wit.go b/examples/component/invoke/gen/wasi/cli/terminal-input/terminal-input.wit.go index 18b9a9d7..2d1034ab 100644 --- a/examples/component/invoke/gen/wasi/cli/terminal-input/terminal-input.wit.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-input/terminal-input.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalinput represents the imported interface "wasi:cli/terminal-input@0.2.0". package terminalinput diff --git a/examples/component/invoke/gen/wasi/cli/terminal-output/terminal-output.wasm.go b/examples/component/invoke/gen/wasi/cli/terminal-output/terminal-output.wasm.go new file mode 100644 index 00000000..e2b1717c --- /dev/null +++ b/examples/component/invoke/gen/wasi/cli/terminal-output/terminal-output.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminaloutput + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-output@0.2.0 [resource-drop]terminal-output +//go:noescape +func wasmimport_TerminalOutputResourceDrop(self0 uint32) diff --git a/examples/component/invoke/gen/wasi/cli/terminal-output/terminal-output.wit.go b/examples/component/invoke/gen/wasi/cli/terminal-output/terminal-output.wit.go index 823aaf52..55f0400f 100644 --- a/examples/component/invoke/gen/wasi/cli/terminal-output/terminal-output.wit.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-output/terminal-output.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminaloutput represents the imported interface "wasi:cli/terminal-output@0.2.0". package terminaloutput diff --git a/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go b/examples/component/invoke/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go old mode 100755 new mode 100644 similarity index 84% rename from examples/component/http-client/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go rename to examples/component/invoke/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go index be9af72f..86c0791e --- a/examples/component/http-client/gen/wasi/cli/terminal-stderr/terminalstderr.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstderr diff --git a/examples/component/invoke/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go b/examples/component/invoke/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go index d5eabbf9..5e4c6d7a 100644 --- a/examples/component/invoke/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstderr represents the imported interface "wasi:cli/terminal-stderr@0.2.0". package terminalstderr diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go b/examples/component/invoke/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go old mode 100755 new mode 100644 similarity index 83% rename from examples/component/http-server/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go rename to examples/component/invoke/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go index e3b3ac61..3f657f5b --- a/examples/component/http-server/gen/wasi/cli/terminal-stdin/terminalstdin.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstdin diff --git a/examples/component/invoke/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go b/examples/component/invoke/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go index 258b405a..14cbc365 100644 --- a/examples/component/invoke/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdin represents the imported interface "wasi:cli/terminal-stdin@0.2.0". package terminalstdin diff --git a/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go b/examples/component/invoke/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go old mode 100755 new mode 100644 similarity index 84% rename from examples/component/http-server/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go rename to examples/component/invoke/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go index fa750ad9..705fcf9d --- a/examples/component/http-server/gen/wasi/cli/terminal-stdout/terminalstdout.wasm.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package terminalstdout diff --git a/examples/component/invoke/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go b/examples/component/invoke/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go index a5d9d223..50fc5b62 100644 --- a/examples/component/invoke/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go +++ b/examples/component/invoke/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdout represents the imported interface "wasi:cli/terminal-stdout@0.2.0". package terminalstdout diff --git a/examples/component/invoke/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go b/examples/component/invoke/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go new file mode 100644 index 00000000..aae90f4a --- /dev/null +++ b/examples/component/invoke/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go @@ -0,0 +1,21 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package monotonicclock + +// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0". + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 now +//go:noescape +func wasmimport_Now() (result0 uint64) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 resolution +//go:noescape +func wasmimport_Resolution() (result0 uint64) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-instant +//go:noescape +func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-duration +//go:noescape +func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32) diff --git a/examples/component/invoke/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go b/examples/component/invoke/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go index 12670de0..43aba910 100644 --- a/examples/component/invoke/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go +++ b/examples/component/invoke/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package monotonicclock represents the imported interface "wasi:clocks/monotonic-clock@0.2.0". package monotonicclock diff --git a/examples/component/invoke/gen/wasi/clocks/wall-clock/wall-clock.wasm.go b/examples/component/invoke/gen/wasi/clocks/wall-clock/wall-clock.wasm.go new file mode 100644 index 00000000..662ea1e5 --- /dev/null +++ b/examples/component/invoke/gen/wasi/clocks/wall-clock/wall-clock.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package wallclock + +// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0". + +//go:wasmimport wasi:clocks/wall-clock@0.2.0 now +//go:noescape +func wasmimport_Now(result *DateTime) + +//go:wasmimport wasi:clocks/wall-clock@0.2.0 resolution +//go:noescape +func wasmimport_Resolution(result *DateTime) diff --git a/examples/component/invoke/gen/wasi/clocks/wall-clock/wall-clock.wit.go b/examples/component/invoke/gen/wasi/clocks/wall-clock/wall-clock.wit.go index e3f35395..752ffdd9 100644 --- a/examples/component/invoke/gen/wasi/clocks/wall-clock/wall-clock.wit.go +++ b/examples/component/invoke/gen/wasi/clocks/wall-clock/wall-clock.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package wallclock represents the imported interface "wasi:clocks/wall-clock@0.2.0". package wallclock @@ -14,9 +14,9 @@ import ( // nanoseconds: u32, // } type DateTime struct { - _ cm.HostLayout - Seconds uint64 - Nanoseconds uint32 + _ cm.HostLayout `json:"-"` + Seconds uint64 `json:"seconds"` + Nanoseconds uint32 `json:"nanoseconds"` } // Now represents the imported function "now". diff --git a/examples/component/invoke/gen/wasi/config/runtime/abi.go b/examples/component/invoke/gen/wasi/config/runtime/abi.go index 61412cbe..45139366 100644 --- a/examples/component/invoke/gen/wasi/config/runtime/abi.go +++ b/examples/component/invoke/gen/wasi/config/runtime/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime diff --git a/examples/component/invoke/gen/wasi/config/runtime/runtime.wasm.go b/examples/component/invoke/gen/wasi/config/runtime/runtime.wasm.go index 8ce17d5e..bf6a60c6 100755 --- a/examples/component/invoke/gen/wasi/config/runtime/runtime.wasm.go +++ b/examples/component/invoke/gen/wasi/config/runtime/runtime.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime diff --git a/examples/component/invoke/gen/wasi/config/runtime/runtime.wit.go b/examples/component/invoke/gen/wasi/config/runtime/runtime.wit.go index 99a739d1..4de65a40 100644 --- a/examples/component/invoke/gen/wasi/config/runtime/runtime.wit.go +++ b/examples/component/invoke/gen/wasi/config/runtime/runtime.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package runtime represents the imported interface "wasi:config/runtime@0.2.0-draft". package runtime @@ -35,14 +35,14 @@ func (self *ConfigError) IO() *string { return cm.Case[string](self, 1) } -var stringsConfigError = [2]string{ +var _ConfigErrorStrings = [2]string{ "upstream", "io", } // String implements [fmt.Stringer], returning the variant case name of v. func (v ConfigError) String() string { - return stringsConfigError[v.Tag()] + return _ConfigErrorStrings[v.Tag()] } // Get represents the imported function "get". diff --git a/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wasm.go b/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wasm.go index 1bcd416a..c95831c0 100755 --- a/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wasm.go +++ b/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package preopens diff --git a/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wit.go b/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wit.go index d21bde16..b9bc97e8 100644 --- a/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wit.go +++ b/examples/component/invoke/gen/wasi/filesystem/preopens/preopens.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package preopens represents the imported interface "wasi:filesystem/preopens@0.2.0". package preopens diff --git a/examples/component/invoke/gen/wasi/filesystem/types/abi.go b/examples/component/invoke/gen/wasi/filesystem/types/abi.go index f7d57cde..8d6f0a86 100644 --- a/examples/component/invoke/gen/wasi/filesystem/types/abi.go +++ b/examples/component/invoke/gen/wasi/filesystem/types/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/invoke/gen/wasi/filesystem/types/types.wasm.go b/examples/component/invoke/gen/wasi/filesystem/types/types.wasm.go index b97dad84..1daa0062 100755 --- a/examples/component/invoke/gen/wasi/filesystem/types/types.wasm.go +++ b/examples/component/invoke/gen/wasi/filesystem/types/types.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/invoke/gen/wasi/filesystem/types/types.wit.go b/examples/component/invoke/gen/wasi/filesystem/types/types.wit.go index d095f471..d5769690 100644 --- a/examples/component/invoke/gen/wasi/filesystem/types/types.wit.go +++ b/examples/component/invoke/gen/wasi/filesystem/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:filesystem/types@0.2.0". package types @@ -59,7 +59,7 @@ const ( DescriptorTypeSocket ) -var stringsDescriptorType = [8]string{ +var _DescriptorTypeStrings = [8]string{ "unknown", "block-device", "character-device", @@ -72,9 +72,22 @@ var stringsDescriptorType = [8]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e DescriptorType) String() string { - return stringsDescriptorType[e] + return _DescriptorTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e DescriptorType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *DescriptorType) UnmarshalText(text []byte) error { + return _DescriptorTypeUnmarshalCase(e, text) +} + +var _DescriptorTypeUnmarshalCase = cm.CaseUnmarshaler[DescriptorType](_DescriptorTypeStrings[:]) + // DescriptorFlags represents the flags "wasi:filesystem/types@0.2.0#descriptor-flags". // // flags descriptor-flags { @@ -140,13 +153,13 @@ type LinkCount uint64 // status-change-timestamp: option, // } type DescriptorStat struct { - _ cm.HostLayout - Type DescriptorType - LinkCount LinkCount - Size FileSize - DataAccessTimestamp cm.Option[DateTime] - DataModificationTimestamp cm.Option[DateTime] - StatusChangeTimestamp cm.Option[DateTime] + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + LinkCount LinkCount `json:"link-count"` + Size FileSize `json:"size"` + DataAccessTimestamp cm.Option[DateTime] `json:"data-access-timestamp"` + DataModificationTimestamp cm.Option[DateTime] `json:"data-modification-timestamp"` + StatusChangeTimestamp cm.Option[DateTime] `json:"status-change-timestamp"` } // NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp". @@ -190,7 +203,7 @@ func (self *NewTimestamp) Timestamp() *DateTime { return cm.Case[DateTime](self, 2) } -var stringsNewTimestamp = [3]string{ +var _NewTimestampStrings = [3]string{ "no-change", "now", "timestamp", @@ -198,7 +211,7 @@ var stringsNewTimestamp = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v NewTimestamp) String() string { - return stringsNewTimestamp[v.Tag()] + return _NewTimestampStrings[v.Tag()] } // DirectoryEntry represents the record "wasi:filesystem/types@0.2.0#directory-entry". @@ -208,9 +221,9 @@ func (v NewTimestamp) String() string { // name: string, // } type DirectoryEntry struct { - _ cm.HostLayout - Type DescriptorType - Name string + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + Name string `json:"name"` } // ErrorCode represents the enum "wasi:filesystem/types@0.2.0#error-code". @@ -296,7 +309,7 @@ const ( ErrorCodeCrossDevice ) -var stringsErrorCode = [37]string{ +var _ErrorCodeStrings = [37]string{ "access", "would-block", "already", @@ -338,9 +351,22 @@ var stringsErrorCode = [37]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // Advice represents the enum "wasi:filesystem/types@0.2.0#advice". // // enum advice { @@ -362,7 +388,7 @@ const ( AdviceNoReuse ) -var stringsAdvice = [6]string{ +var _AdviceStrings = [6]string{ "normal", "sequential", "random", @@ -373,9 +399,22 @@ var stringsAdvice = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Advice) String() string { - return stringsAdvice[e] + return _AdviceStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e Advice) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Advice) UnmarshalText(text []byte) error { + return _AdviceUnmarshalCase(e, text) +} + +var _AdviceUnmarshalCase = cm.CaseUnmarshaler[Advice](_AdviceStrings[:]) + // MetadataHashValue represents the record "wasi:filesystem/types@0.2.0#metadata-hash-value". // // record metadata-hash-value { @@ -383,9 +422,9 @@ func (e Advice) String() string { // upper: u64, // } type MetadataHashValue struct { - _ cm.HostLayout - Lower uint64 - Upper uint64 + _ cm.HostLayout `json:"-"` + Lower uint64 `json:"lower"` + Upper uint64 `json:"upper"` } // Descriptor represents the imported resource "wasi:filesystem/types@0.2.0#descriptor". diff --git a/examples/component/invoke/gen/wasi/http/outgoing-handler/abi.go b/examples/component/invoke/gen/wasi/http/outgoing-handler/abi.go index 3c193143..4fe90d79 100644 --- a/examples/component/invoke/gen/wasi/http/outgoing-handler/abi.go +++ b/examples/component/invoke/gen/wasi/http/outgoing-handler/abi.go @@ -1,9 +1,8 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler import ( - "github.com/wasmCloud/go/examples/component/invoke/gen/wasi/http/types" "go.bytecodealliance.org/cm" "unsafe" ) @@ -11,7 +10,7 @@ import ( // ErrorCodeShape is used for storage in variant or result types. type ErrorCodeShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(types.ErrorCode{})]byte + shape [unsafe.Sizeof(ErrorCode{})]byte } func lower_OptionRequestOptions(v cm.Option[RequestOptions]) (f0 uint32, f1 uint32) { diff --git a/component/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go b/examples/component/invoke/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go old mode 100755 new mode 100644 similarity index 86% rename from component/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go rename to examples/component/invoke/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go index 6b3f3828..754b1aed --- a/component/gen/wasi/http/outgoing-handler/outgoinghandler.wasm.go +++ b/examples/component/invoke/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler diff --git a/examples/component/invoke/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go b/examples/component/invoke/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go index 68550053..5cbf8b1b 100644 --- a/examples/component/invoke/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go +++ b/examples/component/invoke/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package outgoinghandler represents the imported interface "wasi:http/outgoing-handler@0.2.0". package outgoinghandler diff --git a/examples/component/invoke/gen/wasi/http/types/abi.go b/examples/component/invoke/gen/wasi/http/types/abi.go index 6ffb1fdd..05889832 100644 --- a/examples/component/invoke/gen/wasi/http/types/abi.go +++ b/examples/component/invoke/gen/wasi/http/types/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/invoke/gen/wasi/http/types/types.wasm.go b/examples/component/invoke/gen/wasi/http/types/types.wasm.go index b025b2af..5f1a9c66 100755 --- a/examples/component/invoke/gen/wasi/http/types/types.wasm.go +++ b/examples/component/invoke/gen/wasi/http/types/types.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types diff --git a/examples/component/invoke/gen/wasi/http/types/types.wit.go b/examples/component/invoke/gen/wasi/http/types/types.wit.go index 2e1903ea..51a4d23b 100644 --- a/examples/component/invoke/gen/wasi/http/types/types.wit.go +++ b/examples/component/invoke/gen/wasi/http/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:http/types@0.2.0". package types @@ -161,7 +161,7 @@ func (self *Method) Other() *string { return cm.Case[string](self, 9) } -var stringsMethod = [10]string{ +var _MethodStrings = [10]string{ "get", "head", "post", @@ -176,7 +176,7 @@ var stringsMethod = [10]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Method) String() string { - return stringsMethod[v.Tag()] + return _MethodStrings[v.Tag()] } // Scheme represents the variant "wasi:http/types@0.2.0#scheme". @@ -220,7 +220,7 @@ func (self *Scheme) Other() *string { return cm.Case[string](self, 2) } -var stringsScheme = [3]string{ +var _SchemeStrings = [3]string{ "HTTP", "HTTPS", "other", @@ -228,7 +228,7 @@ var stringsScheme = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Scheme) String() string { - return stringsScheme[v.Tag()] + return _SchemeStrings[v.Tag()] } // DNSErrorPayload represents the record "wasi:http/types@0.2.0#DNS-error-payload". @@ -238,9 +238,9 @@ func (v Scheme) String() string { // info-code: option, // } type DNSErrorPayload struct { - _ cm.HostLayout - Rcode cm.Option[string] - InfoCode cm.Option[uint16] + _ cm.HostLayout `json:"-"` + Rcode cm.Option[string] `json:"rcode"` + InfoCode cm.Option[uint16] `json:"info-code"` } // TLSAlertReceivedPayload represents the record "wasi:http/types@0.2.0#TLS-alert-received-payload". @@ -250,9 +250,9 @@ type DNSErrorPayload struct { // alert-message: option, // } type TLSAlertReceivedPayload struct { - _ cm.HostLayout - AlertID cm.Option[uint8] - AlertMessage cm.Option[string] + _ cm.HostLayout `json:"-"` + AlertID cm.Option[uint8] `json:"alert-id"` + AlertMessage cm.Option[string] `json:"alert-message"` } // FieldSizePayload represents the record "wasi:http/types@0.2.0#field-size-payload". @@ -262,9 +262,9 @@ type TLSAlertReceivedPayload struct { // field-size: option, // } type FieldSizePayload struct { - _ cm.HostLayout - FieldName cm.Option[string] - FieldSize cm.Option[uint32] + _ cm.HostLayout `json:"-"` + FieldName cm.Option[string] `json:"field-name"` + FieldSize cm.Option[uint32] `json:"field-size"` } // ErrorCode represents the variant "wasi:http/types@0.2.0#error-code". @@ -726,7 +726,7 @@ func (self *ErrorCode) InternalError() *cm.Option[string] { return cm.Case[cm.Option[string]](self, 38) } -var stringsErrorCode = [39]string{ +var _ErrorCodeStrings = [39]string{ "DNS-timeout", "DNS-error", "destination-not-found", @@ -770,7 +770,7 @@ var stringsErrorCode = [39]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v ErrorCode) String() string { - return stringsErrorCode[v.Tag()] + return _ErrorCodeStrings[v.Tag()] } // HeaderError represents the variant "wasi:http/types@0.2.0#header-error". @@ -788,7 +788,7 @@ const ( HeaderErrorImmutable ) -var stringsHeaderError = [3]string{ +var _HeaderErrorStrings = [3]string{ "invalid-syntax", "forbidden", "immutable", @@ -796,9 +796,22 @@ var stringsHeaderError = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e HeaderError) String() string { - return stringsHeaderError[e] + return _HeaderErrorStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e HeaderError) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *HeaderError) UnmarshalText(text []byte) error { + return _HeaderErrorUnmarshalCase(e, text) +} + +var _HeaderErrorUnmarshalCase = cm.CaseUnmarshaler[HeaderError](_HeaderErrorStrings[:]) + // FieldKey represents the string "wasi:http/types@0.2.0#field-key". // // type field-key = string diff --git a/examples/component/invoke/gen/wasi/io/error/error.wasm.go b/examples/component/invoke/gen/wasi/io/error/error.wasm.go new file mode 100644 index 00000000..eee2750b --- /dev/null +++ b/examples/component/invoke/gen/wasi/io/error/error.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package ioerror + +// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". + +//go:wasmimport wasi:io/error@0.2.0 [resource-drop]error +//go:noescape +func wasmimport_ErrorResourceDrop(self0 uint32) + +//go:wasmimport wasi:io/error@0.2.0 [method]error.to-debug-string +//go:noescape +func wasmimport_ErrorToDebugString(self0 uint32, result *string) diff --git a/examples/component/invoke/gen/wasi/io/error/error.wit.go b/examples/component/invoke/gen/wasi/io/error/error.wit.go index 828e977e..33ec33e6 100644 --- a/examples/component/invoke/gen/wasi/io/error/error.wit.go +++ b/examples/component/invoke/gen/wasi/io/error/error.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ioerror represents the imported interface "wasi:io/error@0.2.0". package ioerror diff --git a/examples/component/invoke/gen/wasi/io/poll/poll.wasm.go b/examples/component/invoke/gen/wasi/io/poll/poll.wasm.go index f7c55c3d..6b2ac35b 100755 --- a/examples/component/invoke/gen/wasi/io/poll/poll.wasm.go +++ b/examples/component/invoke/gen/wasi/io/poll/poll.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package poll diff --git a/examples/component/invoke/gen/wasi/io/poll/poll.wit.go b/examples/component/invoke/gen/wasi/io/poll/poll.wit.go index ad9e9564..32ee50e4 100644 --- a/examples/component/invoke/gen/wasi/io/poll/poll.wit.go +++ b/examples/component/invoke/gen/wasi/io/poll/poll.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package poll represents the imported interface "wasi:io/poll@0.2.0". package poll diff --git a/examples/component/invoke/gen/wasi/io/streams/streams.wasm.go b/examples/component/invoke/gen/wasi/io/streams/streams.wasm.go index eec56645..a6664884 100755 --- a/examples/component/invoke/gen/wasi/io/streams/streams.wasm.go +++ b/examples/component/invoke/gen/wasi/io/streams/streams.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package streams diff --git a/examples/component/invoke/gen/wasi/io/streams/streams.wit.go b/examples/component/invoke/gen/wasi/io/streams/streams.wit.go index ce1cf719..fa1bd583 100644 --- a/examples/component/invoke/gen/wasi/io/streams/streams.wit.go +++ b/examples/component/invoke/gen/wasi/io/streams/streams.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package streams represents the imported interface "wasi:io/streams@0.2.0". package streams @@ -48,14 +48,14 @@ func (self *StreamError) Closed() bool { return self.Tag() == 1 } -var stringsStreamError = [2]string{ +var _StreamErrorStrings = [2]string{ "last-operation-failed", "closed", } // String implements [fmt.Stringer], returning the variant case name of v. func (v StreamError) String() string { - return stringsStreamError[v.Tag()] + return _StreamErrorStrings[v.Tag()] } // InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream". diff --git a/examples/component/invoke/gen/wasi/logging/logging/logging.wasm.go b/examples/component/invoke/gen/wasi/logging/logging/logging.wasm.go index d2d27098..bc430bd6 100755 --- a/examples/component/invoke/gen/wasi/logging/logging/logging.wasm.go +++ b/examples/component/invoke/gen/wasi/logging/logging/logging.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package logging diff --git a/examples/component/invoke/gen/wasi/logging/logging/logging.wit.go b/examples/component/invoke/gen/wasi/logging/logging/logging.wit.go index 96e406ed..58b38a84 100644 --- a/examples/component/invoke/gen/wasi/logging/logging/logging.wit.go +++ b/examples/component/invoke/gen/wasi/logging/logging/logging.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package logging represents the imported interface "wasi:logging/logging@0.1.0-draft". package logging @@ -28,7 +28,7 @@ const ( LevelCritical ) -var stringsLevel = [6]string{ +var _LevelStrings = [6]string{ "trace", "debug", "info", @@ -39,9 +39,22 @@ var stringsLevel = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Level) String() string { - return stringsLevel[e] + return _LevelStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e Level) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Level) UnmarshalText(text []byte) error { + return _LevelUnmarshalCase(e, text) +} + +var _LevelUnmarshalCase = cm.CaseUnmarshaler[Level](_LevelStrings[:]) + // Log represents the imported function "log". // // log: func(level: level, context: string, message: string) diff --git a/examples/component/invoke/gen/wasi/random/insecure-seed/insecure-seed.wasm.go b/examples/component/invoke/gen/wasi/random/insecure-seed/insecure-seed.wasm.go new file mode 100644 index 00000000..2c1d8b4a --- /dev/null +++ b/examples/component/invoke/gen/wasi/random/insecure-seed/insecure-seed.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package insecureseed + +// This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". + +//go:wasmimport wasi:random/insecure-seed@0.2.0 insecure-seed +//go:noescape +func wasmimport_InsecureSeed(result *[2]uint64) diff --git a/examples/component/invoke/gen/wasi/random/insecure-seed/insecure-seed.wit.go b/examples/component/invoke/gen/wasi/random/insecure-seed/insecure-seed.wit.go index e701d1b4..856b2cc7 100644 --- a/examples/component/invoke/gen/wasi/random/insecure-seed/insecure-seed.wit.go +++ b/examples/component/invoke/gen/wasi/random/insecure-seed/insecure-seed.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecureseed represents the imported interface "wasi:random/insecure-seed@0.2.0". package insecureseed diff --git a/examples/component/invoke/gen/wasi/random/insecure/insecure.wasm.go b/examples/component/invoke/gen/wasi/random/insecure/insecure.wasm.go index 498bfe4a..f5c82d7b 100755 --- a/examples/component/invoke/gen/wasi/random/insecure/insecure.wasm.go +++ b/examples/component/invoke/gen/wasi/random/insecure/insecure.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecure diff --git a/examples/component/invoke/gen/wasi/random/insecure/insecure.wit.go b/examples/component/invoke/gen/wasi/random/insecure/insecure.wit.go index f32282c6..c150d4a6 100644 --- a/examples/component/invoke/gen/wasi/random/insecure/insecure.wit.go +++ b/examples/component/invoke/gen/wasi/random/insecure/insecure.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecure represents the imported interface "wasi:random/insecure@0.2.0". package insecure diff --git a/examples/component/invoke/gen/wasi/random/random/random.wasm.go b/examples/component/invoke/gen/wasi/random/random/random.wasm.go index 9096457b..0bbdd1aa 100755 --- a/examples/component/invoke/gen/wasi/random/random/random.wasm.go +++ b/examples/component/invoke/gen/wasi/random/random/random.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package random diff --git a/examples/component/invoke/gen/wasi/random/random/random.wit.go b/examples/component/invoke/gen/wasi/random/random/random.wit.go index 98bb7779..600913ad 100644 --- a/examples/component/invoke/gen/wasi/random/random/random.wit.go +++ b/examples/component/invoke/gen/wasi/random/random/random.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package random represents the imported interface "wasi:random/random@0.2.0". package random diff --git a/examples/component/invoke/gen/wasi/sockets/instance-network/instance-network.wasm.go b/examples/component/invoke/gen/wasi/sockets/instance-network/instance-network.wasm.go new file mode 100644 index 00000000..aca75114 --- /dev/null +++ b/examples/component/invoke/gen/wasi/sockets/instance-network/instance-network.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package instancenetwork + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/instance-network@0.2.0 instance-network +//go:noescape +func wasmimport_InstanceNetwork() (result0 uint32) diff --git a/examples/component/invoke/gen/wasi/sockets/instance-network/instance-network.wit.go b/examples/component/invoke/gen/wasi/sockets/instance-network/instance-network.wit.go index 73529fe3..23e0c604 100644 --- a/examples/component/invoke/gen/wasi/sockets/instance-network/instance-network.wit.go +++ b/examples/component/invoke/gen/wasi/sockets/instance-network/instance-network.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package instancenetwork represents the imported interface "wasi:sockets/instance-network@0.2.0". package instancenetwork diff --git a/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/abi.go b/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/abi.go index a63f0d01..5d8d473a 100644 --- a/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/abi.go +++ b/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup diff --git a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go b/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go old mode 100755 new mode 100644 similarity index 94% rename from examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go rename to examples/component/invoke/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go index da5fb000..d895d45f --- a/examples/component/http-client/gen/wasi/sockets/ip-name-lookup/ipnamelookup.wasm.go +++ b/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup diff --git a/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go b/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go index fb98aba4..6b8136ba 100644 --- a/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go +++ b/examples/component/invoke/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ipnamelookup represents the imported interface "wasi:sockets/ip-name-lookup@0.2.0". package ipnamelookup diff --git a/examples/component/invoke/gen/wasi/sockets/network/abi.go b/examples/component/invoke/gen/wasi/sockets/network/abi.go index a088bd1d..67f17115 100644 --- a/examples/component/invoke/gen/wasi/sockets/network/abi.go +++ b/examples/component/invoke/gen/wasi/sockets/network/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network diff --git a/examples/component/invoke/gen/wasi/sockets/network/network.wasm.go b/examples/component/invoke/gen/wasi/sockets/network/network.wasm.go index 012a79ff..23f02bdd 100755 --- a/examples/component/invoke/gen/wasi/sockets/network/network.wasm.go +++ b/examples/component/invoke/gen/wasi/sockets/network/network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network diff --git a/examples/component/invoke/gen/wasi/sockets/network/network.wit.go b/examples/component/invoke/gen/wasi/sockets/network/network.wit.go index f0fb7eef..3b3d1768 100644 --- a/examples/component/invoke/gen/wasi/sockets/network/network.wit.go +++ b/examples/component/invoke/gen/wasi/sockets/network/network.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package network represents the imported interface "wasi:sockets/network@0.2.0". package network @@ -74,7 +74,7 @@ const ( ErrorCodePermanentResolverFailure ) -var stringsErrorCode = [21]string{ +var _ErrorCodeStrings = [21]string{ "unknown", "access-denied", "not-supported", @@ -100,9 +100,22 @@ var stringsErrorCode = [21]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // IPAddressFamily represents the enum "wasi:sockets/network@0.2.0#ip-address-family". // // enum ip-address-family { @@ -116,16 +129,29 @@ const ( IPAddressFamilyIPv6 ) -var stringsIPAddressFamily = [2]string{ +var _IPAddressFamilyStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the enum case name of e. func (e IPAddressFamily) String() string { - return stringsIPAddressFamily[e] + return _IPAddressFamilyStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e IPAddressFamily) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *IPAddressFamily) UnmarshalText(text []byte) error { + return _IPAddressFamilyUnmarshalCase(e, text) +} + +var _IPAddressFamilyUnmarshalCase = cm.CaseUnmarshaler[IPAddressFamily](_IPAddressFamilyStrings[:]) + // IPv4Address represents the tuple "wasi:sockets/network@0.2.0#ipv4-address". // // type ipv4-address = tuple @@ -164,14 +190,14 @@ func (self *IPAddress) IPv6() *IPv6Address { return cm.Case[IPv6Address](self, 1) } -var stringsIPAddress = [2]string{ +var _IPAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPAddress) String() string { - return stringsIPAddress[v.Tag()] + return _IPAddressStrings[v.Tag()] } // IPv4SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv4-socket-address". @@ -181,9 +207,9 @@ func (v IPAddress) String() string { // address: ipv4-address, // } type IPv4SocketAddress struct { - _ cm.HostLayout - Port uint16 - Address IPv4Address + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + Address IPv4Address `json:"address"` } // IPv6SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv6-socket-address". @@ -195,11 +221,11 @@ type IPv4SocketAddress struct { // scope-id: u32, // } type IPv6SocketAddress struct { - _ cm.HostLayout - Port uint16 - FlowInfo uint32 - Address IPv6Address - ScopeID uint32 + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + FlowInfo uint32 `json:"flow-info"` + Address IPv6Address `json:"address"` + ScopeID uint32 `json:"scope-id"` } // IPSocketAddress represents the variant "wasi:sockets/network@0.2.0#ip-socket-address". @@ -230,12 +256,12 @@ func (self *IPSocketAddress) IPv6() *IPv6SocketAddress { return cm.Case[IPv6SocketAddress](self, 1) } -var stringsIPSocketAddress = [2]string{ +var _IPSocketAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPSocketAddress) String() string { - return stringsIPSocketAddress[v.Tag()] + return _IPSocketAddressStrings[v.Tag()] } diff --git a/component/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go b/examples/component/invoke/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go old mode 100755 new mode 100644 similarity index 85% rename from component/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go rename to examples/component/invoke/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go index b7b43155..dc473c1b --- a/component/gen/wasi/sockets/tcp-create-socket/tcpcreatesocket.wasm.go +++ b/examples/component/invoke/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcpcreatesocket diff --git a/examples/component/invoke/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go b/examples/component/invoke/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go index 1144092f..1e95e06c 100644 --- a/examples/component/invoke/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go +++ b/examples/component/invoke/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcpcreatesocket represents the imported interface "wasi:sockets/tcp-create-socket@0.2.0". package tcpcreatesocket diff --git a/examples/component/invoke/gen/wasi/sockets/tcp/abi.go b/examples/component/invoke/gen/wasi/sockets/tcp/abi.go index 4d31d8bb..4fb4abd3 100644 --- a/examples/component/invoke/gen/wasi/sockets/tcp/abi.go +++ b/examples/component/invoke/gen/wasi/sockets/tcp/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp @@ -23,7 +23,7 @@ type TupleInputStreamOutputStreamShape struct { // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wasm.go b/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wasm.go index 56247525..3da96a47 100755 --- a/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wasm.go +++ b/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp @@ -46,7 +46,7 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32, //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-enabled //go:noescape -func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool, bool, ErrorCode]) +func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[ErrorCode, bool, ErrorCode]) //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-idle-time //go:noescape diff --git a/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wit.go b/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wit.go index 0f236b65..d65e54e9 100644 --- a/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wit.go +++ b/examples/component/invoke/gen/wasi/sockets/tcp/tcp.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcp represents the imported interface "wasi:sockets/tcp@0.2.0". package tcp @@ -66,7 +66,7 @@ const ( ShutdownTypeBoth ) -var stringsShutdownType = [3]string{ +var _ShutdownTypeStrings = [3]string{ "receive", "send", "both", @@ -74,9 +74,22 @@ var stringsShutdownType = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ShutdownType) String() string { - return stringsShutdownType[e] + return _ShutdownTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ShutdownType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ShutdownType) UnmarshalText(text []byte) error { + return _ShutdownTypeUnmarshalCase(e, text) +} + +var _ShutdownTypeUnmarshalCase = cm.CaseUnmarshaler[ShutdownType](_ShutdownTypeStrings[:]) + // TCPSocket represents the imported resource "wasi:sockets/tcp@0.2.0#tcp-socket". // // resource tcp-socket @@ -188,7 +201,7 @@ func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCo // keep-alive-enabled: func() -> result // //go:nosplit -func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) { +func (self TCPSocket) KeepAliveEnabled() (result cm.Result[ErrorCode, bool, ErrorCode]) { self0 := cm.Reinterpret[uint32](self) wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result) return diff --git a/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go b/examples/component/invoke/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go old mode 100755 new mode 100644 similarity index 85% rename from examples/component/http-server/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go rename to examples/component/invoke/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go index 94b1ab67..2318cd58 --- a/examples/component/http-server/gen/wasi/sockets/udp-create-socket/udpcreatesocket.wasm.go +++ b/examples/component/invoke/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udpcreatesocket diff --git a/examples/component/invoke/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go b/examples/component/invoke/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go index 770343b3..07cd8807 100644 --- a/examples/component/invoke/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go +++ b/examples/component/invoke/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udpcreatesocket represents the imported interface "wasi:sockets/udp-create-socket@0.2.0". package udpcreatesocket diff --git a/examples/component/invoke/gen/wasi/sockets/udp/abi.go b/examples/component/invoke/gen/wasi/sockets/udp/abi.go index 3cdc2717..24668486 100644 --- a/examples/component/invoke/gen/wasi/sockets/udp/abi.go +++ b/examples/component/invoke/gen/wasi/sockets/udp/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp @@ -11,7 +11,7 @@ import ( // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/invoke/gen/wasi/sockets/udp/udp.wasm.go b/examples/component/invoke/gen/wasi/sockets/udp/udp.wasm.go index 83ce8ca7..b9204765 100755 --- a/examples/component/invoke/gen/wasi/sockets/udp/udp.wasm.go +++ b/examples/component/invoke/gen/wasi/sockets/udp/udp.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp diff --git a/examples/component/invoke/gen/wasi/sockets/udp/udp.wit.go b/examples/component/invoke/gen/wasi/sockets/udp/udp.wit.go index 7d5919e8..e904a8c6 100644 --- a/examples/component/invoke/gen/wasi/sockets/udp/udp.wit.go +++ b/examples/component/invoke/gen/wasi/sockets/udp/udp.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udp represents the imported interface "wasi:sockets/udp@0.2.0". package udp @@ -41,9 +41,9 @@ type IPAddressFamily = network.IPAddressFamily // remote-address: ip-socket-address, // } type IncomingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress IPSocketAddress + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress IPSocketAddress `json:"remote-address"` } // OutgoingDatagram represents the record "wasi:sockets/udp@0.2.0#outgoing-datagram". @@ -53,9 +53,9 @@ type IncomingDatagram struct { // remote-address: option, // } type OutgoingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress cm.Option[IPSocketAddress] + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress cm.Option[IPSocketAddress] `json:"remote-address"` } // UDPSocket represents the imported resource "wasi:sockets/udp@0.2.0#udp-socket". diff --git a/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wasm.go b/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wasm.go index 7c7b9094..a7e9df88 100755 --- a/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wasm.go +++ b/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package lattice diff --git a/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wit.go b/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wit.go index ba34d30c..38324335 100644 --- a/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wit.go +++ b/examples/component/invoke/gen/wasmcloud/bus/lattice/lattice.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package lattice represents the imported interface "wasmcloud:bus/lattice@1.0.0". package lattice diff --git a/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wasm.go b/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wasm.go index 65404eb3..2bd8c561 100755 --- a/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wasm.go +++ b/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package reveal diff --git a/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wit.go b/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wit.go index c56aeddd..f64070c0 100644 --- a/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wit.go +++ b/examples/component/invoke/gen/wasmcloud/secrets/reveal/reveal.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package reveal represents the imported interface "wasmcloud:secrets/reveal@0.1.0-draft". package reveal diff --git a/examples/component/invoke/gen/wasmcloud/secrets/store/abi.go b/examples/component/invoke/gen/wasmcloud/secrets/store/abi.go index 20affd6c..ea41541d 100644 --- a/examples/component/invoke/gen/wasmcloud/secrets/store/abi.go +++ b/examples/component/invoke/gen/wasmcloud/secrets/store/abi.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store diff --git a/examples/component/invoke/gen/wasmcloud/secrets/store/store.wasm.go b/examples/component/invoke/gen/wasmcloud/secrets/store/store.wasm.go index cc94c517..c2e9413a 100755 --- a/examples/component/invoke/gen/wasmcloud/secrets/store/store.wasm.go +++ b/examples/component/invoke/gen/wasmcloud/secrets/store/store.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store diff --git a/examples/component/invoke/gen/wasmcloud/secrets/store/store.wit.go b/examples/component/invoke/gen/wasmcloud/secrets/store/store.wit.go index d3465e4f..ddedcfc8 100644 --- a/examples/component/invoke/gen/wasmcloud/secrets/store/store.wit.go +++ b/examples/component/invoke/gen/wasmcloud/secrets/store/store.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package store represents the imported interface "wasmcloud:secrets/store@0.1.0-draft". package store @@ -47,7 +47,7 @@ func (self *SecretsError) NotFound() bool { return self.Tag() == 2 } -var stringsSecretsError = [3]string{ +var _SecretsErrorStrings = [3]string{ "upstream", "io", "not-found", @@ -55,7 +55,7 @@ var stringsSecretsError = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretsError) String() string { - return stringsSecretsError[v.Tag()] + return _SecretsErrorStrings[v.Tag()] } // SecretValue represents the variant "wasmcloud:secrets/store@0.1.0-draft#secret-value". @@ -64,7 +64,7 @@ func (v SecretsError) String() string { // %string(string), // bytes(list), // } -type SecretValue cm.Variant[uint8, string, cm.List[uint8]] +type SecretValue cm.Variant[uint8, string, string] // SecretValueString_ returns a [SecretValue] of case "string". func SecretValueString_(data string) SecretValue { @@ -86,14 +86,14 @@ func (self *SecretValue) Bytes() *cm.List[uint8] { return cm.Case[cm.List[uint8]](self, 1) } -var stringsSecretValue = [2]string{ +var _SecretValueStrings = [2]string{ "string", "bytes", } // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretValue) String() string { - return stringsSecretValue[v.Tag()] + return _SecretValueStrings[v.Tag()] } // Secret represents the imported resource "wasmcloud:secrets/store@0.1.0-draft#secret". diff --git a/examples/component/invoke/go.mod b/examples/component/invoke/go.mod index 8e159918..9946486a 100644 --- a/examples/component/invoke/go.mod +++ b/examples/component/invoke/go.mod @@ -4,8 +4,7 @@ go 1.24 require ( github.com/stretchr/testify v1.10.0 - go.bytecodealliance.org v0.5.0 - go.bytecodealliance.org/cm v0.1.0 + go.bytecodealliance.org/cm v0.2.2 go.wasmcloud.dev/component v0.0.6 go.wasmcloud.dev/wadge v0.7.0 ) @@ -17,17 +16,19 @@ require ( github.com/klauspost/compress v1.17.11 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/regclient/regclient v0.8.0 // indirect + github.com/regclient/regclient v0.8.2 // indirect github.com/samber/lo v1.49.1 // indirect github.com/samber/slog-common v0.18.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tetratelabs/wazero v1.9.0 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/urfave/cli/v3 v3.0.0-beta1 // indirect - golang.org/x/mod v0.22.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.29.0 // indirect + go.bytecodealliance.org v0.6.2 // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect golang.org/x/text v0.21.0 // indirect - golang.org/x/tools v0.29.0 // indirect + golang.org/x/tools v0.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -35,6 +36,6 @@ require ( replace go.wasmcloud.dev/component => ../../../component tool ( - go.bytecodealliance.org/cmd/wit-bindgen-go + go.wasmcloud.dev/component/wit-bindgen go.wasmcloud.dev/wadge/cmd/wadge-bindgen-go ) diff --git a/examples/component/invoke/go.sum b/examples/component/invoke/go.sum index 51e627e5..e86acaea 100644 --- a/examples/component/invoke/go.sum +++ b/examples/component/invoke/go.sum @@ -19,8 +19,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/regclient/regclient v0.8.0 h1:xNAMDlADcyMvFAlGXoqDOxlSUBG4mqWBFgjQqVTP8Og= -github.com/regclient/regclient v0.8.0/go.mod h1:h9+Y6dBvqBkdlrj6EIhbTOv0xUuIFl7CdI1bZvEB42g= +github.com/regclient/regclient v0.8.2 h1:23BQ3jWgKYHHIXUhp/S9laVJDHDoOQaQCzXMJ4undVE= +github.com/regclient/regclient v0.8.2/go.mod h1:uGyetv0o6VLyRDjtfeBqp/QBwRLJ3Hcn07/+8QbhNcM= github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew= github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o= github.com/samber/slog-common v0.18.1 h1:c0EipD/nVY9HG5shgm/XAs67mgpWDMF+MmtptdJNCkQ= @@ -33,27 +33,29 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= +github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg= github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y= -go.bytecodealliance.org v0.5.0 h1:ywhCpF0JdqGkqct5JqSY1Me8lz001UIJXUaCSS32cew= -go.bytecodealliance.org v0.5.0/go.mod h1:8kYTSxmQr8DU3dKOKCOHH1Ap1gWX/61qlFSbIuIno2Q= -go.bytecodealliance.org/cm v0.1.0 h1:78Rk4d5rgir5Hm+LMFpDWhjmFBWrKDFPSKUwDBj+nwo= -go.bytecodealliance.org/cm v0.1.0/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= +go.bytecodealliance.org v0.6.2 h1:Jy4u5DVmSkXgsnwojBhJ+AD/YsJsR3VzVnxF0xRCqTQ= +go.bytecodealliance.org v0.6.2/go.mod h1:gqjTJm0y9NSksG4py/lSjIQ/SNuIlOQ+hCIEPQwtJgA= +go.bytecodealliance.org/cm v0.2.2 h1:M9iHS6qs884mbQbIjtLX1OifgyPG9DuMs2iwz8G4WQA= +go.bytecodealliance.org/cm v0.2.2/go.mod h1:JD5vtVNZv7sBoQQkvBvAAVKJPhR/bqBH7yYXTItMfZI= go.wasmcloud.dev/wadge v0.7.0 h1:eUt0jODh6xQ5HEof1PFSgDp+evrNs+lD1LYCYeRR2Cg= go.wasmcloud.dev/wadge v0.7.0/go.mod h1:SMnPSWZFTkXyUX0GJ11mcdc7ZoMITtbAlPLlpvGJd4M= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= -golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/examples/component/invoke/main.go b/examples/component/invoke/main.go index e8f34320..abaec438 100644 --- a/examples/component/invoke/main.go +++ b/examples/component/invoke/main.go @@ -1,4 +1,4 @@ -//go:generate go tool wit-bindgen-go generate --world example --out gen ./wit +//go:generate go tool wit-bindgen --cm go.bytecodealliance.org/cm --world example --out gen ./wit package main diff --git a/examples/component/wasitel-http/.gitignore b/examples/component/wasitel-http/.gitignore new file mode 100644 index 00000000..567609b1 --- /dev/null +++ b/examples/component/wasitel-http/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/examples/component/wasitel-http/gen/example/wasitel-echo/component/component.wit.go b/examples/component/wasitel-http/gen/example/wasitel-echo/component/component.wit.go index bfae63d4..8963e739 100755 --- a/examples/component/wasitel-http/gen/example/wasitel-echo/component/component.wit.go +++ b/examples/component/wasitel-http/gen/example/wasitel-echo/component/component.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package component represents the world "example:wasitel-echo/component". package component diff --git a/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wasm.go index 89bb596b..08cd452e 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package environment import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wit.go b/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wit.go index 068bed33..eefe4386 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/environment/environment.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package environment represents the imported interface "wasi:cli/environment@0.2.0". package environment import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetEnvironment represents the imported function "get-environment". diff --git a/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wasm.go index 849d5f50..eb875244 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package exit diff --git a/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wit.go b/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wit.go index 7a347b60..90433404 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/exit/exit.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package exit represents the imported interface "wasi:cli/exit@0.2.0". package exit import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Exit represents the imported function "exit". diff --git a/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wasm.go index 462cf172..4f71e47a 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stderr diff --git a/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wit.go b/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wit.go index 56d7a621..6813db1e 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/stderr/stderr.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stderr represents the imported interface "wasi:cli/stderr@0.2.0". package stderr import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/io/streams" ) diff --git a/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wasm.go index 374eb253..e23cbf3d 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdin diff --git a/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wit.go b/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wit.go index cb2fd514..15b81c33 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/stdin/stdin.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdin represents the imported interface "wasi:cli/stdin@0.2.0". package stdin import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/io/streams" ) diff --git a/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wasm.go index 68e4a3da..c184dcca 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package stdout diff --git a/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wit.go b/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wit.go index 137c4fea..24d6766b 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/stdout/stdout.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package stdout represents the imported interface "wasi:cli/stdout@0.2.0". package stdout import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/io/streams" ) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-input/terminal-input.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-input/terminal-input.wasm.go new file mode 100644 index 00000000..d1271efa --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-input/terminal-input.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalinput + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-input@0.2.0 [resource-drop]terminal-input +//go:noescape +func wasmimport_TerminalInputResourceDrop(self0 uint32) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-input/terminal-input.wit.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-input/terminal-input.wit.go index 18b9a9d7..f4270e53 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/terminal-input/terminal-input.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-input/terminal-input.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalinput represents the imported interface "wasi:cli/terminal-input@0.2.0". package terminalinput import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalInput represents the imported resource "wasi:cli/terminal-input@0.2.0#terminal-input". diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-output/terminal-output.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-output/terminal-output.wasm.go new file mode 100644 index 00000000..e2b1717c --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-output/terminal-output.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminaloutput + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-output@0.2.0 [resource-drop]terminal-output +//go:noescape +func wasmimport_TerminalOutputResourceDrop(self0 uint32) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-output/terminal-output.wit.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-output/terminal-output.wit.go index 823aaf52..0f30de01 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/terminal-output/terminal-output.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-output/terminal-output.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminaloutput represents the imported interface "wasi:cli/terminal-output@0.2.0". package terminaloutput import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // TerminalOutput represents the imported resource "wasi:cli/terminal-output@0.2.0#terminal-output". diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go new file mode 100644 index 00000000..f7491c65 --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-stderr/terminal-stderr.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalstderr + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-stderr@0.2.0 get-terminal-stderr +//go:noescape +func wasmimport_GetTerminalStderr(result *cm.Option[TerminalOutput]) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go index e99189d5..9650b494 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-stderr/terminal-stderr.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstderr represents the imported interface "wasi:cli/terminal-stderr@0.2.0". package terminalstderr import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" terminaloutput "wasitel-http/gen/wasi/cli/terminal-output" ) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go new file mode 100644 index 00000000..1337d58c --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdin/terminal-stdin.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalstdin + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-stdin@0.2.0 get-terminal-stdin +//go:noescape +func wasmimport_GetTerminalStdin(result *cm.Option[TerminalInput]) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go index 291e181c..6f30d769 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdin/terminal-stdin.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdin represents the imported interface "wasi:cli/terminal-stdin@0.2.0". package terminalstdin import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" terminalinput "wasitel-http/gen/wasi/cli/terminal-input" ) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go new file mode 100644 index 00000000..aaf931c9 --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdout/terminal-stdout.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package terminalstdout + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/terminal-stdout@0.2.0 get-terminal-stdout +//go:noescape +func wasmimport_GetTerminalStdout(result *cm.Option[TerminalOutput]) diff --git a/examples/component/wasitel-http/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go index e8bdd0fb..cc3a225f 100755 --- a/examples/component/wasitel-http/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go +++ b/examples/component/wasitel-http/gen/wasi/cli/terminal-stdout/terminal-stdout.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package terminalstdout represents the imported interface "wasi:cli/terminal-stdout@0.2.0". package terminalstdout import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" terminaloutput "wasitel-http/gen/wasi/cli/terminal-output" ) diff --git a/examples/component/wasitel-http/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go b/examples/component/wasitel-http/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go new file mode 100644 index 00000000..aae90f4a --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go @@ -0,0 +1,21 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package monotonicclock + +// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0". + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 now +//go:noescape +func wasmimport_Now() (result0 uint64) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 resolution +//go:noescape +func wasmimport_Resolution() (result0 uint64) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-instant +//go:noescape +func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-duration +//go:noescape +func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32) diff --git a/examples/component/wasitel-http/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go b/examples/component/wasitel-http/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go index c5b4d245..97aec26c 100755 --- a/examples/component/wasitel-http/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go +++ b/examples/component/wasitel-http/gen/wasi/clocks/monotonic-clock/monotonic-clock.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package monotonicclock represents the imported interface "wasi:clocks/monotonic-clock@0.2.0". package monotonicclock import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/io/poll" ) diff --git a/examples/component/wasitel-http/gen/wasi/clocks/wall-clock/wall-clock.wasm.go b/examples/component/wasitel-http/gen/wasi/clocks/wall-clock/wall-clock.wasm.go new file mode 100644 index 00000000..662ea1e5 --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/clocks/wall-clock/wall-clock.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package wallclock + +// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0". + +//go:wasmimport wasi:clocks/wall-clock@0.2.0 now +//go:noescape +func wasmimport_Now(result *DateTime) + +//go:wasmimport wasi:clocks/wall-clock@0.2.0 resolution +//go:noescape +func wasmimport_Resolution(result *DateTime) diff --git a/examples/component/wasitel-http/gen/wasi/clocks/wall-clock/wall-clock.wit.go b/examples/component/wasitel-http/gen/wasi/clocks/wall-clock/wall-clock.wit.go index e3f35395..b97eddd8 100755 --- a/examples/component/wasitel-http/gen/wasi/clocks/wall-clock/wall-clock.wit.go +++ b/examples/component/wasitel-http/gen/wasi/clocks/wall-clock/wall-clock.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package wallclock represents the imported interface "wasi:clocks/wall-clock@0.2.0". package wallclock import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // DateTime represents the record "wasi:clocks/wall-clock@0.2.0#datetime". @@ -14,9 +14,9 @@ import ( // nanoseconds: u32, // } type DateTime struct { - _ cm.HostLayout - Seconds uint64 - Nanoseconds uint32 + _ cm.HostLayout `json:"-"` + Seconds uint64 `json:"seconds"` + Nanoseconds uint32 `json:"nanoseconds"` } // Now represents the imported function "now". diff --git a/examples/component/wasitel-http/gen/wasi/config/runtime/abi.go b/examples/component/wasitel-http/gen/wasi/config/runtime/abi.go index 61412cbe..a99a45a9 100755 --- a/examples/component/wasitel-http/gen/wasi/config/runtime/abi.go +++ b/examples/component/wasitel-http/gen/wasi/config/runtime/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wasm.go b/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wasm.go index 8ce17d5e..b9e129da 100755 --- a/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:config@0.2.0-draft". diff --git a/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wit.go b/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wit.go index 99a739d1..5a02be62 100755 --- a/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wit.go +++ b/examples/component/wasitel-http/gen/wasi/config/runtime/runtime.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package runtime represents the imported interface "wasi:config/runtime@0.2.0-draft". package runtime import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // ConfigError represents the variant "wasi:config/runtime@0.2.0-draft#config-error". @@ -35,14 +35,14 @@ func (self *ConfigError) IO() *string { return cm.Case[string](self, 1) } -var stringsConfigError = [2]string{ +var _ConfigErrorStrings = [2]string{ "upstream", "io", } // String implements [fmt.Stringer], returning the variant case name of v. func (v ConfigError) String() string { - return stringsConfigError[v.Tag()] + return _ConfigErrorStrings[v.Tag()] } // Get represents the imported function "get". diff --git a/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wasm.go b/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wasm.go index 1bcd416a..6aebe453 100755 --- a/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package preopens import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wit.go b/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wit.go index abe2a4aa..d629b6c4 100755 --- a/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wit.go +++ b/examples/component/wasitel-http/gen/wasi/filesystem/preopens/preopens.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package preopens represents the imported interface "wasi:filesystem/preopens@0.2.0". package preopens import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/filesystem/types" ) diff --git a/examples/component/wasitel-http/gen/wasi/filesystem/types/abi.go b/examples/component/wasitel-http/gen/wasi/filesystem/types/abi.go index dbea951a..bc3f22c1 100755 --- a/examples/component/wasitel-http/gen/wasi/filesystem/types/abi.go +++ b/examples/component/wasitel-http/gen/wasi/filesystem/types/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" wallclock "wasitel-http/gen/wasi/clocks/wall-clock" ) diff --git a/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wasm.go b/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wasm.go index b97dad84..9c919e5e 100755 --- a/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wit.go b/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wit.go index 03ff475c..0ea61c5f 100755 --- a/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wit.go +++ b/examples/component/wasitel-http/gen/wasi/filesystem/types/types.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:filesystem/types@0.2.0". package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" wallclock "wasitel-http/gen/wasi/clocks/wall-clock" "wasitel-http/gen/wasi/io/streams" ) @@ -59,7 +59,7 @@ const ( DescriptorTypeSocket ) -var stringsDescriptorType = [8]string{ +var _DescriptorTypeStrings = [8]string{ "unknown", "block-device", "character-device", @@ -72,9 +72,22 @@ var stringsDescriptorType = [8]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e DescriptorType) String() string { - return stringsDescriptorType[e] + return _DescriptorTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e DescriptorType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *DescriptorType) UnmarshalText(text []byte) error { + return _DescriptorTypeUnmarshalCase(e, text) +} + +var _DescriptorTypeUnmarshalCase = cm.CaseUnmarshaler[DescriptorType](_DescriptorTypeStrings[:]) + // DescriptorFlags represents the flags "wasi:filesystem/types@0.2.0#descriptor-flags". // // flags descriptor-flags { @@ -140,13 +153,13 @@ type LinkCount uint64 // status-change-timestamp: option, // } type DescriptorStat struct { - _ cm.HostLayout - Type DescriptorType - LinkCount LinkCount - Size FileSize - DataAccessTimestamp cm.Option[DateTime] - DataModificationTimestamp cm.Option[DateTime] - StatusChangeTimestamp cm.Option[DateTime] + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + LinkCount LinkCount `json:"link-count"` + Size FileSize `json:"size"` + DataAccessTimestamp cm.Option[DateTime] `json:"data-access-timestamp"` + DataModificationTimestamp cm.Option[DateTime] `json:"data-modification-timestamp"` + StatusChangeTimestamp cm.Option[DateTime] `json:"status-change-timestamp"` } // NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp". @@ -190,7 +203,7 @@ func (self *NewTimestamp) Timestamp() *DateTime { return cm.Case[DateTime](self, 2) } -var stringsNewTimestamp = [3]string{ +var _NewTimestampStrings = [3]string{ "no-change", "now", "timestamp", @@ -198,7 +211,7 @@ var stringsNewTimestamp = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v NewTimestamp) String() string { - return stringsNewTimestamp[v.Tag()] + return _NewTimestampStrings[v.Tag()] } // DirectoryEntry represents the record "wasi:filesystem/types@0.2.0#directory-entry". @@ -208,9 +221,9 @@ func (v NewTimestamp) String() string { // name: string, // } type DirectoryEntry struct { - _ cm.HostLayout - Type DescriptorType - Name string + _ cm.HostLayout `json:"-"` + Type DescriptorType `json:"type"` + Name string `json:"name"` } // ErrorCode represents the enum "wasi:filesystem/types@0.2.0#error-code". @@ -296,7 +309,7 @@ const ( ErrorCodeCrossDevice ) -var stringsErrorCode = [37]string{ +var _ErrorCodeStrings = [37]string{ "access", "would-block", "already", @@ -338,9 +351,22 @@ var stringsErrorCode = [37]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // Advice represents the enum "wasi:filesystem/types@0.2.0#advice". // // enum advice { @@ -362,7 +388,7 @@ const ( AdviceNoReuse ) -var stringsAdvice = [6]string{ +var _AdviceStrings = [6]string{ "normal", "sequential", "random", @@ -373,9 +399,22 @@ var stringsAdvice = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Advice) String() string { - return stringsAdvice[e] + return _AdviceStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e Advice) MarshalText() ([]byte, error) { + return []byte(e.String()), nil } +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Advice) UnmarshalText(text []byte) error { + return _AdviceUnmarshalCase(e, text) +} + +var _AdviceUnmarshalCase = cm.CaseUnmarshaler[Advice](_AdviceStrings[:]) + // MetadataHashValue represents the record "wasi:filesystem/types@0.2.0#metadata-hash-value". // // record metadata-hash-value { @@ -383,9 +422,9 @@ func (e Advice) String() string { // upper: u64, // } type MetadataHashValue struct { - _ cm.HostLayout - Lower uint64 - Upper uint64 + _ cm.HostLayout `json:"-"` + Lower uint64 `json:"lower"` + Upper uint64 `json:"upper"` } // Descriptor represents the imported resource "wasi:filesystem/types@0.2.0#descriptor". diff --git a/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.exports.go b/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.exports.go index 673ccb48..6447d62b 100755 --- a/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.exports.go +++ b/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.exports.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package incominghandler diff --git a/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.wasm.go b/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.wasm.go new file mode 100644 index 00000000..abeca9ae --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.wasm.go @@ -0,0 +1,18 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package incominghandler + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". + +//go:wasmexport wasi:http/incoming-handler@0.2.0#handle +//export wasi:http/incoming-handler@0.2.0#handle +func wasmexport_Handle(request0 uint32, responseOut0 uint32) { + request := cm.Reinterpret[IncomingRequest]((uint32)(request0)) + responseOut := cm.Reinterpret[ResponseOutparam]((uint32)(responseOut0)) + Exports.Handle(request, responseOut) + return +} diff --git a/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.wit.go b/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.wit.go index df0c8a01..e2b7b6c7 100755 --- a/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.wit.go +++ b/examples/component/wasitel-http/gen/wasi/http/incoming-handler/incoming-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package incominghandler represents the exported interface "wasi:http/incoming-handler@0.2.0". // diff --git a/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/abi.go b/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/abi.go index a525fe70..89fa94be 100755 --- a/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/abi.go +++ b/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/abi.go @@ -1,17 +1,16 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package outgoinghandler import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" - "wasitel-http/gen/wasi/http/types" ) // ErrorCodeShape is used for storage in variant or result types. type ErrorCodeShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(types.ErrorCode{})]byte + shape [unsafe.Sizeof(ErrorCode{})]byte } func lower_OptionRequestOptions(v cm.Option[RequestOptions]) (f0 uint32, f1 uint32) { diff --git a/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go b/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go new file mode 100644 index 00000000..efbfdb74 --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/outgoing-handler.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package outgoinghandler + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". + +//go:wasmimport wasi:http/outgoing-handler@0.2.0 handle +//go:noescape +func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result *cm.Result[ErrorCodeShape, FutureIncomingResponse, ErrorCode]) diff --git a/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go b/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go index c86c83a2..0c32d0f2 100755 --- a/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go +++ b/examples/component/wasitel-http/gen/wasi/http/outgoing-handler/outgoing-handler.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package outgoinghandler represents the imported interface "wasi:http/outgoing-handler@0.2.0". // @@ -7,7 +7,7 @@ package outgoinghandler import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/http/types" ) diff --git a/examples/component/wasitel-http/gen/wasi/http/types/abi.go b/examples/component/wasitel-http/gen/wasi/http/types/abi.go index 6ffb1fdd..7c24d70f 100755 --- a/examples/component/wasitel-http/gen/wasi/http/types/abi.go +++ b/examples/component/wasitel-http/gen/wasi/http/types/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/wasitel-http/gen/wasi/http/types/types.wasm.go b/examples/component/wasitel-http/gen/wasi/http/types/types.wasm.go index b025b2af..1d4810cf 100755 --- a/examples/component/wasitel-http/gen/wasi/http/types/types.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/http/types/types.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/http/types/types.wit.go b/examples/component/wasitel-http/gen/wasi/http/types/types.wit.go index a5755ff5..668c0565 100755 --- a/examples/component/wasitel-http/gen/wasi/http/types/types.wit.go +++ b/examples/component/wasitel-http/gen/wasi/http/types/types.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package types represents the imported interface "wasi:http/types@0.2.0". // @@ -8,7 +8,7 @@ package types import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" monotonicclock "wasitel-http/gen/wasi/clocks/monotonic-clock" ioerror "wasitel-http/gen/wasi/io/error" "wasitel-http/gen/wasi/io/poll" @@ -167,7 +167,7 @@ func (self *Method) Other() *string { return cm.Case[string](self, 9) } -var stringsMethod = [10]string{ +var _MethodStrings = [10]string{ "get", "head", "post", @@ -182,7 +182,7 @@ var stringsMethod = [10]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Method) String() string { - return stringsMethod[v.Tag()] + return _MethodStrings[v.Tag()] } // Scheme represents the variant "wasi:http/types@0.2.0#scheme". @@ -228,7 +228,7 @@ func (self *Scheme) Other() *string { return cm.Case[string](self, 2) } -var stringsScheme = [3]string{ +var _SchemeStrings = [3]string{ "HTTP", "HTTPS", "other", @@ -236,7 +236,7 @@ var stringsScheme = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v Scheme) String() string { - return stringsScheme[v.Tag()] + return _SchemeStrings[v.Tag()] } // DNSErrorPayload represents the record "wasi:http/types@0.2.0#DNS-error-payload". @@ -248,9 +248,9 @@ func (v Scheme) String() string { // info-code: option, // } type DNSErrorPayload struct { - _ cm.HostLayout - Rcode cm.Option[string] - InfoCode cm.Option[uint16] + _ cm.HostLayout `json:"-"` + Rcode cm.Option[string] `json:"rcode"` + InfoCode cm.Option[uint16] `json:"info-code"` } // TLSAlertReceivedPayload represents the record "wasi:http/types@0.2.0#TLS-alert-received-payload". @@ -262,9 +262,9 @@ type DNSErrorPayload struct { // alert-message: option, // } type TLSAlertReceivedPayload struct { - _ cm.HostLayout - AlertID cm.Option[uint8] - AlertMessage cm.Option[string] + _ cm.HostLayout `json:"-"` + AlertID cm.Option[uint8] `json:"alert-id"` + AlertMessage cm.Option[string] `json:"alert-message"` } // FieldSizePayload represents the record "wasi:http/types@0.2.0#field-size-payload". @@ -276,9 +276,9 @@ type TLSAlertReceivedPayload struct { // field-size: option, // } type FieldSizePayload struct { - _ cm.HostLayout - FieldName cm.Option[string] - FieldSize cm.Option[uint32] + _ cm.HostLayout `json:"-"` + FieldName cm.Option[string] `json:"field-name"` + FieldSize cm.Option[uint32] `json:"field-size"` } // ErrorCode represents the variant "wasi:http/types@0.2.0#error-code". @@ -749,7 +749,7 @@ func (self *ErrorCode) InternalError() *cm.Option[string] { return cm.Case[cm.Option[string]](self, 38) } -var stringsErrorCode = [39]string{ +var _ErrorCodeStrings = [39]string{ "DNS-timeout", "DNS-error", "destination-not-found", @@ -793,7 +793,7 @@ var stringsErrorCode = [39]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v ErrorCode) String() string { - return stringsErrorCode[v.Tag()] + return _ErrorCodeStrings[v.Tag()] } // HeaderError represents the variant "wasi:http/types@0.2.0#header-error". @@ -823,7 +823,7 @@ const ( HeaderErrorImmutable ) -var stringsHeaderError = [3]string{ +var _HeaderErrorStrings = [3]string{ "invalid-syntax", "forbidden", "immutable", @@ -831,9 +831,22 @@ var stringsHeaderError = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e HeaderError) String() string { - return stringsHeaderError[e] + return _HeaderErrorStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e HeaderError) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *HeaderError) UnmarshalText(text []byte) error { + return _HeaderErrorUnmarshalCase(e, text) +} + +var _HeaderErrorUnmarshalCase = cm.CaseUnmarshaler[HeaderError](_HeaderErrorStrings[:]) + // FieldKey represents the string "wasi:http/types@0.2.0#field-key". // // Field keys are always strings. diff --git a/examples/component/wasitel-http/gen/wasi/io/error/error.wasm.go b/examples/component/wasitel-http/gen/wasi/io/error/error.wasm.go new file mode 100644 index 00000000..eee2750b --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/io/error/error.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package ioerror + +// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". + +//go:wasmimport wasi:io/error@0.2.0 [resource-drop]error +//go:noescape +func wasmimport_ErrorResourceDrop(self0 uint32) + +//go:wasmimport wasi:io/error@0.2.0 [method]error.to-debug-string +//go:noescape +func wasmimport_ErrorToDebugString(self0 uint32, result *string) diff --git a/examples/component/wasitel-http/gen/wasi/io/error/error.wit.go b/examples/component/wasitel-http/gen/wasi/io/error/error.wit.go index 828e977e..ed84ae22 100755 --- a/examples/component/wasitel-http/gen/wasi/io/error/error.wit.go +++ b/examples/component/wasitel-http/gen/wasi/io/error/error.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ioerror represents the imported interface "wasi:io/error@0.2.0". package ioerror import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Error represents the imported resource "wasi:io/error@0.2.0#error". diff --git a/examples/component/wasitel-http/gen/wasi/io/poll/poll.wasm.go b/examples/component/wasitel-http/gen/wasi/io/poll/poll.wasm.go index f7c55c3d..ab811b32 100755 --- a/examples/component/wasitel-http/gen/wasi/io/poll/poll.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/io/poll/poll.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package poll import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/io/poll/poll.wit.go b/examples/component/wasitel-http/gen/wasi/io/poll/poll.wit.go index ad9e9564..cb8f618f 100755 --- a/examples/component/wasitel-http/gen/wasi/io/poll/poll.wit.go +++ b/examples/component/wasitel-http/gen/wasi/io/poll/poll.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package poll represents the imported interface "wasi:io/poll@0.2.0". package poll import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Pollable represents the imported resource "wasi:io/poll@0.2.0#pollable". diff --git a/examples/component/wasitel-http/gen/wasi/io/streams/streams.wasm.go b/examples/component/wasitel-http/gen/wasi/io/streams/streams.wasm.go index eec56645..a754dbcf 100755 --- a/examples/component/wasitel-http/gen/wasi/io/streams/streams.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/io/streams/streams.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package streams import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/io/streams/streams.wit.go b/examples/component/wasitel-http/gen/wasi/io/streams/streams.wit.go index ee05c4e4..20b85bf9 100755 --- a/examples/component/wasitel-http/gen/wasi/io/streams/streams.wit.go +++ b/examples/component/wasitel-http/gen/wasi/io/streams/streams.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package streams represents the imported interface "wasi:io/streams@0.2.0". package streams import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ioerror "wasitel-http/gen/wasi/io/error" "wasitel-http/gen/wasi/io/poll" ) @@ -48,14 +48,14 @@ func (self *StreamError) Closed() bool { return self.Tag() == 1 } -var stringsStreamError = [2]string{ +var _StreamErrorStrings = [2]string{ "last-operation-failed", "closed", } // String implements [fmt.Stringer], returning the variant case name of v. func (v StreamError) String() string { - return stringsStreamError[v.Tag()] + return _StreamErrorStrings[v.Tag()] } // InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream". diff --git a/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wasm.go b/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wasm.go index d2d27098..bc430bd6 100755 --- a/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package logging diff --git a/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wit.go b/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wit.go index 96e406ed..064814a5 100755 --- a/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wit.go +++ b/examples/component/wasitel-http/gen/wasi/logging/logging/logging.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package logging represents the imported interface "wasi:logging/logging@0.1.0-draft". package logging import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Level represents the enum "wasi:logging/logging@0.1.0-draft#level". @@ -28,7 +28,7 @@ const ( LevelCritical ) -var stringsLevel = [6]string{ +var _LevelStrings = [6]string{ "trace", "debug", "info", @@ -39,9 +39,22 @@ var stringsLevel = [6]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e Level) String() string { - return stringsLevel[e] + return _LevelStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e Level) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *Level) UnmarshalText(text []byte) error { + return _LevelUnmarshalCase(e, text) +} + +var _LevelUnmarshalCase = cm.CaseUnmarshaler[Level](_LevelStrings[:]) + // Log represents the imported function "log". // // log: func(level: level, context: string, message: string) diff --git a/examples/component/wasitel-http/gen/wasi/random/insecure-seed/insecure-seed.wasm.go b/examples/component/wasitel-http/gen/wasi/random/insecure-seed/insecure-seed.wasm.go new file mode 100644 index 00000000..2c1d8b4a --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/random/insecure-seed/insecure-seed.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package insecureseed + +// This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". + +//go:wasmimport wasi:random/insecure-seed@0.2.0 insecure-seed +//go:noescape +func wasmimport_InsecureSeed(result *[2]uint64) diff --git a/examples/component/wasitel-http/gen/wasi/random/insecure-seed/insecure-seed.wit.go b/examples/component/wasitel-http/gen/wasi/random/insecure-seed/insecure-seed.wit.go index e701d1b4..856b2cc7 100755 --- a/examples/component/wasitel-http/gen/wasi/random/insecure-seed/insecure-seed.wit.go +++ b/examples/component/wasitel-http/gen/wasi/random/insecure-seed/insecure-seed.wit.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecureseed represents the imported interface "wasi:random/insecure-seed@0.2.0". package insecureseed diff --git a/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wasm.go b/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wasm.go index 498bfe4a..cfcd23b9 100755 --- a/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package insecure import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wit.go b/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wit.go index f32282c6..6195f9a6 100755 --- a/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wit.go +++ b/examples/component/wasitel-http/gen/wasi/random/insecure/insecure.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package insecure represents the imported interface "wasi:random/insecure@0.2.0". package insecure import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetInsecureRandomBytes represents the imported function "get-insecure-random-bytes". diff --git a/examples/component/wasitel-http/gen/wasi/random/random/random.wasm.go b/examples/component/wasitel-http/gen/wasi/random/random/random.wasm.go index 9096457b..d7885ae4 100755 --- a/examples/component/wasitel-http/gen/wasi/random/random/random.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/random/random/random.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package random import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/random/random/random.wit.go b/examples/component/wasitel-http/gen/wasi/random/random/random.wit.go index 98bb7779..392341aa 100755 --- a/examples/component/wasitel-http/gen/wasi/random/random/random.wit.go +++ b/examples/component/wasitel-http/gen/wasi/random/random/random.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package random represents the imported interface "wasi:random/random@0.2.0". package random import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // GetRandomBytes represents the imported function "get-random-bytes". diff --git a/examples/component/wasitel-http/gen/wasi/sockets/instance-network/instance-network.wasm.go b/examples/component/wasitel-http/gen/wasi/sockets/instance-network/instance-network.wasm.go new file mode 100644 index 00000000..aca75114 --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/sockets/instance-network/instance-network.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package instancenetwork + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/instance-network@0.2.0 instance-network +//go:noescape +func wasmimport_InstanceNetwork() (result0 uint32) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/instance-network/instance-network.wit.go b/examples/component/wasitel-http/gen/wasi/sockets/instance-network/instance-network.wit.go index 2ca5f7de..18a65881 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/instance-network/instance-network.wit.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/instance-network/instance-network.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package instancenetwork represents the imported interface "wasi:sockets/instance-network@0.2.0". package instancenetwork import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/sockets/network" ) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/abi.go b/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/abi.go index a63f0d01..87ab2794 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/abi.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package ipnamelookup import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go b/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go new file mode 100644 index 00000000..24edd5cb --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wasm.go @@ -0,0 +1,25 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package ipnamelookup + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [resource-drop]resolve-address-stream +//go:noescape +func wasmimport_ResolveAddressStreamResourceDrop(self0 uint32) + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [method]resolve-address-stream.resolve-next-address +//go:noescape +func wasmimport_ResolveAddressStreamResolveNextAddress(self0 uint32, result *cm.Result[OptionIPAddressShape, cm.Option[IPAddress], ErrorCode]) + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [method]resolve-address-stream.subscribe +//go:noescape +func wasmimport_ResolveAddressStreamSubscribe(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 resolve-addresses +//go:noescape +func wasmimport_ResolveAddresses(network0 uint32, name0 *uint8, name1 uint32, result *cm.Result[ResolveAddressStream, ResolveAddressStream, ErrorCode]) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go b/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go index 1c83fb29..ccdfd89c 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/ip-name-lookup/ip-name-lookup.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package ipnamelookup represents the imported interface "wasi:sockets/ip-name-lookup@0.2.0". package ipnamelookup import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/io/poll" "wasitel-http/gen/wasi/sockets/network" ) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/network/abi.go b/examples/component/wasitel-http/gen/wasi/sockets/network/abi.go index a088bd1d..3d09cbe2 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/network/abi.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/network/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/network/network.wasm.go b/examples/component/wasitel-http/gen/wasi/sockets/network/network.wasm.go index 012a79ff..23f02bdd 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/network/network.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/network/network.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package network diff --git a/examples/component/wasitel-http/gen/wasi/sockets/network/network.wit.go b/examples/component/wasitel-http/gen/wasi/sockets/network/network.wit.go index f0fb7eef..17d70aeb 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/network/network.wit.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/network/network.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package network represents the imported interface "wasi:sockets/network@0.2.0". package network import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // Network represents the imported resource "wasi:sockets/network@0.2.0#network". @@ -74,7 +74,7 @@ const ( ErrorCodePermanentResolverFailure ) -var stringsErrorCode = [21]string{ +var _ErrorCodeStrings = [21]string{ "unknown", "access-denied", "not-supported", @@ -100,9 +100,22 @@ var stringsErrorCode = [21]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ErrorCode) String() string { - return stringsErrorCode[e] + return _ErrorCodeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ErrorCode) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ErrorCode) UnmarshalText(text []byte) error { + return _ErrorCodeUnmarshalCase(e, text) +} + +var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:]) + // IPAddressFamily represents the enum "wasi:sockets/network@0.2.0#ip-address-family". // // enum ip-address-family { @@ -116,16 +129,29 @@ const ( IPAddressFamilyIPv6 ) -var stringsIPAddressFamily = [2]string{ +var _IPAddressFamilyStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the enum case name of e. func (e IPAddressFamily) String() string { - return stringsIPAddressFamily[e] + return _IPAddressFamilyStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e IPAddressFamily) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *IPAddressFamily) UnmarshalText(text []byte) error { + return _IPAddressFamilyUnmarshalCase(e, text) +} + +var _IPAddressFamilyUnmarshalCase = cm.CaseUnmarshaler[IPAddressFamily](_IPAddressFamilyStrings[:]) + // IPv4Address represents the tuple "wasi:sockets/network@0.2.0#ipv4-address". // // type ipv4-address = tuple @@ -164,14 +190,14 @@ func (self *IPAddress) IPv6() *IPv6Address { return cm.Case[IPv6Address](self, 1) } -var stringsIPAddress = [2]string{ +var _IPAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPAddress) String() string { - return stringsIPAddress[v.Tag()] + return _IPAddressStrings[v.Tag()] } // IPv4SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv4-socket-address". @@ -181,9 +207,9 @@ func (v IPAddress) String() string { // address: ipv4-address, // } type IPv4SocketAddress struct { - _ cm.HostLayout - Port uint16 - Address IPv4Address + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + Address IPv4Address `json:"address"` } // IPv6SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv6-socket-address". @@ -195,11 +221,11 @@ type IPv4SocketAddress struct { // scope-id: u32, // } type IPv6SocketAddress struct { - _ cm.HostLayout - Port uint16 - FlowInfo uint32 - Address IPv6Address - ScopeID uint32 + _ cm.HostLayout `json:"-"` + Port uint16 `json:"port"` + FlowInfo uint32 `json:"flow-info"` + Address IPv6Address `json:"address"` + ScopeID uint32 `json:"scope-id"` } // IPSocketAddress represents the variant "wasi:sockets/network@0.2.0#ip-socket-address". @@ -230,12 +256,12 @@ func (self *IPSocketAddress) IPv6() *IPv6SocketAddress { return cm.Case[IPv6SocketAddress](self, 1) } -var stringsIPSocketAddress = [2]string{ +var _IPSocketAddressStrings = [2]string{ "ipv4", "ipv6", } // String implements [fmt.Stringer], returning the variant case name of v. func (v IPSocketAddress) String() string { - return stringsIPSocketAddress[v.Tag()] + return _IPSocketAddressStrings[v.Tag()] } diff --git a/examples/component/wasitel-http/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go b/examples/component/wasitel-http/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go new file mode 100644 index 00000000..5124c0c0 --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package tcpcreatesocket + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/tcp-create-socket@0.2.0 create-tcp-socket +//go:noescape +func wasmimport_CreateTCPSocket(addressFamily0 uint32, result *cm.Result[TCPSocket, TCPSocket, ErrorCode]) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go b/examples/component/wasitel-http/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go index e5339b1f..16553485 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/tcp-create-socket/tcp-create-socket.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcpcreatesocket represents the imported interface "wasi:sockets/tcp-create-socket@0.2.0". package tcpcreatesocket import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/sockets/network" "wasitel-http/gen/wasi/sockets/tcp" ) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/tcp/abi.go b/examples/component/wasitel-http/gen/wasi/sockets/tcp/abi.go index f355f722..34d62f33 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/tcp/abi.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/tcp/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" "wasitel-http/gen/wasi/sockets/network" ) @@ -23,7 +23,7 @@ type TupleInputStreamOutputStreamShape struct { // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wasm.go b/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wasm.go index 56247525..b833ba41 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package tcp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". @@ -46,7 +46,7 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32, //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-enabled //go:noescape -func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool, bool, ErrorCode]) +func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[ErrorCode, bool, ErrorCode]) //go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-idle-time //go:noescape diff --git a/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wit.go b/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wit.go index ad930cda..09276daf 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wit.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/tcp/tcp.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package tcp represents the imported interface "wasi:sockets/tcp@0.2.0". package tcp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" monotonicclock "wasitel-http/gen/wasi/clocks/monotonic-clock" "wasitel-http/gen/wasi/io/poll" "wasitel-http/gen/wasi/io/streams" @@ -66,7 +66,7 @@ const ( ShutdownTypeBoth ) -var stringsShutdownType = [3]string{ +var _ShutdownTypeStrings = [3]string{ "receive", "send", "both", @@ -74,9 +74,22 @@ var stringsShutdownType = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e ShutdownType) String() string { - return stringsShutdownType[e] + return _ShutdownTypeStrings[e] } +// MarshalText implements [encoding.TextMarshaler]. +func (e ShutdownType) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *ShutdownType) UnmarshalText(text []byte) error { + return _ShutdownTypeUnmarshalCase(e, text) +} + +var _ShutdownTypeUnmarshalCase = cm.CaseUnmarshaler[ShutdownType](_ShutdownTypeStrings[:]) + // TCPSocket represents the imported resource "wasi:sockets/tcp@0.2.0#tcp-socket". // // resource tcp-socket @@ -188,7 +201,7 @@ func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCo // keep-alive-enabled: func() -> result // //go:nosplit -func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) { +func (self TCPSocket) KeepAliveEnabled() (result cm.Result[ErrorCode, bool, ErrorCode]) { self0 := cm.Reinterpret[uint32](self) wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result) return diff --git a/examples/component/wasitel-http/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go b/examples/component/wasitel-http/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go new file mode 100644 index 00000000..bbae0015 --- /dev/null +++ b/examples/component/wasitel-http/gen/wasi/sockets/udp-create-socket/udp-create-socket.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. + +package udpcreatesocket + +import ( + "go.wasmcloud.dev/component/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". + +//go:wasmimport wasi:sockets/udp-create-socket@0.2.0 create-udp-socket +//go:noescape +func wasmimport_CreateUDPSocket(addressFamily0 uint32, result *cm.Result[UDPSocket, UDPSocket, ErrorCode]) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go b/examples/component/wasitel-http/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go index 999b2c42..005cdc7a 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/udp-create-socket/udp-create-socket.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udpcreatesocket represents the imported interface "wasi:sockets/udp-create-socket@0.2.0". package udpcreatesocket import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/sockets/network" "wasitel-http/gen/wasi/sockets/udp" ) diff --git a/examples/component/wasitel-http/gen/wasi/sockets/udp/abi.go b/examples/component/wasitel-http/gen/wasi/sockets/udp/abi.go index 64da87ce..81a9faaa 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/udp/abi.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/udp/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" "wasitel-http/gen/wasi/sockets/network" ) @@ -11,7 +11,7 @@ import ( // IPSocketAddressShape is used for storage in variant or result types. type IPSocketAddressShape struct { _ cm.HostLayout - shape [unsafe.Sizeof(network.IPSocketAddress{})]byte + shape [unsafe.Sizeof(IPSocketAddress{})]byte } func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) { diff --git a/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wasm.go b/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wasm.go index 83ce8ca7..662148ba 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wasm.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package udp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0". diff --git a/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wit.go b/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wit.go index 95d00fa6..38e77773 100755 --- a/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wit.go +++ b/examples/component/wasitel-http/gen/wasi/sockets/udp/udp.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package udp represents the imported interface "wasi:sockets/udp@0.2.0". package udp import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasi/io/poll" "wasitel-http/gen/wasi/sockets/network" ) @@ -41,9 +41,9 @@ type IPAddressFamily = network.IPAddressFamily // remote-address: ip-socket-address, // } type IncomingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress IPSocketAddress + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress IPSocketAddress `json:"remote-address"` } // OutgoingDatagram represents the record "wasi:sockets/udp@0.2.0#outgoing-datagram". @@ -53,9 +53,9 @@ type IncomingDatagram struct { // remote-address: option, // } type OutgoingDatagram struct { - _ cm.HostLayout - Data cm.List[uint8] - RemoteAddress cm.Option[IPSocketAddress] + _ cm.HostLayout `json:"-"` + Data cm.List[uint8] `json:"data"` + RemoteAddress cm.Option[IPSocketAddress] `json:"remote-address"` } // UDPSocket represents the imported resource "wasi:sockets/udp@0.2.0#udp-socket". diff --git a/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wasm.go b/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wasm.go index 7c7b9094..a7e9df88 100755 --- a/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wasm.go +++ b/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package lattice diff --git a/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wit.go b/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wit.go index ba34d30c..684468cf 100755 --- a/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wit.go +++ b/examples/component/wasitel-http/gen/wasmcloud/bus/lattice/lattice.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package lattice represents the imported interface "wasmcloud:bus/lattice@1.0.0". package lattice import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // CallTargetInterface represents the imported resource "wasmcloud:bus/lattice@1.0.0#call-target-interface". diff --git a/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wasm.go b/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wasm.go index 65404eb3..2bd8c561 100755 --- a/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wasm.go +++ b/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wasm.go @@ -1,4 +1,4 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package reveal diff --git a/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wit.go b/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wit.go index 039d5706..ac84e271 100755 --- a/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wit.go +++ b/examples/component/wasitel-http/gen/wasmcloud/secrets/reveal/reveal.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package reveal represents the imported interface "wasmcloud:secrets/reveal@0.1.0-draft". package reveal import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "wasitel-http/gen/wasmcloud/secrets/store" ) diff --git a/examples/component/wasitel-http/gen/wasmcloud/secrets/store/abi.go b/examples/component/wasitel-http/gen/wasmcloud/secrets/store/abi.go index 20affd6c..e5ff5543 100755 --- a/examples/component/wasitel-http/gen/wasmcloud/secrets/store/abi.go +++ b/examples/component/wasitel-http/gen/wasmcloud/secrets/store/abi.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" "unsafe" ) diff --git a/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wasm.go b/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wasm.go index cc94c517..d2208168 100755 --- a/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wasm.go +++ b/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wasm.go @@ -1,9 +1,9 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // This file contains wasmimport and wasmexport declarations for "wasmcloud:secrets@0.1.0-draft". diff --git a/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wit.go b/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wit.go index d3465e4f..aeb006a6 100755 --- a/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wit.go +++ b/examples/component/wasitel-http/gen/wasmcloud/secrets/store/store.wit.go @@ -1,10 +1,10 @@ -// Code generated by wit-bindgen-go. DO NOT EDIT. +// Code generated by wasmcloud-wit-bindgen. DO NOT EDIT. // Package store represents the imported interface "wasmcloud:secrets/store@0.1.0-draft". package store import ( - "go.bytecodealliance.org/cm" + "go.wasmcloud.dev/component/cm" ) // SecretsError represents the variant "wasmcloud:secrets/store@0.1.0-draft#secrets-error". @@ -47,7 +47,7 @@ func (self *SecretsError) NotFound() bool { return self.Tag() == 2 } -var stringsSecretsError = [3]string{ +var _SecretsErrorStrings = [3]string{ "upstream", "io", "not-found", @@ -55,7 +55,7 @@ var stringsSecretsError = [3]string{ // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretsError) String() string { - return stringsSecretsError[v.Tag()] + return _SecretsErrorStrings[v.Tag()] } // SecretValue represents the variant "wasmcloud:secrets/store@0.1.0-draft#secret-value". @@ -64,7 +64,7 @@ func (v SecretsError) String() string { // %string(string), // bytes(list), // } -type SecretValue cm.Variant[uint8, string, cm.List[uint8]] +type SecretValue cm.Variant[uint8, string, string] // SecretValueString_ returns a [SecretValue] of case "string". func SecretValueString_(data string) SecretValue { @@ -86,14 +86,14 @@ func (self *SecretValue) Bytes() *cm.List[uint8] { return cm.Case[cm.List[uint8]](self, 1) } -var stringsSecretValue = [2]string{ +var _SecretValueStrings = [2]string{ "string", "bytes", } // String implements [fmt.Stringer], returning the variant case name of v. func (v SecretValue) String() string { - return stringsSecretValue[v.Tag()] + return _SecretValueStrings[v.Tag()] } // Secret represents the imported resource "wasmcloud:secrets/store@0.1.0-draft#secret". diff --git a/examples/component/wasitel-http/go.mod b/examples/component/wasitel-http/go.mod index b55241d8..a87f898a 100644 --- a/examples/component/wasitel-http/go.mod +++ b/examples/component/wasitel-http/go.mod @@ -3,9 +3,9 @@ module wasitel-http go 1.24 require ( - go.bytecodealliance.org/cm v0.1.0 - go.opentelemetry.io/otel v1.35.0 - go.opentelemetry.io/otel/sdk v1.35.0 + go.bytecodealliance.org/cm v0.2.2 + go.opentelemetry.io/otel v1.34.0 + go.opentelemetry.io/otel/sdk v1.34.0 go.wasmcloud.dev/component v0.0.6 go.wasmcloud.dev/x/wasitel v0.0.1 ) @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect - go.opentelemetry.io/otel/metric v1.35.0 // indirect - go.opentelemetry.io/otel/trace v1.35.0 // indirect + go.opentelemetry.io/otel/metric v1.34.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 // indirect ) require ( @@ -23,17 +23,17 @@ require ( github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/regclient/regclient v0.8.0 // indirect + github.com/regclient/regclient v0.8.2 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + github.com/tetratelabs/wazero v1.9.0 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/urfave/cli/v3 v3.0.0-beta1 // indirect - go.bytecodealliance.org v0.5.0 // indirect + go.bytecodealliance.org v0.6.2 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect - golang.org/x/mod v0.22.0 // indirect + golang.org/x/mod v0.23.0 // indirect golang.org/x/sys v0.30.0 // indirect ) -tool go.bytecodealliance.org/cmd/wit-bindgen-go - -// NOTE(lxf): Remove this line if running outside of wasmCloud/go repository replace go.wasmcloud.dev/component => ../../../component + +tool go.wasmcloud.dev/component/wit-bindgen diff --git a/examples/component/wasitel-http/go.sum b/examples/component/wasitel-http/go.sum index 6a637c17..1fb9f30f 100644 --- a/examples/component/wasitel-http/go.sum +++ b/examples/component/wasitel-http/go.sum @@ -10,8 +10,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= @@ -22,8 +22,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/regclient/regclient v0.8.0 h1:xNAMDlADcyMvFAlGXoqDOxlSUBG4mqWBFgjQqVTP8Og= -github.com/regclient/regclient v0.8.0/go.mod h1:h9+Y6dBvqBkdlrj6EIhbTOv0xUuIFl7CdI1bZvEB42g= +github.com/regclient/regclient v0.8.2 h1:23BQ3jWgKYHHIXUhp/S9laVJDHDoOQaQCzXMJ4undVE= +github.com/regclient/regclient v0.8.2/go.mod h1:uGyetv0o6VLyRDjtfeBqp/QBwRLJ3Hcn07/+8QbhNcM= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -32,37 +32,37 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= +github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg= github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y= -go.bytecodealliance.org v0.5.0 h1:ywhCpF0JdqGkqct5JqSY1Me8lz001UIJXUaCSS32cew= -go.bytecodealliance.org v0.5.0/go.mod h1:8kYTSxmQr8DU3dKOKCOHH1Ap1gWX/61qlFSbIuIno2Q= -go.bytecodealliance.org/cm v0.1.0 h1:78Rk4d5rgir5Hm+LMFpDWhjmFBWrKDFPSKUwDBj+nwo= -go.bytecodealliance.org/cm v0.1.0/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= +go.bytecodealliance.org v0.6.2 h1:Jy4u5DVmSkXgsnwojBhJ+AD/YsJsR3VzVnxF0xRCqTQ= +go.bytecodealliance.org v0.6.2/go.mod h1:gqjTJm0y9NSksG4py/lSjIQ/SNuIlOQ+hCIEPQwtJgA= +go.bytecodealliance.org/cm v0.2.2 h1:M9iHS6qs884mbQbIjtLX1OifgyPG9DuMs2iwz8G4WQA= +go.bytecodealliance.org/cm v0.2.2/go.mod h1:JD5vtVNZv7sBoQQkvBvAAVKJPhR/bqBH7yYXTItMfZI= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= -go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= -go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= -go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= -go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= -go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= -go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= -go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.wasmcloud.dev/x/wasitel v0.0.1 h1:b5jiibs0emOGOROhWVmMdQ526a3iTXFDqShIBgaDE5c= go.wasmcloud.dev/x/wasitel v0.0.1/go.mod h1:WkxbqT/S0PG78NIrnuUQI42fcLN2shh+x/rFYfXOClI= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= -golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/examples/component/wasitel-http/main.go b/examples/component/wasitel-http/main.go index 951102f2..e28347ed 100644 --- a/examples/component/wasitel-http/main.go +++ b/examples/component/wasitel-http/main.go @@ -1,4 +1,4 @@ -//go:generate go tool wit-bindgen-go generate --world example --out gen ./wit +//go:generate go tool wit-bindgen --world example --out gen ./wit package main @@ -24,12 +24,8 @@ func init() { } func echoHandler(w http.ResponseWriter, r *http.Request) { - if err := setupOTelSDK(); err != nil { - http.Error(w, "failed setting up otel", http.StatusInternalServerError) - return - } - ctx := r.Context() + setupOTelSDK() _, span := tracer.Start(ctx, serviceName) defer span.End()