feat: Convert all app files to JS
This commit is contained in:
3
packages/backend/src/apps/azure-openai/actions/index.js
Normal file
3
packages/backend/src/apps/azure-openai/actions/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import sendPrompt from './send-prompt/index.js';
|
||||
|
||||
export default [sendPrompt];
|
@@ -1,3 +0,0 @@
|
||||
import sendPrompt from './send-prompt';
|
||||
|
||||
export default [sendPrompt];
|
@@ -0,0 +1,97 @@
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
const castFloatOrUndefined = (value) => {
|
||||
return value === '' ? undefined : parseFloat(value);
|
||||
};
|
||||
|
||||
export default defineAction({
|
||||
name: 'Send prompt',
|
||||
key: 'sendPrompt',
|
||||
description: 'Creates a completion for the provided prompt and parameters.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Prompt',
|
||||
key: 'prompt',
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'The text to analyze.',
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
key: 'temperature',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
'What sampling temperature to use, between 0 and 2. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or Top P but not both.',
|
||||
},
|
||||
{
|
||||
label: 'Maximum tokens',
|
||||
key: 'maxTokens',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
'The maximum number of tokens to generate in the completion.',
|
||||
},
|
||||
{
|
||||
label: 'Stop Sequence',
|
||||
key: 'stopSequence',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
'Single stop sequence where the API will stop generating further tokens. The returned text will not contain the stop sequence.',
|
||||
},
|
||||
{
|
||||
label: 'Top P',
|
||||
key: 'topP',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.',
|
||||
},
|
||||
{
|
||||
label: 'Frequency Penalty',
|
||||
key: 'frequencyPenalty',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.`,
|
||||
},
|
||||
{
|
||||
label: 'Presence Penalty',
|
||||
key: 'presencePenalty',
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.`,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const payload = {
|
||||
model: $.step.parameters.model,
|
||||
prompt: $.step.parameters.prompt,
|
||||
temperature: castFloatOrUndefined($.step.parameters.temperature),
|
||||
max_tokens: castFloatOrUndefined($.step.parameters.maxTokens),
|
||||
stop: $.step.parameters.stopSequence || null,
|
||||
top_p: castFloatOrUndefined($.step.parameters.topP),
|
||||
frequency_penalty: castFloatOrUndefined(
|
||||
$.step.parameters.frequencyPenalty
|
||||
),
|
||||
presence_penalty: castFloatOrUndefined($.step.parameters.presencePenalty),
|
||||
};
|
||||
|
||||
const { data } = await $.http.post(
|
||||
`/deployments/${$.auth.data.deploymentId}/completions`,
|
||||
payload
|
||||
);
|
||||
|
||||
$.setActionItem({
|
||||
raw: data,
|
||||
});
|
||||
},
|
||||
});
|
@@ -1,87 +0,0 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
const castFloatOrUndefined = (value: string | null) => {
|
||||
return value === '' ? undefined : parseFloat(value);
|
||||
}
|
||||
|
||||
export default defineAction({
|
||||
name: 'Send prompt',
|
||||
key: 'sendPrompt',
|
||||
description: 'Creates a completion for the provided prompt and parameters.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Prompt',
|
||||
key: 'prompt',
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'The text to analyze.'
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
key: 'temperature',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'What sampling temperature to use, between 0 and 2. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or Top P but not both.'
|
||||
},
|
||||
{
|
||||
label: 'Maximum tokens',
|
||||
key: 'maxTokens',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'The maximum number of tokens to generate in the completion.'
|
||||
},
|
||||
{
|
||||
label: 'Stop Sequence',
|
||||
key: 'stopSequence',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'Single stop sequence where the API will stop generating further tokens. The returned text will not contain the stop sequence.'
|
||||
},
|
||||
{
|
||||
label: 'Top P',
|
||||
key: 'topP',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.'
|
||||
},
|
||||
{
|
||||
label: 'Frequency Penalty',
|
||||
key: 'frequencyPenalty',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.`
|
||||
},
|
||||
{
|
||||
label: 'Presence Penalty',
|
||||
key: 'presencePenalty',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
variables: true,
|
||||
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.`
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const payload = {
|
||||
model: $.step.parameters.model as string,
|
||||
prompt: $.step.parameters.prompt as string,
|
||||
temperature: castFloatOrUndefined($.step.parameters.temperature as string),
|
||||
max_tokens: castFloatOrUndefined($.step.parameters.maxTokens as string),
|
||||
stop: ($.step.parameters.stopSequence as string || null),
|
||||
top_p: castFloatOrUndefined($.step.parameters.topP as string),
|
||||
frequency_penalty: castFloatOrUndefined($.step.parameters.frequencyPenalty as string),
|
||||
presence_penalty: castFloatOrUndefined($.step.parameters.presencePenalty as string),
|
||||
};
|
||||
const { data } = await $.http.post(`/deployments/${$.auth.data.deploymentId}/completions`, payload);
|
||||
|
||||
$.setActionItem({
|
||||
raw: data,
|
||||
});
|
||||
},
|
||||
});
|
@@ -1,12 +1,12 @@
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'screenName',
|
||||
label: 'Screen Name',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -18,7 +18,7 @@ export default {
|
||||
{
|
||||
key: 'yourResourceName',
|
||||
label: 'Your Resource Name',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -30,7 +30,7 @@ export default {
|
||||
{
|
||||
key: 'deploymentId',
|
||||
label: 'Deployment ID',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
{
|
||||
key: 'apiKey',
|
||||
label: 'API Key',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
@@ -0,0 +1,6 @@
|
||||
const isStillVerified = async ($) => {
|
||||
await $.http.get('/fine_tuning/jobs');
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,8 +0,0 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await $.http.get('/fine_tuning/jobs');
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -0,0 +1,5 @@
|
||||
const verifyCredentials = async ($) => {
|
||||
await $.http.get('/fine_tuning/jobs');
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
@@ -1,7 +0,0 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
await $.http.get('/fine_tuning/jobs');
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
@@ -0,0 +1,13 @@
|
||||
const addAuthHeader = ($, requestConfig) => {
|
||||
if ($.auth.data?.apiKey) {
|
||||
requestConfig.headers['api-key'] = $.auth.data.apiKey;
|
||||
}
|
||||
|
||||
requestConfig.params = {
|
||||
'api-version': '2023-10-01-preview',
|
||||
};
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
@@ -1,15 +0,0 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if ($.auth.data?.apiKey) {
|
||||
requestConfig.headers['api-key'] = $.auth.data.apiKey as string;
|
||||
}
|
||||
|
||||
requestConfig.params = {
|
||||
'api-version': '2023-10-01-preview'
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
@@ -0,0 +1,11 @@
|
||||
const setBaseUrl = ($, requestConfig) => {
|
||||
const yourResourceName = $.auth.data.yourResourceName;
|
||||
|
||||
if (yourResourceName) {
|
||||
requestConfig.baseURL = `https://${yourResourceName}.openai.azure.com/openai`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default setBaseUrl;
|
@@ -1,13 +0,0 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const setBaseUrl: TBeforeRequest = ($, requestConfig) => {
|
||||
const yourResourceName = $.auth.data.yourResourceName as string;
|
||||
|
||||
if (yourResourceName) {
|
||||
requestConfig.baseURL = `https://${yourResourceName}.openai.azure.com/openai`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default setBaseUrl;
|
@@ -1,8 +1,8 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import setBaseUrl from './common/set-base-url';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import actions from './actions';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import setBaseUrl from './common/set-base-url.js';
|
||||
import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import actions from './actions/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Azure OpenAI',
|
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Add Template',
|
||||
@@ -9,7 +9,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Templete Data',
|
||||
key: 'templateData',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'The content of your new Template in XML/HTML format.',
|
||||
@@ -17,7 +17,7 @@ export default defineAction({
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const templateData = $.step.parameters.templateData as string;
|
||||
const templateData = $.step.parameters.templateData;
|
||||
|
||||
const base64Data = Buffer.from(templateData).toString('base64');
|
||||
const dataURI = `data:application/xml;base64,${base64Data}`;
|
3
packages/backend/src/apps/carbone/actions/index.js
Normal file
3
packages/backend/src/apps/carbone/actions/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import addTemplate from './add-template/index.js';
|
||||
|
||||
export default [addTemplate];
|
@@ -1,3 +0,0 @@
|
||||
import addTemplate from './add-template';
|
||||
|
||||
export default [addTemplate];
|
@@ -1,12 +1,12 @@
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'screenName',
|
||||
label: 'Screen Name',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -18,7 +18,7 @@ export default {
|
||||
{
|
||||
key: 'apiKey',
|
||||
label: 'API Key',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
@@ -0,0 +1,8 @@
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
|
||||
const isStillVerified = async ($) => {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,9 +0,0 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,6 +1,4 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const verifyCredentials = async ($) => {
|
||||
await $.http.get('/templates');
|
||||
|
||||
await $.auth.set({
|
@@ -1,6 +1,4 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const addAuthHeader = ($) => {
|
||||
if ($.auth.data?.apiKey) {
|
||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`;
|
||||
requestConfig.headers['carbone-version'] = '4';
|
@@ -1,7 +1,7 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import actions from './actions';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import actions from './actions/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Carbone',
|
3
packages/backend/src/apps/deepl/actions/index.js
Normal file
3
packages/backend/src/apps/deepl/actions/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import translateText from './translate-text/index.js';
|
||||
|
||||
export default [translateText];
|
@@ -1,3 +0,0 @@
|
||||
import translateText from './translate-text';
|
||||
|
||||
export default [translateText];
|
@@ -1,5 +1,5 @@
|
||||
import qs from 'qs';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Translate text',
|
||||
@@ -9,7 +9,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Text',
|
||||
key: 'text',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Text to be translated.',
|
||||
variables: true,
|
||||
@@ -17,7 +17,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Target Language',
|
||||
key: 'targetLanguage',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'Language to translate the text to.',
|
||||
variables: true,
|
@@ -1,12 +1,12 @@
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'screenName',
|
||||
label: 'Screen Name',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -18,7 +18,7 @@ export default {
|
||||
{
|
||||
key: 'authenticationKey',
|
||||
label: 'Authentication Key',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
@@ -0,0 +1,8 @@
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
|
||||
const isStillVerified = async ($) => {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,9 +0,0 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await verifyCredentials($);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,6 +1,4 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const verifyCredentials = async ($) => {
|
||||
await $.http.get('/v2/usage');
|
||||
|
||||
await $.auth.set({
|
@@ -1,6 +1,4 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const addAuthHeader = ($, requestConfig) => {
|
||||
if ($.auth.data?.authenticationKey) {
|
||||
const authorizationHeader = `DeepL-Auth-Key ${$.auth.data.authenticationKey}`;
|
||||
requestConfig.headers.Authorization = authorizationHeader;
|
@@ -1,7 +1,7 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import actions from './actions';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import actions from './actions/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'DeepL',
|
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Delay for',
|
||||
@@ -9,7 +9,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Delay for unit',
|
||||
key: 'delayForUnit',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
value: null,
|
||||
description: 'Delay for unit, e.g. minutes, hours, days, weeks.',
|
||||
@@ -36,7 +36,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Delay for value',
|
||||
key: 'delayForValue',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Delay for value, use a number, e.g. 1, 2, 3.',
|
||||
variables: true,
|
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Delay until',
|
||||
@@ -9,7 +9,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Delay until (Date)',
|
||||
key: 'delayUntil',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Delay until the date. E.g. 2022-12-18',
|
||||
variables: true,
|
4
packages/backend/src/apps/delay/actions/index.js
Normal file
4
packages/backend/src/apps/delay/actions/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import delayFor from './delay-for/index.js';
|
||||
import delayUntil from './delay-until/index.js';
|
||||
|
||||
export default [delayFor, delayUntil];
|
@@ -1,4 +0,0 @@
|
||||
import delayFor from './delay-for';
|
||||
import delayUntil from './delay-until';
|
||||
|
||||
export default [delayFor, delayUntil];
|
@@ -1,5 +1,5 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import actions from './actions';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import actions from './actions/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Delay',
|
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Create a scheduled event',
|
||||
@@ -8,13 +8,13 @@ export default defineAction({
|
||||
{
|
||||
label: 'Type',
|
||||
key: 'entityType',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
variables: true,
|
||||
options: [
|
||||
{ label: 'Stage channel', value: 1 },
|
||||
{ label: 'Voice channel', value: 2 },
|
||||
{ label: 'External', value: 3 }
|
||||
{ label: 'External', value: 3 },
|
||||
],
|
||||
additionalFields: {
|
||||
type: 'query',
|
||||
@@ -34,61 +34,47 @@ export default defineAction({
|
||||
{
|
||||
label: 'Name',
|
||||
key: 'name',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Description',
|
||||
key: 'description',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Image',
|
||||
key: 'image',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'Image as DataURI scheme [data:image/<jpeg/png/gif>;base64,BASE64_ENCODED_<JPEG/PNG/GIF>_IMAGE_DATA]',
|
||||
description:
|
||||
'Image as DataURI scheme [data:image/<jpeg/png/gif>;base64,BASE64_ENCODED_<JPEG/PNG/GIF>_IMAGE_DATA]',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
type entity_metadata = {
|
||||
location: string
|
||||
}
|
||||
|
||||
type guild_event = {
|
||||
channel_id: number,
|
||||
name: string,
|
||||
privacy_level: number,
|
||||
scheduled_start_time: string,
|
||||
scheduled_end_time?: string,
|
||||
description?: string,
|
||||
entity_type?: number,
|
||||
entity_metadata?: entity_metadata,
|
||||
image?: string, //data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA
|
||||
}
|
||||
|
||||
|
||||
const data: guild_event = {
|
||||
channel_id: $.step.parameters.channel_id as number,
|
||||
name: $.step.parameters.name as string,
|
||||
const data = {
|
||||
channel_id: $.step.parameters.channel_id,
|
||||
name: $.step.parameters.name,
|
||||
privacy_level: 2,
|
||||
scheduled_start_time: $.step.parameters.scheduledStartTime as string,
|
||||
scheduled_end_time: $.step.parameters.scheduledEndTime as string,
|
||||
description: $.step.parameters.description as string,
|
||||
entity_type: $.step.parameters.entityType as number,
|
||||
image: $.step.parameters.image as string,
|
||||
scheduled_start_time: $.step.parameters.scheduledStartTime,
|
||||
scheduled_end_time: $.step.parameters.scheduledEndTime,
|
||||
description: $.step.parameters.description,
|
||||
entity_type: $.step.parameters.entityType,
|
||||
image: $.step.parameters.image,
|
||||
};
|
||||
|
||||
const isExternal = $.step.parameters.entityType === 3;
|
||||
|
||||
if (isExternal) {
|
||||
data.entity_metadata = {
|
||||
location: $.step.parameters.location as string,
|
||||
location: $.step.parameters.location,
|
||||
};
|
||||
|
||||
data.channel_id = null;
|
||||
}
|
||||
|
4
packages/backend/src/apps/discord/actions/index.js
Normal file
4
packages/backend/src/apps/discord/actions/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import sendMessageToChannel from './send-message-to-channel/index.js';
|
||||
import createScheduledEvent from './create-scheduled-event/index.js';
|
||||
|
||||
export default [sendMessageToChannel, createScheduledEvent];
|
@@ -1,4 +0,0 @@
|
||||
import sendMessageToChannel from './send-message-to-channel';
|
||||
import createScheduledEvent from './create-scheduled-event';
|
||||
|
||||
export default [sendMessageToChannel, createScheduledEvent];
|
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Send a message to channel',
|
||||
@@ -8,7 +8,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Channel',
|
||||
key: 'channel',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'Pick a channel to send the message to.',
|
||||
variables: true,
|
||||
@@ -26,7 +26,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Message text',
|
||||
key: 'message',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The content of your new message.',
|
||||
variables: true,
|
||||
@@ -35,8 +35,9 @@ export default defineAction({
|
||||
|
||||
async run($) {
|
||||
const data = {
|
||||
content: $.step.parameters.message as string,
|
||||
content: $.step.parameters.message,
|
||||
};
|
||||
|
||||
const response = await $.http?.post(
|
||||
`/channels/${$.step.parameters.channel}/messages`,
|
||||
data
|
@@ -1,15 +1,15 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
import scopes from '../common/scopes';
|
||||
import scopes from '../common/scopes.js';
|
||||
|
||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||
export default async function generateAuthUrl($) {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
(field) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const callbackUrl = oauthRedirectUrlField.value as string;
|
||||
|
||||
const callbackUrl = oauthRedirectUrlField.value;
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: $.auth.data.consumerKey as string,
|
||||
client_id: $.auth.data.consumerKey,
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
permissions: '2146958591',
|
@@ -1,13 +1,13 @@
|
||||
import generateAuthUrl from './generate-auth-url';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
import generateAuthUrl from './generate-auth-url.js';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'oAuthRedirectUrl',
|
||||
label: 'OAuth Redirect URL',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/discord/connections/add',
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
{
|
||||
key: 'consumerKey',
|
||||
label: 'Consumer Key',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -32,7 +32,7 @@ export default {
|
||||
{
|
||||
key: 'consumerSecret',
|
||||
label: 'Consumer Secret',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -44,7 +44,7 @@ export default {
|
||||
{
|
||||
key: 'botToken',
|
||||
label: 'Bot token',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
@@ -0,0 +1,9 @@
|
||||
import getCurrentUser from '../common/get-current-user.js';
|
||||
|
||||
const isStillVerified = async ($) => {
|
||||
await getCurrentUser($);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,10 +0,0 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await getCurrentUser($);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,22 +1,24 @@
|
||||
import { IGlobalVariable, IField } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
import scopes from '../common/scopes';
|
||||
import getCurrentUser from '../common/get-current-user';
|
||||
import scopes from '../common/scopes.js';
|
||||
import getCurrentUser from '../common/get-current-user.js';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const verifyCredentials = async ($) => {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
(field) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const callbackUrl = oauthRedirectUrlField.value as string;
|
||||
|
||||
const callbackUrl = oauthRedirectUrlField.value;
|
||||
|
||||
const params = new URLSearchParams({
|
||||
client_id: $.auth.data.consumerKey as string,
|
||||
client_id: $.auth.data.consumerKey,
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
scope: scopes.join(' '),
|
||||
client_secret: $.auth.data.consumerSecret as string,
|
||||
code: $.auth.data.code as string,
|
||||
client_secret: $.auth.data.consumerSecret,
|
||||
code: $.auth.data.code,
|
||||
grant_type: 'authorization_code',
|
||||
});
|
||||
|
||||
const { data: verifiedCredentials } = await $.http.post(
|
||||
'/oauth2/token',
|
||||
params.toString()
|
@@ -1,6 +1,4 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const addAuthHeader = ($, requestConfig) => {
|
||||
const { tokenType, botToken } = $.auth.data;
|
||||
if (tokenType && botToken) {
|
||||
requestConfig.headers.Authorization = `Bot ${botToken}`;
|
@@ -1,6 +1,4 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||
const getCurrentUser = async ($) => {
|
||||
const response = await $.http.get('/users/@me');
|
||||
const currentUser = response.data;
|
||||
|
4
packages/backend/src/apps/discord/dynamic-data/index.js
Normal file
4
packages/backend/src/apps/discord/dynamic-data/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import listChannels from './list-channels/index.js';
|
||||
import listVoiceChannels from './list-voice-channels/index.js';
|
||||
|
||||
export default [listChannels, listVoiceChannels];
|
@@ -1,4 +0,0 @@
|
||||
import listChannels from './list-channels';
|
||||
import listVoiceChannels from './list-voice-channels';
|
||||
|
||||
export default [listChannels, listVoiceChannels];
|
@@ -1,14 +1,9 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List channels',
|
||||
key: 'listChannels',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const channels: {
|
||||
data: IJSONObject[];
|
||||
error: IJSONObject | null;
|
||||
} = {
|
||||
async run($) {
|
||||
const channels = {
|
||||
data: [],
|
||||
error: null,
|
||||
};
|
||||
@@ -18,11 +13,11 @@ export default {
|
||||
);
|
||||
|
||||
channels.data = response.data
|
||||
.filter((channel: IJSONObject) => {
|
||||
.filter((channel) => {
|
||||
// filter in text channels and announcement channels only
|
||||
return channel.type === 0 || channel.type === 5;
|
||||
})
|
||||
.map((channel: IJSONObject) => {
|
||||
.map((channel) => {
|
||||
return {
|
||||
value: channel.id,
|
||||
name: channel.name,
|
@@ -1,14 +1,9 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default {
|
||||
name: 'List voice channels',
|
||||
key: 'listVoiceChannels',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const channels: {
|
||||
data: IJSONObject[];
|
||||
error: IJSONObject | null;
|
||||
} = {
|
||||
async run($) {
|
||||
const channels = {
|
||||
data: [],
|
||||
error: null,
|
||||
};
|
||||
@@ -18,11 +13,11 @@ export default {
|
||||
);
|
||||
|
||||
channels.data = response.data
|
||||
.filter((channel: IJSONObject) => {
|
||||
.filter((channel) => {
|
||||
// filter in voice and stage channels only
|
||||
return channel.type === 2 || channel.type === 13;
|
||||
})
|
||||
.map((channel: IJSONObject) => {
|
||||
.map((channel) => {
|
||||
return {
|
||||
value: channel.id,
|
||||
name: channel.name,
|
@@ -1,3 +1,3 @@
|
||||
import listExternalScheduledEventFields from './list-external-scheduled-event-fields';
|
||||
import listExternalScheduledEventFields from './list-external-scheduled-event-fields/index.js';
|
||||
|
||||
export default [listExternalScheduledEventFields];
|
@@ -1,9 +1,8 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
export default {
|
||||
name: 'List external scheduled event fields',
|
||||
key: 'listExternalScheduledEventFields',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
async run($) {
|
||||
const isExternal = $.step.parameters.entityType === 3;
|
||||
|
||||
if (isExternal) {
|
||||
@@ -11,15 +10,16 @@ export default {
|
||||
{
|
||||
label: 'Location',
|
||||
key: 'location',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||
description:
|
||||
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Start-Time',
|
||||
key: 'scheduledStartTime',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The time the event will start [ISO8601]',
|
||||
variables: true,
|
||||
@@ -27,9 +27,10 @@ export default {
|
||||
{
|
||||
label: 'End-Time',
|
||||
key: 'scheduledEndTime',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||
description:
|
||||
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
];
|
||||
@@ -39,9 +40,10 @@ export default {
|
||||
{
|
||||
label: 'Channel',
|
||||
key: 'channel_id',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: 'Pick a voice or stage channel to link the event to. This will be omitted if type is EXTERNAL',
|
||||
description:
|
||||
'Pick a voice or stage channel to link the event to. This will be omitted if type is EXTERNAL',
|
||||
variables: true,
|
||||
source: {
|
||||
type: 'query',
|
||||
@@ -57,15 +59,16 @@ export default {
|
||||
{
|
||||
label: 'Location',
|
||||
key: 'location',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||
description:
|
||||
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Start-Time',
|
||||
key: 'scheduledStartTime',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The time the event will start [ISO8601]',
|
||||
variables: true,
|
||||
@@ -73,9 +76,10 @@ export default {
|
||||
{
|
||||
label: 'End-Time',
|
||||
key: 'scheduledEndTime',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||
description:
|
||||
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||
variables: true,
|
||||
},
|
||||
];
|
@@ -1,10 +1,10 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import dynamicData from './dynamic-data';
|
||||
import actions from './actions';
|
||||
import triggers from './triggers';
|
||||
import dynamicFields from './dynamic-fields';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import dynamicData from './dynamic-data/index.js';
|
||||
import actions from './actions/index.js';
|
||||
import triggers from './triggers/index.js';
|
||||
import dynamicFields from './dynamic-fields/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Discord',
|
@@ -1,23 +1,25 @@
|
||||
import path from 'node:path';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Create folder',
|
||||
key: 'createFolder',
|
||||
description: 'Create a new folder with the given parent folder and folder name',
|
||||
description:
|
||||
'Create a new folder with the given parent folder and folder name',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Folder',
|
||||
key: 'parentFolder',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Enter the parent folder path, like /TextFiles/ or /Documents/Taxes/',
|
||||
description:
|
||||
'Enter the parent folder path, like /TextFiles/ or /Documents/Taxes/',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'Folder Name',
|
||||
key: 'folderName',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Enter the name for the new folder',
|
||||
variables: true,
|
||||
@@ -25,11 +27,13 @@ export default defineAction({
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const parentFolder = $.step.parameters.parentFolder as string;
|
||||
const folderName = $.step.parameters.folderName as string;
|
||||
const parentFolder = $.step.parameters.parentFolder;
|
||||
const folderName = $.step.parameters.folderName;
|
||||
const folderPath = path.join(parentFolder, folderName);
|
||||
|
||||
const response = await $.http.post('/2/files/create_folder_v2', { path: folderPath });
|
||||
const response = await $.http.post('/2/files/create_folder_v2', {
|
||||
path: folderPath,
|
||||
});
|
||||
|
||||
$.setActionItem({ raw: response.data });
|
||||
},
|
4
packages/backend/src/apps/dropbox/actions/index.js
Normal file
4
packages/backend/src/apps/dropbox/actions/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import createFolder from './create-folder/index.js';
|
||||
import renameFile from './rename-file/index.js';
|
||||
|
||||
export default [createFolder, renameFile];
|
@@ -1,4 +0,0 @@
|
||||
import createFolder from "./create-folder";
|
||||
import renameFile from "./rename-file";
|
||||
|
||||
export default [createFolder, renameFile];
|
@@ -1,5 +1,5 @@
|
||||
import path from 'node:path';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Rename file',
|
||||
@@ -9,25 +9,25 @@ export default defineAction({
|
||||
{
|
||||
label: 'File Path',
|
||||
key: 'filePath',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description:
|
||||
'Write the full path to the file such as /Folder1/File.pdf',
|
||||
description: 'Write the full path to the file such as /Folder1/File.pdf',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
label: 'New Name',
|
||||
key: 'newName',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: "Enter the new name for the file (without the extension, e.g., '.pdf')",
|
||||
description:
|
||||
"Enter the new name for the file (without the extension, e.g., '.pdf')",
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const filePath = $.step.parameters.filePath as string;
|
||||
const newName = $.step.parameters.newName as string;
|
||||
const filePath = $.step.parameters.filePath;
|
||||
const newName = $.step.parameters.newName;
|
||||
const fileObject = path.parse(filePath);
|
||||
const newPath = path.format({
|
||||
dir: fileObject.dir,
|
@@ -1,15 +1,15 @@
|
||||
import { URLSearchParams } from 'url';
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import scopes from '../common/scopes';
|
||||
import scopes from '../common/scopes.js';
|
||||
|
||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||
export default async function generateAuthUrl($) {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
(field) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const callbackUrl = oauthRedirectUrlField.value as string;
|
||||
|
||||
const callbackUrl = oauthRedirectUrlField.value;
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: $.auth.data.clientId as string,
|
||||
client_id: $.auth.data.clientId,
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
scope: scopes.join(' '),
|
@@ -1,14 +1,14 @@
|
||||
import generateAuthUrl from './generate-auth-url';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
import refreshToken from './refresh-token';
|
||||
import generateAuthUrl from './generate-auth-url.js';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
import refreshToken from './refresh-token.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'oAuthRedirectUrl',
|
||||
label: 'OAuth Redirect URL',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/dropbox/connections/add',
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
{
|
||||
key: 'clientId',
|
||||
label: 'App Key',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
{
|
||||
key: 'clientSecret',
|
||||
label: 'App Secret',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
@@ -0,0 +1,8 @@
|
||||
import getCurrentAccount from '../common/get-current-account.js';
|
||||
|
||||
const isStillVerified = async ($) => {
|
||||
const account = await getCurrentAccount($);
|
||||
return !!account;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -1,9 +0,0 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import getCurrentAccount from '../common/get-current-account';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
const account = await getCurrentAccount($);
|
||||
return !!account;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
36
packages/backend/src/apps/dropbox/auth/refresh-token.js
Normal file
36
packages/backend/src/apps/dropbox/auth/refresh-token.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Buffer } from 'node:buffer';
|
||||
|
||||
const refreshToken = async ($) => {
|
||||
const params = {
|
||||
grant_type: 'refresh_token',
|
||||
refresh_token: $.auth.data.refreshToken,
|
||||
};
|
||||
|
||||
const basicAuthToken = Buffer.from(
|
||||
`${$.auth.data.clientId}:${$.auth.data.clientSecret}`
|
||||
).toString('base64');
|
||||
|
||||
const { data } = await $.http.post('oauth2/token', null, {
|
||||
params,
|
||||
headers: {
|
||||
Authorization: `Basic ${basicAuthToken}`,
|
||||
},
|
||||
additionalProperties: {
|
||||
skipAddingAuthHeader: true,
|
||||
},
|
||||
});
|
||||
|
||||
const {
|
||||
access_token: accessToken,
|
||||
expires_in: expiresIn,
|
||||
token_type: tokenType,
|
||||
} = data;
|
||||
|
||||
await $.auth.set({
|
||||
accessToken,
|
||||
expiresIn,
|
||||
tokenType,
|
||||
});
|
||||
};
|
||||
|
||||
export default refreshToken;
|
@@ -1,41 +0,0 @@
|
||||
import { Buffer } from 'node:buffer';
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const refreshToken = async ($: IGlobalVariable) => {
|
||||
const params = {
|
||||
grant_type: 'refresh_token',
|
||||
refresh_token: $.auth.data.refreshToken as string,
|
||||
};
|
||||
|
||||
const basicAuthToken = Buffer
|
||||
.from(`${$.auth.data.clientId}:${$.auth.data.clientSecret}`)
|
||||
.toString('base64');
|
||||
|
||||
const { data } = await $.http.post(
|
||||
'oauth2/token',
|
||||
null,
|
||||
{
|
||||
params,
|
||||
headers: {
|
||||
Authorization: `Basic ${basicAuthToken}`
|
||||
},
|
||||
additionalProperties: {
|
||||
skipAddingAuthHeader: true
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const {
|
||||
access_token: accessToken,
|
||||
expires_in: expiresIn,
|
||||
token_type: tokenType,
|
||||
} = data;
|
||||
|
||||
await $.auth.set({
|
||||
accessToken,
|
||||
expiresIn,
|
||||
tokenType,
|
||||
});
|
||||
};
|
||||
|
||||
export default refreshToken;
|
@@ -1,44 +1,20 @@
|
||||
import { IGlobalVariable, IField } from '@automatisch/types';
|
||||
import getCurrentAccount from '../common/get-current-account';
|
||||
import getCurrentAccount from '../common/get-current-account.js';
|
||||
|
||||
type TAccount = {
|
||||
account_id: string,
|
||||
name: {
|
||||
given_name: string,
|
||||
surname: string,
|
||||
familiar_name: string,
|
||||
display_name: string,
|
||||
abbreviated_name: string,
|
||||
},
|
||||
email: string,
|
||||
email_verified: boolean,
|
||||
disabled: boolean,
|
||||
country: string,
|
||||
locale: string,
|
||||
referral_link: string,
|
||||
is_paired: boolean,
|
||||
account_type: {
|
||||
".tag": string,
|
||||
},
|
||||
root_info: {
|
||||
".tag": string,
|
||||
root_namespace_id: string,
|
||||
home_namespace_id: string,
|
||||
},
|
||||
}
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const verifyCredentials = async ($) => {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
(field) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
const redirectUrl = oauthRedirectUrlField.value as string;
|
||||
|
||||
const redirectUrl = oauthRedirectUrlField.value;
|
||||
|
||||
const params = {
|
||||
client_id: $.auth.data.clientId as string,
|
||||
client_id: $.auth.data.clientId,
|
||||
redirect_uri: redirectUrl,
|
||||
client_secret: $.auth.data.clientSecret as string,
|
||||
code: $.auth.data.code as string,
|
||||
client_secret: $.auth.data.clientSecret,
|
||||
code: $.auth.data.code,
|
||||
grant_type: 'authorization_code',
|
||||
}
|
||||
};
|
||||
|
||||
const { data: verifiedCredentials } = await $.http.post(
|
||||
'/oauth2/token',
|
||||
null,
|
||||
@@ -66,10 +42,10 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
accountId,
|
||||
teamId,
|
||||
idToken,
|
||||
uid
|
||||
uid,
|
||||
});
|
||||
|
||||
const account = await getCurrentAccount($) as TAccount;
|
||||
const account = await getCurrentAccount($);
|
||||
|
||||
await $.auth.set({
|
||||
accountId: account.account_id,
|
||||
@@ -88,10 +64,10 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
referralLink: account.referral_link,
|
||||
isPaired: account.is_paired,
|
||||
accountType: {
|
||||
".tag": account.account_type['.tag'],
|
||||
'.tag': account.account_type['.tag'],
|
||||
},
|
||||
rootInfo: {
|
||||
".tag": account.root_info['.tag'],
|
||||
'.tag': account.root_info['.tag'],
|
||||
rootNamespaceId: account.root_info.root_namespace_id,
|
||||
homeNamespaceId: account.root_info.home_namespace_id,
|
||||
},
|
14
packages/backend/src/apps/dropbox/common/add-auth-header.js
Normal file
14
packages/backend/src/apps/dropbox/common/add-auth-header.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const addAuthHeader = ($, requestConfig) => {
|
||||
requestConfig.headers['Content-Type'] = 'application/json';
|
||||
|
||||
if (
|
||||
!requestConfig.additionalProperties?.skipAddingAuthHeader &&
|
||||
$.auth.data?.accessToken
|
||||
) {
|
||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
@@ -1,13 +0,0 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
requestConfig.headers['Content-Type'] = 'application/json';
|
||||
|
||||
if (!requestConfig.additionalProperties?.skipAddingAuthHeader && $.auth.data?.accessToken) {
|
||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
@@ -0,0 +1,6 @@
|
||||
const getCurrentAccount = async ($) => {
|
||||
const response = await $.http.post('/2/users/get_current_account', null);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export default getCurrentAccount;
|
@@ -1,8 +0,0 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
const getCurrentAccount = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||
const response = await $.http.post('/2/users/get_current_account', null);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export default getCurrentAccount;
|
@@ -1,7 +1,7 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import actions from './actions';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import actions from './actions/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Dropbox',
|
88
packages/backend/src/apps/filter/actions/continue/index.js
Normal file
88
packages/backend/src/apps/filter/actions/continue/index.js
Normal file
@@ -0,0 +1,88 @@
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
const isEqual = (a, b) => a === b;
|
||||
const isNotEqual = (a, b) => !isEqual(a, b);
|
||||
const isGreaterThan = (a, b) => Number(a) > Number(b);
|
||||
const isLessThan = (a, b) => Number(a) < Number(b);
|
||||
const isGreaterThanOrEqual = (a, b) => Number(a) >= Number(b);
|
||||
const isLessThanOrEqual = (a, b) => Number(a) <= Number(b);
|
||||
const contains = (a, b) => a.includes(b);
|
||||
const doesNotContain = (a, b) => !contains(a, b);
|
||||
|
||||
const shouldContinue = (orGroups) => {
|
||||
let atLeastOneGroupMatches = false;
|
||||
|
||||
for (const group of orGroups) {
|
||||
let groupMatches = true;
|
||||
|
||||
for (const condition of group.and) {
|
||||
const conditionMatches = operate(
|
||||
condition.operator,
|
||||
condition.key,
|
||||
condition.value
|
||||
);
|
||||
|
||||
if (!conditionMatches) {
|
||||
groupMatches = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (groupMatches) {
|
||||
atLeastOneGroupMatches = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return atLeastOneGroupMatches;
|
||||
};
|
||||
|
||||
const operators = {
|
||||
equal: isEqual,
|
||||
not_equal: isNotEqual,
|
||||
greater_than: isGreaterThan,
|
||||
less_than: isLessThan,
|
||||
greater_than_or_equal: isGreaterThanOrEqual,
|
||||
less_than_or_equal: isLessThanOrEqual,
|
||||
contains: contains,
|
||||
not_contains: doesNotContain,
|
||||
};
|
||||
|
||||
const operate = (operation, a, b) => {
|
||||
return operators[operation](a, b);
|
||||
};
|
||||
|
||||
export default defineAction({
|
||||
name: 'Continue if conditions match',
|
||||
key: 'continueIfMatches',
|
||||
description: 'Let the execution continue if the conditions match',
|
||||
arguments: [],
|
||||
|
||||
async run($) {
|
||||
const orGroups = $.step.parameters.or;
|
||||
|
||||
const matchingGroups = orGroups.reduce((groups, group) => {
|
||||
const matchingConditions = group.and.filter((condition) =>
|
||||
operate(condition.operator, condition.key, condition.value)
|
||||
);
|
||||
|
||||
if (matchingConditions.length) {
|
||||
return groups.concat([{ and: matchingConditions }]);
|
||||
}
|
||||
|
||||
return groups;
|
||||
}, []);
|
||||
|
||||
if (!shouldContinue(orGroups)) {
|
||||
$.execution.exit();
|
||||
}
|
||||
|
||||
$.setActionItem({
|
||||
raw: {
|
||||
or: matchingGroups,
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
@@ -1,109 +0,0 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
|
||||
type TGroupItem = {
|
||||
key: string;
|
||||
operator: keyof TOperators;
|
||||
value: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
type TGroup = Record<'and', TGroupItem[]>;
|
||||
|
||||
const isEqual = (a: string, b: string) => a === b;
|
||||
const isNotEqual = (a: string, b: string) => !isEqual(a, b);
|
||||
const isGreaterThan = (a: string, b: string) => Number(a) > Number(b);
|
||||
const isLessThan = (a: string, b: string) => Number(a) < Number(b);
|
||||
const isGreaterThanOrEqual = (a: string, b: string) => Number(a) >= Number(b);
|
||||
const isLessThanOrEqual = (a: string, b: string) => Number(a) <= Number(b);
|
||||
const contains = (a: string, b: string) => a.includes(b);
|
||||
const doesNotContain = (a: string, b: string) => !contains(a, b);
|
||||
|
||||
const shouldContinue = (orGroups: TGroup[]) => {
|
||||
let atLeastOneGroupMatches = false;
|
||||
|
||||
for (const group of orGroups) {
|
||||
let groupMatches = true;
|
||||
|
||||
for (const condition of group.and) {
|
||||
const conditionMatches = operate(
|
||||
condition.operator,
|
||||
condition.key,
|
||||
condition.value
|
||||
);
|
||||
|
||||
if (!conditionMatches) {
|
||||
groupMatches = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (groupMatches) {
|
||||
atLeastOneGroupMatches = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return atLeastOneGroupMatches;
|
||||
}
|
||||
|
||||
type TOperatorFunc = (a: string, b: string) => boolean;
|
||||
|
||||
type TOperators = {
|
||||
equal: TOperatorFunc;
|
||||
not_equal: TOperatorFunc;
|
||||
greater_than: TOperatorFunc;
|
||||
less_than: TOperatorFunc;
|
||||
greater_than_or_equal: TOperatorFunc;
|
||||
less_than_or_equal: TOperatorFunc;
|
||||
contains: TOperatorFunc;
|
||||
not_contains: TOperatorFunc;
|
||||
};
|
||||
|
||||
const operators: TOperators = {
|
||||
'equal': isEqual,
|
||||
'not_equal': isNotEqual,
|
||||
'greater_than': isGreaterThan,
|
||||
'less_than': isLessThan,
|
||||
'greater_than_or_equal': isGreaterThanOrEqual,
|
||||
'less_than_or_equal': isLessThanOrEqual,
|
||||
'contains': contains,
|
||||
'not_contains': doesNotContain,
|
||||
};
|
||||
|
||||
const operate = (operation: keyof TOperators, a: string, b: string) => {
|
||||
return operators[operation](a, b);
|
||||
};
|
||||
|
||||
export default defineAction({
|
||||
name: 'Continue if conditions match',
|
||||
key: 'continueIfMatches',
|
||||
description: 'Let the execution continue if the conditions match',
|
||||
arguments: [],
|
||||
|
||||
async run($) {
|
||||
const orGroups = $.step.parameters.or as TGroup[];
|
||||
|
||||
const matchingGroups = orGroups.reduce((groups, group) => {
|
||||
const matchingConditions = group.and
|
||||
.filter((condition) => operate(condition.operator, condition.key, condition.value));
|
||||
|
||||
if (matchingConditions.length) {
|
||||
return groups.concat([{ and: matchingConditions }]);
|
||||
}
|
||||
|
||||
return groups;
|
||||
}, []);
|
||||
|
||||
if (!shouldContinue(orGroups)) {
|
||||
$.execution.exit();
|
||||
}
|
||||
|
||||
$.setActionItem({
|
||||
raw: {
|
||||
or: matchingGroups,
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
3
packages/backend/src/apps/filter/actions/index.js
Normal file
3
packages/backend/src/apps/filter/actions/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import continueIfMatches from './continue/index.js';
|
||||
|
||||
export default [continueIfMatches];
|
@@ -1,3 +0,0 @@
|
||||
import continueIfMatches from './continue';
|
||||
|
||||
export default [continueIfMatches];
|
@@ -1,5 +1,5 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import actions from './actions';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import actions from './actions/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Filter',
|
@@ -1,9 +1,8 @@
|
||||
import { IField, IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
export default async function generateAuthUrl($: IGlobalVariable) {
|
||||
export default async function generateAuthUrl($) {
|
||||
const oauthRedirectUrlField = $.app.auth.fields.find(
|
||||
(field: IField) => field.key == 'oAuthRedirectUrl'
|
||||
(field) => field.key == 'oAuthRedirectUrl'
|
||||
);
|
||||
|
||||
const callbackUrl = oauthRedirectUrlField.value;
|
@@ -1,13 +1,13 @@
|
||||
import generateAuthUrl from './generate-auth-url';
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
import generateAuthUrl from './generate-auth-url.js';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'oAuthRedirectUrl',
|
||||
label: 'OAuth Redirect URL',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/flickr/connections/add',
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
{
|
||||
key: 'consumerKey',
|
||||
label: 'Consumer Key',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
@@ -32,7 +32,7 @@ export default {
|
||||
{
|
||||
key: 'consumerSecret',
|
||||
label: 'Consumer Secret',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
@@ -1,6 +1,4 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
const isStillVerified = async ($) => {
|
||||
const params = {
|
||||
method: 'flickr.test.login',
|
||||
format: 'json',
|
@@ -1,7 +1,6 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const verifyCredentials = async ($) => {
|
||||
const response = await $.http.post(
|
||||
`/oauth/access_token?oauth_verifier=${$.auth.data.oauth_verifier}&oauth_token=${$.auth.data.accessToken}`,
|
||||
null
|
@@ -1,22 +1,14 @@
|
||||
import { Token } from 'oauth-1.0a';
|
||||
import { IJSONObject, TBeforeRequest } from '@automatisch/types';
|
||||
import oauthClient from './oauth-client';
|
||||
import oauthClient from './oauth-client.js';
|
||||
|
||||
type RequestDataType = {
|
||||
url: string;
|
||||
method: string;
|
||||
data?: IJSONObject;
|
||||
};
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const addAuthHeader = ($, requestConfig) => {
|
||||
const { url, method, data, params } = requestConfig;
|
||||
|
||||
const token: Token = {
|
||||
key: $.auth.data?.accessToken as string,
|
||||
secret: $.auth.data?.accessSecret as string,
|
||||
const token = {
|
||||
key: $.auth.data?.accessToken,
|
||||
secret: $.auth.data?.accessSecret,
|
||||
};
|
||||
|
||||
const requestData: RequestDataType = {
|
||||
const requestData = {
|
||||
url: `${requestConfig.baseURL}${url}`,
|
||||
method,
|
||||
};
|
@@ -1,11 +1,10 @@
|
||||
import { IGlobalVariable } from '@automatisch/types';
|
||||
import crypto from 'crypto';
|
||||
import OAuth from 'oauth-1.0a';
|
||||
|
||||
const oauthClient = ($: IGlobalVariable) => {
|
||||
const oauthClient = ($) => {
|
||||
const consumerData = {
|
||||
key: $.auth.data.consumerKey as string,
|
||||
secret: $.auth.data.consumerSecret as string,
|
||||
key: $.auth.data.consumerKey,
|
||||
secret: $.auth.data.consumerSecret,
|
||||
};
|
||||
|
||||
return new OAuth({
|
3
packages/backend/src/apps/flickr/dynamic-data/index.js
Normal file
3
packages/backend/src/apps/flickr/dynamic-data/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import listAlbums from './list-albums/index.js';
|
||||
|
||||
export default [listAlbums];
|
@@ -1,3 +0,0 @@
|
||||
import listAlbums from './list-albums';
|
||||
|
||||
export default [listAlbums];
|
@@ -1,22 +1,8 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
type TResponse = {
|
||||
data: IJSONObject[];
|
||||
error?: IJSONObject;
|
||||
};
|
||||
|
||||
type TPhotoset = {
|
||||
id: string;
|
||||
title: {
|
||||
_content: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'List albums',
|
||||
key: 'listAlbums',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
async run($) {
|
||||
const params = {
|
||||
page: 1,
|
||||
per_page: 500,
|
||||
@@ -25,9 +11,10 @@ export default {
|
||||
format: 'json',
|
||||
nojsoncallback: 1,
|
||||
};
|
||||
|
||||
let response = await $.http.get('/rest', { params });
|
||||
|
||||
const aggregatedResponse: TResponse = {
|
||||
const aggregatedResponse = {
|
||||
data: [...response.data.photosets.photoset],
|
||||
};
|
||||
|
||||
@@ -42,14 +29,12 @@ export default {
|
||||
aggregatedResponse.data.push(...response.data.photosets.photoset);
|
||||
}
|
||||
|
||||
aggregatedResponse.data = aggregatedResponse.data.map(
|
||||
(photoset: TPhotoset) => {
|
||||
return {
|
||||
value: photoset.id,
|
||||
name: photoset.title._content,
|
||||
} as IJSONObject;
|
||||
}
|
||||
);
|
||||
aggregatedResponse.data = aggregatedResponse.data.map((photoset) => {
|
||||
return {
|
||||
value: photoset.id,
|
||||
name: photoset.title._content,
|
||||
};
|
||||
});
|
||||
|
||||
return aggregatedResponse;
|
||||
},
|
@@ -1,8 +1,8 @@
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
import dynamicData from './dynamic-data';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import triggers from './triggers/index.js';
|
||||
import dynamicData from './dynamic-data/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Flickr',
|
6
packages/backend/src/apps/flickr/triggers/index.js
Normal file
6
packages/backend/src/apps/flickr/triggers/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import newAlbums from './new-albums/index.js';
|
||||
import newFavoritePhotos from './new-favorite-photos/index.js';
|
||||
import newPhotos from './new-photos/index.js';
|
||||
import newPhotosInAlbums from './new-photos-in-album/index.js';
|
||||
|
||||
export default [newAlbums, newFavoritePhotos, newPhotos, newPhotosInAlbums];
|
@@ -1,6 +0,0 @@
|
||||
import newAlbums from './new-albums';
|
||||
import newFavoritePhotos from './new-favorite-photos';
|
||||
import newPhotos from './new-photos';
|
||||
import newPhotosInAlbums from './new-photos-in-album';
|
||||
|
||||
export default [newAlbums, newFavoritePhotos, newPhotos, newPhotosInAlbums];
|
@@ -1,5 +1,5 @@
|
||||
import defineTrigger from '../../../../helpers/define-trigger';
|
||||
import newAlbums from './new-albums';
|
||||
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
import newAlbums from './new-albums.js';
|
||||
|
||||
export default defineTrigger({
|
||||
name: 'New albums',
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user