@netlify/cache 1.6.1 → 1.7.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.
@@ -200,7 +200,7 @@ var NetlifyCache = class {
200
200
  if (!cacheResponse.ok) {
201
201
  const errorDetail = cacheResponse.headers.get(ErrorDetail) ?? "";
202
202
  const errorMessage = ERROR_CODES[errorDetail] || GENERIC_ERROR;
203
- console.warn(`Failed to write to the cache: ${errorMessage}`);
203
+ context.logger?.(`Failed to write to the cache: ${errorMessage}`);
204
204
  }
205
205
  }
206
206
  };
@@ -1,5 +1,5 @@
1
- import { E as EnvironmentOptions } from '../cache-fc378069.js';
2
- export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-fc378069.js';
1
+ import { E as EnvironmentOptions } from '../cache-7af07baa.js';
2
+ export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-7af07baa.js';
3
3
 
4
4
  declare class NetlifyCacheStorage {
5
5
  #private;
@@ -1,5 +1,5 @@
1
- import { E as EnvironmentOptions } from '../cache-fc378069.js';
2
- export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-fc378069.js';
1
+ import { E as EnvironmentOptions } from '../cache-7af07baa.js';
2
+ export { B as Base64Encoder, N as NetlifyCache, O as Operation, R as RequestContextFactory } from '../cache-7af07baa.js';
3
3
 
4
4
  declare class NetlifyCacheStorage {
5
5
  #private;
@@ -173,7 +173,7 @@ var NetlifyCache = class {
173
173
  if (!cacheResponse.ok) {
174
174
  const errorDetail = cacheResponse.headers.get(ErrorDetail) ?? "";
175
175
  const errorMessage = ERROR_CODES[errorDetail] || GENERIC_ERROR;
176
- console.warn(`Failed to write to the cache: ${errorMessage}`);
176
+ context.logger?.(`Failed to write to the cache: ${errorMessage}`);
177
177
  }
178
178
  }
179
179
  };
@@ -1,4 +1,5 @@
1
1
  type Base64Encoder = (input: string) => string;
2
+ type Logger = (...args: any[]) => void;
2
3
  interface EnvironmentOptions {
3
4
  base64Encode: Base64Encoder;
4
5
  getContext: RequestContextFactory;
@@ -14,6 +15,7 @@ type RequestContextFactory = (options: {
14
15
  }) => RequestContext | null;
15
16
  interface RequestContext {
16
17
  host: string;
18
+ logger?: Logger;
17
19
  token: string;
18
20
  url: string;
19
21
  }
package/dist/main.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { N as NetlifyCache } from './cache-fc378069.js';
1
+ import { N as NetlifyCache } from './cache-7af07baa.js';
2
2
 
3
3
  interface CacheSettings {
4
4
  /**
package/dist/main.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { N as NetlifyCache } from './cache-fc378069.js';
1
+ import { N as NetlifyCache } from './cache-7af07baa.js';
2
2
 
3
3
  interface CacheSettings {
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/cache",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
4
4
  "description": "TypeScript utilities for interacting with the Netlify cache",
5
5
  "type": "module",
6
6
  "engines": {