@giveitsmaller/contracts 0.1.2 → 0.2.3

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 (31) hide show
  1. package/asyncapi/events.yaml +2012 -0
  2. package/dist/asyncapi/OperationType.d.ts +4 -0
  3. package/dist/asyncapi/OperationType.js +4 -0
  4. package/dist/openapi/models/JobType.d.ts +8 -1
  5. package/dist/openapi/models/JobType.js +8 -1
  6. package/dist/openapi/models/MultipartCompleteRequest.d.ts +1 -1
  7. package/dist/openapi/models/MultipartCompleteRequest.js +3 -3
  8. package/dist/openapi/models/MultipartCompleteResponse.d.ts +50 -0
  9. package/dist/openapi/models/MultipartCompleteResponse.js +53 -0
  10. package/dist/openapi/models/MultipartCompleteSuccessEnvelope.d.ts +46 -0
  11. package/dist/openapi/models/MultipartCompleteSuccessEnvelope.js +54 -0
  12. package/dist/openapi/models/MultipartInitiateResponse.d.ts +1 -1
  13. package/dist/openapi/models/MultipartInitiateResponse.js +3 -3
  14. package/dist/openapi/models/OperationInputModel.d.ts +3 -1
  15. package/dist/openapi/models/OperationInputModel.js +3 -1
  16. package/dist/openapi/models/OperationType.d.ts +24 -2
  17. package/dist/openapi/models/OperationType.js +24 -2
  18. package/dist/openapi/models/index.d.ts +2 -0
  19. package/dist/openapi/models/index.js +2 -0
  20. package/dist/operations/index.d.ts +1 -0
  21. package/dist/operations/index.js +1 -0
  22. package/dist/operations/watermark.d.ts +28 -0
  23. package/dist/operations/watermark.js +19 -0
  24. package/openapi/api.yaml +2533 -0
  25. package/operations/schemas/archive.yaml +22 -0
  26. package/operations/schemas/compress.yaml +280 -0
  27. package/operations/schemas/convert.yaml +104 -0
  28. package/operations/schemas/merge.yaml +211 -0
  29. package/operations/schemas/thumbnail.yaml +120 -0
  30. package/operations/schemas/watermark.yaml +87 -0
  31. package/package.json +14 -3
@@ -0,0 +1,22 @@
1
+ schema_version: "1.0.0"
2
+
3
+ operation:
4
+ type: archive
5
+ description: "Bundle multiple files into a single archive"
6
+ default: false
7
+ input_model: multi
8
+ min_inputs: 2
9
+ max_inputs: 50
10
+ accepts_mixed_types: true
11
+
12
+ options:
13
+ format:
14
+ type: enum
15
+ values: [zip, tar.gz]
16
+ default: zip
17
+ description: "Archive format"
18
+ folder_structure:
19
+ type: enum
20
+ values: [flat, by_job]
21
+ default: flat
22
+ description: "flat = all files in root, by_job = subfolder per source job"
@@ -0,0 +1,280 @@
1
+ schema_version: "1.0.0"
2
+
3
+ operation:
4
+ type: compress
5
+ description: "Reduce file size while maintaining acceptable quality"
6
+ default: true
7
+ input_model: single
8
+
9
+ mime_groups:
10
+ image:
11
+ mimes:
12
+ - image/jpeg
13
+ - image/png
14
+ - image/gif
15
+ - image/webp
16
+ - image/svg+xml
17
+ - image/tiff
18
+ - image/bmp
19
+ - image/x-icon
20
+ - image/avif
21
+ - image/heic
22
+ options:
23
+ mode:
24
+ type: enum
25
+ values: [lossy, lossless, auto]
26
+ default: lossy
27
+ description: "Compression algorithm. lossy = smaller file, lossless = no quality loss, auto = best for format"
28
+ quality:
29
+ type: integer
30
+ min: 1
31
+ max: 100
32
+ default: 80
33
+ depends_on: { mode: lossy }
34
+ description: "Compression quality (1 = smallest file, 100 = best quality). Only applies to lossy mode."
35
+ width:
36
+ type: integer
37
+ min: 1
38
+ max: 16384
39
+ description: "Maximum output width in pixels"
40
+ height:
41
+ type: integer
42
+ min: 1
43
+ max: 16384
44
+ description: "Maximum output height in pixels"
45
+ fit:
46
+ type: enum
47
+ values: [max, crop, scale]
48
+ default: max
49
+ depends_on: { width: set, height: set, logic: or }
50
+ description: "Resize mode. max = fit within bounds, crop = fill and trim, scale = force exact dimensions. Only applies when width or height is set."
51
+ metadata:
52
+ type: enum
53
+ values: [all, none, copyright, sensitive]
54
+ default: all
55
+ description: >-
56
+ Metadata handling. all = strip everything (smallest file), none = keep all EXIF/IPTC/XMP,
57
+ copyright = keep only copyright/author fields, sensitive = keep EXIF but strip GPS/location (GDPR-friendly)
58
+ icc_profile:
59
+ type: enum
60
+ values: [preserve, strip, srgb]
61
+ default: preserve
62
+ description: "ICC color profile handling. preserve = keep original, strip = remove, srgb = convert to sRGB"
63
+ auto_orient:
64
+ type: boolean
65
+ default: true
66
+ description: "Auto-rotate based on EXIF orientation"
67
+ progressive:
68
+ type: boolean
69
+ default: true
70
+ description: "Enable progressive rendering (JPEG only). Renders low-quality preview first, then refines."
71
+ output_format:
72
+ type: enum
73
+ values: [original, auto, smallest, jpeg, png, webp, avif]
74
+ default: original
75
+ description: >-
76
+ Output format. original = keep input format, auto = best for browser support
77
+ (AVIF > WebP > JPEG based on Accept header hint), smallest = try all supported formats and return the smallest file
78
+
79
+ audio:
80
+ mimes:
81
+ - audio/mpeg
82
+ - audio/aac
83
+ - audio/ogg
84
+ - audio/flac
85
+ - audio/wav
86
+ - audio/x-m4a
87
+ options:
88
+ bitrate:
89
+ type: enum
90
+ value_type: integer
91
+ values: [64, 96, 128, 192, 256, 320]
92
+ default: 128
93
+ description: "Output bitrate in kbps"
94
+ channels:
95
+ type: integer
96
+ min: 1
97
+ max: 2
98
+ description: "Number of audio channels (1 = mono, 2 = stereo)"
99
+ sample_rate:
100
+ type: enum
101
+ value_type: integer
102
+ values: [22050, 44100, 48000]
103
+ description: "Audio sample rate in Hz"
104
+ normalize:
105
+ type: boolean
106
+ default: false
107
+ description: "Apply loudness normalization (EBU R128 / -14 LUFS target)"
108
+ trim_start:
109
+ type: float
110
+ min: 0
111
+ description: "Trim from beginning in seconds"
112
+ trim_end:
113
+ type: float
114
+ min: 0
115
+ description: "Trim from end in seconds"
116
+
117
+ video:
118
+ mimes:
119
+ - video/mp4
120
+ - video/webm
121
+ - video/ogg
122
+ options:
123
+ codec:
124
+ type: enum
125
+ values: [h264, h265, vp9, av1]
126
+ default: h264
127
+ description: "Video codec. h264 = widest compatibility, h265/av1 = better compression but slower"
128
+ encoding_mode:
129
+ type: enum
130
+ values: [crf, target_size]
131
+ default: crf
132
+ description: "crf = constant quality (variable file size), target_size = constrained file size (two-pass)"
133
+ crf:
134
+ type: integer
135
+ min: 0
136
+ max: 51
137
+ default: 23
138
+ depends_on: { encoding_mode: crf }
139
+ description: "Constant Rate Factor (0 = lossless, 51 = worst, 23 = visually good). Only applies to CRF mode."
140
+ target_size_bytes:
141
+ type: integer
142
+ min: 1048576
143
+ depends_on: { encoding_mode: target_size }
144
+ description: "Target output file size in bytes (min 1MB). Two-pass encoding to meet this target."
145
+ preset:
146
+ type: enum
147
+ values: [ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow]
148
+ default: medium
149
+ description: "Encoding speed vs compression ratio trade-off"
150
+ width:
151
+ type: integer
152
+ min: 1
153
+ max: 7680
154
+ description: "Output width in pixels"
155
+ height:
156
+ type: integer
157
+ min: 1
158
+ max: 4320
159
+ description: "Output height in pixels"
160
+ fit:
161
+ type: enum
162
+ values: [max, crop, scale, pad]
163
+ default: max
164
+ depends_on: { width: set, height: set, logic: or }
165
+ description: "Resize mode. max = fit within bounds (preserves ratio), crop/scale/pad = exact dimensions. Only applies when width or height is set."
166
+ fps:
167
+ type: float
168
+ min: 1
169
+ max: 120
170
+ description: "Output frame rate"
171
+ faststart:
172
+ type: boolean
173
+ default: true
174
+ description: "Move MP4 moov atom to start for progressive web playback (MP4 only)"
175
+ audio_codec:
176
+ type: enum
177
+ values: [aac, opus, vorbis, copy]
178
+ default: aac
179
+ description: "Audio codec. aac = widest compatibility, opus = best quality/size, copy = passthrough"
180
+ audio_bitrate:
181
+ type: enum
182
+ value_type: integer
183
+ values: [64, 96, 128, 192, 256, 320]
184
+ default: 128
185
+ description: "Audio track bitrate in kbps"
186
+ trim_start:
187
+ type: float
188
+ min: 0
189
+ description: "Trim from beginning in seconds"
190
+ trim_end:
191
+ type: float
192
+ min: 0
193
+ description: "Trim from end in seconds"
194
+
195
+ document_pdf:
196
+ mimes:
197
+ - application/pdf
198
+ options:
199
+ profile:
200
+ type: enum
201
+ values: [web, print, archive, max]
202
+ default: web
203
+ description: "Optimization profile. web = aggressive (downsample images, strip metadata), print = preserve quality, archive = PDF/A compliance, max = smallest file"
204
+ colorspace:
205
+ type: enum
206
+ values: [unchanged, rgb, cmyk, grayscale]
207
+ default: unchanged
208
+ description: "Output color space"
209
+ pages:
210
+ type: string
211
+ description: "Page selection (e.g. '1-5,8,10-12'). Omit to keep all pages."
212
+ flatten_forms:
213
+ type: boolean
214
+ default: false
215
+ description: "Flatten interactive form fields into static content"
216
+
217
+ document_office:
218
+ mimes:
219
+ - application/vnd.openxmlformats-officedocument.wordprocessingml.document
220
+ - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
221
+ - application/vnd.openxmlformats-officedocument.presentationml.presentation
222
+ options:
223
+ image_quality:
224
+ type: integer
225
+ min: 1
226
+ max: 100
227
+ default: 80
228
+ description: "Recompress embedded images at this quality level (1 = smallest, 100 = best)"
229
+ strip_macros:
230
+ type: boolean
231
+ default: true
232
+ description: "Remove VBA macros and ActiveX controls"
233
+ strip_hidden_data:
234
+ type: boolean
235
+ default: true
236
+ description: "Remove revisions, comments, personal info, hidden rows/columns, and speaker notes"
237
+ strip_unused_fonts:
238
+ type: boolean
239
+ default: false
240
+ description: "Remove embedded fonts not referenced in the document. Risk: may affect rendering on systems without the font installed"
241
+
242
+ document_odf:
243
+ mimes:
244
+ - application/vnd.oasis.opendocument.text
245
+ - application/vnd.oasis.opendocument.spreadsheet
246
+ - application/vnd.oasis.opendocument.presentation
247
+ options:
248
+ image_quality:
249
+ type: integer
250
+ min: 1
251
+ max: 100
252
+ default: 80
253
+ description: "Recompress embedded images at this quality level"
254
+ strip_metadata:
255
+ type: boolean
256
+ default: true
257
+ description: "Remove document metadata (author, revision history, comments)"
258
+ strip_unused_styles:
259
+ type: boolean
260
+ default: false
261
+ description: "Remove style definitions not referenced in document content"
262
+
263
+ document_epub:
264
+ mimes:
265
+ - application/epub+zip
266
+ options:
267
+ image_quality:
268
+ type: integer
269
+ min: 1
270
+ max: 100
271
+ default: 80
272
+ description: "Recompress embedded images at this quality level"
273
+ font_subsetting:
274
+ type: boolean
275
+ default: true
276
+ description: "Subset embedded fonts to only include glyphs used in the document. Significant size reduction for books with large font files"
277
+ strip_unused_css:
278
+ type: boolean
279
+ default: false
280
+ description: "Remove CSS rules not referenced by any content. Risk: may affect rendering in some readers"
@@ -0,0 +1,104 @@
1
+ schema_version: "1.0.0"
2
+
3
+ operation:
4
+ type: convert
5
+ description: "Convert file to a different format"
6
+ default: false
7
+ input_model: single
8
+
9
+ mime_groups:
10
+ image:
11
+ mimes:
12
+ - image/jpeg
13
+ - image/png
14
+ - image/gif
15
+ - image/webp
16
+ - image/svg+xml
17
+ - image/tiff
18
+ - image/bmp
19
+ - image/x-icon
20
+ - image/avif
21
+ - image/heic
22
+ options:
23
+ output_format:
24
+ type: enum
25
+ values: [jpeg, png, webp, avif, gif, tiff]
26
+ required: true
27
+ description: "Target format"
28
+ quality:
29
+ type: integer
30
+ min: 1
31
+ max: 100
32
+ default: 85
33
+ depends_on: { output_format: [jpeg, webp, avif] }
34
+ description: "Output quality for lossy formats"
35
+ background:
36
+ type: string
37
+ depends_on: { output_format: jpeg }
38
+ description: "Background colour (hex, e.g. '#ffffff') for transparent images converted to JPEG"
39
+
40
+ video:
41
+ mimes:
42
+ - video/mp4
43
+ - video/webm
44
+ - video/ogg
45
+ options:
46
+ output_format:
47
+ type: enum
48
+ values: [mp4, webm, ogg, gif]
49
+ required: true
50
+ description: "Target format"
51
+ codec:
52
+ type: enum
53
+ values: [h264, h265, vp9, av1]
54
+ description: "Video codec for target format. Defaults to format's standard codec."
55
+ quality:
56
+ type: integer
57
+ min: 0
58
+ max: 51
59
+ default: 23
60
+ description: "CRF value (0 = lossless, 51 = worst)"
61
+
62
+ audio:
63
+ mimes:
64
+ - audio/mpeg
65
+ - audio/aac
66
+ - audio/ogg
67
+ - audio/flac
68
+ - audio/wav
69
+ - audio/x-m4a
70
+ options:
71
+ output_format:
72
+ type: enum
73
+ values: [mp3, aac, ogg, flac, wav]
74
+ required: true
75
+ description: "Target format"
76
+ bitrate:
77
+ type: enum
78
+ value_type: integer
79
+ values: [64, 96, 128, 192, 256, 320]
80
+ default: 128
81
+ depends_on: { output_format: [mp3, aac, ogg] }
82
+ description: "Output bitrate in kbps (lossy formats only)"
83
+
84
+ # Only PDF conversion is supported. Office/ODF/EPUB conversion would require
85
+ # LibreOffice which is not available in the document Lambda.
86
+ document_pdf:
87
+ mimes:
88
+ - application/pdf
89
+ options:
90
+ output_format:
91
+ type: enum
92
+ values: [png, jpeg]
93
+ required: true
94
+ description: "Target image format (renders PDF pages as images)"
95
+ pages:
96
+ type: string
97
+ default: "1"
98
+ description: "Page selection (e.g. '1-5,8'). Each page produces a separate output file."
99
+ dpi:
100
+ type: integer
101
+ min: 72
102
+ max: 600
103
+ default: 150
104
+ description: "Render resolution in DPI"
@@ -0,0 +1,211 @@
1
+ schema_version: "1.0.0"
2
+
3
+ operation:
4
+ type: merge
5
+ description: "Combine multiple files into one"
6
+ default: false
7
+ input_model: multi
8
+ min_inputs: 2
9
+ max_inputs: 10
10
+ # All merge operations route to the single `ops-merge` Lambda via
11
+ # `operation_type=merge` on the `operations` SNS topic. The
12
+ # `output_type` field below is read by the merge Lambda to decide
13
+ # the internal encoding path (collage/grid, animated GIF, video
14
+ # slideshow/concat, audio concat, PDF concat), not to influence SNS
15
+ # routing. The API publisher additionally sets `media_group` as an
16
+ # informational SNS attribute on non-archive operations, but it is
17
+ # not used as a routing filter.
18
+
19
+ mime_groups:
20
+ image:
21
+ mimes:
22
+ - image/jpeg
23
+ - image/png
24
+ - image/webp
25
+ - image/gif
26
+ - image/tiff
27
+ - image/bmp
28
+ options:
29
+ output_type:
30
+ type: enum
31
+ values: [image, gif, video]
32
+ default: image
33
+ description: "Result format: static image (collage/grid), animated GIF, or slideshow video"
34
+ # --- Options for output_type: image ---
35
+ layout:
36
+ type: enum
37
+ values: [grid, horizontal, vertical]
38
+ default: grid
39
+ depends_on: { output_type: image }
40
+ description: "How to arrange images in the collage"
41
+ columns:
42
+ type: integer
43
+ min: 1
44
+ max: 10
45
+ depends_on: { output_type: image }
46
+ description: "Number of columns in grid layout. Omit for auto (square-ish grid based on input count)."
47
+ resize_mode:
48
+ type: enum
49
+ values: [fit, fill, none]
50
+ default: fit
51
+ depends_on: { output_type: image }
52
+ description: "How to handle images of different sizes"
53
+ spacing:
54
+ type: integer
55
+ min: 0
56
+ max: 100
57
+ default: 0
58
+ depends_on: { output_type: image }
59
+ description: "Pixel spacing between images"
60
+ background:
61
+ type: string
62
+ default: "transparent"
63
+ depends_on: { output_type: image }
64
+ description: "Background color for spacing/padding (CSS color or 'transparent')"
65
+ image_format:
66
+ type: enum
67
+ values: [jpeg, png, webp]
68
+ default: png
69
+ depends_on: { output_type: image }
70
+ description: "Output image format for the collage"
71
+ # --- Options for output_type: gif ---
72
+ delay:
73
+ type: integer
74
+ min: 10
75
+ max: 5000
76
+ default: 500
77
+ depends_on: { output_type: gif }
78
+ description: "Milliseconds between frames"
79
+ loop_count:
80
+ type: integer
81
+ min: 0
82
+ max: 100
83
+ default: 0
84
+ depends_on: { output_type: gif }
85
+ description: "Number of loops (0 = infinite)"
86
+ # --- Options for output_type: video ---
87
+ duration_per_image:
88
+ type: float
89
+ min: 0.5
90
+ max: 30.0
91
+ default: 3.0
92
+ depends_on: { output_type: video }
93
+ description: "Seconds each image is displayed"
94
+ transition:
95
+ type: enum
96
+ values: [none, fade, slide]
97
+ default: none
98
+ depends_on: { output_type: video }
99
+ description: "Transition effect between images"
100
+ transition_duration:
101
+ type: float
102
+ min: 0.1
103
+ max: 5.0
104
+ default: 0.5
105
+ depends_on: { output_type: video }
106
+ description: "Duration of transition effect in seconds"
107
+ fps:
108
+ type: integer
109
+ min: 1
110
+ max: 60
111
+ default: 30
112
+ depends_on: { output_type: video }
113
+ description: "Output frame rate"
114
+ video_format:
115
+ type: enum
116
+ values: [mp4, webm]
117
+ default: mp4
118
+ depends_on: { output_type: video }
119
+ description: "Output video container format"
120
+
121
+ video:
122
+ mimes:
123
+ - video/mp4
124
+ - video/webm
125
+ options:
126
+ transition:
127
+ type: enum
128
+ values: [none, crossfade]
129
+ default: none
130
+ description: "Default transition between clips"
131
+ crossfade_duration:
132
+ type: float
133
+ min: 0.1
134
+ max: 5.0
135
+ default: 1.0
136
+ depends_on: { transition: crossfade }
137
+ description: "Crossfade duration in seconds"
138
+ normalize_audio:
139
+ type: boolean
140
+ default: true
141
+ description: "Normalize audio levels across all clips"
142
+ per_input_options:
143
+ transition:
144
+ type: enum
145
+ values: [none, crossfade]
146
+ description: "Override transition for the join point preceding this input"
147
+ crossfade_duration:
148
+ type: float
149
+ min: 0.1
150
+ max: 5.0
151
+ depends_on: { transition: crossfade }
152
+ description: "Override crossfade duration for this join point"
153
+
154
+ audio:
155
+ mimes:
156
+ - audio/mpeg
157
+ - audio/aac
158
+ - audio/wav
159
+ - audio/ogg
160
+ - audio/flac
161
+ options:
162
+ transition:
163
+ type: enum
164
+ values: [none, crossfade]
165
+ default: none
166
+ description: "Default transition between clips"
167
+ crossfade_duration:
168
+ type: float
169
+ min: 0
170
+ max: 10.0
171
+ default: 0
172
+ depends_on: { transition: crossfade }
173
+ description: "Crossfade duration in seconds"
174
+ gap_duration:
175
+ type: float
176
+ min: 0
177
+ max: 10.0
178
+ default: 0
179
+ description: "Silence duration between clips in seconds"
180
+ normalize_audio:
181
+ type: boolean
182
+ default: true
183
+ description: "Normalize audio levels across all clips"
184
+ per_input_options:
185
+ transition:
186
+ type: enum
187
+ values: [none, crossfade]
188
+ description: "Override transition for the join point preceding this input"
189
+ crossfade_duration:
190
+ type: float
191
+ min: 0
192
+ max: 10.0
193
+ depends_on: { transition: crossfade }
194
+ description: "Override crossfade duration for this join point"
195
+ gap_duration:
196
+ type: float
197
+ min: 0
198
+ max: 10.0
199
+ description: "Override gap duration for this join point"
200
+
201
+ document:
202
+ mimes:
203
+ - application/pdf
204
+ options:
205
+ page_range:
206
+ type: string
207
+ description: "Default page range per input, e.g. '1-3,5'. Null = all pages."
208
+ per_input_options:
209
+ page_range:
210
+ type: string
211
+ description: "Override page range for this specific input document"