zenko 0.1.10-beta.2 → 0.1.10-beta.3
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.d.cts +71 -1
- package/dist/index.d.ts +71 -1
- package/package.json +3 -5
package/dist/index.d.cts
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
type OpenAPISpec = {
|
|
2
|
+
openapi: string;
|
|
3
|
+
info: unknown;
|
|
4
|
+
paths: Record<string, Record<string, unknown>>;
|
|
5
|
+
webhooks?: Record<string, Record<string, unknown>>;
|
|
6
|
+
components?: {
|
|
7
|
+
schemas?: Record<string, unknown>;
|
|
8
|
+
parameters?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
type TypesHelperMode = "package" | "inline" | "file";
|
|
12
|
+
type TypesConfig = {
|
|
13
|
+
emit?: boolean;
|
|
14
|
+
helpers?: TypesHelperMode;
|
|
15
|
+
helpersOutput?: string;
|
|
16
|
+
treeShake?: boolean;
|
|
17
|
+
optionalType?: "optional" | "nullable" | "nullish";
|
|
18
|
+
};
|
|
19
|
+
type GenerateOptions = {
|
|
20
|
+
strictDates?: boolean;
|
|
21
|
+
strictNumeric?: boolean;
|
|
22
|
+
types?: TypesConfig;
|
|
23
|
+
operationIds?: string[];
|
|
24
|
+
};
|
|
25
|
+
type GenerateResult = {
|
|
26
|
+
output: string;
|
|
27
|
+
helperFile?: {
|
|
28
|
+
path: string;
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Generate TypeScript source with additional metadata about helper files.
|
|
34
|
+
*
|
|
35
|
+
* @param spec - The OpenAPI specification to generate code from.
|
|
36
|
+
* @param options - Generation options (e.g., strictDates, strictNumeric, types) that adjust emitted schemas and helper types.
|
|
37
|
+
* @returns Object containing the generated output and optional helper file information.
|
|
38
|
+
*/
|
|
39
|
+
declare function generateWithMetadata(spec: OpenAPISpec, options?: GenerateOptions): GenerateResult;
|
|
40
|
+
/**
|
|
41
|
+
* Convenience alias for code that prefers a document-centric API.
|
|
42
|
+
*
|
|
43
|
+
* @param spec - The OpenAPI specification to generate code from.
|
|
44
|
+
* @param options - Generation options (e.g., strictDates, strictNumeric, types) that adjust emitted schemas and helper types.
|
|
45
|
+
* @returns Object containing the generated output and optional helper file information.
|
|
46
|
+
*/
|
|
47
|
+
declare function generateFromDocument(spec: OpenAPISpec, options?: GenerateOptions): GenerateResult;
|
|
48
|
+
/**
|
|
49
|
+
* Generates TypeScript client code from an OpenAPI specification.
|
|
50
|
+
*
|
|
51
|
+
* @param spec - The OpenAPI specification object.
|
|
52
|
+
* @param options - Configuration options controlling code generation behavior.
|
|
53
|
+
* @returns Generated TypeScript code as a string.
|
|
54
|
+
*/
|
|
55
|
+
declare function generate(spec: OpenAPISpec, options?: GenerateOptions): string;
|
|
56
|
+
|
|
57
|
+
type PathFn<TArgs extends unknown[] = []> = (...args: TArgs) => string;
|
|
58
|
+
type RequestMethod = "get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace";
|
|
59
|
+
type HeaderFn<TArgs extends unknown[] = [], TResult = Record<string, unknown> | Record<string, never>> = (...args: TArgs) => TResult;
|
|
60
|
+
type AnyHeaderFn = HeaderFn<any, unknown> | (() => unknown);
|
|
61
|
+
type OperationErrors<TError = unknown> = TError extends Record<string, unknown> ? TError : Record<string, TError>;
|
|
62
|
+
type OperationDefinition<TMethod extends RequestMethod, TPath extends (...args: any[]) => string, TRequest = undefined, TResponse = undefined, THeaders extends AnyHeaderFn | undefined = undefined, TErrors extends OperationErrors | undefined = undefined> = {
|
|
63
|
+
method: TMethod;
|
|
64
|
+
path: TPath;
|
|
65
|
+
request?: TRequest;
|
|
66
|
+
response?: TResponse;
|
|
67
|
+
headers?: THeaders;
|
|
68
|
+
errors?: TErrors;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { type GenerateOptions, type GenerateResult, type HeaderFn, type OpenAPISpec, type OperationDefinition, type OperationErrors, type PathFn, type TypesConfig, type TypesHelperMode, generate, generateFromDocument, generateWithMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
type OpenAPISpec = {
|
|
2
|
+
openapi: string;
|
|
3
|
+
info: unknown;
|
|
4
|
+
paths: Record<string, Record<string, unknown>>;
|
|
5
|
+
webhooks?: Record<string, Record<string, unknown>>;
|
|
6
|
+
components?: {
|
|
7
|
+
schemas?: Record<string, unknown>;
|
|
8
|
+
parameters?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
type TypesHelperMode = "package" | "inline" | "file";
|
|
12
|
+
type TypesConfig = {
|
|
13
|
+
emit?: boolean;
|
|
14
|
+
helpers?: TypesHelperMode;
|
|
15
|
+
helpersOutput?: string;
|
|
16
|
+
treeShake?: boolean;
|
|
17
|
+
optionalType?: "optional" | "nullable" | "nullish";
|
|
18
|
+
};
|
|
19
|
+
type GenerateOptions = {
|
|
20
|
+
strictDates?: boolean;
|
|
21
|
+
strictNumeric?: boolean;
|
|
22
|
+
types?: TypesConfig;
|
|
23
|
+
operationIds?: string[];
|
|
24
|
+
};
|
|
25
|
+
type GenerateResult = {
|
|
26
|
+
output: string;
|
|
27
|
+
helperFile?: {
|
|
28
|
+
path: string;
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Generate TypeScript source with additional metadata about helper files.
|
|
34
|
+
*
|
|
35
|
+
* @param spec - The OpenAPI specification to generate code from.
|
|
36
|
+
* @param options - Generation options (e.g., strictDates, strictNumeric, types) that adjust emitted schemas and helper types.
|
|
37
|
+
* @returns Object containing the generated output and optional helper file information.
|
|
38
|
+
*/
|
|
39
|
+
declare function generateWithMetadata(spec: OpenAPISpec, options?: GenerateOptions): GenerateResult;
|
|
40
|
+
/**
|
|
41
|
+
* Convenience alias for code that prefers a document-centric API.
|
|
42
|
+
*
|
|
43
|
+
* @param spec - The OpenAPI specification to generate code from.
|
|
44
|
+
* @param options - Generation options (e.g., strictDates, strictNumeric, types) that adjust emitted schemas and helper types.
|
|
45
|
+
* @returns Object containing the generated output and optional helper file information.
|
|
46
|
+
*/
|
|
47
|
+
declare function generateFromDocument(spec: OpenAPISpec, options?: GenerateOptions): GenerateResult;
|
|
48
|
+
/**
|
|
49
|
+
* Generates TypeScript client code from an OpenAPI specification.
|
|
50
|
+
*
|
|
51
|
+
* @param spec - The OpenAPI specification object.
|
|
52
|
+
* @param options - Configuration options controlling code generation behavior.
|
|
53
|
+
* @returns Generated TypeScript code as a string.
|
|
54
|
+
*/
|
|
55
|
+
declare function generate(spec: OpenAPISpec, options?: GenerateOptions): string;
|
|
56
|
+
|
|
57
|
+
type PathFn<TArgs extends unknown[] = []> = (...args: TArgs) => string;
|
|
58
|
+
type RequestMethod = "get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace";
|
|
59
|
+
type HeaderFn<TArgs extends unknown[] = [], TResult = Record<string, unknown> | Record<string, never>> = (...args: TArgs) => TResult;
|
|
60
|
+
type AnyHeaderFn = HeaderFn<any, unknown> | (() => unknown);
|
|
61
|
+
type OperationErrors<TError = unknown> = TError extends Record<string, unknown> ? TError : Record<string, TError>;
|
|
62
|
+
type OperationDefinition<TMethod extends RequestMethod, TPath extends (...args: any[]) => string, TRequest = undefined, TResponse = undefined, THeaders extends AnyHeaderFn | undefined = undefined, TErrors extends OperationErrors | undefined = undefined> = {
|
|
63
|
+
method: TMethod;
|
|
64
|
+
path: TPath;
|
|
65
|
+
request?: TRequest;
|
|
66
|
+
response?: TResponse;
|
|
67
|
+
headers?: THeaders;
|
|
68
|
+
errors?: TErrors;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { type GenerateOptions, type GenerateResult, type HeaderFn, type OpenAPISpec, type OperationDefinition, type OperationErrors, type PathFn, type TypesConfig, type TypesHelperMode, generate, generateFromDocument, generateWithMetadata };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zenko",
|
|
3
|
-
"version": "0.1.10-beta.
|
|
3
|
+
"version": "0.1.10-beta.3",
|
|
4
4
|
"description": "Generate TypeScript types and path functions from OpenAPI specs",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -64,12 +64,10 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/bun": "1.3.2",
|
|
66
66
|
"tsup": "8.5.0",
|
|
67
|
-
"typescript": "5.9.3"
|
|
67
|
+
"typescript": "5.9.3",
|
|
68
|
+
"@zenko/core": "0.1.0"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"typescript": "^5"
|
|
71
|
-
},
|
|
72
|
-
"dependencies": {
|
|
73
|
-
"@zenko/core": "0.1.0"
|
|
74
72
|
}
|
|
75
73
|
}
|