api-farmer 0.0.0 → 0.0.2
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/acorn-O63CA7L4.js +3047 -0
- package/dist/angular-U44OZXUW.js +2794 -0
- package/dist/babel-VWJW3TNP.js +6946 -0
- package/dist/chunk-6N4OHGAC.js +72 -0
- package/dist/chunk-6OIOYGN7.js +17 -0
- package/dist/chunk-HMKED3BC.js +22949 -0
- package/dist/cli.cjs +102232 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15 -0
- package/dist/estree-OIZOUIW7.js +4374 -0
- package/dist/flow-TDKVTHFE.js +26897 -0
- package/dist/generate-3DZVV2U4.js +14 -0
- package/dist/glimmer-AWQE7API.js +2847 -0
- package/dist/graphql-IJWEVF4G.js +1247 -0
- package/dist/html-7SW5PDZO.js +2716 -0
- package/dist/index.cjs +102270 -0
- package/dist/index.d.cts +130 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.js +61 -0
- package/dist/markdown-2BNVGUT3.js +3484 -0
- package/dist/meriyah-L52O7E6A.js +2474 -0
- package/dist/postcss-AOWY4ITF.js +5057 -0
- package/dist/typescript-ANND5E4Y.js +13104 -0
- package/dist/yaml-MB3PL3NY.js +4223 -0
- package/package.json +90 -2
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { OpenAPI3, OperationObject } from 'openapi-typescript';
|
|
2
|
+
export { default as pluralize } from 'pluralize';
|
|
3
|
+
|
|
4
|
+
declare function transformVerb(method: string): string;
|
|
5
|
+
declare function transformUrl(path: string, base?: string): string;
|
|
6
|
+
declare function transformEntity(path: string, method: string, base?: string): string;
|
|
7
|
+
declare function transformFn(verb: string, entity: string): string;
|
|
8
|
+
declare function transformType(verb: string, entity: string): string;
|
|
9
|
+
declare function transformTypeValue(path: string, method: string): string;
|
|
10
|
+
declare function transformTypeQuery(verb: string, entity: string): string;
|
|
11
|
+
declare function transformTypeQueryValue(type: string): string;
|
|
12
|
+
declare function transformTypeRequestBody(verb: string, entity: string): string;
|
|
13
|
+
declare function transformTypeRequestBodyValue(type: string): string;
|
|
14
|
+
declare function transformTypeResponseBody(verb: string, entity: string): string;
|
|
15
|
+
declare function transformTypeResponseBodyValue(type: string, statusCode: number, mime: string): string;
|
|
16
|
+
interface Transformer {
|
|
17
|
+
verb: typeof transformVerb;
|
|
18
|
+
url: typeof transformUrl;
|
|
19
|
+
entity: typeof transformEntity;
|
|
20
|
+
fn: typeof transformFn;
|
|
21
|
+
type: typeof transformType;
|
|
22
|
+
typeValue: typeof transformTypeValue;
|
|
23
|
+
typeQuery: typeof transformTypeQuery;
|
|
24
|
+
typeQueryValue: typeof transformTypeQueryValue;
|
|
25
|
+
typeRequestBody: typeof transformTypeRequestBody;
|
|
26
|
+
typeRequestBodyValue: typeof transformTypeRequestBodyValue;
|
|
27
|
+
typeResponseBody: typeof transformTypeResponseBody;
|
|
28
|
+
typeResponseBodyValue: typeof transformTypeResponseBodyValue;
|
|
29
|
+
}
|
|
30
|
+
declare function createTransformer(): Transformer;
|
|
31
|
+
|
|
32
|
+
type Preset = 'axle' | 'axios';
|
|
33
|
+
type StatusCodeStrategy = 'strict' | 'loose';
|
|
34
|
+
interface StatusCodes {
|
|
35
|
+
get?: number;
|
|
36
|
+
post?: number;
|
|
37
|
+
put?: number;
|
|
38
|
+
delete?: number;
|
|
39
|
+
patch?: number;
|
|
40
|
+
options?: number;
|
|
41
|
+
head?: number;
|
|
42
|
+
}
|
|
43
|
+
declare function createStatusCodesByStrategy(strategy: StatusCodeStrategy): {
|
|
44
|
+
get: number;
|
|
45
|
+
post: number;
|
|
46
|
+
put: number;
|
|
47
|
+
delete: number;
|
|
48
|
+
patch: number;
|
|
49
|
+
options: number;
|
|
50
|
+
head: number;
|
|
51
|
+
} | {
|
|
52
|
+
get: number;
|
|
53
|
+
post: number;
|
|
54
|
+
put: number;
|
|
55
|
+
delete: number;
|
|
56
|
+
patch: number;
|
|
57
|
+
options: number;
|
|
58
|
+
head: number;
|
|
59
|
+
};
|
|
60
|
+
declare function readSchema(input: string): Promise<OpenAPI3>;
|
|
61
|
+
declare function readTemplateFile(preset?: Preset): string;
|
|
62
|
+
declare function hasQueryParameter(operation: OperationObject): boolean;
|
|
63
|
+
declare function hasResponseBody(operation: OperationObject): boolean;
|
|
64
|
+
declare function getCliVersion(): any;
|
|
65
|
+
|
|
66
|
+
interface ApiModulePayload {
|
|
67
|
+
fn: string;
|
|
68
|
+
path: string;
|
|
69
|
+
url: string;
|
|
70
|
+
method: string;
|
|
71
|
+
verb: string;
|
|
72
|
+
entity: string;
|
|
73
|
+
type: string;
|
|
74
|
+
typeValue: string;
|
|
75
|
+
typeQuery: string;
|
|
76
|
+
typeQueryValue: string;
|
|
77
|
+
typeRequestBody: string;
|
|
78
|
+
typeRequestBodyValue: string;
|
|
79
|
+
typeResponseBody: string;
|
|
80
|
+
typeResponseBodyValue: string;
|
|
81
|
+
}
|
|
82
|
+
interface ApiModule {
|
|
83
|
+
name: string;
|
|
84
|
+
payloads: ApiModulePayload[];
|
|
85
|
+
}
|
|
86
|
+
interface ApiModuleTemplateData {
|
|
87
|
+
apiModule: ApiModule;
|
|
88
|
+
typesFilename: string;
|
|
89
|
+
ts: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface GenerateOptions {
|
|
92
|
+
input?: string;
|
|
93
|
+
output?: string;
|
|
94
|
+
base?: string;
|
|
95
|
+
typesFilename?: string;
|
|
96
|
+
transformer?: Partial<Transformer>;
|
|
97
|
+
ts?: boolean;
|
|
98
|
+
override?: boolean | string[];
|
|
99
|
+
preset?: Preset;
|
|
100
|
+
statusCodeStrategy?: StatusCodeStrategy;
|
|
101
|
+
statusCodes?: {
|
|
102
|
+
get?: number;
|
|
103
|
+
post?: number;
|
|
104
|
+
put?: number;
|
|
105
|
+
delete?: number;
|
|
106
|
+
patch?: number;
|
|
107
|
+
options?: number;
|
|
108
|
+
head?: number;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
declare function partitionApiModules(schema: OpenAPI3, transformer: Transformer, options: {
|
|
112
|
+
ts: boolean;
|
|
113
|
+
statusCodes: StatusCodes;
|
|
114
|
+
base?: string;
|
|
115
|
+
}): ApiModule[];
|
|
116
|
+
declare function renderApiModules(apiModules: ApiModule[], options: {
|
|
117
|
+
output: string;
|
|
118
|
+
typesFilename: string;
|
|
119
|
+
ts: boolean;
|
|
120
|
+
override: boolean | string[];
|
|
121
|
+
preset: Preset;
|
|
122
|
+
}): Promise<unknown[]>;
|
|
123
|
+
declare function generateTypes(schema: OpenAPI3, output: string, typesFilename: string): Promise<void>;
|
|
124
|
+
declare function generate(userOptions?: GenerateOptions): Promise<void>;
|
|
125
|
+
|
|
126
|
+
type Config = GenerateOptions;
|
|
127
|
+
declare function defineConfig(config: Config): GenerateOptions;
|
|
128
|
+
declare function getConfig(): Promise<Config>;
|
|
129
|
+
|
|
130
|
+
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, hasQueryParameter, hasResponseBody, partitionApiModules, readSchema, readTemplateFile, renderApiModules, transformEntity, transformFn, transformType, transformTypeQuery, transformTypeQueryValue, transformTypeRequestBody, transformTypeRequestBodyValue, transformTypeResponseBody, transformTypeResponseBodyValue, transformTypeValue, transformUrl, transformVerb };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { OpenAPI3, OperationObject } from 'openapi-typescript';
|
|
2
|
+
export { default as pluralize } from 'pluralize';
|
|
3
|
+
|
|
4
|
+
declare function transformVerb(method: string): string;
|
|
5
|
+
declare function transformUrl(path: string, base?: string): string;
|
|
6
|
+
declare function transformEntity(path: string, method: string, base?: string): string;
|
|
7
|
+
declare function transformFn(verb: string, entity: string): string;
|
|
8
|
+
declare function transformType(verb: string, entity: string): string;
|
|
9
|
+
declare function transformTypeValue(path: string, method: string): string;
|
|
10
|
+
declare function transformTypeQuery(verb: string, entity: string): string;
|
|
11
|
+
declare function transformTypeQueryValue(type: string): string;
|
|
12
|
+
declare function transformTypeRequestBody(verb: string, entity: string): string;
|
|
13
|
+
declare function transformTypeRequestBodyValue(type: string): string;
|
|
14
|
+
declare function transformTypeResponseBody(verb: string, entity: string): string;
|
|
15
|
+
declare function transformTypeResponseBodyValue(type: string, statusCode: number, mime: string): string;
|
|
16
|
+
interface Transformer {
|
|
17
|
+
verb: typeof transformVerb;
|
|
18
|
+
url: typeof transformUrl;
|
|
19
|
+
entity: typeof transformEntity;
|
|
20
|
+
fn: typeof transformFn;
|
|
21
|
+
type: typeof transformType;
|
|
22
|
+
typeValue: typeof transformTypeValue;
|
|
23
|
+
typeQuery: typeof transformTypeQuery;
|
|
24
|
+
typeQueryValue: typeof transformTypeQueryValue;
|
|
25
|
+
typeRequestBody: typeof transformTypeRequestBody;
|
|
26
|
+
typeRequestBodyValue: typeof transformTypeRequestBodyValue;
|
|
27
|
+
typeResponseBody: typeof transformTypeResponseBody;
|
|
28
|
+
typeResponseBodyValue: typeof transformTypeResponseBodyValue;
|
|
29
|
+
}
|
|
30
|
+
declare function createTransformer(): Transformer;
|
|
31
|
+
|
|
32
|
+
type Preset = 'axle' | 'axios';
|
|
33
|
+
type StatusCodeStrategy = 'strict' | 'loose';
|
|
34
|
+
interface StatusCodes {
|
|
35
|
+
get?: number;
|
|
36
|
+
post?: number;
|
|
37
|
+
put?: number;
|
|
38
|
+
delete?: number;
|
|
39
|
+
patch?: number;
|
|
40
|
+
options?: number;
|
|
41
|
+
head?: number;
|
|
42
|
+
}
|
|
43
|
+
declare function createStatusCodesByStrategy(strategy: StatusCodeStrategy): {
|
|
44
|
+
get: number;
|
|
45
|
+
post: number;
|
|
46
|
+
put: number;
|
|
47
|
+
delete: number;
|
|
48
|
+
patch: number;
|
|
49
|
+
options: number;
|
|
50
|
+
head: number;
|
|
51
|
+
} | {
|
|
52
|
+
get: number;
|
|
53
|
+
post: number;
|
|
54
|
+
put: number;
|
|
55
|
+
delete: number;
|
|
56
|
+
patch: number;
|
|
57
|
+
options: number;
|
|
58
|
+
head: number;
|
|
59
|
+
};
|
|
60
|
+
declare function readSchema(input: string): Promise<OpenAPI3>;
|
|
61
|
+
declare function readTemplateFile(preset?: Preset): string;
|
|
62
|
+
declare function hasQueryParameter(operation: OperationObject): boolean;
|
|
63
|
+
declare function hasResponseBody(operation: OperationObject): boolean;
|
|
64
|
+
declare function getCliVersion(): any;
|
|
65
|
+
|
|
66
|
+
interface ApiModulePayload {
|
|
67
|
+
fn: string;
|
|
68
|
+
path: string;
|
|
69
|
+
url: string;
|
|
70
|
+
method: string;
|
|
71
|
+
verb: string;
|
|
72
|
+
entity: string;
|
|
73
|
+
type: string;
|
|
74
|
+
typeValue: string;
|
|
75
|
+
typeQuery: string;
|
|
76
|
+
typeQueryValue: string;
|
|
77
|
+
typeRequestBody: string;
|
|
78
|
+
typeRequestBodyValue: string;
|
|
79
|
+
typeResponseBody: string;
|
|
80
|
+
typeResponseBodyValue: string;
|
|
81
|
+
}
|
|
82
|
+
interface ApiModule {
|
|
83
|
+
name: string;
|
|
84
|
+
payloads: ApiModulePayload[];
|
|
85
|
+
}
|
|
86
|
+
interface ApiModuleTemplateData {
|
|
87
|
+
apiModule: ApiModule;
|
|
88
|
+
typesFilename: string;
|
|
89
|
+
ts: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface GenerateOptions {
|
|
92
|
+
input?: string;
|
|
93
|
+
output?: string;
|
|
94
|
+
base?: string;
|
|
95
|
+
typesFilename?: string;
|
|
96
|
+
transformer?: Partial<Transformer>;
|
|
97
|
+
ts?: boolean;
|
|
98
|
+
override?: boolean | string[];
|
|
99
|
+
preset?: Preset;
|
|
100
|
+
statusCodeStrategy?: StatusCodeStrategy;
|
|
101
|
+
statusCodes?: {
|
|
102
|
+
get?: number;
|
|
103
|
+
post?: number;
|
|
104
|
+
put?: number;
|
|
105
|
+
delete?: number;
|
|
106
|
+
patch?: number;
|
|
107
|
+
options?: number;
|
|
108
|
+
head?: number;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
declare function partitionApiModules(schema: OpenAPI3, transformer: Transformer, options: {
|
|
112
|
+
ts: boolean;
|
|
113
|
+
statusCodes: StatusCodes;
|
|
114
|
+
base?: string;
|
|
115
|
+
}): ApiModule[];
|
|
116
|
+
declare function renderApiModules(apiModules: ApiModule[], options: {
|
|
117
|
+
output: string;
|
|
118
|
+
typesFilename: string;
|
|
119
|
+
ts: boolean;
|
|
120
|
+
override: boolean | string[];
|
|
121
|
+
preset: Preset;
|
|
122
|
+
}): Promise<unknown[]>;
|
|
123
|
+
declare function generateTypes(schema: OpenAPI3, output: string, typesFilename: string): Promise<void>;
|
|
124
|
+
declare function generate(userOptions?: GenerateOptions): Promise<void>;
|
|
125
|
+
|
|
126
|
+
type Config = GenerateOptions;
|
|
127
|
+
declare function defineConfig(config: Config): GenerateOptions;
|
|
128
|
+
declare function getConfig(): Promise<Config>;
|
|
129
|
+
|
|
130
|
+
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, hasQueryParameter, hasResponseBody, partitionApiModules, readSchema, readTemplateFile, renderApiModules, transformEntity, transformFn, transformType, transformTypeQuery, transformTypeQueryValue, transformTypeRequestBody, transformTypeRequestBodyValue, transformTypeResponseBody, transformTypeResponseBodyValue, transformTypeValue, transformUrl, transformVerb };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createTransformer,
|
|
3
|
+
defineConfig,
|
|
4
|
+
generate,
|
|
5
|
+
generateTypes,
|
|
6
|
+
getConfig,
|
|
7
|
+
partitionApiModules,
|
|
8
|
+
renderApiModules,
|
|
9
|
+
transformEntity,
|
|
10
|
+
transformFn,
|
|
11
|
+
transformType,
|
|
12
|
+
transformTypeQuery,
|
|
13
|
+
transformTypeQueryValue,
|
|
14
|
+
transformTypeRequestBody,
|
|
15
|
+
transformTypeRequestBodyValue,
|
|
16
|
+
transformTypeResponseBody,
|
|
17
|
+
transformTypeResponseBodyValue,
|
|
18
|
+
transformTypeValue,
|
|
19
|
+
transformUrl,
|
|
20
|
+
transformVerb
|
|
21
|
+
} from "./chunk-HMKED3BC.js";
|
|
22
|
+
import {
|
|
23
|
+
createStatusCodesByStrategy,
|
|
24
|
+
getCliVersion,
|
|
25
|
+
hasQueryParameter,
|
|
26
|
+
hasResponseBody,
|
|
27
|
+
readSchema,
|
|
28
|
+
readTemplateFile
|
|
29
|
+
} from "./chunk-6N4OHGAC.js";
|
|
30
|
+
import "./chunk-6OIOYGN7.js";
|
|
31
|
+
|
|
32
|
+
// src/index.ts
|
|
33
|
+
import { default as default2 } from "pluralize";
|
|
34
|
+
export {
|
|
35
|
+
createStatusCodesByStrategy,
|
|
36
|
+
createTransformer,
|
|
37
|
+
defineConfig,
|
|
38
|
+
generate,
|
|
39
|
+
generateTypes,
|
|
40
|
+
getCliVersion,
|
|
41
|
+
getConfig,
|
|
42
|
+
hasQueryParameter,
|
|
43
|
+
hasResponseBody,
|
|
44
|
+
partitionApiModules,
|
|
45
|
+
default2 as pluralize,
|
|
46
|
+
readSchema,
|
|
47
|
+
readTemplateFile,
|
|
48
|
+
renderApiModules,
|
|
49
|
+
transformEntity,
|
|
50
|
+
transformFn,
|
|
51
|
+
transformType,
|
|
52
|
+
transformTypeQuery,
|
|
53
|
+
transformTypeQueryValue,
|
|
54
|
+
transformTypeRequestBody,
|
|
55
|
+
transformTypeRequestBodyValue,
|
|
56
|
+
transformTypeResponseBody,
|
|
57
|
+
transformTypeResponseBodyValue,
|
|
58
|
+
transformTypeValue,
|
|
59
|
+
transformUrl,
|
|
60
|
+
transformVerb
|
|
61
|
+
};
|