chore: Use ES modules for backend app
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
"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",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ts-node-dev --watch 'src/graphql/schema.graphql' --exit-child src/server.ts",
|
"dev": "nodemon --watch 'src/**/*.js' --exec 'node' src/server.js",
|
||||||
"worker": "nodemon --watch 'src/**/*.js' --exec 'node' src/worker.js",
|
"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/**/*.js' --watch 'bin/**/*.ts' --exec yarn build --ext ts",
|
"build:watch": "nodemon --watch 'src/**/*.js' --watch 'bin/**/*.ts' --exec yarn build --ext ts",
|
||||||
|
@@ -2,21 +2,21 @@ import createError from 'http-errors';
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
|
|
||||||
import appConfig from './config/app';
|
import appConfig from './config/app.js';
|
||||||
import corsOptions from './config/cors-options';
|
import corsOptions from './config/cors-options.js';
|
||||||
import morgan from './helpers/morgan';
|
import morgan from './helpers/morgan.js';
|
||||||
import * as Sentry from './helpers/sentry.ee';
|
import * as Sentry from './helpers/sentry.ee.js';
|
||||||
import appAssetsHandler from './helpers/app-assets-handler';
|
import appAssetsHandler from './helpers/app-assets-handler.js';
|
||||||
import webUIHandler from './helpers/web-ui-handler';
|
import webUIHandler from './helpers/web-ui-handler.js';
|
||||||
import errorHandler from './helpers/error-handler';
|
import errorHandler from './helpers/error-handler.js';
|
||||||
import './config/orm';
|
import './config/orm.js';
|
||||||
import {
|
import {
|
||||||
createBullBoardHandler,
|
createBullBoardHandler,
|
||||||
serverAdapter,
|
serverAdapter,
|
||||||
} from './helpers/create-bull-board-handler';
|
} from './helpers/create-bull-board-handler.js';
|
||||||
import injectBullBoardHandler from './helpers/inject-bull-board-handler';
|
import injectBullBoardHandler from './helpers/inject-bull-board-handler.js';
|
||||||
import router from './routes';
|
import router from './routes/index.js';
|
||||||
import configurePassport from './helpers/passport';
|
import configurePassport from './helpers/passport.js';
|
||||||
|
|
||||||
createBullBoardHandler(serverAdapter);
|
createBullBoardHandler(serverAdapter);
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import appConfig from './app';
|
import appConfig from './app.js';
|
||||||
|
|
||||||
const corsOptions = {
|
const corsOptions = {
|
||||||
origin: appConfig.webAppUrl,
|
origin: appConfig.webAppUrl,
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import { serialize } from 'php-serialize';
|
import { serialize } from 'php-serialize';
|
||||||
import Billing from '../../helpers/billing/index.ee';
|
import Billing from '../../helpers/billing/index.ee.js';
|
||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
|
|
||||||
export default async (request, response) => {
|
export default async (request, response) => {
|
||||||
if (!verifyWebhook(request)) {
|
if (!verifyWebhook(request)) {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import Connection from '../../models/connection';
|
import Connection from '../../models/connection.js';
|
||||||
import logger from '../../helpers/logger';
|
import logger from '../../helpers/logger.js';
|
||||||
import handler from '../../helpers/webhook-handler';
|
import handler from '../../helpers/webhook-handler.js';
|
||||||
|
|
||||||
export default async (request, response) => {
|
export default async (request, response) => {
|
||||||
const computedRequestPayload = {
|
const computedRequestPayload = {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
import logger from '../../helpers/logger';
|
import logger from '../../helpers/logger.js';
|
||||||
import handler from '../../helpers/webhook-handler';
|
import handler from '../../helpers/webhook-handler.js';
|
||||||
|
|
||||||
export default async (request, response) => {
|
export default async (request, response) => {
|
||||||
const computedRequestPayload = {
|
const computedRequestPayload = {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import BaseError from './base';
|
import BaseError from './base.js';
|
||||||
|
|
||||||
export default class QuotaExceededError extends BaseError {
|
export default class QuotaExceededError extends BaseError {
|
||||||
constructor(error = 'The allowed task quota has been exhausted!') {
|
constructor(error = 'The allowed task quota has been exhausted!') {
|
||||||
|
@@ -1,37 +1,37 @@
|
|||||||
import createAppAuthClient from './mutations/create-app-auth-client.ee';
|
import createAppAuthClient from './mutations/create-app-auth-client.ee.js';
|
||||||
import createAppConfig from './mutations/create-app-config.ee';
|
import createAppConfig from './mutations/create-app-config.ee.js';
|
||||||
import createConnection from './mutations/create-connection';
|
import createConnection from './mutations/create-connection.js';
|
||||||
import createFlow from './mutations/create-flow';
|
import createFlow from './mutations/create-flow.js';
|
||||||
import createRole from './mutations/create-role.ee';
|
import createRole from './mutations/create-role.ee.js';
|
||||||
import createStep from './mutations/create-step';
|
import createStep from './mutations/create-step.js';
|
||||||
import createUser from './mutations/create-user.ee';
|
import createUser from './mutations/create-user.ee.js';
|
||||||
import deleteConnection from './mutations/delete-connection';
|
import deleteConnection from './mutations/delete-connection.js';
|
||||||
import deleteCurrentUser from './mutations/delete-current-user.ee';
|
import deleteCurrentUser from './mutations/delete-current-user.ee.js';
|
||||||
import deleteFlow from './mutations/delete-flow';
|
import deleteFlow from './mutations/delete-flow.js';
|
||||||
import deleteRole from './mutations/delete-role.ee';
|
import deleteRole from './mutations/delete-role.ee.js';
|
||||||
import deleteStep from './mutations/delete-step';
|
import deleteStep from './mutations/delete-step.js';
|
||||||
import deleteUser from './mutations/delete-user.ee';
|
import deleteUser from './mutations/delete-user.ee.js';
|
||||||
import duplicateFlow from './mutations/duplicate-flow';
|
import duplicateFlow from './mutations/duplicate-flow.js';
|
||||||
import executeFlow from './mutations/execute-flow';
|
import executeFlow from './mutations/execute-flow.js';
|
||||||
import forgotPassword from './mutations/forgot-password.ee';
|
import forgotPassword from './mutations/forgot-password.ee.js';
|
||||||
import generateAuthUrl from './mutations/generate-auth-url';
|
import generateAuthUrl from './mutations/generate-auth-url.js';
|
||||||
import login from './mutations/login';
|
import login from './mutations/login.js';
|
||||||
import registerUser from './mutations/register-user.ee';
|
import registerUser from './mutations/register-user.ee.js';
|
||||||
import resetConnection from './mutations/reset-connection';
|
import resetConnection from './mutations/reset-connection.js';
|
||||||
import resetPassword from './mutations/reset-password.ee';
|
import resetPassword from './mutations/reset-password.ee.js';
|
||||||
import updateAppAuthClient from './mutations/update-app-auth-client.ee';
|
import updateAppAuthClient from './mutations/update-app-auth-client.ee.js';
|
||||||
import updateAppConfig from './mutations/update-app-config.ee';
|
import updateAppConfig from './mutations/update-app-config.ee.js';
|
||||||
import updateConfig from './mutations/update-config.ee';
|
import updateConfig from './mutations/update-config.ee.js';
|
||||||
import updateConnection from './mutations/update-connection';
|
import updateConnection from './mutations/update-connection.js';
|
||||||
import updateCurrentUser from './mutations/update-current-user';
|
import updateCurrentUser from './mutations/update-current-user.js';
|
||||||
import updateFlow from './mutations/update-flow';
|
import updateFlow from './mutations/update-flow.js';
|
||||||
import updateFlowStatus from './mutations/update-flow-status';
|
import updateFlowStatus from './mutations/update-flow-status.js';
|
||||||
import updateRole from './mutations/update-role.ee';
|
import updateRole from './mutations/update-role.ee.js';
|
||||||
import updateStep from './mutations/update-step';
|
import updateStep from './mutations/update-step.js';
|
||||||
import updateUser from './mutations/update-user.ee';
|
import updateUser from './mutations/update-user.ee.js';
|
||||||
import upsertSamlAuthProvider from './mutations/upsert-saml-auth-provider.ee';
|
import upsertSamlAuthProvider from './mutations/upsert-saml-auth-provider.ee.js';
|
||||||
import upsertSamlAuthProvidersRoleMappings from './mutations/upsert-saml-auth-providers-role-mappings.ee';
|
import upsertSamlAuthProvidersRoleMappings from './mutations/upsert-saml-auth-providers-role-mappings.ee.js';
|
||||||
import verifyConnection from './mutations/verify-connection';
|
import verifyConnection from './mutations/verify-connection.js';
|
||||||
|
|
||||||
const mutationResolvers = {
|
const mutationResolvers = {
|
||||||
createAppAuthClient,
|
createAppAuthClient,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import AppConfig from '../../models/app-config';
|
import AppConfig from '../../models/app-config.js';
|
||||||
|
|
||||||
const createAppAuthClient = async (_parent, params, context) => {
|
const createAppAuthClient = async (_parent, params, context) => {
|
||||||
context.currentUser.can('update', 'App');
|
context.currentUser.can('update', 'App');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import AppConfig from '../../models/app-config';
|
import AppConfig from '../../models/app-config.js';
|
||||||
|
|
||||||
const createAppConfig = async (_parent, params, context) => {
|
const createAppConfig = async (_parent, params, context) => {
|
||||||
context.currentUser.can('update', 'App');
|
context.currentUser.can('update', 'App');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import AppConfig from '../../models/app-config';
|
import AppConfig from '../../models/app-config.js';
|
||||||
|
|
||||||
const createConnection = async (_parent, params, context) => {
|
const createConnection = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'Connection');
|
context.currentUser.can('create', 'Connection');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Step from '../../models/step';
|
import Step from '../../models/step.js';
|
||||||
|
|
||||||
const createFlow = async (_parent, params, context) => {
|
const createFlow = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'Flow');
|
context.currentUser.can('create', 'Flow');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import kebabCase from 'lodash/kebabCase';
|
import kebabCase from 'lodash/kebabCase.js';
|
||||||
import Role from '../../models/role';
|
import Role from '../../models/role.js';
|
||||||
|
|
||||||
const createRole = async (_parent, params, context) => {
|
const createRole = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'Role');
|
context.currentUser.can('create', 'Role');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
|
|
||||||
const createStep = async (_parent, params, context) => {
|
const createStep = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('update', 'Flow');
|
const conditions = context.currentUser.can('update', 'Flow');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
import Role from '../../models/role';
|
import Role from '../../models/role.js';
|
||||||
|
|
||||||
const createUser = async (_parent, params, context) => {
|
const createUser = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'User');
|
context.currentUser.can('create', 'User');
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Duration } from 'luxon';
|
import { Duration } from 'luxon';
|
||||||
import deleteUserQueue from '../../queues/delete-user.ee';
|
import deleteUserQueue from '../../queues/delete-user.ee.js';
|
||||||
import flowQueue from '../../queues/flow';
|
import flowQueue from '../../queues/flow.js';
|
||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
import ExecutionStep from '../../models/execution-step';
|
import ExecutionStep from '../../models/execution-step.js';
|
||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
|
|
||||||
const deleteCurrentUser = async (_parent, params, context) => {
|
const deleteCurrentUser = async (_parent, params, context) => {
|
||||||
const id = context.currentUser.id;
|
const id = context.currentUser.id;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
import ExecutionStep from '../../models/execution-step';
|
import ExecutionStep from '../../models/execution-step.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';
|
||||||
|
|
||||||
const deleteFlow = async (_parent, params, context) => {
|
const deleteFlow = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('delete', 'Flow');
|
const conditions = context.currentUser.can('delete', 'Flow');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import Role from '../../models/role';
|
import Role from '../../models/role.js';
|
||||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
|
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
|
||||||
|
|
||||||
const deleteRole = async (_parent, params, context) => {
|
const deleteRole = async (_parent, params, context) => {
|
||||||
context.currentUser.can('delete', 'Role');
|
context.currentUser.can('delete', 'Role');
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { Duration } from 'luxon';
|
import { Duration } from 'luxon';
|
||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
import deleteUserQueue from '../../queues/delete-user.ee';
|
import deleteUserQueue from '../../queues/delete-user.ee.js';
|
||||||
|
|
||||||
const deleteUser = async (_parent, params, context) => {
|
const deleteUser = async (_parent, params, context) => {
|
||||||
context.currentUser.can('delete', 'User');
|
context.currentUser.can('delete', 'User');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import testRun from '../../services/test-run';
|
import testRun from '../../services/test-run.js';
|
||||||
import Step from '../../models/step';
|
import Step from '../../models/step.js';
|
||||||
|
|
||||||
const executeFlow = async (_parent, params, context) => {
|
const executeFlow = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('update', 'Flow');
|
const conditions = context.currentUser.can('update', 'Flow');
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
import emailQueue from '../../queues/email';
|
import emailQueue from '../../queues/email.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';
|
||||||
|
|
||||||
const forgotPassword = async (_parent, params) => {
|
const forgotPassword = async (_parent, params) => {
|
||||||
const { email } = params.input;
|
const { email } = params.input;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import globalVariable from '../../helpers/global-variable';
|
import globalVariable from '../../helpers/global-variable.js';
|
||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
|
|
||||||
const generateAuthUrl = async (_parent, params, context) => {
|
const generateAuthUrl = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'Connection');
|
context.currentUser.can('create', 'Connection');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
import createAuthTokenByUserId from '../../helpers/create-auth-token-by-user-id';
|
import createAuthTokenByUserId from '../../helpers/create-auth-token-by-user-id.js';
|
||||||
|
|
||||||
const login = async (_parent, params) => {
|
const login = async (_parent, params) => {
|
||||||
const user = await User.query().findOne({
|
const user = await User.query().findOne({
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
import Role from '../../models/role';
|
import Role from '../../models/role.js';
|
||||||
|
|
||||||
const registerUser = async (_parent, params) => {
|
const registerUser = async (_parent, params) => {
|
||||||
const { fullName, email, password } = params.input;
|
const { fullName, email, password } = params.input;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
|
|
||||||
const resetPassword = async (_parent, params) => {
|
const resetPassword = async (_parent, params) => {
|
||||||
const { token, password } = params.input;
|
const { token, password } = params.input;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import AppAuthClient from '../../models/app-auth-client';
|
import AppAuthClient from '../../models/app-auth-client.js';
|
||||||
|
|
||||||
const updateAppAuthClient = async (_parent, params, context) => {
|
const updateAppAuthClient = async (_parent, params, context) => {
|
||||||
context.currentUser.can('update', 'App');
|
context.currentUser.can('update', 'App');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import AppConfig from '../../models/app-config';
|
import AppConfig from '../../models/app-config.js';
|
||||||
|
|
||||||
const updateAppConfig = async (_parent, params, context) => {
|
const updateAppConfig = async (_parent, params, context) => {
|
||||||
context.currentUser.can('update', 'App');
|
context.currentUser.can('update', 'App');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import Config from '../../models/config';
|
import Config from '../../models/config.js';
|
||||||
|
|
||||||
const updateConfig = async (_parent, params, context) => {
|
const updateConfig = async (_parent, params, context) => {
|
||||||
context.currentUser.can('update', 'Config');
|
context.currentUser.can('update', 'Config');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import AppAuthClient from '../../models/app-auth-client';
|
import AppAuthClient from '../../models/app-auth-client.js';
|
||||||
|
|
||||||
const updateConnection = async (_parent, params, context) => {
|
const updateConnection = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'Connection');
|
context.currentUser.can('create', 'Connection');
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
import flowQueue from '../../queues/flow';
|
import flowQueue from '../../queues/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';
|
||||||
import globalVariable from '../../helpers/global-variable';
|
import globalVariable from '../../helpers/global-variable.js';
|
||||||
|
|
||||||
const JOB_NAME = 'flow';
|
const JOB_NAME = 'flow';
|
||||||
const EVERY_15_MINUTES_CRON = '*/15 * * * *';
|
const EVERY_15_MINUTES_CRON = '*/15 * * * *';
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import Role from '../../models/role';
|
import Role from '../../models/role.js';
|
||||||
import Permission from '../../models/permission';
|
import Permission from '../../models/permission.js';
|
||||||
import permissionCatalog from '../../helpers/permission-catalog.ee';
|
import permissionCatalog from '../../helpers/permission-catalog.ee.js';
|
||||||
|
|
||||||
const updateRole = async (_parent, params, context) => {
|
const updateRole = async (_parent, params, context) => {
|
||||||
context.currentUser.can('update', 'Role');
|
context.currentUser.can('update', 'Role');
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Step from '../../models/step';
|
import Step from '../../models/step.js';
|
||||||
import Connection from '../../models/connection';
|
import Connection from '../../models/connection.js';
|
||||||
|
|
||||||
const updateStep = async (_parent, params, context) => {
|
const updateStep = async (_parent, params, context) => {
|
||||||
const { isCreator } = context.currentUser.can('update', 'Flow');
|
const { isCreator } = context.currentUser.can('update', 'Flow');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
|
|
||||||
const updateUser = async (_parent, params, context) => {
|
const updateUser = async (_parent, params, context) => {
|
||||||
context.currentUser.can('update', 'User');
|
context.currentUser.can('update', 'User');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
|
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
|
||||||
|
|
||||||
const upsertSamlAuthProvider = async (_parent, params, context) => {
|
const upsertSamlAuthProvider = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'SamlAuthProvider');
|
context.currentUser.can('create', 'SamlAuthProvider');
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
|
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
|
||||||
import SamlAuthProvidersRoleMapping from '../../models/saml-auth-providers-role-mapping.ee';
|
import SamlAuthProvidersRoleMapping from '../../models/saml-auth-providers-role-mapping.ee.js';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty.js';
|
||||||
|
|
||||||
const upsertSamlAuthProvidersRoleMappings = async (
|
const upsertSamlAuthProvidersRoleMappings = async (
|
||||||
_parent,
|
_parent,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import globalVariable from '../../helpers/global-variable';
|
import globalVariable from '../../helpers/global-variable.js';
|
||||||
|
|
||||||
const verifyConnection = async (_parent, params, context) => {
|
const verifyConnection = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'Connection');
|
context.currentUser.can('create', 'Connection');
|
||||||
|
@@ -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) => {
|
const getAppAuthClient = async (_parent, params, context) => {
|
||||||
let canSeeAllClients = false;
|
let canSeeAllClients = false;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import AppConfig from '../../models/app-config';
|
import AppConfig from '../../models/app-config.js';
|
||||||
|
|
||||||
const getAppAuthClients = async (_parent, params, context) => {
|
const getAppAuthClients = async (_parent, params, context) => {
|
||||||
let canSeeAllClients = false;
|
let canSeeAllClients = false;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import AppConfig from '../../models/app-config';
|
import AppConfig from '../../models/app-config.js';
|
||||||
|
|
||||||
const getAppConfig = async (_parent, params, context) => {
|
const getAppConfig = async (_parent, params, context) => {
|
||||||
context.currentUser.can('create', 'Connection');
|
context.currentUser.can('create', 'Connection');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Connection from '../../models/connection';
|
import Connection from '../../models/connection.js';
|
||||||
|
|
||||||
const getApp = async (_parent, params, context) => {
|
const getApp = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('read', 'Connection');
|
const conditions = context.currentUser.can('read', 'Connection');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
|
|
||||||
const getApps = async (_parent, params) => {
|
const getApps = async (_parent, params) => {
|
||||||
const apps = await App.findAll(params.name);
|
const apps = await App.findAll(params.name);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
import { getLicense } from '../../helpers/license.ee';
|
import { getLicense } from '../../helpers/license.ee.js';
|
||||||
|
|
||||||
const getAutomatischInfo = async () => {
|
const getAutomatischInfo = async () => {
|
||||||
const license = await getLicense();
|
const license = await getLicense();
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import Billing from '../../helpers/billing/index.ee';
|
import Billing from '../../helpers/billing/index.ee.js';
|
||||||
import ExecutionStep from '../../models/execution-step';
|
import ExecutionStep from '../../models/execution-step.js';
|
||||||
|
|
||||||
const getBillingAndUsage = async (_parent, _params, context) => {
|
const getBillingAndUsage = async (_parent, _params, context) => {
|
||||||
const persistedSubscription = await context.currentUser.$relatedQuery(
|
const persistedSubscription = await context.currentUser.$relatedQuery(
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { hasValidLicense } from '../../helpers/license.ee';
|
import { hasValidLicense } from '../../helpers/license.ee.js';
|
||||||
import Config from '../../models/config';
|
import Config from '../../models/config.js';
|
||||||
|
|
||||||
const getConfig = async (_parent, params) => {
|
const getConfig = async (_parent, params) => {
|
||||||
if (!(await hasValidLicense())) return {};
|
if (!(await hasValidLicense())) return {};
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
import Connection from '../../models/connection';
|
import Connection from '../../models/connection.js';
|
||||||
|
|
||||||
const getConnectedApps = async (_parent, params, context) => {
|
const getConnectedApps = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('read', 'Connection');
|
const conditions = context.currentUser.can('read', 'Connection');
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Step from '../../models/step';
|
import Step from '../../models/step.js';
|
||||||
import ExecutionStep from '../../models/execution-step';
|
import ExecutionStep from '../../models/execution-step.js';
|
||||||
import globalVariable from '../../helpers/global-variable';
|
import globalVariable from '../../helpers/global-variable.js';
|
||||||
import computeParameters from '../../helpers/compute-parameters';
|
import computeParameters from '../../helpers/compute-parameters.js';
|
||||||
|
|
||||||
const getDynamicData = async (_parent, params, context) => {
|
const getDynamicData = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('update', 'Flow');
|
const conditions = context.currentUser.can('update', 'Flow');
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Step from '../../models/step';
|
import Step from '../../models/step.js';
|
||||||
import globalVariable from '../../helpers/global-variable';
|
import globalVariable from '../../helpers/global-variable.js';
|
||||||
|
|
||||||
const getDynamicFields = async (_parent, params, context) => {
|
const getDynamicFields = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('update', 'Flow');
|
const conditions = context.currentUser.can('update', 'Flow');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import paginate from '../../helpers/pagination';
|
import paginate from '../../helpers/pagination.js';
|
||||||
import Execution from '../../models/execution';
|
import Execution from '../../models/execution.js';
|
||||||
|
|
||||||
const getExecutionSteps = async (_parent, params, context) => {
|
const getExecutionSteps = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('read', 'Execution');
|
const conditions = context.currentUser.can('read', 'Execution');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import Execution from '../../models/execution';
|
import Execution from '../../models/execution.js';
|
||||||
|
|
||||||
const getExecution = async (_parent, params, context) => {
|
const getExecution = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('read', 'Execution');
|
const conditions = context.currentUser.can('read', 'Execution');
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { raw } from 'objection';
|
import { raw } from 'objection';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import Execution from '../../models/execution';
|
import Execution from '../../models/execution.js';
|
||||||
import paginate from '../../helpers/pagination';
|
import paginate from '../../helpers/pagination.js';
|
||||||
|
|
||||||
const getExecutions = async (_parent, params, context) => {
|
const getExecutions = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('read', 'Execution');
|
const conditions = context.currentUser.can('read', 'Execution');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
|
|
||||||
const getFlow = async (_parent, params, context) => {
|
const getFlow = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('read', 'Flow');
|
const conditions = context.currentUser.can('read', 'Flow');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow.js';
|
||||||
import paginate from '../../helpers/pagination';
|
import paginate from '../../helpers/pagination.js';
|
||||||
|
|
||||||
const getFlows = async (_parent, params, context) => {
|
const getFlows = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('read', 'Flow');
|
const conditions = context.currentUser.can('read', 'Flow');
|
||||||
|
@@ -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 getInvoices = async (_parent, _params, context) => {
|
||||||
const subscription = await context.currentUser.$relatedQuery(
|
const subscription = await context.currentUser.$relatedQuery(
|
||||||
|
@@ -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 () => {
|
const getNotifications = async () => {
|
||||||
try {
|
try {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
import Billing from '../../helpers/billing/index.ee';
|
import Billing from '../../helpers/billing/index.ee.js';
|
||||||
|
|
||||||
const getPaddleInfo = async () => {
|
const getPaddleInfo = async () => {
|
||||||
if (!appConfig.isCloud) return;
|
if (!appConfig.isCloud) return;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
import Billing from '../../helpers/billing/index.ee';
|
import Billing from '../../helpers/billing/index.ee.js';
|
||||||
|
|
||||||
const getPaymentPlans = async () => {
|
const getPaymentPlans = async () => {
|
||||||
if (!appConfig.isCloud) return;
|
if (!appConfig.isCloud) return;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import permissionCatalog from '../../helpers/permission-catalog.ee';
|
import permissionCatalog from '../../helpers/permission-catalog.ee.js';
|
||||||
|
|
||||||
const getPermissionCatalog = async () => {
|
const getPermissionCatalog = async () => {
|
||||||
return permissionCatalog;
|
return permissionCatalog;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import Role from '../../models/role';
|
import Role from '../../models/role.js';
|
||||||
|
|
||||||
const getRole = async (_parent, params, context) => {
|
const getRole = async (_parent, params, context) => {
|
||||||
context.currentUser.can('read', 'Role');
|
context.currentUser.can('read', 'Role');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import Role from '../../models/role';
|
import Role from '../../models/role.js';
|
||||||
|
|
||||||
const getRoles = async (_parent, params, context) => {
|
const getRoles = async (_parent, params, context) => {
|
||||||
context.currentUser.can('read', 'Role');
|
context.currentUser.can('read', 'Role');
|
||||||
|
@@ -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) => {
|
const getSamlAuthProviderRoleMappings = async (_parent, params, context) => {
|
||||||
context.currentUser.can('read', 'SamlAuthProvider');
|
context.currentUser.can('read', 'SamlAuthProvider');
|
||||||
|
@@ -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) => {
|
const getSamlAuthProvider = async (_parent, params, context) => {
|
||||||
context.currentUser.can('read', 'SamlAuthProvider');
|
context.currentUser.can('read', 'SamlAuthProvider');
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { ref } from 'objection';
|
import { ref } from 'objection';
|
||||||
import ExecutionStep from '../../models/execution-step';
|
import ExecutionStep from '../../models/execution-step.js';
|
||||||
import Step from '../../models/step';
|
import Step from '../../models/step.js';
|
||||||
|
|
||||||
const getStepWithTestExecutions = async (_parent, params, context) => {
|
const getStepWithTestExecutions = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('update', 'Flow');
|
const conditions = context.currentUser.can('update', 'Flow');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
|
|
||||||
const getSubscriptionStatus = async (_parent, _params, context) => {
|
const getSubscriptionStatus = async (_parent, _params, context) => {
|
||||||
if (!appConfig.isCloud) return;
|
if (!appConfig.isCloud) return;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
|
|
||||||
const getTrialStatus = async (_parent, _params, context) => {
|
const getTrialStatus = async (_parent, _params, context) => {
|
||||||
if (!appConfig.isCloud) return;
|
if (!appConfig.isCloud) return;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
|
|
||||||
const getUser = async (_parent, params, context) => {
|
const getUser = async (_parent, params, context) => {
|
||||||
context.currentUser.can('read', 'User');
|
context.currentUser.can('read', 'User');
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import paginate from '../../helpers/pagination';
|
import paginate from '../../helpers/pagination.js';
|
||||||
import User from '../../models/user';
|
import User from '../../models/user.js';
|
||||||
|
|
||||||
const getUsers = async (_parent, params, context) => {
|
const getUsers = async (_parent, params, context) => {
|
||||||
context.currentUser.can('read', 'User');
|
context.currentUser.can('read', 'User');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
|
|
||||||
const healthcheck = () => {
|
const healthcheck = () => {
|
||||||
return {
|
return {
|
||||||
|
@@ -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 listSamlAuthProviders = async () => {
|
||||||
const providers = await SamlAuthProvider.query().where({ active: true });
|
const providers = await SamlAuthProvider.query().where({ active: true });
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import App from '../../models/app';
|
import App from '../../models/app.js';
|
||||||
import Connection from '../../models/connection';
|
import Connection from '../../models/connection.js';
|
||||||
import globalVariable from '../../helpers/global-variable';
|
import globalVariable from '../../helpers/global-variable.js';
|
||||||
|
|
||||||
const testConnection = async (_parent, params, context) => {
|
const testConnection = async (_parent, params, context) => {
|
||||||
const conditions = context.currentUser.can('update', 'Connection');
|
const conditions = context.currentUser.can('update', 'Connection');
|
||||||
|
@@ -1,37 +1,37 @@
|
|||||||
import getApp from './queries/get-app';
|
import getApp from './queries/get-app.js';
|
||||||
import getAppAuthClient from './queries/get-app-auth-client.ee';
|
import getAppAuthClient from './queries/get-app-auth-client.ee.js';
|
||||||
import getAppAuthClients from './queries/get-app-auth-clients.ee';
|
import getAppAuthClients from './queries/get-app-auth-clients.ee.js';
|
||||||
import getAppConfig from './queries/get-app-config.ee';
|
import getAppConfig from './queries/get-app-config.ee.js';
|
||||||
import getApps from './queries/get-apps';
|
import getApps from './queries/get-apps.js';
|
||||||
import getAutomatischInfo from './queries/get-automatisch-info';
|
import getAutomatischInfo from './queries/get-automatisch-info.js';
|
||||||
import getBillingAndUsage from './queries/get-billing-and-usage.ee';
|
import getBillingAndUsage from './queries/get-billing-and-usage.ee.js';
|
||||||
import getConfig from './queries/get-config.ee';
|
import getConfig from './queries/get-config.ee.js';
|
||||||
import getConnectedApps from './queries/get-connected-apps';
|
import getConnectedApps from './queries/get-connected-apps.js';
|
||||||
import getCurrentUser from './queries/get-current-user';
|
import getCurrentUser from './queries/get-current-user.js';
|
||||||
import getDynamicData from './queries/get-dynamic-data';
|
import getDynamicData from './queries/get-dynamic-data.js';
|
||||||
import getDynamicFields from './queries/get-dynamic-fields';
|
import getDynamicFields from './queries/get-dynamic-fields.js';
|
||||||
import getExecution from './queries/get-execution';
|
import getExecution from './queries/get-execution.js';
|
||||||
import getExecutionSteps from './queries/get-execution-steps';
|
import getExecutionSteps from './queries/get-execution-steps.js';
|
||||||
import getExecutions from './queries/get-executions';
|
import getExecutions from './queries/get-executions.js';
|
||||||
import getFlow from './queries/get-flow';
|
import getFlow from './queries/get-flow.js';
|
||||||
import getFlows from './queries/get-flows';
|
import getFlows from './queries/get-flows.js';
|
||||||
import getInvoices from './queries/get-invoices.ee';
|
import getInvoices from './queries/get-invoices.ee.js';
|
||||||
import getNotifications from './queries/get-notifications';
|
import getNotifications from './queries/get-notifications.js';
|
||||||
import getPaddleInfo from './queries/get-paddle-info.ee';
|
import getPaddleInfo from './queries/get-paddle-info.ee.js';
|
||||||
import getPaymentPlans from './queries/get-payment-plans.ee';
|
import getPaymentPlans from './queries/get-payment-plans.ee.js';
|
||||||
import getPermissionCatalog from './queries/get-permission-catalog.ee';
|
import getPermissionCatalog from './queries/get-permission-catalog.ee.js';
|
||||||
import getRole from './queries/get-role.ee';
|
import getRole from './queries/get-role.ee.js';
|
||||||
import getRoles from './queries/get-roles.ee';
|
import getRoles from './queries/get-roles.ee.js';
|
||||||
import getSamlAuthProviderRoleMappings from './queries/get-saml-auth-provider-role-mappings.ee';
|
import getSamlAuthProviderRoleMappings from './queries/get-saml-auth-provider-role-mappings.ee.js';
|
||||||
import getSamlAuthProvider from './queries/get-saml-auth-provider.ee';
|
import getSamlAuthProvider from './queries/get-saml-auth-provider.ee.js';
|
||||||
import getStepWithTestExecutions from './queries/get-step-with-test-executions';
|
import getStepWithTestExecutions from './queries/get-step-with-test-executions.js';
|
||||||
import getSubscriptionStatus from './queries/get-subscription-status.ee';
|
import getSubscriptionStatus from './queries/get-subscription-status.ee.js';
|
||||||
import getTrialStatus from './queries/get-trial-status.ee';
|
import getTrialStatus from './queries/get-trial-status.ee.js';
|
||||||
import getUser from './queries/get-user';
|
import getUser from './queries/get-user.js';
|
||||||
import getUsers from './queries/get-users';
|
import getUsers from './queries/get-users.js';
|
||||||
import healthcheck from './queries/healthcheck';
|
import healthcheck from './queries/healthcheck.js';
|
||||||
import listSamlAuthProviders from './queries/list-saml-auth-providers.ee';
|
import listSamlAuthProviders from './queries/list-saml-auth-providers.ee.js';
|
||||||
import testConnection from './queries/test-connection';
|
import testConnection from './queries/test-connection.js';
|
||||||
|
|
||||||
const queryResolvers = {
|
const queryResolvers = {
|
||||||
getApp,
|
getApp,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import mutationResolvers from './mutation-resolvers';
|
import mutationResolvers from './mutation-resolvers.js';
|
||||||
import queryResolvers from './query-resolvers';
|
import queryResolvers from './query-resolvers.js';
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
Query: queryResolvers,
|
Query: queryResolvers,
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const appAssetsHandler = async (app) => {
|
const appAssetsHandler = async (app) => {
|
||||||
app.use('/apps/:appKey/assets/favicon.svg', (req, res, next) => {
|
app.use('/apps/:appKey/assets/favicon.svg', (req, res, next) => {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { allow, rule, shield } from 'graphql-shield';
|
import { allow, rule, shield } from 'graphql-shield';
|
||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
import User from '../models/user';
|
import User from '../models/user.js';
|
||||||
|
|
||||||
const isAuthenticated = rule()(async (_parent, _args, req) => {
|
const isAuthenticated = rule()(async (_parent, _args, req) => {
|
||||||
const token = req.headers['authorization'];
|
const token = req.headers['authorization'];
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
import paddleClient from './paddle.ee';
|
import paddleClient from './paddle.ee.js';
|
||||||
import paddlePlans from './plans.ee';
|
import paddlePlans from './plans.ee.js';
|
||||||
import webhooks from './webhooks.ee';
|
import webhooks from './webhooks.ee.js';
|
||||||
|
|
||||||
const paddleInfo = {
|
const paddleInfo = {
|
||||||
sandbox: appConfig.isProd ? false : true,
|
sandbox: appConfig.isProd ? false : true,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// TODO: replace with axios-with-proxy when needed
|
// TODO: replace with axios-with-proxy when needed
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app.js';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
const PADDLE_VENDOR_URL = appConfig.isDev
|
const PADDLE_VENDOR_URL = appConfig.isDev
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import Subscription from '../../models/subscription.ee';
|
import Subscription from '../../models/subscription.ee.js';
|
||||||
import Billing from './index.ee';
|
import Billing from './index.ee.js';
|
||||||
|
|
||||||
const handleSubscriptionCreated = async (request) => {
|
const handleSubscriptionCreated = async (request) => {
|
||||||
const subscription = await Subscription.query().insertAndFetch(
|
const subscription = await Subscription.query().insertAndFetch(
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
|
|
||||||
const TOKEN_EXPIRES_IN = '14d';
|
const TOKEN_EXPIRES_IN = '14d';
|
||||||
|
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { ExpressAdapter } from '@bull-board/express';
|
import { ExpressAdapter } from '@bull-board/express';
|
||||||
import { createBullBoard } from '@bull-board/api';
|
import { createBullBoard } from '@bull-board/api';
|
||||||
import { BullMQAdapter } from '@bull-board/api/bullMQAdapter';
|
import { BullMQAdapter } from '@bull-board/api/bullMQAdapter.js';
|
||||||
import flowQueue from '../queues/flow';
|
import flowQueue from '../queues/flow.js';
|
||||||
import triggerQueue from '../queues/trigger';
|
import triggerQueue from '../queues/trigger.js';
|
||||||
import actionQueue from '../queues/action';
|
import actionQueue from '../queues/action.js';
|
||||||
import emailQueue from '../queues/email';
|
import emailQueue from '../queues/email.js';
|
||||||
import deleteUserQueue from '../queues/delete-user.ee';
|
import deleteUserQueue from '../queues/delete-user.ee.js';
|
||||||
import removeCancelledSubscriptionsQueue from '../queues/remove-cancelled-subscriptions.ee';
|
import removeCancelledSubscriptionsQueue from '../queues/remove-cancelled-subscriptions.ee.js';
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
|
|
||||||
const serverAdapter = new ExpressAdapter();
|
const serverAdapter = new ExpressAdapter();
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import logger from './logger';
|
import logger from './logger.js';
|
||||||
|
|
||||||
// Do not remove `next` argument as the function signature will not fit for an error handler middleware
|
// Do not remove `next` argument as the function signature will not fit for an error handler middleware
|
||||||
const errorHandler = (err, req, res, next) => {
|
const errorHandler = (err, req, res, next) => {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import User from '../models/user';
|
import User from '../models/user.js';
|
||||||
import Identity from '../models/identity.ee';
|
import Identity from '../models/identity.ee.js';
|
||||||
|
|
||||||
const getUser = (user, providerConfig) => ({
|
const getUser = (user, providerConfig) => ({
|
||||||
name: user[providerConfig.firstnameAttributeName],
|
name: user[providerConfig.firstnameAttributeName],
|
||||||
|
@@ -1,16 +1,19 @@
|
|||||||
import { join } from 'node:path';
|
import path, { join } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
import { graphqlHTTP } from 'express-graphql';
|
import { graphqlHTTP } from 'express-graphql';
|
||||||
import { loadSchemaSync } from '@graphql-tools/load';
|
import { loadSchemaSync } from '@graphql-tools/load';
|
||||||
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
||||||
import { addResolversToSchema } from '@graphql-tools/schema';
|
import { addResolversToSchema } from '@graphql-tools/schema';
|
||||||
import { applyMiddleware } from 'graphql-middleware';
|
import { applyMiddleware } from 'graphql-middleware';
|
||||||
|
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
import logger from './logger';
|
import logger from './logger.js';
|
||||||
import authentication from './authentication';
|
import authentication from './authentication.js';
|
||||||
import * as Sentry from './sentry.ee';
|
import * as Sentry from './sentry.ee.js';
|
||||||
import resolvers from '../graphql/resolvers';
|
import resolvers from '../graphql/resolvers.js';
|
||||||
import HttpError from '../errors/http';
|
import HttpError from '../errors/http.js';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const schema = loadSchemaSync(join(__dirname, '../graphql/schema.graphql'), {
|
const schema = loadSchemaSync(join(__dirname, '../graphql/schema.graphql'), {
|
||||||
loaders: [new GraphQLFileLoader()],
|
loaders: [new GraphQLFileLoader()],
|
||||||
@@ -22,7 +25,10 @@ const schemaWithResolvers = addResolversToSchema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const graphQLInstance = graphqlHTTP({
|
const graphQLInstance = graphqlHTTP({
|
||||||
schema: applyMiddleware(schemaWithResolvers, authentication),
|
schema: applyMiddleware(
|
||||||
|
schemaWithResolvers,
|
||||||
|
authentication.generate(schemaWithResolvers)
|
||||||
|
),
|
||||||
graphiql: appConfig.isDev,
|
graphiql: appConfig.isDev,
|
||||||
customFormatErrorFn: (error) => {
|
customFormatErrorFn: (error) => {
|
||||||
logger.error(error.path + ' : ' + error.message + '\n' + error.stack);
|
logger.error(error.path + ' : ' + error.message + '\n' + error.stack);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import basicAuth from 'express-basic-auth';
|
import basicAuth from 'express-basic-auth';
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
|
|
||||||
const injectBullBoardHandler = async (app, serverAdapter) => {
|
const injectBullBoardHandler = async (app, serverAdapter) => {
|
||||||
if (
|
if (
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import morgan from 'morgan';
|
import morgan from 'morgan';
|
||||||
import logger from './logger';
|
import logger from './logger.js';
|
||||||
|
|
||||||
const stream = {
|
const stream = {
|
||||||
write: (message) =>
|
write: (message) =>
|
||||||
|
@@ -2,10 +2,10 @@ import { URL } from 'node:url';
|
|||||||
import { MultiSamlStrategy } from '@node-saml/passport-saml';
|
import { MultiSamlStrategy } from '@node-saml/passport-saml';
|
||||||
import passport from 'passport';
|
import passport from 'passport';
|
||||||
|
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
import createAuthTokenByUserId from './create-auth-token-by-user-id';
|
import createAuthTokenByUserId from './create-auth-token-by-user-id.js';
|
||||||
import SamlAuthProvider from '../models/saml-auth-provider.ee';
|
import SamlAuthProvider from '../models/saml-auth-provider.ee.js';
|
||||||
import findOrCreateUserBySamlIdentity from './find-or-create-user-by-saml-identity.ee';
|
import findOrCreateUserBySamlIdentity from './find-or-create-user-by-saml-identity.ee.js';
|
||||||
|
|
||||||
export default function configurePassport(app) {
|
export default function configurePassport(app) {
|
||||||
app.use(
|
app.use(
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
|
|
||||||
const webUIHandler = async (app) => {
|
const webUIHandler = async (app) => {
|
||||||
if (appConfig.serveWebAppSeparately) return;
|
if (appConfig.serveWebAppSeparately) return;
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty.js';
|
||||||
|
|
||||||
import Flow from '../models/flow';
|
import Flow from '../models/flow.js';
|
||||||
import { processTrigger } from '../services/trigger';
|
import { processTrigger } from '../services/trigger.js';
|
||||||
import triggerQueue from '../queues/trigger';
|
import triggerQueue from '../queues/trigger.js';
|
||||||
import globalVariable from './global-variable';
|
import globalVariable from './global-variable.js';
|
||||||
import QuotaExceededError from '../errors/quote-exceeded';
|
import QuotaExceededError from '../errors/quote-exceeded.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 './remove-job-configuration';
|
} from './remove-job-configuration.js';
|
||||||
|
|
||||||
export default async (flowId, request, response) => {
|
export default async (flowId, request, response) => {
|
||||||
const flow = await Flow.query().findById(flowId).throwIfNotFound();
|
const flow = await Flow.query().findById(flowId).throwIfNotFound();
|
||||||
|
@@ -47,7 +47,7 @@ class AppAuthClient extends Base {
|
|||||||
if (!this.eligibleForDecryption()) return;
|
if (!this.eligibleForDecryption()) return;
|
||||||
|
|
||||||
this.formattedAuthDefaults = JSON.parse(
|
this.formattedAuthDefaults = JSON.parse(
|
||||||
AES.decrypt(this.authDefaults, appConfig.encryptionKey).toString(enc.Utf8)
|
AES.decrypt(this.authDefaults, appConfig.encryptionKey).toString(enc)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import Base from './base';
|
import Base from './base.js';
|
||||||
|
|
||||||
class Config extends Base {
|
class Config extends Base {
|
||||||
static tableName = 'config';
|
static tableName = 'config';
|
||||||
|
@@ -109,7 +109,7 @@ class Connection extends Base {
|
|||||||
if (!this.eligibleForDecryption()) return;
|
if (!this.eligibleForDecryption()) return;
|
||||||
|
|
||||||
this.formattedData = JSON.parse(
|
this.formattedData = JSON.parse(
|
||||||
AES.decrypt(this.data, appConfig.encryptionKey).toString(enc.Utf8)
|
AES.decrypt(this.data, appConfig.encryptionKey).toString(enc)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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';
|
||||||
|
|
||||||
|
@@ -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';
|
||||||
|
|
||||||
|
@@ -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';
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import graphQLInstance from '../helpers/graphql-instance';
|
import graphQLInstance from '../helpers/graphql-instance.js';
|
||||||
import webhooksRouter from './webhooks';
|
import webhooksRouter from './webhooks.js';
|
||||||
import paddleRouter from './paddle.ee';
|
import paddleRouter from './paddle.ee.js';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import webhooksHandler from '../controllers/paddle/webhooks.ee';
|
import webhooksHandler from '../controllers/paddle/webhooks.ee.js';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import express, { Router } from 'express';
|
import express, { Router } from 'express';
|
||||||
import multer from 'multer';
|
import multer from 'multer';
|
||||||
|
|
||||||
import appConfig from '../config/app';
|
import appConfig from '../config/app.js';
|
||||||
import webhookHandlerByFlowId from '../controllers/webhooks/handler-by-flow-id';
|
import webhookHandlerByFlowId from '../controllers/webhooks/handler-by-flow-id.js';
|
||||||
import webhookHandlerByConnectionIdAndRefValue from '../controllers/webhooks/handler-by-connection-id-and-ref-value';
|
import webhookHandlerByConnectionIdAndRefValue from '../controllers/webhooks/handler-by-connection-id-and-ref-value.js';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
const upload = multer();
|
const upload = multer();
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import app from './app';
|
import app from './app.js';
|
||||||
import appConfig from './config/app';
|
import appConfig from './config/app.js';
|
||||||
import logger from './helpers/logger';
|
import logger from './helpers/logger.js';
|
||||||
import telemetry from './helpers/telemetry';
|
import telemetry from './helpers/telemetry/index.js';
|
||||||
|
|
||||||
telemetry.setServiceType('main');
|
telemetry.setServiceType('main');
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import Step from '../models/step';
|
import Step from '../models/step.js';
|
||||||
import { processFlow } from './flow';
|
import { processFlow } from './flow.js';
|
||||||
import { processTrigger } from './trigger';
|
import { processTrigger } from './trigger.js';
|
||||||
import { processAction } from './action';
|
import { processAction } from './action.js';
|
||||||
|
|
||||||
const testRun = async (options) => {
|
const testRun = async (options) => {
|
||||||
const untilStep = await Step.query()
|
const untilStep = await Step.query()
|
||||||
|
Reference in New Issue
Block a user