workos 5.20.2__py3-none-any.whl → 5.21.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
workos/__about__.py CHANGED
@@ -12,7 +12,7 @@ __package_name__ = "workos"
12
12
 
13
13
  __package_url__ = "https://github.com/workos-inc/workos-python"
14
14
 
15
- __version__ = "5.20.2"
15
+ __version__ = "5.21.0"
16
16
 
17
17
  __author__ = "WorkOS"
18
18
 
workos/fga.py CHANGED
@@ -11,6 +11,7 @@ from workos.types.fga import (
11
11
  WarrantWriteOperation,
12
12
  WriteWarrantResponse,
13
13
  WarrantQueryResult,
14
+ FGAWarning,
14
15
  )
15
16
  from workos.types.fga.list_filters import (
16
17
  AuthorizationResourceListFilters,
@@ -45,9 +46,11 @@ AuthorizationResourceTypeListResource = WorkOSListResource[
45
46
 
46
47
  WarrantListResource = WorkOSListResource[Warrant, WarrantListFilters, ListMetadata]
47
48
 
48
- WarrantQueryListResource = WorkOSListResource[
49
- WarrantQueryResult, WarrantQueryListFilters, ListMetadata
50
- ]
49
+
50
+ class WarrantQueryListResource(
51
+ WorkOSListResource[WarrantQueryResult, WarrantQueryListFilters, ListMetadata]
52
+ ):
53
+ warnings: Optional[Sequence[FGAWarning]] = None
51
54
 
52
55
 
53
56
  class FGAModule(Protocol):
@@ -641,5 +644,6 @@ class FGA(FGAModule):
641
644
  return WarrantQueryListResource(
642
645
  list_method=self.query,
643
646
  list_args=list_params,
647
+ warnings=response.get("warnings"),
644
648
  **ListPage[WarrantQueryResult](**response).model_dump(),
645
649
  )
@@ -2,3 +2,4 @@ from .check import *
2
2
  from .authorization_resource_types import *
3
3
  from .authorization_resources import *
4
4
  from .warrant import *
5
+ from .warnings import *
workos/types/fga/check.py CHANGED
@@ -3,6 +3,7 @@ from typing import Any, Literal, Mapping, Optional, Sequence, TypedDict
3
3
  from workos.types.workos_model import WorkOSModel
4
4
  from workos.typing.literals import LiteralOrUntyped
5
5
 
6
+ from .warnings import FGAWarning
6
7
  from .warrant import Subject, SubjectInput
7
8
 
8
9
  CheckOperation = Literal["any_of", "all_of", "batch"]
@@ -44,6 +45,7 @@ class CheckResponse(WorkOSModel):
44
45
  result: LiteralOrUntyped[CheckResult]
45
46
  is_implicit: bool
46
47
  debug_info: Optional[DebugInfo] = None
48
+ warnings: Optional[Sequence[FGAWarning]] = None
47
49
 
48
50
  def authorized(self) -> bool:
49
51
  return self.result == "authorized"
@@ -0,0 +1,33 @@
1
+ from typing import Sequence, Union, Any, Dict, Literal
2
+ from typing_extensions import Annotated
3
+
4
+ from pydantic import BeforeValidator
5
+ from pydantic_core.core_schema import ValidationInfo
6
+
7
+ from workos.types.workos_model import WorkOSModel
8
+
9
+
10
+ class FGABaseWarning(WorkOSModel):
11
+ code: str
12
+ message: str
13
+
14
+
15
+ class MissingContextKeysWarning(FGABaseWarning):
16
+ code: Literal["missing_context_keys"]
17
+ keys: Sequence[str]
18
+
19
+
20
+ def fga_warning_dispatch_validator(
21
+ value: Dict[str, Any], info: ValidationInfo
22
+ ) -> FGABaseWarning:
23
+ if value.get("code") == "missing_context_keys":
24
+ return MissingContextKeysWarning.model_validate(value)
25
+
26
+ # Fallback to the base warning model
27
+ return FGABaseWarning.model_validate(value)
28
+
29
+
30
+ FGAWarning = Annotated[
31
+ Union[MissingContextKeysWarning, FGABaseWarning],
32
+ BeforeValidator(fga_warning_dispatch_validator),
33
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: workos
3
- Version: 5.20.2
3
+ Version: 5.21.0
4
4
  Summary: WorkOS Python Client
5
5
  Home-page: https://github.com/workos-inc/workos-python
6
6
  Author: WorkOS
@@ -1,4 +1,4 @@
1
- workos/__about__.py,sha256=6JtoB6AO1YUIK4GXShXMp_t0qx7xLaM31tzYxv9XFtM,406
1
+ workos/__about__.py,sha256=Kw99rsfShlsW2EcW28hAVwvZlNv7VycJWuKA1sBEwis,406
2
2
  workos/__init__.py,sha256=hOdbO_MJCvpLx8EbRjQg-fvFAB-glJmrmxUZK8kWG0k,167
3
3
  workos/_base_client.py,sha256=t69Nb3zxo3wygI3JtbPdZMGvIuRPsZx_xZANC5K8dn8,3429
4
4
  workos/_client_configuration.py,sha256=g3eXhtrEMN6CW0hZ5uHb2PmLurXjyBkWZeQYMPeJD6s,222
@@ -8,7 +8,7 @@ workos/client.py,sha256=ESweUKW2ju5dPGFCTUMxjVYgh2txoZ3ZVbxy81i0JcI,3747
8
8
  workos/directory_sync.py,sha256=6Z1gHz1LWNy56EtkXwNm6jhRRcvsJ7ASeDLy_Q1oKM0,14601
9
9
  workos/events.py,sha256=b4JIzMbd5LlVtpOMKVojC70RCHAgmLN3nJ62_2U0GwI,3892
10
10
  workos/exceptions.py,sha256=eoy-T4We98HKZn0UZu33fPzhm4DwafzwLeg3juhC6FE,1732
11
- workos/fga.py,sha256=zEtDxM2QqGqhS9gnXv4Lfmv81sXrzPsJFd1V1lZxFzY,20886
11
+ workos/fga.py,sha256=qjZrdkXKwJDLVTMMrOADxyXRDkswto4kGIdtTjtS3hw,21008
12
12
  workos/mfa.py,sha256=J8eOr4ZEmK0TPFKD7pabSalgCFCyg3XJY1stu28_8Vw,6862
13
13
  workos/organizations.py,sha256=ugPRhwN8cN2O6qOCf7wj8Wus-oeRKXlNe2642PSl_n4,12266
14
14
  workos/passwordless.py,sha256=NGXDoxomBkrIml8-VHXH1HvCFMqotQ-YhRobUQXpVZs,3203
@@ -52,11 +52,12 @@ workos/types/events/list_filters.py,sha256=P04zmRynx9VPqNX_MBXA-3KA6flPZJogtIUqT
52
52
  workos/types/events/organization_domain_verification_failed_payload.py,sha256=26reKTFxdriOo6fF6MVkYx0s867E-bproKTbwLZcUpE,483
53
53
  workos/types/events/previous_attributes.py,sha256=DxolwLwzcnG8r_W6rh5BT29iDfSVsIELvRYJ0NCrNn0,72
54
54
  workos/types/events/session_created_payload.py,sha256=F4eKjmetgyRIluNBDUmB2OXq8hDWEVjALJ4rrT2IHJs,462
55
- workos/types/fga/__init__.py,sha256=i95iijwdmzAQ0pv9-Z_swyS-CeeMUon65i0r6iF_124,127
55
+ workos/types/fga/__init__.py,sha256=mVb3gvhvK93PAosSgO1RlNmxYX4zIxVDcZZQ8Jyejuw,151
56
56
  workos/types/fga/authorization_resource_types.py,sha256=wB_CNWhsuCx16u26-o0MJuN2zS6aMV61WDTVHlwD1zk,225
57
57
  workos/types/fga/authorization_resources.py,sha256=pXDMKGTd6AX7Z6zDAud9ebn_NMOAVoXtBNH1VRkmdyI,263
58
- workos/types/fga/check.py,sha256=USmGt0k0ccY5KpcDG0nHk5wSIP9lYL6ZC2AHXYKAX-c,1189
58
+ workos/types/fga/check.py,sha256=6AIHsc2WmsXbpEFZcSTy2hIoSr2rmoLt-8wLWdSrc_E,1274
59
59
  workos/types/fga/list_filters.py,sha256=wLQt_AJprmvglZSWv7ZRjwjD4b2vHL0V_7c9u-5u_Uw,640
60
+ workos/types/fga/warnings.py,sha256=zCasrVd19nRgSR4u5AhsyS_qCUduIfuhMLUdEUtE9Xg,869
60
61
  workos/types/fga/warrant.py,sha256=aKO-9t0NGk-9oQs8j_gnG3VfNU6U9IdGCH4EN3imRWs,1016
61
62
  workos/types/mfa/__init__.py,sha256=-gHL2QwZYbqDGPrIMkUrciJm4EiSRz3fJVF55B3rKiM,253
62
63
  workos/types/mfa/authentication_challenge.py,sha256=V8UYutxCAxenaOeqWuPwQU0QcO4HD_0RoQbkG3sqgAU,436
@@ -117,8 +118,8 @@ workos/utils/_base_http_client.py,sha256=KqRHUaDJUfXGxhu6UHLfZVkIBikcvrUZYhm9GBS
117
118
  workos/utils/http_client.py,sha256=TM5yMFFExmAE8D2Z43-5O301tRbnylLG0aXO0isGorE,6197
118
119
  workos/utils/pagination_order.py,sha256=_-et1DDJLG0czarTU7op4W6RA0V1f85GNsUgtyRU55Q,70
119
120
  workos/utils/request_helper.py,sha256=NaO16qPPbSNnCeE0fiNKYb8gM-dK_okYVJbLGrEGXz8,793
120
- workos-5.20.2.dist-info/LICENSE,sha256=mU--WL1JzelH2tXpKVoOlpud4cpqKSRTtdArCvYZmb4,1063
121
- workos-5.20.2.dist-info/METADATA,sha256=44vft5bmjzJKVrKy5hbkMkXSSltlkpSsoyZ6-faeUZI,4187
122
- workos-5.20.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
123
- workos-5.20.2.dist-info/top_level.txt,sha256=ZFskIfue1Tw-JwjyIXRvdsAl9i0DX9VbqmgICXV84Sk,7
124
- workos-5.20.2.dist-info/RECORD,,
121
+ workos-5.21.0.dist-info/LICENSE,sha256=mU--WL1JzelH2tXpKVoOlpud4cpqKSRTtdArCvYZmb4,1063
122
+ workos-5.21.0.dist-info/METADATA,sha256=SuIoJTI38CWgt5EbmrbOHhnTZgIQ9wjRhFxgJhbHhss,4187
123
+ workos-5.21.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
124
+ workos-5.21.0.dist-info/top_level.txt,sha256=ZFskIfue1Tw-JwjyIXRvdsAl9i0DX9VbqmgICXV84Sk,7
125
+ workos-5.21.0.dist-info/RECORD,,