@vulog/aima-core 1.2.29 → 1.2.31

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.cjs ADDED
@@ -0,0 +1,14 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let zod = require("zod");
3
+ //#region src/index.ts
4
+ const createPaginableOptionsSchema = (optionsSchema, sortSchema = zod.z.string().optional()) => {
5
+ return zod.z.object({
6
+ page: zod.z.number().int().nonnegative().default(0),
7
+ pageSize: zod.z.number().int().positive().lte(1e3).default(100),
8
+ sort: sortSchema,
9
+ sortDirection: zod.z.enum(["ASC", "DESC"]).optional().default("ASC"),
10
+ ...optionsSchema ? { filters: optionsSchema } : {}
11
+ });
12
+ };
13
+ //#endregion
14
+ exports.createPaginableOptionsSchema = createPaginableOptionsSchema;
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/index.d.ts
4
+ type PaginableOptions<T = void, S = string> = T extends void ? {
5
+ page?: number;
6
+ pageSize?: number;
7
+ sort?: S;
8
+ sortDirection?: 'ASC' | 'DESC';
9
+ } : {
10
+ page?: number;
11
+ pageSize?: number;
12
+ sort?: S;
13
+ sortDirection?: 'ASC' | 'DESC';
14
+ filters?: T;
15
+ };
16
+ declare const createPaginableOptionsSchema: <T extends z.ZodTypeAny, S extends z.ZodTypeAny>(optionsSchema?: T, sortSchema?: S) => z.ZodObject<{
17
+ filters?: T | undefined;
18
+ page: z.ZodDefault<z.ZodNumber>;
19
+ pageSize: z.ZodDefault<z.ZodNumber>;
20
+ sort: S;
21
+ sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
22
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
23
+ filters?: T | undefined;
24
+ page: z.ZodDefault<z.ZodNumber>;
25
+ pageSize: z.ZodDefault<z.ZodNumber>;
26
+ sort: S;
27
+ sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
28
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k] } : never, z.baseObjectInputType<{
29
+ filters?: T | undefined;
30
+ page: z.ZodDefault<z.ZodNumber>;
31
+ pageSize: z.ZodDefault<z.ZodNumber>;
32
+ sort: S;
33
+ sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
34
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1] } : never>;
35
+ type PaginableResponse<T> = {
36
+ data: T[];
37
+ page: number;
38
+ pageSize: number;
39
+ total: number;
40
+ totalPages: number;
41
+ };
42
+ type PatchAction<T extends string> = {
43
+ op: 'add' | 'replace';
44
+ path: T;
45
+ value: string;
46
+ } | {
47
+ op: 'remove';
48
+ path: T;
49
+ };
50
+ //#endregion
51
+ export { PaginableOptions, PaginableResponse, PatchAction, createPaginableOptionsSchema };
package/dist/index.d.mts CHANGED
@@ -1,50 +1,51 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
 
3
+ //#region src/index.d.ts
3
4
  type PaginableOptions<T = void, S = string> = T extends void ? {
4
- page?: number;
5
- pageSize?: number;
6
- sort?: S;
7
- sortDirection?: 'ASC' | 'DESC';
5
+ page?: number;
6
+ pageSize?: number;
7
+ sort?: S;
8
+ sortDirection?: 'ASC' | 'DESC';
8
9
  } : {
9
- page?: number;
10
- pageSize?: number;
11
- sort?: S;
12
- sortDirection?: 'ASC' | 'DESC';
13
- filters?: T;
10
+ page?: number;
11
+ pageSize?: number;
12
+ sort?: S;
13
+ sortDirection?: 'ASC' | 'DESC';
14
+ filters?: T;
14
15
  };
15
16
  declare const createPaginableOptionsSchema: <T extends z.ZodTypeAny, S extends z.ZodTypeAny>(optionsSchema?: T, sortSchema?: S) => z.ZodObject<{
16
- filters?: T | undefined;
17
- page: z.ZodDefault<z.ZodNumber>;
18
- pageSize: z.ZodDefault<z.ZodNumber>;
19
- sort: S;
20
- sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
17
+ filters?: T | undefined;
18
+ page: z.ZodDefault<z.ZodNumber>;
19
+ pageSize: z.ZodDefault<z.ZodNumber>;
20
+ sort: S;
21
+ sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
21
22
  }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
22
- filters?: T | undefined;
23
- page: z.ZodDefault<z.ZodNumber>;
24
- pageSize: z.ZodDefault<z.ZodNumber>;
25
- sort: S;
26
- sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
27
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
28
- filters?: T | undefined;
29
- page: z.ZodDefault<z.ZodNumber>;
30
- pageSize: z.ZodDefault<z.ZodNumber>;
31
- sort: S;
32
- sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
33
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
23
+ filters?: T | undefined;
24
+ page: z.ZodDefault<z.ZodNumber>;
25
+ pageSize: z.ZodDefault<z.ZodNumber>;
26
+ sort: S;
27
+ sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
28
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k] } : never, z.baseObjectInputType<{
29
+ filters?: T | undefined;
30
+ page: z.ZodDefault<z.ZodNumber>;
31
+ pageSize: z.ZodDefault<z.ZodNumber>;
32
+ sort: S;
33
+ sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
34
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1] } : never>;
34
35
  type PaginableResponse<T> = {
35
- data: T[];
36
- page: number;
37
- pageSize: number;
38
- total: number;
39
- totalPages: number;
36
+ data: T[];
37
+ page: number;
38
+ pageSize: number;
39
+ total: number;
40
+ totalPages: number;
40
41
  };
41
42
  type PatchAction<T extends string> = {
42
- op: 'add' | 'replace';
43
- path: T;
44
- value: string;
43
+ op: 'add' | 'replace';
44
+ path: T;
45
+ value: string;
45
46
  } | {
46
- op: 'remove';
47
- path: T;
47
+ op: 'remove';
48
+ path: T;
48
49
  };
49
-
50
- export { type PaginableOptions, type PaginableResponse, type PatchAction, createPaginableOptionsSchema };
50
+ //#endregion
51
+ export { PaginableOptions, PaginableResponse, PatchAction, createPaginableOptionsSchema };
package/dist/index.mjs CHANGED
@@ -1,14 +1,13 @@
1
- // src/index.ts
2
1
  import { z } from "zod";
3
- var createPaginableOptionsSchema = (optionsSchema, sortSchema = z.string().optional()) => {
4
- return z.object({
5
- page: z.number().int().nonnegative().default(0),
6
- pageSize: z.number().int().positive().lte(1e3).default(100),
7
- sort: sortSchema,
8
- sortDirection: z.enum(["ASC", "DESC"]).optional().default("ASC"),
9
- ...optionsSchema ? { filters: optionsSchema } : {}
10
- });
11
- };
12
- export {
13
- createPaginableOptionsSchema
2
+ //#region src/index.ts
3
+ const createPaginableOptionsSchema = (optionsSchema, sortSchema = z.string().optional()) => {
4
+ return z.object({
5
+ page: z.number().int().nonnegative().default(0),
6
+ pageSize: z.number().int().positive().lte(1e3).default(100),
7
+ sort: sortSchema,
8
+ sortDirection: z.enum(["ASC", "DESC"]).optional().default("ASC"),
9
+ ...optionsSchema ? { filters: optionsSchema } : {}
10
+ });
14
11
  };
12
+ //#endregion
13
+ export { createPaginableOptionsSchema };
package/package.json CHANGED
@@ -1,12 +1,25 @@
1
1
  {
2
2
  "name": "@vulog/aima-core",
3
- "version": "1.2.29",
4
- "main": "dist/index.js",
3
+ "type": "module",
4
+ "version": "1.2.31",
5
+ "main": "dist/index.cjs",
5
6
  "module": "dist/index.mjs",
6
- "types": "dist/index.d.ts",
7
+ "types": "dist/index.d.cts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ }
19
+ },
7
20
  "scripts": {
8
- "build": "tsup",
9
- "dev": "tsup --watch",
21
+ "build": "tsdown",
22
+ "dev": "tsdown --watch",
10
23
  "test": "",
11
24
  "test:watch": "vitest",
12
25
  "lint": "eslint src/**/* --ext .ts"
@@ -1,4 +1,4 @@
1
- import { defineConfig } from 'tsup';
1
+ import { defineConfig } from 'tsdown';
2
2
 
3
3
  export default defineConfig({
4
4
  entry: ['src/index.ts'],
package/dist/index.d.ts DELETED
@@ -1,50 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- type PaginableOptions<T = void, S = string> = T extends void ? {
4
- page?: number;
5
- pageSize?: number;
6
- sort?: S;
7
- sortDirection?: 'ASC' | 'DESC';
8
- } : {
9
- page?: number;
10
- pageSize?: number;
11
- sort?: S;
12
- sortDirection?: 'ASC' | 'DESC';
13
- filters?: T;
14
- };
15
- declare const createPaginableOptionsSchema: <T extends z.ZodTypeAny, S extends z.ZodTypeAny>(optionsSchema?: T, sortSchema?: S) => z.ZodObject<{
16
- filters?: T | undefined;
17
- page: z.ZodDefault<z.ZodNumber>;
18
- pageSize: z.ZodDefault<z.ZodNumber>;
19
- sort: S;
20
- sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
21
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
22
- filters?: T | undefined;
23
- page: z.ZodDefault<z.ZodNumber>;
24
- pageSize: z.ZodDefault<z.ZodNumber>;
25
- sort: S;
26
- sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
27
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
28
- filters?: T | undefined;
29
- page: z.ZodDefault<z.ZodNumber>;
30
- pageSize: z.ZodDefault<z.ZodNumber>;
31
- sort: S;
32
- sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>>;
33
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
34
- type PaginableResponse<T> = {
35
- data: T[];
36
- page: number;
37
- pageSize: number;
38
- total: number;
39
- totalPages: number;
40
- };
41
- type PatchAction<T extends string> = {
42
- op: 'add' | 'replace';
43
- path: T;
44
- value: string;
45
- } | {
46
- op: 'remove';
47
- path: T;
48
- };
49
-
50
- export { type PaginableOptions, type PaginableResponse, type PatchAction, createPaginableOptionsSchema };
package/dist/index.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- createPaginableOptionsSchema: () => createPaginableOptionsSchema
24
- });
25
- module.exports = __toCommonJS(index_exports);
26
- var import_zod = require("zod");
27
- var createPaginableOptionsSchema = (optionsSchema, sortSchema = import_zod.z.string().optional()) => {
28
- return import_zod.z.object({
29
- page: import_zod.z.number().int().nonnegative().default(0),
30
- pageSize: import_zod.z.number().int().positive().lte(1e3).default(100),
31
- sort: sortSchema,
32
- sortDirection: import_zod.z.enum(["ASC", "DESC"]).optional().default("ASC"),
33
- ...optionsSchema ? { filters: optionsSchema } : {}
34
- });
35
- };
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- createPaginableOptionsSchema
39
- });
File without changes