chore: Use ES modules for backend app

This commit is contained in:
Faruk AYDIN
2024-01-05 19:08:04 +01:00
parent 43dba351c3
commit b2f8634008
97 changed files with 286 additions and 275 deletions

View File

@@ -1,4 +1,4 @@
import AppAuthClient from '../../models/app-auth-client';
import AppAuthClient from '../../models/app-auth-client.js';
const getAppAuthClient = async (_parent, params, context) => {
let canSeeAllClients = false;

View File

@@ -1,4 +1,4 @@
import AppConfig from '../../models/app-config';
import AppConfig from '../../models/app-config.js';
const getAppAuthClients = async (_parent, params, context) => {
let canSeeAllClients = false;

View File

@@ -1,4 +1,4 @@
import AppConfig from '../../models/app-config';
import AppConfig from '../../models/app-config.js';
const getAppConfig = async (_parent, params, context) => {
context.currentUser.can('create', 'Connection');

View File

@@ -1,5 +1,5 @@
import App from '../../models/app';
import Connection from '../../models/connection';
import App from '../../models/app.js';
import Connection from '../../models/connection.js';
const getApp = async (_parent, params, context) => {
const conditions = context.currentUser.can('read', 'Connection');

View File

@@ -1,4 +1,4 @@
import App from '../../models/app';
import App from '../../models/app.js';
const getApps = async (_parent, params) => {
const apps = await App.findAll(params.name);

View File

@@ -1,5 +1,5 @@
import appConfig from '../../config/app';
import { getLicense } from '../../helpers/license.ee';
import appConfig from '../../config/app.js';
import { getLicense } from '../../helpers/license.ee.js';
const getAutomatischInfo = async () => {
const license = await getLicense();

View File

@@ -1,6 +1,6 @@
import { DateTime } from 'luxon';
import Billing from '../../helpers/billing/index.ee';
import ExecutionStep from '../../models/execution-step';
import Billing from '../../helpers/billing/index.ee.js';
import ExecutionStep from '../../models/execution-step.js';
const getBillingAndUsage = async (_parent, _params, context) => {
const persistedSubscription = await context.currentUser.$relatedQuery(

View File

@@ -1,5 +1,5 @@
import { hasValidLicense } from '../../helpers/license.ee';
import Config from '../../models/config';
import { hasValidLicense } from '../../helpers/license.ee.js';
import Config from '../../models/config.js';
const getConfig = async (_parent, params) => {
if (!(await hasValidLicense())) return {};

View File

@@ -1,6 +1,6 @@
import App from '../../models/app';
import Flow from '../../models/flow';
import Connection from '../../models/connection';
import App from '../../models/app.js';
import Flow from '../../models/flow.js';
import Connection from '../../models/connection.js';
const getConnectedApps = async (_parent, params, context) => {
const conditions = context.currentUser.can('read', 'Connection');

View File

@@ -1,8 +1,8 @@
import App from '../../models/app';
import Step from '../../models/step';
import ExecutionStep from '../../models/execution-step';
import globalVariable from '../../helpers/global-variable';
import computeParameters from '../../helpers/compute-parameters';
import App from '../../models/app.js';
import Step from '../../models/step.js';
import ExecutionStep from '../../models/execution-step.js';
import globalVariable from '../../helpers/global-variable.js';
import computeParameters from '../../helpers/compute-parameters.js';
const getDynamicData = async (_parent, params, context) => {
const conditions = context.currentUser.can('update', 'Flow');

View File

@@ -1,6 +1,6 @@
import App from '../../models/app';
import Step from '../../models/step';
import globalVariable from '../../helpers/global-variable';
import App from '../../models/app.js';
import Step from '../../models/step.js';
import globalVariable from '../../helpers/global-variable.js';
const getDynamicFields = async (_parent, params, context) => {
const conditions = context.currentUser.can('update', 'Flow');

View File

@@ -1,5 +1,5 @@
import paginate from '../../helpers/pagination';
import Execution from '../../models/execution';
import paginate from '../../helpers/pagination.js';
import Execution from '../../models/execution.js';
const getExecutionSteps = async (_parent, params, context) => {
const conditions = context.currentUser.can('read', 'Execution');

View File

@@ -1,4 +1,4 @@
import Execution from '../../models/execution';
import Execution from '../../models/execution.js';
const getExecution = async (_parent, params, context) => {
const conditions = context.currentUser.can('read', 'Execution');

View File

@@ -1,7 +1,7 @@
import { raw } from 'objection';
import { DateTime } from 'luxon';
import Execution from '../../models/execution';
import paginate from '../../helpers/pagination';
import Execution from '../../models/execution.js';
import paginate from '../../helpers/pagination.js';
const getExecutions = async (_parent, params, context) => {
const conditions = context.currentUser.can('read', 'Execution');

View File

@@ -1,4 +1,4 @@
import Flow from '../../models/flow';
import Flow from '../../models/flow.js';
const getFlow = async (_parent, params, context) => {
const conditions = context.currentUser.can('read', 'Flow');

View File

@@ -1,5 +1,5 @@
import Flow from '../../models/flow';
import paginate from '../../helpers/pagination';
import Flow from '../../models/flow.js';
import paginate from '../../helpers/pagination.js';
const getFlows = async (_parent, params, context) => {
const conditions = context.currentUser.can('read', 'Flow');

View File

@@ -1,4 +1,4 @@
import Billing from '../../helpers/billing/index.ee';
import Billing from '../../helpers/billing/index.ee.js';
const getInvoices = async (_parent, _params, context) => {
const subscription = await context.currentUser.$relatedQuery(

View File

@@ -1,6 +1,7 @@
import axios from '../../helpers/axios-with-proxy';
import axios from '../../helpers/axios-with-proxy.js';
const NOTIFICATIONS_URL = 'https://notifications.automatisch.io/notifications.json';
const NOTIFICATIONS_URL =
'https://notifications.automatisch.io/notifications.json';
const getNotifications = async () => {
try {

View File

@@ -1,5 +1,5 @@
import appConfig from '../../config/app';
import Billing from '../../helpers/billing/index.ee';
import appConfig from '../../config/app.js';
import Billing from '../../helpers/billing/index.ee.js';
const getPaddleInfo = async () => {
if (!appConfig.isCloud) return;

View File

@@ -1,5 +1,5 @@
import appConfig from '../../config/app';
import Billing from '../../helpers/billing/index.ee';
import appConfig from '../../config/app.js';
import Billing from '../../helpers/billing/index.ee.js';
const getPaymentPlans = async () => {
if (!appConfig.isCloud) return;

View File

@@ -1,4 +1,4 @@
import permissionCatalog from '../../helpers/permission-catalog.ee';
import permissionCatalog from '../../helpers/permission-catalog.ee.js';
const getPermissionCatalog = async () => {
return permissionCatalog;

View File

@@ -1,4 +1,4 @@
import Role from '../../models/role';
import Role from '../../models/role.js';
const getRole = async (_parent, params, context) => {
context.currentUser.can('read', 'Role');

View File

@@ -1,4 +1,4 @@
import Role from '../../models/role';
import Role from '../../models/role.js';
const getRoles = async (_parent, params, context) => {
context.currentUser.can('read', 'Role');

View File

@@ -1,4 +1,4 @@
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
const getSamlAuthProviderRoleMappings = async (_parent, params, context) => {
context.currentUser.can('read', 'SamlAuthProvider');

View File

@@ -1,4 +1,4 @@
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
const getSamlAuthProvider = async (_parent, params, context) => {
context.currentUser.can('read', 'SamlAuthProvider');

View File

@@ -1,6 +1,6 @@
import { ref } from 'objection';
import ExecutionStep from '../../models/execution-step';
import Step from '../../models/step';
import ExecutionStep from '../../models/execution-step.js';
import Step from '../../models/step.js';
const getStepWithTestExecutions = async (_parent, params, context) => {
const conditions = context.currentUser.can('update', 'Flow');

View File

@@ -1,4 +1,4 @@
import appConfig from '../../config/app';
import appConfig from '../../config/app.js';
const getSubscriptionStatus = async (_parent, _params, context) => {
if (!appConfig.isCloud) return;

View File

@@ -1,4 +1,4 @@
import appConfig from '../../config/app';
import appConfig from '../../config/app.js';
const getTrialStatus = async (_parent, _params, context) => {
if (!appConfig.isCloud) return;

View File

@@ -1,4 +1,4 @@
import User from '../../models/user';
import User from '../../models/user.js';
const getUser = async (_parent, params, context) => {
context.currentUser.can('read', 'User');

View File

@@ -1,5 +1,5 @@
import paginate from '../../helpers/pagination';
import User from '../../models/user';
import paginate from '../../helpers/pagination.js';
import User from '../../models/user.js';
const getUsers = async (_parent, params, context) => {
context.currentUser.can('read', 'User');

View File

@@ -1,4 +1,4 @@
import appConfig from '../../config/app';
import appConfig from '../../config/app.js';
const healthcheck = () => {
return {

View File

@@ -1,4 +1,4 @@
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
const listSamlAuthProviders = async () => {
const providers = await SamlAuthProvider.query().where({ active: true });

View File

@@ -1,6 +1,6 @@
import App from '../../models/app';
import Connection from '../../models/connection';
import globalVariable from '../../helpers/global-variable';
import App from '../../models/app.js';
import Connection from '../../models/connection.js';
import globalVariable from '../../helpers/global-variable.js';
const testConnection = async (_parent, params, context) => {
const conditions = context.currentUser.can('update', 'Connection');