@powerlines/plugin-hey-api 0.1.411 → 0.1.413
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 -1
- package/dist/helpers/create-operation-id.cjs +17 -1
- package/dist/helpers/create-operation-id.mjs +15 -1
- package/dist/helpers/create-operation-id.mjs.map +1 -1
- package/dist/helpers/index.cjs +4 -1
- package/dist/helpers/index.mjs +3 -1
- package/dist/index.cjs +91 -1
- package/dist/index.mjs +86 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +4 -4
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
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 +1,17 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/create-operation-id.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create an Operation Id from a summary string
|
|
8
|
+
*
|
|
9
|
+
* @param summary - The summary string from the specification
|
|
10
|
+
* @returns The generated operation ID
|
|
11
|
+
*/
|
|
12
|
+
function createOperationId(summary) {
|
|
13
|
+
return (0, _stryke_string_format_camel_case.camelCase)(summary.replace(/\b(?:a|from|to|the|given|of|an)\b/gi, "").replace("Get list", "list"));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.createOperationId = createOperationId;
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import{camelCase
|
|
1
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/create-operation-id.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create an Operation Id from a summary string
|
|
6
|
+
*
|
|
7
|
+
* @param summary - The summary string from the specification
|
|
8
|
+
* @returns The generated operation ID
|
|
9
|
+
*/
|
|
10
|
+
function createOperationId(summary) {
|
|
11
|
+
return camelCase(summary.replace(/\b(?:a|from|to|the|given|of|an)\b/gi, "").replace("Get list", "list"));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createOperationId };
|
|
2
16
|
//# sourceMappingURL=create-operation-id.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-operation-id.mjs","names":[],"sources":["../../src/helpers/create-operation-id.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { camelCase } from \"@stryke/string-format/camel-case\";\n\n/**\n * Create an Operation Id from a summary string\n *\n * @param summary - The summary string from the specification\n * @returns The generated operation ID\n */\nexport function createOperationId(summary: string) {\n return camelCase(\n summary\n .replace(/\\b(?:a|from|to|the|given|of|an)\\b/gi, \"\")\n .replace(\"Get list\", \"list\")\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-operation-id.mjs","names":[],"sources":["../../src/helpers/create-operation-id.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { camelCase } from \"@stryke/string-format/camel-case\";\n\n/**\n * Create an Operation Id from a summary string\n *\n * @param summary - The summary string from the specification\n * @returns The generated operation ID\n */\nexport function createOperationId(summary: string) {\n return camelCase(\n summary\n .replace(/\\b(?:a|from|to|the|given|of|an)\\b/gi, \"\")\n .replace(\"Get list\", \"list\")\n );\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,kBAAkB,SAAiB;AACjD,QAAO,UACL,QACG,QAAQ,uCAAuC,GAAG,CAClD,QAAQ,YAAY,OAAO,CAC/B"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_helpers_create_operation_id = require('./create-operation-id.cjs');
|
|
3
|
+
|
|
4
|
+
exports.createOperationId = require_helpers_create_operation_id.createOperationId;
|
package/dist/helpers/index.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1 +1,91 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_helpers_create_operation_id = require('./helpers/create-operation-id.cjs');
|
|
4
|
+
require('./helpers/index.cjs');
|
|
5
|
+
let _hey_api_openapi_ts = require("@hey-api/openapi-ts");
|
|
6
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
7
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
8
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
11
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
12
|
+
|
|
13
|
+
//#region src/index.ts
|
|
14
|
+
/**
|
|
15
|
+
* A Powerlines plugin to integrate Hey API for code generation.
|
|
16
|
+
*
|
|
17
|
+
* @see https://heyapi.dev/
|
|
18
|
+
*
|
|
19
|
+
* @param options - The plugin options.
|
|
20
|
+
* @returns A Powerlines plugin instance.
|
|
21
|
+
*/
|
|
22
|
+
const plugin = (options = {}) => {
|
|
23
|
+
return {
|
|
24
|
+
name: "hey-api",
|
|
25
|
+
config() {
|
|
26
|
+
return { heyApi: {
|
|
27
|
+
plugins: [
|
|
28
|
+
{
|
|
29
|
+
name: "@hey-api/typescript",
|
|
30
|
+
exportFromIndex: false
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "@hey-api/sdk",
|
|
34
|
+
instance: "PrismaClient",
|
|
35
|
+
exportFromIndex: false,
|
|
36
|
+
auth: false
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "@hey-api/client-fetch",
|
|
40
|
+
throwOnError: true
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
...(0, defu.default)(options, {
|
|
44
|
+
schema: (0, _stryke_path_join_paths.joinPaths)(this.config.cwd ?? "./", this.config.root, "schema.yaml"),
|
|
45
|
+
output: { path: (0, _stryke_path_join_paths.joinPaths)("{builtinPath}", "api") },
|
|
46
|
+
logs: this.envPaths.log
|
|
47
|
+
})
|
|
48
|
+
} };
|
|
49
|
+
},
|
|
50
|
+
async configResolved() {
|
|
51
|
+
this.config.heyApi.output ??= {};
|
|
52
|
+
this.config.heyApi.output.path = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.heyApi.output.path);
|
|
53
|
+
if (!this.config.heyApi.schema) throw new Error("The `schema` option is required by the Hey API plugin.");
|
|
54
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.heyApi.schema)) {
|
|
55
|
+
const result = await this.fetch(this.config.heyApi.schema);
|
|
56
|
+
this.config.heyApi.schema = await result.json();
|
|
57
|
+
}
|
|
58
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.config.heyApi.schema) && this.config.heyApi.schema.paths) {
|
|
59
|
+
const schema = this.config.heyApi.schema;
|
|
60
|
+
for (const pathItem of Object.values(schema.paths)) {
|
|
61
|
+
if (!pathItem || "$ref" in pathItem) continue;
|
|
62
|
+
for (const method of [
|
|
63
|
+
"get",
|
|
64
|
+
"put",
|
|
65
|
+
"post",
|
|
66
|
+
"delete",
|
|
67
|
+
"options",
|
|
68
|
+
"head",
|
|
69
|
+
"patch",
|
|
70
|
+
"trace"
|
|
71
|
+
]) {
|
|
72
|
+
const operation = pathItem[method];
|
|
73
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(operation?.summary)) continue;
|
|
74
|
+
operation.operationId = require_helpers_create_operation_id.createOperationId(operation.summary);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
async prepare() {
|
|
80
|
+
await (0, _hey_api_openapi_ts.createClient)({
|
|
81
|
+
...this.config.heyApi,
|
|
82
|
+
input: this.config.heyApi.schema
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
exports.createOperationId = require_helpers_create_operation_id.createOperationId;
|
|
90
|
+
exports.default = plugin;
|
|
91
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,87 @@
|
|
|
1
|
-
import{createOperationId
|
|
1
|
+
import { createOperationId } from "./helpers/create-operation-id.mjs";
|
|
2
|
+
import "./helpers/index.mjs";
|
|
3
|
+
import { createClient } from "@hey-api/openapi-ts";
|
|
4
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
5
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
6
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
7
|
+
import defu from "defu";
|
|
8
|
+
import { replacePathTokens } from "powerlines/plugin-utils";
|
|
9
|
+
|
|
10
|
+
//#region src/index.ts
|
|
11
|
+
/**
|
|
12
|
+
* A Powerlines plugin to integrate Hey API for code generation.
|
|
13
|
+
*
|
|
14
|
+
* @see https://heyapi.dev/
|
|
15
|
+
*
|
|
16
|
+
* @param options - The plugin options.
|
|
17
|
+
* @returns A Powerlines plugin instance.
|
|
18
|
+
*/
|
|
19
|
+
const plugin = (options = {}) => {
|
|
20
|
+
return {
|
|
21
|
+
name: "hey-api",
|
|
22
|
+
config() {
|
|
23
|
+
return { heyApi: {
|
|
24
|
+
plugins: [
|
|
25
|
+
{
|
|
26
|
+
name: "@hey-api/typescript",
|
|
27
|
+
exportFromIndex: false
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "@hey-api/sdk",
|
|
31
|
+
instance: "PrismaClient",
|
|
32
|
+
exportFromIndex: false,
|
|
33
|
+
auth: false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "@hey-api/client-fetch",
|
|
37
|
+
throwOnError: true
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
...defu(options, {
|
|
41
|
+
schema: joinPaths(this.config.cwd ?? "./", this.config.root, "schema.yaml"),
|
|
42
|
+
output: { path: joinPaths("{builtinPath}", "api") },
|
|
43
|
+
logs: this.envPaths.log
|
|
44
|
+
})
|
|
45
|
+
} };
|
|
46
|
+
},
|
|
47
|
+
async configResolved() {
|
|
48
|
+
this.config.heyApi.output ??= {};
|
|
49
|
+
this.config.heyApi.output.path = replacePathTokens(this, this.config.heyApi.output.path);
|
|
50
|
+
if (!this.config.heyApi.schema) throw new Error("The `schema` option is required by the Hey API plugin.");
|
|
51
|
+
if (isSetString(this.config.heyApi.schema)) {
|
|
52
|
+
const result = await this.fetch(this.config.heyApi.schema);
|
|
53
|
+
this.config.heyApi.schema = await result.json();
|
|
54
|
+
}
|
|
55
|
+
if (isSetObject(this.config.heyApi.schema) && this.config.heyApi.schema.paths) {
|
|
56
|
+
const schema = this.config.heyApi.schema;
|
|
57
|
+
for (const pathItem of Object.values(schema.paths)) {
|
|
58
|
+
if (!pathItem || "$ref" in pathItem) continue;
|
|
59
|
+
for (const method of [
|
|
60
|
+
"get",
|
|
61
|
+
"put",
|
|
62
|
+
"post",
|
|
63
|
+
"delete",
|
|
64
|
+
"options",
|
|
65
|
+
"head",
|
|
66
|
+
"patch",
|
|
67
|
+
"trace"
|
|
68
|
+
]) {
|
|
69
|
+
const operation = pathItem[method];
|
|
70
|
+
if (!isSetString(operation?.summary)) continue;
|
|
71
|
+
operation.operationId = createOperationId(operation.summary);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
async prepare() {
|
|
77
|
+
await createClient({
|
|
78
|
+
...this.config.heyApi,
|
|
79
|
+
input: this.config.heyApi.schema
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { createOperationId, plugin as default, plugin };
|
|
2
87
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { UserConfig } from \"@hey-api/openapi-ts\";\nimport { createClient, OpenApi } from \"@hey-api/openapi-ts\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { createOperationId } from \"./helpers/create-operation-id\";\nimport {\n HeyAPIPluginContext,\n HeyAPIPluginOptions,\n HeyAPIPluginOutputOptions\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n heyApi?: HeyAPIPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate Hey API for code generation.\n *\n * @see https://heyapi.dev/\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends HeyAPIPluginContext = HeyAPIPluginContext\n>(\n options: HeyAPIPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"hey-api\",\n config() {\n return {\n heyApi: {\n plugins: [\n {\n name: \"@hey-api/typescript\",\n exportFromIndex: false\n },\n {\n name: \"@hey-api/sdk\",\n instance: \"PrismaClient\",\n exportFromIndex: false,\n auth: false\n },\n {\n name: \"@hey-api/client-fetch\",\n throwOnError: true\n }\n ],\n ...defu(options, {\n schema: joinPaths(\n this.config.cwd ?? \"./\",\n this.config.root,\n \"schema.yaml\"\n ),\n output: {\n path: joinPaths(\"{builtinPath}\", \"api\")\n },\n logs: this.envPaths.log\n })\n }\n };\n },\n async configResolved() {\n this.config.heyApi.output ??= {} as HeyAPIPluginOutputOptions;\n this.config.heyApi.output.path = replacePathTokens(\n this,\n this.config.heyApi.output.path\n );\n\n if (!this.config.heyApi.schema) {\n throw new Error(\n \"The `schema` option is required by the Hey API plugin.\"\n );\n }\n\n if (isSetString(this.config.heyApi.schema)) {\n const result = await this.fetch(this.config.heyApi.schema);\n this.config.heyApi.schema =\n (await result.json()) as HeyAPIPluginOptions[\"schema\"];\n }\n\n if (\n isSetObject(this.config.heyApi.schema) &&\n (this.config.heyApi.schema as OpenApi.V3_0_X).paths\n ) {\n const schema = this.config.heyApi.schema as OpenApi.V3_0_X;\n for (const pathItem of Object.values(schema.paths)) {\n if (!pathItem || \"$ref\" in pathItem) {\n continue;\n }\n\n for (const method of [\n \"get\",\n \"put\",\n \"post\",\n \"delete\",\n \"options\",\n \"head\",\n \"patch\",\n \"trace\"\n ] as const) {\n const operation = pathItem[method];\n if (!isSetString(operation?.summary)) {\n continue;\n }\n\n operation.operationId = createOperationId(operation.summary);\n }\n }\n }\n },\n async prepare() {\n await createClient({\n ...this.config.heyApi,\n input: this.config.heyApi.schema!\n } as UserConfig);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { UserConfig } from \"@hey-api/openapi-ts\";\nimport { createClient, OpenApi } from \"@hey-api/openapi-ts\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { createOperationId } from \"./helpers/create-operation-id\";\nimport {\n HeyAPIPluginContext,\n HeyAPIPluginOptions,\n HeyAPIPluginOutputOptions\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n heyApi?: HeyAPIPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate Hey API for code generation.\n *\n * @see https://heyapi.dev/\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends HeyAPIPluginContext = HeyAPIPluginContext\n>(\n options: HeyAPIPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"hey-api\",\n config() {\n return {\n heyApi: {\n plugins: [\n {\n name: \"@hey-api/typescript\",\n exportFromIndex: false\n },\n {\n name: \"@hey-api/sdk\",\n instance: \"PrismaClient\",\n exportFromIndex: false,\n auth: false\n },\n {\n name: \"@hey-api/client-fetch\",\n throwOnError: true\n }\n ],\n ...defu(options, {\n schema: joinPaths(\n this.config.cwd ?? \"./\",\n this.config.root,\n \"schema.yaml\"\n ),\n output: {\n path: joinPaths(\"{builtinPath}\", \"api\")\n },\n logs: this.envPaths.log\n })\n }\n };\n },\n async configResolved() {\n this.config.heyApi.output ??= {} as HeyAPIPluginOutputOptions;\n this.config.heyApi.output.path = replacePathTokens(\n this,\n this.config.heyApi.output.path\n );\n\n if (!this.config.heyApi.schema) {\n throw new Error(\n \"The `schema` option is required by the Hey API plugin.\"\n );\n }\n\n if (isSetString(this.config.heyApi.schema)) {\n const result = await this.fetch(this.config.heyApi.schema);\n this.config.heyApi.schema =\n (await result.json()) as HeyAPIPluginOptions[\"schema\"];\n }\n\n if (\n isSetObject(this.config.heyApi.schema) &&\n (this.config.heyApi.schema as OpenApi.V3_0_X).paths\n ) {\n const schema = this.config.heyApi.schema as OpenApi.V3_0_X;\n for (const pathItem of Object.values(schema.paths)) {\n if (!pathItem || \"$ref\" in pathItem) {\n continue;\n }\n\n for (const method of [\n \"get\",\n \"put\",\n \"post\",\n \"delete\",\n \"options\",\n \"head\",\n \"patch\",\n \"trace\"\n ] as const) {\n const operation = pathItem[method];\n if (!isSetString(operation?.summary)) {\n continue;\n }\n\n operation.operationId = createOperationId(operation.summary);\n }\n }\n }\n },\n async prepare() {\n await createClient({\n ...this.config.heyApi,\n input: this.config.heyApi.schema!\n } as UserConfig);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkDA,MAAa,UAGX,UAA+B,EAAE,KACZ;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,QAAQ;IACN,SAAS;KACP;MACE,MAAM;MACN,iBAAiB;MAClB;KACD;MACE,MAAM;MACN,UAAU;MACV,iBAAiB;MACjB,MAAM;MACP;KACD;MACE,MAAM;MACN,cAAc;MACf;KACF;IACD,GAAG,KAAK,SAAS;KACf,QAAQ,UACN,KAAK,OAAO,OAAO,MACnB,KAAK,OAAO,MACZ,cACD;KACD,QAAQ,EACN,MAAM,UAAU,iBAAiB,MAAM,EACxC;KACD,MAAM,KAAK,SAAS;KACrB,CAAC;IACH,EACF;;EAEH,MAAM,iBAAiB;AACrB,QAAK,OAAO,OAAO,WAAW,EAAE;AAChC,QAAK,OAAO,OAAO,OAAO,OAAO,kBAC/B,MACA,KAAK,OAAO,OAAO,OAAO,KAC3B;AAED,OAAI,CAAC,KAAK,OAAO,OAAO,OACtB,OAAM,IAAI,MACR,yDACD;AAGH,OAAI,YAAY,KAAK,OAAO,OAAO,OAAO,EAAE;IAC1C,MAAM,SAAS,MAAM,KAAK,MAAM,KAAK,OAAO,OAAO,OAAO;AAC1D,SAAK,OAAO,OAAO,SAChB,MAAM,OAAO,MAAM;;AAGxB,OACE,YAAY,KAAK,OAAO,OAAO,OAAO,IACrC,KAAK,OAAO,OAAO,OAA0B,OAC9C;IACA,MAAM,SAAS,KAAK,OAAO,OAAO;AAClC,SAAK,MAAM,YAAY,OAAO,OAAO,OAAO,MAAM,EAAE;AAClD,SAAI,CAAC,YAAY,UAAU,SACzB;AAGF,UAAK,MAAM,UAAU;MACnB;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACD,EAAW;MACV,MAAM,YAAY,SAAS;AAC3B,UAAI,CAAC,YAAY,WAAW,QAAQ,CAClC;AAGF,gBAAU,cAAc,kBAAkB,UAAU,QAAQ;;;;;EAKpE,MAAM,UAAU;AACd,SAAM,aAAa;IACjB,GAAG,KAAK,OAAO;IACf,OAAO,KAAK,OAAO,OAAO;IAC3B,CAAe;;EAEnB"}
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-hey-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.413",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to generate project code using Hey API.",
|
|
6
6
|
"repository": {
|
|
@@ -124,13 +124,13 @@
|
|
|
124
124
|
"@stryke/types": "^0.12.0",
|
|
125
125
|
"defu": "^6.1.7",
|
|
126
126
|
"jiti": "^2.6.1",
|
|
127
|
-
"powerlines": "^0.46.
|
|
127
|
+
"powerlines": "^0.46.6"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
130
|
+
"@powerlines/plugin-plugin": "^0.12.410",
|
|
131
131
|
"@types/node": "^25.6.0"
|
|
132
132
|
},
|
|
133
133
|
"publishConfig": { "access": "public" },
|
|
134
134
|
"types": "./dist/index.d.cts",
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "610c4c943933458c5f433b9002d8c187625b2d3f"
|
|
136
136
|
}
|