@kalutskii/foundation 0.6.21 → 0.6.22

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +24 -24
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -58,29 +58,6 @@ type FetchResult<T> = {
58
58
  data: null;
59
59
  };
60
60
 
61
- type QueryPrimitive = string | number | boolean | bigint | Date;
62
- /**
63
- * Recursively transforms all fields of T to `string`, matching how query parameters are serialized.
64
- * Handles nested objects, arrays, and primitive values (including null and undefined as optional).
65
- */
66
- type AsQuery<T> = T extends null | undefined ? T : T extends QueryPrimitive ? string : T extends readonly (infer Item)[] ? AsQuery<Item>[] : T extends object ? {
67
- [Key in keyof T]: AsQuery<T[Key]>;
68
- } : string;
69
- /**
70
- * Utility type that ensures at least one property from the specified
71
- * keys of a given type T is required, while the rest remain optional.
72
- *
73
- * This is useful for scenarios where you want to enforce that at least one
74
- * of several optional (nullable) properties must be provided in an object.
75
- *
76
- * ```typescript
77
- * type Example = AtLeastOne<{ a?: string; b?: number; c?: boolean }>;
78
- * // Valid: { a: "hello" }, { b: 42 }, { c: true }, { a: "hello", b: 42 }
79
- * // Invalid: {}, { a: undefined, b: undefined, c: undefined }
80
- * ```
81
- */
82
- type AtLeastOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? Simplify$1<Required<Pick<T, Keys>> & Partial<Omit<T, Keys>>> : never;
83
-
84
61
  /**
85
62
  * Wraps c.json with a typed success payload / (or void data) & possible APIError response.
86
63
  * When no data is provided, responds with an empty object {} (purely for type consistency).
@@ -88,7 +65,7 @@ type AtLeastOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? Simp
88
65
  declare function respond<T extends object = Record<string, never>, S extends SuccessStatusCode = SuccessStatusCode>(c: Context, options: {
89
66
  status: S;
90
67
  data?: T;
91
- }): Response & TypedResponse<APISuccess<AsQuery<T>> | APIError, S, 'json'>;
68
+ }): Response & TypedResponse<APISuccess<T> | APIError, S, 'json'>;
92
69
 
93
70
  /**
94
71
  * Factory for creating successful API responses with serializable data.
@@ -318,6 +295,29 @@ declare const zodPaginationShape: {
318
295
  */
319
296
  type ZodPaginationOptions = z.infer<typeof zodPaginationSchema>;
320
297
 
298
+ type QueryPrimitive = string | number | boolean | bigint | Date;
299
+ /**
300
+ * Recursively transforms all fields of T to `string`, matching how query parameters are serialized.
301
+ * Handles nested objects, arrays, and primitive values (including null and undefined as optional).
302
+ */
303
+ type AsQuery<T> = T extends null | undefined ? T : T extends QueryPrimitive ? string : T extends readonly (infer Item)[] ? AsQuery<Item>[] : T extends object ? {
304
+ [Key in keyof T]: AsQuery<T[Key]>;
305
+ } : string;
306
+ /**
307
+ * Utility type that ensures at least one property from the specified
308
+ * keys of a given type T is required, while the rest remain optional.
309
+ *
310
+ * This is useful for scenarios where you want to enforce that at least one
311
+ * of several optional (nullable) properties must be provided in an object.
312
+ *
313
+ * ```typescript
314
+ * type Example = AtLeastOne<{ a?: string; b?: number; c?: boolean }>;
315
+ * // Valid: { a: "hello" }, { b: 42 }, { c: true }, { a: "hello", b: 42 }
316
+ * // Invalid: {}, { a: undefined, b: undefined, c: undefined }
317
+ * ```
318
+ */
319
+ type AtLeastOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? Simplify$1<Required<Pick<T, Keys>> & Partial<Omit<T, Keys>>> : never;
320
+
321
321
  /**
322
322
  * Wraps a partial Zod object schema with:
323
323
  * 1. A runtime check ensuring at least one field is non-undefined.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalutskii/foundation",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
4
4
  "description": "Typescript collection of most common utilities, schemas and functions among private projects.",
5
5
  "type": "module",
6
6
  "repository": {