@vulog/aima-core 1.1.75 → 1.1.77
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/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
- package/src/index.ts +5 -2
package/dist/index.d.mts
CHANGED
|
@@ -12,35 +12,35 @@ type PaginableOptions<T = void, S = string> = T extends void ? {
|
|
|
12
12
|
sortDirection?: 'ASC' | 'DESC';
|
|
13
13
|
filters?: T;
|
|
14
14
|
};
|
|
15
|
-
declare const createPaginableOptionsSchema: <T extends z.ZodTypeAny>(optionsSchema?: T) => z.ZodObject<{
|
|
15
|
+
declare const createPaginableOptionsSchema: <T extends z.ZodTypeAny, S extends z.ZodTypeAny>(optionsSchema?: T, sortSchema?: S) => z.ZodObject<{
|
|
16
16
|
filters?: T | undefined;
|
|
17
17
|
page: z.ZodDefault<z.ZodNumber>;
|
|
18
18
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
19
|
-
sort:
|
|
19
|
+
sort: S;
|
|
20
20
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
21
21
|
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
22
22
|
filters?: T | undefined;
|
|
23
23
|
page: z.ZodDefault<z.ZodNumber>;
|
|
24
24
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
25
|
-
sort:
|
|
25
|
+
sort: S;
|
|
26
26
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
27
27
|
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
28
28
|
filters?: T | undefined;
|
|
29
29
|
page: z.ZodDefault<z.ZodNumber>;
|
|
30
30
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
31
|
-
sort:
|
|
31
|
+
sort: S;
|
|
32
32
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
33
33
|
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
34
34
|
filters?: T | undefined;
|
|
35
35
|
page: z.ZodDefault<z.ZodNumber>;
|
|
36
36
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
37
|
-
sort:
|
|
37
|
+
sort: S;
|
|
38
38
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
39
39
|
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
40
40
|
filters?: T | undefined;
|
|
41
41
|
page: z.ZodDefault<z.ZodNumber>;
|
|
42
42
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
43
|
-
sort:
|
|
43
|
+
sort: S;
|
|
44
44
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
45
45
|
}>[k_1]; } : never>;
|
|
46
46
|
type PaginableResponse<T> = {
|
package/dist/index.d.ts
CHANGED
|
@@ -12,35 +12,35 @@ type PaginableOptions<T = void, S = string> = T extends void ? {
|
|
|
12
12
|
sortDirection?: 'ASC' | 'DESC';
|
|
13
13
|
filters?: T;
|
|
14
14
|
};
|
|
15
|
-
declare const createPaginableOptionsSchema: <T extends z.ZodTypeAny>(optionsSchema?: T) => z.ZodObject<{
|
|
15
|
+
declare const createPaginableOptionsSchema: <T extends z.ZodTypeAny, S extends z.ZodTypeAny>(optionsSchema?: T, sortSchema?: S) => z.ZodObject<{
|
|
16
16
|
filters?: T | undefined;
|
|
17
17
|
page: z.ZodDefault<z.ZodNumber>;
|
|
18
18
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
19
|
-
sort:
|
|
19
|
+
sort: S;
|
|
20
20
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
21
21
|
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
22
22
|
filters?: T | undefined;
|
|
23
23
|
page: z.ZodDefault<z.ZodNumber>;
|
|
24
24
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
25
|
-
sort:
|
|
25
|
+
sort: S;
|
|
26
26
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
27
27
|
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
28
28
|
filters?: T | undefined;
|
|
29
29
|
page: z.ZodDefault<z.ZodNumber>;
|
|
30
30
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
31
|
-
sort:
|
|
31
|
+
sort: S;
|
|
32
32
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
33
33
|
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
34
34
|
filters?: T | undefined;
|
|
35
35
|
page: z.ZodDefault<z.ZodNumber>;
|
|
36
36
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
37
|
-
sort:
|
|
37
|
+
sort: S;
|
|
38
38
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
39
39
|
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
40
40
|
filters?: T | undefined;
|
|
41
41
|
page: z.ZodDefault<z.ZodNumber>;
|
|
42
42
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
43
|
-
sort:
|
|
43
|
+
sort: S;
|
|
44
44
|
sortDirection: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
45
45
|
}>[k_1]; } : never>;
|
|
46
46
|
type PaginableResponse<T> = {
|
package/dist/index.js
CHANGED
|
@@ -24,11 +24,11 @@ __export(index_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
var import_zod = require("zod");
|
|
27
|
-
var createPaginableOptionsSchema = (optionsSchema) => {
|
|
27
|
+
var createPaginableOptionsSchema = (optionsSchema, sortSchema = import_zod.z.string().optional()) => {
|
|
28
28
|
return import_zod.z.object({
|
|
29
29
|
page: import_zod.z.number().int().nonnegative().default(0),
|
|
30
30
|
pageSize: import_zod.z.number().int().positive().lte(1e3).default(100),
|
|
31
|
-
sort:
|
|
31
|
+
sort: sortSchema,
|
|
32
32
|
sortDirection: import_zod.z.enum(["ASC", "DESC"]).optional(),
|
|
33
33
|
...optionsSchema ? { filters: optionsSchema } : {}
|
|
34
34
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
var createPaginableOptionsSchema = (optionsSchema) => {
|
|
3
|
+
var createPaginableOptionsSchema = (optionsSchema, sortSchema = z.string().optional()) => {
|
|
4
4
|
return z.object({
|
|
5
5
|
page: z.number().int().nonnegative().default(0),
|
|
6
6
|
pageSize: z.number().int().positive().lte(1e3).default(100),
|
|
7
|
-
sort:
|
|
7
|
+
sort: sortSchema,
|
|
8
8
|
sortDirection: z.enum(["ASC", "DESC"]).optional(),
|
|
9
9
|
...optionsSchema ? { filters: optionsSchema } : {}
|
|
10
10
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.77",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"CORE"
|
|
18
18
|
],
|
|
19
19
|
"author": "Vulog",
|
|
20
|
-
"license": "
|
|
20
|
+
"license": "MIT",
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"zod": "^3.24.2"
|
|
23
23
|
},
|
package/src/index.ts
CHANGED
|
@@ -15,11 +15,14 @@ export type PaginableOptions<T = void, S = string> = T extends void
|
|
|
15
15
|
filters?: T;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const createPaginableOptionsSchema = <T extends z.ZodTypeAny
|
|
18
|
+
export const createPaginableOptionsSchema = <T extends z.ZodTypeAny, S extends z.ZodTypeAny>(
|
|
19
|
+
optionsSchema?: T,
|
|
20
|
+
sortSchema: S = z.string().optional() as unknown as S
|
|
21
|
+
) => {
|
|
19
22
|
return z.object({
|
|
20
23
|
page: z.number().int().nonnegative().default(0),
|
|
21
24
|
pageSize: z.number().int().positive().lte(1000).default(100),
|
|
22
|
-
sort:
|
|
25
|
+
sort: sortSchema,
|
|
23
26
|
sortDirection: z.enum(['ASC', 'DESC']).optional(),
|
|
24
27
|
...(optionsSchema ? { filters: optionsSchema } : {}),
|
|
25
28
|
});
|