File tree Expand file tree Collapse file tree 5 files changed +25
-12
lines changed
Expand file tree Collapse file tree 5 files changed +25
-12
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @curatedotfun/object-transform" ,
3- "version" : " 0.0.6 " ,
3+ "version" : " 0.0.7 " ,
44 "description" : " Object transformation plugin for curatedotfun with configurable field mappings" ,
55 "main" : " ./dist/index.js" ,
66 "types" : " ./dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -367,4 +367,22 @@ describe("ObjectTransformer", () => {
367367 } ) ;
368368 } ) ;
369369 } ) ;
370+
371+ it ( "should not HTML-encode link fields" , async ( ) => {
372+ await transformer . initialize ( {
373+ mappings : {
374+ link : "{{url}}" ,
375+ } ,
376+ } ) ;
377+
378+ const result = await transformer . transform ( {
379+ input : {
380+ url : "https://example.com/some/path?query=string" ,
381+ } ,
382+ } ) ;
383+
384+ expect ( result ) . toEqual ( {
385+ link : "https://example.com/some/path?query=string" ,
386+ } ) ;
387+ } ) ;
370388} ) ;
Original file line number Diff line number Diff line change @@ -3,12 +3,6 @@ import { z } from "zod";
33import { format } from "date-fns" ;
44import type { TransformerPlugin , ActionArgs } from "@curatedotfun/types" ;
55
6- // Create a local copy of Mustache with custom settings
7- const localMustache = { ...Mustache } ;
8- localMustache . escape = function ( text ) {
9- return text ;
10- } ;
11-
126// Default template generators
137type TemplateGenerator = ( formatStr ?: string ) => string | number ;
148
@@ -83,7 +77,10 @@ export default class ObjectTransformer
8377 ) : unknown => {
8478 // Helper function to process template value
8579 const processTemplate = ( template : string ) => {
86- const rendered = localMustache . render ( template , inputData ) ;
80+ const originalEscape = Mustache . escape ;
81+ Mustache . escape = ( text ) => text ;
82+ const rendered = Mustache . render ( template , inputData ) ;
83+ Mustache . escape = originalEscape ;
8784
8885 // If the template references a field that's an array or object, return it directly
8986 const fieldMatch = template . match ( / ^ \{ \{ ( [ ^ } ] + ) \} \} $ / ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @curatedotfun/simple-transform" ,
3- "version" : " 0.0.8 " ,
3+ "version" : " 0.0.9 " ,
44 "description" : " Simple transform plugin for curatedotfun" ,
55 "main" : " ./dist/index.js" ,
66 "types" : " ./dist/index.d.ts" ,
Original file line number Diff line number Diff line change 11import Mustache from "mustache" ;
22import type { TransformerPlugin , ActionArgs } from "@curatedotfun/types" ;
33
4- const localMustache = { ...Mustache } ;
5-
64interface SimpleTransformerConfig extends Record < string , unknown > {
75 template : string ;
86}
@@ -23,7 +21,7 @@ export default class SimpleTransformer
2321 input,
2422 } : ActionArgs < unknown , SimpleTransformerConfig > ) : Promise < string > {
2523 try {
26- return localMustache . render ( this . template , input ) ;
24+ return Mustache . render ( this . template , input ) ;
2725 } catch ( error : unknown ) {
2826 const errorMessage =
2927 error instanceof Error ? error . message : "Unknown error occurred" ;
You can’t perform that action at this time.
0 commit comments