@kalutskii/foundation 0.6.24 → 0.7.0
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/README.md +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +5 -5
- package/package.json +3 -3
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SQL } from 'drizzle-orm';
|
|
2
2
|
import { ErrorHandler, MiddlewareHandler, Context, TypedResponse } from 'hono';
|
|
3
3
|
import { Locale } from 'date-fns';
|
|
4
|
-
import z, { ZodObject, ZodRawShape
|
|
4
|
+
import z$1, { z, ZodObject, ZodRawShape } from 'zod';
|
|
5
5
|
import { SymmetricAlgorithm } from 'hono/utils/jwt/jwa';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -252,7 +252,7 @@ declare const zodBulkSelectionSchema: <const TIdentifierSchema extends z.ZodType
|
|
|
252
252
|
* Shared bulk-selection payload produced by `zodBulkSelectionSchema`.
|
|
253
253
|
* String identifiers are used by default for frontend table integrations.
|
|
254
254
|
*/
|
|
255
|
-
type ZodBulkSelection<TIdentifier extends string | number = string> = z.infer<ReturnType<typeof zodBulkSelectionSchema<z.ZodType<TIdentifier>>>>;
|
|
255
|
+
type ZodBulkSelection<TIdentifier extends string | number = string> = z$1.infer<ReturnType<typeof zodBulkSelectionSchema<z.ZodType<TIdentifier>>>>;
|
|
256
256
|
/**
|
|
257
257
|
* Explicit bulk selection containing only identifiers chosen by the client.
|
|
258
258
|
* This branch does not require resolving an all-matching search snapshot.
|
|
@@ -283,11 +283,11 @@ type JWTSignOptions = {
|
|
|
283
283
|
/**
|
|
284
284
|
* Utility types for inferring payload types from Zod schemas.
|
|
285
285
|
*/
|
|
286
|
-
type Payload<T> = T extends z.ZodType ? z.infer<T> : T;
|
|
286
|
+
type Payload<T> = T extends z$1.ZodType ? z$1.infer<T> : T;
|
|
287
287
|
/**
|
|
288
288
|
* Utility type to extract the payload schema type from a Zod schema.
|
|
289
289
|
* */
|
|
290
|
-
type PayloadSchema<T> = T extends z.ZodType ? T : never;
|
|
290
|
+
type PayloadSchema<T> = T extends z$1.ZodType ? T : never;
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* A service class for handling JWT operations with optional Zod schema validation for the payload.
|
|
@@ -341,7 +341,7 @@ declare const zodPaginationShape: {
|
|
|
341
341
|
* TypeScript output produced after successful pagination validation.
|
|
342
342
|
* Defaulted fields are represented as required numeric properties.
|
|
343
343
|
*/
|
|
344
|
-
type ZodPaginationOptions = z.infer<typeof zodPaginationSchema>;
|
|
344
|
+
type ZodPaginationOptions = z$1.infer<typeof zodPaginationSchema>;
|
|
345
345
|
/**
|
|
346
346
|
* Feature flags shared by both supported search schema composition modes.
|
|
347
347
|
* Literal values are preserved in the resulting runtime and static shapes.
|
|
@@ -365,12 +365,12 @@ type ZodSearchFeatureOptions<TQueryEnabled extends boolean, TPaginationEnabled e
|
|
|
365
365
|
* `filters` is the concise mode that applies partial and non-empty rules.
|
|
366
366
|
* `whereSchema` accepts a fully prepared schema with custom Zod effects.
|
|
367
367
|
*/
|
|
368
|
-
type ZodSearchSchemaOptions<TShape extends z.ZodRawShape = never, TWhereSchema extends z.ZodType<Record<string, unknown>> = never, TQueryEnabled extends boolean = true, TPaginationEnabled extends boolean = true> = ZodSearchFeatureOptions<TQueryEnabled, TPaginationEnabled> & ({
|
|
368
|
+
type ZodSearchSchemaOptions<TShape extends z$1.ZodRawShape = never, TWhereSchema extends z$1.ZodType<Record<string, unknown>> = never, TQueryEnabled extends boolean = true, TPaginationEnabled extends boolean = true> = ZodSearchFeatureOptions<TQueryEnabled, TPaginationEnabled> & ({
|
|
369
369
|
/**
|
|
370
370
|
* Object schema whose fields become optional filters inside `where`.
|
|
371
371
|
* The factory requires one defined value whenever `where` is present.
|
|
372
372
|
*/
|
|
373
|
-
filters: z.ZodObject<TShape>;
|
|
373
|
+
filters: z$1.ZodObject<TShape>;
|
|
374
374
|
/** Prevents combining automatic filters with a prepared schema. */
|
|
375
375
|
whereSchema?: never;
|
|
376
376
|
} | {
|
|
@@ -470,7 +470,7 @@ type AtLeastOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? Simp
|
|
|
470
470
|
* zQuery(zodAtLeastOne(userSelectSchema)) // result: UserSelect ✓
|
|
471
471
|
* ```
|
|
472
472
|
*/
|
|
473
|
-
declare const zodAtLeastOne: <T extends ZodObject<ZodRawShape>>(schema: T) => z
|
|
473
|
+
declare const zodAtLeastOne: <T extends ZodObject<ZodRawShape>>(schema: T) => z.ZodPipe<T, z.ZodTransform<Awaited<AtLeastOne<z.core.output<T>>>, z.core.output<T>>>;
|
|
474
474
|
|
|
475
475
|
declare const parseQueryValue: (value: unknown) => unknown;
|
|
476
476
|
/**
|
|
@@ -493,8 +493,8 @@ declare const parseQueryValue: (value: unknown) => unknown;
|
|
|
493
493
|
declare const asQuery: <T extends z.ZodTypeAny>(schema: T) => z.ZodPreprocess<T>;
|
|
494
494
|
|
|
495
495
|
/**
|
|
496
|
-
* Checks
|
|
497
|
-
*
|
|
496
|
+
* Checks whether a value is a plain record backed by `Object.prototype`.
|
|
497
|
+
* Arrays, null, dates, collections, and custom class instances are rejected.
|
|
498
498
|
*/
|
|
499
499
|
declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
500
500
|
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,7 @@ async function measureExecutionTime(execution) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// src/zod-bulk/zod-bulk.schemas.ts
|
|
168
|
-
import z from "zod";
|
|
168
|
+
import { z } from "zod";
|
|
169
169
|
var DEFAULT_ERROR_MESSAGE = "Selection identifiers must be provided.";
|
|
170
170
|
var zodBulkSelectionSchema = ({ identifierSchema }) => {
|
|
171
171
|
const identifiersSchema = z.array(identifierSchema).refine((identifiers) => new Set(identifiers).size === identifiers.length, {
|
|
@@ -227,7 +227,7 @@ var ZodJWTService = class {
|
|
|
227
227
|
};
|
|
228
228
|
|
|
229
229
|
// src/zod-search/zod-search.pagination.schemas.ts
|
|
230
|
-
import z2 from "zod";
|
|
230
|
+
import { z as z2 } from "zod";
|
|
231
231
|
var zodPaginationSchema = z2.object({
|
|
232
232
|
/**
|
|
233
233
|
* Zero-based number of records skipped before collecting a result page.
|
|
@@ -243,7 +243,7 @@ var zodPaginationSchema = z2.object({
|
|
|
243
243
|
var zodPaginationShape = zodPaginationSchema.shape;
|
|
244
244
|
|
|
245
245
|
// src/zod-search/zod-search.schemas.ts
|
|
246
|
-
import z3 from "zod";
|
|
246
|
+
import { z as z3 } from "zod";
|
|
247
247
|
|
|
248
248
|
// src/zod-validation/zod-validation.refiners.ts
|
|
249
249
|
var DEFAULT_ERROR_MESSAGE2 = "Invalid input. At least one field must be provided.";
|
|
@@ -267,11 +267,11 @@ var zodSearchSchema = (options) => {
|
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
// src/zod-validation/zod-validation.parsing.ts
|
|
270
|
-
import z4 from "zod";
|
|
270
|
+
import { z as z4 } from "zod";
|
|
271
271
|
|
|
272
272
|
// src/zod-validation/zod-validation.utilities.ts
|
|
273
273
|
var isPlainObject = (value) => {
|
|
274
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
274
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
275
275
|
};
|
|
276
276
|
|
|
277
277
|
// src/zod-validation/zod-validation.parsing.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalutskii/foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Typescript collection of most common utilities, schemas and functions among private projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsup",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
15
16
|
"lint": "eslint . --ext .ts --fix",
|
|
16
17
|
"format": "prettier --write .",
|
|
17
|
-
"test": "bun test"
|
|
18
|
-
"typecheck": "tsc --noEmit"
|
|
18
|
+
"test": "bun test"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|