snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
This commit is contained in:
21
server/vendor/github.com/lestrrat-go/iter/LICENSE
generated
vendored
Normal file
21
server/vendor/github.com/lestrrat-go/iter/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 lestrrat-go
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
192
server/vendor/github.com/lestrrat-go/iter/arrayiter/arrayiter.go
generated
vendored
Normal file
192
server/vendor/github.com/lestrrat-go/iter/arrayiter/arrayiter.go
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
package arrayiter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func Iterate(ctx context.Context, a interface{}) (Iterator, error) {
|
||||
arv := reflect.ValueOf(a)
|
||||
|
||||
switch arv.Kind() {
|
||||
case reflect.Array, reflect.Slice:
|
||||
default:
|
||||
return nil, fmt.Errorf(`argument must be an array/slice (%s)`, arv.Type())
|
||||
}
|
||||
|
||||
ch := make(chan *Pair)
|
||||
go func(ctx context.Context, ch chan *Pair, arv reflect.Value) {
|
||||
defer close(ch)
|
||||
|
||||
for i := 0; i < arv.Len(); i++ {
|
||||
value := arv.Index(i)
|
||||
pair := &Pair{
|
||||
Index: i,
|
||||
Value: value.Interface(),
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case ch <- pair:
|
||||
}
|
||||
}
|
||||
}(ctx, ch, arv)
|
||||
|
||||
return New(ch), nil
|
||||
}
|
||||
|
||||
// Source represents a array that knows how to create an iterator
|
||||
type Source interface {
|
||||
Iterate(context.Context) Iterator
|
||||
}
|
||||
|
||||
// Pair represents a single pair of key and value from a array
|
||||
type Pair struct {
|
||||
Index int
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// Iterator iterates through keys and values of a array
|
||||
type Iterator interface {
|
||||
Next(context.Context) bool
|
||||
Pair() *Pair
|
||||
}
|
||||
|
||||
type iter struct {
|
||||
ch chan *Pair
|
||||
mu sync.RWMutex
|
||||
next *Pair
|
||||
}
|
||||
|
||||
// Visitor represents an object that handles each pair in a array
|
||||
type Visitor interface {
|
||||
Visit(int, interface{}) error
|
||||
}
|
||||
|
||||
// VisitorFunc is a type of Visitor based on a function
|
||||
type VisitorFunc func(int, interface{}) error
|
||||
|
||||
func (fn VisitorFunc) Visit(s int, v interface{}) error {
|
||||
return fn(s, v)
|
||||
}
|
||||
|
||||
func New(ch chan *Pair) Iterator {
|
||||
return &iter{
|
||||
ch: ch,
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns true if there are more items to read from the iterator
|
||||
func (i *iter) Next(ctx context.Context) bool {
|
||||
i.mu.RLock()
|
||||
if i.ch == nil {
|
||||
i.mu.RUnlock()
|
||||
return false
|
||||
}
|
||||
i.mu.RUnlock()
|
||||
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
i.ch = nil
|
||||
return false
|
||||
case v, ok := <-i.ch:
|
||||
if !ok {
|
||||
i.ch = nil
|
||||
return false
|
||||
}
|
||||
i.next = v
|
||||
return true
|
||||
}
|
||||
|
||||
//nolint:govet
|
||||
return false // never reached
|
||||
}
|
||||
|
||||
// Pair returns the currently buffered Pair. Calling Next() will reset its value
|
||||
func (i *iter) Pair() *Pair {
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
return i.next
|
||||
}
|
||||
|
||||
// Walk walks through each element in the array
|
||||
func Walk(ctx context.Context, s Source, v Visitor) error {
|
||||
for i := s.Iterate(ctx); i.Next(ctx); {
|
||||
pair := i.Pair()
|
||||
if err := v.Visit(pair.Index, pair.Value); err != nil {
|
||||
return fmt.Errorf(`failed to visit index %d: %w`, pair.Index, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func AsArray(ctx context.Context, s interface{}, v interface{}) error {
|
||||
var iter Iterator
|
||||
switch reflect.ValueOf(s).Kind() {
|
||||
case reflect.Array, reflect.Slice:
|
||||
x, err := Iterate(ctx, s)
|
||||
if err != nil {
|
||||
return fmt.Errorf(`failed to iterate over array/slice type: %w`, err)
|
||||
}
|
||||
iter = x
|
||||
default:
|
||||
ssrc, ok := s.(Source)
|
||||
if !ok {
|
||||
return fmt.Errorf(`cannot iterate over %T: not a arrayiter.Source type`, s)
|
||||
}
|
||||
iter = ssrc.Iterate(ctx)
|
||||
}
|
||||
|
||||
dst := reflect.ValueOf(v)
|
||||
|
||||
// dst MUST be a pointer to a array type
|
||||
if kind := dst.Kind(); kind != reflect.Ptr {
|
||||
return fmt.Errorf(`dst must be a pointer to a array (%s)`, dst.Type())
|
||||
}
|
||||
|
||||
dst = dst.Elem()
|
||||
switch dst.Kind() {
|
||||
case reflect.Array, reflect.Slice:
|
||||
default:
|
||||
return fmt.Errorf(`dst must be a pointer to an array or slice (%s)`, dst.Type())
|
||||
}
|
||||
|
||||
var pairs []*Pair
|
||||
for iter.Next(ctx) {
|
||||
pair := iter.Pair()
|
||||
pairs = append(pairs, pair)
|
||||
}
|
||||
|
||||
switch dst.Kind() {
|
||||
case reflect.Array:
|
||||
if len(pairs) < dst.Len() {
|
||||
return fmt.Errorf(`dst array does not have enough space for elements (%d, want %d)`, dst.Len(), len(pairs))
|
||||
}
|
||||
case reflect.Slice:
|
||||
if dst.IsNil() {
|
||||
dst.Set(reflect.MakeSlice(dst.Type(), len(pairs), len(pairs)))
|
||||
}
|
||||
}
|
||||
|
||||
// dst must be assignable
|
||||
if !dst.CanSet() {
|
||||
return fmt.Errorf(`dst is not writeable`)
|
||||
}
|
||||
|
||||
elemtyp := dst.Type().Elem()
|
||||
for _, pair := range pairs {
|
||||
rvvalue := reflect.ValueOf(pair.Value)
|
||||
|
||||
if !rvvalue.Type().AssignableTo(elemtyp) {
|
||||
return fmt.Errorf(`cannot assign key of type %s to map key of type %s`, rvvalue.Type(), elemtyp)
|
||||
}
|
||||
|
||||
dst.Index(pair.Index).Set(rvvalue)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
195
server/vendor/github.com/lestrrat-go/iter/mapiter/mapiter.go
generated
vendored
Normal file
195
server/vendor/github.com/lestrrat-go/iter/mapiter/mapiter.go
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
package mapiter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Iterate creates an iterator from arbitrary map types. This is not
|
||||
// the most efficient tool, but it's the quickest way to create an
|
||||
// iterator for maps.
|
||||
// Also, note that you cannot make any assumptions on the order of
|
||||
// pairs being returned.
|
||||
func Iterate(ctx context.Context, m interface{}) (Iterator, error) {
|
||||
mrv := reflect.ValueOf(m)
|
||||
|
||||
if mrv.Kind() != reflect.Map {
|
||||
return nil, fmt.Errorf(`argument must be a map (%s)`, mrv.Type())
|
||||
}
|
||||
|
||||
ch := make(chan *Pair)
|
||||
go func(ctx context.Context, ch chan *Pair, mrv reflect.Value) {
|
||||
defer close(ch)
|
||||
for _, key := range mrv.MapKeys() {
|
||||
value := mrv.MapIndex(key)
|
||||
pair := &Pair{
|
||||
Key: key.Interface(),
|
||||
Value: value.Interface(),
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case ch <- pair:
|
||||
}
|
||||
}
|
||||
}(ctx, ch, mrv)
|
||||
|
||||
return New(ch), nil
|
||||
}
|
||||
|
||||
// Source represents a map that knows how to create an iterator
|
||||
type Source interface {
|
||||
Iterate(context.Context) Iterator
|
||||
}
|
||||
|
||||
// Pair represents a single pair of key and value from a map
|
||||
type Pair struct {
|
||||
Key interface{}
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// Iterator iterates through keys and values of a map
|
||||
type Iterator interface {
|
||||
Next(context.Context) bool
|
||||
Pair() *Pair
|
||||
}
|
||||
|
||||
type iter struct {
|
||||
ch chan *Pair
|
||||
mu sync.RWMutex
|
||||
next *Pair
|
||||
}
|
||||
|
||||
// Visitor represents an object that handles each pair in a map
|
||||
type Visitor interface {
|
||||
Visit(interface{}, interface{}) error
|
||||
}
|
||||
|
||||
// VisitorFunc is a type of Visitor based on a function
|
||||
type VisitorFunc func(interface{}, interface{}) error
|
||||
|
||||
func (fn VisitorFunc) Visit(s interface{}, v interface{}) error {
|
||||
return fn(s, v)
|
||||
}
|
||||
|
||||
func New(ch chan *Pair) Iterator {
|
||||
return &iter{
|
||||
ch: ch,
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns true if there are more items to read from the iterator
|
||||
func (i *iter) Next(ctx context.Context) bool {
|
||||
i.mu.RLock()
|
||||
if i.ch == nil {
|
||||
i.mu.RUnlock()
|
||||
return false
|
||||
}
|
||||
i.mu.RUnlock()
|
||||
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
i.ch = nil
|
||||
return false
|
||||
case v, ok := <-i.ch:
|
||||
if !ok {
|
||||
i.ch = nil
|
||||
return false
|
||||
}
|
||||
i.next = v
|
||||
return true
|
||||
}
|
||||
|
||||
//nolint:govet
|
||||
return false // never reached
|
||||
}
|
||||
|
||||
// Pair returns the currently buffered Pair. Calling Next() will reset its value
|
||||
func (i *iter) Pair() *Pair {
|
||||
i.mu.RLock()
|
||||
defer i.mu.RUnlock()
|
||||
return i.next
|
||||
}
|
||||
|
||||
// Walk walks through each element in the map
|
||||
func Walk(ctx context.Context, s Source, v Visitor) error {
|
||||
for i := s.Iterate(ctx); i.Next(ctx); {
|
||||
pair := i.Pair()
|
||||
if err := v.Visit(pair.Key, pair.Value); err != nil {
|
||||
return fmt.Errorf(`failed to visit key %s: %w`, pair.Key, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AsMap returns the values obtained from the source as a map
|
||||
func AsMap(ctx context.Context, s interface{}, v interface{}) error {
|
||||
var iter Iterator
|
||||
switch reflect.ValueOf(s).Kind() {
|
||||
case reflect.Map:
|
||||
x, err := Iterate(ctx, s)
|
||||
if err != nil {
|
||||
return fmt.Errorf(`failed to iterate over map type: %w`, err)
|
||||
}
|
||||
iter = x
|
||||
default:
|
||||
ssrc, ok := s.(Source)
|
||||
if !ok {
|
||||
return fmt.Errorf(`cannot iterate over %T: not a mapiter.Source type`, s)
|
||||
}
|
||||
iter = ssrc.Iterate(ctx)
|
||||
}
|
||||
|
||||
dst := reflect.ValueOf(v)
|
||||
|
||||
// dst MUST be a pointer to a map type
|
||||
if kind := dst.Kind(); kind != reflect.Ptr {
|
||||
return fmt.Errorf(`dst must be a pointer to a map (%s)`, dst.Type())
|
||||
}
|
||||
|
||||
dst = dst.Elem()
|
||||
if dst.Kind() != reflect.Map {
|
||||
return fmt.Errorf(`dst must be a pointer to a map (%s)`, dst.Type())
|
||||
}
|
||||
|
||||
if dst.IsNil() {
|
||||
dst.Set(reflect.MakeMap(dst.Type()))
|
||||
}
|
||||
|
||||
// dst must be assignable
|
||||
if !dst.CanSet() {
|
||||
return fmt.Errorf(`dst is not writeable`)
|
||||
}
|
||||
|
||||
keytyp := dst.Type().Key()
|
||||
valtyp := dst.Type().Elem()
|
||||
|
||||
for iter.Next(ctx) {
|
||||
pair := iter.Pair()
|
||||
|
||||
rvkey := reflect.ValueOf(pair.Key)
|
||||
rvvalue := reflect.ValueOf(pair.Value)
|
||||
|
||||
if !rvkey.Type().AssignableTo(keytyp) {
|
||||
return fmt.Errorf(`cannot assign key of type %s to map key of type %s`, rvkey.Type(), keytyp)
|
||||
}
|
||||
|
||||
switch rvvalue.Kind() {
|
||||
// we can only check if we can assign to rvvalue to valtyp if it's non-nil
|
||||
case reflect.Invalid:
|
||||
rvvalue = reflect.New(valtyp).Elem()
|
||||
default:
|
||||
if !rvvalue.Type().AssignableTo(valtyp) {
|
||||
return fmt.Errorf(`cannot assign value of type %s to map value of type %s`, rvvalue.Type(), valtyp)
|
||||
}
|
||||
}
|
||||
|
||||
dst.SetMapIndex(rvkey, rvvalue)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user