vovk-cli 0.0.1-draft.214 → 0.0.1-draft.216
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VovkStrictConfig } from 'vovk';
|
|
1
|
+
import { VovkSchemaIdEnum, type VovkStrictConfig } from 'vovk';
|
|
2
2
|
export default function getConfig({ configPath, cwd }: {
|
|
3
3
|
configPath?: string;
|
|
4
4
|
cwd: string;
|
|
@@ -6,7 +6,76 @@ export default function getConfig({ configPath, cwd }: {
|
|
|
6
6
|
config: VovkStrictConfig;
|
|
7
7
|
srcRoot: string | null;
|
|
8
8
|
configAbsolutePaths: string[];
|
|
9
|
-
userConfig:
|
|
9
|
+
userConfig: {
|
|
10
|
+
$schema?: typeof VovkSchemaIdEnum.CONFIG | string;
|
|
11
|
+
emitConfig?: boolean | (keyof VovkStrictConfig | string)[];
|
|
12
|
+
schemaOutDir?: string;
|
|
13
|
+
composedClient?: ({
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
outDir?: string;
|
|
16
|
+
fromTemplates?: string[];
|
|
17
|
+
} & ({
|
|
18
|
+
excludeSegments?: never;
|
|
19
|
+
includeSegments?: string[];
|
|
20
|
+
} | {
|
|
21
|
+
excludeSegments?: string[];
|
|
22
|
+
includeSegments?: never;
|
|
23
|
+
})) & {
|
|
24
|
+
package?: import("type-fest").PackageJson;
|
|
25
|
+
};
|
|
26
|
+
segmentedClient?: ({
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
outDir?: string;
|
|
29
|
+
fromTemplates?: string[];
|
|
30
|
+
} & ({
|
|
31
|
+
excludeSegments?: never;
|
|
32
|
+
includeSegments?: string[];
|
|
33
|
+
} | {
|
|
34
|
+
excludeSegments?: string[];
|
|
35
|
+
includeSegments?: never;
|
|
36
|
+
})) & {
|
|
37
|
+
packages?: Record<string, import("type-fest").PackageJson>;
|
|
38
|
+
};
|
|
39
|
+
bundle?: {
|
|
40
|
+
outDir?: string;
|
|
41
|
+
requires?: Record<string, string>;
|
|
42
|
+
tsClientOutDir?: string;
|
|
43
|
+
dontDeleteTsClientOutDirAfter?: boolean;
|
|
44
|
+
sourcemap?: boolean;
|
|
45
|
+
} & ({
|
|
46
|
+
excludeSegments?: never;
|
|
47
|
+
includeSegments?: string[];
|
|
48
|
+
} | {
|
|
49
|
+
excludeSegments?: string[];
|
|
50
|
+
includeSegments?: never;
|
|
51
|
+
});
|
|
52
|
+
imports?: {
|
|
53
|
+
fetcher?: string | [string, string] | [string];
|
|
54
|
+
validateOnClient?: string | [string, string] | [string];
|
|
55
|
+
createRPC?: string | [string, string] | [string];
|
|
56
|
+
};
|
|
57
|
+
modulesDir?: string;
|
|
58
|
+
rootEntry?: string;
|
|
59
|
+
origin?: string;
|
|
60
|
+
rootSegmentModulesDirName?: string;
|
|
61
|
+
logLevel?: "error" | "trace" | "debug" | "info" | "warn";
|
|
62
|
+
prettifyClient?: boolean;
|
|
63
|
+
devHttps?: boolean;
|
|
64
|
+
clientTemplateDefs?: Record<string, import("vovk/mjs/types").ClientTemplateDef>;
|
|
65
|
+
moduleTemplates?: {
|
|
66
|
+
service?: string;
|
|
67
|
+
controller?: string;
|
|
68
|
+
[key: string]: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
libs?: Record<string, import("vovk").KnownAny>;
|
|
71
|
+
segmentConfig?: false | {
|
|
72
|
+
[x: string]: {
|
|
73
|
+
origin?: string;
|
|
74
|
+
rootEntry?: string;
|
|
75
|
+
segmentNameOverride?: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
} | null;
|
|
10
79
|
log: {
|
|
11
80
|
info: (msg: string) => void;
|
|
12
81
|
warn: (msg: string) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { JSONSchema7 } from 'json-schema';
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
2
|
export declare function convertJSONSchemaToTypeScriptDef(schema: JSONSchema7): string | null;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
export function convertJSONSchemaToTypeScriptDef(schema) {
|
|
2
2
|
if (!schema)
|
|
3
3
|
return null;
|
|
4
|
+
// Helper function to resolve $ref references
|
|
5
|
+
const resolveRef = (ref) => {
|
|
6
|
+
if (!ref.startsWith('#/'))
|
|
7
|
+
return null;
|
|
8
|
+
const path = ref.substring(2).split('/');
|
|
9
|
+
let currentSchema = schema;
|
|
10
|
+
for (const segment of path) {
|
|
11
|
+
if (!currentSchema || typeof currentSchema !== 'object') {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
currentSchema = currentSchema[segment];
|
|
15
|
+
}
|
|
16
|
+
return currentSchema || null;
|
|
17
|
+
};
|
|
4
18
|
// Helper function to get JSDoc from schema
|
|
5
19
|
const getJSDoc = (schema, indentation = '') => {
|
|
6
20
|
if (typeof schema === 'boolean') {
|
|
@@ -17,6 +31,18 @@ export function convertJSONSchemaToTypeScriptDef(schema) {
|
|
|
17
31
|
if (typeof schema === 'boolean') {
|
|
18
32
|
return schema ? 'KnownAny' : 'never';
|
|
19
33
|
}
|
|
34
|
+
// Handle $ref references - check this first before other properties
|
|
35
|
+
if (schema.$ref) {
|
|
36
|
+
const resolvedSchema = resolveRef(schema.$ref);
|
|
37
|
+
if (resolvedSchema) {
|
|
38
|
+
return schemaToType(resolvedSchema, indentation);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// If we can't resolve the reference, use the reference name as type
|
|
42
|
+
const refName = schema.$ref.split('/').pop();
|
|
43
|
+
return refName || 'KnownAny';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
20
46
|
if (schema.enum) {
|
|
21
47
|
return schema.enum
|
|
22
48
|
.map((value) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vovk-cli",
|
|
3
|
-
"version": "0.0.1-draft.
|
|
3
|
+
"version": "0.0.1-draft.216",
|
|
4
4
|
"bin": {
|
|
5
5
|
"vovk": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://vovk.dev",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"vovk": "^3.0.0-draft.
|
|
38
|
+
"vovk": "^3.0.0-draft.204"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"vovk-python-client": "^0.0.1-draft.
|
|
41
|
+
"vovk-python-client": "^0.0.1-draft.39"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@iarna/toml": "^2.2.5",
|