alchemy 0.73.1 → 0.74.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 (96) hide show
  1. package/bin/alchemy.js +3311 -4413
  2. package/bin/alchemy.ts +2 -0
  3. package/bin/commands/configure.ts +4 -1
  4. package/bin/commands/util.ts +510 -0
  5. package/lib/cloudflare/bound.d.ts +1 -1
  6. package/lib/cloudflare/bound.d.ts.map +1 -1
  7. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
  8. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +6 -14
  9. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
  10. package/lib/cloudflare/miniflare/remote-binding-proxy.d.ts.map +1 -1
  11. package/lib/cloudflare/miniflare/remote-binding-proxy.js +12 -4
  12. package/lib/cloudflare/miniflare/remote-binding-proxy.js.map +1 -1
  13. package/lib/cloudflare/tanstack-start/tanstack-start.d.ts.map +1 -1
  14. package/lib/cloudflare/tanstack-start/tanstack-start.js +8 -1
  15. package/lib/cloudflare/tanstack-start/tanstack-start.js.map +1 -1
  16. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  17. package/lib/cloudflare/vite/plugin.js +23 -9
  18. package/lib/cloudflare/vite/plugin.js.map +1 -1
  19. package/lib/planetscale/branch.d.ts +6 -0
  20. package/lib/planetscale/branch.d.ts.map +1 -1
  21. package/lib/planetscale/branch.js +2 -1
  22. package/lib/planetscale/branch.js.map +1 -1
  23. package/lib/planetscale/database.d.ts +6 -0
  24. package/lib/planetscale/database.d.ts.map +1 -1
  25. package/lib/planetscale/database.js +2 -1
  26. package/lib/planetscale/database.js.map +1 -1
  27. package/lib/planetscale/password.d.ts +6 -0
  28. package/lib/planetscale/password.d.ts.map +1 -1
  29. package/lib/planetscale/password.js +2 -1
  30. package/lib/planetscale/password.js.map +1 -1
  31. package/lib/planetscale/role.d.ts +6 -0
  32. package/lib/planetscale/role.d.ts.map +1 -1
  33. package/lib/planetscale/role.js +2 -1
  34. package/lib/planetscale/role.js.map +1 -1
  35. package/lib/prisma-postgres/api/client.gen.d.ts +13 -0
  36. package/lib/prisma-postgres/api/client.gen.d.ts.map +1 -0
  37. package/lib/prisma-postgres/api/client.gen.js +6 -0
  38. package/lib/prisma-postgres/api/client.gen.js.map +1 -0
  39. package/lib/prisma-postgres/api/sdk.gen.d.ts +120 -0
  40. package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -0
  41. package/lib/prisma-postgres/api/sdk.gen.js +219 -0
  42. package/lib/prisma-postgres/api/sdk.gen.js.map +1 -0
  43. package/lib/prisma-postgres/api/types.gen.d.ts +957 -0
  44. package/lib/prisma-postgres/api/types.gen.d.ts.map +1 -0
  45. package/lib/prisma-postgres/api/types.gen.js +2 -0
  46. package/lib/prisma-postgres/api/types.gen.js.map +1 -0
  47. package/lib/prisma-postgres/api.d.ts +29 -0
  48. package/lib/prisma-postgres/api.d.ts.map +1 -0
  49. package/lib/prisma-postgres/api.js +49 -0
  50. package/lib/prisma-postgres/api.js.map +1 -0
  51. package/lib/prisma-postgres/connection.d.ts +87 -0
  52. package/lib/prisma-postgres/connection.d.ts.map +1 -0
  53. package/lib/prisma-postgres/connection.js +73 -0
  54. package/lib/prisma-postgres/connection.js.map +1 -0
  55. package/lib/prisma-postgres/database.d.ts +104 -0
  56. package/lib/prisma-postgres/database.d.ts.map +1 -0
  57. package/lib/prisma-postgres/database.js +88 -0
  58. package/lib/prisma-postgres/database.js.map +1 -0
  59. package/lib/prisma-postgres/index.d.ts +5 -0
  60. package/lib/prisma-postgres/index.d.ts.map +1 -0
  61. package/lib/prisma-postgres/index.js +5 -0
  62. package/lib/prisma-postgres/index.js.map +1 -0
  63. package/lib/prisma-postgres/project.d.ts +69 -0
  64. package/lib/prisma-postgres/project.d.ts.map +1 -0
  65. package/lib/prisma-postgres/project.js +62 -0
  66. package/lib/prisma-postgres/project.js.map +1 -0
  67. package/lib/prisma-postgres/workspace.d.ts +18 -0
  68. package/lib/prisma-postgres/workspace.d.ts.map +1 -0
  69. package/lib/prisma-postgres/workspace.js +21 -0
  70. package/lib/prisma-postgres/workspace.js.map +1 -0
  71. package/lib/util/http.d.ts +5 -2
  72. package/lib/util/http.d.ts.map +1 -1
  73. package/lib/util/http.js +71 -26
  74. package/lib/util/http.js.map +1 -1
  75. package/package.json +9 -1
  76. package/src/cloudflare/bound.ts +3 -1
  77. package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +10 -13
  78. package/src/cloudflare/miniflare/remote-binding-proxy.ts +12 -4
  79. package/src/cloudflare/tanstack-start/tanstack-start.ts +9 -1
  80. package/src/cloudflare/vite/plugin.ts +24 -10
  81. package/src/planetscale/branch.ts +9 -1
  82. package/src/planetscale/database.ts +9 -1
  83. package/src/planetscale/password.ts +9 -1
  84. package/src/planetscale/role.ts +9 -1
  85. package/src/prisma-postgres/api/client.gen.ts +27 -0
  86. package/src/prisma-postgres/api/sdk.gen.ts +437 -0
  87. package/src/prisma-postgres/api/types.gen.ts +1096 -0
  88. package/src/prisma-postgres/api.ts +79 -0
  89. package/src/prisma-postgres/connection.ts +154 -0
  90. package/src/prisma-postgres/database.ts +178 -0
  91. package/src/prisma-postgres/index.ts +4 -0
  92. package/src/prisma-postgres/project.ts +131 -0
  93. package/src/prisma-postgres/workspace.ts +27 -0
  94. package/src/util/http.ts +79 -33
  95. package/workers/cloudflare-state-store.js +1 -1
  96. package/workers/tunnel-proxy.js +1 -1
@@ -0,0 +1,437 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type {
4
+ Client,
5
+ Options as Options2,
6
+ TDataShape,
7
+ } from "../../util/api/client/index.ts";
8
+ import { client } from "./client.gen.ts";
9
+ import type {
10
+ CreateDatabaseConnectionStringData,
11
+ CreateDatabaseConnectionStringErrors,
12
+ CreateDatabaseConnectionStringResponses,
13
+ CreateDatabaseData,
14
+ CreateDatabaseErrors,
15
+ CreateDatabaseResponses,
16
+ CreateProjectWithPostgresDatabaseData,
17
+ CreateProjectWithPostgresDatabaseErrors,
18
+ CreateProjectWithPostgresDatabaseResponses,
19
+ DeleteDatabaseConnectionStringData,
20
+ DeleteDatabaseConnectionStringErrors,
21
+ DeleteDatabaseConnectionStringResponses,
22
+ DeleteDatabaseData,
23
+ DeleteDatabaseErrors,
24
+ DeleteDatabaseResponses,
25
+ DeleteProjectData,
26
+ DeleteProjectErrors,
27
+ DeleteProjectResponses,
28
+ GetDatabaseData,
29
+ GetDatabaseErrors,
30
+ GetDatabaseResponses,
31
+ GetDatabaseUsageMetricsData,
32
+ GetDatabaseUsageMetricsErrors,
33
+ GetDatabaseUsageMetricsResponses,
34
+ GetPrismaAccelerateRegionsData,
35
+ GetPrismaAccelerateRegionsErrors,
36
+ GetPrismaAccelerateRegionsResponses,
37
+ GetPrismaPostgresRegionsData,
38
+ GetPrismaPostgresRegionsErrors,
39
+ GetPrismaPostgresRegionsResponses,
40
+ GetProjectData,
41
+ GetProjectErrors,
42
+ GetProjectResponses,
43
+ ListBackupsData,
44
+ ListBackupsErrors,
45
+ ListBackupsResponses,
46
+ ListDatabaseConnectionsData,
47
+ ListDatabaseConnectionsErrors,
48
+ ListDatabaseConnectionsResponses,
49
+ ListDatabasesData,
50
+ ListDatabasesErrors,
51
+ ListDatabasesResponses,
52
+ ListIntegrationsData,
53
+ ListIntegrationsErrors,
54
+ ListIntegrationsResponses,
55
+ ListProjectsData,
56
+ ListProjectsErrors,
57
+ ListProjectsResponses,
58
+ ListWorkspacesData,
59
+ ListWorkspacesErrors,
60
+ ListWorkspacesResponses,
61
+ RevokeIntegrationTokensData,
62
+ RevokeIntegrationTokensErrors,
63
+ RevokeIntegrationTokensResponses,
64
+ TransferProjectData,
65
+ TransferProjectErrors,
66
+ TransferProjectResponses,
67
+ } from "./types.gen.ts";
68
+
69
+ export type Options<
70
+ TData extends TDataShape = TDataShape,
71
+ ThrowOnError extends boolean = boolean,
72
+ > = Options2<TData, ThrowOnError> & {
73
+ /**
74
+ * You can provide a client instance returned by `createClient()` instead of
75
+ * individual options. This might be also useful if you want to implement a
76
+ * custom client.
77
+ */
78
+ client?: Client;
79
+ /**
80
+ * You can pass arbitrary values through the `meta` object. This can be
81
+ * used to access values that aren't defined as part of the SDK function.
82
+ */
83
+ meta?: Record<string, unknown>;
84
+ };
85
+
86
+ class _HeyApiClient {
87
+ protected _client: Client = client;
88
+
89
+ constructor(args?: {
90
+ client?: Client;
91
+ }) {
92
+ if (args?.client) {
93
+ this._client = args.client;
94
+ }
95
+ }
96
+ }
97
+
98
+ export class PrismaClient extends _HeyApiClient {
99
+ /**
100
+ * Delete database connection string
101
+ * Deletes the database connection string with the given ID.
102
+ */
103
+ public deleteDatabaseConnectionString<ThrowOnError extends boolean = true>(
104
+ options: Options<DeleteDatabaseConnectionStringData, ThrowOnError>,
105
+ ) {
106
+ return (options.client ?? this._client).delete<
107
+ DeleteDatabaseConnectionStringResponses,
108
+ DeleteDatabaseConnectionStringErrors,
109
+ ThrowOnError
110
+ >({
111
+ url: "/v1/connections/{id}",
112
+ ...options,
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Delete database
118
+ * Deletes the database with the given ID.
119
+ */
120
+ public deleteDatabase<ThrowOnError extends boolean = true>(
121
+ options: Options<DeleteDatabaseData, ThrowOnError>,
122
+ ) {
123
+ return (options.client ?? this._client).delete<
124
+ DeleteDatabaseResponses,
125
+ DeleteDatabaseErrors,
126
+ ThrowOnError
127
+ >({
128
+ url: "/v1/databases/{databaseId}",
129
+ ...options,
130
+ });
131
+ }
132
+
133
+ /**
134
+ * Get database
135
+ * Returns the database with the given ID.
136
+ */
137
+ public getDatabase<ThrowOnError extends boolean = true>(
138
+ options: Options<GetDatabaseData, ThrowOnError>,
139
+ ) {
140
+ return (options.client ?? this._client).get<
141
+ GetDatabaseResponses,
142
+ GetDatabaseErrors,
143
+ ThrowOnError
144
+ >({
145
+ url: "/v1/databases/{databaseId}",
146
+ ...options,
147
+ });
148
+ }
149
+
150
+ /**
151
+ * Get list of database connections
152
+ * Returns all connections for the given database.
153
+ */
154
+ public listDatabaseConnections<ThrowOnError extends boolean = true>(
155
+ options: Options<ListDatabaseConnectionsData, ThrowOnError>,
156
+ ) {
157
+ return (options.client ?? this._client).get<
158
+ ListDatabaseConnectionsResponses,
159
+ ListDatabaseConnectionsErrors,
160
+ ThrowOnError
161
+ >({
162
+ url: "/v1/databases/{databaseId}/connections",
163
+ ...options,
164
+ });
165
+ }
166
+
167
+ /**
168
+ * Create database connection string
169
+ * Creates a new connection string for the given database.
170
+ */
171
+ public createDatabaseConnectionString<ThrowOnError extends boolean = true>(
172
+ options: Options<CreateDatabaseConnectionStringData, ThrowOnError>,
173
+ ) {
174
+ return (options.client ?? this._client).post<
175
+ CreateDatabaseConnectionStringResponses,
176
+ CreateDatabaseConnectionStringErrors,
177
+ ThrowOnError
178
+ >({
179
+ url: "/v1/databases/{databaseId}/connections",
180
+ ...options,
181
+ headers: {
182
+ "Content-Type": "application/json",
183
+ ...options.headers,
184
+ },
185
+ });
186
+ }
187
+
188
+ /**
189
+ * Get list of backups
190
+ * Returns backups for the specified database.
191
+ */
192
+ public listBackups<ThrowOnError extends boolean = true>(
193
+ options: Options<ListBackupsData, ThrowOnError>,
194
+ ) {
195
+ return (options.client ?? this._client).get<
196
+ ListBackupsResponses,
197
+ ListBackupsErrors,
198
+ ThrowOnError
199
+ >({
200
+ url: "/v1/databases/{databaseId}/backups",
201
+ ...options,
202
+ });
203
+ }
204
+
205
+ /**
206
+ * Get database usage metrics
207
+ * Returns usage metrics for the specified database.
208
+ */
209
+ public getDatabaseUsageMetrics<ThrowOnError extends boolean = true>(
210
+ options: Options<GetDatabaseUsageMetricsData, ThrowOnError>,
211
+ ) {
212
+ return (options.client ?? this._client).get<
213
+ GetDatabaseUsageMetricsResponses,
214
+ GetDatabaseUsageMetricsErrors,
215
+ ThrowOnError
216
+ >({
217
+ url: "/v1/databases/{databaseId}/usage",
218
+ ...options,
219
+ });
220
+ }
221
+
222
+ /**
223
+ * Get list of projects
224
+ * Returns the list of projects the token has access to.
225
+ */
226
+ public listProjects<ThrowOnError extends boolean = true>(
227
+ options?: Options<ListProjectsData, ThrowOnError>,
228
+ ) {
229
+ return (options?.client ?? this._client).get<
230
+ ListProjectsResponses,
231
+ ListProjectsErrors,
232
+ ThrowOnError
233
+ >({
234
+ url: "/v1/projects",
235
+ ...options,
236
+ });
237
+ }
238
+
239
+ /**
240
+ * Create project with a postgres database
241
+ * Creates a new project with a postgres database.
242
+ */
243
+ public createProjectWithPostgresDatabase<ThrowOnError extends boolean = true>(
244
+ options?: Options<CreateProjectWithPostgresDatabaseData, ThrowOnError>,
245
+ ) {
246
+ return (options?.client ?? this._client).post<
247
+ CreateProjectWithPostgresDatabaseResponses,
248
+ CreateProjectWithPostgresDatabaseErrors,
249
+ ThrowOnError
250
+ >({
251
+ url: "/v1/projects",
252
+ ...options,
253
+ headers: {
254
+ "Content-Type": "application/json",
255
+ ...options?.headers,
256
+ },
257
+ });
258
+ }
259
+
260
+ /**
261
+ * Delete project
262
+ * Deletes the project with the given ID.
263
+ */
264
+ public deleteProject<ThrowOnError extends boolean = true>(
265
+ options: Options<DeleteProjectData, ThrowOnError>,
266
+ ) {
267
+ return (options.client ?? this._client).delete<
268
+ DeleteProjectResponses,
269
+ DeleteProjectErrors,
270
+ ThrowOnError
271
+ >({
272
+ url: "/v1/projects/{id}",
273
+ ...options,
274
+ });
275
+ }
276
+
277
+ /**
278
+ * Get project
279
+ * Returns the project with the given ID.
280
+ */
281
+ public getProject<ThrowOnError extends boolean = true>(
282
+ options: Options<GetProjectData, ThrowOnError>,
283
+ ) {
284
+ return (options.client ?? this._client).get<
285
+ GetProjectResponses,
286
+ GetProjectErrors,
287
+ ThrowOnError
288
+ >({
289
+ url: "/v1/projects/{id}",
290
+ ...options,
291
+ });
292
+ }
293
+
294
+ /**
295
+ * Transfer project
296
+ * Transfer the project with the given ID to the new owner's workspace
297
+ */
298
+ public transferProject<ThrowOnError extends boolean = true>(
299
+ options: Options<TransferProjectData, ThrowOnError>,
300
+ ) {
301
+ return (options.client ?? this._client).post<
302
+ TransferProjectResponses,
303
+ TransferProjectErrors,
304
+ ThrowOnError
305
+ >({
306
+ url: "/v1/projects/{id}/transfer",
307
+ ...options,
308
+ headers: {
309
+ "Content-Type": "application/json",
310
+ ...options.headers,
311
+ },
312
+ });
313
+ }
314
+
315
+ /**
316
+ * Get list of databases
317
+ * Returns databases for the given project.
318
+ */
319
+ public listDatabases<ThrowOnError extends boolean = true>(
320
+ options: Options<ListDatabasesData, ThrowOnError>,
321
+ ) {
322
+ return (options.client ?? this._client).get<
323
+ ListDatabasesResponses,
324
+ ListDatabasesErrors,
325
+ ThrowOnError
326
+ >({
327
+ url: "/v1/projects/{projectId}/databases",
328
+ ...options,
329
+ });
330
+ }
331
+
332
+ /**
333
+ * Create database
334
+ * Creates a new database for the given project.
335
+ */
336
+ public createDatabase<ThrowOnError extends boolean = true>(
337
+ options: Options<CreateDatabaseData, ThrowOnError>,
338
+ ) {
339
+ return (options.client ?? this._client).post<
340
+ CreateDatabaseResponses,
341
+ CreateDatabaseErrors,
342
+ ThrowOnError
343
+ >({
344
+ url: "/v1/projects/{projectId}/databases",
345
+ ...options,
346
+ headers: {
347
+ "Content-Type": "application/json",
348
+ ...options.headers,
349
+ },
350
+ });
351
+ }
352
+
353
+ /**
354
+ * Get list of integrations
355
+ * Returns integrations for the given workspace.
356
+ */
357
+ public listIntegrations<ThrowOnError extends boolean = true>(
358
+ options: Options<ListIntegrationsData, ThrowOnError>,
359
+ ) {
360
+ return (options.client ?? this._client).get<
361
+ ListIntegrationsResponses,
362
+ ListIntegrationsErrors,
363
+ ThrowOnError
364
+ >({
365
+ url: "/v1/workspaces/{workspaceId}/integrations",
366
+ ...options,
367
+ });
368
+ }
369
+
370
+ /**
371
+ * Revoke integration tokens
372
+ * Revokes the integration tokens with the given client ID.
373
+ */
374
+ public revokeIntegrationTokens<ThrowOnError extends boolean = true>(
375
+ options: Options<RevokeIntegrationTokensData, ThrowOnError>,
376
+ ) {
377
+ return (options.client ?? this._client).delete<
378
+ RevokeIntegrationTokensResponses,
379
+ RevokeIntegrationTokensErrors,
380
+ ThrowOnError
381
+ >({
382
+ url: "/v1/workspaces/{workspaceId}/integrations/{clientId}",
383
+ ...options,
384
+ });
385
+ }
386
+
387
+ /**
388
+ * Get Prisma Postgres regions
389
+ * Returns all available regions for Prisma Postgres.
390
+ */
391
+ public getPrismaPostgresRegions<ThrowOnError extends boolean = true>(
392
+ options?: Options<GetPrismaPostgresRegionsData, ThrowOnError>,
393
+ ) {
394
+ return (options?.client ?? this._client).get<
395
+ GetPrismaPostgresRegionsResponses,
396
+ GetPrismaPostgresRegionsErrors,
397
+ ThrowOnError
398
+ >({
399
+ url: "/v1/regions/postgres",
400
+ ...options,
401
+ });
402
+ }
403
+
404
+ /**
405
+ * Get Prisma Accelerate regions
406
+ * Returns all available regions for Prisma Accelerate.
407
+ */
408
+ public getPrismaAccelerateRegions<ThrowOnError extends boolean = true>(
409
+ options?: Options<GetPrismaAccelerateRegionsData, ThrowOnError>,
410
+ ) {
411
+ return (options?.client ?? this._client).get<
412
+ GetPrismaAccelerateRegionsResponses,
413
+ GetPrismaAccelerateRegionsErrors,
414
+ ThrowOnError
415
+ >({
416
+ url: "/v1/regions/accelerate",
417
+ ...options,
418
+ });
419
+ }
420
+
421
+ /**
422
+ * Get list of workspaces
423
+ * Returns the list of workspaces the current token can access.
424
+ */
425
+ public listWorkspaces<ThrowOnError extends boolean = true>(
426
+ options?: Options<ListWorkspacesData, ThrowOnError>,
427
+ ) {
428
+ return (options?.client ?? this._client).get<
429
+ ListWorkspacesResponses,
430
+ ListWorkspacesErrors,
431
+ ThrowOnError
432
+ >({
433
+ url: "/v1/workspaces",
434
+ ...options,
435
+ });
436
+ }
437
+ }