feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -2,7 +2,7 @@ export const fields = [
{
label: 'Client Name',
key: 'clientName',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -10,7 +10,7 @@ export const fields = [
{
label: 'Contact First Name',
key: 'contactFirstName',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -18,7 +18,7 @@ export const fields = [
{
label: 'Contact Last Name',
key: 'contactLastName',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -26,7 +26,7 @@ export const fields = [
{
label: 'Contact Email',
key: 'contactEmail',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -34,7 +34,7 @@ export const fields = [
{
label: 'Contact Phone',
key: 'contactPhone',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -42,7 +42,7 @@ export const fields = [
{
label: 'Language Code',
key: 'languageCode',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: '',
variables: true,
@@ -92,7 +92,7 @@ export const fields = [
{
label: 'Currency Code',
key: 'currencyCode',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: '',
variables: true,
@@ -220,7 +220,7 @@ export const fields = [
{
label: 'Id Number',
key: 'idNumber',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -228,7 +228,7 @@ export const fields = [
{
label: 'Vat Number',
key: 'vatNumber',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -236,7 +236,7 @@ export const fields = [
{
label: 'Street Address',
key: 'streetAddress',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -244,7 +244,7 @@ export const fields = [
{
label: 'Apt/Suite',
key: 'aptSuite',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -252,7 +252,7 @@ export const fields = [
{
label: 'City',
key: 'city',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -260,7 +260,7 @@ export const fields = [
{
label: 'State/Province',
key: 'stateProvince',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -268,7 +268,7 @@ export const fields = [
{
label: 'Postal Code',
key: 'postalCode',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -276,7 +276,7 @@ export const fields = [
{
label: 'Country Code',
key: 'countryCode',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: '',
variables: true,
@@ -535,7 +535,7 @@ export const fields = [
{
label: 'Shipping Street Address',
key: 'shippingStreetAddress',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -543,7 +543,7 @@ export const fields = [
{
label: 'Shipping Apt/Suite',
key: 'shippingAptSuite',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -551,7 +551,7 @@ export const fields = [
{
label: 'Shipping City',
key: 'shippingCity',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -559,7 +559,7 @@ export const fields = [
{
label: 'Shipping State/Province',
key: 'shippingStateProvince',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -567,7 +567,7 @@ export const fields = [
{
label: 'Shipping Postal Code',
key: 'shippingPostalCode',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -575,7 +575,7 @@ export const fields = [
{
label: 'Shipping Country Code',
key: 'shippingCountryCode',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -583,7 +583,7 @@ export const fields = [
{
label: 'Private Notes',
key: 'privateNotes',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -591,7 +591,7 @@ export const fields = [
{
label: 'Public Notes',
key: 'publicNotes',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -599,7 +599,7 @@ export const fields = [
{
label: 'Website',
key: 'website',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -607,7 +607,7 @@ export const fields = [
{
label: 'Custom Value 1',
key: 'customValue1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -615,7 +615,7 @@ export const fields = [
{
label: 'Custom Value 2',
key: 'customValue2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -623,7 +623,7 @@ export const fields = [
{
label: 'Custom Value 3',
key: 'customValue3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -631,7 +631,7 @@ export const fields = [
{
label: 'Custom Value 4',
key: 'customValue4',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,

View File

@@ -1,6 +1,6 @@
import defineAction from '../../../../helpers/define-action';
import { filterProvidedFields } from '../../common/filter-provided-fields';
import { fields } from './fields';
import defineAction from '../../../../helpers/define-action.js';
import { filterProvidedFields } from '../../common/filter-provided-fields.js';
import { fields } from './fields.js';
export default defineAction({
name: 'Create client',

View File

@@ -2,7 +2,7 @@ export const fields = [
{
label: 'Client ID',
key: 'clientId',
type: 'dropdown' as const,
type: 'dropdown',
required: true,
description: 'The ID of the client, not the name or email address.',
variables: true,
@@ -20,7 +20,7 @@ export const fields = [
{
label: 'Send Email',
key: 'sendEmail',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: '',
variables: true,
@@ -32,7 +32,7 @@ export const fields = [
{
label: 'Mark Sent',
key: 'markSent',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: 'Setting this to true creates the invoice as sent.',
variables: true,
@@ -44,7 +44,7 @@ export const fields = [
{
label: 'Paid',
key: 'paid',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: 'Setting this to true creates the invoice as paid.',
variables: true,
@@ -56,7 +56,7 @@ export const fields = [
{
label: 'Amount Paid',
key: 'amountPaid',
type: 'string' as const,
type: 'string',
required: false,
description:
'If this value is greater than zero a payment will be created along with the invoice.',
@@ -65,7 +65,7 @@ export const fields = [
{
label: 'Number',
key: 'number',
type: 'string' as const,
type: 'string',
required: false,
description:
'The invoice number - is a unique alpha numeric number per invoice per company',
@@ -74,7 +74,7 @@ export const fields = [
{
label: 'Discount',
key: 'discount',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -82,7 +82,7 @@ export const fields = [
{
label: 'PO Number',
key: 'poNumber',
type: 'string' as const,
type: 'string',
required: false,
description: 'The purchase order associated with this invoice',
variables: true,
@@ -90,7 +90,7 @@ export const fields = [
{
label: 'Date',
key: 'date',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -98,7 +98,7 @@ export const fields = [
{
label: 'Due Date',
key: 'dueDate',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -106,7 +106,7 @@ export const fields = [
{
label: 'Tax Rate 1',
key: 'taxRate1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -114,7 +114,7 @@ export const fields = [
{
label: 'Tax Name 1',
key: 'taxName1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -122,7 +122,7 @@ export const fields = [
{
label: 'Tax Rate 2',
key: 'taxRate2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -130,7 +130,7 @@ export const fields = [
{
label: 'Tax Name 2',
key: 'taxName2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -138,7 +138,7 @@ export const fields = [
{
label: 'Tax Rate 3',
key: 'taxRate3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -146,7 +146,7 @@ export const fields = [
{
label: 'Tax Name 3',
key: 'taxName3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -154,7 +154,7 @@ export const fields = [
{
label: 'Custom Field 1',
key: 'customField1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -162,7 +162,7 @@ export const fields = [
{
label: 'Custom Field 2',
key: 'customField2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -170,7 +170,7 @@ export const fields = [
{
label: 'Custom Field 3',
key: 'customField3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -178,7 +178,7 @@ export const fields = [
{
label: 'Custom Field 4',
key: 'customField4',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -186,7 +186,7 @@ export const fields = [
{
label: 'Custom Surcharge 1',
key: 'customSurcharge1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -194,7 +194,7 @@ export const fields = [
{
label: 'Custom Surcharge 2',
key: 'customSurcharge2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -202,7 +202,7 @@ export const fields = [
{
label: 'Custom Surcharge 3',
key: 'customSurcharge3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -210,7 +210,7 @@ export const fields = [
{
label: 'Custom Surcharge 4',
key: 'customSurcharge4',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -218,7 +218,7 @@ export const fields = [
{
label: 'Is Amount Discount',
key: 'isAmountDiscount',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description:
'By default the discount is applied as a percentage, enabling this applies the discount as a fixed amount.',
@@ -231,7 +231,7 @@ export const fields = [
{
label: 'Partial/Deposit',
key: 'partialDeposit',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -239,7 +239,7 @@ export const fields = [
{
label: 'Partial Due Date',
key: 'partialDueDate',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -247,7 +247,7 @@ export const fields = [
{
label: 'Line Item Cost',
key: 'lineItemCost',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -255,7 +255,7 @@ export const fields = [
{
label: 'Line Item Quatity',
key: 'lineItemQuantity',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -263,7 +263,7 @@ export const fields = [
{
label: 'Line Item Product',
key: 'lineItemProduct',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -271,7 +271,7 @@ export const fields = [
{
label: 'Line Item Discount',
key: 'lineItemDiscount',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -279,7 +279,7 @@ export const fields = [
{
label: 'Line Item Description',
key: 'lineItemDescription',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -287,7 +287,7 @@ export const fields = [
{
label: 'Line Item Tax Rate 1',
key: 'lineItemTaxRate1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -295,7 +295,7 @@ export const fields = [
{
label: 'Line Item Tax Name 1',
key: 'lineItemTaxName1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -303,7 +303,7 @@ export const fields = [
{
label: 'Line Item Tax Rate 2',
key: 'lineItemTaxRate2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -311,7 +311,7 @@ export const fields = [
{
label: 'Line Item Tax Name 2',
key: 'lineItemTaxName2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -319,7 +319,7 @@ export const fields = [
{
label: 'Line Item Tax Rate 3',
key: 'lineItemTaxRate3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -327,7 +327,7 @@ export const fields = [
{
label: 'Line Item Tax Name 3',
key: 'lineItemTaxName3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -335,7 +335,7 @@ export const fields = [
{
label: 'Line Item Custom Field 1',
key: 'lineItemCustomField1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -343,7 +343,7 @@ export const fields = [
{
label: 'Line Item Custom Field 2',
key: 'lineItemCustomField2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -351,7 +351,7 @@ export const fields = [
{
label: 'Line Item Custom Field 3',
key: 'lineItemCustomField3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -359,7 +359,7 @@ export const fields = [
{
label: 'Line Item Custom Field 4',
key: 'lineItemCustomField4',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -367,7 +367,7 @@ export const fields = [
{
label: 'Line Item Product Cost',
key: 'lineItemProductCost',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -375,7 +375,7 @@ export const fields = [
{
label: 'Public Notes',
key: 'publicNotes',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -383,7 +383,7 @@ export const fields = [
{
label: 'Private Notes',
key: 'privateNotes',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -391,7 +391,7 @@ export const fields = [
{
label: 'Terms',
key: 'terms',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -399,7 +399,7 @@ export const fields = [
{
label: 'Footer',
key: 'footer',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,

View File

@@ -1,6 +1,6 @@
import defineAction from '../../../../helpers/define-action';
import { filterProvidedFields } from '../../common/filter-provided-fields';
import { fields } from './fields';
import defineAction from '../../../../helpers/define-action.js';
import { filterProvidedFields } from '../../common/filter-provided-fields.js';
import { fields } from './fields.js';
export default defineAction({
name: 'Create invoice',

View File

@@ -2,7 +2,7 @@ export const fields = [
{
label: 'Client ID',
key: 'clientId',
type: 'dropdown' as const,
type: 'dropdown',
required: true,
description: 'The ID of the client, not the name or email address.',
variables: true,
@@ -20,7 +20,7 @@ export const fields = [
{
label: 'Payment Date',
key: 'paymentDate',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -28,7 +28,7 @@ export const fields = [
{
label: 'Invoice',
key: 'invoiceId',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: '',
variables: true,
@@ -46,7 +46,7 @@ export const fields = [
{
label: 'Invoice Amount',
key: 'invoiceAmount',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -54,7 +54,7 @@ export const fields = [
{
label: 'Payment Type',
key: 'paymentType',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: '',
variables: true,
@@ -95,7 +95,7 @@ export const fields = [
{
label: 'Transfer Reference',
key: 'transferReference',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -103,7 +103,7 @@ export const fields = [
{
label: 'Private Notes',
key: 'privateNotes',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,

View File

@@ -1,6 +1,6 @@
import defineAction from '../../../../helpers/define-action';
import { filterProvidedFields } from '../../common/filter-provided-fields';
import { fields } from './fields';
import defineAction from '../../../../helpers/define-action.js';
import { filterProvidedFields } from '../../common/filter-provided-fields.js';
import { fields } from './fields.js';
export default defineAction({
name: 'Create payment',

View File

@@ -2,7 +2,7 @@ export const fields = [
{
label: 'Product Key',
key: 'productKey',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -10,7 +10,7 @@ export const fields = [
{
label: 'Notes',
key: 'notes',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -18,7 +18,7 @@ export const fields = [
{
label: 'Price',
key: 'price',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -26,7 +26,7 @@ export const fields = [
{
label: 'Quantity',
key: 'quantity',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -34,7 +34,7 @@ export const fields = [
{
label: 'Tax Rate 1',
key: 'taxRate1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -42,7 +42,7 @@ export const fields = [
{
label: 'Tax Name 1',
key: 'taxName1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -50,7 +50,7 @@ export const fields = [
{
label: 'Tax Rate 2',
key: 'taxRate2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -58,7 +58,7 @@ export const fields = [
{
label: 'Tax Name 2',
key: 'taxName2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -66,7 +66,7 @@ export const fields = [
{
label: 'Tax Rate 3',
key: 'taxRate3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -74,7 +74,7 @@ export const fields = [
{
label: 'Tax Name 3',
key: 'taxName3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -82,7 +82,7 @@ export const fields = [
{
label: 'Custom Value 1',
key: 'customValue1',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -90,7 +90,7 @@ export const fields = [
{
label: 'Custom Value 2',
key: 'customValue2',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -98,7 +98,7 @@ export const fields = [
{
label: 'Custom Value 3',
key: 'customValue3',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,
@@ -106,7 +106,7 @@ export const fields = [
{
label: 'Custom Value 4',
key: 'customValue4',
type: 'string' as const,
type: 'string',
required: false,
description: '',
variables: true,

View File

@@ -1,6 +1,6 @@
import defineAction from '../../../../helpers/define-action';
import { filterProvidedFields } from '../../common/filter-provided-fields';
import { fields } from './fields';
import defineAction from '../../../../helpers/define-action.js';
import { filterProvidedFields } from '../../common/filter-provided-fields.js';
import { fields } from './fields.js';
export default defineAction({
name: 'Create product',

View File

@@ -0,0 +1,6 @@
import createClient from './create-client/index.js';
import createInvoice from './create-invoice/index.js';
import createPayment from './create-payment/index.js';
import createProduct from './create-product/index.js';
export default [createClient, createInvoice, createPayment, createProduct];

View File

@@ -1,6 +0,0 @@
import createClient from './create-client';
import createInvoice from './create-invoice';
import createPayment from './create-payment';
import createProduct from './create-product';
export default [createClient, createInvoice, createPayment, createProduct];

View File

@@ -1,12 +1,12 @@
import verifyCredentials from './verify-credentials';
import isStillVerified from './is-still-verified';
import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified.js';
export default {
fields: [
{
key: 'apiToken',
label: 'API Token',
type: 'string' as const,
type: 'string',
required: true,
readOnly: false,
value: null,
@@ -18,7 +18,7 @@ export default {
{
key: 'instanceUrl',
label: 'Invoice Ninja instance URL (optional)',
type: 'string' as const,
type: 'string',
required: false,
readOnly: false,
value: null,

View File

@@ -0,0 +1,9 @@
import verifyCredentials from './verify-credentials.js';
const isStillVerified = async ($) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,10 +0,0 @@
import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,6 +1,4 @@
import { IGlobalVariable } from '@automatisch/types';
const verifyCredentials = async ($: IGlobalVariable) => {
const verifyCredentials = async ($) => {
const { data } = await $.http.get('/v1/ping');
const screenName = [data.user_name, data.company_name]

View File

@@ -1,13 +1,11 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const addAuthHeader = ($, requestConfig) => {
const { instanceUrl } = $.auth.data;
if (instanceUrl) {
requestConfig.baseURL = instanceUrl as string;
requestConfig.baseURL = instanceUrl;
}
requestConfig.headers['X-API-TOKEN'] = $.auth.data.apiToken as string;
requestConfig.headers['X-API-TOKEN'] = $.auth.data.apiToken;
requestConfig.headers['X-Requested-With'] = 'XMLHttpRequest';

View File

@@ -0,0 +1,18 @@
import isObject from 'lodash/isObject.js';
export function filterProvidedFields(body) {
return Object.keys(body).reduce((result, key) => {
const value = body[key];
if (isObject(value)) {
const filteredNestedObj = filterProvidedFields(value);
if (Object.keys(filteredNestedObj).length > 0) {
result[key] = filteredNestedObj;
}
} else if (body[key]) {
result[key] = value;
}
return result;
}, {});
}

View File

@@ -1,18 +0,0 @@
import isObject from 'lodash/isObject';
export function filterProvidedFields(body: Record<string, unknown>) {
return Object.keys(body).reduce<Record<string, unknown>>((result, key) => {
const value = body[key];
if (isObject(value)) {
const filteredNestedObj = filterProvidedFields(
value as Record<string, unknown>
);
if (Object.keys(filteredNestedObj).length > 0) {
result[key] = filteredNestedObj;
}
} else if (body[key]) {
result[key] = value;
}
return result;
}, {});
}

View File

@@ -0,0 +1,11 @@
const setBaseUrl = ($, requestConfig) => {
const instanceUrl = $.auth.data.instanceUrl;
if (instanceUrl) {
requestConfig.baseURL = instanceUrl;
}
return requestConfig;
};
export default setBaseUrl;

View File

@@ -1,13 +0,0 @@
import { TBeforeRequest } from '@automatisch/types';
const setBaseUrl: TBeforeRequest = ($, requestConfig) => {
const instanceUrl = $.auth.data.instanceUrl as string;
if (instanceUrl) {
requestConfig.baseURL = instanceUrl;
}
return requestConfig;
};
export default setBaseUrl;

View File

@@ -0,0 +1,4 @@
import listClients from './list-clients/index.js';
import listInvoices from './list-invoices/index.js';
export default [listClients, listInvoices];

View File

@@ -1,4 +0,0 @@
import listClients from './list-clients';
import listInvoices from './list-invoices';
export default [listClients, listInvoices];

View File

@@ -1,13 +1,9 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List clients',
key: 'listClients',
async run($: IGlobalVariable) {
const clients: {
data: IJSONObject[];
} = {
async run($) {
const clients = {
data: [],
};

View File

@@ -1,13 +1,9 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List invoices',
key: 'listInvoices',
async run($: IGlobalVariable) {
const invoices: {
data: IJSONObject[];
} = {
async run($) {
const invoices = {
data: [],
};

View File

@@ -1,10 +1,10 @@
import defineApp from '../../helpers/define-app';
import setBaseUrl from './common/set-base-url';
import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import triggers from './triggers';
import actions from './actions';
import dynamicData from './dynamic-data';
import defineApp from '../../helpers/define-app.js';
import setBaseUrl from './common/set-base-url.js';
import addAuthHeader from './common/add-auth-header.js';
import auth from './auth/index.js';
import triggers from './triggers/index.js';
import actions from './actions/index.js';
import dynamicData from './dynamic-data/index.js';
export default defineApp({
name: 'Invoice Ninja',

View File

@@ -0,0 +1,15 @@
import newClients from './new-clients/index.js';
import newCredits from './new-credits/index.js';
import newInvoices from './new-invoices/index.js';
import newPayments from './new-payments/index.js';
import newProjects from './new-projects/index.js';
import newQuotes from './new-quotes/index.js';
export default [
newClients,
newCredits,
newInvoices,
newPayments,
newProjects,
newQuotes,
];

View File

@@ -1,15 +0,0 @@
import newClients from './new-clients';
import newCredits from './new-credits';
import newInvoices from './new-invoices';
import newPayments from './new-payments';
import newProjects from './new-projects';
import newQuotes from './new-quotes';
export default [
newClients,
newCredits,
newInvoices,
newPayments,
newProjects,
newQuotes,
];

View File

@@ -1,17 +1,6 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
type Response = {
data: {
data: {
id: string;
event_id: string;
target_url: string;
format: string;
};
};
};
import isEmpty from 'lodash/isEmpty.js';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New clients',
@@ -54,7 +43,7 @@ export default defineTrigger({
rest_method: 'post',
};
const response: Response = await $.http.post('/v1/webhooks', payload);
const response = await $.http.post('/v1/webhooks', payload);
await $.flow.setRemoteWebhookId(response.data.data.id);
},

View File

@@ -1,17 +1,6 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
type Response = {
data: {
data: {
id: string;
event_id: string;
target_url: string;
format: string;
};
};
};
import isEmpty from 'lodash/isEmpty.js';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New credits',
@@ -54,7 +43,7 @@ export default defineTrigger({
rest_method: 'post',
};
const response: Response = await $.http.post('/v1/webhooks', payload);
const response = await $.http.post('/v1/webhooks', payload);
await $.flow.setRemoteWebhookId(response.data.data.id);
},

View File

@@ -1,17 +1,6 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
type Response = {
data: {
data: {
id: string;
event_id: string;
target_url: string;
format: string;
};
};
};
import isEmpty from 'lodash/isEmpty.js';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New invoices',
@@ -54,7 +43,7 @@ export default defineTrigger({
rest_method: 'post',
};
const response: Response = await $.http.post('/v1/webhooks', payload);
const response = await $.http.post('/v1/webhooks', payload);
await $.flow.setRemoteWebhookId(response.data.data.id);
},

View File

@@ -1,17 +1,6 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
type Response = {
data: {
data: {
id: string;
event_id: string;
target_url: string;
format: string;
};
};
};
import isEmpty from 'lodash/isEmpty.js';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New payments',
@@ -54,7 +43,7 @@ export default defineTrigger({
rest_method: 'post',
};
const response: Response = await $.http.post('/v1/webhooks', payload);
const response = await $.http.post('/v1/webhooks', payload);
await $.flow.setRemoteWebhookId(response.data.data.id);
},

View File

@@ -1,17 +1,6 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
type Response = {
data: {
data: {
id: string;
event_id: string;
target_url: string;
format: string;
};
};
};
import isEmpty from 'lodash/isEmpty.js';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New projects',
@@ -54,7 +43,7 @@ export default defineTrigger({
rest_method: 'post',
};
const response: Response = await $.http.post('/v1/webhooks', payload);
const response = await $.http.post('/v1/webhooks', payload);
await $.flow.setRemoteWebhookId(response.data.data.id);
},

View File

@@ -1,17 +1,6 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
type Response = {
data: {
data: {
id: string;
event_id: string;
target_url: string;
format: string;
};
};
};
import isEmpty from 'lodash/isEmpty.js';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New quotes',
@@ -54,7 +43,7 @@ export default defineTrigger({
rest_method: 'post',
};
const response: Response = await $.http.post('/v1/webhooks', payload);
const response = await $.http.post('/v1/webhooks', payload);
await $.flow.setRemoteWebhookId(response.data.data.id);
},