Add HandleDelete and GetSerialsFromFilter methods, integrate admin keys handling, and enhance constraints API. Include a new CLI convert tool for key translation.
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"lol.mleku.dev/errorf"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly/units"
|
||||
"utils.orly/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
@@ -30,7 +31,7 @@ var _ codec.Envelope = (*Challenge)(nil)
|
||||
func NewChallenge() *Challenge { return &Challenge{} }
|
||||
|
||||
// NewChallengeWith creates a new authenvelope.Challenge with provided bytes.
|
||||
func NewChallengeWith[V string | []byte](challenge V) *Challenge {
|
||||
func NewChallengeWith[V constraints.Bytes](challenge V) *Challenge {
|
||||
return &Challenge{[]byte(challenge)}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"utils.orly/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
@@ -118,7 +119,7 @@ func NewResponse() *Response { return new(Response) }
|
||||
// NewResponseFrom creates a new countenvelope.Response with provided string for the
|
||||
// subscription.Id, a count and optional variadic approximate flag, which is
|
||||
// otherwise false and does not get rendered into the JSON.
|
||||
func NewResponseFrom[V string | []byte](
|
||||
func NewResponseFrom[V constraints.Bytes](
|
||||
s V, cnt int,
|
||||
approx ...bool,
|
||||
) (res *Response, err error) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"lol.mleku.dev/errorf"
|
||||
"utils.orly/bufpool"
|
||||
"utils.orly/units"
|
||||
"utils.orly/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
@@ -103,7 +104,7 @@ func NewResult() *Result { return &Result{} }
|
||||
|
||||
// NewResultWith creates a new eventenvelope.Result with a provided
|
||||
// subscription.Id string and event.E.
|
||||
func NewResultWith[V string | []byte](s V, ev *event.E) (
|
||||
func NewResultWith[V constraints.Bytes](s V, ev *event.E) (
|
||||
res *Result, err error,
|
||||
) {
|
||||
if len(s) < 0 || len(s) > 64 {
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
@@ -28,7 +29,7 @@ var _ codec.Envelope = (*T)(nil)
|
||||
func New() *T { return &T{} }
|
||||
|
||||
// NewFrom creates a new noticeenvelope.T with a provided message.
|
||||
func NewFrom[V string | []byte](msg V) *T { return &T{Message: []byte(msg)} }
|
||||
func NewFrom[V constraints.Bytes](msg V) *T { return &T{Message: []byte(msg)} }
|
||||
|
||||
// Label returns the label of a NOTICE envelope.
|
||||
func (en *T) Label() string { return L }
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"lol.mleku.dev/chk"
|
||||
"lol.mleku.dev/errorf"
|
||||
"lol.mleku.dev/log"
|
||||
"utils.orly/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
@@ -34,7 +35,7 @@ func New() *T { return &T{} }
|
||||
|
||||
// NewFrom creates a new okenvelope.T with a string for the subscription.Id and
|
||||
// the optional reason.
|
||||
func NewFrom[V string | []byte](eid V, ok bool, msg ...V) *T {
|
||||
func NewFrom[V constraints.Bytes](eid V, ok bool, msg ...V) *T {
|
||||
var m []byte
|
||||
if len(msg) > 0 {
|
||||
m = []byte(msg[0])
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"encoders.orly/text"
|
||||
"interfaces.orly/codec"
|
||||
"lol.mleku.dev/chk"
|
||||
"utils.orly/constraints"
|
||||
)
|
||||
|
||||
// L is the label associated with this type of codec.Envelope.
|
||||
@@ -39,7 +40,7 @@ func NewFrom(id []byte, ff *filter.S) *T {
|
||||
}
|
||||
}
|
||||
|
||||
func NewWithId[V string | []byte](id V, ff *filter.S) (sub *T) {
|
||||
func NewWithId[V constraints.Bytes](id V, ff *filter.S) (sub *T) {
|
||||
return &T{
|
||||
Subscription: []byte(id),
|
||||
Filters: ff,
|
||||
|
||||
Reference in New Issue
Block a user