@powerlines/plugin-prisma 0.2.207 → 0.2.209

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 (82) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/api/client/client.gen.cjs +175 -8
  3. package/dist/api/client/client.gen.mjs +174 -7
  4. package/dist/api/client/index.cjs +13 -18
  5. package/dist/api/client/index.mjs +5 -10
  6. package/dist/api/client/utils.gen.cjs +186 -13
  7. package/dist/api/client/utils.gen.mjs +178 -5
  8. package/dist/api/client.gen.cjs +8 -12
  9. package/dist/api/client.gen.mjs +7 -11
  10. package/dist/api/core/auth.gen.cjs +11 -2
  11. package/dist/api/core/auth.gen.mjs +9 -1
  12. package/dist/api/core/bodySerializer.gen.cjs +34 -4
  13. package/dist/api/core/bodySerializer.gen.mjs +30 -1
  14. package/dist/api/core/params.gen.cjs +64 -2
  15. package/dist/api/core/params.gen.mjs +62 -1
  16. package/dist/api/core/pathSerializer.gen.cjs +86 -7
  17. package/dist/api/core/pathSerializer.gen.mjs +79 -1
  18. package/dist/api/core/queryKeySerializer.gen.cjs +65 -4
  19. package/dist/api/core/queryKeySerializer.gen.mjs +61 -1
  20. package/dist/api/core/serverSentEvents.gen.cjs +94 -2
  21. package/dist/api/core/serverSentEvents.gen.mjs +92 -1
  22. package/dist/api/core/utils.gen.cjs +80 -6
  23. package/dist/api/core/utils.gen.mjs +76 -2
  24. package/dist/api/sdk.gen.cjs +255 -13
  25. package/dist/api/sdk.gen.mjs +254 -12
  26. package/dist/api/types.gen.cjs +0 -1
  27. package/dist/api/types.gen.mjs +0 -2
  28. package/dist/helpers/get-schema.cjs +80 -2
  29. package/dist/helpers/get-schema.mjs +76 -1
  30. package/dist/helpers/index.cjs +6 -6
  31. package/dist/helpers/index.mjs +3 -3
  32. package/dist/helpers/prisma-postgres.cjs +15 -2
  33. package/dist/helpers/prisma-postgres.mjs +13 -1
  34. package/dist/helpers/schema-creator.cjs +60 -2
  35. package/dist/helpers/schema-creator.mjs +58 -1
  36. package/dist/index.cjs +14 -25
  37. package/dist/index.mjs +6 -18
  38. package/dist/types/index.cjs +0 -3
  39. package/dist/types/index.mjs +0 -4
  40. package/dist/types/plugin.cjs +0 -1
  41. package/dist/types/plugin.mjs +0 -2
  42. package/dist/types/prisma.cjs +0 -1
  43. package/dist/types/prisma.mjs +0 -2
  44. package/package.json +5 -5
  45. package/dist/auth.gen-BFteuMTV.cjs +0 -17
  46. package/dist/auth.gen-C4FxE4_3.mjs +0 -11
  47. package/dist/bodySerializer.gen-BLtxkFoA.cjs +0 -50
  48. package/dist/bodySerializer.gen-DBXNewIA.mjs +0 -32
  49. package/dist/client-BlRUW8mL.mjs +0 -1
  50. package/dist/client-DBAc9HV1.cjs +0 -0
  51. package/dist/client.gen-COMS1glH.mjs +0 -8
  52. package/dist/client.gen-CPQm4WCv.mjs +0 -176
  53. package/dist/client.gen-DPSMNZNm.cjs +0 -181
  54. package/dist/client.gen-JhYC1fDf.cjs +0 -13
  55. package/dist/get-schema-CKw6MiKb.mjs +0 -78
  56. package/dist/get-schema-CqMBOHOd.cjs +0 -118
  57. package/dist/params.gen-BM1l95BD.mjs +0 -64
  58. package/dist/params.gen-BtCSnwiV.cjs +0 -70
  59. package/dist/pathSerializer.gen-BEbuI0Vn.cjs +0 -117
  60. package/dist/pathSerializer.gen-m7BRzH23.mjs +0 -81
  61. package/dist/plugin-DE9fKOLA.cjs +0 -0
  62. package/dist/plugin-EFmNQLKA.mjs +0 -1
  63. package/dist/prisma-BzQJneyW.cjs +0 -0
  64. package/dist/prisma-CB-m5c-j.mjs +0 -1
  65. package/dist/prisma-postgres-CAOpTtWq.mjs +0 -15
  66. package/dist/prisma-postgres-dGaLzxF3.cjs +0 -21
  67. package/dist/queryKeySerializer.gen-4TWHHXn3.cjs +0 -81
  68. package/dist/queryKeySerializer.gen-BMMZAjVN.mjs +0 -63
  69. package/dist/schema-creator-Cfian3ih.mjs +0 -60
  70. package/dist/schema-creator-zmlwh4-l.cjs +0 -66
  71. package/dist/sdk.gen-B2his2jD.mjs +0 -256
  72. package/dist/sdk.gen-CAWIQ8BM.cjs +0 -261
  73. package/dist/serverSentEvents.gen-C4apQvDl.mjs +0 -94
  74. package/dist/serverSentEvents.gen-CiMMmhyQ.cjs +0 -100
  75. package/dist/types-CmY9-4ff.cjs +0 -0
  76. package/dist/types-Dbwx-Khg.mjs +0 -1
  77. package/dist/types.gen-BN-p9nVT.cjs +0 -0
  78. package/dist/types.gen-CS2KiRfG.mjs +0 -1
  79. package/dist/utils.gen-Bk2pTkV1.cjs +0 -101
  80. package/dist/utils.gen-C-7sZa7Z.mjs +0 -180
  81. package/dist/utils.gen-DATakax-.cjs +0 -227
  82. package/dist/utils.gen-RO8GxC4i.mjs +0 -78
@@ -1,261 +0,0 @@
1
- const require_client_gen = require('./client.gen-JhYC1fDf.cjs');
2
-
3
- //#region src/api/sdk.gen.ts
4
- var HeyApiClient = class {
5
- client;
6
- constructor(args) {
7
- this.client = args?.client ?? require_client_gen.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
- * Delete database connection string
30
- *
31
- * Deletes the database connection string with the given ID.
32
- */
33
- deleteDatabaseConnectionString(options) {
34
- return (options.client ?? this.client).delete({
35
- url: "/v1/connections/{id}",
36
- ...options
37
- });
38
- }
39
- /**
40
- * Delete database
41
- *
42
- * Deletes the database with the given ID.
43
- */
44
- deleteDatabase(options) {
45
- return (options.client ?? this.client).delete({
46
- url: "/v1/databases/{databaseId}",
47
- ...options
48
- });
49
- }
50
- /**
51
- * Get database
52
- *
53
- * Returns the database with the given ID.
54
- */
55
- getDatabase(options) {
56
- return (options.client ?? this.client).get({
57
- url: "/v1/databases/{databaseId}",
58
- ...options
59
- });
60
- }
61
- /**
62
- * Get list of database connections
63
- *
64
- * Returns all connections for the given database.
65
- */
66
- listDatabaseConnections(options) {
67
- return (options.client ?? this.client).get({
68
- url: "/v1/databases/{databaseId}/connections",
69
- ...options
70
- });
71
- }
72
- /**
73
- * Create database connection string
74
- *
75
- * Creates a new connection string for the given database.
76
- */
77
- createDatabaseConnectionString(options) {
78
- return (options.client ?? this.client).post({
79
- url: "/v1/databases/{databaseId}/connections",
80
- ...options,
81
- headers: {
82
- "Content-Type": "application/json",
83
- ...options.headers
84
- }
85
- });
86
- }
87
- /**
88
- * Get list of backups
89
- *
90
- * Returns backups for the specified database.
91
- */
92
- listBackups(options) {
93
- return (options.client ?? this.client).get({
94
- url: "/v1/databases/{databaseId}/backups",
95
- ...options
96
- });
97
- }
98
- /**
99
- * Get database usage metrics
100
- *
101
- * Returns usage metrics for the specified database.
102
- */
103
- getDatabaseUsageMetrics(options) {
104
- return (options.client ?? this.client).get({
105
- url: "/v1/databases/{databaseId}/usage",
106
- ...options
107
- });
108
- }
109
- /**
110
- * Get list of projects
111
- *
112
- * Returns the list of projects the token has access to.
113
- */
114
- listProjects(options) {
115
- return (options?.client ?? this.client).get({
116
- url: "/v1/projects",
117
- ...options
118
- });
119
- }
120
- /**
121
- * Create project with a postgres database
122
- *
123
- * Creates a new project with a postgres database.
124
- */
125
- createProjectWithPostgresDatabase(options) {
126
- return (options?.client ?? this.client).post({
127
- url: "/v1/projects",
128
- ...options,
129
- headers: {
130
- "Content-Type": "application/json",
131
- ...options?.headers
132
- }
133
- });
134
- }
135
- /**
136
- * Delete project
137
- *
138
- * Deletes the project with the given ID.
139
- */
140
- deleteProject(options) {
141
- return (options.client ?? this.client).delete({
142
- url: "/v1/projects/{id}",
143
- ...options
144
- });
145
- }
146
- /**
147
- * Get project
148
- *
149
- * Returns the project with the given ID.
150
- */
151
- getProject(options) {
152
- return (options.client ?? this.client).get({
153
- url: "/v1/projects/{id}",
154
- ...options
155
- });
156
- }
157
- /**
158
- * Transfer project
159
- *
160
- * Transfer the project with the given ID to the new owner's workspace
161
- */
162
- transferProject(options) {
163
- return (options.client ?? this.client).post({
164
- url: "/v1/projects/{id}/transfer",
165
- ...options,
166
- headers: {
167
- "Content-Type": "application/json",
168
- ...options.headers
169
- }
170
- });
171
- }
172
- /**
173
- * Get list of databases
174
- *
175
- * Returns databases for the given project.
176
- */
177
- listDatabases(options) {
178
- return (options.client ?? this.client).get({
179
- url: "/v1/projects/{projectId}/databases",
180
- ...options
181
- });
182
- }
183
- /**
184
- * Create database
185
- *
186
- * Creates a new database for the given project.
187
- */
188
- createDatabase(options) {
189
- return (options.client ?? this.client).post({
190
- url: "/v1/projects/{projectId}/databases",
191
- ...options,
192
- headers: {
193
- "Content-Type": "application/json",
194
- ...options.headers
195
- }
196
- });
197
- }
198
- /**
199
- * Get list of integrations
200
- *
201
- * Returns integrations for the given workspace.
202
- */
203
- listIntegrations(options) {
204
- return (options.client ?? this.client).get({
205
- url: "/v1/workspaces/{workspaceId}/integrations",
206
- ...options
207
- });
208
- }
209
- /**
210
- * Revoke integration tokens
211
- *
212
- * Revokes the integration tokens with the given client ID.
213
- */
214
- revokeIntegrationTokens(options) {
215
- return (options.client ?? this.client).delete({
216
- url: "/v1/workspaces/{workspaceId}/integrations/{clientId}",
217
- ...options
218
- });
219
- }
220
- /**
221
- * Get Prisma Postgres regions
222
- *
223
- * Returns all available regions for Prisma Postgres.
224
- */
225
- getPrismaPostgresRegions(options) {
226
- return (options?.client ?? this.client).get({
227
- url: "/v1/regions/postgres",
228
- ...options
229
- });
230
- }
231
- /**
232
- * Get Prisma Accelerate regions
233
- *
234
- * Returns all available regions for Prisma Accelerate.
235
- */
236
- getPrismaAccelerateRegions(options) {
237
- return (options?.client ?? this.client).get({
238
- url: "/v1/regions/accelerate",
239
- ...options
240
- });
241
- }
242
- /**
243
- * Get list of workspaces
244
- *
245
- * Returns the list of workspaces the current token can access.
246
- */
247
- listWorkspaces(options) {
248
- return (options?.client ?? this.client).get({
249
- url: "/v1/workspaces",
250
- ...options
251
- });
252
- }
253
- };
254
-
255
- //#endregion
256
- Object.defineProperty(exports, 'PrismaClient', {
257
- enumerable: true,
258
- get: function () {
259
- return PrismaClient;
260
- }
261
- });
@@ -1,94 +0,0 @@
1
- //#region src/api/core/serverSentEvents.gen.ts
2
- const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
3
- let lastEventId;
4
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
5
- const createStream = async function* () {
6
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
7
- let attempt = 0;
8
- const signal = options.signal ?? new AbortController().signal;
9
- while (true) {
10
- if (signal.aborted) break;
11
- attempt++;
12
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
13
- if (lastEventId !== void 0) headers.set("Last-Event-ID", lastEventId);
14
- try {
15
- const requestInit = {
16
- redirect: "follow",
17
- ...options,
18
- body: options.serializedBody,
19
- headers,
20
- signal
21
- };
22
- let request = new Request(url, requestInit);
23
- if (onRequest) request = await onRequest(url, requestInit);
24
- const response = await (options.fetch ?? globalThis.fetch)(request);
25
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
26
- if (!response.body) throw new Error("No body in SSE response");
27
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
28
- let buffer = "";
29
- const abortHandler = () => {
30
- try {
31
- reader.cancel();
32
- } catch {}
33
- };
34
- signal.addEventListener("abort", abortHandler);
35
- try {
36
- while (true) {
37
- const { done, value } = await reader.read();
38
- if (done) break;
39
- buffer += value;
40
- buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
41
- const chunks = buffer.split("\n\n");
42
- buffer = chunks.pop() ?? "";
43
- for (const chunk of chunks) {
44
- const lines = chunk.split("\n");
45
- const dataLines = [];
46
- let eventName;
47
- for (const line of lines) if (line.startsWith("data:")) dataLines.push(line.replace(/^data:\s*/, ""));
48
- else if (line.startsWith("event:")) eventName = line.replace(/^event:\s*/, "");
49
- else if (line.startsWith("id:")) lastEventId = line.replace(/^id:\s*/, "");
50
- else if (line.startsWith("retry:")) {
51
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
52
- if (!Number.isNaN(parsed)) retryDelay = parsed;
53
- }
54
- let data;
55
- let parsedJson = false;
56
- if (dataLines.length) {
57
- const rawData = dataLines.join("\n");
58
- try {
59
- data = JSON.parse(rawData);
60
- parsedJson = true;
61
- } catch {
62
- data = rawData;
63
- }
64
- }
65
- if (parsedJson) {
66
- if (responseValidator) await responseValidator(data);
67
- if (responseTransformer) data = await responseTransformer(data);
68
- }
69
- onSseEvent?.({
70
- data,
71
- event: eventName,
72
- id: lastEventId,
73
- retry: retryDelay
74
- });
75
- if (dataLines.length) yield data;
76
- }
77
- }
78
- } finally {
79
- signal.removeEventListener("abort", abortHandler);
80
- reader.releaseLock();
81
- }
82
- break;
83
- } catch (error) {
84
- onSseError?.(error);
85
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
86
- await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
87
- }
88
- }
89
- };
90
- return { stream: createStream() };
91
- };
92
-
93
- //#endregion
94
- export { createSseClient as t };
@@ -1,100 +0,0 @@
1
-
2
- //#region src/api/core/serverSentEvents.gen.ts
3
- const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
4
- let lastEventId;
5
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
6
- const createStream = async function* () {
7
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
8
- let attempt = 0;
9
- const signal = options.signal ?? new AbortController().signal;
10
- while (true) {
11
- if (signal.aborted) break;
12
- attempt++;
13
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
14
- if (lastEventId !== void 0) headers.set("Last-Event-ID", lastEventId);
15
- try {
16
- const requestInit = {
17
- redirect: "follow",
18
- ...options,
19
- body: options.serializedBody,
20
- headers,
21
- signal
22
- };
23
- let request = new Request(url, requestInit);
24
- if (onRequest) request = await onRequest(url, requestInit);
25
- const response = await (options.fetch ?? globalThis.fetch)(request);
26
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
27
- if (!response.body) throw new Error("No body in SSE response");
28
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
29
- let buffer = "";
30
- const abortHandler = () => {
31
- try {
32
- reader.cancel();
33
- } catch {}
34
- };
35
- signal.addEventListener("abort", abortHandler);
36
- try {
37
- while (true) {
38
- const { done, value } = await reader.read();
39
- if (done) break;
40
- buffer += value;
41
- buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
42
- const chunks = buffer.split("\n\n");
43
- buffer = chunks.pop() ?? "";
44
- for (const chunk of chunks) {
45
- const lines = chunk.split("\n");
46
- const dataLines = [];
47
- let eventName;
48
- for (const line of lines) if (line.startsWith("data:")) dataLines.push(line.replace(/^data:\s*/, ""));
49
- else if (line.startsWith("event:")) eventName = line.replace(/^event:\s*/, "");
50
- else if (line.startsWith("id:")) lastEventId = line.replace(/^id:\s*/, "");
51
- else if (line.startsWith("retry:")) {
52
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
53
- if (!Number.isNaN(parsed)) retryDelay = parsed;
54
- }
55
- let data;
56
- let parsedJson = false;
57
- if (dataLines.length) {
58
- const rawData = dataLines.join("\n");
59
- try {
60
- data = JSON.parse(rawData);
61
- parsedJson = true;
62
- } catch {
63
- data = rawData;
64
- }
65
- }
66
- if (parsedJson) {
67
- if (responseValidator) await responseValidator(data);
68
- if (responseTransformer) data = await responseTransformer(data);
69
- }
70
- onSseEvent?.({
71
- data,
72
- event: eventName,
73
- id: lastEventId,
74
- retry: retryDelay
75
- });
76
- if (dataLines.length) yield data;
77
- }
78
- }
79
- } finally {
80
- signal.removeEventListener("abort", abortHandler);
81
- reader.releaseLock();
82
- }
83
- break;
84
- } catch (error) {
85
- onSseError?.(error);
86
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
87
- await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
88
- }
89
- }
90
- };
91
- return { stream: createStream() };
92
- };
93
-
94
- //#endregion
95
- Object.defineProperty(exports, 'createSseClient', {
96
- enumerable: true,
97
- get: function () {
98
- return createSseClient;
99
- }
100
- });
File without changes
@@ -1 +0,0 @@
1
- export { };
File without changes
@@ -1 +0,0 @@
1
- export { };
@@ -1,101 +0,0 @@
1
- const require_pathSerializer_gen = require('./pathSerializer.gen-BEbuI0Vn.cjs');
2
-
3
- //#region src/api/core/utils.gen.ts
4
- const PATH_PARAM_RE = /\{[^{}]+\}/g;
5
- const defaultPathSerializer = ({ path, url: _url }) => {
6
- let url = _url;
7
- const matches = _url.match(PATH_PARAM_RE);
8
- if (matches) for (const match of matches) {
9
- let explode = false;
10
- let name = match.substring(1, match.length - 1);
11
- let style = "simple";
12
- if (name.endsWith("*")) {
13
- explode = true;
14
- name = name.substring(0, name.length - 1);
15
- }
16
- if (name.startsWith(".")) {
17
- name = name.substring(1);
18
- style = "label";
19
- } else if (name.startsWith(";")) {
20
- name = name.substring(1);
21
- style = "matrix";
22
- }
23
- const value = path[name];
24
- if (value === void 0 || value === null) continue;
25
- if (Array.isArray(value)) {
26
- url = url.replace(match, require_pathSerializer_gen.serializeArrayParam({
27
- explode,
28
- name,
29
- style,
30
- value
31
- }));
32
- continue;
33
- }
34
- if (typeof value === "object") {
35
- url = url.replace(match, require_pathSerializer_gen.serializeObjectParam({
36
- explode,
37
- name,
38
- style,
39
- value,
40
- valueOnly: true
41
- }));
42
- continue;
43
- }
44
- if (style === "matrix") {
45
- url = url.replace(match, `;${require_pathSerializer_gen.serializePrimitiveParam({
46
- name,
47
- value
48
- })}`);
49
- continue;
50
- }
51
- const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
52
- url = url.replace(match, replaceValue);
53
- }
54
- return url;
55
- };
56
- const getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => {
57
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
58
- let url = (baseUrl ?? "") + pathUrl;
59
- if (path) url = defaultPathSerializer({
60
- path,
61
- url
62
- });
63
- let search = query ? querySerializer(query) : "";
64
- if (search.startsWith("?")) search = search.substring(1);
65
- if (search) url += `?${search}`;
66
- return url;
67
- };
68
- function getValidRequestBody(options) {
69
- const hasBody = options.body !== void 0;
70
- if (hasBody && options.bodySerializer) {
71
- if ("serializedBody" in options) return options.serializedBody !== void 0 && options.serializedBody !== "" ? options.serializedBody : null;
72
- return options.body !== "" ? options.body : null;
73
- }
74
- if (hasBody) return options.body;
75
- }
76
-
77
- //#endregion
78
- Object.defineProperty(exports, 'PATH_PARAM_RE', {
79
- enumerable: true,
80
- get: function () {
81
- return PATH_PARAM_RE;
82
- }
83
- });
84
- Object.defineProperty(exports, 'defaultPathSerializer', {
85
- enumerable: true,
86
- get: function () {
87
- return defaultPathSerializer;
88
- }
89
- });
90
- Object.defineProperty(exports, 'getUrl', {
91
- enumerable: true,
92
- get: function () {
93
- return getUrl;
94
- }
95
- });
96
- Object.defineProperty(exports, 'getValidRequestBody', {
97
- enumerable: true,
98
- get: function () {
99
- return getValidRequestBody;
100
- }
101
- });