File tree Expand file tree Collapse file tree 6 files changed +35
-23
lines changed
Expand file tree Collapse file tree 6 files changed +35
-23
lines changed Original file line number Diff line number Diff line change 11export default {
22 preset : "ts-jest" ,
33 testEnvironment : "node" ,
4- testMatch : [ "**/src/__tests__/**/*.ts?(x)" , "**/src/?(*.)+(spec|test).ts?(x)" ] ,
4+ testMatch : [
5+ "**/src/__tests__/**/*.ts?(x)" ,
6+ "**/src/?(*.)+(spec|test).ts?(x)" ,
7+ ] ,
58 collectCoverageFrom : [ "src/**/*.ts" ] ,
69 coveragePathIgnorePatterns : [ "/node_modules/" , "__tests__" ] ,
710 testPathIgnorePatterns : [ "/node_modules/" , "/dist/" ] ,
811 transform : {
9- "^.+\\.tsx?$" : [ "ts-jest" , { } ]
10- }
12+ "^.+\\.tsx?$" : [ "ts-jest" , { } ] ,
13+ } ,
1114} ;
Original file line number Diff line number Diff line change @@ -12,18 +12,22 @@ describe("idRef", () => {
1212
1313 // Should validate UUIDs like the original schema's domainId
1414 expect ( ( ) => refField . parse ( "not-a-uuid" ) ) . toThrow ( ) ;
15- expect ( ( ) => refField . parse ( "123e4567-e89b-12d3-a456-426614174000" ) ) . not . toThrow ( ) ;
15+ expect ( ( ) =>
16+ refField . parse ( "123e4567-e89b-12d3-a456-426614174000" ) ,
17+ ) . not . toThrow ( ) ;
1618 } ) ;
1719
1820 it ( "should add reference metadata" , ( ) => {
1921 const refField = idRef ( TestSchema , "domainId" , "TestEntity" ) ;
2022
2123 expect ( refField ) . toBeDefined ( ) ;
2224 expect ( z . globalRegistry . has ( refField ) ) . toBe ( true ) ;
23- expect ( z . globalRegistry . get ( refField ) ) . toEqual ( expect . objectContaining ( {
24- title : "TestEntity ID Reference" ,
25- description : "Reference to a TestEntity by its unique identifier" ,
26- } ) ) ;
25+ expect ( z . globalRegistry . get ( refField ) ) . toEqual (
26+ expect . objectContaining ( {
27+ title : "TestEntity ID Reference" ,
28+ description : "Reference to a TestEntity by its unique identifier" ,
29+ } ) ,
30+ ) ;
2731 } ) ;
2832
2933 it ( "should use custom ID field name when provided" , ( ) => {
Original file line number Diff line number Diff line change 1- import { z } from ' zod' ;
1+ import { z } from " zod" ;
22
33/**
44 * Deployment / execution environment identifier.
55 * Intentionally liberal; constrain in callers as needed.
66 */
7- export const $Environment = z . string ( ) . meta ( {
8- title : ' Environment' ,
9- description : ' The environment in which the configuration has effect' ,
10- examples : [ ' dev' , ' int' , ' prod' ] ,
7+ const $Environment = z . string ( ) . meta ( {
8+ title : " Environment" ,
9+ description : " The environment in which the configuration has effect" ,
10+ examples : [ " dev" , " int" , " prod" ] ,
1111} ) ;
12+
13+ export default $Environment ;
Original file line number Diff line number Diff line change @@ -24,15 +24,19 @@ import { z } from "zod";
2424// Overload for when a specific ID field is provided
2525export function idRef <
2626 T extends z . ZodObject < Record < string , z . ZodTypeAny > > ,
27- K extends keyof T [ "shape" ] & string
27+ K extends keyof T [ "shape" ] & string ,
2828> ( schema : T , idFieldName : K , entityName ?: string ) : T [ "shape" ] [ K ] ;
2929
3030// Overload for when using the default "domainId" field
3131export function idRef <
3232 T extends z . ZodObject < Record < string , z . ZodTypeAny > > & {
33- shape : { domainId : z . ZodTypeAny }
34- }
35- > ( schema : T , idFieldName ?: undefined , entityName ?: string ) : T [ "shape" ] [ "domainId" ] ;
33+ shape : { domainId : z . ZodTypeAny } ;
34+ } ,
35+ > (
36+ schema : T ,
37+ idFieldName ?: undefined ,
38+ entityName ?: string ,
39+ ) : T [ "shape" ] [ "domainId" ] ;
3640
3741// Implementation
3842export function idRef <
Original file line number Diff line number Diff line change 44 */
55
66// Export all helpers
7- export * from ' ./version' ;
8- export * from ' ./environment' ;
7+ export * from " ./version" ;
8+ export { default as $Environment } from " ./environment" ;
99export * from "./id-ref" ;
10- export * from "../../events/src/domain/domain-base" ;
Original file line number Diff line number Diff line change 1- import { z } from ' zod' ;
1+ import { z } from " zod" ;
22
33/**
44 * Semantic version (major.minor.patch) with numeric segments only.
55 * Branded for nominal typing.
66 */
77export const $Version = z
88 . string ( )
9- . regex ( / ^ [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + $ / )
10- . brand ( ' Version' ) ;
9+ . regex ( / ^ \d + \. \d + \. \d + $ / )
10+ . brand ( " Version" ) ;
1111
1212export type Version = z . infer < typeof $Version > ;
You can’t perform that action at this time.
0 commit comments