perspectapi-ts-sdk 5.4.0 → 5.4.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/dist/index.d.mts CHANGED
@@ -3804,6 +3804,8 @@ interface ImageTransformOptions {
3804
3804
  bottom?: number;
3805
3805
  left?: number;
3806
3806
  };
3807
+ /** URL prefix for image transform paths. Defaults to '/_image'. */
3808
+ imageUrlPrefix?: string;
3807
3809
  }
3808
3810
  interface ResponsiveImageSizes {
3809
3811
  thumbnail: ImageTransformOptions;
package/dist/index.d.ts CHANGED
@@ -3804,6 +3804,8 @@ interface ImageTransformOptions {
3804
3804
  bottom?: number;
3805
3805
  left?: number;
3806
3806
  };
3807
+ /** URL prefix for image transform paths. Defaults to '/_image'. */
3808
+ imageUrlPrefix?: string;
3807
3809
  }
3808
3810
  interface ResponsiveImageSizes {
3809
3811
  thumbnail: ImageTransformOptions;
package/dist/index.js CHANGED
@@ -3911,7 +3911,8 @@ function buildImageUrl(baseUrl, mediaPath, options) {
3911
3911
  }
3912
3912
  }
3913
3913
  const queryString = params.join(",");
3914
- return `/cdn-cgi/image/${queryString}/${sourceUrl}`;
3914
+ const prefix = options?.imageUrlPrefix ?? "/_image";
3915
+ return `${prefix}/${queryString}/${sourceUrl}`;
3915
3916
  }
3916
3917
  function generateResponsiveUrls(baseUrl, mediaPath, sizes = DEFAULT_IMAGE_SIZES) {
3917
3918
  return {
package/dist/index.mjs CHANGED
@@ -3843,7 +3843,8 @@ function buildImageUrl(baseUrl, mediaPath, options) {
3843
3843
  }
3844
3844
  }
3845
3845
  const queryString = params.join(",");
3846
- return `/cdn-cgi/image/${queryString}/${sourceUrl}`;
3846
+ const prefix = options?.imageUrlPrefix ?? "/_image";
3847
+ return `${prefix}/${queryString}/${sourceUrl}`;
3847
3848
  }
3848
3849
  function generateResponsiveUrls(baseUrl, mediaPath, sizes = DEFAULT_IMAGE_SIZES) {
3849
3850
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perspectapi-ts-sdk",
3
- "version": "5.4.0",
3
+ "version": "5.4.2",
4
4
  "description": "TypeScript SDK for PerspectAPI - Cloudflare Workers compatible",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -23,6 +23,8 @@ export interface ImageTransformOptions {
23
23
  bottom?: number;
24
24
  left?: number;
25
25
  };
26
+ /** URL prefix for image transform paths. Defaults to '/_image'. */
27
+ imageUrlPrefix?: string;
26
28
  }
27
29
 
28
30
  export interface ResponsiveImageSizes {
@@ -127,10 +129,8 @@ export function buildImageUrl(
127
129
 
128
130
  const queryString = params.join(',');
129
131
 
130
- // Cloudflare Image Resizing URL format:
131
- // /cdn-cgi/image/{options}/{source-image-url}
132
- // Note: This only works on Cloudflare zones with Image Resizing enabled
133
- return `/cdn-cgi/image/${queryString}/${sourceUrl}`;
132
+ const prefix = options?.imageUrlPrefix ?? '/_image';
133
+ return `${prefix}/${queryString}/${sourceUrl}`;
134
134
  }
135
135
 
136
136
  /**