feat: Convert all app files to JS
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
import listTransformOptions from './list-transform-options/index.js';
|
||||
|
||||
export default [listTransformOptions];
|
@@ -1,3 +0,0 @@
|
||||
import listTransformOptions from './list-transform-options';
|
||||
|
||||
export default [listTransformOptions];
|
@@ -1,11 +1,11 @@
|
||||
import formatOptions from './options/format';
|
||||
import timezoneOptions from './options/timezone';
|
||||
import formatOptions from './options/format.js';
|
||||
import timezoneOptions from './options/timezone.js';
|
||||
|
||||
const formatDateTime = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The datetime you want to format.',
|
||||
variables: true,
|
||||
@@ -13,7 +13,7 @@ const formatDateTime = [
|
||||
{
|
||||
label: 'From Format',
|
||||
key: 'fromFormat',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The format of the input.',
|
||||
variables: true,
|
||||
@@ -22,7 +22,7 @@ const formatDateTime = [
|
||||
{
|
||||
label: 'From Timezone',
|
||||
key: 'fromTimezone',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The timezone of the input.',
|
||||
variables: true,
|
||||
@@ -31,7 +31,7 @@ const formatDateTime = [
|
||||
{
|
||||
label: 'To Format',
|
||||
key: 'toFormat',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The format of the output.',
|
||||
variables: true,
|
||||
@@ -40,7 +40,7 @@ const formatDateTime = [
|
||||
{
|
||||
label: 'To Timezone',
|
||||
key: 'toTimezone',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The timezone of the output.',
|
||||
variables: true,
|
@@ -0,0 +1,42 @@
|
||||
import capitalize from './text/capitalize.js';
|
||||
import extractEmailAddress from './text/extract-email-address.js';
|
||||
import extractNumber from './text/extract-number.js';
|
||||
import htmlToMarkdown from './text/html-to-markdown.js';
|
||||
import lowercase from './text/lowercase.js';
|
||||
import markdownToHtml from './text/markdown-to-html.js';
|
||||
import pluralize from './text/pluralize.js';
|
||||
import replace from './text/replace.js';
|
||||
import trimWhitespace from './text/trim-whitespace.js';
|
||||
import useDefaultValue from './text/use-default-value.js';
|
||||
import performMathOperation from './numbers/perform-math-operation.js';
|
||||
import randomNumber from './numbers/random-number.js';
|
||||
import formatNumber from './numbers/format-number.js';
|
||||
import formatPhoneNumber from './numbers/format-phone-number.js';
|
||||
import formatDateTime from './date-time/format-date-time.js';
|
||||
|
||||
const options = {
|
||||
capitalize,
|
||||
extractEmailAddress,
|
||||
extractNumber,
|
||||
htmlToMarkdown,
|
||||
lowercase,
|
||||
markdownToHtml,
|
||||
pluralize,
|
||||
replace,
|
||||
trimWhitespace,
|
||||
useDefaultValue,
|
||||
performMathOperation,
|
||||
randomNumber,
|
||||
formatNumber,
|
||||
formatPhoneNumber,
|
||||
formatDateTime,
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'List fields after transform',
|
||||
key: 'listTransformOptions',
|
||||
|
||||
async run($) {
|
||||
return options[$.step.parameters.transform];
|
||||
},
|
||||
};
|
@@ -1,43 +0,0 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
import capitalize from './text/capitalize';
|
||||
import extractEmailAddress from './text/extract-email-address';
|
||||
import extractNumber from './text/extract-number';
|
||||
import htmlToMarkdown from './text/html-to-markdown';
|
||||
import lowercase from './text/lowercase';
|
||||
import markdownToHtml from './text/markdown-to-html';
|
||||
import pluralize from './text/pluralize';
|
||||
import replace from './text/replace';
|
||||
import trimWhitespace from './text/trim-whitespace';
|
||||
import useDefaultValue from './text/use-default-value';
|
||||
import performMathOperation from './numbers/perform-math-operation';
|
||||
import randomNumber from './numbers/random-number';
|
||||
import formatNumber from './numbers/format-number';
|
||||
import formatPhoneNumber from './numbers/format-phone-number';
|
||||
import formatDateTime from './date-time/format-date-time';
|
||||
|
||||
const options: IJSONObject = {
|
||||
capitalize,
|
||||
extractEmailAddress,
|
||||
extractNumber,
|
||||
htmlToMarkdown,
|
||||
lowercase,
|
||||
markdownToHtml,
|
||||
pluralize,
|
||||
replace,
|
||||
trimWhitespace,
|
||||
useDefaultValue,
|
||||
performMathOperation,
|
||||
randomNumber,
|
||||
formatNumber,
|
||||
formatPhoneNumber,
|
||||
formatDateTime,
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'List fields after transform',
|
||||
key: 'listTransformOptions',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
return options[$.step.parameters.transform as string];
|
||||
},
|
||||
};
|
@@ -2,7 +2,7 @@ const formatNumber = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The number you want to format.',
|
||||
variables: true,
|
||||
@@ -10,7 +10,7 @@ const formatNumber = [
|
||||
{
|
||||
label: 'Input Decimal Mark',
|
||||
key: 'inputDecimalMark',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The decimal mark of the input number.',
|
||||
variables: true,
|
||||
@@ -22,7 +22,7 @@ const formatNumber = [
|
||||
{
|
||||
label: 'To Format',
|
||||
key: 'toFormat',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The format you want to convert the number to.',
|
||||
variables: true,
|
@@ -1,10 +1,10 @@
|
||||
import phoneNumberCountryCodes from '../../../common/phone-number-country-codes';
|
||||
import phoneNumberCountryCodes from '../../../common/phone-number-country-codes.js';
|
||||
|
||||
const formatPhoneNumber = [
|
||||
{
|
||||
label: 'Phone Number',
|
||||
key: 'phoneNumber',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The phone number you want to format.',
|
||||
variables: true,
|
||||
@@ -12,7 +12,7 @@ const formatPhoneNumber = [
|
||||
{
|
||||
label: 'To Format',
|
||||
key: 'toFormat',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The format you want to convert the number to.',
|
||||
variables: true,
|
||||
@@ -25,7 +25,7 @@ const formatPhoneNumber = [
|
||||
{
|
||||
label: 'Phone Number Country Code',
|
||||
key: 'phoneNumberCountryCode',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The country code of the phone number. The default is US.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const performMathOperation = [
|
||||
{
|
||||
label: 'Math Operation',
|
||||
key: 'mathOperation',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'The math operation to perform.',
|
||||
variables: true,
|
||||
@@ -17,14 +17,14 @@ const performMathOperation = [
|
||||
{
|
||||
label: 'Values',
|
||||
key: 'values',
|
||||
type: 'dynamic' as const,
|
||||
type: 'dynamic',
|
||||
required: false,
|
||||
description: 'Add or remove numbers as needed.',
|
||||
fields: [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The number to perform the math operation on.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const randomNumber = [
|
||||
{
|
||||
label: 'Lower range',
|
||||
key: 'lowerRange',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The lowest number to generate.',
|
||||
variables: true,
|
||||
@@ -10,7 +10,7 @@ const randomNumber = [
|
||||
{
|
||||
label: 'Upper range',
|
||||
key: 'upperRange',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The highest number to generate.',
|
||||
variables: true,
|
||||
@@ -18,7 +18,7 @@ const randomNumber = [
|
||||
{
|
||||
label: 'Decimal points',
|
||||
key: 'decimalPoints',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description:
|
||||
'The number of digits after the decimal point. It can be an integer between 0 and 15.',
|
@@ -2,7 +2,7 @@ const capitalize = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text that will be capitalized.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const extractEmailAddress = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text that will be searched for an email address.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const extractNumber = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text that will be searched for a number.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const htmlToMarkdown = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'HTML that will be converted to Markdown.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const lowercase = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text that will be lowercased.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const markdownToHtml = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Markdown text that will be converted to HTML.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const pluralize = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text that will be pluralized.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const replace = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text that you want to search for and replace values.',
|
||||
variables: true,
|
||||
@@ -10,7 +10,7 @@ const replace = [
|
||||
{
|
||||
label: 'Find',
|
||||
key: 'find',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text that will be searched for.',
|
||||
variables: true,
|
||||
@@ -18,7 +18,7 @@ const replace = [
|
||||
{
|
||||
label: 'Replace',
|
||||
key: 'replace',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'Text that will replace the found text.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const trimWhitespace = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text you want to remove leading and trailing spaces.',
|
||||
variables: true,
|
@@ -2,7 +2,7 @@ const useDefaultValue = [
|
||||
{
|
||||
label: 'Input',
|
||||
key: 'input',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text you want to check whether it is empty or not.',
|
||||
variables: true,
|
||||
@@ -10,7 +10,7 @@ const useDefaultValue = [
|
||||
{
|
||||
label: 'Default Value',
|
||||
key: 'defaultValue',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description:
|
||||
'Text that will be used as a default value if the input is empty.',
|
Reference in New Issue
Block a user