From 67e5f987d864112c00ba40d1862f10ecc2a7390c Mon Sep 17 00:00:00 2001 From: Shubham Gupta <14368181+goodhamgupta@users.noreply.github.com> Date: Mon, 27 May 2024 08:13:08 +0800 Subject: [PATCH] Upgrade schema to v1.33.0 and package to 0.0.11 (#23) --- buf.gen.yaml | 2 +- lib/api/v1/error_reason.pb.ex | 4 + lib/api/v1/experimental_service.pb.ex | 347 +++++++++++++++++++++++++- mix.exs | 2 +- 4 files changed, 352 insertions(+), 3 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index 6563b83..8cfe2b5 100755 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,4 +1,4 @@ -#!/usr/bin/env -S buf generate buf.build/authzed/api:v1.30.0 --template +#!/usr/bin/env -S buf generate buf.build/authzed/api:v1.33.0 --template --- version: "v1" plugins: diff --git a/lib/api/v1/error_reason.pb.ex b/lib/api/v1/error_reason.pb.ex index 2a8ba02..baab523 100644 --- a/lib/api/v1/error_reason.pb.ex +++ b/lib/api/v1/error_reason.pb.ex @@ -25,4 +25,8 @@ defmodule Authzed.Api.V1.ErrorReason do field(:ERROR_REASON_MAXIMUM_DEPTH_EXCEEDED, 19) field(:ERROR_REASON_SERIALIZATION_FAILURE, 20) field(:ERROR_REASON_TOO_MANY_CHECKS_IN_REQUEST, 21) + field(:ERROR_REASON_EXCEEDS_MAXIMUM_ALLOWABLE_LIMIT, 22) + field(:ERROR_REASON_INVALID_FILTER, 23) + field(:ERROR_REASON_INMEMORY_TOO_MANY_CONCURRENT_UPDATES, 24) + field(:ERROR_REASON_EMPTY_PRECONDITION, 25) end diff --git a/lib/api/v1/experimental_service.pb.ex b/lib/api/v1/experimental_service.pb.ex index ce03db5..b7fcf8b 100644 --- a/lib/api/v1/experimental_service.pb.ex +++ b/lib/api/v1/experimental_service.pb.ex @@ -8,7 +8,7 @@ defmodule Authzed.Api.V1.BulkCheckPermissionRequest do field(:items, 2, repeated: true, type: Authzed.Api.V1.BulkCheckPermissionRequestItem, - deprecated: false + deprecated: true ) end @@ -107,6 +107,327 @@ defmodule Authzed.Api.V1.BulkExportRelationshipsResponse do field(:relationships, 2, repeated: true, type: Authzed.Api.V1.Relationship) end +defmodule Authzed.Api.V1.ExperimentalReflectSchemaRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:consistency, 1, type: Authzed.Api.V1.Consistency) + + field(:optional_filters, 2, + repeated: true, + type: Authzed.Api.V1.ExpSchemaFilter, + json_name: "optionalFilters" + ) +end + +defmodule Authzed.Api.V1.ExperimentalReflectSchemaResponse do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:definitions, 1, repeated: true, type: Authzed.Api.V1.ExpDefinition) + field(:caveats, 2, repeated: true, type: Authzed.Api.V1.ExpCaveat) + field(:read_at, 3, type: Authzed.Api.V1.ZedToken, json_name: "readAt") +end + +defmodule Authzed.Api.V1.ExpSchemaFilter do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:optional_definition_name_filter, 1, + type: :string, + json_name: "optionalDefinitionNameFilter" + ) + + field(:optional_caveat_name_filter, 2, type: :string, json_name: "optionalCaveatNameFilter") + field(:optional_relation_name_filter, 3, type: :string, json_name: "optionalRelationNameFilter") + + field(:optional_permission_name_filter, 4, + type: :string, + json_name: "optionalPermissionNameFilter" + ) +end + +defmodule Authzed.Api.V1.ExpDefinition do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:name, 1, type: :string) + field(:comment, 2, type: :string) + field(:relations, 3, repeated: true, type: Authzed.Api.V1.ExpRelation) + field(:permissions, 4, repeated: true, type: Authzed.Api.V1.ExpPermission) +end + +defmodule Authzed.Api.V1.ExpCaveat do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:name, 1, type: :string) + field(:comment, 2, type: :string) + field(:parameters, 3, repeated: true, type: Authzed.Api.V1.ExpCaveatParameter) + field(:expression, 4, type: :string) +end + +defmodule Authzed.Api.V1.ExpCaveatParameter do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:name, 1, type: :string) + field(:type, 2, type: :string) + field(:parent_caveat_name, 3, type: :string, json_name: "parentCaveatName") +end + +defmodule Authzed.Api.V1.ExpRelation do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:name, 1, type: :string) + field(:comment, 2, type: :string) + field(:parent_definition_name, 3, type: :string, json_name: "parentDefinitionName") + + field(:subject_types, 4, + repeated: true, + type: Authzed.Api.V1.ExpTypeReference, + json_name: "subjectTypes" + ) +end + +defmodule Authzed.Api.V1.ExpTypeReference do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:typeref, 0) + + field(:subject_definition_name, 1, type: :string, json_name: "subjectDefinitionName") + field(:optional_caveat_name, 2, type: :string, json_name: "optionalCaveatName") + field(:is_terminal_subject, 3, type: :bool, json_name: "isTerminalSubject", oneof: 0) + field(:optional_relation_name, 4, type: :string, json_name: "optionalRelationName", oneof: 0) + field(:is_public_wildcard, 5, type: :bool, json_name: "isPublicWildcard", oneof: 0) +end + +defmodule Authzed.Api.V1.ExpPermission do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:name, 1, type: :string) + field(:comment, 2, type: :string) + field(:parent_definition_name, 3, type: :string, json_name: "parentDefinitionName") +end + +defmodule Authzed.Api.V1.ExperimentalComputablePermissionsRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:consistency, 1, type: Authzed.Api.V1.Consistency) + field(:definition_name, 2, type: :string, json_name: "definitionName") + field(:relation_name, 3, type: :string, json_name: "relationName") + + field(:optional_definition_name_filter, 4, + type: :string, + json_name: "optionalDefinitionNameFilter" + ) +end + +defmodule Authzed.Api.V1.ExpRelationReference do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:definition_name, 1, type: :string, json_name: "definitionName") + field(:relation_name, 2, type: :string, json_name: "relationName") + field(:is_permission, 3, type: :bool, json_name: "isPermission") +end + +defmodule Authzed.Api.V1.ExperimentalComputablePermissionsResponse do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:permissions, 1, repeated: true, type: Authzed.Api.V1.ExpRelationReference) + field(:read_at, 2, type: Authzed.Api.V1.ZedToken, json_name: "readAt") +end + +defmodule Authzed.Api.V1.ExperimentalDependentRelationsRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:consistency, 1, type: Authzed.Api.V1.Consistency) + field(:definition_name, 2, type: :string, json_name: "definitionName") + field(:permission_name, 3, type: :string, json_name: "permissionName") +end + +defmodule Authzed.Api.V1.ExperimentalDependentRelationsResponse do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:relations, 1, repeated: true, type: Authzed.Api.V1.ExpRelationReference) + field(:read_at, 2, type: Authzed.Api.V1.ZedToken, json_name: "readAt") +end + +defmodule Authzed.Api.V1.ExperimentalDiffSchemaRequest do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:consistency, 1, type: Authzed.Api.V1.Consistency) + field(:comparison_schema, 2, type: :string, json_name: "comparisonSchema") +end + +defmodule Authzed.Api.V1.ExperimentalDiffSchemaResponse do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:diffs, 1, repeated: true, type: Authzed.Api.V1.ExpSchemaDiff) + field(:read_at, 2, type: Authzed.Api.V1.ZedToken, json_name: "readAt") +end + +defmodule Authzed.Api.V1.ExpRelationSubjectTypeChange do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:relation, 1, type: Authzed.Api.V1.ExpRelation) + + field(:changed_subject_type, 2, + type: Authzed.Api.V1.ExpTypeReference, + json_name: "changedSubjectType" + ) +end + +defmodule Authzed.Api.V1.ExpCaveatParameterTypeChange do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + field(:parameter, 1, type: Authzed.Api.V1.ExpCaveatParameter) + field(:previous_type, 2, type: :string, json_name: "previousType") +end + +defmodule Authzed.Api.V1.ExpSchemaDiff do + @moduledoc false + + use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" + + oneof(:diff, 0) + + field(:definition_added, 1, + type: Authzed.Api.V1.ExpDefinition, + json_name: "definitionAdded", + oneof: 0 + ) + + field(:definition_removed, 2, + type: Authzed.Api.V1.ExpDefinition, + json_name: "definitionRemoved", + oneof: 0 + ) + + field(:definition_doc_comment_changed, 3, + type: Authzed.Api.V1.ExpDefinition, + json_name: "definitionDocCommentChanged", + oneof: 0 + ) + + field(:relation_added, 4, + type: Authzed.Api.V1.ExpRelation, + json_name: "relationAdded", + oneof: 0 + ) + + field(:relation_removed, 5, + type: Authzed.Api.V1.ExpRelation, + json_name: "relationRemoved", + oneof: 0 + ) + + field(:relation_doc_comment_changed, 6, + type: Authzed.Api.V1.ExpRelation, + json_name: "relationDocCommentChanged", + oneof: 0 + ) + + field(:relation_subject_type_added, 7, + type: Authzed.Api.V1.ExpRelationSubjectTypeChange, + json_name: "relationSubjectTypeAdded", + oneof: 0 + ) + + field(:relation_subject_type_removed, 8, + type: Authzed.Api.V1.ExpRelationSubjectTypeChange, + json_name: "relationSubjectTypeRemoved", + oneof: 0 + ) + + field(:permission_added, 9, + type: Authzed.Api.V1.ExpPermission, + json_name: "permissionAdded", + oneof: 0 + ) + + field(:permission_removed, 10, + type: Authzed.Api.V1.ExpPermission, + json_name: "permissionRemoved", + oneof: 0 + ) + + field(:permission_doc_comment_changed, 11, + type: Authzed.Api.V1.ExpPermission, + json_name: "permissionDocCommentChanged", + oneof: 0 + ) + + field(:permission_expr_changed, 12, + type: Authzed.Api.V1.ExpPermission, + json_name: "permissionExprChanged", + oneof: 0 + ) + + field(:caveat_added, 13, type: Authzed.Api.V1.ExpCaveat, json_name: "caveatAdded", oneof: 0) + field(:caveat_removed, 14, type: Authzed.Api.V1.ExpCaveat, json_name: "caveatRemoved", oneof: 0) + + field(:caveat_doc_comment_changed, 15, + type: Authzed.Api.V1.ExpCaveat, + json_name: "caveatDocCommentChanged", + oneof: 0 + ) + + field(:caveat_expr_changed, 16, + type: Authzed.Api.V1.ExpCaveat, + json_name: "caveatExprChanged", + oneof: 0 + ) + + field(:caveat_parameter_added, 17, + type: Authzed.Api.V1.ExpCaveatParameter, + json_name: "caveatParameterAdded", + oneof: 0 + ) + + field(:caveat_parameter_removed, 18, + type: Authzed.Api.V1.ExpCaveatParameter, + json_name: "caveatParameterRemoved", + oneof: 0 + ) + + field(:caveat_parameter_type_changed, 19, + type: Authzed.Api.V1.ExpCaveatParameterTypeChange, + json_name: "caveatParameterTypeChanged", + oneof: 0 + ) +end + defmodule Authzed.Api.V1.ExperimentalService.Service do @moduledoc false @@ -131,6 +452,30 @@ defmodule Authzed.Api.V1.ExperimentalService.Service do Authzed.Api.V1.BulkCheckPermissionRequest, Authzed.Api.V1.BulkCheckPermissionResponse ) + + rpc( + :ExperimentalReflectSchema, + Authzed.Api.V1.ExperimentalReflectSchemaRequest, + Authzed.Api.V1.ExperimentalReflectSchemaResponse + ) + + rpc( + :ExperimentalComputablePermissions, + Authzed.Api.V1.ExperimentalComputablePermissionsRequest, + Authzed.Api.V1.ExperimentalComputablePermissionsResponse + ) + + rpc( + :ExperimentalDependentRelations, + Authzed.Api.V1.ExperimentalDependentRelationsRequest, + Authzed.Api.V1.ExperimentalDependentRelationsResponse + ) + + rpc( + :ExperimentalDiffSchema, + Authzed.Api.V1.ExperimentalDiffSchemaRequest, + Authzed.Api.V1.ExperimentalDiffSchemaResponse + ) end defmodule Authzed.Api.V1.ExperimentalService.Stub do diff --git a/mix.exs b/mix.exs index 94b1a10..73ae6f6 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Authzed.MixProject do use Mix.Project - @version "0.0.10" + @version "0.0.11" @repo_url "https://github.com/goodhamgupta/authzed_ex/" def project do