@appweaver/cli 1.0.16 → 1.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appweaver/cli",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Appweaver - the backend framework for AI-first development (@cli)",
5
5
  "author": "Luka Matosevic",
6
6
  "license": "MIT",
package/skill/SKILL.md CHANGED
@@ -212,7 +212,8 @@ export default createModel({
212
212
  files: {
213
213
  photo: {
214
214
  mimeType: 'image/*',
215
- maxSize: '2 MB'
215
+ maxSize: '2 MB',
216
+ image: { quality: 80, maxWidth: 1200 }
216
217
  }
217
218
  },
218
219
  create: {
@@ -333,7 +334,8 @@ export default createAuthModel({
333
334
  files: {
334
335
  avatar: {
335
336
  mimeType: 'image/(png|jpeg|gif)',
336
- maxSize: '2 MB'
337
+ maxSize: '2 MB',
338
+ image: { quality: 80, maxHeight: 800, fit: 'inside' }
337
339
  }
338
340
  }
339
341
  });
@@ -434,7 +434,13 @@ const config = {
434
434
  photo: {
435
435
  mimeType: 'image/*',
436
436
  namePattern: 'photos/{userId}-{name}-{hash}.{extension}',
437
- maxSize: '2 MB'
437
+ maxSize: '2 MB',
438
+ image: {
439
+ quality: 80,
440
+ maxWidth: 1200,
441
+ maxHeight: 1200,
442
+ fit: 'inside'
443
+ }
438
444
  },
439
445
  documents: {
440
446
  mimeType: 'application/pdf',
@@ -454,6 +460,7 @@ const config = {
454
460
  | `maxCount` | number | Maximum number of files (for array fields). |
455
461
  | `output` | RelationOutput | When to include file info in output. |
456
462
  | `onResourceDeleted` | `'delete'` \| `'keep'` | When the owning resource is deleted. `'delete'` (default) removes files from storage, `'keep'` leaves them. |
463
+ | `image` | ImageConfig | Image compression and resize settings. Only applies to image MIME types (excluding GIF). |
457
464
 
458
465
  #### Available namePattern variables
459
466
 
@@ -483,6 +490,49 @@ Default pattern is: `{name}-{hash}.{extension}`.
483
490
  | `uuid` | string | Generated random UUID. |
484
491
  | `hash` | string | Generated random hash (32 bytes). |
485
492
 
493
+ #### Image compression
494
+
495
+ Configure automatic image compression and resizing by adding the `image` property to a file field. Processing only
496
+ applies to supported image MIME types: `image/jpeg`, `image/png`, `image/webp`, `image/avif`, `image/tiff`. GIF files
497
+ are passed through unchanged.
498
+
499
+ | Property | Type | Description |
500
+ |-------------|----------|----------------------------------------------------------------------------------------------------------------|
501
+ | `quality` | number | Compression quality (1-100). Applies to JPEG, PNG, WebP, AVIF, and TIFF. |
502
+ | `width` | number | Exact resize width in pixels. |
503
+ | `height` | number | Exact resize height in pixels. |
504
+ | `maxWidth` | number | Maximum width. Only downscales if the image exceeds this dimension. |
505
+ | `maxHeight` | number | Maximum height. Only downscales if the image exceeds this dimension. |
506
+ | `fit` | ImageFit | How the image fits the target dimensions: `'inside'` (default), `'contain'`, `'cover'`, `'fill'`, `'outside'`. |
507
+
508
+ `width`/`height` take precedence over `maxWidth`/`maxHeight`. When using `maxWidth`/`maxHeight`, images smaller than
509
+ the specified dimensions are not enlarged.
510
+
511
+ ```ts
512
+ // Compress and limit dimensions
513
+ const config = {
514
+ files: {
515
+ avatar: {
516
+ mimeType: 'image/*',
517
+ maxSize: '5 MB',
518
+ image: { quality: 80, maxWidth: 800, maxHeight: 800 }
519
+ }
520
+ }
521
+ };
522
+ ```
523
+
524
+ ```ts
525
+ // Exact resize for thumbnails
526
+ const config = {
527
+ files: {
528
+ thumbnail: {
529
+ mimeType: 'image/jpeg',
530
+ image: { quality: 70, width: 200, height: 200, fit: 'inside' }
531
+ }
532
+ }
533
+ }
534
+ ```
535
+
486
536
  ### Virtual fields
487
537
 
488
538
  Virtual fields are computed values not stored in the database. They can appear in input DTOs (to receive data) and/or