@powerlines/plugin-prisma 0.2.75 → 0.2.77
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.
- package/dist/api/client/client.gen.cjs +8 -175
- package/dist/api/client/client.gen.mjs +7 -174
- package/dist/api/client/index.cjs +18 -13
- package/dist/api/client/index.mjs +10 -5
- package/dist/api/client/utils.gen.cjs +13 -186
- package/dist/api/client/utils.gen.mjs +5 -178
- package/dist/api/client.gen.cjs +12 -8
- package/dist/api/client.gen.mjs +11 -7
- package/dist/api/core/auth.gen.cjs +2 -11
- package/dist/api/core/auth.gen.mjs +1 -9
- package/dist/api/core/bodySerializer.gen.cjs +4 -34
- package/dist/api/core/bodySerializer.gen.mjs +1 -30
- package/dist/api/core/params.gen.cjs +2 -64
- package/dist/api/core/params.gen.mjs +1 -62
- package/dist/api/core/pathSerializer.gen.cjs +7 -86
- package/dist/api/core/pathSerializer.gen.mjs +1 -79
- package/dist/api/core/queryKeySerializer.gen.cjs +4 -65
- package/dist/api/core/queryKeySerializer.gen.mjs +1 -61
- package/dist/api/core/serverSentEvents.gen.cjs +2 -94
- package/dist/api/core/serverSentEvents.gen.mjs +1 -92
- package/dist/api/core/utils.gen.cjs +6 -80
- package/dist/api/core/utils.gen.mjs +2 -76
- package/dist/api/sdk.gen.cjs +13 -255
- package/dist/api/sdk.gen.mjs +12 -254
- package/dist/api/types.gen.cjs +1 -0
- package/dist/api/types.gen.mjs +2 -0
- package/dist/auth.gen-BFteuMTV.cjs +17 -0
- package/dist/auth.gen-C4FxE4_3.mjs +11 -0
- package/dist/bodySerializer.gen-BLtxkFoA.cjs +50 -0
- package/dist/bodySerializer.gen-DBXNewIA.mjs +32 -0
- package/dist/client-BlRUW8mL.mjs +1 -0
- package/dist/client-DBAc9HV1.cjs +0 -0
- package/dist/client.gen-COMS1glH.mjs +8 -0
- package/dist/client.gen-CPQm4WCv.mjs +176 -0
- package/dist/client.gen-DPSMNZNm.cjs +181 -0
- package/dist/client.gen-JhYC1fDf.cjs +13 -0
- package/dist/get-schema-CKw6MiKb.mjs +78 -0
- package/dist/get-schema-CqMBOHOd.cjs +118 -0
- package/dist/helpers/get-schema.cjs +2 -80
- package/dist/helpers/get-schema.mjs +1 -76
- package/dist/helpers/index.cjs +6 -6
- package/dist/helpers/index.mjs +3 -3
- package/dist/helpers/prisma-postgres.cjs +2 -15
- package/dist/helpers/prisma-postgres.mjs +1 -13
- package/dist/helpers/schema-creator.cjs +2 -60
- package/dist/helpers/schema-creator.mjs +1 -58
- package/dist/index.cjs +107 -20
- package/dist/index.mjs +96 -8
- package/dist/params.gen-BM1l95BD.mjs +64 -0
- package/dist/params.gen-BtCSnwiV.cjs +70 -0
- package/dist/pathSerializer.gen-BEbuI0Vn.cjs +117 -0
- package/dist/pathSerializer.gen-m7BRzH23.mjs +81 -0
- package/dist/plugin-DE9fKOLA.cjs +0 -0
- package/dist/plugin-EFmNQLKA.mjs +1 -0
- package/dist/prisma-BzQJneyW.cjs +0 -0
- package/dist/prisma-CB-m5c-j.mjs +1 -0
- package/dist/prisma-postgres-CAOpTtWq.mjs +15 -0
- package/dist/prisma-postgres-dGaLzxF3.cjs +21 -0
- package/dist/queryKeySerializer.gen-4TWHHXn3.cjs +81 -0
- package/dist/queryKeySerializer.gen-BMMZAjVN.mjs +63 -0
- package/dist/schema-creator-Cfian3ih.mjs +60 -0
- package/dist/schema-creator-zmlwh4-l.cjs +66 -0
- package/dist/sdk.gen-B2his2jD.mjs +256 -0
- package/dist/sdk.gen-CAWIQ8BM.cjs +261 -0
- package/dist/serverSentEvents.gen-C4apQvDl.mjs +94 -0
- package/dist/serverSentEvents.gen-CiMMmhyQ.cjs +100 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.mjs +2 -0
- package/dist/types/prisma.cjs +1 -0
- package/dist/types/prisma.mjs +2 -0
- package/dist/types-CmY9-4ff.cjs +0 -0
- package/dist/types-Dbwx-Khg.mjs +1 -0
- package/dist/types.gen-BN-p9nVT.cjs +0 -0
- package/dist/types.gen-CS2KiRfG.mjs +1 -0
- package/dist/utils.gen-Bk2pTkV1.cjs +101 -0
- package/dist/utils.gen-C-7sZa7Z.mjs +180 -0
- package/dist/utils.gen-DATakax-.cjs +227 -0
- package/dist/utils.gen-RO8GxC4i.mjs +78 -0
- package/package.json +6 -6
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/powerlines/src/plugin-utils/get-config-path.cjs +0 -49
- package/dist/powerlines/src/plugin-utils/get-config-path.mjs +0 -48
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
package/dist/types/index.mjs
CHANGED
package/dist/types/plugin.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../plugin-DE9fKOLA.cjs');
|
package/dist/types/plugin.mjs
CHANGED
package/dist/types/prisma.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../prisma-BzQJneyW.cjs');
|
package/dist/types/prisma.mjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,180 @@
|
|
|
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 };
|
|
@@ -0,0 +1,227 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-prisma",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.77",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to generate project code and a Prisma client from a Prisma schema (PSL).",
|
|
6
6
|
"repository": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@stryke/cli": "^0.12.37",
|
|
83
83
|
"defu": "^6.1.4",
|
|
84
84
|
"jiti": "^2.6.1",
|
|
85
|
-
"powerlines": "^0.36.
|
|
85
|
+
"powerlines": "^0.36.27",
|
|
86
86
|
"ts-pattern": "^5.9.0",
|
|
87
87
|
"prisma-util": "^2.1.1",
|
|
88
88
|
"@prisma/get-platform": "^6.19.1",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"fp-ts": "^2.16.11"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@powerlines/nx": "^0.11.
|
|
94
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
95
|
-
"@powerlines/plugin-hey-api": "^0.1.
|
|
93
|
+
"@powerlines/nx": "^0.11.53",
|
|
94
|
+
"@powerlines/plugin-plugin": "^0.12.75",
|
|
95
|
+
"@powerlines/plugin-hey-api": "^0.1.77",
|
|
96
96
|
"@types/node": "^24.10.4"
|
|
97
97
|
},
|
|
98
98
|
"publishConfig": { "access": "public" },
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "fbc59ce584fd0f78d90d2dbaa18f9c9267bd3b61"
|
|
100
100
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|