From faea009a2dd3f4dc8fbd941ea333908b82aa3e1d Mon Sep 17 00:00:00 2001 From: FilippoTrotter Date: Mon, 30 Dec 2024 19:13:27 +0100 Subject: [PATCH 01/14] feat: update pocketbase Go to 0.23 --- go.mod | 115 +++--- go.sum | 332 ++++++++------- main.go | 126 +++--- migrations/1664858353_collections_snapshot.go | 17 +- pocketbase/feature/feature.go | 7 +- pocketbase/hooks/hooks.go | 80 ++-- pocketbase/webauthn/webauthn.go | 388 ++++++++---------- 7 files changed, 495 insertions(+), 570 deletions(-) diff --git a/go.mod b/go.mod index 844c2766..ca459d28 100644 --- a/go.mod +++ b/go.mod @@ -5,95 +5,88 @@ go 1.23 require ( github.com/dyne/slangroom-exec/bindings/go v0.0.0-20241017085658-fb538b02efa3 github.com/go-webauthn/webauthn v0.10.2 - github.com/labstack/echo/v5 v5.0.0-20230722203903-ec5b858dab61 - github.com/pocketbase/dbx v1.10.1 - github.com/pocketbase/pocketbase v0.22.12 - golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d + github.com/pocketbase/dbx v1.11.0 + github.com/pocketbase/pocketbase v0.23.12 + golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 ) require ( github.com/AlecAivazis/survey/v2 v2.3.7 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/aws/aws-sdk-go v1.53.10 // indirect - github.com/aws/aws-sdk-go-v2 v1.27.0 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect - github.com/aws/aws-sdk-go-v2/config v1.27.16 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.16 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 // indirect - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.21 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.7 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.9 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.7 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.54.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.20.9 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.28.10 // indirect - github.com/aws/smithy-go v1.20.2 // indirect + github.com/aws/aws-sdk-go-v2 v1.32.7 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 // indirect + github.com/aws/aws-sdk-go-v2/config v1.28.7 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.48 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.44 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.26 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.7 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.71.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 // indirect + github.com/aws/smithy-go v1.22.1 // indirect github.com/disintegration/imaging v1.6.2 // indirect - github.com/dlclark/regexp2 v1.11.0 // indirect + github.com/dlclark/regexp2 v1.11.4 // indirect github.com/domodwyer/mailyak/v3 v3.6.2 // indirect - github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 // indirect - github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf // indirect + github.com/dop251/base64dec v0.0.0-20231022112746-c6c9f9a96217 // indirect + github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 // indirect + github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/fatih/color v1.17.0 // indirect + github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fxamacker/cbor/v2 v2.6.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.4 // indirect - github.com/ganigeorgiev/fexpr v0.4.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.7 // indirect + github.com/ganigeorgiev/fexpr v0.4.1 // indirect github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect github.com/go-webauthn/x v0.1.10 // indirect - github.com/goccy/go-json v0.10.3 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/go-tpm v0.9.0 // indirect - github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect + github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/gax-go/v2 v2.12.4 // indirect + github.com/googleapis/gax-go/v2 v2.14.1 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/cast v1.7.1 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasttemplate v1.2.2 // indirect github.com/x448/float16 v0.8.4 // indirect go.opencensus.io v0.24.0 // indirect - gocloud.dev v0.37.0 // indirect - golang.org/x/crypto v0.23.0 // indirect - golang.org/x/image v0.16.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/term v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/api v0.181.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect - google.golang.org/grpc v1.64.0 // indirect - google.golang.org/protobuf v1.34.1 // indirect - modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect - modernc.org/libc v1.50.9 // indirect - modernc.org/mathutil v1.6.0 // indirect + gocloud.dev v0.40.0 // indirect + golang.org/x/crypto v0.31.0 // indirect + golang.org/x/image v0.23.0 // indirect + golang.org/x/net v0.33.0 // indirect + golang.org/x/oauth2 v0.24.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect + google.golang.org/api v0.214.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect + google.golang.org/grpc v1.69.2 // indirect + google.golang.org/protobuf v1.36.1 // indirect + modernc.org/gc/v3 v3.0.0-20241223112719-96e2e1e4408d // indirect + modernc.org/libc v1.61.5 // indirect + modernc.org/mathutil v1.7.1 // indirect modernc.org/memory v1.8.0 // indirect - modernc.org/sqlite v1.29.10 // indirect - modernc.org/strutil v1.2.0 // indirect + modernc.org/sqlite v1.34.4 // indirect + modernc.org/strutil v1.2.1 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index 5b62ba54..8eefbc3e 100644 --- a/go.sum +++ b/go.sum @@ -1,71 +1,72 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.113.0 h1:g3C70mn3lWfckKBiCVsAshabrDg01pQ0pnX1MNtnMkA= -cloud.google.com/go v0.113.0/go.mod h1:glEqlogERKYeePz6ZdkcLJ28Q2I6aERgDDErBg9GzO8= -cloud.google.com/go/auth v0.4.1 h1:Z7YNIhlWRtrnKlZke7z3GMqzvuYzdc2z98F9D1NV5Hg= -cloud.google.com/go/auth v0.4.1/go.mod h1:QVBuVEKpCn4Zp58hzRGvL0tjRGU0YqdRTdCHM1IHnro= -cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= -cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= -cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= -cloud.google.com/go/storage v1.39.1 h1:MvraqHKhogCOTXTlct/9C3K3+Uy2jBmFYb3/Sp6dVtY= -cloud.google.com/go/storage v1.39.1/go.mod h1:xK6xZmxZmo+fyP7+DEF6FhNc24/JAe95OLyOHCXFH1o= +cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= +cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= +cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs= +cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q= +cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU= +cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= +github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.53.10 h1:3enP5l5WtezT9Ql+XZqs56JBf5YUd/FEzTCg///OIGY= -github.com/aws/aws-sdk-go v1.53.10/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= -github.com/aws/aws-sdk-go-v2 v1.27.0 h1:7bZWKoXhzI+mMR/HjdMx8ZCC5+6fY0lS5tr0bbgiLlo= -github.com/aws/aws-sdk-go-v2 v1.27.0/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2/go.mod h1:lPprDr1e6cJdyYeGXnRaJoP4Md+cDBvi2eOj00BlGmg= -github.com/aws/aws-sdk-go-v2/config v1.27.16 h1:knpCuH7laFVGYTNd99Ns5t+8PuRjDn4HnnZK48csipM= -github.com/aws/aws-sdk-go-v2/config v1.27.16/go.mod h1:vutqgRhDUktwSge3hrC3nkuirzkJ4E/mLj5GvI0BQas= -github.com/aws/aws-sdk-go-v2/credentials v1.17.16 h1:7d2QxY83uYl0l58ceyiSpxg9bSbStqBC6BeEeHEchwo= -github.com/aws/aws-sdk-go-v2/credentials v1.17.16/go.mod h1:Ae6li/6Yc6eMzysRL2BXlPYvnrLLBg3D11/AmOjw50k= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 h1:dQLK4TjtnlRGb0czOht2CevZ5l6RSyRWAnKeGd7VAFE= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3/go.mod h1:TL79f2P6+8Q7dTsILpiVST+AL9lkF6PPGI167Ny0Cjw= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.21 h1:1v8Ii0MRVGYB/sdhkbxrtolCA7Tp+lGh+5OJTs5vmZ8= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.21/go.mod h1:cxdd1rc8yxCjKz28hi30XN1jDXr2DxZvD44vLxTz/bg= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7 h1:lf/8VTF2cM+N4SLzaYJERKEWAXq8MOMpZfU6wEPWsPk= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.7/go.mod h1:4SjkU7QiqK2M9oozyMzfZ/23LmUY+h3oFqhdeP5OMiI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7 h1:4OYVp0705xu8yjdyoWix0r9wPIRXnIzzOoUpQVHIJ/g= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.7/go.mod h1:vd7ESTEvI76T2Na050gODNmNU7+OyKrIKroYTu4ABiI= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.7 h1:/FUtT3xsoHO3cfh+I/kCbcMCN98QZRsiFet/V8QkWSs= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.7/go.mod h1:MaCAgWpGooQoCWZnMur97rGn5dp350w2+CeiV5406wE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.9 h1:UXqEWQI0n+q0QixzU0yUUQBZXRd5037qdInTIHFTl98= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.9/go.mod h1:xP6Gq6fzGZT8w/ZN+XvGMZ2RU1LeEs7b2yUP5DN8NY4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 h1:Wx0rlZoEJR7JwlSZcHnEa7CNjrSIyVxMFWGAaXy4fJY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9/go.mod h1:aVMHdE0aHO3v+f/iw01fmXV/5DbfQ3Bi9nN7nd9bE9Y= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.7 h1:uO5XR6QGBcmPyo2gxofYJLFkcVQ4izOoGDNenlZhTEk= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.7/go.mod h1:feeeAYfAcwTReM6vbwjEyDmiGho+YgBhaFULuXDW8kc= -github.com/aws/aws-sdk-go-v2/service/s3 v1.54.3 h1:57NtjG+WLims0TxIQbjTqebZUKDM03DfM11ANAekW0s= -github.com/aws/aws-sdk-go-v2/service/s3 v1.54.3/go.mod h1:739CllldowZiPPsDFcJHNF4FXrVxaSGVnZ9Ez9Iz9hc= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.9 h1:aD7AGQhvPuAxlSUfo0CWU7s6FpkbyykMhGYMvlqTjVs= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.9/go.mod h1:c1qtZUWtygI6ZdvKppzCSXsDOq5I4luJPZ0Ud3juFCA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3 h1:Pav5q3cA260Zqez42T9UhIlsd9QeypszRPwC9LdSSsQ= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.3/go.mod h1:9lmoVDVLz/yUZwLaQ676TK02fhCu4+PgRSmMaKR1ozk= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.10 h1:69tpbPED7jKPyzMcrwSvhWcJ9bPnZsZs18NT40JwM0g= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.10/go.mod h1:0Aqn1MnEuitqfsCNyKsdKLhDUOr4txD/g19EfiUqgws= -github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= -github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go-v2 v1.32.7 h1:ky5o35oENWi0JYWUZkB7WYvVPP+bcRF5/Iq7JWSb5Rw= +github.com/aws/aws-sdk-go-v2 v1.32.7/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 h1:lL7IfaFzngfx0ZwUGOZdsFFnQ5uLvR0hWqqhyE7Q9M8= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7/go.mod h1:QraP0UcVlQJsmHfioCrveWOC1nbiWUl3ej08h4mXWoc= +github.com/aws/aws-sdk-go-v2/config v1.28.7 h1:GduUnoTXlhkgnxTD93g1nv4tVPILbdNQOzav+Wpg7AE= +github.com/aws/aws-sdk-go-v2/config v1.28.7/go.mod h1:vZGX6GVkIE8uECSUHB6MWAUsd4ZcG2Yq/dMa4refR3M= +github.com/aws/aws-sdk-go-v2/credentials v1.17.48 h1:IYdLD1qTJ0zanRavulofmqut4afs45mOWEI+MzZtTfQ= +github.com/aws/aws-sdk-go-v2/credentials v1.17.48/go.mod h1:tOscxHN3CGmuX9idQ3+qbkzrjVIx32lqDSU1/0d/qXs= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 h1:kqOrpojG71DxJm/KDPO+Z/y1phm1JlC8/iT+5XRmAn8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22/go.mod h1:NtSFajXVVL8TA2QNngagVZmUtXciyrHOt7xgz4faS/M= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.44 h1:2zxMLXLedpB4K1ilbJFxtMKsVKaexOqDttOhc0QGm3Q= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.44/go.mod h1:VuLHdqwjSvgftNC7yqPWyGVhEwPmJpeRi07gOgOfHF8= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 h1:I/5wmGMffY4happ8NOCuIUEWGUvvFp5NSeQcXl9RHcI= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26/go.mod h1:FR8f4turZtNy6baO0KJ5FJUmXH/cSkI9fOngs0yl6mA= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 h1:zXFLuEuMMUOvEARXFUVJdfqZ4bvvSgdGRq/ATcrQxzM= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26/go.mod h1:3o2Wpy0bogG1kyOPrgkXA8pgIfEEv0+m19O9D5+W8y8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.26 h1:GeNJsIFHB+WW5ap2Tec4K6dzcVTsRbsT1Lra46Hv9ME= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.26/go.mod h1:zfgMpwHDXX2WGoG84xG2H+ZlPTkJUU4YUvx2svLQYWo= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.7 h1:tB4tNw83KcajNAzaIMhkhVI2Nt8fAZd5A5ro113FEMY= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.7/go.mod h1:lvpyBGkZ3tZ9iSsUIcC2EWp+0ywa7aK3BLT+FwZi+mQ= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 h1:8eUsivBQzZHqe/3FE+cqwfH+0p5Jo8PFM/QYQSmeZ+M= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7/go.mod h1:kLPQvGUmxn/fqiCrDeohwG33bq2pQpGeY62yRO6Nrh0= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.7 h1:Hi0KGbrnr57bEHWM0bJ1QcBzxLrL/k2DHvGYhb8+W1w= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.7/go.mod h1:wKNgWgExdjjrm4qvfbTorkvocEstaoDl4WCvGfeCy9c= +github.com/aws/aws-sdk-go-v2/service/s3 v1.71.1 h1:aOVVZJgWbaH+EJYPvEgkNhCEbXXvH7+oML36oaPK3zE= +github.com/aws/aws-sdk-go-v2/service/s3 v1.71.1/go.mod h1:r+xl5yzMk9083rMR+sJ5TYj9Tihvf/l1oxzZXDgGj2Q= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 h1:CvuUmnXI7ebaUAhbJcDy9YQx8wHR69eZ9I7q5hszt/g= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.8/go.mod h1:XDeGv1opzwm8ubxddF0cgqkZWsyOtw4lr6dxwmb6YQg= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 h1:F2rBfNAL5UyswqoeWv9zs74N/NanhK16ydHW1pahX6E= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7/go.mod h1:JfyQ0g2JG8+Krq0EuZNnRwX0mU0HrwY/tG6JNfcqh4k= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 h1:Xgv/hyNgvLda/M9l9qxXc4UFSgppnRczLxlMs5Ae/QY= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.3/go.mod h1:5Gn+d+VaaRgsjewpMvGazt0WfcFO+Md4wLOuBfGR9Bc= +github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro= +github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -73,14 +74,16 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= -github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= -github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= +github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/domodwyer/mailyak/v3 v3.6.2 h1:x3tGMsyFhTCaxp6ycgR0FE/bu5QiNp+hetUuCOBXMn8= github.com/domodwyer/mailyak/v3 v3.6.2/go.mod h1:lOm/u9CyCVWHeaAmHIdF4RiKVxKUT/H5XX10lIKAL6c= -github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 h1:OFTHt+yJDo/uaIKMGjEKzc3DGhrpQZoqvMUIloZv6ZY= -github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2/go.mod h1:o31y53rb/qiIAONF7w3FHJZRqqP3fzHUr1HqanthByw= -github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf h1:2JoVYP9iko8uuIW33BQafzaylDixXbdXCRw/vCoxL+s= -github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf/go.mod h1:bhGPmCgCCTSRfiMYWjpS46IDo9EUZXlsuUaPXSWGbv0= +github.com/dop251/base64dec v0.0.0-20231022112746-c6c9f9a96217 h1:16iT9CBDOniJwFGPI41MbUDfEk74hFaKTqudrX8kenY= +github.com/dop251/base64dec v0.0.0-20231022112746-c6c9f9a96217/go.mod h1:eIb+f24U+eWQCIsj9D/ah+MD9UP+wdxuqzsdLD+mhGM= +github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 h1:MXsAuToxwsTn5BEEYm2DheqIiC4jWGmkEJ1uy+KFhvQ= +github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= +github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc h1:MKYt39yZJi0Z9xEeRmDX2L4ocE0ETKcHKw6MVL3R+co= +github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc/go.mod h1:VULptt4Q/fNzQUJlqY/GP3qHyU7ZH46mFkBZe0ZTokU= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dyne/slangroom-exec/bindings/go v0.0.0-20241017085658-fb538b02efa3 h1:NpCugAf9qm8A8X1qle9+jYlamF6ATGDrsMzWfDOuGW0= @@ -89,8 +92,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -99,12 +102,12 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA= github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= -github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I= -github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s= -github.com/ganigeorgiev/fexpr v0.4.0 h1:ojitI+VMNZX/odeNL1x3RzTTE8qAIVvnSSYPNAnQFDI= -github.com/ganigeorgiev/fexpr v0.4.0/go.mod h1:RyGiGqmeXhEQ6+mlGdnUleLHgtzzu/VGO2WtJkF5drE= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= +github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= +github.com/ganigeorgiev/fexpr v0.4.1 h1:hpUgbUEEWIZhSDBtf4M9aUNfQQ0BZkGRaMePy7Gcx5k= +github.com/ganigeorgiev/fexpr v0.4.1/go.mod h1:RyGiGqmeXhEQ6+mlGdnUleLHgtzzu/VGO2WtJkF5drE= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= @@ -112,22 +115,20 @@ github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRi github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TCYl6lbukKPc7b5x0n1s6Q= github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.8.0 h1:UtktXaU2Nb64z/pLiGIxY4431SJ4/dR5cjMmlVHgnT4= -github.com/go-sql-driver/mysql v1.8.0/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-webauthn/webauthn v0.10.2 h1:OG7B+DyuTytrEPFmTX503K77fqs3HDK/0Iv+z8UYbq4= github.com/go-webauthn/webauthn v0.10.2/go.mod h1:Gd1IDsGAybuvK1NkwUTLbGmeksxuRJjVN2PE/xsPxHs= github.com/go-webauthn/x v0.1.10 h1:1JOJPQYJUssqOG3XcU0/Ifyl8TGk3iefZTrjv4oxTS8= github.com/go-webauthn/x v0.1.10/go.mod h1:ZuuOJLvqa4+nYGY480aPXC4oY5jQUqzp8iKrRGYm64k= -github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= -github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -151,19 +152,19 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-tpm v0.9.0 h1:sQF6YqWMi+SCXpsmS3fd21oPy/vSddwZry4JnmltHVk= github.com/google/go-tpm v0.9.0/go.mod h1:FkNVkc6C+IsvDI9Jw1OveJmxGZUUaKxtrpOS47QWKfU= -github.com/google/pprof v0.0.0-20240528025155-186aa0362fba h1:ql1qNgCyOB7iAEk8JTNM+zJrgIbnyCKX/wdlyPufP5g= -github.com/google/pprof v0.0.0-20240528025155-186aa0362fba/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= +github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/wire v0.6.0 h1:HBkoIh4BdSxoyo9PveV8giw7ZsaBOvzWKfcg/6MrVwI= github.com/google/wire v0.6.0/go.mod h1:F4QhpQ9EDIdJ1Mbop/NZBRB+5yrR6qg3BnctaoUk6NA= -github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= -github.com/googleapis/gax-go/v2 v2.12.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg= -github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI= +github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= +github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= +github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q= +github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= @@ -172,16 +173,12 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/labstack/echo/v5 v5.0.0-20230722203903-ec5b858dab61 h1:FwuzbVh87iLiUQj1+uQUsuw9x5t9m5n5g7rG7o4svW4= -github.com/labstack/echo/v5 v5.0.0-20230722203903-ec5b858dab61/go.mod h1:paQfF1YtHe+GrGg5fOgjsjoCX/UKDr9bc1DoWpZfns8= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= @@ -189,8 +186,6 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= -github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= @@ -200,20 +195,20 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pocketbase/dbx v1.10.1 h1:cw+vsyfCJD8YObOVeqb93YErnlxwYMkNZ4rwN0G0AaA= -github.com/pocketbase/dbx v1.10.1/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs= -github.com/pocketbase/pocketbase v0.22.12 h1:2wWcs2yoyA3OkbW9cxFShemzchOh3eHFr1e8QvLy5is= -github.com/pocketbase/pocketbase v0.22.12/go.mod h1:yY/3IGi1tUbcI6yGVFspAyKi/IDHCntdYk4IAP32UF0= +github.com/pocketbase/dbx v1.11.0 h1:LpZezioMfT3K4tLrqA55wWFw1EtH1pM4tzSVa7kgszU= +github.com/pocketbase/dbx v1.11.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs= +github.com/pocketbase/pocketbase v0.23.12 h1:HB4THFbzaliF0C3wvpx+kNOZxIwCEMDqN3/17gn5N7E= +github.com/pocketbase/pocketbase v0.23.12/go.mod h1:OcFJNMO0Vzt3f9+lweMbup6iL7V13ckxu1pdEY6FeM0= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= +github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -226,44 +221,44 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= -github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= -gocloud.dev v0.37.0 h1:XF1rN6R0qZI/9DYjN16Uy0durAmSlf58DHOcb28GPro= -gocloud.dev v0.37.0/go.mod h1:7/O4kqdInCNsc6LqgmuFnS0GRew4XNNYWpA44yQnwco= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= +go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +gocloud.dev v0.40.0 h1:f8LgP+4WDqOG/RXoUcyLpeIAGOcAbZrZbDQCUee10ng= +gocloud.dev v0.40.0/go.mod h1:drz+VyYNBvrMTW0KZiBAYEdl8lbNZx+OQ7oQvdrFmSQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d h1:N0hmiNbwsSNwHBAvR3QB5w25pUwH4tK0Y/RltD1j1h4= -golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.16.0 h1:9kloLAKhUufZhA12l5fwnx2NZW39/we1UhBesW433jw= -golang.org/x/image v0.16.0/go.mod h1:ugSZItdV4nOxyqp56HmXwH0Ry0nBCpjnZdpDaIHdoPs= +golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= +golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -274,17 +269,17 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -296,21 +291,21 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -318,33 +313,33 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= -golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -google.golang.org/api v0.181.0 h1:rPdjwnWgiPPOJx3IcSAQ2III5aX5tCer6wMpa/xmZi4= -google.golang.org/api v0.181.0/go.mod h1:MnQ+M0CFsfUwA5beZ+g/vCBCPXvtmZwRz2qzZk8ih1k= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da h1:noIWHXmPHxILtqtCOPIhSt0ABwskkZKjD3bXGnZGpNY= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +google.golang.org/api v0.214.0 h1:h2Gkq07OYi6kusGOaT/9rnNljuXmqPnaig7WGPmKbwA= +google.golang.org/api v0.214.0/go.mod h1:bYPpLG8AyeMWwDU6NXoB00xC0DFkikVvd5MfwoxjLqE= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 h1:ImUcDPHjTrAqNhlOkSocDLfG9rrNHH7w7uoKWPaWZ8s= -google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7/go.mod h1:/3XmxOjePkvmKrHuBy4zNFw7IzxJXtAgdpXi8Ll990U= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e h1:Elxv5MwEkCI9f5SkoL6afed6NTdxaGoAo39eANBwHL8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 h1:CT2Thj5AuPV9phrYMtzX11k+XkzMGfRAet42PmoTATM= +google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988/go.mod h1:7uvplUBj4RjHAxIZ//98LzOvrQ04JBkaixRmCMI29hc= +google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q= +google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= +google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -354,11 +349,10 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -366,29 +360,29 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -modernc.org/cc/v4 v4.21.2 h1:dycHFB/jDc3IyacKipCNSDrjIC0Lm1hyoWOZTRR20Lk= -modernc.org/cc/v4 v4.21.2/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= -modernc.org/ccgo/v4 v4.17.8 h1:yyWBf2ipA0Y9GGz/MmCmi3EFpKgeS7ICrAFes+suEbs= -modernc.org/ccgo/v4 v4.17.8/go.mod h1:buJnJ6Fn0tyAdP/dqePbrrvLyr6qslFfTbFrCuaYvtA= +modernc.org/cc/v4 v4.24.1 h1:mLykA8iIlZ/SZbwI2JgYIURXQMSgmOb/+5jaielxPi4= +modernc.org/cc/v4 v4.24.1/go.mod h1:T1lKJZhXIi2VSqGBiB4LIbKs9NsKTbUXj4IDrmGqtTI= +modernc.org/ccgo/v4 v4.23.5 h1:6uAwu8u3pnla3l/+UVUrDDO1HIGxHTYmFH6w+X9nsyw= +modernc.org/ccgo/v4 v4.23.5/go.mod h1:FogrWfBdzqLWm1ku6cfr4IzEFouq2fSAPf6aSAHdAJQ= modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= -modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw= -modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU= -modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b h1:BnN1t+pb1cy61zbvSUV7SeI0PwosMhlAEi/vBY4qxp8= -modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4= -modernc.org/libc v1.50.9 h1:hIWf1uz55lorXQhfoEoezdUHjxzuO6ceshET/yWjSjk= -modernc.org/libc v1.50.9/go.mod h1:15P6ublJ9FJR8YQCGy8DeQ2Uwur7iW9Hserr/T3OFZE= -modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= -modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/gc/v2 v2.6.0 h1:Tiw3pezQj7PfV8k4Dzyu/vhRHR2e92kOXtTFU8pbCl4= +modernc.org/gc/v2 v2.6.0/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU= +modernc.org/gc/v3 v3.0.0-20241223112719-96e2e1e4408d h1:d0JExN5U5FjUVHCP6L9DIlLJBZveR6KUM4AvfDUL3+k= +modernc.org/gc/v3 v3.0.0-20241223112719-96e2e1e4408d/go.mod h1:qBSLm/exCqouT2hrfyTKikWKG9IPq8EoX5fS00l3jqk= +modernc.org/libc v1.61.5 h1:WzsPUvWl2CvsRmk2foyWWHUEUmQ2iW4oFyWOVR0O5ho= +modernc.org/libc v1.61.5/go.mod h1:llBdEGIywhnRgAFuTF+CWaKV8/2bFgACcQZTXhkAuAM= +modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= +modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss= -modernc.org/sqlite v1.29.10 h1:3u93dz83myFnMilBGCOLbr+HjklS6+5rJLx4q86RDAg= -modernc.org/sqlite v1.29.10/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA= -modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= -modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= +modernc.org/sqlite v1.34.4 h1:sjdARozcL5KJBvYQvLlZEmctRgW9xqIZc2ncN7PU0P8= +modernc.org/sqlite v1.34.4/go.mod h1:3QQFCG2SEMtc2nv+Wq4cQCH7Hjcg+p/RMlS1XK+zwbk= +modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= +modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/main.go b/main.go index 4ce1e866..324123d2 100644 --- a/main.go +++ b/main.go @@ -14,12 +14,10 @@ import ( "github.com/forkbombeu/didimo/pocketbase/webauthn" "github.com/forkbombeu/didimo/pocketbase/zencode" - "github.com/labstack/echo/v5" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase" "github.com/pocketbase/pocketbase/apis" "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/plugins/jsvm" "github.com/pocketbase/pocketbase/plugins/migratecmd" ) @@ -27,80 +25,72 @@ import ( func main() { app := pocketbase.New() - app.OnBeforeServe().Add(func(e *core.ServeEvent) error { + app.OnServe().BindFunc(func(se *core.ServeEvent) error { proxy := httputil.NewSingleHostReverseProxy(&url.URL{ Scheme: "http", Host: "localhost:5100", }) - e.Router.Any("/*", echo.WrapHandler(proxy)) - e.Router.Any("/", echo.WrapHandler(proxy)) - - e.Router.AddRoute(echo.Route{ - Method: http.MethodPost, - Path: "/api/keypairoom-server", - Handler: func(c echo.Context) error { - var body map[string]map[string]interface{} - - conf, err := feature.FetchKeypairoomConfig(app) - if err != nil { - return err - } - - err = json.NewDecoder(c.Request().Body).Decode(&body) - if err != nil { - return err - } - hmac, err := zencode.KeypairoomServer(conf, body["userData"]) - if err != nil { - return err - } - - return c.JSON(http.StatusOK, map[string]string{"hmac": hmac}) - }, - Middlewares: []echo.MiddlewareFunc{ - apis.ActivityLogger(app), - }, + se.Router.Any("/*", func(req *core.RequestEvent) error { + proxy.ServeHTTP(req.Response, req.Request) + return nil + }) + se.Router.Any("/", func(req *core.RequestEvent) error { + proxy.ServeHTTP(req.Response, req.Request) + return nil + }) + + se.Router.POST("/api/keypairoom-server", func(e *core.RequestEvent) error { + var body map[string]map[string]interface{} + + conf, err := feature.FetchKeypairoomConfig(app) + if err != nil { + return err + } + + err = json.NewDecoder(e.Request.Body).Decode(&body) + if err != nil { + return err + } + hmac, err := zencode.KeypairoomServer(conf, body["userData"]) + if err != nil { + return err + } + + return e.JSON(http.StatusOK, map[string]string{"hmac": hmac}) }) - e.Router.AddRoute(echo.Route{ - Method: http.MethodGet, - Path: "/api/did", - Handler: func(c echo.Context) error { - authRecord, _ := c.Get(apis.ContextAuthRecordKey).(*models.Record) - if authRecord == nil { - return apis.NewForbiddenError("Only auth records can access this endpoint", nil) - } - - publicKeys, err := app.Dao().FindFirstRecordByFilter("users_public_keys", "owner = {:owner_id}", dbx.Params{"owner_id": authRecord.Id}) - if err != nil { - return apis.NewForbiddenError("Only users with public keys can access this endpoint", nil) - } - - conf, err := feature.FetchDidConfig(app) - if err != nil { - return err - } - - did, err := did.ClaimDid(conf, &did.DidAgent{ - BitcoinPublicKey: publicKeys.Get("bitcoin_public_key").(string), - EcdhPublicKey: publicKeys.Get("ecdh_public_key").(string), - EddsaPublicKey: publicKeys.Get("eddsa_public_key").(string), - EthereumAddress: publicKeys.Get("ethereum_address").(string), - ReflowPublicKey: publicKeys.Get("reflow_public_key").(string), - Es256PublicKey: publicKeys.Get("es256_public_key").(string), - }) - if err != nil { - return err - } - - return c.JSON(http.StatusOK, did) - }, - Middlewares: []echo.MiddlewareFunc{ - apis.ActivityLogger(app), - }, + se.Router.GET("/api/did", func(e *core.RequestEvent) error { + authRecord := e.Auth + if authRecord == nil { + return apis.NewForbiddenError("Only auth records can access this endpoint", nil) + } + + publicKeys, err := app.FindFirstRecordByFilter("users_public_keys", "owner = {:owner_id}", dbx.Params{"owner_id": authRecord.Id}) + if err != nil { + return apis.NewForbiddenError("Only users with public keys can access this endpoint", nil) + } + + conf, err := feature.FetchDidConfig(app) + if err != nil { + return err + } + + did, err := did.ClaimDid(conf, &did.DidAgent{ + BitcoinPublicKey: publicKeys.Get("bitcoin_public_key").(string), + EcdhPublicKey: publicKeys.Get("ecdh_public_key").(string), + EddsaPublicKey: publicKeys.Get("eddsa_public_key").(string), + EthereumAddress: publicKeys.Get("ethereum_address").(string), + ReflowPublicKey: publicKeys.Get("reflow_public_key").(string), + Es256PublicKey: publicKeys.Get("es256_public_key").(string), + }) + if err != nil { + return err + } + + return e.JSON(http.StatusOK, did) }) - return nil + return se.Next() }) webauthn.Register(app) diff --git a/migrations/1664858353_collections_snapshot.go b/migrations/1664858353_collections_snapshot.go index e8993a35..0a7e23d8 100755 --- a/migrations/1664858353_collections_snapshot.go +++ b/migrations/1664858353_collections_snapshot.go @@ -1,17 +1,13 @@ package migrations import ( - "encoding/json" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/core" m "github.com/pocketbase/pocketbase/migrations" - "github.com/pocketbase/pocketbase/models" ) // Auto generated migration with the most recent collections configuration. func init() { - m.Register(func(db dbx.Builder) error { + m.Register(func(app core.App) error { jsonData := `[ { "id": "3fhw2mfr9zrgodj", @@ -121,13 +117,8 @@ func init() { } ]` - collections := []*models.Collection{} - if err := json.Unmarshal([]byte(jsonData), &collections); err != nil { - return err - } - - return daos.New(db).ImportCollections(collections, false, nil) - }, func(db dbx.Builder) error { + return app.ImportCollectionsByMarshaledJSON([]byte(jsonData), false) + }, func(app core.App) error { // no revert since the configuration on the environment, on which // the migration was executed, could have changed via the UI/API return nil diff --git a/pocketbase/feature/feature.go b/pocketbase/feature/feature.go index 8fff5fe7..89e12f2a 100644 --- a/pocketbase/feature/feature.go +++ b/pocketbase/feature/feature.go @@ -119,7 +119,7 @@ func fetchURL(env string) (*url.URL, error) { func fetchDict(env string) (map[string]interface{}, error) { rawDecodedDict, err := base64.StdEncoding.DecodeString(env) if err != nil { - return nil, fmt.Errorf("%q is malformed: %w", err) + return nil, fmt.Errorf("%q is malformed: %w", env, err) } var body map[string]interface{} @@ -130,9 +130,8 @@ func fetchDict(env string) (map[string]interface{}, error) { func newConfig(app core.App, feature string) (map[string]string, error) { var envConfig map[string]string - record, err := app.Dao(). - FindFirstRecordByData("features", "name", feature) - envString, err := record.Get("envVariables").(types.JsonRaw).MarshalJSON() + record, err := app.FindFirstRecordByData("features", "name", feature) + envString, err := record.Get("envVariables").(types.JSONRaw).MarshalJSON() if err != nil { return envConfig, err } diff --git a/pocketbase/hooks/hooks.go b/pocketbase/hooks/hooks.go index 232b5547..e3a5212c 100755 --- a/pocketbase/hooks/hooks.go +++ b/pocketbase/hooks/hooks.go @@ -14,43 +14,40 @@ import ( "os/exec" "strings" - "github.com/labstack/echo/v5" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase" - "github.com/pocketbase/pocketbase/apis" "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/tools/mailer" "golang.org/x/exp/slices" ) func Register(app *pocketbase.PocketBase) error { - modelHandler := func(event string) func(e *core.ModelEvent) error { - return func(e *core.ModelEvent) error { - table := e.Model.TableName() + modelHandler := func(event string) func(e *core.RecordEvent) error { + return func(e *core.RecordEvent) error { + table := e.Record.TableName() // we don't want to executeEventActions if the event is a system event (e.g. "_collections" changes) - if record, ok := e.Model.(*models.Record); ok { - executeEventActions(app, event, table, record) + if e.Record != nil { + executeEventActions(app, event, table, e.Record) } else { log.Println("Skipping executeEventActions for table:", table) } - return nil + return e.Next() } } - app.OnBeforeServe().Add(func(e *core.ServeEvent) error { - app.OnModelAfterCreate().Add(modelHandler("insert")) - app.OnModelAfterUpdate().Add(modelHandler("update")) - app.OnModelAfterDelete().Add(modelHandler("delete")) - app.OnRecordAfterCreateRequest().Add(func(e *core.RecordCreateEvent) error { - return doAudit(app, "insert", e.Record, e.HttpContext) + app.OnServe().BindFunc(func(e *core.ServeEvent) error { + app.OnRecordAfterCreateSuccess().BindFunc(modelHandler("insert")) + app.OnRecordAfterUpdateSuccess().BindFunc(modelHandler("update")) + app.OnRecordAfterDeleteSuccess().BindFunc(modelHandler("delete")) + app.OnRecordCreateRequest().BindFunc(func(e *core.RecordRequestEvent) error { + return doAudit(app, "insert", e.Record, e.RequestEvent) }) - app.OnRecordAfterUpdateRequest().Add(func(e *core.RecordUpdateEvent) error { - return doAudit(app, "update", e.Record, e.HttpContext) + app.OnRecordUpdateRequest().BindFunc(func(e *core.RecordRequestEvent) error { + return doAudit(app, "update", e.Record, e.RequestEvent) }) - app.OnRecordAfterDeleteRequest().Add(func(e *core.RecordDeleteEvent) error { - return doAudit(app, "delete", e.Record, e.HttpContext) + app.OnRecordDeleteRequest().BindFunc(func(e *core.RecordRequestEvent) error { + return doAudit(app, "delete", e.Record, e.RequestEvent) }) - return nil + return e.Next() }) return nil } @@ -58,36 +55,29 @@ func Register(app *pocketbase.PocketBase) error { // collection names to be audit logged var collections = strings.Split(os.Getenv("AUDITLOG"), ",") -func doAudit(app *pocketbase.PocketBase, event string, record *models.Record, ctx echo.Context) error { +func doAudit(app *pocketbase.PocketBase, event string, record *core.Record, e *core.RequestEvent) error { collection := record.Collection().Name // exclude logging "auditlog" and include only what's in AUDITLOG env var if collection != "auditlog" && slices.Contains(collections, collection) { - var user, admin string - if u, ok := ctx.Get(apis.ContextAdminKey).(*models.Admin); ok { - admin = u.Id - } - if u, ok := ctx.Get(apis.ContextAuthRecordKey).(*models.Record); ok { - user = u.Id - } - log.Printf("AuditLog:%s:%s:%s:%s:%s\n", collection, record.Id, event, user, admin) - target, err := app.Dao().FindCollectionByNameOrId("auditlog") + user := e.Auth.Id + log.Printf("AuditLog:%s:%s:%s:%s\n", collection, record.Id, event, user) + target, err := app.FindCollectionByNameOrId("auditlog") if err != nil { return err } - auditlog := models.NewRecord(target) + auditlog := core.NewRecord(target) auditlog.Set("collection", collection) auditlog.Set("record", record.Id) auditlog.Set("event", event) auditlog.Set("user", user) - auditlog.Set("admin", admin) auditlog.Set("data", record) - return app.Dao().SaveRecord(auditlog) + return app.Save(auditlog) } return nil } -func executeEventActions(app *pocketbase.PocketBase, event string, table string, record *models.Record) { +func executeEventActions(app *pocketbase.PocketBase, event string, table string, record *core.Record) { // TODO: Load and cache this. Reload only on changes to "hooks" table rows := []dbx.NullStringMap{} app.DB().Select("action_type", "action", "action_params", "expands"). @@ -99,8 +89,8 @@ func executeEventActions(app *pocketbase.PocketBase, event string, table string, action := row["action"].String action_params := row["action_params"].String expands := strings.Split(row["expands"].String, ",") - app.Dao().ExpandRecord(record, expands, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c.Name, ids, nil) + app.ExpandRecord(record, expands, func(c *core.Collection, ids []string) ([]*core.Record, error) { + return app.FindRecordsByIds(c.Name, ids, nil) }) switch action_type { case "sendmail": @@ -115,13 +105,13 @@ func executeEventActions(app *pocketbase.PocketBase, event string, table string, } } -func executeEventAction(event, table, action_type, action, action_params string, record *models.Record) error { +func executeEventAction(event, table, action_type, action, action_params string, record *core.Record) error { log.Printf("event:%s, table: %s, action: %s\n", event, table, action) switch action_type { case "command": return doCommand(action, action_params, record) case "post": - return doPost(action, action_params, record) + return doPost(action, record) case "restroom-mw": return doRestroomMW(action, action_params, record) default: @@ -129,7 +119,7 @@ func executeEventAction(event, table, action_type, action, action_params string, } } -func doSendMail(app *pocketbase.PocketBase, action, action_params string, record *models.Record) error { +func doSendMail(app *pocketbase.PocketBase, action, action_params string, record *core.Record) error { params := struct { Subject string `json:"subject"` OwnerField string `json:"ownerField"` @@ -146,13 +136,13 @@ func doSendMail(app *pocketbase.PocketBase, action, action_params string, record var emails []string owner := record.Get(params.OwnerField) if o, ok := owner.(string); ok { - userTo, err := app.Dao().FindRecordById("users", o) + userTo, err := app.FindRecordById("users", o) if err != nil { return err } emails = []string{userTo.Email()} } else if os, ok := owner.([]string); ok { - records, err := app.Dao().FindRecordsByIds("users", os) + records, err := app.FindRecordsByIds("users", os) if err != nil { return err } @@ -189,7 +179,7 @@ func doSendMail(app *pocketbase.PocketBase, action, action_params string, record return err } -func doCommand(action, action_params string, record *models.Record) error { +func doCommand(action, action_params string, record *core.Record) error { cmd := exec.Command(action, action_params) if w, err := cmd.StdinPipe(); err != nil { return err @@ -220,7 +210,7 @@ func doCommand(action, action_params string, record *models.Record) error { return nil } -func doPost(action, action_params string, record *models.Record) error { +func doPost(action string, record *core.Record) error { r, w := io.Pipe() defer w.Close() go func() { @@ -237,7 +227,7 @@ func doPost(action, action_params string, record *models.Record) error { return nil } -func doRestroomMW(action, action_params string, record *models.Record) error { +func doRestroomMW(action, action_params string, record *core.Record) error { // Parse action params params := struct { Wrapper string `json:"wrapper"` @@ -283,7 +273,7 @@ func doRestroomMW(action, action_params string, record *models.Record) error { // Build request object if params.Wrapper != "" { - reqObj = map[string]models.Record{ + reqObj = map[string]core.Record{ params.Wrapper: *record, } } else { diff --git a/pocketbase/webauthn/webauthn.go b/pocketbase/webauthn/webauthn.go index 509d41d1..65c3b75e 100644 --- a/pocketbase/webauthn/webauthn.go +++ b/pocketbase/webauthn/webauthn.go @@ -11,21 +11,18 @@ import ( "net/http" "github.com/go-webauthn/webauthn/webauthn" - "github.com/labstack/echo/v5" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase" "github.com/pocketbase/pocketbase/apis" "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tokens" ) type User struct { app *pocketbase.PocketBase - model *models.Record + model *core.Record } -func NewUser(app *pocketbase.PocketBase, m *models.Record) *User { +func NewUser(app *pocketbase.PocketBase, m *core.Record) *User { user := &User{ model: m, @@ -57,16 +54,16 @@ func (u User) WebAuthnIcon() string { // AddCredential associates the credential to the user func (u *User) AddCredential(cred webauthn.Credential, description string) error { - credentialsStore, err := u.app.Dao().FindCollectionByNameOrId("webauthnCredentials") + credentialsStore, err := u.app.FindCollectionByNameOrId("webauthnCredentials") if err != nil { return err } - record := models.NewRecord(credentialsStore) + record := core.NewRecord(credentialsStore) record.Set("user", u.model.Id) record.Set("credential", cred) record.Set("description", description) - if err := u.app.Dao().SaveRecord(record); err != nil { + if err := u.app.Save(record); err != nil { return err } return nil @@ -75,7 +72,7 @@ func (u *User) AddCredential(cred webauthn.Credential, description string) error // WebAuthnCredentials returns credentials owned by the user func (u User) WebAuthnCredentials() []webauthn.Credential { var credentials []webauthn.Credential - records, err := u.app.Dao().FindRecordsByExpr("webauthnCredentials", + records, err := u.app.FindAllRecords("webauthnCredentials", dbx.NewExp("user = {:user}", dbx.Params{"user": u.model.Id})) if err != nil { log.Println(err.Error()) @@ -96,7 +93,7 @@ func (u User) WebAuthnCredentials() []webauthn.Credential { } func NewWebAuthnFromEnv(app *pocketbase.PocketBase) (*webauthn.WebAuthn, error) { - record, err := app.Dao().FindFirstRecordByData("features", "name", "webauthn") + record, err := app.FindFirstRecordByData("features", "name", "webauthn") if err != nil { return nil, err } @@ -139,241 +136,212 @@ func NewWebAuthnFromEnv(app *pocketbase.PocketBase) (*webauthn.WebAuthn, error) return w, nil } -func storeSessionData(app *pocketbase.PocketBase, userRecord *models.Record, sessionData *webauthn.SessionData) error { +func storeSessionData(app *pocketbase.PocketBase, userRecord *core.Record, sessionData *webauthn.SessionData) error { // Remove old session data - record, err := app.Dao().FindFirstRecordByData("sessionDataWebauthn", "user", userRecord.Id) + record, err := app.FindFirstRecordByData("sessionDataWebauthn", "user", userRecord.Id) if record != nil { - if err := app.Dao().DeleteRecord(record); err != nil { + if err := app.Delete(record); err != nil { return err } } // store session data as marshaled JSON - sessionStore, err := app.Dao().FindCollectionByNameOrId("sessionDataWebauthn") + sessionStore, err := app.FindCollectionByNameOrId("sessionDataWebauthn") if err != nil { return err } - record = models.NewRecord(sessionStore) + record = core.NewRecord(sessionStore) record.Set("user", userRecord.Id) record.Set("session", sessionData) - if err := app.Dao().SaveRecord(record); err != nil { + if err := app.Save(record); err != nil { return err } return nil } func Register(app *pocketbase.PocketBase) error { - app.OnBeforeServe().Add(func(e *core.ServeEvent) error { - e.Router.AddRoute(echo.Route{ - Method: http.MethodGet, - Path: "/api/webauthn/register/begin/:email", - Handler: func(c echo.Context) error { - w, err := NewWebAuthnFromEnv(app) + app.OnServe().BindFunc(func(se *core.ServeEvent) error { + se.Router.GET("/api/webauthn/register/begin/:email", func(e *core.RequestEvent) error { + w, err := NewWebAuthnFromEnv(app) + if err != nil { + return err + } + + email := e.Request.PathValue("email") + + authenticated := true + if e.Auth == nil { + authenticated = false + // User not authenticated I have to create a new user, + // but if a user exists I may go on if that user doesn't + // have neither a password nor a credential + e.Auth, err = app.FindAuthRecordByEmail("users", email) if err != nil { - return err - } - - email := c.PathParam("email") - - authenticated := true - userRecord, _ := c.Get(apis.ContextAuthRecordKey).(*models.Record) - if userRecord == nil { - authenticated = false - // User not authenticated I have to create a new user, - // but if a user exists I may go on if that user doesn't - // have neither a password nor a credential - userRecord, err = app.Dao().FindAuthRecordByEmail("users", email) + // Could not fetch the user, try to create a new one + collection, err := app.FindCollectionByNameOrId("users") if err != nil { - // Could not fetch the user, try to create a new one - collection, err := app.Dao().FindCollectionByNameOrId("users") - if err != nil { - return err - } - - userRecord = models.NewRecord(collection) - userRecord.Set("email", email) - userRecord.Set("username", email) - userRecord.RefreshTokenKey() - if err := app.Dao().SaveRecord(userRecord); err != nil { - return err - } + return err } - } else if userRecord.Get("email") != email { // User is logged in - return apis.NewForbiddenError("Wrong email", nil) - } - - user := NewUser(app, userRecord) - - if !authenticated && (len(user.WebAuthnCredentials()) > 0 || userRecord.PasswordHash() != "") { - return apis.NewForbiddenError("A user already exists with this email", nil) - } - - options, sessionData, err := w.BeginRegistration( - user, - ) - - if err != nil { - return c.JSON(http.StatusInternalServerError, err.Error()) - } - - err = storeSessionData(app, userRecord, sessionData) - - if err != nil { - return c.JSON(http.StatusInternalServerError, err.Error()) - } - return c.JSON(http.StatusOK, options) - }, - Middlewares: []echo.MiddlewareFunc{ - apis.ActivityLogger(app), - }, - }) - e.Router.AddRoute(echo.Route{ - Method: http.MethodPost, - Path: "/api/webauthn/register/finish/:email", - Handler: func(c echo.Context) error { - w, err := NewWebAuthnFromEnv(app) - if err != nil { - return err - } - - data := new(struct { - Description string `json:"description" form:"description" query:"description"` - }) - var b []byte - - // I have to read c.Request() twice.. :( - if c.Request().Body != nil { - // TODO: check that the body is not tooo big (it should not) - b, _ = io.ReadAll(c.Request().Body) - c.Request().Body = io.NopCloser(bytes.NewBuffer(b)) - - if err := c.Bind(data); err != nil { - return c.String(http.StatusBadRequest, err.Error()) + e.Auth = core.NewRecord(collection) + e.Auth.Set("email", email) + e.Auth.Set("username", email) + e.Auth.RefreshTokenKey() + if err := app.Save(e.Auth); err != nil { + return err } - c.Request().Body = io.NopCloser(bytes.NewBuffer(b)) } - fmt.Printf("data: %v\n", data) - email := c.PathParam("email") + } else if e.Auth.Get("email") != email { // User is logged in + return apis.NewForbiddenError("Wrong email", nil) + } - userRecord, err := app.Dao().FindAuthRecordByEmail("users", email) - if err != nil { - log.Println(err) - return err - } - user := NewUser(app, userRecord) - record, err := app.Dao().FindFirstRecordByData("sessionDataWebauthn", "user", userRecord.Id) - if err != nil { - return err - } - var sessionData webauthn.SessionData - json.Unmarshal([]byte(record.GetString("session")), &sessionData) + user := NewUser(app, e.Auth) - credential, err := w.FinishRegistration(user, sessionData, c.Request()) - if err != nil { - fmt.Println(c.Request()) - return err - } - user.AddCredential(*credential, data.Description) + if !authenticated && (len(user.WebAuthnCredentials()) > 0 || e.Auth.GetString("passwordHash") != "") { + return apis.NewForbiddenError("A user already exists with this email", nil) + } - if err := app.Dao().SaveRecord(userRecord); err != nil { - return err - } - if err := app.Dao().DeleteRecord(record); err != nil { - return err - } + options, sessionData, err := w.BeginRegistration( + user, + ) - return c.JSON(http.StatusOK, make(map[string]interface{})) - }, - Middlewares: []echo.MiddlewareFunc{ - apis.ActivityLogger(app), - }, - }) - e.Router.AddRoute(echo.Route{ - Method: http.MethodGet, - Path: "/api/webauthn/login/begin/:email", - Handler: func(c echo.Context) error { - w, err := NewWebAuthnFromEnv(app) - if err != nil { - return err - } - if w == nil { - return apis.NewNotFoundError("Webauthn not enabled", nil) - } - - email := c.PathParam("email") - userRecord, err := app.Dao().FindAuthRecordByEmail("users", email) - if err != nil { - return err - } - user := NewUser(app, userRecord) + if err != nil { + return e.JSON(http.StatusInternalServerError, err.Error()) + } - // generate PublicKeyCredentialRequestOptions, session data - options, sessionData, err := w.BeginLogin(user) - if err != nil { - return err - } + err = storeSessionData(app, e.Auth, sessionData) - err = storeSessionData(app, userRecord, sessionData) + if err != nil { + return e.JSON(http.StatusInternalServerError, err.Error()) + } - if err != nil { - return c.JSON(http.StatusInternalServerError, err.Error()) - } - - return c.JSON(http.StatusOK, options) - }, - Middlewares: []echo.MiddlewareFunc{ - apis.ActivityLogger(app), - }, + return e.JSON(http.StatusOK, options) }) - e.Router.AddRoute(echo.Route{ - Method: http.MethodPost, - Path: "/api/webauthn/login/finish/:email", - Handler: func(c echo.Context) error { - w, err := NewWebAuthnFromEnv(app) - if err != nil { - return err - } - if w == nil { - return apis.NewNotFoundError("Webauthn not enabled", nil) + se.Router.POST("/api/webauthn/register/finish/:email", func(e *core.RequestEvent) error { + w, err := NewWebAuthnFromEnv(app) + if err != nil { + return err + } + + data := new(struct { + Description string `json:"description" form:"description" query:"description"` + }) + var b []byte + + // I have to read c.Request() twice.. :( + if e.Request.Body != nil { + // TODO: check that the body is not tooo big (it should not) + b, _ = io.ReadAll(e.Request.Body) + e.Request.Body = io.NopCloser(bytes.NewBuffer(b)) + + if err := json.Unmarshal(b, data); err != nil { + return e.String(http.StatusBadRequest, err.Error()) } - - email := c.PathParam("email") - userRecord, err := app.Dao().FindAuthRecordByEmail("users", email) - if err != nil { - return err - } - user := NewUser(app, userRecord) - record, err := app.Dao().FindFirstRecordByData("sessionDataWebauthn", "user", userRecord.Id) - if err != nil { - return err - } - var sessionData webauthn.SessionData - json.Unmarshal([]byte(record.GetString("session")), &sessionData) - - _, err = w.FinishLogin(user, sessionData, c.Request()) - if err != nil { - return err - } - - // generate an auth token and return an auth response - // note: in the future the below will be simplified to just: return api.AuthResponse(c, user) - token, tokenErr := tokens.NewRecordAuthToken(app, userRecord) - if tokenErr != nil { - return errors.New("Failed to create user token") - } - - return c.JSON(http.StatusOK, map[string]any{ - "token": token, - "user": userRecord, - }) - }, - Middlewares: []echo.MiddlewareFunc{ - apis.ActivityLogger(app), - }, + e.Request.Body = io.NopCloser(bytes.NewBuffer(b)) + } + fmt.Printf("data: %v\n", data) + email := e.Request.PathValue("email") + + userRecord, err := app.FindAuthRecordByEmail("users", email) + if err != nil { + log.Println(err) + return err + } + user := NewUser(app, userRecord) + record, err := app.FindFirstRecordByData("sessionDataWebauthn", "user", userRecord.Id) + if err != nil { + return err + } + var sessionData webauthn.SessionData + json.Unmarshal([]byte(record.GetString("session")), &sessionData) + + credential, err := w.FinishRegistration(user, sessionData, e.Request) + if err != nil { + fmt.Println(e.Request) + return err + } + user.AddCredential(*credential, data.Description) + + if err := app.Save(userRecord); err != nil { + return err + } + if err := app.Delete(record); err != nil { + return err + } + + return e.JSON(http.StatusOK, make(map[string]interface{})) }) - return nil + se.Router.GET("/api/webauthn/login/begin/:email", func(e *core.RequestEvent) error { + w, err := NewWebAuthnFromEnv(app) + if err != nil { + return err + } + if w == nil { + return apis.NewNotFoundError("Webauthn not enabled", nil) + } + + email := e.Request.PathValue("email") + userRecord, err := app.FindAuthRecordByEmail("users", email) + if err != nil { + return err + } + user := NewUser(app, userRecord) + + // generate PublicKeyCredentialRequestOptions, session data + options, sessionData, err := w.BeginLogin(user) + if err != nil { + return err + } + + err = storeSessionData(app, userRecord, sessionData) + + if err != nil { + return e.JSON(http.StatusInternalServerError, err.Error()) + } + + return e.JSON(http.StatusOK, options) + }) + se.Router.POST("/api/webauthn/login/finish/:email", func(e *core.RequestEvent) error { + w, err := NewWebAuthnFromEnv(app) + if err != nil { + return err + } + if w == nil { + return apis.NewNotFoundError("Webauthn not enabled", nil) + } + + email := e.Request.PathValue("email") + userRecord, err := app.FindAuthRecordByEmail("users", email) + if err != nil { + return err + } + user := NewUser(app, userRecord) + record, err := app.FindFirstRecordByData("sessionDataWebauthn", "user", userRecord.Id) + if err != nil { + return err + } + var sessionData webauthn.SessionData + json.Unmarshal([]byte(record.GetString("session")), &sessionData) + + _, err = w.FinishLogin(user, sessionData, e.Request) + if err != nil { + return err + } + + // generate an auth token and return an auth response + // note: in the future the below will be simplified to just: return api.AuthResponse(c, user) + token, tokenErr := userRecord.NewAuthToken() + if tokenErr != nil { + return errors.New("Failed to create user token") + } + + return e.JSON(http.StatusOK, map[string]any{ + "token": token, + "user": userRecord, + }) + }) + return se.Next() }) return nil } From 2a6477dd8102f1a7bdb083346b9a0b54f1b32518 Mon Sep 17 00:00:00 2001 From: FilippoTrotter Date: Tue, 7 Jan 2025 12:16:48 +0100 Subject: [PATCH 02/14] try to update pb_hooks to pocketbase 0.23 --- pb_hooks/ambient.d.ts | 2 +- pb_hooks/auditLogger.js | 12 +- pb_hooks/features.pb.js | 4 +- pb_hooks/oauth.pb.js | 4 +- pb_hooks/organizations.pb.js | 56 ++++----- pb_hooks/organizations_authorizations.pb.js | 70 ++++++----- pb_hooks/organizations_invites.pb.js | 58 ++++----- .../organizations_request_membership.pb.js | 48 ++++---- pb_hooks/users.pb.js | 10 +- pb_hooks/utils.js | 111 +++++++++--------- 10 files changed, 182 insertions(+), 193 deletions(-) diff --git a/pb_hooks/ambient.d.ts b/pb_hooks/ambient.d.ts index 142d7467..7ce987ac 100644 --- a/pb_hooks/ambient.d.ts +++ b/pb_hooks/ambient.d.ts @@ -1,7 +1,7 @@ /// /// -interface RecordModel> extends models.Record { +interface RecordModel> extends core.Record { get: (key: K) => R[K]; } diff --git a/pb_hooks/auditLogger.js b/pb_hooks/auditLogger.js index 0ca8f746..04ba1170 100644 --- a/pb_hooks/auditLogger.js +++ b/pb_hooks/auditLogger.js @@ -2,22 +2,22 @@ /** @typedef {import('./utils.js')} Utils */ -/** @param {echo.Context} c */ -function auditLogger(c) { +/** @param {core.RequestEvent} e */ +function auditLogger(e) { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); /** @type {unknown[]} */ - const args = ["actorIp", c.realIP()]; + const args = ["actorIp", e.realIP()]; - if (utils.isAdminContext(c)) { + if (utils.isAdminContext(e)) { args.push("actorId", "ADMIN"); } else { args.push( "actorId", - $apis.requestInfo(c).authRecord?.getId(), + e.auth?.id, "actorCollection", - $apis.requestInfo(c).authRecord?.collection().name + e.auth?.collection().name ); } diff --git a/pb_hooks/features.pb.js b/pb_hooks/features.pb.js index eba74c40..15e9c67d 100644 --- a/pb_hooks/features.pb.js +++ b/pb_hooks/features.pb.js @@ -7,7 +7,7 @@ onRecordViewRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; e.record?.set("envVariables", null); }, "features"); @@ -16,7 +16,7 @@ onRecordsListRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; e.records.forEach((r) => { r?.set("envVariables", null); diff --git a/pb_hooks/oauth.pb.js b/pb_hooks/oauth.pb.js index 54ef60dd..165d4ed5 100644 --- a/pb_hooks/oauth.pb.js +++ b/pb_hooks/oauth.pb.js @@ -4,7 +4,7 @@ /** @typedef {import('./utils.js')} Utils */ /* Updating user info on first register */ -onRecordAfterAuthWithOAuth2Request((e) => { +onRecordAuthWithOAuth2Request((e) => { if (!e.isNewRecord) return; /** @type {Utils} */ @@ -16,5 +16,5 @@ onRecordAfterAuthWithOAuth2Request((e) => { user.set("name", oAuth2User.name); user.markAsNotNew(); - $app.dao().saveRecord(user); + $app.Save(user); }, "users"); diff --git a/pb_hooks/organizations.pb.js b/pb_hooks/organizations.pb.js index 00cbdf4c..90322298 100644 --- a/pb_hooks/organizations.pb.js +++ b/pb_hooks/organizations.pb.js @@ -14,44 +14,44 @@ /* Routes */ -routerAdd("POST", "/organizations/verify-user-membership", (c) => { +routerAdd("POST", "/organizations/verify-user-membership", (e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); - const userId = utils.getUserFromContext(c)?.getId(); + const userId = utils.getUserFromContext(e)?.id; /** @type {string | undefined} */ - const organizationId = $apis.requestInfo(c).data["organizationId"]; + const organizationId = e.requestInfo().body["organizationId"]; if (!organizationId) throw utils.createMissingDataError("organizationId", "roles"); try { - $app.dao().findFirstRecordByFilter( + $app.findFirstRecordByFilter( "orgAuthorizations", `organization="${organizationId}" && user="${userId}"` ); - return c.json(200, { isMember: true }); + return e.json(200, { isMember: true }); } catch { - auditLogger(c).info( + auditLogger(e).info( "request_from_user_not_member", "organizationId", organizationId ); - return c.json(200, { isMember: false }); + return e.json(200, { isMember: false }); } }); -routerAdd("POST", "/organizations/verify-user-role", (c) => { +routerAdd("POST", "/organizations/verify-user-role", (e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - const userId = utils.getUserFromContext(c)?.getId(); + const userId = utils.getUserFromContext(e)?.id; /** @type {{organizationId: string, roles: string[]}}*/ // @ts-ignore - const { organizationId, roles } = $apis.requestInfo(c).data; + const { organizationId, roles } = e.requestInfo().body; if (!organizationId || !roles || roles.length === 0) throw utils.createMissingDataError("organizationId", "roles"); @@ -60,13 +60,13 @@ routerAdd("POST", "/organizations/verify-user-role", (c) => { .join(" || ")} )`; try { - $app.dao().findFirstRecordByFilter( + $app.findFirstRecordByFilter( "orgAuthorizations", `organization="${organizationId}" && user="${userId}" && ${roleFilter}` ); - return c.json(200, { hasRole: true }); + return e.json(200, { hasRole: true }); } catch { - return c.json(200, { hasRole: false }); + return e.json(200, { hasRole: false }); } }); @@ -74,35 +74,35 @@ routerAdd("POST", "/organizations/verify-user-role", (c) => { // On Organization Create โ€“ Creating owner authorization -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); // Don't create orgAuthorization if organization is created from admin panel - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; - const userId = utils.getUserFromContext(e.httpContext)?.getId(); - const organizationId = e.record?.getId(); + const userId = utils.getUserFromContext(e)?.id; + const organizationId = e.record?.id; const ownerRole = utils.getRoleByName("owner"); - const ownerRoleId = ownerRole?.getId(); + const ownerRoleId = ownerRole?.id; - const collection = $app.dao().findCollectionByNameOrId("orgAuthorizations"); + const collection = $app.findCollectionByNameOrId("orgAuthorizations"); const record = new Record(collection, { organization: organizationId, role: ownerRoleId, user: userId, }); - $app.dao().saveRecord(record); + $app.Save(record); // - auditLogger(e.httpContext).info( + auditLogger(e).info( "Created owner role for organization", "organizationId", - e.record?.getId(), + e.record?.id, "organizationName", e.record?.get("name"), "userId", @@ -114,14 +114,14 @@ onRecordAfterCreateRequest((e) => { // Log organization creation -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Created organization", "organizationId", - e.record?.getId(), + e.record?.id, "organizationName", e.record?.get("name") ); @@ -131,13 +131,13 @@ onRecordAfterCreateRequest((e) => { // Send email after organization creation -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); if (!e.record) throw utils.createMissingDataError("organization"); - const user = utils.getUserFromContext(e.httpContext); + const user = utils.getUserFromContext(e); if (!user) throw utils.createMissingDataError("user creating organization"); const userAddress = utils.getUserEmailAddressData(user); @@ -146,7 +146,7 @@ onRecordAfterCreateRequest((e) => { const emailData = utils.renderEmail("new-organization", { OrganizationName: organizationName, UserName: user.get("name") ?? "User", - DashboardLink: utils.getOrganizationPageUrl(e.record.getId()), + DashboardLink: utils.getOrganizationPageUrl(e.record.id), AppName: utils.getAppName(), }); diff --git a/pb_hooks/organizations_authorizations.pb.js b/pb_hooks/organizations_authorizations.pb.js index aaaad9a0..49a62daf 100644 --- a/pb_hooks/organizations_authorizations.pb.js +++ b/pb_hooks/organizations_authorizations.pb.js @@ -16,11 +16,11 @@ // [CREATE] Cannot create an authorization with a level higher than or equal to your permissions -onRecordBeforeCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; const { isSelf, userRoleLevel } = utils.getUserContextInOrgAuthorizationHookEvent(e); @@ -48,18 +48,18 @@ onRecordBeforeCreateRequest((e) => { // [UPDATE] Cannot update to/from a role higher than the user -onRecordBeforeUpdateRequest((e) => { +onRecordUpdateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; const { isSelf, userRoleLevel: requestingUserRoleLevel } = utils.getUserContextInOrgAuthorizationHookEvent(e); // Getting role before edit (unmodified) - const originalAuthorization = e.record?.originalCopy(); + const originalAuthorization = e.record?.original(); if (!originalAuthorization) throw utils.createMissingDataError("originalAuthorization"); @@ -78,10 +78,10 @@ onRecordBeforeUpdateRequest((e) => { // Getting requested role /** @type {Partial} */ - const { role: newRoleId } = $apis.requestInfo(e.httpContext).data; + const { role: newRoleId } = e.requestInfo().body; if (!newRoleId) throw utils.createMissingDataError("newRoleId"); - const newRole = $app.dao().findRecordById("orgRoles", newRoleId); + const newRole = $app.findRecordById("orgRoles", newRoleId); const newRoleLevel = utils.getRoleLevel(newRole); @@ -95,11 +95,11 @@ onRecordBeforeUpdateRequest((e) => { // [DELETE] Cannot delete an authorization with a level higher than or equal to yours -onRecordBeforeDeleteRequest((e) => { +onRecordDeleteRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; const { isSelf, userRoleLevel: requestingUserRoleLevel } = utils.getUserContextInOrgAuthorizationHookEvent(e); @@ -126,11 +126,11 @@ onRecordBeforeDeleteRequest((e) => { // [DELETE] Cannot delete last owner role -onRecordBeforeDeleteRequest((e) => { +onRecordDeleteRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; if (e.record && utils.isLastOwnerAuthorization(e.record)) { throw new BadRequestError(utils.errors.cant_edit_last_owner_role); @@ -139,13 +139,13 @@ onRecordBeforeDeleteRequest((e) => { // [UPDATE] Cannot edit last owner role -onRecordBeforeUpdateRequest((e) => { +onRecordUpdateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); - if (utils.isAdminContext(e.httpContext)) return; + if (utils.isAdminContext(e)) return; - const originalRecord = e.record?.originalCopy(); + const originalRecord = e.record?.original(); // e.record is already the "modified" version, so it is not a "owner" role anymore // to check if it's the last one, we need to get the "original" record @@ -156,7 +156,7 @@ onRecordBeforeUpdateRequest((e) => { /* Audit + Email hooks */ -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); @@ -169,24 +169,24 @@ onRecordAfterCreateRequest((e) => { const user = utils.getExpanded(e.record, "user"); const role = utils.getExpanded(e.record, "role"); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Created organization authorization", "organizationId", - organization?.getId(), + organization?.id, "organizationName", organization?.get("name"), "userId", - user?.getId(), + user?.id, "userName", user?.get("name"), "roleId", - role?.getId(), + role?.id, "roleName", role?.get("name") ); }, "orgAuthorizations"); -onRecordAfterUpdateRequest((e) => { +onRecordUpdateRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); @@ -203,38 +203,36 @@ onRecordAfterUpdateRequest((e) => { if (!user) throw utils.createMissingDataError("user of orgAuthorization"); const UserName = user.getString("name"); - const previousRole = utils.getExpanded(e.record.originalCopy(), "role"); + const previousRole = utils.getExpanded(e.record.original(), "role"); const role = utils.getExpanded(e.record, "role"); if (!role) throw utils.createMissingDataError("role"); - const adminName = $apis - .requestInfo(e.httpContext) - .authRecord?.getString("name"); + const adminName = e.auth?.getString("name"); if (!adminName) throw utils.createMissingDataError("adminName"); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Updated organization authorization", "organizationId", - organization.getId(), + organization.id, "organizationName", OrganizationName, "userId", - user.getId(), + user.id, "userName", UserName, "previousRoleId", - previousRole?.getId(), + previousRole?.id, "previousRoleName", previousRole?.get("name"), "newRoleId", - role.getId(), + role.id, "newRoleName", role.getString("name") ); const email = utils.renderEmail("role-change", { OrganizationName, - DashboardLink: utils.getOrganizationPageUrl(organization.getId()), + DashboardLink: utils.getOrganizationPageUrl(organization.id), UserName, Admin: adminName, Membership: role.getString("name"), @@ -251,7 +249,7 @@ onRecordAfterUpdateRequest((e) => { } }, "orgAuthorizations"); -onRecordAfterDeleteRequest((e) => { +onRecordDeleteRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); @@ -260,7 +258,7 @@ onRecordAfterDeleteRequest((e) => { if (!e.record) return; - const record = e.record.originalCopy(); + const record = e.record.original(); const organization = utils.getExpanded(record, "organization"); const OrganizationName = organization?.get("name"); @@ -271,18 +269,18 @@ onRecordAfterDeleteRequest((e) => { if (!user) throw utils.createMissingDataError("user of orgAuthorization"); if (!role) throw utils.createMissingDataError("role of orgAuthorization"); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Deleted organization authorization", "organizationId", - organization?.getId(), + organization?.id, "organizationName", OrganizationName, "userId", - user.getId(), + user.id, "userName", user.get("name"), "roleId", - role.getId(), + role.id, "roleName", role.get("name") ); diff --git a/pb_hooks/organizations_invites.pb.js b/pb_hooks/organizations_invites.pb.js index 6407cb0a..59443322 100644 --- a/pb_hooks/organizations_invites.pb.js +++ b/pb_hooks/organizations_invites.pb.js @@ -12,7 +12,7 @@ /* Hooks */ -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -22,8 +22,8 @@ onRecordAfterCreateRequest((e) => { ); invites.forEach((invite) => { invite.markAsNotNew(); - invite.set("user", e.record?.getId()); - $app.dao().saveRecord(invite); + invite.set("user", e.record?.id); + $app.Save(invite); }); }, "users"); @@ -41,19 +41,17 @@ routerAdd("POST", "/organizations/invites/accept", (c) => { /* -- Logic -- */ - const orgAuthorizationsCollection = $app - .dao() - .findCollectionByNameOrId("orgAuthorizations"); + const orgAuthorizationsCollection = $app.findCollectionByNameOrId("orgAuthorizations"); const organizationId = invite.get("organization"); const authorization = new Record(orgAuthorizationsCollection); authorization.set("user", userId); - authorization.set("role", utils.getRoleByName("member")?.getId()); + authorization.set("role", utils.getRoleByName("member")?.id); authorization.set("organization", organizationId); - $app.dao().saveRecord(authorization); - $app.dao().deleteRecord(invite); + $app.Save(authorization); + $app.Delete(invite); auditLogger(c).info( "user_accepted_invite", @@ -72,7 +70,7 @@ routerAdd("POST", "/organizations/invites/decline", (c) => { invite.markAsNotNew(); invite.set("declined", true); - $app.dao().saveRecord(invite); + $app.Save(invite); auditLogger(c).info( "user_accepted_invite", @@ -99,7 +97,7 @@ routerAdd("POST", "/organizations/invite", (c) => { throw utils.createMissingDataError("organizationId", "emails"); const actor = utils.getUserFromContext(c); - const actorId = actor?.getId(); + const actorId = actor?.id; const actorName = actor?.get("name"); if (!actorId) throw utils.createMissingDataError("userId"); @@ -110,29 +108,25 @@ routerAdd("POST", "/organizations/invite", (c) => { /* -- Logic -- */ - const orgInvitesCollection = $app - .dao() - .findCollectionByNameOrId("org_invites"); + const orgInvitesCollection = $app.findCollectionByNameOrId("org_invites"); - const organization = $app - .dao() - .findRecordById("organizations", organizationId); + const organization = $app.findRecordById("organizations", organizationId); const organizationName = organization.get("name"); - $app.dao().runInTransaction((txDao) => { + $app.runInTransaction((txApp) => { for (const email of emails) { // Checking if user is already member const user = utils.findFirstRecordByFilter( "users", `email = "${email}"`, - txDao + txApp ); if (user) { const userRole = utils.getUserRole( - user.getId(), + user.id, organizationId, - txDao + txApp ); if (userRole) continue; } @@ -142,7 +136,7 @@ routerAdd("POST", "/organizations/invite", (c) => { const existingInvite = utils.findFirstRecordByFilter( "org_invites", `user_email = "${email}"`, - txDao + txApp ); if (existingInvite) continue; @@ -151,8 +145,8 @@ routerAdd("POST", "/organizations/invite", (c) => { const invite = new Record(orgInvitesCollection); invite.set("organization", organizationId); invite.set("user_email", email); - if (user) invite.set("user", user.getId()); - txDao.saveRecord(invite); + if (user) invite.set("user", user.id); + txApp.Save(invite); // Send email @@ -160,9 +154,9 @@ routerAdd("POST", "/organizations/invite", (c) => { // Reference: webapp/src/routes/[[lang]]/(nru)/organization-invite-[orgId]-[inviteId]-[email]-[[userId]] const routeParams = [ organizationId, - invite.getId(), + invite.id, encodeURIComponent(email), - user?.getId() ?? "", + user?.id ?? "", ]; const paramsString = routeParams.join("-"); const emailCtaUrl = `${utils.getAppUrl()}/organization-invite-${paramsString}`; @@ -201,12 +195,12 @@ routerAdd("POST", "/organizations/invite", (c) => { "personEmail", email, "userId", - user?.getId() + user?.id ); } else { invite.markAsNotNew(); invite.set("failed_email_send", true); - txDao.saveRecord(invite); + txApp.Save(invite); auditLogger(c).info( "failed_to_send_organization_invite", @@ -215,7 +209,7 @@ routerAdd("POST", "/organizations/invite", (c) => { "email", email, "userId", - user?.getId(), + user?.id, "errorMessage", err.message ); @@ -226,14 +220,14 @@ routerAdd("POST", "/organizations/invite", (c) => { /* */ -onRecordAfterDeleteRequest((e) => { +onRecordDeleteRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Deleted organization invite", "inviteId", - e.record?.getId(), + e.record?.id, "organizationId", e.record?.get("organization") ); diff --git a/pb_hooks/organizations_request_membership.pb.js b/pb_hooks/organizations_request_membership.pb.js index 25ac0614..6fcc20ed 100644 --- a/pb_hooks/organizations_request_membership.pb.js +++ b/pb_hooks/organizations_request_membership.pb.js @@ -12,14 +12,14 @@ /* Base hooks */ -onRecordBeforeCreateRequest((e) => { +onRecordCreateRequest((e) => { e.record?.set("status", "pending"); e.record?.set("reminders", 0); }, "orgJoinRequests"); // Cannot create join request if user is already member -onRecordBeforeCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -39,7 +39,7 @@ onRecordBeforeCreateRequest((e) => { // Create orgAuthorization after accepting membership request -onRecordAfterUpdateRequest((e) => { +onRecordUpdateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -48,9 +48,7 @@ onRecordAfterUpdateRequest((e) => { const status = e.record.get("status"); if (status != "accepted") return; - const orgAuthorizationsCollection = $app - .dao() - .findCollectionByNameOrId("orgAuthorizations"); + const orgAuthorizationsCollection = $app.findCollectionByNameOrId("orgAuthorizations"); if (!orgAuthorizationsCollection) throw utils.createMissingDataError("orgAuthorizationsCollection"); @@ -58,7 +56,7 @@ onRecordAfterUpdateRequest((e) => { const userId = e.record.get("user"); const memberRole = utils.getRoleByName("member"); - const roleId = memberRole?.getId(); + const roleId = memberRole?.id; const record = new Record(orgAuthorizationsCollection, { user: userId, @@ -66,12 +64,12 @@ onRecordAfterUpdateRequest((e) => { role: roleId, }); - $app.dao().saveRecord(record); + $app.saveRecord(record); }, "orgJoinRequests"); /* Email hooks - Notifications to Admins */ -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -83,7 +81,7 @@ onRecordAfterCreateRequest((e) => { const user = utils.getExpanded(e.record, "user"); if (!user) throw utils.createMissingDataError("user of orgJoinRequest"); - const organizationId = organization.getId(); + const organizationId = organization.id; const recipients = utils.getOrganizationAdminsAddresses(organizationId); for (const adminAddress of recipients) { @@ -121,13 +119,13 @@ cronAdd("remind admins about join requests", "0 9 * * 1", () => { requests: utils .findRecordsByFilter( "orgJoinRequests", - `organization.id = "${organization.getId()}"` + `organization.id = "${organization.id}"` ) .filter((r) => r.get("status") == "pending"), })) .filter(({ requests }) => requests.length > 0) .forEach(({ organization, requests }) => { - const organizationId = organization.getId(); + const organizationId = organization.id; const OrganizationName = organization.get("name"); const recipients = @@ -156,7 +154,7 @@ cronAdd("remind admins about join requests", "0 9 * * 1", () => { /* Email hooks - Notifications to Users */ -onRecordAfterUpdateRequest((e) => { +onRecordUpdateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -188,7 +186,7 @@ onRecordAfterUpdateRequest((e) => { const successEmail = utils.renderEmail("membership-request-accepted", { OrganizationName, UserName: userAddress.name, - DashboardLink: utils.getOrganizationPageUrl(organization.getId()), + DashboardLink: utils.getOrganizationPageUrl(organization.id), AppName: utils.getAppName(), }); @@ -206,52 +204,52 @@ onRecordAfterUpdateRequest((e) => { /* Audit logs */ -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Created membership request", "organizationId", e.record?.get("organization"), "requestId", - e.record?.getId() + e.record?.id ); }, "orgJoinRequests"); -onRecordAfterUpdateRequest((e) => { +onRecordUpdateRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Updated membership request", "organizationId", e.record?.get("organization"), "status", e.record?.get("status"), "requestId", - e.record?.getId() + e.record?.id ); }, "orgJoinRequests"); -onRecordAfterDeleteRequest((e) => { +onRecordDeleteRequest((e) => { /** @type {AuditLogger} */ const auditLogger = require(`${__hooks}/auditLogger.js`); - auditLogger(e.httpContext).info( + auditLogger(e).info( "Deleted membership request", "organizationId", e.record?.get("organization"), "status", e.record?.get("status"), "requestId", - e.record?.getId() + e.record?.id ); }, "orgJoinRequests"); /* IMPORTANT: This hook must be registered last */ -onRecordAfterUpdateRequest((e) => { +onRecordUpdateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -263,5 +261,5 @@ onRecordAfterUpdateRequest((e) => { const isRelevantChange = status == "accepted" || status == "rejected"; if (!isRelevantChange) return; - $app.dao().deleteRecord(e.record); + $app.Delete(e.record); }, "orgJoinRequests"); diff --git a/pb_hooks/users.pb.js b/pb_hooks/users.pb.js index 8b665de5..9d0ad954 100644 --- a/pb_hooks/users.pb.js +++ b/pb_hooks/users.pb.js @@ -4,7 +4,7 @@ /** @typedef {import('./utils.js')} Utils */ /** @typedef {import('./auditLogger.js')} AuditLogger */ -onMailerBeforeRecordResetPasswordSend((e) => { +onMailerRecordPasswordResetSend((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -14,7 +14,7 @@ onMailerBeforeRecordResetPasswordSend((e) => { const token = e.meta["token"]; if (!token) throw utils.createMissingDataError("token"); - const resetLink = $app.settings().meta.appUrl + `/reset-password-${token}`; + const resetLink = $app.settings().meta.appURL + `/reset-password-${token}`; const emailData = utils.renderEmail("reset-password", { username: e.record?.get("name") ?? "User", @@ -26,7 +26,7 @@ onMailerBeforeRecordResetPasswordSend((e) => { e.message.subject = emailData.subject; }, "users"); -onMailerBeforeRecordVerificationSend((e) => { +onMailerRecordVerificationSend((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); @@ -37,7 +37,7 @@ onMailerBeforeRecordVerificationSend((e) => { if (!token) throw utils.createMissingDataError("token"); const VerificationLink = - $app.settings().meta.appUrl + `/verify-email-${token}`; + $app.settings().meta.appURL + `/verify-email-${token}`; const emailData = utils.renderEmail("confirm-email", { UserName: e.record?.get("name") ?? "User", @@ -49,7 +49,7 @@ onMailerBeforeRecordVerificationSend((e) => { e.message.subject = emailData.subject; }, "users"); -onRecordAfterCreateRequest((e) => { +onRecordCreateRequest((e) => { /** @type {Utils} */ const utils = require(`${__hooks}/utils.js`); diff --git a/pb_hooks/utils.js b/pb_hooks/utils.js index 3f22120c..4bc6a4ba 100644 --- a/pb_hooks/utils.js +++ b/pb_hooks/utils.js @@ -42,14 +42,14 @@ const errors = { */ function getRoleByName(name) { try { - return $app.dao().findFirstRecordByData("orgRoles", "name", name); + return $app.findFirstRecordByData("orgRoles", "name", name); } catch { return undefined; } } /** - * @param {models.Record} role + * @param {core.Record} role * @returns {number} */ function getRoleLevel(role) { @@ -57,12 +57,12 @@ function getRoleLevel(role) { } /** - * @param {models.Record} orgAuthorization + * @param {core.Record} orgAuthorization */ function isLastOwnerAuthorization(orgAuthorization) { const organizationId = orgAuthorization.get("organization"); const roleId = orgAuthorization.get("role"); - const ownerRoleId = getRoleByName("owner")?.getId(); + const ownerRoleId = getRoleByName("owner")?.id; if (roleId !== ownerRoleId) return false; @@ -77,24 +77,25 @@ function isLastOwnerAuthorization(orgAuthorization) { /** * @param {string} userId * @param {string} organizationId + * @param {core.App | excludeHooks } [app= $app] * @returns {RecordModel | undefined} */ -function getUserRole(userId, organizationId, dao = $app.dao()) { +function getUserRole(userId, organizationId, app = $app) { const authorization = findFirstRecordByFilter( "orgAuthorizations", `user = "${userId}" && organization = "${organizationId}"`, - dao + app ); if (!authorization) return undefined; - return getExpanded(authorization, "role", dao); + return getExpanded(authorization, "role", app); } /** * - * @param {core.RecordUpdateEvent|core.RecordDeleteEvent|core.RecordViewEvent|core.RecordCreateEvent} e + * @param {core.RecordRequestEvent} e */ function getUserContextInOrgAuthorizationHookEvent(e) { - const userId = getUserFromContext(e.httpContext)?.getId(); + const userId = getUserFromContext(e)?.id; /** @type {string | undefined} */ const organizationId = e.record?.get("organization"); @@ -115,21 +116,21 @@ function getUserContextInOrgAuthorizationHookEvent(e) { /* -- Pocketbase utils -- */ /** - * @param {echo.Context} c + * @param {core.RequestEvent} e * @returns {RecordModel | undefined} */ -function getUserFromContext(c) { - return $apis.requestInfo(c).authRecord; +function getUserFromContext(e) { + return e.auth; } /** * @param {string} collection * @param {string} filter - * @param {daos.Dao} [dao=$app.dao()] - * @returns {Array} + * @param {core.App | excludeHooks } [app= $app] + * @returns {Array} */ -function findRecordsByFilter(collection, filter, dao = $app.dao()) { - return dao +function findRecordsByFilter(collection, filter, app = $app) { + return app .findRecordsByFilter(collection, filter, "", 0, 0) .filter((v) => v != undefined); } @@ -137,24 +138,26 @@ function findRecordsByFilter(collection, filter, dao = $app.dao()) { /** * @param {string} collection * @param {string} filter + * @param {core.App | excludeHooks } [app= $app] */ -function findFirstRecordByFilter(collection, filter, dao = $app.dao()) { +function findFirstRecordByFilter(collection, filter, app = $app) { try { - return dao.findFirstRecordByFilter(collection, filter); + return app.findFirstRecordByFilter(collection, filter); } catch { return undefined; } } /** - * @param {models.Record} record + * @param {core.Record} record * @param {string} key - * @returns {models.Record | undefined} + * @param {core.App | excludeHooks } [app= $app] + * @returns {core.Record | undefined} */ -function getExpanded(record, key, dao = $app.dao()) { +function getExpanded(record, key, app = $app) { try { // @ts-ignore - dao.expandRecord(record, [key], null); + app.expandRecord(record, [key], null); return record.expandedOne(key); } catch (e) { return undefined; @@ -162,10 +165,10 @@ function getExpanded(record, key, dao = $app.dao()) { } /** - * @param {echo.Context} c + * @param {core.RequestEvent} e */ -function isAdminContext(c) { - return Boolean($apis.requestInfo(c).admin); +function isAdminContext(e) { + return Boolean(e.hasSuperuserAuth()); } /** @@ -176,7 +179,7 @@ function createMissingDataError(...args) { } /** - * @param {models.Record} user + * @param {core.Record} user * @returns {Address} */ function getUserEmailAddressData(user) { @@ -228,14 +231,14 @@ function removeTrailingSlash(string) { /** * @param {string} organizationId - * @param {daos.Dao} [dao=$app.dao()] + * @param {core.App | excludeHooks } [app= $app] * @returns {Address[]} */ -function getOrganizationAdminsAddresses(organizationId, dao = $app.dao()) { +function getOrganizationAdminsAddresses(organizationId, app = $app) { const recipients = findRecordsByFilter( "orgAuthorizations", `organization.id = "${organizationId}" && ( role.name = "admin" || role.name = "owner" )`, - dao + app ); return recipients @@ -246,7 +249,7 @@ function getOrganizationAdminsAddresses(organizationId, dao = $app.dao()) { /** @returns {string} */ function getAppUrl() { - return removeTrailingSlash($app.settings().meta.appUrl); + return removeTrailingSlash($app.settings().meta.appURL); } /** @returns {string} */ @@ -271,17 +274,17 @@ function getOrganizationMembersPageUrl(organizationId) { } /** - * @param {echo.Context} c + * @param {core.RequestEvent} e */ -function runOrganizationInviteEndpointChecks(c) { +function runOrganizationInviteEndpointChecks(e) { /** @type {{inviteId: string | undefined}} */ // @ts-ignore - const data = $apis.requestInfo(c).data; + const data = $apis.requestInfo(e).data; const { inviteId } = data; if (!inviteId || typeof inviteId != "string") throw createMissingDataError("inviteId"); - const userId = getUserFromContext(c)?.getId(); + const userId = getUserFromContext(e)?.id; if (!userId) throw createMissingDataError("userId"); const invite = findFirstRecordByFilter("org_invites", `id = "${inviteId}"`); @@ -295,12 +298,12 @@ function runOrganizationInviteEndpointChecks(c) { /** * - * @param {core.RecordUpdateEvent} event + * @param {core.RecordRequestEvent} event * @param {string[]} fields */ function getRecordUpdateEventDiff(event, fields = []) { const updatedRecord = event.record; - const originalRecord = event.record?.originalCopy(); + const originalRecord = event.record?.original(); if (!updatedRecord || !originalRecord) throw createMissingDataError("updated record"); @@ -317,11 +320,10 @@ function getRecordUpdateEventDiff(event, fields = []) { } /** - * @param {models.Collection} collection + * @param {core.Collection} collection */ function getCollectionFields(collection) { - return collection.schema - .fields() + return collection.fields .map((f) => f?.name) .filter((n) => n != undefined); } @@ -351,12 +353,12 @@ const renderEmail = (name, data) => { /** * - * @param {core.RecordUpdateEvent} event + * @param {core.RecordRequestEvent} event * @param {string[]} fields */ function getRecordUpdateEventDiff(event, fields = []) { const updatedRecord = event.record; - const originalRecord = event.record?.originalCopy(); + const originalRecord = event.record?.original(); if (!updatedRecord || !originalRecord) throw createMissingDataError("updated record"); @@ -373,29 +375,28 @@ function getRecordUpdateEventDiff(event, fields = []) { } /** - * @param {models.Collection} collection + * @param {core.Collection} collection */ function getCollectionFields(collection) { - return collection.schema - .fields() + return collection.fields .map((f) => f?.name) .filter((n) => n != undefined); } /** * - * @param { echo.Context } httpContext - * @returns { RecordModel | models.Admin | undefined } + * @param { core.RequestEvent } e + * @returns { RecordModel | undefined } */ -function getRequestAgent(httpContext) { - /** @type {RecordModel | models.Admin | undefined} */ +function getRequestAgent(e) { + /** @type {RecordModel | undefined} */ let agent = undefined; - const adminContext = isAdminContext(httpContext); - const user = getUserFromContext(httpContext); + const adminContext = isAdminContext(e); + const user = getUserFromContext(e); if (adminContext) { - agent = $apis.requestInfo(httpContext).admin; + agent = e.auth; } else if (user) { agent = user; } @@ -405,17 +406,15 @@ function getRequestAgent(httpContext) { /** * - * @param { echo.Context } httpContext + * @param { core.RequestEvent } e * @returns { string | undefined } */ -function getRequestAgentName(httpContext) { - const agent = getRequestAgent(httpContext); +function getRequestAgentName(e) { + const agent = getRequestAgent(e); if (!agent) return undefined; if ("getString" in agent) { return agent.getString("name"); - } else { - return `System Admin ${agent.getId()}`; } } From 2aac9a31b822c7e1d8af6e1d9d9b4f51e0506bba Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Tue, 7 Jan 2025 17:38:04 +0100 Subject: [PATCH 03/14] feat: remove migrations and start from the pb_schema export file --- Procfile.dev | 2 +- migrations/1664858353_collections_snapshot.go | 114 +- migrations/pb_schema.json | 1353 +++++++++++++++++ .../1681363155_collections_snapshot.js | 580 ------- pb_migrations/1685000000_create_admin.js | 23 - pb_migrations/1685000000_initial_settings.js | 8 - pb_migrations/1685000000_seed_features.js | 95 -- pb_migrations/1685000001_seed_users.js | 81 - pb_migrations/1689062410_updated_hooks.js | 46 - pb_migrations/1689094917_updated_users.js | 17 - ...89097267_updated_authorizationsExamples.js | 41 - .../1689097291_updated_authorizations.js | 17 - ...89155439_updated_authorizationsExamples.js | 21 - pb_migrations/1692027564_updated_hooks.js | 48 - .../1692194881_created_sessionDataWebauthn.js | 50 - .../1692626405_created_webauthnCredentials.js | 55 - .../1692700573_updated_webauthnCredentials.js | 17 - .../1692700709_updated_webauthnCredentials.js | 15 - .../1692796632_updated_webauthnCredentials.js | 29 - .../1694441090_updated_webauthnCredentials.js | 15 - .../1695197120_created_organizations.js | 92 -- .../1695199123_updated_organizations.js | 48 - .../1695199164_updated_organizations.js | 48 - pb_migrations/1695371104_created_roles.js | 71 - ...1373_created_organizationAuthorizations.js | 75 - ...2330_updated_organizationAuthorizations.js | 24 - pb_migrations/1695372719_updated_roles.js | 18 - pb_migrations/1695373788_updated_users.js | 18 - ...9174_updated_organizationAuthorizations.js | 18 - ...9242_updated_organizationAuthorizations.js | 20 - pb_migrations/1695380238_updated_roles.js | 22 - .../1695653929_updated_organizations.js | 39 - .../1696431796_updated_organizations.js | 18 - ...2157_updated_organizationAuthorizations.js | 20 - .../1696575925_created_protectedPaths.js | 57 - .../1696585858_updated_organizationRoles.js | 22 - .../1696585879_updated_protectedPaths.js | 16 - ...8864_updated_organizationAuthorizations.js | 32 - pb_migrations/1696598918_updated_orgRoles.js | 39 - .../1696598950_updated_organizations.js | 18 - .../1696599006_updated_orgAuthorizations.js | 20 - .../1696603275_updated_orgProtectedPaths.js | 48 - .../1696622801_updated_orgProtectedPaths.js | 44 - pb_migrations/1696849689_updated_orgRoles.js | 31 - .../1696870220_updated_organizations.js | 18 - .../1696870367_updated_orgAuthorizations.js | 20 - .../1698229181_created_orgJoinRequest.js | 78 - .../1698229207_updated_orgJoinRequest.js | 16 - .../1698229226_updated_orgJoinRequest.js | 16 - .../1698229276_updated_orgJoinRequest.js | 16 - .../1698229293_updated_orgJoinRequest.js | 16 - .../1698229301_updated_orgJoinRequest.js | 16 - .../1698229324_updated_orgJoinRequest.js | 20 - .../1698229341_updated_orgJoinRequest.js | 16 - .../1698229458_updated_orgJoinRequest.js | 22 - .../1698231235_updated_orgJoinRequests.js | 31 - .../1698242178_updated_orgJoinRequests.js | 22 - .../1698242304_updated_orgJoinRequests.js | 20 - .../1698244942_updated_orgJoinRequests.js | 16 - .../1698393887_updated_orgJoinRequests.js | 31 - .../1698394333_updated_orgJoinRequests.js | 31 - pb_migrations/1700000000_seed_rooles.js | 26 - pb_migrations/1708687922_updated_users.js | 54 - pb_migrations/1709116531_updated_users.js | 44 - .../1714492101_default_mail_settings.js | 10 - .../1715249207_created_users_public_keys.js | 127 -- .../1715331681_move_users_public_keys.js | 57 - pb_migrations/1715333405_updated_users.js | 126 -- .../1721422489_created_z_test_collection.js | 232 --- .../1722850166_updated_orgAuthorizations.js | 48 - .../1722850178_updated_orgJoinRequests.js | 48 - pb_migrations/1725893867_updated_users.js | 60 - pb_migrations/1726038316_updated_orgRoles.js | 31 - .../1726038450_seed_roles_with_level.js | 36 - .../1726475967_updated_orgAuthorizations.js | 16 - .../1727194827_deleted_orgProtectedPaths.js | 57 - .../1727420027_updated_orgJoinRequests.js | 22 - .../1727427248_updated_orgJoinRequests.js | 51 - .../1727434248_updated_orgJoinRequests.js | 16 - .../1727434645_updated_organizations.js | 16 - .../1727719328_created_org_invite.js | 72 - .../1727720630_updated_org_invite.js | 19 - .../1727792062_updated_org_invite.js | 24 - .../1727793426_updated_org_invites.js | 21 - .../1727796849_updated_org_invites.js | 27 - .../1727796874_updated_org_invites.js | 20 - .../1727798303_updated_org_invites.js | 18 - .../1727798588_updated_org_invites.js | 22 - .../1727800869_updated_org_invites.js | 18 - .../1727854886_updated_org_invites.js | 27 - .../1728470648_updated_z_test_collection.js | 24 - .../1728481427_updated_z_test_collection.js | 54 - .../1728481532_updated_z_test_collection.js | 52 - .../1728563836_updated_z_test_collection.js | 54 - .../1729074142_updated_z_test_collection.js | 50 - .../1729074280_updated_z_test_collection.js | 52 - .../1729096464_updated_z_test_collection.js | 50 - .../1729755967_updated_z_test_collection.js | 18 - .../1729757085_updated_z_test_collection.js | 18 - .../1729843574_updated_z_test_collection.js | 33 - .../1729930153_updated_z_test_collection.js | 33 - .../1729930209_updated_z_test_collection.js | 48 - .../1729930438_updated_z_test_collection.js | 16 - .../1729930444_updated_z_test_collection.js | 16 - .../1729930951_updated_z_test_collection.js | 18 - ...29933259_deleted_authorizationsExamples.js | 57 - .../1730125916_updated_z_test_collection.js | 52 - .../1730129064_deleted_crudExample.js | 200 --- .../1730129141_updated_z_test_collection.js | 63 - .../1730134615_updated_orgAuthorizations.js | 16 - pb_migrations/1734523066_feature_oauth.js | 55 - pb_migrations/1734947817_created_tests.js | 67 - pb_migrations/1734951182_created_services.js | 69 - 113 files changed, 1359 insertions(+), 4991 deletions(-) create mode 100644 migrations/pb_schema.json delete mode 100644 pb_migrations/1681363155_collections_snapshot.js delete mode 100644 pb_migrations/1685000000_create_admin.js delete mode 100644 pb_migrations/1685000000_initial_settings.js delete mode 100644 pb_migrations/1685000000_seed_features.js delete mode 100644 pb_migrations/1685000001_seed_users.js delete mode 100644 pb_migrations/1689062410_updated_hooks.js delete mode 100644 pb_migrations/1689094917_updated_users.js delete mode 100644 pb_migrations/1689097267_updated_authorizationsExamples.js delete mode 100644 pb_migrations/1689097291_updated_authorizations.js delete mode 100644 pb_migrations/1689155439_updated_authorizationsExamples.js delete mode 100644 pb_migrations/1692027564_updated_hooks.js delete mode 100644 pb_migrations/1692194881_created_sessionDataWebauthn.js delete mode 100644 pb_migrations/1692626405_created_webauthnCredentials.js delete mode 100644 pb_migrations/1692700573_updated_webauthnCredentials.js delete mode 100644 pb_migrations/1692700709_updated_webauthnCredentials.js delete mode 100644 pb_migrations/1692796632_updated_webauthnCredentials.js delete mode 100644 pb_migrations/1694441090_updated_webauthnCredentials.js delete mode 100644 pb_migrations/1695197120_created_organizations.js delete mode 100644 pb_migrations/1695199123_updated_organizations.js delete mode 100644 pb_migrations/1695199164_updated_organizations.js delete mode 100644 pb_migrations/1695371104_created_roles.js delete mode 100644 pb_migrations/1695371373_created_organizationAuthorizations.js delete mode 100644 pb_migrations/1695372330_updated_organizationAuthorizations.js delete mode 100644 pb_migrations/1695372719_updated_roles.js delete mode 100644 pb_migrations/1695373788_updated_users.js delete mode 100644 pb_migrations/1695379174_updated_organizationAuthorizations.js delete mode 100644 pb_migrations/1695379242_updated_organizationAuthorizations.js delete mode 100644 pb_migrations/1695380238_updated_roles.js delete mode 100644 pb_migrations/1695653929_updated_organizations.js delete mode 100644 pb_migrations/1696431796_updated_organizations.js delete mode 100644 pb_migrations/1696502157_updated_organizationAuthorizations.js delete mode 100644 pb_migrations/1696575925_created_protectedPaths.js delete mode 100644 pb_migrations/1696585858_updated_organizationRoles.js delete mode 100644 pb_migrations/1696585879_updated_protectedPaths.js delete mode 100644 pb_migrations/1696598864_updated_organizationAuthorizations.js delete mode 100644 pb_migrations/1696598918_updated_orgRoles.js delete mode 100644 pb_migrations/1696598950_updated_organizations.js delete mode 100644 pb_migrations/1696599006_updated_orgAuthorizations.js delete mode 100644 pb_migrations/1696603275_updated_orgProtectedPaths.js delete mode 100644 pb_migrations/1696622801_updated_orgProtectedPaths.js delete mode 100644 pb_migrations/1696849689_updated_orgRoles.js delete mode 100644 pb_migrations/1696870220_updated_organizations.js delete mode 100644 pb_migrations/1696870367_updated_orgAuthorizations.js delete mode 100644 pb_migrations/1698229181_created_orgJoinRequest.js delete mode 100644 pb_migrations/1698229207_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698229226_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698229276_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698229293_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698229301_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698229324_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698229341_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698229458_updated_orgJoinRequest.js delete mode 100644 pb_migrations/1698231235_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1698242178_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1698242304_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1698244942_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1698393887_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1698394333_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1700000000_seed_rooles.js delete mode 100644 pb_migrations/1708687922_updated_users.js delete mode 100644 pb_migrations/1709116531_updated_users.js delete mode 100644 pb_migrations/1714492101_default_mail_settings.js delete mode 100644 pb_migrations/1715249207_created_users_public_keys.js delete mode 100644 pb_migrations/1715331681_move_users_public_keys.js delete mode 100644 pb_migrations/1715333405_updated_users.js delete mode 100644 pb_migrations/1721422489_created_z_test_collection.js delete mode 100644 pb_migrations/1722850166_updated_orgAuthorizations.js delete mode 100644 pb_migrations/1722850178_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1725893867_updated_users.js delete mode 100644 pb_migrations/1726038316_updated_orgRoles.js delete mode 100644 pb_migrations/1726038450_seed_roles_with_level.js delete mode 100644 pb_migrations/1726475967_updated_orgAuthorizations.js delete mode 100644 pb_migrations/1727194827_deleted_orgProtectedPaths.js delete mode 100644 pb_migrations/1727420027_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1727427248_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1727434248_updated_orgJoinRequests.js delete mode 100644 pb_migrations/1727434645_updated_organizations.js delete mode 100644 pb_migrations/1727719328_created_org_invite.js delete mode 100644 pb_migrations/1727720630_updated_org_invite.js delete mode 100644 pb_migrations/1727792062_updated_org_invite.js delete mode 100644 pb_migrations/1727793426_updated_org_invites.js delete mode 100644 pb_migrations/1727796849_updated_org_invites.js delete mode 100644 pb_migrations/1727796874_updated_org_invites.js delete mode 100644 pb_migrations/1727798303_updated_org_invites.js delete mode 100644 pb_migrations/1727798588_updated_org_invites.js delete mode 100644 pb_migrations/1727800869_updated_org_invites.js delete mode 100644 pb_migrations/1727854886_updated_org_invites.js delete mode 100644 pb_migrations/1728470648_updated_z_test_collection.js delete mode 100644 pb_migrations/1728481427_updated_z_test_collection.js delete mode 100644 pb_migrations/1728481532_updated_z_test_collection.js delete mode 100644 pb_migrations/1728563836_updated_z_test_collection.js delete mode 100644 pb_migrations/1729074142_updated_z_test_collection.js delete mode 100644 pb_migrations/1729074280_updated_z_test_collection.js delete mode 100644 pb_migrations/1729096464_updated_z_test_collection.js delete mode 100644 pb_migrations/1729755967_updated_z_test_collection.js delete mode 100644 pb_migrations/1729757085_updated_z_test_collection.js delete mode 100644 pb_migrations/1729843574_updated_z_test_collection.js delete mode 100644 pb_migrations/1729930153_updated_z_test_collection.js delete mode 100644 pb_migrations/1729930209_updated_z_test_collection.js delete mode 100644 pb_migrations/1729930438_updated_z_test_collection.js delete mode 100644 pb_migrations/1729930444_updated_z_test_collection.js delete mode 100644 pb_migrations/1729930951_updated_z_test_collection.js delete mode 100644 pb_migrations/1729933259_deleted_authorizationsExamples.js delete mode 100644 pb_migrations/1730125916_updated_z_test_collection.js delete mode 100644 pb_migrations/1730129064_deleted_crudExample.js delete mode 100644 pb_migrations/1730129141_updated_z_test_collection.js delete mode 100644 pb_migrations/1730134615_updated_orgAuthorizations.js delete mode 100644 pb_migrations/1734523066_feature_oauth.js delete mode 100644 pb_migrations/1734947817_created_tests.js delete mode 100644 pb_migrations/1734951182_created_services.js diff --git a/Procfile.dev b/Procfile.dev index dcd8a590..3fefe9a4 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,3 +1,3 @@ pocketbase: air -ui: ./scripts/wait-for-it.sh localhost:8090 && cd webapp && bun i && bun dev +ui: ./scripts/wait-for-it.sh -t 0 localhost:8090 && cd webapp && bun i && bun dev docs: cd docs && bun i && bun run docs:dev diff --git a/migrations/1664858353_collections_snapshot.go b/migrations/1664858353_collections_snapshot.go index 0a7e23d8..01b9d144 100755 --- a/migrations/1664858353_collections_snapshot.go +++ b/migrations/1664858353_collections_snapshot.go @@ -1,122 +1,18 @@ package migrations import ( + _ "embed" + "github.com/pocketbase/pocketbase/core" m "github.com/pocketbase/pocketbase/migrations" ) +//go:embed pb_schema.json +var jsonData string + // Auto generated migration with the most recent collections configuration. func init() { m.Register(func(app core.App) error { - jsonData := `[ - { - "id": "3fhw2mfr9zrgodj", - "created": "2022-10-03 21:50:44.238", - "updated": "2022-10-04 04:24:28.113", - "name": "hooks", - "system": false, - "schema": [ - { - "system": false, - "id": "j8mewfur", - "name": "collection", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "4xcxcfuv", - "name": "event", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "insert", - "update", - "delete" - ] - } - }, - { - "system": false, - "id": "u3bmgjpb", - "name": "action_type", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "command", - "post" - ] - } - }, - { - "system": false, - "id": "kayyu1l3", - "name": "action", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "zkengev8", - "name": "action_params", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "balsaeka", - "name": "expands", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "emgxgcok", - "name": "disabled", - "type": "bool", - "required": false, - "unique": false, - "options": {} - } - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null - } - ]` - return app.ImportCollectionsByMarshaledJSON([]byte(jsonData), false) }, func(app core.App) error { // no revert since the configuration on the environment, on which diff --git a/migrations/pb_schema.json b/migrations/pb_schema.json new file mode 100644 index 00000000..c8720bce --- /dev/null +++ b/migrations/pb_schema.json @@ -0,0 +1,1353 @@ +[ + { + "id": "_pb_users_auth_", + "name": "users", + "type": "auth", + "system": false, + "schema": [ + { + "system": false, + "id": "users_name", + "name": "name", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "users_avatar", + "name": "avatar", + "type": "file", + "required": false, + "presentable": false, + "unique": false, + "options": { + "mimeTypes": [ + "image/jpeg", + "image/png", + "image/svg+xml", + "image/gif", + "image/webp" + ], + "thumbs": null, + "maxSelect": 1, + "maxSize": 22020096, + "protected": false + } + } + ], + "indexes": [ + "CREATE INDEX `__pb_users_auth__created_idx` ON `users` (`created`)" + ], + "listRule": "@request.auth.id != ''", + "viewRule": "@request.auth.id != ''", + "createRule": "", + "updateRule": "id = @request.auth.id", + "deleteRule": "id = @request.auth.id", + "options": { + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": null, + "manageRule": null, + "minPasswordLength": 8, + "onlyEmailDomains": null, + "onlyVerified": false, + "requireEmail": false + } + }, + { + "id": "285guwyxvr46lsu", + "name": "authorizations", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "5jd5bhu8", + "name": "owner", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": [] + } + }, + { + "system": false, + "id": "w4xrqdgs", + "name": "users", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": null, + "displayFields": [] + } + }, + { + "system": false, + "id": "g1t9kpqo", + "name": "collection_id", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "fqvzbaze", + "name": "record_id", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + } + ], + "options": {} + }, + { + "id": "z4cc0g76ciqx13v", + "name": "features", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "lj04bczn", + "name": "name", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "yctafkxl", + "name": "active", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + }, + { + "system": false, + "id": "yo3lch0p", + "name": "envVariables", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + } + ], + "listRule": "", + "viewRule": "", + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "3fhw2mfr9zrgodj", + "name": "hooks", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "j8mewfur", + "name": "collection", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "4xcxcfuv", + "name": "event", + "type": "select", + "required": true, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "insert", + "update", + "delete" + ] + } + }, + { + "system": false, + "id": "u3bmgjpb", + "name": "action_type", + "type": "select", + "required": true, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "command", + "post", + "sendmail", + "restroom-mw" + ] + } + }, + { + "system": false, + "id": "kayyu1l3", + "name": "action", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "zkengev8", + "name": "action_params", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "balsaeka", + "name": "expands", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "emgxgcok", + "name": "disabled", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + } + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "k1vlx34o1x8tzno", + "name": "orgAuthorizations", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "pzwwp3tf", + "name": "organization", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "aako88kt3br4npt", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "hlla24j5", + "name": "user", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "nawal8qa", + "name": "role", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "pgsh9x4x20kdgjd", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + } + ], + "listRule": "", + "viewRule": "", + "options": {} + }, + { + "id": "g7w0g7iqidynhim", + "name": "orgJoinRequests", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "kj3nhvxx", + "name": "user", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "dfgtbvkp", + "name": "organization", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "aako88kt3br4npt", + "cascadeDelete": true, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "l5dq93vm", + "name": "status", + "type": "select", + "required": true, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "pending", + "accepted", + "rejected", + "blocked" + ] + } + }, + { + "system": false, + "id": "fhyjwtkm", + "name": "reminders", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "noDecimal": true + } + } + ], + "options": {} + }, + { + "id": "pgsh9x4x20kdgjd", + "name": "orgRoles", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "ewo9sxda", + "name": "name", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "^[a-z_]+$" + } + }, + { + "system": false, + "id": "xcrt6mly", + "name": "level", + "type": "number", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": 0, + "max": null, + "noDecimal": true + } + } + ], + "listRule": "", + "viewRule": "", + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "v12xstc3xygpawh", + "name": "org_invites", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "7yfkzy39", + "name": "organization", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "aako88kt3br4npt", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "32axfwku", + "name": "user", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "gbqnjiwb", + "name": "user_email", + "type": "email", + "required": false, + "presentable": false, + "unique": false, + "options": { + "exceptDomains": [], + "onlyDomains": [] + } + }, + { + "system": false, + "id": "6stxg7b7", + "name": "failed_email_send", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + }, + { + "system": false, + "id": "gtmrpmp3", + "name": "declined", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + } + ], + "options": {} + }, + { + "id": "aako88kt3br4npt", + "name": "organizations", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "de5ifbee", + "name": "name", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": 2, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "zhuxbrib", + "name": "avatar", + "type": "file", + "required": false, + "presentable": false, + "unique": false, + "options": { + "mimeTypes": [ + "image/png", + "image/jpeg", + "image/webp", + "image/svg+xml" + ], + "thumbs": [], + "maxSelect": 1, + "maxSize": 5242880, + "protected": false + } + }, + { + "system": false, + "id": "pjjpq1r4", + "name": "description", + "type": "editor", + "required": false, + "presentable": false, + "unique": false, + "options": { + "convertUrls": false + } + } + ], + "listRule": "", + "viewRule": "", + "createRule": "@request.auth.id != ''", + "deleteRule": null, + "options": {} + }, + { + "id": "zxnrlx8sdr589dx", + "name": "services", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "u5njqdn2", + "name": "name", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": 3, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "cv21hi1u", + "name": "organization", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "aako88kt3br4npt", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "kju0juul", + "name": "description", + "type": "editor", + "required": false, + "presentable": false, + "unique": false, + "options": { + "convertUrls": false + } + } + ], + "indexes": [], + "listRule": "", + "viewRule": "", + "options": {} + }, + { + "id": "55roakey1q8vk77", + "name": "sessionDataWebauthn", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "xdfemwi3", + "name": "user", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": [] + } + }, + { + "system": false, + "id": "kds5s6oc", + "name": "session", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + } + ], + "indexes": [], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "c66aipq8fvzcwk9", + "name": "standards", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "5o3gcmzu", + "name": "version", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "zg0ytf26", + "name": "specification", + "type": "url", + "required": false, + "presentable": false, + "unique": false, + "options": { + "exceptDomains": null, + "onlyDomains": null + } + }, + { + "system": false, + "id": "5xeugad8", + "name": "description", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "qrxbfpdw", + "name": "name", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "nxb3xxnu", + "name": "last_update", + "type": "date", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": "", + "max": "" + } + } + ], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "m31x6zqgugf9yor", + "name": "tests", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "wznp5aw5", + "name": "name", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": 3, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "rvfexfeg", + "name": "description", + "type": "editor", + "required": false, + "presentable": false, + "unique": false, + "options": { + "convertUrls": false + } + }, + { + "system": false, + "id": "mvh8nhuf", + "name": "content", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": 3, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "4pn3e4rw", + "name": "standard", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "c66aipq8fvzcwk9", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": null, + "displayFields": null + } + } + ], + "indexes": [], + "listRule": "", + "viewRule": "", + "createRule": "@request.auth.id != \"\"", + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "7bmyedethjhr1ir", + "name": "users_public_keys", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "rylpn1gv", + "name": "owner", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "t65tksny", + "name": "bitcoin_public_key", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "tnshwyg9", + "name": "ecdh_public_key", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "xwkg2zsb", + "name": "eddsa_public_key", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "ygmmntyo", + "name": "ethereum_address", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "pz24o3ls", + "name": "reflow_public_key", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "system": false, + "id": "qg6jnudd", + "name": "es256_public_key", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + } + ], + "indexes": [], + "listRule": "", + "viewRule": "", + "createRule": "", + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "nopzrf0n7mbfu58", + "name": "webauthnCredentials", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "xootznbs", + "name": "user", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": [] + } + }, + { + "system": false, + "id": "of3px3ud", + "name": "credential", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + }, + { + "system": false, + "id": "gfynehdb", + "name": "description", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + } + ], + "options": {} + }, + { + "id": "xsmisoxjnzdkoc1", + "name": "workflows", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "mb7wgtx5", + "name": "status", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "DONE", + "RUNNING", + "ERROR" + ] + } + }, + { + "system": false, + "id": "bpvexuus", + "name": "organization", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "aako88kt3br4npt", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "pljvqncw", + "name": "test", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "m31x6zqgugf9yor", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + } + ], + "indexes": [], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "ktjgpqf146ss2ia", + "name": "z_test_collection", + "type": "base", + "system": false, + "schema": [ + { + "system": false, + "id": "dyxsckke", + "name": "text_field", + "type": "text", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": 2, + "max": 10, + "pattern": "" + } + }, + { + "system": false, + "id": "5nakh5br", + "name": "url_field", + "type": "url", + "required": false, + "presentable": false, + "unique": false, + "options": { + "exceptDomains": [], + "onlyDomains": [ + "uld.com" + ] + } + }, + { + "system": false, + "id": "zjaakeak", + "name": "number_field", + "type": "number", + "required": true, + "presentable": false, + "unique": false, + "options": { + "min": 2, + "max": 70, + "noDecimal": true + } + }, + { + "system": false, + "id": "plf9bqlo", + "name": "boolean_field", + "type": "bool", + "required": false, + "presentable": false, + "unique": false, + "options": {} + }, + { + "system": false, + "id": "o9i7jdyx", + "name": "richtext_field", + "type": "editor", + "required": true, + "presentable": false, + "unique": false, + "options": { + "convertUrls": true + } + }, + { + "system": false, + "id": "euflpigq", + "name": "email_field", + "type": "email", + "required": false, + "presentable": false, + "unique": false, + "options": { + "exceptDomains": [ + "mat.cos" + ], + "onlyDomains": [] + } + }, + { + "system": false, + "id": "r6bk98mc", + "name": "date_field", + "type": "date", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": "2024-07-18 12:00:00.000Z", + "max": "2024-07-28 12:00:00.000Z" + } + }, + { + "system": false, + "id": "jnvj44gc", + "name": "select_field", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 1, + "values": [ + "a", + "b", + "c" + ] + } + }, + { + "system": false, + "id": "wlqgr8z3", + "name": "select_multi_field", + "type": "select", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSelect": 2, + "values": [ + "x", + "y", + "z" + ] + } + }, + { + "system": false, + "id": "ldafagmk", + "name": "file_field", + "type": "file", + "required": false, + "presentable": false, + "unique": false, + "options": { + "mimeTypes": [ + "text/plain" + ], + "thumbs": [], + "maxSelect": 1, + "maxSize": 5242880, + "protected": true + } + }, + { + "system": false, + "id": "ctqisupe", + "name": "file_multi_field", + "type": "file", + "required": false, + "presentable": false, + "unique": false, + "options": { + "mimeTypes": [ + "text/plain" + ], + "thumbs": [], + "maxSelect": 3, + "maxSize": 5242880, + "protected": false + } + }, + { + "system": false, + "id": "dmehmjlp", + "name": "relation_multi_field", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": 1, + "maxSelect": 4, + "displayFields": null + } + }, + { + "system": false, + "id": "wj9awedr", + "name": "json_field", + "type": "json", + "required": false, + "presentable": false, + "unique": false, + "options": { + "maxSize": 2000000 + } + }, + { + "system": false, + "id": "rwghvhbv", + "name": "relation_field", + "type": "relation", + "required": true, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "irg7eqrq", + "name": "self_relation", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "ktjgpqf146ss2ia", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "7d3zwah8", + "name": "owner", + "type": "relation", + "required": false, + "presentable": false, + "unique": false, + "options": { + "collectionId": "_pb_users_auth_", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": null + } + }, + { + "system": false, + "id": "moejq2ra", + "name": "text_with_regex", + "type": "text", + "required": false, + "presentable": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "^\\w+$" + } + } + ], + "indexes": [], + "createRule": "", + "updateRule": "", + "deleteRule": "", + "options": {} + } +] diff --git a/pb_migrations/1681363155_collections_snapshot.js b/pb_migrations/1681363155_collections_snapshot.js deleted file mode 100644 index 5dccdb56..00000000 --- a/pb_migrations/1681363155_collections_snapshot.js +++ /dev/null @@ -1,580 +0,0 @@ -migrate((db) => { - const snapshot = [ - { - "id": "3fhw2mfr9zrgodj", - "created": "2022-10-03 21:50:44.238Z", - "updated": "2023-07-11 15:40:56.394Z", - "name": "hooks", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "j8mewfur", - "name": "collection", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "4xcxcfuv", - "name": "event", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "insert", - "update", - "delete" - ] - } - }, - { - "system": false, - "id": "u3bmgjpb", - "name": "action_type", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "command", - "post" - ] - } - }, - { - "system": false, - "id": "kayyu1l3", - "name": "action", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "zkengev8", - "name": "action_params", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "balsaeka", - "name": "expands", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "emgxgcok", - "name": "disabled", - "type": "bool", - "required": false, - "unique": false, - "options": {} - } - ], - "indexes": [ - "CREATE INDEX `_3fhw2mfr9zrgodj_created_idx` ON `hooks` (`created`)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "z4cc0g76ciqx13v", - "created": "2023-05-17 16:48:21.255Z", - "updated": "2023-07-11 12:40:55.518Z", - "name": "features", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "lj04bczn", - "name": "name", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "yctafkxl", - "name": "active", - "type": "bool", - "required": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "yo3lch0p", - "name": "envVariables", - "type": "json", - "required": false, - "unique": false, - "options": {} - } - ], - "indexes": [ - "CREATE UNIQUE INDEX `idx_T3xOIQy` ON `features` (`name`)" - ], - "listRule": "", - "viewRule": "", - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "p9dhra382rts3bg", - "created": "2023-06-07 10:44:19.476Z", - "updated": "2023-07-11 13:16:04.708Z", - "name": "crudExample", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "o0hwn3yh", - "name": "text", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": 6, - "max": 10, - "pattern": "" - } - }, - { - "system": false, - "id": "3hmes6kr", - "name": "file_only_pdf_json", - "type": "file", - "required": true, - "unique": false, - "options": { - "maxSelect": 99, - "maxSize": 5242880, - "mimeTypes": [ - "application/json", - "application/pdf" - ], - "thumbs": [], - "protected": false - } - }, - { - "system": false, - "id": "o72s557k", - "name": "boolean", - "type": "bool", - "required": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "dzneawfh", - "name": "select", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "opt1", - "opt2", - "opt3", - "opt4", - "opt5" - ] - } - }, - { - "system": false, - "id": "t1i6phfc", - "name": "textarea", - "type": "editor", - "required": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "lybqqrme", - "name": "text_with_regex", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "^w+S" - } - }, - { - "system": false, - "id": "vkmf5bzv", - "name": "multiselect", - "type": "select", - "required": false, - "unique": false, - "options": { - "maxSelect": 2, - "values": [ - "A", - "B", - "C", - "D" - ] - } - }, - { - "system": false, - "id": "kx4ozipk", - "name": "relation", - "type": "relation", - "required": false, - "unique": false, - "options": { - "collectionId": "z4cc0g76ciqx13v", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": [] - } - }, - { - "system": false, - "id": "nfghsb83", - "name": "image", - "type": "file", - "required": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/png", - "image/jpeg" - ], - "thumbs": [], - "protected": false - } - }, - { - "system": false, - "id": "uy849pd2", - "name": "relation_single", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "z4cc0g76ciqx13v", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - }, - { - "system": false, - "id": "61lxlzl2", - "name": "owner", - "type": "relation", - "required": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - } - ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "", - "updateRule": "", - "deleteRule": "", - "options": {} - }, - { - "id": "285guwyxvr46lsu", - "created": "2023-07-11 13:23:15.614Z", - "updated": "2023-07-11 15:42:24.490Z", - "name": "authorizations", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "5jd5bhu8", - "name": "owner", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - }, - { - "system": false, - "id": "w4xrqdgs", - "name": "users", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": [] - } - }, - { - "system": false, - "id": "g1t9kpqo", - "name": "collection_id", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "fqvzbaze", - "name": "record_id", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX `idx_w4uoK0u` ON `authorizations` (\n `owner`,\n `collection_id`,\n `record_id`\n)" - ], - "listRule": "@request.auth.id = owner.id || users.id ?= @request.auth.id", - "viewRule": "@request.auth.id = owner.id || users.id ?= @request.auth.id", - "createRule": "@request.auth.id != ''", - "updateRule": "@request.auth.id != owner.id", - "deleteRule": "@request.auth.id != owner.id", - "options": {} - }, - { - "id": "sijd38964ht83q5", - "created": "2023-07-11 13:26:18.946Z", - "updated": "2023-07-11 13:28:21.425Z", - "name": "authorizationsExamples", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "s6z3yyrm", - "name": "name", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [], - "listRule": "(@collection.authorizations.users.id ?= @request.auth.id || @collection.authorizations.owner.id = @request.auth.id) && @collection.authorizations.record_id = id", - "viewRule": "(@collection.authorizations.users.id ?= @request.auth.id || @collection.authorizations.owner.id = @request.auth.id) && @collection.authorizations.record_id = id", - "createRule": "@request.auth.id != ''", - "updateRule": "(@collection.authorizations.users.id ?= @request.auth.id || @collection.authorizations.owner.id = @request.auth.id) && @collection.authorizations.record_id = id", - "deleteRule": "(@collection.authorizations.users.id ?= @request.auth.id || @collection.authorizations.owner.id = @request.auth.id) && @collection.authorizations.record_id = id", - "options": {} - }, - { - "id": "_pb_users_auth_", - "created": "2023-07-11 15:40:56.391Z", - "updated": "2023-07-11 15:40:56.394Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "protected": false - } - }, - { - "system": false, - "id": "nf3jan6h", - "name": "bitcoin_public_key", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "zjvzw9wa", - "name": "ecdh_public_key", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "yg9yz2sc", - "name": "eddsa_public_key", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ouslgk2m", - "name": "ethereum_address", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "vqu3zutd", - "name": "reflow_public_key", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE INDEX `__pb_users_auth__created_idx` ON `users` (`created`)" - ], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": false - } - } - ]; - - const collections = snapshot.map((item) => new Collection(item)); - - return Dao(db).importCollections(collections, true, null); -}, (db) => { - return null; -}) diff --git a/pb_migrations/1685000000_create_admin.js b/pb_migrations/1685000000_create_admin.js deleted file mode 100644 index 18026068..00000000 --- a/pb_migrations/1685000000_create_admin.js +++ /dev/null @@ -1,23 +0,0 @@ -/// - -const ADMIN_EMAIL = "admin@example.org"; - -migrate( - (db) => { - const dao = new Dao(db); - - try { - dao.findAdminByEmail(ADMIN_EMAIL); - } catch { - const admin = new Admin(); - admin.email = ADMIN_EMAIL; - admin.setPassword("adminadmin"); - return dao.saveAdmin(admin); - } - }, - (db) => { - const dao = new Dao(db); - const admin = dao.findAdminByEmail(ADMIN_EMAIL); - return dao.deleteAdmin(admin); - } -); diff --git a/pb_migrations/1685000000_initial_settings.js b/pb_migrations/1685000000_initial_settings.js deleted file mode 100644 index be64fe4d..00000000 --- a/pb_migrations/1685000000_initial_settings.js +++ /dev/null @@ -1,8 +0,0 @@ -migrate((db) => { - const dao = new Dao(db); - - const settings = dao.findSettings(); - settings.meta.appName = "DIDimo"; - - dao.saveSettings(settings); -}); diff --git a/pb_migrations/1685000000_seed_features.js b/pb_migrations/1685000000_seed_features.js deleted file mode 100644 index 19a5efa3..00000000 --- a/pb_migrations/1685000000_seed_features.js +++ /dev/null @@ -1,95 +0,0 @@ -// @ts-check - -/// -/** - * @typedef {import('../../webapp/src/modules/pocketbase/types').FeaturesRecord} Feature - */ - -const FEATURES_COLLECTION_NAME = "features"; - -/** - * @type {Feature[]} - */ -const features = [ - { - name: "keypairoom", - envVariables: { - SALT: "bWltbW8K", - }, - }, - { - name: "DID", - envVariables: { - DID_URL: "url", - DID_SPEC: "string", - DID_SIGNER_SPEC: "string", - DID_IDENTITY: "string", - DID_KEYRING: "json, currently passed base64 encoded", - }, - }, - { - name: "auth", - envVariables: {}, - }, - { - name: "maintenance", - envVariables: {}, - active: false, - }, - { - name: "organizations", - envVariables: {}, - }, - { - name: "webauthn", - envVariables: { - DISPLAY_NAME: "DIDimo", - RPID: "localhost", - RPORIGINS: "http://localhost:5173", - }, - }, -]; - -migrate( - (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId( - FEATURES_COLLECTION_NAME - ); - - for (const feature of features) { - /** @type {models.Record} */ - let record; - try { - record = dao.findFirstRecordByData( - FEATURES_COLLECTION_NAME, - "name", - feature.name - ); - } catch (e) { - record = new Record(collection, { - name: feature.name, - }); - } - record.set("envVariables", feature.envVariables); - record.set("active", feature.active ?? true); - dao.saveRecord(record); - } - }, - (db) => { - const dao = new Dao(db); - - // delete the previously created record (if exists) - for (const feature of features) { - try { - const record = dao.findFirstRecordByData( - FEATURES_COLLECTION_NAME, - "name", - feature.name - ); - - dao.deleteRecord(record); - } catch {} - } - } -); diff --git a/pb_migrations/1685000001_seed_users.js b/pb_migrations/1685000001_seed_users.js deleted file mode 100644 index 350a253f..00000000 --- a/pb_migrations/1685000001_seed_users.js +++ /dev/null @@ -1,81 +0,0 @@ -/// - -const USERS_COLLECTION_NAME = "users"; - -/** - * @param {string} letter - */ -function createSampleUserData(letter) { - const name = `user${letter}`; - return { - email: `user${letter}@example.org`, - username: name, - password: `user${letter}user${letter}`, - name: name, - }; -} - -/** - * - * @param {Dao} dao - * @param {string} letter - * @returns - */ -function addSampleUser(dao, letter) { - const { email, username, password, name } = createSampleUserData(letter); - const collection = dao.findCollectionByNameOrId(USERS_COLLECTION_NAME); - - /** @type {models.Record} */ - let record; - - try { - record = dao.findAuthRecordByEmail(collection.name, email); - } catch (e) { - record = new Record(collection); - } - - record.setUsername(username); - record.setEmail(email); - record.setPassword(password); - record.setVerified(true); - record.set("name", name); - record.set("emailVisibility", true); - - dao.saveRecord(record); - - return record; -} - -migrate( - (db) => { - const dao = new Dao(db); - - /* Users */ - const userA = addSampleUser(dao, "A"); - const userB = addSampleUser(dao, "B"); - const userC = addSampleUser(dao, "C"); - - // /* AuthorizationExample */ - // const authorizationsExamples = dao.findCollectionByNameOrId( - // "authorizationsExamples" - // ); - // const authorizationExample = new Record(authorizationsExamples); - // authorizationExample.set("name", "authorizationExample"); - // authorizationExample.set("owner", userA.id); - // dao.saveRecord(authorizationExample); - - // /* Authorization */ - // const authorizations = dao.findCollectionByNameOrId("authorizations"); - // const authorization = new Record(authorizations); - // authorization.set("owner", userA.id); - // authorization.set("users", [userB.id]); - // authorization.set("collection_id", authorizationsExamples.id); - // authorization.set("record_id", authorizationExample.id); - // dao.saveRecord(authorization); - - return; - }, - (db) => { - return; - } -); diff --git a/pb_migrations/1689062410_updated_hooks.js b/pb_migrations/1689062410_updated_hooks.js deleted file mode 100644 index 11285896..00000000 --- a/pb_migrations/1689062410_updated_hooks.js +++ /dev/null @@ -1,46 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("3fhw2mfr9zrgodj") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "u3bmgjpb", - "name": "action_type", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "command", - "post", - "sendmail" - ] - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("3fhw2mfr9zrgodj") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "u3bmgjpb", - "name": "action_type", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "command", - "post" - ] - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1689094917_updated_users.js b/pb_migrations/1689094917_updated_users.js deleted file mode 100644 index 57909e0f..00000000 --- a/pb_migrations/1689094917_updated_users.js +++ /dev/null @@ -1,17 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - collection.listRule = "@request.auth.id != ''" - collection.viewRule = "@request.auth.id != ''" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - collection.listRule = null - collection.viewRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1689097267_updated_authorizationsExamples.js b/pb_migrations/1689097267_updated_authorizationsExamples.js deleted file mode 100644 index 861036fe..00000000 --- a/pb_migrations/1689097267_updated_authorizationsExamples.js +++ /dev/null @@ -1,41 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("sijd38964ht83q5") - - collection.listRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id = id)" - collection.viewRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id = id)" - collection.updateRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id = id)" - collection.deleteRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id = id)" - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "3l6g88rp", - "name": "owner", - "type": "relation", - "required": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("sijd38964ht83q5") - - collection.listRule = null - collection.viewRule = null - collection.updateRule = null - collection.deleteRule = null - - // remove - collection.schema.removeField("3l6g88rp") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1689097291_updated_authorizations.js b/pb_migrations/1689097291_updated_authorizations.js deleted file mode 100644 index 90e67387..00000000 --- a/pb_migrations/1689097291_updated_authorizations.js +++ /dev/null @@ -1,17 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("285guwyxvr46lsu") - - collection.updateRule = "@request.auth.id = owner.id" - collection.deleteRule = "@request.auth.id = owner.id" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("285guwyxvr46lsu") - - collection.updateRule = null - collection.deleteRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1689155439_updated_authorizationsExamples.js b/pb_migrations/1689155439_updated_authorizationsExamples.js deleted file mode 100644 index d945059d..00000000 --- a/pb_migrations/1689155439_updated_authorizationsExamples.js +++ /dev/null @@ -1,21 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("sijd38964ht83q5") - - collection.listRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)" - collection.viewRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)" - collection.updateRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)" - collection.deleteRule = "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("sijd38964ht83q5") - - collection.listRule = null - collection.viewRule = null - collection.updateRule = null - collection.deleteRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1692027564_updated_hooks.js b/pb_migrations/1692027564_updated_hooks.js deleted file mode 100644 index f19938eb..00000000 --- a/pb_migrations/1692027564_updated_hooks.js +++ /dev/null @@ -1,48 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("3fhw2mfr9zrgodj") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "u3bmgjpb", - "name": "action_type", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "command", - "post", - "sendmail", - "restroom-mw" - ] - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("3fhw2mfr9zrgodj") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "u3bmgjpb", - "name": "action_type", - "type": "select", - "required": true, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "command", - "post", - "sendmail" - ] - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1692194881_created_sessionDataWebauthn.js b/pb_migrations/1692194881_created_sessionDataWebauthn.js deleted file mode 100644 index bf57e109..00000000 --- a/pb_migrations/1692194881_created_sessionDataWebauthn.js +++ /dev/null @@ -1,50 +0,0 @@ -migrate((db) => { - const collection = new Collection({ - "id": "55roakey1q8vk77", - "created": "2023-08-16 14:08:01.186Z", - "updated": "2023-08-16 14:08:01.186Z", - "name": "sessionDataWebauthn", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "xdfemwi3", - "name": "user", - "type": "relation", - "required": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - }, - { - "system": false, - "id": "kds5s6oc", - "name": "session", - "type": "json", - "required": false, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("55roakey1q8vk77"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1692626405_created_webauthnCredentials.js b/pb_migrations/1692626405_created_webauthnCredentials.js deleted file mode 100644 index a93adc94..00000000 --- a/pb_migrations/1692626405_created_webauthnCredentials.js +++ /dev/null @@ -1,55 +0,0 @@ -migrate((db) => { - const collection = new Collection({ - "id": "nopzrf0n7mbfu58", - "created": "2023-08-21 14:00:05.210Z", - "updated": "2023-08-21 14:00:05.210Z", - "name": "webauthnCredentials", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "xootznbs", - "name": "user", - "type": "relation", - "required": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - }, - { - "system": false, - "id": "of3px3ud", - "name": "credential", - "type": "json", - "required": false, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - collection.indexes = [ - "CREATE INDEX `idx_p4OsklQ` ON `webauthnCredentials` (`user`)" - ] - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58"); - - collection.indexes = [] - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1692700573_updated_webauthnCredentials.js b/pb_migrations/1692700573_updated_webauthnCredentials.js deleted file mode 100644 index 6f01867d..00000000 --- a/pb_migrations/1692700573_updated_webauthnCredentials.js +++ /dev/null @@ -1,17 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - collection.listRule = "user.id = @request.auth.id" - collection.viewRule = "user.id = @request.auth.id" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - collection.listRule = null - collection.viewRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1692700709_updated_webauthnCredentials.js b/pb_migrations/1692700709_updated_webauthnCredentials.js deleted file mode 100644 index 75dce76b..00000000 --- a/pb_migrations/1692700709_updated_webauthnCredentials.js +++ /dev/null @@ -1,15 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - collection.deleteRule = "user.id = @request.auth.id" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - collection.deleteRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1692796632_updated_webauthnCredentials.js b/pb_migrations/1692796632_updated_webauthnCredentials.js deleted file mode 100644 index 31e3e5e6..00000000 --- a/pb_migrations/1692796632_updated_webauthnCredentials.js +++ /dev/null @@ -1,29 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "gfynehdb", - "name": "description", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - // remove - collection.schema.removeField("gfynehdb") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1694441090_updated_webauthnCredentials.js b/pb_migrations/1694441090_updated_webauthnCredentials.js deleted file mode 100644 index ce6c12be..00000000 --- a/pb_migrations/1694441090_updated_webauthnCredentials.js +++ /dev/null @@ -1,15 +0,0 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - collection.updateRule = "user.id = @request.auth.id" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("nopzrf0n7mbfu58") - - collection.updateRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695197120_created_organizations.js b/pb_migrations/1695197120_created_organizations.js deleted file mode 100644 index 2f531b51..00000000 --- a/pb_migrations/1695197120_created_organizations.js +++ /dev/null @@ -1,92 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "aako88kt3br4npt", - "created": "2023-09-20 08:05:20.415Z", - "updated": "2023-09-20 08:05:20.415Z", - "name": "organizations", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "de5ifbee", - "name": "name", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "rdd3ph1n", - "name": "owners", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": null, - "displayFields": null - } - }, - { - "system": false, - "id": "zhuxbrib", - "name": "avatar", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/png", - "image/jpeg", - "image/webp", - "image/svg+xml" - ], - "thumbs": [], - "protected": false - } - }, - { - "system": false, - "id": "pjjpq1r4", - "name": "description", - "type": "editor", - "required": false, - "presentable": false, - "unique": false, - "options": { - "convertUrls": false - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX `idx_PHN81EZ` ON `organizations` (`name`)" - ], - "listRule": "", - "viewRule": "", - "createRule": "@request.auth.id != ''", - "updateRule": "owners.id ~ @request.auth.id", - "deleteRule": "owners.id ~ @request.auth.id", - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1695199123_updated_organizations.js b/pb_migrations/1695199123_updated_organizations.js deleted file mode 100644 index 56eca6e3..00000000 --- a/pb_migrations/1695199123_updated_organizations.js +++ /dev/null @@ -1,48 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "rdd3ph1n", - "name": "owners", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": 10, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "rdd3ph1n", - "name": "owners", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": null, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695199164_updated_organizations.js b/pb_migrations/1695199164_updated_organizations.js deleted file mode 100644 index 151b0502..00000000 --- a/pb_migrations/1695199164_updated_organizations.js +++ /dev/null @@ -1,48 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "rdd3ph1n", - "name": "owners", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": null, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "rdd3ph1n", - "name": "owners", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": 10, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695371104_created_roles.js b/pb_migrations/1695371104_created_roles.js deleted file mode 100644 index 9112779d..00000000 --- a/pb_migrations/1695371104_created_roles.js +++ /dev/null @@ -1,71 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "pgsh9x4x20kdgjd", - "created": "2023-09-22 08:25:04.234Z", - "updated": "2023-09-22 08:25:04.234Z", - "name": "roles", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "ewo9sxda", - "name": "name", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "^[a-z_]+$" - } - }, - { - "system": false, - "id": "iz3yszre", - "name": "label", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "du40ulzs", - "name": "level", - "type": "number", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": true - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX `idx_IXVrGSd` ON `roles` (\n `name`,\n `label`\n)" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1695371373_created_organizationAuthorizations.js b/pb_migrations/1695371373_created_organizationAuthorizations.js deleted file mode 100644 index 9505ea6f..00000000 --- a/pb_migrations/1695371373_created_organizationAuthorizations.js +++ /dev/null @@ -1,75 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "k1vlx34o1x8tzno", - "created": "2023-09-22 08:29:33.205Z", - "updated": "2023-09-22 08:29:33.205Z", - "name": "organizationAuthorizations", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "pzwwp3tf", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "hlla24j5", - "name": "user", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "nawal8qa", - "name": "role", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "pgsh9x4x20kdgjd", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1695372330_updated_organizationAuthorizations.js b/pb_migrations/1695372330_updated_organizationAuthorizations.js deleted file mode 100644 index c8a5a600..00000000 --- a/pb_migrations/1695372330_updated_organizationAuthorizations.js +++ /dev/null @@ -1,24 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.listRule = "user.id = @request.auth.id || organization.owners.id ~ @request.auth.id" - collection.viewRule = "user.id = @request.auth.id || organization.owners.id ~ @request.auth.id" - collection.createRule = "organization.owners.id ~ @request.auth.id" - collection.updateRule = "organization.owners.id ~ @request.auth.id" - collection.deleteRule = "organization.owners.id ~ @request.auth.id" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.listRule = null - collection.viewRule = null - collection.createRule = null - collection.updateRule = null - collection.deleteRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695372719_updated_roles.js b/pb_migrations/1695372719_updated_roles.js deleted file mode 100644 index 2e217ed7..00000000 --- a/pb_migrations/1695372719_updated_roles.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.listRule = "" - collection.viewRule = "" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.listRule = null - collection.viewRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695373788_updated_users.js b/pb_migrations/1695373788_updated_users.js deleted file mode 100644 index 43be415b..00000000 --- a/pb_migrations/1695373788_updated_users.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - collection.listRule = "@request.auth.id != ''" - collection.viewRule = "@request.auth.id != ''" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - collection.listRule = "" - collection.viewRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695379174_updated_organizationAuthorizations.js b/pb_migrations/1695379174_updated_organizationAuthorizations.js deleted file mode 100644 index 1f3e24d7..00000000 --- a/pb_migrations/1695379174_updated_organizationAuthorizations.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.indexes = [ - "CREATE INDEX `idx_ik2InMV` ON `organizationAuthorizations` (\n `organization`,\n `user`\n)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.indexes = [] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695379242_updated_organizationAuthorizations.js b/pb_migrations/1695379242_updated_organizationAuthorizations.js deleted file mode 100644 index caa2f933..00000000 --- a/pb_migrations/1695379242_updated_organizationAuthorizations.js +++ /dev/null @@ -1,20 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_ik2InMV` ON `organizationAuthorizations` (\n `organization`,\n `user`\n)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.indexes = [ - "CREATE INDEX `idx_ik2InMV` ON `organizationAuthorizations` (\n `organization`,\n `user`\n)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695380238_updated_roles.js b/pb_migrations/1695380238_updated_roles.js deleted file mode 100644 index ebf6a9de..00000000 --- a/pb_migrations/1695380238_updated_roles.js +++ /dev/null @@ -1,22 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.name = "organizationRoles" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_IXVrGSd` ON `organizationRoles` (\n `name`,\n `label`\n)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.name = "roles" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_IXVrGSd` ON `roles` (\n `name`,\n `label`\n)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1695653929_updated_organizations.js b/pb_migrations/1695653929_updated_organizations.js deleted file mode 100644 index 31ed4ac5..00000000 --- a/pb_migrations/1695653929_updated_organizations.js +++ /dev/null @@ -1,39 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = null - collection.deleteRule = null - - // remove - collection.schema.removeField("rdd3ph1n") - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = "owners.id ~ @request.auth.id" - collection.deleteRule = "owners.id ~ @request.auth.id" - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "rdd3ph1n", - "name": "owners", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": null, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696431796_updated_organizations.js b/pb_migrations/1696431796_updated_organizations.js deleted file mode 100644 index 0eef09da..00000000 --- a/pb_migrations/1696431796_updated_organizations.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = null - collection.deleteRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696502157_updated_organizationAuthorizations.js b/pb_migrations/1696502157_updated_organizationAuthorizations.js deleted file mode 100644 index 50306ae1..00000000 --- a/pb_migrations/1696502157_updated_organizationAuthorizations.js +++ /dev/null @@ -1,20 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.createRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= organization.id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - collection.updateRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= organization.id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= organization.id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.createRule = "" - collection.updateRule = "" - collection.deleteRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696575925_created_protectedPaths.js b/pb_migrations/1696575925_created_protectedPaths.js deleted file mode 100644 index 38876400..00000000 --- a/pb_migrations/1696575925_created_protectedPaths.js +++ /dev/null @@ -1,57 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "2y35btjamfzcr9o", - "created": "2023-10-06 07:05:25.903Z", - "updated": "2023-10-06 07:05:25.903Z", - "name": "protectedPaths", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "bruk6bzo", - "name": "path", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "4q4vbdck", - "name": "field", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "pgsh9x4x20kdgjd", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": null - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1696585858_updated_organizationRoles.js b/pb_migrations/1696585858_updated_organizationRoles.js deleted file mode 100644 index cfd95b2d..00000000 --- a/pb_migrations/1696585858_updated_organizationRoles.js +++ /dev/null @@ -1,22 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.name = "orgRoles" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_IXVrGSd` ON `orgRoles` (\n `name`,\n `label`\n)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.name = "organizationRoles" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_IXVrGSd` ON `organizationRoles` (\n `name`,\n `label`\n)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696585879_updated_protectedPaths.js b/pb_migrations/1696585879_updated_protectedPaths.js deleted file mode 100644 index 556de475..00000000 --- a/pb_migrations/1696585879_updated_protectedPaths.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o") - - collection.name = "orgProtectedPaths" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o") - - collection.name = "protectedPaths" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696598864_updated_organizationAuthorizations.js b/pb_migrations/1696598864_updated_organizationAuthorizations.js deleted file mode 100644 index be7d6aaf..00000000 --- a/pb_migrations/1696598864_updated_organizationAuthorizations.js +++ /dev/null @@ -1,32 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.name = "orgAuthorizations" - collection.listRule = "" - collection.viewRule = "" - collection.createRule = "" - collection.updateRule = "" - collection.deleteRule = "" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_ik2InMV` ON `orgAuthorizations` (\n `organization`,\n `user`\n)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.name = "organizationAuthorizations" - collection.listRule = "user.id = @request.auth.id || organization.owners.id ~ @request.auth.id" - collection.viewRule = "user.id = @request.auth.id || organization.owners.id ~ @request.auth.id" - collection.createRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= organization.id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - collection.updateRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= organization.id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= organization.id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_ik2InMV` ON `organizationAuthorizations` (\n `organization`,\n `user`\n)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696598918_updated_orgRoles.js b/pb_migrations/1696598918_updated_orgRoles.js deleted file mode 100644 index 84230858..00000000 --- a/pb_migrations/1696598918_updated_orgRoles.js +++ /dev/null @@ -1,39 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.indexes = [ - "CREATE INDEX `idx_tuBFjhq` ON `orgRoles` (`name`)" - ] - - // remove - collection.schema.removeField("iz3yszre") - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_IXVrGSd` ON `orgRoles` (\n `name`,\n `label`\n)" - ] - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "iz3yszre", - "name": "label", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696598950_updated_organizations.js b/pb_migrations/1696598950_updated_organizations.js deleted file mode 100644 index 5313be85..00000000 --- a/pb_migrations/1696598950_updated_organizations.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.organizationAuthorizations.user.id ?= @request.auth.id &&\n@collection.organizationAuthorizations.organization.id ?= id &&\n@collection.organizationAuthorizations.role.name ?= \"admin\"" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696599006_updated_orgAuthorizations.js b/pb_migrations/1696599006_updated_orgAuthorizations.js deleted file mode 100644 index c9ded419..00000000 --- a/pb_migrations/1696599006_updated_orgAuthorizations.js +++ /dev/null @@ -1,20 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.createRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.createRule = "" - collection.updateRule = "" - collection.deleteRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696603275_updated_orgProtectedPaths.js b/pb_migrations/1696603275_updated_orgProtectedPaths.js deleted file mode 100644 index 603a230d..00000000 --- a/pb_migrations/1696603275_updated_orgProtectedPaths.js +++ /dev/null @@ -1,48 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4q4vbdck", - "name": "roles", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "pgsh9x4x20kdgjd", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4q4vbdck", - "name": "field", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "pgsh9x4x20kdgjd", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696622801_updated_orgProtectedPaths.js b/pb_migrations/1696622801_updated_orgProtectedPaths.js deleted file mode 100644 index 2263a89d..00000000 --- a/pb_migrations/1696622801_updated_orgProtectedPaths.js +++ /dev/null @@ -1,44 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "bruk6bzo", - "name": "pathRegex", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "bruk6bzo", - "name": "path", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696849689_updated_orgRoles.js b/pb_migrations/1696849689_updated_orgRoles.js deleted file mode 100644 index f17edbef..00000000 --- a/pb_migrations/1696849689_updated_orgRoles.js +++ /dev/null @@ -1,31 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - // remove - collection.schema.removeField("du40ulzs") - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "du40ulzs", - "name": "level", - "type": "number", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": true - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696870220_updated_organizations.js b/pb_migrations/1696870220_updated_organizations.js deleted file mode 100644 index 48136b35..00000000 --- a/pb_migrations/1696870220_updated_organizations.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"owner\"" - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"owner\"" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1696870367_updated_orgAuthorizations.js b/pb_migrations/1696870367_updated_orgAuthorizations.js deleted file mode 100644 index 8b545cd1..00000000 --- a/pb_migrations/1696870367_updated_orgAuthorizations.js +++ /dev/null @@ -1,20 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.createRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.createRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n@collection.orgAuthorizations.role.name ?= \"admin\"" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229181_created_orgJoinRequest.js b/pb_migrations/1698229181_created_orgJoinRequest.js deleted file mode 100644 index cf80c388..00000000 --- a/pb_migrations/1698229181_created_orgJoinRequest.js +++ /dev/null @@ -1,78 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "g7w0g7iqidynhim", - "created": "2023-10-25 10:19:41.008Z", - "updated": "2023-10-25 10:19:41.008Z", - "name": "orgJoinRequest", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "kj3nhvxx", - "name": "user", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "dfgtbvkp", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "l5dq93vm", - "name": "status", - "type": "select", - "required": true, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "pending", - "accepted", - "rejected" - ] - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX `idx_H6SZMtG` ON `orgJoinRequest` (\n `user`,\n `organization`\n)" - ], - "listRule": "user.id = @request.auth.id", - "viewRule": "", - "createRule": "", - "updateRule": "", - "deleteRule": "", - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1698229207_updated_orgJoinRequest.js b/pb_migrations/1698229207_updated_orgJoinRequest.js deleted file mode 100644 index 3257e816..00000000 --- a/pb_migrations/1698229207_updated_orgJoinRequest.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229226_updated_orgJoinRequest.js b/pb_migrations/1698229226_updated_orgJoinRequest.js deleted file mode 100644 index 1bc62413..00000000 --- a/pb_migrations/1698229226_updated_orgJoinRequest.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229276_updated_orgJoinRequest.js b/pb_migrations/1698229276_updated_orgJoinRequest.js deleted file mode 100644 index 0156bc8f..00000000 --- a/pb_migrations/1698229276_updated_orgJoinRequest.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id && (\n @collection.orgAuthorizations.role.name = \"admin\"\n )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229293_updated_orgJoinRequest.js b/pb_migrations/1698229293_updated_orgJoinRequest.js deleted file mode 100644 index eca4f642..00000000 --- a/pb_migrations/1698229293_updated_orgJoinRequest.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id && (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id && (\n @collection.orgAuthorizations.role.name = \"admin\"\n )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229301_updated_orgJoinRequest.js b/pb_migrations/1698229301_updated_orgJoinRequest.js deleted file mode 100644 index 88135d6b..00000000 --- a/pb_migrations/1698229301_updated_orgJoinRequest.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id || (\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id && (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229324_updated_orgJoinRequest.js b/pb_migrations/1698229324_updated_orgJoinRequest.js deleted file mode 100644 index 0c1a0d97..00000000 --- a/pb_migrations/1698229324_updated_orgJoinRequest.js +++ /dev/null @@ -1,20 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.viewRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - collection.updateRule = "@collection.orgAuthorizations.user.id = @request.auth.id &&\n@collection.orgAuthorizations.organization = organization.id &&\n(\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n)" - collection.deleteRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.viewRule = "" - collection.updateRule = "" - collection.deleteRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229341_updated_orgJoinRequest.js b/pb_migrations/1698229341_updated_orgJoinRequest.js deleted file mode 100644 index 8e4079f0..00000000 --- a/pb_migrations/1698229341_updated_orgJoinRequest.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.createRule = "@request.auth.id != \"\"" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.createRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698229458_updated_orgJoinRequest.js b/pb_migrations/1698229458_updated_orgJoinRequest.js deleted file mode 100644 index 2e6bff1f..00000000 --- a/pb_migrations/1698229458_updated_orgJoinRequest.js +++ /dev/null @@ -1,22 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.name = "orgJoinRequests" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_H6SZMtG` ON `orgJoinRequests` (\n `user`,\n `organization`\n)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.name = "orgJoinRequest" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_H6SZMtG` ON `orgJoinRequest` (\n `user`,\n `organization`\n)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698231235_updated_orgJoinRequests.js b/pb_migrations/1698231235_updated_orgJoinRequests.js deleted file mode 100644 index c37685ea..00000000 --- a/pb_migrations/1698231235_updated_orgJoinRequests.js +++ /dev/null @@ -1,31 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "0emehjgx", - "name": "email", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // remove - collection.schema.removeField("0emehjgx") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698242178_updated_orgJoinRequests.js b/pb_migrations/1698242178_updated_orgJoinRequests.js deleted file mode 100644 index 2c720305..00000000 --- a/pb_migrations/1698242178_updated_orgJoinRequests.js +++ /dev/null @@ -1,22 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization.id = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - collection.viewRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization.id = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - collection.updateRule = "@collection.orgAuthorizations.user.id = @request.auth.id &&\n@collection.orgAuthorizations.organization.id = organization.id &&\n(\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n)" - collection.deleteRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization.id = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "" - collection.viewRule = "" - collection.updateRule = "@collection.orgAuthorizations.user.id = @request.auth.id &&\n@collection.orgAuthorizations.organization = organization.id &&\n(\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n)" - collection.deleteRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698242304_updated_orgJoinRequests.js b/pb_migrations/1698242304_updated_orgJoinRequests.js deleted file mode 100644 index 4e07d873..00000000 --- a/pb_migrations/1698242304_updated_orgJoinRequests.js +++ /dev/null @@ -1,20 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id\n &&\n (\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n )\n)" - collection.viewRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id\n &&\n (\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n )\n)" - collection.deleteRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id\n &&\n (\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization.id = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - collection.viewRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization.id = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - collection.deleteRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id = @request.auth.id &&\n @collection.orgAuthorizations.organization.id = organization.id &&\n (\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698244942_updated_orgJoinRequests.js b/pb_migrations/1698244942_updated_orgJoinRequests.js deleted file mode 100644 index c2116bee..00000000 --- a/pb_migrations/1698244942_updated_orgJoinRequests.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.updateRule = "@collection.orgAuthorizations.user.id = @request.auth.id &&\n@collection.orgAuthorizations.organization.id = organization.id &&\n(\n @collection.orgAuthorizations.role.name = \"admin\" ||\n @collection.orgAuthorizations.role.name = \"owner\"\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698393887_updated_orgJoinRequests.js b/pb_migrations/1698393887_updated_orgJoinRequests.js deleted file mode 100644 index a7726395..00000000 --- a/pb_migrations/1698393887_updated_orgJoinRequests.js +++ /dev/null @@ -1,31 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // remove - collection.schema.removeField("0emehjgx") - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "0emehjgx", - "name": "email", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1698394333_updated_orgJoinRequests.js b/pb_migrations/1698394333_updated_orgJoinRequests.js deleted file mode 100644 index 05f744e0..00000000 --- a/pb_migrations/1698394333_updated_orgJoinRequests.js +++ /dev/null @@ -1,31 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "fhyjwtkm", - "name": "reminders", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": true - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // remove - collection.schema.removeField("fhyjwtkm") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1700000000_seed_rooles.js b/pb_migrations/1700000000_seed_rooles.js deleted file mode 100644 index 4f3fe04d..00000000 --- a/pb_migrations/1700000000_seed_rooles.js +++ /dev/null @@ -1,26 +0,0 @@ -/// - -const roles = ["owner", "admin", "member"]; - -migrate((db) => { - const dao = new Dao(db); - const rolesCollection = dao.findCollectionByNameOrId("orgRoles"); - - for (const role of roles) { - const record = new Record(rolesCollection, { name: role }); - dao.saveRecord(record); - } - - // -- Seeding protected paths -- // - - const ownerRole = dao.findFirstRecordByData("orgRoles", "name", "owner"); - // const adminRole = dao.findFirstRecordByData("orgRoles", "name", "admin"); - - const pathsCollection = dao.findCollectionByNameOrId("orgProtectedPaths"); - dao.saveRecord( - new Record(pathsCollection, { - pathRegex: "/organizations/(.*)/settings", - roles: [ownerRole.id], - }) - ); -}); diff --git a/pb_migrations/1708687922_updated_users.js b/pb_migrations/1708687922_updated_users.js deleted file mode 100644 index ccb970d4..00000000 --- a/pb_migrations/1708687922_updated_users.js +++ /dev/null @@ -1,54 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - collection.options = { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "onlyVerified": false, - "requireEmail": false - } - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "nkp4qhd9", - "name": "es256_public_key", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - collection.options = { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": false - } - - // remove - collection.schema.removeField("nkp4qhd9") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1709116531_updated_users.js b/pb_migrations/1709116531_updated_users.js deleted file mode 100644 index 648b981f..00000000 --- a/pb_migrations/1709116531_updated_users.js +++ /dev/null @@ -1,44 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1714492101_default_mail_settings.js b/pb_migrations/1714492101_default_mail_settings.js deleted file mode 100644 index c38bbe31..00000000 --- a/pb_migrations/1714492101_default_mail_settings.js +++ /dev/null @@ -1,10 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db); - - const settings = dao.findSettings(); - settings.meta.resetPasswordTemplate.actionUrl = - "{APP_URL}/reset-password-{TOKEN}"; - - dao.saveSettings(settings); -}); diff --git a/pb_migrations/1715249207_created_users_public_keys.js b/pb_migrations/1715249207_created_users_public_keys.js deleted file mode 100644 index 71d5a29f..00000000 --- a/pb_migrations/1715249207_created_users_public_keys.js +++ /dev/null @@ -1,127 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "7bmyedethjhr1ir", - "created": "2024-05-09 10:06:47.639Z", - "updated": "2024-05-09 10:06:47.639Z", - "name": "users_public_keys", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "rylpn1gv", - "name": "owner", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "t65tksny", - "name": "bitcoin_public_key", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "tnshwyg9", - "name": "ecdh_public_key", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "xwkg2zsb", - "name": "eddsa_public_key", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "ygmmntyo", - "name": "ethereum_address", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "pz24o3ls", - "name": "reflow_public_key", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "qg6jnudd", - "name": "es256_public_key", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "owner.id = @request.auth.id", - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("7bmyedethjhr1ir"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1715331681_move_users_public_keys.js b/pb_migrations/1715331681_move_users_public_keys.js deleted file mode 100644 index 875d3a96..00000000 --- a/pb_migrations/1715331681_move_users_public_keys.js +++ /dev/null @@ -1,57 +0,0 @@ -/// -migrate( - (db) => { - const dao = new Dao(db); - - const usersPublicKeysCollection = - dao.findCollectionByNameOrId("users_public_keys"); - - const users = dao.findRecordsByFilter( - "users", - `email != ""`, - "-created", - 0, - 0 - ); - - for (const user of users) { - if (user) { - const keys = { - bitcoin_public_key: user.get("bitcoin_public_key"), - ecdh_public_key: user.get("ecdh_public_key"), - eddsa_public_key: user.get("eddsa_public_key"), - ethereum_address: user.get("ethereum_address"), - reflow_public_key: user.get("reflow_public_key"), - es256_public_key: user.get("es256_public_key"), - }; - - const userHasKeys = Object.values(keys) - .map(Boolean) - .every((v) => v); - if (!userHasKeys) continue; - - const userPublicKeys = new Record(usersPublicKeysCollection, { - owner: user.getId(), - ...keys, - }); - - dao.saveRecord(userPublicKeys); - } - } - }, - (db) => { - const dao = new Dao(db); - - const usersPublicKeys = dao.findRecordsByFilter( - "users_public_keys", - `owner != ""`, - "-created", - 0, - 0 - ); - - for (const keys of usersPublicKeys) { - dao.deleteRecord(keys); - } - } -); diff --git a/pb_migrations/1715333405_updated_users.js b/pb_migrations/1715333405_updated_users.js deleted file mode 100644 index bf20210c..00000000 --- a/pb_migrations/1715333405_updated_users.js +++ /dev/null @@ -1,126 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - // remove - collection.schema.removeField("nf3jan6h") - - // remove - collection.schema.removeField("zjvzw9wa") - - // remove - collection.schema.removeField("yg9yz2sc") - - // remove - collection.schema.removeField("ouslgk2m") - - // remove - collection.schema.removeField("vqu3zutd") - - // remove - collection.schema.removeField("nkp4qhd9") - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "nf3jan6h", - "name": "bitcoin_public_key", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "zjvzw9wa", - "name": "ecdh_public_key", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "yg9yz2sc", - "name": "eddsa_public_key", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ouslgk2m", - "name": "ethereum_address", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "vqu3zutd", - "name": "reflow_public_key", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "nkp4qhd9", - "name": "es256_public_key", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1721422489_created_z_test_collection.js b/pb_migrations/1721422489_created_z_test_collection.js deleted file mode 100644 index 14ccdf47..00000000 --- a/pb_migrations/1721422489_created_z_test_collection.js +++ /dev/null @@ -1,232 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "ktjgpqf146ss2ia", - "created": "2024-07-19 20:54:49.363Z", - "updated": "2024-07-19 20:54:49.363Z", - "name": "z_test_collection", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "dyxsckke", - "name": "text_field", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 10, - "pattern": "^\\w+$" - } - }, - { - "system": false, - "id": "5nakh5br", - "name": "url_field", - "type": "url", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": [], - "onlyDomains": [ - "uld.com" - ] - } - }, - { - "system": false, - "id": "zjaakeak", - "name": "number_field", - "type": "number", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 70, - "noDecimal": true - } - }, - { - "system": false, - "id": "plf9bqlo", - "name": "boolean_field", - "type": "bool", - "required": false, - "presentable": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "o9i7jdyx", - "name": "richtext_field", - "type": "editor", - "required": true, - "presentable": false, - "unique": false, - "options": { - "convertUrls": true - } - }, - { - "system": false, - "id": "euflpigq", - "name": "email_field", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": [ - "mat.cos" - ], - "onlyDomains": [] - } - }, - { - "system": false, - "id": "r6bk98mc", - "name": "date_field", - "type": "date", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": "2024-07-18 12:00:00.000Z", - "max": "2024-07-28 12:00:00.000Z" - } - }, - { - "system": false, - "id": "jnvj44gc", - "name": "select_field", - "type": "select", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "a", - "b", - "c" - ] - } - }, - { - "system": false, - "id": "wlqgr8z3", - "name": "select_multi_field", - "type": "select", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 3, - "values": [ - "x", - "y", - "z" - ] - } - }, - { - "system": false, - "id": "ldafagmk", - "name": "file_field", - "type": "file", - "required": true, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "application/zip" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": true - } - }, - { - "system": false, - "id": "ctqisupe", - "name": "file_multi_field", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [], - "thumbs": [], - "maxSelect": 99, - "maxSize": 5242880, - "protected": false - } - }, - { - "system": false, - "id": "ckgk3hqn", - "name": "relation_field", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "nopzrf0n7mbfu58", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "dmehmjlp", - "name": "relation_multi_field", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": 4, - "displayFields": null - } - }, - { - "system": false, - "id": "wj9awedr", - "name": "json_field", - "type": "json", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSize": 2000000 - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1722850166_updated_orgAuthorizations.js b/pb_migrations/1722850166_updated_orgAuthorizations.js deleted file mode 100644 index 83215a86..00000000 --- a/pb_migrations/1722850166_updated_orgAuthorizations.js +++ /dev/null @@ -1,48 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "pzwwp3tf", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": true, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "pzwwp3tf", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1722850178_updated_orgJoinRequests.js b/pb_migrations/1722850178_updated_orgJoinRequests.js deleted file mode 100644 index eee4568a..00000000 --- a/pb_migrations/1722850178_updated_orgJoinRequests.js +++ /dev/null @@ -1,48 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "dfgtbvkp", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": true, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "dfgtbvkp", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1725893867_updated_users.js b/pb_migrations/1725893867_updated_users.js deleted file mode 100644 index 74d08d54..00000000 --- a/pb_migrations/1725893867_updated_users.js +++ /dev/null @@ -1,60 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "maxSelect": 1, - "maxSize": 22020096, - "protected": false - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("_pb_users_auth_") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "maxSelect": 1, - "maxSize": 5242880, - "protected": false - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1726038316_updated_orgRoles.js b/pb_migrations/1726038316_updated_orgRoles.js deleted file mode 100644 index 1fc729e2..00000000 --- a/pb_migrations/1726038316_updated_orgRoles.js +++ /dev/null @@ -1,31 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "xcrt6mly", - "name": "level", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": 0, - "max": null, - "noDecimal": true - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("pgsh9x4x20kdgjd") - - // remove - collection.schema.removeField("xcrt6mly") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1726038450_seed_roles_with_level.js b/pb_migrations/1726038450_seed_roles_with_level.js deleted file mode 100644 index 6a87f64d..00000000 --- a/pb_migrations/1726038450_seed_roles_with_level.js +++ /dev/null @@ -1,36 +0,0 @@ -/// -// @ts-check - -/**ย @type {Array<{name:string, level:number}>} */ -const roles = [ - { name: "owner", level: 0 }, - { name: "admin", level: 1 }, - { name: "member", level: 9 }, -]; - -migrate( - (db) => { - const dao = new Dao(db); - const rolesCollection = dao.findCollectionByNameOrId("orgRoles"); - - roles - // Taking into account the roles created with a previous migration - .map((role) => { - try { - const record = dao.findFirstRecordByData( - "orgRoles", - "name", - role.name - ); - record.set("level", role.level); - return record; - } catch { - return new Record(rolesCollection, role); - } - }) - .forEach((roleRecord) => dao.saveRecord(roleRecord)); - }, - (db) => { - // add down queries... - } -); diff --git a/pb_migrations/1726475967_updated_orgAuthorizations.js b/pb_migrations/1726475967_updated_orgAuthorizations.js deleted file mode 100644 index dab1350b..00000000 --- a/pb_migrations/1726475967_updated_orgAuthorizations.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.updateRule = "@request.data.user:isset = false &&\n@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727194827_deleted_orgProtectedPaths.js b/pb_migrations/1727194827_deleted_orgProtectedPaths.js deleted file mode 100644 index f47d746c..00000000 --- a/pb_migrations/1727194827_deleted_orgProtectedPaths.js +++ /dev/null @@ -1,57 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("2y35btjamfzcr9o"); - - return dao.deleteCollection(collection); -}, (db) => { - const collection = new Collection({ - "id": "2y35btjamfzcr9o", - "created": "2023-10-06 07:05:25.903Z", - "updated": "2024-09-24 15:44:31.884Z", - "name": "orgProtectedPaths", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "bruk6bzo", - "name": "pathRegex", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "4q4vbdck", - "name": "roles", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "pgsh9x4x20kdgjd", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": null - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}) diff --git a/pb_migrations/1727420027_updated_orgJoinRequests.js b/pb_migrations/1727420027_updated_orgJoinRequests.js deleted file mode 100644 index 7d594d24..00000000 --- a/pb_migrations/1727420027_updated_orgJoinRequests.js +++ /dev/null @@ -1,22 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)" - collection.viewRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)" - collection.updateRule = "@request.data.organization:isset = false &&\n@request.data.user:isset = false &&\n@request.data.reminders:isset = false &&\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)" - collection.deleteRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.listRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id\n &&\n (\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n )\n)" - collection.viewRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id\n &&\n (\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n )\n)" - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n)" - collection.deleteRule = "user.id = @request.auth.id ||\n(\n @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id\n &&\n (\n @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\"\n )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727427248_updated_orgJoinRequests.js b/pb_migrations/1727427248_updated_orgJoinRequests.js deleted file mode 100644 index 06f8f423..00000000 --- a/pb_migrations/1727427248_updated_orgJoinRequests.js +++ /dev/null @@ -1,51 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "l5dq93vm", - "name": "status", - "type": "select", - "required": true, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "pending", - "accepted", - "rejected", - "blocked" - ] - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "l5dq93vm", - "name": "status", - "type": "select", - "required": true, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "pending", - "accepted", - "rejected" - ] - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727434248_updated_orgJoinRequests.js b/pb_migrations/1727434248_updated_orgJoinRequests.js deleted file mode 100644 index 9a376b83..00000000 --- a/pb_migrations/1727434248_updated_orgJoinRequests.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.deleteRule = "user.id = @request.auth.id" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("g7w0g7iqidynhim") - - collection.deleteRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727434645_updated_organizations.js b/pb_migrations/1727434645_updated_organizations.js deleted file mode 100644 index fc300d10..00000000 --- a/pb_migrations/1727434645_updated_organizations.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.deleteRule = null - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aako88kt3br4npt") - - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"owner\"" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727719328_created_org_invite.js b/pb_migrations/1727719328_created_org_invite.js deleted file mode 100644 index 9a2e8b45..00000000 --- a/pb_migrations/1727719328_created_org_invite.js +++ /dev/null @@ -1,72 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "v12xstc3xygpawh", - "created": "2024-09-30 18:02:08.746Z", - "updated": "2024-09-30 18:02:08.746Z", - "name": "org_invite", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "7yfkzy39", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "32axfwku", - "name": "user", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "gbqnjiwb", - "name": "user_email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": [], - "onlyDomains": [] - } - } - ], - "indexes": [], - "listRule": "user.id = @request.auth.id ||\n( @request.auth.id = @collection.orgAuthorizations.user.id &&\n organization.id = @collection.orgAuthorizations.organization.id &&\n ( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )\n)", - "viewRule": "user.id = @request.auth.id ||\n( @request.auth.id = @collection.orgAuthorizations.user.id &&\n organization.id = @collection.orgAuthorizations.organization.id &&\n ( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )\n)", - "createRule": "@request.auth.id = @collection.orgAuthorizations.user.id &&\norganization.id = @collection.orgAuthorizations.organization.id &&\n( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )", - "updateRule": null, - "deleteRule": "user.id = @request.auth.id ||\n( @request.auth.id = @collection.orgAuthorizations.user.id &&\n organization.id = @collection.orgAuthorizations.organization.id &&\n ( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )\n)", - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1727720630_updated_org_invite.js b/pb_migrations/1727720630_updated_org_invite.js deleted file mode 100644 index dc873596..00000000 --- a/pb_migrations/1727720630_updated_org_invite.js +++ /dev/null @@ -1,19 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invite` (`user_email`)", - "CREATE UNIQUE INDEX `idx_cdEx89V` ON `org_invite` (`user`)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.indexes = [] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727792062_updated_org_invite.js b/pb_migrations/1727792062_updated_org_invite.js deleted file mode 100644 index 96c76849..00000000 --- a/pb_migrations/1727792062_updated_org_invite.js +++ /dev/null @@ -1,24 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.name = "org_invites" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invites` (`user_email`)", - "CREATE UNIQUE INDEX `idx_cdEx89V` ON `org_invites` (`user`)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.name = "org_invite" - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invite` (`user_email`)", - "CREATE UNIQUE INDEX `idx_cdEx89V` ON `org_invite` (`user`)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727793426_updated_org_invites.js b/pb_migrations/1727793426_updated_org_invites.js deleted file mode 100644 index 546a0760..00000000 --- a/pb_migrations/1727793426_updated_org_invites.js +++ /dev/null @@ -1,21 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invites` (`user_email`)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invites` (`user_email`)", - "CREATE UNIQUE INDEX `idx_cdEx89V` ON `org_invites` (`user`)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727796849_updated_org_invites.js b/pb_migrations/1727796849_updated_org_invites.js deleted file mode 100644 index f99b1920..00000000 --- a/pb_migrations/1727796849_updated_org_invites.js +++ /dev/null @@ -1,27 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "6stxg7b7", - "name": "failed_email_send", - "type": "bool", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - // remove - collection.schema.removeField("6stxg7b7") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727796874_updated_org_invites.js b/pb_migrations/1727796874_updated_org_invites.js deleted file mode 100644 index 48146446..00000000 --- a/pb_migrations/1727796874_updated_org_invites.js +++ /dev/null @@ -1,20 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invites` (\n `user_email`,\n `organization`\n)" - ] - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invites` (`user_email`)" - ] - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727798303_updated_org_invites.js b/pb_migrations/1727798303_updated_org_invites.js deleted file mode 100644 index 3115cd2e..00000000 --- a/pb_migrations/1727798303_updated_org_invites.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.listRule = "" - collection.viewRule = "" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.listRule = "user.id = @request.auth.id ||\n( @request.auth.id = @collection.orgAuthorizations.user.id &&\n organization.id = @collection.orgAuthorizations.organization.id &&\n ( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )\n)" - collection.viewRule = "user.id = @request.auth.id ||\n( @request.auth.id = @collection.orgAuthorizations.user.id &&\n organization.id = @collection.orgAuthorizations.organization.id &&\n ( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727798588_updated_org_invites.js b/pb_migrations/1727798588_updated_org_invites.js deleted file mode 100644 index a240348e..00000000 --- a/pb_migrations/1727798588_updated_org_invites.js +++ /dev/null @@ -1,22 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.listRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") )" - collection.viewRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") )" - collection.createRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") " - collection.deleteRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") )" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.listRule = "" - collection.viewRule = "" - collection.createRule = "@request.auth.id = @collection.orgAuthorizations.user.id &&\norganization.id = @collection.orgAuthorizations.organization.id &&\n( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )" - collection.deleteRule = "user.id = @request.auth.id ||\n( @request.auth.id = @collection.orgAuthorizations.user.id &&\n organization.id = @collection.orgAuthorizations.organization.id &&\n ( @collection.orgAuthorizations.role.name = 'admin' ||\n @collection.orgAuthorizations.role.name = 'owner' )\n)" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727800869_updated_org_invites.js b/pb_migrations/1727800869_updated_org_invites.js deleted file mode 100644 index e6bc2d05..00000000 --- a/pb_migrations/1727800869_updated_org_invites.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.createRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") " - collection.deleteRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - collection.createRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") " - collection.deleteRule = "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") )" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1727854886_updated_org_invites.js b/pb_migrations/1727854886_updated_org_invites.js deleted file mode 100644 index bf47fd41..00000000 --- a/pb_migrations/1727854886_updated_org_invites.js +++ /dev/null @@ -1,27 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "gtmrpmp3", - "name": "declined", - "type": "bool", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v12xstc3xygpawh") - - // remove - collection.schema.removeField("gtmrpmp3") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1728470648_updated_z_test_collection.js b/pb_migrations/1728470648_updated_z_test_collection.js deleted file mode 100644 index 835f542b..00000000 --- a/pb_migrations/1728470648_updated_z_test_collection.js +++ /dev/null @@ -1,24 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "" - collection.viewRule = "" - collection.createRule = "" - collection.updateRule = "" - collection.deleteRule = "" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = null - collection.viewRule = null - collection.createRule = null - collection.updateRule = null - collection.deleteRule = null - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1728481427_updated_z_test_collection.js b/pb_migrations/1728481427_updated_z_test_collection.js deleted file mode 100644 index 61e190ca..00000000 --- a/pb_migrations/1728481427_updated_z_test_collection.js +++ /dev/null @@ -1,54 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // remove - collection.schema.removeField("ckgk3hqn") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "xkpmxcbr", - "name": "relation_field", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "ktjgpqf146ss2ia", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ckgk3hqn", - "name": "relation_field", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "nopzrf0n7mbfu58", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - // remove - collection.schema.removeField("xkpmxcbr") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1728481532_updated_z_test_collection.js b/pb_migrations/1728481532_updated_z_test_collection.js deleted file mode 100644 index 30401953..00000000 --- a/pb_migrations/1728481532_updated_z_test_collection.js +++ /dev/null @@ -1,52 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ldafagmk", - "name": "file_field", - "type": "file", - "required": true, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": true - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ldafagmk", - "name": "file_field", - "type": "file", - "required": true, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "application/zip" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": true - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1728563836_updated_z_test_collection.js b/pb_migrations/1728563836_updated_z_test_collection.js deleted file mode 100644 index 6035c6b5..00000000 --- a/pb_migrations/1728563836_updated_z_test_collection.js +++ /dev/null @@ -1,54 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // remove - collection.schema.removeField("xkpmxcbr") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "rwghvhbv", - "name": "relation_field", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "xkpmxcbr", - "name": "relation_field", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "ktjgpqf146ss2ia", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - // remove - collection.schema.removeField("rwghvhbv") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729074142_updated_z_test_collection.js b/pb_migrations/1729074142_updated_z_test_collection.js deleted file mode 100644 index 8d16fd8c..00000000 --- a/pb_migrations/1729074142_updated_z_test_collection.js +++ /dev/null @@ -1,50 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ctqisupe", - "name": "file_multi_field", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 99, - "maxSize": 5242880, - "protected": false - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ctqisupe", - "name": "file_multi_field", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [], - "thumbs": [], - "maxSelect": 99, - "maxSize": 5242880, - "protected": false - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729074280_updated_z_test_collection.js b/pb_migrations/1729074280_updated_z_test_collection.js deleted file mode 100644 index d0c5b3ef..00000000 --- a/pb_migrations/1729074280_updated_z_test_collection.js +++ /dev/null @@ -1,52 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ctqisupe", - "name": "file_multi_field", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 3, - "maxSize": 5242880, - "protected": false - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ctqisupe", - "name": "file_multi_field", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 99, - "maxSize": 5242880, - "protected": false - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729096464_updated_z_test_collection.js b/pb_migrations/1729096464_updated_z_test_collection.js deleted file mode 100644 index 665e9b4e..00000000 --- a/pb_migrations/1729096464_updated_z_test_collection.js +++ /dev/null @@ -1,50 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "wlqgr8z3", - "name": "select_multi_field", - "type": "select", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 2, - "values": [ - "x", - "y", - "z" - ] - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "wlqgr8z3", - "name": "select_multi_field", - "type": "select", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 3, - "values": [ - "x", - "y", - "z" - ] - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729755967_updated_z_test_collection.js b/pb_migrations/1729755967_updated_z_test_collection.js deleted file mode 100644 index 8a386c38..00000000 --- a/pb_migrations/1729755967_updated_z_test_collection.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "@request.auth.id != ''" - collection.viewRule = "@request.auth.id != ''" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "" - collection.viewRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729757085_updated_z_test_collection.js b/pb_migrations/1729757085_updated_z_test_collection.js deleted file mode 100644 index 75174d9d..00000000 --- a/pb_migrations/1729757085_updated_z_test_collection.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "" - collection.viewRule = "" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "@request.auth.id != ''" - collection.viewRule = "@request.auth.id != ''" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729843574_updated_z_test_collection.js b/pb_migrations/1729843574_updated_z_test_collection.js deleted file mode 100644 index cff0cf14..00000000 --- a/pb_migrations/1729843574_updated_z_test_collection.js +++ /dev/null @@ -1,33 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "irg7eqrq", - "name": "self_relation", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "ktjgpqf146ss2ia", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // remove - collection.schema.removeField("irg7eqrq") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729930153_updated_z_test_collection.js b/pb_migrations/1729930153_updated_z_test_collection.js deleted file mode 100644 index b6b35abf..00000000 --- a/pb_migrations/1729930153_updated_z_test_collection.js +++ /dev/null @@ -1,33 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "7d3zwah8", - "name": "owner", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // remove - collection.schema.removeField("7d3zwah8") - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729930209_updated_z_test_collection.js b/pb_migrations/1729930209_updated_z_test_collection.js deleted file mode 100644 index fe1ab3b8..00000000 --- a/pb_migrations/1729930209_updated_z_test_collection.js +++ /dev/null @@ -1,48 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "7d3zwah8", - "name": "owner", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "7d3zwah8", - "name": "owner", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729930438_updated_z_test_collection.js b/pb_migrations/1729930438_updated_z_test_collection.js deleted file mode 100644 index fa7b4908..00000000 --- a/pb_migrations/1729930438_updated_z_test_collection.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "(owner != null && owner.id = @request.auth.id) || owner = null" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729930444_updated_z_test_collection.js b/pb_migrations/1729930444_updated_z_test_collection.js deleted file mode 100644 index b9cb14ae..00000000 --- a/pb_migrations/1729930444_updated_z_test_collection.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.viewRule = "(owner != null && owner.id = @request.auth.id) || owner = null" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.viewRule = "" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729930951_updated_z_test_collection.js b/pb_migrations/1729930951_updated_z_test_collection.js deleted file mode 100644 index e1726f2c..00000000 --- a/pb_migrations/1729930951_updated_z_test_collection.js +++ /dev/null @@ -1,18 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "owner = null ||\n( owner != null && (\n owner.id = @request.auth.id ||\n ( @collection.authorizations.record_id = id &&\n @collection.authorizations.users.id ?= @request.auth.id &&\n @collection.authorizations.owner.id ?= owner.id )\n )\n)" - collection.viewRule = "owner = null ||\n( owner != null && (\n owner.id = @request.auth.id ||\n ( @collection.authorizations.record_id = id &&\n @collection.authorizations.users.id ?= @request.auth.id &&\n @collection.authorizations.owner.id ?= owner.id )\n )\n)" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - collection.listRule = "(owner != null && owner.id = @request.auth.id) || owner = null" - collection.viewRule = "(owner != null && owner.id = @request.auth.id) || owner = null" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1729933259_deleted_authorizationsExamples.js b/pb_migrations/1729933259_deleted_authorizationsExamples.js deleted file mode 100644 index 32e049dd..00000000 --- a/pb_migrations/1729933259_deleted_authorizationsExamples.js +++ /dev/null @@ -1,57 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("sijd38964ht83q5"); - - return dao.deleteCollection(collection); -}, (db) => { - const collection = new Collection({ - "id": "sijd38964ht83q5", - "created": "2023-07-11 13:26:18.946Z", - "updated": "2024-10-24 07:03:42.098Z", - "name": "authorizationsExamples", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "s6z3yyrm", - "name": "name", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "3l6g88rp", - "name": "owner", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - } - ], - "indexes": [], - "listRule": "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)", - "viewRule": "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)", - "createRule": "@request.auth.id != ''", - "updateRule": "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)", - "deleteRule": "owner.id = @request.auth.id || (@collection.authorizations.users.id ?= @request.auth.id && @collection.authorizations.record_id ?= id)", - "options": {} - }); - - return Dao(db).saveCollection(collection); -}) diff --git a/pb_migrations/1730125916_updated_z_test_collection.js b/pb_migrations/1730125916_updated_z_test_collection.js deleted file mode 100644 index d60937ea..00000000 --- a/pb_migrations/1730125916_updated_z_test_collection.js +++ /dev/null @@ -1,52 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ldafagmk", - "name": "file_field", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": true - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ldafagmk", - "name": "file_field", - "type": "file", - "required": true, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": true - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1730129064_deleted_crudExample.js b/pb_migrations/1730129064_deleted_crudExample.js deleted file mode 100644 index 0aa77039..00000000 --- a/pb_migrations/1730129064_deleted_crudExample.js +++ /dev/null @@ -1,200 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("p9dhra382rts3bg"); - - return dao.deleteCollection(collection); -}, (db) => { - const collection = new Collection({ - "id": "p9dhra382rts3bg", - "created": "2023-06-07 10:44:19.476Z", - "updated": "2023-07-11 13:16:04.708Z", - "name": "crudExample", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "o0hwn3yh", - "name": "text", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 6, - "max": 10, - "pattern": "" - } - }, - { - "system": false, - "id": "3hmes6kr", - "name": "file_only_pdf_json", - "type": "file", - "required": true, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "application/json", - "application/pdf" - ], - "thumbs": [], - "maxSelect": 99, - "maxSize": 5242880, - "protected": false - } - }, - { - "system": false, - "id": "o72s557k", - "name": "boolean", - "type": "bool", - "required": false, - "presentable": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "dzneawfh", - "name": "select", - "type": "select", - "required": true, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "opt1", - "opt2", - "opt3", - "opt4", - "opt5" - ] - } - }, - { - "system": false, - "id": "t1i6phfc", - "name": "textarea", - "type": "editor", - "required": false, - "presentable": false, - "unique": false, - "options": { - "convertUrls": false - } - }, - { - "system": false, - "id": "lybqqrme", - "name": "text_with_regex", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "^w+S" - } - }, - { - "system": false, - "id": "vkmf5bzv", - "name": "multiselect", - "type": "select", - "required": false, - "presentable": false, - "unique": false, - "options": { - "maxSelect": 2, - "values": [ - "A", - "B", - "C", - "D" - ] - } - }, - { - "system": false, - "id": "kx4ozipk", - "name": "relation", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "z4cc0g76ciqx13v", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": [] - } - }, - { - "system": false, - "id": "nfghsb83", - "name": "image", - "type": "file", - "required": false, - "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "image/png", - "image/jpeg" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": false - } - }, - { - "system": false, - "id": "uy849pd2", - "name": "relation_single", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "z4cc0g76ciqx13v", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - }, - { - "system": false, - "id": "61lxlzl2", - "name": "owner", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - } - ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "", - "updateRule": "", - "deleteRule": "", - "options": {} - }); - - return Dao(db).saveCollection(collection); -}) diff --git a/pb_migrations/1730129141_updated_z_test_collection.js b/pb_migrations/1730129141_updated_z_test_collection.js deleted file mode 100644 index b352c1b8..00000000 --- a/pb_migrations/1730129141_updated_z_test_collection.js +++ /dev/null @@ -1,63 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "moejq2ra", - "name": "text_with_regex", - "type": "text", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "^\\w+$" - } - })) - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "dyxsckke", - "name": "text_field", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 10, - "pattern": "" - } - })) - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("ktjgpqf146ss2ia") - - // remove - collection.schema.removeField("moejq2ra") - - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "dyxsckke", - "name": "text_field", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 10, - "pattern": "^\\w+$" - } - })) - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1730134615_updated_orgAuthorizations.js b/pb_migrations/1730134615_updated_orgAuthorizations.js deleted file mode 100644 index 1f287802..00000000 --- a/pb_migrations/1730134615_updated_orgAuthorizations.js +++ /dev/null @@ -1,16 +0,0 @@ -/// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.updateRule = "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("k1vlx34o1x8tzno") - - collection.updateRule = "@request.data.user:isset = false &&\n@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")" - - return dao.saveCollection(collection) -}) diff --git a/pb_migrations/1734523066_feature_oauth.js b/pb_migrations/1734523066_feature_oauth.js deleted file mode 100644 index 0f8c8932..00000000 --- a/pb_migrations/1734523066_feature_oauth.js +++ /dev/null @@ -1,55 +0,0 @@ -// @ts-check - -/// -/** - * @typedef {import('../../webapp/src/modules/pocketbase/types').FeaturesRecord} Feature - */ - -const FEATURES_COLLECTION_NAME = "features"; - -/** - * @type {Feature} - */ -const feature = { - name: "oauth", - active: false, -}; - -migrate( - (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId( - FEATURES_COLLECTION_NAME - ); - - /** @type {models.Record} */ - let record; - try { - record = dao.findFirstRecordByData( - FEATURES_COLLECTION_NAME, - "name", - feature.name - ); - } catch (e) { - record = new Record(collection, { - name: feature.name, - }); - } - record.set("envVariables", feature.envVariables); - record.set("active", feature.active ?? true); - dao.saveRecord(record); - }, - (db) => { - const dao = new Dao(db); - - try { - const record = dao.findFirstRecordByData( - FEATURES_COLLECTION_NAME, - "name", - feature.name - ); - - dao.deleteRecord(record); - } catch {} - } -); diff --git a/pb_migrations/1734947817_created_tests.js b/pb_migrations/1734947817_created_tests.js deleted file mode 100644 index cf95fc66..00000000 --- a/pb_migrations/1734947817_created_tests.js +++ /dev/null @@ -1,67 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "m31x6zqgugf9yor", - "created": "2024-12-23 09:56:57.005Z", - "updated": "2024-12-23 09:56:57.005Z", - "name": "tests", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "wznp5aw5", - "name": "name", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 3, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "rvfexfeg", - "name": "description", - "type": "editor", - "required": false, - "presentable": false, - "unique": false, - "options": { - "convertUrls": false - } - }, - { - "system": false, - "id": "mvh8nhuf", - "name": "content", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 3, - "max": null, - "pattern": "" - } - } - ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "@request.auth.id != \"\"", - "updateRule": null, - "deleteRule": null, - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("m31x6zqgugf9yor"); - - return dao.deleteCollection(collection); -}) diff --git a/pb_migrations/1734951182_created_services.js b/pb_migrations/1734951182_created_services.js deleted file mode 100644 index 7dcfcdcd..00000000 --- a/pb_migrations/1734951182_created_services.js +++ /dev/null @@ -1,69 +0,0 @@ -/// -migrate((db) => { - const collection = new Collection({ - "id": "zxnrlx8sdr589dx", - "created": "2024-12-23 10:53:02.535Z", - "updated": "2024-12-23 10:53:02.535Z", - "name": "services", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "u5njqdn2", - "name": "name", - "type": "text", - "required": true, - "presentable": false, - "unique": false, - "options": { - "min": 3, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "cv21hi1u", - "name": "organization", - "type": "relation", - "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "kju0juul", - "name": "description", - "type": "editor", - "required": false, - "presentable": false, - "unique": false, - "options": { - "convertUrls": false - } - } - ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") ", - "updateRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") ", - "deleteRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") ", - "options": {} - }); - - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("zxnrlx8sdr589dx"); - - return dao.deleteCollection(collection); -}) From c31e55eaaca544ec0828493f2e462e53941643d2 Mon Sep 17 00:00:00 2001 From: Giovanni Abbatepaolo <30571828+bbtgnn@users.noreply.github.com> Date: Tue, 7 Jan 2025 18:26:17 +0100 Subject: [PATCH 04/14] feat: add starters schema --- migrations/pb_schema.json | 2816 +++++++++++++++++++++++-------------- 1 file changed, 1795 insertions(+), 1021 deletions(-) diff --git a/migrations/pb_schema.json b/migrations/pb_schema.json index c8720bce..59aa0cb3 100644 --- a/migrations/pb_schema.json +++ b/migrations/pb_schema.json @@ -1,1353 +1,2127 @@ [ { - "id": "_pb_users_auth_", - "name": "users", - "type": "auth", - "system": false, - "schema": [ + "createRule": null, + "deleteRule": null, + "fields": [ { - "system": false, - "id": "users_name", - "name": "name", - "type": "text", - "required": true, + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "primaryKey": true, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "users_avatar", - "name": "avatar", - "type": "file", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "j8mewfur", + "max": 0, + "min": 0, + "name": "collection", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - "image/webp" - ], - "thumbs": null, - "maxSelect": 1, - "maxSize": 22020096, - "protected": false - } - } - ], - "indexes": [ - "CREATE INDEX `__pb_users_auth__created_idx` ON `users` (`created`)" - ], - "listRule": "@request.auth.id != ''", - "viewRule": "@request.auth.id != ''", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": "id = @request.auth.id", - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": true, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "onlyVerified": false, - "requireEmail": false - } - }, - { - "id": "285guwyxvr46lsu", - "name": "authorizations", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "5jd5bhu8", - "name": "owner", - "type": "relation", + "primaryKey": false, "required": true, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "4xcxcfuv", + "maxSelect": 1, + "name": "event", "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } + "required": true, + "system": false, + "type": "select", + "values": ["insert", "update", "delete"] }, { + "hidden": false, + "id": "u3bmgjpb", + "maxSelect": 1, + "name": "action_type", + "presentable": false, + "required": true, "system": false, - "id": "w4xrqdgs", - "name": "users", - "type": "relation", + "type": "select", + "values": ["command", "post", "sendmail", "restroom-mw"] + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "kayyu1l3", + "max": 0, + "min": 0, + "name": "action", + "pattern": "", + "presentable": false, + "primaryKey": false, "required": true, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "zkengev8", + "max": 0, + "min": 0, + "name": "action_params", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": [] - } + "primaryKey": false, + "required": false, + "system": false, + "type": "text" }, { + "autogeneratePattern": "", + "hidden": false, + "id": "balsaeka", + "max": 0, + "min": 0, + "name": "expands", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": false, "system": false, - "id": "g1t9kpqo", - "name": "collection_id", - "type": "text", - "required": true, + "type": "text" + }, + { + "hidden": false, + "id": "emgxgcok", + "name": "disabled", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "required": false, + "system": false, + "type": "bool" }, { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, "system": false, - "id": "fqvzbaze", - "name": "record_id", - "type": "text", - "required": true, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "system": false, + "type": "autodate" } ], - "options": {} + "id": "3fhw2mfr9zrgodj", + "indexes": [ + "CREATE INDEX `_3fhw2mfr9zrgodj_created_idx` ON `hooks` (`created`)" + ], + "listRule": null, + "name": "hooks", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": null }, { - "id": "z4cc0g76ciqx13v", - "name": "features", - "type": "base", - "system": false, - "schema": [ + "createRule": null, + "deleteRule": null, + "fields": [ { - "system": false, + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, "id": "lj04bczn", + "max": 0, + "min": 0, "name": "name", - "type": "text", - "required": true, + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "primaryKey": false, + "required": true, + "system": false, + "type": "text" }, { - "system": false, + "hidden": false, "id": "yctafkxl", "name": "active", - "type": "bool", - "required": false, "presentable": false, - "unique": false, - "options": {} + "required": false, + "system": false, + "type": "bool" }, { - "system": false, + "hidden": false, "id": "yo3lch0p", + "maxSize": 2000000, "name": "envVariables", - "type": "json", + "presentable": false, "required": false, + "system": false, + "type": "json" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "maxSize": 2000000 - } + "system": false, + "type": "autodate" } ], + "id": "z4cc0g76ciqx13v", + "indexes": ["CREATE UNIQUE INDEX `idx_T3xOIQy` ON `features` (`name`)"], "listRule": "", - "viewRule": "", - "createRule": null, + "name": "features", + "system": false, + "type": "base", "updateRule": null, - "deleteRule": null, - "options": {} + "viewRule": "" }, { - "id": "3fhw2mfr9zrgodj", - "name": "hooks", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "j8mewfur", - "name": "collection", - "type": "text", + "createRule": "@request.auth.id != ''", + "deleteRule": "@request.auth.id = owner.id", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, "required": true, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "system": true, + "type": "text" }, { - "system": false, - "id": "4xcxcfuv", - "name": "event", - "type": "select", - "required": true, + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "5jd5bhu8", + "maxSelect": 1, + "minSelect": 0, + "name": "owner", "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "insert", - "update", - "delete" - ] - } + "required": true, + "system": false, + "type": "relation" }, { - "system": false, - "id": "u3bmgjpb", - "name": "action_type", - "type": "select", - "required": true, + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "w4xrqdgs", + "maxSelect": 2147483647, + "minSelect": 0, + "name": "users", "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "command", - "post", - "sendmail", - "restroom-mw" - ] - } + "required": true, + "system": false, + "type": "relation" }, { - "system": false, - "id": "kayyu1l3", - "name": "action", - "type": "text", - "required": true, + "autogeneratePattern": "", + "hidden": false, + "id": "g1t9kpqo", + "max": 0, + "min": 0, + "name": "collection_id", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "primaryKey": false, + "required": true, + "system": false, + "type": "text" }, { - "system": false, - "id": "zkengev8", - "name": "action_params", - "type": "text", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "fqvzbaze", + "max": 0, + "min": 0, + "name": "record_id", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "primaryKey": false, + "required": true, + "system": false, + "type": "text" }, { - "system": false, - "id": "balsaeka", - "name": "expands", - "type": "text", - "required": false, + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "system": false, + "type": "autodate" }, { - "system": false, - "id": "emgxgcok", - "name": "disabled", - "type": "bool", - "required": false, + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": {} + "system": false, + "type": "autodate" } ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} + "id": "285guwyxvr46lsu", + "indexes": [ + "CREATE UNIQUE INDEX `idx_w4uoK0u` ON `authorizations` (\n `owner`,\n `collection_id`,\n `record_id`\n)" + ], + "listRule": "@request.auth.id = owner.id || users.id ?= @request.auth.id", + "name": "authorizations", + "system": false, + "type": "base", + "updateRule": "@request.auth.id = owner.id", + "viewRule": "@request.auth.id = owner.id || users.id ?= @request.auth.id" }, { - "id": "k1vlx34o1x8tzno", - "name": "orgAuthorizations", - "type": "base", - "system": false, - "schema": [ + "createRule": null, + "deleteRule": null, + "fields": [ { - "system": false, - "id": "pzwwp3tf", - "name": "organization", - "type": "relation", - "required": true, + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": true, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "primaryKey": true, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "hlla24j5", + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "xdfemwi3", + "maxSelect": 1, + "minSelect": 0, "name": "user", - "type": "relation", - "required": true, "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "required": false, + "system": false, + "type": "relation" + }, + { + "hidden": false, + "id": "kds5s6oc", + "maxSize": 2000000, + "name": "session", + "presentable": false, + "required": false, + "system": false, + "type": "json" }, { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, "system": false, - "id": "nawal8qa", - "name": "role", - "type": "relation", - "required": true, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "collectionId": "pgsh9x4x20kdgjd", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "system": false, + "type": "autodate" } ], - "listRule": "", - "viewRule": "", - "options": {} + "id": "55roakey1q8vk77", + "indexes": [], + "listRule": null, + "name": "sessionDataWebauthn", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": null }, { - "id": "g7w0g7iqidynhim", - "name": "orgJoinRequests", - "type": "base", - "system": false, - "schema": [ + "createRule": null, + "deleteRule": "user.id = @request.auth.id", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, { - "system": false, - "id": "kj3nhvxx", + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "xootznbs", + "maxSelect": 1, + "minSelect": 0, "name": "user", - "type": "relation", - "required": true, "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "required": false, + "system": false, + "type": "relation" }, { + "hidden": false, + "id": "of3px3ud", + "maxSize": 2000000, + "name": "credential", + "presentable": false, + "required": false, "system": false, - "id": "dfgtbvkp", - "name": "organization", - "type": "relation", - "required": true, + "type": "json" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "gfynehdb", + "max": 0, + "min": 0, + "name": "description", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": true, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "primaryKey": false, + "required": false, + "system": false, + "type": "text" }, { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, "system": false, - "id": "l5dq93vm", - "name": "status", - "type": "select", + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + } + ], + "id": "nopzrf0n7mbfu58", + "indexes": [ + "CREATE INDEX `idx_p4OsklQ` ON `webauthnCredentials` (`user`)" + ], + "listRule": "user.id = @request.auth.id", + "name": "webauthnCredentials", + "system": false, + "type": "base", + "updateRule": "user.id = @request.auth.id", + "viewRule": "user.id = @request.auth.id" + }, + { + "createRule": "@request.auth.id != ''", + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "de5ifbee", + "max": 0, + "min": 2, + "name": "name", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "pending", - "accepted", - "rejected", - "blocked" - ] - } + "primaryKey": false, + "required": true, + "system": false, + "type": "text" }, { + "hidden": false, + "id": "zhuxbrib", + "maxSelect": 1, + "maxSize": 5242880, + "mimeTypes": [ + "image/png", + "image/jpeg", + "image/webp", + "image/svg+xml" + ], + "name": "avatar", + "presentable": false, + "protected": false, + "required": false, "system": false, - "id": "fhyjwtkm", - "name": "reminders", - "type": "number", + "thumbs": null, + "type": "file" + }, + { + "convertURLs": false, + "hidden": false, + "id": "pjjpq1r4", + "maxSize": 0, + "name": "description", + "presentable": false, "required": false, + "system": false, + "type": "editor" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": true - } + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" } ], - "options": {} + "id": "aako88kt3br4npt", + "indexes": [ + "CREATE UNIQUE INDEX `idx_PHN81EZ` ON `organizations` (`name`)" + ], + "listRule": "", + "name": "organizations", + "system": false, + "type": "base", + "updateRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= id &&\n@collection.orgAuthorizations.role.name ?= \"owner\"", + "viewRule": "" }, { - "id": "pgsh9x4x20kdgjd", - "name": "orgRoles", - "type": "base", - "system": false, - "schema": [ + "createRule": null, + "deleteRule": null, + "fields": [ { - "system": false, + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, "id": "ewo9sxda", + "max": 0, + "min": 0, "name": "name", - "type": "text", - "required": true, + "pattern": "^[a-z_]+$", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "^[a-z_]+$" - } + "primaryKey": false, + "required": true, + "system": false, + "type": "text" }, { - "system": false, + "hidden": false, "id": "xcrt6mly", + "max": null, + "min": 0, "name": "level", - "type": "number", + "onlyInt": true, + "presentable": false, "required": false, + "system": false, + "type": "number" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "min": 0, - "max": null, - "noDecimal": true - } + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" } ], + "id": "pgsh9x4x20kdgjd", + "indexes": ["CREATE INDEX `idx_tuBFjhq` ON `orgRoles` (`name`)"], "listRule": "", - "viewRule": "", - "createRule": null, + "name": "orgRoles", + "system": false, + "type": "base", "updateRule": null, - "deleteRule": null, - "options": {} + "viewRule": "" }, { - "id": "v12xstc3xygpawh", - "name": "org_invites", - "type": "base", - "system": false, - "schema": [ + "createRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")", + "deleteRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, { - "system": false, - "id": "7yfkzy39", + "cascadeDelete": true, + "collectionId": "aako88kt3br4npt", + "hidden": false, + "id": "pzwwp3tf", + "maxSelect": 1, + "minSelect": 0, "name": "organization", - "type": "relation", - "required": true, "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "required": true, + "system": false, + "type": "relation" }, { - "system": false, - "id": "32axfwku", + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "hlla24j5", + "maxSelect": 1, + "minSelect": 0, "name": "user", - "type": "relation", - "required": false, "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "required": true, + "system": false, + "type": "relation" }, { - "system": false, - "id": "gbqnjiwb", - "name": "user_email", - "type": "email", - "required": false, + "cascadeDelete": false, + "collectionId": "pgsh9x4x20kdgjd", + "hidden": false, + "id": "nawal8qa", + "maxSelect": 1, + "minSelect": 0, + "name": "role", "presentable": false, - "unique": false, - "options": { - "exceptDomains": [], - "onlyDomains": [] - } + "required": true, + "system": false, + "type": "relation" }, { - "system": false, - "id": "6stxg7b7", - "name": "failed_email_send", - "type": "bool", - "required": false, + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": {} + "system": false, + "type": "autodate" }, { - "system": false, - "id": "gtmrpmp3", - "name": "declined", - "type": "bool", - "required": false, + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": {} + "system": false, + "type": "autodate" } ], - "options": {} + "id": "k1vlx34o1x8tzno", + "indexes": [ + "CREATE UNIQUE INDEX `idx_ik2InMV` ON `orgAuthorizations` (\n `organization`,\n `user`\n)" + ], + "listRule": "", + "name": "orgAuthorizations", + "system": false, + "type": "base", + "updateRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n(@collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")", + "viewRule": "" }, { - "id": "aako88kt3br4npt", - "name": "organizations", - "type": "base", - "system": false, - "schema": [ + "createRule": "@request.auth.id != \"\"", + "deleteRule": "user.id = @request.auth.id", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, { - "system": false, - "id": "de5ifbee", - "name": "name", - "type": "text", + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "kj3nhvxx", + "maxSelect": 1, + "minSelect": 0, + "name": "user", + "presentable": false, "required": true, + "system": false, + "type": "relation" + }, + { + "cascadeDelete": true, + "collectionId": "aako88kt3br4npt", + "hidden": false, + "id": "dfgtbvkp", + "maxSelect": 1, + "minSelect": 0, + "name": "organization", "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": null, - "pattern": "" - } + "required": true, + "system": false, + "type": "relation" }, { + "hidden": false, + "id": "l5dq93vm", + "maxSelect": 1, + "name": "status", + "presentable": false, + "required": true, "system": false, - "id": "zhuxbrib", - "name": "avatar", - "type": "file", - "required": false, + "type": "select", + "values": ["pending", "accepted", "rejected", "blocked"] + }, + { + "hidden": false, + "id": "fhyjwtkm", + "max": null, + "min": null, + "name": "reminders", + "onlyInt": true, "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "image/png", - "image/jpeg", - "image/webp", - "image/svg+xml" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": false - } + "required": false, + "system": false, + "type": "number" }, { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, "system": false, - "id": "pjjpq1r4", - "name": "description", - "type": "editor", - "required": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "convertUrls": false - } + "system": false, + "type": "autodate" } ], - "listRule": "", - "viewRule": "", - "createRule": "@request.auth.id != ''", - "deleteRule": null, - "options": {} + "id": "g7w0g7iqidynhim", + "indexes": [ + "CREATE UNIQUE INDEX `idx_H6SZMtG` ON `orgJoinRequests` (\n `user`,\n `organization`\n)" + ], + "listRule": "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)", + "name": "orgJoinRequests", + "system": false, + "type": "base", + "updateRule": "@request.body.organization:isset = false &&\n@request.body.user:isset = false &&\n@request.body.reminders:isset = false &&\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)", + "viewRule": "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" ||\n @collection.orgAuthorizations.role.name ?= \"owner\" )\n)" }, { - "id": "zxnrlx8sdr589dx", - "name": "services", - "type": "base", - "system": false, - "schema": [ + "createRule": "owner.id = @request.auth.id", + "deleteRule": null, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "rylpn1gv", + "maxSelect": 1, + "minSelect": 0, + "name": "owner", + "presentable": false, + "required": true, "system": false, - "id": "u5njqdn2", - "name": "name", - "type": "text", + "type": "relation" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "t65tksny", + "max": 0, + "min": 0, + "name": "bitcoin_public_key", + "pattern": "", + "presentable": false, + "primaryKey": false, "required": true, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "tnshwyg9", + "max": 0, + "min": 0, + "name": "ecdh_public_key", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": 3, - "max": null, - "pattern": "" - } + "primaryKey": false, + "required": true, + "system": false, + "type": "text" }, { + "autogeneratePattern": "", + "hidden": false, + "id": "xwkg2zsb", + "max": 0, + "min": 0, + "name": "eddsa_public_key", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, "system": false, - "id": "cv21hi1u", - "name": "organization", - "type": "relation", + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "ygmmntyo", + "max": 0, + "min": 0, + "name": "ethereum_address", + "pattern": "", + "presentable": false, + "primaryKey": false, "required": true, + "system": false, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "pz24o3ls", + "max": 0, + "min": 0, + "name": "reflow_public_key", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "primaryKey": false, + "required": true, + "system": false, + "type": "text" }, { + "autogeneratePattern": "", + "hidden": false, + "id": "qg6jnudd", + "max": 0, + "min": 0, + "name": "es256_public_key", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, "system": false, - "id": "kju0juul", - "name": "description", - "type": "editor", - "required": false, + "type": "text" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "convertUrls": false - } + "system": false, + "type": "autodate" } ], + "id": "7bmyedethjhr1ir", "indexes": [], "listRule": "", - "viewRule": "", - "options": {} + "name": "users_public_keys", + "system": false, + "type": "base", + "updateRule": null, + "viewRule": "" }, { - "id": "55roakey1q8vk77", - "name": "sessionDataWebauthn", - "type": "base", - "system": false, - "schema": [ + "createRule": "", + "deleteRule": "", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, { + "autogeneratePattern": "", + "hidden": false, + "id": "dyxsckke", + "max": 10, + "min": 2, + "name": "text_field", + "pattern": "", + "presentable": false, + "primaryKey": false, + "required": true, "system": false, - "id": "xdfemwi3", - "name": "user", - "type": "relation", + "type": "text" + }, + { + "exceptDomains": null, + "hidden": false, + "id": "5nakh5br", + "name": "url_field", + "onlyDomains": ["uld.com"], + "presentable": false, "required": false, + "system": false, + "type": "url" + }, + { + "hidden": false, + "id": "zjaakeak", + "max": 70, + "min": 2, + "name": "number_field", + "onlyInt": true, "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } + "required": true, + "system": false, + "type": "number" }, { + "hidden": false, + "id": "plf9bqlo", + "name": "boolean_field", + "presentable": false, + "required": false, "system": false, - "id": "kds5s6oc", - "name": "session", - "type": "json", + "type": "bool" + }, + { + "convertURLs": true, + "hidden": false, + "id": "o9i7jdyx", + "maxSize": 0, + "name": "richtext_field", + "presentable": false, + "required": true, + "system": false, + "type": "editor" + }, + { + "exceptDomains": ["mat.cos"], + "hidden": false, + "id": "euflpigq", + "name": "email_field", + "onlyDomains": null, + "presentable": false, "required": false, + "system": false, + "type": "email" + }, + { + "hidden": false, + "id": "r6bk98mc", + "max": "2024-07-28 12:00:00.000Z", + "min": "2024-07-18 12:00:00.000Z", + "name": "date_field", "presentable": false, - "unique": false, - "options": { - "maxSize": 2000000 - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "c66aipq8fvzcwk9", - "name": "standards", - "type": "base", - "system": false, - "schema": [ + "required": false, + "system": false, + "type": "date" + }, { + "hidden": false, + "id": "jnvj44gc", + "maxSelect": 1, + "name": "select_field", + "presentable": false, + "required": false, "system": false, - "id": "5o3gcmzu", - "name": "version", - "type": "text", + "type": "select", + "values": ["a", "b", "c"] + }, + { + "hidden": false, + "id": "wlqgr8z3", + "maxSelect": 2, + "name": "select_multi_field", + "presentable": false, "required": false, + "system": false, + "type": "select", + "values": ["x", "y", "z"] + }, + { + "hidden": false, + "id": "ldafagmk", + "maxSelect": 1, + "maxSize": 5242880, + "mimeTypes": ["text/plain"], + "name": "file_field", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "protected": true, + "required": false, + "system": false, + "thumbs": null, + "type": "file" }, { + "hidden": false, + "id": "ctqisupe", + "maxSelect": 3, + "maxSize": 5242880, + "mimeTypes": ["text/plain"], + "name": "file_multi_field", + "presentable": false, + "protected": false, + "required": false, "system": false, - "id": "zg0ytf26", - "name": "specification", - "type": "url", + "thumbs": null, + "type": "file" + }, + { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "dmehmjlp", + "maxSelect": 4, + "minSelect": 1, + "name": "relation_multi_field", + "presentable": false, + "required": true, + "system": false, + "type": "relation" + }, + { + "hidden": false, + "id": "wj9awedr", + "maxSize": 2000000, + "name": "json_field", + "presentable": false, "required": false, + "system": false, + "type": "json" + }, + { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "rwghvhbv", + "maxSelect": 1, + "minSelect": 0, + "name": "relation_field", "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null - } + "required": true, + "system": false, + "type": "relation" }, { + "cascadeDelete": false, + "collectionId": "ktjgpqf146ss2ia", + "hidden": false, + "id": "irg7eqrq", + "maxSelect": 1, + "minSelect": 0, + "name": "self_relation", + "presentable": false, + "required": false, "system": false, - "id": "5xeugad8", - "name": "description", - "type": "text", + "type": "relation" + }, + { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "7d3zwah8", + "maxSelect": 1, + "minSelect": 0, + "name": "owner", + "presentable": false, "required": false, + "system": false, + "type": "relation" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "moejq2ra", + "max": 0, + "min": 0, + "name": "text_with_regex", + "pattern": "^\\w+$", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "primaryKey": false, + "required": false, + "system": false, + "type": "text" }, { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, "system": false, - "id": "qrxbfpdw", - "name": "name", - "type": "text", + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" + } + ], + "id": "ktjgpqf146ss2ia", + "indexes": [], + "listRule": "owner = null ||\n( owner != null && (\n owner.id = @request.auth.id ||\n ( @collection.authorizations.record_id = id &&\n @collection.authorizations.users.id ?= @request.auth.id &&\n @collection.authorizations.owner.id ?= owner.id )\n )\n)", + "name": "z_test_collection", + "system": false, + "type": "base", + "updateRule": "", + "viewRule": "owner = null ||\n( owner != null && (\n owner.id = @request.auth.id ||\n ( @collection.authorizations.record_id = id &&\n @collection.authorizations.users.id ?= @request.auth.id &&\n @collection.authorizations.owner.id ?= owner.id )\n )\n)" + }, + { + "createRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") ", + "deleteRule": "@collection.orgAuthorizations.user.id ?= @request.auth.id &&\n@collection.orgAuthorizations.organization.id ?= organization.id &&\n( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\")", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, + { + "cascadeDelete": false, + "collectionId": "aako88kt3br4npt", + "hidden": false, + "id": "7yfkzy39", + "maxSelect": 1, + "minSelect": 0, + "name": "organization", + "presentable": false, + "required": true, + "system": false, + "type": "relation" + }, + { + "cascadeDelete": false, + "collectionId": "_pb_users_auth_", + "hidden": false, + "id": "32axfwku", + "maxSelect": 1, + "minSelect": 0, + "name": "user", + "presentable": false, "required": false, + "system": false, + "type": "relation" + }, + { + "exceptDomains": null, + "hidden": false, + "id": "gbqnjiwb", + "name": "user_email", + "onlyDomains": null, "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "required": false, + "system": false, + "type": "email" }, { + "hidden": false, + "id": "6stxg7b7", + "name": "failed_email_send", + "presentable": false, + "required": false, "system": false, - "id": "nxb3xxnu", - "name": "last_update", - "type": "date", + "type": "bool" + }, + { + "hidden": false, + "id": "gtmrpmp3", + "name": "declined", + "presentable": false, "required": false, + "system": false, + "type": "bool" + }, + { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "min": "", - "max": "" - } + "system": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, + "presentable": false, + "system": false, + "type": "autodate" } ], - "listRule": null, - "viewRule": null, - "createRule": null, + "id": "v12xstc3xygpawh", + "indexes": [ + "CREATE UNIQUE INDEX `idx_xyC4d4D` ON `org_invites` (\n `user_email`,\n `organization`\n)" + ], + "listRule": "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") )", + "name": "org_invites", + "system": false, + "type": "base", "updateRule": null, - "deleteRule": null, - "options": {} + "viewRule": "user.id = @request.auth.id ||\n( @collection.orgAuthorizations.user.id ?= @request.auth.id &&\n @collection.orgAuthorizations.organization.id ?= organization.id &&\n ( @collection.orgAuthorizations.role.name ?= \"admin\" || \n @collection.orgAuthorizations.role.name ?= \"owner\") )" }, { - "id": "m31x6zqgugf9yor", - "name": "tests", - "type": "base", - "system": false, - "schema": [ + "authAlert": { + "emailTemplate": { + "body": "

Hello,

\n

We noticed a login to your {APP_NAME} account from a new location.

\n

If this was you, you may disregard this email.

\n

If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Login from a new location" + }, + "enabled": true + }, + "authRule": "", + "authToken": { + "duration": 1209600 + }, + "confirmEmailChangeTemplate": { + "body": "

Hello,

\n

Click on the button below to confirm your new email address.

\n

\n Confirm new email\n

\n

If you didn't ask to change your email address, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Confirm your {APP_NAME} new email address" + }, + "createRule": "", + "deleteRule": "id = @request.auth.id", + "emailChangeToken": { + "duration": 1800 + }, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, { - "system": false, - "id": "wznp5aw5", - "name": "name", - "type": "text", + "cost": 10, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 8, + "name": "password", + "pattern": "", + "presentable": false, + "required": true, + "system": true, + "type": "password" + }, + { + "autogeneratePattern": "[a-zA-Z0-9_]{50}", + "hidden": true, + "id": "text2504183744", + "max": 60, + "min": 30, + "name": "tokenKey", + "pattern": "", + "presentable": false, + "primaryKey": false, "required": true, + "system": true, + "type": "text" + }, + { + "exceptDomains": null, + "hidden": false, + "id": "email3885137012", + "name": "email", + "onlyDomains": null, + "presentable": false, + "required": false, + "system": true, + "type": "email" + }, + { + "hidden": false, + "id": "bool1547992806", + "name": "emailVisibility", "presentable": false, - "unique": false, - "options": { - "min": 3, - "max": null, - "pattern": "" - } + "required": false, + "system": true, + "type": "bool" }, { - "system": false, - "id": "rvfexfeg", - "name": "description", - "type": "editor", - "required": false, + "hidden": false, + "id": "bool256245529", + "name": "verified", "presentable": false, - "unique": false, - "options": { - "convertUrls": false - } + "required": false, + "system": true, + "type": "bool" }, { + "autogeneratePattern": "users[0-9]{6}", + "hidden": false, + "id": "text4166911607", + "max": 150, + "min": 3, + "name": "username", + "pattern": "^[\\w][\\w\\.\\-]*$", + "presentable": false, + "primaryKey": false, + "required": true, "system": false, - "id": "mvh8nhuf", - "name": "content", - "type": "text", + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "users_name", + "max": 0, + "min": 0, + "name": "name", + "pattern": "", + "presentable": false, + "primaryKey": false, "required": true, + "system": false, + "type": "text" + }, + { + "hidden": false, + "id": "users_avatar", + "maxSelect": 1, + "maxSize": 22020096, + "mimeTypes": [ + "image/jpeg", + "image/png", + "image/svg+xml", + "image/gif", + "image/webp" + ], + "name": "avatar", "presentable": false, - "unique": false, - "options": { - "min": 3, - "max": null, - "pattern": "" - } + "protected": false, + "required": false, + "system": false, + "thumbs": null, + "type": "file" }, { + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, + "presentable": false, "system": false, - "id": "4pn3e4rw", - "name": "standard", - "type": "relation", - "required": false, + "type": "autodate" + }, + { + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "collectionId": "c66aipq8fvzcwk9", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": null, - "displayFields": null - } + "system": false, + "type": "autodate" } ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "@request.auth.id != \"\"", - "updateRule": null, - "deleteRule": null, - "options": {} + "fileToken": { + "duration": 120 + }, + "id": "_pb_users_auth_", + "indexes": [ + "CREATE UNIQUE INDEX `__pb_users_auth__username_idx` ON `users` (username COLLATE NOCASE)", + "CREATE UNIQUE INDEX `__pb_users_auth__email_idx` ON `users` (`email`) WHERE `email` != ''", + "CREATE UNIQUE INDEX `__pb_users_auth__tokenKey_idx` ON `users` (`tokenKey`)", + "CREATE INDEX `__pb_users_auth__created_idx` ON `users` (`created`)" + ], + "listRule": "@request.auth.id != ''", + "manageRule": null, + "mfa": { + "duration": 1800, + "enabled": false, + "rule": "" + }, + "name": "users", + "oauth2": { + "enabled": false, + "mappedFields": { + "avatarURL": "", + "id": "", + "name": "", + "username": "username" + } + }, + "otp": { + "duration": 180, + "emailTemplate": { + "body": "

Hello,

\n

Your one-time password is: {OTP}

\n

If you didn't ask for the one-time password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "OTP for {APP_NAME}" + }, + "enabled": false, + "length": 8 + }, + "passwordAuth": { + "enabled": true, + "identityFields": ["email", "username"] + }, + "passwordResetToken": { + "duration": 1800 + }, + "resetPasswordTemplate": { + "body": "

Hello,

\n

Click on the button below to reset your password.

\n

\n Reset password\n

\n

If you didn't ask to reset your password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Reset your {APP_NAME} password" + }, + "system": false, + "type": "auth", + "updateRule": "id = @request.auth.id", + "verificationTemplate": { + "body": "

Hello,

\n

Thank you for joining us at {APP_NAME}.

\n

Click on the button below to verify your email address.

\n

\n Verify\n

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Verify your {APP_NAME} email" + }, + "verificationToken": { + "duration": 604800 + }, + "viewRule": "@request.auth.id != ''" }, { - "id": "7bmyedethjhr1ir", - "name": "users_public_keys", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "rylpn1gv", - "name": "owner", - "type": "relation", + "authAlert": { + "emailTemplate": { + "body": "

Hello,

\n

We noticed a login to your {APP_NAME} account from a new location.

\n

If this was you, you may disregard this email.

\n

If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Login from a new location" + }, + "enabled": true + }, + "authRule": "", + "authToken": { + "duration": 1209600 + }, + "confirmEmailChangeTemplate": { + "body": "

Hello,

\n

Click on the button below to confirm your new email address.

\n

\n Confirm new email\n

\n

If you didn't ask to change your email address, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Confirm your {APP_NAME} new email address" + }, + "createRule": null, + "deleteRule": null, + "emailChangeToken": { + "duration": 1800 + }, + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, "required": true, - "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "system": true, + "type": "text" }, { - "system": false, - "id": "t65tksny", - "name": "bitcoin_public_key", - "type": "text", - "required": true, + "cost": 0, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 8, + "name": "password", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "required": true, + "system": true, + "type": "password" }, { - "system": false, - "id": "tnshwyg9", - "name": "ecdh_public_key", - "type": "text", - "required": true, + "autogeneratePattern": "[a-zA-Z0-9]{50}", + "hidden": true, + "id": "text2504183744", + "max": 60, + "min": 30, + "name": "tokenKey", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "xwkg2zsb", - "name": "eddsa_public_key", - "type": "text", + "exceptDomains": null, + "hidden": false, + "id": "email3885137012", + "name": "email", + "onlyDomains": null, + "presentable": false, "required": true, + "system": true, + "type": "email" + }, + { + "hidden": false, + "id": "bool1547992806", + "name": "emailVisibility", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "required": false, + "system": true, + "type": "bool" }, { - "system": false, - "id": "ygmmntyo", - "name": "ethereum_address", - "type": "text", - "required": true, + "hidden": false, + "id": "bool256245529", + "name": "verified", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "required": false, + "system": true, + "type": "bool" }, { - "system": false, - "id": "pz24o3ls", - "name": "reflow_public_key", - "type": "text", - "required": true, + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "system": true, + "type": "autodate" }, { - "system": false, - "id": "qg6jnudd", - "name": "es256_public_key", - "type": "text", - "required": true, + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } + "system": true, + "type": "autodate" } ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "", + "fileToken": { + "duration": 120 + }, + "id": "pbc_3142635823", + "indexes": [ + "CREATE UNIQUE INDEX `idx_tokenKey_pbc_3142635823` ON `_superusers` (`tokenKey`)", + "CREATE UNIQUE INDEX `idx_email_pbc_3142635823` ON `_superusers` (`email`) WHERE `email` != ''" + ], + "listRule": null, + "manageRule": null, + "mfa": { + "duration": 1800, + "enabled": false, + "rule": "" + }, + "name": "_superusers", + "oauth2": { + "enabled": false, + "mappedFields": { + "avatarURL": "", + "id": "", + "name": "", + "username": "" + } + }, + "otp": { + "duration": 180, + "emailTemplate": { + "body": "

Hello,

\n

Your one-time password is: {OTP}

\n

If you didn't ask for the one-time password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "OTP for {APP_NAME}" + }, + "enabled": false, + "length": 8 + }, + "passwordAuth": { + "enabled": true, + "identityFields": ["email"] + }, + "passwordResetToken": { + "duration": 1800 + }, + "resetPasswordTemplate": { + "body": "

Hello,

\n

Click on the button below to reset your password.

\n

\n Reset password\n

\n

If you didn't ask to reset your password, you can ignore this email.

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Reset your {APP_NAME} password" + }, + "system": true, + "type": "auth", "updateRule": null, - "deleteRule": null, - "options": {} + "verificationTemplate": { + "body": "

Hello,

\n

Thank you for joining us at {APP_NAME}.

\n

Click on the button below to verify your email address.

\n

\n Verify\n

\n

\n Thanks,
\n {APP_NAME} team\n

", + "subject": "Verify your {APP_NAME} email" + }, + "verificationToken": { + "duration": 259200 + }, + "viewRule": null }, { - "id": "nopzrf0n7mbfu58", - "name": "webauthnCredentials", - "type": "base", - "system": false, - "schema": [ + "createRule": null, + "deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" + }, { - "system": false, - "id": "xootznbs", - "name": "user", - "type": "relation", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "of3px3ud", - "name": "credential", - "type": "json", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "maxSize": 2000000 - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "gfynehdb", - "name": "description", - "type": "text", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text2462348188", + "max": 0, + "min": 0, + "name": "provider", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "options": {} - }, - { - "id": "xsmisoxjnzdkoc1", - "name": "workflows", - "type": "base", - "system": false, - "schema": [ + "primaryKey": false, + "required": true, + "system": true, + "type": "text" + }, { - "system": false, - "id": "mb7wgtx5", - "name": "status", - "type": "select", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text1044722854", + "max": 0, + "min": 0, + "name": "providerId", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "DONE", - "RUNNING", - "ERROR" - ] - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "bpvexuus", - "name": "organization", - "type": "relation", - "required": false, + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "collectionId": "aako88kt3br4npt", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "system": true, + "type": "autodate" }, { - "system": false, - "id": "pljvqncw", - "name": "test", - "type": "relation", - "required": false, + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "collectionId": "m31x6zqgugf9yor", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "system": true, + "type": "autodate" } ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, + "id": "pbc_2281828961", + "indexes": [ + "CREATE UNIQUE INDEX `idx_externalAuths_record_provider` ON `_externalAuths` (collectionRef, recordRef, provider)", + "CREATE UNIQUE INDEX `idx_externalAuths_collection_provider` ON `_externalAuths` (collectionRef, provider, providerId)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_externalAuths", + "system": true, + "type": "base", "updateRule": null, - "deleteRule": null, - "options": {} + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" }, { - "id": "ktjgpqf146ss2ia", - "name": "z_test_collection", - "type": "base", - "system": false, - "schema": [ + "createRule": null, + "deleteRule": null, + "fields": [ { - "system": false, - "id": "dyxsckke", - "name": "text_field", - "type": "text", - "required": true, + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 10, - "pattern": "" - } + "primaryKey": true, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "5nakh5br", - "name": "url_field", - "type": "url", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "exceptDomains": [], - "onlyDomains": [ - "uld.com" - ] - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "zjaakeak", - "name": "number_field", - "type": "number", - "required": true, + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "min": 2, - "max": 70, - "noDecimal": true - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "plf9bqlo", - "name": "boolean_field", - "type": "bool", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text1582905952", + "max": 0, + "min": 0, + "name": "method", + "pattern": "", "presentable": false, - "unique": false, - "options": {} + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "o9i7jdyx", - "name": "richtext_field", - "type": "editor", - "required": true, + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "convertUrls": true - } + "system": true, + "type": "autodate" }, { - "system": false, - "id": "euflpigq", - "name": "email_field", - "type": "email", - "required": false, + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "exceptDomains": [ - "mat.cos" - ], - "onlyDomains": [] - } - }, + "system": true, + "type": "autodate" + } + ], + "id": "pbc_2279338944", + "indexes": [ + "CREATE INDEX `idx_mfas_collectionRef_recordRef` ON `_mfas` (collectionRef,recordRef)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_mfas", + "system": true, + "type": "base", + "updateRule": null, + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" + }, + { + "createRule": null, + "deleteRule": null, + "fields": [ { - "system": false, - "id": "r6bk98mc", - "name": "date_field", - "type": "date", - "required": false, + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", "presentable": false, - "unique": false, - "options": { - "min": "2024-07-18 12:00:00.000Z", - "max": "2024-07-28 12:00:00.000Z" - } + "primaryKey": true, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "jnvj44gc", - "name": "select_field", - "type": "select", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "maxSelect": 1, - "values": [ - "a", - "b", - "c" - ] - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "wlqgr8z3", - "name": "select_multi_field", - "type": "select", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "maxSelect": 2, - "values": [ - "x", - "y", - "z" - ] - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "ldafagmk", - "name": "file_field", - "type": "file", - "required": false, + "cost": 8, + "hidden": true, + "id": "password901924565", + "max": 0, + "min": 0, + "name": "password", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 1, - "maxSize": 5242880, - "protected": true - } + "required": true, + "system": true, + "type": "password" }, { - "system": false, - "id": "ctqisupe", - "name": "file_multi_field", - "type": "file", - "required": false, + "autogeneratePattern": "", + "hidden": true, + "id": "text3866985172", + "max": 0, + "min": 0, + "name": "sentTo", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "mimeTypes": [ - "text/plain" - ], - "thumbs": [], - "maxSelect": 3, - "maxSize": 5242880, - "protected": false - } + "primaryKey": false, + "required": false, + "system": true, + "type": "text" }, { - "system": false, - "id": "dmehmjlp", - "name": "relation_multi_field", - "type": "relation", - "required": true, + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": 1, - "maxSelect": 4, - "displayFields": null - } + "system": true, + "type": "autodate" }, { - "system": false, - "id": "wj9awedr", - "name": "json_field", - "type": "json", - "required": false, + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "maxSize": 2000000 - } + "system": true, + "type": "autodate" + } + ], + "id": "pbc_1638494021", + "indexes": [ + "CREATE INDEX `idx_otps_collectionRef_recordRef` ON `_otps` (collectionRef, recordRef)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_otps", + "system": true, + "type": "base", + "updateRule": null, + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" + }, + { + "createRule": null, + "deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "fields": [ + { + "autogeneratePattern": "[a-z0-9]{15}", + "hidden": false, + "id": "text3208210256", + "max": 15, + "min": 15, + "name": "id", + "pattern": "^[a-z0-9]+$", + "presentable": false, + "primaryKey": true, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "rwghvhbv", - "name": "relation_field", - "type": "relation", + "autogeneratePattern": "", + "hidden": false, + "id": "text455797646", + "max": 0, + "min": 0, + "name": "collectionRef", + "pattern": "", + "presentable": false, + "primaryKey": false, "required": true, + "system": true, + "type": "text" + }, + { + "autogeneratePattern": "", + "hidden": false, + "id": "text127846527", + "max": 0, + "min": 0, + "name": "recordRef", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "irg7eqrq", - "name": "self_relation", - "type": "relation", - "required": false, + "autogeneratePattern": "", + "hidden": false, + "id": "text4228609354", + "max": 0, + "min": 0, + "name": "fingerprint", + "pattern": "", "presentable": false, - "unique": false, - "options": { - "collectionId": "ktjgpqf146ss2ia", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "primaryKey": false, + "required": true, + "system": true, + "type": "text" }, { - "system": false, - "id": "7d3zwah8", - "name": "owner", - "type": "relation", - "required": false, + "hidden": false, + "id": "autodate2990389176", + "name": "created", + "onCreate": true, + "onUpdate": false, "presentable": false, - "unique": false, - "options": { - "collectionId": "_pb_users_auth_", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } + "system": true, + "type": "autodate" }, { - "system": false, - "id": "moejq2ra", - "name": "text_with_regex", - "type": "text", - "required": false, + "hidden": false, + "id": "autodate3332085495", + "name": "updated", + "onCreate": true, + "onUpdate": true, "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "^\\w+$" - } + "system": true, + "type": "autodate" } ], - "indexes": [], - "createRule": "", - "updateRule": "", - "deleteRule": "", - "options": {} + "id": "pbc_4275539003", + "indexes": [ + "CREATE UNIQUE INDEX `idx_authOrigins_unique_pairs` ON `_authOrigins` (collectionRef, recordRef, fingerprint)" + ], + "listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId", + "name": "_authOrigins", + "system": true, + "type": "base", + "updateRule": null, + "viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId" } ] From 120e1b635d71b302b2dad7a5541f25796acfd95e Mon Sep 17 00:00:00 2001 From: Giovanni Abbatepaolo <30571828+bbtgnn@users.noreply.github.com> Date: Tue, 7 Jan 2025 18:31:14 +0100 Subject: [PATCH 05/14] chore: update pocketbase sdk --- webapp/bun.lockb | Bin 290837 -> 290837 bytes webapp/package.json | 200 ++++++++++++++++++++++---------------------- 2 files changed, 100 insertions(+), 100 deletions(-) diff --git a/webapp/bun.lockb b/webapp/bun.lockb index cc3b47a947b478378138f147b91907c731f9d25b..cd8998bc1ca545e429745e994de1662847c7f49f 100755 GIT binary patch delta 159 zcmV;Q0AT->;1QMJ5s)q*1~SmDihlCr=oU%=`W}A(N|FVF;xrFTLGD#r_18{*u}*d~ z0U49AEi04oEeNytGyUU0#kk@?Z|$BPhq5+nO>Wr`kP^OLA(&tR;UPjDH#uGKrztmuCyDwhcy@hw>207QQ-$LE;2O$006g*`2tRx N12rx%x89TkH`~5-MbQ8N delta 153 zcmV;K0A~M{;1QMJ5s)q*^{5Q$)!DKXh;#@c9irb#M}dbL#+*1Kb6u}*d~ zlf+*%v-mUp<3Mh5Ke{RBLYqDkRHe@u9OEnSxglRE$}G$~S0DZmPhnvit)?YaFAiL1 z`nb_uS?y9Y-0x~WF| diff --git a/webapp/package.json b/webapp/package.json index fd3cdefd..d12b4c28 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,102 +1,102 @@ { - "name": "DIDimo - webapp", - "author": { - "name": "Forkbomb", - "email": "info@forkbomb.com" - }, - "description": "Your trustworthy compliance checker for decentralized identity solutions", - "version": "0.0.1", - "type": "module", - "engines": { - "node": ">=17", - "pnpm": ">=8" - }, - "scripts": { - "predev": "bun run generate:definitions", - "dev": "vite dev", - "prebuild": "bun run generate:definitions", - "build": "vite build", - "bin": "bun run build && bun build --compile --minify-whitespace --minify-syntax --target bun --outfile didimo-ui ./build/index.js", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "format": "prettier --write .", - "lint": "prettier --check . && eslint .", - "test:unit": "vitest", - "test": "bun run test:unit -- --run && bun run test:e2e", - "test:e2e": "playwright test", - "test:e2e:ui": "playwright test --ui", - "serve": "bun run build && bun run preview --host", - "vite-run": "node ./vite-run.js", - "generate:types": "npx pocketbase-typegen@1.2.1 --db ../pb_data/data.db --out src/modules/pocketbase/types/index.generated.ts && bun run generate:types-extra", - "generate:types-extra": "bun run vite-run src/modules/pocketbase/types/generate.types-extra.ts", - "generate:features": "bun run vite-run src/modules/features/generate.features-list.ts", - "generate:roles": "bun run vite-run ./src/modules/organizations/generate.roles-list.ts", - "generate:collections-models": "bun run vite-run ./src/modules/pocketbase/collections-models/generate.collections-models.ts", - "generate:definitions": "bun run generate:collections-models && bun run generate:types && bun run generate:features && bun run generate:roles", - "i18n:remove-unused-strings": "bun run vite-run ./src/modules/i18n/remove-unused-strings.ts", - "i18n:lint": "bun run inlang lint --project ./project.inlang", - "i18n:lint:en": "bun run inlang lint --project ./project.inlang --languageTags en", - "emails": "rm -rf static/emails/* && mkdir -p static/emails && find ./ -name _components -prune -o -name '*.mjml' -exec sh -c 'mjml \"$1\" -o static/emails/$(basename \"${1%.mjml}.html\")' sh {} \\;", - "postemails": "node ./emails/_generateEmailList.mjs" - }, - "devDependencies": { - "@inlang/cli": "^2.18.1", - "@internationalized/date": "^3.5.6", - "@playwright/test": "^1.45.3", - "@sveltejs/kit": "^2.12.2", - "@sveltejs/vite-plugin-svelte": "^4.0.0", - "@tailwindcss/aspect-ratio": "^0.4.2", - "@tailwindcss/container-queries": "^0.1.1", - "@tailwindcss/forms": "^0.5.9", - "@tailwindcss/typography": "^0.5.15", - "@types/eslint": "^9.6.0", - "@types/lodash": "^4.17.13", - "autoprefixer": "^10.4.20", - "bits-ui": "1.0.0-next.74", - "clsx": "^2.1.1", - "dotenv": "^16.4.5", - "eslint": "^9.7.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-svelte": "^2.36.0", - "formsnap": "2.0.0-next.1", - "globals": "^15.0.0", - "json-to-ts": "^2.1.0", - "lucide-svelte": "^0.454.0", - "mode-watcher": "^0.4.1", - "paneforge": "1.0.0-next.2", - "prettier": "^3.3.2", - "prettier-plugin-svelte": "^3.2.6", - "prettier-plugin-tailwindcss": "^0.6.5", - "svelte": "^5.14.4", - "svelte-adapter-bun": "^0.5.2", - "svelte-check": "^4.0.0", - "svelte-sonner": "^0.3.28", - "sveltekit-superforms": "^2.20.0", - "tailwind-merge": "^2.5.4", - "tailwind-variants": "^0.2.1", - "tailwindcss": "^3.4.9", - "tailwindcss-animate": "^1.0.7", - "typescript": "^5.0.0", - "typescript-eslint": "^8.0.0", - "vite": "^5.0.3", - "vite-node": "^2.1.4", - "vitest": "^2.0.4", - "zod": "^3.23.8" - }, - "dependencies": { - "@inlang/paraglide-sveltekit": "^0.15.0", - "@melt-ui/svelte": "^0.86.0", - "@types/node": "^22.10.2", - "date-fns": "^4.1.0", - "effect": "^3.10.12", - "lodash": "^4.17.21", - "mjml": "^4.15.3", - "nanoid": "^5.0.8", - "pocketbase": "^0.21.5", - "runed": "^0.15.3", - "svelte-loading-spinners": "^0.3.6", - "type-fest": "^4.26.1", - "zenroom": "^4.45.3" - } + "name": "DIDimo - webapp", + "author": { + "name": "Forkbomb", + "email": "info@forkbomb.com" + }, + "description": "Your trustworthy compliance checker for decentralized identity solutions", + "version": "0.0.1", + "type": "module", + "engines": { + "node": ">=17", + "pnpm": ">=8" + }, + "scripts": { + "predev": "bun run generate:definitions", + "dev": "vite dev", + "prebuild": "bun run generate:definitions", + "build": "vite build", + "bin": "bun run build && bun build --compile --minify-whitespace --minify-syntax --target bun --outfile didimo-ui ./build/index.js", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "format": "prettier --write .", + "lint": "prettier --check . && eslint .", + "test:unit": "vitest", + "test": "bun run test:unit -- --run && bun run test:e2e", + "test:e2e": "playwright test", + "test:e2e:ui": "playwright test --ui", + "serve": "bun run build && bun run preview --host", + "vite-run": "node ./vite-run.js", + "generate:types": "bun x pocketbase-typegen --db ../pb_data/data.db --out src/modules/pocketbase/types/index.generated.ts && bun run generate:types-extra", + "generate:types-extra": "bun run vite-run src/modules/pocketbase/types/generate.types-extra.ts", + "generate:features": "bun run vite-run src/modules/features/generate.features-list.ts", + "generate:roles": "bun run vite-run ./src/modules/organizations/generate.roles-list.ts", + "generate:collections-models": "bun run vite-run ./src/modules/pocketbase/collections-models/generate.collections-models.ts", + "generate:definitions": "bun run generate:collections-models && bun run generate:types && bun run generate:features && bun run generate:roles", + "i18n:remove-unused-strings": "bun run vite-run ./src/modules/i18n/remove-unused-strings.ts", + "i18n:lint": "bun run inlang lint --project ./project.inlang", + "i18n:lint:en": "bun run inlang lint --project ./project.inlang --languageTags en", + "emails": "rm -rf static/emails/* && mkdir -p static/emails && find ./ -name _components -prune -o -name '*.mjml' -exec sh -c 'mjml \"$1\" -o static/emails/$(basename \"${1%.mjml}.html\")' sh {} \\;", + "postemails": "node ./emails/_generateEmailList.mjs" + }, + "devDependencies": { + "@inlang/cli": "^2.18.1", + "@internationalized/date": "^3.5.6", + "@playwright/test": "^1.45.3", + "@sveltejs/kit": "^2.12.2", + "@sveltejs/vite-plugin-svelte": "^4.0.0", + "@tailwindcss/aspect-ratio": "^0.4.2", + "@tailwindcss/container-queries": "^0.1.1", + "@tailwindcss/forms": "^0.5.9", + "@tailwindcss/typography": "^0.5.15", + "@types/eslint": "^9.6.0", + "@types/lodash": "^4.17.13", + "autoprefixer": "^10.4.20", + "bits-ui": "1.0.0-next.74", + "clsx": "^2.1.1", + "dotenv": "^16.4.5", + "eslint": "^9.7.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.36.0", + "formsnap": "2.0.0-next.1", + "globals": "^15.0.0", + "json-to-ts": "^2.1.0", + "lucide-svelte": "^0.454.0", + "mode-watcher": "^0.4.1", + "paneforge": "1.0.0-next.2", + "prettier": "^3.3.2", + "prettier-plugin-svelte": "^3.2.6", + "prettier-plugin-tailwindcss": "^0.6.5", + "svelte": "^5.14.4", + "svelte-adapter-bun": "^0.5.2", + "svelte-check": "^4.0.0", + "svelte-sonner": "^0.3.28", + "sveltekit-superforms": "^2.20.0", + "tailwind-merge": "^2.5.4", + "tailwind-variants": "^0.2.1", + "tailwindcss": "^3.4.9", + "tailwindcss-animate": "^1.0.7", + "typescript": "^5.0.0", + "typescript-eslint": "^8.0.0", + "vite": "^5.0.3", + "vite-node": "^2.1.4", + "vitest": "^2.0.4", + "zod": "^3.23.8" + }, + "dependencies": { + "@inlang/paraglide-sveltekit": "^0.15.0", + "@melt-ui/svelte": "^0.86.0", + "@types/node": "^22.10.2", + "date-fns": "^4.1.0", + "effect": "^3.10.12", + "lodash": "^4.17.21", + "mjml": "^4.15.3", + "nanoid": "^5.0.8", + "pocketbase": "0.25", + "runed": "^0.15.3", + "svelte-loading-spinners": "^0.3.6", + "type-fest": "^4.26.1", + "zenroom": "^4.45.3" + } } From b75f3e5aa28baff1a8c437cc9bab94c2df6eccff Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Thu, 2 Jan 2025 13:59:22 +0100 Subject: [PATCH 06/14] feat: add lint checks to PRs and local toolchain (#16) * feat: add lint checks to PR and tool for local * fix: add the package comment on package main --- .github/workflows/go.yml | 17 +++++++++++++++++ Makefile | 11 +++++++---- main.go | 5 +++-- 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..7cefae97 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,17 @@ +name: ๐Ÿน lint + +on: + pull_request: + push: + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker://morphy/revive-action:v2 diff --git a/Makefile b/Makefile index d19b6bcb..2481d96a 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ GOBIN ?= $(GOPATH)/bin GOMOD_FILES := go.mod go.sum # Tools & Linters -GOLANGCI_LINT ?= $(GOBIN)/golangci-lint +REVIVE ?= $(GOBIN)/revive GOFUMPT ?= $(GOBIN)/gofumpt GOVULNCHECK ?= $(GOBIN)/govulncheck OVERMIND ?= $(GOBIN)/overmind @@ -36,7 +36,7 @@ DEPS = mise wget git tmux upx K := $(foreach exec,$(DEPS), $(if $(shell which $(exec)),some string,$(error "๐Ÿฅถ `$(exec)` not found in PATH please install it"))) all: help -.PHONY: submodules version dev test tidy build docker doc clean tools help +.PHONY: submodules version dev test lint tidy build docker doc clean tools help $(BIN): @mkdir $(BIN) @@ -80,6 +80,9 @@ dev: $(SLANGROOM) $(WEBENV) tools submodules ## ๐Ÿš€ run in watch mode test: ## ๐Ÿงช run tests with coverage $(GOTEST) $(SUBDIRS) -v -cover +lint: tools ## ๐Ÿ“‘ lint rules checks + $(REVIVE) -formatter stylish github.com/$(ORGANIZATION)/$(PROJECT_NAME) pocketbase/... + tidy: $(GOMOD_FILES) @$(GOMOD) tidy @@ -124,8 +127,8 @@ clean: ## ๐Ÿงน Clean files and caches tools: mise install - @if [ ! -f "$(GOLANGCI_LINT)" ]; then \ - $(GOINST) github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \ + @if [ ! -f "$(REVIVE)" ]; then \ + $(GOINST) github.com/mgechev/revive@latest; \ fi @if [ ! -f "$(GOFUMPT)" ]; then \ $(GOINST) mvdan.cc/gofumpt@latest; \ diff --git a/main.go b/main.go index 1cbede87..d70541bf 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,5 @@ +// main entry point for the didimo backend server + package main import ( @@ -24,8 +26,7 @@ import ( func main() { app := pocketbase.New() - app.RootCmd.Short = - "\033[38;2;255;100;0m dP oo dP oo \033[0m\n" + + app.RootCmd.Short = "\033[38;2;255;100;0m dP oo dP oo \033[0m\n" + "\033[38;2;255;71;43m 88 88 \033[0m\n" + "\033[38;2;255;43;86m.d888b88 dP .d888b88 dP 88d8b.d8b. .d8888b. \033[0m\n" + "\033[38;2;255;14;129m88' `88 88 88' `88 88 88'`88'`88 88' `88 \033[0m\n" + From 2e9c0997062f47d7cd6731f5a707e570f862592e Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Thu, 2 Jan 2025 14:16:32 +0100 Subject: [PATCH 07/14] feat: add format tools (#17) --- Makefile | 3 +++ pocketbase/webauthn/webauthn.go | 8 +------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 2481d96a..c7f2489c 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,9 @@ test: ## ๐Ÿงช run tests with coverage lint: tools ## ๐Ÿ“‘ lint rules checks $(REVIVE) -formatter stylish github.com/$(ORGANIZATION)/$(PROJECT_NAME) pocketbase/... +fmt: tools ## ๐Ÿ—ฟ format rules checks + $(GOFUMPT) -l -w pocketbase *.go + tidy: $(GOMOD_FILES) @$(GOMOD) tidy diff --git a/pocketbase/webauthn/webauthn.go b/pocketbase/webauthn/webauthn.go index 65c3b75e..24c0c0f4 100644 --- a/pocketbase/webauthn/webauthn.go +++ b/pocketbase/webauthn/webauthn.go @@ -1,10 +1,9 @@ package webauthn import ( + "bytes" "encoding/json" "errors" - - "bytes" "fmt" "io" "log" @@ -23,7 +22,6 @@ type User struct { } func NewUser(app *pocketbase.PocketBase, m *core.Record) *User { - user := &User{ model: m, app: app, @@ -205,13 +203,11 @@ func Register(app *pocketbase.PocketBase) error { options, sessionData, err := w.BeginRegistration( user, ) - if err != nil { return e.JSON(http.StatusInternalServerError, err.Error()) } err = storeSessionData(app, e.Auth, sessionData) - if err != nil { return e.JSON(http.StatusInternalServerError, err.Error()) } @@ -269,7 +265,6 @@ func Register(app *pocketbase.PocketBase) error { if err := app.Delete(record); err != nil { return err } - return e.JSON(http.StatusOK, make(map[string]interface{})) }) se.Router.GET("/api/webauthn/login/begin/:email", func(e *core.RequestEvent) error { @@ -295,7 +290,6 @@ func Register(app *pocketbase.PocketBase) error { } err = storeSessionData(app, userRecord, sessionData) - if err != nil { return e.JSON(http.StatusInternalServerError, err.Error()) } From e9067101a8af3ecd0fab4af0136160e368e860de Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Thu, 2 Jan 2025 21:31:28 +0100 Subject: [PATCH 08/14] refactor: create cmd, add temportal dep and proc (#18) * refactor: create cmd, add temportal dep and proc * doc: the package doc and fix the email public path * fix: remove duplicate docker compose file --- .air.toml | 2 +- .gitignore | 4 +--- Dockerfile | 2 +- Makefile | 4 ++-- Procfile.dev | 1 + main.go => cmd/didimo/didimo.go | 3 +-- docker-compose.override.yml | 2 -- docker-compose.yaml | 11 ----------- pb_hooks/utils.js | 19 ++++++++----------- 9 files changed, 15 insertions(+), 33 deletions(-) rename main.go => cmd/didimo/didimo.go (98%) delete mode 100644 docker-compose.yaml diff --git a/.air.toml b/.air.toml index dcc5f6b5..f43d203b 100644 --- a/.air.toml +++ b/.air.toml @@ -1,2 +1,2 @@ [build] - cmd = "go run main.go serve" + cmd = "go run cmd/didimo/didimo.go serve" diff --git a/.gitignore b/.gitignore index fa91212b..e0252775 100644 --- a/.gitignore +++ b/.gitignore @@ -4,12 +4,10 @@ docs/.vitepress/cache/ .bin/slangroom-exec -/pb /tmp /pb_data .DS_Store .env pb.env -didimo +/didimo didimo-ui -postgres-data diff --git a/Dockerfile b/Dockerfile index cd8aa828..620c98ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ COPY . . ENV GOCACHE=/go-cache ENV GOMODCACHE=/gomod-cache RUN --mount=type=cache,target=/gomod-cache --mount=type=cache,target=/go-cache \ - go build -o didimo . + go build -o didimo cmd/didimo/didimo.go FROM alpine:latest diff --git a/Makefile b/Makefile index c7f2489c..3bf700cf 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ DESCRIPTION ?= "SSI Compliance tool" ROOT_DIR ?= $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) BINARY_NAME ?= $(PROJECT_NAME) SUBDIRS ?= ./... -MAIN_SRC ?= $(ROOT_DIR)/main.go +MAIN_SRC ?= $(ROOT_DIR)/cmd/didimo/didimo.go WEBAPP ?= $(ROOT_DIR)/webapp GO_SRC := $(wildcard **/*.go) UI_SRC := $(shell find $(WEBAPP)/src -type f \( -name '*.svelte' -o -name '*.js' -o -name '*.ts' -o -name '*.css' \) ! -name '*.generated.ts' ! -path 'webapp/src/modules/i18n/paraglide/*') @@ -32,7 +32,7 @@ AIR ?= $(GOBIN)/air WEBENV = $(WEBAPP)/.env BIN = $(ROOT_DIR)/.bin SLANGROOM = $(BIN)/slangroom-exec -DEPS = mise wget git tmux upx +DEPS = mise wget git tmux upx temporal K := $(foreach exec,$(DEPS), $(if $(shell which $(exec)),some string,$(error "๐Ÿฅถ `$(exec)` not found in PATH please install it"))) all: help diff --git a/Procfile.dev b/Procfile.dev index 3fefe9a4..a721e2bf 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,3 +1,4 @@ pocketbase: air ui: ./scripts/wait-for-it.sh -t 0 localhost:8090 && cd webapp && bun i && bun dev docs: cd docs && bun i && bun run docs:dev +temporal: temporal server start-dev --db-filename pb_data/temporal.db diff --git a/main.go b/cmd/didimo/didimo.go similarity index 98% rename from main.go rename to cmd/didimo/didimo.go index d70541bf..2f25b655 100644 --- a/main.go +++ b/cmd/didimo/didimo.go @@ -1,5 +1,4 @@ -// main entry point for the didimo backend server - +// DIDimo is your companion tool for be compliant with your SSI system. package main import ( diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 2162a9d3..63b17171 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -6,8 +6,6 @@ services: POSTGRES_PASSWORD: d POSTGRES_USER: d image: postgres:13 - volumes: - - ./.postgres-data:/var/lib/postgresql/data temporal: depends_on: - postgresql diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index e4dc8cda..00000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,11 +0,0 @@ -services: - app: - build: - context: . - dockerfile: Dockerfile - ports: - - "8090:8090" - environment: - PORT: 5100 - volumes: - - ./pb_data/:/pb_data diff --git a/pb_hooks/utils.js b/pb_hooks/utils.js index 4bc6a4ba..c9efe313 100644 --- a/pb_hooks/utils.js +++ b/pb_hooks/utils.js @@ -68,7 +68,7 @@ function isLastOwnerAuthorization(orgAuthorization) { const ownerAuthorizations = findRecordsByFilter( "orgAuthorizations", - `organization="${organizationId}" && role="${ownerRoleId}"` + `organization="${organizationId}" && role="${ownerRoleId}"`, ); return ownerAuthorizations.length == 1; @@ -84,7 +84,7 @@ function getUserRole(userId, organizationId, app = $app) { const authorization = findFirstRecordByFilter( "orgAuthorizations", `user = "${userId}" && organization = "${organizationId}"`, - app + app, ); if (!authorization) return undefined; return getExpanded(authorization, "role", app); @@ -238,7 +238,7 @@ function getOrganizationAdminsAddresses(organizationId, app = $app) { const recipients = findRecordsByFilter( "orgAuthorizations", `organization.id = "${organizationId}" && ( role.name = "admin" || role.name = "owner" )`, - app + app, ); return recipients @@ -323,9 +323,7 @@ function getRecordUpdateEventDiff(event, fields = []) { * @param {core.Collection} collection */ function getCollectionFields(collection) { - return collection.fields - .map((f) => f?.name) - .filter((n) => n != undefined); + return collection.fields.map((f) => f?.name).filter((n) => n != undefined); } // @@ -335,9 +333,10 @@ const renderEmail = (name, data) => { const emailPath = $filepath.join( __hooks, "..", - "pb_public", + "webapp", + "static", "emails", - `${name}.html` + `${name}.html`, ); const html = $template .loadFiles(emailPath) @@ -378,9 +377,7 @@ function getRecordUpdateEventDiff(event, fields = []) { * @param {core.Collection} collection */ function getCollectionFields(collection) { - return collection.fields - .map((f) => f?.name) - .filter((n) => n != undefined); + return collection.fields.map((f) => f?.name).filter((n) => n != undefined); } /** From 15b0b4828da860dacb8e771bb9a50308a1c7bfdb Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Sat, 4 Jan 2025 12:31:18 +0100 Subject: [PATCH 09/14] chore: add vuln check on go packages --- .github/workflows/go.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7cefae97..dcd742c2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -15,3 +15,4 @@ jobs: steps: - uses: actions/checkout@v4 - uses: docker://morphy/revive-action:v2 + - uses: golang/govulncheck-action@v1 From 17aeacb2294e432af5d22149e9fa1b96e1bcc53b Mon Sep 17 00:00:00 2001 From: Giovanni Abbatepaolo <30571828+bbtgnn@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:05:51 +0100 Subject: [PATCH 10/14] fix: codegen --- webapp/package.json | 2 +- .../generate.collections-models.ts | 43 +++++++------- .../pocketbase/collections-models/index.ts | 16 +++--- .../pocketbase/types/generate.types-extra.ts | 56 ++++++++++++------- webapp/src/modules/utils/codegen.ts | 2 +- 5 files changed, 69 insertions(+), 50 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index d12b4c28..cc0d5fe8 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -28,11 +28,11 @@ "test:e2e:ui": "playwright test --ui", "serve": "bun run build && bun run preview --host", "vite-run": "node ./vite-run.js", + "generate:collections-models": "bun run vite-run ./src/modules/pocketbase/collections-models/generate.collections-models.ts", "generate:types": "bun x pocketbase-typegen --db ../pb_data/data.db --out src/modules/pocketbase/types/index.generated.ts && bun run generate:types-extra", "generate:types-extra": "bun run vite-run src/modules/pocketbase/types/generate.types-extra.ts", "generate:features": "bun run vite-run src/modules/features/generate.features-list.ts", "generate:roles": "bun run vite-run ./src/modules/organizations/generate.roles-list.ts", - "generate:collections-models": "bun run vite-run ./src/modules/pocketbase/collections-models/generate.collections-models.ts", "generate:definitions": "bun run generate:collections-models && bun run generate:types && bun run generate:features && bun run generate:roles", "i18n:remove-unused-strings": "bun run vite-run ./src/modules/i18n/remove-unused-strings.ts", "i18n:lint": "bun run inlang lint --project ./project.inlang", diff --git a/webapp/src/modules/pocketbase/collections-models/generate.collections-models.ts b/webapp/src/modules/pocketbase/collections-models/generate.collections-models.ts index a3dfa8d1..33cbbc33 100644 --- a/webapp/src/modules/pocketbase/collections-models/generate.collections-models.ts +++ b/webapp/src/modules/pocketbase/collections-models/generate.collections-models.ts @@ -10,7 +10,7 @@ import { logCodegenResult, SEPARATOR } from '@/utils/codegen'; -import { pipe, Array as A, String, Record } from 'effect'; +import { pipe, Array as A, Record } from 'effect'; import { capitalize, merge } from 'lodash'; import JsonToTS from 'json-to-ts'; @@ -21,10 +21,10 @@ const models = await pb.collections.getFullList(); /* Codegen */ -const SCHEMA_FIELD = `SchemaField`; +const COLLECTION_FIELD = `CollectionField`; const COLLECTION_MODEL = `CollectionModel`; const IMPORT_STATEMENTS = ` -import type { ${SCHEMA_FIELD}, ${COLLECTION_MODEL} } from 'pocketbase' +import type { ${COLLECTION_MODEL} } from 'pocketbase' import type { SetFieldType, Simplify } from 'type-fest'; `; @@ -36,10 +36,12 @@ const schemaFieldOptionsTypesData = schemaFieldTypes.map((f) => const schemaFields = `export type SchemaFields = { ${schemaFieldOptionsTypesData.map(({ name, key }) => `${key}: ${name}`).join('\n')} }`; -const anySchemaField = `export type AnySchemaField = ${schemaFieldOptionsTypesData.map(({ name }) => name).join(' | ')}`; + +const ANY_COLLECTION_FIELD = `Any${COLLECTION_FIELD}`; +const anySchemaField = `export type ${ANY_COLLECTION_FIELD} = ${schemaFieldOptionsTypesData.map(({ name }) => name).join(' | ')}`; const ANY_COLLECTION_MODEL = `AnyCollectionModel`; -const anyCollectionModel = `export type ${ANY_COLLECTION_MODEL} = Simplify>;`; +const anyCollectionModel = `export type ${ANY_COLLECTION_MODEL} = Simplify>;`; const code = [ IMPORT_STATEMENTS, @@ -84,7 +86,7 @@ function collectionName(models: CollectionModel[]): string { function getFieldTypeNames(models: CollectionModel[]) { return pipe( - models.flatMap((model) => model.schema), + models.flatMap((model) => model.fields), A.map((field) => field.type), A.dedupe ); @@ -94,25 +96,21 @@ function createFieldOptionsTypeData( fieldType: string, models: CollectionModel[] ): GeneratedTypeData { - const typeName = capitalize(fieldType) + SCHEMA_FIELD; + const typeName = capitalize(fieldType) + COLLECTION_FIELD; return pipe( - models - .flatMap((m) => m.schema) - .filter((f) => f.type == fieldType) - .map((f) => f.options), + models.flatMap((m) => m.fields).filter((f) => f.type == fieldType), // merging data in a single object - (fieldsSchemas) => merge({}, ...fieldsSchemas), + // somehow `required` is not present on some sytem fields, we add it here + (fieldsSchemas) => merge({ required: false }, ...fieldsSchemas), // converting to ts - (data) => JsonToTS(data, { useTypeAlias: true })[0], + (data) => JsonToTS(data, { useTypeAlias: true, rootName: typeName })[0], // (code) => { - const typeOnly = code.split('=')[1].trim(); - const removeEmptyObject = typeOnly == `{\n}` ? 'Record' : typeOnly; - const newCode = `export type ${typeName} = ${SCHEMA_FIELD} & { type: "${fieldType}"; options: Partial<${removeEmptyObject}>; unique: boolean }`; - return newCode; + const newCode = code + .replace('type: string;', `type: "${fieldType}";`) + .replace('any[]', 'string[]'); + return `export ${newCode}`; }, - // small fix - String.replace('any[]', 'string[]'), // (code) => ({ code, @@ -127,3 +125,10 @@ type GeneratedTypeData = { name: string; key: string; }; + +// + +export function pipeLog(data: T): T { + console.log(data); + return data; +} diff --git a/webapp/src/modules/pocketbase/collections-models/index.ts b/webapp/src/modules/pocketbase/collections-models/index.ts index 628a0fb4..f4cc41cf 100644 --- a/webapp/src/modules/pocketbase/collections-models/index.ts +++ b/webapp/src/modules/pocketbase/collections-models/index.ts @@ -5,10 +5,10 @@ export * from './collections-models.generated'; import { CollectionsModels, type CollectionName, - type AnySchemaField, - type FileSchemaField, - type RelationSchemaField, - type SelectSchemaField, + type AnyCollectionField, + type FileCollectionField, + type RelationCollectionField, + type SelectCollectionField, type AnyCollectionModel } from './collections-models.generated'; import { Array, Option, pipe } from 'effect'; @@ -37,16 +37,16 @@ class CollectionNotFoundError extends Error {} // export function isArrayField( - fieldConfig: AnySchemaField -): fieldConfig is FileSchemaField | SelectSchemaField | RelationSchemaField { + fieldConfig: AnyCollectionField +): fieldConfig is FileCollectionField | SelectCollectionField | RelationCollectionField { const type = fieldConfig.type; if (type !== 'select' && type !== 'relation' && type !== 'file') return false; - if (fieldConfig.options.maxSelect === 1) return false; + if (fieldConfig.maxSelect === 1) return false; else return true; } export function getRelationFields(collection: C): string[] { return getCollectionModel(collection) - .schema.filter((field) => field.type == 'relation') + .fields.filter((field) => field.type == 'relation') .map((field) => field.name); } diff --git a/webapp/src/modules/pocketbase/types/generate.types-extra.ts b/webapp/src/modules/pocketbase/types/generate.types-extra.ts index 05354b10..ad3c15ba 100644 --- a/webapp/src/modules/pocketbase/types/generate.types-extra.ts +++ b/webapp/src/modules/pocketbase/types/generate.types-extra.ts @@ -2,8 +2,8 @@ import { CollectionsModels, isArrayField, type AnyCollectionModel, - type AnySchemaField, - type RelationSchemaField + type AnyCollectionField, + type RelationCollectionField } from '@/pocketbase/collections-models'; import { camelCase } from 'lodash'; import { capitalize } from 'effect/String'; @@ -32,6 +32,8 @@ import type {z} from 'zod' /* Functions */ +class UnhandledFieldTypeError extends Error {} + main(); async function main() { @@ -47,7 +49,10 @@ async function main() { const zodIndexType = createIndexType(zodTypes, ZOD_RAW_SHAPE, true); const relatedCollectionTypes = sortedCollections.map(createCollectionRelatedCollections); - const relatedCollectionsIndexType = createIndexType(relatedCollectionTypes, RELATED_COLLECTIONS); + const relatedCollectionsIndexType = createIndexType( + relatedCollectionTypes, + RELATED_COLLECTIONS + ); const code = [ IMPORT_STATEMENTS, @@ -77,7 +82,9 @@ function createCollectionFormDataType(model: AnyCollectionModel): GeneratedColle const collectionName = model.name; const typeName = capitalize(camelCase(model.name)) + FORM_DATA; - const fields = model.schema.map((f) => { + const modelFields = model.fields as AnyCollectionField[]; + + const fields = modelFields.map((f) => { let type: string; if (f.type == 'number') type = 'number'; else if (f.type == 'bool') type = 'boolean'; @@ -89,11 +96,14 @@ function createCollectionFormDataType(model: AnyCollectionModel): GeneratedColle else if (f.type == 'relation') type = 'string'; else if (f.type == 'text') type = 'string'; else if (f.type == 'url') type = 'string'; - else if (f.type == 'select' && f.options.values) - type = f.options.values.map((v) => `"${v}"`).join(' | '); + else if (f.type == 'select') type = f.values.map((v) => `"${v}"`).join(' | '); + else if (f.type == 'autodate') type = 'string'; + else if (f.type == 'password') type = 'string'; else throw new UnhandledFieldTypeError(); + if (isArrayField(f)) type = `(${type})[]`; const optionalQuestionMark = f.required ? '' : '?'; + return `"${f.name}"${optionalQuestionMark} : ${type}`; }); @@ -109,8 +119,9 @@ function createCollectionFormDataType(model: AnyCollectionModel): GeneratedColle function createCollectionZodRawType(model: AnyCollectionModel): GeneratedCollectionTypeData { const collectionName = model.name; const typeName = capitalize(camelCase(model.name)) + ZOD_RAW_SHAPE; + const modelFields = model.fields as AnyCollectionField[]; - const fields = model.schema.map((f) => { + const fields = modelFields.map((f) => { let type: string; if (f.type == 'number') type = 'z.ZodNumber'; else if (f.type == 'bool') type = 'z.ZodBoolean'; @@ -120,12 +131,16 @@ function createCollectionZodRawType(model: AnyCollectionModel): GeneratedCollect else if (f.type == 'file') type = 'z.ZodType'; else if (f.type == 'json') type = 'z.ZodUnknown'; else if (f.type == 'relation') type = 'z.ZodString'; - else if (f.type == 'select') type = `z.ZodEnum<${JSON.stringify(f.options.values)}>`; + else if (f.type == 'select') type = `z.ZodEnum<${JSON.stringify(f.values)}>`; else if (f.type == 'text') type = 'z.ZodString'; else if (f.type == 'url') type = 'z.ZodString'; + else if (f.type == 'autodate') type = 'z.ZodString'; + else if (f.type == 'password') type = 'z.ZodString'; else throw new UnhandledFieldTypeError(); + if (isArrayField(f)) type = `z.ZodArray<${type}>`; if (!f.required) type = `z.ZodOptional<${type}>`; + return `"${f.name}" : ${type}`; }); @@ -157,29 +172,31 @@ function createCollectionExpand(model: AnyCollectionModel): GeneratedCollectionT } function createCollectionExpandItems(model: AnyCollectionModel): string[] { - return model.schema + return model.fields .filter((field) => field.type == 'relation') .map((field) => { - const model = CollectionsModels.find((m) => m.id == field.options.collectionId); + const model = CollectionsModels.find((m) => m.id == field.collectionId); assert(model, 'Missing model'); const optionalQuestionMark = field.required ? '' : '?'; - const optionalArray = field.options.maxSelect == 1 ? '' : '[]'; + // + const optionalArray = field.maxSelect == 1 ? '' : '[]'; + // @ts-check return `${field.name}${optionalQuestionMark} : (${COLLECTION_RESPONSES}["${model.name}"])${optionalArray}`; }); } function createCollectionInverseExpandItems(model: AnyCollectionModel): string[] { - function isInverseRelationField(field: AnySchemaField): field is RelationSchemaField { - return field.type == 'relation' && field.options.collectionId == model.id; + function isInverseRelationField(field: AnyCollectionField): field is RelationCollectionField { + return field.type == 'relation' && field.collectionId == model.id; } const inverseRelatedCollections = CollectionsModels.filter((c) => - c.schema.some(isInverseRelationField) + c.fields.some((f) => isInverseRelationField(f as AnyCollectionField)) ); return inverseRelatedCollections.flatMap((c) => - c.schema - .filter(isInverseRelationField) + c.fields + .filter((f) => isInverseRelationField(f as AnyCollectionField)) .map((f) => `${c.name}_via_${f.name}?: ${COLLECTION_RESPONSES}["${c.name}"][]`) ); } @@ -192,11 +209,10 @@ function createCollectionRelatedCollections( const collectionName = model.name; const typeName = capitalize(camelCase(model.name)) + RELATED_COLLECTIONS; - const relatedCollections = model.schema + const relatedCollections = model.fields .filter((field) => field.type == 'relation') .map((field) => { - const options = field.options; - const model = CollectionsModels.find((m) => m.id == options.collectionId); + const model = CollectionsModels.find((m) => m.id == field.collectionId); assert(model, 'missing model'); return `${field.name} : "${model.name}"`; }); @@ -221,8 +237,6 @@ function createIndexType(data: GeneratedCollectionTypeData[], category: string, // -class UnhandledFieldTypeError extends Error {} - type GeneratedCollectionTypeData = { code: string; collectionName: string; diff --git a/webapp/src/modules/utils/codegen.ts b/webapp/src/modules/utils/codegen.ts index 09413917..97d89b7e 100644 --- a/webapp/src/modules/utils/codegen.ts +++ b/webapp/src/modules/utils/codegen.ts @@ -19,7 +19,7 @@ export async function initAdminPocketbase() { assert(PUBLIC_POCKETBASE_URL); const pb = new PocketBase(PUBLIC_POCKETBASE_URL) as TypedPocketBase; - await pb.admins.authWithPassword(PB_ADMIN_USER, PB_ADMIN_PASS); + await pb.collection('_superusers').authWithPassword(PB_ADMIN_USER, PB_ADMIN_PASS); return pb; } From 947697295371e1a122c04f15e2823f418c421ada Mon Sep 17 00:00:00 2001 From: Giovanni Abbatepaolo <30571828+bbtgnn@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:12:25 +0100 Subject: [PATCH 11/14] fix: type issues --- .../modules/collections-components/utils.ts | 6 ++++-- webapp/src/modules/pocketbase/query/index.ts | 20 +++++++++++++++---- .../modules/pocketbase/subscriptions/index.ts | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/webapp/src/modules/collections-components/utils.ts b/webapp/src/modules/collections-components/utils.ts index d19c3450..e3abff3d 100644 --- a/webapp/src/modules/collections-components/utils.ts +++ b/webapp/src/modules/collections-components/utils.ts @@ -23,7 +23,7 @@ export function createDefaultRecordPresenter { const fields = getCollectionModel(collection) - .schema.filter((field) => field.type == 'text') + .fields.filter((field) => field.type == 'text') .map((field) => field.name) as (keyof R)[]; return (record) => { @@ -39,7 +39,9 @@ export function createRecordDisplay>( if (displayFields) return createRecordDisplayFromFields(record, displayFields); else if (displayFn) return displayFn(record); else { - const presenter = createDefaultRecordPresenter(getCollectionNameFromId(record.collectionId)); + const presenter = createDefaultRecordPresenter( + getCollectionNameFromId(record.collectionId) + ); return presenter(record); } } diff --git a/webapp/src/modules/pocketbase/query/index.ts b/webapp/src/modules/pocketbase/query/index.ts index 7616b5b3..65cccaac 100644 --- a/webapp/src/modules/pocketbase/query/index.ts +++ b/webapp/src/modules/pocketbase/query/index.ts @@ -81,9 +81,17 @@ export class PocketbaseQuery { return Option.fromNullable(this.options.search).pipe( Option.map((searchText) => { - const allowedFieldTypes: SchemaFieldType[] = ['text', 'editor', 'select', 'email', 'url']; + const allowedFieldTypes: SchemaFieldType[] = [ + 'text', + 'editor', + 'select', + 'email', + 'url' + ]; const fieldNames = getCollectionModel(this.collection) - .schema.filter((field) => allowedFieldTypes.includes(field.type)) + .fields.filter((field) => + allowedFieldTypes.includes(field.type as SchemaFieldType) + ) .map((field) => field.name); if (this.collection == 'users') fieldNames.push('email'); return fieldNames.map((f) => `${f} ~ "${searchText}"`).join(' || '); @@ -112,7 +120,9 @@ export class PocketbaseQuery { - return Option.fromNullable(this.options.expand).pipe(Option.map((expand) => expand.join(', '))); + return Option.fromNullable(this.options.expand).pipe( + Option.map((expand) => expand.join(', ')) + ); } get sortPbOption(): string { @@ -143,7 +153,9 @@ export class PocketbaseQuery>> { const { perPage } = this.options; - return pb.collection(this.collection).getList(currentPage, perPage, this.pocketbaseListOptions); + return pb + .collection(this.collection) + .getList(currentPage, perPage, this.pocketbaseListOptions); } // Utils diff --git a/webapp/src/modules/pocketbase/subscriptions/index.ts b/webapp/src/modules/pocketbase/subscriptions/index.ts index 64d79bcb..2871b95e 100644 --- a/webapp/src/modules/pocketbase/subscriptions/index.ts +++ b/webapp/src/modules/pocketbase/subscriptions/index.ts @@ -59,7 +59,7 @@ function getRelatedCollectionsFromExpandOption( .filter((expandItem) => !expandItem.includes(INVERSE_RELATION_KEY)) .map((expandItem) => { const relationField = getCollectionModel(collection) - .schema.filter((field) => field.type == 'relation') + .fields.filter((field) => field.type == 'relation') .find((field) => field.name == expandItem); if (!relationField) throw new Error('relation_field_not_found'); From 02c925a30a05001fb2508bf0f06ac70633d754a2 Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Tue, 7 Jan 2025 19:28:13 +0100 Subject: [PATCH 12/14] refactor: remove useless import() --- cmd/didimo/didimo.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/didimo/didimo.go b/cmd/didimo/didimo.go index fac33d76..2f25b655 100644 --- a/cmd/didimo/didimo.go +++ b/cmd/didimo/didimo.go @@ -15,12 +15,10 @@ import ( "github.com/forkbombeu/didimo/pocketbase/webauthn" "github.com/forkbombeu/didimo/pocketbase/zencode" - "github.com/labstack/echo/v5" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase" "github.com/pocketbase/pocketbase/apis" "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/plugins/jsvm" "github.com/pocketbase/pocketbase/plugins/migratecmd" ) From 6cea7a31ffb2700739cdd9aa2f614aac6c70b8c3 Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Tue, 7 Jan 2025 19:34:15 +0100 Subject: [PATCH 13/14] feat: fix lint and add vulncheck to linting --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3bf700cf..bd31ba36 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,8 @@ test: ## ๐Ÿงช run tests with coverage $(GOTEST) $(SUBDIRS) -v -cover lint: tools ## ๐Ÿ“‘ lint rules checks - $(REVIVE) -formatter stylish github.com/$(ORGANIZATION)/$(PROJECT_NAME) pocketbase/... + $(REVIVE) -formatter stylish cmd + $(GOVULNCHECK) $(SUBDIRS) fmt: tools ## ๐Ÿ—ฟ format rules checks $(GOFUMPT) -l -w pocketbase *.go From b5e3b521580c00faf366b716815ea5da7a52789e Mon Sep 17 00:00:00 2001 From: Puria Nafisi Azizi Date: Tue, 7 Jan 2025 19:34:40 +0100 Subject: [PATCH 14/14] fix: remove double checks on pr and push --- .github/workflows/go.yml | 1 - docs/public/API/openapi.yml | 124 ++++++++++++++++++++++++++++-------- 2 files changed, 98 insertions(+), 27 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index dcd742c2..a85b1d15 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,7 +2,6 @@ name: ๐Ÿน lint on: pull_request: - push: paths: - '**.go' - 'go.mod' diff --git a/docs/public/API/openapi.yml b/docs/public/API/openapi.yml index 49cbd80a..7bd3b767 100644 --- a/docs/public/API/openapi.yml +++ b/docs/public/API/openapi.yml @@ -16,13 +16,15 @@ info: url: https://forkbomb.solutions servers: - - url: https://s.api.didimo.forkbomb.eu/v1 - description: Staging server + - url: http://localhost:8090/ + description: Localhost server - url: https://t.api.didimo.forkbomb.eu/v1 description: Test server + - url: https://s.api.didimo.forkbomb.eu/v1 + description: Staging server paths: - /auth/register: + /api/collections/users/records: post: summary: Register a new user description: > @@ -37,32 +39,95 @@ paths: schema: $ref: '#/components/schemas/RegisterRequest' responses: - '201': - description: User registered successfully. + '200': + description: Successfully created the record content: application/json: schema: - $ref: '#/components/schemas/SuccessResponse' + type: object + properties: + id: + type: string + description: Unique identifier for the user record + collectionId: + type: string + description: Identifier of the user collection + collectionName: + type: string + description: Name of the user collection + username: + type: string + description: Username of the registered user + verified: + type: boolean + description: Whether the user is verified + emailVisibility: + type: boolean + description: Whether the user's email is visible + email: + type: string + format: email + description: Email of the registered user + created: + type: string + format: date-time + description: Timestamp when the user was created + updated: + type: string + format: date-time + description: Timestamp when the user was last updated + name: + type: string + description: Name of the user + avatar: + type: string + description: Avatar filename for the user '400': - description: Invalid registration data. + description: Bad request - validation error content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - '409': - description: User already exists. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '500': - description: Internal server error during registration. + type: object + properties: + code: + type: integer + example: 400 + message: + type: string + description: Error message + example: "Failed to create record." + data: + type: object + additionalProperties: + type: object + properties: + code: + type: string + description: Validation error code + example: "validation_required" + message: + type: string + description: Validation error message + example: "Missing required value." + '403': + description: Forbidden - access denied content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - - /auth/login: + type: object + properties: + code: + type: integer + example: 403 + message: + type: string + description: Error message + example: "You are not allowed to perform this request." + data: + type: object + description: Additional data (if any) + additionalProperties: false + /api/collections/users/auth-with-password: post: summary: Log in user description: > @@ -947,34 +1012,41 @@ components: RegisterRequest: type: object properties: - username: + name: type: string - description: The username of the user to register. + description: The name of the user to register. password: type: string format: password description: The password for the user. + passwordConfirm: + type: string + format: password + description: The password confirmation for the user. email: type: string format: email description: The email address of the user. + emailVisibility: + type: boolean + description: Whether to show/hide the auth record email when fetching the record data. required: - - username + - name - password - - email + - passwordConfirm LoginRequest: type: object properties: - username: + identiry: type: string - description: The username of the user. + description: The username or the email of the user. password: type: string format: password description: The password for the user. required: - - username + - identity - password LoginResponse: