@transloadit/node 4.1.8 → 4.2.0

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 (50) hide show
  1. package/README.md +23 -1
  2. package/dist/Transloadit.d.ts +17 -5
  3. package/dist/Transloadit.d.ts.map +1 -1
  4. package/dist/Transloadit.js +206 -39
  5. package/dist/Transloadit.js.map +1 -1
  6. package/dist/alphalib/mcache.d.ts.map +1 -1
  7. package/dist/alphalib/mcache.js +22 -7
  8. package/dist/alphalib/mcache.js.map +1 -1
  9. package/dist/alphalib/types/assemblyReplay.d.ts +56 -0
  10. package/dist/alphalib/types/assemblyReplay.d.ts.map +1 -1
  11. package/dist/alphalib/types/assemblyReplayNotification.d.ts +56 -0
  12. package/dist/alphalib/types/assemblyReplayNotification.d.ts.map +1 -1
  13. package/dist/alphalib/types/assemblyStatus.d.ts +63 -57
  14. package/dist/alphalib/types/assemblyStatus.d.ts.map +1 -1
  15. package/dist/alphalib/types/assemblyStatus.js +9 -1
  16. package/dist/alphalib/types/assemblyStatus.js.map +1 -1
  17. package/dist/alphalib/types/assemblyUrls.d.ts +1 -1
  18. package/dist/alphalib/types/assemblyUrls.d.ts.map +1 -1
  19. package/dist/alphalib/types/assemblyUrls.js.map +1 -1
  20. package/dist/alphalib/types/robots/_index.d.ts +608 -81
  21. package/dist/alphalib/types/robots/_index.d.ts.map +1 -1
  22. package/dist/alphalib/types/robots/_index.js +4 -0
  23. package/dist/alphalib/types/robots/_index.js.map +1 -1
  24. package/dist/alphalib/types/robots/_instructions-primitives.d.ts +4 -4
  25. package/dist/alphalib/types/robots/_instructions-primitives.d.ts.map +1 -1
  26. package/dist/alphalib/types/robots/_instructions-primitives.js +1 -0
  27. package/dist/alphalib/types/robots/_instructions-primitives.js.map +1 -1
  28. package/dist/alphalib/types/robots/document-optimize.d.ts +489 -0
  29. package/dist/alphalib/types/robots/document-optimize.d.ts.map +1 -0
  30. package/dist/alphalib/types/robots/document-optimize.js +151 -0
  31. package/dist/alphalib/types/robots/document-optimize.js.map +1 -0
  32. package/dist/alphalib/types/template.d.ts +1050 -174
  33. package/dist/alphalib/types/template.d.ts.map +1 -1
  34. package/dist/cli/commands/assemblies.d.ts.map +1 -1
  35. package/dist/cli/commands/assemblies.js +2 -2
  36. package/dist/cli/commands/assemblies.js.map +1 -1
  37. package/dist/tus.d.ts +2 -1
  38. package/dist/tus.d.ts.map +1 -1
  39. package/dist/tus.js +2 -1
  40. package/dist/tus.js.map +1 -1
  41. package/package.json +2 -2
  42. package/src/Transloadit.ts +279 -49
  43. package/src/alphalib/mcache.ts +26 -7
  44. package/src/alphalib/types/assemblyStatus.ts +9 -1
  45. package/src/alphalib/types/assemblyUrls.ts +2 -5
  46. package/src/alphalib/types/robots/_index.ts +14 -0
  47. package/src/alphalib/types/robots/_instructions-primitives.ts +1 -0
  48. package/src/alphalib/types/robots/document-optimize.ts +180 -0
  49. package/src/cli/commands/assemblies.ts +4 -2
  50. package/src/tus.ts +3 -0
@@ -0,0 +1,489 @@
1
+ import { z } from 'zod';
2
+ import type { RobotMetaInput } from './_instructions-primitives.ts';
3
+ export declare const meta: RobotMetaInput;
4
+ export declare const robotDocumentOptimizeInstructionsSchema: z.ZodObject<{
5
+ output_meta: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodBoolean>, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>;
6
+ result: z.ZodDefault<z.ZodBoolean>;
7
+ queue: z.ZodOptional<z.ZodEnum<["batch"]>>;
8
+ force_accept: z.ZodDefault<z.ZodBoolean>;
9
+ ignore_errors: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEnum<["meta", "execute"]>, "many">]>, string[], boolean | ("meta" | "execute")[]>>;
10
+ } & {
11
+ use: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
12
+ name: z.ZodString;
13
+ fields: z.ZodOptional<z.ZodString>;
14
+ as: z.ZodOptional<z.ZodString>;
15
+ }, "strict", z.ZodTypeAny, {
16
+ name: string;
17
+ fields?: string | undefined;
18
+ as?: string | undefined;
19
+ }, {
20
+ name: string;
21
+ fields?: string | undefined;
22
+ as?: string | undefined;
23
+ }>, "many">]>, z.ZodObject<{
24
+ steps: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
25
+ name: z.ZodString;
26
+ fields: z.ZodOptional<z.ZodString>;
27
+ as: z.ZodOptional<z.ZodString>;
28
+ }, "strict", z.ZodTypeAny, {
29
+ name: string;
30
+ fields?: string | undefined;
31
+ as?: string | undefined;
32
+ }, {
33
+ name: string;
34
+ fields?: string | undefined;
35
+ as?: string | undefined;
36
+ }>, "many">]>;
37
+ bundle_steps: z.ZodOptional<z.ZodBoolean>;
38
+ group_by_original: z.ZodOptional<z.ZodBoolean>;
39
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
40
+ }, "strict", z.ZodTypeAny, {
41
+ steps: string | string[] | {
42
+ name: string;
43
+ fields?: string | undefined;
44
+ as?: string | undefined;
45
+ }[];
46
+ fields?: string[] | undefined;
47
+ bundle_steps?: boolean | undefined;
48
+ group_by_original?: boolean | undefined;
49
+ }, {
50
+ steps: string | string[] | {
51
+ name: string;
52
+ fields?: string | undefined;
53
+ as?: string | undefined;
54
+ }[];
55
+ fields?: string[] | undefined;
56
+ bundle_steps?: boolean | undefined;
57
+ group_by_original?: boolean | undefined;
58
+ }>]>>;
59
+ } & {
60
+ robot: z.ZodLiteral<"/document/optimize">;
61
+ preset: z.ZodDefault<z.ZodEnum<["screen", "ebook", "printer", "prepress"]>>;
62
+ image_dpi: z.ZodOptional<z.ZodNumber>;
63
+ compress_fonts: z.ZodDefault<z.ZodBoolean>;
64
+ subset_fonts: z.ZodDefault<z.ZodBoolean>;
65
+ remove_metadata: z.ZodDefault<z.ZodBoolean>;
66
+ linearize: z.ZodDefault<z.ZodBoolean>;
67
+ compatibility: z.ZodDefault<z.ZodEnum<["1.4", "1.5", "1.6", "1.7", "2.0"]>>;
68
+ }, "strict", z.ZodTypeAny, {
69
+ result: boolean;
70
+ robot: "/document/optimize";
71
+ force_accept: boolean;
72
+ ignore_errors: string[];
73
+ preset: "ebook" | "screen" | "printer" | "prepress";
74
+ compress_fonts: boolean;
75
+ subset_fonts: boolean;
76
+ remove_metadata: boolean;
77
+ linearize: boolean;
78
+ compatibility: "1.4" | "1.5" | "1.6" | "1.7" | "2.0";
79
+ use?: string | string[] | {
80
+ name: string;
81
+ fields?: string | undefined;
82
+ as?: string | undefined;
83
+ }[] | {
84
+ steps: string | string[] | {
85
+ name: string;
86
+ fields?: string | undefined;
87
+ as?: string | undefined;
88
+ }[];
89
+ fields?: string[] | undefined;
90
+ bundle_steps?: boolean | undefined;
91
+ group_by_original?: boolean | undefined;
92
+ } | undefined;
93
+ output_meta?: boolean | string[] | Record<string, boolean> | undefined;
94
+ queue?: "batch" | undefined;
95
+ image_dpi?: number | undefined;
96
+ }, {
97
+ robot: "/document/optimize";
98
+ result?: boolean | undefined;
99
+ use?: string | string[] | {
100
+ name: string;
101
+ fields?: string | undefined;
102
+ as?: string | undefined;
103
+ }[] | {
104
+ steps: string | string[] | {
105
+ name: string;
106
+ fields?: string | undefined;
107
+ as?: string | undefined;
108
+ }[];
109
+ fields?: string[] | undefined;
110
+ bundle_steps?: boolean | undefined;
111
+ group_by_original?: boolean | undefined;
112
+ } | undefined;
113
+ output_meta?: boolean | string[] | Record<string, boolean> | undefined;
114
+ queue?: "batch" | undefined;
115
+ force_accept?: boolean | undefined;
116
+ ignore_errors?: boolean | ("meta" | "execute")[] | undefined;
117
+ preset?: "ebook" | "screen" | "printer" | "prepress" | undefined;
118
+ image_dpi?: number | undefined;
119
+ compress_fonts?: boolean | undefined;
120
+ subset_fonts?: boolean | undefined;
121
+ remove_metadata?: boolean | undefined;
122
+ linearize?: boolean | undefined;
123
+ compatibility?: "1.4" | "1.5" | "1.6" | "1.7" | "2.0" | undefined;
124
+ }>;
125
+ export declare const robotDocumentOptimizeInstructionsWithHiddenFieldsSchema: z.ZodObject<{
126
+ output_meta: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodBoolean>, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>;
127
+ queue: z.ZodOptional<z.ZodEnum<["batch"]>>;
128
+ force_accept: z.ZodDefault<z.ZodBoolean>;
129
+ ignore_errors: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEnum<["meta", "execute"]>, "many">]>, string[], boolean | ("meta" | "execute")[]>>;
130
+ use: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
131
+ name: z.ZodString;
132
+ fields: z.ZodOptional<z.ZodString>;
133
+ as: z.ZodOptional<z.ZodString>;
134
+ }, "strict", z.ZodTypeAny, {
135
+ name: string;
136
+ fields?: string | undefined;
137
+ as?: string | undefined;
138
+ }, {
139
+ name: string;
140
+ fields?: string | undefined;
141
+ as?: string | undefined;
142
+ }>, "many">]>, z.ZodObject<{
143
+ steps: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
144
+ name: z.ZodString;
145
+ fields: z.ZodOptional<z.ZodString>;
146
+ as: z.ZodOptional<z.ZodString>;
147
+ }, "strict", z.ZodTypeAny, {
148
+ name: string;
149
+ fields?: string | undefined;
150
+ as?: string | undefined;
151
+ }, {
152
+ name: string;
153
+ fields?: string | undefined;
154
+ as?: string | undefined;
155
+ }>, "many">]>;
156
+ bundle_steps: z.ZodOptional<z.ZodBoolean>;
157
+ group_by_original: z.ZodOptional<z.ZodBoolean>;
158
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
159
+ }, "strict", z.ZodTypeAny, {
160
+ steps: string | string[] | {
161
+ name: string;
162
+ fields?: string | undefined;
163
+ as?: string | undefined;
164
+ }[];
165
+ fields?: string[] | undefined;
166
+ bundle_steps?: boolean | undefined;
167
+ group_by_original?: boolean | undefined;
168
+ }, {
169
+ steps: string | string[] | {
170
+ name: string;
171
+ fields?: string | undefined;
172
+ as?: string | undefined;
173
+ }[];
174
+ fields?: string[] | undefined;
175
+ bundle_steps?: boolean | undefined;
176
+ group_by_original?: boolean | undefined;
177
+ }>]>>;
178
+ robot: z.ZodLiteral<"/document/optimize">;
179
+ preset: z.ZodDefault<z.ZodEnum<["screen", "ebook", "printer", "prepress"]>>;
180
+ image_dpi: z.ZodOptional<z.ZodNumber>;
181
+ compress_fonts: z.ZodDefault<z.ZodBoolean>;
182
+ subset_fonts: z.ZodDefault<z.ZodBoolean>;
183
+ remove_metadata: z.ZodDefault<z.ZodBoolean>;
184
+ linearize: z.ZodDefault<z.ZodBoolean>;
185
+ compatibility: z.ZodDefault<z.ZodEnum<["1.4", "1.5", "1.6", "1.7", "2.0"]>>;
186
+ } & {
187
+ result: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"debug">, z.ZodDefault<z.ZodBoolean>]>>;
188
+ }, "strict", z.ZodTypeAny, {
189
+ robot: "/document/optimize";
190
+ force_accept: boolean;
191
+ ignore_errors: string[];
192
+ preset: "ebook" | "screen" | "printer" | "prepress";
193
+ compress_fonts: boolean;
194
+ subset_fonts: boolean;
195
+ remove_metadata: boolean;
196
+ linearize: boolean;
197
+ compatibility: "1.4" | "1.5" | "1.6" | "1.7" | "2.0";
198
+ result?: boolean | "debug" | undefined;
199
+ use?: string | string[] | {
200
+ name: string;
201
+ fields?: string | undefined;
202
+ as?: string | undefined;
203
+ }[] | {
204
+ steps: string | string[] | {
205
+ name: string;
206
+ fields?: string | undefined;
207
+ as?: string | undefined;
208
+ }[];
209
+ fields?: string[] | undefined;
210
+ bundle_steps?: boolean | undefined;
211
+ group_by_original?: boolean | undefined;
212
+ } | undefined;
213
+ output_meta?: boolean | string[] | Record<string, boolean> | undefined;
214
+ queue?: "batch" | undefined;
215
+ image_dpi?: number | undefined;
216
+ }, {
217
+ robot: "/document/optimize";
218
+ result?: boolean | "debug" | undefined;
219
+ use?: string | string[] | {
220
+ name: string;
221
+ fields?: string | undefined;
222
+ as?: string | undefined;
223
+ }[] | {
224
+ steps: string | string[] | {
225
+ name: string;
226
+ fields?: string | undefined;
227
+ as?: string | undefined;
228
+ }[];
229
+ fields?: string[] | undefined;
230
+ bundle_steps?: boolean | undefined;
231
+ group_by_original?: boolean | undefined;
232
+ } | undefined;
233
+ output_meta?: boolean | string[] | Record<string, boolean> | undefined;
234
+ queue?: "batch" | undefined;
235
+ force_accept?: boolean | undefined;
236
+ ignore_errors?: boolean | ("meta" | "execute")[] | undefined;
237
+ preset?: "ebook" | "screen" | "printer" | "prepress" | undefined;
238
+ image_dpi?: number | undefined;
239
+ compress_fonts?: boolean | undefined;
240
+ subset_fonts?: boolean | undefined;
241
+ remove_metadata?: boolean | undefined;
242
+ linearize?: boolean | undefined;
243
+ compatibility?: "1.4" | "1.5" | "1.6" | "1.7" | "2.0" | undefined;
244
+ }>;
245
+ export type RobotDocumentOptimizeInstructions = z.infer<typeof robotDocumentOptimizeInstructionsSchema>;
246
+ export type RobotDocumentOptimizeInstructionsWithHiddenFields = z.infer<typeof robotDocumentOptimizeInstructionsWithHiddenFieldsSchema>;
247
+ export declare const interpolatableRobotDocumentOptimizeInstructionsSchema: z.ZodObject<{
248
+ output_meta: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, z.ZodUnion<[z.ZodString, z.ZodBoolean]>, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>]>>;
249
+ result: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
250
+ queue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodEnum<["batch"]>]>>;
251
+ force_accept: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
252
+ ignore_errors: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEnum<["meta", "execute"]>, "many">]>, string[], boolean | ("meta" | "execute")[]>]>>;
253
+ use: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
254
+ name: z.ZodString;
255
+ fields: z.ZodOptional<z.ZodString>;
256
+ as: z.ZodOptional<z.ZodString>;
257
+ }, "strict", z.ZodTypeAny, {
258
+ name: string;
259
+ fields?: string | undefined;
260
+ as?: string | undefined;
261
+ }, {
262
+ name: string;
263
+ fields?: string | undefined;
264
+ as?: string | undefined;
265
+ }>, "many">]>, z.ZodObject<{
266
+ steps: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
267
+ name: z.ZodString;
268
+ fields: z.ZodOptional<z.ZodString>;
269
+ as: z.ZodOptional<z.ZodString>;
270
+ }, "strict", z.ZodTypeAny, {
271
+ name: string;
272
+ fields?: string | undefined;
273
+ as?: string | undefined;
274
+ }, {
275
+ name: string;
276
+ fields?: string | undefined;
277
+ as?: string | undefined;
278
+ }>, "many">]>;
279
+ bundle_steps: z.ZodOptional<z.ZodBoolean>;
280
+ group_by_original: z.ZodOptional<z.ZodBoolean>;
281
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
282
+ }, "strict", z.ZodTypeAny, {
283
+ steps: string | string[] | {
284
+ name: string;
285
+ fields?: string | undefined;
286
+ as?: string | undefined;
287
+ }[];
288
+ fields?: string[] | undefined;
289
+ bundle_steps?: boolean | undefined;
290
+ group_by_original?: boolean | undefined;
291
+ }, {
292
+ steps: string | string[] | {
293
+ name: string;
294
+ fields?: string | undefined;
295
+ as?: string | undefined;
296
+ }[];
297
+ fields?: string[] | undefined;
298
+ bundle_steps?: boolean | undefined;
299
+ group_by_original?: boolean | undefined;
300
+ }>]>>;
301
+ robot: z.ZodLiteral<"/document/optimize">;
302
+ preset: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodEnum<["screen", "ebook", "printer", "prepress"]>]>>;
303
+ image_dpi: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
304
+ compress_fonts: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
305
+ subset_fonts: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
306
+ remove_metadata: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
307
+ linearize: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
308
+ compatibility: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodEnum<["1.4", "1.5", "1.6", "1.7", "2.0"]>]>>;
309
+ }, "strict", z.ZodTypeAny, {
310
+ result: string | boolean;
311
+ robot: "/document/optimize";
312
+ force_accept: string | boolean;
313
+ ignore_errors: string | string[];
314
+ preset: string;
315
+ compress_fonts: string | boolean;
316
+ subset_fonts: string | boolean;
317
+ remove_metadata: string | boolean;
318
+ linearize: string | boolean;
319
+ compatibility: string;
320
+ use?: string | string[] | {
321
+ name: string;
322
+ fields?: string | undefined;
323
+ as?: string | undefined;
324
+ }[] | {
325
+ steps: string | string[] | {
326
+ name: string;
327
+ fields?: string | undefined;
328
+ as?: string | undefined;
329
+ }[];
330
+ fields?: string[] | undefined;
331
+ bundle_steps?: boolean | undefined;
332
+ group_by_original?: boolean | undefined;
333
+ } | undefined;
334
+ output_meta?: string | boolean | string[] | Record<string, string | boolean> | undefined;
335
+ queue?: string | undefined;
336
+ image_dpi?: string | number | undefined;
337
+ }, {
338
+ robot: "/document/optimize";
339
+ result?: string | boolean | undefined;
340
+ use?: string | string[] | {
341
+ name: string;
342
+ fields?: string | undefined;
343
+ as?: string | undefined;
344
+ }[] | {
345
+ steps: string | string[] | {
346
+ name: string;
347
+ fields?: string | undefined;
348
+ as?: string | undefined;
349
+ }[];
350
+ fields?: string[] | undefined;
351
+ bundle_steps?: boolean | undefined;
352
+ group_by_original?: boolean | undefined;
353
+ } | undefined;
354
+ output_meta?: string | boolean | string[] | Record<string, string | boolean> | undefined;
355
+ queue?: string | undefined;
356
+ force_accept?: string | boolean | undefined;
357
+ ignore_errors?: string | boolean | ("meta" | "execute")[] | undefined;
358
+ preset?: string | undefined;
359
+ image_dpi?: string | number | undefined;
360
+ compress_fonts?: string | boolean | undefined;
361
+ subset_fonts?: string | boolean | undefined;
362
+ remove_metadata?: string | boolean | undefined;
363
+ linearize?: string | boolean | undefined;
364
+ compatibility?: string | undefined;
365
+ }>;
366
+ export type InterpolatableRobotDocumentOptimizeInstructions = InterpolatableRobotDocumentOptimizeInstructionsInput;
367
+ export type InterpolatableRobotDocumentOptimizeInstructionsInput = z.input<typeof interpolatableRobotDocumentOptimizeInstructionsSchema>;
368
+ export declare const interpolatableRobotDocumentOptimizeInstructionsWithHiddenFieldsSchema: z.ZodObject<{
369
+ output_meta: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, z.ZodUnion<[z.ZodString, z.ZodBoolean]>, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>]>>;
370
+ queue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodEnum<["batch"]>]>>;
371
+ force_accept: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
372
+ ignore_errors: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEnum<["meta", "execute"]>, "many">]>, string[], boolean | ("meta" | "execute")[]>]>>;
373
+ use: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
374
+ name: z.ZodString;
375
+ fields: z.ZodOptional<z.ZodString>;
376
+ as: z.ZodOptional<z.ZodString>;
377
+ }, "strict", z.ZodTypeAny, {
378
+ name: string;
379
+ fields?: string | undefined;
380
+ as?: string | undefined;
381
+ }, {
382
+ name: string;
383
+ fields?: string | undefined;
384
+ as?: string | undefined;
385
+ }>, "many">]>, z.ZodObject<{
386
+ steps: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{
387
+ name: z.ZodString;
388
+ fields: z.ZodOptional<z.ZodString>;
389
+ as: z.ZodOptional<z.ZodString>;
390
+ }, "strict", z.ZodTypeAny, {
391
+ name: string;
392
+ fields?: string | undefined;
393
+ as?: string | undefined;
394
+ }, {
395
+ name: string;
396
+ fields?: string | undefined;
397
+ as?: string | undefined;
398
+ }>, "many">]>;
399
+ bundle_steps: z.ZodOptional<z.ZodBoolean>;
400
+ group_by_original: z.ZodOptional<z.ZodBoolean>;
401
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
402
+ }, "strict", z.ZodTypeAny, {
403
+ steps: string | string[] | {
404
+ name: string;
405
+ fields?: string | undefined;
406
+ as?: string | undefined;
407
+ }[];
408
+ fields?: string[] | undefined;
409
+ bundle_steps?: boolean | undefined;
410
+ group_by_original?: boolean | undefined;
411
+ }, {
412
+ steps: string | string[] | {
413
+ name: string;
414
+ fields?: string | undefined;
415
+ as?: string | undefined;
416
+ }[];
417
+ fields?: string[] | undefined;
418
+ bundle_steps?: boolean | undefined;
419
+ group_by_original?: boolean | undefined;
420
+ }>]>>;
421
+ robot: z.ZodLiteral<"/document/optimize">;
422
+ preset: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodEnum<["screen", "ebook", "printer", "prepress"]>]>>;
423
+ image_dpi: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
424
+ compress_fonts: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
425
+ subset_fonts: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
426
+ remove_metadata: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
427
+ linearize: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
428
+ compatibility: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodEnum<["1.4", "1.5", "1.6", "1.7", "2.0"]>]>>;
429
+ result: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodString, z.ZodLiteral<"debug">]>, z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>]>>;
430
+ }, "strict", z.ZodTypeAny, {
431
+ robot: "/document/optimize";
432
+ force_accept: string | boolean;
433
+ ignore_errors: string | string[];
434
+ preset: string;
435
+ compress_fonts: string | boolean;
436
+ subset_fonts: string | boolean;
437
+ remove_metadata: string | boolean;
438
+ linearize: string | boolean;
439
+ compatibility: string;
440
+ result?: string | boolean | undefined;
441
+ use?: string | string[] | {
442
+ name: string;
443
+ fields?: string | undefined;
444
+ as?: string | undefined;
445
+ }[] | {
446
+ steps: string | string[] | {
447
+ name: string;
448
+ fields?: string | undefined;
449
+ as?: string | undefined;
450
+ }[];
451
+ fields?: string[] | undefined;
452
+ bundle_steps?: boolean | undefined;
453
+ group_by_original?: boolean | undefined;
454
+ } | undefined;
455
+ output_meta?: string | boolean | string[] | Record<string, string | boolean> | undefined;
456
+ queue?: string | undefined;
457
+ image_dpi?: string | number | undefined;
458
+ }, {
459
+ robot: "/document/optimize";
460
+ result?: string | boolean | undefined;
461
+ use?: string | string[] | {
462
+ name: string;
463
+ fields?: string | undefined;
464
+ as?: string | undefined;
465
+ }[] | {
466
+ steps: string | string[] | {
467
+ name: string;
468
+ fields?: string | undefined;
469
+ as?: string | undefined;
470
+ }[];
471
+ fields?: string[] | undefined;
472
+ bundle_steps?: boolean | undefined;
473
+ group_by_original?: boolean | undefined;
474
+ } | undefined;
475
+ output_meta?: string | boolean | string[] | Record<string, string | boolean> | undefined;
476
+ queue?: string | undefined;
477
+ force_accept?: string | boolean | undefined;
478
+ ignore_errors?: string | boolean | ("meta" | "execute")[] | undefined;
479
+ preset?: string | undefined;
480
+ image_dpi?: string | number | undefined;
481
+ compress_fonts?: string | boolean | undefined;
482
+ subset_fonts?: string | boolean | undefined;
483
+ remove_metadata?: string | boolean | undefined;
484
+ linearize?: string | boolean | undefined;
485
+ compatibility?: string | undefined;
486
+ }>;
487
+ export type InterpolatableRobotDocumentOptimizeInstructionsWithHiddenFields = z.infer<typeof interpolatableRobotDocumentOptimizeInstructionsWithHiddenFieldsSchema>;
488
+ export type InterpolatableRobotDocumentOptimizeInstructionsWithHiddenFieldsInput = z.input<typeof interpolatableRobotDocumentOptimizeInstructionsWithHiddenFieldsSchema>;
489
+ //# sourceMappingURL=document-optimize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-optimize.d.ts","sourceRoot":"","sources":["../../../../src/alphalib/types/robots/document-optimize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAGnE,eAAO,MAAM,IAAI,EAAE,cAyDlB,CAAA;AAED,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkFzC,CAAA;AAEX,eAAO,MAAM,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKhE,CAAA;AAEJ,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAA;AACD,MAAM,MAAM,iDAAiD,GAAG,CAAC,CAAC,KAAK,CACrE,OAAO,uDAAuD,CAC/D,CAAA;AAED,eAAO,MAAM,qDAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjE,CAAA;AACD,MAAM,MAAM,+CAA+C,GACzD,oDAAoD,CAAA;AAEtD,MAAM,MAAM,oDAAoD,GAAG,CAAC,CAAC,KAAK,CACxE,OAAO,qDAAqD,CAC7D,CAAA;AAED,eAAO,MAAM,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EACP,CAAA;AAC3E,MAAM,MAAM,+DAA+D,GAAG,CAAC,CAAC,KAAK,CACnF,OAAO,qEAAqE,CAC7E,CAAA;AACD,MAAM,MAAM,oEAAoE,GAAG,CAAC,CAAC,KAAK,CACxF,OAAO,qEAAqE,CAC7E,CAAA"}
@@ -0,0 +1,151 @@
1
+ import { z } from 'zod';
2
+ import { interpolateRobot, robotBase, robotUse } from "./_instructions-primitives.js";
3
+ export const meta = {
4
+ allowed_for_url_transform: true,
5
+ bytescount: 1,
6
+ discount_factor: 1,
7
+ discount_pct: 0,
8
+ example_code: {
9
+ steps: {
10
+ optimized: {
11
+ robot: '/document/optimize',
12
+ use: ':original',
13
+ preset: 'ebook',
14
+ },
15
+ },
16
+ },
17
+ example_code_description: 'Optimize PDF file size using the ebook preset:',
18
+ extended_description: `
19
+ This <dfn>Robot</dfn> reduces PDF file sizes. It recompresses images, subsets fonts, and applies various optimizations to reduce file size while maintaining acceptable quality.
20
+
21
+ ## Quality Presets
22
+
23
+ The Robot supports four quality presets that control the trade-off between file size and quality:
24
+
25
+ | Preset | DPI | Use Case | Typical Savings |
26
+ |--------|-----|----------|-----------------|
27
+ | \`screen\` | 72 | Screen viewing, smallest files | ~86% |
28
+ | \`ebook\` | 150 | Good balance of quality/size | ~71% |
29
+ | \`printer\` | 300 | Print quality | Moderate |
30
+ | \`prepress\` | Highest | Press-ready, largest files | Minimal |
31
+
32
+ ## Use Cases
33
+
34
+ - Reducing storage costs for archived documents
35
+ - Faster document delivery and download
36
+ - Meeting email attachment size limits
37
+ - Mobile-optimized document viewing
38
+ `,
39
+ minimum_charge: 2097152,
40
+ output_factor: 0.5,
41
+ override_lvl1: 'Document Processing',
42
+ purpose_sentence: 'reduces the file size of PDF documents',
43
+ purpose_verb: 'optimize',
44
+ purpose_word: 'optimize PDF',
45
+ purpose_words: 'Optimize PDF file size',
46
+ service_slug: 'document-processing',
47
+ slot_count: 10,
48
+ title: 'Reduce PDF file size',
49
+ typical_file_size_mb: 2.0,
50
+ typical_file_type: 'document',
51
+ name: 'DocumentOptimizeRobot',
52
+ priceFactor: 1,
53
+ queueSlotCount: 10,
54
+ minimumCharge: 2097152,
55
+ isAllowedForUrlTransform: true,
56
+ trackOutputFileSize: true,
57
+ isInternal: false,
58
+ removeJobResultFilesFromDiskRightAfterStoringOnS3: false,
59
+ stage: 'beta',
60
+ };
61
+ export const robotDocumentOptimizeInstructionsSchema = robotBase
62
+ .merge(robotUse)
63
+ .extend({
64
+ robot: z.literal('/document/optimize').describe(`
65
+ This Robot reduces PDF file sizes. It recompresses images, subsets fonts, and applies various optimizations to reduce file size while maintaining acceptable quality.
66
+
67
+ ## Quality Presets
68
+
69
+ The Robot supports four quality presets that control the trade-off between file size and quality:
70
+
71
+ | Preset | DPI | Use Case | Typical Savings |
72
+ |--------|-----|----------|-----------------|
73
+ | \`screen\` | 72 | Screen viewing, smallest files | ~86% |
74
+ | \`ebook\` | 150 | Good balance of quality/size | ~71% |
75
+ | \`printer\` | 300 | Print quality | Moderate |
76
+ | \`prepress\` | Highest | Press-ready, largest files | Minimal |
77
+ `),
78
+ preset: z
79
+ .enum(['screen', 'ebook', 'printer', 'prepress'])
80
+ .default('ebook')
81
+ .describe(`
82
+ The quality preset to use for optimization. Each preset provides a different balance between file size and quality:
83
+
84
+ - \`screen\` - Lowest quality, smallest file size. Best for screen viewing only. Images are downsampled to 72 DPI.
85
+ - \`ebook\` - Good balance of quality and size. Suitable for most purposes. Images are downsampled to 150 DPI.
86
+ - \`printer\` - High quality suitable for printing. Images are kept at 300 DPI.
87
+ - \`prepress\` - Highest quality for professional printing. Minimal compression applied.
88
+ `),
89
+ image_dpi: z
90
+ .number()
91
+ .int()
92
+ .min(36)
93
+ .max(600)
94
+ .optional()
95
+ .describe(`
96
+ Target DPI (dots per inch) for embedded images. When specified, this overrides the DPI setting from the preset.
97
+
98
+ Higher DPI values result in better image quality but larger file sizes. Lower values produce smaller files but may result in pixelated images when printed.
99
+
100
+ Common values:
101
+ - 72 - Screen viewing
102
+ - 150 - eBooks and general documents
103
+ - 300 - Print quality
104
+ - 600 - High-quality print
105
+ `),
106
+ compress_fonts: z
107
+ .boolean()
108
+ .default(true)
109
+ .describe(`
110
+ Whether to compress embedded fonts. When enabled, fonts are compressed to reduce file size.
111
+ `),
112
+ subset_fonts: z
113
+ .boolean()
114
+ .default(true)
115
+ .describe(`
116
+ Whether to subset embedded fonts, keeping only the glyphs that are actually used in the document. This can significantly reduce file size for documents that only use a small portion of a font's character set.
117
+ `),
118
+ remove_metadata: z
119
+ .boolean()
120
+ .default(false)
121
+ .describe(`
122
+ Whether to strip document metadata (title, author, keywords, etc.) from the PDF. This can provide a small reduction in file size and may be useful for privacy.
123
+ `),
124
+ linearize: z
125
+ .boolean()
126
+ .default(true)
127
+ .describe(`
128
+ Whether to linearize (optimize for Fast Web View) the output PDF. Linearized PDFs can begin displaying in a browser before they are fully downloaded, improving the user experience for web delivery.
129
+ `),
130
+ compatibility: z
131
+ .enum(['1.4', '1.5', '1.6', '1.7', '2.0'])
132
+ .default('1.7')
133
+ .describe(`
134
+ The PDF version compatibility level. Lower versions have broader compatibility but fewer features. Higher versions support more advanced features but may not open in older PDF readers.
135
+
136
+ - \`1.4\` - Acrobat 5 compatibility, most widely supported
137
+ - \`1.5\` - Acrobat 6 compatibility
138
+ - \`1.6\` - Acrobat 7 compatibility
139
+ - \`1.7\` - Acrobat 8+ compatibility (default)
140
+ - \`2.0\` - PDF 2.0 standard
141
+ `),
142
+ })
143
+ .strict();
144
+ export const robotDocumentOptimizeInstructionsWithHiddenFieldsSchema = robotDocumentOptimizeInstructionsSchema.extend({
145
+ result: z
146
+ .union([z.literal('debug'), robotDocumentOptimizeInstructionsSchema.shape.result])
147
+ .optional(),
148
+ });
149
+ export const interpolatableRobotDocumentOptimizeInstructionsSchema = interpolateRobot(robotDocumentOptimizeInstructionsSchema);
150
+ export const interpolatableRobotDocumentOptimizeInstructionsWithHiddenFieldsSchema = interpolateRobot(robotDocumentOptimizeInstructionsWithHiddenFieldsSchema);
151
+ //# sourceMappingURL=document-optimize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-optimize.js","sourceRoot":"","sources":["../../../../src/alphalib/types/robots/document-optimize.ts"],"names":[],"mappings":"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"}