@powerlines/plugin-openapi 0.2.610 → 0.2.612
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/index.cjs +47 -14
- package/dist/index.d.cts +8 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -5
- package/dist/index.mjs +45 -13
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/plugin.d.cts +22 -14
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +22 -14
- package/package.json +11 -9
package/dist/index.cjs
CHANGED
|
@@ -1,39 +1,72 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _power_plant_openapi_typescript = require("@power-plant/openapi-typescript");
|
|
4
|
+
_power_plant_openapi_typescript = require_runtime.__toESM(_power_plant_openapi_typescript, 1);
|
|
5
|
+
let _powerlines_plugin_power_plant = require("@powerlines/plugin-power-plant");
|
|
6
|
+
_powerlines_plugin_power_plant = require_runtime.__toESM(_powerlines_plugin_power_plant, 1);
|
|
7
|
+
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
3
8
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
9
|
let defu = require("defu");
|
|
5
10
|
defu = require_runtime.__toESM(defu, 1);
|
|
6
|
-
let openapi_typescript = require("openapi-typescript");
|
|
7
|
-
openapi_typescript = require_runtime.__toESM(openapi_typescript, 1);
|
|
8
11
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
12
|
+
let yaml = require("yaml");
|
|
9
13
|
|
|
10
14
|
//#region src/index.ts
|
|
15
|
+
function isLoadedDocument(value) {
|
|
16
|
+
return typeof value === "object" && value !== null && !(value instanceof URL);
|
|
17
|
+
}
|
|
18
|
+
function parseOpenAPISchema(content) {
|
|
19
|
+
return (0, yaml.parse)(content);
|
|
20
|
+
}
|
|
11
21
|
/**
|
|
12
|
-
* A Powerlines plugin to integrate OpenAPI
|
|
22
|
+
* A Powerlines plugin to integrate OpenAPI TypeScript via Power Plant.
|
|
23
|
+
*
|
|
24
|
+
* @see https://openapi-ts.dev
|
|
25
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/openapi-typescript
|
|
13
26
|
*
|
|
14
27
|
* @param options - The plugin options.
|
|
15
|
-
* @returns
|
|
28
|
+
* @returns Powerlines plugin instances.
|
|
16
29
|
*/
|
|
17
30
|
const plugin = (options = {}) => {
|
|
18
|
-
return {
|
|
31
|
+
return [(0, _powerlines_plugin_power_plant.default)(_power_plant_openapi_typescript.default), {
|
|
19
32
|
name: "openapi",
|
|
20
33
|
config() {
|
|
21
34
|
return { openapi: (0, defu.default)(options, {
|
|
22
|
-
schema: (0, _stryke_path_join_paths.joinPaths)(this.config.cwd, this.config.root, "schema.yaml"),
|
|
23
|
-
|
|
24
|
-
outputPath: (0, _stryke_path_join_paths.joinPaths)("{builtinPath}", "api"),
|
|
35
|
+
schema: (0, _stryke_path_join_paths.joinPaths)(this.config.cwd ?? "./", this.config.root, "schema.yaml"),
|
|
36
|
+
outputPath: (0, _stryke_path_join_paths.joinPaths)("{builtinPath}", "api.ts"),
|
|
25
37
|
silent: this.config.logLevel === null
|
|
26
38
|
}) };
|
|
27
39
|
},
|
|
28
40
|
async configResolved() {
|
|
41
|
+
if (!this.config.openapi.schema) throw new Error("OpenAPI schema is required. Please specify it in the plugin options or your Powerlines configuration under \"openapi.schema\".");
|
|
42
|
+
let document;
|
|
43
|
+
if (isLoadedDocument(this.config.openapi.schema)) document = this.config.openapi.schema;
|
|
44
|
+
else {
|
|
45
|
+
const schemaRef = this.config.openapi.schema.toString();
|
|
46
|
+
if ((0, _stryke_fs_exists.existsSync)(schemaRef)) {
|
|
47
|
+
const content = await this.fs.read(schemaRef);
|
|
48
|
+
if (!content) throw new Error(`Failed to read OpenAPI schema from file: ${schemaRef}`);
|
|
49
|
+
document = parseOpenAPISchema(content);
|
|
50
|
+
} else {
|
|
51
|
+
const response = await this.fetch(schemaRef);
|
|
52
|
+
if (!response) throw new Error(`Failed to fetch OpenAPI schema from endpoint: ${schemaRef}`);
|
|
53
|
+
document = parseOpenAPISchema(await response.text());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (!document) throw new Error("Failed to resolve OpenAPI schema. Provide a loaded OpenAPI document, a local file path, or a fetchable schema URL.");
|
|
29
57
|
this.config.openapi.outputPath = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.openapi.outputPath);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
58
|
+
this.config.openapi.document = document;
|
|
59
|
+
const { schema: _schema, document: loadedDocument, outputPath, ...rest } = this.config.openapi;
|
|
60
|
+
this.config.powerplant = {
|
|
61
|
+
...generatorConfig,
|
|
62
|
+
input: loadedDocument
|
|
63
|
+
};
|
|
64
|
+
this.powerplant.options = {
|
|
65
|
+
...rest,
|
|
66
|
+
output: outputPath
|
|
67
|
+
};
|
|
35
68
|
}
|
|
36
|
-
};
|
|
69
|
+
}];
|
|
37
70
|
};
|
|
38
71
|
|
|
39
72
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig } from "./types/plugin.cjs";
|
|
1
|
+
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, OpenAPISchema, PowerPlantOpenAPITypeScriptOptions } from "./types/plugin.cjs";
|
|
2
2
|
import "./types/index.cjs";
|
|
3
3
|
import { Plugin } from "powerlines";
|
|
4
4
|
//#region src/index.d.ts
|
|
@@ -8,12 +8,15 @@ declare module "powerlines" {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* A Powerlines plugin to integrate OpenAPI
|
|
11
|
+
* A Powerlines plugin to integrate OpenAPI TypeScript via Power Plant.
|
|
12
|
+
*
|
|
13
|
+
* @see https://openapi-ts.dev
|
|
14
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/openapi-typescript
|
|
12
15
|
*
|
|
13
16
|
* @param options - The plugin options.
|
|
14
|
-
* @returns
|
|
17
|
+
* @returns Powerlines plugin instances.
|
|
15
18
|
*/
|
|
16
|
-
declare const plugin: <TContext extends OpenAPIPluginContext = OpenAPIPluginContext>(options?: OpenAPIPluginOptions) => Plugin<TContext
|
|
19
|
+
declare const plugin: <TContext extends OpenAPIPluginContext = OpenAPIPluginContext>(options?: OpenAPIPluginOptions) => Plugin<TContext>[];
|
|
17
20
|
//#endregion
|
|
18
|
-
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, plugin as default, plugin };
|
|
21
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, type OpenAPISchema, type PowerPlantOpenAPITypeScriptOptions, plugin as default, plugin };
|
|
19
22
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;YAoCY;IACR,UAAU;;;;;;;;;;;;cAqBD,SACX,iBAAiB,uBAAuB,sBAExC,UAAS,yBACR,OAAO"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig } from "./types/plugin.mjs";
|
|
1
|
+
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, OpenAPISchema, PowerPlantOpenAPITypeScriptOptions } from "./types/plugin.mjs";
|
|
2
2
|
import "./types/index.mjs";
|
|
3
3
|
import { Plugin } from "powerlines";
|
|
4
4
|
//#region src/index.d.ts
|
|
@@ -8,12 +8,15 @@ declare module "powerlines" {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* A Powerlines plugin to integrate OpenAPI
|
|
11
|
+
* A Powerlines plugin to integrate OpenAPI TypeScript via Power Plant.
|
|
12
|
+
*
|
|
13
|
+
* @see https://openapi-ts.dev
|
|
14
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/openapi-typescript
|
|
12
15
|
*
|
|
13
16
|
* @param options - The plugin options.
|
|
14
|
-
* @returns
|
|
17
|
+
* @returns Powerlines plugin instances.
|
|
15
18
|
*/
|
|
16
|
-
declare const plugin: <TContext extends OpenAPIPluginContext = OpenAPIPluginContext>(options?: OpenAPIPluginOptions) => Plugin<TContext
|
|
19
|
+
declare const plugin: <TContext extends OpenAPIPluginContext = OpenAPIPluginContext>(options?: OpenAPIPluginOptions) => Plugin<TContext>[];
|
|
17
20
|
//#endregion
|
|
18
|
-
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, plugin as default, plugin };
|
|
21
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, type OpenAPISchema, type PowerPlantOpenAPITypeScriptOptions, plugin as default, plugin };
|
|
19
22
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,35 +1,67 @@
|
|
|
1
|
+
import openapiTypeScriptGenerator from "@power-plant/openapi-typescript";
|
|
2
|
+
import powerPlant from "@powerlines/plugin-power-plant";
|
|
3
|
+
import { existsSync } from "@stryke/fs/exists";
|
|
1
4
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
2
5
|
import defu from "defu";
|
|
3
|
-
import openapiTS, { astToString } from "openapi-typescript";
|
|
4
6
|
import { replacePathTokens } from "powerlines/plugin-utils";
|
|
7
|
+
import { parse } from "yaml";
|
|
5
8
|
|
|
6
9
|
//#region src/index.ts
|
|
10
|
+
function isLoadedDocument(value) {
|
|
11
|
+
return typeof value === "object" && value !== null && !(value instanceof URL);
|
|
12
|
+
}
|
|
13
|
+
function parseOpenAPISchema(content) {
|
|
14
|
+
return parse(content);
|
|
15
|
+
}
|
|
7
16
|
/**
|
|
8
|
-
* A Powerlines plugin to integrate OpenAPI
|
|
17
|
+
* A Powerlines plugin to integrate OpenAPI TypeScript via Power Plant.
|
|
18
|
+
*
|
|
19
|
+
* @see https://openapi-ts.dev
|
|
20
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/openapi-typescript
|
|
9
21
|
*
|
|
10
22
|
* @param options - The plugin options.
|
|
11
|
-
* @returns
|
|
23
|
+
* @returns Powerlines plugin instances.
|
|
12
24
|
*/
|
|
13
25
|
const plugin = (options = {}) => {
|
|
14
|
-
return {
|
|
26
|
+
return [powerPlant(openapiTypeScriptGenerator), {
|
|
15
27
|
name: "openapi",
|
|
16
28
|
config() {
|
|
17
29
|
return { openapi: defu(options, {
|
|
18
|
-
schema: joinPaths(this.config.cwd, this.config.root, "schema.yaml"),
|
|
19
|
-
|
|
20
|
-
outputPath: joinPaths("{builtinPath}", "api"),
|
|
30
|
+
schema: joinPaths(this.config.cwd ?? "./", this.config.root, "schema.yaml"),
|
|
31
|
+
outputPath: joinPaths("{builtinPath}", "api.ts"),
|
|
21
32
|
silent: this.config.logLevel === null
|
|
22
33
|
}) };
|
|
23
34
|
},
|
|
24
35
|
async configResolved() {
|
|
36
|
+
if (!this.config.openapi.schema) throw new Error("OpenAPI schema is required. Please specify it in the plugin options or your Powerlines configuration under \"openapi.schema\".");
|
|
37
|
+
let document;
|
|
38
|
+
if (isLoadedDocument(this.config.openapi.schema)) document = this.config.openapi.schema;
|
|
39
|
+
else {
|
|
40
|
+
const schemaRef = this.config.openapi.schema.toString();
|
|
41
|
+
if (existsSync(schemaRef)) {
|
|
42
|
+
const content = await this.fs.read(schemaRef);
|
|
43
|
+
if (!content) throw new Error(`Failed to read OpenAPI schema from file: ${schemaRef}`);
|
|
44
|
+
document = parseOpenAPISchema(content);
|
|
45
|
+
} else {
|
|
46
|
+
const response = await this.fetch(schemaRef);
|
|
47
|
+
if (!response) throw new Error(`Failed to fetch OpenAPI schema from endpoint: ${schemaRef}`);
|
|
48
|
+
document = parseOpenAPISchema(await response.text());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!document) throw new Error("Failed to resolve OpenAPI schema. Provide a loaded OpenAPI document, a local file path, or a fetchable schema URL.");
|
|
25
52
|
this.config.openapi.outputPath = replacePathTokens(this, this.config.openapi.outputPath);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
this.config.openapi.document = document;
|
|
54
|
+
const { schema: _schema, document: loadedDocument, outputPath, ...rest } = this.config.openapi;
|
|
55
|
+
this.config.powerplant = {
|
|
56
|
+
...generatorConfig,
|
|
57
|
+
input: loadedDocument
|
|
58
|
+
};
|
|
59
|
+
this.powerplant.options = {
|
|
60
|
+
...rest,
|
|
61
|
+
output: outputPath
|
|
62
|
+
};
|
|
31
63
|
}
|
|
32
|
-
};
|
|
64
|
+
}];
|
|
33
65
|
};
|
|
34
66
|
|
|
35
67
|
//#endregion
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig } from "./plugin.cjs";
|
|
2
|
-
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig };
|
|
1
|
+
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, OpenAPISchema, PowerPlantOpenAPITypeScriptOptions } from "./plugin.cjs";
|
|
2
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, type OpenAPISchema, type PowerPlantOpenAPITypeScriptOptions };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig } from "./plugin.mjs";
|
|
2
|
-
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig };
|
|
1
|
+
import { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, OpenAPISchema, PowerPlantOpenAPITypeScriptOptions } from "./plugin.mjs";
|
|
2
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, type OpenAPISchema, type PowerPlantOpenAPITypeScriptOptions };
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ResolvedConfig, UserConfig } from "powerlines";
|
|
2
|
+
import { OpenAPISchema, OpenAPISchema as OpenAPISchema$1 } from "@power-plant/openapi-schema";
|
|
3
|
+
import { Options, Options as PowerPlantOpenAPITypeScriptOptions } from "@power-plant/openapi-typescript";
|
|
4
|
+
import { PowerPlantPluginContext, PowerPlantPluginResolvedConfig } from "@powerlines/plugin-power-plant/types/plugin";
|
|
5
5
|
//#region src/types/plugin.d.ts
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Options for the OpenAPI Powerlines plugin.
|
|
8
|
+
*/
|
|
9
|
+
type OpenAPIPluginOptions = Partial<Omit<Options, "output">> & {
|
|
7
10
|
/**
|
|
8
|
-
* The
|
|
11
|
+
* The OpenAPI schema to generate from.
|
|
9
12
|
*
|
|
10
13
|
* @remarks
|
|
11
|
-
* This can be
|
|
14
|
+
* This can be an {@link OpenAPISchema} object, a local file path, a remote URL
|
|
15
|
+
* string, or a {@link URL} object.
|
|
12
16
|
*
|
|
13
17
|
* @defaultValue "\{root\}/schema.yaml"
|
|
14
18
|
*/
|
|
15
|
-
schema?: string | URL |
|
|
19
|
+
schema?: string | URL | OpenAPISchema$1;
|
|
16
20
|
/**
|
|
17
21
|
* The path to the output file generated by the plugin.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
23
|
+
* @remarks
|
|
20
24
|
* If using the default value, the file can be imported from "powerlines:api". This field allows the use of the "\{builtinsPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
|
|
21
25
|
*
|
|
22
26
|
* @defaultValue "\{builtinsPath\}/api.ts"
|
|
@@ -24,12 +28,16 @@ type OpenAPIPluginOptions = Omit<OpenAPITSOptions, "cwd"> & {
|
|
|
24
28
|
outputPath?: string;
|
|
25
29
|
};
|
|
26
30
|
type OpenAPIPluginUserConfig = UserConfig & {
|
|
27
|
-
openapi?:
|
|
31
|
+
openapi?: OpenAPIPluginOptions;
|
|
28
32
|
};
|
|
29
|
-
type OpenAPIPluginResolvedConfig = ResolvedConfig & {
|
|
30
|
-
openapi: Omit<OpenAPIPluginOptions, "schema"
|
|
33
|
+
type OpenAPIPluginResolvedConfig = ResolvedConfig & PowerPlantPluginResolvedConfig<OpenAPISchema$1, Options> & {
|
|
34
|
+
openapi: Omit<OpenAPIPluginOptions, "schema" | "outputPath"> & {
|
|
35
|
+
schema: string | URL | OpenAPISchema$1;
|
|
36
|
+
outputPath: string;
|
|
37
|
+
document: OpenAPISchema$1;
|
|
38
|
+
};
|
|
31
39
|
};
|
|
32
|
-
type OpenAPIPluginContext<TResolvedConfig extends OpenAPIPluginResolvedConfig = OpenAPIPluginResolvedConfig> =
|
|
40
|
+
type OpenAPIPluginContext<TResolvedConfig extends OpenAPIPluginResolvedConfig = OpenAPIPluginResolvedConfig> = PowerPlantPluginContext<OpenAPISchema$1, Options, TResolvedConfig>;
|
|
33
41
|
//#endregion
|
|
34
|
-
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig };
|
|
42
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, type OpenAPISchema, type PowerPlantOpenAPITypeScriptOptions };
|
|
35
43
|
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;KAgCY,uBAAuB,QACjC,KAAK;;;;;;;;;;EAWL,kBAAkB,MAAM;;;;;;;;;EAUxB;;KAGU,0BAA0B;EACpC,UAAU;;KAGA,8BAA8B,iBACxC,+BACE,iBACA;EAEA,SAAS,KAAK;IACZ,iBAAiB,MAAM;IACvB;IACA,UAAU;;;KAIJ,qBACV,wBAAwB,8BACtB,+BACA,wBACF,iBACA,SACA"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Options, Options as PowerPlantOpenAPITypeScriptOptions } from "@power-plant/openapi-typescript";
|
|
2
|
+
import { ResolvedConfig, UserConfig } from "powerlines";
|
|
3
|
+
import { OpenAPISchema, OpenAPISchema as OpenAPISchema$1 } from "@power-plant/openapi-schema";
|
|
4
|
+
import { PowerPlantPluginContext, PowerPlantPluginResolvedConfig } from "@powerlines/plugin-power-plant/types/plugin";
|
|
5
5
|
//#region src/types/plugin.d.ts
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Options for the OpenAPI Powerlines plugin.
|
|
8
|
+
*/
|
|
9
|
+
type OpenAPIPluginOptions = Partial<Omit<Options, "output">> & {
|
|
7
10
|
/**
|
|
8
|
-
* The
|
|
11
|
+
* The OpenAPI schema to generate from.
|
|
9
12
|
*
|
|
10
13
|
* @remarks
|
|
11
|
-
* This can be
|
|
14
|
+
* This can be an {@link OpenAPISchema} object, a local file path, a remote URL
|
|
15
|
+
* string, or a {@link URL} object.
|
|
12
16
|
*
|
|
13
17
|
* @defaultValue "\{root\}/schema.yaml"
|
|
14
18
|
*/
|
|
15
|
-
schema?: string | URL |
|
|
19
|
+
schema?: string | URL | OpenAPISchema$1;
|
|
16
20
|
/**
|
|
17
21
|
* The path to the output file generated by the plugin.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
23
|
+
* @remarks
|
|
20
24
|
* If using the default value, the file can be imported from "powerlines:api". This field allows the use of the "\{builtinsPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
|
|
21
25
|
*
|
|
22
26
|
* @defaultValue "\{builtinsPath\}/api.ts"
|
|
@@ -24,12 +28,16 @@ type OpenAPIPluginOptions = Omit<OpenAPITSOptions, "cwd"> & {
|
|
|
24
28
|
outputPath?: string;
|
|
25
29
|
};
|
|
26
30
|
type OpenAPIPluginUserConfig = UserConfig & {
|
|
27
|
-
openapi?:
|
|
31
|
+
openapi?: OpenAPIPluginOptions;
|
|
28
32
|
};
|
|
29
|
-
type OpenAPIPluginResolvedConfig = ResolvedConfig & {
|
|
30
|
-
openapi: Omit<OpenAPIPluginOptions, "schema"
|
|
33
|
+
type OpenAPIPluginResolvedConfig = ResolvedConfig & PowerPlantPluginResolvedConfig<OpenAPISchema$1, Options> & {
|
|
34
|
+
openapi: Omit<OpenAPIPluginOptions, "schema" | "outputPath"> & {
|
|
35
|
+
schema: string | URL | OpenAPISchema$1;
|
|
36
|
+
outputPath: string;
|
|
37
|
+
document: OpenAPISchema$1;
|
|
38
|
+
};
|
|
31
39
|
};
|
|
32
|
-
type OpenAPIPluginContext<TResolvedConfig extends OpenAPIPluginResolvedConfig = OpenAPIPluginResolvedConfig> =
|
|
40
|
+
type OpenAPIPluginContext<TResolvedConfig extends OpenAPIPluginResolvedConfig = OpenAPIPluginResolvedConfig> = PowerPlantPluginContext<OpenAPISchema$1, Options, TResolvedConfig>;
|
|
33
41
|
//#endregion
|
|
34
|
-
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig };
|
|
42
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, type OpenAPISchema, type PowerPlantOpenAPITypeScriptOptions };
|
|
35
43
|
//# sourceMappingURL=plugin.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-openapi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.612",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to generate project code from OpenAPI specifications.",
|
|
6
6
|
"repository": {
|
|
@@ -95,19 +95,21 @@
|
|
|
95
95
|
"powerlines-plugin"
|
|
96
96
|
],
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@
|
|
99
|
-
"@
|
|
100
|
-
"@
|
|
98
|
+
"@power-plant/core": "^0.0.23",
|
|
99
|
+
"@power-plant/openapi-schema": "^0.0.1",
|
|
100
|
+
"@power-plant/openapi-typescript": "^0.0.3",
|
|
101
|
+
"@powerlines/plugin-power-plant": "^0.1.2",
|
|
102
|
+
"@stryke/fs": "^0.33.97",
|
|
103
|
+
"@stryke/path": "^0.29.23",
|
|
101
104
|
"defu": "^6.1.7",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"powerlines": "^0.47.144"
|
|
105
|
+
"powerlines": "^0.47.146",
|
|
106
|
+
"yaml": "^2.9.0"
|
|
105
107
|
},
|
|
106
108
|
"devDependencies": {
|
|
107
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
109
|
+
"@powerlines/plugin-plugin": "^0.12.558",
|
|
108
110
|
"@types/node": "^25.9.5"
|
|
109
111
|
},
|
|
110
112
|
"publishConfig": { "access": "public" },
|
|
111
113
|
"types": "./dist/index.d.cts",
|
|
112
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "e86d6fab3bd4d2e2f9f6d05df8df7a07d399857e"
|
|
113
115
|
}
|