@giveitsmaller/sdk 0.12.0 → 0.12.1

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.
@@ -335,8 +335,9 @@ export declare class Recipe {
335
335
  */
336
336
  compress(optimize?: OptimizeFor, options?: Record<string, unknown>): Recipe;
337
337
  /**
338
- * Change format. `format` is lowered verbatim to the `format` wire option;
339
- * `options` carries any additional per-op convert options.
338
+ * Change format. The `format` shorthand lowers to the `output_format` wire
339
+ * option (the convert op's wire key per the contract); `options` carries any
340
+ * additional per-op convert options.
340
341
  */
341
342
  convert(format: string, options?: Record<string, unknown>): Recipe;
342
343
  /**
@@ -436,13 +436,19 @@ export class Recipe {
436
436
  });
437
437
  }
438
438
  /**
439
- * Change format. `format` is lowered verbatim to the `format` wire option;
440
- * `options` carries any additional per-op convert options.
439
+ * Change format. The `format` shorthand lowers to the `output_format` wire
440
+ * option (the convert op's wire key per the contract); `options` carries any
441
+ * additional per-op convert options.
441
442
  */
442
443
  convert(format, options = {}) {
443
- // Spread options FIRST so the explicit `format` argument is authoritative —
444
- // a `format` key in the bag must NOT silently override the call's format.
445
- return this.withStep({ opType: 'convert', options: { ...options, format } });
444
+ // The convert op's wire key is `output_format` (contract: convert.yaml,
445
+ // required, all media), NOT `format`. Spread options FIRST so the explicit
446
+ // shorthand wins over an `output_format` key in the bag.
447
+ // The shorthand owns the format → a stray legacy `format` key in the bag is
448
+ // not a valid convert option; drop it so the wire never carries both keys.
449
+ const rest = { ...options };
450
+ delete rest.format;
451
+ return this.withStep({ opType: 'convert', options: { ...rest, output_format: format } });
446
452
  }
447
453
  /**
448
454
  * Generate a preview. Width and/or height in pixels; any additional per-op
@@ -1053,9 +1059,14 @@ export class MergedRecipe {
1053
1059
  }
1054
1060
  /** Change the merged output's format. See {@link Recipe.convert}. */
1055
1061
  convert(format, options = {}) {
1056
- // Spread options FIRST so the explicit `format` argument is authoritative —
1057
- // a `format` key in the bag must NOT silently override the call's format.
1058
- return this.withStep({ opType: 'convert', options: { ...options, format } });
1062
+ // The convert op's wire key is `output_format` (contract: convert.yaml,
1063
+ // required, all media), NOT `format`. Spread options FIRST so the explicit
1064
+ // shorthand wins over an `output_format` key in the bag.
1065
+ // The shorthand owns the format → a stray legacy `format` key in the bag is
1066
+ // not a valid convert option; drop it so the wire never carries both keys.
1067
+ const rest = { ...options };
1068
+ delete rest.format;
1069
+ return this.withStep({ opType: 'convert', options: { ...rest, output_format: format } });
1059
1070
  }
1060
1071
  /** Thumbnail the merged output. Omitted dimensions are dropped from the wire options. */
1061
1072
  thumbnail(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giveitsmaller/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Node.js SDK for the GISL (Give It Smaller) file compression and processing API",
5
5
  "license": "MIT",
6
6
  "type": "module",