@powerlines/plugin-prisma 0.2.76 → 0.2.78
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 +20 -107
- package/dist/index.mjs +8 -96
- package/dist/powerlines/src/plugin-utils/get-config-path.cjs +49 -0
- package/dist/powerlines/src/plugin-utils/get-config-path.mjs +48 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
- 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 +6 -6
- 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,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
5
|
+
/**
|
|
6
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The following tokens are supported:
|
|
10
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
11
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
12
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
13
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
14
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
15
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
16
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
17
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
18
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
19
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
20
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
21
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
22
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
23
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
24
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
25
|
+
*
|
|
26
|
+
* @param context - The context containing the values for the path tokens.
|
|
27
|
+
* @param path - The path string with tokens to replace.
|
|
28
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
29
|
+
*/
|
|
30
|
+
function replacePathTokens(context, path) {
|
|
31
|
+
if (!path) return path;
|
|
32
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.replacePathTokens = replacePathTokens;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { replacePath } from "@stryke/path/replace";
|
|
2
|
+
|
|
3
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
4
|
+
/**
|
|
5
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The following tokens are supported:
|
|
9
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
10
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
11
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
12
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
13
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
14
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
15
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
16
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
17
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
18
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
19
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
20
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
21
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
22
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
23
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
24
|
+
*
|
|
25
|
+
* @param context - The context containing the values for the path tokens.
|
|
26
|
+
* @param path - The path string with tokens to replace.
|
|
27
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
28
|
+
*/
|
|
29
|
+
function replacePathTokens(context, path) {
|
|
30
|
+
if (!path) return path;
|
|
31
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { replacePathTokens };
|
package/dist/types/index.cjs
CHANGED
package/dist/types/index.mjs
CHANGED
package/dist/types/plugin.cjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require('../plugin-DE9fKOLA.cjs');
|
package/dist/types/plugin.mjs
CHANGED
package/dist/types/prisma.cjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require('../prisma-BzQJneyW.cjs');
|
package/dist/types/prisma.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-prisma",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.78",
|
|
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.28",
|
|
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.54",
|
|
94
|
+
"@powerlines/plugin-plugin": "^0.12.76",
|
|
95
|
+
"@powerlines/plugin-hey-api": "^0.1.78",
|
|
96
96
|
"@types/node": "^24.10.4"
|
|
97
97
|
},
|
|
98
98
|
"publishConfig": { "access": "public" },
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "6891ff1330798e807c4caef6134df09d9f57686d"
|
|
100
100
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/api/core/auth.gen.ts
|
|
3
|
-
const getAuthToken = async (auth, callback) => {
|
|
4
|
-
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
5
|
-
if (!token) return;
|
|
6
|
-
if (auth.scheme === "bearer") return `Bearer ${token}`;
|
|
7
|
-
if (auth.scheme === "basic") return `Basic ${btoa(token)}`;
|
|
8
|
-
return token;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
Object.defineProperty(exports, 'getAuthToken', {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return getAuthToken;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/api/core/auth.gen.ts
|
|
2
|
-
const getAuthToken = async (auth, callback) => {
|
|
3
|
-
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
4
|
-
if (!token) return;
|
|
5
|
-
if (auth.scheme === "bearer") return `Bearer ${token}`;
|
|
6
|
-
if (auth.scheme === "basic") return `Basic ${btoa(token)}`;
|
|
7
|
-
return token;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { getAuthToken as t };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/api/core/bodySerializer.gen.ts
|
|
3
|
-
const serializeFormDataPair = (data, key, value) => {
|
|
4
|
-
if (typeof value === "string" || value instanceof Blob) data.append(key, value);
|
|
5
|
-
else if (value instanceof Date) data.append(key, value.toISOString());
|
|
6
|
-
else data.append(key, JSON.stringify(value));
|
|
7
|
-
};
|
|
8
|
-
const serializeUrlSearchParamsPair = (data, key, value) => {
|
|
9
|
-
if (typeof value === "string") data.append(key, value);
|
|
10
|
-
else data.append(key, JSON.stringify(value));
|
|
11
|
-
};
|
|
12
|
-
const formDataBodySerializer = { bodySerializer: (body) => {
|
|
13
|
-
const data = new FormData();
|
|
14
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
15
|
-
if (value === void 0 || value === null) return;
|
|
16
|
-
if (Array.isArray(value)) value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
17
|
-
else serializeFormDataPair(data, key, value);
|
|
18
|
-
});
|
|
19
|
-
return data;
|
|
20
|
-
} };
|
|
21
|
-
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
22
|
-
const urlSearchParamsBodySerializer = { bodySerializer: (body) => {
|
|
23
|
-
const data = new URLSearchParams();
|
|
24
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
25
|
-
if (value === void 0 || value === null) return;
|
|
26
|
-
if (Array.isArray(value)) value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));
|
|
27
|
-
else serializeUrlSearchParamsPair(data, key, value);
|
|
28
|
-
});
|
|
29
|
-
return data.toString();
|
|
30
|
-
} };
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
Object.defineProperty(exports, 'formDataBodySerializer', {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return formDataBodySerializer;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(exports, 'jsonBodySerializer', {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return jsonBodySerializer;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(exports, 'urlSearchParamsBodySerializer', {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: function () {
|
|
48
|
-
return urlSearchParamsBodySerializer;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//#region src/api/core/bodySerializer.gen.ts
|
|
2
|
-
const serializeFormDataPair = (data, key, value) => {
|
|
3
|
-
if (typeof value === "string" || value instanceof Blob) data.append(key, value);
|
|
4
|
-
else if (value instanceof Date) data.append(key, value.toISOString());
|
|
5
|
-
else data.append(key, JSON.stringify(value));
|
|
6
|
-
};
|
|
7
|
-
const serializeUrlSearchParamsPair = (data, key, value) => {
|
|
8
|
-
if (typeof value === "string") data.append(key, value);
|
|
9
|
-
else data.append(key, JSON.stringify(value));
|
|
10
|
-
};
|
|
11
|
-
const formDataBodySerializer = { bodySerializer: (body) => {
|
|
12
|
-
const data = new FormData();
|
|
13
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
14
|
-
if (value === void 0 || value === null) return;
|
|
15
|
-
if (Array.isArray(value)) value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
16
|
-
else serializeFormDataPair(data, key, value);
|
|
17
|
-
});
|
|
18
|
-
return data;
|
|
19
|
-
} };
|
|
20
|
-
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
21
|
-
const urlSearchParamsBodySerializer = { bodySerializer: (body) => {
|
|
22
|
-
const data = new URLSearchParams();
|
|
23
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
24
|
-
if (value === void 0 || value === null) return;
|
|
25
|
-
if (Array.isArray(value)) value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));
|
|
26
|
-
else serializeUrlSearchParamsPair(data, key, value);
|
|
27
|
-
});
|
|
28
|
-
return data.toString();
|
|
29
|
-
} };
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { jsonBodySerializer as n, urlSearchParamsBodySerializer as r, formDataBodySerializer as t };
|
package/dist/client-BlRUW8mL.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/client-DBAc9HV1.cjs
DELETED
|
File without changes
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { n as createConfig } from "./utils.gen-C-7sZa7Z.mjs";
|
|
2
|
-
import { t as createClient } from "./client.gen-CPQm4WCv.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/api/client.gen.ts
|
|
5
|
-
const client = createClient(createConfig({ throwOnError: true }));
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { client as t };
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { t as createSseClient } from "./serverSentEvents.gen-C4apQvDl.mjs";
|
|
2
|
-
import { i as getValidRequestBody } from "./utils.gen-RO8GxC4i.mjs";
|
|
3
|
-
import { a as getParseAs, c as setAuthParams, n as createConfig, o as mergeConfigs, r as createInterceptors, s as mergeHeaders, t as buildUrl } from "./utils.gen-C-7sZa7Z.mjs";
|
|
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
|
|
176
|
-
export { createClient as t };
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
const require_serverSentEvents_gen = require('./serverSentEvents.gen-CiMMmhyQ.cjs');
|
|
2
|
-
const require_utils_gen = require('./utils.gen-Bk2pTkV1.cjs');
|
|
3
|
-
const require_utils_gen$1 = require('./utils.gen-DATakax-.cjs');
|
|
4
|
-
|
|
5
|
-
//#region src/api/client/client.gen.ts
|
|
6
|
-
const createClient = (config = {}) => {
|
|
7
|
-
let _config = require_utils_gen$1.mergeConfigs(require_utils_gen$1.createConfig(), config);
|
|
8
|
-
const getConfig = () => ({ ..._config });
|
|
9
|
-
const setConfig = (config$1) => {
|
|
10
|
-
_config = require_utils_gen$1.mergeConfigs(_config, config$1);
|
|
11
|
-
return getConfig();
|
|
12
|
-
};
|
|
13
|
-
const interceptors = require_utils_gen$1.createInterceptors();
|
|
14
|
-
const beforeRequest = async (options) => {
|
|
15
|
-
const opts = {
|
|
16
|
-
..._config,
|
|
17
|
-
...options,
|
|
18
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
19
|
-
headers: require_utils_gen$1.mergeHeaders(_config.headers, options.headers),
|
|
20
|
-
serializedBody: void 0
|
|
21
|
-
};
|
|
22
|
-
if (opts.security) await require_utils_gen$1.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_utils_gen$1.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_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_utils_gen$1.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_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_utils_gen$1.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
|
-
Object.defineProperty(exports, 'createClient', {
|
|
177
|
-
enumerable: true,
|
|
178
|
-
get: function () {
|
|
179
|
-
return createClient;
|
|
180
|
-
}
|
|
181
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const require_utils_gen = require('./utils.gen-DATakax-.cjs');
|
|
2
|
-
const require_client_gen = require('./client.gen-DPSMNZNm.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/api/client.gen.ts
|
|
5
|
-
const client = require_client_gen.createClient(require_utils_gen.createConfig({ throwOnError: true }));
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
Object.defineProperty(exports, 'client', {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return client;
|
|
12
|
-
}
|
|
13
|
-
});
|