netlify-cli 16.6.2 → 16.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.
Files changed (93) hide show
  1. package/npm-shrinkwrap.json +366 -1042
  2. package/package.json +4 -4
  3. package/src/lib/build.mjs +3 -1
  4. package/src/lib/edge-functions/consts.mjs +1 -0
  5. package/src/lib/edge-functions/proxy.mjs +1 -2
  6. package/src/lib/edge-functions/registry.mjs +15 -19
  7. package/src/utils/deploy/hash-fns.mjs +9 -3
  8. package/src/functions-templates/javascript/apollo-graphql/.netlify-function-template.mjs +0 -5
  9. package/src/functions-templates/javascript/apollo-graphql/package.json +0 -21
  10. package/src/functions-templates/javascript/apollo-graphql/{{name}}.js +0 -42
  11. package/src/functions-templates/javascript/apollo-graphql-rest/.netlify-function-template.mjs +0 -5
  12. package/src/functions-templates/javascript/apollo-graphql-rest/package.json +0 -22
  13. package/src/functions-templates/javascript/apollo-graphql-rest/random-user.js +0 -23
  14. package/src/functions-templates/javascript/apollo-graphql-rest/{{name}}.js +0 -68
  15. package/src/functions-templates/javascript/auth-fetch/.netlify-function-template.mjs +0 -11
  16. package/src/functions-templates/javascript/auth-fetch/package-lock.json +0 -83
  17. package/src/functions-templates/javascript/auth-fetch/package.json +0 -21
  18. package/src/functions-templates/javascript/auth-fetch/{{name}}.js +0 -39
  19. package/src/functions-templates/javascript/create-user/.netlify-function-template.mjs +0 -11
  20. package/src/functions-templates/javascript/create-user/package.json +0 -21
  21. package/src/functions-templates/javascript/create-user/{{name}}.js +0 -36
  22. package/src/functions-templates/javascript/fauna-crud/.netlify-function-template.mjs +0 -17
  23. package/src/functions-templates/javascript/fauna-crud/create-schema.js +0 -36
  24. package/src/functions-templates/javascript/fauna-crud/create.js +0 -37
  25. package/src/functions-templates/javascript/fauna-crud/delete.js +0 -29
  26. package/src/functions-templates/javascript/fauna-crud/package.json +0 -20
  27. package/src/functions-templates/javascript/fauna-crud/read-all.js +0 -33
  28. package/src/functions-templates/javascript/fauna-crud/read.js +0 -30
  29. package/src/functions-templates/javascript/fauna-crud/update.js +0 -30
  30. package/src/functions-templates/javascript/fauna-crud/{{name}}.js +0 -62
  31. package/src/functions-templates/javascript/fauna-graphql/.netlify-function-template.mjs +0 -17
  32. package/src/functions-templates/javascript/fauna-graphql/package.json +0 -26
  33. package/src/functions-templates/javascript/fauna-graphql/schema.graphql +0 -8
  34. package/src/functions-templates/javascript/fauna-graphql/sync-schema.js +0 -38
  35. package/src/functions-templates/javascript/fauna-graphql/{{name}}.js +0 -46
  36. package/src/functions-templates/javascript/google-analytics/.netlify-function-template.mjs +0 -5
  37. package/src/functions-templates/javascript/google-analytics/package-lock.json +0 -100
  38. package/src/functions-templates/javascript/google-analytics/package.json +0 -25
  39. package/src/functions-templates/javascript/google-analytics/{{name}}.js +0 -114
  40. package/src/functions-templates/javascript/graphql-gateway/.netlify-function-template.mjs +0 -5
  41. package/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-1.js +0 -42
  42. package/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-2.js +0 -80
  43. package/src/functions-templates/javascript/graphql-gateway/package.json +0 -24
  44. package/src/functions-templates/javascript/graphql-gateway/{{name}}.js +0 -75
  45. package/src/functions-templates/javascript/hasura-event-triggered/.netlify-function-template.mjs +0 -5
  46. package/src/functions-templates/javascript/hasura-event-triggered/package.json +0 -21
  47. package/src/functions-templates/javascript/hasura-event-triggered/{{name}}.js +0 -40
  48. package/src/functions-templates/javascript/node-fetch/.netlify-function-template.mjs +0 -5
  49. package/src/functions-templates/javascript/node-fetch/package.json +0 -19
  50. package/src/functions-templates/javascript/node-fetch/{{name}}.js +0 -29
  51. package/src/functions-templates/javascript/oauth-passport/.netlify-function-template.mjs +0 -5
  52. package/src/functions-templates/javascript/oauth-passport/package.json +0 -25
  53. package/src/functions-templates/javascript/oauth-passport/utils/auth.js +0 -65
  54. package/src/functions-templates/javascript/oauth-passport/utils/config.js +0 -24
  55. package/src/functions-templates/javascript/oauth-passport/{{name}}.js +0 -37
  56. package/src/functions-templates/javascript/protected-function/.netlify-function-template.mjs +0 -5
  57. package/src/functions-templates/javascript/protected-function/{{name}}.js +0 -25
  58. package/src/functions-templates/javascript/send-email/.netlify-function-template.mjs +0 -5
  59. package/src/functions-templates/javascript/send-email/package.json +0 -21
  60. package/src/functions-templates/javascript/send-email/validations.js +0 -38
  61. package/src/functions-templates/javascript/send-email/{{name}}.js +0 -68
  62. package/src/functions-templates/javascript/serverless-ssr/.netlify-function-template.mjs +0 -5
  63. package/src/functions-templates/javascript/serverless-ssr/app/index.js +0 -116
  64. package/src/functions-templates/javascript/serverless-ssr/package.json +0 -24
  65. package/src/functions-templates/javascript/serverless-ssr/serverless-http.js +0 -15
  66. package/src/functions-templates/javascript/serverless-ssr/{{name}}.js +0 -15
  67. package/src/functions-templates/javascript/set-cookie/.netlify-function-template.mjs +0 -5
  68. package/src/functions-templates/javascript/set-cookie/package.json +0 -19
  69. package/src/functions-templates/javascript/set-cookie/{{name}}.js +0 -44
  70. package/src/functions-templates/javascript/slack-rate-limit/.netlify-function-template.mjs +0 -5
  71. package/src/functions-templates/javascript/slack-rate-limit/package.json +0 -20
  72. package/src/functions-templates/javascript/slack-rate-limit/{{name}}.js +0 -115
  73. package/src/functions-templates/javascript/stripe-charge/.netlify-function-template.mjs +0 -28
  74. package/src/functions-templates/javascript/stripe-charge/package-lock.json +0 -196
  75. package/src/functions-templates/javascript/stripe-charge/package.json +0 -21
  76. package/src/functions-templates/javascript/stripe-charge/{{name}}.js +0 -56
  77. package/src/functions-templates/javascript/stripe-subscription/.netlify-function-template.mjs +0 -28
  78. package/src/functions-templates/javascript/stripe-subscription/package-lock.json +0 -196
  79. package/src/functions-templates/javascript/stripe-subscription/package.json +0 -21
  80. package/src/functions-templates/javascript/stripe-subscription/{{name}}.js +0 -52
  81. package/src/functions-templates/javascript/token-hider/.netlify-function-template.mjs +0 -29
  82. package/src/functions-templates/javascript/token-hider/package-lock.json +0 -317
  83. package/src/functions-templates/javascript/token-hider/package.json +0 -21
  84. package/src/functions-templates/javascript/token-hider/{{name}}.js +0 -37
  85. package/src/functions-templates/javascript/url-shortener/.netlify-function-template.mjs +0 -29
  86. package/src/functions-templates/javascript/url-shortener/generate-route.js +0 -53
  87. package/src/functions-templates/javascript/url-shortener/get-route.js +0 -32
  88. package/src/functions-templates/javascript/url-shortener/package-lock.json +0 -126
  89. package/src/functions-templates/javascript/url-shortener/package.json +0 -22
  90. package/src/functions-templates/javascript/url-shortener/{{name}}.js +0 -30
  91. package/src/functions-templates/javascript/using-middleware/.netlify-function-template.mjs +0 -5
  92. package/src/functions-templates/javascript/using-middleware/package.json +0 -19
  93. package/src/functions-templates/javascript/using-middleware/{{name}}.js +0 -60
@@ -1,56 +0,0 @@
1
- // with thanks https://github.com/alexmacarthur/netlify-lambda-function-example/blob/68a0cdc05e201d68fe80b0926b0af7ff88f15802/lambda-src/purchase.js
2
- const process = require('process')
3
-
4
- const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY)
5
-
6
- const statusCode = 200
7
- const headers = {
8
- 'Access-Control-Allow-Origin': '*',
9
- 'Access-Control-Allow-Headers': 'Content-Type',
10
- }
11
-
12
- const handler = async function (event) {
13
- // -- We only care to do anything if this is our POST request.
14
- if (event.httpMethod !== 'POST' || !event.body) {
15
- return {
16
- statusCode,
17
- headers,
18
- body: '',
19
- }
20
- }
21
-
22
- // -- Parse the body contents into an object.
23
- const data = JSON.parse(event.body)
24
-
25
- // -- Make sure we have all required data. Otherwise, escape.
26
- if (!data.token || !data.amount || !data.idempotency_key) {
27
- console.error('Required information is missing.')
28
-
29
- return {
30
- statusCode,
31
- headers,
32
- body: JSON.stringify({ status: 'missing-information' }),
33
- }
34
- }
35
-
36
- try {
37
- const charge = await stripe.charges.create(
38
- {
39
- currency: 'usd',
40
- amount: data.amount,
41
- source: data.token.id,
42
- receipt_email: data.token.email,
43
- description: `charge for a widget`,
44
- },
45
- {
46
- idempotency_key: data.idempotency_key,
47
- },
48
- )
49
- const status = charge === null || charge.status !== 'succeeded' ? 'failed' : charge.status
50
- return { statusCode, headers, body: JSON.stringify({ status }) }
51
- } catch (error) {
52
- return { statusCode: 500, error: error.message }
53
- }
54
- }
55
-
56
- module.exports = { handler }
@@ -1,28 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- export default {
4
- name: 'stripe-subscription',
5
- description: 'Stripe subscription: Create a subscription with Stripe',
6
- functionType: 'serverless',
7
- async onComplete() {
8
- console.log(`${chalk.yellow('stripe-subscription')} function created from template!`)
9
- if (!process.env.STRIPE_SECRET_KEY) {
10
- console.log(
11
- `note this function requires ${chalk.yellow(
12
- 'STRIPE_SECRET_KEY',
13
- )} build environment variable set in your Netlify Site.`,
14
- )
15
- let siteData = { name: 'YOURSITENAMEHERE' }
16
- try {
17
- siteData = await this.netlify.api.getSite({
18
- siteId: this.netlify.site.id,
19
- })
20
- } catch (e) {
21
- // silent error, not important
22
- }
23
- console.log(
24
- `Set it at: https://app.netlify.com/sites/${siteData.name}/settings/deploys#environment-variables (must have CD setup)`,
25
- )
26
- }
27
- },
28
- }
@@ -1,196 +0,0 @@
1
- {
2
- "name": "stripe-subscription",
3
- "version": "1.0.0",
4
- "lockfileVersion": 2,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "stripe-subscription",
9
- "version": "1.0.0",
10
- "license": "MIT",
11
- "dependencies": {
12
- "stripe": "^10.0.0"
13
- }
14
- },
15
- "node_modules/@types/node": {
16
- "version": "17.0.2",
17
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
18
- "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA=="
19
- },
20
- "node_modules/call-bind": {
21
- "version": "1.0.2",
22
- "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
23
- "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
24
- "dependencies": {
25
- "function-bind": "^1.1.1",
26
- "get-intrinsic": "^1.0.2"
27
- },
28
- "funding": {
29
- "url": "https://github.com/sponsors/ljharb"
30
- }
31
- },
32
- "node_modules/function-bind": {
33
- "version": "1.1.1",
34
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
35
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
36
- },
37
- "node_modules/get-intrinsic": {
38
- "version": "1.1.1",
39
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
40
- "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
41
- "dependencies": {
42
- "function-bind": "^1.1.1",
43
- "has": "^1.0.3",
44
- "has-symbols": "^1.0.1"
45
- },
46
- "funding": {
47
- "url": "https://github.com/sponsors/ljharb"
48
- }
49
- },
50
- "node_modules/has": {
51
- "version": "1.0.3",
52
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
53
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
54
- "dependencies": {
55
- "function-bind": "^1.1.1"
56
- },
57
- "engines": {
58
- "node": ">= 0.4.0"
59
- }
60
- },
61
- "node_modules/has-symbols": {
62
- "version": "1.0.2",
63
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
64
- "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
65
- "engines": {
66
- "node": ">= 0.4"
67
- },
68
- "funding": {
69
- "url": "https://github.com/sponsors/ljharb"
70
- }
71
- },
72
- "node_modules/object-inspect": {
73
- "version": "1.12.0",
74
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz",
75
- "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==",
76
- "funding": {
77
- "url": "https://github.com/sponsors/ljharb"
78
- }
79
- },
80
- "node_modules/qs": {
81
- "version": "6.11.0",
82
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
83
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
84
- "dependencies": {
85
- "side-channel": "^1.0.4"
86
- },
87
- "engines": {
88
- "node": ">=0.6"
89
- },
90
- "funding": {
91
- "url": "https://github.com/sponsors/ljharb"
92
- }
93
- },
94
- "node_modules/side-channel": {
95
- "version": "1.0.4",
96
- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
97
- "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
98
- "dependencies": {
99
- "call-bind": "^1.0.0",
100
- "get-intrinsic": "^1.0.2",
101
- "object-inspect": "^1.9.0"
102
- },
103
- "funding": {
104
- "url": "https://github.com/sponsors/ljharb"
105
- }
106
- },
107
- "node_modules/stripe": {
108
- "version": "10.17.0",
109
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.17.0.tgz",
110
- "integrity": "sha512-JHV2KoL+nMQRXu3m9ervCZZvi4DDCJfzHUE6CmtJxR9TmizyYfrVuhGvnsZLLnheby9Qrnf4Hq6iOEcejGwnGQ==",
111
- "dependencies": {
112
- "@types/node": ">=8.1.0",
113
- "qs": "^6.11.0"
114
- },
115
- "engines": {
116
- "node": "^8.1 || >=10.*"
117
- }
118
- }
119
- },
120
- "dependencies": {
121
- "@types/node": {
122
- "version": "17.0.2",
123
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
124
- "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA=="
125
- },
126
- "call-bind": {
127
- "version": "1.0.2",
128
- "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
129
- "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
130
- "requires": {
131
- "function-bind": "^1.1.1",
132
- "get-intrinsic": "^1.0.2"
133
- }
134
- },
135
- "function-bind": {
136
- "version": "1.1.1",
137
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
138
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
139
- },
140
- "get-intrinsic": {
141
- "version": "1.1.1",
142
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
143
- "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
144
- "requires": {
145
- "function-bind": "^1.1.1",
146
- "has": "^1.0.3",
147
- "has-symbols": "^1.0.1"
148
- }
149
- },
150
- "has": {
151
- "version": "1.0.3",
152
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
153
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
154
- "requires": {
155
- "function-bind": "^1.1.1"
156
- }
157
- },
158
- "has-symbols": {
159
- "version": "1.0.2",
160
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
161
- "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw=="
162
- },
163
- "object-inspect": {
164
- "version": "1.12.0",
165
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz",
166
- "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g=="
167
- },
168
- "qs": {
169
- "version": "6.11.0",
170
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
171
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
172
- "requires": {
173
- "side-channel": "^1.0.4"
174
- }
175
- },
176
- "side-channel": {
177
- "version": "1.0.4",
178
- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
179
- "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
180
- "requires": {
181
- "call-bind": "^1.0.0",
182
- "get-intrinsic": "^1.0.2",
183
- "object-inspect": "^1.9.0"
184
- }
185
- },
186
- "stripe": {
187
- "version": "10.17.0",
188
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.17.0.tgz",
189
- "integrity": "sha512-JHV2KoL+nMQRXu3m9ervCZZvi4DDCJfzHUE6CmtJxR9TmizyYfrVuhGvnsZLLnheby9Qrnf4Hq6iOEcejGwnGQ==",
190
- "requires": {
191
- "@types/node": ">=8.1.0",
192
- "qs": "^6.11.0"
193
- }
194
- }
195
- }
196
- }
@@ -1,21 +0,0 @@
1
- {
2
- "name": "stripe-subscription",
3
- "version": "1.0.0",
4
- "description": "netlify functions:create - Create a subscription with Stripe",
5
- "main": "stripe-subscription.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [
10
- "netlify",
11
- "serverless",
12
- "apis",
13
- "stripe",
14
- "js"
15
- ],
16
- "author": "Netlify",
17
- "license": "MIT",
18
- "dependencies": {
19
- "stripe": "^10.0.0"
20
- }
21
- }
@@ -1,52 +0,0 @@
1
- // with thanks https://github.com/LukeMwila/stripe-subscriptions-backend/blob/master/stripe-api/index.ts
2
- const process = require('process')
3
-
4
- const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY)
5
-
6
- const respond = (fulfillmentText) => ({
7
- statusCode: 200,
8
- body: JSON.stringify(fulfillmentText),
9
- headers: {
10
- 'Access-Control-Allow-Credentials': true,
11
- 'Access-Control-Allow-Origin': '*',
12
- 'Content-Type': 'application/json',
13
- },
14
- })
15
-
16
- const handler = async function (event) {
17
- let incoming
18
- try {
19
- incoming = JSON.parse(event.body)
20
- } catch (error) {
21
- console.error(`error with parsing function parameters:`, error)
22
- return {
23
- statusCode: 400,
24
- body: JSON.stringify(error),
25
- }
26
- }
27
- try {
28
- const { email, productPlan, stripeToken } = incoming
29
- const data = await createCustomerAndSubscribeToPlan(stripeToken, email, productPlan)
30
- return respond(data)
31
- } catch (error) {
32
- return respond(error)
33
- }
34
- }
35
-
36
- const createCustomerAndSubscribeToPlan = async function (stripeToken, email, productPlan) {
37
- // create a customer
38
- const customer = await stripe.customers.create({
39
- email,
40
- source: stripeToken,
41
- })
42
- // retrieve created customer id to add customer to subscription plan
43
- const customerId = customer.id
44
- // create a subscription for the newly created customer
45
- const subscription = await stripe.subscriptions.create({
46
- customer: customerId,
47
- items: [{ plan: productPlan }],
48
- })
49
- return subscription
50
- }
51
-
52
- module.exports = { handler }
@@ -1,29 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- export default {
4
- name: 'token-hider',
5
- description: 'Token Hider: access APIs without exposing your API keys',
6
- functionType: 'serverless',
7
- async onComplete() {
8
- console.log(`${chalk.yellow('token-hider')} function created from template!`)
9
- if (!process.env.API_URL || !process.env.API_TOKEN) {
10
- console.log(
11
- `note this function requires ${chalk.yellow('API_URL')} and ${chalk.yellow(
12
- 'API_TOKEN',
13
- )} build environment variables set in your Netlify Site.`,
14
- )
15
-
16
- let siteData = { name: 'YOURSITENAMEHERE' }
17
- try {
18
- siteData = await this.netlify.api.getSite({
19
- siteId: this.netlify.site.id,
20
- })
21
- } catch (e) {
22
- // silent error, not important
23
- }
24
- console.log(
25
- `Set them at: https://app.netlify.com/sites/${siteData.name}/settings/deploys#environment-variables (must have CD setup)`,
26
- )
27
- }
28
- },
29
- }