cabloy 5.1.56 → 5.1.58
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.
- package/.gitignore +1 -0
- package/CHANGELOG.md +18 -0
- package/cabloy-docs/.vitepress/config.mjs +1 -0
- package/cabloy-docs/backend/dto-guide.md +7 -0
- package/cabloy-docs/backend/orm-select-guide.md +2 -0
- package/cabloy-docs/backend/validation-guide.md +8 -0
- package/cabloy-docs/fullstack/comparison-with-other-frameworks.md +1 -0
- package/cabloy-docs/fullstack/framework-performance.md +89 -0
- package/cabloy-docs/fullstack/introduction.md +1 -0
- package/cabloy-docs/fullstack/quickstart.md +19 -3
- package/cabloy-docs/fullstack/vona-zova-integration.md +2 -0
- package/cabloy-docs/index.md +8 -0
- package/package.json +1 -1
- package/scripts/init.ts +46 -0
- package/scripts/upgrade.ts +139 -27
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-utils/zod-query/package.json +1 -1
- package/vona/packages-utils/zod-query/src/index.ts +1 -0
- package/vona/packages-utils/zod-query/src/lib/query.ts +31 -12
- package/vona/packages-utils/zod-query/src/lib/zod-is-type.ts +48 -6
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +482 -477
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapi/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/schema/v/system.ts +6 -0
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/schema/v.ts +2 -0
- package/vona/src/suite-vendor/a-vona/modules/a-web/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/bean/filterTransform.base.ts +6 -0
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/bean/filterTransform.dateRange.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/bean/pipe.filter.ts +5 -5
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/packages-utils/zova-jsx/package.json +2 -2
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +2 -2
- package/zova/packages-zova/zova-core/src/types/interface/component.ts +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-zod/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +3 -3
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
import { Metadata } from './metadata.ts';
|
|
4
4
|
import { isNil } from './utils.ts';
|
|
5
|
-
import { isZodType } from './zod-is-type.ts';
|
|
5
|
+
import { isNullableSchema, isZodType } from './zod-is-type.ts';
|
|
6
6
|
|
|
7
7
|
interface IParsePayload {
|
|
8
8
|
value: any;
|
|
@@ -33,6 +33,8 @@ function __parseAdapter(inst: z.ZodType, parse) {
|
|
|
33
33
|
return __parseObject(inst, parse, payload, _);
|
|
34
34
|
case 'array':
|
|
35
35
|
return __parseArray(inst, parse, payload, _);
|
|
36
|
+
case 'nullable':
|
|
37
|
+
return __parseNullable(inst, parse, payload, _);
|
|
36
38
|
case 'optional':
|
|
37
39
|
return __parseOptional(inst, parse, payload, _);
|
|
38
40
|
case 'default':
|
|
@@ -171,17 +173,27 @@ function __parseArray(_inst, parse, payload: IParsePayload, _) {
|
|
|
171
173
|
///////////////////////////////////////////
|
|
172
174
|
|
|
173
175
|
function __parseOptional(_inst, parse, payload: IParsePayload, _) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
_coerceWithNil(payload);
|
|
178
|
-
}
|
|
179
|
-
if (payload.value === null) {
|
|
176
|
+
const nullable = isNullableSchema(_inst);
|
|
177
|
+
_coerceNullable(_inst, payload, nullable);
|
|
178
|
+
if (payload.value === null && !nullable) {
|
|
180
179
|
payload.value = undefined;
|
|
181
180
|
}
|
|
182
181
|
return parse(payload, _);
|
|
183
182
|
}
|
|
184
183
|
|
|
184
|
+
////////////////////////////////////////////
|
|
185
|
+
////////////////////////////////////////////
|
|
186
|
+
/// /////// //////////
|
|
187
|
+
/// /////// ZodNullable /////////
|
|
188
|
+
/// /////// //////////
|
|
189
|
+
////////////////////////////////////////////
|
|
190
|
+
////////////////////////////////////////////
|
|
191
|
+
|
|
192
|
+
function __parseNullable(_inst, parse, payload: IParsePayload, _) {
|
|
193
|
+
_coerceNullable(_inst, payload, true);
|
|
194
|
+
return parse(payload, _);
|
|
195
|
+
}
|
|
196
|
+
|
|
185
197
|
////////////////////////////////////////////
|
|
186
198
|
////////////////////////////////////////////
|
|
187
199
|
/// /////// /////////
|
|
@@ -191,11 +203,7 @@ function __parseOptional(_inst, parse, payload: IParsePayload, _) {
|
|
|
191
203
|
////////////////////////////////////////////
|
|
192
204
|
|
|
193
205
|
function __parseDefault(_inst, parse, payload: IParsePayload, _) {
|
|
194
|
-
|
|
195
|
-
_coerceString(payload);
|
|
196
|
-
} else {
|
|
197
|
-
_coerceWithNil(payload);
|
|
198
|
-
}
|
|
206
|
+
_coerceNullable(_inst, payload, isNullableSchema(_inst));
|
|
199
207
|
return parse(payload, _);
|
|
200
208
|
}
|
|
201
209
|
|
|
@@ -225,6 +233,17 @@ function _coerceString(payload: IParsePayload, fn?: Function) {
|
|
|
225
233
|
}
|
|
226
234
|
}
|
|
227
235
|
|
|
236
|
+
function _coerceNullable(inst: z.ZodType, payload: IParsePayload, nullable: boolean) {
|
|
237
|
+
if (isZodType(Metadata.unwrapUntil(inst), 'ZodString')) {
|
|
238
|
+
_coerceString(payload);
|
|
239
|
+
if (nullable && payload.value === 'null') {
|
|
240
|
+
payload.value = null;
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
_coerceWithNil(payload);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
228
247
|
function _coerceWithNil(payload: IParsePayload, fn?: Function) {
|
|
229
248
|
if (!isNil(payload.value)) {
|
|
230
249
|
if (payload.value === 'undefined' || payload.value === '') {
|
|
@@ -90,17 +90,59 @@ export function isAnyZodType(schema: object): schema is z.ZodType {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* The schema.isNullable() is deprecated. This is the suggested replacement
|
|
94
|
-
* as this was how isNullable operated beforehand.
|
|
93
|
+
* The schema.isNullable() is deprecated. This is the suggested replacement.
|
|
95
94
|
*/
|
|
96
95
|
export function isNullableSchema(schema: z.ZodType) {
|
|
97
|
-
return schema
|
|
96
|
+
return _isNullableSchema(schema);
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
/**
|
|
101
|
-
* The schema.isOptional() is deprecated. This is the suggested replacement
|
|
102
|
-
* as this was how isOptional operated beforehand.
|
|
100
|
+
* The schema.isOptional() is deprecated. This is the suggested replacement.
|
|
103
101
|
*/
|
|
104
102
|
export function isOptionalSchema(schema: z.ZodType) {
|
|
105
|
-
return schema
|
|
103
|
+
return _isOptionalSchema(schema);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function _isNullableSchema(schema: z.ZodType): boolean {
|
|
107
|
+
if (isZodType(schema, 'ZodNullable')) return true;
|
|
108
|
+
if (isZodType(schema, 'ZodNonOptional')) return false;
|
|
109
|
+
if (
|
|
110
|
+
isZodType(schema, ['ZodOptional', 'ZodDefault', 'ZodReadonly']) &&
|
|
111
|
+
isAnyZodType(schema._zod.def.innerType)
|
|
112
|
+
) {
|
|
113
|
+
return _isNullableSchema(schema._zod.def.innerType);
|
|
114
|
+
}
|
|
115
|
+
if (isZodType(schema, 'ZodPipe')) {
|
|
116
|
+
const inSchema = schema._zod.def.in;
|
|
117
|
+
const outSchema = schema._zod.def.out;
|
|
118
|
+
if (isZodType(inSchema, 'ZodTransform') && isAnyZodType(outSchema)) {
|
|
119
|
+
return _isNullableSchema(outSchema);
|
|
120
|
+
}
|
|
121
|
+
if (isAnyZodType(inSchema)) {
|
|
122
|
+
return _isNullableSchema(inSchema);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function _isOptionalSchema(schema: z.ZodType): boolean {
|
|
129
|
+
if (isZodType(schema, ['ZodOptional', 'ZodDefault'])) return true;
|
|
130
|
+
if (isZodType(schema, 'ZodNonOptional')) return false;
|
|
131
|
+
if (
|
|
132
|
+
isZodType(schema, ['ZodNullable', 'ZodReadonly']) &&
|
|
133
|
+
isAnyZodType(schema._zod.def.innerType)
|
|
134
|
+
) {
|
|
135
|
+
return _isOptionalSchema(schema._zod.def.innerType);
|
|
136
|
+
}
|
|
137
|
+
if (isZodType(schema, 'ZodPipe')) {
|
|
138
|
+
const inSchema = schema._zod.def.in;
|
|
139
|
+
const outSchema = schema._zod.def.out;
|
|
140
|
+
if (isZodType(inSchema, 'ZodTransform') && isAnyZodType(outSchema)) {
|
|
141
|
+
return _isOptionalSchema(outSchema);
|
|
142
|
+
}
|
|
143
|
+
if (isAnyZodType(inSchema)) {
|
|
144
|
+
return _isOptionalSchema(inSchema);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
106
148
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.45",
|
|
4
4
|
"gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
|
|
5
5
|
"description": "Vona is an intuitive, elegant and powerful Node.js framework for rapidly developing enterprise applications of any size",
|
|
6
6
|
"keywords": [
|