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