unitysvc-core 0.1.0__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.
- unitysvc_core-0.1.0/LICENSE +21 -0
- unitysvc_core-0.1.0/PKG-INFO +134 -0
- unitysvc_core-0.1.0/README.md +99 -0
- unitysvc_core-0.1.0/pyproject.toml +79 -0
- unitysvc_core-0.1.0/setup.cfg +4 -0
- unitysvc_core-0.1.0/src/unitysvc_core/__init__.py +32 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/__init__.py +171 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/base.py +317 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/documents.py +46 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/listing_data.py +115 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/listing_v1.py +55 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/offering_data.py +116 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/offering_v1.py +68 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/pricing.py +1394 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/promotion_data.py +290 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/promotion_v1.py +29 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/provider_data.py +79 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/provider_v1.py +70 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/service.py +135 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/service_group_data.py +178 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/service_group_v1.py +36 -0
- unitysvc_core-0.1.0/src/unitysvc_core/models/validators.py +206 -0
- unitysvc_core-0.1.0/src/unitysvc_core/py.typed +0 -0
- unitysvc_core-0.1.0/src/unitysvc_core/schema/base.json +796 -0
- unitysvc_core-0.1.0/src/unitysvc_core/schema/listing_v1.json +2108 -0
- unitysvc_core-0.1.0/src/unitysvc_core/schema/offering_v1.json +2133 -0
- unitysvc_core-0.1.0/src/unitysvc_core/schema/promotion_v1.json +122 -0
- unitysvc_core-0.1.0/src/unitysvc_core/schema/provider_v1.json +379 -0
- unitysvc_core-0.1.0/src/unitysvc_core/schema/service_group_v1.json +94 -0
- unitysvc_core-0.1.0/src/unitysvc_core/utils.py +434 -0
- unitysvc_core-0.1.0/src/unitysvc_core/validator.py +615 -0
- unitysvc_core-0.1.0/src/unitysvc_core.egg-info/PKG-INFO +134 -0
- unitysvc_core-0.1.0/src/unitysvc_core.egg-info/SOURCES.txt +37 -0
- unitysvc_core-0.1.0/src/unitysvc_core.egg-info/dependency_links.txt +1 -0
- unitysvc_core-0.1.0/src/unitysvc_core.egg-info/requires.txt +19 -0
- unitysvc_core-0.1.0/src/unitysvc_core.egg-info/top_level.txt +1 -0
- unitysvc_core-0.1.0/tests/test_pricing.py +1812 -0
- unitysvc_core-0.1.0/tests/test_utils.py +196 -0
- unitysvc_core-0.1.0/tests/test_validator.py +705 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Bo Peng
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unitysvc-core
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shared data models and validation helpers for UnitySVC packages
|
|
5
|
+
Author-email: Bo Peng <bo.peng@unitysvc.com>
|
|
6
|
+
Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: bugs, https://github.com/unitysvc/unitysvc-core/issues
|
|
9
|
+
Project-URL: homepage, https://github.com/unitysvc/unitysvc-core
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: pydantic>=2
|
|
18
|
+
Requires-Dist: email-validator
|
|
19
|
+
Requires-Dist: jsonschema
|
|
20
|
+
Requires-Dist: jinja2
|
|
21
|
+
Requires-Dist: json5
|
|
22
|
+
Requires-Dist: tomli-w
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: coverage; extra == "test"
|
|
25
|
+
Requires-Dist: pytest; extra == "test"
|
|
26
|
+
Requires-Dist: ruff; extra == "test"
|
|
27
|
+
Requires-Dist: mypy; extra == "test"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: coverage; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff; extra == "dev"
|
|
32
|
+
Requires-Dist: ty; extra == "dev"
|
|
33
|
+
Requires-Dist: ipdb; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# unitysvc-core
|
|
37
|
+
|
|
38
|
+
Shared data models, JSON schemas, and validation helpers for the UnitySVC
|
|
39
|
+
ecosystem. This package is **audience-neutral**: it contains only the
|
|
40
|
+
foundational types and helpers that are consumed by the UnitySVC backend,
|
|
41
|
+
the customer SDK, the admin CLI, and the seller SDK.
|
|
42
|
+
|
|
43
|
+
It intentionally does **not** include any CLI, HTTP client, or
|
|
44
|
+
audience-specific helpers. Those live in the corresponding packages:
|
|
45
|
+
|
|
46
|
+
- `unitysvc-sellers` — seller SDK + `usvc_seller` CLI, catalog builders
|
|
47
|
+
(`populate_from_iterator`, `render_template_file`,
|
|
48
|
+
`convert_convenience_fields_to_documents`, etc.)
|
|
49
|
+
- `unitysvc` — customer SDK + `usvc` CLI
|
|
50
|
+
- `unitysvc-admin` — admin CLI
|
|
51
|
+
|
|
52
|
+
## What's inside
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
src/unitysvc_core/
|
|
56
|
+
├── models/
|
|
57
|
+
│ ├── base.py # All enums (status, type, currency, rate-limit, etc.)
|
|
58
|
+
│ ├── pricing.py # PriceStr, UsageData, all *PriceData classes,
|
|
59
|
+
│ │ # Pricing union, validate_pricing, cost calculation
|
|
60
|
+
│ ├── documents.py # DocumentData
|
|
61
|
+
│ ├── service.py # RateLimit, ServiceConstraints, AccessInterfaceData,
|
|
62
|
+
│ │ # UpstreamAccessConfigData
|
|
63
|
+
│ ├── validators.py # validate_name, validate_service_options,
|
|
64
|
+
│ │ # suggest_valid_name, SUPPORTED_SERVICE_OPTIONS
|
|
65
|
+
│ ├── provider_v1.py # Provider file schema + ProviderData
|
|
66
|
+
│ ├── offering_v1.py # Offering file schema + ServiceOfferingData
|
|
67
|
+
│ ├── listing_v1.py # Listing file schema + ServiceListingData
|
|
68
|
+
│ ├── promotion_v1.py # Promotion file schema + PromotionData
|
|
69
|
+
│ └── service_group_v1.py
|
|
70
|
+
├── schema/ # Generated JSON schemas
|
|
71
|
+
├── validator.py # DataValidator — per-file schema validation,
|
|
72
|
+
│ # union-field reference checks, API-key secret
|
|
73
|
+
│ # scanning, Jinja2 syntax validation, etc.
|
|
74
|
+
└── utils.py # Content hashing, mime/extension helpers,
|
|
75
|
+
# data file loaders (JSON/TOML + overrides),
|
|
76
|
+
# schema-based file discovery
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### What's deliberately NOT here
|
|
80
|
+
|
|
81
|
+
- **CLI code** — `typer`, `rich`, no entry points
|
|
82
|
+
- **HTTP clients** — no `httpx`, no API wrappers
|
|
83
|
+
- **Seller catalog builders** — `populate_from_iterator`,
|
|
84
|
+
`render_template_file`, `convert_convenience_fields_to_documents`,
|
|
85
|
+
`execute_script_content` live in `unitysvc-sellers`
|
|
86
|
+
- **Seller-catalog-layout validation** — `validate_provider_status`,
|
|
87
|
+
`validate_all_service_directories`, `resolve_provider_name`,
|
|
88
|
+
`resolve_service_name_for_listing` live in `unitysvc-sellers`
|
|
89
|
+
|
|
90
|
+
## Installation
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install unitysvc-core
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Dependencies: `pydantic`, `email-validator`, `jsonschema`, `jinja2`,
|
|
97
|
+
`json5`, `tomli-w`. No `typer`, no `rich`, no `httpx`.
|
|
98
|
+
|
|
99
|
+
## Usage
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from pathlib import Path
|
|
103
|
+
|
|
104
|
+
import unitysvc_core
|
|
105
|
+
from unitysvc_core.models import ProviderV1, OfferingV1, ListingV1
|
|
106
|
+
from unitysvc_core.models.pricing import UsageData, validate_pricing
|
|
107
|
+
from unitysvc_core.validator import DataValidator
|
|
108
|
+
|
|
109
|
+
# Validate a single catalog directory
|
|
110
|
+
validator = DataValidator(
|
|
111
|
+
data_dir=Path("./catalog"),
|
|
112
|
+
schema_dir=Path(unitysvc_core.__file__).parent / "schema",
|
|
113
|
+
)
|
|
114
|
+
results = validator.validate_all()
|
|
115
|
+
|
|
116
|
+
# Typed pricing + cost calculation
|
|
117
|
+
pricing = validate_pricing({
|
|
118
|
+
"type": "one_million_tokens",
|
|
119
|
+
"input": "0.50",
|
|
120
|
+
"output": "1.50",
|
|
121
|
+
})
|
|
122
|
+
cost = pricing.calculate_cost(UsageData(input_tokens=1_000, output_tokens=500))
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## History
|
|
126
|
+
|
|
127
|
+
This package was split out of `unitysvc-services` (see
|
|
128
|
+
[unitysvc/unitysvc-services#99](https://github.com/unitysvc/unitysvc-services/issues/99)).
|
|
129
|
+
The seller CLI, catalog builders, and seller-catalog-layout validators
|
|
130
|
+
moved to `unitysvc-sellers`.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# unitysvc-core
|
|
2
|
+
|
|
3
|
+
Shared data models, JSON schemas, and validation helpers for the UnitySVC
|
|
4
|
+
ecosystem. This package is **audience-neutral**: it contains only the
|
|
5
|
+
foundational types and helpers that are consumed by the UnitySVC backend,
|
|
6
|
+
the customer SDK, the admin CLI, and the seller SDK.
|
|
7
|
+
|
|
8
|
+
It intentionally does **not** include any CLI, HTTP client, or
|
|
9
|
+
audience-specific helpers. Those live in the corresponding packages:
|
|
10
|
+
|
|
11
|
+
- `unitysvc-sellers` — seller SDK + `usvc_seller` CLI, catalog builders
|
|
12
|
+
(`populate_from_iterator`, `render_template_file`,
|
|
13
|
+
`convert_convenience_fields_to_documents`, etc.)
|
|
14
|
+
- `unitysvc` — customer SDK + `usvc` CLI
|
|
15
|
+
- `unitysvc-admin` — admin CLI
|
|
16
|
+
|
|
17
|
+
## What's inside
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
src/unitysvc_core/
|
|
21
|
+
├── models/
|
|
22
|
+
│ ├── base.py # All enums (status, type, currency, rate-limit, etc.)
|
|
23
|
+
│ ├── pricing.py # PriceStr, UsageData, all *PriceData classes,
|
|
24
|
+
│ │ # Pricing union, validate_pricing, cost calculation
|
|
25
|
+
│ ├── documents.py # DocumentData
|
|
26
|
+
│ ├── service.py # RateLimit, ServiceConstraints, AccessInterfaceData,
|
|
27
|
+
│ │ # UpstreamAccessConfigData
|
|
28
|
+
│ ├── validators.py # validate_name, validate_service_options,
|
|
29
|
+
│ │ # suggest_valid_name, SUPPORTED_SERVICE_OPTIONS
|
|
30
|
+
│ ├── provider_v1.py # Provider file schema + ProviderData
|
|
31
|
+
│ ├── offering_v1.py # Offering file schema + ServiceOfferingData
|
|
32
|
+
│ ├── listing_v1.py # Listing file schema + ServiceListingData
|
|
33
|
+
│ ├── promotion_v1.py # Promotion file schema + PromotionData
|
|
34
|
+
│ └── service_group_v1.py
|
|
35
|
+
├── schema/ # Generated JSON schemas
|
|
36
|
+
├── validator.py # DataValidator — per-file schema validation,
|
|
37
|
+
│ # union-field reference checks, API-key secret
|
|
38
|
+
│ # scanning, Jinja2 syntax validation, etc.
|
|
39
|
+
└── utils.py # Content hashing, mime/extension helpers,
|
|
40
|
+
# data file loaders (JSON/TOML + overrides),
|
|
41
|
+
# schema-based file discovery
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### What's deliberately NOT here
|
|
45
|
+
|
|
46
|
+
- **CLI code** — `typer`, `rich`, no entry points
|
|
47
|
+
- **HTTP clients** — no `httpx`, no API wrappers
|
|
48
|
+
- **Seller catalog builders** — `populate_from_iterator`,
|
|
49
|
+
`render_template_file`, `convert_convenience_fields_to_documents`,
|
|
50
|
+
`execute_script_content` live in `unitysvc-sellers`
|
|
51
|
+
- **Seller-catalog-layout validation** — `validate_provider_status`,
|
|
52
|
+
`validate_all_service_directories`, `resolve_provider_name`,
|
|
53
|
+
`resolve_service_name_for_listing` live in `unitysvc-sellers`
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install unitysvc-core
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Dependencies: `pydantic`, `email-validator`, `jsonschema`, `jinja2`,
|
|
62
|
+
`json5`, `tomli-w`. No `typer`, no `rich`, no `httpx`.
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from pathlib import Path
|
|
68
|
+
|
|
69
|
+
import unitysvc_core
|
|
70
|
+
from unitysvc_core.models import ProviderV1, OfferingV1, ListingV1
|
|
71
|
+
from unitysvc_core.models.pricing import UsageData, validate_pricing
|
|
72
|
+
from unitysvc_core.validator import DataValidator
|
|
73
|
+
|
|
74
|
+
# Validate a single catalog directory
|
|
75
|
+
validator = DataValidator(
|
|
76
|
+
data_dir=Path("./catalog"),
|
|
77
|
+
schema_dir=Path(unitysvc_core.__file__).parent / "schema",
|
|
78
|
+
)
|
|
79
|
+
results = validator.validate_all()
|
|
80
|
+
|
|
81
|
+
# Typed pricing + cost calculation
|
|
82
|
+
pricing = validate_pricing({
|
|
83
|
+
"type": "one_million_tokens",
|
|
84
|
+
"input": "0.50",
|
|
85
|
+
"output": "1.50",
|
|
86
|
+
})
|
|
87
|
+
cost = pricing.calculate_cost(UsageData(input_tokens=1_000, output_tokens=500))
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## History
|
|
91
|
+
|
|
92
|
+
This package was split out of `unitysvc-services` (see
|
|
93
|
+
[unitysvc/unitysvc-services#99](https://github.com/unitysvc/unitysvc-services/issues/99)).
|
|
94
|
+
The seller CLI, catalog builders, and seller-catalog-layout validators
|
|
95
|
+
moved to `unitysvc-sellers`.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "unitysvc-core"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Shared data models and validation helpers for UnitySVC packages"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Bo Peng", email = "bo.peng@unitysvc.com" }]
|
|
11
|
+
maintainers = [{ name = "Bo Peng", email = "bo.peng@unitysvc.com" }]
|
|
12
|
+
license = "MIT"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Typing :: Typed",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"pydantic>=2",
|
|
21
|
+
"email-validator",
|
|
22
|
+
"jsonschema",
|
|
23
|
+
"jinja2",
|
|
24
|
+
"json5",
|
|
25
|
+
"tomli-w",
|
|
26
|
+
]
|
|
27
|
+
requires-python = ">= 3.11"
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
test = [
|
|
31
|
+
"coverage",
|
|
32
|
+
"pytest",
|
|
33
|
+
"ruff",
|
|
34
|
+
"mypy",
|
|
35
|
+
]
|
|
36
|
+
dev = [
|
|
37
|
+
"coverage",
|
|
38
|
+
"pytest",
|
|
39
|
+
"ruff",
|
|
40
|
+
"ty",
|
|
41
|
+
"ipdb",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
bugs = "https://github.com/unitysvc/unitysvc-core/issues"
|
|
46
|
+
homepage = "https://github.com/unitysvc/unitysvc-core"
|
|
47
|
+
|
|
48
|
+
[tool.ruff]
|
|
49
|
+
line-length = 120
|
|
50
|
+
|
|
51
|
+
[tool.ruff.lint]
|
|
52
|
+
select = [
|
|
53
|
+
"E", # pycodestyle errors
|
|
54
|
+
"W", # pycodestyle warnings
|
|
55
|
+
"F", # Pyflakes
|
|
56
|
+
"I", # isort
|
|
57
|
+
"B", # flake8-bugbear
|
|
58
|
+
"UP", # pyupgrade
|
|
59
|
+
]
|
|
60
|
+
ignore = [
|
|
61
|
+
"B904",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.mypy]
|
|
65
|
+
ignore_missing_imports = true
|
|
66
|
+
warn_unused_ignores = false
|
|
67
|
+
disable_error_code = ["import-untyped"]
|
|
68
|
+
|
|
69
|
+
[tool.uv]
|
|
70
|
+
package = true
|
|
71
|
+
|
|
72
|
+
[tool.setuptools]
|
|
73
|
+
include-package-data = true
|
|
74
|
+
|
|
75
|
+
[tool.setuptools.package-data]
|
|
76
|
+
unitysvc_core = ["schema/*.json", "py.typed"]
|
|
77
|
+
|
|
78
|
+
[tool.pytest.ini_options]
|
|
79
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""UnitySVC Core — shared data models and validation helpers.
|
|
2
|
+
|
|
3
|
+
This package is audience-neutral. It contains the pydantic models, JSON
|
|
4
|
+
schemas, and validator consumed by the UnitySVC backend, the customer SDK,
|
|
5
|
+
the admin CLI, and the seller SDK.
|
|
6
|
+
|
|
7
|
+
It intentionally does NOT include any CLI, HTTP client, or audience-
|
|
8
|
+
specific helpers (seller catalog builders, customer query helpers, etc.).
|
|
9
|
+
Those live in the corresponding audience packages (``unitysvc-sellers``,
|
|
10
|
+
``unitysvc`` customer SDK, ``unitysvc-admin``).
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
__author__ = """Bo Peng"""
|
|
14
|
+
__email__ = "bo.peng@unitysvc.com"
|
|
15
|
+
|
|
16
|
+
# Shared file / data utilities used by the backend and SDK consumers
|
|
17
|
+
from .utils import (
|
|
18
|
+
compute_file_hash,
|
|
19
|
+
generate_content_based_key,
|
|
20
|
+
get_basename,
|
|
21
|
+
get_file_extension,
|
|
22
|
+
mime_type_to_extension,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
# File utilities
|
|
27
|
+
"compute_file_hash",
|
|
28
|
+
"generate_content_based_key",
|
|
29
|
+
"get_basename",
|
|
30
|
+
"get_file_extension",
|
|
31
|
+
"mime_type_to_extension",
|
|
32
|
+
]
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from .base import (
|
|
2
|
+
AccessMethodEnum,
|
|
3
|
+
AuthMethodEnum,
|
|
4
|
+
ContentFilterEnum,
|
|
5
|
+
CurrencyEnum,
|
|
6
|
+
DocumentCategoryEnum,
|
|
7
|
+
DocumentContextEnum,
|
|
8
|
+
ListingStatusEnum,
|
|
9
|
+
MimeTypeEnum,
|
|
10
|
+
OfferingStatusEnum,
|
|
11
|
+
OveragePolicyEnum,
|
|
12
|
+
PriceRuleApplyAtEnum,
|
|
13
|
+
PriceRuleStatusEnum,
|
|
14
|
+
PricingTypeEnum,
|
|
15
|
+
ProviderStatusEnum,
|
|
16
|
+
QuotaResetCycleEnum,
|
|
17
|
+
RateLimitUnitEnum,
|
|
18
|
+
RequestTransformEnum,
|
|
19
|
+
SellerTypeEnum,
|
|
20
|
+
ServiceGroupStatusEnum,
|
|
21
|
+
ServiceTypeEnum,
|
|
22
|
+
TimeWindowEnum,
|
|
23
|
+
UpstreamStatusEnum, # Backwards compatibility alias for OfferingStatusEnum
|
|
24
|
+
)
|
|
25
|
+
from .documents import DocumentData
|
|
26
|
+
from .listing_data import ServiceListingData
|
|
27
|
+
from .listing_v1 import ListingV1
|
|
28
|
+
from .offering_data import ServiceOfferingData
|
|
29
|
+
from .offering_v1 import OfferingV1
|
|
30
|
+
from .pricing import (
|
|
31
|
+
AddPriceData,
|
|
32
|
+
BasePriceData,
|
|
33
|
+
ConstantPriceData,
|
|
34
|
+
CountPriceData,
|
|
35
|
+
DataPriceData,
|
|
36
|
+
ExprPriceData,
|
|
37
|
+
FirstPriceData,
|
|
38
|
+
GraduatedPriceData,
|
|
39
|
+
GraduatedTier,
|
|
40
|
+
ImagePriceData,
|
|
41
|
+
MaxPriceData,
|
|
42
|
+
MinPriceData,
|
|
43
|
+
MultiplyPriceData,
|
|
44
|
+
PercentageStr,
|
|
45
|
+
PriceStr,
|
|
46
|
+
PriceTier,
|
|
47
|
+
Pricing,
|
|
48
|
+
RevenueSharePriceData,
|
|
49
|
+
StepPriceData,
|
|
50
|
+
TieredPriceData,
|
|
51
|
+
TimePriceData,
|
|
52
|
+
TokenPriceData,
|
|
53
|
+
UsageData,
|
|
54
|
+
validate_pricing,
|
|
55
|
+
)
|
|
56
|
+
from .promotion_data import (
|
|
57
|
+
PROMOTION_SCHEMA_VERSION,
|
|
58
|
+
PromotionData,
|
|
59
|
+
describe_scope,
|
|
60
|
+
is_promotion_file,
|
|
61
|
+
strip_schema_field,
|
|
62
|
+
validate_promotion,
|
|
63
|
+
)
|
|
64
|
+
from .promotion_v1 import PromotionV1
|
|
65
|
+
from .provider_data import ProviderData
|
|
66
|
+
from .provider_v1 import ProviderV1
|
|
67
|
+
from .service import (
|
|
68
|
+
AccessInterfaceData,
|
|
69
|
+
RateLimit,
|
|
70
|
+
ServiceConstraints,
|
|
71
|
+
UpstreamAccessConfigData,
|
|
72
|
+
)
|
|
73
|
+
from .service_group_data import (
|
|
74
|
+
SERVICE_GROUP_SCHEMA_VERSION,
|
|
75
|
+
ServiceGroupData,
|
|
76
|
+
is_service_group_file,
|
|
77
|
+
validate_service_group,
|
|
78
|
+
)
|
|
79
|
+
from .service_group_v1 import ServiceGroupV1
|
|
80
|
+
from .validators import (
|
|
81
|
+
SUPPORTED_SERVICE_OPTIONS,
|
|
82
|
+
suggest_valid_name,
|
|
83
|
+
validate_name,
|
|
84
|
+
validate_service_options,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
__all__ = [
|
|
88
|
+
# V1 models (for file validation)
|
|
89
|
+
"ProviderV1",
|
|
90
|
+
"OfferingV1",
|
|
91
|
+
"ListingV1",
|
|
92
|
+
"PromotionV1",
|
|
93
|
+
"ServiceGroupV1",
|
|
94
|
+
# Data models (for API/backend use)
|
|
95
|
+
"ProviderData",
|
|
96
|
+
"ServiceOfferingData",
|
|
97
|
+
"ServiceListingData",
|
|
98
|
+
"PromotionData",
|
|
99
|
+
"ServiceGroupData",
|
|
100
|
+
# Shared / access models
|
|
101
|
+
"DocumentData",
|
|
102
|
+
"AccessInterfaceData",
|
|
103
|
+
"UpstreamAccessConfigData",
|
|
104
|
+
"RateLimit",
|
|
105
|
+
"ServiceConstraints",
|
|
106
|
+
# Enums
|
|
107
|
+
"AccessMethodEnum",
|
|
108
|
+
"AuthMethodEnum",
|
|
109
|
+
"ContentFilterEnum",
|
|
110
|
+
"CurrencyEnum",
|
|
111
|
+
"DocumentCategoryEnum",
|
|
112
|
+
"DocumentContextEnum",
|
|
113
|
+
"ListingStatusEnum",
|
|
114
|
+
"MimeTypeEnum",
|
|
115
|
+
"OfferingStatusEnum",
|
|
116
|
+
"OveragePolicyEnum",
|
|
117
|
+
"PriceRuleApplyAtEnum",
|
|
118
|
+
"PriceRuleStatusEnum",
|
|
119
|
+
"PricingTypeEnum",
|
|
120
|
+
"ProviderStatusEnum",
|
|
121
|
+
"QuotaResetCycleEnum",
|
|
122
|
+
"RateLimitUnitEnum",
|
|
123
|
+
"RequestTransformEnum",
|
|
124
|
+
"SellerTypeEnum",
|
|
125
|
+
"ServiceGroupStatusEnum",
|
|
126
|
+
"ServiceTypeEnum",
|
|
127
|
+
"TimeWindowEnum",
|
|
128
|
+
"UpstreamStatusEnum", # Backwards compatibility alias for OfferingStatusEnum
|
|
129
|
+
# Pricing — primitives
|
|
130
|
+
"PriceStr",
|
|
131
|
+
"PercentageStr",
|
|
132
|
+
"UsageData",
|
|
133
|
+
"Pricing",
|
|
134
|
+
"validate_pricing",
|
|
135
|
+
"BasePriceData",
|
|
136
|
+
# Pricing — simple types
|
|
137
|
+
"TokenPriceData",
|
|
138
|
+
"TimePriceData",
|
|
139
|
+
"DataPriceData",
|
|
140
|
+
"CountPriceData",
|
|
141
|
+
"ImagePriceData",
|
|
142
|
+
"StepPriceData",
|
|
143
|
+
"RevenueSharePriceData",
|
|
144
|
+
"ConstantPriceData",
|
|
145
|
+
# Pricing — composite types
|
|
146
|
+
"AddPriceData",
|
|
147
|
+
"MultiplyPriceData",
|
|
148
|
+
"MaxPriceData",
|
|
149
|
+
"MinPriceData",
|
|
150
|
+
"FirstPriceData",
|
|
151
|
+
"TieredPriceData",
|
|
152
|
+
"GraduatedPriceData",
|
|
153
|
+
"ExprPriceData",
|
|
154
|
+
"PriceTier",
|
|
155
|
+
"GraduatedTier",
|
|
156
|
+
# Validators
|
|
157
|
+
"SUPPORTED_SERVICE_OPTIONS",
|
|
158
|
+
"validate_name",
|
|
159
|
+
"validate_service_options",
|
|
160
|
+
"suggest_valid_name",
|
|
161
|
+
# Promotions
|
|
162
|
+
"PROMOTION_SCHEMA_VERSION",
|
|
163
|
+
"is_promotion_file",
|
|
164
|
+
"describe_scope",
|
|
165
|
+
"strip_schema_field",
|
|
166
|
+
"validate_promotion",
|
|
167
|
+
# Service Groups
|
|
168
|
+
"SERVICE_GROUP_SCHEMA_VERSION",
|
|
169
|
+
"is_service_group_file",
|
|
170
|
+
"validate_service_group",
|
|
171
|
+
]
|