@kalutskii/foundation 0.7.17 → 0.7.19

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 CHANGED
@@ -856,13 +856,13 @@ type ZodSearchShape<TShape extends z.ZodRawShape, TWhereSchema extends z.ZodType
856
856
  */
857
857
  declare const zodSearchSchema: <const TShape extends z.ZodRawShape = never, const TWhereSchema extends z.ZodType<Record<string, unknown>> = never, const TQueryEnabled extends boolean = true, const TPaginationEnabled extends boolean = true>(options: ZodSearchSchemaOptions<TShape, TWhereSchema, TQueryEnabled, TPaginationEnabled>) => z.ZodObject<ZodSearchShape<TShape, TWhereSchema, TQueryEnabled, TPaginationEnabled> extends infer T ? { -readonly [P in keyof T]: T[P]; } : never, z.core.$strict>;
858
858
 
859
- type QueryPrimitive = string | number | boolean | bigint | Date;
859
+ type StringifiablePayloadValue = string | number | boolean | bigint | Date;
860
860
  /**
861
- * Recursively transforms all fields of T to `string`, matching how query parameters are serialized.
862
- * Handles nested objects, arrays, and primitive values (including null and undefined as optional).
861
+ * Recursively transforms payload values to strings while preserving container structure.
862
+ * Nullable and omitted members remain unchanged for transport-layer omission handling.
863
863
  */
864
- type AsQuery<T> = T extends null | undefined ? T : T extends QueryPrimitive ? string : T extends readonly (infer Item)[] ? AsQuery<Item>[] : T extends object ? {
865
- [Key in keyof T]: AsQuery<T[Key]>;
864
+ type StringifiedPayload<TValue> = TValue extends null | undefined ? TValue : TValue extends StringifiablePayloadValue ? string : TValue extends readonly (infer TItem)[] ? StringifiedPayload<TItem>[] : TValue extends object ? {
865
+ [TKey in keyof TValue]: StringifiedPayload<TValue[TKey]>;
866
866
  } : string;
867
867
  /**
868
868
  * Utility type that ensures at least one property from the specified
@@ -908,14 +908,14 @@ declare const parseQueryValue: (value: unknown) => unknown;
908
908
  */
909
909
  declare const asQuery: <T extends z.ZodTypeAny>(schema: T) => z.ZodPreprocess<T>;
910
910
  /**
911
- * Recursively converts a domain payload into its string-based query representation.
912
- * Objects and arrays are copied while `null` and `undefined` retain their omission semantics.
911
+ * Recursively converts payload values to strings without changing container structure.
912
+ * Objects and arrays are copied while `null` and `undefined` retain omission semantics.
913
913
  *
914
914
  * @example
915
- * preprocessTransportPayload({ page: 2, enabled: true });
915
+ * stringifyPayloadValues({ page: 2, enabled: true });
916
916
  * // { page: '2', enabled: 'true' }
917
917
  */
918
- declare function preprocessTransportPayload<TValue>(value: TValue): AsQuery<TValue>;
918
+ declare function stringifyPayloadValues<TValue>(value: TValue): StringifiedPayload<TValue>;
919
919
 
920
920
  /**
921
921
  * Checks whether a value is a plain record backed by `Object.prototype`.
@@ -923,4 +923,4 @@ declare function preprocessTransportPayload<TValue>(value: TValue): AsQuery<TVal
923
923
  */
924
924
  declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
925
925
 
926
- export { type APIContractData, type APIContractError, type APIContractResult, type APIError, type APISuccess, type AsQuery, type AtLeastOne, DEFAULT_UPLOAD_MAX_FILE_SIZE, EXCEPTION_STATUS_CODES, type ExceptionStatusCode, type FetchResult, type FileFormat, type FileFormatConfig, type HonoFileRespondOptions, type HonoRespondOptions, type JWTServiceOptions, type JWTSignOptions, type LogLevel, type MeasuredExecution, type Payload, type PayloadSchema, REDACTED_LOG_VALUE, type ReplaceDotsWithUnderscores, type ReplaceHyphensWithUnderscores, SUCCESS_STATUS_CODES, type Simplify, type StringEnumRecord, type SuccessStatusCode, type UploadFilesValidationOptions, type UploadFilesValidationResult, type UploadPreset, type UploadValidationError, type ZodBulkExcludeSelection, type ZodBulkIncludeSelection, type ZodBulkSelection, ZodJWTService, type ZodPaginationOptions, type ZodSearchSchemaOptions, type ZodUploadFileSchemaOptions, asQuery, createStringEnumRecord, createUploadAccept, createZodSearchWhereSchema, defineUploadPreset, documentUploadPreset, failure, fetchAndThrow, fetchSafely, fileFormat, fileFormatsArray, fileFormatsConfig, fileFormatsRecord, fileRespond, formatTime, generateRandomString, getColoredHTTPStatus, getFileExtension, getFormattedDate, getFormattedTime, getUTCOffset, getZonedTime, httpStatusColors, imageTransparentUploadPreset, imageUploadPreset, isFileExtensionSupported, isFileFormatSupported, isFileMimeTypeSupported, isPlainObject, log, logLevel, logLevelColors, logLevelsArray, logLevelsRecord, loggingMiddleware, matchesMimeType, measureExecutionTime, normalizeFileExtension, onHandlerError, parseQueryValue, preprocessTransportPayload, redactSensitiveJSON, redactSensitiveSearchParams, respond, safeExecute, sensitiveLogKeyParts, sqlWhere, success, uploadValidationError, uploadValidationErrorsArray, uploadValidationErrorsRecord, validateUploadFile, validateUploadFiles, zodAtLeastOne, zodBulkSelectionSchema, zodPaginationSchema, zodPaginationShape, zodSearchQuerySchema, zodSearchSchema, zodUploadFileSchema };
926
+ export { type APIContractData, type APIContractError, type APIContractResult, type APIError, type APISuccess, type AtLeastOne, DEFAULT_UPLOAD_MAX_FILE_SIZE, EXCEPTION_STATUS_CODES, type ExceptionStatusCode, type FetchResult, type FileFormat, type FileFormatConfig, type HonoFileRespondOptions, type HonoRespondOptions, type JWTServiceOptions, type JWTSignOptions, type LogLevel, type MeasuredExecution, type Payload, type PayloadSchema, REDACTED_LOG_VALUE, type ReplaceDotsWithUnderscores, type ReplaceHyphensWithUnderscores, SUCCESS_STATUS_CODES, type Simplify, type StringEnumRecord, type StringifiedPayload, type SuccessStatusCode, type UploadFilesValidationOptions, type UploadFilesValidationResult, type UploadPreset, type UploadValidationError, type ZodBulkExcludeSelection, type ZodBulkIncludeSelection, type ZodBulkSelection, ZodJWTService, type ZodPaginationOptions, type ZodSearchSchemaOptions, type ZodUploadFileSchemaOptions, asQuery, createStringEnumRecord, createUploadAccept, createZodSearchWhereSchema, defineUploadPreset, documentUploadPreset, failure, fetchAndThrow, fetchSafely, fileFormat, fileFormatsArray, fileFormatsConfig, fileFormatsRecord, fileRespond, formatTime, generateRandomString, getColoredHTTPStatus, getFileExtension, getFormattedDate, getFormattedTime, getUTCOffset, getZonedTime, httpStatusColors, imageTransparentUploadPreset, imageUploadPreset, isFileExtensionSupported, isFileFormatSupported, isFileMimeTypeSupported, isPlainObject, log, logLevel, logLevelColors, logLevelsArray, logLevelsRecord, loggingMiddleware, matchesMimeType, measureExecutionTime, normalizeFileExtension, onHandlerError, parseQueryValue, redactSensitiveJSON, redactSensitiveSearchParams, respond, safeExecute, sensitiveLogKeyParts, sqlWhere, stringifyPayloadValues, success, uploadValidationError, uploadValidationErrorsArray, uploadValidationErrorsRecord, validateUploadFile, validateUploadFiles, zodAtLeastOne, zodBulkSelectionSchema, zodPaginationSchema, zodPaginationShape, zodSearchQuerySchema, zodSearchSchema, zodUploadFileSchema };
package/dist/index.js CHANGED
@@ -467,7 +467,7 @@ var zodPaginationSchema = z3.object({
467
467
  * Positive maximum number of records returned in a single result page.
468
468
  * String values are coerced to support validation of URL query input.
469
469
  */
470
- limit: z3.coerce.number().int().positive().default(10)
470
+ limit: z3.coerce.number().int().positive().max(256).default(10)
471
471
  });
472
472
  var zodPaginationShape = zodPaginationSchema.shape;
473
473
 
@@ -524,13 +524,13 @@ var parseQueryValue = (value) => {
524
524
  return value;
525
525
  };
526
526
  var asQuery = (schema) => z5.preprocess(parseQueryValue, schema);
527
- function preprocessTransportPayload(value) {
527
+ function stringifyPayloadValues(value) {
528
528
  if (Array.isArray(value)) {
529
- return value.map(preprocessTransportPayload);
529
+ return value.map(stringifyPayloadValues);
530
530
  }
531
531
  if (isPlainObject(value)) {
532
532
  const entries = Object.entries(value).map(([key, entryValue]) => {
533
- return [key, preprocessTransportPayload(entryValue)];
533
+ return [key, stringifyPayloadValues(entryValue)];
534
534
  });
535
535
  return Object.fromEntries(entries);
536
536
  }
@@ -584,13 +584,13 @@ export {
584
584
  normalizeFileExtension,
585
585
  onHandlerError,
586
586
  parseQueryValue,
587
- preprocessTransportPayload,
588
587
  redactSensitiveJSON,
589
588
  redactSensitiveSearchParams,
590
589
  respond,
591
590
  safeExecute,
592
591
  sensitiveLogKeyParts,
593
592
  sqlWhere,
593
+ stringifyPayloadValues,
594
594
  success,
595
595
  uploadValidationError,
596
596
  uploadValidationErrorsArray,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalutskii/foundation",
3
- "version": "0.7.17",
3
+ "version": "0.7.19",
4
4
  "description": "Typescript collection of most common utilities, schemas and functions among private projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",