File tree Expand file tree Collapse file tree
javascript/json-transform-core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @nlighten/json-transform-core" ,
33 "description" : " Core types and utilities for handling JSON transformers" ,
4- "version" : " 1.3.4 " ,
4+ "version" : " 1.4.0 " ,
55 "main" : " dist/json-transform-core.js" ,
66 "umd:main" : " dist/json-transform-core.umd.js" ,
77 "module" : " dist/json-transform-core.module.js" ,
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ class FunctionsParser {
137137 if ( func . overrides ) {
138138 for ( const override of func . overrides ) {
139139 if ( override . if . every ( c => args [ c . argument ] ?. toString ( ) . toUpperCase ( ) === c . equals ) ) {
140- func = { ... func , ... override . then } ; // replace func instance based on args
140+ func = override . then ; // replace func instance based on args
141141 break ;
142142 }
143143 }
@@ -164,7 +164,7 @@ class FunctionsParser {
164164 if ( func . overrides ) {
165165 for ( const override of func . overrides ) {
166166 if ( override . if . every ( c => data [ c . argument ] ?. toString ( ) . toUpperCase ( ) === c . equals ) ) {
167- func = { ... func , ... override . then } ; // replace func instance based on args
167+ func = override . then ; // replace func instance based on args
168168 break ;
169169 }
170170 }
Original file line number Diff line number Diff line change @@ -14,11 +14,14 @@ function parseSchemas<T extends string>(
1414 func . custom = true ;
1515 }
1616 if ( Array . isArray ( func . overrides ) ) {
17- func . overrides . forEach ( o => {
18- if ( o . then . outputSchema ) {
19- o . then . parsedOutputSchema = JSONSchemaUtils . parse ( o . then . outputSchema ) ;
20- }
21- } ) ;
17+ for ( let i = 0 ; i < func . overrides . length ; i ++ ) {
18+ const schemaOverride = func . overrides [ i ] . then . outputSchema ;
19+ func . overrides [ i ] = {
20+ ...func ,
21+ overrides : null ,
22+ parsedOutputSchema : schemaOverride && JSONSchemaUtils . parse ( schemaOverride ) ,
23+ } ;
24+ }
2225 }
2326 }
2427 return functions ;
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export type ArgumentCondition = {
103103
104104export type ConditionalOverrides = {
105105 if : ArgumentCondition [ ] ; // AND relationship
106- then : Partial < FunctionDescriptor > ;
106+ then : FunctionDescriptor ;
107107} ;
108108
109109export type FunctionDescriptor = {
@@ -116,7 +116,8 @@ export type FunctionDescriptor = {
116116 overrides ?: ConditionalOverrides [ ] ;
117117 /** For documentation purposes when output schema is calculated */
118118 outputSchemaTemplate ?: TypeSchema ;
119- deprecated ?: string ;
119+ /** should specify the alternative function that should be used instead **/
120+ deprecatedInFavorOf ?: string ;
120121 /** If set, this function does not alter the type of its primary argument */
121122 pipedType ?: boolean ;
122123 custom ?: boolean ;
You can’t perform that action at this time.
0 commit comments