@ontrails/config 1.0.0-beta.15 → 1.0.0-beta.16
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/CHANGELOG.md +34 -0
- package/README.md +1 -1
- package/package.json +10 -2
- package/src/define-config.ts +6 -3
- package/src/extensions.ts +1 -1
- package/src/index.ts +0 -1
- package/src/registry.ts +1 -1
- package/src/resolve.ts +4 -2
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-lint.log +0 -3
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/app-config.d.ts +0 -65
- package/dist/app-config.d.ts.map +0 -1
- package/dist/app-config.js +0 -177
- package/dist/app-config.js.map +0 -1
- package/dist/collect.d.ts +0 -11
- package/dist/collect.d.ts.map +0 -1
- package/dist/collect.js +0 -81
- package/dist/collect.js.map +0 -1
- package/dist/compose.d.ts +0 -26
- package/dist/compose.d.ts.map +0 -1
- package/dist/compose.js +0 -19
- package/dist/compose.js.map +0 -1
- package/dist/config-layer.d.ts +0 -11
- package/dist/config-layer.d.ts.map +0 -1
- package/dist/config-layer.js +0 -6
- package/dist/config-layer.js.map +0 -1
- package/dist/config-resource.d.ts +0 -3
- package/dist/config-resource.d.ts.map +0 -1
- package/dist/config-resource.js +0 -26
- package/dist/config-resource.js.map +0 -1
- package/dist/define-config.d.ts +0 -61
- package/dist/define-config.d.ts.map +0 -1
- package/dist/define-config.js +0 -87
- package/dist/define-config.js.map +0 -1
- package/dist/derive/env.d.ts +0 -15
- package/dist/derive/env.d.ts.map +0 -1
- package/dist/derive/env.js +0 -65
- package/dist/derive/env.js.map +0 -1
- package/dist/derive/example.d.ts +0 -16
- package/dist/derive/example.d.ts.map +0 -1
- package/dist/derive/example.js +0 -138
- package/dist/derive/example.js.map +0 -1
- package/dist/derive/helpers.d.ts +0 -35
- package/dist/derive/helpers.d.ts.map +0 -1
- package/dist/derive/helpers.js +0 -116
- package/dist/derive/helpers.js.map +0 -1
- package/dist/derive/index.d.ts +0 -4
- package/dist/derive/index.d.ts.map +0 -1
- package/dist/derive/index.js +0 -4
- package/dist/derive/index.js.map +0 -1
- package/dist/derive/json-schema.d.ts +0 -18
- package/dist/derive/json-schema.d.ts.map +0 -1
- package/dist/derive/json-schema.js +0 -97
- package/dist/derive/json-schema.js.map +0 -1
- package/dist/derive-fields.d.ts +0 -25
- package/dist/derive-fields.d.ts.map +0 -1
- package/dist/derive-fields.js +0 -147
- package/dist/derive-fields.js.map +0 -1
- package/dist/derive-provenance.d.ts +0 -30
- package/dist/derive-provenance.d.ts.map +0 -1
- package/dist/derive-provenance.js +0 -101
- package/dist/derive-provenance.js.map +0 -1
- package/dist/doctor.d.ts +0 -27
- package/dist/doctor.d.ts.map +0 -1
- package/dist/doctor.js +0 -131
- package/dist/doctor.js.map +0 -1
- package/dist/extensions.d.ts +0 -38
- package/dist/extensions.d.ts.map +0 -1
- package/dist/extensions.js +0 -35
- package/dist/extensions.js.map +0 -1
- package/dist/index.d.ts +0 -20
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/merge.d.ts +0 -16
- package/dist/merge.d.ts.map +0 -1
- package/dist/merge.js +0 -34
- package/dist/merge.js.map +0 -1
- package/dist/ref.d.ts +0 -29
- package/dist/ref.d.ts.map +0 -1
- package/dist/ref.js +0 -30
- package/dist/ref.js.map +0 -1
- package/dist/registry.d.ts +0 -24
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -12
- package/dist/registry.js.map +0 -1
- package/dist/resolve.d.ts +0 -21
- package/dist/resolve.d.ts.map +0 -1
- package/dist/resolve.js +0 -177
- package/dist/resolve.js.map +0 -1
- package/dist/secret-heuristics.d.ts +0 -10
- package/dist/secret-heuristics.d.ts.map +0 -1
- package/dist/secret-heuristics.js +0 -11
- package/dist/secret-heuristics.js.map +0 -1
- package/dist/trails/config-check.d.ts +0 -11
- package/dist/trails/config-check.d.ts.map +0 -1
- package/dist/trails/config-check.js +0 -53
- package/dist/trails/config-check.js.map +0 -1
- package/dist/trails/config-describe.d.ts +0 -12
- package/dist/trails/config-describe.d.ts.map +0 -1
- package/dist/trails/config-describe.js +0 -41
- package/dist/trails/config-describe.js.map +0 -1
- package/dist/trails/config-explain.d.ts +0 -8
- package/dist/trails/config-explain.d.ts.map +0 -1
- package/dist/trails/config-explain.js +0 -74
- package/dist/trails/config-explain.js.map +0 -1
- package/dist/trails/config-init.d.ts +0 -9
- package/dist/trails/config-init.d.ts.map +0 -1
- package/dist/trails/config-init.js +0 -78
- package/dist/trails/config-init.js.map +0 -1
- package/dist/workspace.d.ts +0 -9
- package/dist/workspace.d.ts.map +0 -1
- package/dist/workspace.js +0 -49
- package/dist/workspace.js.map +0 -1
- package/dist/zod-utils.d.ts +0 -14
- package/dist/zod-utils.d.ts.map +0 -1
- package/dist/zod-utils.js +0 -41
- package/dist/zod-utils.js.map +0 -1
- package/src/__tests__/app-config.test.ts +0 -342
- package/src/__tests__/compose.test.ts +0 -59
- package/src/__tests__/config-check.test.ts +0 -171
- package/src/__tests__/config-describe.test.ts +0 -154
- package/src/__tests__/config-explain.test.ts +0 -167
- package/src/__tests__/config-init.test.ts +0 -210
- package/src/__tests__/config-resource.test.ts +0 -87
- package/src/__tests__/define-config.test.ts +0 -269
- package/src/__tests__/derive-fields.test.ts +0 -158
- package/src/__tests__/derive-provenance.test.ts +0 -139
- package/src/__tests__/derive.test.ts +0 -269
- package/src/__tests__/doctor.test.ts +0 -172
- package/src/__tests__/extensions.test.ts +0 -134
- package/src/__tests__/ref.test.ts +0 -35
- package/src/__tests__/resolve.test.ts +0 -246
- package/src/__tests__/workspace.test.ts +0 -64
- package/src/workspace.ts +0 -56
- package/tsconfig.json +0 -9
- package/tsconfig.tests.json +0 -10
- package/tsconfig.tsbuildinfo +0 -1
package/dist/define-config.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trails-specific config wrapper — `appConfig('trails', ...)` with
|
|
3
|
-
* framework conventions for profile selection and local overrides.
|
|
4
|
-
*/
|
|
5
|
-
import type { z } from 'zod';
|
|
6
|
-
/** Options for defining a Trails app config. */
|
|
7
|
-
export interface DefineConfigOptions<T extends z.ZodType> {
|
|
8
|
-
readonly schema: T;
|
|
9
|
-
readonly base?: Partial<z.infer<T>>;
|
|
10
|
-
readonly profiles?: Record<string, Partial<z.infer<T>>>;
|
|
11
|
-
/** When true, fall back to `NODE_ENV` when `TRAILS_ENV` is unset. */
|
|
12
|
-
readonly envFromNodeEnv?: boolean;
|
|
13
|
-
}
|
|
14
|
-
/** Options passed to `resolve()` on a defined config. */
|
|
15
|
-
interface DefineConfigResolveOptions {
|
|
16
|
-
readonly profile?: string;
|
|
17
|
-
readonly env?: Record<string, string | undefined>;
|
|
18
|
-
/** Working directory for local overrides discovery. Defaults to `process.cwd()`. */
|
|
19
|
-
readonly cwd?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Define Trails app config.
|
|
23
|
-
*
|
|
24
|
-
* This is `appConfig('trails', ...)` with the framework's own conventions:
|
|
25
|
-
* `TRAILS_ENV` selects the profile. When `envFromNodeEnv` is true,
|
|
26
|
-
* `NODE_ENV` is used as a fallback when `TRAILS_ENV` is unset.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* const config = defineConfig({
|
|
31
|
-
* schema: z.object({
|
|
32
|
-
* port: z.number().default(3000),
|
|
33
|
-
* debug: z.boolean().default(false),
|
|
34
|
-
* }),
|
|
35
|
-
* base: { port: 8080 },
|
|
36
|
-
* profiles: {
|
|
37
|
-
* production: { debug: false },
|
|
38
|
-
* test: { debug: true, port: 0 },
|
|
39
|
-
* },
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* const result = config.resolve();
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare const defineConfig: <T extends z.ZodType>(options: DefineConfigOptions<T>) => {
|
|
46
|
-
base: Partial<z.core.output<T>> | undefined;
|
|
47
|
-
profiles: Record<string, Partial<z.core.output<T>>> | undefined;
|
|
48
|
-
resolve: (resolveOpts?: DefineConfigResolveOptions) => Promise<import("packages/core/src/result.js").Result<z.core.output<T>, Error>>;
|
|
49
|
-
schema: T;
|
|
50
|
-
name: string;
|
|
51
|
-
formats: readonly import("./app-config.js").ConfigFormat[];
|
|
52
|
-
dotfile: boolean;
|
|
53
|
-
describe(): readonly import("./derive-fields.js").FieldDescription[];
|
|
54
|
-
check(values: Record<string, unknown>, options?: {
|
|
55
|
-
readonly env?: Record<string, string | undefined>;
|
|
56
|
-
}): import("./doctor.js").CheckResult;
|
|
57
|
-
explain(options: import("./app-config.js").AppConfigDeriveProvenanceOptions): readonly import("./derive-provenance.js").ProvenanceEntry[];
|
|
58
|
-
ref(fieldPath: string): import("./ref.js").ConfigRef;
|
|
59
|
-
};
|
|
60
|
-
export {};
|
|
61
|
-
//# sourceMappingURL=define-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAS7B,gDAAgD;AAChD,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO;IACtD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,qEAAqE;IACrE,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,yDAAyD;AACzD,UAAU,0BAA0B;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAClD,oFAAoF;IACpF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAoCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAC9C,SAAS,mBAAmB,CAAC,CAAC,CAAC;;;4BAQC,0BAA0B;;;;;;;oBAnCvC,CAAC;;;;CAgErB,CAAC"}
|
package/dist/define-config.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trails-specific config wrapper — `appConfig('trails', ...)` with
|
|
3
|
-
* framework conventions for profile selection and local overrides.
|
|
4
|
-
*/
|
|
5
|
-
import { existsSync } from 'node:fs';
|
|
6
|
-
import { join } from 'node:path';
|
|
7
|
-
import { appConfig } from './app-config.js';
|
|
8
|
-
import { deriveConfig } from './resolve.js';
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Local overrides discovery
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
const LOCAL_OVERRIDE_CANDIDATES = ['local.ts', 'local.js'];
|
|
13
|
-
/**
|
|
14
|
-
* Discover and synchronously import a `.trails/config/local.{ts,js}` file.
|
|
15
|
-
*
|
|
16
|
-
* Skipped when `TRAILS_ENV=test` for hermetic test environments.
|
|
17
|
-
*/
|
|
18
|
-
const discoverLocalOverrides = async (cwd, envRecord) => {
|
|
19
|
-
if (envRecord['TRAILS_ENV'] === 'test') {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
for (const filename of LOCAL_OVERRIDE_CANDIDATES) {
|
|
23
|
-
const candidate = join(cwd, '.trails', 'config', filename);
|
|
24
|
-
if (existsSync(candidate)) {
|
|
25
|
-
const mod = await import(candidate);
|
|
26
|
-
return (mod['default'] ?? mod);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
};
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
// Public API
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
/**
|
|
35
|
-
* Define Trails app config.
|
|
36
|
-
*
|
|
37
|
-
* This is `appConfig('trails', ...)` with the framework's own conventions:
|
|
38
|
-
* `TRAILS_ENV` selects the profile. When `envFromNodeEnv` is true,
|
|
39
|
-
* `NODE_ENV` is used as a fallback when `TRAILS_ENV` is unset.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```ts
|
|
43
|
-
* const config = defineConfig({
|
|
44
|
-
* schema: z.object({
|
|
45
|
-
* port: z.number().default(3000),
|
|
46
|
-
* debug: z.boolean().default(false),
|
|
47
|
-
* }),
|
|
48
|
-
* base: { port: 8080 },
|
|
49
|
-
* profiles: {
|
|
50
|
-
* production: { debug: false },
|
|
51
|
-
* test: { debug: true, port: 0 },
|
|
52
|
-
* },
|
|
53
|
-
* });
|
|
54
|
-
*
|
|
55
|
-
* const result = config.resolve();
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export const defineConfig = (options) => {
|
|
59
|
-
const config = appConfig('trails', { schema: options.schema });
|
|
60
|
-
return {
|
|
61
|
-
...config,
|
|
62
|
-
base: options.base,
|
|
63
|
-
profiles: options.profiles,
|
|
64
|
-
resolve: async (resolveOpts) => {
|
|
65
|
-
const envRecord = {
|
|
66
|
-
...(resolveOpts?.env ?? process.env),
|
|
67
|
-
};
|
|
68
|
-
if (options.envFromNodeEnv &&
|
|
69
|
-
envRecord['TRAILS_ENV'] === undefined &&
|
|
70
|
-
envRecord['NODE_ENV'] !== undefined) {
|
|
71
|
-
envRecord['TRAILS_ENV'] = envRecord['NODE_ENV'];
|
|
72
|
-
}
|
|
73
|
-
const cwd = resolveOpts?.cwd ?? process.cwd();
|
|
74
|
-
const localOverrides = await discoverLocalOverrides(cwd, envRecord);
|
|
75
|
-
return deriveConfig({
|
|
76
|
-
base: options.base,
|
|
77
|
-
env: envRecord,
|
|
78
|
-
localOverrides,
|
|
79
|
-
profile: resolveOpts?.profile ?? envRecord['TRAILS_ENV'],
|
|
80
|
-
profiles: options.profiles,
|
|
81
|
-
schema: options.schema,
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
schema: options.schema,
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=define-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-config.js","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAuB5C,8EAA8E;AAC9E,4BAA4B;AAC5B,8EAA8E;AAE9E,MAAM,yBAAyB,GAAG,CAAC,UAAU,EAAE,UAAU,CAAU,CAAC;AAEpE;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,KAAK,EAClC,GAAW,EACX,SAA6C,EACC,EAAE;IAChD,IAAI,SAAS,CAAC,YAAY,CAAC,KAAK,MAAM,EAAE,CAAC;QACvC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,yBAAyB,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC3D,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1B,MAAM,GAAG,GAA4B,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,SAAS,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D,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/derive/env.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `.env.example` file generation from Zod schema `env()` bindings.
|
|
3
|
-
*
|
|
4
|
-
* Lists each env var with its type, default, and whether it is a secret.
|
|
5
|
-
* Returns an empty string when no env bindings are present.
|
|
6
|
-
*/
|
|
7
|
-
import type { z } from 'zod';
|
|
8
|
-
/**
|
|
9
|
-
* Generate a `.env.example` file from `env()` bindings in the schema.
|
|
10
|
-
*
|
|
11
|
-
* Lists each env var with its type, default, and whether it is a secret.
|
|
12
|
-
* Returns an empty string when no env bindings are present.
|
|
13
|
-
*/
|
|
14
|
-
export declare const deriveConfigEnvExample: (schema: z.ZodObject<Record<string, z.ZodType>>) => string;
|
|
15
|
-
//# sourceMappingURL=env.d.ts.map
|
package/dist/derive/env.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/derive/env.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsF7B;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAC7C,MAGF,CAAC"}
|
package/dist/derive/env.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { collectConfigMeta } from '../collect.js';
|
|
2
|
-
import { isLikelySecret } from '../secret-heuristics.js';
|
|
3
|
-
import { formatValue, getDefault, getDescription, deriveFieldByPath, unwrap, zodTypeName, zodTypeToJsonSchema, } from './helpers.js';
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
// Helpers
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
/** Map Zod type names to human-readable type labels. */
|
|
8
|
-
const typeLabel = (schema) => {
|
|
9
|
-
const typeName = zodTypeName(unwrap(schema));
|
|
10
|
-
return zodTypeToJsonSchema[typeName] ?? typeName;
|
|
11
|
-
};
|
|
12
|
-
/** Build the type annotation comment for an env entry. */
|
|
13
|
-
const envTypeAnnotation = (fieldSchema, meta) => {
|
|
14
|
-
const parts = [`type: ${typeLabel(fieldSchema)}`];
|
|
15
|
-
const info = getDefault(fieldSchema);
|
|
16
|
-
if (info.has) {
|
|
17
|
-
parts.push(`default: ${formatValue(info.value)}`);
|
|
18
|
-
}
|
|
19
|
-
if (meta.secret) {
|
|
20
|
-
parts.push('secret');
|
|
21
|
-
}
|
|
22
|
-
return `# ${parts.join(', ')}`;
|
|
23
|
-
};
|
|
24
|
-
/** Format a single env var entry. */
|
|
25
|
-
const envEntry = (envVar, fieldSchema, meta) => {
|
|
26
|
-
const effectiveMeta = !meta.secret && isLikelySecret(envVar) ? { ...meta, secret: true } : meta;
|
|
27
|
-
const lines = [];
|
|
28
|
-
const desc = getDescription(fieldSchema);
|
|
29
|
-
if (desc) {
|
|
30
|
-
lines.push(`# ${desc}`);
|
|
31
|
-
}
|
|
32
|
-
lines.push(envTypeAnnotation(fieldSchema, effectiveMeta));
|
|
33
|
-
lines.push(`${envVar}=`);
|
|
34
|
-
return lines;
|
|
35
|
-
};
|
|
36
|
-
/** Collect env entries from config metadata. */
|
|
37
|
-
const collectEnvEntries = (schema, meta) => {
|
|
38
|
-
const entries = [];
|
|
39
|
-
for (const [path, fieldMeta] of meta) {
|
|
40
|
-
if (!fieldMeta.env) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const fieldSchema = deriveFieldByPath(schema, path);
|
|
44
|
-
if (!fieldSchema) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
entries.push(...envEntry(fieldMeta.env, fieldSchema, fieldMeta));
|
|
48
|
-
entries.push('');
|
|
49
|
-
}
|
|
50
|
-
return entries;
|
|
51
|
-
};
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
// Public API
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
/**
|
|
56
|
-
* Generate a `.env.example` file from `env()` bindings in the schema.
|
|
57
|
-
*
|
|
58
|
-
* Lists each env var with its type, default, and whether it is a secret.
|
|
59
|
-
* Returns an empty string when no env bindings are present.
|
|
60
|
-
*/
|
|
61
|
-
export const deriveConfigEnvExample = (schema) => {
|
|
62
|
-
const entries = collectEnvEntries(schema, collectConfigMeta(schema));
|
|
63
|
-
return entries.length === 0 ? '' : entries.join('\n');
|
|
64
|
-
};
|
|
65
|
-
//# sourceMappingURL=env.js.map
|
package/dist/derive/env.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/derive/env.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,wDAAwD;AACxD,MAAM,SAAS,GAAG,CAAC,MAAiB,EAAU,EAAE;IAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,mBAAmB,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;AACnD,CAAC,CAAC;AAEF,0DAA0D;AAC1D,MAAM,iBAAiB,GAAG,CACxB,WAAsB,EACtB,IAAqB,EACb,EAAE;IACV,MAAM,KAAK,GAAG,CAAC,SAAS,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,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CAAC;QACD,MAAM,WAAW,GAAG,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,SAAS;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAA8C,EACtC,EAAE;IACV,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC,CAAC"}
|
package/dist/derive/example.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config example file generation in multiple formats.
|
|
3
|
-
*
|
|
4
|
-
* Produces TOML, JSON, JSONC, and YAML example files from a Zod schema,
|
|
5
|
-
* with defaults shown and deprecated fields annotated.
|
|
6
|
-
*/
|
|
7
|
-
import type { z } from 'zod';
|
|
8
|
-
type ExampleFormat = 'json' | 'jsonc' | 'toml' | 'yaml';
|
|
9
|
-
/**
|
|
10
|
-
* Generate an example config file in the specified format.
|
|
11
|
-
*
|
|
12
|
-
* Includes descriptions as comments, defaults shown, deprecated fields annotated.
|
|
13
|
-
*/
|
|
14
|
-
export declare const deriveConfigExample: (schema: z.ZodObject<Record<string, z.ZodType>>, format: ExampleFormat) => string;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=example.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/derive/example.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmM7B,KAAK,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAYxD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAC9C,QAAQ,aAAa,KACpB,MAAoC,CAAC"}
|
package/dist/derive/example.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { fieldComments, fieldValue, formatValue, getObjectShape, isObjectType, pushComments, unwrap, } from './helpers.js';
|
|
2
|
-
// ---------------------------------------------------------------------------
|
|
3
|
-
// TOML generation
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
/** Render a flat set of fields as TOML key = value lines. */
|
|
6
|
-
const renderTomlFields = (shape, lines) => {
|
|
7
|
-
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
8
|
-
if (isObjectType(fieldSchema)) {
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
pushComments(lines, fieldComments(fieldSchema, '#'), '');
|
|
12
|
-
lines.push(`${key} = ${formatValue(fieldValue(fieldSchema))}`);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
/** Render nested objects as TOML sections, recursing with dotted prefixes. */
|
|
16
|
-
const renderTomlSections = (shape, lines, prefix = '') => {
|
|
17
|
-
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
18
|
-
const nested = isObjectType(fieldSchema)
|
|
19
|
-
? getObjectShape(fieldSchema)
|
|
20
|
-
: undefined;
|
|
21
|
-
if (!nested) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const sectionKey = prefix ? `${prefix}.${key}` : key;
|
|
25
|
-
if (lines.length > 0) {
|
|
26
|
-
lines.push('');
|
|
27
|
-
}
|
|
28
|
-
lines.push(`[${sectionKey}]`);
|
|
29
|
-
renderTomlFields(nested, lines);
|
|
30
|
-
// oxlint-disable-next-line max-statements -- recursive TOML section rendering
|
|
31
|
-
renderTomlSections(nested, lines, sectionKey);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const formatToml = (schema) => {
|
|
35
|
-
const shape = schema.shape;
|
|
36
|
-
const lines = [];
|
|
37
|
-
renderTomlFields(shape, lines);
|
|
38
|
-
renderTomlSections(shape, lines);
|
|
39
|
-
return `${lines.join('\n')}\n`;
|
|
40
|
-
};
|
|
41
|
-
// ---------------------------------------------------------------------------
|
|
42
|
-
// JSON / JSONC generation
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
/** Resolve a field to its nested object or its scalar value. */
|
|
45
|
-
const resolveJsonField = (fieldSchema, recurse) => {
|
|
46
|
-
if (!isObjectType(fieldSchema)) {
|
|
47
|
-
return fieldValue(fieldSchema);
|
|
48
|
-
}
|
|
49
|
-
const nested = getObjectShape(fieldSchema);
|
|
50
|
-
if (!nested) {
|
|
51
|
-
return fieldValue(fieldSchema);
|
|
52
|
-
}
|
|
53
|
-
const inner = unwrap(fieldSchema);
|
|
54
|
-
return recurse(inner);
|
|
55
|
-
};
|
|
56
|
-
/** Build a plain object with default/placeholder values for JSON output. */
|
|
57
|
-
const buildJsonObject = (schema) => {
|
|
58
|
-
const shape = schema.shape;
|
|
59
|
-
const obj = {};
|
|
60
|
-
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
61
|
-
obj[key] = resolveJsonField(fieldSchema, buildJsonObject);
|
|
62
|
-
}
|
|
63
|
-
return obj;
|
|
64
|
-
};
|
|
65
|
-
const formatJson = (schema) => `${JSON.stringify(buildJsonObject(schema), null, 2)}\n`;
|
|
66
|
-
/** Serialize a nested object field for JSONC output. */
|
|
67
|
-
const serializeJsoncObject = (fieldSchema) => {
|
|
68
|
-
const nested = getObjectShape(fieldSchema);
|
|
69
|
-
if (!nested) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
const inner = unwrap(fieldSchema);
|
|
73
|
-
return JSON.stringify(buildJsonObject(inner), null, 2).replaceAll('\n', '\n ');
|
|
74
|
-
};
|
|
75
|
-
/** Render a single JSONC entry (comments + key: value). */
|
|
76
|
-
const renderJsoncEntry = (key, fieldSchema, isLast, lines) => {
|
|
77
|
-
pushComments(lines, fieldComments(fieldSchema, '//'), ' ');
|
|
78
|
-
const comma = isLast ? '' : ',';
|
|
79
|
-
const serialized = isObjectType(fieldSchema)
|
|
80
|
-
? serializeJsoncObject(fieldSchema)
|
|
81
|
-
: undefined;
|
|
82
|
-
const val = serialized ?? formatValue(fieldValue(fieldSchema));
|
|
83
|
-
lines.push(` "${key}": ${val}${comma}`);
|
|
84
|
-
};
|
|
85
|
-
const formatJsonc = (schema) => {
|
|
86
|
-
const keys = Object.keys(schema.shape);
|
|
87
|
-
const shape = schema.shape;
|
|
88
|
-
const lines = ['{'];
|
|
89
|
-
for (let i = 0; i < keys.length; i += 1) {
|
|
90
|
-
const key = keys[i];
|
|
91
|
-
renderJsoncEntry(key, shape[key], i === keys.length - 1, lines);
|
|
92
|
-
}
|
|
93
|
-
lines.push('}');
|
|
94
|
-
return `${lines.join('\n')}\n`;
|
|
95
|
-
};
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
// YAML generation
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
/** Render a single YAML scalar field. */
|
|
100
|
-
const renderYamlScalar = (key, fieldSchema, indent, lines) => {
|
|
101
|
-
pushComments(lines, fieldComments(fieldSchema, '#'), indent);
|
|
102
|
-
lines.push(`${indent}${key}: ${formatValue(fieldValue(fieldSchema))}`);
|
|
103
|
-
};
|
|
104
|
-
/** Render YAML fields at a given indent level. */
|
|
105
|
-
const renderYamlFields = (shape, indent, lines) => {
|
|
106
|
-
for (const [key, fieldSchema] of Object.entries(shape)) {
|
|
107
|
-
if (isObjectType(fieldSchema)) {
|
|
108
|
-
const nested = getObjectShape(fieldSchema);
|
|
109
|
-
if (!nested) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
lines.push(`${indent}${key}:`);
|
|
113
|
-
renderYamlFields(nested, `${indent} `, lines);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
renderYamlScalar(key, fieldSchema, indent, lines);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const formatYaml = (schema) => {
|
|
121
|
-
const shape = schema.shape;
|
|
122
|
-
const lines = [];
|
|
123
|
-
renderYamlFields(shape, '', lines);
|
|
124
|
-
return `${lines.join('\n')}\n`;
|
|
125
|
-
};
|
|
126
|
-
const formatters = {
|
|
127
|
-
json: formatJson,
|
|
128
|
-
jsonc: formatJsonc,
|
|
129
|
-
toml: formatToml,
|
|
130
|
-
yaml: formatYaml,
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Generate an example config file in the specified format.
|
|
134
|
-
*
|
|
135
|
-
* Includes descriptions as comments, defaults shown, deprecated fields annotated.
|
|
136
|
-
*/
|
|
137
|
-
export const deriveConfigExample = (schema, format) => formatters[format](schema);
|
|
138
|
-
//# sourceMappingURL=example.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","sourceRoot":"","sources":["../../src/derive/example.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,6DAA6D;AAC7D,MAAM,gBAAgB,GAAG,CACvB,KAAgC,EAChC,KAAe,EACT,EAAE;IACR,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAA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I,CAAC,GAAG,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC;YAC/B,gBAAgB,CAAC,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,gBAAgB,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,MAA8C,EAAU,EAAE;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAkC,CAAC;IACxD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,gBAAgB,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACnC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC,CAAC;AAQF,MAAM,UAAU,GAGZ;IACF,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,MAA8C,EAC9C,MAAqB,EACb,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/derive/helpers.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
/** Unwrap `.default()`, `.optional()`, `.nullable()` to reach the inner type. */
|
|
3
|
-
export declare const unwrap: (schema: z.ZodType) => z.ZodType;
|
|
4
|
-
/** Read the Zod type discriminant from a schema's def. */
|
|
5
|
-
export declare const zodTypeName: (schema: z.ZodType) => string;
|
|
6
|
-
/** Walk the registry up through wrappers to find a metadata key. */
|
|
7
|
-
export declare const walkRegistryKey: (schema: z.ZodType, key: string) => unknown | undefined;
|
|
8
|
-
/** Get the description from the global registry for a schema or its inner type. */
|
|
9
|
-
export declare const getDescription: (schema: z.ZodType) => string | undefined;
|
|
10
|
-
/** Get the deprecation message from the config meta for a field. */
|
|
11
|
-
export declare const getDeprecation: (schema: z.ZodType) => string | undefined;
|
|
12
|
-
/** Get the default value from a schema if it has one. */
|
|
13
|
-
export declare const getDefault: (schema: z.ZodType) => {
|
|
14
|
-
has: false;
|
|
15
|
-
} | {
|
|
16
|
-
has: true;
|
|
17
|
-
value: unknown;
|
|
18
|
-
};
|
|
19
|
-
/** Check whether a schema (or its inner type) is a ZodObject. */
|
|
20
|
-
export declare const isObjectType: (schema: z.ZodType) => boolean;
|
|
21
|
-
/** Get the shape of a ZodObject, unwrapping wrappers first. */
|
|
22
|
-
export declare const getObjectShape: (schema: z.ZodType) => Record<string, z.ZodType> | undefined;
|
|
23
|
-
/** Resolve a dot-separated path to the field schema within an object. */
|
|
24
|
-
export declare const deriveFieldByPath: (schema: z.ZodObject<Record<string, z.ZodType>>, path: string) => z.ZodType | undefined;
|
|
25
|
-
/** Format a value as a quoted string or literal. */
|
|
26
|
-
export declare const formatValue: (value: unknown) => string;
|
|
27
|
-
/** Get the display value for a field (default or empty placeholder). */
|
|
28
|
-
export declare const fieldValue: (schema: z.ZodType) => unknown;
|
|
29
|
-
/** Collect comment lines for a field (description + deprecation). */
|
|
30
|
-
export declare const fieldComments: (schema: z.ZodType, prefix: string) => readonly string[];
|
|
31
|
-
/** Append comment lines to an output array. */
|
|
32
|
-
export declare const pushComments: (lines: string[], comments: readonly string[], indent: string) => void;
|
|
33
|
-
/** Map a Zod type name to a JSON Schema type. */
|
|
34
|
-
export declare const zodTypeToJsonSchema: Record<string, string>;
|
|
35
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/derive/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,iFAAiF;A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QAAQ,CAAC,CAAC,OAAO,KAAG,OAG9C,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,aAAa,GACxB,QAAQ,CAAC,CAAC,OAAO,EACjB,QAAQ,MAAM,KACb,SAAS,MAAM,EAWjB,CAAC;AAEF,+CAA+C;AAC/C,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EAAE,EACf,UAAU,SAAS,MAAM,EAAE,EAC3B,QAAQ,MAAM,KACb,IAIF,CAAC;AAEF,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAItD,CAAC"}
|
package/dist/derive/helpers.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { globalRegistry } from 'zod';
|
|
2
|
-
// ---------------------------------------------------------------------------
|
|
3
|
-
// Schema introspection helpers
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
/** Unwrap `.default()`, `.optional()`, `.nullable()` to reach the inner type. */
|
|
6
|
-
export const unwrap = (schema) => {
|
|
7
|
-
let current = schema;
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
9
|
-
while (true) {
|
|
10
|
-
const def = current.def;
|
|
11
|
-
const inner = def['innerType'];
|
|
12
|
-
if (!inner) {
|
|
13
|
-
return current;
|
|
14
|
-
}
|
|
15
|
-
current = inner;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
/** Read the Zod type discriminant from a schema's def. */
|
|
19
|
-
export const zodTypeName = (schema) => {
|
|
20
|
-
const def = schema.def;
|
|
21
|
-
return def['type'] ?? 'unknown';
|
|
22
|
-
};
|
|
23
|
-
/** Walk the registry up through wrappers to find a metadata key. */
|
|
24
|
-
export const walkRegistryKey = (schema, key) => {
|
|
25
|
-
let current = schema;
|
|
26
|
-
while (current) {
|
|
27
|
-
const meta = globalRegistry.get(current);
|
|
28
|
-
if (meta?.[key] !== undefined) {
|
|
29
|
-
return meta[key];
|
|
30
|
-
}
|
|
31
|
-
const def = current.def;
|
|
32
|
-
current = def['innerType'];
|
|
33
|
-
}
|
|
34
|
-
return undefined;
|
|
35
|
-
};
|
|
36
|
-
/** Get the description from the global registry for a schema or its inner type. */
|
|
37
|
-
export const getDescription = (schema) => walkRegistryKey(schema, 'description');
|
|
38
|
-
/** Get the deprecation message from the config meta for a field. */
|
|
39
|
-
export const getDeprecation = (schema) => walkRegistryKey(schema, 'deprecationMessage');
|
|
40
|
-
/** Get the default value from a schema if it has one. */
|
|
41
|
-
export const getDefault = (schema) => {
|
|
42
|
-
const def = schema.def;
|
|
43
|
-
if (def['type'] === 'default') {
|
|
44
|
-
return { has: true, value: def['defaultValue'] };
|
|
45
|
-
}
|
|
46
|
-
return { has: false };
|
|
47
|
-
};
|
|
48
|
-
/** Check whether a schema (or its inner type) is a ZodObject. */
|
|
49
|
-
export const isObjectType = (schema) => {
|
|
50
|
-
const inner = unwrap(schema);
|
|
51
|
-
const def = inner.def;
|
|
52
|
-
return def['type'] === 'object' && 'shape' in def;
|
|
53
|
-
};
|
|
54
|
-
/** Get the shape of a ZodObject, unwrapping wrappers first. */
|
|
55
|
-
export const getObjectShape = (schema) => {
|
|
56
|
-
const inner = unwrap(schema);
|
|
57
|
-
const def = inner.def;
|
|
58
|
-
if (def['type'] !== 'object' || !('shape' in def)) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
return inner.shape;
|
|
62
|
-
};
|
|
63
|
-
/** Resolve a dot-separated path to the field schema within an object. */
|
|
64
|
-
export const deriveFieldByPath = (schema, path) => {
|
|
65
|
-
const parts = path.split('.');
|
|
66
|
-
let current = schema;
|
|
67
|
-
for (const part of parts) {
|
|
68
|
-
const shape = getObjectShape(current);
|
|
69
|
-
if (!shape?.[part]) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
current = shape[part];
|
|
73
|
-
}
|
|
74
|
-
return current;
|
|
75
|
-
};
|
|
76
|
-
// ---------------------------------------------------------------------------
|
|
77
|
-
// Value formatting helpers
|
|
78
|
-
// ---------------------------------------------------------------------------
|
|
79
|
-
/** Format a value as a quoted string or literal. */
|
|
80
|
-
export const formatValue = (value) => {
|
|
81
|
-
if (typeof value === 'string') {
|
|
82
|
-
return `"${value}"`;
|
|
83
|
-
}
|
|
84
|
-
return String(value);
|
|
85
|
-
};
|
|
86
|
-
/** Get the display value for a field (default or empty placeholder). */
|
|
87
|
-
export const fieldValue = (schema) => {
|
|
88
|
-
const info = getDefault(schema);
|
|
89
|
-
return info.has ? info.value : '';
|
|
90
|
-
};
|
|
91
|
-
/** Collect comment lines for a field (description + deprecation). */
|
|
92
|
-
export const fieldComments = (schema, prefix) => {
|
|
93
|
-
const lines = [];
|
|
94
|
-
const desc = getDescription(schema);
|
|
95
|
-
if (desc) {
|
|
96
|
-
lines.push(`${prefix} ${desc}`);
|
|
97
|
-
}
|
|
98
|
-
const dep = getDeprecation(schema);
|
|
99
|
-
if (dep) {
|
|
100
|
-
lines.push(`${prefix} DEPRECATED: ${dep}`);
|
|
101
|
-
}
|
|
102
|
-
return lines;
|
|
103
|
-
};
|
|
104
|
-
/** Append comment lines to an output array. */
|
|
105
|
-
export const pushComments = (lines, comments, indent) => {
|
|
106
|
-
for (const c of comments) {
|
|
107
|
-
lines.push(`${indent}${c}`);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
/** Map a Zod type name to a JSON Schema type. */
|
|
111
|
-
export const zodTypeToJsonSchema = {
|
|
112
|
-
boolean: 'boolean',
|
|
113
|
-
number: 'number',
|
|
114
|
-
string: 'string',
|
|
115
|
-
};
|
|
116
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/derive/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrC,8EAA8E;AAC9E,+BAA+B;AAC/B,8EAA8E;AAE9E,iFAAiF;AACj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AC,CAAC;IACnC,IAAI,GAAG,EAAE,CAAC;QACR,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,gBAAgB,GAAG,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAe,EACf,QAA2B,EAC3B,MAAc,EACR,EAAE;IACR,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC,CAAC;AAEF,iDAAiD;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAC"}
|
package/dist/derive/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/derive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/derive/index.js
DELETED
package/dist/derive/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/derive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Schema generation from Zod object schemas.
|
|
3
|
-
*
|
|
4
|
-
* Produces JSON Schema Draft 2020-12 with descriptions, defaults,
|
|
5
|
-
* deprecated annotations, and constraints.
|
|
6
|
-
*/
|
|
7
|
-
import type { z } from 'zod';
|
|
8
|
-
/**
|
|
9
|
-
* Generate a JSON Schema from a Zod object schema.
|
|
10
|
-
*
|
|
11
|
-
* Includes descriptions, defaults, deprecated annotations, and constraints.
|
|
12
|
-
* Produces JSON Schema Draft 2020-12.
|
|
13
|
-
*/
|
|
14
|
-
export declare const deriveConfigJsonSchema: (schema: z.ZodObject<Record<string, z.ZodType>>, options?: {
|
|
15
|
-
readonly description?: string;
|
|
16
|
-
readonly title?: string;
|
|
17
|
-
}) => Record<string, unknown>;
|
|
18
|
-
//# sourceMappingURL=json-schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/derive/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsG7B;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAC9C,UAAU;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KACnE,MAAM,CAAC,MAAM,EAAE,OAAO,CAmBxB,CAAC"}
|