@ontrails/config 1.0.0-beta.14 → 1.0.0-beta.15
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/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +7 -0
- package/README.md +20 -28
- package/dist/app-config.d.ts +4 -4
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +12 -7
- package/dist/app-config.js.map +1 -1
- package/dist/compose.d.ts +11 -15
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +7 -9
- package/dist/compose.js.map +1 -1
- package/dist/config-layer.d.ts +3 -3
- package/dist/config-resource.d.ts +3 -0
- package/dist/config-resource.d.ts.map +1 -0
- package/dist/{config-provision.js → config-resource.js} +6 -6
- package/dist/config-resource.js.map +1 -0
- package/dist/define-config.d.ts +9 -9
- package/dist/define-config.d.ts.map +1 -1
- package/dist/define-config.js +9 -12
- package/dist/define-config.js.map +1 -1
- package/dist/{generate → derive}/env.d.ts +1 -1
- package/dist/derive/env.d.ts.map +1 -0
- package/dist/{generate → derive}/env.js +3 -3
- package/dist/derive/env.js.map +1 -0
- package/dist/{generate → derive}/example.d.ts +1 -1
- package/dist/derive/example.d.ts.map +1 -0
- package/dist/{generate → derive}/example.js +1 -1
- package/dist/derive/example.js.map +1 -0
- package/dist/{generate → derive}/helpers.d.ts +1 -1
- package/dist/derive/helpers.d.ts.map +1 -0
- package/dist/{generate → derive}/helpers.js +1 -1
- package/dist/derive/helpers.js.map +1 -0
- package/dist/derive/index.d.ts +4 -0
- package/dist/derive/index.d.ts.map +1 -0
- package/dist/derive/index.js +4 -0
- package/dist/derive/index.js.map +1 -0
- package/dist/{generate → derive}/json-schema.d.ts +1 -1
- package/dist/derive/json-schema.d.ts.map +1 -0
- package/dist/{generate → derive}/json-schema.js +1 -1
- package/dist/derive/json-schema.js.map +1 -0
- package/dist/{describe.d.ts → derive-fields.d.ts} +2 -2
- package/dist/derive-fields.d.ts.map +1 -0
- package/dist/{describe.js → derive-fields.js} +2 -2
- package/dist/derive-fields.js.map +1 -0
- package/dist/{explain.d.ts → derive-provenance.d.ts} +5 -5
- package/dist/derive-provenance.d.ts.map +1 -0
- package/dist/{explain.js → derive-provenance.js} +3 -3
- package/dist/derive-provenance.js.map +1 -0
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/resolve.d.ts +6 -6
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +7 -7
- package/dist/resolve.js.map +1 -1
- package/dist/trails/config-check.d.ts +1 -1
- package/dist/trails/config-check.d.ts.map +1 -1
- package/dist/trails/config-check.js +3 -3
- package/dist/trails/config-check.js.map +1 -1
- package/dist/trails/config-describe.d.ts +1 -1
- package/dist/trails/config-describe.d.ts.map +1 -1
- package/dist/trails/config-describe.js +5 -5
- package/dist/trails/config-describe.js.map +1 -1
- package/dist/trails/config-explain.d.ts +1 -1
- package/dist/trails/config-explain.d.ts.map +1 -1
- package/dist/trails/config-explain.js +8 -8
- package/dist/trails/config-explain.js.map +1 -1
- package/dist/trails/config-init.d.ts +1 -1
- package/dist/trails/config-init.d.ts.map +1 -1
- package/dist/trails/config-init.js +7 -7
- package/dist/trails/config-init.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/app-config.test.ts +19 -6
- package/src/__tests__/compose.test.ts +15 -15
- package/src/__tests__/config-check.test.ts +7 -7
- package/src/__tests__/config-describe.test.ts +7 -7
- package/src/__tests__/config-explain.test.ts +7 -7
- package/src/__tests__/config-init.test.ts +7 -7
- package/src/__tests__/{config-provision.test.ts → config-resource.test.ts} +12 -12
- package/src/__tests__/define-config.test.ts +24 -18
- package/src/__tests__/{describe.test.ts → derive-fields.test.ts} +11 -11
- package/src/__tests__/{explain.test.ts → derive-provenance.test.ts} +18 -18
- package/src/__tests__/{generate.test.ts → derive.test.ts} +30 -30
- package/src/__tests__/resolve.test.ts +31 -31
- package/src/app-config.ts +23 -12
- package/src/compose.ts +16 -22
- package/src/{config-provision.ts → config-resource.ts} +5 -5
- package/src/define-config.ts +12 -15
- package/src/{generate → derive}/env.ts +3 -3
- package/src/{generate → derive}/example.ts +1 -1
- package/src/{generate → derive}/helpers.ts +1 -1
- package/src/derive/index.ts +3 -0
- package/src/{generate → derive}/json-schema.ts +1 -1
- package/src/{describe.ts → derive-fields.ts} +1 -1
- package/src/{explain.ts → derive-provenance.ts} +6 -6
- package/src/index.ts +12 -18
- package/src/registry.ts +2 -2
- package/src/resolve.ts +13 -13
- package/src/trails/config-check.ts +3 -3
- package/src/trails/config-describe.ts +5 -5
- package/src/trails/config-explain.ts +13 -13
- package/src/trails/config-init.ts +10 -10
- package/tsconfig.tests.json +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/config-gate.d.ts +0 -11
- package/dist/config-gate.d.ts.map +0 -1
- package/dist/config-gate.js +0 -6
- package/dist/config-gate.js.map +0 -1
- package/dist/config-provision.d.ts +0 -3
- package/dist/config-provision.d.ts.map +0 -1
- package/dist/config-provision.js.map +0 -1
- package/dist/config-service.d.ts +0 -3
- package/dist/config-service.d.ts.map +0 -1
- package/dist/config-service.js +0 -26
- package/dist/config-service.js.map +0 -1
- package/dist/describe.d.ts.map +0 -1
- package/dist/describe.js.map +0 -1
- package/dist/explain.d.ts.map +0 -1
- package/dist/explain.js.map +0 -1
- package/dist/generate/env.d.ts.map +0 -1
- package/dist/generate/env.js.map +0 -1
- package/dist/generate/example.d.ts.map +0 -1
- package/dist/generate/example.js.map +0 -1
- package/dist/generate/helpers.d.ts.map +0 -1
- package/dist/generate/helpers.js.map +0 -1
- package/dist/generate/index.d.ts +0 -4
- package/dist/generate/index.d.ts.map +0 -1
- package/dist/generate/index.js +0 -4
- package/dist/generate/index.js.map +0 -1
- package/dist/generate/json-schema.d.ts.map +0 -1
- package/dist/generate/json-schema.js.map +0 -1
- package/src/__tests__/config-gate.test.ts +0 -53
- package/src/config-gate.ts +0 -15
- package/src/generate/index.ts +0 -3
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Schema-derived configuration for Trails.
|
|
4
4
|
|
|
5
|
-
The root package owns the connector-agnostic config declaration and resolution engine. Schemas define the contract
|
|
5
|
+
The root package owns the connector-agnostic config declaration and resolution engine. Schemas define the contract, and `configResource` exposes resolved values to trail execution.
|
|
6
6
|
|
|
7
7
|
## The core pattern
|
|
8
8
|
|
|
@@ -24,7 +24,7 @@ export const config = defineConfig({
|
|
|
24
24
|
base: {
|
|
25
25
|
host: 'example.com',
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
profiles: {
|
|
28
28
|
production: {
|
|
29
29
|
debug: false,
|
|
30
30
|
host: 'prod.example.com',
|
|
@@ -45,7 +45,7 @@ import { registerConfigState } from '@ontrails/config';
|
|
|
45
45
|
|
|
46
46
|
const result = await config.resolve({
|
|
47
47
|
cwd: process.cwd(),
|
|
48
|
-
|
|
48
|
+
profile: process.env.TRAILS_ENV,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
if (!result.isOk()) {
|
|
@@ -56,7 +56,7 @@ registerConfigState({
|
|
|
56
56
|
resolved: result.unwrap(),
|
|
57
57
|
schema: config.schema,
|
|
58
58
|
base: config.base,
|
|
59
|
-
|
|
59
|
+
profile: process.env.TRAILS_ENV,
|
|
60
60
|
env: process.env,
|
|
61
61
|
});
|
|
62
62
|
```
|
|
@@ -64,12 +64,12 @@ registerConfigState({
|
|
|
64
64
|
### 3. Access resolved config in trails
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
|
-
import {
|
|
67
|
+
import { configResource } from '@ontrails/config';
|
|
68
68
|
|
|
69
69
|
export const getStatus = trail('status.get', {
|
|
70
|
-
|
|
70
|
+
resources: [configResource],
|
|
71
71
|
blaze: (_input, ctx) => {
|
|
72
|
-
const state =
|
|
72
|
+
const state = configResource.from(ctx);
|
|
73
73
|
return Result.ok({
|
|
74
74
|
port: state.resolved.port,
|
|
75
75
|
debug: state.resolved.debug,
|
|
@@ -83,11 +83,14 @@ export const getStatus = trail('status.get', {
|
|
|
83
83
|
Config resolves through a deterministic priority order:
|
|
84
84
|
|
|
85
85
|
```text
|
|
86
|
-
defaults (schema) → base →
|
|
86
|
+
defaults (schema) → base → profile → local → env
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
Each layer overrides the previous. Environment variables always win.
|
|
90
90
|
|
|
91
|
+
`appConfig()` discovers `*.config.toml`, `*.config.json`, `*.config.jsonc`, and
|
|
92
|
+
`*.config.yaml` by default, plus dotfile equivalents when `dotfile: true`.
|
|
93
|
+
|
|
91
94
|
## Extensions
|
|
92
95
|
|
|
93
96
|
### `env()`
|
|
@@ -133,33 +136,22 @@ const schema = z.object({
|
|
|
133
136
|
});
|
|
134
137
|
```
|
|
135
138
|
|
|
136
|
-
## The
|
|
139
|
+
## The resource
|
|
137
140
|
|
|
138
|
-
The config
|
|
141
|
+
The config resource manages resolved config lifecycle:
|
|
139
142
|
|
|
140
143
|
```typescript
|
|
141
|
-
import {
|
|
144
|
+
import { configResource } from '@ontrails/config';
|
|
142
145
|
|
|
143
146
|
export const myTrail = trail('my.trail', {
|
|
144
|
-
|
|
147
|
+
resources: [configResource],
|
|
145
148
|
blaze: (_input, ctx) => {
|
|
146
|
-
const state =
|
|
149
|
+
const state = configResource.from(ctx);
|
|
147
150
|
return Result.ok(state.resolved);
|
|
148
151
|
},
|
|
149
152
|
});
|
|
150
153
|
```
|
|
151
154
|
|
|
152
|
-
## The gate
|
|
153
|
-
|
|
154
|
-
The config gate reserves a slot in the execution context for per-trail config validation:
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
import { configGate } from '@ontrails/config';
|
|
158
|
-
|
|
159
|
-
export const app = topo('my-app', configModule);
|
|
160
|
-
// Register configGate with your trailhead
|
|
161
|
-
```
|
|
162
|
-
|
|
163
155
|
## Trail definitions
|
|
164
156
|
|
|
165
157
|
### `config.check`
|
|
@@ -172,7 +164,7 @@ Describe all fields in the schema — paths, types, defaults, env bindings, secr
|
|
|
172
164
|
|
|
173
165
|
### `config.explain`
|
|
174
166
|
|
|
175
|
-
Show which source won for each config field — defaults, base,
|
|
167
|
+
Show which source won for each config field — defaults, base, profile, local, or env.
|
|
176
168
|
|
|
177
169
|
### `config.init`
|
|
178
170
|
|
|
@@ -180,13 +172,13 @@ Generate example config files in TOML, JSON, JSONC, or YAML. Optionally writes `
|
|
|
180
172
|
|
|
181
173
|
## Testing
|
|
182
174
|
|
|
183
|
-
Trails that depend on `
|
|
175
|
+
Trails that depend on `configResource` auto-resolve with a mock when registered in the topo:
|
|
184
176
|
|
|
185
177
|
```typescript
|
|
186
178
|
import { testAll } from '@ontrails/testing';
|
|
187
179
|
|
|
188
|
-
const results = testAll(
|
|
189
|
-
//
|
|
180
|
+
const results = testAll(graph);
|
|
181
|
+
// configResource.mock() is called automatically
|
|
190
182
|
```
|
|
191
183
|
|
|
192
184
|
For explicit test setup:
|
package/dist/app-config.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { Result } from '@ontrails/core';
|
|
5
5
|
import type { z } from 'zod';
|
|
6
6
|
import type { CheckResult } from './doctor.js';
|
|
7
|
-
import type { FieldDescription } from './
|
|
8
|
-
import type {
|
|
7
|
+
import type { FieldDescription } from './derive-fields.js';
|
|
8
|
+
import type { DeriveConfigProvenanceOptions, ProvenanceEntry } from './derive-provenance.js';
|
|
9
9
|
import type { ConfigRef } from './ref.js';
|
|
10
10
|
/** Supported config file formats. */
|
|
11
11
|
export type ConfigFormat = 'toml' | 'json' | 'jsonc' | 'yaml';
|
|
@@ -23,7 +23,7 @@ export interface ResolveOptions {
|
|
|
23
23
|
readonly path?: string;
|
|
24
24
|
}
|
|
25
25
|
/** Options for the `explain()` method on AppConfig, excluding schema. */
|
|
26
|
-
export type
|
|
26
|
+
export type AppConfigDeriveProvenanceOptions = Omit<DeriveConfigProvenanceOptions<z.ZodType>, 'schema'>;
|
|
27
27
|
/** The resolved config contract returned by `appConfig()`. */
|
|
28
28
|
export interface AppConfig<T extends z.ZodType> {
|
|
29
29
|
readonly name: string;
|
|
@@ -38,7 +38,7 @@ export interface AppConfig<T extends z.ZodType> {
|
|
|
38
38
|
readonly env?: Record<string, string | undefined>;
|
|
39
39
|
}): CheckResult;
|
|
40
40
|
/** Show which source won for each config field. */
|
|
41
|
-
explain(options:
|
|
41
|
+
explain(options: AppConfigDeriveProvenanceOptions): readonly ProvenanceEntry[];
|
|
42
42
|
/** Create a lazy reference to a config field for use as a trail input default. */
|
|
43
43
|
ref(fieldPath: string): ConfigRef;
|
|
44
44
|
}
|
package/dist/app-config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config.d.ts","sourceRoot":"","sources":["../src/app-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAiB,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"app-config.d.ts","sourceRoot":"","sources":["../src/app-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAiB,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EACV,6BAA6B,EAC7B,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,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AC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;KAAE,GAC9D,WAAW,CAAC;IAEf,mDAAmD;IACnD,OAAO,CACL,OAAO,EAAE,gCAAgC,GACxC,SAAS,eAAe,EAAE,CAAC;IAE9B,kFAAkF;IAClF,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAwMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAC3C,MAAM,MAAM,EACZ,SAAS,gBAAgB,CAAC,CAAC,CAAC,KAC3B,SAAS,CAAC,CAAC,CAsBb,CAAC"}
|
package/dist/app-config.js
CHANGED
|
@@ -4,13 +4,18 @@
|
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
5
5
|
import { NotFoundError, Result, ValidationError } from '@ontrails/core';
|
|
6
6
|
import { checkConfig } from './doctor.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { deriveConfigFields } from './derive-fields.js';
|
|
8
|
+
import { deriveConfigProvenance } from './derive-provenance.js';
|
|
9
9
|
import { configRef } from './ref.js';
|
|
10
10
|
// ---------------------------------------------------------------------------
|
|
11
11
|
// Default values
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
|
-
const DEFAULT_FORMATS = [
|
|
13
|
+
const DEFAULT_FORMATS = [
|
|
14
|
+
'toml',
|
|
15
|
+
'json',
|
|
16
|
+
'jsonc',
|
|
17
|
+
'yaml',
|
|
18
|
+
];
|
|
14
19
|
// ---------------------------------------------------------------------------
|
|
15
20
|
// Internal helpers (defined before consumers — no-use-before-define)
|
|
16
21
|
// ---------------------------------------------------------------------------
|
|
@@ -117,7 +122,7 @@ const discoverConfigFile = async (name, formats, dotfile, startDir) => {
|
|
|
117
122
|
return undefined;
|
|
118
123
|
};
|
|
119
124
|
/** Resolve a config file — either from an explicit path or via discovery. */
|
|
120
|
-
const
|
|
125
|
+
const resolveAppConfigFile = async (name, schema, formats, dotfile, options) => {
|
|
121
126
|
const filePath = options?.path ??
|
|
122
127
|
(await discoverConfigFile(name, formats, dotfile, options?.cwd ?? process.cwd()));
|
|
123
128
|
if (filePath === undefined) {
|
|
@@ -159,13 +164,13 @@ export const appConfig = (name, options) => {
|
|
|
159
164
|
const { schema } = options;
|
|
160
165
|
return {
|
|
161
166
|
check: (values, checkOpts) => checkConfig(schema, values, checkOpts),
|
|
162
|
-
describe: () =>
|
|
167
|
+
describe: () => deriveConfigFields(schema),
|
|
163
168
|
dotfile,
|
|
164
|
-
explain: (explainOpts) =>
|
|
169
|
+
explain: (explainOpts) => deriveConfigProvenance({ ...explainOpts, schema }),
|
|
165
170
|
formats,
|
|
166
171
|
name,
|
|
167
172
|
ref: (fieldPath) => configRef(fieldPath),
|
|
168
|
-
resolve: (resolveOptions) =>
|
|
173
|
+
resolve: (resolveOptions) => resolveAppConfigFile(name, schema, formats, dotfile, resolveOptions),
|
|
169
174
|
schema,
|
|
170
175
|
};
|
|
171
176
|
};
|
package/dist/app-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config.js","sourceRoot":"","sources":["../src/app-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIxE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app-config.js","sourceRoot":"","sources":["../src/app-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIxE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,EAAE,cAAc,CAAC;QACtE,MAAM;KACP,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/compose.d.ts
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Config composition utilities for
|
|
2
|
+
* Config composition utilities for resources.
|
|
3
3
|
*
|
|
4
|
-
* Collects config schemas from
|
|
4
|
+
* Collects config schemas from resource declarations so they can be
|
|
5
5
|
* composed into a unified config structure via `defineConfig`.
|
|
6
6
|
*/
|
|
7
7
|
import type { z } from 'zod';
|
|
8
|
-
/** A
|
|
9
|
-
export interface
|
|
10
|
-
readonly
|
|
8
|
+
/** A resource config schema entry extracted from a resource declaration. */
|
|
9
|
+
export interface ResourceConfigEntry {
|
|
10
|
+
readonly resourceId: string;
|
|
11
11
|
readonly schema: z.ZodType;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/** Minimal shape needed to extract config from a provision-like object. */
|
|
16
|
-
interface ProvisionWithOptionalConfig {
|
|
13
|
+
/** Minimal shape needed to extract config from a resource-like object. */
|
|
14
|
+
interface ResourceWithOptionalConfig {
|
|
17
15
|
readonly id: string;
|
|
18
16
|
readonly config?: z.ZodType | undefined;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
|
-
* Collect config schemas from
|
|
19
|
+
* Collect config schemas from resources that declare them.
|
|
22
20
|
*
|
|
23
|
-
* Returns entries keyed by
|
|
24
|
-
*
|
|
21
|
+
* Returns entries keyed by resource ID for composition into `defineConfig`.
|
|
22
|
+
* Resources without a `config` schema are excluded.
|
|
25
23
|
*/
|
|
26
|
-
export declare const
|
|
27
|
-
/** Backward-compatible alias while the migration is in flight. */
|
|
28
|
-
export declare const collectServiceConfigs: (provisions: readonly ProvisionWithOptionalConfig[]) => ProvisionConfigEntry[];
|
|
24
|
+
export declare const collectResourceConfigs: (resources: readonly ResourceWithOptionalConfig[]) => ResourceConfigEntry[];
|
|
29
25
|
export {};
|
|
30
26
|
//# sourceMappingURL=compose.d.ts.map
|
package/dist/compose.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;CAC5B;AAED,0EAA0E;AAC1E,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC;CACzC;AAMD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,WAAW,SAAS,0BAA0B,EAAE,KAC/C,mBAAmB,EAQyC,CAAC"}
|
package/dist/compose.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Config composition utilities for
|
|
2
|
+
* Config composition utilities for resources.
|
|
3
3
|
*
|
|
4
|
-
* Collects config schemas from
|
|
4
|
+
* Collects config schemas from resource declarations so they can be
|
|
5
5
|
* composed into a unified config structure via `defineConfig`.
|
|
6
6
|
*/
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
// Public API
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
/**
|
|
11
|
-
* Collect config schemas from
|
|
11
|
+
* Collect config schemas from resources that declare them.
|
|
12
12
|
*
|
|
13
|
-
* Returns entries keyed by
|
|
14
|
-
*
|
|
13
|
+
* Returns entries keyed by resource ID for composition into `defineConfig`.
|
|
14
|
+
* Resources without a `config` schema are excluded.
|
|
15
15
|
*/
|
|
16
|
-
export const
|
|
16
|
+
export const collectResourceConfigs = (resources) => resources
|
|
17
17
|
.filter((svc) => svc.config !== undefined)
|
|
18
|
-
.map((svc) => ({
|
|
19
|
-
/** Backward-compatible alias while the migration is in flight. */
|
|
20
|
-
export const collectServiceConfigs = collectProvisionConfigs;
|
|
18
|
+
.map((svc) => ({ resourceId: svc.id, schema: svc.config }));
|
|
21
19
|
//# sourceMappingURL=compose.js.map
|
package/dist/compose.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,SAAgD,EACzB,EAAE,CACzB,SAAS;KACN,MAAM,CACL,CACE,GAAG,EACiE,EAAE,CACtE,GAAG,CAAC,MAAM,KAAK,SAAS,CAC3B;KACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC"}
|
package/dist/config-layer.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Config layer — attaches resolved config to the execution context.
|
|
3
3
|
*
|
|
4
4
|
* For v1, the layer is a pass-through: config resolution happens at
|
|
5
|
-
* bootstrap time and the
|
|
6
|
-
* config before any trail runs. The layer reserves a named slot so
|
|
7
|
-
*
|
|
5
|
+
* bootstrap time and the resource pipeline (TRL-91) injects the resolved
|
|
6
|
+
* config before any trail runs. The layer reserves a named slot so future
|
|
7
|
+
* versions can add per-trail config overrides or validation.
|
|
8
8
|
*/
|
|
9
9
|
import type { Layer } from '@ontrails/core';
|
|
10
10
|
export declare const configLayer: Layer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-resource.d.ts","sourceRoot":"","sources":["../src/config-resource.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,eAAO,MAAM,cAAc,gDAkBzB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Config
|
|
2
|
+
* Config resource — manages resolved config lifecycle.
|
|
3
3
|
*
|
|
4
4
|
* The config is resolved during bootstrap (two-phase init per ADR-010)
|
|
5
|
-
* and registered via `registerConfigState`. This
|
|
6
|
-
* global registry so trails can access it through `
|
|
5
|
+
* and registered via `registerConfigState`. This resource reads from the
|
|
6
|
+
* global registry so trails can access it through `configResource.from(ctx)`.
|
|
7
7
|
*/
|
|
8
|
-
import { InternalError, Result,
|
|
8
|
+
import { InternalError, Result, resource } from '@ontrails/core';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { getConfigState } from './registry.js';
|
|
11
|
-
export const
|
|
11
|
+
export const configResource = resource('config', {
|
|
12
12
|
create: () => {
|
|
13
13
|
const state = getConfigState();
|
|
14
14
|
if (state === undefined) {
|
|
@@ -23,4 +23,4 @@ export const configProvision = provision('config', {
|
|
|
23
23
|
schema: z.object({}),
|
|
24
24
|
}),
|
|
25
25
|
});
|
|
26
|
-
//# sourceMappingURL=config-
|
|
26
|
+
//# sourceMappingURL=config-resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-resource.js","sourceRoot":"","sources":["../src/config-resource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAc,QAAQ,EAAE;IAC5D,MAAM,EAAE,GAAG,EAAE;QACX,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,aAAa,CACf,qEAAqE,CACtE,CACF,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IACD,WAAW,EAAE,oCAAoC;IACjD,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE;IACpC,IAAI,EAAE,GAAgB,EAAE,CAAC,CAAC;QACxB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KACrB,CAAC;CACH,CAAC,CAAC"}
|
package/dist/define-config.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Trails-specific config wrapper — `appConfig('trails', ...)` with
|
|
3
|
-
* framework conventions for
|
|
3
|
+
* framework conventions for profile selection and local overrides.
|
|
4
4
|
*/
|
|
5
5
|
import type { z } from 'zod';
|
|
6
6
|
/** Options for defining a Trails app config. */
|
|
7
7
|
export interface DefineConfigOptions<T extends z.ZodType> {
|
|
8
8
|
readonly schema: T;
|
|
9
9
|
readonly base?: Partial<z.infer<T>>;
|
|
10
|
-
readonly
|
|
10
|
+
readonly profiles?: Record<string, Partial<z.infer<T>>>;
|
|
11
11
|
/** When true, fall back to `NODE_ENV` when `TRAILS_ENV` is unset. */
|
|
12
12
|
readonly envFromNodeEnv?: boolean;
|
|
13
13
|
}
|
|
14
14
|
/** Options passed to `resolve()` on a defined config. */
|
|
15
15
|
interface DefineConfigResolveOptions {
|
|
16
|
-
readonly
|
|
16
|
+
readonly profile?: string;
|
|
17
17
|
readonly env?: Record<string, string | undefined>;
|
|
18
18
|
/** Working directory for local overrides discovery. Defaults to `process.cwd()`. */
|
|
19
19
|
readonly cwd?: string;
|
|
@@ -22,7 +22,7 @@ interface DefineConfigResolveOptions {
|
|
|
22
22
|
* Define Trails app config.
|
|
23
23
|
*
|
|
24
24
|
* This is `appConfig('trails', ...)` with the framework's own conventions:
|
|
25
|
-
* `TRAILS_ENV` selects the
|
|
25
|
+
* `TRAILS_ENV` selects the profile. When `envFromNodeEnv` is true,
|
|
26
26
|
* `NODE_ENV` is used as a fallback when `TRAILS_ENV` is unset.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
@@ -33,7 +33,7 @@ interface DefineConfigResolveOptions {
|
|
|
33
33
|
* debug: z.boolean().default(false),
|
|
34
34
|
* }),
|
|
35
35
|
* base: { port: 8080 },
|
|
36
|
-
*
|
|
36
|
+
* profiles: {
|
|
37
37
|
* production: { debug: false },
|
|
38
38
|
* test: { debug: true, port: 0 },
|
|
39
39
|
* },
|
|
@@ -44,17 +44,17 @@ interface DefineConfigResolveOptions {
|
|
|
44
44
|
*/
|
|
45
45
|
export declare const defineConfig: <T extends z.ZodType>(options: DefineConfigOptions<T>) => {
|
|
46
46
|
base: Partial<z.core.output<T>> | undefined;
|
|
47
|
-
|
|
48
|
-
resolve: (resolveOpts?: DefineConfigResolveOptions) => Promise<import("
|
|
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
49
|
schema: T;
|
|
50
50
|
name: string;
|
|
51
51
|
formats: readonly import("./app-config.js").ConfigFormat[];
|
|
52
52
|
dotfile: boolean;
|
|
53
|
-
describe(): readonly import("./
|
|
53
|
+
describe(): readonly import("./derive-fields.js").FieldDescription[];
|
|
54
54
|
check(values: Record<string, unknown>, options?: {
|
|
55
55
|
readonly env?: Record<string, string | undefined>;
|
|
56
56
|
}): import("./doctor.js").CheckResult;
|
|
57
|
-
explain(options: import("./app-config.js").
|
|
57
|
+
explain(options: import("./app-config.js").AppConfigDeriveProvenanceOptions): readonly import("./derive-provenance.js").ProvenanceEntry[];
|
|
58
58
|
ref(fieldPath: string): import("./ref.js").ConfigRef;
|
|
59
59
|
};
|
|
60
60
|
export {};
|
|
@@ -1 +1 @@
|
|
|
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;;;
|
|
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
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Trails-specific config wrapper — `appConfig('trails', ...)` with
|
|
3
|
-
* framework conventions for
|
|
3
|
+
* framework conventions for profile selection and local overrides.
|
|
4
4
|
*/
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { appConfig } from './app-config.js';
|
|
8
|
-
import {
|
|
8
|
+
import { deriveConfig } from './resolve.js';
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
// Local overrides discovery
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
@@ -35,7 +35,7 @@ const discoverLocalOverrides = async (cwd, envRecord) => {
|
|
|
35
35
|
* Define Trails app config.
|
|
36
36
|
*
|
|
37
37
|
* This is `appConfig('trails', ...)` with the framework's own conventions:
|
|
38
|
-
* `TRAILS_ENV` selects the
|
|
38
|
+
* `TRAILS_ENV` selects the profile. When `envFromNodeEnv` is true,
|
|
39
39
|
* `NODE_ENV` is used as a fallback when `TRAILS_ENV` is unset.
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
@@ -46,7 +46,7 @@ const discoverLocalOverrides = async (cwd, envRecord) => {
|
|
|
46
46
|
* debug: z.boolean().default(false),
|
|
47
47
|
* }),
|
|
48
48
|
* base: { port: 8080 },
|
|
49
|
-
*
|
|
49
|
+
* profiles: {
|
|
50
50
|
* production: { debug: false },
|
|
51
51
|
* test: { debug: true, port: 0 },
|
|
52
52
|
* },
|
|
@@ -56,14 +56,11 @@ const discoverLocalOverrides = async (cwd, envRecord) => {
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
export const defineConfig = (options) => {
|
|
59
|
-
const config = appConfig('trails', {
|
|
60
|
-
formats: ['toml', 'json'],
|
|
61
|
-
schema: options.schema,
|
|
62
|
-
});
|
|
59
|
+
const config = appConfig('trails', { schema: options.schema });
|
|
63
60
|
return {
|
|
64
61
|
...config,
|
|
65
62
|
base: options.base,
|
|
66
|
-
|
|
63
|
+
profiles: options.profiles,
|
|
67
64
|
resolve: async (resolveOpts) => {
|
|
68
65
|
const envRecord = {
|
|
69
66
|
...(resolveOpts?.env ?? process.env),
|
|
@@ -75,12 +72,12 @@ export const defineConfig = (options) => {
|
|
|
75
72
|
}
|
|
76
73
|
const cwd = resolveOpts?.cwd ?? process.cwd();
|
|
77
74
|
const localOverrides = await discoverLocalOverrides(cwd, envRecord);
|
|
78
|
-
return
|
|
75
|
+
return deriveConfig({
|
|
79
76
|
base: options.base,
|
|
80
77
|
env: envRecord,
|
|
81
|
-
loadout: resolveOpts?.loadout ?? envRecord['TRAILS_ENV'],
|
|
82
|
-
loadouts: options.loadouts,
|
|
83
78
|
localOverrides,
|
|
79
|
+
profile: resolveOpts?.profile ?? envRecord['TRAILS_ENV'],
|
|
80
|
+
profiles: options.profiles,
|
|
84
81
|
schema: options.schema,
|
|
85
82
|
});
|
|
86
83
|
},
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,C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EAAE,SAAS,CAAC,CAAC;YAEpE,OAAO,YAAY,CAAC;gBAClB,IAAI,EAAE,OAAO,CAAC,IAA2C;gBACzD,GAAG,EAAE,SAAS;gBACd,cAAc;gBACd,OAAO,EAAE,WAAW,EAAE,OAAO,IAAI,SAAS,CAAC,YAAY,CAAC;gBACxD,QAAQ,EAAE,OAAO,CAAC,QAEL;gBACb,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;QACL,CAAC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -11,5 +11,5 @@ import type { z } from 'zod';
|
|
|
11
11
|
* Lists each env var with its type, default, and whether it is a secret.
|
|
12
12
|
* Returns an empty string when no env bindings are present.
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const deriveConfigEnvExample: (schema: z.ZodObject<Record<string, z.ZodType>>) => string;
|
|
15
15
|
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { collectConfigMeta } from '../collect.js';
|
|
2
2
|
import { isLikelySecret } from '../secret-heuristics.js';
|
|
3
|
-
import { formatValue, getDefault, getDescription,
|
|
3
|
+
import { formatValue, getDefault, getDescription, deriveFieldByPath, unwrap, zodTypeName, zodTypeToJsonSchema, } from './helpers.js';
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
// Helpers
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
@@ -40,7 +40,7 @@ const collectEnvEntries = (schema, meta) => {
|
|
|
40
40
|
if (!fieldMeta.env) {
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
|
-
const fieldSchema =
|
|
43
|
+
const fieldSchema = deriveFieldByPath(schema, path);
|
|
44
44
|
if (!fieldSchema) {
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
@@ -58,7 +58,7 @@ const collectEnvEntries = (schema, meta) => {
|
|
|
58
58
|
* Lists each env var with its type, default, and whether it is a secret.
|
|
59
59
|
* Returns an empty string when no env bindings are present.
|
|
60
60
|
*/
|
|
61
|
-
export const
|
|
61
|
+
export const deriveConfigEnvExample = (schema) => {
|
|
62
62
|
const entries = collectEnvEntries(schema, collectConfigMeta(schema));
|
|
63
63
|
return entries.length === 0 ? '' : entries.join('\n');
|
|
64
64
|
};
|
|
@@ -0,0 +1 @@
|
|
|
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,SAA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AI,IAAI,EAAE,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACnB,SAAS;QACX,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"}
|
|
@@ -11,6 +11,6 @@ type ExampleFormat = 'json' | 'jsonc' | 'toml' | 'yaml';
|
|
|
11
11
|
*
|
|
12
12
|
* Includes descriptions as comments, defaults shown, deprecated fields annotated.
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const deriveConfigExample: (schema: z.ZodObject<Record<string, z.ZodType>>, format: ExampleFormat) => string;
|
|
15
15
|
export {};
|
|
16
16
|
//# sourceMappingURL=example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -134,5 +134,5 @@ const formatters = {
|
|
|
134
134
|
*
|
|
135
135
|
* Includes descriptions as comments, defaults shown, deprecated fields annotated.
|
|
136
136
|
*/
|
|
137
|
-
export const
|
|
137
|
+
export const deriveConfigExample = (schema, format) => formatters[format](schema);
|
|
138
138
|
//# sourceMappingURL=example.js.map
|