diff --git a/Makefile b/Makefile index 7af0594..f7c9cd1 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,9 @@ generate: @echo "Removing generated files.." rm -rf authzed @echo "File cleanup completed" + @echo "Formating files.." + mix format + @echo "Formating completed" start-infra: @echo "Stopping and removing old containers.." diff --git a/buf.gen.yaml b/buf.gen.yaml index d777775..6563b83 100755 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,4 +1,4 @@ -#!/usr/bin/env -S buf generate buf.build/authzed/api:v1.25.0 --template +#!/usr/bin/env -S buf generate buf.build/authzed/api:v1.30.0 --template --- version: "v1" plugins: diff --git a/lib/api/v1/error_reason.pb.ex b/lib/api/v1/error_reason.pb.ex index afeb724..2a8ba02 100644 --- a/lib/api/v1/error_reason.pb.ex +++ b/lib/api/v1/error_reason.pb.ex @@ -23,4 +23,6 @@ defmodule Authzed.Api.V1.ErrorReason do field(:ERROR_REASON_MAX_RELATIONSHIP_CONTEXT_SIZE, 17) field(:ERROR_REASON_ATTEMPT_TO_RECREATE_RELATIONSHIP, 18) field(:ERROR_REASON_MAXIMUM_DEPTH_EXCEEDED, 19) + field(:ERROR_REASON_SERIALIZATION_FAILURE, 20) + field(:ERROR_REASON_TOO_MANY_CHECKS_IN_REQUEST, 21) end diff --git a/lib/api/v1/experimental_service.pb.ex b/lib/api/v1/experimental_service.pb.ex index 2a56396..ce03db5 100644 --- a/lib/api/v1/experimental_service.pb.ex +++ b/lib/api/v1/experimental_service.pb.ex @@ -91,6 +91,11 @@ defmodule Authzed.Api.V1.BulkExportRelationshipsRequest do field(:consistency, 1, type: Authzed.Api.V1.Consistency) field(:optional_limit, 2, type: :uint32, json_name: "optionalLimit", deprecated: false) field(:optional_cursor, 3, type: Authzed.Api.V1.Cursor, json_name: "optionalCursor") + + field(:optional_relationship_filter, 4, + type: Authzed.Api.V1.RelationshipFilter, + json_name: "optionalRelationshipFilter" + ) end defmodule Authzed.Api.V1.BulkExportRelationshipsResponse do diff --git a/lib/api/v1/permission_service.pb.ex b/lib/api/v1/permission_service.pb.ex index 59c68ac..609609b 100644 --- a/lib/api/v1/permission_service.pb.ex +++ b/lib/api/v1/permission_service.pb.ex @@ -96,6 +96,12 @@ defmodule Authzed.Api.V1.RelationshipFilter do deprecated: false ) + field(:optional_resource_id_prefix, 5, + type: :string, + json_name: "optionalResourceIdPrefix", + deprecated: false + ) + field(:optional_relation, 3, type: :string, json_name: "optionalRelation", deprecated: false) field(:optional_subject_filter, 4, @@ -235,6 +241,7 @@ defmodule Authzed.Api.V1.CheckPermissionRequest do field(:permission, 3, type: :string, deprecated: false) field(:subject, 4, type: Authzed.Api.V1.SubjectReference, deprecated: false) field(:context, 5, type: Google.Protobuf.Struct, deprecated: false) + field(:with_tracing, 6, type: :bool, json_name: "withTracing") end defmodule Authzed.Api.V1.CheckPermissionResponse do @@ -255,6 +262,77 @@ defmodule Authzed.Api.V1.CheckPermissionResponse do json_name: "partialCaveatInfo", deprecated: false ) + + field(:debug_trace, 4, type: Authzed.Api.V1.DebugInformation, json_name: "debugTrace") +end + +defmodule Authzed.Api.V1.CheckBulkPermissionsRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:consistency, 1, type: Authzed.Api.V1.Consistency) + + field(:items, 2, + repeated: true, + type: Authzed.Api.V1.CheckBulkPermissionsRequestItem, + deprecated: false + ) +end + +defmodule Authzed.Api.V1.CheckBulkPermissionsRequestItem do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:resource, 1, type: Authzed.Api.V1.ObjectReference, deprecated: false) + field(:permission, 2, type: :string, deprecated: false) + field(:subject, 3, type: Authzed.Api.V1.SubjectReference, deprecated: false) + field(:context, 4, type: Google.Protobuf.Struct, deprecated: false) +end + +defmodule Authzed.Api.V1.CheckBulkPermissionsResponse do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:checked_at, 1, type: Authzed.Api.V1.ZedToken, json_name: "checkedAt", deprecated: false) + + field(:pairs, 2, + repeated: true, + type: Authzed.Api.V1.CheckBulkPermissionsPair, + deprecated: false + ) +end + +defmodule Authzed.Api.V1.CheckBulkPermissionsPair do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:response, 0) + + field(:request, 1, type: Authzed.Api.V1.CheckBulkPermissionsRequestItem) + field(:item, 2, type: Authzed.Api.V1.CheckBulkPermissionsResponseItem, oneof: 0) + field(:error, 3, type: Google.Rpc.Status, oneof: 0) +end + +defmodule Authzed.Api.V1.CheckBulkPermissionsResponseItem do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:permissionship, 1, + type: Authzed.Api.V1.CheckPermissionResponse.Permissionship, + enum: true, + deprecated: false + ) + + field(:partial_caveat_info, 2, + type: Authzed.Api.V1.PartialCaveatInfo, + json_name: "partialCaveatInfo", + deprecated: false + ) end defmodule Authzed.Api.V1.ExpandPermissionTreeRequest do @@ -439,6 +517,12 @@ defmodule Authzed.Api.V1.PermissionsService.Service do Authzed.Api.V1.CheckPermissionResponse ) + rpc( + :CheckBulkPermissions, + Authzed.Api.V1.CheckBulkPermissionsRequest, + Authzed.Api.V1.CheckBulkPermissionsResponse + ) + rpc( :ExpandPermissionTree, Authzed.Api.V1.ExpandPermissionTreeRequest, diff --git a/lib/api/v1/watch_service.pb.ex b/lib/api/v1/watch_service.pb.ex index 0897e19..42d7d18 100644 --- a/lib/api/v1/watch_service.pb.ex +++ b/lib/api/v1/watch_service.pb.ex @@ -14,6 +14,12 @@ defmodule Authzed.Api.V1.WatchRequest do type: Authzed.Api.V1.ZedToken, json_name: "optionalStartCursor" ) + + field(:optional_relationship_filters, 3, + repeated: true, + type: Authzed.Api.V1.RelationshipFilter, + json_name: "optionalRelationshipFilters" + ) end defmodule Authzed.Api.V1.WatchResponse do diff --git a/mix.exs b/mix.exs index 0a7b1a1..94b1a10 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Authzed.MixProject do use Mix.Project - @version "0.0.9" + @version "0.0.10" @repo_url "https://github.com/goodhamgupta/authzed_ex/" def project do @@ -32,7 +32,7 @@ defmodule Authzed.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:grpc, "~> 0.7.0"}, + {:grpc, "~> 0.8.1"}, {:protobuf, "~> 0.12.0"}, {:google_protos, "~> 0.3.0"}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} diff --git a/mix.lock b/mix.lock index 0e3f92d..0100ef0 100644 --- a/mix.lock +++ b/mix.lock @@ -1,16 +1,16 @@ %{ - "cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"}, - "cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"}, + "cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"}, + "cowlib": {:hex, :cowlib, "2.13.0", "db8f7505d8332d98ef50a3ef34b34c1afddec7506e4ee4dd4a3a266285d282ca", [:make, :rebar3], [], "hexpm", "e1e1284dc3fc030a64b1ad0d8382ae7e99da46c3246b815318a4b848873800a4"}, "earmark_parser": {:hex, :earmark_parser, "1.4.32", "fa739a0ecfa34493de19426681b23f6814573faee95dfd4b4aafe15a7b5b32c6", [:mix], [], "hexpm", "b8b0dd77d60373e77a3d7e8afa598f325e49e8663a51bcc2b88ef41838cca755"}, "ex_doc": {:hex, :ex_doc, "0.29.4", "6257ecbb20c7396b1fe5accd55b7b0d23f44b6aa18017b415cb4c2b91d997729", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2c6699a737ae46cb61e4ed012af931b57b699643b24dabe2400a8168414bc4f5"}, "google_protos": {:hex, :google_protos, "0.3.0", "15faf44dce678ac028c289668ff56548806e313e4959a3aaf4f6e1ebe8db83f4", [:mix], [{:protobuf, "~> 0.10", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "1f6b7fb20371f72f418b98e5e48dae3e022a9a6de1858d4b254ac5a5d0b4035f"}, - "grpc": {:hex, :grpc, "0.7.0", "a86eab356b0b84406b526786a947ca50e9b9eae87108c873b51e321f8a71e8ed", [:mix], [{:cowboy, "~> 2.10", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowlib, "~> 2.12", [hex: :cowlib, repo: "hexpm", optional: false]}, {:gun, "~> 2.0", [hex: :gun, repo: "hexpm", optional: false]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "632a9507da8d3c12b112b197db4d60da3c95bad02594d37711eeb622d032f254"}, - "gun": {:hex, :gun, "2.0.1", "160a9a5394800fcba41bc7e6d421295cf9a7894c2252c0678244948e3336ad73", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "a10bc8d6096b9502205022334f719cc9a08d9adcfbfc0dbee9ef31b56274a20b"}, + "grpc": {:hex, :grpc, "0.8.1", "a8a5884a0d41fc30679c269d0332571cebb43cbfd6eb3d4819169778e866343e", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:cowboy, "~> 2.10", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowlib, "~> 2.12", [hex: :cowlib, repo: "hexpm", optional: false]}, {:gun, "~> 2.0", [hex: :gun, repo: "hexpm", optional: false]}, {:jason, ">= 0.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: false]}, {:protobuf, "~> 0.11", [hex: :protobuf, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1cccd9fd83547a562f315cc0e1ee1879546f0a44193b5c8eb8d68dae0bb2065b"}, + "gun": {:hex, :gun, "2.1.0", "b4e4cbbf3026d21981c447e9e7ca856766046eff693720ba43114d7f5de36e87", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "52fc7fc246bfc3b00e01aea1c2854c70a366348574ab50c57dfe796d24a0101d"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, - "mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"}, + "mint": {:hex, :mint, "1.5.2", "4805e059f96028948870d23d7783613b7e6b0e2fb4e98d720383852a760067fd", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "d77d9e9ce4eb35941907f1d3df38d8f750c357865353e21d335bdcdf6d892a02"}, "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, "protobuf": {:hex, :protobuf, "0.12.0", "58c0dfea5f929b96b5aa54ec02b7130688f09d2de5ddc521d696eec2a015b223", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "75fa6cbf262062073dd51be44dd0ab940500e18386a6c4e87d5819a58964dc45"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},