@kizunajs/kotlin 2.0.0-beta.2 → 2.0.0-beta.21
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/README.md +18 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{generator-BvNpSarY.mjs → generator-DHi8XSWb.mjs} +306 -78
- package/dist/{generator-s2pn7vqP.cjs → generator-Dft2DL-3.cjs} +310 -76
- package/dist/index.cjs +39 -8
- package/dist/index.d.cts +22 -34
- package/dist/index.d.mts +22 -34
- package/dist/index.mjs +38 -9
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-Dft2DL-3.cjs");
|
|
3
|
+
let kizunajs_generator = require("kizunajs/generator");
|
|
4
|
+
let zod = require("zod");
|
|
3
5
|
//#region src/client-target.ts
|
|
6
|
+
const KotlinClientOptionsSchema = zod.z.object({
|
|
7
|
+
/**
|
|
8
|
+
* Name of the generated namespace object.
|
|
9
|
+
*
|
|
10
|
+
* @default 'API'
|
|
11
|
+
*/
|
|
12
|
+
namespace: zod.z.string().default("API"),
|
|
13
|
+
/**
|
|
14
|
+
* Package declaration for the generated file, e.g. `com.example.api`.
|
|
15
|
+
*/
|
|
16
|
+
package: zod.z.string().optional(),
|
|
17
|
+
/**
|
|
18
|
+
* Convert wire field names to camelCase properties, mapping the wire name
|
|
19
|
+
* back via `@SerialName`.
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
camelCaseProperties: zod.z.boolean().optional(),
|
|
24
|
+
/**
|
|
25
|
+
* Give every enum an `unknown` case, so a value the client has not been
|
|
26
|
+
* generated for decodes instead of throwing.
|
|
27
|
+
*
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
unknownEnumCase: zod.z.boolean().optional()
|
|
31
|
+
});
|
|
4
32
|
/**
|
|
5
|
-
* A Kotlin client
|
|
33
|
+
* A Kotlin client for `kizuna.config.ts`.
|
|
6
34
|
*
|
|
7
35
|
* @example
|
|
8
|
-
* kotlinClient({
|
|
36
|
+
* kotlinClient({
|
|
37
|
+
* output: './api/APIClient.kt',
|
|
38
|
+
* package: 'com.example.api',
|
|
39
|
+
* });
|
|
9
40
|
*/
|
|
10
|
-
const kotlinClient = (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
generate: (
|
|
14
|
-
namespaceName: options.namespace
|
|
41
|
+
const kotlinClient = (0, kizunajs_generator.defineClient)({
|
|
42
|
+
target: "kotlin",
|
|
43
|
+
options: KotlinClientOptionsSchema,
|
|
44
|
+
generate: ({ options, api }) => require_generator.kotlinClientWalk(api, {
|
|
45
|
+
namespaceName: options.namespace,
|
|
15
46
|
packageName: options.package,
|
|
16
47
|
camelCaseProperties: options.camelCaseProperties,
|
|
17
48
|
unknownEnumCase: options.unknownEnumCase
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GeneratedFileOptions } from "kizunajs/generator";
|
|
2
|
+
import * as _$kizunajs from "kizunajs";
|
|
3
|
+
import { ApiDefinition } from "kizunajs";
|
|
4
|
+
import { z } from "zod";
|
|
2
5
|
|
|
3
6
|
//#region src/generator.d.ts
|
|
4
7
|
interface KotlinConfig {
|
|
@@ -38,45 +41,30 @@ interface KotlinConfig {
|
|
|
38
41
|
declare const generateKotlinClient: (api: ApiDefinition, config: KotlinConfig) => string;
|
|
39
42
|
//#endregion
|
|
40
43
|
//#region src/client-target.d.ts
|
|
44
|
+
declare const KotlinClientOptionsSchema: z.ZodObject<{
|
|
45
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
46
|
+
package: z.ZodOptional<z.ZodString>;
|
|
47
|
+
camelCaseProperties: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
unknownEnumCase: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
}, z.core.$strip>;
|
|
41
50
|
/**
|
|
42
51
|
* Where a generated Kotlin client is written, and what it is called there.
|
|
43
52
|
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Path the generated file is written to.
|
|
47
|
-
*/
|
|
48
|
-
output: string;
|
|
49
|
-
/**
|
|
50
|
-
* Name of the generated namespace object.
|
|
51
|
-
*
|
|
52
|
-
* @default 'API'
|
|
53
|
-
*/
|
|
54
|
-
namespace?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Package declaration for the generated file, e.g. `com.example.api`.
|
|
57
|
-
*/
|
|
58
|
-
package?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Convert wire field names to camelCase properties, mapping the wire name
|
|
61
|
-
* back via `@SerialName`.
|
|
62
|
-
*
|
|
63
|
-
* @default false
|
|
64
|
-
*/
|
|
65
|
-
camelCaseProperties?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Give every enum an `unknown` case, so a value the client has not been
|
|
68
|
-
* generated for decodes instead of throwing.
|
|
69
|
-
*
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
unknownEnumCase?: boolean;
|
|
73
|
-
}
|
|
53
|
+
type KotlinClientOptions = z.input<typeof KotlinClientOptionsSchema> & GeneratedFileOptions;
|
|
74
54
|
/**
|
|
75
|
-
* A Kotlin client
|
|
55
|
+
* A Kotlin client for `kizuna.config.ts`.
|
|
76
56
|
*
|
|
77
57
|
* @example
|
|
78
|
-
* kotlinClient({
|
|
58
|
+
* kotlinClient({
|
|
59
|
+
* output: './api/APIClient.kt',
|
|
60
|
+
* package: 'com.example.api',
|
|
61
|
+
* });
|
|
79
62
|
*/
|
|
80
|
-
declare const kotlinClient: (options:
|
|
63
|
+
declare const kotlinClient: (options: {
|
|
64
|
+
namespace?: string | undefined;
|
|
65
|
+
package?: string | undefined;
|
|
66
|
+
camelCaseProperties?: boolean | undefined;
|
|
67
|
+
unknownEnumCase?: boolean | undefined;
|
|
68
|
+
} & GeneratedFileOptions) => _$kizunajs.GeneratedFile;
|
|
81
69
|
//#endregion
|
|
82
70
|
export { type KotlinClientOptions, type KotlinConfig, generateKotlinClient, kotlinClient };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GeneratedFileOptions } from "kizunajs/generator";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as _$kizunajs from "kizunajs";
|
|
4
|
+
import { ApiDefinition } from "kizunajs";
|
|
2
5
|
|
|
3
6
|
//#region src/generator.d.ts
|
|
4
7
|
interface KotlinConfig {
|
|
@@ -38,45 +41,30 @@ interface KotlinConfig {
|
|
|
38
41
|
declare const generateKotlinClient: (api: ApiDefinition, config: KotlinConfig) => string;
|
|
39
42
|
//#endregion
|
|
40
43
|
//#region src/client-target.d.ts
|
|
44
|
+
declare const KotlinClientOptionsSchema: z.ZodObject<{
|
|
45
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
46
|
+
package: z.ZodOptional<z.ZodString>;
|
|
47
|
+
camelCaseProperties: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
unknownEnumCase: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
}, z.core.$strip>;
|
|
41
50
|
/**
|
|
42
51
|
* Where a generated Kotlin client is written, and what it is called there.
|
|
43
52
|
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Path the generated file is written to.
|
|
47
|
-
*/
|
|
48
|
-
output: string;
|
|
49
|
-
/**
|
|
50
|
-
* Name of the generated namespace object.
|
|
51
|
-
*
|
|
52
|
-
* @default 'API'
|
|
53
|
-
*/
|
|
54
|
-
namespace?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Package declaration for the generated file, e.g. `com.example.api`.
|
|
57
|
-
*/
|
|
58
|
-
package?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Convert wire field names to camelCase properties, mapping the wire name
|
|
61
|
-
* back via `@SerialName`.
|
|
62
|
-
*
|
|
63
|
-
* @default false
|
|
64
|
-
*/
|
|
65
|
-
camelCaseProperties?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Give every enum an `unknown` case, so a value the client has not been
|
|
68
|
-
* generated for decodes instead of throwing.
|
|
69
|
-
*
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
unknownEnumCase?: boolean;
|
|
73
|
-
}
|
|
53
|
+
type KotlinClientOptions = z.input<typeof KotlinClientOptionsSchema> & GeneratedFileOptions;
|
|
74
54
|
/**
|
|
75
|
-
* A Kotlin client
|
|
55
|
+
* A Kotlin client for `kizuna.config.ts`.
|
|
76
56
|
*
|
|
77
57
|
* @example
|
|
78
|
-
* kotlinClient({
|
|
58
|
+
* kotlinClient({
|
|
59
|
+
* output: './api/APIClient.kt',
|
|
60
|
+
* package: 'com.example.api',
|
|
61
|
+
* });
|
|
79
62
|
*/
|
|
80
|
-
declare const kotlinClient: (options:
|
|
63
|
+
declare const kotlinClient: (options: {
|
|
64
|
+
namespace?: string | undefined;
|
|
65
|
+
package?: string | undefined;
|
|
66
|
+
camelCaseProperties?: boolean | undefined;
|
|
67
|
+
unknownEnumCase?: boolean | undefined;
|
|
68
|
+
} & GeneratedFileOptions) => _$kizunajs.GeneratedFile;
|
|
81
69
|
//#endregion
|
|
82
70
|
export { type KotlinClientOptions, type KotlinConfig, generateKotlinClient, kotlinClient };
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,45 @@
|
|
|
1
|
-
import { t as generateKotlinClient } from "./generator-
|
|
2
|
-
|
|
1
|
+
import { n as kotlinClientWalk, t as generateKotlinClient } from "./generator-DHi8XSWb.mjs";
|
|
2
|
+
import { defineClient } from "kizunajs/generator";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
/**
|
|
4
|
-
* A Kotlin client
|
|
5
|
+
* A Kotlin client for `kizuna.config.ts`.
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
7
|
-
* kotlinClient({
|
|
8
|
+
* kotlinClient({
|
|
9
|
+
* output: './api/APIClient.kt',
|
|
10
|
+
* package: 'com.example.api',
|
|
11
|
+
* });
|
|
8
12
|
*/
|
|
9
|
-
const kotlinClient = (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
const kotlinClient = defineClient({
|
|
14
|
+
target: "kotlin",
|
|
15
|
+
options: z.object({
|
|
16
|
+
/**
|
|
17
|
+
* Name of the generated namespace object.
|
|
18
|
+
*
|
|
19
|
+
* @default 'API'
|
|
20
|
+
*/
|
|
21
|
+
namespace: z.string().default("API"),
|
|
22
|
+
/**
|
|
23
|
+
* Package declaration for the generated file, e.g. `com.example.api`.
|
|
24
|
+
*/
|
|
25
|
+
package: z.string().optional(),
|
|
26
|
+
/**
|
|
27
|
+
* Convert wire field names to camelCase properties, mapping the wire name
|
|
28
|
+
* back via `@SerialName`.
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
camelCaseProperties: z.boolean().optional(),
|
|
33
|
+
/**
|
|
34
|
+
* Give every enum an `unknown` case, so a value the client has not been
|
|
35
|
+
* generated for decodes instead of throwing.
|
|
36
|
+
*
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
unknownEnumCase: z.boolean().optional()
|
|
40
|
+
}),
|
|
41
|
+
generate: ({ options, api }) => kotlinClientWalk(api, {
|
|
42
|
+
namespaceName: options.namespace,
|
|
14
43
|
packageName: options.package,
|
|
15
44
|
camelCaseProperties: options.camelCaseProperties,
|
|
16
45
|
unknownEnumCase: options.unknownEnumCase
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kizunajs/kotlin",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.21",
|
|
4
4
|
"description": "Kotlin client generation for Kizuna.js APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kizunajs",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@kizunajs/cli": "2.0.0-beta.
|
|
63
|
+
"@kizunajs/cli": "2.0.0-beta.21"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
66
|
+
"kizunajs": "2.0.0-beta.21",
|
|
67
|
+
"zod": "^4.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
+
"kizunajs": "2.0.0-beta.21",
|
|
70
71
|
"@types/node": "^22.9.0",
|
|
71
72
|
"tsdown": "^0.21.0",
|
|
72
73
|
"typescript": "^6.0.3",
|
|
73
|
-
"zod": "^4.0.0"
|
|
74
|
-
"kizunajs": "2.0.0-beta.2"
|
|
74
|
+
"zod": "^4.0.0"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "tsdown src/index.ts src/cli.ts --format esm,cjs --dts --clean --external kizunajs --external @kizunajs/cli --external zod",
|