Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: updated server package
=45587d58e2a4
diff --git a/backend-go/pkg/api/README.md b/backend-go/pkg/chita/README.mdsimilarity index 100%rename from backend-go/pkg/api/README.mdrename to backend-go/pkg/chita/README.mddiff --git a/backend-go/pkg/api/auth.go b/backend-go/pkg/chita/auth.gosimilarity index 99%rename from backend-go/pkg/api/auth.gorename to backend-go/pkg/chita/auth.goindex 99768c5a83..6d8ca96bff 100644--- a/backend-go/pkg/api/auth.go+++ b/backend-go/pkg/chita/auth.go@@ -1,4 +1,4 @@-package api+package chitaimport ("context"diff --git a/backend-go/pkg/api/auth_test.go b/backend-go/pkg/chita/auth_test.gosimilarity index 99%rename from backend-go/pkg/api/auth_test.gorename to backend-go/pkg/chita/auth_test.goindex ce97ed0445..86e8c3643d 100644--- a/backend-go/pkg/api/auth_test.go+++ b/backend-go/pkg/chita/auth_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("context"diff --git a/backend-go/pkg/api/endpoint.go b/backend-go/pkg/chita/endpoint.gosimilarity index 99%rename from backend-go/pkg/api/endpoint.gorename to backend-go/pkg/chita/endpoint.goindex 0a6d65c60b..c868d89e24 100644--- a/backend-go/pkg/api/endpoint.go+++ b/backend-go/pkg/chita/endpoint.go@@ -1,4 +1,4 @@-package api+package chitaimport ("net/http"diff --git a/backend-go/pkg/api/errors.go b/backend-go/pkg/chita/errors.gosimilarity index 99%rename from backend-go/pkg/api/errors.gorename to backend-go/pkg/chita/errors.goindex c0b672ff52..eb929e6280 100644--- a/backend-go/pkg/api/errors.go+++ b/backend-go/pkg/chita/errors.go@@ -1,4 +1,4 @@-package api+package chitaimport ("errors"diff --git a/backend-go/pkg/api/handler.go b/backend-go/pkg/chita/handler.gosimilarity index 99%rename from backend-go/pkg/api/handler.gorename to backend-go/pkg/chita/handler.goindex 983f4d56fa..c0799491b0 100644--- a/backend-go/pkg/api/handler.go+++ b/backend-go/pkg/chita/handler.go@@ -1,4 +1,4 @@-package api+package chitaimport ("context"diff --git a/backend-go/pkg/api/http_test.go b/backend-go/pkg/chita/http_test.gosimilarity index 99%rename from backend-go/pkg/api/http_test.gorename to backend-go/pkg/chita/http_test.goindex 1e0c8c8348..b3a52c0101 100644--- a/backend-go/pkg/api/http_test.go+++ b/backend-go/pkg/chita/http_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("bytes"diff --git a/backend-go/pkg/api/integration_test.go b/backend-go/pkg/chita/integration_test.gosimilarity index 99%rename from backend-go/pkg/api/integration_test.gorename to backend-go/pkg/chita/integration_test.goindex e7d4a10e2e..2f4bbd86fb 100644--- a/backend-go/pkg/api/integration_test.go+++ b/backend-go/pkg/chita/integration_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/ispresent_test.go b/backend-go/pkg/chita/ispresent_test.gosimilarity index 99%rename from backend-go/pkg/api/ispresent_test.gorename to backend-go/pkg/chita/ispresent_test.goindex 68cd819476..2f7e136b3a 100644--- a/backend-go/pkg/api/ispresent_test.go+++ b/backend-go/pkg/chita/ispresent_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/nullable.go b/backend-go/pkg/chita/nullable.gosimilarity index 99%rename from backend-go/pkg/api/nullable.gorename to backend-go/pkg/chita/nullable.goindex b3c16dde3c..18d5f27f56 100644--- a/backend-go/pkg/api/nullable.go+++ b/backend-go/pkg/chita/nullable.go@@ -1,4 +1,4 @@-package api+package chitaimport ("bytes"diff --git a/backend-go/pkg/api/nullable_test.go b/backend-go/pkg/chita/nullable_test.gosimilarity index 99%rename from backend-go/pkg/api/nullable_test.gorename to backend-go/pkg/chita/nullable_test.goindex 6464133f1f..17b1e96d94 100644--- a/backend-go/pkg/api/nullable_test.go+++ b/backend-go/pkg/chita/nullable_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/oneof_anyof_test.go b/backend-go/pkg/chita/oneof_anyof_test.gosimilarity index 99%rename from backend-go/pkg/api/oneof_anyof_test.gorename to backend-go/pkg/chita/oneof_anyof_test.goindex 113afc385b..e8542654b8 100644--- a/backend-go/pkg/api/oneof_anyof_test.go+++ b/backend-go/pkg/chita/oneof_anyof_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("testing"diff --git a/backend-go/pkg/api/openapi.go b/backend-go/pkg/chita/openapi.gosimilarity index 99%rename from backend-go/pkg/api/openapi.gorename to backend-go/pkg/chita/openapi.goindex 1c62789040..4972d2917c 100644--- a/backend-go/pkg/api/openapi.go+++ b/backend-go/pkg/chita/openapi.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/openapi_test.go b/backend-go/pkg/chita/openapi_test.gosimilarity index 99%rename from backend-go/pkg/api/openapi_test.gorename to backend-go/pkg/chita/openapi_test.goindex 8e606b272d..2ef0738d1b 100644--- a/backend-go/pkg/api/openapi_test.go+++ b/backend-go/pkg/chita/openapi_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/registry.go b/backend-go/pkg/chita/registry.gosimilarity index 99%rename from backend-go/pkg/api/registry.gorename to backend-go/pkg/chita/registry.goindex 804cb44c4f..6c558b28b0 100644--- a/backend-go/pkg/api/registry.go+++ b/backend-go/pkg/chita/registry.go@@ -1,4 +1,4 @@-package api+package chitaimport ("maps"diff --git a/backend-go/pkg/api/request.go b/backend-go/pkg/chita/request.gosimilarity index 99%rename from backend-go/pkg/api/request.gorename to backend-go/pkg/chita/request.goindex c92d6fa64d..3e70fdf1b2 100644--- a/backend-go/pkg/api/request.go+++ b/backend-go/pkg/chita/request.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/request_test.go b/backend-go/pkg/chita/request_test.gosimilarity index 99%rename from backend-go/pkg/api/request_test.gorename to backend-go/pkg/chita/request_test.goindex 790587387b..9a5f16ac30 100644--- a/backend-go/pkg/api/request_test.go+++ b/backend-go/pkg/chita/request_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("bytes"diff --git a/backend-go/pkg/api/router.go b/backend-go/pkg/chita/router.gosimilarity index 99%rename from backend-go/pkg/api/router.gorename to backend-go/pkg/chita/router.goindex b6549364b1..7b2c85adbe 100644--- a/backend-go/pkg/api/router.go+++ b/backend-go/pkg/chita/router.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/router_test.go b/backend-go/pkg/chita/router_test.gosimilarity index 99%rename from backend-go/pkg/api/router_test.gorename to backend-go/pkg/chita/router_test.goindex 65771983a4..9a0ce9e00b 100644--- a/backend-go/pkg/api/router_test.go+++ b/backend-go/pkg/chita/router_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("context"diff --git a/backend-go/pkg/api/schema.go b/backend-go/pkg/chita/schema.gosimilarity index 99%rename from backend-go/pkg/api/schema.gorename to backend-go/pkg/chita/schema.goindex 651f97c92c..69c22a9c73 100644--- a/backend-go/pkg/api/schema.go+++ b/backend-go/pkg/chita/schema.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/schema_composite.go b/backend-go/pkg/chita/schema_composite.gosimilarity index 99%rename from backend-go/pkg/api/schema_composite.gorename to backend-go/pkg/chita/schema_composite.goindex 63b4ada267..f05a84e649 100644--- a/backend-go/pkg/api/schema_composite.go+++ b/backend-go/pkg/chita/schema_composite.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/schema_composite_test.go b/backend-go/pkg/chita/schema_composite_test.gosimilarity index 99%rename from backend-go/pkg/api/schema_composite_test.gorename to backend-go/pkg/chita/schema_composite_test.goindex 8ef123b558..a4e34f77e0 100644--- a/backend-go/pkg/api/schema_composite_test.go+++ b/backend-go/pkg/chita/schema_composite_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("testing"diff --git a/backend-go/pkg/chita/schema_request.go b/backend-go/pkg/chita/schema_request.gonew file mode 100644index 0000000000..624b48766f--- /dev/null+++ b/backend-go/pkg/chita/schema_request.go@@ -0,0 +1,178 @@+package chita++import (+ "fmt"+ "net/url"+ "strings"+)++// ValueGetter is implemented by schema types that can return their bound value.+type ValueGetter interface {+ GetValue() any+ IsZero() bool+}++// GetValue returns the bound string value.+func (s *StringSchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return *s.ptr+}++// IsZero returns true if the value is zero/empty.+func (s *StringSchema) IsZero() bool {+ return s.ptr == nil || *s.ptr == ""+}++// GetValue returns the bound int value.+func (s *IntSchema) GetValue() any {+ if s.ptr != nil {+ return *s.ptr+ }+ if s.ptr64 != nil {+ return *s.ptr64+ }+ return nil+}++// IsZero returns true if the value is zero/empty.+func (s *IntSchema) IsZero() bool {+ if s.ptr != nil {+ return *s.ptr == 0+ }+ if s.ptr64 != nil {+ return *s.ptr64 == 0+ }+ return true+}++// GetValue returns the bound float value.+func (s *FloatSchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return *s.ptr+}++// IsZero returns true if the value is zero/empty.+func (s *FloatSchema) IsZero() bool {+ return s.ptr == nil || *s.ptr == 0+}++// GetValue returns the bound bool value.+func (s *BoolSchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return *s.ptr+}++// IsZero returns true if the value is zero/empty.+func (s *BoolSchema) IsZero() bool {+ return s.ptr == nil+}++// GetValue returns the bound UUID value.+func (s *UUIDSchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return s.ptr.String()+}++// IsZero returns true if the value is zero/empty.+func (s *UUIDSchema) IsZero() bool {+ return s.ptr == nil || *s.ptr == [16]byte{}+}++// GetValue returns the bound time value.+func (s *TimeSchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return s.ptr.Format("2006-01-02T15:04:05Z07:00")+}++// IsZero returns true if the value is zero/empty.+func (s *TimeSchema) IsZero() bool {+ return s.ptr == nil || s.ptr.IsZero()+}++// GetValue returns the bound bytes value.+func (s *BytesSchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return *s.ptr+}++// IsZero returns true if the value is zero/empty.+func (s *BytesSchema) IsZero() bool {+ return s.ptr == nil || len(*s.ptr) == 0+}++// GetValue returns the bound any value.+func (s *AnySchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return *s.ptr+}++// IsZero returns true if the value is zero/empty.+func (s *AnySchema) IsZero() bool {+ return s.ptr == nil || *s.ptr == nil+}++// GetValue returns the bound raw JSON value.+func (s *RawSchema) GetValue() any {+ if s.ptr == nil {+ return nil+ }+ return *s.ptr+}++// IsZero returns true if the value is zero/empty.+func (s *RawSchema) IsZero() bool {+ return s.ptr == nil || len(*s.ptr) == 0+}++// BuildRequest builds the URL path and body from the schema's bound values.+// It uses the Source of each field to determine if it goes in path, query, or body.+// Returns the path (with query string) and a map of body fields.+func (s *ObjectSchema) BuildRequest(basePath string) (path string, body map[string]any) {+ path = basePath+ query := url.Values{}+ body = make(map[string]any)++ for name, field := range s.properties {+ source := field.GetSource()++ valueGetter, ok := field.(ValueGetter)+ if !ok {+ continue+ }++ if valueGetter.IsZero() {+ continue+ }++ value := valueGetter.GetValue()++ switch source {+ case SourcePath:+ path = strings.Replace(path, "{"+name+"}", fmt.Sprint(value), 1)+ case SourceQuery:+ query.Set(name, fmt.Sprint(value))+ default:+ body[name] = value+ }+ }++ if len(query) > 0 {+ path += "?" + query.Encode()+ }++ return+}diff --git a/backend-go/pkg/api/schema_test.go b/backend-go/pkg/chita/schema_test.gosimilarity index 99%rename from backend-go/pkg/api/schema_test.gorename to backend-go/pkg/chita/schema_test.goindex 42f5495ab9..da05fa3649 100644--- a/backend-go/pkg/api/schema_test.go+++ b/backend-go/pkg/chita/schema_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/chita/testing.go b/backend-go/pkg/chita/testing.gonew file mode 100644index 0000000000..b4149a18fa--- /dev/null+++ b/backend-go/pkg/chita/testing.go@@ -0,0 +1,44 @@+package chita++import (+ "bytes"+ "context"+ "encoding/json"+ "io"+ "net/http"+ "net/http/httptest"+ "testing"++ "github.com/stretchr/testify/require"+)++// HTTPTest makes an HTTP request using the schema's BuildRequest to construct the URL and body.+// It returns the decoded response and status code.+func HTTPTest[Req SchemaProvider, Resp any](t *testing.T, srv *httptest.Server, method, basePath string, req Req) (result Resp, statusCode int) {+ t.Helper()++ path, bodyFields := req.Schema().BuildRequest(basePath)++ var reqBody io.Reader = http.NoBody+ if len(bodyFields) > 0 {+ b, err := json.Marshal(bodyFields)+ require.NoError(t, err)+ reqBody = bytes.NewReader(b)+ }++ httpReq, err := http.NewRequestWithContext(context.Background(), method, srv.URL+path, reqBody)+ require.NoError(t, err)++ if len(bodyFields) > 0 {+ httpReq.Header.Set("Content-Type", "application/json")+ }++ resp, err := http.DefaultClient.Do(httpReq)+ require.NoError(t, err)+ defer func() { _ = resp.Body.Close() }()++ _ = json.NewDecoder(resp.Body).Decode(&result)+ statusCode = resp.StatusCode++ return+}diff --git a/backend-go/pkg/api/union.go b/backend-go/pkg/chita/union.gosimilarity index 99%rename from backend-go/pkg/api/union.gorename to backend-go/pkg/chita/union.goindex 359c0da788..5b6a73129b 100644--- a/backend-go/pkg/api/union.go+++ b/backend-go/pkg/chita/union.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/union_helpers_test.go b/backend-go/pkg/chita/union_helpers_test.gosimilarity index 99%rename from backend-go/pkg/api/union_helpers_test.gorename to backend-go/pkg/chita/union_helpers_test.goindex e6df20e501..b226f07931 100644--- a/backend-go/pkg/api/union_helpers_test.go+++ b/backend-go/pkg/chita/union_helpers_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"diff --git a/backend-go/pkg/api/union_test.go b/backend-go/pkg/chita/union_test.gosimilarity index 99%rename from backend-go/pkg/api/union_test.gorename to backend-go/pkg/chita/union_test.goindex 3a27fd07ff..9d24ee7be3 100644--- a/backend-go/pkg/api/union_test.go+++ b/backend-go/pkg/chita/union_test.go@@ -1,4 +1,4 @@-package api+package chitaimport ("encoding/json"