jvspatial 0.0.1__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.
- jvspatial/__init__.py +104 -0
- jvspatial/api/__init__.py +45 -0
- jvspatial/api/auth/config.py +76 -0
- jvspatial/api/auth/enhanced.py +503 -0
- jvspatial/api/auth/models.py +75 -0
- jvspatial/api/auth/openapi_config.py +209 -0
- jvspatial/api/auth/service.py +338 -0
- jvspatial/api/components/__init__.py +19 -0
- jvspatial/api/components/app_builder.py +154 -0
- jvspatial/api/components/auth_middleware.py +323 -0
- jvspatial/api/components/endpoint_manager.py +328 -0
- jvspatial/api/components/error_handler.py +118 -0
- jvspatial/api/config.py +191 -0
- jvspatial/api/constants.py +220 -0
- jvspatial/api/context.py +141 -0
- jvspatial/api/decorators/__init__.py +60 -0
- jvspatial/api/decorators/field.py +146 -0
- jvspatial/api/decorators/route.py +354 -0
- jvspatial/api/decorators/route_config.py +322 -0
- jvspatial/api/endpoints/__init__.py +56 -0
- jvspatial/api/endpoints/factory.py +428 -0
- jvspatial/api/endpoints/metadata.py +94 -0
- jvspatial/api/endpoints/registry.py +605 -0
- jvspatial/api/endpoints/response.py +821 -0
- jvspatial/api/endpoints/router.py +995 -0
- jvspatial/api/exceptions.py +451 -0
- jvspatial/api/integrations/__init__.py +15 -0
- jvspatial/api/integrations/scheduler/__init__.py +18 -0
- jvspatial/api/integrations/scheduler/decorators.py +219 -0
- jvspatial/api/integrations/scheduler/middleware.py +237 -0
- jvspatial/api/integrations/scheduler/models.py +117 -0
- jvspatial/api/integrations/scheduler/scheduler.py +992 -0
- jvspatial/api/integrations/storage/__init__.py +12 -0
- jvspatial/api/integrations/storage/service.py +347 -0
- jvspatial/api/integrations/webhooks/__init__.py +19 -0
- jvspatial/api/integrations/webhooks/decorators.py +12 -0
- jvspatial/api/integrations/webhooks/helpers.py +328 -0
- jvspatial/api/integrations/webhooks/middleware.py +595 -0
- jvspatial/api/integrations/webhooks/models.py +416 -0
- jvspatial/api/integrations/webhooks/utils.py +507 -0
- jvspatial/api/middleware/__init__.py +24 -0
- jvspatial/api/middleware/error.py +102 -0
- jvspatial/api/middleware/manager.py +261 -0
- jvspatial/api/server.py +1573 -0
- jvspatial/api/services/__init__.py +28 -0
- jvspatial/api/services/discovery.py +332 -0
- jvspatial/api/services/lifecycle.py +237 -0
- jvspatial/async_utils/__init__.py +506 -0
- jvspatial/cache/__init__.py +29 -0
- jvspatial/cache/base.py +187 -0
- jvspatial/cache/factory.py +80 -0
- jvspatial/cache/layered.py +281 -0
- jvspatial/cache/memory.py +205 -0
- jvspatial/cache/redis.py +349 -0
- jvspatial/config.py +319 -0
- jvspatial/core/__init__.py +64 -0
- jvspatial/core/annotations.py +340 -0
- jvspatial/core/context.py +1084 -0
- jvspatial/core/decorators.py +85 -0
- jvspatial/core/entities/__init__.py +38 -0
- jvspatial/core/entities/edge.py +338 -0
- jvspatial/core/entities/node.py +804 -0
- jvspatial/core/entities/node_query.py +87 -0
- jvspatial/core/entities/object.py +526 -0
- jvspatial/core/entities/root.py +44 -0
- jvspatial/core/entities/walker.py +896 -0
- jvspatial/core/entities/walker_components/__init__.py +13 -0
- jvspatial/core/entities/walker_components/event_system.py +37 -0
- jvspatial/core/entities/walker_components/protection.py +169 -0
- jvspatial/core/entities/walker_components/walker_queue.py +195 -0
- jvspatial/core/entities/walker_components/walker_trail.py +72 -0
- jvspatial/core/events.py +186 -0
- jvspatial/core/graph.py +453 -0
- jvspatial/core/pager.py +310 -0
- jvspatial/core/utils.py +69 -0
- jvspatial/db/__init__.py +73 -0
- jvspatial/db/database.py +116 -0
- jvspatial/db/dynamodb.py +333 -0
- jvspatial/db/factory.py +335 -0
- jvspatial/db/jsondb.py +133 -0
- jvspatial/db/manager.py +266 -0
- jvspatial/db/mongodb.py +94 -0
- jvspatial/db/query.py +645 -0
- jvspatial/db/sqlite.py +235 -0
- jvspatial/db/transaction.py +277 -0
- jvspatial/dev_tools/__init__.py +484 -0
- jvspatial/exceptions.py +472 -0
- jvspatial/logging/__init__.py +336 -0
- jvspatial/memory/__init__.py +481 -0
- jvspatial/profiling/__init__.py +486 -0
- jvspatial/storage/__init__.py +228 -0
- jvspatial/storage/exceptions.py +165 -0
- jvspatial/storage/interfaces/__init__.py +34 -0
- jvspatial/storage/interfaces/base.py +390 -0
- jvspatial/storage/interfaces/local.py +772 -0
- jvspatial/storage/interfaces/s3.py +764 -0
- jvspatial/storage/managers/__init__.py +12 -0
- jvspatial/storage/managers/proxy.py +494 -0
- jvspatial/storage/models.py +108 -0
- jvspatial/storage/security/__init__.py +27 -0
- jvspatial/storage/security/path_sanitizer.py +278 -0
- jvspatial/storage/security/validator.py +394 -0
- jvspatial/testing/__init__.py +649 -0
- jvspatial/utils/__init__.py +162 -0
- jvspatial/utils/context.py +60 -0
- jvspatial/utils/decorators.py +340 -0
- jvspatial/utils/factory.py +96 -0
- jvspatial/utils/serialization.py +46 -0
- jvspatial/utils/types.py +402 -0
- jvspatial/utils/validation.py +41 -0
- jvspatial/version.py +12 -0
- jvspatial-0.0.1.dist-info/METADATA +394 -0
- jvspatial-0.0.1.dist-info/RECORD +116 -0
- jvspatial-0.0.1.dist-info/WHEEL +5 -0
- jvspatial-0.0.1.dist-info/licenses/LICENSE +21 -0
- jvspatial-0.0.1.dist-info/top_level.txt +1 -0
jvspatial/__init__.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""
|
|
2
|
+
jvspatial - Enhanced async object-spatial Python library.
|
|
3
|
+
|
|
4
|
+
jvspatial is an asynchronous, object-spatial Python library designed for building
|
|
5
|
+
robust persistence and business logic application layers. This enhanced version
|
|
6
|
+
maintains the original inheritance hierarchy while providing simplified APIs.
|
|
7
|
+
|
|
8
|
+
Key Features:
|
|
9
|
+
- Maintained inheritance hierarchy: Object → Node → Edge/Walker
|
|
10
|
+
- Enhanced classes with simplified decorator support
|
|
11
|
+
- Simplified decorator system (@attribute, @endpoint)
|
|
12
|
+
- Direct instantiation (no complex factories)
|
|
13
|
+
- Essential CRUD operations
|
|
14
|
+
- Unified configuration system
|
|
15
|
+
- Async/await architecture
|
|
16
|
+
|
|
17
|
+
Main Exports (Import from top level):
|
|
18
|
+
Core Entities (Maintaining Original Hierarchy):
|
|
19
|
+
- Object: Base class for all entities
|
|
20
|
+
- Node: Graph nodes with spatial data (inherits from Object)
|
|
21
|
+
- Edge: Relationships between nodes (inherits from Object)
|
|
22
|
+
- Walker: Graph traversal and pathfinding (inherits from Object)
|
|
23
|
+
- Root: Singleton root node (inherits from Node)
|
|
24
|
+
- GraphContext: Graph database context
|
|
25
|
+
|
|
26
|
+
Decorators:
|
|
27
|
+
- attribute: Unified attribute decorator (@attribute(protected=True))
|
|
28
|
+
- endpoint: Unified endpoint decorator (@endpoint("/api/users"))
|
|
29
|
+
|
|
30
|
+
API:
|
|
31
|
+
- Server: FastAPI server for graph operations
|
|
32
|
+
- Config: Unified configuration system
|
|
33
|
+
|
|
34
|
+
Database & Cache:
|
|
35
|
+
- Database: Simplified database interface
|
|
36
|
+
- create_database: Direct database creation
|
|
37
|
+
- create_cache: Direct cache creation
|
|
38
|
+
|
|
39
|
+
Utilities:
|
|
40
|
+
- serialize_datetime: Serialize datetime objects
|
|
41
|
+
- deserialize_datetime: Deserialize datetime objects
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
# Using enhanced classes with maintained hierarchy
|
|
45
|
+
from jvspatial import Node, Walker, Server, Config, create_database
|
|
46
|
+
|
|
47
|
+
# Node inherits from Object with all original functionality
|
|
48
|
+
node = Node(id="test-node")
|
|
49
|
+
|
|
50
|
+
# Walker inherits from Object with all original functionality
|
|
51
|
+
walker = Walker()
|
|
52
|
+
await walker.spawn(node)
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
# API server
|
|
56
|
+
from .api import Server
|
|
57
|
+
from .api.decorators.route import endpoint
|
|
58
|
+
from .cache import create_cache
|
|
59
|
+
|
|
60
|
+
# Unified configuration
|
|
61
|
+
from .config import Config
|
|
62
|
+
|
|
63
|
+
# Simplified decorators
|
|
64
|
+
from .core.annotations import attribute
|
|
65
|
+
from .core.context import GraphContext
|
|
66
|
+
|
|
67
|
+
# Unified entity system
|
|
68
|
+
from .core.entities import Edge, Node, Object, Root, Walker
|
|
69
|
+
|
|
70
|
+
# Simplified database and cache
|
|
71
|
+
from .db import Database, create_database
|
|
72
|
+
|
|
73
|
+
# Utilities
|
|
74
|
+
from .utils.serialization import deserialize_datetime, serialize_datetime
|
|
75
|
+
|
|
76
|
+
# Version is managed in version.py
|
|
77
|
+
# Update version.py to release a new version
|
|
78
|
+
from .version import __version__
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
# Version
|
|
82
|
+
"__version__",
|
|
83
|
+
# Unified configuration
|
|
84
|
+
"Config",
|
|
85
|
+
# Core entities
|
|
86
|
+
"Object",
|
|
87
|
+
"Node",
|
|
88
|
+
"Edge",
|
|
89
|
+
"Walker",
|
|
90
|
+
"Root",
|
|
91
|
+
"GraphContext",
|
|
92
|
+
# Simplified decorators
|
|
93
|
+
"attribute",
|
|
94
|
+
"endpoint",
|
|
95
|
+
# API
|
|
96
|
+
"Server",
|
|
97
|
+
# Database & Cache
|
|
98
|
+
"Database",
|
|
99
|
+
"create_database",
|
|
100
|
+
"create_cache",
|
|
101
|
+
# Utilities
|
|
102
|
+
"serialize_datetime",
|
|
103
|
+
"deserialize_datetime",
|
|
104
|
+
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""API module for jvspatial.
|
|
2
|
+
|
|
3
|
+
This module provides:
|
|
4
|
+
- Server implementation with FastAPI integration
|
|
5
|
+
- Authentication and authorization
|
|
6
|
+
- Response handling
|
|
7
|
+
- Endpoint configuration
|
|
8
|
+
- Error handling
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .config import ServerConfig
|
|
12
|
+
from .context import ServerContext, get_current_server, set_current_server
|
|
13
|
+
from .decorators.route import endpoint
|
|
14
|
+
|
|
15
|
+
# Note: EndpointField, EndpointFieldInfo, endpoint_field moved to endpoints module
|
|
16
|
+
# from .endpoints import EndpointField, EndpointFieldInfo, endpoint_field
|
|
17
|
+
# from .endpoints import ResponseHelper, format_response
|
|
18
|
+
# Note: Routing moved to endpoints module
|
|
19
|
+
# from .routing import (
|
|
20
|
+
# BaseRouter,
|
|
21
|
+
# EndpointRouter,
|
|
22
|
+
# )
|
|
23
|
+
from .server import Server, create_lambda_handler, create_server
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
# Main exports
|
|
27
|
+
"Server",
|
|
28
|
+
"ServerConfig",
|
|
29
|
+
"create_server",
|
|
30
|
+
"create_lambda_handler",
|
|
31
|
+
"get_current_server",
|
|
32
|
+
"set_current_server",
|
|
33
|
+
"ServerContext",
|
|
34
|
+
"endpoint",
|
|
35
|
+
# Core routers (for advanced usage)
|
|
36
|
+
"BaseRouter",
|
|
37
|
+
"EndpointRouter",
|
|
38
|
+
# Field configuration
|
|
39
|
+
"endpoint_field",
|
|
40
|
+
"EndpointField",
|
|
41
|
+
"EndpointFieldInfo",
|
|
42
|
+
# Response handling
|
|
43
|
+
"format_response",
|
|
44
|
+
"ResponseHelper",
|
|
45
|
+
]
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Authentication configuration for jvspatial API.
|
|
2
|
+
|
|
3
|
+
This module provides authentication configuration models for the jvspatial API,
|
|
4
|
+
including JWT, API key, and session-based authentication settings.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import List
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AuthConfig(BaseModel):
|
|
13
|
+
"""Authentication configuration model.
|
|
14
|
+
|
|
15
|
+
Attributes:
|
|
16
|
+
enabled: Enable authentication middleware
|
|
17
|
+
exempt_paths: List of paths exempt from authentication
|
|
18
|
+
jwt_secret: JWT secret key
|
|
19
|
+
jwt_algorithm: JWT algorithm
|
|
20
|
+
jwt_expire_minutes: JWT expiration time in minutes
|
|
21
|
+
api_key_header: Header name for API key authentication
|
|
22
|
+
session_cookie_name: Cookie name for session authentication
|
|
23
|
+
session_expire_minutes: Session expiration time in minutes
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# General Authentication Settings
|
|
27
|
+
enabled: bool = True
|
|
28
|
+
exempt_paths: List[str] = Field(
|
|
29
|
+
default_factory=lambda: [
|
|
30
|
+
"/health",
|
|
31
|
+
"/docs",
|
|
32
|
+
"/redoc",
|
|
33
|
+
"/openapi.json",
|
|
34
|
+
"/favicon.ico",
|
|
35
|
+
]
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# JWT Configuration
|
|
39
|
+
jwt_secret: str = Field(default="your-secret-key", description="JWT secret key")
|
|
40
|
+
jwt_algorithm: str = Field(default="HS256", description="JWT algorithm")
|
|
41
|
+
jwt_expire_minutes: int = Field(
|
|
42
|
+
default=30, description="JWT expiration time in minutes"
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# API Key Configuration
|
|
46
|
+
api_key_header: str = Field(
|
|
47
|
+
default="x-api-key", description="Header name for API key"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# Session Configuration
|
|
51
|
+
session_cookie_name: str = Field(
|
|
52
|
+
default="session", description="Session cookie name"
|
|
53
|
+
)
|
|
54
|
+
session_expire_minutes: int = Field(
|
|
55
|
+
default=60, description="Session expiration time in minutes"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Rate Limiting Configuration
|
|
59
|
+
rate_limit_enabled: bool = Field(default=False, description="Enable rate limiting")
|
|
60
|
+
rate_limit_requests_per_minute: int = Field(
|
|
61
|
+
default=60, description="Requests per minute limit"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Brute Force Protection
|
|
65
|
+
brute_force_protection_enabled: bool = Field(
|
|
66
|
+
default=False, description="Enable brute force protection"
|
|
67
|
+
)
|
|
68
|
+
max_login_attempts: int = Field(
|
|
69
|
+
default=5, description="Maximum login attempts before lockout"
|
|
70
|
+
)
|
|
71
|
+
lockout_duration_minutes: int = Field(
|
|
72
|
+
default=15, description="Lockout duration in minutes"
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
__all__ = ["AuthConfig"]
|