netlify-cli 25.4.0 → 25.6.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 (61) hide show
  1. package/dist/commands/database/database.d.ts.map +1 -1
  2. package/dist/commands/database/database.js +7 -12
  3. package/dist/commands/database/database.js.map +1 -1
  4. package/dist/commands/database/db-init.d.ts +6 -0
  5. package/dist/commands/database/db-init.d.ts.map +1 -0
  6. package/dist/commands/database/db-init.js +280 -0
  7. package/dist/commands/database/db-init.js.map +1 -0
  8. package/dist/commands/database/db-migration-new.d.ts.map +1 -1
  9. package/dist/commands/database/db-migration-new.js +2 -10
  10. package/dist/commands/database/db-migration-new.js.map +1 -1
  11. package/dist/commands/database/db-status.d.ts.map +1 -1
  12. package/dist/commands/database/db-status.js +6 -16
  13. package/dist/commands/database/db-status.js.map +1 -1
  14. package/dist/commands/database/util/db-connection.d.ts +1 -0
  15. package/dist/commands/database/util/db-connection.d.ts.map +1 -1
  16. package/dist/commands/database/util/db-connection.js +55 -7
  17. package/dist/commands/database/util/db-connection.js.map +1 -1
  18. package/dist/commands/database/util/init-data.d.ts +8 -0
  19. package/dist/commands/database/util/init-data.d.ts.map +1 -0
  20. package/dist/commands/database/util/init-data.js +47 -0
  21. package/dist/commands/database/util/init-data.js.map +1 -0
  22. package/dist/commands/database/util/package-json.d.ts +2 -0
  23. package/dist/commands/database/util/package-json.d.ts.map +1 -0
  24. package/dist/commands/database/util/package-json.js +16 -0
  25. package/dist/commands/database/util/package-json.js.map +1 -0
  26. package/dist/commands/database/util/packages.d.ts +15 -0
  27. package/dist/commands/database/util/packages.d.ts.map +1 -0
  28. package/dist/commands/database/util/packages.js +59 -0
  29. package/dist/commands/database/util/packages.js.map +1 -0
  30. package/dist/commands/database/util/paths.d.ts +2 -0
  31. package/dist/commands/database/util/paths.d.ts.map +1 -0
  32. package/dist/commands/database/util/paths.js +13 -0
  33. package/dist/commands/database/util/paths.js.map +1 -0
  34. package/dist/commands/database/util/timestamp.d.ts +2 -0
  35. package/dist/commands/database/util/timestamp.d.ts.map +1 -0
  36. package/dist/commands/database/util/timestamp.js +7 -0
  37. package/dist/commands/database/util/timestamp.js.map +1 -0
  38. package/dist/commands/deploy/deploy.d.ts.map +1 -1
  39. package/dist/commands/deploy/deploy.js +7 -2
  40. package/dist/commands/deploy/deploy.js.map +1 -1
  41. package/dist/commands/functions/functions-create.d.ts +1 -1
  42. package/dist/commands/functions/functions-create.d.ts.map +1 -1
  43. package/dist/commands/functions/functions-create.js +56 -2
  44. package/dist/commands/functions/functions-create.js.map +1 -1
  45. package/dist/commands/functions/functions.d.ts.map +1 -1
  46. package/dist/commands/functions/functions.js +2 -0
  47. package/dist/commands/functions/functions.js.map +1 -1
  48. package/dist/tsconfig.build.tsbuildinfo +1 -1
  49. package/functions-templates/javascript/scheduled-function/package.json +1 -1
  50. package/functions-templates/typescript/database/.netlify-function-template.mjs +5 -0
  51. package/functions-templates/typescript/database/package-lock.json +357 -0
  52. package/functions-templates/typescript/database/package.json +23 -0
  53. package/functions-templates/typescript/database/{{name}}.mts +24 -0
  54. package/functions-templates/typescript/database-drizzle/.netlify-function-template.mjs +5 -0
  55. package/functions-templates/typescript/database-drizzle/package-lock.json +520 -0
  56. package/functions-templates/typescript/database-drizzle/package.json +25 -0
  57. package/functions-templates/typescript/database-drizzle/{{name}}.mts +26 -0
  58. package/functions-templates/typescript/hello-world/package-lock.json +7 -7
  59. package/functions-templates/typescript/hello-world/package.json +1 -1
  60. package/functions-templates/typescript/scheduled-function/package.json +1 -1
  61. package/package.json +7 -6
@@ -15,6 +15,6 @@
15
15
  "author": "Netlify",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@netlify/functions": "^5.1.5"
18
+ "@netlify/functions": "^5.2.0"
19
19
  }
20
20
  }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ name: 'database',
3
+ description: 'Query a Netlify Database table with raw SQL via `db.sql`',
4
+ functionType: 'serverless',
5
+ }
@@ -0,0 +1,357 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "{{name}}",
9
+ "version": "1.0.0",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "@netlify/database": "latest",
13
+ "@netlify/functions": "^5.2.0",
14
+ "@types/node": "^22.0.0",
15
+ "typescript": "^4.5.5"
16
+ }
17
+ },
18
+ "node_modules/@neondatabase/serverless": {
19
+ "version": "1.1.0",
20
+ "resolved": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-1.1.0.tgz",
21
+ "integrity": "sha512-r3ZZhRjEcfEdKIZnoB1RusNgvHuaBRqfCzV4Gi+5A9yUX0S4HTws/ASWqt13wL4y4I+0rqsWGdA2w7EQXHi3+Q==",
22
+ "license": "MIT",
23
+ "engines": {
24
+ "node": ">=19.0.0"
25
+ }
26
+ },
27
+ "node_modules/@netlify/database": {
28
+ "version": "0.7.0",
29
+ "resolved": "https://registry.npmjs.org/@netlify/database/-/database-0.7.0.tgz",
30
+ "integrity": "sha512-oCJVGauiLIMuxPSF4QZV+F3weU3GnclCRQcqU0lSrNqXmxJXiIehomaXHVzXGOZ7QJhVb/RRc2K1n9qIP3EwJg==",
31
+ "license": "MIT",
32
+ "dependencies": {
33
+ "@neondatabase/serverless": "^1.1.0",
34
+ "@netlify/runtime-utils": "2.3.0",
35
+ "pg": "^8.13.0",
36
+ "waddler": "^0.1.1",
37
+ "ws": "^8.18.0"
38
+ },
39
+ "engines": {
40
+ "node": ">=20.6.1"
41
+ }
42
+ },
43
+ "node_modules/@netlify/functions": {
44
+ "version": "5.2.0",
45
+ "resolved": "https://registry.npmjs.org/@netlify/functions/-/functions-5.2.0.tgz",
46
+ "integrity": "sha512-Pj93qeQd1tkQ5xm9gWJZmBf/1riLYqYHc0OzFukrJomrj82Ott53Rr/Q88H1ms5cF+P5QXRKWmA2JSxSybKfjA==",
47
+ "license": "MIT",
48
+ "dependencies": {
49
+ "@netlify/types": "2.6.0"
50
+ },
51
+ "engines": {
52
+ "node": ">=18.0.0"
53
+ }
54
+ },
55
+ "node_modules/@netlify/runtime-utils": {
56
+ "version": "2.3.0",
57
+ "resolved": "https://registry.npmjs.org/@netlify/runtime-utils/-/runtime-utils-2.3.0.tgz",
58
+ "integrity": "sha512-cW8weDvsKV7zfia2m5EcBy6KILGoPD+eYZ3qWNGnIo05DGF28goPES0xKSDkNYgAF/2rRSIhie2qcBhbGVgSRg==",
59
+ "license": "MIT",
60
+ "engines": {
61
+ "node": "^18.14.0 || >=20"
62
+ }
63
+ },
64
+ "node_modules/@netlify/types": {
65
+ "version": "2.6.0",
66
+ "resolved": "https://registry.npmjs.org/@netlify/types/-/types-2.6.0.tgz",
67
+ "integrity": "sha512-yD20EizHJDQxajJ66Vo8RTwLwR2jMNVxufPG8MHd2AScX8jW4z0VPnnJHArq2GYPFTFZRHmiAhDrXr5m8zof6w==",
68
+ "license": "MIT",
69
+ "engines": {
70
+ "node": "^18.14.0 || >=20"
71
+ }
72
+ },
73
+ "node_modules/@types/node": {
74
+ "version": "22.19.17",
75
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.17.tgz",
76
+ "integrity": "sha512-wGdMcf+vPYM6jikpS/qhg6WiqSV/OhG+jeeHT/KlVqxYfD40iYJf9/AE1uQxVWFvU7MipKRkRv8NSHiCGgPr8Q==",
77
+ "license": "MIT",
78
+ "dependencies": {
79
+ "undici-types": "~6.21.0"
80
+ }
81
+ },
82
+ "node_modules/pg": {
83
+ "version": "8.20.0",
84
+ "resolved": "https://registry.npmjs.org/pg/-/pg-8.20.0.tgz",
85
+ "integrity": "sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA==",
86
+ "license": "MIT",
87
+ "dependencies": {
88
+ "pg-connection-string": "^2.12.0",
89
+ "pg-pool": "^3.13.0",
90
+ "pg-protocol": "^1.13.0",
91
+ "pg-types": "2.2.0",
92
+ "pgpass": "1.0.5"
93
+ },
94
+ "engines": {
95
+ "node": ">= 16.0.0"
96
+ },
97
+ "optionalDependencies": {
98
+ "pg-cloudflare": "^1.3.0"
99
+ },
100
+ "peerDependencies": {
101
+ "pg-native": ">=3.0.1"
102
+ },
103
+ "peerDependenciesMeta": {
104
+ "pg-native": {
105
+ "optional": true
106
+ }
107
+ }
108
+ },
109
+ "node_modules/pg-cloudflare": {
110
+ "version": "1.3.0",
111
+ "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.3.0.tgz",
112
+ "integrity": "sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==",
113
+ "license": "MIT",
114
+ "optional": true
115
+ },
116
+ "node_modules/pg-connection-string": {
117
+ "version": "2.12.0",
118
+ "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.12.0.tgz",
119
+ "integrity": "sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ==",
120
+ "license": "MIT"
121
+ },
122
+ "node_modules/pg-int8": {
123
+ "version": "1.0.1",
124
+ "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
125
+ "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
126
+ "license": "ISC",
127
+ "engines": {
128
+ "node": ">=4.0.0"
129
+ }
130
+ },
131
+ "node_modules/pg-pool": {
132
+ "version": "3.13.0",
133
+ "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.13.0.tgz",
134
+ "integrity": "sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA==",
135
+ "license": "MIT",
136
+ "peerDependencies": {
137
+ "pg": ">=8.0"
138
+ }
139
+ },
140
+ "node_modules/pg-protocol": {
141
+ "version": "1.13.0",
142
+ "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.13.0.tgz",
143
+ "integrity": "sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==",
144
+ "license": "MIT"
145
+ },
146
+ "node_modules/pg-types": {
147
+ "version": "2.2.0",
148
+ "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
149
+ "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
150
+ "license": "MIT",
151
+ "dependencies": {
152
+ "pg-int8": "1.0.1",
153
+ "postgres-array": "~2.0.0",
154
+ "postgres-bytea": "~1.0.0",
155
+ "postgres-date": "~1.0.4",
156
+ "postgres-interval": "^1.1.0"
157
+ },
158
+ "engines": {
159
+ "node": ">=4"
160
+ }
161
+ },
162
+ "node_modules/pgpass": {
163
+ "version": "1.0.5",
164
+ "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
165
+ "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
166
+ "license": "MIT",
167
+ "dependencies": {
168
+ "split2": "^4.1.0"
169
+ }
170
+ },
171
+ "node_modules/postgres-array": {
172
+ "version": "2.0.0",
173
+ "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
174
+ "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
175
+ "license": "MIT",
176
+ "engines": {
177
+ "node": ">=4"
178
+ }
179
+ },
180
+ "node_modules/postgres-bytea": {
181
+ "version": "1.0.1",
182
+ "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz",
183
+ "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==",
184
+ "license": "MIT",
185
+ "engines": {
186
+ "node": ">=0.10.0"
187
+ }
188
+ },
189
+ "node_modules/postgres-date": {
190
+ "version": "1.0.7",
191
+ "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
192
+ "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
193
+ "license": "MIT",
194
+ "engines": {
195
+ "node": ">=0.10.0"
196
+ }
197
+ },
198
+ "node_modules/postgres-interval": {
199
+ "version": "1.2.0",
200
+ "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
201
+ "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
202
+ "license": "MIT",
203
+ "dependencies": {
204
+ "xtend": "^4.0.0"
205
+ },
206
+ "engines": {
207
+ "node": ">=0.10.0"
208
+ }
209
+ },
210
+ "node_modules/split2": {
211
+ "version": "4.2.0",
212
+ "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
213
+ "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
214
+ "license": "ISC",
215
+ "engines": {
216
+ "node": ">= 10.x"
217
+ }
218
+ },
219
+ "node_modules/typescript": {
220
+ "version": "4.9.5",
221
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
222
+ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
223
+ "license": "Apache-2.0",
224
+ "bin": {
225
+ "tsc": "bin/tsc",
226
+ "tsserver": "bin/tsserver"
227
+ },
228
+ "engines": {
229
+ "node": ">=4.2.0"
230
+ }
231
+ },
232
+ "node_modules/undici-types": {
233
+ "version": "6.21.0",
234
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
235
+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
236
+ "license": "MIT"
237
+ },
238
+ "node_modules/waddler": {
239
+ "version": "0.1.1",
240
+ "resolved": "https://registry.npmjs.org/waddler/-/waddler-0.1.1.tgz",
241
+ "integrity": "sha512-lBJXYFBLEpYe+scAeCJmLj6Iqweuq1whM6Am3I9WfopOCFxvKz8Nq5hXoy8/b3zwJqHIQMglFIvM4skRydSpZg==",
242
+ "license": "MIT",
243
+ "peerDependencies": {
244
+ "@clickhouse/client": "^1.11.2",
245
+ "@duckdb/node-api": "^1.1.2-alpha.4",
246
+ "@electric-sql/pglite": "^0.2.17",
247
+ "@libsql/client": "^0.15.4",
248
+ "@libsql/client-wasm": "^0.15.4",
249
+ "@neondatabase/serverless": "^1.0.0",
250
+ "@planetscale/database": "^1.19.0",
251
+ "@tidbcloud/serverless": "^0.2.0",
252
+ "@vercel/postgres": "^0.10.0",
253
+ "@xata.io/client": "^0.30.1",
254
+ "better-sqlite3": "^11.9.1",
255
+ "bun-types": "*",
256
+ "duckdb": "^1.2.1",
257
+ "gel": "^2.0.2",
258
+ "mysql2": "^3.14.0",
259
+ "pg": "^8.14.0",
260
+ "pg-query-stream": "^4.8.0",
261
+ "postgres": "^3.4.5"
262
+ },
263
+ "peerDependenciesMeta": {
264
+ "@clickhouse/client": {
265
+ "optional": true
266
+ },
267
+ "@cloudflare/workers-types": {
268
+ "optional": true
269
+ },
270
+ "@duckdb/node-api": {
271
+ "optional": true
272
+ },
273
+ "@electric-sql/pglite": {
274
+ "optional": true
275
+ },
276
+ "@libsql/client": {
277
+ "optional": true
278
+ },
279
+ "@libsql/client-wasm": {
280
+ "optional": true
281
+ },
282
+ "@neondatabase/serverless": {
283
+ "optional": true
284
+ },
285
+ "@op-engineering/op-sqlite": {
286
+ "optional": true
287
+ },
288
+ "@planetscale/database": {
289
+ "optional": true
290
+ },
291
+ "@tidbcloud/serverless": {
292
+ "optional": true
293
+ },
294
+ "@vercel/postgres": {
295
+ "optional": true
296
+ },
297
+ "@xata.io/client": {
298
+ "optional": true
299
+ },
300
+ "better-sqlite3": {
301
+ "optional": true
302
+ },
303
+ "bun-types": {
304
+ "optional": true
305
+ },
306
+ "duckdb": {
307
+ "optional": true
308
+ },
309
+ "gel": {
310
+ "optional": true
311
+ },
312
+ "mysql2": {
313
+ "optional": true
314
+ },
315
+ "pg": {
316
+ "optional": true
317
+ },
318
+ "pg-query-stream": {
319
+ "optional": true
320
+ },
321
+ "postgres": {
322
+ "optional": true
323
+ }
324
+ }
325
+ },
326
+ "node_modules/ws": {
327
+ "version": "8.20.0",
328
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",
329
+ "integrity": "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==",
330
+ "license": "MIT",
331
+ "engines": {
332
+ "node": ">=10.0.0"
333
+ },
334
+ "peerDependencies": {
335
+ "bufferutil": "^4.0.1",
336
+ "utf-8-validate": ">=5.0.2"
337
+ },
338
+ "peerDependenciesMeta": {
339
+ "bufferutil": {
340
+ "optional": true
341
+ },
342
+ "utf-8-validate": {
343
+ "optional": true
344
+ }
345
+ }
346
+ },
347
+ "node_modules/xtend": {
348
+ "version": "4.0.2",
349
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
350
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
351
+ "license": "MIT",
352
+ "engines": {
353
+ "node": ">=0.4"
354
+ }
355
+ }
356
+ }
357
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "version": "1.0.0",
4
+ "description": "netlify functions:create - query Netlify Database with raw SQL",
5
+ "main": "{{name}}.mts",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [
10
+ "netlify",
11
+ "serverless",
12
+ "typescript",
13
+ "database"
14
+ ],
15
+ "author": "Netlify",
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "@netlify/database": "latest",
19
+ "@netlify/functions": "^5.2.0",
20
+ "@types/node": "^22.0.0",
21
+ "typescript": "^4.5.5"
22
+ }
23
+ }
@@ -0,0 +1,24 @@
1
+ import { getDatabase } from '@netlify/database'
2
+
3
+ export default async () => {
4
+ try {
5
+ const db = getDatabase()
6
+ const planets = await db.sql`SELECT * FROM planets ORDER BY mass_kg`
7
+
8
+ return Response.json({ planets })
9
+ } catch (error) {
10
+ const details = error instanceof Error ? error.message : String(error)
11
+
12
+ return Response.json(
13
+ {
14
+ error: "Couldn't query the database. If you haven't set up the schema yet, run `netlify database init`.",
15
+ details,
16
+ },
17
+ { status: 500 },
18
+ )
19
+ }
20
+ }
21
+
22
+ export const config = {
23
+ path: '/planets',
24
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ name: 'database-drizzle',
3
+ description: 'Query a Netlify Database table with Drizzle ORM',
4
+ functionType: 'serverless',
5
+ }