feat: add scoped workflow instance queries and SDK pagination

This commit is contained in:
2026-09-18 08:34:45 +08:00
parent 17a8e0126c
commit 082898e705
33 changed files with 1598 additions and 18 deletions

View File

@@ -0,0 +1,27 @@
package instance
import (
"context"
"strings"
"testing"
"time"
"git.yuntuo.hk/k2safe/orbit/platform/auth"
)
func TestListBoundary(t *testing.T) {
store := &captureStore{}
api := New(store)
if _, err := api.List(context.Background(), auth.Token{}, ListInput{}); err != nil {
t.Fatal(err)
}
now := time.Now().UTC().Truncate(time.Microsecond)
for _, in := range []ListInput{{Limit: -1}, {Limit: 101}, {Cursor: strings.Repeat("x", 1025)}, {DefinitionID: "bad"}, {Version: "v1"}, {DefinitionID: "11111111111111111111111111111111", Version: "../v1"}, {State: "STOPPED"}, {BusinessKey: "\xff"}, {BusinessKey: "nul\x00"}, {BusinessKey: strings.Repeat("中", 192)}, {CreatedFrom: &now, CreatedBefore: &now}} {
if _, err := api.List(context.Background(), auth.Token{}, in); err == nil {
t.Fatal("invalid query accepted", in)
}
}
if store.calls != 1 {
t.Fatal("invalid query reached store")
}
}