an5-client 0.1.4__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.
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: an5-client
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: Python client models for AN5 ORM.
|
|
5
|
+
Author: an5ORM
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: an5,client,orm
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# an5Client
|
|
14
|
+
|
|
15
|
+
Auto-generated client artifacts for AN5 ORM. Contains TypeScript, Python, .NET (C#), Golang, and Rust model types, metadata, and entity classes generated from `.an5` schema files.
|
|
16
|
+
|
|
17
|
+
## Structure
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
an5Client/
|
|
21
|
+
├── typescript/ # TypeScript types and metadata
|
|
22
|
+
│ ├── index.ts # Barrel exports & An5Client class
|
|
23
|
+
│ ├── base.ts # Base types, filters, error classes
|
|
24
|
+
│ ├── an5Metadata.ts # Model-table mappings, relations
|
|
25
|
+
│ ├── User.ts # Generated User model & TableClient
|
|
26
|
+
│ └── Order.ts # Generated Order model & TableClient
|
|
27
|
+
├── python/ # Python metadata, dataclasses, and ORM client
|
|
28
|
+
│ ├── __init__.py
|
|
29
|
+
│ ├── an5_metadata.py # Model-table mappings & field metadata
|
|
30
|
+
│ ├── an5_models.py # Python @dataclass model definitions
|
|
31
|
+
│ └── an5_client.py # Typed An5Client ORM class
|
|
32
|
+
├── dotnet/ # .NET entity classes & DbContext
|
|
33
|
+
│ ├── User.cs
|
|
34
|
+
│ ├── Order.cs
|
|
35
|
+
│ ├── An5DbContext.cs # Complete DbContext & TableClient<T> repository
|
|
36
|
+
│ └── An5Config.cs
|
|
37
|
+
└── golang/ # Golang models & DbContext repository
|
|
38
|
+
├── User.go # Generated User struct + WhereInput/OrderBy/Args
|
|
39
|
+
├── Order.go # Generated Order struct + WhereInput/OrderBy/Args
|
|
40
|
+
├── client.go # An5DbContext & generic TableClient[T]
|
|
41
|
+
└── config.go # Environment connection string helper
|
|
42
|
+
└── rust/ # Rust crate (serde + chrono)
|
|
43
|
+
├── Cargo.toml # Crate manifest (an5-client)
|
|
44
|
+
└── src/
|
|
45
|
+
├── lib.rs # Module exports
|
|
46
|
+
├── models.rs # Structs + WhereInput/OrderBy/FindManyArgs
|
|
47
|
+
├── filters.rs # StringFilter/IntFilter/NumberFilter/Bool/DateTime + Dialect
|
|
48
|
+
├── metadata.rs # model_to_table / model_primary_key
|
|
49
|
+
├── config.rs # DATABASE_URL helper
|
|
50
|
+
└── client.rs # An5Client (adapter-backed) + typed <Model>Table handles + vector math
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
### TypeScript
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { An5Client, User, Order } from './an5Client/typescript';
|
|
59
|
+
|
|
60
|
+
const db = new An5Client();
|
|
61
|
+
|
|
62
|
+
// Supports flex property casing (db.User, db.user, db.Users, db.users)
|
|
63
|
+
const users = await db.User.findMany({
|
|
64
|
+
where: { email: { contains: '@example.com' } }
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Python
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from an5Client.python import An5Client, User
|
|
72
|
+
|
|
73
|
+
db = An5Client()
|
|
74
|
+
|
|
75
|
+
# Supports flexible property casing (db.User, db.user, db.Users, db.users)
|
|
76
|
+
users = db.User.find_many(where={"email": {"contains": "@example.com"}})
|
|
77
|
+
user = db.User.create({"email": "john@example.com", "name": "John"})
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### .NET (C#)
|
|
81
|
+
|
|
82
|
+
```csharp
|
|
83
|
+
using An5Orm;
|
|
84
|
+
using An5Orm.Entities;
|
|
85
|
+
|
|
86
|
+
var db = new An5DbContext(connectionString);
|
|
87
|
+
|
|
88
|
+
// Supports flexible property access (db.User, db.Users)
|
|
89
|
+
var users = db.User.FindMany("Email LIKE '%@example.com%'");
|
|
90
|
+
var count = db.User.Count();
|
|
91
|
+
db.User.Create(new User { Email = "john@example.com", Name = "John" });
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Golang
|
|
95
|
+
|
|
96
|
+
```go
|
|
97
|
+
package main
|
|
98
|
+
|
|
99
|
+
import (
|
|
100
|
+
"context"
|
|
101
|
+
"database/sql"
|
|
102
|
+
"fmt"
|
|
103
|
+
"an5Client/golang"
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
func main() {
|
|
107
|
+
db, _ := sql.Open("sqlserver", an5client.GetDefaultConnectionString())
|
|
108
|
+
ctx := an5client.NewAn5DbContext(db)
|
|
109
|
+
|
|
110
|
+
// Supports flexible property access (ctx.User, ctx.Users)
|
|
111
|
+
users, _ := ctx.User.FindMany(context.Background(), "email LIKE ?", "%@example.com%")
|
|
112
|
+
fmt.Printf("Found %d users\n", len(users))
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Rust
|
|
117
|
+
|
|
118
|
+
```rust
|
|
119
|
+
use an5_client::{An5Client, StringFilter, UserFindManyArgs, UserWhereInput};
|
|
120
|
+
|
|
121
|
+
#[tokio::main]
|
|
122
|
+
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|
123
|
+
// Register the sqlx drivers you need before connecting.
|
|
124
|
+
sqlx::any::install_drivers(&[sqlx::sqlite::any::DRIVER])?;
|
|
125
|
+
let db = An5Client::connect("sqlite:file:app.sqlite?mode=rwc").await?;
|
|
126
|
+
|
|
127
|
+
// Typed per-model handle.
|
|
128
|
+
let args = UserFindManyArgs {
|
|
129
|
+
where_: Some(UserWhereInput {
|
|
130
|
+
email: Some(StringFilter {
|
|
131
|
+
contains: Some("@example.com".to_string()),
|
|
132
|
+
..Default::default()
|
|
133
|
+
}),
|
|
134
|
+
..Default::default()
|
|
135
|
+
}),
|
|
136
|
+
take: Some(10),
|
|
137
|
+
..Default::default()
|
|
138
|
+
};
|
|
139
|
+
let users = db.user().find_many(&args).await?;
|
|
140
|
+
println!("{} users", users.len());
|
|
141
|
+
|
|
142
|
+
// Or dynamic access, like `db.User` in TypeScript.
|
|
143
|
+
let all = db.table("User").find_many(&Default::default()).await?;
|
|
144
|
+
println!("{} total", all.len());
|
|
145
|
+
Ok(())
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Rust has no dynamic property access, so a generated method (`db.user()`) is
|
|
150
|
+
the equivalent of `db.User` — matching Go, where the generator emits a real
|
|
151
|
+
`ctx.User` field.
|
|
152
|
+
|
|
153
|
+
## Generation
|
|
154
|
+
|
|
155
|
+
This package is auto-generated by `an5Orm/generator`. Do not edit files manually.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Regenerate from schema
|
|
159
|
+
cd ../an5Orm
|
|
160
|
+
npm run generate
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Testing
|
|
164
|
+
|
|
165
|
+
The package ships generated sources for multiple languages, so the local checks
|
|
166
|
+
compile each target surface:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npm test
|
|
170
|
+
npm run test:package:smoke
|
|
171
|
+
npm run test:python
|
|
172
|
+
npm run test:dotnet
|
|
173
|
+
npm run test:go
|
|
174
|
+
npm run test:rust
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
an5_metadata.py,sha256=1MHMy3_TB0rieoHJDFsZFlWdHr1OvRdC3dadsphJYus,8273
|
|
2
|
+
an5_client-0.1.4.dist-info/METADATA,sha256=OFhhcdBiJq9R-asQ9sO_gRR_ehNrZ9aJGmjuz9eIyCs,5451
|
|
3
|
+
an5_client-0.1.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
4
|
+
an5_client-0.1.4.dist-info/top_level.txt,sha256=BOpl1WZnB-UtFc_3J_hhx8UuSdqtD_MKymMR4DRR1SE,13
|
|
5
|
+
an5_client-0.1.4.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
an5_metadata
|
an5_metadata.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# This file is auto-generated. Do not edit directly.
|
|
2
|
+
|
|
3
|
+
MODEL_TO_TABLE = {
|
|
4
|
+
"embeddingConfig": "[dbo].[embeddingconfigs]",
|
|
5
|
+
"embedding_config": "[dbo].[embeddingconfigs]",
|
|
6
|
+
"llmConfig": "[dbo].[llmconfigs]",
|
|
7
|
+
"llm_config": "[dbo].[llmconfigs]",
|
|
8
|
+
"user": "[dbo].[users]",
|
|
9
|
+
"order": "[dbo].[orders]",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
MODEL_DESCRIPTIONS = {
|
|
13
|
+
"embeddingConfig": "Embedding provider configuration. Stores API keys and model settings for RAG features.",
|
|
14
|
+
"embedding_config": "Embedding provider configuration. Stores API keys and model settings for RAG features.",
|
|
15
|
+
"llmConfig": "LLM provider configuration. Stores API keys and model settings for AI features.",
|
|
16
|
+
"llm_config": "LLM provider configuration. Stores API keys and model settings for AI features.",
|
|
17
|
+
"user": "Represents a registered user in the database.",
|
|
18
|
+
"order": "Represents a customer order in the system.",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
MODEL_FIELDS = {
|
|
22
|
+
"embeddingConfig": [
|
|
23
|
+
{ "name": "id", "type": "string", "sql": "NVARCHAR(1000)", "isOptional": False, "hasDefault": True, "isId": True, "description": "Primary key" },
|
|
24
|
+
{ "name": "provider", "type": "string", "sql": "NVARCHAR(100)", "isOptional": False, "hasDefault": False, "isId": False, "description": "Embedding provider: openai, cohere, custom" },
|
|
25
|
+
{ "name": "apiKey", "type": "string", "sql": "NVARCHAR(4000)", "isOptional": False, "hasDefault": False, "isId": False, "description": "API key for the embedding service" },
|
|
26
|
+
{ "name": "model", "type": "string?", "sql": "NVARCHAR(500)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Model name, e.g. text-embedding-3-small" },
|
|
27
|
+
{ "name": "endpoint", "type": "string?", "sql": "NVARCHAR(2000)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Custom endpoint URL" },
|
|
28
|
+
{ "name": "isActive", "type": "boolean", "sql": "BIT", "isOptional": False, "hasDefault": True, "isId": False, "description": "Whether this config is active" },
|
|
29
|
+
{ "name": "createdAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Creation timestamp" },
|
|
30
|
+
{ "name": "updatedAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Last update timestamp" }
|
|
31
|
+
],
|
|
32
|
+
"embedding_config": [
|
|
33
|
+
{ "name": "id", "type": "string", "sql": "NVARCHAR(1000)", "isOptional": False, "hasDefault": True, "isId": True, "description": "Primary key" },
|
|
34
|
+
{ "name": "provider", "type": "string", "sql": "NVARCHAR(100)", "isOptional": False, "hasDefault": False, "isId": False, "description": "Embedding provider: openai, cohere, custom" },
|
|
35
|
+
{ "name": "apiKey", "type": "string", "sql": "NVARCHAR(4000)", "isOptional": False, "hasDefault": False, "isId": False, "description": "API key for the embedding service" },
|
|
36
|
+
{ "name": "model", "type": "string?", "sql": "NVARCHAR(500)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Model name, e.g. text-embedding-3-small" },
|
|
37
|
+
{ "name": "endpoint", "type": "string?", "sql": "NVARCHAR(2000)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Custom endpoint URL" },
|
|
38
|
+
{ "name": "isActive", "type": "boolean", "sql": "BIT", "isOptional": False, "hasDefault": True, "isId": False, "description": "Whether this config is active" },
|
|
39
|
+
{ "name": "createdAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Creation timestamp" },
|
|
40
|
+
{ "name": "updatedAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Last update timestamp" }
|
|
41
|
+
],
|
|
42
|
+
"llmConfig": [
|
|
43
|
+
{ "name": "id", "type": "string", "sql": "NVARCHAR(1000)", "isOptional": False, "hasDefault": True, "isId": True, "description": "Primary key" },
|
|
44
|
+
{ "name": "provider", "type": "string", "sql": "NVARCHAR(100)", "isOptional": False, "hasDefault": False, "isId": False, "description": "LLM provider: openai, gemini, custom, azure" },
|
|
45
|
+
{ "name": "apiKey", "type": "string", "sql": "NVARCHAR(4000)", "isOptional": False, "hasDefault": False, "isId": False, "description": "API key for the LLM provider" },
|
|
46
|
+
{ "name": "model", "type": "string?", "sql": "NVARCHAR(500)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Model name, e.g. gpt-4o, gemini-2.5-flash" },
|
|
47
|
+
{ "name": "endpoint", "type": "string?", "sql": "NVARCHAR(2000)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Custom endpoint URL" },
|
|
48
|
+
{ "name": "isActive", "type": "boolean", "sql": "BIT", "isOptional": False, "hasDefault": True, "isId": False, "description": "Whether this config is active" },
|
|
49
|
+
{ "name": "createdAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Creation timestamp" },
|
|
50
|
+
{ "name": "updatedAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Last update timestamp" }
|
|
51
|
+
],
|
|
52
|
+
"llm_config": [
|
|
53
|
+
{ "name": "id", "type": "string", "sql": "NVARCHAR(1000)", "isOptional": False, "hasDefault": True, "isId": True, "description": "Primary key" },
|
|
54
|
+
{ "name": "provider", "type": "string", "sql": "NVARCHAR(100)", "isOptional": False, "hasDefault": False, "isId": False, "description": "LLM provider: openai, gemini, custom, azure" },
|
|
55
|
+
{ "name": "apiKey", "type": "string", "sql": "NVARCHAR(4000)", "isOptional": False, "hasDefault": False, "isId": False, "description": "API key for the LLM provider" },
|
|
56
|
+
{ "name": "model", "type": "string?", "sql": "NVARCHAR(500)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Model name, e.g. gpt-4o, gemini-2.5-flash" },
|
|
57
|
+
{ "name": "endpoint", "type": "string?", "sql": "NVARCHAR(2000)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Custom endpoint URL" },
|
|
58
|
+
{ "name": "isActive", "type": "boolean", "sql": "BIT", "isOptional": False, "hasDefault": True, "isId": False, "description": "Whether this config is active" },
|
|
59
|
+
{ "name": "createdAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Creation timestamp" },
|
|
60
|
+
{ "name": "updatedAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Last update timestamp" }
|
|
61
|
+
],
|
|
62
|
+
"user": [
|
|
63
|
+
{ "name": "id", "type": "string", "sql": "NVARCHAR(1000)", "isOptional": False, "hasDefault": True, "isId": True, "description": "Primary key for the User table (auto-generated UUID)" },
|
|
64
|
+
{ "name": "email", "type": "string", "sql": "NVARCHAR(255)", "isOptional": False, "hasDefault": False, "isId": False, "description": "Unique email address used for login and notifications" },
|
|
65
|
+
{ "name": "name", "type": "string?", "sql": "NVARCHAR(255)", "isOptional": True, "hasDefault": False, "isId": False, "description": "Display name of the user" },
|
|
66
|
+
{ "name": "createdAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "Timestamp when the user profile was created" }
|
|
67
|
+
],
|
|
68
|
+
"order": [
|
|
69
|
+
{ "name": "id", "type": "string", "sql": "NVARCHAR(1000)", "isOptional": False, "hasDefault": True, "isId": True, "description": "Primary key for the Order table (auto-generated UUID)" },
|
|
70
|
+
{ "name": "userId", "type": "string", "sql": "NVARCHAR(1000)", "isOptional": False, "hasDefault": False, "isId": False, "description": "Foreign key linking to the User model who placed the order" },
|
|
71
|
+
{ "name": "total", "type": "number", "sql": "INT", "isOptional": False, "hasDefault": True, "isId": False, "description": "Total cost amount of the order" },
|
|
72
|
+
{ "name": "createdAt", "type": "Date", "sql": "DATETIME2", "isOptional": False, "hasDefault": True, "isId": False, "description": "The date and time when the order was created." }
|
|
73
|
+
],
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
RELATION_MAP = {
|
|
77
|
+
"embeddingConfig": {
|
|
78
|
+
},
|
|
79
|
+
"embedding_config": {
|
|
80
|
+
},
|
|
81
|
+
"llmConfig": {
|
|
82
|
+
},
|
|
83
|
+
"llm_config": {
|
|
84
|
+
},
|
|
85
|
+
"user": {
|
|
86
|
+
},
|
|
87
|
+
"order": {
|
|
88
|
+
},
|
|
89
|
+
}
|