@vercel/functions 1.2.0 → 1.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.
@@ -0,0 +1,133 @@
1
+ export declare const getEnv: (env?: {
2
+ [key: string]: string | undefined;
3
+ }) => {
4
+ /**
5
+ * An indicator to show that System Environment Variables have been exposed to your project's Deployments.
6
+ * @example "1"
7
+ */
8
+ VERCEL: string | undefined;
9
+ /**
10
+ * An indicator that the code is running in a Continuous Integration environment.
11
+ * @example "1"
12
+ */
13
+ CI: string | undefined;
14
+ /**
15
+ * The Environment that the app is deployed and running on.
16
+ * @example "production"
17
+ */
18
+ VERCEL_ENV: string | undefined;
19
+ /**
20
+ * The domain name of the generated deployment URL. The value does not include the protocol scheme https://.
21
+ * NOTE: This Variable cannot be used in conjunction with Standard Deployment Protection.
22
+ * @example "*.vercel.app"
23
+ */
24
+ VERCEL_URL: string | undefined;
25
+ /**
26
+ * The domain name of the generated Git branch URL. The value does not include the protocol scheme https://.
27
+ * @example "*-git-*.vercel.app"
28
+ */
29
+ VERCEL_BRANCH_URL: string | undefined;
30
+ /**
31
+ * A production domain name of the project. This is useful to reliably generate links that point to production such as OG-image URLs.
32
+ * The value does not include the protocol scheme https://.
33
+ * @example "myproject.vercel.app"
34
+ */
35
+ VERCEL_PROJECT_PRODUCTION_URL: string | undefined;
36
+ /**
37
+ * The ID of the Region where the app is running.
38
+ *
39
+ * Possible values:
40
+ * - arn1 (Stockholm, Sweden)
41
+ * - bom1 (Mumbai, India)
42
+ * - cdg1 (Paris, France)
43
+ * - cle1 (Cleveland, USA)
44
+ * - cpt1 (Cape Town, South Africa)
45
+ * - dub1 (Dublin, Ireland)
46
+ * - fra1 (Frankfurt, Germany)
47
+ * - gru1 (São Paulo, Brazil)
48
+ * - hkg1 (Hong Kong)
49
+ * - hnd1 (Tokyo, Japan)
50
+ * - iad1 (Washington, D.C., USA)
51
+ * - icn1 (Seoul, South Korea)
52
+ * - kix1 (Osaka, Japan)
53
+ * - lhr1 (London, United Kingdom)
54
+ * - pdx1 (Portland, USA)
55
+ * - sfo1 (San Francisco, USA)
56
+ * - sin1 (Singapore)
57
+ * - syd1 (Sydney, Australia)
58
+ * - dev1 (Development Region)
59
+ *
60
+ * @example "iad1"
61
+ */
62
+ VERCEL_REGION: string | undefined;
63
+ /**
64
+ * The unique identifier for the deployment, which can be used to implement Skew Protection.
65
+ * @example "dpl_7Gw5ZMBpQA8h9GF832KGp7nwbuh3"
66
+ */
67
+ VERCEL_DEPLOYMENT_ID: string | undefined;
68
+ /**
69
+ * When Skew Protection is enabled in Project Settings, this value is set to 1.
70
+ * @example "1"
71
+ */
72
+ VERCEL_SKEW_PROTECTION_ENABLED: string | undefined;
73
+ /**
74
+ * The Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings.
75
+ */
76
+ VERCEL_AUTOMATION_BYPASS_SECRET: string | undefined;
77
+ /**
78
+ * The Git Provider the deployment is triggered from.
79
+ * @example "github"
80
+ */
81
+ VERCEL_GIT_PROVIDER: string | undefined;
82
+ /**
83
+ * The origin repository the deployment is triggered from.
84
+ * @example "my-site"
85
+ */
86
+ VERCEL_GIT_REPO_SLUG: string | undefined;
87
+ /**
88
+ * The account that owns the repository the deployment is triggered from.
89
+ * @example "acme"
90
+ */
91
+ VERCEL_GIT_REPO_OWNER: string | undefined;
92
+ /**
93
+ * The ID of the repository the deployment is triggered from.
94
+ * @example "117716146"
95
+ */
96
+ VERCEL_GIT_REPO_ID: string | undefined;
97
+ /**
98
+ * The git branch of the commit the deployment was triggered by.
99
+ * @example "improve-about-page"
100
+ */
101
+ VERCEL_GIT_COMMIT_REF: string | undefined;
102
+ /**
103
+ * The git SHA of the commit the deployment was triggered by.
104
+ * @example "fa1eade47b73733d6312d5abfad33ce9e4068081"
105
+ */
106
+ VERCEL_GIT_COMMIT_SHA: string | undefined;
107
+ /**
108
+ * The message attached to the commit the deployment was triggered by.
109
+ * @example "Update about page"
110
+ */
111
+ VERCEL_GIT_COMMIT_MESSAGE: string | undefined;
112
+ /**
113
+ * The username attached to the author of the commit that the project was deployed by.
114
+ * @example "johndoe"
115
+ */
116
+ VERCEL_GIT_COMMIT_AUTHOR_LOGIN: string | undefined;
117
+ /**
118
+ * The name attached to the author of the commit that the project was deployed by.
119
+ * @example "John Doe"
120
+ */
121
+ VERCEL_GIT_COMMIT_AUTHOR_NAME: string | undefined;
122
+ /**
123
+ * The git SHA of the last successful deployment for the project and branch.
124
+ * NOTE: This Variable is only exposed when an Ignored Build Step is provided.
125
+ * @example "fa1eade47b73733d6312d5abfad33ce9e4068080"
126
+ */
127
+ VERCEL_GIT_PREVIOUS_SHA: string | undefined;
128
+ /**
129
+ * The pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string.
130
+ * @example "23"
131
+ */
132
+ VERCEL_GIT_PULL_REQUEST_ID: string | undefined;
133
+ };
@@ -0,0 +1,162 @@
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 get_env_exports = {};
20
+ __export(get_env_exports, {
21
+ getEnv: () => getEnv
22
+ });
23
+ module.exports = __toCommonJS(get_env_exports);
24
+ const getEnv = (env = process.env) => ({
25
+ /**
26
+ * An indicator to show that System Environment Variables have been exposed to your project's Deployments.
27
+ * @example "1"
28
+ */
29
+ VERCEL: get(env, "VERCEL"),
30
+ /**
31
+ * An indicator that the code is running in a Continuous Integration environment.
32
+ * @example "1"
33
+ */
34
+ CI: get(env, "CI"),
35
+ /**
36
+ * The Environment that the app is deployed and running on.
37
+ * @example "production"
38
+ */
39
+ VERCEL_ENV: get(env, "VERCEL_ENV"),
40
+ /**
41
+ * The domain name of the generated deployment URL. The value does not include the protocol scheme https://.
42
+ * NOTE: This Variable cannot be used in conjunction with Standard Deployment Protection.
43
+ * @example "*.vercel.app"
44
+ */
45
+ VERCEL_URL: get(env, "VERCEL_URL"),
46
+ /**
47
+ * The domain name of the generated Git branch URL. The value does not include the protocol scheme https://.
48
+ * @example "*-git-*.vercel.app"
49
+ */
50
+ VERCEL_BRANCH_URL: get(env, "VERCEL_BRANCH_URL"),
51
+ /**
52
+ * A production domain name of the project. This is useful to reliably generate links that point to production such as OG-image URLs.
53
+ * The value does not include the protocol scheme https://.
54
+ * @example "myproject.vercel.app"
55
+ */
56
+ VERCEL_PROJECT_PRODUCTION_URL: get(env, "VERCEL_PROJECT_PRODUCTION_URL"),
57
+ /**
58
+ * The ID of the Region where the app is running.
59
+ *
60
+ * Possible values:
61
+ * - arn1 (Stockholm, Sweden)
62
+ * - bom1 (Mumbai, India)
63
+ * - cdg1 (Paris, France)
64
+ * - cle1 (Cleveland, USA)
65
+ * - cpt1 (Cape Town, South Africa)
66
+ * - dub1 (Dublin, Ireland)
67
+ * - fra1 (Frankfurt, Germany)
68
+ * - gru1 (São Paulo, Brazil)
69
+ * - hkg1 (Hong Kong)
70
+ * - hnd1 (Tokyo, Japan)
71
+ * - iad1 (Washington, D.C., USA)
72
+ * - icn1 (Seoul, South Korea)
73
+ * - kix1 (Osaka, Japan)
74
+ * - lhr1 (London, United Kingdom)
75
+ * - pdx1 (Portland, USA)
76
+ * - sfo1 (San Francisco, USA)
77
+ * - sin1 (Singapore)
78
+ * - syd1 (Sydney, Australia)
79
+ * - dev1 (Development Region)
80
+ *
81
+ * @example "iad1"
82
+ */
83
+ VERCEL_REGION: get(env, "VERCEL_REGION"),
84
+ /**
85
+ * The unique identifier for the deployment, which can be used to implement Skew Protection.
86
+ * @example "dpl_7Gw5ZMBpQA8h9GF832KGp7nwbuh3"
87
+ */
88
+ VERCEL_DEPLOYMENT_ID: get(env, "VERCEL_DEPLOYMENT_ID"),
89
+ /**
90
+ * When Skew Protection is enabled in Project Settings, this value is set to 1.
91
+ * @example "1"
92
+ */
93
+ VERCEL_SKEW_PROTECTION_ENABLED: get(env, "VERCEL_SKEW_PROTECTION_ENABLED"),
94
+ /**
95
+ * The Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings.
96
+ */
97
+ VERCEL_AUTOMATION_BYPASS_SECRET: get(env, "VERCEL_AUTOMATION_BYPASS_SECRET"),
98
+ /**
99
+ * The Git Provider the deployment is triggered from.
100
+ * @example "github"
101
+ */
102
+ VERCEL_GIT_PROVIDER: get(env, "VERCEL_GIT_PROVIDER"),
103
+ /**
104
+ * The origin repository the deployment is triggered from.
105
+ * @example "my-site"
106
+ */
107
+ VERCEL_GIT_REPO_SLUG: get(env, "VERCEL_GIT_REPO_SLUG"),
108
+ /**
109
+ * The account that owns the repository the deployment is triggered from.
110
+ * @example "acme"
111
+ */
112
+ VERCEL_GIT_REPO_OWNER: get(env, "VERCEL_GIT_REPO_OWNER"),
113
+ /**
114
+ * The ID of the repository the deployment is triggered from.
115
+ * @example "117716146"
116
+ */
117
+ VERCEL_GIT_REPO_ID: get(env, "VERCEL_GIT_REPO_ID"),
118
+ /**
119
+ * The git branch of the commit the deployment was triggered by.
120
+ * @example "improve-about-page"
121
+ */
122
+ VERCEL_GIT_COMMIT_REF: get(env, "VERCEL_GIT_COMMIT_REF"),
123
+ /**
124
+ * The git SHA of the commit the deployment was triggered by.
125
+ * @example "fa1eade47b73733d6312d5abfad33ce9e4068081"
126
+ */
127
+ VERCEL_GIT_COMMIT_SHA: get(env, "VERCEL_GIT_COMMIT_SHA"),
128
+ /**
129
+ * The message attached to the commit the deployment was triggered by.
130
+ * @example "Update about page"
131
+ */
132
+ VERCEL_GIT_COMMIT_MESSAGE: get(env, "VERCEL_GIT_COMMIT_MESSAGE"),
133
+ /**
134
+ * The username attached to the author of the commit that the project was deployed by.
135
+ * @example "johndoe"
136
+ */
137
+ VERCEL_GIT_COMMIT_AUTHOR_LOGIN: get(env, "VERCEL_GIT_COMMIT_AUTHOR_LOGIN"),
138
+ /**
139
+ * The name attached to the author of the commit that the project was deployed by.
140
+ * @example "John Doe"
141
+ */
142
+ VERCEL_GIT_COMMIT_AUTHOR_NAME: get(env, "VERCEL_GIT_COMMIT_AUTHOR_NAME"),
143
+ /**
144
+ * The git SHA of the last successful deployment for the project and branch.
145
+ * NOTE: This Variable is only exposed when an Ignored Build Step is provided.
146
+ * @example "fa1eade47b73733d6312d5abfad33ce9e4068080"
147
+ */
148
+ VERCEL_GIT_PREVIOUS_SHA: get(env, "VERCEL_GIT_PREVIOUS_SHA"),
149
+ /**
150
+ * The pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string.
151
+ * @example "23"
152
+ */
153
+ VERCEL_GIT_PULL_REQUEST_ID: get(env, "VERCEL_GIT_PULL_REQUEST_ID")
154
+ });
155
+ const get = (env, key) => {
156
+ const value = env[key];
157
+ return value === "" ? void 0 : value;
158
+ };
159
+ // Annotate the CommonJS export names for ESM import in node:
160
+ 0 && (module.exports = {
161
+ getEnv
162
+ });
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { geolocation, ipAddress } from './headers';
2
+ export { getEnv } from './get-env';
2
3
  export { waitUntil } from './wait-until';
package/dist/index.js CHANGED
@@ -19,15 +19,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var src_exports = {};
20
20
  __export(src_exports, {
21
21
  geolocation: () => import_headers.geolocation,
22
+ getEnv: () => import_get_env.getEnv,
22
23
  ipAddress: () => import_headers.ipAddress,
23
24
  waitUntil: () => import_wait_until.waitUntil
24
25
  });
25
26
  module.exports = __toCommonJS(src_exports);
26
27
  var import_headers = require("./headers");
28
+ var import_get_env = require("./get-env");
27
29
  var import_wait_until = require("./wait-until");
28
30
  // Annotate the CommonJS export names for ESM import in node:
29
31
  0 && (module.exports = {
30
32
  geolocation,
33
+ getEnv,
31
34
  ipAddress,
32
35
  waitUntil
33
36
  });
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "types": "./dist/index.d.ts",
12
- "version": "1.2.0",
12
+ "version": "1.3.0",
13
13
  "repository": {
14
14
  "directory": "packages/functions",
15
15
  "type": "git",