sera-2 1.26.3__py3-none-any.whl → 1.26.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.
- sera/make/make_typescript_model.py +4 -858
- sera/make/ts_frontend/make_class_schema.py +0 -1
- sera/make/ts_frontend/make_draft_model.py +811 -0
- sera/make/ts_frontend/make_query.py +33 -15
- {sera_2-1.26.3.dist-info → sera_2-1.26.4.dist-info}/METADATA +3 -3
- {sera_2-1.26.3.dist-info → sera_2-1.26.4.dist-info}/RECORD +7 -6
- {sera_2-1.26.3.dist-info → sera_2-1.26.4.dist-info}/WHEEL +1 -1
@@ -96,29 +96,47 @@ def make_query(schema: Schema, cls: Class, pkg: Package):
|
|
96
96
|
for dep in tstype.deps:
|
97
97
|
program.import_(dep, is_import_attr=True)
|
98
98
|
|
99
|
+
query_ops = []
|
100
|
+
|
99
101
|
if tstype.type == "string":
|
100
|
-
|
101
|
-
elif tstype.type
|
102
|
-
|
102
|
+
query_ops.append(('"fuzzy"', tstype.type))
|
103
|
+
elif tstype.type == "number":
|
104
|
+
if (
|
105
|
+
isinstance(prop, DataProperty)
|
106
|
+
and prop.db is not None
|
107
|
+
and prop.db.is_primary_key
|
108
|
+
) or (isinstance(prop, ObjectProperty) and prop.target.db is not None):
|
109
|
+
# primary key or foreign key, we only support a limited set of operations
|
110
|
+
query_ops.append(('"eq" | "ne"', tstype.type))
|
111
|
+
else:
|
112
|
+
query_ops.append(
|
113
|
+
('"eq" | "ne" | "lt" | "lte" | "gt" | "gte"', tstype.type)
|
114
|
+
)
|
115
|
+
query_ops.append(('"bti"', "[number, number]"))
|
103
116
|
elif tstype.is_enum_type():
|
104
|
-
|
117
|
+
query_ops.append(('"eq" | "ne"', tstype.type))
|
118
|
+
elif tstype.type == "Date":
|
119
|
+
# for date type, we use iso string as the value
|
120
|
+
query_ops.append(('"eq" | "ne" | "lt" | "lte" | "gt" | "gte"', "string"))
|
121
|
+
query_ops.append(('"bti"', "[string, string]"))
|
105
122
|
else:
|
106
123
|
raise NotImplementedError(tstype.type)
|
107
124
|
|
108
|
-
if tstype.type == "Date":
|
109
|
-
# for date type, we use timestamp (number) for comparison
|
110
|
-
value = "number"
|
111
|
-
else:
|
112
|
-
value = tstype.type
|
113
|
-
|
114
125
|
query_condition_args.append(
|
115
126
|
(
|
116
127
|
expr.ExprIdent(tspropname + "?"),
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
128
|
+
expr.ExprRawTypescript(
|
129
|
+
" | ".join(
|
130
|
+
[
|
131
|
+
PredefinedFn.dict(
|
132
|
+
[
|
133
|
+
(expr.ExprIdent("op"), expr.ExprIdent(op)),
|
134
|
+
(expr.ExprIdent("value"), expr.ExprIdent(value)),
|
135
|
+
]
|
136
|
+
).to_typescript()
|
137
|
+
for op, value in query_ops
|
138
|
+
]
|
139
|
+
)
|
122
140
|
),
|
123
141
|
)
|
124
142
|
)
|
@@ -1,14 +1,14 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: sera-2
|
3
|
-
Version: 1.26.
|
3
|
+
Version: 1.26.4
|
4
4
|
Summary:
|
5
|
-
Home-page: https://github.com/binh-vu/sera
|
6
5
|
Author: Binh Vu
|
7
6
|
Author-email: bvu687@gmail.com
|
8
7
|
Requires-Python: >=3.12,<4.0
|
9
8
|
Classifier: Programming Language :: Python :: 3
|
10
9
|
Classifier: Programming Language :: Python :: 3.12
|
11
10
|
Classifier: Programming Language :: Python :: 3.13
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
12
12
|
Requires-Dist: black (==25.1.0)
|
13
13
|
Requires-Dist: codegen-2 (>=2.15.1,<3.0.0)
|
14
14
|
Requires-Dist: graph-wrapper (>=1.7.3,<2.0.0)
|
@@ -26,13 +26,14 @@ sera/make/make_app.py,sha256=dTzpJRPGoCojCdJr1TAzwbaquctwwitrGPxkRm9skpo,6033
|
|
26
26
|
sera/make/make_python_api.py,sha256=sfaYnX6Vwj0xWPpvpWbBhq8GyNHgNkvwlyZr7NDCO0k,24770
|
27
27
|
sera/make/make_python_model.py,sha256=cW3RGVttuZWLVWrEg-NppSknWoTKCRE2mar9yyhj-gU,72545
|
28
28
|
sera/make/make_python_services.py,sha256=SvdU--QF23FN_d-Ao07CeXIK9d5eL_-mdXYwXx69dRE,2102
|
29
|
-
sera/make/make_typescript_model.py,sha256=
|
29
|
+
sera/make/make_typescript_model.py,sha256=bhvYbQKST1DT0pnkNOpwcmsaeVnUcNfVvHxUq2LAoo4,17604
|
30
30
|
sera/make/py_backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
sera/make/py_backend/misc.py,sha256=lZNkrniR2OZiyK4rei1Yl_mRYBR_QzOpqVO_gMWbJD4,487
|
32
32
|
sera/make/ts_frontend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
sera/make/ts_frontend/make_class_schema.py,sha256=
|
33
|
+
sera/make/ts_frontend/make_class_schema.py,sha256=JrUNBl5yJSbVFrdGcuC7sG0A-HhmXl24VJWCTVkDh8I,14458
|
34
|
+
sera/make/ts_frontend/make_draft_model.py,sha256=LY1HP6BuEmtxEevqAWMe-GJyTbK-yDIsUjLjZdd-0Rg,32570
|
34
35
|
sera/make/ts_frontend/make_enums.py,sha256=3U6Dt5Y4DM6D_ZiitcVHXtNQyA9cTE046WCDQCDOvSU,2596
|
35
|
-
sera/make/ts_frontend/make_query.py,sha256=
|
36
|
+
sera/make/ts_frontend/make_query.py,sha256=YnUBwMW_3LRJBoV2dpim6M6ouNhPPloCT2YBEBLgU7M,5731
|
36
37
|
sera/make/ts_frontend/misc.py,sha256=A54nMg4dsn1AC_6T1tFRW3rZAJ71d7SHEMrFOdsI3jo,1011
|
37
38
|
sera/misc/__init__.py,sha256=ee7OODdWPKP8pCDxsfg1EOdxxKFMJCoNMljgV0NCxBw,767
|
38
39
|
sera/misc/_formatter.py,sha256=aCGYL08l8f3aLODHxSocxBBwkRYEo3K1QzCDEn3suj0,1685
|
@@ -50,6 +51,6 @@ sera/models/_parse.py,sha256=nihBEDni-jKwecSBagd6bupDOuCzGviuoD9u6-rT64Q,13203
|
|
50
51
|
sera/models/_property.py,sha256=Qo23KZl5OQNbuceygicgC3_Yv5ve1KxiFiMoWq6Ljj0,7758
|
51
52
|
sera/models/_schema.py,sha256=VxJEiqgVvbXgcSUK4UW6JnRcggk4nsooVSE6MyXmfNY,1636
|
52
53
|
sera/typing.py,sha256=7S6Ah-Yfcl8a0xAJ4lxEcguq3rYVM7SBeOiuxyJhC04,1089
|
53
|
-
sera_2-1.26.
|
54
|
-
sera_2-1.26.
|
55
|
-
sera_2-1.26.
|
54
|
+
sera_2-1.26.4.dist-info/METADATA,sha256=9tRFamnahw1dsWTpsIeoBGCkF8pLU2o6rNlQG2PExbA,987
|
55
|
+
sera_2-1.26.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
56
|
+
sera_2-1.26.4.dist-info/RECORD,,
|