@kalutskii/foundation 0.7.12 → 0.7.14

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
@@ -211,6 +211,11 @@ declare const fileFormatsConfig: {
211
211
  readonly mimeTypes: readonly ["image/jpeg"];
212
212
  readonly extensions: readonly [".jpg", ".jpeg"];
213
213
  };
214
+ readonly svg: {
215
+ readonly name: "SVG";
216
+ readonly mimeTypes: readonly ["image/svg+xml"];
217
+ readonly extensions: readonly [".svg"];
218
+ };
214
219
  readonly webp: {
215
220
  readonly name: "WEBP";
216
221
  readonly mimeTypes: readonly ["image/webp"];
@@ -243,7 +248,7 @@ declare const fileFormatsConfig: {
243
248
  };
244
249
  };
245
250
 
246
- declare const fileFormatsArray: readonly ["png", "jpg", "webp", "avif", "heic", "pdf", "rtf", "txt"];
251
+ declare const fileFormatsArray: readonly ["png", "jpg", "webp", "avif", "heic", "svg", "pdf", "rtf", "txt"];
247
252
  type FileFormat = (typeof fileFormatsArray)[number];
248
253
  declare const fileFormatsRecord: Readonly<{
249
254
  AVIF: "avif";
@@ -251,6 +256,7 @@ declare const fileFormatsRecord: Readonly<{
251
256
  PDF: "pdf";
252
257
  PNG: "png";
253
258
  RTF: "rtf";
259
+ SVG: "svg";
254
260
  TXT: "txt";
255
261
  WEBP: "webp";
256
262
  HEIC: "heic";
@@ -261,6 +267,7 @@ declare const fileFormat: Readonly<{
261
267
  PDF: "pdf";
262
268
  PNG: "png";
263
269
  RTF: "rtf";
270
+ SVG: "svg";
264
271
  TXT: "txt";
265
272
  WEBP: "webp";
266
273
  HEIC: "heic";
@@ -399,6 +406,16 @@ declare const imageUploadPreset: Readonly<{
399
406
  maxFilesCount?: number;
400
407
  extensionFallback?: boolean;
401
408
  }>;
409
+ /**
410
+ * Ready-to-use policy for every image format supporting transparency (alpha channel).
411
+ * Each image may occupy up to 20 MiB while collection capacity remains unrestricted.
412
+ */
413
+ declare const imageTransparentUploadPreset: Readonly<{
414
+ formats: readonly ["png", "webp", "svg"];
415
+ maxFileSize: number;
416
+ maxFilesCount?: number;
417
+ extensionFallback?: boolean;
418
+ }>;
402
419
  /**
403
420
  * Ready-to-use policy for every document format supported by the upload catalog.
404
421
  * Each document may occupy up to 20 MiB while collection capacity remains unrestricted.
@@ -889,4 +906,4 @@ declare const asQuery: <T extends z.ZodTypeAny>(schema: T) => z.ZodPreprocess<T>
889
906
  */
890
907
  declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
891
908
 
892
- 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, 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, imageUploadPreset, isFileExtensionSupported, isFileFormatSupported, isFileMimeTypeSupported, isPlainObject, log, logLevel, logLevelColors, logLevelsArray, logLevelsRecord, loggingMiddleware, matchesMimeType, measureExecutionTime, normalizeFileExtension, onHandlerError, parseQueryValue, redactSensitiveJSON, redactSensitiveSearchParams, respond, safeExecute, sensitiveLogKeyParts, sqlWhere, success, uploadValidationError, uploadValidationErrorsArray, uploadValidationErrorsRecord, validateUploadFile, validateUploadFiles, zodAtLeastOne, zodBulkSelectionSchema, zodPaginationSchema, zodPaginationShape, zodSearchQuerySchema, zodSearchSchema, zodUploadFileSchema };
909
+ 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, 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, redactSensitiveJSON, redactSensitiveSearchParams, respond, safeExecute, sensitiveLogKeyParts, sqlWhere, success, uploadValidationError, uploadValidationErrorsArray, uploadValidationErrorsRecord, validateUploadFile, validateUploadFiles, zodAtLeastOne, zodBulkSelectionSchema, zodPaginationSchema, zodPaginationShape, zodSearchQuerySchema, zodSearchSchema, zodUploadFileSchema };
package/dist/index.js CHANGED
@@ -252,7 +252,7 @@ var loggingMiddleware = async (c, next) => {
252
252
 
253
253
  // src/upload/upload.enums.ts
254
254
  var fileFormatsArray = [
255
- ...["png", "jpg", "webp", "avif", "heic"],
255
+ ...["png", "jpg", "webp", "avif", "heic", "svg"],
256
256
  // Image formats.
257
257
  ...["pdf", "rtf", "txt"]
258
258
  // Text and document formats.
@@ -273,6 +273,7 @@ var fileFormatsConfig = {
273
273
  // Image formats.
274
274
  [fileFormatsRecord.PNG]: { name: "PNG", mimeTypes: ["image/png"], extensions: [".png"] },
275
275
  [fileFormatsRecord.JPG]: { name: "JPG", mimeTypes: ["image/jpeg"], extensions: [".jpg", ".jpeg"] },
276
+ [fileFormatsRecord.SVG]: { name: "SVG", mimeTypes: ["image/svg+xml"], extensions: [".svg"] },
276
277
  [fileFormatsRecord.WEBP]: { name: "WEBP", mimeTypes: ["image/webp"], extensions: [".webp"] },
277
278
  [fileFormatsRecord.AVIF]: { name: "AVIF", mimeTypes: ["image/avif"], extensions: [".avif"] },
278
279
  [fileFormatsRecord.HEIC]: { name: "HEIC", mimeTypes: ["image/heic", "image/heif"], extensions: [".heic", ".heif"] },
@@ -293,6 +294,10 @@ var imageUploadPreset = defineUploadPreset({
293
294
  formats: [fileFormat.PNG, fileFormat.JPG, fileFormat.WEBP, fileFormat.AVIF, fileFormat.HEIC],
294
295
  maxFileSize: DEFAULT_UPLOAD_MAX_FILE_SIZE
295
296
  });
297
+ var imageTransparentUploadPreset = defineUploadPreset({
298
+ formats: [fileFormat.PNG, fileFormat.WEBP, fileFormat.SVG],
299
+ maxFileSize: DEFAULT_UPLOAD_MAX_FILE_SIZE
300
+ });
296
301
  var documentUploadPreset = defineUploadPreset({
297
302
  formats: [fileFormat.PDF, fileFormat.RTF, fileFormat.TXT],
298
303
  maxFileSize: DEFAULT_UPLOAD_MAX_FILE_SIZE
@@ -548,6 +553,7 @@ export {
548
553
  getUTCOffset,
549
554
  getZonedTime,
550
555
  httpStatusColors,
556
+ imageTransparentUploadPreset,
551
557
  imageUploadPreset,
552
558
  isFileExtensionSupported,
553
559
  isFileFormatSupported,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kalutskii/foundation",
3
- "version": "0.7.12",
3
+ "version": "0.7.14",
4
4
  "description": "Typescript collection of most common utilities, schemas and functions among private projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",