@vercel/functions 2.0.2 → 2.0.3

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
+ ## 2.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Rename FunctionCache / getFunctionCache to RuntimeCache / getRuntimeCache ([#13296](https://github.com/vercel/vercel/pull/13296))
8
+
3
9
  ## 2.0.2
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
- import { FunctionCache } from './types';
2
- export declare class InMemoryCache implements FunctionCache {
1
+ import { RuntimeCache } from './types';
2
+ export declare class InMemoryCache implements RuntimeCache {
3
3
  private cache;
4
4
  get(key: string, options?: {
5
5
  tags?: string[];
package/cache/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { CacheOptions, FunctionCache } from './types';
1
+ import { CacheOptions, RuntimeCache } from './types';
2
2
  /**
3
- * Retrieves the Vercel Function Cache.
3
+ * Retrieves the Vercel Runtime Cache.
4
4
  *
5
5
  * Keys are hashed to ensure they are unique and consistent. The hashing function can be overridden by providing a custom
6
6
  * `keyHashFunction` in the `cacheOptions` parameter.
@@ -10,7 +10,7 @@ import { CacheOptions, FunctionCache } from './types';
10
10
  * namespaceSeparator can also be customized using the `namespaceSeparator` option.
11
11
  *
12
12
  * @param cacheOptions - Optional configuration for the cache.
13
- * @returns An instance of the Vercel Function Cache.
13
+ * @returns An instance of the Vercel Runtime Cache.
14
14
  * @throws {Error} If no cache is available in the context and `InMemoryCache` cannot be created.
15
15
  */
16
- export declare const getFunctionCache: (cacheOptions?: CacheOptions) => FunctionCache;
16
+ export declare const getRuntimeCache: (cacheOptions?: CacheOptions) => RuntimeCache;
package/cache/index.js CHANGED
@@ -18,7 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var cache_exports = {};
20
20
  __export(cache_exports, {
21
- getFunctionCache: () => getFunctionCache
21
+ getRuntimeCache: () => getRuntimeCache
22
22
  });
23
23
  module.exports = __toCommonJS(cache_exports);
24
24
  var import_get_context = require("../get-context");
@@ -32,7 +32,7 @@ const defaultKeyHashFunction = (key) => {
32
32
  };
33
33
  const defaultNamespaceSeparator = "$";
34
34
  let inMemoryCacheInstance = null;
35
- const getFunctionCache = (cacheOptions) => {
35
+ const getRuntimeCache = (cacheOptions) => {
36
36
  let cache;
37
37
  if ((0, import_get_context.getContext)().cache) {
38
38
  cache = (0, import_get_context.getContext)().cache;
@@ -68,5 +68,5 @@ const getFunctionCache = (cacheOptions) => {
68
68
  };
69
69
  // Annotate the CommonJS export names for ESM import in node:
70
70
  0 && (module.exports = {
71
- getFunctionCache
71
+ getRuntimeCache
72
72
  });
package/cache/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Interface representing the function cache.
2
+ * Interface representing the runtime cache.
3
3
  */
4
- export interface FunctionCache {
4
+ export interface RuntimeCache {
5
5
  /**
6
6
  * Deletes a value from the cache.
7
7
  *
@@ -1,17 +1,17 @@
1
- # Interface: FunctionCache
1
+ # Interface: RuntimeCache
2
2
 
3
- [index](../modules/index.md).FunctionCache
3
+ [index](../modules/index.md).RuntimeCache
4
4
 
5
- Interface representing the function cache.
5
+ Interface representing the runtime cache.
6
6
 
7
7
  ## Table of contents
8
8
 
9
9
  ### Properties
10
10
 
11
- - [delete](index.FunctionCache.md#delete)
12
- - [expireTag](index.FunctionCache.md#expiretag)
13
- - [get](index.FunctionCache.md#get)
14
- - [set](index.FunctionCache.md#set)
11
+ - [delete](index.RuntimeCache.md#delete)
12
+ - [expireTag](index.RuntimeCache.md#expiretag)
13
+ - [get](index.RuntimeCache.md#get)
14
+ - [set](index.RuntimeCache.md#set)
15
15
 
16
16
  ## Properties
17
17
 
@@ -4,15 +4,15 @@
4
4
 
5
5
  ### Interfaces
6
6
 
7
- - [FunctionCache](../interfaces/index.FunctionCache.md)
8
7
  - [Geo](../interfaces/index.Geo.md)
9
8
  - [Request](../interfaces/index.Request.md)
9
+ - [RuntimeCache](../interfaces/index.RuntimeCache.md)
10
10
 
11
11
  ### Functions
12
12
 
13
13
  - [geolocation](index.md#geolocation)
14
14
  - [getEnv](index.md#getenv)
15
- - [getFunctionCache](index.md#getfunctioncache)
15
+ - [getRuntimeCache](index.md#getruntimecache)
16
16
  - [ipAddress](index.md#ipaddress)
17
17
  - [next](index.md#next)
18
18
  - [rewrite](index.md#rewrite)
@@ -118,11 +118,11 @@ https://vercel.com/docs/projects/environment-variables/system-environment-variab
118
118
 
119
119
  ---
120
120
 
121
- ### getFunctionCache
121
+ ### getRuntimeCache
122
122
 
123
- ▸ **getFunctionCache**(`cacheOptions?`): [`FunctionCache`](../interfaces/index.FunctionCache.md)
123
+ ▸ **getRuntimeCache**(`cacheOptions?`): [`RuntimeCache`](../interfaces/index.RuntimeCache.md)
124
124
 
125
- Retrieves the Vercel Function Cache.
125
+ Retrieves the Vercel Runtime Cache.
126
126
 
127
127
  Keys are hashed to ensure they are unique and consistent. The hashing function can be overridden by providing a custom
128
128
  `keyHashFunction` in the `cacheOptions` parameter.
@@ -143,9 +143,9 @@ If no cache is available in the context and `InMemoryCache` cannot be created.
143
143
 
144
144
  #### Returns
145
145
 
146
- [`FunctionCache`](../interfaces/index.FunctionCache.md)
146
+ [`RuntimeCache`](../interfaces/index.RuntimeCache.md)
147
147
 
148
- An instance of the Vercel Function Cache.
148
+ An instance of the Vercel Runtime Cache.
149
149
 
150
150
  #### Defined in
151
151
 
package/get-context.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { FunctionCache } from './cache/types';
1
+ import { RuntimeCache } from './cache/types';
2
2
  type Context = {
3
3
  waitUntil?: (promise: Promise<unknown>) => void;
4
- cache?: FunctionCache;
4
+ cache?: RuntimeCache;
5
5
  headers?: Record<string, string>;
6
6
  };
7
7
  export declare const SYMBOL_FOR_REQ_CONTEXT: unique symbol;
package/index.d.ts CHANGED
@@ -3,5 +3,5 @@ export { geolocation, ipAddress } from './headers';
3
3
  export { getEnv } from './get-env';
4
4
  export { waitUntil } from './wait-until';
5
5
  export { rewrite, next } from './middleware';
6
- export { getFunctionCache } from './cache';
7
- export type { FunctionCache } from './cache/types';
6
+ export { getRuntimeCache } from './cache';
7
+ export type { RuntimeCache } from './cache/types';
package/index.js CHANGED
@@ -20,7 +20,7 @@ var src_exports = {};
20
20
  __export(src_exports, {
21
21
  geolocation: () => import_headers.geolocation,
22
22
  getEnv: () => import_get_env.getEnv,
23
- getFunctionCache: () => import_cache.getFunctionCache,
23
+ getRuntimeCache: () => import_cache.getRuntimeCache,
24
24
  ipAddress: () => import_headers.ipAddress,
25
25
  next: () => import_middleware.next,
26
26
  rewrite: () => import_middleware.rewrite,
@@ -36,7 +36,7 @@ var import_cache = require("./cache");
36
36
  0 && (module.exports = {
37
37
  geolocation,
38
38
  getEnv,
39
- getFunctionCache,
39
+ getRuntimeCache,
40
40
  ipAddress,
41
41
  next,
42
42
  rewrite,
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "require": "./middleware.js"
27
27
  }
28
28
  },
29
- "version": "2.0.2",
29
+ "version": "2.0.3",
30
30
  "repository": {
31
31
  "directory": "packages/functions",
32
32
  "type": "git",