From 7e5c29fdbf58f3e956ea929e336b4e99c06aa252 Mon Sep 17 00:00:00 2001 From: dawn Date: Sat, 29 Aug 2026 17:00:44 +0900 Subject: [PATCH] api,spindle,web: regen lex bindings and migrate spindle xrpc to org_tangled Signed-off-by: dawn --- api/org_tangled/modban.go | 30 ------- api/org_tangled/moddefs.go | 17 ---- api/{tangled => org_tangled}/moderationban.go | 2 +- .../moderationdefs.go | 2 +- .../moderationgetBan.go | 2 +- .../moderationlistBans.go | 2 +- .../moderationunban.go | 2 +- api/org_tangled/modgetBan.go | 36 --------- api/org_tangled/modlistBans.go | 31 ------- api/org_tangled/modunban.go | 30 ------- spindle/xrpc/ban.go | 16 ++-- spindle/xrpc/ban_test.go | 48 +++++------ spindle/xrpc/quota.go | 22 ++--- spindle/xrpc/quota_test.go | 80 +++++++++---------- spindle/xrpc/xrpc.go | 19 ++--- web/src/lib/api/lexicons/index.ts | 16 ++++ .../tangled/temp/spindle/moderation/ban.ts | 35 ++++++++ .../tangled/temp/spindle/moderation/defs.ts | 24 ++++++ .../tangled/temp/spindle/moderation/getBan.ts | 42 ++++++++++ .../temp/spindle/moderation/listBans.ts | 39 +++++++++ .../tangled/temp/spindle/moderation/unban.ts | 35 ++++++++ .../org/tangled/temp/spindle/quota/defs.ts | 53 ++++++++++++ .../org/tangled/temp/spindle/quota/get.ts | 46 +++++++++++ .../org/tangled/temp/spindle/quota/list.ts | 39 +++++++++ .../org/tangled/temp/spindle/quota/set.ts | 47 +++++++++++ .../org/tangled/temp/spindle/quota/unset.ts | 39 +++++++++ .../org/tangled/temp/spindle/quota/usage.ts | 50 ++++++++++++ .../types/sh/tangled/knot/memberAcceptance.ts | 28 +++++++ .../types/sh/tangled/knot/memberInvite.ts | 28 +++++++ .../types/sh/tangled/repo/checkPushAllowed.ts | 47 +++++++++++ .../sh/tangled/repo/collaboratorAcceptance.ts | 28 +++++++ .../sh/tangled/repo/collaboratorInvite.ts | 28 +++++++ 32 files changed, 722 insertions(+), 241 deletions(-) delete mode 100644 api/org_tangled/modban.go delete mode 100644 api/org_tangled/moddefs.go rename api/{tangled => org_tangled}/moderationban.go (97%) rename api/{tangled => org_tangled}/moderationdefs.go (96%) rename api/{tangled => org_tangled}/moderationgetBan.go (98%) rename api/{tangled => org_tangled}/moderationlistBans.go (98%) rename api/{tangled => org_tangled}/moderationunban.go (97%) delete mode 100644 api/org_tangled/modgetBan.go delete mode 100644 api/org_tangled/modlistBans.go delete mode 100644 api/org_tangled/modunban.go create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/ban.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/defs.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/getBan.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/listBans.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/unban.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/defs.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/get.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/list.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/set.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/unset.ts create mode 100644 web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/usage.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/memberAcceptance.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/memberInvite.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/checkPushAllowed.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorAcceptance.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorInvite.ts diff --git a/api/org_tangled/modban.go b/api/org_tangled/modban.go deleted file mode 100644 index c2023619b..000000000 --- a/api/org_tangled/modban.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package org_tangled - -// schema: org.tangled.temp.spindle.mod.ban - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModBanNSID = "org.tangled.temp.spindle.mod.ban" -) - -// TempSpindleModBan_Input is the input argument to a org.tangled.temp.spindle.mod.ban call. -type TempSpindleModBan_Input struct { - // did: DID of the repository or account owner to ban - Did string `json:"did" cborgen:"did"` -} - -// TempSpindleModBan calls the XRPC method "org.tangled.temp.spindle.mod.ban". -func TempSpindleModBan(ctx context.Context, c util.LexClient, input *TempSpindleModBan_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.mod.ban", nil, input, nil); err != nil { - return err - } - - return nil -} diff --git a/api/org_tangled/moddefs.go b/api/org_tangled/moddefs.go deleted file mode 100644 index c21dea8d1..000000000 --- a/api/org_tangled/moddefs.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package org_tangled - -// schema: org.tangled.temp.spindle.mod.defs - -const () - -// TempSpindleModDefs_Ban is a "ban" in the org.tangled.temp.spindle.mod.defs schema. -// -// an active ban for a repository or account owner -type TempSpindleModDefs_Ban struct { - // createdAt: time at which the ban was created - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - // did: DID of the banned subject, either a repository or its owner - Did string `json:"did" cborgen:"did"` -} diff --git a/api/tangled/moderationban.go b/api/org_tangled/moderationban.go similarity index 97% rename from api/tangled/moderationban.go rename to api/org_tangled/moderationban.go index f440c83c6..6fd05524a 100644 --- a/api/tangled/moderationban.go +++ b/api/org_tangled/moderationban.go @@ -1,6 +1,6 @@ // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. -package tangled +package org_tangled // schema: org.tangled.temp.spindle.moderation.ban diff --git a/api/tangled/moderationdefs.go b/api/org_tangled/moderationdefs.go similarity index 96% rename from api/tangled/moderationdefs.go rename to api/org_tangled/moderationdefs.go index 78c3ed93a..7e9b6b3b2 100644 --- a/api/tangled/moderationdefs.go +++ b/api/org_tangled/moderationdefs.go @@ -1,6 +1,6 @@ // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. -package tangled +package org_tangled // schema: org.tangled.temp.spindle.moderation.defs diff --git a/api/tangled/moderationgetBan.go b/api/org_tangled/moderationgetBan.go similarity index 98% rename from api/tangled/moderationgetBan.go rename to api/org_tangled/moderationgetBan.go index 53625d995..313c6f350 100644 --- a/api/tangled/moderationgetBan.go +++ b/api/org_tangled/moderationgetBan.go @@ -1,6 +1,6 @@ // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. -package tangled +package org_tangled // schema: org.tangled.temp.spindle.moderation.getBan diff --git a/api/tangled/moderationlistBans.go b/api/org_tangled/moderationlistBans.go similarity index 98% rename from api/tangled/moderationlistBans.go rename to api/org_tangled/moderationlistBans.go index ccfb883ac..439de85d1 100644 --- a/api/tangled/moderationlistBans.go +++ b/api/org_tangled/moderationlistBans.go @@ -1,6 +1,6 @@ // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. -package tangled +package org_tangled // schema: org.tangled.temp.spindle.moderation.listBans diff --git a/api/tangled/moderationunban.go b/api/org_tangled/moderationunban.go similarity index 97% rename from api/tangled/moderationunban.go rename to api/org_tangled/moderationunban.go index 398baa551..a2ea48936 100644 --- a/api/tangled/moderationunban.go +++ b/api/org_tangled/moderationunban.go @@ -1,6 +1,6 @@ // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. -package tangled +package org_tangled // schema: org.tangled.temp.spindle.moderation.unban diff --git a/api/org_tangled/modgetBan.go b/api/org_tangled/modgetBan.go deleted file mode 100644 index 9e4ab0182..000000000 --- a/api/org_tangled/modgetBan.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package org_tangled - -// schema: org.tangled.temp.spindle.mod.getBan - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModGetBanNSID = "org.tangled.temp.spindle.mod.getBan" -) - -// TempSpindleModGetBan_Output is the output of a org.tangled.temp.spindle.mod.getBan call. -type TempSpindleModGetBan_Output struct { - // ban: active ban matching the requested DID - Ban *TempSpindleModDefs_Ban `json:"ban" cborgen:"ban"` -} - -// TempSpindleModGetBan calls the XRPC method "org.tangled.temp.spindle.mod.getBan". -// -// did: DID of the repository or account owner to look up -func TempSpindleModGetBan(ctx context.Context, c util.LexClient, did string) (*TempSpindleModGetBan_Output, error) { - var out TempSpindleModGetBan_Output - - params := map[string]interface{}{} - params["did"] = did - if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.mod.getBan", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/org_tangled/modlistBans.go b/api/org_tangled/modlistBans.go deleted file mode 100644 index 287ac9329..000000000 --- a/api/org_tangled/modlistBans.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package org_tangled - -// schema: org.tangled.temp.spindle.mod.listBans - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModListBansNSID = "org.tangled.temp.spindle.mod.listBans" -) - -// TempSpindleModListBans_Output is the output of a org.tangled.temp.spindle.mod.listBans call. -type TempSpindleModListBans_Output struct { - // bans: active bans ordered by subject DID - Bans []*TempSpindleModDefs_Ban `json:"bans" cborgen:"bans"` -} - -// TempSpindleModListBans calls the XRPC method "org.tangled.temp.spindle.mod.listBans". -func TempSpindleModListBans(ctx context.Context, c util.LexClient) (*TempSpindleModListBans_Output, error) { - var out TempSpindleModListBans_Output - if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.mod.listBans", nil, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/org_tangled/modunban.go b/api/org_tangled/modunban.go deleted file mode 100644 index b2102dc77..000000000 --- a/api/org_tangled/modunban.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package org_tangled - -// schema: org.tangled.temp.spindle.mod.unban - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModUnbanNSID = "org.tangled.temp.spindle.mod.unban" -) - -// TempSpindleModUnban_Input is the input argument to a org.tangled.temp.spindle.mod.unban call. -type TempSpindleModUnban_Input struct { - // did: DID of the repository or account owner to unban - Did string `json:"did" cborgen:"did"` -} - -// TempSpindleModUnban calls the XRPC method "org.tangled.temp.spindle.mod.unban". -func TempSpindleModUnban(ctx context.Context, c util.LexClient, input *TempSpindleModUnban_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.mod.unban", nil, input, nil); err != nil { - return err - } - - return nil -} diff --git a/spindle/xrpc/ban.go b/spindle/xrpc/ban.go index 8a107634a..2dde5fa26 100644 --- a/spindle/xrpc/ban.go +++ b/spindle/xrpc/ban.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/bluesky-social/indigo/atproto/syntax" "net/http" - "tangled.org/core/api/tangled" + "tangled.org/core/api/org_tangled" "tangled.org/core/spindle/db" xrpcerr "tangled.org/core/xrpc/errors" ) @@ -24,7 +24,7 @@ func (x *Xrpc) Ban(w http.ResponseWriter, r *http.Request) { return } - var data tangled.TempSpindleModerationBan_Input + var data org_tangled.TempSpindleModerationBan_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -78,7 +78,7 @@ func (x *Xrpc) Unban(w http.ResponseWriter, r *http.Request) { return } - var data tangled.TempSpindleModerationUnban_Input + var data org_tangled.TempSpindleModerationUnban_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -143,8 +143,8 @@ func (x *Xrpc) GetBan(w http.ResponseWriter, r *http.Request) { return } - out := tangled.TempSpindleModerationGetBan_Output{ - Ban: &tangled.TempSpindleModerationDefs_Ban{ + out := org_tangled.TempSpindleModerationGetBan_Output{ + Ban: &org_tangled.TempSpindleModerationDefs_Ban{ Did: ban.SubjectDid.String(), CreatedAt: ban.CreatedAt, }, @@ -174,11 +174,11 @@ func (x *Xrpc) ListBans(w http.ResponseWriter, r *http.Request) { return } - out := tangled.TempSpindleModerationListBans_Output{ - Bans: make([]*tangled.TempSpindleModerationDefs_Ban, 0, len(bans)), + out := org_tangled.TempSpindleModerationListBans_Output{ + Bans: make([]*org_tangled.TempSpindleModerationDefs_Ban, 0, len(bans)), } for _, b := range bans { - out.Bans = append(out.Bans, &tangled.TempSpindleModerationDefs_Ban{ + out.Bans = append(out.Bans, &org_tangled.TempSpindleModerationDefs_Ban{ Did: b.SubjectDid.String(), CreatedAt: b.CreatedAt, }) diff --git a/spindle/xrpc/ban_test.go b/spindle/xrpc/ban_test.go index 0aeb24803..67c511c76 100644 --- a/spindle/xrpc/ban_test.go +++ b/spindle/xrpc/ban_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/bluesky-social/indigo/atproto/syntax" - "tangled.org/core/api/tangled" + "tangled.org/core/api/org_tangled" "tangled.org/core/rbac" "tangled.org/core/spindle/config" ) @@ -62,9 +62,9 @@ func setupBanTestXrpc(t *testing.T) (*Xrpc, *fakeRepoWiper, syntax.DID, syntax.D return x, wiper, ownerDid, nonOwnerDid } -func sendBan(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModerationBan_Input) (*httptest.ResponseRecorder, int) { +func sendBan(x *Xrpc, actor syntax.DID, input org_tangled.TempSpindleModerationBan_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModerationBanNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+org_tangled.TempSpindleModerationBanNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -74,9 +74,9 @@ func sendBan(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModerationBan_I return w, w.Code } -func sendUnban(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModerationUnban_Input) (*httptest.ResponseRecorder, int) { +func sendUnban(x *Xrpc, actor syntax.DID, input org_tangled.TempSpindleModerationUnban_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModerationUnbanNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+org_tangled.TempSpindleModerationUnbanNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -87,7 +87,7 @@ func sendUnban(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModerationUnb } func sendListBans(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { - req := httptest.NewRequest(http.MethodGet, "/"+tangled.TempSpindleModerationListBansNSID, nil) + req := httptest.NewRequest(http.MethodGet, "/"+org_tangled.TempSpindleModerationListBansNSID, nil) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -98,7 +98,7 @@ func sendListBans(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { } func sendGetBan(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRecorder, int) { - path := "/" + tangled.TempSpindleModerationGetBanNSID + path := "/" + org_tangled.TempSpindleModerationGetBanNSID if query != "" { path += "?" + query } @@ -115,7 +115,7 @@ func sendGetBan(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseReco func TestBan_OwnerAuth(t *testing.T) { x, _, ownerDid, nonOwnerDid := setupBanTestXrpc(t) - addInput := tangled.TempSpindleModerationBan_Input{ + addInput := org_tangled.TempSpindleModerationBan_Input{ Did: "did:plc:targetrepo", } @@ -149,7 +149,7 @@ func TestBan_OwnerAuth(t *testing.T) { t.Fatalf("expected 200 for owner ban list, got %d", code) } - removeInput := tangled.TempSpindleModerationUnban_Input{ + removeInput := org_tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:targetrepo", } @@ -174,17 +174,17 @@ func TestBan_ValidationErrors(t *testing.T) { tests := []struct { name string - input tangled.TempSpindleModerationBan_Input + input org_tangled.TempSpindleModerationBan_Input }{ { name: "invalid did", - input: tangled.TempSpindleModerationBan_Input{ + input: org_tangled.TempSpindleModerationBan_Input{ Did: "notadid", }, }, { name: "empty did", - input: tangled.TempSpindleModerationBan_Input{ + input: org_tangled.TempSpindleModerationBan_Input{ Did: "", }, }, @@ -208,17 +208,17 @@ func TestBan_ValidationErrors(t *testing.T) { removeTests := []struct { name string - input tangled.TempSpindleModerationUnban_Input + input org_tangled.TempSpindleModerationUnban_Input }{ { name: "invalid did remove", - input: tangled.TempSpindleModerationUnban_Input{ + input: org_tangled.TempSpindleModerationUnban_Input{ Did: "notadid", }, }, { name: "ban not found", - input: tangled.TempSpindleModerationUnban_Input{ + input: org_tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:nonexistent", }, }, @@ -234,7 +234,7 @@ func TestBan_ValidationErrors(t *testing.T) { } wiper.err = errors.New("wipe network error") - _, code := sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{ + _, code := sendBan(x, ownerDid, org_tangled.TempSpindleModerationBan_Input{ Did: "did:plc:errorrepo", }) if code != http.StatusInternalServerError { @@ -245,7 +245,7 @@ func TestBan_ValidationErrors(t *testing.T) { func TestBan_RoundTrip(t *testing.T) { x, wiper, ownerDid, _ := setupBanTestXrpc(t) - w, code := sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{ + w, code := sendBan(x, ownerDid, org_tangled.TempSpindleModerationBan_Input{ Did: "did:plc:repo123", }) if code != http.StatusOK { @@ -261,7 +261,7 @@ func TestBan_RoundTrip(t *testing.T) { t.Fatalf("expected wipe reason 'banned', got %v", wiper.repoReasons) } - w, code = sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{ + w, code = sendBan(x, ownerDid, org_tangled.TempSpindleModerationBan_Input{ Did: "did:plc:badactor", }) if code != http.StatusOK { @@ -278,7 +278,7 @@ func TestBan_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for ban list, got %d", code) } - var listOut tangled.TempSpindleModerationListBans_Output + var listOut org_tangled.TempSpindleModerationListBans_Output if err := json.Unmarshal(w.Body.Bytes(), &listOut); err != nil { t.Fatalf("failed to decode ban list output: %v", err) } @@ -300,14 +300,14 @@ func TestBan_RoundTrip(t *testing.T) { t.Fatalf("expected both repo and owner bans in list, got %+v", listOut.Bans) } - w, code = sendUnban(x, ownerDid, tangled.TempSpindleModerationUnban_Input{ + w, code = sendUnban(x, ownerDid, org_tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:repo123", }) if code != http.StatusOK { t.Fatalf("expected 200 for repo ban remove, got %d", code) } - w, code = sendUnban(x, ownerDid, tangled.TempSpindleModerationUnban_Input{ + w, code = sendUnban(x, ownerDid, org_tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:repo123", }) if code != http.StatusBadRequest { @@ -318,7 +318,7 @@ func TestBan_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for ban list after remove, got %d", code) } - var afterRemoveOut tangled.TempSpindleModerationListBans_Output + var afterRemoveOut org_tangled.TempSpindleModerationListBans_Output if err := json.Unmarshal(w.Body.Bytes(), &afterRemoveOut); err != nil { t.Fatalf("failed to decode ban list output: %v", err) } @@ -335,7 +335,7 @@ func TestGetBan(t *testing.T) { t.Fatalf("expected 404 before the ban, got %d", code) } - if _, code := sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{Did: banned.String()}); code != http.StatusOK { + if _, code := sendBan(x, ownerDid, org_tangled.TempSpindleModerationBan_Input{Did: banned.String()}); code != http.StatusOK { t.Fatalf("ban add: expected 200, got %d", code) } @@ -343,7 +343,7 @@ func TestGetBan(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 after the ban, got %d", code) } - var out tangled.TempSpindleModerationGetBan_Output + var out org_tangled.TempSpindleModerationGetBan_Output if err := json.Unmarshal(w.Body.Bytes(), &out); err != nil { t.Fatalf("decode: %v", err) } diff --git a/spindle/xrpc/quota.go b/spindle/xrpc/quota.go index 0a88fedea..7a08b82c0 100644 --- a/spindle/xrpc/quota.go +++ b/spindle/xrpc/quota.go @@ -7,7 +7,7 @@ import ( "net/http" "github.com/bluesky-social/indigo/atproto/syntax" - "tangled.org/core/api/tangled" + "tangled.org/core/api/org_tangled" "tangled.org/core/rbac" "tangled.org/core/spindle/db" "tangled.org/core/spindle/quota" @@ -58,7 +58,7 @@ func (x *Xrpc) SetLimit(w http.ResponseWriter, r *http.Request) { return } - var data tangled.TempSpindleQuotaSet_Input + var data org_tangled.TempSpindleQuotaSet_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -122,7 +122,7 @@ func (x *Xrpc) UnsetLimit(w http.ResponseWriter, r *http.Request) { return } - var data tangled.TempSpindleQuotaUnset_Input + var data org_tangled.TempSpindleQuotaUnset_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -190,8 +190,8 @@ func (x *Xrpc) GetLimit(w http.ResponseWriter, r *http.Request) { return } - out := tangled.TempSpindleQuotaGet_Output{ - Limit: &tangled.TempSpindleQuotaDefs_Limit{ + out := org_tangled.TempSpindleQuotaGet_Output{ + Limit: &org_tangled.TempSpindleQuotaDefs_Limit{ Did: lim.DID, Resource: lim.Resource, Limit: lim.Limit, @@ -228,11 +228,11 @@ func (x *Xrpc) ListLimits(w http.ResponseWriter, r *http.Request) { return } - out := tangled.TempSpindleQuotaList_Output{ - Limits: make([]*tangled.TempSpindleQuotaDefs_Limit, 0, len(limits)), + out := org_tangled.TempSpindleQuotaList_Output{ + Limits: make([]*org_tangled.TempSpindleQuotaDefs_Limit, 0, len(limits)), } for _, lim := range limits { - out.Limits = append(out.Limits, &tangled.TempSpindleQuotaDefs_Limit{ + out.Limits = append(out.Limits, &org_tangled.TempSpindleQuotaDefs_Limit{ Did: lim.DID, Resource: lim.Resource, Limit: lim.Limit, @@ -283,8 +283,8 @@ func (x *Xrpc) GetUsage(w http.ResponseWriter, r *http.Request) { return } - out := tangled.TempSpindleQuotaUsage_Output{ - Usages: make([]*tangled.TempSpindleQuotaDefs_Usage, 0), + out := org_tangled.TempSpindleQuotaUsage_Output{ + Usages: make([]*org_tangled.TempSpindleQuotaDefs_Usage, 0), } for _, u := range usages { if scopeFilter != "" && string(u.Scope) != scopeFilter { @@ -293,7 +293,7 @@ func (x *Xrpc) GetUsage(w http.ResponseWriter, r *http.Request) { if didFilter != "" && u.DID != didFilter { continue } - out.Usages = append(out.Usages, &tangled.TempSpindleQuotaDefs_Usage{ + out.Usages = append(out.Usages, &org_tangled.TempSpindleQuotaDefs_Usage{ Scope: string(u.Scope), Did: u.DID, Resource: u.Resource, diff --git a/spindle/xrpc/quota_test.go b/spindle/xrpc/quota_test.go index fa20d973f..7c84292b5 100644 --- a/spindle/xrpc/quota_test.go +++ b/spindle/xrpc/quota_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/bluesky-social/indigo/atproto/syntax" - "tangled.org/core/api/tangled" + "tangled.org/core/api/org_tangled" "tangled.org/core/rbac" "tangled.org/core/spindle/config" "tangled.org/core/spindle/db" @@ -45,9 +45,9 @@ func setupQuotaTestXrpc(t *testing.T) (*Xrpc, syntax.DID, syntax.DID) { return x, ownerDid, nonOwnerDid } -func sendSetLimit(x *Xrpc, actor syntax.DID, input tangled.TempSpindleQuotaSet_Input) (*httptest.ResponseRecorder, int) { +func sendSetLimit(x *Xrpc, actor syntax.DID, input org_tangled.TempSpindleQuotaSet_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleQuotaSetNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+org_tangled.TempSpindleQuotaSetNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -57,9 +57,9 @@ func sendSetLimit(x *Xrpc, actor syntax.DID, input tangled.TempSpindleQuotaSet_I return w, w.Code } -func sendUnsetLimit(x *Xrpc, actor syntax.DID, input tangled.TempSpindleQuotaUnset_Input) (*httptest.ResponseRecorder, int) { +func sendUnsetLimit(x *Xrpc, actor syntax.DID, input org_tangled.TempSpindleQuotaUnset_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleQuotaUnsetNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+org_tangled.TempSpindleQuotaUnsetNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -70,7 +70,7 @@ func sendUnsetLimit(x *Xrpc, actor syntax.DID, input tangled.TempSpindleQuotaUns } func sendListLimits(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { - req := httptest.NewRequest(http.MethodGet, "/"+tangled.TempSpindleQuotaListNSID, nil) + req := httptest.NewRequest(http.MethodGet, "/"+org_tangled.TempSpindleQuotaListNSID, nil) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -81,7 +81,7 @@ func sendListLimits(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) } func sendGetLimit(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRecorder, int) { - path := "/" + tangled.TempSpindleQuotaGetNSID + path := "/" + org_tangled.TempSpindleQuotaGetNSID if query != "" { path += "?" + query } @@ -96,7 +96,7 @@ func sendGetLimit(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRe } func sendGetUsage(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRecorder, int) { - path := "/" + tangled.TempSpindleQuotaUsageNSID + path := "/" + org_tangled.TempSpindleQuotaUsageNSID if query != "" { path += "?" + query } @@ -114,7 +114,7 @@ func TestQuota_OwnerAuth(t *testing.T) { x, ownerDid, nonOwnerDid := setupQuotaTestXrpc(t) limitVal := int64(10) - setInput := tangled.TempSpindleQuotaSet_Input{ + setInput := org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &limitVal, @@ -161,7 +161,7 @@ func TestQuota_OwnerAuth(t *testing.T) { t.Fatalf("expected 401 for missing actor usage, got %d", code) } - unsetInput := tangled.TempSpindleQuotaUnset_Input{ + unsetInput := org_tangled.TempSpindleQuotaUnset_Input{ Did: "did:plc:alice", Resource: "workflows", } @@ -202,11 +202,11 @@ func TestQuota_ValidationErrors(t *testing.T) { tests := []struct { name string - input tangled.TempSpindleQuotaSet_Input + input org_tangled.TempSpindleQuotaSet_Input }{ { name: "invalid DID", - input: tangled.TempSpindleQuotaSet_Input{ + input: org_tangled.TempSpindleQuotaSet_Input{ Did: "alice", Resource: "workflows", Limit: &limitVal, @@ -214,7 +214,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "malformed DID did:", - input: tangled.TempSpindleQuotaSet_Input{ + input: org_tangled.TempSpindleQuotaSet_Input{ Did: "did:", Resource: "workflows", Limit: &limitVal, @@ -222,7 +222,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "malformed DID notadid", - input: tangled.TempSpindleQuotaSet_Input{ + input: org_tangled.TempSpindleQuotaSet_Input{ Did: "notadid", Resource: "workflows", Limit: &limitVal, @@ -230,7 +230,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "empty resource", - input: tangled.TempSpindleQuotaSet_Input{ + input: org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "", Limit: &limitVal, @@ -238,7 +238,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "resource too long", - input: tangled.TempSpindleQuotaSet_Input{ + input: org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: strings.Repeat("a", 65), Limit: &limitVal, @@ -246,14 +246,14 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "missing limit and unlimited", - input: tangled.TempSpindleQuotaSet_Input{ + input: org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", }, }, { name: "conflicting limit and unlimited", - input: tangled.TempSpindleQuotaSet_Input{ + input: org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &limitVal, @@ -262,9 +262,9 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "negative limit", - input: func() tangled.TempSpindleQuotaSet_Input { + input: func() org_tangled.TempSpindleQuotaSet_Input { neg := int64(-5) - return tangled.TempSpindleQuotaSet_Input{ + return org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &neg, @@ -273,9 +273,9 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "zero limit", - input: func() tangled.TempSpindleQuotaSet_Input { + input: func() org_tangled.TempSpindleQuotaSet_Input { zero := int64(0) - return tangled.TempSpindleQuotaSet_Input{ + return org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &zero, @@ -295,32 +295,32 @@ func TestQuota_ValidationErrors(t *testing.T) { unsetTests := []struct { name string - input tangled.TempSpindleQuotaUnset_Input + input org_tangled.TempSpindleQuotaUnset_Input }{ { name: "invalid did unset", - input: tangled.TempSpindleQuotaUnset_Input{ + input: org_tangled.TempSpindleQuotaUnset_Input{ Did: "not-a-did", Resource: "workflows", }, }, { name: "malformed DID did: unset", - input: tangled.TempSpindleQuotaUnset_Input{ + input: org_tangled.TempSpindleQuotaUnset_Input{ Did: "did:", Resource: "workflows", }, }, { name: "malformed DID notadid unset", - input: tangled.TempSpindleQuotaUnset_Input{ + input: org_tangled.TempSpindleQuotaUnset_Input{ Did: "notadid", Resource: "workflows", }, }, { name: "empty resource unset", - input: tangled.TempSpindleQuotaUnset_Input{ + input: org_tangled.TempSpindleQuotaUnset_Input{ Did: "did:plc:alice", Resource: "", }, @@ -375,7 +375,7 @@ func TestQuota_RoundTrip(t *testing.T) { limit2 := int64(524288000) // 500 MiB in raw bytes unlimited := true - w, code := sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{ + w, code := sendSetLimit(x, ownerDid, org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &limit1, @@ -384,7 +384,7 @@ func TestQuota_RoundTrip(t *testing.T) { t.Fatalf("expected 200 for set workflows, got %d (body: %s)", code, w.Body.String()) } - w, code = sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{ + w, code = sendSetLimit(x, ownerDid, org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "cache_storage_bytes", Limit: &limit2, @@ -393,7 +393,7 @@ func TestQuota_RoundTrip(t *testing.T) { t.Fatalf("expected 200 for set cache_storage_bytes, got %d", code) } - w, code = sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{ + w, code = sendSetLimit(x, ownerDid, org_tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:repo123", Resource: "vcpus", Unlimited: &unlimited, @@ -406,7 +406,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for list limits, got %d", code) } - var listOut tangled.TempSpindleQuotaList_Output + var listOut org_tangled.TempSpindleQuotaList_Output if err := json.Unmarshal(w.Body.Bytes(), &listOut); err != nil { t.Fatalf("failed to unmarshal list limits output: %v", err) } @@ -462,7 +462,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for usage query, got %d", code) } - var usageOut tangled.TempSpindleQuotaUsage_Output + var usageOut org_tangled.TempSpindleQuotaUsage_Output if err := json.Unmarshal(w.Body.Bytes(), &usageOut); err != nil { t.Fatalf("failed to unmarshal usage output: %v", err) } @@ -474,7 +474,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for filtered usage, got %d", code) } - var userUsageOut tangled.TempSpindleQuotaUsage_Output + var userUsageOut org_tangled.TempSpindleQuotaUsage_Output if err := json.Unmarshal(w.Body.Bytes(), &userUsageOut); err != nil { t.Fatalf("failed to unmarshal filtered usage: %v", err) } @@ -486,7 +486,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for empty filtered usage, got %d", code) } - var emptyUsageOut tangled.TempSpindleQuotaUsage_Output + var emptyUsageOut org_tangled.TempSpindleQuotaUsage_Output if err := json.Unmarshal(w.Body.Bytes(), &emptyUsageOut); err != nil { t.Fatalf("failed to unmarshal empty usage output: %v", err) } @@ -494,7 +494,7 @@ func TestQuota_RoundTrip(t *testing.T) { t.Fatalf("expected 0 usages for nonexistent did, got %d", len(emptyUsageOut.Usages)) } - w, code = sendUnsetLimit(x, ownerDid, tangled.TempSpindleQuotaUnset_Input{ + w, code = sendUnsetLimit(x, ownerDid, org_tangled.TempSpindleQuotaUnset_Input{ Did: "did:plc:alice", Resource: "workflows", }) @@ -506,7 +506,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for list limits after unset, got %d", code) } - var afterUnsetOut tangled.TempSpindleQuotaList_Output + var afterUnsetOut org_tangled.TempSpindleQuotaList_Output if err := json.Unmarshal(w.Body.Bytes(), &afterUnsetOut); err != nil { t.Fatalf("failed to unmarshal list limits output: %v", err) } @@ -530,7 +530,7 @@ func TestGetLimit(t *testing.T) { } limit := int64(7) - if _, code := sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{Did: did, Resource: "workflows", Limit: &limit}); code != http.StatusOK { + if _, code := sendSetLimit(x, ownerDid, org_tangled.TempSpindleQuotaSet_Input{Did: did, Resource: "workflows", Limit: &limit}); code != http.StatusOK { t.Fatal("set limit failed") } @@ -538,7 +538,7 @@ func TestGetLimit(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for a set override, got %d", code) } - var out tangled.TempSpindleQuotaGet_Output + var out org_tangled.TempSpindleQuotaGet_Output if err := json.Unmarshal(w.Body.Bytes(), &out); err != nil { t.Fatalf("decode: %v", err) } @@ -547,14 +547,14 @@ func TestGetLimit(t *testing.T) { } unlimited := true - if _, code := sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{Did: did, Resource: "workflows", Unlimited: &unlimited}); code != http.StatusOK { + if _, code := sendSetLimit(x, ownerDid, org_tangled.TempSpindleQuotaSet_Input{Did: did, Resource: "workflows", Unlimited: &unlimited}); code != http.StatusOK { t.Fatal("set unlimited failed") } w, code = sendGetLimit(x, ownerDid, "did="+did+"&resource=workflows") if code != http.StatusOK { t.Fatalf("expected 200 for an unlimited override, got %d", code) } - out = tangled.TempSpindleQuotaGet_Output{} + out = org_tangled.TempSpindleQuotaGet_Output{} if err := json.Unmarshal(w.Body.Bytes(), &out); err != nil { t.Fatalf("decode: %v", err) } diff --git a/spindle/xrpc/xrpc.go b/spindle/xrpc/xrpc.go index 13bc14a7e..c88566843 100644 --- a/spindle/xrpc/xrpc.go +++ b/spindle/xrpc/xrpc.go @@ -12,6 +12,7 @@ import ( "github.com/bluesky-social/indigo/atproto/syntax" "github.com/go-chi/chi/v5" + "tangled.org/core/api/org_tangled" "tangled.org/core/api/tangled" "tangled.org/core/idresolver" "tangled.org/core/notifier" @@ -83,15 +84,15 @@ func (x *Xrpc) Router() http.Handler { r.Get("/"+tangled.RepoListSecretsNSID, x.ListSecrets) r.Post("/"+tangled.CiCancelPipelineNSID, x.CancelPipeline) r.Post("/"+tangled.CiTriggerPipelineNSID, x.TriggerPipeline) - r.Post("/"+tangled.TempSpindleQuotaSetNSID, x.SetLimit) - r.Post("/"+tangled.TempSpindleQuotaUnsetNSID, x.UnsetLimit) - r.Get("/"+tangled.TempSpindleQuotaGetNSID, x.GetLimit) - r.Get("/"+tangled.TempSpindleQuotaListNSID, x.ListLimits) - r.Get("/"+tangled.TempSpindleQuotaUsageNSID, x.GetUsage) - r.Post("/"+tangled.TempSpindleModerationBanNSID, x.Ban) - r.Post("/"+tangled.TempSpindleModerationUnbanNSID, x.Unban) - r.Get("/"+tangled.TempSpindleModerationGetBanNSID, x.GetBan) - r.Get("/"+tangled.TempSpindleModerationListBansNSID, x.ListBans) + r.Post("/"+org_tangled.TempSpindleQuotaSetNSID, x.SetLimit) + r.Post("/"+org_tangled.TempSpindleQuotaUnsetNSID, x.UnsetLimit) + r.Get("/"+org_tangled.TempSpindleQuotaGetNSID, x.GetLimit) + r.Get("/"+org_tangled.TempSpindleQuotaListNSID, x.ListLimits) + r.Get("/"+org_tangled.TempSpindleQuotaUsageNSID, x.GetUsage) + r.Post("/"+org_tangled.TempSpindleModerationBanNSID, x.Ban) + r.Post("/"+org_tangled.TempSpindleModerationUnbanNSID, x.Unban) + r.Get("/"+org_tangled.TempSpindleModerationGetBanNSID, x.GetBan) + r.Get("/"+org_tangled.TempSpindleModerationListBansNSID, x.ListBans) }) // service query endpoints (no auth required) diff --git a/web/src/lib/api/lexicons/index.ts b/web/src/lib/api/lexicons/index.ts index 98dc52e68..84f1baf73 100644 --- a/web/src/lib/api/lexicons/index.ts +++ b/web/src/lib/api/lexicons/index.ts @@ -35,6 +35,17 @@ export * as OrgTangledTempSearchSearchCode from "./types/org/tangled/temp/search export * as OrgTangledTempSiteClaimDomain from "./types/org/tangled/temp/site/claimDomain.js"; export * as OrgTangledTempSiteGetDomainClaim from "./types/org/tangled/temp/site/getDomainClaim.js"; export * as OrgTangledTempSiteReleaseDomain from "./types/org/tangled/temp/site/releaseDomain.js"; +export * as OrgTangledTempSpindleModerationBan from "./types/org/tangled/temp/spindle/moderation/ban.js"; +export * as OrgTangledTempSpindleModerationDefs from "./types/org/tangled/temp/spindle/moderation/defs.js"; +export * as OrgTangledTempSpindleModerationGetBan from "./types/org/tangled/temp/spindle/moderation/getBan.js"; +export * as OrgTangledTempSpindleModerationListBans from "./types/org/tangled/temp/spindle/moderation/listBans.js"; +export * as OrgTangledTempSpindleModerationUnban from "./types/org/tangled/temp/spindle/moderation/unban.js"; +export * as OrgTangledTempSpindleQuotaDefs from "./types/org/tangled/temp/spindle/quota/defs.js"; +export * as OrgTangledTempSpindleQuotaGet from "./types/org/tangled/temp/spindle/quota/get.js"; +export * as OrgTangledTempSpindleQuotaList from "./types/org/tangled/temp/spindle/quota/list.js"; +export * as OrgTangledTempSpindleQuotaSet from "./types/org/tangled/temp/spindle/quota/set.js"; +export * as OrgTangledTempSpindleQuotaUnset from "./types/org/tangled/temp/spindle/quota/unset.js"; +export * as OrgTangledTempSpindleQuotaUsage from "./types/org/tangled/temp/spindle/quota/usage.js"; export * as ShTangledActorDefs from "./types/sh/tangled/actor/defs.js"; export * as ShTangledActorGetProfile from "./types/sh/tangled/actor/getProfile.js"; export * as ShTangledActorGetProfiles from "./types/sh/tangled/actor/getProfiles.js"; @@ -122,6 +133,8 @@ export * as ShTangledKnotListKnots from "./types/sh/tangled/knot/listKnots.js"; export * as ShTangledKnotListMembers from "./types/sh/tangled/knot/listMembers.js"; export * as ShTangledKnotListMembersBy from "./types/sh/tangled/knot/listMembersBy.js"; export * as ShTangledKnotMember from "./types/sh/tangled/knot/member.js"; +export * as ShTangledKnotMemberAcceptance from "./types/sh/tangled/knot/memberAcceptance.js"; +export * as ShTangledKnotMemberInvite from "./types/sh/tangled/knot/memberInvite.js"; export * as ShTangledKnotRemoveMember from "./types/sh/tangled/knot/removeMember.js"; export * as ShTangledKnotSubscribeRepos from "./types/sh/tangled/knot/subscribeRepos.js"; export * as ShTangledKnotVersion from "./types/sh/tangled/knot/version.js"; @@ -162,7 +175,10 @@ export * as ShTangledRepoArtifact from "./types/sh/tangled/repo/artifact.js"; export * as ShTangledRepoBlob from "./types/sh/tangled/repo/blob.js"; export * as ShTangledRepoBranch from "./types/sh/tangled/repo/branch.js"; export * as ShTangledRepoBranches from "./types/sh/tangled/repo/branches.js"; +export * as ShTangledRepoCheckPushAllowed from "./types/sh/tangled/repo/checkPushAllowed.js"; export * as ShTangledRepoCollaborator from "./types/sh/tangled/repo/collaborator.js"; +export * as ShTangledRepoCollaboratorAcceptance from "./types/sh/tangled/repo/collaboratorAcceptance.js"; +export * as ShTangledRepoCollaboratorInvite from "./types/sh/tangled/repo/collaboratorInvite.js"; export * as ShTangledRepoCompare from "./types/sh/tangled/repo/compare.js"; export * as ShTangledRepoCountArtifacts from "./types/sh/tangled/repo/countArtifacts.js"; export * as ShTangledRepoCountArtifactsBy from "./types/sh/tangled/repo/countArtifactsBy.js"; diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/ban.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/ban.ts new file mode 100644 index 000000000..83f4c8e56 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/ban.ts @@ -0,0 +1,35 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "org.tangled.temp.spindle.moderation.ban", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the repository or account owner to ban + */ + did: /*#__PURE__*/ v.didString(), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "org.tangled.temp.spindle.moderation.ban": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/defs.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/defs.ts new file mode 100644 index 000000000..17db1a5b3 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/defs.ts @@ -0,0 +1,24 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _banSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.temp.spindle.moderation.defs#ban"), + ), + /** + * time at which the ban was created + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * DID of the banned subject, either a repository or its owner + */ + did: /*#__PURE__*/ v.didString(), +}); + +type ban$schematype = typeof _banSchema; + +export interface banSchema extends ban$schematype {} + +export const banSchema = _banSchema as banSchema; + +export interface Ban extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/getBan.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/getBan.ts new file mode 100644 index 000000000..33729dfd3 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/getBan.ts @@ -0,0 +1,42 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledTempSpindleModerationDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.temp.spindle.moderation.getBan", + { + params: /*#__PURE__*/ v.object({ + /** + * DID of the repository or account owner to look up + */ + did: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * active ban matching the requested DID + */ + get ban() { + return OrgTangledTempSpindleModerationDefs.banSchema; + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.temp.spindle.moderation.getBan": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/listBans.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/listBans.ts new file mode 100644 index 000000000..e7daed85b --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/listBans.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledTempSpindleModerationDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.temp.spindle.moderation.listBans", + { + params: null, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * active bans ordered by subject DID + */ + get bans() { + return /*#__PURE__*/ v.array( + OrgTangledTempSpindleModerationDefs.banSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.temp.spindle.moderation.listBans": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/unban.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/unban.ts new file mode 100644 index 000000000..29a727f9b --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/moderation/unban.ts @@ -0,0 +1,35 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "org.tangled.temp.spindle.moderation.unban", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the repository or account owner to unban + */ + did: /*#__PURE__*/ v.didString(), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "org.tangled.temp.spindle.moderation.unban": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/defs.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/defs.ts new file mode 100644 index 000000000..6d1735247 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/defs.ts @@ -0,0 +1,53 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _limitSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.temp.spindle.quota.defs#limit"), + ), + /** + * DID whose quota is overridden, either a repository or an account owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * maximum amount in the resource's native units; -1 means unlimited + */ + limit: /*#__PURE__*/ v.integer(), + /** + * quota resource name + */ + resource: /*#__PURE__*/ v.string(), +}); +const _usageSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.temp.spindle.quota.defs#usage"), + ), + /** + * DID for the user or repository scope + */ + did: /*#__PURE__*/ v.didString(), + /** + * quota resource name + */ + resource: /*#__PURE__*/ v.string(), + /** + * aggregation axis for this row: user or repo + */ + scope: /*#__PURE__*/ v.string<"repo" | "user" | (string & {})>(), + /** + * amount currently allocated or reserved in native resource units + */ + used: /*#__PURE__*/ v.integer(), +}); + +type limit$schematype = typeof _limitSchema; +type usage$schematype = typeof _usageSchema; + +export interface limitSchema extends limit$schematype {} +export interface usageSchema extends usage$schematype {} + +export const limitSchema = _limitSchema as limitSchema; +export const usageSchema = _usageSchema as usageSchema; + +export interface Limit extends v.InferInput {} +export interface Usage extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/get.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/get.ts new file mode 100644 index 000000000..8f299dd90 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/get.ts @@ -0,0 +1,46 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledTempSpindleQuotaDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.temp.spindle.quota.get", + { + params: /*#__PURE__*/ v.object({ + /** + * DID of the repository or account owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * quota resource to look up + */ + resource: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * quota override for the requested DID and resource + */ + get limit() { + return OrgTangledTempSpindleQuotaDefs.limitSchema; + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.temp.spindle.quota.get": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/list.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/list.ts new file mode 100644 index 000000000..b1934e354 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/list.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledTempSpindleQuotaDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.temp.spindle.quota.list", + { + params: null, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * quota overrides ordered by DID and resource + */ + get limits() { + return /*#__PURE__*/ v.array( + OrgTangledTempSpindleQuotaDefs.limitSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.temp.spindle.quota.list": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/set.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/set.ts new file mode 100644 index 000000000..9088d2893 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/set.ts @@ -0,0 +1,47 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "org.tangled.temp.spindle.quota.set", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the repository or account owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * positive maximum in the resource's native units; cannot be combined with unlimited + */ + limit: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + /** + * quota resource name, such as workflows, vcpus, memory_mib, disk_mib, or cache_storage_bytes + */ + resource: /*#__PURE__*/ v.string(), + /** + * store an unlimited override; cannot be combined with limit + */ + unlimited: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "org.tangled.temp.spindle.quota.set": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/unset.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/unset.ts new file mode 100644 index 000000000..14fb98e6a --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/unset.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "org.tangled.temp.spindle.quota.unset", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the repository or account owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * quota resource whose override to remove + */ + resource: /*#__PURE__*/ v.string(), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "org.tangled.temp.spindle.quota.unset": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/usage.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/usage.ts new file mode 100644 index 000000000..3c45ff4a9 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/spindle/quota/usage.ts @@ -0,0 +1,50 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledTempSpindleQuotaDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.temp.spindle.quota.usage", + { + params: /*#__PURE__*/ v.object({ + /** + * limit results to rows for this subject DID + */ + did: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * limit results to one aggregation axis: user or repo + */ + scope: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"repo" | "user" | (string & {})>(), + ), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * non-zero usage rows, including active reservations and committed allocations + */ + get usages() { + return /*#__PURE__*/ v.array( + OrgTangledTempSpindleQuotaDefs.usageSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.temp.spindle.quota.usage": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/memberAcceptance.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/memberAcceptance.ts new file mode 100644 index 000000000..0822f0699 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/memberAcceptance.ts @@ -0,0 +1,28 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.knot.memberAcceptance"), + /** + * Invite acceptance timestamp + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.knot.memberAcceptance": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/memberInvite.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/memberInvite.ts new file mode 100644 index 000000000..f363c7e2d --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/memberInvite.ts @@ -0,0 +1,28 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.knot.memberInvite"), + /** + * Invite issue timestamp + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.knot.memberInvite": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/checkPushAllowed.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/checkPushAllowed.ts new file mode 100644 index 000000000..b6bfda259 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/checkPushAllowed.ts @@ -0,0 +1,47 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.checkPushAllowed", { + params: /*#__PURE__*/ v.object({ + /** + * Public key in OpenSSH authorized_keys format. + * @maxLength 4096 + */ + key: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 4096), + ]), + /** + * A repo DID. + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Whether the key's owner may push to the repo. + */ + allowed: /*#__PURE__*/ v.boolean(), + /** + * DID the key resolved to, if a match was found. + */ + did: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.checkPushAllowed": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorAcceptance.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorAcceptance.ts new file mode 100644 index 000000000..6f92751e0 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorAcceptance.ts @@ -0,0 +1,28 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.collaboratorAcceptance"), + /** + * Invite acceptance timestamp + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.collaboratorAcceptance": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorInvite.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorInvite.ts new file mode 100644 index 000000000..e42c81673 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/collaboratorInvite.ts @@ -0,0 +1,28 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.collaboratorInvite"), + /** + * Invite issue timestamp + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.collaboratorInvite": mainSchema; + } +} -- 2.51.2