@vercel/functions 3.7.7 → 3.8.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/deadline.d.ts +5 -0
- package/deadline.js +39 -0
- package/docs/index/README.md +1 -0
- package/docs/index/functions/getDeadline.md +16 -0
- package/get-context.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/deadline.d.ts
ADDED
package/deadline.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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 deadline_exports = {};
|
|
20
|
+
__export(deadline_exports, {
|
|
21
|
+
getDeadline: () => getDeadline
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(deadline_exports);
|
|
24
|
+
var import_get_context = require("./get-context");
|
|
25
|
+
function getDeadline() {
|
|
26
|
+
const deadline = (0, import_get_context.getContext)().deadline;
|
|
27
|
+
if (deadline === void 0) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
const date = new Date(deadline);
|
|
31
|
+
if (isNaN(date.getTime())) {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
return date;
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
getDeadline
|
|
39
|
+
});
|
package/docs/index/README.md
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
- [experimental_upgradeWebSocket](functions/experimental_upgradeWebSocket.md)
|
|
34
34
|
- [geolocation](functions/geolocation.md)
|
|
35
35
|
- [getCache](functions/getCache.md)
|
|
36
|
+
- [getDeadline](functions/getDeadline.md)
|
|
36
37
|
- [getEnv](functions/getEnv.md)
|
|
37
38
|
- [invalidateBySrcImage](functions/invalidateBySrcImage.md)
|
|
38
39
|
- [invalidateByTag](functions/invalidateByTag.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[**@vercel/functions**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# Function: getDeadline()
|
|
6
|
+
|
|
7
|
+
> **getDeadline**(): [`Date`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \| `undefined`
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/functions/src/deadline.ts:7](https://github.com/vercel/vercel/blob/main/packages/functions/src/deadline.ts#L7)
|
|
10
|
+
|
|
11
|
+
Returns the shared invocation deadline for the
|
|
12
|
+
current function invocation, as a Date object.
|
|
13
|
+
|
|
14
|
+
## Returns
|
|
15
|
+
|
|
16
|
+
[`Date`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \| `undefined`
|
package/get-context.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { Request, Geo } from './headers';
|
|
2
2
|
export { geolocation, ipAddress } from './headers';
|
|
3
3
|
export { getEnv } from './get-env';
|
|
4
|
+
export { getDeadline } from './deadline';
|
|
4
5
|
export { waitUntil } from './wait-until';
|
|
5
6
|
export { rewrite, next } from './middleware';
|
|
6
7
|
export { getCache } from './cache';
|
package/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(src_exports, {
|
|
|
26
26
|
experimental_upgradeWebSocket: () => import_websocket.experimental_upgradeWebSocket,
|
|
27
27
|
geolocation: () => import_headers.geolocation,
|
|
28
28
|
getCache: () => import_cache.getCache,
|
|
29
|
+
getDeadline: () => import_deadline.getDeadline,
|
|
29
30
|
getEnv: () => import_get_env.getEnv,
|
|
30
31
|
invalidateBySrcImage: () => import_purge.invalidateBySrcImage,
|
|
31
32
|
invalidateByTag: () => import_purge.invalidateByTag,
|
|
@@ -37,6 +38,7 @@ __export(src_exports, {
|
|
|
37
38
|
module.exports = __toCommonJS(src_exports);
|
|
38
39
|
var import_headers = require("./headers");
|
|
39
40
|
var import_get_env = require("./get-env");
|
|
41
|
+
var import_deadline = require("./deadline");
|
|
40
42
|
var import_wait_until = require("./wait-until");
|
|
41
43
|
var import_middleware = require("./middleware");
|
|
42
44
|
var import_cache = require("./cache");
|
|
@@ -54,6 +56,7 @@ var import_websocket = require("./websocket");
|
|
|
54
56
|
experimental_upgradeWebSocket,
|
|
55
57
|
geolocation,
|
|
56
58
|
getCache,
|
|
59
|
+
getDeadline,
|
|
57
60
|
getEnv,
|
|
58
61
|
invalidateBySrcImage,
|
|
59
62
|
invalidateByTag,
|