@kalutskii/foundation 0.6.16 → 0.6.18
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.ts +5 -20
- package/dist/index.js +2 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -280,8 +280,8 @@ declare class ZodJWTService<TPayloadOrSchema> {
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
declare const zodPaginationSchema: z.ZodObject<{
|
|
283
|
-
offset: z.
|
|
284
|
-
limit: z.
|
|
283
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
284
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
285
285
|
}, z.core.$strip>;
|
|
286
286
|
/**
|
|
287
287
|
* Reusable pagination fields for flat query schemas, allowing for
|
|
@@ -291,8 +291,8 @@ declare const zodPaginationSchema: z.ZodObject<{
|
|
|
291
291
|
* or use `zodPaginationSchema.extend(...)` when building directly from the schema.
|
|
292
292
|
*/
|
|
293
293
|
declare const zodPaginationShape: {
|
|
294
|
-
offset: z.
|
|
295
|
-
limit: z.
|
|
294
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
295
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
296
296
|
};
|
|
297
297
|
/**
|
|
298
298
|
* TypeScript type representing the pagination options validated by the `zodPaginationSchema`.
|
|
@@ -300,21 +300,6 @@ declare const zodPaginationShape: {
|
|
|
300
300
|
*/
|
|
301
301
|
type ZodPaginationOptions = z.infer<typeof zodPaginationSchema>;
|
|
302
302
|
|
|
303
|
-
/**
|
|
304
|
-
* Extracts defined pagination options from a query object.
|
|
305
|
-
*
|
|
306
|
-
* This keeps query builder calls clean by omitting undefined values while
|
|
307
|
-
* preserving valid pagination values like `0`, useful when spreading pagination
|
|
308
|
-
* options into APIs that expect only explicitly provided fields (e.g., Drizzle).
|
|
309
|
-
*
|
|
310
|
-
* ```ts
|
|
311
|
-
* await db.query.someTable.findMany({
|
|
312
|
-
* ...refinePagination(options),
|
|
313
|
-
* });
|
|
314
|
-
* ```
|
|
315
|
-
*/
|
|
316
|
-
declare const refinePagination: (options?: ZodPaginationOptions) => ZodPaginationOptions;
|
|
317
|
-
|
|
318
303
|
/**
|
|
319
304
|
* Wraps a partial Zod object schema with:
|
|
320
305
|
* 1. A runtime check ensuring at least one field is non-undefined.
|
|
@@ -353,4 +338,4 @@ declare const asQuery: <T extends z.ZodTypeAny>(schema: T) => z.ZodPreprocess<T>
|
|
|
353
338
|
*/
|
|
354
339
|
declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
355
340
|
|
|
356
|
-
export { type APIContractData, type APIContractError, type APIContractResult, type APIError, type APISuccess, type AsQuery, type AtLeastOne, EXCEPTION_STATUS_CODES, type ExceptionStatusCode, type FetchResult, type JWTServiceOptions, type JWTSignOptions, type MeasuredExecution, type Payload, type PayloadSchema, SUCCESS_STATUS_CODES, type Simplify, type SuccessStatusCode, ZodJWTService, type ZodPaginationOptions, asQuery, failure, fetchAndThrow, fetchSafely, formatTime, generateRandomString, getColoredHTTPStatus, getFormattedDate, getFormattedTime, getUTCOffset, getZonedTime, honoLoggingHandler, isPlainObject, log, measureExecutionTime, onHandlerError, parseQueryValue,
|
|
341
|
+
export { type APIContractData, type APIContractError, type APIContractResult, type APIError, type APISuccess, type AsQuery, type AtLeastOne, EXCEPTION_STATUS_CODES, type ExceptionStatusCode, type FetchResult, type JWTServiceOptions, type JWTSignOptions, type MeasuredExecution, type Payload, type PayloadSchema, SUCCESS_STATUS_CODES, type Simplify, type SuccessStatusCode, ZodJWTService, type ZodPaginationOptions, asQuery, failure, fetchAndThrow, fetchSafely, formatTime, generateRandomString, getColoredHTTPStatus, getFormattedDate, getFormattedTime, getUTCOffset, getZonedTime, honoLoggingHandler, isPlainObject, log, measureExecutionTime, onHandlerError, parseQueryValue, respond, safeExecute, sqlWhere, success, zodAtLeastOne, zodPaginationSchema, zodPaginationShape };
|
package/dist/index.js
CHANGED
|
@@ -208,19 +208,13 @@ var ZodJWTService = class {
|
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
// src/zod-pagination/zod-pagination.refiners.ts
|
|
212
|
-
var refinePagination = (options) => ({
|
|
213
|
-
...options?.offset !== void 0 ? { offset: options.offset } : {},
|
|
214
|
-
...options?.limit !== void 0 ? { limit: options.limit } : {}
|
|
215
|
-
});
|
|
216
|
-
|
|
217
211
|
// src/zod-pagination/zod-pagination.schemas.ts
|
|
218
212
|
import z from "zod";
|
|
219
213
|
var zodPaginationSchema = z.object({
|
|
220
214
|
/** Integer representing the starting point for pagination. */
|
|
221
|
-
offset: z.coerce.number().int().nonnegative().
|
|
215
|
+
offset: z.coerce.number().int().nonnegative().default(0),
|
|
222
216
|
/** Integer representing the maximum number of items to return. */
|
|
223
|
-
limit: z.coerce.number().int().positive().
|
|
217
|
+
limit: z.coerce.number().int().positive().default(10)
|
|
224
218
|
});
|
|
225
219
|
var zodPaginationShape = zodPaginationSchema.shape;
|
|
226
220
|
|
|
@@ -282,7 +276,6 @@ export {
|
|
|
282
276
|
measureExecutionTime,
|
|
283
277
|
onHandlerError,
|
|
284
278
|
parseQueryValue,
|
|
285
|
-
refinePagination,
|
|
286
279
|
respond,
|
|
287
280
|
safeExecute,
|
|
288
281
|
sqlWhere,
|