@ontrails/core 1.0.0-beta.5 → 1.0.0-beta.7
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 +12 -0
- package/dist/type-utils.d.ts +4 -5
- package/dist/type-utils.d.ts.map +1 -1
- package/dist/type-utils.js +2 -2
- package/dist/type-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/type-utils.test.ts +7 -0
- package/src/type-utils.ts +5 -6
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ontrails/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.7
|
|
4
|
+
|
|
5
|
+
## 1.0.0-beta.6
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- Fix Codex review findings on type-utils and follow-declarations.
|
|
10
|
+
|
|
11
|
+
**core**: `inputOf()`/`outputOf()` now preserve the exact Zod schema subtype instead of widening to `z.ZodType`.
|
|
12
|
+
|
|
13
|
+
**warden**: `follow-declarations` rule now recognizes single-object trail overload, detects any context parameter name (not just `ctx`), matches destructured `follow()` calls, resolves const identifiers in `follow` arrays, and restricts run body extraction to top-level config properties.
|
|
14
|
+
|
|
3
15
|
## 1.0.0-beta.5
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/type-utils.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type utilities for extracting input/output types from trails.
|
|
3
3
|
*/
|
|
4
|
-
import type { z } from 'zod';
|
|
5
4
|
import type { AnyTrail, Trail } from './trail.js';
|
|
6
5
|
/** Extract the input type from a Trail. */
|
|
7
6
|
export type TrailInput<T extends AnyTrail> = T extends Trail<infer I, any> ? I : never;
|
|
8
7
|
/** Extract the output type from a Trail. */
|
|
9
8
|
export type TrailOutput<T extends AnyTrail> = T extends Trail<any, infer O> ? O : never;
|
|
10
|
-
/** Get the input Zod schema from a trail. */
|
|
11
|
-
export declare const inputOf: <
|
|
12
|
-
/** Get the output Zod schema from a trail, if defined. */
|
|
13
|
-
export declare const outputOf: <
|
|
9
|
+
/** Get the input Zod schema from a trail, preserving the specific schema type. */
|
|
10
|
+
export declare const inputOf: <T extends AnyTrail>(trail: T) => T["input"];
|
|
11
|
+
/** Get the output Zod schema from a trail, if defined, preserving the specific schema type. */
|
|
12
|
+
export declare const outputOf: <T extends AnyTrail>(trail: T) => T["output"];
|
|
14
13
|
//# sourceMappingURL=type-utils.d.ts.map
|
package/dist/type-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAQlD,2CAA2C;AAC3C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,QAAQ,IACvC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,IACxC,CAAC,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAQ5C,kFAAkF;AAClF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,QAAQ,EAAE,OAAO,CAAC,KAAG,CAAC,CAAC,OAAO,CACnD,CAAC;AAEd,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,QAAQ,EAAE,OAAO,CAAC,KAAG,CAAC,CAAC,QAAQ,CACpD,CAAC"}
|
package/dist/type-utils.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
// Runtime schema accessors
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
|
-
/** Get the input Zod schema from a trail. */
|
|
8
|
+
/** Get the input Zod schema from a trail, preserving the specific schema type. */
|
|
9
9
|
export const inputOf = (trail) => trail.input;
|
|
10
|
-
/** Get the output Zod schema from a trail, if defined. */
|
|
10
|
+
/** Get the output Zod schema from a trail, if defined, preserving the specific schema type. */
|
|
11
11
|
export const outputOf = (trail) => trail.output;
|
|
12
12
|
//# sourceMappingURL=type-utils.js.map
|
package/dist/type-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,mCAAmC;AAEnC,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E,kFAAkF;AAClF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAqB,KAAQ,EAAc,EAAE,CAClE,KAAK,CAAC,KAAK,CAAC;AAEd,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAqB,KAAQ,EAAe,EAAE,CACpE,KAAK,CAAC,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -30,6 +30,13 @@ describe('type-utils', () => {
|
|
|
30
30
|
name: 'Alice',
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
test('preserves specific schema type so .shape is accessible', () => {
|
|
35
|
+
const schema = inputOf(greetTrail);
|
|
36
|
+
// .shape is only available on z.ZodObject, not the broader z.ZodType
|
|
37
|
+
expect(schema.shape).toBeDefined();
|
|
38
|
+
expect(schema.shape.name).toBeDefined();
|
|
39
|
+
});
|
|
33
40
|
});
|
|
34
41
|
|
|
35
42
|
describe('outputOf', () => {
|
package/src/type-utils.ts
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* Type utilities for extracting input/output types from trails.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { z } from 'zod';
|
|
6
|
-
|
|
7
5
|
import type { AnyTrail, Trail } from './trail.js';
|
|
8
6
|
|
|
9
7
|
// ---------------------------------------------------------------------------
|
|
@@ -26,9 +24,10 @@ export type TrailOutput<T extends AnyTrail> =
|
|
|
26
24
|
// Runtime schema accessors
|
|
27
25
|
// ---------------------------------------------------------------------------
|
|
28
26
|
|
|
29
|
-
/** Get the input Zod schema from a trail. */
|
|
30
|
-
export const inputOf = <
|
|
27
|
+
/** Get the input Zod schema from a trail, preserving the specific schema type. */
|
|
28
|
+
export const inputOf = <T extends AnyTrail>(trail: T): T['input'] =>
|
|
29
|
+
trail.input;
|
|
31
30
|
|
|
32
|
-
/** Get the output Zod schema from a trail, if defined. */
|
|
33
|
-
export const outputOf = <
|
|
31
|
+
/** Get the output Zod schema from a trail, if defined, preserving the specific schema type. */
|
|
32
|
+
export const outputOf = <T extends AnyTrail>(trail: T): T['output'] =>
|
|
34
33
|
trail.output;
|