api-farmer 0.0.7 → 0.0.9
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/{chunk-GHW46C2M.js → chunk-ZOF4QGMP.js} +35 -22
- package/dist/cli.cjs +34 -21
- package/dist/cli.js +1 -1
- package/dist/{generate-QIKM4YKD.js → generate-KEVAHIZH.js} +1 -1
- package/dist/index.cjs +34 -21
- package/dist/index.d.cts +37 -25
- package/dist/index.d.ts +37 -25
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -22740,6 +22740,9 @@ import { camelize, pascalCase } from "rattail";
|
|
|
22740
22740
|
function transformModuleName({ name }) {
|
|
22741
22741
|
return camelize(name);
|
|
22742
22742
|
}
|
|
22743
|
+
function transformUrl({ path: path13, base }) {
|
|
22744
|
+
return (base ? path13.replace(base, "") : path13).replace(/{/g, ":").replace(/}/g, "");
|
|
22745
|
+
}
|
|
22743
22746
|
function transformVerb({ method }) {
|
|
22744
22747
|
switch (method) {
|
|
22745
22748
|
case "post":
|
|
@@ -22750,9 +22753,6 @@ function transformVerb({ method }) {
|
|
|
22750
22753
|
return pascalCase(method);
|
|
22751
22754
|
}
|
|
22752
22755
|
}
|
|
22753
|
-
function transformUrl({ path: path13, base }) {
|
|
22754
|
-
return (base ? path13.replace(base, "") : path13).replace(/{/g, ":").replace(/}/g, "");
|
|
22755
|
-
}
|
|
22756
22756
|
function transformEntity({ path: path13, method, base }) {
|
|
22757
22757
|
path13 = base ? path13.replace(base, "") : path13;
|
|
22758
22758
|
const words = path13.split("/").filter(Boolean);
|
|
@@ -22776,20 +22776,29 @@ function transformType({ verb, entity }) {
|
|
|
22776
22776
|
function transformTypeValue({ path: path13, method }) {
|
|
22777
22777
|
return `paths['${path13}']['${method}']`;
|
|
22778
22778
|
}
|
|
22779
|
-
function transformTypeQuery({
|
|
22780
|
-
return
|
|
22779
|
+
function transformTypeQuery({ type: type2 }) {
|
|
22780
|
+
return `${type2}Query`;
|
|
22781
22781
|
}
|
|
22782
|
-
function transformTypeQueryValue({
|
|
22782
|
+
function transformTypeQueryValue({
|
|
22783
|
+
type: type2
|
|
22784
|
+
}) {
|
|
22783
22785
|
return `${type2}['parameters']['query']`;
|
|
22784
22786
|
}
|
|
22785
|
-
function transformTypeRequestBody({
|
|
22786
|
-
|
|
22787
|
+
function transformTypeRequestBody({
|
|
22788
|
+
type: type2
|
|
22789
|
+
}) {
|
|
22790
|
+
return `${type2}RequestBody`;
|
|
22787
22791
|
}
|
|
22788
|
-
function transformTypeRequestBodyValue({
|
|
22792
|
+
function transformTypeRequestBodyValue({
|
|
22793
|
+
type: type2,
|
|
22794
|
+
required
|
|
22795
|
+
}) {
|
|
22789
22796
|
return required ? `${type2}['requestBody']['content']['application/json']` : `NonNullable<${type2}['requestBody']>['content']['application/json'] | undefined`;
|
|
22790
22797
|
}
|
|
22791
|
-
function transformTypeResponseBody({
|
|
22792
|
-
|
|
22798
|
+
function transformTypeResponseBody({
|
|
22799
|
+
type: type2
|
|
22800
|
+
}) {
|
|
22801
|
+
return `${type2}ResponseBody`;
|
|
22793
22802
|
}
|
|
22794
22803
|
function transformTypeResponseBodyValue({
|
|
22795
22804
|
type: type2,
|
|
@@ -22828,22 +22837,26 @@ function partitionApiModules(schema2, transformer, options8) {
|
|
|
22828
22837
|
const pathItems = schemaPaths[path13];
|
|
22829
22838
|
const childPayloads = Object.entries(pathItems).reduce((payloads3, [method, operation]) => {
|
|
22830
22839
|
const url2 = transformer.url({ path: path13, base });
|
|
22831
|
-
const
|
|
22832
|
-
const
|
|
22833
|
-
const
|
|
22834
|
-
const
|
|
22835
|
-
const
|
|
22836
|
-
const
|
|
22837
|
-
const
|
|
22838
|
-
const
|
|
22840
|
+
const args = { path: path13, base, url: url2, method, operation };
|
|
22841
|
+
const entity = transformer.entity(args);
|
|
22842
|
+
const verb = transformer.verb(args);
|
|
22843
|
+
const fn = transformer.fn({ ...args, verb, entity });
|
|
22844
|
+
const type2 = transformer.type({ ...args, verb, entity });
|
|
22845
|
+
const typeValue = transformer.typeValue({ ...args, verb, entity });
|
|
22846
|
+
const typeQuery = transformer.typeQuery({ ...args, type: type2, verb, entity });
|
|
22847
|
+
const typeQueryValue = hasQueryParameter(operation) ? transformer.typeQueryValue({ ...args, type: type2, verb, entity }) : "never";
|
|
22848
|
+
const typeRequestBody = transformer.typeRequestBody({ ...args, type: type2, verb, entity });
|
|
22839
22849
|
const typeRequestBodyValue = operation.requestBody ? transformer.typeRequestBodyValue({
|
|
22850
|
+
...args,
|
|
22840
22851
|
type: type2,
|
|
22852
|
+
verb,
|
|
22853
|
+
entity,
|
|
22841
22854
|
required: isRequiredRequestBody(operation.requestBody)
|
|
22842
22855
|
}) : "never";
|
|
22843
22856
|
const statusCode = statusCodes[method] ?? 200;
|
|
22844
22857
|
const mime = getResponseMime(operation, statusCode);
|
|
22845
|
-
const typeResponseBody = transformer.typeResponseBody({ verb, entity });
|
|
22846
|
-
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ type: type2, statusCode, mime }) : "never";
|
|
22858
|
+
const typeResponseBody = transformer.typeResponseBody({ ...args, type: type2, verb, entity });
|
|
22859
|
+
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ ...args, type: type2, verb, entity, statusCode, mime }) : "never";
|
|
22847
22860
|
payloads3.push({
|
|
22848
22861
|
fn,
|
|
22849
22862
|
url: url2,
|
|
@@ -22942,8 +22955,8 @@ export {
|
|
|
22942
22955
|
defineConfig,
|
|
22943
22956
|
getConfig,
|
|
22944
22957
|
transformModuleName,
|
|
22945
|
-
transformVerb,
|
|
22946
22958
|
transformUrl,
|
|
22959
|
+
transformVerb,
|
|
22947
22960
|
transformEntity,
|
|
22948
22961
|
transformFn,
|
|
22949
22962
|
transformType,
|
package/dist/cli.cjs
CHANGED
|
@@ -102000,6 +102000,9 @@ var init_config = __esm({
|
|
|
102000
102000
|
function transformModuleName({ name }) {
|
|
102001
102001
|
return (0, import_rattail.camelize)(name);
|
|
102002
102002
|
}
|
|
102003
|
+
function transformUrl({ path: path13, base }) {
|
|
102004
|
+
return (base ? path13.replace(base, "") : path13).replace(/{/g, ":").replace(/}/g, "");
|
|
102005
|
+
}
|
|
102003
102006
|
function transformVerb({ method }) {
|
|
102004
102007
|
switch (method) {
|
|
102005
102008
|
case "post":
|
|
@@ -102010,9 +102013,6 @@ function transformVerb({ method }) {
|
|
|
102010
102013
|
return (0, import_rattail.pascalCase)(method);
|
|
102011
102014
|
}
|
|
102012
102015
|
}
|
|
102013
|
-
function transformUrl({ path: path13, base }) {
|
|
102014
|
-
return (base ? path13.replace(base, "") : path13).replace(/{/g, ":").replace(/}/g, "");
|
|
102015
|
-
}
|
|
102016
102016
|
function transformEntity({ path: path13, method, base }) {
|
|
102017
102017
|
path13 = base ? path13.replace(base, "") : path13;
|
|
102018
102018
|
const words = path13.split("/").filter(Boolean);
|
|
@@ -102036,20 +102036,29 @@ function transformType({ verb, entity }) {
|
|
|
102036
102036
|
function transformTypeValue({ path: path13, method }) {
|
|
102037
102037
|
return `paths['${path13}']['${method}']`;
|
|
102038
102038
|
}
|
|
102039
|
-
function transformTypeQuery({
|
|
102040
|
-
return
|
|
102039
|
+
function transformTypeQuery({ type: type2 }) {
|
|
102040
|
+
return `${type2}Query`;
|
|
102041
102041
|
}
|
|
102042
|
-
function transformTypeQueryValue({
|
|
102042
|
+
function transformTypeQueryValue({
|
|
102043
|
+
type: type2
|
|
102044
|
+
}) {
|
|
102043
102045
|
return `${type2}['parameters']['query']`;
|
|
102044
102046
|
}
|
|
102045
|
-
function transformTypeRequestBody({
|
|
102046
|
-
|
|
102047
|
+
function transformTypeRequestBody({
|
|
102048
|
+
type: type2
|
|
102049
|
+
}) {
|
|
102050
|
+
return `${type2}RequestBody`;
|
|
102047
102051
|
}
|
|
102048
|
-
function transformTypeRequestBodyValue({
|
|
102052
|
+
function transformTypeRequestBodyValue({
|
|
102053
|
+
type: type2,
|
|
102054
|
+
required
|
|
102055
|
+
}) {
|
|
102049
102056
|
return required ? `${type2}['requestBody']['content']['application/json']` : `NonNullable<${type2}['requestBody']>['content']['application/json'] | undefined`;
|
|
102050
102057
|
}
|
|
102051
|
-
function transformTypeResponseBody({
|
|
102052
|
-
|
|
102058
|
+
function transformTypeResponseBody({
|
|
102059
|
+
type: type2
|
|
102060
|
+
}) {
|
|
102061
|
+
return `${type2}ResponseBody`;
|
|
102053
102062
|
}
|
|
102054
102063
|
function transformTypeResponseBodyValue({
|
|
102055
102064
|
type: type2,
|
|
@@ -102104,22 +102113,26 @@ function partitionApiModules(schema2, transformer, options8) {
|
|
|
102104
102113
|
const pathItems = schemaPaths[path13];
|
|
102105
102114
|
const childPayloads = Object.entries(pathItems).reduce((payloads3, [method, operation]) => {
|
|
102106
102115
|
const url2 = transformer.url({ path: path13, base });
|
|
102107
|
-
const
|
|
102108
|
-
const
|
|
102109
|
-
const
|
|
102110
|
-
const
|
|
102111
|
-
const
|
|
102112
|
-
const
|
|
102113
|
-
const
|
|
102114
|
-
const
|
|
102116
|
+
const args = { path: path13, base, url: url2, method, operation };
|
|
102117
|
+
const entity = transformer.entity(args);
|
|
102118
|
+
const verb = transformer.verb(args);
|
|
102119
|
+
const fn8 = transformer.fn({ ...args, verb, entity });
|
|
102120
|
+
const type2 = transformer.type({ ...args, verb, entity });
|
|
102121
|
+
const typeValue = transformer.typeValue({ ...args, verb, entity });
|
|
102122
|
+
const typeQuery = transformer.typeQuery({ ...args, type: type2, verb, entity });
|
|
102123
|
+
const typeQueryValue = hasQueryParameter(operation) ? transformer.typeQueryValue({ ...args, type: type2, verb, entity }) : "never";
|
|
102124
|
+
const typeRequestBody = transformer.typeRequestBody({ ...args, type: type2, verb, entity });
|
|
102115
102125
|
const typeRequestBodyValue = operation.requestBody ? transformer.typeRequestBodyValue({
|
|
102126
|
+
...args,
|
|
102116
102127
|
type: type2,
|
|
102128
|
+
verb,
|
|
102129
|
+
entity,
|
|
102117
102130
|
required: isRequiredRequestBody(operation.requestBody)
|
|
102118
102131
|
}) : "never";
|
|
102119
102132
|
const statusCode = statusCodes[method] ?? 200;
|
|
102120
102133
|
const mime = getResponseMime(operation, statusCode);
|
|
102121
|
-
const typeResponseBody = transformer.typeResponseBody({ verb, entity });
|
|
102122
|
-
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ type: type2, statusCode, mime }) : "never";
|
|
102134
|
+
const typeResponseBody = transformer.typeResponseBody({ ...args, type: type2, verb, entity });
|
|
102135
|
+
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ ...args, type: type2, verb, entity, statusCode, mime }) : "never";
|
|
102123
102136
|
payloads3.push({
|
|
102124
102137
|
fn: fn8,
|
|
102125
102138
|
url: url2,
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Command } from "commander";
|
|
|
9
9
|
var program = new Command();
|
|
10
10
|
program.version(getCliVersion());
|
|
11
11
|
program.action(async () => {
|
|
12
|
-
const { generate } = await import("./generate-
|
|
12
|
+
const { generate } = await import("./generate-KEVAHIZH.js");
|
|
13
13
|
return generate();
|
|
14
14
|
});
|
|
15
15
|
program.parse();
|
package/dist/index.cjs
CHANGED
|
@@ -79264,6 +79264,9 @@ var import_rattail = require("rattail");
|
|
|
79264
79264
|
function transformModuleName({ name }) {
|
|
79265
79265
|
return (0, import_rattail.camelize)(name);
|
|
79266
79266
|
}
|
|
79267
|
+
function transformUrl({ path: path13, base }) {
|
|
79268
|
+
return (base ? path13.replace(base, "") : path13).replace(/{/g, ":").replace(/}/g, "");
|
|
79269
|
+
}
|
|
79267
79270
|
function transformVerb({ method }) {
|
|
79268
79271
|
switch (method) {
|
|
79269
79272
|
case "post":
|
|
@@ -79274,9 +79277,6 @@ function transformVerb({ method }) {
|
|
|
79274
79277
|
return (0, import_rattail.pascalCase)(method);
|
|
79275
79278
|
}
|
|
79276
79279
|
}
|
|
79277
|
-
function transformUrl({ path: path13, base }) {
|
|
79278
|
-
return (base ? path13.replace(base, "") : path13).replace(/{/g, ":").replace(/}/g, "");
|
|
79279
|
-
}
|
|
79280
79280
|
function transformEntity({ path: path13, method, base }) {
|
|
79281
79281
|
path13 = base ? path13.replace(base, "") : path13;
|
|
79282
79282
|
const words = path13.split("/").filter(Boolean);
|
|
@@ -79300,20 +79300,29 @@ function transformType({ verb, entity }) {
|
|
|
79300
79300
|
function transformTypeValue({ path: path13, method }) {
|
|
79301
79301
|
return `paths['${path13}']['${method}']`;
|
|
79302
79302
|
}
|
|
79303
|
-
function transformTypeQuery({
|
|
79304
|
-
return
|
|
79303
|
+
function transformTypeQuery({ type: type2 }) {
|
|
79304
|
+
return `${type2}Query`;
|
|
79305
79305
|
}
|
|
79306
|
-
function transformTypeQueryValue({
|
|
79306
|
+
function transformTypeQueryValue({
|
|
79307
|
+
type: type2
|
|
79308
|
+
}) {
|
|
79307
79309
|
return `${type2}['parameters']['query']`;
|
|
79308
79310
|
}
|
|
79309
|
-
function transformTypeRequestBody({
|
|
79310
|
-
|
|
79311
|
+
function transformTypeRequestBody({
|
|
79312
|
+
type: type2
|
|
79313
|
+
}) {
|
|
79314
|
+
return `${type2}RequestBody`;
|
|
79311
79315
|
}
|
|
79312
|
-
function transformTypeRequestBodyValue({
|
|
79316
|
+
function transformTypeRequestBodyValue({
|
|
79317
|
+
type: type2,
|
|
79318
|
+
required
|
|
79319
|
+
}) {
|
|
79313
79320
|
return required ? `${type2}['requestBody']['content']['application/json']` : `NonNullable<${type2}['requestBody']>['content']['application/json'] | undefined`;
|
|
79314
79321
|
}
|
|
79315
|
-
function transformTypeResponseBody({
|
|
79316
|
-
|
|
79322
|
+
function transformTypeResponseBody({
|
|
79323
|
+
type: type2
|
|
79324
|
+
}) {
|
|
79325
|
+
return `${type2}ResponseBody`;
|
|
79317
79326
|
}
|
|
79318
79327
|
function transformTypeResponseBodyValue({
|
|
79319
79328
|
type: type2,
|
|
@@ -102142,22 +102151,26 @@ function partitionApiModules(schema2, transformer, options8) {
|
|
|
102142
102151
|
const pathItems = schemaPaths[path13];
|
|
102143
102152
|
const childPayloads = Object.entries(pathItems).reduce((payloads3, [method, operation]) => {
|
|
102144
102153
|
const url2 = transformer.url({ path: path13, base });
|
|
102145
|
-
const
|
|
102146
|
-
const
|
|
102147
|
-
const
|
|
102148
|
-
const
|
|
102149
|
-
const
|
|
102150
|
-
const
|
|
102151
|
-
const
|
|
102152
|
-
const
|
|
102154
|
+
const args = { path: path13, base, url: url2, method, operation };
|
|
102155
|
+
const entity = transformer.entity(args);
|
|
102156
|
+
const verb = transformer.verb(args);
|
|
102157
|
+
const fn8 = transformer.fn({ ...args, verb, entity });
|
|
102158
|
+
const type2 = transformer.type({ ...args, verb, entity });
|
|
102159
|
+
const typeValue = transformer.typeValue({ ...args, verb, entity });
|
|
102160
|
+
const typeQuery = transformer.typeQuery({ ...args, type: type2, verb, entity });
|
|
102161
|
+
const typeQueryValue = hasQueryParameter(operation) ? transformer.typeQueryValue({ ...args, type: type2, verb, entity }) : "never";
|
|
102162
|
+
const typeRequestBody = transformer.typeRequestBody({ ...args, type: type2, verb, entity });
|
|
102153
102163
|
const typeRequestBodyValue = operation.requestBody ? transformer.typeRequestBodyValue({
|
|
102164
|
+
...args,
|
|
102154
102165
|
type: type2,
|
|
102166
|
+
verb,
|
|
102167
|
+
entity,
|
|
102155
102168
|
required: isRequiredRequestBody(operation.requestBody)
|
|
102156
102169
|
}) : "never";
|
|
102157
102170
|
const statusCode = statusCodes[method] ?? 200;
|
|
102158
102171
|
const mime = getResponseMime(operation, statusCode);
|
|
102159
|
-
const typeResponseBody = transformer.typeResponseBody({ verb, entity });
|
|
102160
|
-
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ type: type2, statusCode, mime }) : "never";
|
|
102172
|
+
const typeResponseBody = transformer.typeResponseBody({ ...args, type: type2, verb, entity });
|
|
102173
|
+
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ ...args, type: type2, verb, entity, statusCode, mime }) : "never";
|
|
102161
102174
|
payloads3.push({
|
|
102162
102175
|
fn: fn8,
|
|
102163
102176
|
url: url2,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,57 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OperationObject, OpenAPI3, RequestBodyObject, ReferenceObject } from 'openapi-typescript';
|
|
2
2
|
export { default as pluralize } from 'pluralize';
|
|
3
3
|
|
|
4
|
+
type TransformerBaseArgs = {
|
|
5
|
+
path: string;
|
|
6
|
+
base: string | undefined;
|
|
7
|
+
url: string;
|
|
8
|
+
method: string;
|
|
9
|
+
operation: OperationObject;
|
|
10
|
+
};
|
|
4
11
|
declare function transformModuleName({ name }: {
|
|
5
12
|
name: string;
|
|
6
13
|
}): string;
|
|
7
|
-
declare function transformVerb({ method }: {
|
|
8
|
-
method: string;
|
|
9
|
-
}): string;
|
|
10
14
|
declare function transformUrl({ path, base }: {
|
|
11
15
|
path: string;
|
|
12
|
-
base
|
|
16
|
+
base: string | undefined;
|
|
13
17
|
}): string;
|
|
14
|
-
declare function
|
|
15
|
-
path: string;
|
|
18
|
+
declare function transformVerb({ method }: {
|
|
16
19
|
method: string;
|
|
17
|
-
base?: string;
|
|
18
20
|
}): string;
|
|
21
|
+
declare function transformEntity({ path, method, base }: TransformerBaseArgs): string;
|
|
19
22
|
declare function transformFn({ verb, entity }: {
|
|
20
23
|
verb: string;
|
|
21
24
|
entity: string;
|
|
22
|
-
}): string;
|
|
25
|
+
} & TransformerBaseArgs): string;
|
|
23
26
|
declare function transformType({ verb, entity }: {
|
|
24
27
|
verb: string;
|
|
25
28
|
entity: string;
|
|
26
|
-
}): string;
|
|
29
|
+
} & TransformerBaseArgs): string;
|
|
27
30
|
declare function transformTypeValue({ path, method }: {
|
|
28
|
-
path: string;
|
|
29
|
-
method: string;
|
|
30
|
-
}): string;
|
|
31
|
-
declare function transformTypeQuery({ verb, entity }: {
|
|
32
31
|
verb: string;
|
|
33
32
|
entity: string;
|
|
34
|
-
}): string;
|
|
35
|
-
declare function
|
|
33
|
+
} & TransformerBaseArgs): string;
|
|
34
|
+
declare function transformTypeQuery({ type }: {
|
|
36
35
|
type: string;
|
|
37
|
-
}): string;
|
|
38
|
-
declare function transformTypeRequestBody({ verb, entity }: {
|
|
39
36
|
verb: string;
|
|
40
37
|
entity: string;
|
|
41
|
-
}): string;
|
|
42
|
-
declare function
|
|
38
|
+
} & TransformerBaseArgs): string;
|
|
39
|
+
declare function transformTypeQueryValue({ type, }: {
|
|
40
|
+
type: string;
|
|
41
|
+
verb: string;
|
|
42
|
+
entity: string;
|
|
43
|
+
} & TransformerBaseArgs): string;
|
|
44
|
+
declare function transformTypeRequestBody({ type, }: {
|
|
45
|
+
type: string;
|
|
46
|
+
verb: string;
|
|
47
|
+
entity: string;
|
|
48
|
+
} & TransformerBaseArgs): string;
|
|
49
|
+
declare function transformTypeRequestBodyValue({ type, required, }: {
|
|
43
50
|
type: string;
|
|
51
|
+
verb: string;
|
|
52
|
+
entity: string;
|
|
44
53
|
required: boolean;
|
|
45
|
-
}): string;
|
|
46
|
-
declare function transformTypeResponseBody({
|
|
54
|
+
} & TransformerBaseArgs): string;
|
|
55
|
+
declare function transformTypeResponseBody({ type, }: {
|
|
56
|
+
type: string;
|
|
47
57
|
verb: string;
|
|
48
58
|
entity: string;
|
|
49
|
-
}): string;
|
|
59
|
+
} & TransformerBaseArgs): string;
|
|
50
60
|
declare function transformTypeResponseBodyValue({ type, statusCode, mime, }: {
|
|
51
61
|
type: string;
|
|
62
|
+
verb: string;
|
|
63
|
+
entity: string;
|
|
52
64
|
statusCode: number;
|
|
53
65
|
mime: string;
|
|
54
|
-
}): string;
|
|
66
|
+
} & TransformerBaseArgs): string;
|
|
55
67
|
interface Transformer {
|
|
56
68
|
moduleName: typeof transformModuleName;
|
|
57
69
|
verb: typeof transformVerb;
|
|
@@ -251,4 +263,4 @@ type Config = GenerateOptions;
|
|
|
251
263
|
declare function defineConfig(config: Config): GenerateOptions;
|
|
252
264
|
declare function getConfig(): Promise<Config>;
|
|
253
265
|
|
|
254
|
-
export { type ApiModule, type ApiModulePayload, type ApiModuleTemplateData, type Config, type GenerateOptions, type Preset, type StatusCodeStrategy, type StatusCodes, type Transformer, createStatusCodesByStrategy, createTransformer, defineConfig, generate, generateTypes, getCliVersion, getConfig, getResponseMime, hasQueryParameter, isRequiredRequestBody, partitionApiModules, readSchema, readTemplateFile, renderApiModules, transformEntity, transformFn, transformModuleName, transformType, transformTypeQuery, transformTypeQueryValue, transformTypeRequestBody, transformTypeRequestBodyValue, transformTypeResponseBody, transformTypeResponseBodyValue, transformTypeValue, transformUrl, transformVerb };
|
|
266
|
+
export { type ApiModule, type ApiModulePayload, type ApiModuleTemplateData, type Config, type GenerateOptions, type Preset, type StatusCodeStrategy, type StatusCodes, type Transformer, type TransformerBaseArgs, createStatusCodesByStrategy, createTransformer, defineConfig, generate, generateTypes, getCliVersion, getConfig, getResponseMime, hasQueryParameter, isRequiredRequestBody, partitionApiModules, readSchema, readTemplateFile, renderApiModules, transformEntity, transformFn, transformModuleName, transformType, transformTypeQuery, transformTypeQueryValue, transformTypeRequestBody, transformTypeRequestBodyValue, transformTypeResponseBody, transformTypeResponseBodyValue, transformTypeValue, transformUrl, transformVerb };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,57 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OperationObject, OpenAPI3, RequestBodyObject, ReferenceObject } from 'openapi-typescript';
|
|
2
2
|
export { default as pluralize } from 'pluralize';
|
|
3
3
|
|
|
4
|
+
type TransformerBaseArgs = {
|
|
5
|
+
path: string;
|
|
6
|
+
base: string | undefined;
|
|
7
|
+
url: string;
|
|
8
|
+
method: string;
|
|
9
|
+
operation: OperationObject;
|
|
10
|
+
};
|
|
4
11
|
declare function transformModuleName({ name }: {
|
|
5
12
|
name: string;
|
|
6
13
|
}): string;
|
|
7
|
-
declare function transformVerb({ method }: {
|
|
8
|
-
method: string;
|
|
9
|
-
}): string;
|
|
10
14
|
declare function transformUrl({ path, base }: {
|
|
11
15
|
path: string;
|
|
12
|
-
base
|
|
16
|
+
base: string | undefined;
|
|
13
17
|
}): string;
|
|
14
|
-
declare function
|
|
15
|
-
path: string;
|
|
18
|
+
declare function transformVerb({ method }: {
|
|
16
19
|
method: string;
|
|
17
|
-
base?: string;
|
|
18
20
|
}): string;
|
|
21
|
+
declare function transformEntity({ path, method, base }: TransformerBaseArgs): string;
|
|
19
22
|
declare function transformFn({ verb, entity }: {
|
|
20
23
|
verb: string;
|
|
21
24
|
entity: string;
|
|
22
|
-
}): string;
|
|
25
|
+
} & TransformerBaseArgs): string;
|
|
23
26
|
declare function transformType({ verb, entity }: {
|
|
24
27
|
verb: string;
|
|
25
28
|
entity: string;
|
|
26
|
-
}): string;
|
|
29
|
+
} & TransformerBaseArgs): string;
|
|
27
30
|
declare function transformTypeValue({ path, method }: {
|
|
28
|
-
path: string;
|
|
29
|
-
method: string;
|
|
30
|
-
}): string;
|
|
31
|
-
declare function transformTypeQuery({ verb, entity }: {
|
|
32
31
|
verb: string;
|
|
33
32
|
entity: string;
|
|
34
|
-
}): string;
|
|
35
|
-
declare function
|
|
33
|
+
} & TransformerBaseArgs): string;
|
|
34
|
+
declare function transformTypeQuery({ type }: {
|
|
36
35
|
type: string;
|
|
37
|
-
}): string;
|
|
38
|
-
declare function transformTypeRequestBody({ verb, entity }: {
|
|
39
36
|
verb: string;
|
|
40
37
|
entity: string;
|
|
41
|
-
}): string;
|
|
42
|
-
declare function
|
|
38
|
+
} & TransformerBaseArgs): string;
|
|
39
|
+
declare function transformTypeQueryValue({ type, }: {
|
|
40
|
+
type: string;
|
|
41
|
+
verb: string;
|
|
42
|
+
entity: string;
|
|
43
|
+
} & TransformerBaseArgs): string;
|
|
44
|
+
declare function transformTypeRequestBody({ type, }: {
|
|
45
|
+
type: string;
|
|
46
|
+
verb: string;
|
|
47
|
+
entity: string;
|
|
48
|
+
} & TransformerBaseArgs): string;
|
|
49
|
+
declare function transformTypeRequestBodyValue({ type, required, }: {
|
|
43
50
|
type: string;
|
|
51
|
+
verb: string;
|
|
52
|
+
entity: string;
|
|
44
53
|
required: boolean;
|
|
45
|
-
}): string;
|
|
46
|
-
declare function transformTypeResponseBody({
|
|
54
|
+
} & TransformerBaseArgs): string;
|
|
55
|
+
declare function transformTypeResponseBody({ type, }: {
|
|
56
|
+
type: string;
|
|
47
57
|
verb: string;
|
|
48
58
|
entity: string;
|
|
49
|
-
}): string;
|
|
59
|
+
} & TransformerBaseArgs): string;
|
|
50
60
|
declare function transformTypeResponseBodyValue({ type, statusCode, mime, }: {
|
|
51
61
|
type: string;
|
|
62
|
+
verb: string;
|
|
63
|
+
entity: string;
|
|
52
64
|
statusCode: number;
|
|
53
65
|
mime: string;
|
|
54
|
-
}): string;
|
|
66
|
+
} & TransformerBaseArgs): string;
|
|
55
67
|
interface Transformer {
|
|
56
68
|
moduleName: typeof transformModuleName;
|
|
57
69
|
verb: typeof transformVerb;
|
|
@@ -251,4 +263,4 @@ type Config = GenerateOptions;
|
|
|
251
263
|
declare function defineConfig(config: Config): GenerateOptions;
|
|
252
264
|
declare function getConfig(): Promise<Config>;
|
|
253
265
|
|
|
254
|
-
export { type ApiModule, type ApiModulePayload, type ApiModuleTemplateData, type Config, type GenerateOptions, type Preset, type StatusCodeStrategy, type StatusCodes, type Transformer, createStatusCodesByStrategy, createTransformer, defineConfig, generate, generateTypes, getCliVersion, getConfig, getResponseMime, hasQueryParameter, isRequiredRequestBody, partitionApiModules, readSchema, readTemplateFile, renderApiModules, transformEntity, transformFn, transformModuleName, transformType, transformTypeQuery, transformTypeQueryValue, transformTypeRequestBody, transformTypeRequestBodyValue, transformTypeResponseBody, transformTypeResponseBodyValue, transformTypeValue, transformUrl, transformVerb };
|
|
266
|
+
export { type ApiModule, type ApiModulePayload, type ApiModuleTemplateData, type Config, type GenerateOptions, type Preset, type StatusCodeStrategy, type StatusCodes, type Transformer, type TransformerBaseArgs, createStatusCodesByStrategy, createTransformer, defineConfig, generate, generateTypes, getCliVersion, getConfig, getResponseMime, hasQueryParameter, isRequiredRequestBody, partitionApiModules, readSchema, readTemplateFile, renderApiModules, transformEntity, transformFn, transformModuleName, transformType, transformTypeQuery, transformTypeQueryValue, transformTypeRequestBody, transformTypeRequestBodyValue, transformTypeResponseBody, transformTypeResponseBodyValue, transformTypeValue, transformUrl, transformVerb };
|
package/dist/index.js
CHANGED