chore: Use imports as ES modules

This commit is contained in:
Faruk AYDIN
2024-01-04 22:24:42 +01:00
parent 523f8a8951
commit b95478b635
52 changed files with 198 additions and 186 deletions

View File

@@ -1,7 +1,10 @@
import { knexSnakeCaseMappers } from 'objection'; import { knexSnakeCaseMappers } from 'objection';
import appConfig from './src/config/app'; import appConfig from './src/config/app.js';
import path from 'path';
import { fileURLToPath } from 'url';
const fileExtension = 'js'; const fileExtension = 'js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const knexConfig = { const knexConfig = {
client: 'pg', client: 'pg',

View File

@@ -3,11 +3,12 @@
"version": "0.10.0", "version": "0.10.0",
"license": "See LICENSE file", "license": "See LICENSE file",
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.", "description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
"type": "module",
"scripts": { "scripts": {
"dev": "ts-node-dev --watch 'src/graphql/schema.graphql' --exit-child src/server.ts", "dev": "ts-node-dev --watch 'src/graphql/schema.graphql' --exit-child src/server.ts",
"worker": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/worker.ts", "worker": "nodemon --watch 'src/**/*.js' --exec 'node' src/worker.js",
"build": "tsc && yarn copy-statics", "build": "tsc && yarn copy-statics",
"build:watch": "nodemon --watch 'src/**/*.ts' --watch 'bin/**/*.ts' --exec yarn build --ext ts", "build:watch": "nodemon --watch 'src/**/*.js' --watch 'bin/**/*.ts' --exec yarn build --ext ts",
"start": "node dist/src/server.js", "start": "node dist/src/server.js",
"pretest": "APP_ENV=test ts-node ./test/setup/prepare-test-env.ts", "pretest": "APP_ENV=test ts-node ./test/setup/prepare-test-env.ts",
"test": "APP_ENV=test jest --verbose", "test": "APP_ENV=test jest --verbose",

View File

@@ -7,7 +7,8 @@ import actions from './actions';
export default defineApp({ export default defineApp({
name: 'Azure OpenAI', name: 'Azure OpenAI',
key: 'azure-openai', key: 'azure-openai',
baseUrl: 'https://azure.microsoft.com/en-us/products/ai-services/openai-service', baseUrl:
'https://azure.microsoft.com/en-us/products/ai-services/openai-service',
apiBaseUrl: '', apiBaseUrl: '',
iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg', iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg',
authDocUrl: 'https://automatisch.io/docs/apps/azure-openai/connection', authDocUrl: 'https://automatisch.io/docs/apps/azure-openai/connection',

View File

@@ -4,8 +4,8 @@ import process from 'process';
import pg from 'pg'; import pg from 'pg';
pg.types.setTypeParser(20, 'text', parseInt); pg.types.setTypeParser(20, 'text', parseInt);
import knex from 'knex'; import knex from 'knex';
import knexConfig from '../../knexfile'; import knexConfig from '../../knexfile.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
export const client = knex(knexConfig); export const client = knex(knexConfig);

View File

@@ -1,4 +1,4 @@
import { Model } from 'objection'; import { Model } from 'objection';
import { client } from './database'; import { client } from './database.js';
Model.knex(client); Model.knex(client);

View File

@@ -1,4 +1,4 @@
import appConfig from './app'; import appConfig from './app.js';
const redisConfig = { const redisConfig = {
host: appConfig.redisHost, host: appConfig.redisHost,

View File

@@ -1,3 +1,3 @@
import BaseError from './base'; import BaseError from './base.js';
export default class AlreadyProcessedError extends BaseError { } export default class AlreadyProcessedError extends BaseError {}

View File

@@ -1,3 +1,3 @@
import BaseError from './base'; import BaseError from './base.js';
export default class EarlyExitError extends BaseError {} export default class EarlyExitError extends BaseError {}

View File

@@ -1,4 +1,4 @@
import BaseError from './base'; import BaseError from './base.js';
export default class HttpError extends BaseError { export default class HttpError extends BaseError {
constructor(error) { constructor(error) {

View File

@@ -1,4 +1,4 @@
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep.js';
const connectionIdArgument = { const connectionIdArgument = {
name: 'id', name: 'id',

View File

@@ -1,4 +1,4 @@
import appConfig from '../config/app'; import appConfig from '../config/app.js';
const appInfoConverter = (rawAppData) => { const appInfoConverter = (rawAppData) => {
rawAppData.iconUrl = rawAppData.iconUrl.replace( rawAppData.iconUrl = rawAppData.iconUrl.replace(

View File

@@ -1,4 +1,4 @@
import appConfig from '../../config/app'; import appConfig from '../../config/app.js';
const testPlans = [ const testPlans = [
{ {

View File

@@ -1,6 +1,6 @@
import Redis from 'ioredis'; import Redis from 'ioredis';
import logger from './logger'; import logger from './logger.js';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
const redisClient = new Redis(redisConfig); const redisClient = new Redis(redisConfig);

View File

@@ -1,5 +1,5 @@
import delayForAsMilliseconds from './delay-for-as-milliseconds'; import delayForAsMilliseconds from './delay-for-as-milliseconds.js';
import delayUntilAsMilliseconds from './delay-until-as-milliseconds'; import delayUntilAsMilliseconds from './delay-until-as-milliseconds.js';
const delayAsMilliseconds = (eventKey, computedParameters) => { const delayAsMilliseconds = (eventKey, computedParameters) => {
let delayDuration = 0; let delayDuration = 0;

View File

@@ -1,8 +1,12 @@
import path from 'node:path'; import path from 'node:path';
import fs from 'node:fs'; import fs from 'node:fs';
import { omit, cloneDeep } from 'lodash'; import omit from 'lodash/omit.js';
import addAuthenticationSteps from './add-authentication-steps'; import cloneDeep from 'lodash/cloneDeep.js';
import addReconnectionSteps from './add-reconnection-steps'; import addAuthenticationSteps from './add-authentication-steps.js';
import addReconnectionSteps from './add-reconnection-steps.js';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const apps = fs const apps = fs
.readdirSync(path.resolve(__dirname, `../apps/`), { withFileTypes: true }) .readdirSync(path.resolve(__dirname, `../apps/`), { withFileTypes: true })

View File

@@ -1,6 +1,6 @@
import createHttpClient from './http-client'; import createHttpClient from './http-client/index.js';
import EarlyExitError from '../errors/early-exit'; import EarlyExitError from '../errors/early-exit.js';
import AlreadyProcessedError from '../errors/already-processed'; import AlreadyProcessedError from '../errors/already-processed.js';
const globalVariable = async (options) => { const globalVariable = async (options) => {
const { const {

View File

@@ -1,8 +1,6 @@
import { URL } from 'node:url'; import { URL } from 'node:url';
export { AxiosInstance as IHttpClient } from 'axios'; import HttpError from '../../errors/http.js';
import axios from '../axios-with-proxy.js';
import HttpError from '../../errors/http';
import axios from '../axios-with-proxy';
const removeBaseUrlForAbsoluteUrls = (requestConfig) => { const removeBaseUrlForAbsoluteUrls = (requestConfig) => {
try { try {

View File

@@ -1,6 +1,6 @@
import memoryCache from 'memory-cache'; import memoryCache from 'memory-cache';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
import axios from './axios-with-proxy'; import axios from './axios-with-proxy.js';
const CACHE_DURATION = 1000 * 60 * 60 * 24; // 24 hours in milliseconds const CACHE_DURATION = 1000 * 60 * 60 * 24; // 24 hours in milliseconds

View File

@@ -1,5 +1,5 @@
import * as winston from 'winston'; import * as winston from 'winston';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
const levels = { const levels = {
error: 0, error: 0,

View File

@@ -1,5 +1,5 @@
import nodemailer from 'nodemailer'; import nodemailer from 'nodemailer';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
const mailer = nodemailer.createTransport({ const mailer = nodemailer.createTransport({
host: appConfig.smtpHost, host: appConfig.smtpHost,

View File

@@ -1,7 +1,7 @@
import * as Sentry from '@sentry/node'; import * as Sentry from '@sentry/node';
import * as Tracing from '@sentry/tracing'; import * as Tracing from '@sentry/tracing';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
const isSentryEnabled = !!appConfig.sentryDsn; const isSentryEnabled = !!appConfig.sentryDsn;

View File

@@ -1,7 +1,7 @@
import Analytics from '@rudderstack/rudder-sdk-node'; import Analytics from '@rudderstack/rudder-sdk-node';
import organizationId from './organization-id'; import organizationId from './organization-id.js';
import instanceId from './instance-id'; import instanceId from './instance-id.js';
import appConfig from '../../config/app'; import appConfig from '../../config/app.js';
import os from 'os'; import os from 'os';
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v'; const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';

View File

@@ -1,5 +1,5 @@
import CryptoJS from 'crypto-js'; import CryptoJS from 'crypto-js';
import appConfig from '../../config/app'; import appConfig from '../../config/app.js';
const organizationId = () => { const organizationId = () => {
const key = appConfig.encryptionKey; const key = appConfig.encryptionKey;

View File

@@ -1,7 +1,8 @@
import { AES, enc } from 'crypto-js'; import AES from 'crypto-js/aes.js';
import appConfig from '../config/app'; import enc from 'crypto-js/enc-utf8.js';
import AppConfig from './app-config'; import appConfig from '../config/app.js';
import Base from './base'; import AppConfig from './app-config.js';
import Base from './base.js';
class AppAuthClient extends Base { class AppAuthClient extends Base {
static tableName = 'app_auth_clients'; static tableName = 'app_auth_clients';

View File

@@ -1,6 +1,6 @@
import App from './app'; import App from './app.js';
import Base from './base'; import Base from './base.js';
import AppAuthClient from './app-auth-client'; import AppAuthClient from './app-auth-client.js';
class AppConfig extends Base { class AppConfig extends Base {
static tableName = 'app_configs'; static tableName = 'app_configs';

View File

@@ -1,7 +1,10 @@
import fs from 'fs'; import fs from 'fs';
import { join } from 'path'; import path, { join } from 'path';
import appInfoConverter from '../helpers/app-info-converter'; import { fileURLToPath } from 'url';
import getApp from '../helpers/get-app'; import appInfoConverter from '../helpers/app-info-converter.js';
import getApp from '../helpers/get-app.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
class App { class App {
static folderPath = join(__dirname, '../apps'); static folderPath = join(__dirname, '../apps');

View File

@@ -1,7 +1,7 @@
import { AjvValidator, Model, snakeCaseMappers } from 'objection'; import { AjvValidator, Model, snakeCaseMappers } from 'objection';
import addFormats from 'ajv-formats'; import addFormats from 'ajv-formats';
import ExtendedQueryBuilder from './query-builder'; import ExtendedQueryBuilder from './query-builder.js';
class Base extends Model { class Base extends Model {
static QueryBuilder = ExtendedQueryBuilder; static QueryBuilder = ExtendedQueryBuilder;

View File

@@ -1,13 +1,14 @@
import { AES, enc } from 'crypto-js'; import AES from 'crypto-js/aes.js';
import App from './app'; import enc from 'crypto-js/enc-utf8.js';
import AppConfig from './app-config'; import App from './app.js';
import AppAuthClient from './app-auth-client'; import AppConfig from './app-config.js';
import Base from './base'; import AppAuthClient from './app-auth-client.js';
import User from './user'; import Base from './base.js';
import Step from './step'; import User from './user.js';
import appConfig from '../config/app'; import Step from './step.js';
import Telemetry from '../helpers/telemetry'; import appConfig from '../config/app.js';
import globalVariable from '../helpers/global-variable'; import Telemetry from '../helpers/telemetry/index.js';
import globalVariable from '../helpers/global-variable.js';
class Connection extends Base { class Connection extends Base {
static tableName = 'connections'; static tableName = 'connections';

View File

@@ -1,8 +1,8 @@
import appConfig from '../config/app'; import appConfig from '../config/app.js';
import Base from './base'; import Base from './base.js';
import Execution from './execution'; import Execution from './execution.js';
import Step from './step'; import Step from './step.js';
import Telemetry from '../helpers/telemetry'; import Telemetry from '../helpers/telemetry/index.js';
class ExecutionStep extends Base { class ExecutionStep extends Base {
static tableName = 'execution_steps'; static tableName = 'execution_steps';

View File

@@ -1,7 +1,7 @@
import Base from './base'; import Base from './base.js';
import Flow from './flow'; import Flow from './flow.js';
import ExecutionStep from './execution-step'; import ExecutionStep from './execution-step.js';
import Telemetry from '../helpers/telemetry'; import Telemetry from '../helpers/telemetry/index.js';
class Execution extends Base { class Execution extends Base {
static tableName = 'executions'; static tableName = 'executions';

View File

@@ -1,9 +1,9 @@
import { ValidationError } from 'objection'; import { ValidationError } from 'objection';
import Base from './base'; import Base from './base.js';
import Step from './step'; import Step from './step.js';
import User from './user'; import User from './user.js';
import Execution from './execution'; import Execution from './execution.js';
import Telemetry from '../helpers/telemetry'; import Telemetry from '../helpers/telemetry/index.js';
class Flow extends Base { class Flow extends Base {
static tableName = 'flows'; static tableName = 'flows';

View File

@@ -1,6 +1,6 @@
import Base from './base'; import Base from './base.js';
import SamlAuthProvider from './saml-auth-provider.ee'; import SamlAuthProvider from './saml-auth-provider.ee.js';
import User from './user'; import User from './user.js';
class Identity extends Base { class Identity extends Base {
static tableName = 'identities'; static tableName = 'identities';

View File

@@ -1,4 +1,4 @@
import Base from './base'; import Base from './base.js';
class Permission extends Base { class Permission extends Base {
static tableName = 'permissions'; static tableName = 'permissions';

View File

@@ -1,6 +1,6 @@
import Base from './base'; import Base from './base.js';
import Permission from './permission'; import Permission from './permission.js';
import User from './user'; import User from './user.js';
class Role extends Base { class Role extends Base {
static tableName = 'roles'; static tableName = 'roles';

View File

@@ -1,8 +1,8 @@
import { URL } from 'node:url'; import { URL } from 'node:url';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
import Base from './base'; import Base from './base.js';
import Identity from './identity.ee'; import Identity from './identity.ee.js';
import SamlAuthProvidersRoleMapping from './saml-auth-providers-role-mapping.ee'; import SamlAuthProvidersRoleMapping from './saml-auth-providers-role-mapping.ee.js';
class SamlAuthProvider extends Base { class SamlAuthProvider extends Base {
static tableName = 'saml_auth_providers'; static tableName = 'saml_auth_providers';

View File

@@ -1,5 +1,5 @@
import Base from './base'; import Base from './base.js';
import SamlAuthProvider from './saml-auth-provider.ee'; import SamlAuthProvider from './saml-auth-provider.ee.js';
class SamlAuthProvidersRoleMapping extends Base { class SamlAuthProvidersRoleMapping extends Base {
static tableName = 'saml_auth_providers_role_mappings'; static tableName = 'saml_auth_providers_role_mappings';

View File

@@ -1,12 +1,12 @@
import { URL } from 'node:url'; import { URL } from 'node:url';
import get from 'lodash.get'; import get from 'lodash.get';
import Base from './base'; import Base from './base.js';
import App from './app'; import App from './app.js';
import Flow from './flow'; import Flow from './flow.js';
import Connection from './connection'; import Connection from './connection.js';
import ExecutionStep from './execution-step'; import ExecutionStep from './execution-step.js';
import Telemetry from '../helpers/telemetry'; import Telemetry from '../helpers/telemetry/index.js';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
class Step extends Base { class Step extends Base {
static tableName = 'steps'; static tableName = 'steps';

View File

@@ -1,8 +1,8 @@
import Base from './base'; import Base from './base.js';
import User from './user'; import User from './user.js';
import UsageData from './usage-data.ee'; import UsageData from './usage-data.ee.js';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { getPlanById } from '../helpers/billing/plans.ee'; import { getPlanById } from '../helpers/billing/plans.ee.js';
class Subscription extends Base { class Subscription extends Base {
static tableName = 'subscriptions'; static tableName = 'subscriptions';

View File

@@ -1,7 +1,7 @@
import { raw } from 'objection'; import { raw } from 'objection';
import Base from './base'; import Base from './base.js';
import User from './user'; import User from './user.js';
import Subscription from './subscription.ee'; import Subscription from './subscription.ee.js';
class UsageData extends Base { class UsageData extends Base {
static tableName = 'usage_data'; static tableName = 'usage_data';

View File

@@ -2,19 +2,19 @@ import bcrypt from 'bcrypt';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import crypto from 'node:crypto'; import crypto from 'node:crypto';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
import { hasValidLicense } from '../helpers/license.ee'; import { hasValidLicense } from '../helpers/license.ee.js';
import userAbility from '../helpers/user-ability'; import userAbility from '../helpers/user-ability.js';
import Base from './base'; import Base from './base.js';
import Connection from './connection'; import Connection from './connection.js';
import Execution from './execution'; import Execution from './execution.js';
import Flow from './flow'; import Flow from './flow.js';
import Identity from './identity.ee'; import Identity from './identity.ee.js';
import Permission from './permission'; import Permission from './permission.js';
import Role from './role'; import Role from './role.js';
import Step from './step'; import Step from './step.js';
import Subscription from './subscription.ee'; import Subscription from './subscription.ee.js';
import UsageData from './usage-data.ee'; import UsageData from './usage-data.ee.js';
class User extends Base { class User extends Base {
static tableName = 'users'; static tableName = 'users';

View File

@@ -1,7 +1,7 @@
import process from 'process'; import process from 'process';
import { Queue } from 'bullmq'; import { Queue } from 'bullmq';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
const CONNECTION_REFUSED = 'ECONNREFUSED'; const CONNECTION_REFUSED = 'ECONNREFUSED';

View File

@@ -1,7 +1,7 @@
import process from 'process'; import process from 'process';
import { Queue } from 'bullmq'; import { Queue } from 'bullmq';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
const CONNECTION_REFUSED = 'ECONNREFUSED'; const CONNECTION_REFUSED = 'ECONNREFUSED';

View File

@@ -1,7 +1,7 @@
import process from 'process'; import process from 'process';
import { Queue } from 'bullmq'; import { Queue } from 'bullmq';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
const CONNECTION_REFUSED = 'ECONNREFUSED'; const CONNECTION_REFUSED = 'ECONNREFUSED';

View File

@@ -1,13 +1,13 @@
import Step from '../models/step'; import Step from '../models/step.js';
import Flow from '../models/flow'; import Flow from '../models/flow.js';
import Execution from '../models/execution'; import Execution from '../models/execution.js';
import ExecutionStep from '../models/execution-step'; import ExecutionStep from '../models/execution-step.js';
import computeParameters from '../helpers/compute-parameters'; import computeParameters from '../helpers/compute-parameters.js';
import globalVariable from '../helpers/global-variable'; import globalVariable from '../helpers/global-variable.js';
import { logger } from '../helpers/logger'; import { logger } from '../helpers/logger.js';
import HttpError from '../errors/http'; import HttpError from '../errors/http.js';
import EarlyExitError from '../errors/early-exit'; import EarlyExitError from '../errors/early-exit.js';
import AlreadyProcessedError from '../errors/already-processed'; import AlreadyProcessedError from '../errors/already-processed.js';
export const processAction = async (options) => { export const processAction = async (options) => {
const { flowId, stepId, executionId } = options; const { flowId, stepId, executionId } = options;

View File

@@ -1,9 +1,9 @@
import Flow from '../models/flow'; import Flow from '../models/flow.js';
import globalVariable from '../helpers/global-variable'; import globalVariable from '../helpers/global-variable.js';
import EarlyExitError from '../errors/early-exit'; import EarlyExitError from '../errors/early-exit.js';
import AlreadyProcessedError from '../errors/already-processed'; import AlreadyProcessedError from '../errors/already-processed.js';
import HttpError from '../errors/http'; import HttpError from '../errors/http.js';
import { logger } from '../helpers/logger'; import { logger } from '../helpers/logger.js';
export const processFlow = async (options) => { export const processFlow = async (options) => {
const { testRun, flowId } = options; const { testRun, flowId } = options;

View File

@@ -1,7 +1,7 @@
import Step from '../models/step'; import Step from '../models/step.js';
import Flow from '../models/flow'; import Flow from '../models/flow.js';
import Execution from '../models/execution'; import Execution from '../models/execution.js';
import globalVariable from '../helpers/global-variable'; import globalVariable from '../helpers/global-variable.js';
export const processTrigger = async (options) => { export const processTrigger = async (options) => {
const { flowId, stepId, triggerItem, error, testRun } = options; const { flowId, stepId, triggerItem, error, testRun } = options;

View File

@@ -1,21 +1,21 @@
import * as Sentry from './helpers/sentry.ee'; import * as Sentry from './helpers/sentry.ee.js';
import appConfig from './config/app'; import appConfig from './config/app.js';
Sentry.init(); Sentry.init();
import './config/orm'; import './config/orm.js';
import './helpers/check-worker-readiness'; import './helpers/check-worker-readiness.js';
import './workers/flow'; import './workers/flow.js';
import './workers/trigger'; import './workers/trigger.js';
import './workers/action'; import './workers/action.js';
import './workers/email'; import './workers/email.js';
import './workers/delete-user.ee'; import './workers/delete-user.ee.js';
if (appConfig.isCloud) { if (appConfig.isCloud) {
import('./workers/remove-cancelled-subscriptions.ee'); import('./workers/remove-cancelled-subscriptions.ee.js');
import('./queues/remove-cancelled-subscriptions.ee'); import('./queues/remove-cancelled-subscriptions.ee.js');
} }
import telemetry from './helpers/telemetry'; import telemetry from './helpers/telemetry/index.js';
telemetry.setServiceType('worker'); telemetry.setServiceType('worker');

View File

@@ -1,17 +1,17 @@
import { Worker } from 'bullmq'; import { Worker } from 'bullmq';
import process from 'node:process'; import process from 'node:process';
import * as Sentry from '../helpers/sentry.ee'; import * as Sentry from '../helpers/sentry.ee.js';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
import Step from '../models/step'; import Step from '../models/step.js';
import actionQueue from '../queues/action'; import actionQueue from '../queues/action.js';
import { processAction } from '../services/action'; import { processAction } from '../services/action.js';
import { import {
REMOVE_AFTER_30_DAYS_OR_150_JOBS, REMOVE_AFTER_30_DAYS_OR_150_JOBS,
REMOVE_AFTER_7_DAYS_OR_50_JOBS, REMOVE_AFTER_7_DAYS_OR_50_JOBS,
} from '../helpers/remove-job-configuration'; } from '../helpers/remove-job-configuration.js';
import delayAsMilliseconds from '../helpers/delay-as-milliseconds'; import delayAsMilliseconds from '../helpers/delay-as-milliseconds.js';
const DEFAULT_DELAY_DURATION = 0; const DEFAULT_DELAY_DURATION = 0;

View File

@@ -1,12 +1,12 @@
import { Worker } from 'bullmq'; import { Worker } from 'bullmq';
import process from 'node:process'; import process from 'node:process';
import * as Sentry from '../helpers/sentry.ee'; import * as Sentry from '../helpers/sentry.ee.js';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
import User from '../models/user'; import User from '../models/user.js';
import ExecutionStep from '../models/execution-step'; import ExecutionStep from '../models/execution-step.js';
export const worker = new Worker( export const worker = new Worker(
'delete-user', 'delete-user',

View File

@@ -1,12 +1,12 @@
import { Worker } from 'bullmq'; import { Worker } from 'bullmq';
import process from 'node:process'; import process from 'node:process';
import * as Sentry from '../helpers/sentry.ee'; import * as Sentry from '../helpers/sentry.ee.js';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
import mailer from '../helpers/mailer.ee'; import mailer from '../helpers/mailer.ee.js';
import compileEmail from '../helpers/compile-email.ee'; import compileEmail from '../helpers/compile-email.ee.js';
import appConfig from '../config/app'; import appConfig from '../config/app.js';
const isCloudSandbox = () => { const isCloudSandbox = () => {
return appConfig.isCloud && !appConfig.isProd; return appConfig.isCloud && !appConfig.isProd;

View File

@@ -1,17 +1,17 @@
import { Worker } from 'bullmq'; import { Worker } from 'bullmq';
import process from 'node:process'; import process from 'node:process';
import * as Sentry from '../helpers/sentry.ee'; import * as Sentry from '../helpers/sentry.ee.js';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
import flowQueue from '../queues/flow'; import flowQueue from '../queues/flow.js';
import triggerQueue from '../queues/trigger'; import triggerQueue from '../queues/trigger.js';
import { processFlow } from '../services/flow'; import { processFlow } from '../services/flow.js';
import Flow from '../models/flow'; import Flow from '../models/flow.js';
import { import {
REMOVE_AFTER_30_DAYS_OR_150_JOBS, REMOVE_AFTER_30_DAYS_OR_150_JOBS,
REMOVE_AFTER_7_DAYS_OR_50_JOBS, REMOVE_AFTER_7_DAYS_OR_50_JOBS,
} from '../helpers/remove-job-configuration'; } from '../helpers/remove-job-configuration.js';
export const worker = new Worker( export const worker = new Worker(
'flow', 'flow',

View File

@@ -1,16 +1,16 @@
import { Worker } from 'bullmq'; import { Worker } from 'bullmq';
import process from 'node:process'; import process from 'node:process';
import * as Sentry from '../helpers/sentry.ee'; import * as Sentry from '../helpers/sentry.ee.js';
import redisConfig from '../config/redis'; import redisConfig from '../config/redis.js';
import logger from '../helpers/logger'; import logger from '../helpers/logger.js';
import actionQueue from '../queues/action'; import actionQueue from '../queues/action.js';
import Step from '../models/step'; import Step from '../models/step.js';
import { processTrigger } from '../services/trigger'; import { processTrigger } from '../services/trigger.js';
import { import {
REMOVE_AFTER_30_DAYS_OR_150_JOBS, REMOVE_AFTER_30_DAYS_OR_150_JOBS,
REMOVE_AFTER_7_DAYS_OR_50_JOBS, REMOVE_AFTER_7_DAYS_OR_50_JOBS,
} from '../helpers/remove-job-configuration'; } from '../helpers/remove-job-configuration.js';
export const worker = new Worker( export const worker = new Worker(
'trigger', 'trigger',