@deboxsoft/module-core
Advanced tools
Comparing version 2.5.48 to 2.6.0
@@ -198,6 +198,46 @@ import { z, ZodType } from 'zod'; | ||
declare const transformDefaultPageInfo: z.ZodEffects<z.ZodObject<z.extendShape<{ | ||
current: z.ZodDefault<z.ZodNumber>; | ||
size: z.ZodDefault<z.ZodNumber>; | ||
}, { | ||
total: z.ZodNumber; | ||
}>, "strip", z.ZodTypeAny, { | ||
current: number; | ||
size: number; | ||
total: number; | ||
}, { | ||
current?: number | undefined; | ||
size?: number | undefined; | ||
total: number; | ||
}>, { | ||
current: number; | ||
size: number; | ||
total: number; | ||
last: number; | ||
}, { | ||
current?: number | undefined; | ||
size?: number | undefined; | ||
total: number; | ||
}>; | ||
declare const PaginationOptions: z.ZodObject<{ | ||
type: z.ZodOptional<z.ZodDefault<z.ZodEnum<["cursor", "default"]>>>; | ||
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>; | ||
page: z.ZodOptional<z.ZodDefault<z.ZodNumber>>; | ||
params: z.ZodUnion<[z.ZodObject<{ | ||
current: z.ZodDefault<z.ZodNumber>; | ||
size: z.ZodDefault<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
current: number; | ||
size: number; | ||
}, { | ||
current?: number | undefined; | ||
size?: number | undefined; | ||
}>, z.ZodObject<{ | ||
current: z.ZodDefault<z.ZodNumber>; | ||
size: z.ZodDefault<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
current: number; | ||
size: number; | ||
}, { | ||
current?: number | undefined; | ||
size?: number | undefined; | ||
}>]>; | ||
sortField: z.ZodOptional<z.ZodString>; | ||
@@ -237,6 +277,8 @@ sortAsc: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>; | ||
} | undefined; | ||
limit?: number | undefined; | ||
page?: number | undefined; | ||
sortField?: string | undefined; | ||
sortAsc?: boolean | undefined; | ||
params: { | ||
current: number; | ||
size: number; | ||
}; | ||
}, { | ||
@@ -253,6 +295,8 @@ sort?: Record<string, 1 | -1> | undefined; | ||
} | undefined; | ||
limit?: number | undefined; | ||
page?: number | undefined; | ||
sortField?: string | undefined; | ||
sortAsc?: boolean | undefined; | ||
params: { | ||
current?: number | undefined; | ||
size?: number | undefined; | ||
}; | ||
}>; | ||
@@ -262,71 +306,31 @@ declare type PaginationOptions<F = any> = z.TypeOf<typeof PaginationOptions> & { | ||
}; | ||
declare const Pagination: z.ZodObject<{ | ||
data: z.ZodArray<z.ZodAny, "many">; | ||
pageInfo: z.ZodObject<{ | ||
total: z.ZodNullable<z.ZodOptional<z.ZodNumber>>; | ||
page: z.ZodNullable<z.ZodOptional<z.ZodNumber>>; | ||
cursor: z.ZodNullable<z.ZodOptional<z.ZodObject<{ | ||
next: z.ZodOptional<z.ZodString>; | ||
hasNext: z.ZodOptional<z.ZodBoolean>; | ||
previous: z.ZodOptional<z.ZodString>; | ||
hasPrevious: z.ZodOptional<z.ZodBoolean>; | ||
}, "strip", z.ZodTypeAny, { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
}, { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
}>>>; | ||
}, "strip", z.ZodTypeAny, { | ||
cursor?: { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
} | null | undefined; | ||
page?: number | null | undefined; | ||
total?: number | null | undefined; | ||
}, { | ||
cursor?: { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
} | null | undefined; | ||
page?: number | null | undefined; | ||
total?: number | null | undefined; | ||
}>; | ||
declare const PageInfo: z.ZodObject<{ | ||
total: z.ZodNumber; | ||
}, "strip", z.ZodTypeAny, { | ||
data: any[]; | ||
pageInfo: { | ||
cursor?: { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
} | null | undefined; | ||
page?: number | null | undefined; | ||
total?: number | null | undefined; | ||
}; | ||
total: number; | ||
}, { | ||
data: any[]; | ||
pageInfo: { | ||
cursor?: { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
} | null | undefined; | ||
page?: number | null | undefined; | ||
total?: number | null | undefined; | ||
}; | ||
total: number; | ||
}>; | ||
declare type Pagination<D = any> = z.TypeOf<typeof Pagination> & { | ||
data: D[]; | ||
}; | ||
declare const PageCursorInfo: z.ZodObject<{ | ||
declare type PageInfo = z.TypeOf<typeof PageInfo>; | ||
declare const PageDefaultInfo: z.ZodObject<z.extendShape<{ | ||
total: z.ZodNumber; | ||
}, { | ||
size: z.ZodNumber; | ||
current: z.ZodNumber; | ||
last: z.ZodNumber; | ||
}>, "strip", z.ZodTypeAny, { | ||
current: number; | ||
size: number; | ||
total: number; | ||
last: number; | ||
}, { | ||
current: number; | ||
size: number; | ||
total: number; | ||
last: number; | ||
}>; | ||
declare type PageDefaultInfo = z.TypeOf<typeof PageDefaultInfo>; | ||
declare const PageCursorInfo: z.ZodObject<z.extendShape<{ | ||
total: z.ZodNumber; | ||
}, { | ||
next: z.ZodOptional<z.ZodString>; | ||
@@ -336,3 +340,3 @@ hasNext: z.ZodOptional<z.ZodBoolean>; | ||
hasPrevious: z.ZodOptional<z.ZodBoolean>; | ||
}, "strip", z.ZodTypeAny, { | ||
}>, "strip", z.ZodTypeAny, { | ||
previous?: string | undefined; | ||
@@ -342,2 +346,3 @@ next?: string | undefined; | ||
hasPrevious?: boolean | undefined; | ||
total: number; | ||
}, { | ||
@@ -348,4 +353,75 @@ previous?: string | undefined; | ||
hasPrevious?: boolean | undefined; | ||
total: number; | ||
}>; | ||
declare type PageCursorInfo = z.TypeOf<typeof PageCursorInfo>; | ||
declare const Pagination: z.ZodObject<{ | ||
data: z.ZodArray<z.ZodAny, "many">; | ||
pageInfo: z.ZodUnion<[z.ZodObject<z.extendShape<{ | ||
total: z.ZodNumber; | ||
}, { | ||
size: z.ZodNumber; | ||
current: z.ZodNumber; | ||
last: z.ZodNumber; | ||
}>, "strip", z.ZodTypeAny, { | ||
current: number; | ||
size: number; | ||
total: number; | ||
last: number; | ||
}, { | ||
current: number; | ||
size: number; | ||
total: number; | ||
last: number; | ||
}>, z.ZodObject<z.extendShape<{ | ||
total: z.ZodNumber; | ||
}, { | ||
next: z.ZodOptional<z.ZodString>; | ||
hasNext: z.ZodOptional<z.ZodBoolean>; | ||
previous: z.ZodOptional<z.ZodString>; | ||
hasPrevious: z.ZodOptional<z.ZodBoolean>; | ||
}>, "strip", z.ZodTypeAny, { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
total: number; | ||
}, { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
total: number; | ||
}>]>; | ||
}, "strip", z.ZodTypeAny, { | ||
data: any[]; | ||
pageInfo: { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
total: number; | ||
} | { | ||
current: number; | ||
size: number; | ||
total: number; | ||
last: number; | ||
}; | ||
}, { | ||
data: any[]; | ||
pageInfo: { | ||
previous?: string | undefined; | ||
next?: string | undefined; | ||
hasNext?: boolean | undefined; | ||
hasPrevious?: boolean | undefined; | ||
total: number; | ||
} | { | ||
current: number; | ||
size: number; | ||
total: number; | ||
last: number; | ||
}; | ||
}>; | ||
declare type Pagination<D = any> = z.TypeOf<typeof Pagination> & { | ||
data: D[]; | ||
}; | ||
declare const PageCursorParams: z.ZodObject<{ | ||
@@ -518,2 +594,2 @@ previous: z.ZodOptional<z.ZodAny>; | ||
export { AppConfig, BooleanResponse, CONFIG_KEY, Config, Container, DateSchema, DbxError, DbxErrorOptions, IdParams, IdSchema, LOGGER_KEY, Logger, ModuleConfig, NotificationType, NumberResponse, PageCursorInfo, PageCursorParams, Pagination, PaginationOptions, RangeDate, RangeDateSchema, StringResponse, TimeStampSchema, clamp, cloneDeep, createLoggerConsole, dayTimeZone, debounce, getAppConfig, getConfig, getLogger, getRangeDate, isEmpty, isObject, isPlainObject, isString, isStringAndNotBlank, isStringBlank, kindOf, makeSchemaResponse, omit, pickBy, pull, throttle }; | ||
export { AppConfig, BooleanResponse, CONFIG_KEY, Config, Container, DateSchema, DbxError, DbxErrorOptions, IdParams, IdSchema, LOGGER_KEY, Logger, ModuleConfig, NotificationType, NumberResponse, PageCursorInfo, PageCursorParams, PageDefaultInfo, PageInfo, Pagination, PaginationOptions, RangeDate, RangeDateSchema, StringResponse, TimeStampSchema, clamp, cloneDeep, createLoggerConsole, dayTimeZone, debounce, getAppConfig, getConfig, getLogger, getRangeDate, isEmpty, isObject, isPlainObject, isString, isStringAndNotBlank, isStringBlank, kindOf, makeSchemaResponse, omit, pickBy, pull, throttle, transformDefaultPageInfo }; |
@@ -60,2 +60,3 @@ var __defProp = Object.defineProperty; | ||
throttle: () => throttle, | ||
transformDefaultPageInfo: () => transformDefaultPageInfo, | ||
z: () => z2 | ||
@@ -131,3 +132,10 @@ }); | ||
}); | ||
var PageCursorInfo = z2.object({ | ||
var PageDefaultParams = z2.object({ | ||
current: z2.number().default(1), | ||
size: z2.number().default(30) | ||
}); | ||
var PageInfo = z2.object({ | ||
total: z2.number() | ||
}); | ||
var PageCursorInfo = PageInfo.extend({ | ||
next: z2.string().optional(), | ||
@@ -138,6 +146,10 @@ hasNext: z2.boolean().optional(), | ||
}); | ||
var PageDefaultInfo = PageInfo.extend({ | ||
size: z2.number(), | ||
current: z2.number(), | ||
last: z2.number() | ||
}); | ||
var PaginationOptions = z2.object({ | ||
type: PaginationType.optional(), | ||
limit: z2.number().default(30).optional(), | ||
page: z2.number().default(1).optional(), | ||
params: z2.union([PageDefaultParams, PageDefaultParams]), | ||
sortField: z2.string().optional(), | ||
@@ -151,8 +163,15 @@ sortAsc: z2.boolean().default(true).optional(), | ||
data: z2.array(z2.any()), | ||
pageInfo: z2.object({ | ||
total: z2.number().nullish(), | ||
page: z2.number().nullish(), | ||
cursor: PageCursorInfo.nullish() | ||
}) | ||
pageInfo: z2.union([PageDefaultInfo, PageCursorInfo]) | ||
}); | ||
var transformDefaultPageInfo = PageDefaultParams.extend({ | ||
total: z2.number() | ||
}).transform(({ size, current, total }) => { | ||
const pageCount = Math.ceil(total / size); | ||
return { | ||
total, | ||
size, | ||
current, | ||
last: pageCount | ||
}; | ||
}); | ||
@@ -749,3 +768,4 @@ // src/di/errors/ServiceNotFoundError.ts | ||
throttle, | ||
transformDefaultPageInfo, | ||
z2 as z | ||
}; |
{ | ||
"name": "@deboxsoft/module-core", | ||
"version": "2.5.48", | ||
"version": "2.6.0", | ||
"license": "SEE LICENSE IN LICENSE", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67920
2072