@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,180 +0,0 @@
1
- import { a as serializeObjectParam, i as serializeArrayParam, o as serializePrimitiveParam } from "./pathSerializer.gen-m7BRzH23.mjs";
2
- import { r as getUrl } from "./utils.gen-RO8GxC4i.mjs";
3
- import { t as getAuthToken } from "./auth.gen-C4FxE4_3.mjs";
4
- import { n as jsonBodySerializer } from "./bodySerializer.gen-DBXNewIA.mjs";
5
-
6
- //#region src/api/client/utils.gen.ts
7
- const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
8
- const querySerializer = (queryParams) => {
9
- const search = [];
10
- if (queryParams && typeof queryParams === "object") for (const name in queryParams) {
11
- const value = queryParams[name];
12
- if (value === void 0 || value === null) continue;
13
- const options = parameters[name] || args;
14
- if (Array.isArray(value)) {
15
- const serializedArray = serializeArrayParam({
16
- allowReserved: options.allowReserved,
17
- explode: true,
18
- name,
19
- style: "form",
20
- value,
21
- ...options.array
22
- });
23
- if (serializedArray) search.push(serializedArray);
24
- } else if (typeof value === "object") {
25
- const serializedObject = serializeObjectParam({
26
- allowReserved: options.allowReserved,
27
- explode: true,
28
- name,
29
- style: "deepObject",
30
- value,
31
- ...options.object
32
- });
33
- if (serializedObject) search.push(serializedObject);
34
- } else {
35
- const serializedPrimitive = serializePrimitiveParam({
36
- allowReserved: options.allowReserved,
37
- name,
38
- value
39
- });
40
- if (serializedPrimitive) search.push(serializedPrimitive);
41
- }
42
- }
43
- return search.join("&");
44
- };
45
- return querySerializer;
46
- };
47
- /**
48
- * Infers parseAs value from provided Content-Type header.
49
- */
50
- const getParseAs = (contentType) => {
51
- if (!contentType) return "stream";
52
- const cleanContent = contentType.split(";")[0]?.trim();
53
- if (!cleanContent) return;
54
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) return "json";
55
- if (cleanContent === "multipart/form-data") return "formData";
56
- if ([
57
- "application/",
58
- "audio/",
59
- "image/",
60
- "video/"
61
- ].some((type) => cleanContent.startsWith(type))) return "blob";
62
- if (cleanContent.startsWith("text/")) return "text";
63
- };
64
- const checkForExistence = (options, name) => {
65
- if (!name) return false;
66
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) return true;
67
- return false;
68
- };
69
- const setAuthParams = async ({ security, ...options }) => {
70
- for (const auth of security) {
71
- if (checkForExistence(options, auth.name)) continue;
72
- const token = await getAuthToken(auth, options.auth);
73
- if (!token) continue;
74
- const name = auth.name ?? "Authorization";
75
- switch (auth.in) {
76
- case "query":
77
- if (!options.query) options.query = {};
78
- options.query[name] = token;
79
- break;
80
- case "cookie":
81
- options.headers.append("Cookie", `${name}=${token}`);
82
- break;
83
- case "header":
84
- default:
85
- options.headers.set(name, token);
86
- break;
87
- }
88
- }
89
- };
90
- const buildUrl = (options) => getUrl({
91
- baseUrl: options.baseUrl,
92
- path: options.path,
93
- query: options.query,
94
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
95
- url: options.url
96
- });
97
- const mergeConfigs = (a, b) => {
98
- const config = {
99
- ...a,
100
- ...b
101
- };
102
- if (config.baseUrl?.endsWith("/")) config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
103
- config.headers = mergeHeaders(a.headers, b.headers);
104
- return config;
105
- };
106
- const headersEntries = (headers) => {
107
- const entries = [];
108
- headers.forEach((value, key) => {
109
- entries.push([key, value]);
110
- });
111
- return entries;
112
- };
113
- const mergeHeaders = (...headers) => {
114
- const mergedHeaders = new Headers();
115
- for (const header of headers) {
116
- if (!header) continue;
117
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
118
- for (const [key, value] of iterator) if (value === null) mergedHeaders.delete(key);
119
- else if (Array.isArray(value)) for (const v of value) mergedHeaders.append(key, v);
120
- else if (value !== void 0) mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
121
- }
122
- return mergedHeaders;
123
- };
124
- var Interceptors = class {
125
- fns = [];
126
- clear() {
127
- this.fns = [];
128
- }
129
- eject(id) {
130
- const index = this.getInterceptorIndex(id);
131
- if (this.fns[index]) this.fns[index] = null;
132
- }
133
- exists(id) {
134
- const index = this.getInterceptorIndex(id);
135
- return Boolean(this.fns[index]);
136
- }
137
- getInterceptorIndex(id) {
138
- if (typeof id === "number") return this.fns[id] ? id : -1;
139
- return this.fns.indexOf(id);
140
- }
141
- update(id, fn) {
142
- const index = this.getInterceptorIndex(id);
143
- if (this.fns[index]) {
144
- this.fns[index] = fn;
145
- return id;
146
- }
147
- return false;
148
- }
149
- use(fn) {
150
- this.fns.push(fn);
151
- return this.fns.length - 1;
152
- }
153
- };
154
- const createInterceptors = () => ({
155
- error: new Interceptors(),
156
- request: new Interceptors(),
157
- response: new Interceptors()
158
- });
159
- const defaultQuerySerializer = createQuerySerializer({
160
- allowReserved: false,
161
- array: {
162
- explode: true,
163
- style: "form"
164
- },
165
- object: {
166
- explode: true,
167
- style: "deepObject"
168
- }
169
- });
170
- const defaultHeaders = { "Content-Type": "application/json" };
171
- const createConfig = (override = {}) => ({
172
- ...jsonBodySerializer,
173
- headers: defaultHeaders,
174
- parseAs: "auto",
175
- querySerializer: defaultQuerySerializer,
176
- ...override
177
- });
178
-
179
- //#endregion
180
- export { getParseAs as a, setAuthParams as c, createQuerySerializer as i, createConfig as n, mergeConfigs as o, createInterceptors as r, mergeHeaders as s, buildUrl as t };
@@ -1,227 +0,0 @@
1
- const require_pathSerializer_gen = require('./pathSerializer.gen-BEbuI0Vn.cjs');
2
- const require_utils_gen = require('./utils.gen-Bk2pTkV1.cjs');
3
- const require_auth_gen = require('./auth.gen-BFteuMTV.cjs');
4
- const require_bodySerializer_gen = require('./bodySerializer.gen-BLtxkFoA.cjs');
5
-
6
- //#region src/api/client/utils.gen.ts
7
- const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
8
- const querySerializer = (queryParams) => {
9
- const search = [];
10
- if (queryParams && typeof queryParams === "object") for (const name in queryParams) {
11
- const value = queryParams[name];
12
- if (value === void 0 || value === null) continue;
13
- const options = parameters[name] || args;
14
- if (Array.isArray(value)) {
15
- const serializedArray = require_pathSerializer_gen.serializeArrayParam({
16
- allowReserved: options.allowReserved,
17
- explode: true,
18
- name,
19
- style: "form",
20
- value,
21
- ...options.array
22
- });
23
- if (serializedArray) search.push(serializedArray);
24
- } else if (typeof value === "object") {
25
- const serializedObject = require_pathSerializer_gen.serializeObjectParam({
26
- allowReserved: options.allowReserved,
27
- explode: true,
28
- name,
29
- style: "deepObject",
30
- value,
31
- ...options.object
32
- });
33
- if (serializedObject) search.push(serializedObject);
34
- } else {
35
- const serializedPrimitive = require_pathSerializer_gen.serializePrimitiveParam({
36
- allowReserved: options.allowReserved,
37
- name,
38
- value
39
- });
40
- if (serializedPrimitive) search.push(serializedPrimitive);
41
- }
42
- }
43
- return search.join("&");
44
- };
45
- return querySerializer;
46
- };
47
- /**
48
- * Infers parseAs value from provided Content-Type header.
49
- */
50
- const getParseAs = (contentType) => {
51
- if (!contentType) return "stream";
52
- const cleanContent = contentType.split(";")[0]?.trim();
53
- if (!cleanContent) return;
54
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) return "json";
55
- if (cleanContent === "multipart/form-data") return "formData";
56
- if ([
57
- "application/",
58
- "audio/",
59
- "image/",
60
- "video/"
61
- ].some((type) => cleanContent.startsWith(type))) return "blob";
62
- if (cleanContent.startsWith("text/")) return "text";
63
- };
64
- const checkForExistence = (options, name) => {
65
- if (!name) return false;
66
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) return true;
67
- return false;
68
- };
69
- const setAuthParams = async ({ security, ...options }) => {
70
- for (const auth of security) {
71
- if (checkForExistence(options, auth.name)) continue;
72
- const token = await require_auth_gen.getAuthToken(auth, options.auth);
73
- if (!token) continue;
74
- const name = auth.name ?? "Authorization";
75
- switch (auth.in) {
76
- case "query":
77
- if (!options.query) options.query = {};
78
- options.query[name] = token;
79
- break;
80
- case "cookie":
81
- options.headers.append("Cookie", `${name}=${token}`);
82
- break;
83
- case "header":
84
- default:
85
- options.headers.set(name, token);
86
- break;
87
- }
88
- }
89
- };
90
- const buildUrl = (options) => require_utils_gen.getUrl({
91
- baseUrl: options.baseUrl,
92
- path: options.path,
93
- query: options.query,
94
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
95
- url: options.url
96
- });
97
- const mergeConfigs = (a, b) => {
98
- const config = {
99
- ...a,
100
- ...b
101
- };
102
- if (config.baseUrl?.endsWith("/")) config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
103
- config.headers = mergeHeaders(a.headers, b.headers);
104
- return config;
105
- };
106
- const headersEntries = (headers) => {
107
- const entries = [];
108
- headers.forEach((value, key) => {
109
- entries.push([key, value]);
110
- });
111
- return entries;
112
- };
113
- const mergeHeaders = (...headers) => {
114
- const mergedHeaders = new Headers();
115
- for (const header of headers) {
116
- if (!header) continue;
117
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
118
- for (const [key, value] of iterator) if (value === null) mergedHeaders.delete(key);
119
- else if (Array.isArray(value)) for (const v of value) mergedHeaders.append(key, v);
120
- else if (value !== void 0) mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
121
- }
122
- return mergedHeaders;
123
- };
124
- var Interceptors = class {
125
- fns = [];
126
- clear() {
127
- this.fns = [];
128
- }
129
- eject(id) {
130
- const index = this.getInterceptorIndex(id);
131
- if (this.fns[index]) this.fns[index] = null;
132
- }
133
- exists(id) {
134
- const index = this.getInterceptorIndex(id);
135
- return Boolean(this.fns[index]);
136
- }
137
- getInterceptorIndex(id) {
138
- if (typeof id === "number") return this.fns[id] ? id : -1;
139
- return this.fns.indexOf(id);
140
- }
141
- update(id, fn) {
142
- const index = this.getInterceptorIndex(id);
143
- if (this.fns[index]) {
144
- this.fns[index] = fn;
145
- return id;
146
- }
147
- return false;
148
- }
149
- use(fn) {
150
- this.fns.push(fn);
151
- return this.fns.length - 1;
152
- }
153
- };
154
- const createInterceptors = () => ({
155
- error: new Interceptors(),
156
- request: new Interceptors(),
157
- response: new Interceptors()
158
- });
159
- const defaultQuerySerializer = createQuerySerializer({
160
- allowReserved: false,
161
- array: {
162
- explode: true,
163
- style: "form"
164
- },
165
- object: {
166
- explode: true,
167
- style: "deepObject"
168
- }
169
- });
170
- const defaultHeaders = { "Content-Type": "application/json" };
171
- const createConfig = (override = {}) => ({
172
- ...require_bodySerializer_gen.jsonBodySerializer,
173
- headers: defaultHeaders,
174
- parseAs: "auto",
175
- querySerializer: defaultQuerySerializer,
176
- ...override
177
- });
178
-
179
- //#endregion
180
- Object.defineProperty(exports, 'buildUrl', {
181
- enumerable: true,
182
- get: function () {
183
- return buildUrl;
184
- }
185
- });
186
- Object.defineProperty(exports, 'createConfig', {
187
- enumerable: true,
188
- get: function () {
189
- return createConfig;
190
- }
191
- });
192
- Object.defineProperty(exports, 'createInterceptors', {
193
- enumerable: true,
194
- get: function () {
195
- return createInterceptors;
196
- }
197
- });
198
- Object.defineProperty(exports, 'createQuerySerializer', {
199
- enumerable: true,
200
- get: function () {
201
- return createQuerySerializer;
202
- }
203
- });
204
- Object.defineProperty(exports, 'getParseAs', {
205
- enumerable: true,
206
- get: function () {
207
- return getParseAs;
208
- }
209
- });
210
- Object.defineProperty(exports, 'mergeConfigs', {
211
- enumerable: true,
212
- get: function () {
213
- return mergeConfigs;
214
- }
215
- });
216
- Object.defineProperty(exports, 'mergeHeaders', {
217
- enumerable: true,
218
- get: function () {
219
- return mergeHeaders;
220
- }
221
- });
222
- Object.defineProperty(exports, 'setAuthParams', {
223
- enumerable: true,
224
- get: function () {
225
- return setAuthParams;
226
- }
227
- });
@@ -1,78 +0,0 @@
1
- import { a as serializeObjectParam, i as serializeArrayParam, o as serializePrimitiveParam } from "./pathSerializer.gen-m7BRzH23.mjs";
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, serializeArrayParam({
27
- explode,
28
- name,
29
- style,
30
- value
31
- }));
32
- continue;
33
- }
34
- if (typeof value === "object") {
35
- url = url.replace(match, 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, `;${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
- export { getValidRequestBody as i, defaultPathSerializer as n, getUrl as r, PATH_PARAM_RE as t };