diff --git a/apps/web/public/images/connectors/binance.png b/apps/web/public/images/connectors/binance.png index 3c01aca3..0925f19a 100644 Binary files a/apps/web/public/images/connectors/binance.png and b/apps/web/public/images/connectors/binance.png differ diff --git a/apps/web/public/images/connectors/math-helper.png b/apps/web/public/images/connectors/math-helper.png new file mode 100644 index 00000000..3ce86e7c Binary files /dev/null and b/apps/web/public/images/connectors/math-helper.png differ diff --git a/apps/web/public/images/connectors/stripe.png b/apps/web/public/images/connectors/stripe.png index e106fdff..8e94cf2a 100644 Binary files a/apps/web/public/images/connectors/stripe.png and b/apps/web/public/images/connectors/stripe.png differ diff --git a/libs/connectors/math-helper/.eslintrc.json b/libs/connectors/math-helper/.eslintrc.json new file mode 100644 index 00000000..c9748d24 --- /dev/null +++ b/libs/connectors/math-helper/.eslintrc.json @@ -0,0 +1,25 @@ +{ + "extends": ["../../../.eslintrc.base.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": "error" + } + } + ] +} diff --git a/libs/connectors/math-helper/README.md b/libs/connectors/math-helper/README.md new file mode 100644 index 00000000..81f09e02 --- /dev/null +++ b/libs/connectors/math-helper/README.md @@ -0,0 +1,7 @@ +# connectors-math-helper + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build connectors-math-helper` to build the library. diff --git a/libs/connectors/math-helper/package.json b/libs/connectors/math-helper/package.json new file mode 100644 index 00000000..5d3f563b --- /dev/null +++ b/libs/connectors/math-helper/package.json @@ -0,0 +1,10 @@ +{ + "name": "@linkerry/math-helper", + "version": "0.0.1", + "dependencies": { + "tslib": "^2.3.0" + }, + "type": "commonjs", + "main": "./src/index.js", + "typings": "./src/index.d.ts" +} diff --git a/libs/connectors/math-helper/project.json b/libs/connectors/math-helper/project.json new file mode 100644 index 00000000..44e54384 --- /dev/null +++ b/libs/connectors/math-helper/project.json @@ -0,0 +1,21 @@ +{ + "name": "connectors-math-helper", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/connectors/math-helper/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/connectors/math-helper", + "main": "libs/connectors/math-helper/src/index.ts", + "tsConfig": "libs/connectors/math-helper/tsconfig.lib.json", + "assets": ["libs/connectors/math-helper/*.md"], + "buildableProjectDepsInPackageJsonType": "dependencies", + "updateBuildableProjectDepsInPackageJson": true + } + } + } +} diff --git a/libs/connectors/math-helper/src/actions/addition.ts b/libs/connectors/math-helper/src/actions/addition.ts new file mode 100644 index 00000000..c8ec3174 --- /dev/null +++ b/libs/connectors/math-helper/src/actions/addition.ts @@ -0,0 +1,32 @@ +import { ConnectorAuth, Property, createAction } from '@linkerry/connectors-framework' + +export const addition = createAction({ + name: 'addition_math', + auth: ConnectorAuth.None(), + displayName: 'Addition', + description: 'Add the first number and the second number', + descriptionLong: 'Add the first number and the second number', + errorHandlingOptions: { + continueOnFailure: { + hide: true, + }, + retryOnFailure: { + hide: true, + }, + }, + props: { + first_number: Property.Number({ + displayName: 'First Number', + description: undefined, + required: true, + }), + second_number: Property.Number({ + displayName: 'Second Number', + description: undefined, + required: true, + }), + }, + async run(context) { + return context.propsValue['first_number'] + context.propsValue['second_number'] + }, +}) diff --git a/libs/connectors/math-helper/src/actions/division.ts b/libs/connectors/math-helper/src/actions/division.ts new file mode 100644 index 00000000..9f66f93b --- /dev/null +++ b/libs/connectors/math-helper/src/actions/division.ts @@ -0,0 +1,40 @@ +import { + ConnectorAuth, + Property, + Validators, + createAction, +} from '@linkerry/connectors-framework'; + +export const division = createAction({ + name: 'division_math', + auth: ConnectorAuth.None(), + displayName: 'Division', + description: 'Divide first number by the second number', + descriptionLong: 'Divide first number by the second number', + errorHandlingOptions: { + continueOnFailure: { + hide: true, + }, + retryOnFailure: { + hide: true, + }, + }, + props: { + first_number: Property.Number({ + displayName: 'First Number', + description: undefined, + required: true, + }), + second_number: Property.Number({ + displayName: 'Second Number', + description: undefined, + required: true, + validators: [Validators.nonZero], + }), + }, + async run(context) { + return ( + context.propsValue['first_number'] / context.propsValue['second_number'] + ); + }, +}); diff --git a/libs/connectors/math-helper/src/actions/generateRandom.ts b/libs/connectors/math-helper/src/actions/generateRandom.ts new file mode 100644 index 00000000..0b52776e --- /dev/null +++ b/libs/connectors/math-helper/src/actions/generateRandom.ts @@ -0,0 +1,38 @@ +import { + ConnectorAuth, + Property, + createAction, +} from '@linkerry/connectors-framework'; + +export const generateRandom = createAction({ + name: 'generateRandom_math', + auth: ConnectorAuth.None(), + displayName: 'Generate Random Number', + description: 'Generate random number between two numbers (inclusive)', + descriptionLong: 'Generate random number between two numbers (inclusive)', + errorHandlingOptions: { + continueOnFailure: { + hide: true, + }, + retryOnFailure: { + hide: true, + }, + }, + props: { + first_number: Property.Number({ + displayName: 'First Number', + description: undefined, + required: true, + }), + second_number: Property.Number({ + displayName: 'Second Number', + description: undefined, + required: true, + }), + }, + async run(context) { + const min = context.propsValue['first_number']; + const max = context.propsValue['second_number']; + return Math.floor(Math.random() * (max - min + 1) + min); + }, +}); diff --git a/libs/connectors/math-helper/src/actions/modulo.ts b/libs/connectors/math-helper/src/actions/modulo.ts new file mode 100644 index 00000000..8378a8d3 --- /dev/null +++ b/libs/connectors/math-helper/src/actions/modulo.ts @@ -0,0 +1,38 @@ +import { + ConnectorAuth, + Property, + createAction, +} from '@linkerry/connectors-framework'; + +export const modulo = createAction({ + name: 'modulo_math', + auth: ConnectorAuth.None(), + displayName: 'Modulo', + description: 'Get the remainder of the first number divided by second number', + descriptionLong: 'Get the remainder of the first number divided by second number', + errorHandlingOptions: { + continueOnFailure: { + hide: true, + }, + retryOnFailure: { + hide: true, + }, + }, + props: { + first_number: Property.Number({ + displayName: 'First Number', + description: undefined, + required: true, + }), + second_number: Property.Number({ + displayName: 'Second Number', + description: undefined, + required: true, + }), + }, + async run(context) { + return ( + context.propsValue['first_number'] % context.propsValue['second_number'] + ); + }, +}); diff --git a/libs/connectors/math-helper/src/actions/multiplication.ts b/libs/connectors/math-helper/src/actions/multiplication.ts new file mode 100644 index 00000000..362dfdfe --- /dev/null +++ b/libs/connectors/math-helper/src/actions/multiplication.ts @@ -0,0 +1,38 @@ +import { + ConnectorAuth, + Property, + createAction, +} from '@linkerry/connectors-framework'; + +export const multiplication = createAction({ + name: 'multiplication_math', + auth: ConnectorAuth.None(), + displayName: 'Multiplication', + description: 'Multiply first number by the second number', + descriptionLong: 'Multiply first number by the second number', + errorHandlingOptions: { + continueOnFailure: { + hide: true, + }, + retryOnFailure: { + hide: true, + }, + }, + props: { + first_number: Property.Number({ + displayName: 'First Number', + description: undefined, + required: true, + }), + second_number: Property.Number({ + displayName: 'Second Number', + description: undefined, + required: true, + }), + }, + async run(context) { + return ( + context.propsValue['first_number'] * context.propsValue['second_number'] + ); + }, +}); diff --git a/libs/connectors/math-helper/src/actions/subtraction.ts b/libs/connectors/math-helper/src/actions/subtraction.ts new file mode 100644 index 00000000..21fef781 --- /dev/null +++ b/libs/connectors/math-helper/src/actions/subtraction.ts @@ -0,0 +1,38 @@ +import { + ConnectorAuth, + Property, + createAction, +} from '@linkerry/connectors-framework'; + +export const subtraction = createAction({ + name: 'subtraction_math', + auth: ConnectorAuth.None(), + displayName: 'Subtraction', + description: 'Subtract the first number from the second number', + descriptionLong: 'Subtract the first number from the second number', + errorHandlingOptions: { + continueOnFailure: { + hide: true, + }, + retryOnFailure: { + hide: true, + }, + }, + props: { + first_number: Property.Number({ + displayName: 'First Number', + description: undefined, + required: true, + }), + second_number: Property.Number({ + displayName: 'Second Number', + description: undefined, + required: true, + }), + }, + async run(context) { + return ( + context.propsValue['second_number'] - context.propsValue['first_number'] + ); + }, +}); diff --git a/libs/connectors/math-helper/src/index.ts b/libs/connectors/math-helper/src/index.ts new file mode 100644 index 00000000..fe76da68 --- /dev/null +++ b/libs/connectors/math-helper/src/index.ts @@ -0,0 +1,20 @@ +import { ConnectorAuth, createConnector } from '@linkerry/connectors-framework' +import { addition } from './actions/addition' +import { division } from './actions/division' +import { generateRandom } from './actions/generateRandom' +import { modulo } from './actions/modulo' +import { multiplication } from './actions/multiplication' +import { subtraction } from './actions/subtraction' + + +export const math = createConnector({ + displayName: 'Math Helper', + description: 'Perform mathematical operations on a data.', + descriptionLong: 'Perform mathematical operations on data. For example, if the input data you want to use is in a different annotation format (e.g., $14 as 1400), you can divide it and create a new annotation number to fit your other input.', + auth: ConnectorAuth.None(), + minimumSupportedRelease: '0.0.0', + logoUrl: '/images/connectors/math-helper.png', + tags: ['data management', 'core'], + actions: [addition, subtraction, multiplication, division, modulo, generateRandom], + triggers: [], +}) diff --git a/libs/connectors/math-helper/tsconfig.json b/libs/connectors/math-helper/tsconfig.json new file mode 100644 index 00000000..f2400abe --- /dev/null +++ b/libs/connectors/math-helper/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/libs/connectors/math-helper/tsconfig.lib.json b/libs/connectors/math-helper/tsconfig.lib.json new file mode 100644 index 00000000..8f9c818e --- /dev/null +++ b/libs/connectors/math-helper/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/libs/connectors/openai/src/actions/transcriptions.ts b/libs/connectors/openai/src/actions/transcriptions.ts index 3f05cac6..756b1493 100644 --- a/libs/connectors/openai/src/actions/transcriptions.ts +++ b/libs/connectors/openai/src/actions/transcriptions.ts @@ -3,7 +3,7 @@ // // HttpMethod, // // httpClient, // // } from '@activepieces/pieces-common'; -// // import { Property, createAction } from '@activepieces/pieces-framework'; +// // import { Property, createAction } from '@linkerry/connectors-framework'; // // import { openaiAuth } from '../..'; // // import FormData from 'form-data'; // // import mime from 'mime-types'; diff --git a/libs/connectors/openai/src/actions/translation.ts b/libs/connectors/openai/src/actions/translation.ts index 0965cc36..97ed20d1 100644 --- a/libs/connectors/openai/src/actions/translation.ts +++ b/libs/connectors/openai/src/actions/translation.ts @@ -3,7 +3,7 @@ // HttpMethod, // httpClient, // } from '@activepieces/pieces-common'; -// import { Property, createAction } from '@activepieces/pieces-framework'; +// import { Property, createAction } from '@linkerry/connectors-framework'; // import { openaiAuth } from '../..'; // import FormData from 'form-data'; // import mime from 'mime-types'; diff --git a/tsconfig.base.json b/tsconfig.base.json index 58373173..13918adf 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -22,9 +22,10 @@ "@linkerry/common-exchanges": ["libs/connectors/common-exchanges/src/index.ts"], "@linkerry/connectors-common": ["libs/connectors/common/src/index.ts"], "@linkerry/connectors-framework": ["libs/connectors/framework/src/index.ts"], - "@linkerry/fakturownia": ["libs/connectors/fakturownia/src/index.ts"], + "@linkerry/math-helper": ["libs/connectors/math-helper/src/index.ts"], "@linkerry/discord": ["libs/connectors/discord/src/index.ts"], "@linkerry/engine": ["libs/engine/src/index.ts"], + "@linkerry/fakturownia": ["libs/connectors/fakturownia/src/index.ts"], "@linkerry/google-sheets": ["libs/connectors/google-sheets/src/index.ts"], "@linkerry/kucoin": ["libs/connectors/kucoin/src/index.ts"], "@linkerry/linkerry-schedule": ["libs/connectors/schedule/src/index.ts"],