File tree Expand file tree Collapse file tree
src/schema/schemas/primitives Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,19 +86,29 @@ export const MemoryStrategySchema = z
8686 /** @deprecated Use `reflectionNamespaceTemplates` instead. */
8787 reflectionNamespaces : z . array ( z . string ( ) ) . optional ( ) ,
8888 } )
89- . refine ( strategy => ! ( strategy . namespaces !== undefined && strategy . namespaceTemplates !== undefined ) , {
89+ . refine ( strategy => ! ( ( strategy . namespaces ?. length ?? 0 ) > 0 && ( strategy . namespaceTemplates ?. length ?? 0 ) > 0 ) , {
9090 message :
9191 "'namespaces' and 'namespaceTemplates' are mutually exclusive. Prefer 'namespaceTemplates' ('namespaces' is deprecated)." ,
9292 path : [ 'namespaceTemplates' ] ,
9393 } )
9494 . refine (
95- strategy => ! ( strategy . reflectionNamespaces !== undefined && strategy . reflectionNamespaceTemplates !== undefined ) ,
95+ strategy =>
96+ ! ( ( strategy . reflectionNamespaces ?. length ?? 0 ) > 0 && ( strategy . reflectionNamespaceTemplates ?. length ?? 0 ) > 0 ) ,
9697 {
9798 message :
9899 "'reflectionNamespaces' and 'reflectionNamespaceTemplates' are mutually exclusive. Prefer 'reflectionNamespaceTemplates' ('reflectionNamespaces' is deprecated)." ,
99100 path : [ 'reflectionNamespaceTemplates' ] ,
100101 }
101102 )
103+ . refine (
104+ strategy =>
105+ strategy . type === 'EPISODIC' ||
106+ ( strategy . reflectionNamespaceTemplates === undefined && strategy . reflectionNamespaces === undefined ) ,
107+ {
108+ message : "'reflectionNamespaceTemplates' is only allowed on EPISODIC strategies" ,
109+ path : [ 'reflectionNamespaceTemplates' ] ,
110+ }
111+ )
102112 . refine (
103113 strategy => {
104114 if ( strategy . type !== 'EPISODIC' ) return true ;
You can’t perform that action at this time.
0 commit comments