@vercel/functions 3.2.0 → 3.3.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 +6 -0
- package/addcachetag/index.d.ts +1 -0
- package/addcachetag/index.js +35 -0
- package/addcachetag/types.d.ts +12 -0
- package/addcachetag/types.js +16 -0
- package/docs/interfaces/index.AddCacheTagApi.md +39 -0
- package/docs/modules/index.md +22 -0
- package/get-context.d.ts +2 -0
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const addCacheTag: (tag: string | string[]) => Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var addcachetag_exports = {};
|
|
20
|
+
__export(addcachetag_exports, {
|
|
21
|
+
addCacheTag: () => addCacheTag
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(addcachetag_exports);
|
|
24
|
+
var import_get_context = require("../get-context");
|
|
25
|
+
const addCacheTag = (tag) => {
|
|
26
|
+
const api = (0, import_get_context.getContext)().addCacheTag;
|
|
27
|
+
if (api) {
|
|
28
|
+
return api.addCacheTag(tag);
|
|
29
|
+
}
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
};
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
addCacheTag
|
|
35
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel AddCacheTag API.
|
|
3
|
+
*/
|
|
4
|
+
export interface AddCacheTagApi {
|
|
5
|
+
/**
|
|
6
|
+
* Add one or more tags to the cache content
|
|
7
|
+
*
|
|
8
|
+
* @param tag One or more tags to add to the cache content.
|
|
9
|
+
* @returns A promise that resolves when the tag is added.
|
|
10
|
+
*/
|
|
11
|
+
addCacheTag: (tag: string | string[]) => Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Interface: AddCacheTagApi
|
|
2
|
+
|
|
3
|
+
[index](../modules/index.md).AddCacheTagApi
|
|
4
|
+
|
|
5
|
+
Vercel AddCacheTag API.
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
### Properties
|
|
10
|
+
|
|
11
|
+
- [addCacheTag](index.AddCacheTagApi.md#addcachetag)
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
### addCacheTag
|
|
16
|
+
|
|
17
|
+
• **addCacheTag**: (`tag`: `string` \| `string`[]) => [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
18
|
+
|
|
19
|
+
#### Type declaration
|
|
20
|
+
|
|
21
|
+
▸ (`tag`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
22
|
+
|
|
23
|
+
Add one or more tags to the cache content
|
|
24
|
+
|
|
25
|
+
##### Parameters
|
|
26
|
+
|
|
27
|
+
| Name | Type | Description |
|
|
28
|
+
| :---- | :--------------------- | :-------------------------------------------- |
|
|
29
|
+
| `tag` | `string` \| `string`[] | One or more tags to add to the cache content. |
|
|
30
|
+
|
|
31
|
+
##### Returns
|
|
32
|
+
|
|
33
|
+
[`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
34
|
+
|
|
35
|
+
A promise that resolves when the tag is added.
|
|
36
|
+
|
|
37
|
+
#### Defined in
|
|
38
|
+
|
|
39
|
+
[packages/functions/src/addcachetag/types.ts:11](https://github.com/vercel/vercel/blob/main/packages/functions/src/addcachetag/types.ts#L11)
|
package/docs/modules/index.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### Interfaces
|
|
6
6
|
|
|
7
|
+
- [AddCacheTagApi](../interfaces/index.AddCacheTagApi.md)
|
|
7
8
|
- [DangerouslyDeleteOptions](../interfaces/index.DangerouslyDeleteOptions.md)
|
|
8
9
|
- [Geo](../interfaces/index.Geo.md)
|
|
9
10
|
- [PurgeApi](../interfaces/index.PurgeApi.md)
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
|
|
13
14
|
### Functions
|
|
14
15
|
|
|
16
|
+
- [addCacheTag](index.md#addcachetag)
|
|
15
17
|
- [attachDatabasePool](index.md#attachdatabasepool)
|
|
16
18
|
- [dangerouslyDeleteBySrcImage](index.md#dangerouslydeletebysrcimage)
|
|
17
19
|
- [dangerouslyDeleteByTag](index.md#dangerouslydeletebytag)
|
|
@@ -28,6 +30,26 @@
|
|
|
28
30
|
|
|
29
31
|
## Functions
|
|
30
32
|
|
|
33
|
+
### addCacheTag
|
|
34
|
+
|
|
35
|
+
▸ **addCacheTag**(`tag`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
36
|
+
|
|
37
|
+
#### Parameters
|
|
38
|
+
|
|
39
|
+
| Name | Type |
|
|
40
|
+
| :---- | :--------------------- |
|
|
41
|
+
| `tag` | `string` \| `string`[] |
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
[`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`void`\>
|
|
46
|
+
|
|
47
|
+
#### Defined in
|
|
48
|
+
|
|
49
|
+
[packages/functions/src/addcachetag/index.ts:3](https://github.com/vercel/vercel/blob/main/packages/functions/src/addcachetag/index.ts#L3)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
31
53
|
### attachDatabasePool
|
|
32
54
|
|
|
33
55
|
▸ **attachDatabasePool**(`dbPool`): `void`
|
package/get-context.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { RuntimeCache } from './cache/types';
|
|
2
2
|
import { PurgeApi } from './purge/types';
|
|
3
|
+
import { AddCacheTagApi } from './addcachetag/types';
|
|
3
4
|
type Context = {
|
|
4
5
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
5
6
|
cache?: RuntimeCache;
|
|
6
7
|
purge?: PurgeApi;
|
|
8
|
+
addCacheTag?: AddCacheTagApi;
|
|
7
9
|
headers?: Record<string, string>;
|
|
8
10
|
};
|
|
9
11
|
export declare const SYMBOL_FOR_REQ_CONTEXT: unique symbol;
|
package/index.d.ts
CHANGED
|
@@ -8,3 +8,5 @@ export { attachDatabasePool, experimental_attachDatabasePool, } from './db-conne
|
|
|
8
8
|
export type { RuntimeCache } from './cache/types';
|
|
9
9
|
export { invalidateByTag, dangerouslyDeleteByTag, invalidateBySrcImage, dangerouslyDeleteBySrcImage, } from './purge';
|
|
10
10
|
export type { PurgeApi, DangerouslyDeleteOptions } from './purge/types';
|
|
11
|
+
export { addCacheTag } from './addcachetag';
|
|
12
|
+
export type { AddCacheTagApi } from './addcachetag/types';
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var src_exports = {};
|
|
20
20
|
__export(src_exports, {
|
|
21
|
+
addCacheTag: () => import_addcachetag.addCacheTag,
|
|
21
22
|
attachDatabasePool: () => import_db_connections.attachDatabasePool,
|
|
22
23
|
dangerouslyDeleteBySrcImage: () => import_purge.dangerouslyDeleteBySrcImage,
|
|
23
24
|
dangerouslyDeleteByTag: () => import_purge.dangerouslyDeleteByTag,
|
|
@@ -40,8 +41,10 @@ var import_middleware = require("./middleware");
|
|
|
40
41
|
var import_cache = require("./cache");
|
|
41
42
|
var import_db_connections = require("./db-connections");
|
|
42
43
|
var import_purge = require("./purge");
|
|
44
|
+
var import_addcachetag = require("./addcachetag");
|
|
43
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
46
|
0 && (module.exports = {
|
|
47
|
+
addCacheTag,
|
|
45
48
|
attachDatabasePool,
|
|
46
49
|
dangerouslyDeleteBySrcImage,
|
|
47
50
|
dangerouslyDeleteByTag,
|