mockjutsu 1.0.0__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.
- mockjutsu/__init__.py +1 -0
- mockjutsu/api/__init__.py +0 -0
- mockjutsu/api/main.py +225 -0
- mockjutsu/cli.py +927 -0
- mockjutsu/core.py +600 -0
- mockjutsu/data/__init__.py +1 -0
- mockjutsu/data/bip39_en.py +2050 -0
- mockjutsu/generators/__init__.py +1 -0
- mockjutsu/generators/ai_vector.py +62 -0
- mockjutsu/generators/automotive.py +188 -0
- mockjutsu/generators/aviation.py +88 -0
- mockjutsu/generators/bank_statement.py +221 -0
- mockjutsu/generators/banking.py +341 -0
- mockjutsu/generators/barcode.py +163 -0
- mockjutsu/generators/cardphysics.py +300 -0
- mockjutsu/generators/commerce.py +240 -0
- mockjutsu/generators/communication.py +175 -0
- mockjutsu/generators/compliance.py +112 -0
- mockjutsu/generators/corporate.py +106 -0
- mockjutsu/generators/crypto.py +276 -0
- mockjutsu/generators/crypto_fuzz.py +233 -0
- mockjutsu/generators/ecommerce.py +181 -0
- mockjutsu/generators/edi.py +168 -0
- mockjutsu/generators/event_sourcing.py +215 -0
- mockjutsu/generators/fido2.py +197 -0
- mockjutsu/generators/financial.py +421 -0
- mockjutsu/generators/financial_markets.py +565 -0
- mockjutsu/generators/gamedev.py +155 -0
- mockjutsu/generators/hardware.py +126 -0
- mockjutsu/generators/health.py +353 -0
- mockjutsu/generators/identity.py +733 -0
- mockjutsu/generators/intl_ids.py +871 -0
- mockjutsu/generators/iot.py +546 -0
- mockjutsu/generators/location.py +100 -0
- mockjutsu/generators/meta.py +475 -0
- mockjutsu/generators/mrz.py +270 -0
- mockjutsu/generators/name_data.py +862 -0
- mockjutsu/generators/nmea.py +159 -0
- mockjutsu/generators/ohlcv.py +193 -0
- mockjutsu/generators/oidc.py +210 -0
- mockjutsu/generators/payments.py +425 -0
- mockjutsu/generators/prometheus.py +255 -0
- mockjutsu/generators/reverse_regex.py +180 -0
- mockjutsu/generators/security.py +238 -0
- mockjutsu/generators/social.py +123 -0
- mockjutsu/generators/telecom.py +202 -0
- mockjutsu/generators/telemetry.py +167 -0
- mockjutsu/generators/tle.py +216 -0
- mockjutsu/generators/ubl.py +267 -0
- mockjutsu/generators/wallet.py +228 -0
- mockjutsu/masker.py +613 -0
- mockjutsu/regulations.py +1982 -0
- mockjutsu-1.0.0.dist-info/METADATA +386 -0
- mockjutsu-1.0.0.dist-info/RECORD +58 -0
- mockjutsu-1.0.0.dist-info/WHEEL +5 -0
- mockjutsu-1.0.0.dist-info/entry_points.txt +2 -0
- mockjutsu-1.0.0.dist-info/licenses/LICENSE +38 -0
- mockjutsu-1.0.0.dist-info/top_level.txt +1 -0
mockjutsu/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
File without changes
|
mockjutsu/api/main.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"""
|
|
2
|
+
mock-jutsu — FastAPI Application
|
|
3
|
+
Developer: Altan Sezer Ayan - A.S.A (https://github.com/altansayan)
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, List, Optional
|
|
7
|
+
from fastapi import FastAPI, Query
|
|
8
|
+
from pydantic import BaseModel
|
|
9
|
+
from mockjutsu.core import jutsu
|
|
10
|
+
from mockjutsu.masker import apply_mask
|
|
11
|
+
from mockjutsu.cli import _REFERENCE
|
|
12
|
+
|
|
13
|
+
app = FastAPI(
|
|
14
|
+
title="mock-jutsu API",
|
|
15
|
+
description="Algorithmic Mock Data Engine — 174 Types, 6 Locales",
|
|
16
|
+
version="1.0.0",
|
|
17
|
+
contact={
|
|
18
|
+
"name": "Altan Sezer Ayan - A.S.A",
|
|
19
|
+
"url": "https://github.com/altansayan",
|
|
20
|
+
},
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# ── Request bodies ────────────────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
class TemplateRequest(BaseModel):
|
|
27
|
+
types: List[str]
|
|
28
|
+
count: int = 1
|
|
29
|
+
locale: str = "TR"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ExportRequest(BaseModel):
|
|
33
|
+
schema_: Dict[str, str]
|
|
34
|
+
count: int = 10
|
|
35
|
+
locale: str = "TR"
|
|
36
|
+
format: str = "json"
|
|
37
|
+
table: str = "records"
|
|
38
|
+
|
|
39
|
+
class Config:
|
|
40
|
+
populate_by_name = True
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def model_validator_alias(cls):
|
|
44
|
+
return {"schema": "schema_"}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# ── Root ─────────────────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
@app.get("/")
|
|
50
|
+
async def root():
|
|
51
|
+
return {
|
|
52
|
+
"service": "mock-jutsu API",
|
|
53
|
+
"developer": "Altan Sezer Ayan - A.S.A",
|
|
54
|
+
"github": "https://github.com/altansayan",
|
|
55
|
+
"endpoints": [
|
|
56
|
+
"GET /generate/{type}",
|
|
57
|
+
"GET /bulk/{type}",
|
|
58
|
+
"POST /template",
|
|
59
|
+
"GET /profile",
|
|
60
|
+
"GET /company",
|
|
61
|
+
"POST /export",
|
|
62
|
+
"GET /list",
|
|
63
|
+
"GET /health",
|
|
64
|
+
],
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# ── Health ────────────────────────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
@app.get("/health")
|
|
71
|
+
async def health():
|
|
72
|
+
return {"status": "ok"}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# ── List ──────────────────────────────────────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
@app.get("/list")
|
|
78
|
+
async def list_types(cat: str = ""):
|
|
79
|
+
rows = [
|
|
80
|
+
{
|
|
81
|
+
"type": r[0].strip(),
|
|
82
|
+
"category": r[1],
|
|
83
|
+
"locale_aware": r[2],
|
|
84
|
+
"example": r[3],
|
|
85
|
+
"description": r[5] if len(r) > 5 else "",
|
|
86
|
+
}
|
|
87
|
+
for r in _REFERENCE
|
|
88
|
+
if r[0].strip() and not r[0].strip().startswith("--")
|
|
89
|
+
and (not cat or cat.lower() in r[1].lower())
|
|
90
|
+
]
|
|
91
|
+
return {"count": len(rows), "types": rows}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# ── Generate ──────────────────────────────────────────────────────────────────
|
|
95
|
+
|
|
96
|
+
@app.get("/generate/{data_type}")
|
|
97
|
+
async def generate(
|
|
98
|
+
data_type: str,
|
|
99
|
+
locale: str = Query("TR", description="TR · UK · US · DE · FR · RU"),
|
|
100
|
+
network: str = Query("visa", description="visa · mc · amex · troy · mir · jcb · discover · unionpay · maestro"),
|
|
101
|
+
currency: str = Query("btc", description="btc · eth"),
|
|
102
|
+
carrier: str = Query("usps", description="usps · ups · fedex · dhl"),
|
|
103
|
+
algorithm: str = Query("sha256", description="md5 · sha1 · sha256 · sha512 · sha3-256 · crc32 · adler32 · crc16"),
|
|
104
|
+
gender: Optional[str] = Query(None, description="male · female"),
|
|
105
|
+
min: Optional[float] = Query(None, description="Minimum value for numeric types"),
|
|
106
|
+
max: Optional[float] = Query(None, description="Maximum value for numeric types"),
|
|
107
|
+
amount: Optional[float] = Query(None, description="Payment amount for QR/transaction types"),
|
|
108
|
+
merchant: Optional[str] = Query(None, description="Merchant name for QR types"),
|
|
109
|
+
city: Optional[str] = Query(None, description="Merchant city for QR types"),
|
|
110
|
+
words: Optional[int] = Query(None, description="Word count for mnemonic: 12 · 15 · 18 · 21 · 24"),
|
|
111
|
+
pattern: Optional[str] = Query(None, description="Regex pattern for reverse_regex type — e.g. [A-Z]{3}\\d{4}"),
|
|
112
|
+
dims: Optional[int] = Query(None, description="Vector dimensions for ai_embedding / ai_vector"),
|
|
113
|
+
nnz: Optional[int] = Query(None, description="Non-zero entries for ai_sparse_vector"),
|
|
114
|
+
secret: Optional[str] = Query(None, description="HMAC signing key for signature type"),
|
|
115
|
+
payload: Optional[str] = Query(None, description="Message to sign for signature type"),
|
|
116
|
+
format: Optional[str] = Query(None, description="Color output format: hex · rgb · hsl · name"),
|
|
117
|
+
mask: bool = Query(False, description="Return regulation-compliant masked value (PCI DSS · GDPR · KVKK)"),
|
|
118
|
+
start: Optional[str] = Query(None, description="Start date YYYY-MM-DD for date_between"),
|
|
119
|
+
end: Optional[str] = Query(None, description="End date YYYY-MM-DD for date_between"),
|
|
120
|
+
pair: Optional[str] = Query(None, description="FX pair for forex_rate — e.g. EURUSD"),
|
|
121
|
+
):
|
|
122
|
+
extra = {k: v for k, v in {
|
|
123
|
+
"gender": gender, "min": min, "max": max, "amount": amount,
|
|
124
|
+
"merchant": merchant, "city": city, "words": words, "pattern": pattern,
|
|
125
|
+
"dims": dims, "nnz": nnz, "secret": secret, "payload": payload,
|
|
126
|
+
"format": format, "start": start, "end": end, "pair": pair,
|
|
127
|
+
}.items() if v is not None}
|
|
128
|
+
|
|
129
|
+
result = jutsu.generate(
|
|
130
|
+
data_type, locale=locale, network=network,
|
|
131
|
+
currency=currency, carrier=carrier, algorithm=algorithm, **extra,
|
|
132
|
+
)
|
|
133
|
+
if mask and "ERROR" not in str(result):
|
|
134
|
+
result = apply_mask(data_type, result)
|
|
135
|
+
|
|
136
|
+
ok = "ERROR" not in str(result)
|
|
137
|
+
return {
|
|
138
|
+
"type": data_type,
|
|
139
|
+
"locale": locale,
|
|
140
|
+
"result": result,
|
|
141
|
+
"status": "success" if ok else "error",
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# ── Bulk ──────────────────────────────────────────────────────────────────────
|
|
146
|
+
|
|
147
|
+
@app.get("/bulk/{data_type}")
|
|
148
|
+
async def bulk(
|
|
149
|
+
data_type: str,
|
|
150
|
+
count: int = Query(10, ge=1, le=1000),
|
|
151
|
+
locale: str = Query("TR", description="TR UK US DE FR RU"),
|
|
152
|
+
):
|
|
153
|
+
results = jutsu.bulk(data_type, count=count, locale=locale)
|
|
154
|
+
return {
|
|
155
|
+
"type": data_type,
|
|
156
|
+
"locale": locale,
|
|
157
|
+
"count": count,
|
|
158
|
+
"results": results,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# ── Template ──────────────────────────────────────────────────────────────────
|
|
163
|
+
|
|
164
|
+
@app.post("/template")
|
|
165
|
+
async def template(req: TemplateRequest):
|
|
166
|
+
schema = {t: t for t in req.types}
|
|
167
|
+
records = jutsu.template(schema, count=req.count, locale=req.locale)
|
|
168
|
+
output = records[0] if req.count == 1 else records
|
|
169
|
+
return {
|
|
170
|
+
"types": req.types,
|
|
171
|
+
"locale": req.locale,
|
|
172
|
+
"count": req.count,
|
|
173
|
+
"result": output,
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
# ── Profile ───────────────────────────────────────────────────────────────────
|
|
178
|
+
|
|
179
|
+
@app.get("/profile")
|
|
180
|
+
async def profile(
|
|
181
|
+
locale: str = Query("TR", description="TR UK US DE FR RU"),
|
|
182
|
+
count: int = Query(1, ge=1, le=100),
|
|
183
|
+
):
|
|
184
|
+
results = [jutsu.profile(locale=locale) for _ in range(count)]
|
|
185
|
+
output = results[0] if count == 1 else results
|
|
186
|
+
return {"locale": locale, "count": count, "result": output}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
# ── Company ───────────────────────────────────────────────────────────────────
|
|
190
|
+
|
|
191
|
+
@app.get("/company")
|
|
192
|
+
async def company(
|
|
193
|
+
locale: str = Query("TR", description="TR UK US DE FR RU"),
|
|
194
|
+
count: int = Query(1, ge=1, le=100),
|
|
195
|
+
):
|
|
196
|
+
results = [jutsu.company(locale=locale) for _ in range(count)]
|
|
197
|
+
output = results[0] if count == 1 else results
|
|
198
|
+
return {"locale": locale, "count": count, "result": output}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
# ── Export ────────────────────────────────────────────────────────────────────
|
|
202
|
+
|
|
203
|
+
class ExportRequest(BaseModel):
|
|
204
|
+
schema_map: Dict[str, str]
|
|
205
|
+
count: int = 10
|
|
206
|
+
locale: str = "TR"
|
|
207
|
+
format: str = "json"
|
|
208
|
+
table: str = "records"
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
@app.post("/export")
|
|
212
|
+
async def export(req: ExportRequest):
|
|
213
|
+
output = jutsu.export(
|
|
214
|
+
req.schema_map,
|
|
215
|
+
count=req.count,
|
|
216
|
+
format=req.format,
|
|
217
|
+
locale=req.locale,
|
|
218
|
+
table=req.table,
|
|
219
|
+
)
|
|
220
|
+
return {
|
|
221
|
+
"locale": req.locale,
|
|
222
|
+
"count": req.count,
|
|
223
|
+
"format": req.format,
|
|
224
|
+
"result": output,
|
|
225
|
+
}
|