@artsy/img 1.1.1 → 1.1.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v1.1.2 (Mon Feb 09 2026)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - feat: add cache policy param to passthrough to gemini [#26](https://github.com/artsy/img/pull/26) ([@brainbicycle](https://github.com/brainbicycle))
6
+
7
+ #### Authors: 1
8
+
9
+ - Brian Beckerle ([@brainbicycle](https://github.com/brainbicycle))
10
+
11
+ ---
12
+
1
13
  # v1.1.1 (Fri Feb 06 2026)
2
14
 
3
15
  #### 🐛 Bug Fix
@@ -4,8 +4,8 @@ exports.gemini = void 0;
4
4
  const services_1 = require("../services");
5
5
  const stringify_1 = require("../utils/stringify");
6
6
  const gemini = (config) => {
7
- return (mode, src, { width, height, quality = services_1.DEFAULT_IMG_QUALITY }) => {
8
- if (!(0, services_1.validateResizeOptions)(mode, { width, height }))
7
+ return (mode, src, { width, height, quality = services_1.DEFAULT_IMG_QUALITY, cachePolicy }) => {
8
+ if (!(0, services_1.validateResizeOptions)(mode, { width, height, cachePolicy }))
9
9
  return src;
10
10
  let resizeTo;
11
11
  switch (mode) {
@@ -31,6 +31,7 @@ const gemini = (config) => {
31
31
  src,
32
32
  width,
33
33
  quality,
34
+ cache_policy: cachePolicy,
34
35
  };
35
36
  const query = (0, stringify_1.stringify)(params);
36
37
  return `${config.endpoint}?${query}`;
@@ -8,6 +8,7 @@ export type ResizeOptions = {
8
8
  width?: number;
9
9
  height?: number;
10
10
  quality?: number;
11
+ cachePolicy?: string;
11
12
  };
12
13
  export type ServiceConfigurations = {
13
14
  gemini?: Gemini;
@@ -18,7 +19,7 @@ export type ResizeExec = (mode: ResizeMode, src: string, options: ResizeOptions)
18
19
  export type ImageService = {
19
20
  exec: ResizeExec;
20
21
  };
21
- export declare const validateResizeOptions: (mode: ResizeMode, { width, height }: ResizeOptions) => boolean;
22
+ export declare const validateResizeOptions: (mode: ResizeMode, { width, height, cachePolicy }: ResizeOptions) => boolean;
22
23
  /**
23
24
  * Returns a list of configured services.
24
25
  * All endpoints should *not* have trailing slashes.
package/dist/services.js CHANGED
@@ -6,7 +6,7 @@ const imgix_1 = require("./services/imgix");
6
6
  const lambda_1 = require("./services/lambda");
7
7
  exports.RESIZE_MODES = ["resize", "crop"];
8
8
  exports.DEFAULT_IMG_QUALITY = 80;
9
- const validateResizeOptions = (mode, { width, height }) => {
9
+ const validateResizeOptions = (mode, { width, height, cachePolicy }) => {
10
10
  if (mode === "crop" && (!width || !height)) {
11
11
  console.warn("`crop`requires both `width` and `height`");
12
12
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/img",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Logic for constructing image proxy URLs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,8 +10,8 @@ export type Gemini = {
10
10
  };
11
11
 
12
12
  export const gemini = (config: Gemini): ResizeExec => {
13
- return (mode, src, { width, height, quality = DEFAULT_IMG_QUALITY }) => {
14
- if (!validateResizeOptions(mode, { width, height })) return src;
13
+ return (mode, src, { width, height, quality = DEFAULT_IMG_QUALITY, cachePolicy }) => {
14
+ if (!validateResizeOptions(mode, { width, height, cachePolicy})) return src;
15
15
 
16
16
  let resizeTo: "width" | "height" | "fit" | "fill";
17
17
 
@@ -42,6 +42,7 @@ export const gemini = (config: Gemini): ResizeExec => {
42
42
  src,
43
43
  width,
44
44
  quality,
45
+ cache_policy: cachePolicy,
45
46
  };
46
47
 
47
48
  const query = stringify(params);
package/src/services.ts CHANGED
@@ -12,6 +12,7 @@ export type ResizeOptions = {
12
12
  width?: number;
13
13
  height?: number;
14
14
  quality?: number;
15
+ cachePolicy?: string;
15
16
  };
16
17
 
17
18
  export type ServiceConfigurations = {
@@ -30,7 +31,7 @@ export type ImageService = { exec: ResizeExec };
30
31
 
31
32
  export const validateResizeOptions = (
32
33
  mode: ResizeMode,
33
- { width, height }: ResizeOptions
34
+ { width, height, cachePolicy }: ResizeOptions
34
35
  ) => {
35
36
  if (mode === "crop" && (!width || !height)) {
36
37
  console.warn("`crop`requires both `width` and `height`");