zcb 0.3.4 → 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 +25 -25
- 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 +45 -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 +27 -23
- package/src/createConfigBuilder.ts +40 -42
- 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.ts +16 -4
- package/src/utils/transformWriteConfig.test.ts +1 -1
- package/src/utils/transformWriteConfig.ts +6 -4
- 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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type JSONSchema } from 'zod/v4/core';
|
|
2
2
|
import { arrayHasInvalidDefaults } from './arrayHasInvalidDefaults.ts';
|
|
3
3
|
import { collateObjectPropertyDefaults } from './collateObjectPropertyDefaults.ts';
|
|
4
4
|
import { RESERVED_KEYWORDS, isPropertyReservedWord } from './isPropertyReservedWord.ts';
|
|
5
5
|
import { isValidPropertyDefinition } from './isValidPropertyDefinition.ts';
|
|
6
6
|
import { recordHasInvalidDefaults } from './recordHasInvalidDefaults.ts';
|
|
7
7
|
|
|
8
|
-
export const collateDefaultValues = <Config>(jsonSchema:
|
|
8
|
+
export const collateDefaultValues = <Config>(jsonSchema: JSONSchema.JSONSchema): Partial<Config> => {
|
|
9
9
|
const defaultValues: Partial<Config> = {};
|
|
10
10
|
|
|
11
11
|
for (const propertyName in jsonSchema.properties) {
|
|
@@ -17,14 +17,14 @@ export const collateDefaultValues = <Config>(jsonSchema: JSONSchema7) => {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// TypeScript not inferring property is key of Config.
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
22
22
|
const castPropertyName = propertyName as keyof Config;
|
|
23
23
|
const propertyDefinition = jsonSchema.properties[propertyName];
|
|
24
24
|
|
|
25
25
|
if (isValidPropertyDefinition(propertyDefinition)) {
|
|
26
26
|
if (propertyDefinition.default) {
|
|
27
|
-
//
|
|
27
|
+
// TypeScript not inferring propertyDefinition.default is Config value.
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
29
29
|
defaultValues[castPropertyName] = propertyDefinition.default as Config[keyof Config];
|
|
30
30
|
}
|
|
@@ -49,7 +49,7 @@ export const collateDefaultValues = <Config>(jsonSchema: JSONSchema7) => {
|
|
|
49
49
|
const propertyDefaults = collateObjectPropertyDefaults(propertyDefinition);
|
|
50
50
|
|
|
51
51
|
if (propertyDefaults) {
|
|
52
|
-
//
|
|
52
|
+
// TypeScript not inferring propertyDefaults is Config value.
|
|
53
53
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
54
54
|
defaultValues[castPropertyName] = propertyDefaults as Config[keyof Config];
|
|
55
55
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { type JSONSchema7 } from 'json-schema';
|
|
2
1
|
import { isBoolean, isUndefined } from 'lodash-es';
|
|
3
2
|
import { type Jsonifiable } from 'type-fest';
|
|
3
|
+
import { type JSONSchema } from 'zod/v4/core';
|
|
4
4
|
import { objectPropertyHasDefaults } from './objectPropertyHasDefaults.ts';
|
|
5
5
|
|
|
6
|
-
export const collateObjectPropertyDefaults = (
|
|
6
|
+
export const collateObjectPropertyDefaults = (
|
|
7
|
+
propertyDefinition: JSONSchema.JSONSchema,
|
|
8
|
+
): Record<string, Jsonifiable> | undefined => {
|
|
7
9
|
const { properties } = propertyDefinition;
|
|
8
10
|
|
|
9
11
|
if (!properties || !objectPropertyHasDefaults(propertyDefinition)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import shelljs from 'shelljs';
|
|
3
|
-
import { type
|
|
3
|
+
import { type CliCommands } from '../cli.ts';
|
|
4
4
|
import { type ConfigBuilder } from '../createConfigBuilder.ts';
|
|
5
5
|
import { type SetupExperimentsCallback } from '../types.ts';
|
|
6
6
|
import { transformWriteConfig } from './transformWriteConfig.ts';
|
|
@@ -8,10 +8,12 @@ import { transformWriteConfig } from './transformWriteConfig.ts';
|
|
|
8
8
|
export const importValidateTransformWriteConfig = (
|
|
9
9
|
inputFile: string,
|
|
10
10
|
outputFile: string,
|
|
11
|
-
command:
|
|
11
|
+
command: CliCommands,
|
|
12
12
|
experimentCallbackFile?: string,
|
|
13
|
-
) => {
|
|
13
|
+
): void => {
|
|
14
14
|
import(resolve(process.cwd(), inputFile))
|
|
15
|
+
// TODO: Will revisit
|
|
16
|
+
// eslint-disable-next-line unicorn/prefer-await
|
|
15
17
|
.then(({ default: configBuilder }: { default: ConfigBuilder<object> }) => {
|
|
16
18
|
if (!configBuilder.$validate()) {
|
|
17
19
|
shelljs.echo(`zcd ${command} => invalid config`);
|
|
@@ -25,16 +27,22 @@ export const importValidateTransformWriteConfig = (
|
|
|
25
27
|
|
|
26
28
|
if (experimentCallbackFile) {
|
|
27
29
|
import(resolve(process.cwd(), experimentCallbackFile))
|
|
30
|
+
// TODO: Will revisit
|
|
31
|
+
// eslint-disable-next-line unicorn/prefer-await
|
|
28
32
|
.then(({ default: experimentsCallback }: { default: SetupExperimentsCallback }) => {
|
|
29
33
|
void transformWriteConfig(configBuilder.$values(), { experimentsCallback, outputFile });
|
|
30
34
|
})
|
|
35
|
+
// TODO: Will revisit
|
|
36
|
+
// eslint-disable-next-line unicorn/prefer-await
|
|
31
37
|
.catch((error: unknown) => {
|
|
32
|
-
if (error instanceof Error) {
|
|
33
|
-
|
|
38
|
+
if (!(error instanceof Error)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
shelljs.echo(`zcd ${command} => error message: ${error.message}`);
|
|
34
43
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
44
|
+
if (error.stack) {
|
|
45
|
+
shelljs.echo(`zcd ${command} => error stack:\n${error.stack}\n`);
|
|
38
46
|
}
|
|
39
47
|
});
|
|
40
48
|
|
|
@@ -43,13 +51,17 @@ export const importValidateTransformWriteConfig = (
|
|
|
43
51
|
|
|
44
52
|
void transformWriteConfig(configBuilder.$values(), { outputFile });
|
|
45
53
|
})
|
|
54
|
+
// TODO: Will revisit
|
|
55
|
+
// eslint-disable-next-line unicorn/prefer-await
|
|
46
56
|
.catch((error: unknown) => {
|
|
47
|
-
if (error instanceof Error) {
|
|
48
|
-
|
|
57
|
+
if (!(error instanceof Error)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
shelljs.echo(`zcd ${command} => error message: ${error.message}`);
|
|
49
62
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
63
|
+
if (error.stack) {
|
|
64
|
+
shelljs.echo(`zcd ${command} => error stack:\n${error.stack}\n`);
|
|
53
65
|
}
|
|
54
66
|
});
|
|
55
67
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
-
export const isInvalidPropertyOverride = (propertyValue: any, override = false) =>
|
|
2
|
+
export const isInvalidPropertyOverride = (propertyValue: any, override = false): boolean =>
|
|
3
3
|
!override && propertyValue !== undefined;
|
|
@@ -10,4 +10,4 @@ export const RESERVED_KEYWORDS = new Set([
|
|
|
10
10
|
'$values',
|
|
11
11
|
]);
|
|
12
12
|
|
|
13
|
-
export const isPropertyReservedWord = (propertyName: string) => RESERVED_KEYWORDS.has(propertyName);
|
|
13
|
+
export const isPropertyReservedWord = (propertyName: string): boolean => RESERVED_KEYWORDS.has(propertyName);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type JSONSchema } from 'zod/v4/core';
|
|
2
2
|
|
|
3
|
-
export const isSchemaValid = (schema:
|
|
3
|
+
export const isSchemaValid = (schema: JSONSchema.JSONSchema): boolean => schema.type !== 'object';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type JSONSchema } from 'zod/v4/core';
|
|
2
2
|
|
|
3
3
|
export const isValidPropertyDefinition = (
|
|
4
|
-
propertyDefinition
|
|
5
|
-
): propertyDefinition is
|
|
4
|
+
propertyDefinition?: JSONSchema._JSONSchema,
|
|
5
|
+
): propertyDefinition is JSONSchema.JSONSchema => !!propertyDefinition && typeof propertyDefinition === 'object';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type JSONSchema } from 'zod/v4/core';
|
|
2
2
|
|
|
3
|
-
export const objectPropertyHasDefaults = (propertyDefinition:
|
|
4
|
-
propertyDefinition.properties &&
|
|
3
|
+
export const objectPropertyHasDefaults = (propertyDefinition: JSONSchema.JSONSchema): boolean =>
|
|
4
|
+
!!propertyDefinition.properties &&
|
|
5
5
|
Object.values(propertyDefinition.properties).some(value => typeof value === 'object' && 'default' in value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type JSONSchema } from 'zod/v4/core';
|
|
2
2
|
|
|
3
|
-
export const recordHasInvalidDefaults = (propertyDefinition:
|
|
4
|
-
propertyDefinition.additionalProperties &&
|
|
3
|
+
export const recordHasInvalidDefaults = (propertyDefinition: JSONSchema.JSONSchema): boolean =>
|
|
4
|
+
!!propertyDefinition.additionalProperties &&
|
|
5
5
|
typeof propertyDefinition.additionalProperties === 'object' &&
|
|
6
6
|
'default' in propertyDefinition.additionalProperties;
|
|
@@ -46,15 +46,21 @@ export const transformConfig = async <Config extends AnyRecord>(
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
for (const key in config) {
|
|
49
|
+
// TODO: Need to look at this
|
|
50
|
+
// eslint-disable-next-line unicorn/no-unsafe-property-key
|
|
49
51
|
const value = config[key];
|
|
50
52
|
|
|
51
53
|
if (isPlainObject(value)) {
|
|
54
|
+
// TODO: Need to look at this
|
|
55
|
+
// eslint-disable-next-line unicorn/no-unsafe-property-key
|
|
52
56
|
transform[key] = await transformConfig(value, handler);
|
|
53
57
|
} else if (Array.isArray(value)) {
|
|
54
|
-
//
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
58
|
+
// TODO: Need to look at this
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, unicorn/no-unsafe-property-key
|
|
56
60
|
transform[key] = (await transformArray(value, handler)) as Config[Extract<keyof Config, string>];
|
|
57
61
|
} else {
|
|
62
|
+
// TODO: Need to look at this
|
|
63
|
+
// eslint-disable-next-line unicorn/no-unsafe-property-key
|
|
58
64
|
transform[key] = value;
|
|
59
65
|
}
|
|
60
66
|
}
|
|
@@ -107,15 +113,21 @@ export const transformConfigSync = <Config extends AnyRecord>(
|
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
for (const key in config) {
|
|
116
|
+
// TODO: Need to look at this
|
|
117
|
+
// eslint-disable-next-line unicorn/no-unsafe-property-key
|
|
110
118
|
const value = config[key];
|
|
111
119
|
|
|
112
120
|
if (isPlainObject(value)) {
|
|
121
|
+
// TODO: Need to look at this
|
|
122
|
+
// eslint-disable-next-line unicorn/no-unsafe-property-key
|
|
113
123
|
transform[key] = transformConfigSync(value, handler);
|
|
114
124
|
} else if (Array.isArray(value)) {
|
|
115
|
-
//
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
125
|
+
// TODO: Need to look at this
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, unicorn/no-unsafe-property-key
|
|
117
127
|
transform[key] = transformArraySync(value, handler) as Config[Extract<keyof Config, string>];
|
|
118
128
|
} else {
|
|
129
|
+
// TODO: Need to look at this
|
|
130
|
+
// eslint-disable-next-line unicorn/no-unsafe-property-key
|
|
119
131
|
transform[key] = value;
|
|
120
132
|
}
|
|
121
133
|
}
|
|
@@ -23,7 +23,7 @@ describe('transformWriteConfig', () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
expect(outputFileSync.mock.calls[0]?.[1]).toMatchInlineSnapshot(`
|
|
26
|
-
"/* eslint-disable
|
|
26
|
+
"/* eslint-disable import-x/no-default-export, unicorn/numeric-separators-style, unicorn/no-null */
|
|
27
27
|
/* This file is autogenerated, do not edit directly, your changes will not perist. */
|
|
28
28
|
|
|
29
29
|
export default {
|
|
@@ -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,15 +12,17 @@ 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
28
|
const output = template({
|
|
@@ -35,5 +37,5 @@ export const transformWriteConfig = async <Config extends object>(
|
|
|
35
37
|
|
|
36
38
|
shelljs.echo(`zcd watch => writing to file: ${outputFile}`);
|
|
37
39
|
shelljs.echo(`zcd watch => content to write:\n${output}\n`);
|
|
38
|
-
outputFileSync(resolve(process.cwd(), outputFile), output);
|
|
40
|
+
outputFileSync(path.resolve(process.cwd(), outputFile), output);
|
|
39
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;
|