Compare commits
1 Commits
hubspot-do
...
AUT-783
Author | SHA1 | Date | |
---|---|---|---|
![]() |
51e96b832d |
@@ -2,6 +2,7 @@ import defineApp from '../../helpers/define-app.js';
|
|||||||
import addAuthHeader from './common/add-auth-header.js';
|
import addAuthHeader from './common/add-auth-header.js';
|
||||||
import auth from './auth/index.js';
|
import auth from './auth/index.js';
|
||||||
import actions from './actions/index.js';
|
import actions from './actions/index.js';
|
||||||
|
import triggers from './triggers/index.js';
|
||||||
|
|
||||||
export default defineApp({
|
export default defineApp({
|
||||||
name: 'Dropbox',
|
name: 'Dropbox',
|
||||||
@@ -15,4 +16,5 @@ export default defineApp({
|
|||||||
beforeRequest: [addAuthHeader],
|
beforeRequest: [addAuthHeader],
|
||||||
auth,
|
auth,
|
||||||
actions,
|
actions,
|
||||||
|
triggers,
|
||||||
});
|
});
|
||||||
|
3
packages/backend/src/apps/dropbox/triggers/index.js
Normal file
3
packages/backend/src/apps/dropbox/triggers/index.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import newFolders from './new-folders/index.js';
|
||||||
|
|
||||||
|
export default [newFolders];
|
@@ -0,0 +1,61 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New folders',
|
||||||
|
key: 'newFolders',
|
||||||
|
pollInterval: 15,
|
||||||
|
description:
|
||||||
|
'Triggers when any new folder is added. Ensure that the number of files/folders within the monitored directory remains below 4000.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Folder',
|
||||||
|
key: 'folderPath',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description:
|
||||||
|
'Enter the folder path that you want to follow, like /TextFiles or /Documents/Taxes.',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const folderPath = $.step.parameters.folderPath;
|
||||||
|
let endpoint = '/2/files/list_folder';
|
||||||
|
let next = false;
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
path: folderPath,
|
||||||
|
recursive: false,
|
||||||
|
include_deleted: false,
|
||||||
|
include_has_explicit_shared_members: false,
|
||||||
|
include_mounted_folders: true,
|
||||||
|
limit: 2000,
|
||||||
|
include_non_downloadable_files: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
do {
|
||||||
|
const { data } = await $.http.post(endpoint, params);
|
||||||
|
|
||||||
|
if (data.has_more) {
|
||||||
|
endpoint += '/continue';
|
||||||
|
params.cursor = data.cursor;
|
||||||
|
next = data.has_more;
|
||||||
|
} else {
|
||||||
|
next = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.entries?.length) {
|
||||||
|
for (const entry of data.entries.reverse()) {
|
||||||
|
if (entry['.tag'] === 'folder') {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: entry,
|
||||||
|
meta: {
|
||||||
|
internalId: entry.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (next);
|
||||||
|
},
|
||||||
|
});
|
@@ -1,6 +1,5 @@
|
|||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
import Crypto from 'crypto';
|
|
||||||
import app from '../../../../../app.js';
|
import app from '../../../../../app.js';
|
||||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
import { createUser } from '../../../../../../test/factories/user.js';
|
import { createUser } from '../../../../../../test/factories/user.js';
|
||||||
@@ -32,21 +31,5 @@ describe('GET /api/v1/admin/app-auth-clients/:appAuthClientId', () => {
|
|||||||
const expectedPayload = getAdminAppAuthClientMock(currentAppAuthClient);
|
const expectedPayload = getAdminAppAuthClientMock(currentAppAuthClient);
|
||||||
expect(response.body).toEqual(expectedPayload);
|
expect(response.body).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return not found response for not existing app auth client UUID', async () => {
|
|
||||||
const notExistingAppAuthClientUUID = Crypto.randomUUID();
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get(`/api/v1/admin/app-auth-clients/${notExistingAppAuthClientUUID}`)
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return bad request response for invalid UUID', async () => {
|
|
||||||
await request(app)
|
|
||||||
.get('/api/v1/admin/app-auth-clients/invalidAppAuthClientUUID')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(400);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
import Crypto from 'crypto';
|
|
||||||
import app from '../../../../../app.js';
|
import app from '../../../../../app.js';
|
||||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
import { createRole } from '../../../../../../test/factories/role.js';
|
import { createRole } from '../../../../../../test/factories/role.js';
|
||||||
@@ -21,7 +20,7 @@ describe('GET /api/v1/admin/roles/:roleId', () => {
|
|||||||
token = createAuthTokenByUserId(currentUser.id);
|
token = createAuthTokenByUserId(currentUser.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return role', async () => {
|
it('should return roles', async () => {
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||||
|
|
||||||
const response = await request(app)
|
const response = await request(app)
|
||||||
@@ -36,24 +35,4 @@ describe('GET /api/v1/admin/roles/:roleId', () => {
|
|||||||
|
|
||||||
expect(response.body).toEqual(expectedPayload);
|
expect(response.body).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return not found response for not existing role UUID', async () => {
|
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
|
||||||
|
|
||||||
const notExistingRoleUUID = Crypto.randomUUID();
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get(`/api/v1/admin/roles/${notExistingRoleUUID}`)
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return bad request response for invalid UUID', async () => {
|
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get('/api/v1/admin/roles/invalidRoleUUID')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(400);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
import Crypto from 'crypto';
|
|
||||||
import app from '../../../../../app.js';
|
import app from '../../../../../app.js';
|
||||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
import { createRole } from '../../../../../../test/factories/role.js';
|
import { createRole } from '../../../../../../test/factories/role.js';
|
||||||
@@ -32,26 +31,4 @@ describe('GET /api/v1/admin/saml-auth-provider/:samlAuthProviderId', () => {
|
|||||||
|
|
||||||
expect(response.body).toEqual(expectedPayload);
|
expect(response.body).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return not found response for not existing saml auth provider UUID', async () => {
|
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
|
||||||
|
|
||||||
const notExistingSamlAuthProviderUUID = Crypto.randomUUID();
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get(
|
|
||||||
`/api/v1/admin/saml-auth-providers/${notExistingSamlAuthProviderUUID}`
|
|
||||||
)
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return bad request response for invalid UUID', async () => {
|
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get('/api/v1/admin/saml-auth-providers/invalidSamlAuthProviderUUID')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(400);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
import Crypto from 'crypto';
|
|
||||||
import app from '../../../../../app.js';
|
import app from '../../../../../app.js';
|
||||||
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id';
|
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id';
|
||||||
import { createUser } from '../../../../../../test/factories/user';
|
import { createUser } from '../../../../../../test/factories/user';
|
||||||
@@ -32,24 +31,4 @@ describe('GET /api/v1/admin/users/:userId', () => {
|
|||||||
const expectedPayload = getUserMock(anotherUser, anotherUserRole);
|
const expectedPayload = getUserMock(anotherUser, anotherUserRole);
|
||||||
expect(response.body).toEqual(expectedPayload);
|
expect(response.body).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return not found response for not existing user UUID', async () => {
|
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
|
||||||
|
|
||||||
const notExistingUserUUID = Crypto.randomUUID();
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get(`/api/v1/admin/users/${notExistingUserUUID}`)
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return bad request response for invalid UUID', async () => {
|
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get('/api/v1/admin/users/invalidUserUUID')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(400);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
import Crypto from 'crypto';
|
|
||||||
import app from '../../../../app.js';
|
import app from '../../../../app.js';
|
||||||
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id.js';
|
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
import { createUser } from '../../../../../test/factories/user.js';
|
import { createUser } from '../../../../../test/factories/user.js';
|
||||||
@@ -29,20 +28,4 @@ describe('GET /api/v1/app-auth-clients/:id', () => {
|
|||||||
const expectedPayload = getAppAuthClientMock(currentAppAuthClient);
|
const expectedPayload = getAppAuthClientMock(currentAppAuthClient);
|
||||||
expect(response.body).toEqual(expectedPayload);
|
expect(response.body).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return not found response for not existing app auth client ID', async () => {
|
|
||||||
const notExistingAppAuthClientUUID = Crypto.randomUUID();
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get(`/api/v1/app-auth-clients/${notExistingAppAuthClientUUID}`)
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return bad request response for invalid UUID', async () => {
|
|
||||||
await request(app)
|
|
||||||
.get('/api/v1/app-auth-clients/invalidAppAuthClientUUID')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(400);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
import App from '../../../../models/app.js';
|
|
||||||
import { renderObject } from '../../../../helpers/renderer.js';
|
|
||||||
|
|
||||||
export default async (request, response) => {
|
|
||||||
const app = await App.findOneByKey(request.params.appKey);
|
|
||||||
|
|
||||||
renderObject(response, app, { serializer: 'App' });
|
|
||||||
};
|
|
@@ -1,35 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach } from 'vitest';
|
|
||||||
import request from 'supertest';
|
|
||||||
import App from '../../../../models/app';
|
|
||||||
import app from '../../../../app.js';
|
|
||||||
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id';
|
|
||||||
import { createUser } from '../../../../../test/factories/user';
|
|
||||||
import getAppMock from '../../../../../test/mocks/rest/api/v1/apps/get-app.js';
|
|
||||||
|
|
||||||
describe('GET /api/v1/apps/:appKey', () => {
|
|
||||||
let currentUser, token;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
currentUser = await createUser();
|
|
||||||
token = createAuthTokenByUserId(currentUser.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return the app info', async () => {
|
|
||||||
const exampleApp = await App.findOneByKey('github');
|
|
||||||
|
|
||||||
const response = await request(app)
|
|
||||||
.get(`/api/v1/apps/${exampleApp.key}`)
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(200);
|
|
||||||
|
|
||||||
const expectedPayload = getAppMock(exampleApp);
|
|
||||||
expect(response.body).toEqual(expectedPayload);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return not found response for invalid app key', async () => {
|
|
||||||
await request(app)
|
|
||||||
.get('/api/v1/apps/invalid-app-key')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(404);
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,6 +1,5 @@
|
|||||||
import { describe, it, expect, beforeEach } from 'vitest';
|
import { describe, it, expect, beforeEach } from 'vitest';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
import Crypto from 'crypto';
|
|
||||||
import app from '../../../../app.js';
|
import app from '../../../../app.js';
|
||||||
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id';
|
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id';
|
||||||
import { createUser } from '../../../../../test/factories/user';
|
import { createUser } from '../../../../../test/factories/user';
|
||||||
@@ -69,34 +68,4 @@ describe('GET /api/v1/flows/:flowId', () => {
|
|||||||
|
|
||||||
expect(response.body).toEqual(expectedPayload);
|
expect(response.body).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return not found response for not existing flow UUID', async () => {
|
|
||||||
await createPermission({
|
|
||||||
action: 'read',
|
|
||||||
subject: 'Flow',
|
|
||||||
roleId: currentUserRole.id,
|
|
||||||
conditions: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
const notExistingFlowUUID = Crypto.randomUUID();
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get(`/api/v1/flows/${notExistingFlowUUID}`)
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return bad request response for invalid UUID', async () => {
|
|
||||||
await createPermission({
|
|
||||||
action: 'read',
|
|
||||||
subject: 'Flow',
|
|
||||||
roleId: currentUserRole.id,
|
|
||||||
conditions: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
await request(app)
|
|
||||||
.get('/api/v1/flows/invalidFlowUUID')
|
|
||||||
.set('Authorization', token)
|
|
||||||
.expect(400);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,31 +1,14 @@
|
|||||||
import logger from './logger.js';
|
import logger from './logger.js';
|
||||||
import objection from 'objection';
|
|
||||||
const { NotFoundError, DataError } = objection;
|
|
||||||
|
|
||||||
// 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
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const errorHandler = (error, request, response, next) => {
|
const errorHandler = (err, req, res, next) => {
|
||||||
if (error.message === 'Not Found' || error instanceof NotFoundError) {
|
if (err.message === 'Not Found') {
|
||||||
response.status(404).end();
|
res.status(404).end();
|
||||||
|
} else {
|
||||||
|
logger.error(err.message + '\n' + err.stack);
|
||||||
|
res.status(err.statusCode || 500).send(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notFoundAppError(error)) {
|
|
||||||
response.status(404).end();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error instanceof DataError) {
|
|
||||||
response.status(400).end();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error(error.message + '\n' + error.stack);
|
|
||||||
response.status(error.statusCode || 500).end();
|
|
||||||
};
|
|
||||||
|
|
||||||
const notFoundAppError = (error) => {
|
|
||||||
return (
|
|
||||||
error.message.includes('An application with the') ||
|
|
||||||
error.message.includes("key couldn't be found.")
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default errorHandler;
|
export default errorHandler;
|
||||||
|
@@ -11,7 +11,7 @@ const isArray = (object) =>
|
|||||||
const totalCount = (object) =>
|
const totalCount = (object) =>
|
||||||
isPaginated(object) ? object.totalCount : isArray(object) ? object.length : 1;
|
isPaginated(object) ? object.totalCount : isArray(object) ? object.length : 1;
|
||||||
|
|
||||||
const renderObject = (response, object, options) => {
|
const renderObject = (response, object) => {
|
||||||
let data = isPaginated(object) ? object.records : object;
|
let data = isPaginated(object) ? object.records : object;
|
||||||
|
|
||||||
const type = isPaginated(object)
|
const type = isPaginated(object)
|
||||||
@@ -20,9 +20,7 @@ const renderObject = (response, object, options) => {
|
|||||||
? object?.[0]?.constructor?.name || 'Object'
|
? object?.[0]?.constructor?.name || 'Object'
|
||||||
: object.constructor.name;
|
: object.constructor.name;
|
||||||
|
|
||||||
const serializer = options?.serializer
|
const serializer = serializers[type];
|
||||||
? serializers[options.serializer]
|
|
||||||
: serializers[type];
|
|
||||||
|
|
||||||
if (serializer) {
|
if (serializer) {
|
||||||
data = Array.isArray(data)
|
data = Array.isArray(data)
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
import { Router } from 'express';
|
|
||||||
import asyncHandler from 'express-async-handler';
|
|
||||||
import { authenticateUser } from '../../../helpers/authentication.js';
|
|
||||||
import getAppAction from '../../../controllers/api/v1/apps/get-app.js';
|
|
||||||
|
|
||||||
const router = Router();
|
|
||||||
|
|
||||||
router.get('/:appKey', authenticateUser, asyncHandler(getAppAction));
|
|
||||||
|
|
||||||
export default router;
|
|
@@ -8,7 +8,6 @@ import usersRouter from './api/v1/users.js';
|
|||||||
import paymentRouter from './api/v1/payment.ee.js';
|
import paymentRouter from './api/v1/payment.ee.js';
|
||||||
import appAuthClientsRouter from './api/v1/app-auth-clients.js';
|
import appAuthClientsRouter from './api/v1/app-auth-clients.js';
|
||||||
import flowsRouter from './api/v1/flows.js';
|
import flowsRouter from './api/v1/flows.js';
|
||||||
import appsRouter from './api/v1/apps.js';
|
|
||||||
import samlAuthProvidersRouter from './api/v1/admin/saml-auth-providers.ee.js';
|
import samlAuthProvidersRouter from './api/v1/admin/saml-auth-providers.ee.js';
|
||||||
import rolesRouter from './api/v1/admin/roles.ee.js';
|
import rolesRouter from './api/v1/admin/roles.ee.js';
|
||||||
import permissionsRouter from './api/v1/admin/permissions.ee.js';
|
import permissionsRouter from './api/v1/admin/permissions.ee.js';
|
||||||
@@ -26,7 +25,6 @@ router.use('/api/v1/users', usersRouter);
|
|||||||
router.use('/api/v1/payment', paymentRouter);
|
router.use('/api/v1/payment', paymentRouter);
|
||||||
router.use('/api/v1/app-auth-clients', appAuthClientsRouter);
|
router.use('/api/v1/app-auth-clients', appAuthClientsRouter);
|
||||||
router.use('/api/v1/flows', flowsRouter);
|
router.use('/api/v1/flows', flowsRouter);
|
||||||
router.use('/api/v1/apps', appsRouter);
|
|
||||||
router.use('/api/v1/admin/saml-auth-providers', samlAuthProvidersRouter);
|
router.use('/api/v1/admin/saml-auth-providers', samlAuthProvidersRouter);
|
||||||
router.use('/api/v1/admin/roles', rolesRouter);
|
router.use('/api/v1/admin/roles', rolesRouter);
|
||||||
router.use('/api/v1/admin/permissions', permissionsRouter);
|
router.use('/api/v1/admin/permissions', permissionsRouter);
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
const appSerializer = (app) => {
|
|
||||||
return {
|
|
||||||
name: app.name,
|
|
||||||
key: app.key,
|
|
||||||
iconUrl: app.iconUrl,
|
|
||||||
authDocUrl: app.authDocUrl,
|
|
||||||
supportsConnections: app.supportsConnections,
|
|
||||||
primaryColor: app.primaryColor,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default appSerializer;
|
|
@@ -1,20 +0,0 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
import App from '../models/app';
|
|
||||||
import appSerializer from './app';
|
|
||||||
|
|
||||||
describe('appSerializer', () => {
|
|
||||||
it('should return permission data', async () => {
|
|
||||||
const app = await App.findOneByKey('deepl');
|
|
||||||
|
|
||||||
const expectedPayload = {
|
|
||||||
name: app.name,
|
|
||||||
key: app.key,
|
|
||||||
iconUrl: app.iconUrl,
|
|
||||||
authDocUrl: app.authDocUrl,
|
|
||||||
supportsConnections: app.supportsConnections,
|
|
||||||
primaryColor: app.primaryColor,
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(appSerializer(app)).toEqual(expectedPayload);
|
|
||||||
});
|
|
||||||
});
|
|
@@ -5,7 +5,6 @@ import samlAuthProviderSerializer from './saml-auth-provider.ee.js';
|
|||||||
import appAuthClientSerializer from './app-auth-client.js';
|
import appAuthClientSerializer from './app-auth-client.js';
|
||||||
import flowSerializer from './flow.js';
|
import flowSerializer from './flow.js';
|
||||||
import stepSerializer from './step.js';
|
import stepSerializer from './step.js';
|
||||||
import appSerializer from './app.js';
|
|
||||||
|
|
||||||
const serializers = {
|
const serializers = {
|
||||||
User: userSerializer,
|
User: userSerializer,
|
||||||
@@ -15,7 +14,6 @@ const serializers = {
|
|||||||
AppAuthClient: appAuthClientSerializer,
|
AppAuthClient: appAuthClientSerializer,
|
||||||
Flow: flowSerializer,
|
Flow: flowSerializer,
|
||||||
Step: stepSerializer,
|
Step: stepSerializer,
|
||||||
App: appSerializer,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default serializers;
|
export default serializers;
|
||||||
|
@@ -5,8 +5,8 @@ const permissionSerializer = (permission) => {
|
|||||||
action: permission.action,
|
action: permission.action,
|
||||||
subject: permission.subject,
|
subject: permission.subject,
|
||||||
conditions: permission.conditions,
|
conditions: permission.conditions,
|
||||||
createdAt: permission.createdAt.getTime(),
|
createdAt: permission.createdAt,
|
||||||
updatedAt: permission.updatedAt.getTime(),
|
updatedAt: permission.updatedAt,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -16,8 +16,8 @@ describe('permissionSerializer', () => {
|
|||||||
action: permission.action,
|
action: permission.action,
|
||||||
subject: permission.subject,
|
subject: permission.subject,
|
||||||
conditions: permission.conditions,
|
conditions: permission.conditions,
|
||||||
createdAt: permission.createdAt.getTime(),
|
createdAt: permission.createdAt,
|
||||||
updatedAt: permission.updatedAt.getTime(),
|
updatedAt: permission.updatedAt,
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(permissionSerializer(permission)).toEqual(expectedPayload);
|
expect(permissionSerializer(permission)).toEqual(expectedPayload);
|
||||||
|
@@ -6,8 +6,8 @@ const roleSerializer = (role) => {
|
|||||||
name: role.name,
|
name: role.name,
|
||||||
key: role.key,
|
key: role.key,
|
||||||
description: role.description,
|
description: role.description,
|
||||||
createdAt: role.createdAt.getTime(),
|
createdAt: role.createdAt,
|
||||||
updatedAt: role.updatedAt.getTime(),
|
updatedAt: role.updatedAt,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,8 +29,8 @@ describe('roleSerializer', () => {
|
|||||||
name: role.name,
|
name: role.name,
|
||||||
key: role.key,
|
key: role.key,
|
||||||
description: role.description,
|
description: role.description,
|
||||||
createdAt: role.createdAt.getTime(),
|
createdAt: role.createdAt,
|
||||||
updatedAt: role.updatedAt.getTime(),
|
updatedAt: role.updatedAt,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -6,8 +6,8 @@ const userSerializer = (user) => {
|
|||||||
let userData = {
|
let userData = {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
createdAt: user.createdAt.getTime(),
|
createdAt: user.createdAt,
|
||||||
updatedAt: user.updatedAt.getTime(),
|
updatedAt: user.updatedAt,
|
||||||
fullName: user.fullName,
|
fullName: user.fullName,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,11 +31,11 @@ describe('userSerializer', () => {
|
|||||||
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(false);
|
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(false);
|
||||||
|
|
||||||
const expectedPayload = {
|
const expectedPayload = {
|
||||||
createdAt: user.createdAt.getTime(),
|
createdAt: user.createdAt,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
fullName: user.fullName,
|
fullName: user.fullName,
|
||||||
id: user.id,
|
id: user.id,
|
||||||
updatedAt: user.updatedAt.getTime(),
|
updatedAt: user.updatedAt,
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(userSerializer(user)).toEqual(expectedPayload);
|
expect(userSerializer(user)).toEqual(expectedPayload);
|
||||||
@@ -67,7 +67,7 @@ describe('userSerializer', () => {
|
|||||||
it('should return user data with trial expiry date', async () => {
|
it('should return user data with trial expiry date', async () => {
|
||||||
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
||||||
|
|
||||||
await user.$query().patchAndFetch({
|
await user.$query().patch({
|
||||||
trialExpiryDate: DateTime.now().plus({ days: 30 }).toISODate(),
|
trialExpiryDate: DateTime.now().plus({ days: 30 }).toISODate(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -5,16 +5,16 @@ const getRoleMock = async (role, permissions) => {
|
|||||||
name: role.name,
|
name: role.name,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
description: role.description,
|
description: role.description,
|
||||||
createdAt: role.createdAt.getTime(),
|
createdAt: role.createdAt.toISOString(),
|
||||||
updatedAt: role.updatedAt.getTime(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
permissions: permissions.map((permission) => ({
|
permissions: permissions.map((permission) => ({
|
||||||
id: permission.id,
|
id: permission.id,
|
||||||
action: permission.action,
|
action: permission.action,
|
||||||
conditions: permission.conditions,
|
conditions: permission.conditions,
|
||||||
roleId: permission.roleId,
|
roleId: permission.roleId,
|
||||||
subject: permission.subject,
|
subject: permission.subject,
|
||||||
createdAt: permission.createdAt.getTime(),
|
createdAt: permission.createdAt.toISOString(),
|
||||||
updatedAt: permission.updatedAt.getTime(),
|
updatedAt: permission.updatedAt.toISOString(),
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -6,8 +6,8 @@ const getRolesMock = async (roles) => {
|
|||||||
name: role.name,
|
name: role.name,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
description: role.description,
|
description: role.description,
|
||||||
createdAt: role.createdAt.getTime(),
|
createdAt: role.createdAt.toISOString(),
|
||||||
updatedAt: role.updatedAt.getTime(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,21 +1,21 @@
|
|||||||
const getUserMock = (currentUser, role) => {
|
const getUserMock = (currentUser, role) => {
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
createdAt: currentUser.createdAt.getTime(),
|
createdAt: currentUser.createdAt.toISOString(),
|
||||||
email: currentUser.email,
|
email: currentUser.email,
|
||||||
fullName: currentUser.fullName,
|
fullName: currentUser.fullName,
|
||||||
id: currentUser.id,
|
id: currentUser.id,
|
||||||
role: {
|
role: {
|
||||||
createdAt: role.createdAt.getTime(),
|
createdAt: role.createdAt.toISOString(),
|
||||||
description: null,
|
description: null,
|
||||||
id: role.id,
|
id: role.id,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
key: role.key,
|
key: role.key,
|
||||||
name: role.name,
|
name: role.name,
|
||||||
updatedAt: role.updatedAt.getTime(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
||||||
updatedAt: currentUser.updatedAt.getTime(),
|
updatedAt: currentUser.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
count: 1,
|
count: 1,
|
||||||
|
@@ -3,23 +3,23 @@ const getUsersMock = async (users, roles) => {
|
|||||||
const role = roles.find((r) => r.id === user.roleId);
|
const role = roles.find((r) => r.id === user.roleId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
createdAt: user.createdAt.getTime(),
|
createdAt: user.createdAt.toISOString(),
|
||||||
email: user.email,
|
email: user.email,
|
||||||
fullName: user.fullName,
|
fullName: user.fullName,
|
||||||
id: user.id,
|
id: user.id,
|
||||||
role: role
|
role: role
|
||||||
? {
|
? {
|
||||||
createdAt: role.createdAt.getTime(),
|
createdAt: role.createdAt.toISOString(),
|
||||||
description: role.description,
|
description: role.description,
|
||||||
id: role.id,
|
id: role.id,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
key: role.key,
|
key: role.key,
|
||||||
name: role.name,
|
name: role.name,
|
||||||
updatedAt: role.updatedAt.getTime(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
trialExpiryDate: user.trialExpiryDate.toISOString(),
|
trialExpiryDate: user.trialExpiryDate.toISOString(),
|
||||||
updatedAt: user.updatedAt.getTime(),
|
updatedAt: user.updatedAt.toISOString(),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
const getAppMock = (app) => {
|
|
||||||
return {
|
|
||||||
data: {
|
|
||||||
authDocUrl: app.authDocUrl,
|
|
||||||
iconUrl: app.iconUrl,
|
|
||||||
key: app.key,
|
|
||||||
name: app.name,
|
|
||||||
primaryColor: app.primaryColor,
|
|
||||||
supportsConnections: app.supportsConnections,
|
|
||||||
},
|
|
||||||
meta: {
|
|
||||||
count: 1,
|
|
||||||
currentPage: null,
|
|
||||||
isArray: false,
|
|
||||||
totalPages: null,
|
|
||||||
type: 'Object',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default getAppMock;
|
|
@@ -1,22 +1,22 @@
|
|||||||
const getCurrentUserMock = (currentUser, role) => {
|
const getCurrentUserMock = (currentUser, role) => {
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
createdAt: currentUser.createdAt.getTime(),
|
createdAt: currentUser.createdAt.toISOString(),
|
||||||
email: currentUser.email,
|
email: currentUser.email,
|
||||||
fullName: currentUser.fullName,
|
fullName: currentUser.fullName,
|
||||||
id: currentUser.id,
|
id: currentUser.id,
|
||||||
permissions: [],
|
permissions: [],
|
||||||
role: {
|
role: {
|
||||||
createdAt: role.createdAt.getTime(),
|
createdAt: role.createdAt.toISOString(),
|
||||||
description: null,
|
description: null,
|
||||||
id: role.id,
|
id: role.id,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
key: role.key,
|
key: role.key,
|
||||||
name: role.name,
|
name: role.name,
|
||||||
updatedAt: role.updatedAt.getTime(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
||||||
updatedAt: currentUser.updatedAt.getTime(),
|
updatedAt: currentUser.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
count: 1,
|
count: 1,
|
||||||
|
@@ -73,6 +73,7 @@ export default defineConfig({
|
|||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
|
{ text: 'Triggers', link: '/apps/dropbox/triggers' },
|
||||||
{ text: 'Actions', link: '/apps/dropbox/actions' },
|
{ text: 'Actions', link: '/apps/dropbox/actions' },
|
||||||
{ text: 'Connection', link: '/apps/dropbox/connection' },
|
{ text: 'Connection', link: '/apps/dropbox/connection' },
|
||||||
],
|
],
|
||||||
@@ -305,7 +306,7 @@ export default defineConfig({
|
|||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Actions', link: '/apps/removebg/actions' },
|
{ text: 'Actions', link: '/apps/removebg/actions' },
|
||||||
{ text: 'Connection', link: '/apps/removebg/connection' }
|
{ text: 'Connection', link: '/apps/removebg/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
12
packages/docs/pages/apps/dropbox/triggers.md
Normal file
12
packages/docs/pages/apps/dropbox/triggers.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
favicon: /favicons/dropbox.svg
|
||||||
|
items:
|
||||||
|
- name: New folders
|
||||||
|
desc: Triggers when any new folder is added. Ensure that the number of files/folders within the monitored directory remains below 4000.
|
||||||
|
---
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import CustomListing from '../../components/CustomListing.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<CustomListing />
|
@@ -5,21 +5,18 @@ This page explains the steps you need to follow to set up the Hubspot connection
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
1. Go to the [HubSpot Developer page](https://developers.hubspot.com/).
|
1. Go to the [HubSpot Developer page](https://developers.hubspot.com/).
|
||||||
2. Click on the **Create a developer account** button.
|
2. Login into your developer account.
|
||||||
3. Click on the **Create App Developer account** button.
|
3. Click on the **Manage apps** button.
|
||||||
4. Fill the form.
|
4. Click on the **Create app** button.
|
||||||
5. Login into your developer account.
|
5. Fill the **Public app name** field with the name of your API app.
|
||||||
6. Click on the **Manage apps** button.
|
6. Go to the **Auth** tab.
|
||||||
7. Click on the **Create app** button.
|
7. Fill the **Redirect URL(s)** field with the OAuth Redirect URL from the Automatisch connection creation page.
|
||||||
8. Fill the **Public app name** field with the name of your API app.
|
8. Go to the **Scopes** tab.
|
||||||
9. Go to the **Auth** tab.
|
9. Select the scopes you want to use with Automatisch.
|
||||||
10. Fill the **Redirect URL(s)** field with the OAuth Redirect URL from the Automatisch connection creation page.
|
10. Click on the **Create App** button.
|
||||||
11. Go to the **Scopes** tab.
|
11. Go back to the **Auth** tab.
|
||||||
12. Select the scopes you want to use with Automatisch.
|
12. Copy the **Client ID** and **Client Secret** values.
|
||||||
13. Click on the **Create App** button.
|
13. Paste the **Client ID** value into Automatisch as **Client ID**, respectively.
|
||||||
14. Go back to the **Auth** tab.
|
14. Paste the **Client Secret** value into Automatisch as **Client Secret**, respectively.
|
||||||
15. Copy the **Client ID** and **Client Secret** values.
|
15. Click the **Submit** button on Automatisch.
|
||||||
16. Paste the **Client ID** value into Automatisch as **Client ID**, respectively.
|
16. Now, you can start using the HubSpot connection with Automatisch.
|
||||||
17. Paste the **Client Secret** value into Automatisch as **Client Secret**, respectively.
|
|
||||||
18. Click the **Submit** button on Automatisch.
|
|
||||||
19. Now, you can start using the HubSpot connection with Automatisch.
|
|
||||||
|
Reference in New Issue
Block a user