@workflowai/code-generator
Advanced tools
Comparing version 1.0.7 to 1.0.8
import { JsonSchemaObject } from '@workflowai/schema'; | ||
export type FileDataProvider = 'fs-promise' | 'fetch' | 'axios'; | ||
export declare enum FileDataProvider { | ||
FILE_SYSTEM = "fs-promise", | ||
FETCH = "fetch", | ||
AXIOS = "axios" | ||
} | ||
type GeneratedCode = { | ||
@@ -4,0 +8,0 @@ language: 'bash' | 'typescript'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPlaygroundSnippets = void 0; | ||
exports.getPlaygroundSnippets = exports.FileDataProvider = void 0; | ||
const schema_1 = require("@workflowai/schema"); | ||
@@ -23,11 +23,17 @@ const beautify_1 = require("./beautify"); | ||
}; | ||
var FileDataProvider; | ||
(function (FileDataProvider) { | ||
FileDataProvider["FILE_SYSTEM"] = "fs-promise"; | ||
FileDataProvider["FETCH"] = "fetch"; | ||
FileDataProvider["AXIOS"] = "axios"; | ||
})(FileDataProvider || (exports.FileDataProvider = FileDataProvider = {})); | ||
const base64DataToFileDataProvider = (str, fileDataProvider) => { | ||
return str.replace(/"[-A-Za-z0-9+/]{50,}={0,3}"/g, { | ||
'fs-promise': 'readFile("/path/to/file")', | ||
fetch: '(await fetch("http://url.to/file")).arrayBuffer()', | ||
axios: '(await axios.get("http://url.to/file", { responseType: "arraybuffer" })).data', | ||
[FileDataProvider.FILE_SYSTEM]: 'readFile("/path/to/file")', | ||
[FileDataProvider.FETCH]: '(await fetch("http://url.to/file")).arrayBuffer()', | ||
[FileDataProvider.AXIOS]: '(await axios.get("http://url.to/file", { responseType: "arraybuffer" })).data', | ||
}[fileDataProvider]); | ||
}; | ||
const getPlaygroundSnippets = async (config) => { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = 'fs-promise', } = { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = FileDataProvider.FILE_SYSTEM, } = { | ||
...config, | ||
@@ -34,0 +40,0 @@ }; |
@@ -20,11 +20,17 @@ import { inputSchemaToZod, outputSchemaToZod, } from '@workflowai/schema'; | ||
}; | ||
export var FileDataProvider; | ||
(function (FileDataProvider) { | ||
FileDataProvider["FILE_SYSTEM"] = "fs-promise"; | ||
FileDataProvider["FETCH"] = "fetch"; | ||
FileDataProvider["AXIOS"] = "axios"; | ||
})(FileDataProvider || (FileDataProvider = {})); | ||
const base64DataToFileDataProvider = (str, fileDataProvider) => { | ||
return str.replace(/"[-A-Za-z0-9+/]{50,}={0,3}"/g, { | ||
'fs-promise': 'readFile("/path/to/file")', | ||
fetch: '(await fetch("http://url.to/file")).arrayBuffer()', | ||
axios: '(await axios.get("http://url.to/file", { responseType: "arraybuffer" })).data', | ||
[FileDataProvider.FILE_SYSTEM]: 'readFile("/path/to/file")', | ||
[FileDataProvider.FETCH]: '(await fetch("http://url.to/file")).arrayBuffer()', | ||
[FileDataProvider.AXIOS]: '(await axios.get("http://url.to/file", { responseType: "arraybuffer" })).data', | ||
}[fileDataProvider]); | ||
}; | ||
export const getPlaygroundSnippets = async (config) => { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = 'fs-promise', } = { | ||
const { taskId, taskName, schema, groupId, example, api, fileDataProvider = FileDataProvider.FILE_SYSTEM, } = { | ||
...config, | ||
@@ -31,0 +37,0 @@ }; |
import { JsonSchemaObject } from '@workflowai/schema'; | ||
export type FileDataProvider = 'fs-promise' | 'fetch' | 'axios'; | ||
export declare enum FileDataProvider { | ||
FILE_SYSTEM = "fs-promise", | ||
FETCH = "fetch", | ||
AXIOS = "axios" | ||
} | ||
type GeneratedCode = { | ||
@@ -4,0 +8,0 @@ language: 'bash' | 'typescript'; |
{ | ||
"name": "@workflowai/code-generator", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "workflowAI code-generator", | ||
@@ -5,0 +5,0 @@ "author": "workflowAI", |
Sorry, the diff of this file is not supported yet
16604
367