@workflowai/code-generator
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -29,2 +29,3 @@ import { JsonSchemaObject } from '@workflowai/schema'; | ||
fileDataProvider?: FileDataProvider; | ||
descriptionAsComments?: boolean; | ||
}; | ||
@@ -31,0 +32,0 @@ type GetPlaygroundSnippetsResult = { |
@@ -23,7 +23,7 @@ "use strict"; | ||
}; | ||
const cleanZodDescribe = (code) => { | ||
const cleanZodDescribe = (code, asComments) => { | ||
const lines = code.split('\n'); | ||
const cleanLines = lines.map((line) => { | ||
return line.replace(/^(\s*)(("[^"]+": z\.)?.*)\.describe\("([^"]+)"\)/, (_match, indents, pre, prop, description) => { | ||
if (prop) { | ||
if (prop && asComments) { | ||
return `${indents}/**\n${indents} * ${description}\n${indents} */\n${indents}${pre}`; | ||
@@ -52,3 +52,3 @@ } | ||
const getPlaygroundSnippets = async (config) => { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = FileDataProvider.FILE_SYSTEM, } = { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = FileDataProvider.FILE_SYSTEM, descriptionAsComments, } = { | ||
...config, | ||
@@ -106,3 +106,3 @@ }; | ||
}, | ||
})`))} | ||
})`), !!descriptionAsComments)} | ||
`.trim(), | ||
@@ -109,0 +109,0 @@ }, |
@@ -20,7 +20,7 @@ import { inputSchemaToZod, outputSchemaToZod, } from '@workflowai/schema'; | ||
}; | ||
const cleanZodDescribe = (code) => { | ||
const cleanZodDescribe = (code, asComments) => { | ||
const lines = code.split('\n'); | ||
const cleanLines = lines.map((line) => { | ||
return line.replace(/^(\s*)(("[^"]+": z\.)?.*)\.describe\("([^"]+)"\)/, (_match, indents, pre, prop, description) => { | ||
if (prop) { | ||
if (prop && asComments) { | ||
return `${indents}/**\n${indents} * ${description}\n${indents} */\n${indents}${pre}`; | ||
@@ -49,3 +49,3 @@ } | ||
export const getPlaygroundSnippets = async (config) => { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = FileDataProvider.FILE_SYSTEM, } = { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = FileDataProvider.FILE_SYSTEM, descriptionAsComments, } = { | ||
...config, | ||
@@ -103,3 +103,3 @@ }; | ||
}, | ||
})`))} | ||
})`), !!descriptionAsComments)} | ||
`.trim(), | ||
@@ -106,0 +106,0 @@ }, |
@@ -29,2 +29,3 @@ import { JsonSchemaObject } from '@workflowai/schema'; | ||
fileDataProvider?: FileDataProvider; | ||
descriptionAsComments?: boolean; | ||
}; | ||
@@ -31,0 +32,0 @@ type GetPlaygroundSnippetsResult = { |
{ | ||
"name": "@workflowai/code-generator", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "workflowAI code-generator", | ||
@@ -5,0 +5,0 @@ "author": "workflowAI", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18073
403