maleo-foundation 0.0.22__tar.gz → 0.0.24__tar.gz

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.
Files changed (62) hide show
  1. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/PKG-INFO +1 -1
  2. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/schemas/general.py +16 -15
  3. maleo_foundation-0.0.24/maleo_foundation/models/schemas/parameter.py +18 -0
  4. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/schemas/result.py +8 -10
  5. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/types/__init__.py +4 -0
  6. maleo_foundation-0.0.24/maleo_foundation/models/types/general.py +44 -0
  7. maleo_foundation-0.0.24/maleo_foundation/models/types/parameter.py +9 -0
  8. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation.egg-info/PKG-INFO +1 -1
  9. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation.egg-info/SOURCES.txt +2 -0
  10. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/pyproject.toml +1 -1
  11. maleo_foundation-0.0.22/maleo_foundation/models/schemas/parameter.py +0 -16
  12. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/README.md +0 -0
  13. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/__init__.py +0 -0
  14. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/__init__.py +0 -0
  15. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/general/__init__.py +0 -0
  16. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/general/http.py +0 -0
  17. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/google/__init__.py +0 -0
  18. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/google/cloud/__init__.py +0 -0
  19. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/google/cloud/logging.py +0 -0
  20. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/google/cloud/secret.py +0 -0
  21. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/clients/google/cloud/storage.py +0 -0
  22. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/constants.py +0 -0
  23. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/controller.py +0 -0
  24. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/db/__init__.py +0 -0
  25. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/db/database.py +0 -0
  26. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/db/engine.py +0 -0
  27. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/db/session.py +0 -0
  28. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/middlewares/__init__.py +0 -0
  29. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/middlewares/base.py +0 -0
  30. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/middlewares/cors.py +0 -0
  31. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/__init__.py +0 -0
  32. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/enums.py +0 -0
  33. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/responses.py +0 -0
  34. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/schemas/__init__.py +0 -0
  35. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/__init__.py +0 -0
  36. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
  37. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/parameters/client.py +0 -0
  38. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/parameters/general.py +0 -0
  39. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/parameters/service.py +0 -0
  40. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/__init__.py +0 -0
  41. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
  42. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
  43. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
  44. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/client/service.py +0 -0
  45. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
  46. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
  47. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
  48. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/service/general.py +0 -0
  49. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/transfers/results/service/query.py +0 -0
  50. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/types/client.py +0 -0
  51. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/types/query.py +0 -0
  52. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/models/types/service.py +0 -0
  53. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/query.py +0 -0
  54. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/utils/__init__.py +0 -0
  55. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/utils/exceptions.py +0 -0
  56. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/utils/formatter/__init__.py +0 -0
  57. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/utils/formatter/case.py +0 -0
  58. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation/utils/logger.py +0 -0
  59. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation.egg-info/dependency_links.txt +0 -0
  60. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation.egg-info/requires.txt +0 -0
  61. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/maleo_foundation.egg-info/top_level.txt +0 -0
  62. {maleo_foundation-0.0.22 → maleo_foundation-0.0.24}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -1,25 +1,26 @@
1
1
  from __future__ import annotations
2
2
  from datetime import date, datetime, timedelta, timezone
3
3
  from pydantic import BaseModel, Field, model_validator, field_serializer, FieldSerializationInfo
4
- from typing import Optional, Union, Any
4
+ from typing import Optional, Any
5
5
  from uuid import UUID
6
- from maleo_foundation.models.enums import BaseEnums
7
6
  from maleo_foundation.constants import REFRESH_TOKEN_DURATION_DAYS, ACCESS_TOKEN_DURATION_MINUTES
7
+ from maleo_foundation.models.enums import BaseEnums
8
+ from maleo_foundation.models.types.general import BaseGeneralTypes
8
9
 
9
10
  class BaseGeneralSchemas:
10
11
  class IDs(BaseModel):
11
- ids:Optional[list[int]] = Field(None, description="Specific IDs")
12
+ ids:BaseGeneralTypes.OptionalListOfIntegers = Field(None, description="Specific IDs")
12
13
 
13
14
  class Search(BaseModel):
14
- search:Optional[str] = Field(None, description="Search parameter string.")
15
+ search:BaseGeneralTypes.OptionalString = Field(None, description="Search parameter string.")
15
16
 
16
17
  class DateFilter(BaseModel):
17
18
  name:str = Field(..., description="Column name.")
18
- from_date:Optional[datetime] = Field(None, description="From date.")
19
- to_date:Optional[datetime] = Field(None, description="To date.")
19
+ from_date:BaseGeneralTypes.OptionalDatetime = Field(None, description="From date.")
20
+ to_date:BaseGeneralTypes.OptionalDatetime = Field(None, description="To date.")
20
21
 
21
22
  class Statuses(BaseModel):
22
- statuses:Optional[list[BaseEnums.StatusType]] = Field(None, description="Data's status")
23
+ statuses:BaseGeneralTypes.OptionalListOfStatuses = Field(None, description="Data's status")
23
24
 
24
25
  class SortColumn(BaseModel):
25
26
  name:str = Field(..., description="Column name.")
@@ -38,7 +39,7 @@ class BaseGeneralSchemas:
38
39
  action:BaseEnums.StatusUpdateAction = Field(..., description="Status update's action to be executed")
39
40
 
40
41
  class Expand(BaseModel):
41
- expand:Optional[list[str]] = Field(None, description="Expanded field(s)")
42
+ expand:BaseGeneralTypes.OptionalListOfStrings = Field(None, description="Expanded field(s)")
42
43
 
43
44
  class PrivateKey(BaseModel):
44
45
  private_key:str = Field(..., description="Private key in str format.")
@@ -60,13 +61,13 @@ class BaseGeneralSchemas:
60
61
  class Timestamps(BaseModel):
61
62
  created_at:datetime = Field(..., description="Data's created_at timestamp")
62
63
  updated_at:datetime = Field(..., description="Data's updated_at timestamp")
63
- deleted_at:Optional[datetime] = Field(..., description="Data's deleted_at timestamp")
64
- restored_at:Optional[datetime] = Field(..., description="Data's restored_at timestamp")
65
- deactivated_at:Optional[datetime] = Field(..., description="Data's deactivated_at timestamp")
64
+ deleted_at:BaseGeneralTypes.OptionalDatetime = Field(..., description="Data's deleted_at timestamp")
65
+ restored_at:BaseGeneralTypes.OptionalDatetime = Field(..., description="Data's restored_at timestamp")
66
+ deactivated_at:BaseGeneralTypes.OptionalDatetime = Field(..., description="Data's deactivated_at timestamp")
66
67
  activated_at:datetime = Field(..., description="Data's activated_at timestamp")
67
68
 
68
69
  @field_serializer('created_at', 'updated_at', 'deleted_at', 'restored_at', 'deactivated_at', 'activated_at')
69
- def serialize_timestamps(self, value:Optional[datetime], info:FieldSerializationInfo) -> str:
70
+ def serialize_timestamps(self, value:BaseGeneralTypes.OptionalDatetime, info:FieldSerializationInfo) -> str:
70
71
  """Serializes datetime/date fields to ISO format."""
71
72
  if value is not None:
72
73
  return value.isoformat()
@@ -76,7 +77,7 @@ class BaseGeneralSchemas:
76
77
  status:BaseEnums.StatusType = Field(..., description="Data's status")
77
78
 
78
79
  class Order(BaseModel):
79
- order:Optional[int] = Field(..., description="Data's order")
80
+ order:BaseGeneralTypes.OptionalInteger = Field(..., description="Data's order")
80
81
 
81
82
  class Key(BaseModel):
82
83
  key:str = Field(..., description="Data's key")
@@ -88,8 +89,8 @@ class BaseGeneralSchemas:
88
89
  t:BaseEnums.TokenType = Field(..., description="Token Type")
89
90
  sr:UUID = Field(..., description="System role")
90
91
  u:UUID = Field(..., description="user")
91
- o:Optional[UUID] = Field(..., description="Organization")
92
- uor:Optional[list[UUID]] = Field(..., description="User Organization Role")
92
+ o:BaseGeneralTypes.OptionalUUID = Field(..., description="Organization")
93
+ uor:BaseGeneralTypes.OptionalListOfUUIDs = Field(..., description="User Organization Role")
93
94
  iat_dt:datetime = Field(datetime.now(timezone.utc), description="Issued at (datetime)")
94
95
  iat:int = Field(None, description="Issued at (integer)")
95
96
  exp_dt:datetime = Field(None, description="Expired at (datetime)")
@@ -0,0 +1,18 @@
1
+ from pydantic import BaseModel, Field
2
+ from maleo_foundation.models.enums import BaseEnums
3
+ from maleo_foundation.models.schemas.general import BaseGeneralSchemas
4
+ from maleo_foundation.models.types.general import BaseGeneralTypes
5
+ from maleo_foundation.models.types.parameter import BaseParameterTypes
6
+
7
+ class BaseParameterSchemas:
8
+ class Filters(BaseModel):
9
+ filters:BaseGeneralTypes.ListOfStrings = Field([], description="Filters for date range, e.g. 'created_at|from::<ISO_DATETIME>|to::<ISO_DATETIME>'.")
10
+
11
+ class DateFilters(BaseModel):
12
+ date_filters:BaseParameterTypes.ListOfDateFilters = Field([], description="Date filters to be applied")
13
+
14
+ class Sorts(BaseModel):
15
+ sorts:BaseGeneralTypes.ListOfStrings = Field(["id.asc"], description="Sorting columns in 'column_name.asc' or 'column_name.desc' format.")
16
+
17
+ class SortColumns(BaseModel):
18
+ sort_columns:BaseParameterTypes.ListOfSortColumns = Field([BaseGeneralSchemas.SortColumn(name="id", order=BaseEnums.SortOrder.ASC)], description="List of columns to be sorted")
@@ -1,37 +1,35 @@
1
1
  from pydantic import BaseModel, Field
2
2
  from typing import Literal, Optional, Any
3
3
  from maleo_foundation.models.schemas.general import BaseGeneralSchemas
4
+ from maleo_foundation.models.types.general import BaseGeneralTypes
4
5
 
5
6
  class BaseResultSchemas:
6
7
  class Base(BaseModel):
7
8
  success:bool = Field(..., description="Success status")
8
- code:Optional[str] = Field(None, description="Optional result code")
9
- message:Optional[str] = Field(None, description="Optional message")
10
- description:Optional[str] = Field(None, description="Optional description")
9
+ code:BaseGeneralTypes.OptionalString = Field(None, description="Optional result code")
10
+ message:BaseGeneralTypes.OptionalString = Field(None, description="Optional message")
11
+ description:BaseGeneralTypes.OptionalString = Field(None, description="Optional description")
11
12
  data:Any = Field(..., description="Data")
12
- other:Optional[Any] = Field(None, description="Optional other information")
13
+ other:BaseGeneralTypes.OptionalAny = Field(None, description="Optional other information")
13
14
 
14
15
  #* ----- ----- ----- Intermediary ----- ----- ----- *#
15
16
  class Fail(Base):
16
- success:Literal[False] = Field(False, description="Success status")
17
+ success:BaseGeneralTypes.LiteralFalse = Field(False, description="Success status")
17
18
  data:None = Field(None, description="No data")
18
19
 
19
20
  class Success(Base):
20
- success:Literal[True] = Field(True, description="Success status")
21
+ success:BaseGeneralTypes.LiteralTrue = Field(True, description="Success status")
21
22
  data:Any = Field(..., description="Data")
22
23
 
23
24
  #* ----- ----- ----- Derived ----- ----- ----- *#
24
25
  class NoData(Success):
25
- success:Literal[True] = Field(True, description="Success status")
26
26
  data:None = Field(None, description="No data")
27
27
 
28
28
  class SingleData(Success):
29
- success:Literal[True] = Field(True, description="Success status")
30
29
  data:Any = Field(..., description="Fetched single data")
31
30
 
32
31
  class UnpaginatedMultipleData(Success):
33
- success:Literal[True] = Field(True, description="Success status")
34
- data:list[Any] = Field(..., description="Unpaginated multiple data")
32
+ data:BaseGeneralTypes.ListOfAny = Field(..., description="Unpaginated multiple data")
35
33
 
36
34
  class PaginatedMultipleData(
37
35
  UnpaginatedMultipleData,
@@ -1,9 +1,13 @@
1
1
  from __future__ import annotations
2
+ from .general import BaseGeneralTypes
3
+ from .parameter import BaseParameterTypes
2
4
  from .query import BaseQueryTypes
3
5
  from .service import BaseServiceTypes
4
6
  from .client import BaseClientTypes
5
7
 
6
8
  class BaseTypes:
9
+ General = BaseGeneralTypes
10
+ Parameter = BaseParameterTypes
7
11
  Query = BaseQueryTypes
8
12
  Service = BaseServiceTypes
9
13
  Client = BaseClientTypes
@@ -0,0 +1,44 @@
1
+ from datetime import datetime
2
+ from typing import Optional, Union, Literal, List, Any
3
+ from uuid import UUID
4
+ from maleo_foundation.models.enums import BaseEnums
5
+ from maleo_foundation.models.schemas.general import BaseGeneralSchemas
6
+
7
+ class BaseGeneralTypes:
8
+ #* Any-related types
9
+ ListOfAny = List[Any]
10
+ OptionalAny = Optional[Any]
11
+
12
+ #* Boolean-related types
13
+ LiteralFalse = Literal[False]
14
+ LiteralTrue = Literal[True]
15
+
16
+ #* Float-related types
17
+ ListOfFloats = List[float]
18
+ OptionalFloat = Optional[float]
19
+ OptionalListOfFloats = Optional[List[float]]
20
+
21
+ #* Integer-related types
22
+ ListOfIntegers = List[int]
23
+ OptionalInteger = Optional[int]
24
+ OptionalListOfIntegers = Optional[List[int]]
25
+
26
+ #* String-related types
27
+ ListOfStrings = List[str]
28
+ OptionalString = Optional[str]
29
+ OptionalListOfStrings = Optional[List[str]]
30
+
31
+ #* Datetime-related types
32
+ OptionalDatetime = Optional[datetime]
33
+
34
+ #* UUID-related types
35
+ ListOfUUIDs = List[UUID]
36
+ OptionalUUID = Optional[UUID]
37
+ OptionalListOfUUIDs = Optional[List[UUID]]
38
+
39
+ #* Statuses-related types
40
+ ListOfStatuses = List[BaseEnums.StatusType]
41
+ OptionalListOfStatuses = Optional[List[BaseEnums.StatusType]]
42
+
43
+ #* Miscellanous types
44
+ IdentifierValue = Union[int, UUID, str]
@@ -0,0 +1,9 @@
1
+ from typing import List
2
+ from maleo_foundation.models.schemas.general import BaseGeneralSchemas
3
+
4
+ class BaseParameterTypes:
5
+ #* DateFilter-related types
6
+ ListOfDateFilters = List[BaseGeneralSchemas.DateFilter]
7
+
8
+ #* SortColumn-related types
9
+ ListOfSortColumns = List[BaseGeneralSchemas.SortColumn]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -48,6 +48,8 @@ maleo_foundation/models/transfers/results/service/controllers/__init__.py
48
48
  maleo_foundation/models/transfers/results/service/controllers/rest.py
49
49
  maleo_foundation/models/types/__init__.py
50
50
  maleo_foundation/models/types/client.py
51
+ maleo_foundation/models/types/general.py
52
+ maleo_foundation/models/types/parameter.py
51
53
  maleo_foundation/models/types/query.py
52
54
  maleo_foundation/models/types/service.py
53
55
  maleo_foundation/utils/__init__.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maleo_foundation"
7
- version = "0.0.22"
7
+ version = "0.0.24"
8
8
  description = "Foundation package for Maleo"
9
9
  authors = [
10
10
  { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }
@@ -1,16 +0,0 @@
1
- from pydantic import BaseModel, Field
2
- from maleo_foundation.models.enums import BaseEnums
3
- from maleo_foundation.models.schemas.general import BaseGeneralSchemas
4
-
5
- class BaseParameterSchemas:
6
- class Filters(BaseModel):
7
- filters:list[str] = Field([], description="Filters for date range, e.g. 'created_at|from::<ISO_DATETIME>|to::<ISO_DATETIME>'.")
8
-
9
- class DateFilters(BaseModel):
10
- date_filters:list[BaseGeneralSchemas.DateFilter] = Field([], description="Date filters to be applied")
11
-
12
- class Sorts(BaseModel):
13
- sorts:list[str] = Field(["id.asc"], description="Sorting columns in 'column_name.asc' or 'column_name.desc' format.")
14
-
15
- class SortColumns(BaseModel):
16
- sort_columns:list[BaseGeneralSchemas.SortColumn] = Field([BaseGeneralSchemas.SortColumn(name="id", order=BaseEnums.SortOrder.ASC)], description="List of columns to be sorted")