@powerlines/plugin-prisma 0.4.29 → 0.4.31

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 (54) hide show
  1. package/README.md +1 -1
  2. package/dist/client-generator-AkVOcQPr.mjs +146 -0
  3. package/dist/client-generator-B8dwKgp9.mjs +146 -0
  4. package/dist/client-generator-BAc2oiYI.cjs +152 -0
  5. package/dist/client-generator-Wdm31y35.cjs +152 -0
  6. package/dist/get-schema-Dq1-Jwvo.cjs +138 -0
  7. package/dist/helpers/client-generator.cjs +4 -0
  8. package/dist/helpers/client-generator.mjs +3 -0
  9. package/dist/helpers/get-schema.cjs +2 -80
  10. package/dist/helpers/get-schema.mjs +24 -4
  11. package/dist/helpers/index.cjs +6 -4
  12. package/dist/helpers/index.mjs +3 -2
  13. package/dist/helpers/schema-creator.cjs +1 -1
  14. package/dist/helpers/typed-sql.cjs +38 -0
  15. package/dist/helpers/typed-sql.mjs +36 -0
  16. package/dist/index.cjs +71 -45
  17. package/dist/index.mjs +68 -41
  18. package/dist/types/index.cjs +2 -0
  19. package/dist/types/index.mjs +3 -0
  20. package/package.json +46 -235
  21. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  22. package/dist/_virtual/_rolldown/runtime.mjs +0 -3
  23. package/dist/api/client/client.gen.cjs +0 -176
  24. package/dist/api/client/client.gen.mjs +0 -175
  25. package/dist/api/client/index.cjs +0 -15
  26. package/dist/api/client/index.mjs +0 -7
  27. package/dist/api/client/types.gen.cjs +0 -0
  28. package/dist/api/client/types.gen.mjs +0 -1
  29. package/dist/api/client/utils.gen.cjs +0 -187
  30. package/dist/api/client/utils.gen.mjs +0 -179
  31. package/dist/api/client.gen.cjs +0 -10
  32. package/dist/api/client.gen.mjs +0 -9
  33. package/dist/api/core/auth.gen.cjs +0 -13
  34. package/dist/api/core/auth.gen.mjs +0 -11
  35. package/dist/api/core/bodySerializer.gen.cjs +0 -36
  36. package/dist/api/core/bodySerializer.gen.mjs +0 -32
  37. package/dist/api/core/params.gen.cjs +0 -66
  38. package/dist/api/core/params.gen.mjs +0 -64
  39. package/dist/api/core/pathSerializer.gen.cjs +0 -88
  40. package/dist/api/core/pathSerializer.gen.mjs +0 -81
  41. package/dist/api/core/queryKeySerializer.gen.cjs +0 -67
  42. package/dist/api/core/queryKeySerializer.gen.mjs +0 -63
  43. package/dist/api/core/serverSentEvents.gen.cjs +0 -96
  44. package/dist/api/core/serverSentEvents.gen.mjs +0 -94
  45. package/dist/api/core/types.gen.cjs +0 -0
  46. package/dist/api/core/types.gen.mjs +0 -1
  47. package/dist/api/core/utils.gen.cjs +0 -82
  48. package/dist/api/core/utils.gen.mjs +0 -78
  49. package/dist/api/sdk.gen.cjs +0 -405
  50. package/dist/api/sdk.gen.mjs +0 -404
  51. package/dist/api/types.gen.cjs +0 -0
  52. package/dist/api/types.gen.mjs +0 -1
  53. package/dist/helpers/prisma-postgres.cjs +0 -17
  54. package/dist/helpers/prisma-postgres.mjs +0 -15
@@ -1,404 +0,0 @@
1
- import { client } from "./client.gen.mjs";
2
-
3
- //#region src/api/sdk.gen.ts
4
- var HeyApiClient = class {
5
- client;
6
- constructor(args) {
7
- this.client = args?.client ?? client;
8
- }
9
- };
10
- var HeyApiRegistry = class {
11
- defaultKey = "default";
12
- instances = /* @__PURE__ */ new Map();
13
- get(key) {
14
- const instance = this.instances.get(key ?? this.defaultKey);
15
- if (!instance) throw new Error(`No SDK client found. Create one with "new PrismaClient()" to fix this error.`);
16
- return instance;
17
- }
18
- set(value, key) {
19
- this.instances.set(key ?? this.defaultKey, value);
20
- }
21
- };
22
- var PrismaClient = class PrismaClient extends HeyApiClient {
23
- static __registry = new HeyApiRegistry();
24
- constructor(args) {
25
- super(args);
26
- PrismaClient.__registry.set(this, args?.key);
27
- }
28
- /**
29
- * List connections
30
- *
31
- * Returns all connections the actor has access to, with optional database filter.
32
- */
33
- listConnections(options) {
34
- return (options?.client ?? this.client).get({
35
- url: "/v1/connections",
36
- ...options
37
- });
38
- }
39
- /**
40
- * Create connection
41
- *
42
- * Creates a new connection for the specified database.
43
- */
44
- createConnection(options) {
45
- return (options?.client ?? this.client).post({
46
- url: "/v1/connections",
47
- ...options,
48
- headers: {
49
- "Content-Type": "application/json",
50
- ...options?.headers
51
- }
52
- });
53
- }
54
- /**
55
- * Delete connection
56
- *
57
- * Deletes the connection with the given ID.
58
- */
59
- deleteConnection(options) {
60
- return (options.client ?? this.client).delete({
61
- url: "/v1/connections/{id}",
62
- ...options
63
- });
64
- }
65
- /**
66
- * Get connection
67
- *
68
- * Returns the connection with the given ID.
69
- */
70
- getConnection(options) {
71
- return (options.client ?? this.client).get({
72
- url: "/v1/connections/{id}",
73
- ...options
74
- });
75
- }
76
- /**
77
- * List databases
78
- *
79
- * Returns all databases the token has access to. Optionally filter by project ID.
80
- */
81
- listDatabases(options) {
82
- return (options?.client ?? this.client).get({
83
- url: "/v1/databases",
84
- ...options
85
- });
86
- }
87
- /**
88
- * Create database
89
- *
90
- * Creates a new database in the specified project.
91
- */
92
- createDatabase(options) {
93
- return (options?.client ?? this.client).post({
94
- url: "/v1/databases",
95
- ...options,
96
- headers: {
97
- "Content-Type": "application/json",
98
- ...options?.headers
99
- }
100
- });
101
- }
102
- /**
103
- * Delete database
104
- *
105
- * Deletes the database with the given ID.
106
- */
107
- deleteDatabase(options) {
108
- return (options.client ?? this.client).delete({
109
- url: "/v1/databases/{databaseId}",
110
- ...options
111
- });
112
- }
113
- /**
114
- * Get database
115
- *
116
- * Returns the database with the given ID.
117
- */
118
- getDatabase(options) {
119
- return (options.client ?? this.client).get({
120
- url: "/v1/databases/{databaseId}",
121
- ...options
122
- });
123
- }
124
- /**
125
- * Update database
126
- *
127
- * Updates the database with the given ID.
128
- */
129
- updateDatabase(options) {
130
- return (options.client ?? this.client).patch({
131
- url: "/v1/databases/{databaseId}",
132
- ...options,
133
- headers: {
134
- "Content-Type": "application/json",
135
- ...options.headers
136
- }
137
- });
138
- }
139
- /**
140
- * Get list of database connections
141
- *
142
- * Returns all connections for the given database.
143
- */
144
- listDatabaseConnections(options) {
145
- return (options.client ?? this.client).get({
146
- url: "/v1/databases/{databaseId}/connections",
147
- ...options
148
- });
149
- }
150
- /**
151
- * Create database connection string
152
- *
153
- * Creates a new connection string for the given database.
154
- */
155
- createDatabaseConnectionString(options) {
156
- return (options.client ?? this.client).post({
157
- url: "/v1/databases/{databaseId}/connections",
158
- ...options,
159
- headers: {
160
- "Content-Type": "application/json",
161
- ...options.headers
162
- }
163
- });
164
- }
165
- /**
166
- * Get list of backups
167
- *
168
- * Returns backups for the specified database.
169
- */
170
- listBackups(options) {
171
- return (options.client ?? this.client).get({
172
- url: "/v1/databases/{databaseId}/backups",
173
- ...options
174
- });
175
- }
176
- /**
177
- * Get database usage metrics
178
- *
179
- * Returns usage metrics for the specified database.
180
- */
181
- getDatabaseUsageMetrics(options) {
182
- return (options.client ?? this.client).get({
183
- url: "/v1/databases/{databaseId}/usage",
184
- ...options
185
- });
186
- }
187
- /**
188
- * Get list of projects
189
- *
190
- * Returns the list of projects the token has access to.
191
- */
192
- listProjects(options) {
193
- return (options?.client ?? this.client).get({
194
- url: "/v1/projects",
195
- ...options
196
- });
197
- }
198
- /**
199
- * Create project with a postgres database
200
- *
201
- * Creates a new project with a postgres database.
202
- */
203
- createProjectWithPostgresDatabase(options) {
204
- return (options?.client ?? this.client).post({
205
- url: "/v1/projects",
206
- ...options,
207
- headers: {
208
- "Content-Type": "application/json",
209
- ...options?.headers
210
- }
211
- });
212
- }
213
- /**
214
- * Delete project
215
- *
216
- * Deletes the project with the given ID.
217
- */
218
- deleteProject(options) {
219
- return (options.client ?? this.client).delete({
220
- url: "/v1/projects/{id}",
221
- ...options
222
- });
223
- }
224
- /**
225
- * Get project
226
- *
227
- * Returns the project with the given ID.
228
- */
229
- getProject(options) {
230
- return (options.client ?? this.client).get({
231
- url: "/v1/projects/{id}",
232
- ...options
233
- });
234
- }
235
- /**
236
- * Update project
237
- *
238
- * Updates the project with the given ID.
239
- */
240
- updateProject(options) {
241
- return (options.client ?? this.client).patch({
242
- url: "/v1/projects/{id}",
243
- ...options,
244
- headers: {
245
- "Content-Type": "application/json",
246
- ...options.headers
247
- }
248
- });
249
- }
250
- /**
251
- * Transfer project
252
- *
253
- * Transfer the project with the given ID to the new owner's workspace
254
- */
255
- transferProject(options) {
256
- return (options.client ?? this.client).post({
257
- url: "/v1/projects/{id}/transfer",
258
- ...options,
259
- headers: {
260
- "Content-Type": "application/json",
261
- ...options.headers
262
- }
263
- });
264
- }
265
- /**
266
- * Get list of databases
267
- *
268
- * Returns databases for the given project.
269
- */
270
- listDatabases2(options) {
271
- return (options.client ?? this.client).get({
272
- url: "/v1/projects/{projectId}/databases",
273
- ...options
274
- });
275
- }
276
- /**
277
- * Create database
278
- *
279
- * Creates a new database for the given project.
280
- */
281
- createDatabase2(options) {
282
- return (options.client ?? this.client).post({
283
- url: "/v1/projects/{projectId}/databases",
284
- ...options,
285
- headers: {
286
- "Content-Type": "application/json",
287
- ...options.headers
288
- }
289
- });
290
- }
291
- /**
292
- * Get list of integrations
293
- *
294
- * Returns integrations filtered by workspace ID.
295
- */
296
- listIntegrations(options) {
297
- return (options.client ?? this.client).get({
298
- url: "/v1/integrations",
299
- ...options
300
- });
301
- }
302
- /**
303
- * Delete integration
304
- *
305
- * Revokes the integration tokens by integration ID.
306
- */
307
- deleteIntegration(options) {
308
- return (options.client ?? this.client).delete({
309
- url: "/v1/integrations/{id}",
310
- ...options
311
- });
312
- }
313
- /**
314
- * Get integration by ID
315
- *
316
- * Returns a single integration by its ID.
317
- */
318
- getIntegrationById(options) {
319
- return (options.client ?? this.client).get({
320
- url: "/v1/integrations/{id}",
321
- ...options
322
- });
323
- }
324
- /**
325
- * Get list of integrations
326
- *
327
- * Returns integrations for the given workspace.
328
- */
329
- listIntegrations2(options) {
330
- return (options.client ?? this.client).get({
331
- url: "/v1/workspaces/{workspaceId}/integrations",
332
- ...options
333
- });
334
- }
335
- /**
336
- * Revoke integration tokens
337
- *
338
- * Revokes the integration tokens with the given client ID.
339
- */
340
- revokeIntegrationTokens(options) {
341
- return (options.client ?? this.client).delete({
342
- url: "/v1/workspaces/{workspaceId}/integrations/{clientId}",
343
- ...options
344
- });
345
- }
346
- /**
347
- * Get all regions
348
- *
349
- * Returns all available regions across products. Optionally filter by product.
350
- */
351
- getAllRegions(options) {
352
- return (options?.client ?? this.client).get({
353
- url: "/v1/regions",
354
- ...options
355
- });
356
- }
357
- /**
358
- * Get Prisma Postgres regions
359
- *
360
- * Returns all available regions for Prisma Postgres.
361
- */
362
- getPrismaPostgresRegions(options) {
363
- return (options?.client ?? this.client).get({
364
- url: "/v1/regions/postgres",
365
- ...options
366
- });
367
- }
368
- /**
369
- * Get Prisma Accelerate regions
370
- *
371
- * Returns all available regions for Prisma Accelerate.
372
- */
373
- getPrismaAccelerateRegions(options) {
374
- return (options?.client ?? this.client).get({
375
- url: "/v1/regions/accelerate",
376
- ...options
377
- });
378
- }
379
- /**
380
- * Get list of workspaces
381
- *
382
- * Returns the list of workspaces the current token can access.
383
- */
384
- listWorkspaces(options) {
385
- return (options?.client ?? this.client).get({
386
- url: "/v1/workspaces",
387
- ...options
388
- });
389
- }
390
- /**
391
- * Get workspace
392
- *
393
- * Returns the workspace with the given ID.
394
- */
395
- getWorkspace(options) {
396
- return (options.client ?? this.client).get({
397
- url: "/v1/workspaces/{id}",
398
- ...options
399
- });
400
- }
401
- };
402
-
403
- //#endregion
404
- export { PrismaClient };
File without changes
@@ -1 +0,0 @@
1
- export { };
@@ -1,17 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- //#region src/helpers/prisma-postgres.ts
4
- /**
5
- * Find a Postgres database by name.
6
- *
7
- * @param context - The Prisma plugin context.
8
- * @param name - The name of the database to find.
9
- * @returns The database object if found, otherwise undefined.
10
- */
11
- async function findDatabaseByName(context, name) {
12
- if (!context.config.prisma.prismaPostgres?.projectId) throw new Error(`Prisma Postgres project ID is not configured. Please set "prisma.prismaPostgres.projectId" in your Powerlines configuration.`);
13
- return (await context.prisma.api.listDatabases({ path: { projectId: context.config.prisma.prismaPostgres.projectId } })).data.data.find((db) => db.name === name);
14
- }
15
-
16
- //#endregion
17
- exports.findDatabaseByName = findDatabaseByName;
@@ -1,15 +0,0 @@
1
- //#region src/helpers/prisma-postgres.ts
2
- /**
3
- * Find a Postgres database by name.
4
- *
5
- * @param context - The Prisma plugin context.
6
- * @param name - The name of the database to find.
7
- * @returns The database object if found, otherwise undefined.
8
- */
9
- async function findDatabaseByName(context, name) {
10
- if (!context.config.prisma.prismaPostgres?.projectId) throw new Error(`Prisma Postgres project ID is not configured. Please set "prisma.prismaPostgres.projectId" in your Powerlines configuration.`);
11
- return (await context.prisma.api.listDatabases({ path: { projectId: context.config.prisma.prismaPostgres.projectId } })).data.data.find((db) => db.name === name);
12
- }
13
-
14
- //#endregion
15
- export { findDatabaseByName };