unitysvc-services 0.1.24__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.
- unitysvc_services/__init__.py +4 -0
- unitysvc_services/api.py +421 -0
- unitysvc_services/cli.py +23 -0
- unitysvc_services/format_data.py +140 -0
- unitysvc_services/interactive_prompt.py +1132 -0
- unitysvc_services/list.py +216 -0
- unitysvc_services/models/__init__.py +71 -0
- unitysvc_services/models/base.py +1375 -0
- unitysvc_services/models/listing_data.py +118 -0
- unitysvc_services/models/listing_v1.py +56 -0
- unitysvc_services/models/provider_data.py +79 -0
- unitysvc_services/models/provider_v1.py +54 -0
- unitysvc_services/models/seller_data.py +120 -0
- unitysvc_services/models/seller_v1.py +42 -0
- unitysvc_services/models/service_data.py +114 -0
- unitysvc_services/models/service_v1.py +81 -0
- unitysvc_services/populate.py +207 -0
- unitysvc_services/publisher.py +1628 -0
- unitysvc_services/py.typed +0 -0
- unitysvc_services/query.py +688 -0
- unitysvc_services/scaffold.py +1103 -0
- unitysvc_services/schema/base.json +777 -0
- unitysvc_services/schema/listing_v1.json +1286 -0
- unitysvc_services/schema/provider_v1.json +952 -0
- unitysvc_services/schema/seller_v1.json +379 -0
- unitysvc_services/schema/service_v1.json +1306 -0
- unitysvc_services/test.py +965 -0
- unitysvc_services/unpublisher.py +505 -0
- unitysvc_services/update.py +287 -0
- unitysvc_services/utils.py +533 -0
- unitysvc_services/validator.py +731 -0
- unitysvc_services-0.1.24.dist-info/METADATA +184 -0
- unitysvc_services-0.1.24.dist-info/RECORD +37 -0
- unitysvc_services-0.1.24.dist-info/WHEEL +5 -0
- unitysvc_services-0.1.24.dist-info/entry_points.txt +3 -0
- unitysvc_services-0.1.24.dist-info/licenses/LICENSE +21 -0
- unitysvc_services-0.1.24.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"""List command group - list local data files."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
from rich.console import Console
|
|
7
|
+
from rich.table import Table
|
|
8
|
+
|
|
9
|
+
from .utils import (
|
|
10
|
+
find_files_by_schema,
|
|
11
|
+
resolve_provider_name,
|
|
12
|
+
resolve_service_name_for_listing,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
app = typer.Typer(help="List data files in directory")
|
|
16
|
+
console = Console()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@app.command("providers")
|
|
20
|
+
def list_providers(
|
|
21
|
+
data_dir: Path | None = typer.Argument(
|
|
22
|
+
None,
|
|
23
|
+
help="Directory containing provider files (default: current directory)",
|
|
24
|
+
),
|
|
25
|
+
):
|
|
26
|
+
"""List all provider files found in the data directory."""
|
|
27
|
+
# Set data directory
|
|
28
|
+
if data_dir is None:
|
|
29
|
+
data_dir = Path.cwd()
|
|
30
|
+
|
|
31
|
+
if not data_dir.is_absolute():
|
|
32
|
+
data_dir = Path.cwd() / data_dir
|
|
33
|
+
|
|
34
|
+
if not data_dir.exists():
|
|
35
|
+
console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
|
|
36
|
+
raise typer.Exit(code=1)
|
|
37
|
+
|
|
38
|
+
console.print(f"[blue]Searching for providers in:[/blue] {data_dir}\n")
|
|
39
|
+
|
|
40
|
+
# Find provider files by schema
|
|
41
|
+
provider_files = find_files_by_schema(data_dir, "provider_v1")
|
|
42
|
+
|
|
43
|
+
if not provider_files:
|
|
44
|
+
console.print("[yellow]No provider files found.[/yellow]")
|
|
45
|
+
return
|
|
46
|
+
|
|
47
|
+
# Create table
|
|
48
|
+
table = Table(title="Provider Files", show_lines=True)
|
|
49
|
+
table.add_column("File", style="cyan")
|
|
50
|
+
table.add_column("Name", style="green")
|
|
51
|
+
table.add_column("Display Name", style="blue")
|
|
52
|
+
|
|
53
|
+
for file_path, _file_format, data in sorted(provider_files, key=lambda x: x[0]):
|
|
54
|
+
table.add_row(
|
|
55
|
+
str(file_path.relative_to(data_dir)),
|
|
56
|
+
data.get("name", "N/A"),
|
|
57
|
+
data.get("display_name", "N/A"),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
console.print(table)
|
|
61
|
+
console.print(f"\n[green]Total:[/green] {len(provider_files)} provider file(s)")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@app.command("sellers")
|
|
65
|
+
def list_sellers(
|
|
66
|
+
data_dir: Path | None = typer.Argument(
|
|
67
|
+
None,
|
|
68
|
+
help="Directory containing seller files (default: current directory)",
|
|
69
|
+
),
|
|
70
|
+
):
|
|
71
|
+
"""List all seller files found in the data directory."""
|
|
72
|
+
# Set data directory
|
|
73
|
+
if data_dir is None:
|
|
74
|
+
data_dir = Path.cwd()
|
|
75
|
+
|
|
76
|
+
if not data_dir.is_absolute():
|
|
77
|
+
data_dir = Path.cwd() / data_dir
|
|
78
|
+
|
|
79
|
+
if not data_dir.exists():
|
|
80
|
+
console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
|
|
81
|
+
raise typer.Exit(code=1)
|
|
82
|
+
|
|
83
|
+
console.print(f"[blue]Searching for sellers in:[/blue] {data_dir}\n")
|
|
84
|
+
|
|
85
|
+
# Find seller files by schema
|
|
86
|
+
seller_files = find_files_by_schema(data_dir, "seller_v1")
|
|
87
|
+
|
|
88
|
+
if not seller_files:
|
|
89
|
+
console.print("[yellow]No seller files found.[/yellow]")
|
|
90
|
+
return
|
|
91
|
+
|
|
92
|
+
# Create table
|
|
93
|
+
table = Table(title="Seller Files", show_lines=True)
|
|
94
|
+
table.add_column("File", style="cyan")
|
|
95
|
+
table.add_column("Name", style="green")
|
|
96
|
+
table.add_column("Display Name", style="blue")
|
|
97
|
+
|
|
98
|
+
for file_path, _file_format, data in sorted(seller_files, key=lambda x: x[0]):
|
|
99
|
+
table.add_row(
|
|
100
|
+
str(file_path.relative_to(data_dir)),
|
|
101
|
+
data.get("name", "N/A"),
|
|
102
|
+
data.get("display_name", "N/A"),
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
console.print(table)
|
|
106
|
+
console.print(f"\n[green]Total:[/green] {len(seller_files)} seller file(s)")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@app.command("offerings")
|
|
110
|
+
def list_offerings(
|
|
111
|
+
data_dir: Path | None = typer.Argument(
|
|
112
|
+
None,
|
|
113
|
+
help="Directory containing service files (default: current directory)",
|
|
114
|
+
),
|
|
115
|
+
):
|
|
116
|
+
"""List all service offering files found in the data directory."""
|
|
117
|
+
# Set data directory
|
|
118
|
+
if data_dir is None:
|
|
119
|
+
data_dir = Path.cwd()
|
|
120
|
+
|
|
121
|
+
if not data_dir.is_absolute():
|
|
122
|
+
data_dir = Path.cwd() / data_dir
|
|
123
|
+
|
|
124
|
+
if not data_dir.exists():
|
|
125
|
+
console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
|
|
126
|
+
raise typer.Exit(code=1)
|
|
127
|
+
|
|
128
|
+
console.print(f"[blue]Searching for service offerings in:[/blue] {data_dir}\n")
|
|
129
|
+
|
|
130
|
+
# Find service files by schema
|
|
131
|
+
service_files = find_files_by_schema(data_dir, "service_v1")
|
|
132
|
+
|
|
133
|
+
if not service_files:
|
|
134
|
+
console.print("[yellow]No service offering files found.[/yellow]")
|
|
135
|
+
return
|
|
136
|
+
|
|
137
|
+
# Create table
|
|
138
|
+
table = Table(title="Service Offering Files", show_lines=True)
|
|
139
|
+
table.add_column("File", style="cyan")
|
|
140
|
+
table.add_column("Provider", style="yellow")
|
|
141
|
+
table.add_column("Name", style="green")
|
|
142
|
+
table.add_column("Display Name", style="blue")
|
|
143
|
+
table.add_column("Status", style="magenta")
|
|
144
|
+
|
|
145
|
+
for file_path, _file_format, data in sorted(service_files, key=lambda x: x[0]):
|
|
146
|
+
provider_name = resolve_provider_name(file_path) or "N/A"
|
|
147
|
+
table.add_row(
|
|
148
|
+
str(file_path.relative_to(data_dir)),
|
|
149
|
+
provider_name,
|
|
150
|
+
data.get("name", "N/A"),
|
|
151
|
+
data.get("display_name", "N/A"),
|
|
152
|
+
data.get("upstream_status", "N/A"),
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
console.print(table)
|
|
156
|
+
console.print(f"\n[green]Total:[/green] {len(service_files)} service offering file(s)")
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@app.command("listings")
|
|
160
|
+
def list_listings(
|
|
161
|
+
data_dir: Path | None = typer.Argument(
|
|
162
|
+
None,
|
|
163
|
+
help="Directory containing listing files (default: current directory)",
|
|
164
|
+
),
|
|
165
|
+
):
|
|
166
|
+
"""List all service listing files found in the data directory."""
|
|
167
|
+
# Set data directory
|
|
168
|
+
if data_dir is None:
|
|
169
|
+
data_dir = Path.cwd()
|
|
170
|
+
|
|
171
|
+
if not data_dir.is_absolute():
|
|
172
|
+
data_dir = Path.cwd() / data_dir
|
|
173
|
+
|
|
174
|
+
if not data_dir.exists():
|
|
175
|
+
console.print(f"[red]✗[/red] Data directory not found: {data_dir}", style="bold red")
|
|
176
|
+
raise typer.Exit(code=1)
|
|
177
|
+
|
|
178
|
+
console.print(f"[blue]Searching for service listings in:[/blue] {data_dir}\n")
|
|
179
|
+
|
|
180
|
+
# Find seller definition to get display names
|
|
181
|
+
seller_files = find_files_by_schema(data_dir, "seller_v1")
|
|
182
|
+
seller_info = {}
|
|
183
|
+
if seller_files:
|
|
184
|
+
# Use the first (and should be only) seller file
|
|
185
|
+
seller_info = seller_files[0][-1]
|
|
186
|
+
|
|
187
|
+
# Find listing files by schema
|
|
188
|
+
listing_files = find_files_by_schema(data_dir, "listing_v1")
|
|
189
|
+
|
|
190
|
+
if not listing_files:
|
|
191
|
+
console.print("[yellow]No service listing files found.[/yellow]")
|
|
192
|
+
return
|
|
193
|
+
|
|
194
|
+
# Create table
|
|
195
|
+
table = Table(title="Service Listing Files", show_lines=True)
|
|
196
|
+
table.add_column("File", style="cyan")
|
|
197
|
+
table.add_column("Provider", style="yellow")
|
|
198
|
+
table.add_column("Service", style="blue")
|
|
199
|
+
table.add_column("Seller", style="green")
|
|
200
|
+
table.add_column("Status", style="magenta")
|
|
201
|
+
|
|
202
|
+
for file_path, _file_format, data in sorted(listing_files, key=lambda x: x[0]):
|
|
203
|
+
# Resolve provider and service names using the utility functions
|
|
204
|
+
provider_name = resolve_provider_name(file_path) or "N/A"
|
|
205
|
+
service_name = resolve_service_name_for_listing(file_path, data) or "N/A"
|
|
206
|
+
|
|
207
|
+
table.add_row(
|
|
208
|
+
str(file_path.relative_to(data_dir)),
|
|
209
|
+
provider_name,
|
|
210
|
+
service_name,
|
|
211
|
+
seller_info.get("name", "N/A"),
|
|
212
|
+
data.get("listing_status", "N/A"),
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
console.print(table)
|
|
216
|
+
console.print(f"\n[green]Total:[/green] {len(listing_files)} service listing file(s)")
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from .base import (
|
|
2
|
+
AddPriceData,
|
|
3
|
+
BasePriceData,
|
|
4
|
+
ConstantPriceData,
|
|
5
|
+
ExprPriceData,
|
|
6
|
+
GraduatedPriceData,
|
|
7
|
+
ImagePriceData,
|
|
8
|
+
ListingStatusEnum,
|
|
9
|
+
MultiplyPriceData,
|
|
10
|
+
Pricing,
|
|
11
|
+
PricingTypeEnum,
|
|
12
|
+
ProviderStatusEnum,
|
|
13
|
+
RevenueSharePriceData,
|
|
14
|
+
SellerStatusEnum,
|
|
15
|
+
SellerTypeEnum,
|
|
16
|
+
ServiceTypeEnum,
|
|
17
|
+
StepPriceData,
|
|
18
|
+
TieredPriceData,
|
|
19
|
+
TimePriceData,
|
|
20
|
+
TokenPriceData,
|
|
21
|
+
UpstreamStatusEnum,
|
|
22
|
+
UsageData,
|
|
23
|
+
validate_pricing,
|
|
24
|
+
)
|
|
25
|
+
from .listing_data import ServiceListingData
|
|
26
|
+
from .listing_v1 import ListingV1
|
|
27
|
+
from .provider_data import ProviderData
|
|
28
|
+
from .provider_v1 import ProviderV1
|
|
29
|
+
from .seller_data import SellerData
|
|
30
|
+
from .seller_v1 import SellerV1
|
|
31
|
+
from .service_data import ServiceOfferingData
|
|
32
|
+
from .service_v1 import ServiceV1
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
# V1 models (for file validation)
|
|
36
|
+
"ProviderV1",
|
|
37
|
+
"ServiceV1",
|
|
38
|
+
"ListingV1",
|
|
39
|
+
"SellerV1",
|
|
40
|
+
# Data models (for API/backend use)
|
|
41
|
+
"ProviderData",
|
|
42
|
+
"ServiceOfferingData",
|
|
43
|
+
"ServiceListingData",
|
|
44
|
+
"SellerData",
|
|
45
|
+
# Enums
|
|
46
|
+
"ListingStatusEnum",
|
|
47
|
+
"ProviderStatusEnum",
|
|
48
|
+
"SellerStatusEnum",
|
|
49
|
+
"SellerTypeEnum",
|
|
50
|
+
"ServiceTypeEnum",
|
|
51
|
+
"UpstreamStatusEnum",
|
|
52
|
+
# Pricing - Basic types
|
|
53
|
+
"Pricing",
|
|
54
|
+
"PricingTypeEnum",
|
|
55
|
+
"BasePriceData",
|
|
56
|
+
"TokenPriceData",
|
|
57
|
+
"TimePriceData",
|
|
58
|
+
"ImagePriceData",
|
|
59
|
+
"StepPriceData",
|
|
60
|
+
"RevenueSharePriceData",
|
|
61
|
+
# Pricing - Composite types
|
|
62
|
+
"ConstantPriceData",
|
|
63
|
+
"AddPriceData",
|
|
64
|
+
"MultiplyPriceData",
|
|
65
|
+
"TieredPriceData",
|
|
66
|
+
"GraduatedPriceData",
|
|
67
|
+
"ExprPriceData",
|
|
68
|
+
"validate_pricing",
|
|
69
|
+
# Cost calculation
|
|
70
|
+
"UsageData",
|
|
71
|
+
]
|