api-farmer 0.0.7 → 0.0.8
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-L33J46FJ.js} +37 -19
- package/dist/cli.cjs +36 -18
- package/dist/cli.js +1 -1
- package/dist/{generate-QIKM4YKD.js → generate-C3K2GRQJ.js} +1 -1
- package/dist/index.cjs +36 -18
- 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,19 +22776,33 @@ function transformType({ verb, entity }) {
|
|
|
22776
22776
|
function transformTypeValue({ path: path13, method }) {
|
|
22777
22777
|
return `paths['${path13}']['${method}']`;
|
|
22778
22778
|
}
|
|
22779
|
-
function transformTypeQuery({
|
|
22779
|
+
function transformTypeQuery({
|
|
22780
|
+
verb,
|
|
22781
|
+
entity
|
|
22782
|
+
}) {
|
|
22780
22783
|
return `Api${verb}${entity}Query`;
|
|
22781
22784
|
}
|
|
22782
|
-
function transformTypeQueryValue({
|
|
22785
|
+
function transformTypeQueryValue({
|
|
22786
|
+
type: type2
|
|
22787
|
+
}) {
|
|
22783
22788
|
return `${type2}['parameters']['query']`;
|
|
22784
22789
|
}
|
|
22785
|
-
function transformTypeRequestBody({
|
|
22790
|
+
function transformTypeRequestBody({
|
|
22791
|
+
verb,
|
|
22792
|
+
entity
|
|
22793
|
+
}) {
|
|
22786
22794
|
return `Api${verb}${entity}RequestBody`;
|
|
22787
22795
|
}
|
|
22788
|
-
function transformTypeRequestBodyValue({
|
|
22796
|
+
function transformTypeRequestBodyValue({
|
|
22797
|
+
type: type2,
|
|
22798
|
+
required
|
|
22799
|
+
}) {
|
|
22789
22800
|
return required ? `${type2}['requestBody']['content']['application/json']` : `NonNullable<${type2}['requestBody']>['content']['application/json'] | undefined`;
|
|
22790
22801
|
}
|
|
22791
|
-
function transformTypeResponseBody({
|
|
22802
|
+
function transformTypeResponseBody({
|
|
22803
|
+
verb,
|
|
22804
|
+
entity
|
|
22805
|
+
}) {
|
|
22792
22806
|
return `Api${verb}${entity}ResponseBody`;
|
|
22793
22807
|
}
|
|
22794
22808
|
function transformTypeResponseBodyValue({
|
|
@@ -22828,22 +22842,26 @@ function partitionApiModules(schema2, transformer, options8) {
|
|
|
22828
22842
|
const pathItems = schemaPaths[path13];
|
|
22829
22843
|
const childPayloads = Object.entries(pathItems).reduce((payloads3, [method, operation]) => {
|
|
22830
22844
|
const url2 = transformer.url({ path: path13, base });
|
|
22831
|
-
const
|
|
22832
|
-
const
|
|
22833
|
-
const
|
|
22834
|
-
const
|
|
22835
|
-
const
|
|
22836
|
-
const
|
|
22837
|
-
const
|
|
22838
|
-
const
|
|
22845
|
+
const args = { path: path13, base, url: url2, method, operation };
|
|
22846
|
+
const entity = transformer.entity(args);
|
|
22847
|
+
const verb = transformer.verb(args);
|
|
22848
|
+
const fn = transformer.fn({ ...args, verb, entity });
|
|
22849
|
+
const type2 = transformer.type({ ...args, verb, entity });
|
|
22850
|
+
const typeValue = transformer.typeValue({ ...args, verb, entity });
|
|
22851
|
+
const typeQuery = transformer.typeQuery({ ...args, type: type2, verb, entity });
|
|
22852
|
+
const typeQueryValue = hasQueryParameter(operation) ? transformer.typeQueryValue({ ...args, type: type2, verb, entity }) : "never";
|
|
22853
|
+
const typeRequestBody = transformer.typeRequestBody({ ...args, type: type2, verb, entity });
|
|
22839
22854
|
const typeRequestBodyValue = operation.requestBody ? transformer.typeRequestBodyValue({
|
|
22855
|
+
...args,
|
|
22840
22856
|
type: type2,
|
|
22857
|
+
verb,
|
|
22858
|
+
entity,
|
|
22841
22859
|
required: isRequiredRequestBody(operation.requestBody)
|
|
22842
22860
|
}) : "never";
|
|
22843
22861
|
const statusCode = statusCodes[method] ?? 200;
|
|
22844
22862
|
const mime = getResponseMime(operation, statusCode);
|
|
22845
|
-
const typeResponseBody = transformer.typeResponseBody({ verb, entity });
|
|
22846
|
-
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ type: type2, statusCode, mime }) : "never";
|
|
22863
|
+
const typeResponseBody = transformer.typeResponseBody({ ...args, type: type2, verb, entity });
|
|
22864
|
+
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ ...args, type: type2, verb, entity, statusCode, mime }) : "never";
|
|
22847
22865
|
payloads3.push({
|
|
22848
22866
|
fn,
|
|
22849
22867
|
url: url2,
|
|
@@ -22942,8 +22960,8 @@ export {
|
|
|
22942
22960
|
defineConfig,
|
|
22943
22961
|
getConfig,
|
|
22944
22962
|
transformModuleName,
|
|
22945
|
-
transformVerb,
|
|
22946
22963
|
transformUrl,
|
|
22964
|
+
transformVerb,
|
|
22947
22965
|
transformEntity,
|
|
22948
22966
|
transformFn,
|
|
22949
22967
|
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,19 +102036,33 @@ function transformType({ verb, entity }) {
|
|
|
102036
102036
|
function transformTypeValue({ path: path13, method }) {
|
|
102037
102037
|
return `paths['${path13}']['${method}']`;
|
|
102038
102038
|
}
|
|
102039
|
-
function transformTypeQuery({
|
|
102039
|
+
function transformTypeQuery({
|
|
102040
|
+
verb,
|
|
102041
|
+
entity
|
|
102042
|
+
}) {
|
|
102040
102043
|
return `Api${verb}${entity}Query`;
|
|
102041
102044
|
}
|
|
102042
|
-
function transformTypeQueryValue({
|
|
102045
|
+
function transformTypeQueryValue({
|
|
102046
|
+
type: type2
|
|
102047
|
+
}) {
|
|
102043
102048
|
return `${type2}['parameters']['query']`;
|
|
102044
102049
|
}
|
|
102045
|
-
function transformTypeRequestBody({
|
|
102050
|
+
function transformTypeRequestBody({
|
|
102051
|
+
verb,
|
|
102052
|
+
entity
|
|
102053
|
+
}) {
|
|
102046
102054
|
return `Api${verb}${entity}RequestBody`;
|
|
102047
102055
|
}
|
|
102048
|
-
function transformTypeRequestBodyValue({
|
|
102056
|
+
function transformTypeRequestBodyValue({
|
|
102057
|
+
type: type2,
|
|
102058
|
+
required
|
|
102059
|
+
}) {
|
|
102049
102060
|
return required ? `${type2}['requestBody']['content']['application/json']` : `NonNullable<${type2}['requestBody']>['content']['application/json'] | undefined`;
|
|
102050
102061
|
}
|
|
102051
|
-
function transformTypeResponseBody({
|
|
102062
|
+
function transformTypeResponseBody({
|
|
102063
|
+
verb,
|
|
102064
|
+
entity
|
|
102065
|
+
}) {
|
|
102052
102066
|
return `Api${verb}${entity}ResponseBody`;
|
|
102053
102067
|
}
|
|
102054
102068
|
function transformTypeResponseBodyValue({
|
|
@@ -102104,22 +102118,26 @@ function partitionApiModules(schema2, transformer, options8) {
|
|
|
102104
102118
|
const pathItems = schemaPaths[path13];
|
|
102105
102119
|
const childPayloads = Object.entries(pathItems).reduce((payloads3, [method, operation]) => {
|
|
102106
102120
|
const url2 = transformer.url({ path: path13, base });
|
|
102107
|
-
const
|
|
102108
|
-
const
|
|
102109
|
-
const
|
|
102110
|
-
const
|
|
102111
|
-
const
|
|
102112
|
-
const
|
|
102113
|
-
const
|
|
102114
|
-
const
|
|
102121
|
+
const args = { path: path13, base, url: url2, method, operation };
|
|
102122
|
+
const entity = transformer.entity(args);
|
|
102123
|
+
const verb = transformer.verb(args);
|
|
102124
|
+
const fn8 = transformer.fn({ ...args, verb, entity });
|
|
102125
|
+
const type2 = transformer.type({ ...args, verb, entity });
|
|
102126
|
+
const typeValue = transformer.typeValue({ ...args, verb, entity });
|
|
102127
|
+
const typeQuery = transformer.typeQuery({ ...args, type: type2, verb, entity });
|
|
102128
|
+
const typeQueryValue = hasQueryParameter(operation) ? transformer.typeQueryValue({ ...args, type: type2, verb, entity }) : "never";
|
|
102129
|
+
const typeRequestBody = transformer.typeRequestBody({ ...args, type: type2, verb, entity });
|
|
102115
102130
|
const typeRequestBodyValue = operation.requestBody ? transformer.typeRequestBodyValue({
|
|
102131
|
+
...args,
|
|
102116
102132
|
type: type2,
|
|
102133
|
+
verb,
|
|
102134
|
+
entity,
|
|
102117
102135
|
required: isRequiredRequestBody(operation.requestBody)
|
|
102118
102136
|
}) : "never";
|
|
102119
102137
|
const statusCode = statusCodes[method] ?? 200;
|
|
102120
102138
|
const mime = getResponseMime(operation, statusCode);
|
|
102121
|
-
const typeResponseBody = transformer.typeResponseBody({ verb, entity });
|
|
102122
|
-
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ type: type2, statusCode, mime }) : "never";
|
|
102139
|
+
const typeResponseBody = transformer.typeResponseBody({ ...args, type: type2, verb, entity });
|
|
102140
|
+
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ ...args, type: type2, verb, entity, statusCode, mime }) : "never";
|
|
102123
102141
|
payloads3.push({
|
|
102124
102142
|
fn: fn8,
|
|
102125
102143
|
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-C3K2GRQJ.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,19 +79300,33 @@ function transformType({ verb, entity }) {
|
|
|
79300
79300
|
function transformTypeValue({ path: path13, method }) {
|
|
79301
79301
|
return `paths['${path13}']['${method}']`;
|
|
79302
79302
|
}
|
|
79303
|
-
function transformTypeQuery({
|
|
79303
|
+
function transformTypeQuery({
|
|
79304
|
+
verb,
|
|
79305
|
+
entity
|
|
79306
|
+
}) {
|
|
79304
79307
|
return `Api${verb}${entity}Query`;
|
|
79305
79308
|
}
|
|
79306
|
-
function transformTypeQueryValue({
|
|
79309
|
+
function transformTypeQueryValue({
|
|
79310
|
+
type: type2
|
|
79311
|
+
}) {
|
|
79307
79312
|
return `${type2}['parameters']['query']`;
|
|
79308
79313
|
}
|
|
79309
|
-
function transformTypeRequestBody({
|
|
79314
|
+
function transformTypeRequestBody({
|
|
79315
|
+
verb,
|
|
79316
|
+
entity
|
|
79317
|
+
}) {
|
|
79310
79318
|
return `Api${verb}${entity}RequestBody`;
|
|
79311
79319
|
}
|
|
79312
|
-
function transformTypeRequestBodyValue({
|
|
79320
|
+
function transformTypeRequestBodyValue({
|
|
79321
|
+
type: type2,
|
|
79322
|
+
required
|
|
79323
|
+
}) {
|
|
79313
79324
|
return required ? `${type2}['requestBody']['content']['application/json']` : `NonNullable<${type2}['requestBody']>['content']['application/json'] | undefined`;
|
|
79314
79325
|
}
|
|
79315
|
-
function transformTypeResponseBody({
|
|
79326
|
+
function transformTypeResponseBody({
|
|
79327
|
+
verb,
|
|
79328
|
+
entity
|
|
79329
|
+
}) {
|
|
79316
79330
|
return `Api${verb}${entity}ResponseBody`;
|
|
79317
79331
|
}
|
|
79318
79332
|
function transformTypeResponseBodyValue({
|
|
@@ -102142,22 +102156,26 @@ function partitionApiModules(schema2, transformer, options8) {
|
|
|
102142
102156
|
const pathItems = schemaPaths[path13];
|
|
102143
102157
|
const childPayloads = Object.entries(pathItems).reduce((payloads3, [method, operation]) => {
|
|
102144
102158
|
const url2 = transformer.url({ path: path13, base });
|
|
102145
|
-
const
|
|
102146
|
-
const
|
|
102147
|
-
const
|
|
102148
|
-
const
|
|
102149
|
-
const
|
|
102150
|
-
const
|
|
102151
|
-
const
|
|
102152
|
-
const
|
|
102159
|
+
const args = { path: path13, base, url: url2, method, operation };
|
|
102160
|
+
const entity = transformer.entity(args);
|
|
102161
|
+
const verb = transformer.verb(args);
|
|
102162
|
+
const fn8 = transformer.fn({ ...args, verb, entity });
|
|
102163
|
+
const type2 = transformer.type({ ...args, verb, entity });
|
|
102164
|
+
const typeValue = transformer.typeValue({ ...args, verb, entity });
|
|
102165
|
+
const typeQuery = transformer.typeQuery({ ...args, type: type2, verb, entity });
|
|
102166
|
+
const typeQueryValue = hasQueryParameter(operation) ? transformer.typeQueryValue({ ...args, type: type2, verb, entity }) : "never";
|
|
102167
|
+
const typeRequestBody = transformer.typeRequestBody({ ...args, type: type2, verb, entity });
|
|
102153
102168
|
const typeRequestBodyValue = operation.requestBody ? transformer.typeRequestBodyValue({
|
|
102169
|
+
...args,
|
|
102154
102170
|
type: type2,
|
|
102171
|
+
verb,
|
|
102172
|
+
entity,
|
|
102155
102173
|
required: isRequiredRequestBody(operation.requestBody)
|
|
102156
102174
|
}) : "never";
|
|
102157
102175
|
const statusCode = statusCodes[method] ?? 200;
|
|
102158
102176
|
const mime = getResponseMime(operation, statusCode);
|
|
102159
|
-
const typeResponseBody = transformer.typeResponseBody({ verb, entity });
|
|
102160
|
-
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ type: type2, statusCode, mime }) : "never";
|
|
102177
|
+
const typeResponseBody = transformer.typeResponseBody({ ...args, type: type2, verb, entity });
|
|
102178
|
+
const typeResponseBodyValue = mime ? transformer.typeResponseBodyValue({ ...args, type: type2, verb, entity, statusCode, mime }) : "never";
|
|
102161
102179
|
payloads3.push({
|
|
102162
102180
|
fn: fn8,
|
|
102163
102181
|
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({ verb, entity, }: {
|
|
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({ verb, entity, }: {
|
|
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({ verb, entity }: {
|
|
54
|
+
} & TransformerBaseArgs): string;
|
|
55
|
+
declare function transformTypeResponseBody({ verb, entity, }: {
|
|
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({ verb, entity, }: {
|
|
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({ verb, entity, }: {
|
|
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({ verb, entity }: {
|
|
54
|
+
} & TransformerBaseArgs): string;
|
|
55
|
+
declare function transformTypeResponseBody({ verb, entity, }: {
|
|
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