@powerlines/plugin-prisma 0.2.206 → 0.2.208
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/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/api/client/client.gen.cjs +175 -8
- package/dist/api/client/client.gen.mjs +174 -7
- package/dist/api/client/index.cjs +13 -18
- package/dist/api/client/index.mjs +5 -10
- package/dist/api/client/utils.gen.cjs +186 -13
- package/dist/api/client/utils.gen.mjs +178 -5
- package/dist/api/client.gen.cjs +8 -12
- package/dist/api/client.gen.mjs +7 -11
- package/dist/api/core/auth.gen.cjs +11 -2
- package/dist/api/core/auth.gen.mjs +9 -1
- package/dist/api/core/bodySerializer.gen.cjs +34 -4
- package/dist/api/core/bodySerializer.gen.mjs +30 -1
- package/dist/api/core/params.gen.cjs +64 -2
- package/dist/api/core/params.gen.mjs +62 -1
- package/dist/api/core/pathSerializer.gen.cjs +86 -7
- package/dist/api/core/pathSerializer.gen.mjs +79 -1
- package/dist/api/core/queryKeySerializer.gen.cjs +65 -4
- package/dist/api/core/queryKeySerializer.gen.mjs +61 -1
- package/dist/api/core/serverSentEvents.gen.cjs +94 -2
- package/dist/api/core/serverSentEvents.gen.mjs +92 -1
- package/dist/api/core/utils.gen.cjs +80 -6
- package/dist/api/core/utils.gen.mjs +76 -2
- package/dist/api/sdk.gen.cjs +255 -13
- package/dist/api/sdk.gen.mjs +254 -12
- package/dist/api/types.gen.cjs +0 -1
- package/dist/api/types.gen.mjs +0 -2
- package/dist/helpers/get-schema.cjs +80 -2
- package/dist/helpers/get-schema.mjs +76 -1
- package/dist/helpers/index.cjs +6 -6
- package/dist/helpers/index.mjs +3 -3
- package/dist/helpers/prisma-postgres.cjs +15 -2
- package/dist/helpers/prisma-postgres.mjs +13 -1
- package/dist/helpers/schema-creator.cjs +60 -2
- package/dist/helpers/schema-creator.mjs +58 -1
- package/dist/index.cjs +14 -25
- package/dist/index.mjs +6 -18
- package/dist/types/index.cjs +0 -3
- package/dist/types/index.mjs +0 -4
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.mjs +0 -2
- package/dist/types/prisma.cjs +0 -1
- package/dist/types/prisma.mjs +0 -2
- package/package.json +10 -10
- package/dist/auth.gen-BFteuMTV.cjs +0 -17
- package/dist/auth.gen-C4FxE4_3.mjs +0 -11
- package/dist/bodySerializer.gen-BLtxkFoA.cjs +0 -50
- package/dist/bodySerializer.gen-DBXNewIA.mjs +0 -32
- package/dist/client-BlRUW8mL.mjs +0 -1
- package/dist/client-DBAc9HV1.cjs +0 -0
- package/dist/client.gen-COMS1glH.mjs +0 -8
- package/dist/client.gen-CPQm4WCv.mjs +0 -176
- package/dist/client.gen-DPSMNZNm.cjs +0 -181
- package/dist/client.gen-JhYC1fDf.cjs +0 -13
- package/dist/get-schema-CKw6MiKb.mjs +0 -78
- package/dist/get-schema-CqMBOHOd.cjs +0 -118
- package/dist/params.gen-BM1l95BD.mjs +0 -64
- package/dist/params.gen-BtCSnwiV.cjs +0 -70
- package/dist/pathSerializer.gen-BEbuI0Vn.cjs +0 -117
- package/dist/pathSerializer.gen-m7BRzH23.mjs +0 -81
- package/dist/plugin-DE9fKOLA.cjs +0 -0
- package/dist/plugin-EFmNQLKA.mjs +0 -1
- package/dist/prisma-BzQJneyW.cjs +0 -0
- package/dist/prisma-CB-m5c-j.mjs +0 -1
- package/dist/prisma-postgres-CAOpTtWq.mjs +0 -15
- package/dist/prisma-postgres-dGaLzxF3.cjs +0 -21
- package/dist/queryKeySerializer.gen-4TWHHXn3.cjs +0 -81
- package/dist/queryKeySerializer.gen-BMMZAjVN.mjs +0 -63
- package/dist/schema-creator-Cfian3ih.mjs +0 -60
- package/dist/schema-creator-zmlwh4-l.cjs +0 -66
- package/dist/sdk.gen-B2his2jD.mjs +0 -256
- package/dist/sdk.gen-CAWIQ8BM.cjs +0 -261
- package/dist/serverSentEvents.gen-C4apQvDl.mjs +0 -94
- package/dist/serverSentEvents.gen-CiMMmhyQ.cjs +0 -100
- package/dist/types-CmY9-4ff.cjs +0 -0
- package/dist/types-Dbwx-Khg.mjs +0 -1
- package/dist/types.gen-BN-p9nVT.cjs +0 -0
- package/dist/types.gen-CS2KiRfG.mjs +0 -1
- package/dist/utils.gen-Bk2pTkV1.cjs +0 -101
- package/dist/utils.gen-C-7sZa7Z.mjs +0 -180
- package/dist/utils.gen-DATakax-.cjs +0 -227
- package/dist/utils.gen-RO8GxC4i.mjs +0 -78
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
|
@@ -1,9 +1,176 @@
|
|
|
1
|
-
require('
|
|
2
|
-
require('
|
|
3
|
-
require('
|
|
4
|
-
require('../../auth.gen-BFteuMTV.cjs');
|
|
5
|
-
require('../../bodySerializer.gen-BLtxkFoA.cjs');
|
|
6
|
-
require('../../utils.gen-DATakax-.cjs');
|
|
7
|
-
const require_client_gen = require('../../client.gen-DPSMNZNm.cjs');
|
|
1
|
+
const require_api_core_serverSentEvents_gen = require('../core/serverSentEvents.gen.cjs');
|
|
2
|
+
const require_api_core_utils_gen = require('../core/utils.gen.cjs');
|
|
3
|
+
const require_api_client_utils_gen = require('./utils.gen.cjs');
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
//#region src/api/client/client.gen.ts
|
|
6
|
+
const createClient = (config = {}) => {
|
|
7
|
+
let _config = require_api_client_utils_gen.mergeConfigs(require_api_client_utils_gen.createConfig(), config);
|
|
8
|
+
const getConfig = () => ({ ..._config });
|
|
9
|
+
const setConfig = (config$1) => {
|
|
10
|
+
_config = require_api_client_utils_gen.mergeConfigs(_config, config$1);
|
|
11
|
+
return getConfig();
|
|
12
|
+
};
|
|
13
|
+
const interceptors = require_api_client_utils_gen.createInterceptors();
|
|
14
|
+
const beforeRequest = async (options) => {
|
|
15
|
+
const opts = {
|
|
16
|
+
..._config,
|
|
17
|
+
...options,
|
|
18
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
19
|
+
headers: require_api_client_utils_gen.mergeHeaders(_config.headers, options.headers),
|
|
20
|
+
serializedBody: void 0
|
|
21
|
+
};
|
|
22
|
+
if (opts.security) await require_api_client_utils_gen.setAuthParams({
|
|
23
|
+
...opts,
|
|
24
|
+
security: opts.security
|
|
25
|
+
});
|
|
26
|
+
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
27
|
+
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
28
|
+
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
29
|
+
return {
|
|
30
|
+
opts,
|
|
31
|
+
url: require_api_client_utils_gen.buildUrl(opts)
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const request = async (options) => {
|
|
35
|
+
const { opts, url } = await beforeRequest(options);
|
|
36
|
+
const requestInit = {
|
|
37
|
+
redirect: "follow",
|
|
38
|
+
...opts,
|
|
39
|
+
body: require_api_core_utils_gen.getValidRequestBody(opts)
|
|
40
|
+
};
|
|
41
|
+
let request$1 = new Request(url, requestInit);
|
|
42
|
+
for (const fn of interceptors.request.fns) if (fn) request$1 = await fn(request$1, opts);
|
|
43
|
+
const _fetch = opts.fetch;
|
|
44
|
+
let response;
|
|
45
|
+
try {
|
|
46
|
+
response = await _fetch(request$1);
|
|
47
|
+
} catch (error$1) {
|
|
48
|
+
let finalError$1 = error$1;
|
|
49
|
+
for (const fn of interceptors.error.fns) if (fn) finalError$1 = await fn(error$1, void 0, request$1, opts);
|
|
50
|
+
finalError$1 = finalError$1 || {};
|
|
51
|
+
if (opts.throwOnError) throw finalError$1;
|
|
52
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
53
|
+
error: finalError$1,
|
|
54
|
+
request: request$1,
|
|
55
|
+
response: void 0
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request$1, opts);
|
|
59
|
+
const result = {
|
|
60
|
+
request: request$1,
|
|
61
|
+
response
|
|
62
|
+
};
|
|
63
|
+
if (response.ok) {
|
|
64
|
+
const parseAs = (opts.parseAs === "auto" ? require_api_client_utils_gen.getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
65
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
66
|
+
let emptyData;
|
|
67
|
+
switch (parseAs) {
|
|
68
|
+
case "arrayBuffer":
|
|
69
|
+
case "blob":
|
|
70
|
+
case "text":
|
|
71
|
+
emptyData = await response[parseAs]();
|
|
72
|
+
break;
|
|
73
|
+
case "formData":
|
|
74
|
+
emptyData = new FormData();
|
|
75
|
+
break;
|
|
76
|
+
case "stream":
|
|
77
|
+
emptyData = response.body;
|
|
78
|
+
break;
|
|
79
|
+
case "json":
|
|
80
|
+
default:
|
|
81
|
+
emptyData = {};
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
85
|
+
data: emptyData,
|
|
86
|
+
...result
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
let data;
|
|
90
|
+
switch (parseAs) {
|
|
91
|
+
case "arrayBuffer":
|
|
92
|
+
case "blob":
|
|
93
|
+
case "formData":
|
|
94
|
+
case "json":
|
|
95
|
+
case "text":
|
|
96
|
+
data = await response[parseAs]();
|
|
97
|
+
break;
|
|
98
|
+
case "stream": return opts.responseStyle === "data" ? response.body : {
|
|
99
|
+
data: response.body,
|
|
100
|
+
...result
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (parseAs === "json") {
|
|
104
|
+
if (opts.responseValidator) await opts.responseValidator(data);
|
|
105
|
+
if (opts.responseTransformer) data = await opts.responseTransformer(data);
|
|
106
|
+
}
|
|
107
|
+
return opts.responseStyle === "data" ? data : {
|
|
108
|
+
data,
|
|
109
|
+
...result
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const textError = await response.text();
|
|
113
|
+
let jsonError;
|
|
114
|
+
try {
|
|
115
|
+
jsonError = JSON.parse(textError);
|
|
116
|
+
} catch {}
|
|
117
|
+
const error = jsonError ?? textError;
|
|
118
|
+
let finalError = error;
|
|
119
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request$1, opts);
|
|
120
|
+
finalError = finalError || {};
|
|
121
|
+
if (opts.throwOnError) throw finalError;
|
|
122
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
123
|
+
error: finalError,
|
|
124
|
+
...result
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
const makeMethodFn = (method) => (options) => request({
|
|
128
|
+
...options,
|
|
129
|
+
method
|
|
130
|
+
});
|
|
131
|
+
const makeSseFn = (method) => async (options) => {
|
|
132
|
+
const { opts, url } = await beforeRequest(options);
|
|
133
|
+
return require_api_core_serverSentEvents_gen.createSseClient({
|
|
134
|
+
...opts,
|
|
135
|
+
body: opts.body,
|
|
136
|
+
headers: opts.headers,
|
|
137
|
+
method,
|
|
138
|
+
onRequest: async (url$1, init) => {
|
|
139
|
+
let request$1 = new Request(url$1, init);
|
|
140
|
+
for (const fn of interceptors.request.fns) if (fn) request$1 = await fn(request$1, opts);
|
|
141
|
+
return request$1;
|
|
142
|
+
},
|
|
143
|
+
url
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
buildUrl: require_api_client_utils_gen.buildUrl,
|
|
148
|
+
connect: makeMethodFn("CONNECT"),
|
|
149
|
+
delete: makeMethodFn("DELETE"),
|
|
150
|
+
get: makeMethodFn("GET"),
|
|
151
|
+
getConfig,
|
|
152
|
+
head: makeMethodFn("HEAD"),
|
|
153
|
+
interceptors,
|
|
154
|
+
options: makeMethodFn("OPTIONS"),
|
|
155
|
+
patch: makeMethodFn("PATCH"),
|
|
156
|
+
post: makeMethodFn("POST"),
|
|
157
|
+
put: makeMethodFn("PUT"),
|
|
158
|
+
request,
|
|
159
|
+
setConfig,
|
|
160
|
+
sse: {
|
|
161
|
+
connect: makeSseFn("CONNECT"),
|
|
162
|
+
delete: makeSseFn("DELETE"),
|
|
163
|
+
get: makeSseFn("GET"),
|
|
164
|
+
head: makeSseFn("HEAD"),
|
|
165
|
+
options: makeSseFn("OPTIONS"),
|
|
166
|
+
patch: makeSseFn("PATCH"),
|
|
167
|
+
post: makeSseFn("POST"),
|
|
168
|
+
put: makeSseFn("PUT"),
|
|
169
|
+
trace: makeSseFn("TRACE")
|
|
170
|
+
},
|
|
171
|
+
trace: makeMethodFn("TRACE")
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
exports.createClient = createClient;
|
|
@@ -1,9 +1,176 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "../../auth.gen-C4FxE4_3.mjs";
|
|
5
|
-
import "../../bodySerializer.gen-DBXNewIA.mjs";
|
|
6
|
-
import "../../utils.gen-C-7sZa7Z.mjs";
|
|
7
|
-
import { t as createClient } from "../../client.gen-CPQm4WCv.mjs";
|
|
1
|
+
import { createSseClient } from "../core/serverSentEvents.gen.mjs";
|
|
2
|
+
import { getValidRequestBody } from "../core/utils.gen.mjs";
|
|
3
|
+
import { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, mergeHeaders, setAuthParams } from "./utils.gen.mjs";
|
|
8
4
|
|
|
5
|
+
//#region src/api/client/client.gen.ts
|
|
6
|
+
const createClient = (config = {}) => {
|
|
7
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
8
|
+
const getConfig = () => ({ ..._config });
|
|
9
|
+
const setConfig = (config$1) => {
|
|
10
|
+
_config = mergeConfigs(_config, config$1);
|
|
11
|
+
return getConfig();
|
|
12
|
+
};
|
|
13
|
+
const interceptors = createInterceptors();
|
|
14
|
+
const beforeRequest = async (options) => {
|
|
15
|
+
const opts = {
|
|
16
|
+
..._config,
|
|
17
|
+
...options,
|
|
18
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
19
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
20
|
+
serializedBody: void 0
|
|
21
|
+
};
|
|
22
|
+
if (opts.security) await setAuthParams({
|
|
23
|
+
...opts,
|
|
24
|
+
security: opts.security
|
|
25
|
+
});
|
|
26
|
+
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
27
|
+
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
28
|
+
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
29
|
+
return {
|
|
30
|
+
opts,
|
|
31
|
+
url: buildUrl(opts)
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const request = async (options) => {
|
|
35
|
+
const { opts, url } = await beforeRequest(options);
|
|
36
|
+
const requestInit = {
|
|
37
|
+
redirect: "follow",
|
|
38
|
+
...opts,
|
|
39
|
+
body: getValidRequestBody(opts)
|
|
40
|
+
};
|
|
41
|
+
let request$1 = new Request(url, requestInit);
|
|
42
|
+
for (const fn of interceptors.request.fns) if (fn) request$1 = await fn(request$1, opts);
|
|
43
|
+
const _fetch = opts.fetch;
|
|
44
|
+
let response;
|
|
45
|
+
try {
|
|
46
|
+
response = await _fetch(request$1);
|
|
47
|
+
} catch (error$1) {
|
|
48
|
+
let finalError$1 = error$1;
|
|
49
|
+
for (const fn of interceptors.error.fns) if (fn) finalError$1 = await fn(error$1, void 0, request$1, opts);
|
|
50
|
+
finalError$1 = finalError$1 || {};
|
|
51
|
+
if (opts.throwOnError) throw finalError$1;
|
|
52
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
53
|
+
error: finalError$1,
|
|
54
|
+
request: request$1,
|
|
55
|
+
response: void 0
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request$1, opts);
|
|
59
|
+
const result = {
|
|
60
|
+
request: request$1,
|
|
61
|
+
response
|
|
62
|
+
};
|
|
63
|
+
if (response.ok) {
|
|
64
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
65
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
66
|
+
let emptyData;
|
|
67
|
+
switch (parseAs) {
|
|
68
|
+
case "arrayBuffer":
|
|
69
|
+
case "blob":
|
|
70
|
+
case "text":
|
|
71
|
+
emptyData = await response[parseAs]();
|
|
72
|
+
break;
|
|
73
|
+
case "formData":
|
|
74
|
+
emptyData = new FormData();
|
|
75
|
+
break;
|
|
76
|
+
case "stream":
|
|
77
|
+
emptyData = response.body;
|
|
78
|
+
break;
|
|
79
|
+
case "json":
|
|
80
|
+
default:
|
|
81
|
+
emptyData = {};
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
85
|
+
data: emptyData,
|
|
86
|
+
...result
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
let data;
|
|
90
|
+
switch (parseAs) {
|
|
91
|
+
case "arrayBuffer":
|
|
92
|
+
case "blob":
|
|
93
|
+
case "formData":
|
|
94
|
+
case "json":
|
|
95
|
+
case "text":
|
|
96
|
+
data = await response[parseAs]();
|
|
97
|
+
break;
|
|
98
|
+
case "stream": return opts.responseStyle === "data" ? response.body : {
|
|
99
|
+
data: response.body,
|
|
100
|
+
...result
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (parseAs === "json") {
|
|
104
|
+
if (opts.responseValidator) await opts.responseValidator(data);
|
|
105
|
+
if (opts.responseTransformer) data = await opts.responseTransformer(data);
|
|
106
|
+
}
|
|
107
|
+
return opts.responseStyle === "data" ? data : {
|
|
108
|
+
data,
|
|
109
|
+
...result
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const textError = await response.text();
|
|
113
|
+
let jsonError;
|
|
114
|
+
try {
|
|
115
|
+
jsonError = JSON.parse(textError);
|
|
116
|
+
} catch {}
|
|
117
|
+
const error = jsonError ?? textError;
|
|
118
|
+
let finalError = error;
|
|
119
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request$1, opts);
|
|
120
|
+
finalError = finalError || {};
|
|
121
|
+
if (opts.throwOnError) throw finalError;
|
|
122
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
123
|
+
error: finalError,
|
|
124
|
+
...result
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
const makeMethodFn = (method) => (options) => request({
|
|
128
|
+
...options,
|
|
129
|
+
method
|
|
130
|
+
});
|
|
131
|
+
const makeSseFn = (method) => async (options) => {
|
|
132
|
+
const { opts, url } = await beforeRequest(options);
|
|
133
|
+
return createSseClient({
|
|
134
|
+
...opts,
|
|
135
|
+
body: opts.body,
|
|
136
|
+
headers: opts.headers,
|
|
137
|
+
method,
|
|
138
|
+
onRequest: async (url$1, init) => {
|
|
139
|
+
let request$1 = new Request(url$1, init);
|
|
140
|
+
for (const fn of interceptors.request.fns) if (fn) request$1 = await fn(request$1, opts);
|
|
141
|
+
return request$1;
|
|
142
|
+
},
|
|
143
|
+
url
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
buildUrl,
|
|
148
|
+
connect: makeMethodFn("CONNECT"),
|
|
149
|
+
delete: makeMethodFn("DELETE"),
|
|
150
|
+
get: makeMethodFn("GET"),
|
|
151
|
+
getConfig,
|
|
152
|
+
head: makeMethodFn("HEAD"),
|
|
153
|
+
interceptors,
|
|
154
|
+
options: makeMethodFn("OPTIONS"),
|
|
155
|
+
patch: makeMethodFn("PATCH"),
|
|
156
|
+
post: makeMethodFn("POST"),
|
|
157
|
+
put: makeMethodFn("PUT"),
|
|
158
|
+
request,
|
|
159
|
+
setConfig,
|
|
160
|
+
sse: {
|
|
161
|
+
connect: makeSseFn("CONNECT"),
|
|
162
|
+
delete: makeSseFn("DELETE"),
|
|
163
|
+
get: makeSseFn("GET"),
|
|
164
|
+
head: makeSseFn("HEAD"),
|
|
165
|
+
options: makeSseFn("OPTIONS"),
|
|
166
|
+
patch: makeSseFn("PATCH"),
|
|
167
|
+
post: makeSseFn("POST"),
|
|
168
|
+
put: makeSseFn("PUT"),
|
|
169
|
+
trace: makeSseFn("TRACE")
|
|
170
|
+
},
|
|
171
|
+
trace: makeMethodFn("TRACE")
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
9
176
|
export { createClient };
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
require('
|
|
2
|
-
require('
|
|
3
|
-
require('
|
|
4
|
-
require('
|
|
5
|
-
const
|
|
6
|
-
const require_utils_gen$1 = require('../../utils.gen-DATakax-.cjs');
|
|
7
|
-
const require_client_gen = require('../../client.gen-DPSMNZNm.cjs');
|
|
8
|
-
const require_params_gen = require('../../params.gen-BtCSnwiV.cjs');
|
|
9
|
-
const require_queryKeySerializer_gen = require('../../queryKeySerializer.gen-4TWHHXn3.cjs');
|
|
10
|
-
require('../../client-DBAc9HV1.cjs');
|
|
1
|
+
const require_api_core_bodySerializer_gen = require('../core/bodySerializer.gen.cjs');
|
|
2
|
+
const require_api_client_utils_gen = require('./utils.gen.cjs');
|
|
3
|
+
const require_api_client_client_gen = require('./client.gen.cjs');
|
|
4
|
+
const require_api_core_params_gen = require('../core/params.gen.cjs');
|
|
5
|
+
const require_api_core_queryKeySerializer_gen = require('../core/queryKeySerializer.gen.cjs');
|
|
11
6
|
|
|
12
|
-
exports.buildClientParams =
|
|
13
|
-
exports.createClient =
|
|
14
|
-
exports.createConfig =
|
|
15
|
-
exports.formDataBodySerializer =
|
|
16
|
-
exports.jsonBodySerializer =
|
|
17
|
-
exports.mergeHeaders =
|
|
18
|
-
exports.serializeQueryKeyValue =
|
|
19
|
-
exports.urlSearchParamsBodySerializer =
|
|
7
|
+
exports.buildClientParams = require_api_core_params_gen.buildClientParams;
|
|
8
|
+
exports.createClient = require_api_client_client_gen.createClient;
|
|
9
|
+
exports.createConfig = require_api_client_utils_gen.createConfig;
|
|
10
|
+
exports.formDataBodySerializer = require_api_core_bodySerializer_gen.formDataBodySerializer;
|
|
11
|
+
exports.jsonBodySerializer = require_api_core_bodySerializer_gen.jsonBodySerializer;
|
|
12
|
+
exports.mergeHeaders = require_api_client_utils_gen.mergeHeaders;
|
|
13
|
+
exports.serializeQueryKeyValue = require_api_core_queryKeySerializer_gen.serializeQueryKeyValue;
|
|
14
|
+
exports.urlSearchParamsBodySerializer = require_api_core_bodySerializer_gen.urlSearchParamsBodySerializer;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import { n as createConfig, s as mergeHeaders } from "../../utils.gen-C-7sZa7Z.mjs";
|
|
7
|
-
import { t as createClient } from "../../client.gen-CPQm4WCv.mjs";
|
|
8
|
-
import { t as buildClientParams } from "../../params.gen-BM1l95BD.mjs";
|
|
9
|
-
import { n as serializeQueryKeyValue } from "../../queryKeySerializer.gen-BMMZAjVN.mjs";
|
|
10
|
-
import "../../client-BlRUW8mL.mjs";
|
|
1
|
+
import { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from "../core/bodySerializer.gen.mjs";
|
|
2
|
+
import { createConfig, mergeHeaders } from "./utils.gen.mjs";
|
|
3
|
+
import { createClient } from "./client.gen.mjs";
|
|
4
|
+
import { buildClientParams } from "../core/params.gen.mjs";
|
|
5
|
+
import { serializeQueryKeyValue } from "../core/queryKeySerializer.gen.mjs";
|
|
11
6
|
|
|
12
7
|
export { buildClientParams, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, mergeHeaders, serializeQueryKeyValue, urlSearchParamsBodySerializer };
|
|
@@ -1,14 +1,187 @@
|
|
|
1
|
-
require('
|
|
2
|
-
require('
|
|
3
|
-
require('
|
|
4
|
-
require('
|
|
5
|
-
const require_utils_gen$1 = require('../../utils.gen-DATakax-.cjs');
|
|
1
|
+
const require_api_core_pathSerializer_gen = require('../core/pathSerializer.gen.cjs');
|
|
2
|
+
const require_api_core_utils_gen = require('../core/utils.gen.cjs');
|
|
3
|
+
const require_api_core_auth_gen = require('../core/auth.gen.cjs');
|
|
4
|
+
const require_api_core_bodySerializer_gen = require('../core/bodySerializer.gen.cjs');
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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_api_core_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_api_core_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_api_core_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_api_core_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_api_core_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_api_core_bodySerializer_gen.jsonBodySerializer,
|
|
173
|
+
headers: defaultHeaders,
|
|
174
|
+
parseAs: "auto",
|
|
175
|
+
querySerializer: defaultQuerySerializer,
|
|
176
|
+
...override
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
//#endregion
|
|
180
|
+
exports.buildUrl = buildUrl;
|
|
181
|
+
exports.createConfig = createConfig;
|
|
182
|
+
exports.createInterceptors = createInterceptors;
|
|
183
|
+
exports.createQuerySerializer = createQuerySerializer;
|
|
184
|
+
exports.getParseAs = getParseAs;
|
|
185
|
+
exports.mergeConfigs = mergeConfigs;
|
|
186
|
+
exports.mergeHeaders = mergeHeaders;
|
|
187
|
+
exports.setAuthParams = setAuthParams;
|