@vercel/functions 3.5.1 → 3.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/functions
2
2
 
3
+ ## 3.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 102f82b: `getCache().set()` now defaults `options.name` to the provided `key` when omitted, so cache entries get a human-readable label in o11y by default. Pass `name: ''` to suppress this behavior and use the hashed key.
8
+
3
9
  ## 3.5.1
4
10
 
5
11
  ### Patch Changes
@@ -3,6 +3,7 @@ export declare class InMemoryCache implements RuntimeCache {
3
3
  private cache;
4
4
  get(key: string): Promise<unknown | null>;
5
5
  set(key: string, value: unknown, options?: {
6
+ name?: string;
6
7
  ttl?: number;
7
8
  tags?: string[];
8
9
  }): Promise<void>;
package/cache/index.js CHANGED
@@ -71,7 +71,10 @@ function wrapWithKeyTransformation(resolveCache, makeKey) {
71
71
  return resolveCache().get(makeKey(key));
72
72
  },
73
73
  set: (key, value, options) => {
74
- return resolveCache().set(makeKey(key), value, options);
74
+ return resolveCache().set(makeKey(key), value, {
75
+ ...options,
76
+ name: options?.name ?? key
77
+ });
75
78
  },
76
79
  delete: (key) => {
77
80
  return resolveCache().delete(makeKey(key));
package/cache/types.d.ts CHANGED
@@ -22,7 +22,7 @@ export interface RuntimeCache {
22
22
  * @param {string} key - The key of the value to set.
23
23
  * @param {unknown} value - The value to set.
24
24
  * @param {Object} [options] - Optional settings for the cache entry.
25
- * @param {string} [options.name] - Optional user-friendly name for the cache entry used for o11y.
25
+ * @param {string} [options.name] - Optional user-friendly name for the cache entry used for o11y. Defaults to the provided `key` when omitted; pass `''` to suppress sending a name.
26
26
  * @param {string[]} [options.tags] - Optional tags to associate with the cache entry.
27
27
  * @param {number} [options.ttl] - Optional time-to-live for the cache entry, in seconds.
28
28
  * @returns {Promise<void>} A promise that resolves when the value is set.
@@ -112,7 +112,7 @@ Optional settings for the cache entry.
112
112
 
113
113
  `string`
114
114
 
115
- Optional user-friendly name for the cache entry used for o11y.
115
+ Optional user-friendly name for the cache entry used for o11y. Defaults to the provided `key` when omitted; pass `''` to suppress sending a name.
116
116
 
117
117
  ###### tags?
118
118
 
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "require": "./middleware.js"
31
31
  }
32
32
  },
33
- "version": "3.5.1",
33
+ "version": "3.6.0",
34
34
  "repository": {
35
35
  "directory": "packages/functions",
36
36
  "type": "git",