zcb 0.3.3 → 0.3.5
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 +1 -1
- package/dist/cjs/cli.cjs +1 -1
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/templates/config.ts.hbs +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/templates/config.ts.hbs +1 -1
- package/dist/production.analysis.txt +24 -24
- package/dist/types/cjs/cli.d.cts +7 -1
- package/dist/types/cjs/cli.d.cts.map +1 -1
- package/dist/types/cjs/createConfigBuilder.d.cts +3 -3
- package/dist/types/cjs/createConfigBuilder.d.cts.map +1 -1
- package/dist/types/cjs/createConfigParser.d.cts.map +1 -1
- package/dist/types/cjs/transformers/runExperiments.d.cts.map +1 -1
- package/dist/types/cjs/utils/arrayHasInvalidDefaults.d.cts +2 -2
- package/dist/types/cjs/utils/arrayHasInvalidDefaults.d.cts.map +1 -1
- package/dist/types/cjs/utils/collateDefaultValues.d.cts +2 -2
- package/dist/types/cjs/utils/collateDefaultValues.d.cts.map +1 -1
- package/dist/types/cjs/utils/collateObjectPropertyDefaults.d.cts +2 -2
- package/dist/types/cjs/utils/collateObjectPropertyDefaults.d.cts.map +1 -1
- package/dist/types/cjs/utils/importValidateTransformWriteConfig.d.cts +2 -2
- package/dist/types/cjs/utils/importValidateTransformWriteConfig.d.cts.map +1 -1
- package/dist/types/cjs/utils/isInvalidPropertyOverride.d.cts.map +1 -1
- package/dist/types/cjs/utils/isPropertyReservedWord.d.cts.map +1 -1
- package/dist/types/cjs/utils/isSchemaValid.d.cts +2 -2
- package/dist/types/cjs/utils/isSchemaValid.d.cts.map +1 -1
- package/dist/types/cjs/utils/isValidPropertyDefinition.d.cts +2 -2
- package/dist/types/cjs/utils/isValidPropertyDefinition.d.cts.map +1 -1
- package/dist/types/cjs/utils/objectPropertyHasDefaults.d.cts +2 -2
- package/dist/types/cjs/utils/objectPropertyHasDefaults.d.cts.map +1 -1
- package/dist/types/cjs/utils/recordHasInvalidDefaults.d.cts +2 -2
- package/dist/types/cjs/utils/recordHasInvalidDefaults.d.cts.map +1 -1
- package/dist/types/cjs/utils/transformConfig.d.cts.map +1 -1
- package/dist/types/cjs/utils/transformWriteConfig.d.cts.map +1 -1
- package/dist/types/esm/cli.d.ts +7 -1
- package/dist/types/esm/cli.d.ts.map +1 -1
- package/dist/types/esm/createConfigBuilder.d.ts +3 -3
- package/dist/types/esm/createConfigBuilder.d.ts.map +1 -1
- package/dist/types/esm/createConfigParser.d.ts.map +1 -1
- package/dist/types/esm/transformers/runExperiments.d.ts.map +1 -1
- package/dist/types/esm/utils/arrayHasInvalidDefaults.d.ts +2 -2
- package/dist/types/esm/utils/arrayHasInvalidDefaults.d.ts.map +1 -1
- package/dist/types/esm/utils/collateDefaultValues.d.ts +2 -2
- package/dist/types/esm/utils/collateDefaultValues.d.ts.map +1 -1
- package/dist/types/esm/utils/collateObjectPropertyDefaults.d.ts +2 -2
- package/dist/types/esm/utils/collateObjectPropertyDefaults.d.ts.map +1 -1
- package/dist/types/esm/utils/importValidateTransformWriteConfig.d.ts +2 -2
- package/dist/types/esm/utils/importValidateTransformWriteConfig.d.ts.map +1 -1
- package/dist/types/esm/utils/isInvalidPropertyOverride.d.ts.map +1 -1
- package/dist/types/esm/utils/isPropertyReservedWord.d.ts.map +1 -1
- package/dist/types/esm/utils/isSchemaValid.d.ts +2 -2
- package/dist/types/esm/utils/isSchemaValid.d.ts.map +1 -1
- package/dist/types/esm/utils/isValidPropertyDefinition.d.ts +2 -2
- package/dist/types/esm/utils/isValidPropertyDefinition.d.ts.map +1 -1
- package/dist/types/esm/utils/objectPropertyHasDefaults.d.ts +2 -2
- package/dist/types/esm/utils/objectPropertyHasDefaults.d.ts.map +1 -1
- package/dist/types/esm/utils/recordHasInvalidDefaults.d.ts +2 -2
- package/dist/types/esm/utils/recordHasInvalidDefaults.d.ts.map +1 -1
- package/dist/types/esm/utils/transformConfig.d.ts.map +1 -1
- package/dist/types/esm/utils/transformWriteConfig.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +48 -43
- package/pnpm-workspace.yaml +4 -0
- package/src/__testUtils__/builtConfig.ts +1 -1
- package/src/__testUtils__/configBuilder.ts +28 -22
- package/src/__testUtils__/schema.ts +2 -2
- package/src/cli.ts +9 -3
- package/src/createConfigBuilder.test.ts +157 -38
- package/src/createConfigBuilder.ts +44 -41
- package/src/createConfigParser.ts +1 -1
- package/src/createConfigReader.ts +2 -2
- package/src/templates/config.ts.hbs +1 -1
- package/src/transformers/cloneNonEnumerableValues.ts +1 -1
- package/src/transformers/runExperiments.ts +16 -5
- package/src/utils/arrayHasInvalidDefaults.ts +3 -3
- package/src/utils/collateDefaultValues.ts +5 -5
- package/src/utils/collateObjectPropertyDefaults.ts +4 -2
- package/src/utils/importValidateTransformWriteConfig.ts +25 -13
- package/src/utils/isInvalidPropertyOverride.ts +1 -1
- package/src/utils/isPropertyReservedWord.ts +1 -1
- package/src/utils/isSchemaValid.ts +2 -2
- package/src/utils/isValidPropertyDefinition.ts +3 -3
- package/src/utils/objectPropertyHasDefaults.ts +3 -3
- package/src/utils/recordHasInvalidDefaults.ts +3 -3
- package/src/utils/transformConfig.test.ts +14 -0
- package/src/utils/transformConfig.ts +16 -4
- package/src/utils/transformWriteConfig.test.ts +111 -0
- package/src/utils/transformWriteConfig.ts +15 -8
- package/dist/types/cjs/utils/jsonStringifyReplacer.d.cts +0 -109
- package/dist/types/cjs/utils/jsonStringifyReplacer.d.cts.map +0 -1
- package/dist/types/esm/utils/jsonStringifyReplacer.d.ts +0 -109
- package/dist/types/esm/utils/jsonStringifyReplacer.d.ts.map +0 -1
- package/src/__snapshots__/createConfigBuilder.test.ts.snap +0 -30
- package/src/utils/jsonStringifyReplacer.ts +0 -6
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import configBuilder from '../__testUtils__/configBuilder.ts';
|
|
3
|
+
|
|
4
|
+
jest.unstable_mockModule('fs-extra/esm', () => ({
|
|
5
|
+
outputFileSync: jest.fn(),
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
jest.unstable_mockModule('shelljs', () => ({
|
|
9
|
+
default: {
|
|
10
|
+
echo: jest.fn(),
|
|
11
|
+
exec: jest.fn(),
|
|
12
|
+
exit: jest.fn(),
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
const { outputFileSync } = jest.mocked(await import('fs-extra/esm'));
|
|
17
|
+
const { transformWriteConfig } = await import('./transformWriteConfig.ts');
|
|
18
|
+
|
|
19
|
+
describe('transformWriteConfig', () => {
|
|
20
|
+
it('should call outputFileSync with the expected file content', async () => {
|
|
21
|
+
await transformWriteConfig(configBuilder.$values(), {
|
|
22
|
+
outputFile: 'config.ts',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
expect(outputFileSync.mock.calls[0]?.[1]).toMatchInlineSnapshot(`
|
|
26
|
+
"/* eslint-disable import-x/no-default-export, unicorn/numeric-separators-style, unicorn/no-null */
|
|
27
|
+
/* This file is autogenerated, do not edit directly, your changes will not perist. */
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
countryCode: "GB",
|
|
31
|
+
countryName: null,
|
|
32
|
+
distanceUnit: "km",
|
|
33
|
+
enabled: true,
|
|
34
|
+
languageCodes: [
|
|
35
|
+
"en"
|
|
36
|
+
],
|
|
37
|
+
locales: [
|
|
38
|
+
"en_GB"
|
|
39
|
+
],
|
|
40
|
+
name: undefined,
|
|
41
|
+
pages: {
|
|
42
|
+
contactDetails: {
|
|
43
|
+
path: undefined,
|
|
44
|
+
queryParams: undefined,
|
|
45
|
+
sections: [
|
|
46
|
+
{
|
|
47
|
+
sections: undefined,
|
|
48
|
+
name: "header"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "body",
|
|
52
|
+
sections: [
|
|
53
|
+
{
|
|
54
|
+
sections: undefined,
|
|
55
|
+
name: "main"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "sidebar"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "footer"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
name: "contactDetails"
|
|
67
|
+
},
|
|
68
|
+
personalDetails: {
|
|
69
|
+
name: "personalDetails",
|
|
70
|
+
sections: [
|
|
71
|
+
{
|
|
72
|
+
name: "header"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "body",
|
|
76
|
+
sections: [
|
|
77
|
+
{
|
|
78
|
+
name: "main"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "sidebar"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "footer"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
routes: [
|
|
92
|
+
{
|
|
93
|
+
aliases: undefined,
|
|
94
|
+
routes: undefined,
|
|
95
|
+
page: "personalDetails",
|
|
96
|
+
path: "personal-details"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
page: "contactDetails",
|
|
100
|
+
path: "contact-details"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
timeouts: {
|
|
104
|
+
apollo: 10000
|
|
105
|
+
},
|
|
106
|
+
timezone: "Europe/London"
|
|
107
|
+
} as const;
|
|
108
|
+
"
|
|
109
|
+
`);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { outputFileSync } from 'fs-extra/esm';
|
|
2
2
|
import Handlebars from 'handlebars';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
|
-
import
|
|
4
|
+
import path from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import shelljs from 'shelljs';
|
|
7
7
|
import { removeDisabledSlices } from '../transformers/removeDisabledSlices.ts';
|
|
@@ -12,23 +12,30 @@ import { transformConfig } from './transformConfig.ts';
|
|
|
12
12
|
export const transformWriteConfig = async <Config extends object>(
|
|
13
13
|
config: Config,
|
|
14
14
|
{ experimentsCallback, outputFile }: WriteConfigOptions,
|
|
15
|
-
) => {
|
|
15
|
+
): Promise<void> => {
|
|
16
16
|
const handlers: TransformConfigHandler[] = [removeDisabledSlices];
|
|
17
17
|
|
|
18
18
|
if (experimentsCallback) {
|
|
19
19
|
handlers.push(setupExperiments(experimentsCallback));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
|
|
22
24
|
const template = Handlebars.compile(
|
|
23
|
-
readFileSync(resolve(dirname
|
|
25
|
+
readFileSync(path.resolve(dirname, '../templates/config.ts.hbs'), { encoding: 'utf8' }),
|
|
24
26
|
);
|
|
25
27
|
|
|
26
|
-
const output = template({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const output = template({
|
|
29
|
+
config: JSON.stringify(
|
|
30
|
+
await transformConfig(config, handlers),
|
|
31
|
+
(_k, v: unknown) => (v === undefined ? 'undefined' : v),
|
|
32
|
+
2,
|
|
33
|
+
),
|
|
34
|
+
})
|
|
35
|
+
.replaceAll(/"([A-Za-z][\dA-Za-z]+)":/g, '$1:')
|
|
36
|
+
.replaceAll('"undefined"', 'undefined');
|
|
30
37
|
|
|
31
38
|
shelljs.echo(`zcd watch => writing to file: ${outputFile}`);
|
|
32
39
|
shelljs.echo(`zcd watch => content to write:\n${output}\n`);
|
|
33
|
-
outputFileSync(resolve(process.cwd(), outputFile), output);
|
|
40
|
+
outputFileSync(path.resolve(process.cwd(), outputFile), output);
|
|
34
41
|
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { type Jsonifiable } from 'type-fest';
|
|
2
|
-
export declare const jsonStringifyReplacer: (_key: string, value: Jsonifiable) => string | number | boolean | {
|
|
3
|
-
[x: string]: Jsonifiable | undefined;
|
|
4
|
-
} | {
|
|
5
|
-
toJSON: () => Jsonifiable;
|
|
6
|
-
} | import("type-fest/source/jsonifiable.js").JsonifiableArray | ({
|
|
7
|
-
anyOf: import("zod-to-json-schema").JsonSchema7DateType[];
|
|
8
|
-
} & {
|
|
9
|
-
title?: string;
|
|
10
|
-
default?: any;
|
|
11
|
-
description?: string;
|
|
12
|
-
markdownDescription?: string;
|
|
13
|
-
} & {
|
|
14
|
-
$schema?: string | undefined;
|
|
15
|
-
definitions?: {
|
|
16
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
17
|
-
} | undefined;
|
|
18
|
-
}) | ({
|
|
19
|
-
type: "object" | "array";
|
|
20
|
-
} & {
|
|
21
|
-
title?: string;
|
|
22
|
-
default?: any;
|
|
23
|
-
description?: string;
|
|
24
|
-
markdownDescription?: string;
|
|
25
|
-
} & {
|
|
26
|
-
$schema?: string | undefined;
|
|
27
|
-
definitions?: {
|
|
28
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
29
|
-
} | undefined;
|
|
30
|
-
}) | ({
|
|
31
|
-
type: ("string" | "number" | "boolean" | "integer" | "null") | ("string" | "number" | "boolean" | "integer" | "null")[];
|
|
32
|
-
} & {
|
|
33
|
-
title?: string;
|
|
34
|
-
default?: any;
|
|
35
|
-
description?: string;
|
|
36
|
-
markdownDescription?: string;
|
|
37
|
-
} & {
|
|
38
|
-
$schema?: string | undefined;
|
|
39
|
-
definitions?: {
|
|
40
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
41
|
-
} | undefined;
|
|
42
|
-
}) | ({
|
|
43
|
-
anyOf: import("zod-to-json-schema").JsonSchema7Type[];
|
|
44
|
-
} & {
|
|
45
|
-
title?: string;
|
|
46
|
-
default?: any;
|
|
47
|
-
description?: string;
|
|
48
|
-
markdownDescription?: string;
|
|
49
|
-
} & {
|
|
50
|
-
$schema?: string | undefined;
|
|
51
|
-
definitions?: {
|
|
52
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
53
|
-
} | undefined;
|
|
54
|
-
}) | (import("zod-to-json-schema").JsonSchema7UndefinedType & {
|
|
55
|
-
title?: string;
|
|
56
|
-
default?: any;
|
|
57
|
-
description?: string;
|
|
58
|
-
markdownDescription?: string;
|
|
59
|
-
} & {
|
|
60
|
-
$schema?: string | undefined;
|
|
61
|
-
definitions?: {
|
|
62
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
63
|
-
} | undefined;
|
|
64
|
-
}) | (import("zod-to-json-schema").JsonSchema7AnyType & {
|
|
65
|
-
title?: string;
|
|
66
|
-
default?: any;
|
|
67
|
-
description?: string;
|
|
68
|
-
markdownDescription?: string;
|
|
69
|
-
} & {
|
|
70
|
-
$schema?: string | undefined;
|
|
71
|
-
definitions?: {
|
|
72
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
73
|
-
} | undefined;
|
|
74
|
-
}) | ({
|
|
75
|
-
anyOf: [import("zod-to-json-schema").JsonSchema7Type, import("zod-to-json-schema").JsonSchema7NullType];
|
|
76
|
-
} & {
|
|
77
|
-
title?: string;
|
|
78
|
-
default?: any;
|
|
79
|
-
description?: string;
|
|
80
|
-
markdownDescription?: string;
|
|
81
|
-
} & {
|
|
82
|
-
$schema?: string | undefined;
|
|
83
|
-
definitions?: {
|
|
84
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
85
|
-
} | undefined;
|
|
86
|
-
}) | ({
|
|
87
|
-
type: [string, "null"];
|
|
88
|
-
} & {
|
|
89
|
-
title?: string;
|
|
90
|
-
default?: any;
|
|
91
|
-
description?: string;
|
|
92
|
-
markdownDescription?: string;
|
|
93
|
-
} & {
|
|
94
|
-
$schema?: string | undefined;
|
|
95
|
-
definitions?: {
|
|
96
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
97
|
-
} | undefined;
|
|
98
|
-
}) | (import("zod-to-json-schema").JsonSchema7AllOfType & {
|
|
99
|
-
title?: string;
|
|
100
|
-
default?: any;
|
|
101
|
-
description?: string;
|
|
102
|
-
markdownDescription?: string;
|
|
103
|
-
} & {
|
|
104
|
-
$schema?: string | undefined;
|
|
105
|
-
definitions?: {
|
|
106
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
107
|
-
} | undefined;
|
|
108
|
-
}) | null;
|
|
109
|
-
//# sourceMappingURL=jsonStringifyReplacer.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonStringifyReplacer.d.cts","sourceRoot":"","sources":["../../../../src/utils/jsonStringifyReplacer.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,OAAO,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SACc,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { type Jsonifiable } from 'type-fest';
|
|
2
|
-
export declare const jsonStringifyReplacer: (_key: string, value: Jsonifiable) => string | number | boolean | {
|
|
3
|
-
[x: string]: Jsonifiable | undefined;
|
|
4
|
-
} | {
|
|
5
|
-
toJSON: () => Jsonifiable;
|
|
6
|
-
} | import("type-fest/source/jsonifiable.js").JsonifiableArray | ({
|
|
7
|
-
anyOf: import("zod-to-json-schema").JsonSchema7DateType[];
|
|
8
|
-
} & {
|
|
9
|
-
title?: string;
|
|
10
|
-
default?: any;
|
|
11
|
-
description?: string;
|
|
12
|
-
markdownDescription?: string;
|
|
13
|
-
} & {
|
|
14
|
-
$schema?: string | undefined;
|
|
15
|
-
definitions?: {
|
|
16
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
17
|
-
} | undefined;
|
|
18
|
-
}) | ({
|
|
19
|
-
type: "object" | "array";
|
|
20
|
-
} & {
|
|
21
|
-
title?: string;
|
|
22
|
-
default?: any;
|
|
23
|
-
description?: string;
|
|
24
|
-
markdownDescription?: string;
|
|
25
|
-
} & {
|
|
26
|
-
$schema?: string | undefined;
|
|
27
|
-
definitions?: {
|
|
28
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
29
|
-
} | undefined;
|
|
30
|
-
}) | ({
|
|
31
|
-
type: ("string" | "number" | "boolean" | "integer" | "null") | ("string" | "number" | "boolean" | "integer" | "null")[];
|
|
32
|
-
} & {
|
|
33
|
-
title?: string;
|
|
34
|
-
default?: any;
|
|
35
|
-
description?: string;
|
|
36
|
-
markdownDescription?: string;
|
|
37
|
-
} & {
|
|
38
|
-
$schema?: string | undefined;
|
|
39
|
-
definitions?: {
|
|
40
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
41
|
-
} | undefined;
|
|
42
|
-
}) | ({
|
|
43
|
-
anyOf: import("zod-to-json-schema").JsonSchema7Type[];
|
|
44
|
-
} & {
|
|
45
|
-
title?: string;
|
|
46
|
-
default?: any;
|
|
47
|
-
description?: string;
|
|
48
|
-
markdownDescription?: string;
|
|
49
|
-
} & {
|
|
50
|
-
$schema?: string | undefined;
|
|
51
|
-
definitions?: {
|
|
52
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
53
|
-
} | undefined;
|
|
54
|
-
}) | (import("zod-to-json-schema").JsonSchema7UndefinedType & {
|
|
55
|
-
title?: string;
|
|
56
|
-
default?: any;
|
|
57
|
-
description?: string;
|
|
58
|
-
markdownDescription?: string;
|
|
59
|
-
} & {
|
|
60
|
-
$schema?: string | undefined;
|
|
61
|
-
definitions?: {
|
|
62
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
63
|
-
} | undefined;
|
|
64
|
-
}) | (import("zod-to-json-schema").JsonSchema7AnyType & {
|
|
65
|
-
title?: string;
|
|
66
|
-
default?: any;
|
|
67
|
-
description?: string;
|
|
68
|
-
markdownDescription?: string;
|
|
69
|
-
} & {
|
|
70
|
-
$schema?: string | undefined;
|
|
71
|
-
definitions?: {
|
|
72
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
73
|
-
} | undefined;
|
|
74
|
-
}) | ({
|
|
75
|
-
anyOf: [import("zod-to-json-schema").JsonSchema7Type, import("zod-to-json-schema").JsonSchema7NullType];
|
|
76
|
-
} & {
|
|
77
|
-
title?: string;
|
|
78
|
-
default?: any;
|
|
79
|
-
description?: string;
|
|
80
|
-
markdownDescription?: string;
|
|
81
|
-
} & {
|
|
82
|
-
$schema?: string | undefined;
|
|
83
|
-
definitions?: {
|
|
84
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
85
|
-
} | undefined;
|
|
86
|
-
}) | ({
|
|
87
|
-
type: [string, "null"];
|
|
88
|
-
} & {
|
|
89
|
-
title?: string;
|
|
90
|
-
default?: any;
|
|
91
|
-
description?: string;
|
|
92
|
-
markdownDescription?: string;
|
|
93
|
-
} & {
|
|
94
|
-
$schema?: string | undefined;
|
|
95
|
-
definitions?: {
|
|
96
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
97
|
-
} | undefined;
|
|
98
|
-
}) | (import("zod-to-json-schema").JsonSchema7AllOfType & {
|
|
99
|
-
title?: string;
|
|
100
|
-
default?: any;
|
|
101
|
-
description?: string;
|
|
102
|
-
markdownDescription?: string;
|
|
103
|
-
} & {
|
|
104
|
-
$schema?: string | undefined;
|
|
105
|
-
definitions?: {
|
|
106
|
-
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
|
107
|
-
} | undefined;
|
|
108
|
-
}) | null;
|
|
109
|
-
//# sourceMappingURL=jsonStringifyReplacer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonStringifyReplacer.d.ts","sourceRoot":"","sources":["../../../../src/utils/jsonStringifyReplacer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,OAAO,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SACc,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`createConfigBuilder when a user stringifies the config when a config value is a zod schema should stringify the value to JSON schema correctly 1`] = `
|
|
4
|
-
"{
|
|
5
|
-
"schema": {
|
|
6
|
-
"anyOf": [
|
|
7
|
-
{
|
|
8
|
-
"not": {}
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"type": "object",
|
|
12
|
-
"properties": {
|
|
13
|
-
"alpha": {
|
|
14
|
-
"type": "string"
|
|
15
|
-
},
|
|
16
|
-
"bravo": {
|
|
17
|
-
"type": "boolean"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"required": [
|
|
21
|
-
"alpha",
|
|
22
|
-
"bravo"
|
|
23
|
-
],
|
|
24
|
-
"additionalProperties": false
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
28
|
-
}
|
|
29
|
-
}"
|
|
30
|
-
`;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Jsonifiable } from 'type-fest';
|
|
2
|
-
import { ZodType } from 'zod';
|
|
3
|
-
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
4
|
-
|
|
5
|
-
export const jsonStringifyReplacer = (_key: string, value: Jsonifiable) =>
|
|
6
|
-
value instanceof ZodType ? zodToJsonSchema(value, { errorMessages: true }) : value;
|