Compare commits

..

17 Commits

Author SHA1 Message Date
Ali BARIN
24bf07e068 Update version to 0.13.1 2024-08-02 15:54:26 +02:00
Ali BARIN
bae234827f Merge pull request #2006 from automatisch/use-unparsed-numbers-in-compute-parameters
fix(compute-parameters): use unparsed numbers
2024-08-02 15:42:21 +02:00
Ali BARIN
81c698f45b fix(compute-parameters): use unparsed numbers 2024-08-02 12:22:03 +00:00
Ali BARIN
c9fecec575 Merge pull request #2002 from automatisch/aut-1255
feat: expose installationCompleted in GET /v1/automatisch/info
2024-08-02 11:46:48 +02:00
Ali BARIN
2f42dfdc51 Merge pull request #2001 from automatisch/remove-pwa
feat: remove PWA
2024-08-02 11:16:44 +02:00
Ali BARIN
5afd500c26 Merge pull request #2003 from automatisch/release/v0.13.0
Update version to 0.13.0
2024-08-01 18:30:55 +02:00
Faruk AYDIN
50d91405a9 Update version to 0.13.0 2024-08-01 17:32:19 +02:00
Ali BARIN
69eed65c9b Merge pull request #1991 from automatisch/AUT-1064
fix: introduce fix for overflowing inputs with long parameters names
2024-08-01 16:22:17 +02:00
kasia.oczkowska
f1355cd0ab fix: introduce fix for overflowing inputs with long parameters names 2024-08-01 15:10:41 +01:00
Ali BARIN
cc1a924c8b feat: use installationCompleted from useAutomatischInfo hook 2024-08-01 13:38:06 +00:00
Ali BARIN
02005a3f09 feat: expose installationCompleted in GET /v1/automatisch/info 2024-08-01 13:02:21 +00:00
Ali BARIN
d9219a5a48 feat: remove PWA 2024-08-01 12:28:23 +00:00
Ali BARIN
dffbdf544c Merge pull request #2000 from automatisch/AUT-1131
fix: prevent removing last filter criteria
2024-08-01 10:50:42 +02:00
kasia.oczkowska
e2dbf1a215 fix: prevent removing last filter criteria 2024-08-01 08:40:54 +01:00
Ömer Faruk Aydın
c1396b97f0 Merge pull request #1996 from automatisch/support-arrays-in-flows
feat: support arrays in flows
2024-07-30 13:26:56 +02:00
Ali BARIN
920a711c00 feat: support arrays in flows 2024-07-29 11:33:36 +00:00
Ömer Faruk Aydın
02a872a376 Merge pull request #1995 from automatisch/support-async-before-request
feat(http-client): support async beforeRequest interceptors
2024-07-27 18:41:40 +02:00
16 changed files with 96 additions and 107 deletions

View File

@@ -89,8 +89,6 @@ export default defineAction({
const response = await $.http.post('/', payload);
console.log(response.config.additionalProperties.extraData);
$.setActionItem({
raw: response.data,
});

View File

@@ -1,7 +1,4 @@
const addAuthHeader = ($, requestConfig) => {
console.log('requestConfig', requestConfig)
if (requestConfig.additionalProperties?.skip) return requestConfig;
if ($.auth.data.serverUrl) {
requestConfig.baseURL = $.auth.data.serverUrl;
}

View File

@@ -1,23 +0,0 @@
const asyncBeforeRequest = async ($, requestConfig) => {
if (requestConfig.additionalProperties?.skip)
return requestConfig;
const response = await $.http.post(
'http://localhost:3000/webhooks/flows/8a040f4e-817f-4076-80ba-3c1c0af7e65e/sync',
null,
{
additionalProperties: {
skip: true,
},
}
);
console.log(response);
requestConfig.additionalProperties = {
extraData: response.data
}
return requestConfig;
};
export default asyncBeforeRequest;

View File

@@ -1,6 +1,5 @@
import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header.js';
import asyncBeforeRequest from './common/async-before-request.js';
import auth from './auth/index.js';
import actions from './actions/index.js';
@@ -13,7 +12,7 @@ export default defineApp({
baseUrl: 'https://ntfy.sh',
apiBaseUrl: 'https://ntfy.sh',
primaryColor: '56bda8',
beforeRequest: [asyncBeforeRequest, addAuthHeader],
beforeRequest: [addAuthHeader],
auth,
actions,
});

View File

@@ -52,7 +52,7 @@ const appConfig = {
isDev: appEnv === 'development',
isTest: appEnv === 'test',
isProd: appEnv === 'production',
version: '0.12.0',
version: '0.13.1',
postgresDatabase: process.env.POSTGRES_DATABASE || 'automatisch_development',
postgresSchema: process.env.POSTGRES_SCHEMA || 'public',
postgresPort: parseInt(process.env.POSTGRES_PORT || '5432'),

View File

@@ -1,13 +1,17 @@
import appConfig from '../../../../config/app.js';
import { hasValidLicense } from '../../../../helpers/license.ee.js';
import { renderObject } from '../../../../helpers/renderer.js';
import Config from '../../../../models/config.js';
export default async (request, response) => {
const installationCompleted = await Config.isInstallationCompleted();
const info = {
isCloud: appConfig.isCloud,
isMation: appConfig.isMation,
isEnterprise: await hasValidLicense(),
docsUrl: appConfig.docsUrl,
installationCompleted,
isCloud: appConfig.isCloud,
isEnterprise: await hasValidLicense(),
isMation: appConfig.isMation,
};
renderObject(response, info);

View File

@@ -1,12 +1,14 @@
import { vi, expect, describe, it } from 'vitest';
import request from 'supertest';
import appConfig from '../../../../config/app.js';
import Config from '../../../../models/config.js';
import app from '../../../../app.js';
import infoMock from '../../../../../test/mocks/rest/api/v1/automatisch/info.js';
import * as license from '../../../../helpers/license.ee.js';
describe('GET /api/v1/automatisch/info', () => {
it('should return Automatisch info', async () => {
vi.spyOn(Config, 'isInstallationCompleted').mockResolvedValue(true);
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(false);
vi.spyOn(appConfig, 'isMation', 'get').mockReturnValue(false);
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);

View File

@@ -10,7 +10,7 @@ describe('GET /api/v1/automatisch/version', () => {
const expectedPayload = {
data: {
version: '0.12.0',
version: '0.13.1',
},
meta: {
count: 1,

View File

@@ -11,6 +11,7 @@ export default function computeParameters(parameters, executionSteps) {
const computedValue = parts
.map((part) => {
const isVariable = part.match(variableRegExp);
if (isVariable) {
const stepIdAndKeyPath = part.replace(/{{step.|}}/g, '');
const [stepId, ...keyPaths] = stepIdAndKeyPath.split('.');
@@ -20,17 +21,36 @@ export default function computeParameters(parameters, executionSteps) {
});
const data = executionStep?.dataOut;
const dataValue = get(data, keyPath);
// Covers both arrays and objects
if (typeof dataValue === 'object') {
return JSON.stringify(dataValue);
}
return dataValue;
}
return part;
})
.join('');
}).join('');
return {
...result,
[key]: computedValue,
};
// challenge the input to see if it is stringifies object or array
try {
const parsedValue = JSON.parse(computedValue);
if (typeof parsedValue === 'number') {
throw new Error('Use original unparsed value.');
}
return {
...result,
[key]: parsedValue,
};
} catch (error) {
return {
...result,
[key]: computedValue,
};
}
}
if (Array.isArray(value)) {

View File

@@ -1,10 +1,11 @@
const infoMock = () => {
return {
data: {
isCloud: false,
isMation: false,
isEnterprise: true,
docsUrl: 'https://automatisch.io/docs',
installationCompleted: true,
isCloud: false,
isEnterprise: true,
isMation: false,
},
meta: {
count: 1,

View File

@@ -8,11 +8,6 @@
name="description"
content="Build workflow automation without spending time and money. No code is required."
/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.

View File

@@ -1,9 +0,0 @@
{
"short_name": "automatisch",
"name": "automatisch",
"description": "Build workflow automation without spending time and money. No code is required.",
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@@ -3,7 +3,6 @@ import * as React from 'react';
import { v4 as uuidv4 } from 'uuid';
import { useFormContext, useWatch } from 'react-hook-form';
import Stack from '@mui/material/Stack';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Divider from '@mui/material/Divider';
import IconButton from '@mui/material/IconButton';
@@ -12,6 +11,7 @@ import AddIcon from '@mui/icons-material/Add';
import useFormatMessage from 'hooks/useFormatMessage';
import InputCreator from 'components/InputCreator';
import { EditorContext } from 'contexts/Editor';
import { Grid } from '@mui/material';
const createGroupItem = () => ({
key: '',
@@ -122,7 +122,7 @@ function FilterConditions(props) {
<React.Fragment>
<Stack sx={{ width: '100%' }} direction="column" spacing={2} mt={2}>
{groups?.map((group, groupIndex) => (
<>
<React.Fragment key={groupIndex}>
{groupIndex !== 0 && <Divider />}
<Typography variant="subtitle2" gutterBottom>
@@ -133,19 +133,16 @@ function FilterConditions(props) {
</Typography>
{group?.and?.map((groupItem, groupItemIndex) => (
<Stack direction="row" spacing={2} key={`item-${groupItem.id}`}>
<Stack
direction={{ xs: 'column', sm: 'row' }}
spacing={{ xs: 2 }}
sx={{ display: 'flex', flex: 1 }}
<Grid container key={`item-${groupItem.id}`}>
<Grid
container
spacing={2}
item
xs={12}
sm={11}
sx={{ order: { xs: 2, sm: 1 } }}
>
<Box
sx={{
display: 'flex',
flex: '1 0 0px',
maxWidth: ['100%', '33%'],
}}
>
<Grid item xs={12} md={4}>
<InputCreator
schema={createStringArgument({
key: `or.${groupIndex}.and.${groupItemIndex}.key`,
@@ -155,15 +152,8 @@ function FilterConditions(props) {
stepId={stepId}
disabled={editorContext.readOnly}
/>
</Box>
<Box
sx={{
display: 'flex',
flex: '1 0 0px',
maxWidth: ['100%', '33%'],
}}
>
</Grid>
<Grid item xs={12} md={4}>
<InputCreator
schema={createDropdownArgument({
key: `or.${groupIndex}.and.${groupItemIndex}.operator`,
@@ -174,15 +164,8 @@ function FilterConditions(props) {
stepId={stepId}
disabled={editorContext.readOnly}
/>
</Box>
<Box
sx={{
display: 'flex',
flex: '1 0 0px',
maxWidth: ['100%', '33%'],
}}
>
</Grid>
<Grid item xs={12} md={4}>
<InputCreator
schema={createStringArgument({
key: `or.${groupIndex}.and.${groupItemIndex}.value`,
@@ -192,18 +175,28 @@ function FilterConditions(props) {
stepId={stepId}
disabled={editorContext.readOnly}
/>
</Box>
</Stack>
<IconButton
size="small"
edge="start"
onClick={() => removeGroupItem(groupIndex, groupItemIndex)}
sx={{ width: 61, height: 61 }}
>
<RemoveIcon />
</IconButton>
</Stack>
</Grid>
</Grid>
<Grid item xs={12} sm={1} sx={{ order: { xs: 1, sm: 2 } }}>
<Stack justifyContent="center" alignItems="flex-end">
<IconButton
size="small"
edge="start"
onClick={() =>
removeGroupItem(groupIndex, groupItemIndex)
}
sx={{
width: 40,
height: 40,
mb: { xs: 2, sm: 0 },
}}
disabled={groups.length === 1 && group.and.length === 1}
>
<RemoveIcon />
</IconButton>
</Stack>
</Grid>
</Grid>
))}
<Stack spacing={1} direction="row">
@@ -227,7 +220,7 @@ function FilterConditions(props) {
</IconButton>
)}
</Stack>
</>
</React.Fragment>
))}
</Stack>
</React.Fragment>

View File

@@ -44,7 +44,7 @@ function InstallationForm() {
const handleOnRedirect = () => {
queryClient.invalidateQueries({
queryKey: ['automatisch', 'config'],
queryKey: ['automatisch', 'info'],
});
};

View File

@@ -19,7 +19,13 @@ const process = ({ data, parentKey, index, parentLabel = '' }) => {
const value = joinBy('.', parentKey, index?.toString(), name);
if (Array.isArray(sampleValue)) {
return sampleValue.flatMap((item, index) =>
const arrayItself = {
label,
value,
sampleValue: JSON.stringify(sampleValue),
};
const arrayItems = sampleValue.flatMap((item, index) =>
process({
data: item,
parentKey: value,
@@ -27,6 +33,9 @@ const process = ({ data, parentKey, index, parentLabel = '' }) => {
parentLabel: label,
}),
);
// TODO: remove spreading
return [arrayItself, ...arrayItems];
}
if (typeof sampleValue === 'object' && sampleValue !== null) {
@@ -36,6 +45,7 @@ const process = ({ data, parentKey, index, parentLabel = '' }) => {
parentLabel: label,
});
}
return [
{
label,

View File

@@ -29,14 +29,16 @@ import adminSettingsRoutes from './adminSettingsRoutes';
import Notifications from 'pages/Notifications';
import useAutomatischConfig from 'hooks/useAutomatischConfig';
import useAuthentication from 'hooks/useAuthentication';
import useAutomatischInfo from 'hooks/useAutomatischInfo';
import Installation from 'pages/Installation';
function Routes() {
const { data: configData, isSuccess } = useAutomatischConfig();
const { data: automatischInfo, isSuccess } = useAutomatischInfo();
const { data: configData } = useAutomatischConfig();
const { isAuthenticated } = useAuthentication();
const config = configData?.data;
const installed = isSuccess ? config?.['installation.completed'] === true : true;
const installed = isSuccess ? automatischInfo.data.installationCompleted : true;
const navigate = useNavigate();
useEffect(() => {