From e338770e57d53c185bb66d0493de8f2bfb08cf53 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Sat, 5 Nov 2022 22:44:43 +0100 Subject: [PATCH 1/2] chore: add prettier as default formatter --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ad92582b..1b6457c5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "editor.formatOnSave": true + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" } From 475f24f6617d4bc03e08030ad42d2cf88aab2bc0 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Sat, 5 Nov 2022 23:57:33 +0100 Subject: [PATCH 2/2] style: auto format whole project --- .vscode/launch.json | 2 +- LICENSE.md | 310 +++++++++--------- docker/compose/docker-compose.yml | 8 +- lerna.json | 6 +- package.json | 2 +- packages/backend/bin/database/client.ts | 2 +- packages/backend/bin/database/utils.ts | 40 ++- packages/backend/knexfile.ts | 6 +- .../backend/src/apps/discord/actions/index.ts | 6 +- .../src/apps/discord/auth/create-auth-data.ts | 8 +- .../backend/src/apps/discord/auth/index.ts | 61 ++-- .../apps/discord/auth/verify-credentials.ts | 7 +- .../backend/src/apps/discord/data/index.ts | 6 +- .../apps/discord/data/list-channels/index.ts | 4 +- .../backend/src/apps/flickr/auth/index.ts | 57 ++-- .../src/apps/flickr/auth/is-still-verified.ts | 2 +- .../src/apps/flickr/data/list-albums/index.ts | 22 +- .../backend/src/apps/flickr/triggers/index.ts | 7 +- .../src/apps/github/auth/create-auth-data.ts | 4 +- .../backend/src/apps/github/auth/index.ts | 57 ++-- .../apps/github/auth/verify-credentials.ts | 7 +- .../src/apps/github/common/add-auth-header.ts | 6 +- .../github/common/get-repo-owner-and-repo.ts | 8 +- .../backend/src/apps/github/data/index.ts | 5 +- .../src/apps/github/data/list-labels/index.ts | 7 +- .../backend/src/apps/github/triggers/index.ts | 7 +- .../apps/salesforce/auth/create-auth-data.ts | 8 +- .../backend/src/apps/salesforce/auth/index.ts | 6 +- .../salesforce/auth/verify-credentials.ts | 4 +- .../backend/src/apps/salesforce/data/index.ts | 5 +- .../salesforce/data/list-objects/index.ts | 8 +- .../src/apps/salesforce/triggers/index.ts | 6 +- .../updated-field-in-records.ts | 4 +- .../src/apps/scheduler/common/cron-times.ts | 3 +- .../common/get-next-cron-date-time.ts | 6 +- .../src/apps/scheduler/triggers/index.ts | 7 +- .../backend/src/apps/slack/actions/index.ts | 5 +- .../send-a-message-to-channel/index.ts | 13 +- .../send-a-message-to-channel/post-message.ts | 10 +- .../src/apps/slack/auth/create-auth-data.ts | 2 +- .../src/apps/slack/auth/verify-credentials.ts | 11 +- .../src/apps/slack/common/add-auth-header.ts | 9 +- .../src/apps/slack/common/get-current-user.ts | 2 +- .../src/apps/twitter/triggers/index.ts | 7 +- packages/backend/src/config/cors-options.ts | 4 +- .../migrations/20211005151457_create_users.ts | 4 +- .../20211011120732_create_credentials.ts | 6 +- ...55_remove_display_name_from_credentials.ts | 2 +- ...04154_rename_credentials_as_connections.ts | 2 +- .../migrations/20211106214730_create_steps.ts | 2 +- .../migrations/20211122140336_create_flows.ts | 6 +- .../20211122140612_add_flow_id_to_steps.ts | 8 +- ...105151725_remove_constraints_from_steps.ts | 11 +- ...220108141045_add_active_column_to_flows.ts | 4 +- .../20220219093113_create_executions.ts | 2 +- .../20220219100800_create_execution_steps.ts | 2 +- .../20220928162525_soft-delete-base-model.ts | 2 +- .../src/graphql/mutations/create-flow.ts | 4 +- .../src/graphql/mutations/reset-connection.ts | 4 +- .../src/graphql/queries/get-current-user.ts | 6 +- .../src/graphql/queries/get-execution.ts | 4 +- .../backend/src/graphql/queries/get-flows.ts | 6 +- .../src/graphql/queries/healthcheck.ts | 2 +- .../src/helpers/add-reconnection-steps.ts | 28 +- .../backend/src/helpers/app-info-converter.ts | 2 +- packages/backend/src/helpers/error-handler.ts | 12 +- .../backend/src/helpers/global-variable.ts | 5 +- packages/backend/src/helpers/logger.ts | 6 +- packages/backend/src/helpers/morgan.ts | 11 +- .../backend/src/helpers/parse-header-link.ts | 7 +- packages/backend/src/models/base.ts | 5 +- packages/backend/src/models/query-builder.ts | 24 +- packages/backend/src/types/app-info.ts | 16 +- .../src/types/authentication-step-field.ts | 12 +- .../backend/src/types/authentication-step.ts | 8 +- packages/backend/src/types/field.d.ts | 22 +- packages/backend/test/sample.ts | 4 +- packages/cli/.github/dependabot.yml | 16 +- packages/cli/src/commands/start-worker.ts | 2 +- packages/cli/src/commands/start.ts | 4 +- packages/cli/src/index.ts | 2 +- packages/e2e-tests/cypress.config.js | 8 +- .../e2e-tests/cypress/e2e/apps/list-apps.js | 2 +- .../e2e/connections/create-connection.js | 13 +- .../e2e/executions/display-execution.js | 2 +- .../cypress/e2e/executions/list-executions.js | 2 +- .../cypress/e2e/flow-editor/create-flow.js | 62 ++-- .../e2e-tests/cypress/support/commands.js | 39 ++- packages/e2e-tests/cypress/support/e2e.js | 4 +- packages/web/public/index.html | 9 +- .../components/AccountDropdownMenu/index.tsx | 25 +- .../src/components/AddAppConnection/index.tsx | 118 ++++--- .../src/components/ApolloProvider/index.tsx | 13 +- packages/web/src/components/AppBar/index.tsx | 22 +- .../AppConnectionContextMenu/index.tsx | 21 +- .../src/components/AppConnectionRow/index.tsx | 134 +++++--- .../src/components/AppConnectionRow/style.ts | 1 - .../src/components/AppConnections/index.tsx | 14 +- .../web/src/components/AppFlows/index.tsx | 46 +-- packages/web/src/components/AppIcon/index.tsx | 15 +- packages/web/src/components/AppRow/index.tsx | 43 ++- packages/web/src/components/AppRow/style.ts | 3 +- .../ChooseAppAndEventSubstep/index.tsx | 23 +- .../ChooseConnectionSubstep/index.tsx | 158 +++++---- .../ConditionalIconButton/index.tsx | 10 +- .../web/src/components/Container/index.tsx | 8 +- .../ControlledAutocomplete/index.tsx | 40 ++- packages/web/src/components/Drawer/index.tsx | 14 +- packages/web/src/components/Drawer/style.ts | 42 ++- .../components/EditableTypography/index.tsx | 61 ++-- .../components/EditableTypography/style.ts | 13 +- packages/web/src/components/Editor/index.tsx | 21 +- .../web/src/components/EditorLayout/index.tsx | 104 +++--- .../src/components/ExecutionHeader/index.tsx | 32 +- .../web/src/components/ExecutionRow/index.tsx | 22 +- .../web/src/components/ExecutionRow/style.ts | 4 +- .../src/components/ExecutionStep/index.tsx | 43 ++- .../web/src/components/ExecutionStep/style.ts | 10 +- .../web/src/components/FlowAppIcons/index.tsx | 24 +- .../src/components/FlowContextMenu/index.tsx | 21 +- packages/web/src/components/FlowRow/index.tsx | 42 ++- packages/web/src/components/FlowRow/style.ts | 4 +- .../web/src/components/FlowStep/index.tsx | 170 ++++++---- packages/web/src/components/FlowStep/style.ts | 10 +- .../components/FlowStepContextMenu/index.tsx | 29 +- .../web/src/components/FlowSubstep/index.tsx | 37 ++- .../src/components/FlowSubstepTitle/index.tsx | 9 +- packages/web/src/components/Form/index.tsx | 17 +- .../web/src/components/HideOnScroll/index.tsx | 6 +- .../web/src/components/InputCreator/index.tsx | 20 +- .../IntermediateStepCount/index.tsx | 10 +- .../web/src/components/IntlProvider/index.tsx | 6 +- .../web/src/components/JSONViewer/index.tsx | 2 +- .../web/src/components/JSONViewer/style.tsx | 54 +-- packages/web/src/components/Layout/index.tsx | 22 +- .../web/src/components/ListItemLink/index.tsx | 26 +- .../web/src/components/LoginForm/index.tsx | 17 +- .../src/components/NoResultFound/index.tsx | 29 +- .../web/src/components/NoResultFound/style.ts | 2 +- .../src/components/NotificationCard/index.tsx | 24 +- .../web/src/components/PageTitle/index.tsx | 6 +- packages/web/src/components/Portal/index.tsx | 6 +- .../web/src/components/PowerInput/index.tsx | 89 ++--- .../web/src/components/PowerInput/style.ts | 10 +- .../web/src/components/PowerInput/types.ts | 2 +- .../web/src/components/PowerInput/utils.ts | 65 ++-- .../web/src/components/PublicLayout/index.tsx | 3 +- packages/web/src/components/Router/index.tsx | 4 +- .../web/src/components/SearchInput/index.tsx | 8 +- .../src/components/SettingsLayout/index.tsx | 22 +- .../src/components/SnackbarProvider/index.tsx | 7 +- .../web/src/components/TabPanel/index.tsx | 8 +- .../web/src/components/TestSubstep/index.tsx | 77 +++-- .../web/src/components/TextField/index.tsx | 41 ++- .../src/components/ThemeProvider/index.tsx | 5 +- packages/web/src/config/app.ts | 2 +- packages/web/src/config/urls.ts | 38 ++- packages/web/src/contexts/Authentication.tsx | 19 +- packages/web/src/contexts/Editor.tsx | 16 +- packages/web/src/contexts/StepExecutions.tsx | 12 +- packages/web/src/graphql/cache.ts | 24 +- packages/web/src/graphql/client.ts | 10 +- packages/web/src/graphql/link.ts | 61 ++-- .../graphql/mutations/create-connection.ts | 4 +- packages/web/src/graphql/mutations/index.ts | 4 +- packages/web/src/graphql/pagination.ts | 14 +- packages/web/src/graphql/queries/get-apps.ts | 12 +- .../src/graphql/queries/get-connected-apps.ts | 2 +- .../graphql/queries/get-execution-steps.ts | 6 +- packages/web/src/graphql/queries/get-flows.ts | 16 +- .../web/src/helpers/authenticationSteps.ts | 26 +- .../src/helpers/computeAuthStepVariables.ts | 21 +- packages/web/src/helpers/computeVariables.ts | 21 +- packages/web/src/helpers/copyInputValue.ts | 2 +- packages/web/src/helpers/storage.ts | 2 +- packages/web/src/hooks/useAuthentication.ts | 4 +- packages/web/src/hooks/useDynamicData.ts | 53 +-- packages/web/src/hooks/useFormatMessage.ts | 9 +- packages/web/src/hooks/useVersion.ts | 3 +- packages/web/src/index.tsx | 6 +- packages/web/src/locales/en.json | 2 +- packages/web/src/pages/Application/index.tsx | 105 ++++-- packages/web/src/pages/Applications/index.tsx | 58 ++-- packages/web/src/pages/Dashboard/index.tsx | 4 +- packages/web/src/pages/Editor/create.tsx | 17 +- packages/web/src/pages/Editor/index.tsx | 6 +- packages/web/src/pages/Editor/routes.tsx | 2 +- packages/web/src/pages/Execution/index.tsx | 32 +- packages/web/src/pages/Executions/index.tsx | 69 ++-- packages/web/src/pages/Flow/index.tsx | 2 +- packages/web/src/pages/Flows/index.tsx | 121 ++++--- packages/web/src/pages/Login/index.tsx | 2 +- .../web/src/pages/Notifications/index.tsx | 6 +- .../web/src/pages/ProfileSettings/index.tsx | 75 +++-- packages/web/src/react-app-env.d.ts | 2 +- packages/web/src/routes.tsx | 85 ++++- packages/web/src/settingsRoutes.tsx | 14 +- packages/web/src/styles/theme.ts | 86 ++--- packages/web/tsconfig.json | 10 +- 199 files changed, 2421 insertions(+), 1839 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6d2d982e..0619573e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,4 +9,4 @@ "command": "yarn dev" } ] -} \ No newline at end of file +} diff --git a/LICENSE.md b/LICENSE.md index 0ad25db4..162676cb 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,178 +1,178 @@ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. Preamble - The GNU Affero General Public License is a free, copyleft license for +The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - Developers that use our General Public Licenses protect your rights +Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. - A secondary benefit of defending all users' freedom is that +A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. - The GNU Affero General Public License is designed specifically to +The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to +to the community. It requires the operator of a network server to provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on +users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is +An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. - The precise terms and conditions for copying, distribution and +The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS - 0. Definitions. +0. Definitions. - "This License" refers to version 3 of the GNU Affero General Public License. +"This License" refers to version 3 of the GNU Affero General Public License. - "Copyright" also means copyright-like laws that apply to other kinds of +"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. - To "modify" a work means to copy from or adapt all or part of the work +To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the +exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. - A "covered work" means either the unmodified Program or a work based +A "covered work" means either the unmodified Program or a work based on the Program. - To "propagate" a work means to do anything with it that, without +To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, +computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - An interactive user interface displays "Appropriate Legal Notices" +An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If +work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. - 1. Source Code. +1. Source Code. - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source form of a work. - A "Standard Interface" means an interface that either is an official +A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - The "System Libraries" of an executable work include anything, other +The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A +implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - The "Corresponding Source" for a work in object code form means all +The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's +control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source +which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - The Corresponding Source need not include anything that users +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - The Corresponding Source for a work in source code form is that +The Corresponding Source for a work in source code form is that same work. - 2. Basic Permissions. +2. Basic Permissions. - All rights granted under this License are granted for the term of +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your +content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - You may make, run and propagate covered works that you do not +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose +in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works +not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. +3. Protecting Users' Legal Rights From Anti-Circumvention Law. - No covered work shall be deemed part of an effective technological +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - When you convey a covered work, you waive any legal power to forbid +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or @@ -180,9 +180,9 @@ modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. - 4. Conveying Verbatim Copies. +4. Conveying Verbatim Copies. - You may convey verbatim copies of the Program's source code as you +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any @@ -190,12 +190,12 @@ non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - You may charge any price or no price for each copy that you convey, +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. - 5. Conveying Modified Source Versions. +5. Conveying Modified Source Versions. - You may convey a work based on the Program, or the modifications to +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: @@ -220,19 +220,19 @@ terms of section 4, provided that you also meet all of these conditions: interfaces that do not display Appropriate Legal Notices, your work need not make them do so. - A compilation of a covered work with other separate and independent +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work +beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. - 6. Conveying Non-Source Forms. +6. Conveying Non-Source Forms. - You may convey a covered work in object code form under the terms +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: @@ -278,75 +278,75 @@ in one of these ways: Source of the work are being offered to the general public at no charge under subsection 6d. - A separable portion of the object code, whose source code is excluded +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - A "User Product" is either (1) a "consumer product", which means any +A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product +actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - "Installation Information" for a User Product means any methods, +"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must +a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - If you convey an object code work under this section in, or with, or +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply +by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - The requirement to provide Installation Information does not include a +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a +the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - Corresponding Source conveyed, and Installation Information provided, +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. - 7. Additional Terms. +7. Additional Terms. - "Additional permissions" are terms that supplement the terms of this +"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions +that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - When you convey a copy of a covered work, you may at your option +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - Notwithstanding any other provision of this License, for material you +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: @@ -373,74 +373,74 @@ that material) supplement the terms of this License with terms: any liability that these contractual assumptions directly impose on those licensors and authors. - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains +restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - If you add terms to a covered work in accord with this section, you +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - Additional terms, permissive or non-permissive, may be stated in the +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - 8. Termination. +8. Termination. - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - However, if you cease all violation of this License, then your +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - Moreover, your license from a particular copyright holder is +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - Termination of your rights under this section does not terminate the +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently +this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - 9. Acceptance Not Required for Having Copies. +9. Acceptance Not Required for Having Copies. - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, +to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. - 10. Automatic Licensing of Downstream Recipients. +10. Automatic Licensing of Downstream Recipients. - Each time you convey a covered work, the recipient automatically +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible +propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - An "entity transaction" is a transaction transferring control of an +An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered +organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could @@ -448,43 +448,43 @@ give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - 11. Patents. +11. Patents. - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". - A contributor's "essential patent claims" are all patent claims +A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For +consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - Each contributor grants you a non-exclusive, worldwide, royalty-free +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - In the following three paragraphs, a "patent license" is any express +In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a +sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - If you convey a covered work, knowingly relying on a patent license, +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, @@ -492,13 +492,13 @@ then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have +license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - If, pursuant to or in connection with a single transaction or +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify @@ -506,10 +506,10 @@ or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - A patent license is "discriminatory" if it does not include within +A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered +specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying @@ -521,83 +521,83 @@ for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - Nothing in this License shall be construed as excluding or limiting +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - 12. No Surrender of Others' Freedom. +12. No Surrender of Others' Freedom. - If conditions are imposed on you (whether by court order, agreement or +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a +excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you +not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Remote Network Interaction; Use with the GNU General Public License. +13. Remote Network Interaction; Use with the GNU General Public License. - Notwithstanding any other provision of this License, if you modify the +Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source +means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. - Notwithstanding any other provision of this License, you have +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this +combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. - 14. Revised Versions of this License. +14. Revised Versions of this License. - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions +The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - Each version is given a distinguishing version number. If the +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the +Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. - If the Program specifies that a proxy can decide which future +If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - 15. Disclaimer of Warranty. +15. Disclaimer of Warranty. - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - 16. Limitation of Liability. +16. Limitation of Liability. - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE @@ -607,9 +607,9 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - 17. Interpretation of Sections 15 and 16. +17. Interpretation of Sections 15 and 16. - If the disclaimer of warranty and limitation of liability provided +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the @@ -620,11 +620,11 @@ copy of the Program in return for a fee. How to Apply These Terms to Your New Programs - If you develop a new program, and you want it to be of the greatest +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - To do so, attach the following notices to the program. It is safest +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. @@ -647,15 +647,15 @@ the "copyright" line and a pointer to where the full notice is found. Also add information on how to contact you by electronic and paper mail. - If your software can interact with users remotely through a computer +If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its +get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different +of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. - You should also get your employer (if you work as a programmer) or school, +You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . diff --git a/docker/compose/docker-compose.yml b/docker/compose/docker-compose.yml index 6f61b323..31f6c8c6 100644 --- a/docker/compose/docker-compose.yml +++ b/docker/compose/docker-compose.yml @@ -1,11 +1,11 @@ -version: "3.9" +version: '3.9' services: main: build: context: ../images/wait-for-postgres network: host ports: - - "3000:3000" + - '3000:3000' depends_on: - postgres - redis @@ -36,12 +36,12 @@ services: volumes: - automatisch_storage:/automatisch/storage postgres: - image: "postgres:14.5" + image: 'postgres:14.5' environment: POSTGRES_HOST_AUTH_METHOD: trust POSTGRES_DB: automatisch POSTGRES_USER: automatisch_user redis: - image: "redis:7.0.4" + image: 'redis:7.0.4' volumes: automatisch_storage: diff --git a/lerna.json b/lerna.json index d68132d1..731c7db6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,7 +1,5 @@ { - "packages": [ - "packages/*" - ], + "packages": ["packages/*"], "version": "0.1.5", "npmClient": "yarn", "useWorkspaces": true, @@ -10,4 +8,4 @@ "exact": true } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index cc3aec88..a81364f9 100644 --- a/package.json +++ b/package.json @@ -34,4 +34,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/packages/backend/bin/database/client.ts b/packages/backend/bin/database/client.ts index 60f3de26..52ceed4f 100644 --- a/packages/backend/bin/database/client.ts +++ b/packages/backend/bin/database/client.ts @@ -4,6 +4,6 @@ const client = new Client({ host: 'localhost', user: 'postgres', port: 5432, -}) +}); export default client; diff --git a/packages/backend/bin/database/utils.ts b/packages/backend/bin/database/utils.ts index 42591561..3d38d90d 100644 --- a/packages/backend/bin/database/utils.ts +++ b/packages/backend/bin/database/utils.ts @@ -4,7 +4,10 @@ import client from './client'; import User from '../../src/models/user'; import '../../src/config/orm'; -export async function createUser(email = 'user@automatisch.io', password = 'sample') { +export async function createUser( + email = 'user@automatisch.io', + password = 'sample' +) { const UNIQUE_VIOLATION_CODE = '23505'; const userParams = { email, @@ -29,14 +32,17 @@ export async function createUser(email = 'user@automatisch.io', password = 'samp } } -export const createDatabaseAndUser = async (database = appConfig.postgresDatabase, user = appConfig.postgresUsername) => { +export const createDatabaseAndUser = async ( + database = appConfig.postgresDatabase, + user = appConfig.postgresUsername +) => { await client.connect(); await createDatabase(database); await createDatabaseUser(user); await grantPrivileges(database, user); await client.end(); -} +}; export const createDatabase = async (database = appConfig.postgresDatabase) => { const DUPLICATE_DB_CODE = '42P04'; @@ -51,7 +57,7 @@ export const createDatabase = async (database = appConfig.postgresDatabase) => { logger.info(`Database: ${database} already exists!`); } -} +}; export const createDatabaseUser = async (user = appConfig.postgresUsername) => { const DUPLICATE_OBJECT_CODE = '42710'; @@ -68,25 +74,25 @@ export const createDatabaseUser = async (user = appConfig.postgresUsername) => { logger.info(`Database User: ${user} already exists!`); } -} +}; export const grantPrivileges = async ( - database = appConfig.postgresDatabase, user = appConfig.postgresUsername + database = appConfig.postgresDatabase, + user = appConfig.postgresUsername ) => { await client.query( `GRANT ALL PRIVILEGES ON DATABASE ${database} TO ${user};` ); - logger.info( - `${user} has granted all privileges on ${database}!` - ); -} + logger.info(`${user} has granted all privileges on ${database}!`); +}; export const dropDatabase = async () => { if (appConfig.appEnv != 'development' && appConfig.appEnv != 'test') { - const errorMessage = 'Drop database command can be used only with development or test environments!' + const errorMessage = + 'Drop database command can be used only with development or test environments!'; - logger.error(errorMessage) + logger.error(errorMessage); return; } @@ -94,13 +100,15 @@ export const dropDatabase = async () => { await dropDatabaseAndUser(); await client.end(); -} +}; -export const dropDatabaseAndUser = async(database = appConfig.postgresDatabase, user = appConfig.postgresUsername) => { +export const dropDatabaseAndUser = async ( + database = appConfig.postgresDatabase, + user = appConfig.postgresUsername +) => { await client.query(`DROP DATABASE IF EXISTS ${database}`); logger.info(`Database: ${database} removed!`); await client.query(`DROP USER IF EXISTS ${user}`); logger.info(`Database User: ${user} removed!`); -} - +}; diff --git a/packages/backend/knexfile.ts b/packages/backend/knexfile.ts index 4822d4c4..cd9e3b6b 100644 --- a/packages/backend/knexfile.ts +++ b/packages/backend/knexfile.ts @@ -10,7 +10,7 @@ const knexConfig = { user: appConfig.postgresUsername, password: appConfig.postgresPassword, database: appConfig.postgresDatabase, - ssl: appConfig.postgresEnableSsl + ssl: appConfig.postgresEnableSsl, }, pool: { min: 0, max: 20 }, migrations: { @@ -20,7 +20,7 @@ const knexConfig = { }, seeds: { directory: __dirname + '/src/db/seeds', - } -} + }, +}; export default knexConfig; diff --git a/packages/backend/src/apps/discord/actions/index.ts b/packages/backend/src/apps/discord/actions/index.ts index c698a42c..ef5fef9b 100644 --- a/packages/backend/src/apps/discord/actions/index.ts +++ b/packages/backend/src/apps/discord/actions/index.ts @@ -1,5 +1,3 @@ -import sendMessageToChannel from "./send-message-to-channel"; +import sendMessageToChannel from './send-message-to-channel'; -export default [ - sendMessageToChannel -]; +export default [sendMessageToChannel]; diff --git a/packages/backend/src/apps/discord/auth/create-auth-data.ts b/packages/backend/src/apps/discord/auth/create-auth-data.ts index 992d1e98..c4dab8b0 100644 --- a/packages/backend/src/apps/discord/auth/create-auth-data.ts +++ b/packages/backend/src/apps/discord/auth/create-auth-data.ts @@ -17,12 +17,12 @@ export default async function createAuthData($: IGlobalVariable) { scope: scopes.join(' '), }); - const url = `${$.app.apiBaseUrl}/oauth2/authorize?${searchParams.toString()}`; + const url = `${ + $.app.apiBaseUrl + }/oauth2/authorize?${searchParams.toString()}`; await $.auth.set({ url }); } catch (error) { - throw new Error( - `Error occured while verifying credentials: ${error}` - ); + throw new Error(`Error occured while verifying credentials: ${error}`); } } diff --git a/packages/backend/src/apps/discord/auth/index.ts b/packages/backend/src/apps/discord/auth/index.ts index 88499b86..52be17b0 100644 --- a/packages/backend/src/apps/discord/auth/index.ts +++ b/packages/backend/src/apps/discord/auth/index.ts @@ -12,9 +12,10 @@ export default { readOnly: true, value: '{WEB_APP_URL}/app/discord/connections/add', placeholder: null, - description: 'When asked to input an OAuth callback or redirect URL in Discord OAuth, enter the URL above.', + description: + 'When asked to input an OAuth callback or redirect URL in Discord OAuth, enter the URL above.', docUrl: 'https://automatisch.io/docs/discord#oauth-redirect-url', - clickToCopy: true + clickToCopy: true, }, { key: 'consumerKey', @@ -26,7 +27,7 @@ export default { placeholder: null, description: null, docUrl: 'https://automatisch.io/docs/discord#consumer-key', - clickToCopy: false + clickToCopy: false, }, { key: 'consumerSecret', @@ -38,7 +39,7 @@ export default { placeholder: null, description: null, docUrl: 'https://automatisch.io/docs/discord#consumer-secret', - clickToCopy: false + clickToCopy: false, }, { key: 'botToken', @@ -50,8 +51,8 @@ export default { placeholder: null, description: null, docUrl: 'https://automatisch.io/docs/discord#bot-token', - clickToCopy: false - } + clickToCopy: false, + }, ], authenticationSteps: [ { @@ -60,7 +61,7 @@ export default { arguments: [ { name: 'key', - value: '{key}' + value: '{key}', }, { name: 'formattedData', @@ -68,19 +69,19 @@ export default { properties: [ { name: 'consumerKey', - value: '{fields.consumerKey}' + value: '{fields.consumerKey}', }, { name: 'consumerSecret', - value: '{fields.consumerSecret}' + value: '{fields.consumerSecret}', }, { name: 'botToken', - value: '{fields.botToken}' - } - ] - } - ] + value: '{fields.botToken}', + }, + ], + }, + ], }, { type: 'mutation' as const, @@ -88,9 +89,9 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' - } - ] + value: '{createConnection.id}', + }, + ], }, { type: 'openWithPopup' as const, @@ -98,9 +99,9 @@ export default { arguments: [ { name: 'url', - value: '{createAuthData.url}' - } - ] + value: '{createAuthData.url}', + }, + ], }, { type: 'mutation' as const, @@ -108,7 +109,7 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' + value: '{createConnection.id}', }, { name: 'formattedData', @@ -116,11 +117,11 @@ export default { properties: [ { name: 'oauthVerifier', - value: '{openAuthPopup.code}' - } - ] - } - ] + value: '{openAuthPopup.code}', + }, + ], + }, + ], }, { type: 'mutation' as const, @@ -128,10 +129,10 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' - } - ] - } + value: '{createConnection.id}', + }, + ], + }, ], createAuthData, diff --git a/packages/backend/src/apps/discord/auth/verify-credentials.ts b/packages/backend/src/apps/discord/auth/verify-credentials.ts index 75056702..491f4e84 100644 --- a/packages/backend/src/apps/discord/auth/verify-credentials.ts +++ b/packages/backend/src/apps/discord/auth/verify-credentials.ts @@ -28,10 +28,7 @@ const verifyCredentials = async ($: IGlobalVariable) => { expires_in: expiresIn, scope: scope, token_type: tokenType, - guild: { - id: guildId, - name: guildName, - } + guild: { id: guildId, name: guildName }, } = verifiedCredentials; await $.auth.set({ @@ -40,7 +37,7 @@ const verifyCredentials = async ($: IGlobalVariable) => { expiresIn, scope, tokenType, - }) + }); const user = await getCurrentUser($); diff --git a/packages/backend/src/apps/discord/data/index.ts b/packages/backend/src/apps/discord/data/index.ts index 596f701b..fae496fc 100644 --- a/packages/backend/src/apps/discord/data/index.ts +++ b/packages/backend/src/apps/discord/data/index.ts @@ -1,5 +1,3 @@ -import listChannels from "./list-channels"; +import listChannels from './list-channels'; -export default [ - listChannels, -]; +export default [listChannels]; diff --git a/packages/backend/src/apps/discord/data/list-channels/index.ts b/packages/backend/src/apps/discord/data/list-channels/index.ts index eaff6527..e7b6ace6 100644 --- a/packages/backend/src/apps/discord/data/list-channels/index.ts +++ b/packages/backend/src/apps/discord/data/list-channels/index.ts @@ -13,7 +13,9 @@ export default { error: null, }; - const response = await $.http.get(`/guilds/${$.auth.data.guildId}/channels`); + const response = await $.http.get( + `/guilds/${$.auth.data.guildId}/channels` + ); channels.data = response.data .filter((channel: IJSONObject) => { diff --git a/packages/backend/src/apps/flickr/auth/index.ts b/packages/backend/src/apps/flickr/auth/index.ts index 0ee4a0b5..ecdef330 100644 --- a/packages/backend/src/apps/flickr/auth/index.ts +++ b/packages/backend/src/apps/flickr/auth/index.ts @@ -12,9 +12,10 @@ export default { readOnly: true, value: '{WEB_APP_URL}/app/flickr/connections/add', placeholder: null, - description: 'When asked to input an OAuth callback or redirect URL in Flickr OAuth, enter the URL above.', + description: + 'When asked to input an OAuth callback or redirect URL in Flickr OAuth, enter the URL above.', docUrl: 'https://automatisch.io/docs/flickr#oauth-redirect-url', - clickToCopy: true + clickToCopy: true, }, { key: 'consumerKey', @@ -26,7 +27,7 @@ export default { placeholder: null, description: null, docUrl: 'https://automatisch.io/docs/flickr#consumer-key', - clickToCopy: false + clickToCopy: false, }, { key: 'consumerSecret', @@ -38,8 +39,8 @@ export default { placeholder: null, description: null, docUrl: 'https://automatisch.io/docs/flickr#consumer-secret', - clickToCopy: false - } + clickToCopy: false, + }, ], authenticationSteps: [ { @@ -48,7 +49,7 @@ export default { arguments: [ { name: 'key', - value: '{key}' + value: '{key}', }, { name: 'formattedData', @@ -56,15 +57,15 @@ export default { properties: [ { name: 'consumerKey', - value: '{fields.consumerKey}' + value: '{fields.consumerKey}', }, { name: 'consumerSecret', - value: '{fields.consumerSecret}' - } - ] - } - ] + value: '{fields.consumerSecret}', + }, + ], + }, + ], }, { type: 'mutation' as const, @@ -72,9 +73,9 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' - } - ] + value: '{createConnection.id}', + }, + ], }, { type: 'openWithPopup' as const, @@ -82,9 +83,9 @@ export default { arguments: [ { name: 'url', - value: '{createAuthData.url}' - } - ] + value: '{createAuthData.url}', + }, + ], }, { type: 'mutation' as const, @@ -92,7 +93,7 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' + value: '{createConnection.id}', }, { name: 'formattedData', @@ -100,11 +101,11 @@ export default { properties: [ { name: 'oauthVerifier', - value: '{openAuthPopup.oauth_verifier}' - } - ] - } - ] + value: '{openAuthPopup.oauth_verifier}', + }, + ], + }, + ], }, { type: 'mutation' as const, @@ -112,10 +113,10 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' - } - ] - } + value: '{createConnection.id}', + }, + ], + }, ], createAuthData, diff --git a/packages/backend/src/apps/flickr/auth/is-still-verified.ts b/packages/backend/src/apps/flickr/auth/is-still-verified.ts index 2d70bce1..76547cc8 100644 --- a/packages/backend/src/apps/flickr/auth/is-still-verified.ts +++ b/packages/backend/src/apps/flickr/auth/is-still-verified.ts @@ -6,7 +6,7 @@ const isStillVerified = async ($: IGlobalVariable) => { method: 'flickr.test.login', format: 'json', nojsoncallback: 1, - } + }; const response = await $.http.get('/rest', { params }); return !!response.data.user.id; } catch (error) { diff --git a/packages/backend/src/apps/flickr/data/list-albums/index.ts b/packages/backend/src/apps/flickr/data/list-albums/index.ts index c10d99b1..115dcd17 100644 --- a/packages/backend/src/apps/flickr/data/list-albums/index.ts +++ b/packages/backend/src/apps/flickr/data/list-albums/index.ts @@ -10,7 +10,7 @@ type TPhotoset = { title: { _content: string; }; -} +}; export default { name: 'List albums', @@ -25,7 +25,7 @@ export default { format: 'json', nojsoncallback: 1, }; - let response = await $.http.get('/rest', { params, }); + let response = await $.http.get('/rest', { params }); const aggregatedResponse: TResponse = { data: [...response.data.photosets.photoset], @@ -35,19 +35,21 @@ export default { response = await $.http.get('/rest', { params: { ...params, - page: response.data.photosets.page - } + page: response.data.photosets.page, + }, }); 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: TPhotoset) => { + return { + value: photoset.id, + name: photoset.title._content, + } as IJSONObject; + } + ); return aggregatedResponse; }, diff --git a/packages/backend/src/apps/flickr/triggers/index.ts b/packages/backend/src/apps/flickr/triggers/index.ts index c84993e5..5e8bad6a 100644 --- a/packages/backend/src/apps/flickr/triggers/index.ts +++ b/packages/backend/src/apps/flickr/triggers/index.ts @@ -3,9 +3,4 @@ import newFavoritePhotos from './new-favorite-photos'; import newPhotos from './new-photos'; import newPhotosInAlbums from './new-photos-in-album'; -export default [ - newAlbums, - newFavoritePhotos, - newPhotos, - newPhotosInAlbums, -]; +export default [newAlbums, newFavoritePhotos, newPhotos, newPhotosInAlbums]; diff --git a/packages/backend/src/apps/github/auth/create-auth-data.ts b/packages/backend/src/apps/github/auth/create-auth-data.ts index ed1c9c95..26648ce3 100644 --- a/packages/backend/src/apps/github/auth/create-auth-data.ts +++ b/packages/backend/src/apps/github/auth/create-auth-data.ts @@ -13,7 +13,9 @@ export default async function createAuthData($: IGlobalVariable) { scope: scopes.join(','), }); - const url = `${$.app.baseUrl}/login/oauth/authorize?${searchParams.toString()}`; + const url = `${ + $.app.baseUrl + }/login/oauth/authorize?${searchParams.toString()}`; await $.auth.set({ url, diff --git a/packages/backend/src/apps/github/auth/index.ts b/packages/backend/src/apps/github/auth/index.ts index f49c4dd5..5f6a9f21 100644 --- a/packages/backend/src/apps/github/auth/index.ts +++ b/packages/backend/src/apps/github/auth/index.ts @@ -12,9 +12,10 @@ export default { readOnly: true, value: '{WEB_APP_URL}/app/github/connections/add', placeholder: null, - description: 'When asked to input an OAuth callback or redirect URL in Github OAuth, enter the URL above.', + description: + 'When asked to input an OAuth callback or redirect URL in Github OAuth, enter the URL above.', docUrl: 'https://automatisch.io/docs/github#oauth-redirect-url', - clickToCopy: true + clickToCopy: true, }, { key: 'consumerKey', @@ -26,7 +27,7 @@ export default { placeholder: null, description: null, docUrl: 'https://automatisch.io/docs/github#client-id', - clickToCopy: false + clickToCopy: false, }, { key: 'consumerSecret', @@ -38,8 +39,8 @@ export default { placeholder: null, description: null, docUrl: 'https://automatisch.io/docs/github#client-secret', - clickToCopy: false - } + clickToCopy: false, + }, ], authenticationSteps: [ { @@ -48,7 +49,7 @@ export default { arguments: [ { name: 'key', - value: '{key}' + value: '{key}', }, { name: 'formattedData', @@ -56,15 +57,15 @@ export default { properties: [ { name: 'consumerKey', - value: '{fields.consumerKey}' + value: '{fields.consumerKey}', }, { name: 'consumerSecret', - value: '{fields.consumerSecret}' - } - ] - } - ] + value: '{fields.consumerSecret}', + }, + ], + }, + ], }, { type: 'mutation' as const, @@ -72,9 +73,9 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' - } - ] + value: '{createConnection.id}', + }, + ], }, { type: 'openWithPopup' as const, @@ -82,9 +83,9 @@ export default { arguments: [ { name: 'url', - value: '{createAuthData.url}' - } - ] + value: '{createAuthData.url}', + }, + ], }, { type: 'mutation' as const, @@ -92,7 +93,7 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' + value: '{createConnection.id}', }, { name: 'formattedData', @@ -100,11 +101,11 @@ export default { properties: [ { name: 'oauthVerifier', - value: '{openAuthPopup.code}' - } - ] - } - ] + value: '{openAuthPopup.code}', + }, + ], + }, + ], }, { type: 'mutation' as const, @@ -112,10 +113,10 @@ export default { arguments: [ { name: 'id', - value: '{createConnection.id}' - } - ] - } + value: '{createConnection.id}', + }, + ], + }, ], createAuthData, diff --git a/packages/backend/src/apps/github/auth/verify-credentials.ts b/packages/backend/src/apps/github/auth/verify-credentials.ts index 259df592..d2c2c33b 100644 --- a/packages/backend/src/apps/github/auth/verify-credentials.ts +++ b/packages/backend/src/apps/github/auth/verify-credentials.ts @@ -12,9 +12,10 @@ const verifyCredentials = async ($: IGlobalVariable) => { }, { headers: { - Accept: 'application/json' - } - }); + Accept: 'application/json', + }, + } + ); const data = response.data; diff --git a/packages/backend/src/apps/github/common/add-auth-header.ts b/packages/backend/src/apps/github/common/add-auth-header.ts index ab286783..f4f2076f 100644 --- a/packages/backend/src/apps/github/common/add-auth-header.ts +++ b/packages/backend/src/apps/github/common/add-auth-header.ts @@ -1,11 +1,11 @@ -import { TBeforeRequest } from "@automatisch/types"; +import { TBeforeRequest } from '@automatisch/types'; const addAuthHeader: TBeforeRequest = ($, requestConfig) => { if (requestConfig.headers && $.auth.data?.accessToken) { - requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}` + requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`; } return requestConfig; -} +}; export default addAuthHeader; diff --git a/packages/backend/src/apps/github/common/get-repo-owner-and-repo.ts b/packages/backend/src/apps/github/common/get-repo-owner-and-repo.ts index 25891c40..4f6f9184 100644 --- a/packages/backend/src/apps/github/common/get-repo-owner-and-repo.ts +++ b/packages/backend/src/apps/github/common/get-repo-owner-and-repo.ts @@ -1,15 +1,17 @@ type TRepoOwnerAndRepo = { repoOwner?: string; repo?: string; -} +}; -export default function getRepoOwnerAndRepo(repoFullName: string): TRepoOwnerAndRepo { +export default function getRepoOwnerAndRepo( + repoFullName: string +): TRepoOwnerAndRepo { if (!repoFullName) return {}; const [repoOwner, repo] = repoFullName.split('/'); return { repoOwner, - repo + repo, }; } diff --git a/packages/backend/src/apps/github/data/index.ts b/packages/backend/src/apps/github/data/index.ts index d48026f2..290705da 100644 --- a/packages/backend/src/apps/github/data/index.ts +++ b/packages/backend/src/apps/github/data/index.ts @@ -1,7 +1,4 @@ import listLabels from './list-labels'; import listRepos from './list-repos'; -export default [ - listLabels, - listRepos, -]; +export default [listLabels, listRepos]; diff --git a/packages/backend/src/apps/github/data/list-labels/index.ts b/packages/backend/src/apps/github/data/list-labels/index.ts index 9cb71280..2e0aacc4 100644 --- a/packages/backend/src/apps/github/data/list-labels/index.ts +++ b/packages/backend/src/apps/github/data/list-labels/index.ts @@ -7,10 +7,9 @@ export default { key: 'listLabels', async run($: IGlobalVariable) { - const { - repoOwner, - repo, - } = getRepoOwnerAndRepo($.step.parameters.repo as string); + const { repoOwner, repo } = getRepoOwnerAndRepo( + $.step.parameters.repo as string + ); if (!repo) return { data: [] }; diff --git a/packages/backend/src/apps/github/triggers/index.ts b/packages/backend/src/apps/github/triggers/index.ts index 81c50126..d04d72c8 100644 --- a/packages/backend/src/apps/github/triggers/index.ts +++ b/packages/backend/src/apps/github/triggers/index.ts @@ -3,9 +3,4 @@ import newPullRequests from './new-pull-requests'; import newStargazers from './new-stargazers'; import newWatchers from './new-watchers'; -export default [ - newIssues, - newPullRequests, - newStargazers, - newWatchers, -]; +export default [newIssues, newPullRequests, newStargazers, newWatchers]; diff --git a/packages/backend/src/apps/salesforce/auth/create-auth-data.ts b/packages/backend/src/apps/salesforce/auth/create-auth-data.ts index eb83ab73..de43a3b8 100644 --- a/packages/backend/src/apps/salesforce/auth/create-auth-data.ts +++ b/packages/backend/src/apps/salesforce/auth/create-auth-data.ts @@ -10,15 +10,13 @@ export default async function createAuthData($: IGlobalVariable) { const searchParams = qs.stringify({ client_id: $.auth.data.consumerKey as string, redirect_uri: redirectUri, - response_type: 'code' - }) + response_type: 'code', + }); await $.auth.set({ url: `${$.auth.data.oauth2Url}/authorize?${searchParams}`, }); } catch (error) { - throw new Error( - `Error occured while verifying credentials: ${error}` - ); + throw new Error(`Error occured while verifying credentials: ${error}`); } } diff --git a/packages/backend/src/apps/salesforce/auth/index.ts b/packages/backend/src/apps/salesforce/auth/index.ts index c89aede1..fdbd6cb8 100644 --- a/packages/backend/src/apps/salesforce/auth/index.ts +++ b/packages/backend/src/apps/salesforce/auth/index.ts @@ -34,8 +34,8 @@ export default { { label: 'sandbox', value: 'https://test.salesforce.com/services/oauth2', - } - ] + }, + ], }, { key: 'consumerKey', @@ -76,7 +76,7 @@ export default { properties: [ { name: 'oauth2Url', - value: '{fields.oauth2Url}' + value: '{fields.oauth2Url}', }, { name: 'consumerKey', diff --git a/packages/backend/src/apps/salesforce/auth/verify-credentials.ts b/packages/backend/src/apps/salesforce/auth/verify-credentials.ts index 41651050..93a3879c 100644 --- a/packages/backend/src/apps/salesforce/auth/verify-credentials.ts +++ b/packages/backend/src/apps/salesforce/auth/verify-credentials.ts @@ -13,10 +13,10 @@ const verifyCredentials = async ($: IGlobalVariable) => { grant_type: 'authorization_code', client_id: $.auth.data.consumerKey as string, client_secret: $.auth.data.consumerSecret as string, - redirect_uri: redirectUri + redirect_uri: redirectUri, }); const { data } = await $.http.post( - `${$.auth.data.oauth2Url}/token?${searchParams}`, + `${$.auth.data.oauth2Url}/token?${searchParams}` ); await $.auth.set({ diff --git a/packages/backend/src/apps/salesforce/data/index.ts b/packages/backend/src/apps/salesforce/data/index.ts index 018c88f6..b477b472 100644 --- a/packages/backend/src/apps/salesforce/data/index.ts +++ b/packages/backend/src/apps/salesforce/data/index.ts @@ -1,7 +1,4 @@ import listObjects from './list-objects'; import listFields from './list-fields'; -export default [ - listObjects, - listFields, -]; +export default [listObjects, listFields]; diff --git a/packages/backend/src/apps/salesforce/data/list-objects/index.ts b/packages/backend/src/apps/salesforce/data/list-objects/index.ts index 143dab0f..e02d9839 100644 --- a/packages/backend/src/apps/salesforce/data/list-objects/index.ts +++ b/packages/backend/src/apps/salesforce/data/list-objects/index.ts @@ -2,19 +2,21 @@ import { IGlobalVariable } from '@automatisch/types'; type TResponse = { sobjects: TObject[]; -} +}; type TObject = { name: string; label: string; -} +}; export default { name: 'List objects', key: 'listObjects', async run($: IGlobalVariable) { - const response = await $.http.get('/services/data/v56.0/sobjects'); + const response = await $.http.get( + '/services/data/v56.0/sobjects' + ); const objects = response.data.sobjects.map((object) => { return { diff --git a/packages/backend/src/apps/salesforce/triggers/index.ts b/packages/backend/src/apps/salesforce/triggers/index.ts index f769084e..1cfa329f 100644 --- a/packages/backend/src/apps/salesforce/triggers/index.ts +++ b/packages/backend/src/apps/salesforce/triggers/index.ts @@ -1,5 +1,3 @@ -import updatedFieldInRecords from "./updated-field-in-records"; +import updatedFieldInRecords from './updated-field-in-records'; -export default [ - updatedFieldInRecords -]; +export default [updatedFieldInRecords]; diff --git a/packages/backend/src/apps/salesforce/triggers/updated-field-in-records/updated-field-in-records.ts b/packages/backend/src/apps/salesforce/triggers/updated-field-in-records/updated-field-in-records.ts index 8ba1a8bc..6d2480df 100644 --- a/packages/backend/src/apps/salesforce/triggers/updated-field-in-records/updated-field-in-records.ts +++ b/packages/backend/src/apps/salesforce/triggers/updated-field-in-records/updated-field-in-records.ts @@ -23,7 +23,7 @@ const updatedFieldInRecord = async ($: IGlobalVariable): Promise => { const options = { params: { q: getQuery(object, limit, offset), - } + }, }; response = await $.http.get('/services/data/v56.0/query', options); @@ -34,7 +34,7 @@ const updatedFieldInRecord = async ($: IGlobalVariable): Promise => { raw: record, meta: { internalId: `${record.Id}-${record[field]}`, - } + }, }); } diff --git a/packages/backend/src/apps/scheduler/common/cron-times.ts b/packages/backend/src/apps/scheduler/common/cron-times.ts index bcc33254..51483b25 100644 --- a/packages/backend/src/apps/scheduler/common/cron-times.ts +++ b/packages/backend/src/apps/scheduler/common/cron-times.ts @@ -3,7 +3,8 @@ const cronTimes = { everyHourExcludingWeekends: '0 * * * 1-5', everyDayAt: (hour: number) => `0 ${hour} * * *`, everyDayExcludingWeekendsAt: (hour: number) => `0 ${hour} * * 1-5`, - everyWeekOnAndAt: (weekday: number, hour: number) => `0 ${hour} * * ${weekday}`, + everyWeekOnAndAt: (weekday: number, hour: number) => + `0 ${hour} * * ${weekday}`, everyMonthOnAndAt: (day: number, hour: number) => `0 ${hour} ${day} * *`, }; diff --git a/packages/backend/src/apps/scheduler/common/get-next-cron-date-time.ts b/packages/backend/src/apps/scheduler/common/get-next-cron-date-time.ts index b339006b..8ee435bf 100644 --- a/packages/backend/src/apps/scheduler/common/get-next-cron-date-time.ts +++ b/packages/backend/src/apps/scheduler/common/get-next-cron-date-time.ts @@ -4,7 +4,9 @@ import cronParser from 'cron-parser'; export default function getNextCronDateTime(cronString: string) { const cronDate = cronParser.parseExpression(cronString); const matchingNextCronDateTime = cronDate.next(); - const matchingNextDateTime = DateTime.fromJSDate(matchingNextCronDateTime.toDate()); + const matchingNextDateTime = DateTime.fromJSDate( + matchingNextCronDateTime.toDate() + ); return matchingNextDateTime; -}; +} diff --git a/packages/backend/src/apps/scheduler/triggers/index.ts b/packages/backend/src/apps/scheduler/triggers/index.ts index 02cfd4e0..94064465 100644 --- a/packages/backend/src/apps/scheduler/triggers/index.ts +++ b/packages/backend/src/apps/scheduler/triggers/index.ts @@ -3,9 +3,4 @@ import everyDay from './every-day'; import everyWeek from './every-week'; import everyMonth from './every-month'; -export default [ - everyHour, - everyDay, - everyWeek, - everyMonth, -]; +export default [everyHour, everyDay, everyWeek, everyMonth]; diff --git a/packages/backend/src/apps/slack/actions/index.ts b/packages/backend/src/apps/slack/actions/index.ts index 851b5005..30825d13 100644 --- a/packages/backend/src/apps/slack/actions/index.ts +++ b/packages/backend/src/apps/slack/actions/index.ts @@ -1,7 +1,4 @@ import findMessage from './find-message'; import sendMessageToChannel from './send-a-message-to-channel'; -export default [ - findMessage, - sendMessageToChannel, -]; +export default [findMessage, sendMessageToChannel]; diff --git a/packages/backend/src/apps/slack/actions/send-a-message-to-channel/index.ts b/packages/backend/src/apps/slack/actions/send-a-message-to-channel/index.ts index 0b793961..969ecac8 100644 --- a/packages/backend/src/apps/slack/actions/send-a-message-to-channel/index.ts +++ b/packages/backend/src/apps/slack/actions/send-a-message-to-channel/index.ts @@ -38,7 +38,8 @@ export default defineAction({ type: 'dropdown' as const, required: false, value: false, - description: 'If you choose no, this message will appear to come from you. Direct messages are always sent by bots.', + description: + 'If you choose no, this message will appear to come from you. Direct messages are always sent by bots.', variables: false, options: [ { @@ -48,8 +49,8 @@ export default defineAction({ { label: 'No', value: false, - } - ] + }, + ], }, { label: 'Bot name', @@ -57,7 +58,8 @@ export default defineAction({ type: 'string' as const, required: true, value: 'Automatisch', - description: 'Specify the bot name which appears as a bold username above the message inside Slack. Defaults to Automatisch.', + description: + 'Specify the bot name which appears as a bold username above the message inside Slack. Defaults to Automatisch.', variables: true, }, { @@ -65,7 +67,8 @@ export default defineAction({ key: 'botIcon', type: 'string' as const, required: false, - description: 'Either an image url or an emoji available to your team (surrounded by :). For example, https://example.com/icon_256.png or :robot_face:', + description: + 'Either an image url or an emoji available to your team (surrounded by :). For example, https://example.com/icon_256.png or :robot_face:', variables: true, }, ], diff --git a/packages/backend/src/apps/slack/actions/send-a-message-to-channel/post-message.ts b/packages/backend/src/apps/slack/actions/send-a-message-to-channel/post-message.ts index fd1f35cc..8e5376b8 100644 --- a/packages/backend/src/apps/slack/actions/send-a-message-to-channel/post-message.ts +++ b/packages/backend/src/apps/slack/actions/send-a-message-to-channel/post-message.ts @@ -7,7 +7,7 @@ type TData = { username?: string; icon_url?: string; icon_emoji?: string; -} +}; const postMessage = async ($: IGlobalVariable) => { const { parameters } = $.step; @@ -37,11 +37,9 @@ const postMessage = async ($: IGlobalVariable) => { sendAsBot, }; - const response = await $.http.post( - '/chat.postMessage', - data, - { additionalProperties: customConfig }, - ); + const response = await $.http.post('/chat.postMessage', data, { + additionalProperties: customConfig, + }); if (response.data.ok === false) { throw new Error(JSON.stringify(response.data)); diff --git a/packages/backend/src/apps/slack/auth/create-auth-data.ts b/packages/backend/src/apps/slack/auth/create-auth-data.ts index 64006a74..9aff18fb 100644 --- a/packages/backend/src/apps/slack/auth/create-auth-data.ts +++ b/packages/backend/src/apps/slack/auth/create-auth-data.ts @@ -59,4 +59,4 @@ export default async function createAuthData($: IGlobalVariable) { await $.auth.set({ url, }); -}; +} diff --git a/packages/backend/src/apps/slack/auth/verify-credentials.ts b/packages/backend/src/apps/slack/auth/verify-credentials.ts index 3f3feefc..5450d124 100644 --- a/packages/backend/src/apps/slack/auth/verify-credentials.ts +++ b/packages/backend/src/apps/slack/auth/verify-credentials.ts @@ -22,14 +22,9 @@ const verifyCredentials = async ($: IGlobalVariable) => { const { bot_user_id: botId, - authed_user: { - id: userId, - access_token: userAccessToken, - }, + authed_user: { id: userId, access_token: userAccessToken }, access_token: botAccessToken, - team: { - name: teamName, - } + team: { name: teamName }, } = response.data; await $.auth.set({ @@ -44,7 +39,7 @@ const verifyCredentials = async ($: IGlobalVariable) => { const currentUser = await getCurrentUser($); await $.auth.set({ - screenName: `${currentUser.real_name} @ ${teamName}` + screenName: `${currentUser.real_name} @ ${teamName}`, }); }; diff --git a/packages/backend/src/apps/slack/common/add-auth-header.ts b/packages/backend/src/apps/slack/common/add-auth-header.ts index 89ab2eec..24feca73 100644 --- a/packages/backend/src/apps/slack/common/add-auth-header.ts +++ b/packages/backend/src/apps/slack/common/add-auth-header.ts @@ -3,9 +3,9 @@ import { TBeforeRequest } from '@automatisch/types'; const addAuthHeader: TBeforeRequest = ($, requestConfig) => { const authData = $.auth.data; if ( - requestConfig.headers - && authData?.userAccessToken - && authData?.botAccessToken + requestConfig.headers && + authData?.userAccessToken && + authData?.botAccessToken ) { if (requestConfig.additionalProperties?.sendAsBot) { requestConfig.headers.Authorization = `Bearer ${authData.botAccessToken}`; @@ -14,7 +14,8 @@ const addAuthHeader: TBeforeRequest = ($, requestConfig) => { } } - requestConfig.headers['Content-Type'] = requestConfig.headers['Content-Type'] || 'application/json; charset=utf-8'; + requestConfig.headers['Content-Type'] = + requestConfig.headers['Content-Type'] || 'application/json; charset=utf-8'; return requestConfig; }; diff --git a/packages/backend/src/apps/slack/common/get-current-user.ts b/packages/backend/src/apps/slack/common/get-current-user.ts index e0500f8f..9d9b4fba 100644 --- a/packages/backend/src/apps/slack/common/get-current-user.ts +++ b/packages/backend/src/apps/slack/common/get-current-user.ts @@ -3,7 +3,7 @@ import { IGlobalVariable, IJSONObject } from '@automatisch/types'; const getCurrentUser = async ($: IGlobalVariable): Promise => { const params = { user: $.auth.data.userId as string, - } + }; const response = await $.http.get('/users.info', { params }); const currentUser = response.data.user; diff --git a/packages/backend/src/apps/twitter/triggers/index.ts b/packages/backend/src/apps/twitter/triggers/index.ts index 0619545f..3f75a856 100644 --- a/packages/backend/src/apps/twitter/triggers/index.ts +++ b/packages/backend/src/apps/twitter/triggers/index.ts @@ -3,9 +3,4 @@ import newFollowerOfMe from './new-follower-of-me'; import searchTweets from './search-tweets'; import userTweets from './user-tweets'; -export default [ - myTweets, - newFollowerOfMe, - searchTweets, - userTweets, -]; +export default [myTweets, newFollowerOfMe, searchTweets, userTweets]; diff --git a/packages/backend/src/config/cors-options.ts b/packages/backend/src/config/cors-options.ts index 5ebc5c2c..bff4b542 100644 --- a/packages/backend/src/config/cors-options.ts +++ b/packages/backend/src/config/cors-options.ts @@ -1,10 +1,10 @@ -import appConfig from './app' +import appConfig from './app'; const corsOptions = { origin: appConfig.webAppUrl, methods: 'POST', credentials: true, optionsSuccessStatus: 200, -} +}; export default corsOptions; diff --git a/packages/backend/src/db/migrations/20211005151457_create_users.ts b/packages/backend/src/db/migrations/20211005151457_create_users.ts index aab544fe..6177f4d4 100644 --- a/packages/backend/src/db/migrations/20211005151457_create_users.ts +++ b/packages/backend/src/db/migrations/20211005151457_create_users.ts @@ -1,4 +1,4 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.createTable('users', (table) => { @@ -8,10 +8,8 @@ export async function up(knex: Knex): Promise { table.timestamps(true, true); }); - } export async function down(knex: Knex): Promise { return knex.schema.dropTable('users'); } - diff --git a/packages/backend/src/db/migrations/20211011120732_create_credentials.ts b/packages/backend/src/db/migrations/20211011120732_create_credentials.ts index 35a93b18..c24d61e2 100644 --- a/packages/backend/src/db/migrations/20211011120732_create_credentials.ts +++ b/packages/backend/src/db/migrations/20211011120732_create_credentials.ts @@ -1,8 +1,8 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.createTable('credentials', (table) => { - table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')) + table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')); table.string('key').notNullable(); table.string('display_name').notNullable(); table.text('data').notNullable(); @@ -11,7 +11,7 @@ export async function up(knex: Knex): Promise { table.timestamps(true, true); }); -}; +} export async function down(knex: Knex): Promise { return knex.schema.dropTable('credentials'); diff --git a/packages/backend/src/db/migrations/20211014144855_remove_display_name_from_credentials.ts b/packages/backend/src/db/migrations/20211014144855_remove_display_name_from_credentials.ts index e2aa8906..f37d5373 100644 --- a/packages/backend/src/db/migrations/20211014144855_remove_display_name_from_credentials.ts +++ b/packages/backend/src/db/migrations/20211014144855_remove_display_name_from_credentials.ts @@ -1,4 +1,4 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.table('credentials', (table) => { diff --git a/packages/backend/src/db/migrations/20211017104154_rename_credentials_as_connections.ts b/packages/backend/src/db/migrations/20211017104154_rename_credentials_as_connections.ts index 58fa4daa..d9dac102 100644 --- a/packages/backend/src/db/migrations/20211017104154_rename_credentials_as_connections.ts +++ b/packages/backend/src/db/migrations/20211017104154_rename_credentials_as_connections.ts @@ -1,4 +1,4 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.renameTable('credentials', 'connections'); diff --git a/packages/backend/src/db/migrations/20211106214730_create_steps.ts b/packages/backend/src/db/migrations/20211106214730_create_steps.ts index 54cf3488..e478fcd9 100644 --- a/packages/backend/src/db/migrations/20211106214730_create_steps.ts +++ b/packages/backend/src/db/migrations/20211106214730_create_steps.ts @@ -2,7 +2,7 @@ import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.createTable('steps', (table) => { - table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')) + table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')); table.string('key').notNullable(); table.string('app_key').notNullable(); table.string('type').notNullable(); diff --git a/packages/backend/src/db/migrations/20211122140336_create_flows.ts b/packages/backend/src/db/migrations/20211122140336_create_flows.ts index 12028680..2b2b018b 100644 --- a/packages/backend/src/db/migrations/20211122140336_create_flows.ts +++ b/packages/backend/src/db/migrations/20211122140336_create_flows.ts @@ -1,14 +1,14 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.createTable('flows', (table) => { - table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')) + table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')); table.string('name'); table.uuid('user_id').references('id').inTable('users'); table.timestamps(true, true); }); -}; +} export async function down(knex: Knex): Promise { return knex.schema.dropTable('flows'); diff --git a/packages/backend/src/db/migrations/20211122140612_add_flow_id_to_steps.ts b/packages/backend/src/db/migrations/20211122140612_add_flow_id_to_steps.ts index fc223546..44fabcb4 100644 --- a/packages/backend/src/db/migrations/20211122140612_add_flow_id_to_steps.ts +++ b/packages/backend/src/db/migrations/20211122140612_add_flow_id_to_steps.ts @@ -1,15 +1,11 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.table('steps', (table) => { - table - .uuid('flow_id') - .references('id') - .inTable('flows'); + table.uuid('flow_id').references('id').inTable('flows'); }); } - export async function down(knex: Knex): Promise { return knex.schema.table('steps', (table) => { table.dropColumn('flow_id'); diff --git a/packages/backend/src/db/migrations/20220105151725_remove_constraints_from_steps.ts b/packages/backend/src/db/migrations/20220105151725_remove_constraints_from_steps.ts index 369ccac7..24fa418d 100644 --- a/packages/backend/src/db/migrations/20220105151725_remove_constraints_from_steps.ts +++ b/packages/backend/src/db/migrations/20220105151725_remove_constraints_from_steps.ts @@ -1,16 +1,15 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { - return knex.schema.alterTable('steps', table => { + return knex.schema.alterTable('steps', (table) => { table.string('key').nullable().alter(); table.string('app_key').nullable().alter(); - }) + }); } export async function down(knex: Knex): Promise { - return knex.schema.alterTable('steps', table => { + return knex.schema.alterTable('steps', (table) => { table.string('key').notNullable().alter(); table.string('app_key').notNullable().alter(); - }) + }); } - diff --git a/packages/backend/src/db/migrations/20220108141045_add_active_column_to_flows.ts b/packages/backend/src/db/migrations/20220108141045_add_active_column_to_flows.ts index 4b9e323f..84ddc5fc 100644 --- a/packages/backend/src/db/migrations/20220108141045_add_active_column_to_flows.ts +++ b/packages/backend/src/db/migrations/20220108141045_add_active_column_to_flows.ts @@ -1,8 +1,8 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.table('flows', (table) => { - table.boolean('active').defaultTo(false) + table.boolean('active').defaultTo(false); }); } diff --git a/packages/backend/src/db/migrations/20220219093113_create_executions.ts b/packages/backend/src/db/migrations/20220219093113_create_executions.ts index dfba81b8..2f5bbf81 100644 --- a/packages/backend/src/db/migrations/20220219093113_create_executions.ts +++ b/packages/backend/src/db/migrations/20220219093113_create_executions.ts @@ -2,7 +2,7 @@ import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.createTable('executions', (table) => { - table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')) + table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')); table.uuid('flow_id').references('id').inTable('flows'); table.boolean('test_run').notNullable().defaultTo(false); diff --git a/packages/backend/src/db/migrations/20220219100800_create_execution_steps.ts b/packages/backend/src/db/migrations/20220219100800_create_execution_steps.ts index 2260056b..8c8bf77b 100644 --- a/packages/backend/src/db/migrations/20220219100800_create_execution_steps.ts +++ b/packages/backend/src/db/migrations/20220219100800_create_execution_steps.ts @@ -2,7 +2,7 @@ import { Knex } from 'knex'; export async function up(knex: Knex): Promise { return knex.schema.createTable('execution_steps', (table) => { - table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')) + table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()')); table.uuid('execution_id').references('id').inTable('executions'); table.uuid('step_id').references('id').inTable('steps'); table.string('status'); diff --git a/packages/backend/src/db/migrations/20220928162525_soft-delete-base-model.ts b/packages/backend/src/db/migrations/20220928162525_soft-delete-base-model.ts index 862b6691..b1162d6e 100644 --- a/packages/backend/src/db/migrations/20220928162525_soft-delete-base-model.ts +++ b/packages/backend/src/db/migrations/20220928162525_soft-delete-base-model.ts @@ -1,4 +1,4 @@ -import { Knex } from "knex"; +import { Knex } from 'knex'; async function addDeletedColumn(knex: Knex, tableName: string) { return await knex.schema.table(tableName, (table) => { diff --git a/packages/backend/src/graphql/mutations/create-flow.ts b/packages/backend/src/graphql/mutations/create-flow.ts index 3adb0edc..5e015fe2 100644 --- a/packages/backend/src/graphql/mutations/create-flow.ts +++ b/packages/backend/src/graphql/mutations/create-flow.ts @@ -32,13 +32,13 @@ const createFlow = async ( type: 'trigger', position: 1, appKey, - connectionId + connectionId, }); await Step.query().insert({ flowId: flow.id, type: 'action', - position: 2 + position: 2, }); return flow; diff --git a/packages/backend/src/graphql/mutations/reset-connection.ts b/packages/backend/src/graphql/mutations/reset-connection.ts index e85f3bcb..8b127a99 100644 --- a/packages/backend/src/graphql/mutations/reset-connection.ts +++ b/packages/backend/src/graphql/mutations/reset-connection.ts @@ -18,7 +18,9 @@ const resetConnection = async ( }) .throwIfNotFound(); - if (!connection.formattedData) { return null; } + if (!connection.formattedData) { + return null; + } connection = await connection.$query().patchAndFetch({ formattedData: { screenName: connection.formattedData.screenName }, diff --git a/packages/backend/src/graphql/queries/get-current-user.ts b/packages/backend/src/graphql/queries/get-current-user.ts index bb129761..100913a5 100644 --- a/packages/backend/src/graphql/queries/get-current-user.ts +++ b/packages/backend/src/graphql/queries/get-current-user.ts @@ -1,6 +1,10 @@ import Context from '../../types/express/context'; -const getCurrentUser = async (_parent: unknown, _params: unknown, context: Context) => { +const getCurrentUser = async ( + _parent: unknown, + _params: unknown, + context: Context +) => { return context.currentUser; }; diff --git a/packages/backend/src/graphql/queries/get-execution.ts b/packages/backend/src/graphql/queries/get-execution.ts index f687d5df..e7c62e09 100644 --- a/packages/backend/src/graphql/queries/get-execution.ts +++ b/packages/backend/src/graphql/queries/get-execution.ts @@ -13,8 +13,8 @@ const getExecution = async ( .$relatedQuery('executions') .withGraphFetched({ flow: { - steps: true - } + steps: true, + }, }) .findById(params.executionId) .throwIfNotFound(); diff --git a/packages/backend/src/graphql/queries/get-flows.ts b/packages/backend/src/graphql/queries/get-flows.ts index 5fd0a591..48cb2319 100644 --- a/packages/backend/src/graphql/queries/get-flows.ts +++ b/packages/backend/src/graphql/queries/get-flows.ts @@ -13,12 +13,12 @@ const getFlows = async (_parent: unknown, params: Params, context: Context) => { const flowsQuery = context.currentUser .$relatedQuery('flows') .joinRelated({ - steps: true + steps: true, }) .withGraphFetched({ steps: { - connection: true - } + connection: true, + }, }) .where((builder) => { if (params.connectionId) { diff --git a/packages/backend/src/graphql/queries/healthcheck.ts b/packages/backend/src/graphql/queries/healthcheck.ts index 57184eba..e4126d08 100644 --- a/packages/backend/src/graphql/queries/healthcheck.ts +++ b/packages/backend/src/graphql/queries/healthcheck.ts @@ -3,7 +3,7 @@ import appConfig from '../../config/app'; const healthcheck = () => { return { version: appConfig.version, - } + }; }; export default healthcheck; diff --git a/packages/backend/src/helpers/add-reconnection-steps.ts b/packages/backend/src/helpers/add-reconnection-steps.ts index 5110c5b4..1d21008d 100644 --- a/packages/backend/src/helpers/add-reconnection-steps.ts +++ b/packages/backend/src/helpers/add-reconnection-steps.ts @@ -1,4 +1,8 @@ -import { IApp, IAuthenticationStep, IAuthenticationStepField } from '@automatisch/types'; +import { + IApp, + IAuthenticationStep, + IAuthenticationStepField, +} from '@automatisch/types'; import cloneDeep from 'lodash/cloneDeep'; const connectionIdArgument = { @@ -9,16 +13,11 @@ const connectionIdArgument = { const resetConnectionStep = { type: 'mutation' as const, name: 'resetConnection', - arguments: [ - connectionIdArgument, - ], + arguments: [connectionIdArgument], }; function replaceCreateConnection(string: string) { - return string.replace( - '{createConnection.id}', - '{connection.id}' - ); + return string.replace('{createConnection.id}', '{connection.id}'); } function removeAppKeyArgument(args: IAuthenticationStepField[]) { @@ -36,7 +35,7 @@ function addConnectionId(step: IAuthenticationStep) { return { name: property.name, value: replaceCreateConnection(property.value), - } + }; }); } @@ -60,7 +59,7 @@ function replaceCreateConnectionsWithUpdate(steps: IAuthenticationStep[]) { } return step; - }) + }); } function addReconnectionSteps(app: IApp): IApp { @@ -68,12 +67,11 @@ function addReconnectionSteps(app: IApp): IApp { if (hasReconnectionSteps) return app; - const updatedSteps = replaceCreateConnectionsWithUpdate(app.auth.authenticationSteps); + const updatedSteps = replaceCreateConnectionsWithUpdate( + app.auth.authenticationSteps + ); - app.auth.reconnectionSteps = [ - resetConnectionStep, - ...updatedSteps, - ] + app.auth.reconnectionSteps = [resetConnectionStep, ...updatedSteps]; return app; } diff --git a/packages/backend/src/helpers/app-info-converter.ts b/packages/backend/src/helpers/app-info-converter.ts index 99936eb1..e82adea2 100644 --- a/packages/backend/src/helpers/app-info-converter.ts +++ b/packages/backend/src/helpers/app-info-converter.ts @@ -16,7 +16,7 @@ const appInfoConverter = (rawAppData: IApp) => { }; } - return field + return field; }); } diff --git a/packages/backend/src/helpers/error-handler.ts b/packages/backend/src/helpers/error-handler.ts index f20d409d..a2871f1e 100644 --- a/packages/backend/src/helpers/error-handler.ts +++ b/packages/backend/src/helpers/error-handler.ts @@ -3,15 +3,15 @@ import logger from './logger'; type Error = { message: string; -} +}; const errorHandler = (err: Error, req: Request, res: Response): void => { - if(err.message === 'Not Found') { - res.status(404).end() + if (err.message === 'Not Found') { + res.status(404).end(); } else { - logger.error(err.message) - res.status(500).end() + logger.error(err.message); + res.status(500).end(); } -} +}; export default errorHandler; diff --git a/packages/backend/src/helpers/global-variable.ts b/packages/backend/src/helpers/global-variable.ts index 3f38316c..9fbb4446 100644 --- a/packages/backend/src/helpers/global-variable.ts +++ b/packages/backend/src/helpers/global-variable.ts @@ -75,7 +75,10 @@ const globalVariable = async ( }, }, pushTriggerItem: (triggerItem: ITriggerItem) => { - if (isAlreadyProcessed(triggerItem.meta.internalId) && !$.execution.testRun) { + if ( + isAlreadyProcessed(triggerItem.meta.internalId) && + !$.execution.testRun + ) { // early exit as we do not want to process duplicate items in actual executions throw new EarlyExitError(); } diff --git a/packages/backend/src/helpers/logger.ts b/packages/backend/src/helpers/logger.ts index 4c27ea64..7fd1a3cc 100644 --- a/packages/backend/src/helpers/logger.ts +++ b/packages/backend/src/helpers/logger.ts @@ -10,7 +10,7 @@ const levels = { }; const level = () => { - return appConfig.appEnv === 'development' ? 'debug' : 'info' + return appConfig.appEnv === 'development' ? 'debug' : 'info'; }; const colors = { @@ -27,8 +27,8 @@ const format = winston.format.combine( winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), winston.format.colorize({ all: true }), winston.format.printf( - (info) => `${info.timestamp} [${info.level}]: ${info.message}`, - ), + (info) => `${info.timestamp} [${info.level}]: ${info.message}` + ) ); const transports = [ diff --git a/packages/backend/src/helpers/morgan.ts b/packages/backend/src/helpers/morgan.ts index 92f9c124..10652b9a 100644 --- a/packages/backend/src/helpers/morgan.ts +++ b/packages/backend/src/helpers/morgan.ts @@ -3,13 +3,14 @@ import { Request } from 'express'; import logger from './logger'; const stream: StreamOptions = { - write: (message) => logger.http(message.substring(0, message.lastIndexOf("\n"))) + write: (message) => + logger.http(message.substring(0, message.lastIndexOf('\n'))), }; const registerGraphQLToken = () => { - morgan.token("graphql-query", (req: Request) => { - if(req.body.query) { - return `GraphQL ${req.body.query}` + morgan.token('graphql-query', (req: Request) => { + if (req.body.query) { + return `GraphQL ${req.body.query}`; } }); }; @@ -17,7 +18,7 @@ const registerGraphQLToken = () => { registerGraphQLToken(); const morganMiddleware = morgan( - ":method :url :status :res[content-length] - :response-time ms\n:graphql-query", + ':method :url :status :res[content-length] - :response-time ms\n:graphql-query', { stream } ); diff --git a/packages/backend/src/helpers/parse-header-link.ts b/packages/backend/src/helpers/parse-header-link.ts index 61e99695..b636cae6 100644 --- a/packages/backend/src/helpers/parse-header-link.ts +++ b/packages/backend/src/helpers/parse-header-link.ts @@ -25,7 +25,10 @@ export default function parseLinkHeader(link: string): TParsedLinkHeader { const items = link.split(','); for (const item of items) { - const [rawUriReference, ...rawLinkParameters] = item.split(';') as [string, ...string[]]; + const [rawUriReference, ...rawLinkParameters] = item.split(';') as [ + string, + ...string[] + ]; const trimmedUriReference = rawUriReference.trim(); const reference = trimmedUriReference.slice(1, -1); @@ -45,4 +48,4 @@ export default function parseLinkHeader(link: string): TParsedLinkHeader { } return parsed; -} \ No newline at end of file +} diff --git a/packages/backend/src/models/base.ts b/packages/backend/src/models/base.ts index 6bfdc60d..bbc916f4 100644 --- a/packages/backend/src/models/base.ts +++ b/packages/backend/src/models/base.ts @@ -36,7 +36,10 @@ class Base extends Model { this.updatedAt = new Date().toISOString(); } - async $beforeUpdate(opts: ModelOptions, queryContext: QueryContext): Promise { + async $beforeUpdate( + opts: ModelOptions, + queryContext: QueryContext + ): Promise { this.updatedAt = new Date().toISOString(); await super.$beforeUpdate(opts, queryContext); diff --git a/packages/backend/src/models/query-builder.ts b/packages/backend/src/models/query-builder.ts index 8d960068..1413933d 100644 --- a/packages/backend/src/models/query-builder.ts +++ b/packages/backend/src/models/query-builder.ts @@ -1,20 +1,34 @@ -import { Model, Page, PartialModelObject, ForClassMethod, AnyQueryBuilder } from "objection"; +import { + Model, + Page, + PartialModelObject, + ForClassMethod, + AnyQueryBuilder, +} from 'objection'; const DELETED_COLUMN_NAME = 'deleted_at'; const buildQueryBuidlerForClass = (): ForClassMethod => { return (modelClass) => { - const qb: AnyQueryBuilder = Model.QueryBuilder.forClass.call(ExtendedQueryBuilder, modelClass); + const qb: AnyQueryBuilder = Model.QueryBuilder.forClass.call( + ExtendedQueryBuilder, + modelClass + ); qb.onBuild((builder) => { if (!builder.context().withSoftDeleted) { - builder.whereNull(`${qb.modelClass().tableName}.${DELETED_COLUMN_NAME}`); + builder.whereNull( + `${qb.modelClass().tableName}.${DELETED_COLUMN_NAME}` + ); } }); return qb; }; }; -class ExtendedQueryBuilder extends Model.QueryBuilder { +class ExtendedQueryBuilder extends Model.QueryBuilder< + M, + R +> { ArrayQueryBuilderType!: ExtendedQueryBuilder; SingleQueryBuilderType!: ExtendedQueryBuilder; MaybeSingleQueryBuilderType!: ExtendedQueryBuilder; @@ -25,7 +39,7 @@ class ExtendedQueryBuilder extends Model.QueryBuilder< delete() { return this.patch({ - [DELETED_COLUMN_NAME]: (new Date()).toISOString(), + [DELETED_COLUMN_NAME]: new Date().toISOString(), } as unknown as PartialModelObject); } diff --git a/packages/backend/src/types/app-info.ts b/packages/backend/src/types/app-info.ts index a7584557..76eaa9a2 100644 --- a/packages/backend/src/types/app-info.ts +++ b/packages/backend/src/types/app-info.ts @@ -2,13 +2,13 @@ import FieldType from './field'; import AuthenticationStepType from './authentication-step'; type AppInfo = { - name: string, - key: string, - iconUrl: string, - docUrl: string, - primaryColor: string, - fields: FieldType[], - authenticationSteps?: AuthenticationStepType[] -} + name: string; + key: string; + iconUrl: string; + docUrl: string; + primaryColor: string; + fields: FieldType[]; + authenticationSteps?: AuthenticationStepType[]; +}; export default AppInfo; diff --git a/packages/backend/src/types/authentication-step-field.ts b/packages/backend/src/types/authentication-step-field.ts index e5d2e78c..49d9bb2a 100644 --- a/packages/backend/src/types/authentication-step-field.ts +++ b/packages/backend/src/types/authentication-step-field.ts @@ -1,10 +1,10 @@ type AuthenticationStepField = { - name: string, - value: string | null, + name: string; + value: string | null; fields?: { - name: string, - value: string | null - }[] -} + name: string; + value: string | null; + }[]; +}; export default AuthenticationStepField; diff --git a/packages/backend/src/types/authentication-step.ts b/packages/backend/src/types/authentication-step.ts index d4bb9b8b..fc072b97 100644 --- a/packages/backend/src/types/authentication-step.ts +++ b/packages/backend/src/types/authentication-step.ts @@ -1,10 +1,10 @@ import type { IAuthenticationStepField } from '@automatisch/types'; type AuthenticationStep = { - step: number, - type: string, - name: string, + step: number; + type: string; + name: string; fields: IAuthenticationStepField[]; -} +}; export default AuthenticationStep; diff --git a/packages/backend/src/types/field.d.ts b/packages/backend/src/types/field.d.ts index 53e0d378..386dd6fc 100644 --- a/packages/backend/src/types/field.d.ts +++ b/packages/backend/src/types/field.d.ts @@ -1,14 +1,14 @@ type Field = { - key: string, - label: string, - type: string, - required: boolean, - readOnly: boolean, - value: string, - placeholder: string | null, - description: string, - docUrl: string, - clickToCopy: boolean -} + key: string; + label: string; + type: string; + required: boolean; + readOnly: boolean; + value: string; + placeholder: string | null; + description: string; + docUrl: string; + clickToCopy: boolean; +}; export default Field; diff --git a/packages/backend/test/sample.ts b/packages/backend/test/sample.ts index c315d51e..7d603081 100644 --- a/packages/backend/test/sample.ts +++ b/packages/backend/test/sample.ts @@ -2,6 +2,6 @@ import test from 'ava'; const fn = () => 'foo'; -test('fn() returns foo', t => { - t.is(fn(), 'foo'); +test('fn() returns foo', (t) => { + t.is(fn(), 'foo'); }); diff --git a/packages/cli/.github/dependabot.yml b/packages/cli/.github/dependabot.yml index 608f038d..7c265f3c 100644 --- a/packages/cli/.github/dependabot.yml +++ b/packages/cli/.github/dependabot.yml @@ -1,16 +1,16 @@ version: 2 updates: - - package-ecosystem: "npm" + - package-ecosystem: 'npm' versioning-strategy: increase - directory: "/" + directory: '/' schedule: - interval: "monthly" + interval: 'monthly' labels: - - "dependencies" + - 'dependencies' open-pull-requests-limit: 100 pull-request-branch-name: - separator: "-" + separator: '-' ignore: - - dependency-name: "fs-extra" - - dependency-name: "*" - update-types: ["version-update:semver-major"] + - dependency-name: 'fs-extra' + - dependency-name: '*' + update-types: ['version-update:semver-major'] diff --git a/packages/cli/src/commands/start-worker.ts b/packages/cli/src/commands/start-worker.ts index 8aace9d4..a33061da 100644 --- a/packages/cli/src/commands/start-worker.ts +++ b/packages/cli/src/commands/start-worker.ts @@ -11,7 +11,7 @@ export default class StartWorker extends Command { char: 'e', }), 'env-file': Flags.string(), - } + }; async prepareEnvVars(): Promise { const { flags } = await this.parse(StartWorker); diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index a40ff1f0..44c4b09a 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -11,7 +11,7 @@ export default class Start extends Command { char: 'e', }), 'env-file': Flags.string(), - } + }; get isProduction() { return process.env.APP_ENV === 'production'; @@ -46,7 +46,7 @@ export default class Start extends Command { await utils.createDatabaseAndUser( process.env.POSTGRES_DATABASE, - process.env.POSTGRES_USERNAME, + process.env.POSTGRES_USERNAME ); } diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index e32b0b2e..d620e709 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1 +1 @@ -export {run} from '@oclif/core' +export { run } from '@oclif/core'; diff --git a/packages/e2e-tests/cypress.config.js b/packages/e2e-tests/cypress.config.js index 2acda4eb..a9b1bc3e 100644 --- a/packages/e2e-tests/cypress.config.js +++ b/packages/e2e-tests/cypress.config.js @@ -1,4 +1,4 @@ -const { defineConfig } = require("cypress"); +const { defineConfig } = require('cypress'); const TO_BE_PROVIDED = 'HAS_TO_BE_PROVIDED_IN_cypress.env.json'; @@ -6,12 +6,12 @@ module.exports = defineConfig({ e2e: { baseUrl: 'http://localhost:3001', env: { - login_email: "user@automatisch.io", - login_password: "sample", + login_email: 'user@automatisch.io', + login_password: 'sample', slack_user_token: TO_BE_PROVIDED, }, specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', viewportWidth: 1280, - viewportHeight: 768 + viewportHeight: 768, }, }); diff --git a/packages/e2e-tests/cypress/e2e/apps/list-apps.js b/packages/e2e-tests/cypress/e2e/apps/list-apps.js index bf6346c1..908eafac 100644 --- a/packages/e2e-tests/cypress/e2e/apps/list-apps.js +++ b/packages/e2e-tests/cypress/e2e/apps/list-apps.js @@ -47,4 +47,4 @@ describe('Apps page', () => { cy.og('add-app-connection-dialog').should('not.exist'); }); }); -}); \ No newline at end of file +}); diff --git a/packages/e2e-tests/cypress/e2e/connections/create-connection.js b/packages/e2e-tests/cypress/e2e/connections/create-connection.js index 570dab31..7d01d0f7 100644 --- a/packages/e2e-tests/cypress/e2e/connections/create-connection.js +++ b/packages/e2e-tests/cypress/e2e/connections/create-connection.js @@ -23,24 +23,17 @@ describe('Connections page', () => { context('can add connection', () => { it('has a button to open add connection dialog', () => { - cy - .og('add-connection-button') - .scrollIntoView() - .should('be.visible'); + cy.og('add-connection-button').scrollIntoView().should('be.visible'); }); it('add connection button takes user to add connection page', () => { - cy - .og('add-connection-button') - .click({ force: true }); + cy.og('add-connection-button').click({ force: true }); cy.location('pathname').should('equal', '/app/slack/connections/add'); }); it('shows add connection dialog to create a new connection', () => { - cy - .get('input[name="accessToken"]') - .type(Cypress.env('slack_user_token')); + cy.get('input[name="accessToken"]').type(Cypress.env('slack_user_token')); cy.og('create-connection-button').click(); diff --git a/packages/e2e-tests/cypress/e2e/executions/display-execution.js b/packages/e2e-tests/cypress/e2e/executions/display-execution.js index 647f97ca..945b987e 100644 --- a/packages/e2e-tests/cypress/e2e/executions/display-execution.js +++ b/packages/e2e-tests/cypress/e2e/executions/display-execution.js @@ -31,4 +31,4 @@ describe('Execution page', () => { cy.ss('Execution - error'); }); -}); \ No newline at end of file +}); diff --git a/packages/e2e-tests/cypress/e2e/executions/list-executions.js b/packages/e2e-tests/cypress/e2e/executions/list-executions.js index 66fcb026..73a685e8 100644 --- a/packages/e2e-tests/cypress/e2e/executions/list-executions.js +++ b/packages/e2e-tests/cypress/e2e/executions/list-executions.js @@ -17,4 +17,4 @@ describe('Executions page', () => { cy.ss('Executions'); }); -}); \ No newline at end of file +}); diff --git a/packages/e2e-tests/cypress/e2e/flow-editor/create-flow.js b/packages/e2e-tests/cypress/e2e/flow-editor/create-flow.js index 77d08af9..84efbd09 100644 --- a/packages/e2e-tests/cypress/e2e/flow-editor/create-flow.js +++ b/packages/e2e-tests/cypress/e2e/flow-editor/create-flow.js @@ -27,10 +27,7 @@ describe('Flow editor page', () => { }); it('choose an event', () => { - cy - .og('choose-event-autocomplete') - .should('be.visible') - .click(); + cy.og('choose-event-autocomplete').should('be.visible').click(); cy.get('li[role="option"]:contains("Every hour")').click(); }); @@ -42,13 +39,12 @@ describe('Flow editor page', () => { it('collapses the substep', () => { cy.og('choose-app-autocomplete').should('not.be.visible'); cy.og('choose-event-autocomplete').should('not.be.visible'); - }) + }); }); context('set up a trigger', () => { it('choose "yes" in "trigger on weekends?"', () => { - cy - .og('parameters.triggersOnWeekend-autocomplete') + cy.og('parameters.triggersOnWeekend-autocomplete') .should('be.visible') .click(); @@ -60,7 +56,9 @@ describe('Flow editor page', () => { }); it('collapses the substep', () => { - cy.og('parameters.triggersOnWeekend-autocomplete').should('not.exist'); + cy.og('parameters.triggersOnWeekend-autocomplete').should( + 'not.exist' + ); }); }); @@ -88,12 +86,11 @@ describe('Flow editor page', () => { }); it('choose an event', () => { - cy - .og('choose-event-autocomplete') - .should('be.visible') - .click(); + cy.og('choose-event-autocomplete').should('be.visible').click(); - cy.get('li[role="option"]:contains("Send a message to channel")').click(); + cy.get( + 'li[role="option"]:contains("Send a message to channel")' + ).click(); }); it('continue to next step', () => { @@ -130,14 +127,16 @@ describe('Flow editor page', () => { }); it('arrange message text', () => { - cy - .og('power-input', ' [contenteditable]') + cy.og('power-input', ' [contenteditable]') .click() - .type(`Hello from e2e tests! Here is the first suggested variable's value; `); + .type( + `Hello from e2e tests! Here is the first suggested variable's value; ` + ); - cy - .og('power-input-suggestion-group').first() - .og('power-input-suggestion-item').first() + cy.og('power-input-suggestion-group') + .first() + .og('power-input-suggestion-item') + .first() .click(); cy.clickOutside(); @@ -150,9 +149,7 @@ describe('Flow editor page', () => { }); it('collapses the substep', () => { - cy - .og('power-input', ' [contenteditable]') - .should('not.exist'); + cy.og('power-input', ' [contenteditable]').should('not.exist'); }); }); @@ -176,10 +173,7 @@ describe('Flow editor page', () => { it('publish flow', () => { cy.og('unpublish-flow-button').should('not.exist'); - cy - .og('publish-flow-button') - .should('be.visible') - .click(); + cy.og('publish-flow-button').should('be.visible').click(); cy.og('publish-flow-button').should('not.exist'); }); @@ -191,27 +185,19 @@ describe('Flow editor page', () => { }); it('unpublish from snackbar', () => { - cy - .og('unpublish-flow-from-snackbar') - .click(); + cy.og('unpublish-flow-from-snackbar').click(); cy.og('flow-cannot-edit-info-snackbar').should('not.exist'); - }) + }); it('publish once again', () => { - cy - .og('publish-flow-button') - .should('be.visible') - .click(); + cy.og('publish-flow-button').should('be.visible').click(); cy.og('publish-flow-button').should('not.exist'); }); it('unpublish from layout top bar', () => { - cy - .og('unpublish-flow-button') - .should('be.visible') - .click(); + cy.og('unpublish-flow-button').should('be.visible').click(); cy.og('unpublish-flow-button').should('not.exist'); diff --git a/packages/e2e-tests/cypress/support/commands.js b/packages/e2e-tests/cypress/support/commands.js index 7d28515e..06086d4a 100644 --- a/packages/e2e-tests/cypress/support/commands.js +++ b/packages/e2e-tests/cypress/support/commands.js @@ -1,10 +1,14 @@ -Cypress.Commands.add('og', { prevSubject: 'optional' }, (subject, selector, suffix = '') => { - if (subject) { - return cy.wrap(subject).get(`[data-test="${selector}"]${suffix}`); - } +Cypress.Commands.add( + 'og', + { prevSubject: 'optional' }, + (subject, selector, suffix = '') => { + if (subject) { + return cy.wrap(subject).get(`[data-test="${selector}"]${suffix}`); + } - return cy.get(`[data-test="${selector}"]${suffix}`); -}); + return cy.get(`[data-test="${selector}"]${suffix}`); + } +); Cypress.Commands.add('login', () => { cy.visit('/login'); @@ -12,12 +16,10 @@ Cypress.Commands.add('login', () => { cy.og('email-text-field').type(Cypress.env('login_email')); cy.og('password-text-field').type(Cypress.env('login_password')); - cy - .intercept('/graphql') - .as('graphqlCalls'); - cy - .intercept('https://notifications.automatisch.io/notifications.json') - .as('notificationsCall'); + cy.intercept('/graphql').as('graphqlCalls'); + cy.intercept('https://notifications.automatisch.io/notifications.json').as( + 'notificationsCall' + ); cy.og('login-button').click(); cy.wait(['@graphqlCalls', '@notificationsCall']); @@ -30,14 +32,11 @@ Cypress.Commands.add('logout', () => { }); Cypress.Commands.add('ss', (name, opts = {}) => { - return cy.screenshot( - name, - { - overwrite: true, - capture: 'viewport', - ...opts, - } - ); + return cy.screenshot(name, { + overwrite: true, + capture: 'viewport', + ...opts, + }); }); Cypress.Commands.add('clickOutside', () => { diff --git a/packages/e2e-tests/cypress/support/e2e.js b/packages/e2e-tests/cypress/support/e2e.js index 0e7290a1..5df9c018 100644 --- a/packages/e2e-tests/cypress/support/e2e.js +++ b/packages/e2e-tests/cypress/support/e2e.js @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import './commands'; // Alternatively you can use CommonJS syntax: -// require('./commands') \ No newline at end of file +// require('./commands') diff --git a/packages/web/public/index.html b/packages/web/public/index.html index b28bfd96..71ce7d9e 100644 --- a/packages/web/public/index.html +++ b/packages/web/public/index.html @@ -25,9 +25,12 @@ --> Automatisch - - - + + + diff --git a/packages/web/src/components/AccountDropdownMenu/index.tsx b/packages/web/src/components/AccountDropdownMenu/index.tsx index 4f2dbbf7..e34cd045 100644 --- a/packages/web/src/components/AccountDropdownMenu/index.tsx +++ b/packages/web/src/components/AccountDropdownMenu/index.tsx @@ -12,21 +12,18 @@ import useFormatMessage from 'hooks/useFormatMessage'; type AccountDropdownMenuProps = { open: boolean; onClose: () => void; - anchorEl: MenuProps["anchorEl"]; + anchorEl: MenuProps['anchorEl']; id: string; -} +}; -function AccountDropdownMenu(props: AccountDropdownMenuProps): React.ReactElement { +function AccountDropdownMenu( + props: AccountDropdownMenuProps +): React.ReactElement { const formatMessage = useFormatMessage(); const authentication = useAuthentication(); const navigate = useNavigate(); - const { - open, - onClose, - anchorEl, - id - } = props + const { open, onClose, anchorEl, id } = props; const logout = async () => { authentication.updateToken(''); @@ -53,17 +50,11 @@ function AccountDropdownMenu(props: AccountDropdownMenuProps): React.ReactElemen open={open} onClose={onClose} > - + {formatMessage('accountDropdownMenu.settings')} - + {formatMessage('accountDropdownMenu.logout')} diff --git a/packages/web/src/components/AddAppConnection/index.tsx b/packages/web/src/components/AddAppConnection/index.tsx index 4627fd71..44a35a6d 100644 --- a/packages/web/src/components/AddAppConnection/index.tsx +++ b/packages/web/src/components/AddAppConnection/index.tsx @@ -14,9 +14,12 @@ import InputCreator from 'components/InputCreator'; import type { IApp, IField } from '@automatisch/types'; import { Form } from './style'; -const generateDocsLink = (link: string) => (str: string) => ( - {str} -); +const generateDocsLink = (link: string) => (str: string) => + ( + + {str} + + ); type AddAppConnectionProps = { onClose: (response: Record) => void; @@ -26,79 +29,90 @@ type AddAppConnectionProps = { type Response = { [key: string]: any; -} +}; -export default function AddAppConnection(props: AddAppConnectionProps): React.ReactElement { +export default function AddAppConnection( + props: AddAppConnectionProps +): React.ReactElement { const { application, connectionId, onClose } = props; const { name, authDocUrl, key, auth } = application; const formatMessage = useFormatMessage(); const [errorMessage, setErrorMessage] = React.useState(null); const [inProgress, setInProgress] = React.useState(false); const hasConnection = Boolean(connectionId); - const steps = hasConnection ? auth?.reconnectionSteps : auth?.authenticationSteps; + const steps = hasConnection + ? auth?.reconnectionSteps + : auth?.authenticationSteps; React.useEffect(() => { if (window.opener) { - window.opener.postMessage({ source: 'automatisch', payload: window.location.search }); + window.opener.postMessage({ + source: 'automatisch', + payload: window.location.search, + }); window.close(); } }, []); - const submitHandler: SubmitHandler = React.useCallback(async (data) => { - if (!steps) return; + const submitHandler: SubmitHandler = React.useCallback( + async (data) => { + if (!steps) return; - setInProgress(true); - setErrorMessage(null); + setInProgress(true); + setErrorMessage(null); - const response: Response = { - key, - connection: { - id: connectionId - }, - fields: data, - }; + const response: Response = { + key, + connection: { + id: connectionId, + }, + fields: data, + }; - let stepIndex = 0; - while (stepIndex < steps.length) { - const step = steps[stepIndex]; - const variables = computeAuthStepVariables(step.arguments, response); + let stepIndex = 0; + while (stepIndex < steps.length) { + const step = steps[stepIndex]; + const variables = computeAuthStepVariables(step.arguments, response); - try { - const stepResponse = await processStep(step, variables); + try { + const stepResponse = await processStep(step, variables); - response[step.name] = stepResponse; - } catch (err) { - const error = err as Error; - console.log(error); - setErrorMessage(error.message); - setInProgress(false); + response[step.name] = stepResponse; + } catch (err) { + const error = err as Error; + console.log(error); + setErrorMessage(error.message); + setInProgress(false); - break; + break; + } + + stepIndex++; + + if (stepIndex === steps.length) { + onClose(response); + } } - stepIndex++; - - if (stepIndex === steps.length) { - onClose(response); - } - } - - setInProgress(false); - }, [connectionId, key, steps, onClose]); + setInProgress(false); + }, + [connectionId, key, steps, onClose] + ); return ( - {hasConnection ? formatMessage('app.reconnectConnection') : formatMessage('app.addConnection')} + + {hasConnection + ? formatMessage('app.reconnectConnection') + : formatMessage('app.addConnection')} + {authDocUrl && ( - - {formatMessage( - 'addAppConnection.callToDocs', - { - appName: name, - docsLink: generateDocsLink(authDocUrl) - } - )} + + {formatMessage('addAppConnection.callToDocs', { + appName: name, + docsLink: generateDocsLink(authDocUrl), + })} )} @@ -111,7 +125,9 @@ export default function AddAppConnection(props: AddAppConnectionProps): React.Re
- {auth?.fields?.map((field: IField) => ())} + {auth?.fields?.map((field: IField) => ( + + ))}
); -}; +} diff --git a/packages/web/src/components/ApolloProvider/index.tsx b/packages/web/src/components/ApolloProvider/index.tsx index dced28f4..cd9271a5 100644 --- a/packages/web/src/components/ApolloProvider/index.tsx +++ b/packages/web/src/components/ApolloProvider/index.tsx @@ -13,9 +13,12 @@ const ApolloProvider = (props: ApolloProviderProps): React.ReactElement => { const { enqueueSnackbar } = useSnackbar(); const authentication = useAuthentication(); - const onError = React.useCallback((message) => { - enqueueSnackbar(message, { variant: 'error' }); - }, [enqueueSnackbar]); + const onError = React.useCallback( + (message) => { + enqueueSnackbar(message, { variant: 'error' }); + }, + [enqueueSnackbar] + ); const client = React.useMemo(() => { return mutateAndGetClient({ @@ -24,9 +27,7 @@ const ApolloProvider = (props: ApolloProviderProps): React.ReactElement => { }); }, [onError, authentication]); - return ( - - ); + return ; }; export default ApolloProvider; diff --git a/packages/web/src/components/AppBar/index.tsx b/packages/web/src/components/AppBar/index.tsx index b168b645..56d52bd3 100644 --- a/packages/web/src/components/AppBar/index.tsx +++ b/packages/web/src/components/AppBar/index.tsx @@ -20,23 +20,21 @@ type AppBarProps = { drawerOpen: boolean; onDrawerOpen: () => void; onDrawerClose: () => void; - maxWidth?: ContainerProps["maxWidth"]; + maxWidth?: ContainerProps['maxWidth']; }; const accountMenuId = 'account-menu'; export default function AppBar(props: AppBarProps): React.ReactElement { - const { - drawerOpen, - onDrawerOpen, - onDrawerClose, - maxWidth = false, - } = props; + const { drawerOpen, onDrawerOpen, onDrawerClose, maxWidth = false } = props; const theme = useTheme(); - const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true }); + const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { + noSsr: true, + }); - const [accountMenuAnchorElement, setAccountMenuAnchorElement] = React.useState(null); + const [accountMenuAnchorElement, setAccountMenuAnchorElement] = + React.useState(null); const isMenuOpen = Boolean(accountMenuAnchorElement); @@ -65,11 +63,7 @@ export default function AppBar(props: AppBarProps): React.ReactElement {
- + diff --git a/packages/web/src/components/AppConnectionContextMenu/index.tsx b/packages/web/src/components/AppConnectionContextMenu/index.tsx index f9229f40..d18a7818 100644 --- a/packages/web/src/components/AppConnectionContextMenu/index.tsx +++ b/packages/web/src/components/AppConnectionContextMenu/index.tsx @@ -19,17 +19,22 @@ type ContextMenuProps = { anchorEl: PopoverProps['anchorEl']; }; -export default function ContextMenu(props: ContextMenuProps): React.ReactElement { +export default function ContextMenu( + props: ContextMenuProps +): React.ReactElement { const { appKey, connectionId, onClose, onMenuItemClick, anchorEl } = props; const formatMessage = useFormatMessage(); - const createActionHandler = React.useCallback((action: Action) => { - return function clickHandler(event: React.MouseEvent) { - onMenuItemClick(event, action); + const createActionHandler = React.useCallback( + (action: Action) => { + return function clickHandler(event: React.MouseEvent) { + onMenuItemClick(event, action); - onClose(); - }; - }, [onMenuItemClick, onClose]); + onClose(); + }; + }, + [onMenuItemClick, onClose] + ); return ( ); -}; +} diff --git a/packages/web/src/components/AppConnectionRow/index.tsx b/packages/web/src/components/AppConnectionRow/index.tsx index 090de246..b874779b 100644 --- a/packages/web/src/components/AppConnectionRow/index.tsx +++ b/packages/web/src/components/AppConnectionRow/index.tsx @@ -20,13 +20,11 @@ import { CardContent, Typography } from './style'; type AppConnectionRowProps = { connection: IConnection; -} +}; const countTranslation = (value: React.ReactNode) => ( <> - - {value} - + {value}
); @@ -34,15 +32,21 @@ const countTranslation = (value: React.ReactNode) => ( function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { const { enqueueSnackbar } = useSnackbar(); const [verificationVisible, setVerificationVisible] = React.useState(false); - const [testConnection, { called: testCalled, loading: testLoading }] = useLazyQuery(TEST_CONNECTION, { - fetchPolicy: 'network-only', - onCompleted: () => { setTimeout(() => setVerificationVisible(false), 3000); }, - onError: () => { setTimeout(() => setVerificationVisible(false), 3000); }, - }); + const [testConnection, { called: testCalled, loading: testLoading }] = + useLazyQuery(TEST_CONNECTION, { + fetchPolicy: 'network-only', + onCompleted: () => { + setTimeout(() => setVerificationVisible(false), 3000); + }, + onError: () => { + setTimeout(() => setVerificationVisible(false), 3000); + }, + }); const [deleteConnection] = useMutation(DELETE_CONNECTION); const formatMessage = useFormatMessage(); - const { id, key, formattedData, verified, createdAt, flowCount } = props.connection; + const { id, key, formattedData, verified, createdAt, flowCount } = + props.connection; const contextButtonRef = React.useRef(null); const [anchorEl, setAnchorEl] = React.useState(null); @@ -52,47 +56,52 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { }; const onContextMenuClick = () => setAnchorEl(contextButtonRef.current); - const onContextMenuAction = React.useCallback(async (event, action: { [key: string]: string }) => { - if (action.type === 'delete') { - await deleteConnection({ - variables: { input: { id } }, - update: (cache) => { - const connectionCacheId = cache.identify({ - __typename: 'Connection', - id, - }); + const onContextMenuAction = React.useCallback( + async (event, action: { [key: string]: string }) => { + if (action.type === 'delete') { + await deleteConnection({ + variables: { input: { id } }, + update: (cache) => { + const connectionCacheId = cache.identify({ + __typename: 'Connection', + id, + }); - cache.evict({ - id: connectionCacheId, - }); - } - }); + cache.evict({ + id: connectionCacheId, + }); + }, + }); - enqueueSnackbar(formatMessage('connection.deletedMessage'), { variant: 'success' }); - } else if (action.type === 'test') { - setVerificationVisible(true); - testConnection({ variables: { id } }); - } - }, [deleteConnection, id, testConnection, formatMessage, enqueueSnackbar]); + enqueueSnackbar(formatMessage('connection.deletedMessage'), { + variant: 'success', + }); + } else if (action.type === 'test') { + setVerificationVisible(true); + testConnection({ variables: { id } }); + } + }, + [deleteConnection, id, testConnection, formatMessage, enqueueSnackbar] + ); - const relativeCreatedAt = DateTime.fromMillis(parseInt(createdAt, 10)).toRelative(); + const relativeCreatedAt = DateTime.fromMillis( + parseInt(createdAt, 10) + ).toRelative(); return ( <> - + {formattedData?.screenName} - {formatMessage('connection.addedAt', { datetime: relativeCreatedAt })} + {formatMessage('connection.addedAt', { + datetime: relativeCreatedAt, + })} @@ -101,27 +110,42 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { {verificationVisible && testCalled && testLoading && ( <> - {formatMessage('connection.testing')} + + {formatMessage('connection.testing')} + )} {verificationVisible && testCalled && !testLoading && verified && ( <> - {formatMessage('connection.testSuccessful')} - - )} - {verificationVisible && testCalled && !testLoading && !verified && ( - <> - - {formatMessage('connection.testFailed')} + + {formatMessage('connection.testSuccessful')} + )} + {verificationVisible && + testCalled && + !testLoading && + !verified && ( + <> + + + {formatMessage('connection.testFailed')} + + + )} - - {formatMessage('connection.flowCount', { count: countTranslation(flowCount) })} + + {formatMessage('connection.flowCount', { + count: countTranslation(flowCount), + })} @@ -132,13 +156,15 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { - {anchorEl && } + {anchorEl && ( + + )} ); } diff --git a/packages/web/src/components/AppConnectionRow/style.ts b/packages/web/src/components/AppConnectionRow/style.ts index 903a4a26..9bbc429b 100644 --- a/packages/web/src/components/AppConnectionRow/style.ts +++ b/packages/web/src/components/AppConnectionRow/style.ts @@ -10,7 +10,6 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ alignItems: 'center', })); - export const Typography = styled(MuiTypography)(() => ({ textAlign: 'center', display: 'inline-block', diff --git a/packages/web/src/components/AppConnections/index.tsx b/packages/web/src/components/AppConnections/index.tsx index 82e3ffa8..35dea8bc 100644 --- a/packages/web/src/components/AppConnections/index.tsx +++ b/packages/web/src/components/AppConnections/index.tsx @@ -10,12 +10,16 @@ import * as URLS from 'config/urls'; type AppConnectionsProps = { appKey: string; -} +}; -export default function AppConnections(props: AppConnectionsProps): React.ReactElement { +export default function AppConnections( + props: AppConnectionsProps +): React.ReactElement { const { appKey } = props; const formatMessage = useFormatMessage(); - const { data } = useQuery(GET_APP_CONNECTIONS, { variables: { key: appKey } }); + const { data } = useQuery(GET_APP_CONNECTIONS, { + variables: { key: appKey }, + }); const appConnections: IConnection[] = data?.getApp?.connections || []; const hasConnections = appConnections?.length; @@ -35,5 +39,5 @@ export default function AppConnections(props: AppConnectionsProps): React.ReactE ))} - ) -}; + ); +} diff --git a/packages/web/src/components/AppFlows/index.tsx b/packages/web/src/components/AppFlows/index.tsx index 1367aa42..6e7e5ee0 100644 --- a/packages/web/src/components/AppFlows/index.tsx +++ b/packages/web/src/components/AppFlows/index.tsx @@ -12,7 +12,7 @@ import type { IFlow } from '@automatisch/types'; type AppFlowsProps = { appKey: string; -} +}; const FLOW_PER_PAGE = 10; @@ -27,11 +27,13 @@ export default function AppFlows(props: AppFlowsProps): React.ReactElement { const [searchParams, setSearchParams] = useSearchParams(); const connectionId = searchParams.get('connectionId') || undefined; const page = parseInt(searchParams.get('page') || '', 10) || 1; - const { data } = useQuery(GET_FLOWS, { variables: { - appKey, - connectionId, - ...getLimitAndOffset(page) - }}); + const { data } = useQuery(GET_FLOWS, { + variables: { + appKey, + connectionId, + ...getLimitAndOffset(page), + }, + }); const getFlows = data?.getFlows || {}; const { pageInfo, edges } = getFlows; @@ -53,19 +55,21 @@ export default function AppFlows(props: AppFlowsProps): React.ReactElement { ))} - {pageInfo && pageInfo.totalPages > 1 && setSearchParams({ page: page.toString() })} - renderItem={(item) => ( - - )} - />} + {pageInfo && pageInfo.totalPages > 1 && ( + setSearchParams({ page: page.toString() })} + renderItem={(item) => ( + + )} + /> + )} - ) -}; + ); +} diff --git a/packages/web/src/components/AppIcon/index.tsx b/packages/web/src/components/AppIcon/index.tsx index 2c114bca..4e87ab5c 100644 --- a/packages/web/src/components/AppIcon/index.tsx +++ b/packages/web/src/components/AppIcon/index.tsx @@ -13,15 +13,10 @@ const inlineImgStyle: React.CSSProperties = { objectFit: 'contain', }; -export default function AppIcon(props: AppIconProps & AvatarProps): React.ReactElement { - const { - name, - url, - color, - sx = {}, - variant = "square", - ...restProps - } = props; +export default function AppIcon( + props: AppIconProps & AvatarProps +): React.ReactElement { + const { name, url, color, sx = {}, variant = 'square', ...restProps } = props; const initialLetter = name?.[0]; @@ -37,4 +32,4 @@ export default function AppIcon(props: AppIconProps & AvatarProps): React.ReactE {...restProps} /> ); -}; +} diff --git a/packages/web/src/components/AppRow/index.tsx b/packages/web/src/components/AppRow/index.tsx index c714829b..f059c6cc 100644 --- a/packages/web/src/components/AppRow/index.tsx +++ b/packages/web/src/components/AppRow/index.tsx @@ -14,20 +14,19 @@ import { CardContent, Typography } from './style'; type AppRowProps = { application: IApp; -} +}; const countTranslation = (value: React.ReactNode) => ( <> - - {value} - + {value}
); function AppRow(props: AppRowProps): React.ReactElement { const formatMessage = useFormatMessage(); - const { name, primaryColor, iconUrl, connectionCount, flowCount } = props.application; + const { name, primaryColor, iconUrl, connectionCount, flowCount } = + props.application; return ( @@ -39,25 +38,37 @@ function AppRow(props: AppRowProps): React.ReactElement { - - {name} + {name} + + + + + {formatMessage('app.connectionCount', { + count: countTranslation(connectionCount), + })} - - {formatMessage('app.connectionCount', { count: countTranslation(connectionCount) })} - - - - - - {formatMessage('app.flowCount', { count: countTranslation(flowCount) })} + + {formatMessage('app.flowCount', { + count: countTranslation(flowCount), + })} - theme.palette.primary.main }} /> + theme.palette.primary.main }} + /> diff --git a/packages/web/src/components/AppRow/style.ts b/packages/web/src/components/AppRow/style.ts index 56ff45ab..3c00d785 100644 --- a/packages/web/src/components/AppRow/style.ts +++ b/packages/web/src/components/AppRow/style.ts @@ -10,7 +10,6 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ alignItems: 'center', })); - export const Typography = styled(MuiTypography)(() => ({ '&.MuiTypography-h6': { textTransform: 'capitalize', @@ -22,5 +21,5 @@ export const Typography = styled(MuiTypography)(() => ({ export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({ [theme.breakpoints.down('sm')]: { display: 'none', - } + }, })); diff --git a/packages/web/src/components/ChooseAppAndEventSubstep/index.tsx b/packages/web/src/components/ChooseAppAndEventSubstep/index.tsx index 3a50c4bd..fc964bbc 100644 --- a/packages/web/src/components/ChooseAppAndEventSubstep/index.tsx +++ b/packages/web/src/components/ChooseAppAndEventSubstep/index.tsx @@ -12,7 +12,13 @@ import useFormatMessage from 'hooks/useFormatMessage'; import { EditorContext } from 'contexts/Editor'; import { GET_APPS } from 'graphql/queries/get-apps'; import FlowSubstepTitle from 'components/FlowSubstepTitle'; -import type { IApp, IStep, ISubstep, ITrigger, IAction } from '@automatisch/types'; +import type { + IApp, + IStep, + ISubstep, + ITrigger, + IAction, +} from '@automatisch/types'; type ChooseAppAndEventSubstepProps = { substep: ISubstep; @@ -24,7 +30,10 @@ type ChooseAppAndEventSubstepProps = { step: IStep; }; -const optionGenerator = (app: { name: string, key: string, }): { label: string; value: string } => ({ +const optionGenerator = (app: { + name: string; + key: string; +}): { label: string; value: string } => ({ label: app.name as string, value: app.key as string, }); @@ -61,15 +70,15 @@ function ChooseAppAndEventSubstep( () => apps?.map((app) => optionGenerator(app)), [apps] ); - const actionsOrTriggers: Array = (isTrigger ? app?.triggers : app?.actions) || []; + const actionsOrTriggers: Array = + (isTrigger ? app?.triggers : app?.actions) || []; const actionOptions = React.useMemo( () => actionsOrTriggers.map((trigger) => optionGenerator(trigger)), [app?.key] ); - const selectedActionOrTrigger = - actionsOrTriggers.find( - (actionOrTrigger: IAction | ITrigger) => actionOrTrigger.key === step?.key - ); + const selectedActionOrTrigger = actionsOrTriggers.find( + (actionOrTrigger: IAction | ITrigger) => actionOrTrigger.key === step?.key + ); const { name } = substep; diff --git a/packages/web/src/components/ChooseConnectionSubstep/index.tsx b/packages/web/src/components/ChooseConnectionSubstep/index.tsx index 1c32c932..132b659a 100644 --- a/packages/web/src/components/ChooseConnectionSubstep/index.tsx +++ b/packages/web/src/components/ChooseConnectionSubstep/index.tsx @@ -16,7 +16,7 @@ import { TEST_CONNECTION } from 'graphql/queries/test-connection'; type ChooseConnectionSubstepProps = { application: IApp; - substep: ISubstep, + substep: ISubstep; expanded?: boolean; onExpand: () => void; onCollapse: () => void; @@ -27,14 +27,19 @@ type ChooseConnectionSubstepProps = { const ADD_CONNECTION_VALUE = 'ADD_CONNECTION'; -const optionGenerator = (connection: IConnection): { label: string; value: string; } => ({ - label: connection?.formattedData?.screenName as string ?? 'Unnamed', +const optionGenerator = ( + connection: IConnection +): { label: string; value: string } => ({ + label: (connection?.formattedData?.screenName as string) ?? 'Unnamed', value: connection?.id as string, }); -const getOption = (options: Record[], connectionId?: string) => options.find(connection => connection.value === connectionId) || null; +const getOption = (options: Record[], connectionId?: string) => + options.find((connection) => connection.value === connectionId) || null; -function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.ReactElement { +function ChooseConnectionSubstep( + props: ChooseConnectionSubstepProps +): React.ReactElement { const { substep, expanded = false, @@ -45,36 +50,30 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea onChange, application, } = props; - const { - connection, - appKey, - } = step; + const { connection, appKey } = step; const formatMessage = useFormatMessage(); const editorContext = React.useContext(EditorContext); - const [showAddConnectionDialog, setShowAddConnectionDialog] = React.useState(false); - const { data, loading, refetch } = useQuery(GET_APP_CONNECTIONS, { variables: { key: appKey }}); + const [showAddConnectionDialog, setShowAddConnectionDialog] = + React.useState(false); + const { data, loading, refetch } = useQuery(GET_APP_CONNECTIONS, { + variables: { key: appKey }, + }); // TODO: show detailed error when connection test/verification fails const [ testConnection, - { - loading: testResultLoading, - refetch: retestConnection - } - ] = useLazyQuery( - TEST_CONNECTION, - { - variables: { - id: connection?.id, - } - } - ); + { loading: testResultLoading, refetch: retestConnection }, + ] = useLazyQuery(TEST_CONNECTION, { + variables: { + id: connection?.id, + }, + }); React.useEffect(() => { if (connection?.id) { testConnection({ variables: { id: connection.id, - } + }, }); } // intentionally no dependencies for initial test @@ -82,52 +81,30 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea const connectionOptions = React.useMemo(() => { const appWithConnections = data?.getApp as IApp; - const options = appWithConnections - ?.connections - ?.map((connection) => optionGenerator(connection)) || []; + const options = + appWithConnections?.connections?.map((connection) => + optionGenerator(connection) + ) || []; options.push({ label: formatMessage('chooseConnectionSubstep.addNewConnection'), - value: ADD_CONNECTION_VALUE - }) + value: ADD_CONNECTION_VALUE, + }); return options; }, [data, formatMessage]); const { name } = substep; - const handleAddConnectionClose = React.useCallback(async (response) => { - setShowAddConnectionDialog(false); + const handleAddConnectionClose = React.useCallback( + async (response) => { + setShowAddConnectionDialog(false); - const connectionId = response?.createConnection.id; + const connectionId = response?.createConnection.id; - if (connectionId) { - await refetch(); + if (connectionId) { + await refetch(); - onChange({ - step: { - ...step, - connection: { - id: connectionId, - }, - }, - }); - } - }, [onChange, refetch, step]); - - const handleChange = React.useCallback((event: React.SyntheticEvent, selectedOption: unknown) => { - if (typeof selectedOption === 'object') { - // TODO: try to simplify type casting below. - const typedSelectedOption = selectedOption as { value: string }; - const option: { value: string } = typedSelectedOption; - const connectionId = option?.value as string; - - if (connectionId === ADD_CONNECTION_VALUE) { - setShowAddConnectionDialog(true); - return; - } - - if (connectionId !== step.connection?.id) { onChange({ step: { ...step, @@ -137,8 +114,37 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea }, }); } - } - }, [step, onChange]); + }, + [onChange, refetch, step] + ); + + const handleChange = React.useCallback( + (event: React.SyntheticEvent, selectedOption: unknown) => { + if (typeof selectedOption === 'object') { + // TODO: try to simplify type casting below. + const typedSelectedOption = selectedOption as { value: string }; + const option: { value: string } = typedSelectedOption; + const connectionId = option?.value as string; + + if (connectionId === ADD_CONNECTION_VALUE) { + setShowAddConnectionDialog(true); + return; + } + + if (connectionId !== step.connection?.id) { + onChange({ + step: { + ...step, + connection: { + id: connectionId, + }, + }, + }); + } + } + }, + [step, onChange] + ); React.useEffect(() => { if (step.connection?.id) { @@ -146,7 +152,7 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea id: step.connection.id, }); } - }, [step.connection?.id, retestConnection]) + }, [step.connection?.id, retestConnection]); const onToggle = expanded ? onCollapse : onExpand; @@ -159,7 +165,14 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea valid={testResultLoading ? null : connection?.verified} /> - + ( )} value={getOption(connectionOptions, connection?.id)} @@ -183,17 +198,24 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea variant="contained" onClick={onSubmit} sx={{ mt: 2 }} - disabled={testResultLoading || !connection?.verified || editorContext.readOnly}data-test="flow-substep-continue-button" + disabled={ + testResultLoading || + !connection?.verified || + editorContext.readOnly + } + data-test="flow-substep-continue-button" > {formatMessage('chooseConnectionSubstep.continue')} - {application && showAddConnectionDialog && } + {application && showAddConnectionDialog && ( + + )} ); } diff --git a/packages/web/src/components/ConditionalIconButton/index.tsx b/packages/web/src/components/ConditionalIconButton/index.tsx index 9f045798..4c72a4a9 100644 --- a/packages/web/src/components/ConditionalIconButton/index.tsx +++ b/packages/web/src/components/ConditionalIconButton/index.tsx @@ -10,7 +10,9 @@ import { IconButton } from './style'; export default function ConditionalIconButton(props: any): React.ReactElement { const { icon, ...buttonProps } = props; const theme = useTheme(); - const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true }); + const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { + noSsr: true, + }); if (matchSmallScreens) { return ( @@ -22,10 +24,8 @@ export default function ConditionalIconButton(props: any): React.ReactElement { > {icon} - ) + ); } - return ( - @@ -118,8 +140,8 @@ export default function EditorLayout(): React.ReactElement { open={!!flow?.active} message={formatMessage('flowEditor.publishedFlowCannotBeUpdated')} anchorOrigin={{ horizontal: 'center', vertical: 'bottom' }} - ContentProps={{ sx: { fontWeight: 300 }}} - action={( + ContentProps={{ sx: { fontWeight: 300 } }} + action={ - )} + } /> - ) + ); } diff --git a/packages/web/src/components/ExecutionHeader/index.tsx b/packages/web/src/components/ExecutionHeader/index.tsx index 2db8e37f..e146acae 100644 --- a/packages/web/src/components/ExecutionHeader/index.tsx +++ b/packages/web/src/components/ExecutionHeader/index.tsx @@ -10,43 +10,53 @@ type ExecutionHeaderProps = { execution: IExecution; }; -function ExecutionName(props: Pick) { +function ExecutionName(props: Pick) { return ( - {props.name} + + {props.name} + ); } -function ExecutionId(props: Pick) { +function ExecutionId(props: Pick) { return ( - Execution ID: {props.id} + Execution ID:{' '} + + {props.id} + ); } -function ExecutionDate(props: Pick) { - const createdAt = DateTime.fromMillis( - parseInt(props.createdAt, 10) - ); +function ExecutionDate(props: Pick) { + const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10)); const relativeCreatedAt = createdAt.toRelative(); return ( - {relativeCreatedAt} + + {relativeCreatedAt} + ); } -export default function ExecutionHeader(props: ExecutionHeaderProps): React.ReactElement { +export default function ExecutionHeader( + props: ExecutionHeaderProps +): React.ReactElement { const { execution } = props; if (!execution) return ; return ( - + diff --git a/packages/web/src/components/ExecutionRow/index.tsx b/packages/web/src/components/ExecutionRow/index.tsx index f9a133f3..f56abcd1 100644 --- a/packages/web/src/components/ExecutionRow/index.tsx +++ b/packages/web/src/components/ExecutionRow/index.tsx @@ -14,9 +14,11 @@ import { Apps, CardContent, ArrowContainer, Title, Typography } from './style'; type ExecutionRowProps = { execution: IExecution; -} +}; -export default function ExecutionRow(props: ExecutionRowProps): React.ReactElement { +export default function ExecutionRow( + props: ExecutionRowProps +): React.ReactElement { const formatMessage = useFormatMessage(); const { execution } = props; const { flow } = execution; @@ -29,21 +31,19 @@ export default function ExecutionRow(props: ExecutionRowProps): React.ReactEleme - + - + <Title justifyContent="center" alignItems="flex-start" spacing={1}> <Typography variant="h6" noWrap> {flow.name} </Typography> <Typography variant="caption" noWrap> - {formatMessage('execution.executedAt', { datetime: relativeCreatedAt })} + {formatMessage('execution.executedAt', { + datetime: relativeCreatedAt, + })} </Typography> @@ -57,7 +57,9 @@ export default function ExecutionRow(props: ExecutionRowProps): React.ReactEleme /> )} - theme.palette.primary.main }} /> + theme.palette.primary.main }} + /> diff --git a/packages/web/src/components/ExecutionRow/style.ts b/packages/web/src/components/ExecutionRow/style.ts index 09f59802..4f9e0db4 100644 --- a/packages/web/src/components/ExecutionRow/style.ts +++ b/packages/web/src/components/ExecutionRow/style.ts @@ -20,7 +20,7 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ `, gridTemplateColumns: 'minmax(0, auto) min-content', gridTemplateRows: 'auto auto', - } + }, })); export const Apps = styled(MuiStack)(() => ({ @@ -46,5 +46,5 @@ export const Typography = styled(MuiTypography)(() => ({ export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({ [theme.breakpoints.down('sm')]: { display: 'none', - } + }, })); diff --git a/packages/web/src/components/ExecutionStep/index.tsx b/packages/web/src/components/ExecutionStep/index.tsx index b11caaaa..7d4c7fe2 100644 --- a/packages/web/src/components/ExecutionStep/index.tsx +++ b/packages/web/src/components/ExecutionStep/index.tsx @@ -14,32 +14,43 @@ import JSONViewer from 'components/JSONViewer'; import AppIcon from 'components/AppIcon'; import { GET_APPS } from 'graphql/queries/get-apps'; import useFormatMessage from 'hooks/useFormatMessage'; -import { AppIconWrapper, AppIconStatusIconWrapper, Content, Header, Wrapper } from './style'; +import { + AppIconWrapper, + AppIconStatusIconWrapper, + Content, + Header, + Wrapper, +} from './style'; type ExecutionStepProps = { collapsed?: boolean; step: IStep; index?: number; executionStep: IExecutionStep; -} +}; const validIcon = ; const errorIcon = ; -export default function ExecutionStep(props: ExecutionStepProps): React.ReactElement | null { - const { executionStep, } = props; +export default function ExecutionStep( + props: ExecutionStepProps +): React.ReactElement | null { + const { executionStep } = props; const [activeTabIndex, setActiveTabIndex] = React.useState(0); const step: IStep = executionStep.step; const isTrigger = step.type === 'trigger'; const isAction = step.type === 'action'; const formatMessage = useFormatMessage(); - const { data } = useQuery(GET_APPS, { variables: { onlyWithTriggers: isTrigger, onlyWithActions: isAction }}); + const { data } = useQuery(GET_APPS, { + variables: { onlyWithTriggers: isTrigger, onlyWithActions: isAction }, + }); const apps: IApp[] = data?.getApps; const app = apps?.find((currentApp: IApp) => currentApp.key === step.appKey); - if (!apps) return null; + if (!apps) return null; - const validationStatusIcon = executionStep.status === 'success' ? validIcon : errorIcon; + const validationStatusIcon = + executionStep.status === 'success' ? validIcon : errorIcon; return ( @@ -55,11 +66,9 @@ export default function ExecutionStep(props: ExecutionStepProps): React.ReactEle
- { - isTrigger ? - formatMessage('flowStep.triggerType') : - formatMessage('flowStep.actionType') - } + {isTrigger + ? formatMessage('flowStep.triggerType') + : formatMessage('flowStep.actionType')} @@ -71,7 +80,10 @@ export default function ExecutionStep(props: ExecutionStepProps): React.ReactEle - setActiveTabIndex(tabIndex)}> + setActiveTabIndex(tabIndex)} + > @@ -90,7 +102,6 @@ export default function ExecutionStep(props: ExecutionStepProps): React.ReactEle - - ) -}; + ); +} diff --git a/packages/web/src/components/ExecutionStep/style.ts b/packages/web/src/components/ExecutionStep/style.ts index 7a7ffaf3..5d8a87a6 100644 --- a/packages/web/src/components/ExecutionStep/style.ts +++ b/packages/web/src/components/ExecutionStep/style.ts @@ -27,15 +27,17 @@ export const Wrapper = styled(Card)` type HeaderProps = { collapsed?: boolean; -} +}; -export const Header = styled('div', { shouldForwardProp: prop => prop !== 'collapsed' })` +export const Header = styled('div', { + shouldForwardProp: (prop) => prop !== 'collapsed', +})` padding: ${({ theme }) => theme.spacing(2)}; - cursor: ${({ collapsed }) => collapsed ? 'pointer' : 'unset'}; + cursor: ${({ collapsed }) => (collapsed ? 'pointer' : 'unset')}; `; export const Content = styled('div')` - border: 1px solid ${({ theme }) => alpha(theme.palette.divider, .8)}; + border: 1px solid ${({ theme }) => alpha(theme.palette.divider, 0.8)}; border-left: none; border-right: none; padding: ${({ theme }) => theme.spacing(2, 0)}; diff --git a/packages/web/src/components/FlowAppIcons/index.tsx b/packages/web/src/components/FlowAppIcons/index.tsx index 77c1d117..c71329e6 100644 --- a/packages/web/src/components/FlowAppIcons/index.tsx +++ b/packages/web/src/components/FlowAppIcons/index.tsx @@ -6,7 +6,7 @@ import IntermediateStepCount from 'components/IntermediateStepCount'; type FlowAppIconsProps = { steps: Partial[]; -} +}; export default function FlowAppIcons(props: FlowAppIconsProps) { const { steps } = props; @@ -24,14 +24,18 @@ export default function FlowAppIcons(props: FlowAppIconsProps) { sx={{ width: 30, height: 30 }} /> - {intermeaditeStepCount > 0 && } + {intermeaditeStepCount > 0 && ( + + )} - {lastStep && } + {lastStep && ( + + )} - ) -}; + ); +} diff --git a/packages/web/src/components/FlowContextMenu/index.tsx b/packages/web/src/components/FlowContextMenu/index.tsx index 9b03a4db..b1e6a899 100644 --- a/packages/web/src/components/FlowContextMenu/index.tsx +++ b/packages/web/src/components/FlowContextMenu/index.tsx @@ -16,7 +16,9 @@ type ContextMenuProps = { anchorEl: PopoverProps['anchorEl']; }; -export default function ContextMenu(props: ContextMenuProps): React.ReactElement { +export default function ContextMenu( + props: ContextMenuProps +): React.ReactElement { const { flowId, onClose, anchorEl } = props; const { enqueueSnackbar } = useSnackbar(); const [deleteFlow] = useMutation(DELETE_FLOW); @@ -34,10 +36,12 @@ export default function ContextMenu(props: ContextMenuProps): React.ReactElement cache.evict({ id: flowCacheId, }); - } + }, }); - enqueueSnackbar(formatMessage('flow.successfullyDeleted'), { variant: 'success' }); + enqueueSnackbar(formatMessage('flow.successfullyDeleted'), { + variant: 'success', + }); }, [flowId, deleteFlow]); return ( @@ -47,16 +51,11 @@ export default function ContextMenu(props: ContextMenuProps): React.ReactElement hideBackdrop={false} anchorEl={anchorEl} > - + {formatMessage('flow.view')} - - {formatMessage('flow.delete')} - + {formatMessage('flow.delete')} ); -}; +} diff --git a/packages/web/src/components/FlowRow/index.tsx b/packages/web/src/components/FlowRow/index.tsx index 2cf69943..e1504d9a 100644 --- a/packages/web/src/components/FlowRow/index.tsx +++ b/packages/web/src/components/FlowRow/index.tsx @@ -16,12 +16,14 @@ import { Apps, CardContent, ContextMenu, Title, Typography } from './style'; type FlowRowProps = { flow: IFlow; -} +}; export default function FlowRow(props: FlowRowProps): React.ReactElement { const formatMessage = useFormatMessage(); - const contextButtonRef = React.useRef(null); - const [anchorEl, setAnchorEl] = React.useState(null); + const contextButtonRef = React.useRef(null); + const [anchorEl, setAnchorEl] = React.useState( + null + ); const { flow } = props; const handleClose = () => { @@ -32,7 +34,7 @@ export default function FlowRow(props: FlowRowProps): React.ReactElement { event.stopPropagation(); event.nativeEvent.stopImmediatePropagation(); setAnchorEl(contextButtonRef.current); - } + }; const createdAt = DateTime.fromMillis(parseInt(flow.createdAt, 10)); const updatedAt = DateTime.fromMillis(parseInt(flow.updatedAt, 10)); @@ -45,7 +47,7 @@ export default function FlowRow(props: FlowRowProps): React.ReactElement { - + @@ -53,15 +55,21 @@ export default function FlowRow(props: FlowRowProps): React.ReactElement { justifyContent="center" alignItems="flex-start" spacing={1} - sx={{gridArea:"title"}} + sx={{ gridArea: 'title' }} > {flow?.name} - {isUpdated && formatMessage('flow.updatedAt', { datetime: relativeUpdatedAt })} - {!isUpdated && formatMessage('flow.createdAt', { datetime: relativeCreatedAt })} + {isUpdated && + formatMessage('flow.updatedAt', { + datetime: relativeUpdatedAt, + })} + {!isUpdated && + formatMessage('flow.createdAt', { + datetime: relativeCreatedAt, + })} @@ -69,8 +77,10 @@ export default function FlowRow(props: FlowRowProps): React.ReactElement { - {anchorEl && } + {anchorEl && ( + + )} ); } diff --git a/packages/web/src/components/FlowRow/style.ts b/packages/web/src/components/FlowRow/style.ts index 608d1a16..a9c63728 100644 --- a/packages/web/src/components/FlowRow/style.ts +++ b/packages/web/src/components/FlowRow/style.ts @@ -20,7 +20,7 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ `, gridTemplateColumns: 'minmax(0, auto) min-content', gridTemplateRows: 'auto auto', - } + }, })); export const Apps = styled(MuiStack)(() => ({ @@ -46,5 +46,5 @@ export const Typography = styled(MuiTypography)(() => ({ export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({ [theme.breakpoints.down('sm')]: { display: 'none', - } + }, })); diff --git a/packages/web/src/components/FlowStep/index.tsx b/packages/web/src/components/FlowStep/index.tsx index a30ff26b..c78757ae 100644 --- a/packages/web/src/components/FlowStep/index.tsx +++ b/packages/web/src/components/FlowStep/index.tsx @@ -13,7 +13,13 @@ import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import { yupResolver } from '@hookform/resolvers/yup'; import * as yup from 'yup'; import type { BaseSchema } from 'yup'; -import type { IApp, ITrigger, IAction, IStep, ISubstep } from '@automatisch/types'; +import type { + IApp, + ITrigger, + IAction, + IStep, + ISubstep, +} from '@automatisch/types'; import { EditorContext } from 'contexts/Editor'; import { StepExecutionsProvider } from 'contexts/StepExecutions'; @@ -49,53 +55,63 @@ const validIcon = ; const errorIcon = ; function generateValidationSchema(substeps: ISubstep[]) { - const fieldValidations = substeps?.reduce((allValidations, { arguments: args }) => { - if (!args || !Array.isArray(args)) return allValidations; + const fieldValidations = substeps?.reduce( + (allValidations, { arguments: args }) => { + if (!args || !Array.isArray(args)) return allValidations; - const substepArgumentValidations: Record = {}; + const substepArgumentValidations: Record = {}; - for (const arg of args) { - const { key, required, dependsOn } = arg; + for (const arg of args) { + const { key, required, dependsOn } = arg; - // base validation for the field if not exists - if (!substepArgumentValidations[key]) { - substepArgumentValidations[key] = yup.mixed(); - } - - if (typeof substepArgumentValidations[key] === 'object') { - // if the field is required, add the required validation - if (required) { - substepArgumentValidations[key] = substepArgumentValidations[key].required(`${key} is required.`); + // base validation for the field if not exists + if (!substepArgumentValidations[key]) { + substepArgumentValidations[key] = yup.mixed(); } - // if the field depends on another field, add the dependsOn required validation - if (Array.isArray(dependsOn) && dependsOn.length > 0) { - for (const dependsOnKey of dependsOn) { - const missingDependencyValueMessage = `We're having trouble loading '${key}' data as required field '${dependsOnKey}' is missing.`; + if (typeof substepArgumentValidations[key] === 'object') { + // if the field is required, add the required validation + if (required) { + substepArgumentValidations[key] = substepArgumentValidations[ + key + ].required(`${key} is required.`); + } - // TODO: make `dependsOnKey` agnostic to the field. However, nested validation schema is not supported. - // So the fields under the `parameters` key are subject to their siblings only and thus, `parameters.` is removed. - substepArgumentValidations[key] = substepArgumentValidations[key].when(`${dependsOnKey.replace('parameters.', '')}`, { - is: (value: string) => Boolean(value) === false, - then: (schema) => schema.notOneOf([''], missingDependencyValueMessage).required(missingDependencyValueMessage), - }); + // if the field depends on another field, add the dependsOn required validation + if (Array.isArray(dependsOn) && dependsOn.length > 0) { + for (const dependsOnKey of dependsOn) { + const missingDependencyValueMessage = `We're having trouble loading '${key}' data as required field '${dependsOnKey}' is missing.`; + + // TODO: make `dependsOnKey` agnostic to the field. However, nested validation schema is not supported. + // So the fields under the `parameters` key are subject to their siblings only and thus, `parameters.` is removed. + substepArgumentValidations[key] = substepArgumentValidations[ + key + ].when(`${dependsOnKey.replace('parameters.', '')}`, { + is: (value: string) => Boolean(value) === false, + then: (schema) => + schema + .notOneOf([''], missingDependencyValueMessage) + .required(missingDependencyValueMessage), + }); + } } } } - } - return { - ...allValidations, - ...substepArgumentValidations, - } - }, {}); + return { + ...allValidations, + ...substepArgumentValidations, + }; + }, + {} + ); const validationSchema = yup.object({ parameters: yup.object(fieldValidations), }); return yupResolver(validationSchema); -}; +} export default function FlowStep( props: FlowStepProps @@ -140,10 +156,12 @@ export default function FlowStep( const apps: IApp[] = data?.getApps; const app = apps?.find((currentApp: IApp) => currentApp.key === step.appKey); - const actionsOrTriggers: Array = (isTrigger ? app?.triggers : app?.actions) || []; + const actionsOrTriggers: Array = + (isTrigger ? app?.triggers : app?.actions) || []; const substeps = React.useMemo( () => - actionsOrTriggers?.find(({ key }: ITrigger | IAction) => key === step.key)?.substeps || [], + actionsOrTriggers?.find(({ key }: ITrigger | IAction) => key === step.key) + ?.substeps || [], [actionsOrTriggers, step?.key] ); @@ -159,7 +177,10 @@ export default function FlowStep( handleChange({ step: val as IStep }); }; - const stepValidationSchema = React.useMemo(() => generateValidationSchema(substeps), [substeps]); + const stepValidationSchema = React.useMemo( + () => generateValidationSchema(substeps), + [substeps] + ); if (!apps) return null; @@ -183,7 +204,11 @@ export default function FlowStep( step.status === 'completed' ? validIcon : errorIcon; return ( - +
@@ -236,7 +261,11 @@ export default function FlowStep( > toggleSubstep(0)} onCollapse={() => toggleSubstep(0)} onSubmit={expandNextStep} @@ -245,40 +274,38 @@ export default function FlowStep( /> {substeps?.length > 0 && - substeps.map( - ( - substep: ISubstep, - index: number - ) => ( - - {substep.key === 'chooseConnection' && app && ( - toggleSubstep(index + 1)} - onCollapse={() => toggleSubstep(index + 1)} - onSubmit={expandNextStep} - onChange={handleChange} - application={app} - step={step} - /> - )} + substeps.map((substep: ISubstep, index: number) => ( + + {substep.key === 'chooseConnection' && app && ( + toggleSubstep(index + 1)} + onCollapse={() => toggleSubstep(index + 1)} + onSubmit={expandNextStep} + onChange={handleChange} + application={app} + step={step} + /> + )} - {substep.key === 'testStep' && ( - toggleSubstep(index + 1)} - onCollapse={() => toggleSubstep(index + 1)} - onSubmit={expandNextStep} - onChange={handleChange} - onContinue={onContinue} - step={step} - /> - )} + {substep.key === 'testStep' && ( + toggleSubstep(index + 1)} + onCollapse={() => toggleSubstep(index + 1)} + onSubmit={expandNextStep} + onChange={handleChange} + onContinue={onContinue} + step={step} + /> + )} - {substep.key && ['chooseConnection', 'testStep'].includes(substep.key) === - false && ( + {substep.key && + ['chooseConnection', 'testStep'].includes( + substep.key + ) === false && ( )} - - ) - )} + + ))} diff --git a/packages/web/src/components/FlowStep/style.ts b/packages/web/src/components/FlowStep/style.ts index 7a7ffaf3..5d8a87a6 100644 --- a/packages/web/src/components/FlowStep/style.ts +++ b/packages/web/src/components/FlowStep/style.ts @@ -27,15 +27,17 @@ export const Wrapper = styled(Card)` type HeaderProps = { collapsed?: boolean; -} +}; -export const Header = styled('div', { shouldForwardProp: prop => prop !== 'collapsed' })` +export const Header = styled('div', { + shouldForwardProp: (prop) => prop !== 'collapsed', +})` padding: ${({ theme }) => theme.spacing(2)}; - cursor: ${({ collapsed }) => collapsed ? 'pointer' : 'unset'}; + cursor: ${({ collapsed }) => (collapsed ? 'pointer' : 'unset')}; `; export const Content = styled('div')` - border: 1px solid ${({ theme }) => alpha(theme.palette.divider, .8)}; + border: 1px solid ${({ theme }) => alpha(theme.palette.divider, 0.8)}; border-left: none; border-right: none; padding: ${({ theme }) => theme.spacing(2, 0)}; diff --git a/packages/web/src/components/FlowStepContextMenu/index.tsx b/packages/web/src/components/FlowStepContextMenu/index.tsx index 3016e348..5fcd8a4c 100644 --- a/packages/web/src/components/FlowStepContextMenu/index.tsx +++ b/packages/web/src/components/FlowStepContextMenu/index.tsx @@ -14,19 +14,22 @@ type FlowStepContextMenuProps = { deletable: boolean; }; -function FlowStepContextMenu(props: FlowStepContextMenuProps): React.ReactElement { +function FlowStepContextMenu( + props: FlowStepContextMenuProps +): React.ReactElement { const { stepId, onClose, anchorEl, deletable } = props; const [deleteStep] = useMutation(DELETE_STEP, { - refetchQueries: [ - 'GetFlow' - ] + refetchQueries: ['GetFlow'], }); const formatMessage = useFormatMessage(); - const deleteActionHandler = React.useCallback(async (event: React.SyntheticEvent) => { - event.stopPropagation(); - await deleteStep({ variables: { input: { id: stepId } } }); - }, [stepId]); + const deleteActionHandler = React.useCallback( + async (event: React.SyntheticEvent) => { + event.stopPropagation(); + await deleteStep({ variables: { input: { id: stepId } } }); + }, + [stepId] + ); return ( - {deletable && - {formatMessage('connection.delete')} - } + {deletable && ( + + {formatMessage('connection.delete')} + + )} ); -}; +} export default FlowStepContextMenu; diff --git a/packages/web/src/components/FlowSubstep/index.tsx b/packages/web/src/components/FlowSubstep/index.tsx index b4d9b404..c0aa1c23 100644 --- a/packages/web/src/components/FlowSubstep/index.tsx +++ b/packages/web/src/components/FlowSubstep/index.tsx @@ -11,7 +11,7 @@ import InputCreator from 'components/InputCreator'; import type { IField, IStep, ISubstep } from '@automatisch/types'; type FlowSubstepProps = { - substep: ISubstep, + substep: ISubstep; expanded?: boolean; onExpand: () => void; onCollapse: () => void; @@ -25,8 +25,10 @@ const validateSubstep = (substep: ISubstep, step: IStep) => { const args: IField[] = substep.arguments || []; - return args.every(arg => { - if (arg.required === false) { return true; } + return args.every((arg) => { + if (arg.required === false) { + return true; + } const argValue = step.parameters?.[arg.key]; @@ -47,20 +49,19 @@ function FlowSubstep(props: FlowSubstepProps): React.ReactElement { step, } = props; - const { - name, - arguments: args, - } = substep; + const { name, arguments: args } = substep; const editorContext = React.useContext(EditorContext); const formContext = useFormContext(); - const [validationStatus, setValidationStatus] = React.useState(validateSubstep(substep, formContext.getValues() as IStep)); + const [validationStatus, setValidationStatus] = React.useState< + boolean | null + >(validateSubstep(substep, formContext.getValues() as IStep)); React.useEffect(() => { - function validate (step: unknown) { + function validate(step: unknown) { const validationResult = validateSubstep(substep, step as IStep); setValidationStatus(validationResult); - }; + } const subscription = formContext.watch(validate); return () => subscription.unsubscribe(); @@ -77,11 +78,15 @@ function FlowSubstep(props: FlowSubstepProps): React.ReactElement { valid={validationStatus} /> - - + + {args?.map((argument) => ( ); -}; +} export default FlowSubstep; diff --git a/packages/web/src/components/FlowSubstepTitle/index.tsx b/packages/web/src/components/FlowSubstepTitle/index.tsx index 7ce4dc47..66bc5414 100644 --- a/packages/web/src/components/FlowSubstepTitle/index.tsx +++ b/packages/web/src/components/FlowSubstepTitle/index.tsx @@ -4,7 +4,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ErrorIcon from '@mui/icons-material/Error'; import CheckCircleIcon from '@mui/icons-material/CheckCircle'; -import { ListItemButton, Typography} from './style'; +import { ListItemButton, Typography } from './style'; type FlowSubstepTitleProps = { expanded?: boolean; @@ -17,12 +17,7 @@ const validIcon = ; const errorIcon = ; function FlowSubstepTitle(props: FlowSubstepTitleProps): React.ReactElement { - const { - expanded = false, - onClick = () => null, - valid = null, - title, - } = props; + const { expanded = false, onClick = () => null, valid = null, title } = props; const hasValidation = valid !== null; const validationStatusIcon = valid ? validIcon : errorIcon; diff --git a/packages/web/src/components/Form/index.tsx b/packages/web/src/components/Form/index.tsx index 053c52de..1a1124a1 100644 --- a/packages/web/src/components/Form/index.tsx +++ b/packages/web/src/components/Form/index.tsx @@ -1,5 +1,12 @@ import * as React from 'react'; -import { FormProvider, useForm, useWatch, FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form'; +import { + FormProvider, + useForm, + useWatch, + FieldValues, + SubmitHandler, + UseFormReturn, +} from 'react-hook-form'; import type { UseFormProps } from 'react-hook-form'; type FormProps = { @@ -7,8 +14,8 @@ type FormProps = { defaultValues?: UseFormProps['defaultValues']; onSubmit?: SubmitHandler; render?: (props: UseFormReturn) => React.ReactNode; - resolver?: UseFormProps["resolver"]; - mode?: UseFormProps["mode"]; + resolver?: UseFormProps['resolver']; + mode?: UseFormProps['mode']; }; const noop = () => null; @@ -31,7 +38,7 @@ export default function Form(props: FormProps): React.ReactElement { mode, }); - const form = useWatch({ control: methods.control, }); + const form = useWatch({ control: methods.control }); /** * For fields having `dependsOn` fields, we need to re-validate the form. @@ -51,4 +58,4 @@ export default function Form(props: FormProps): React.ReactElement { ); -}; +} diff --git a/packages/web/src/components/HideOnScroll/index.tsx b/packages/web/src/components/HideOnScroll/index.tsx index c2b1287e..02fb8bad 100644 --- a/packages/web/src/components/HideOnScroll/index.tsx +++ b/packages/web/src/components/HideOnScroll/index.tsx @@ -5,7 +5,5 @@ import useScrollTrigger from '@mui/material/useScrollTrigger'; export default function HideOnScroll(props: SlideProps): React.ReactElement { const trigger = useScrollTrigger(); - return ( - - ); -}; + return ; +} diff --git a/packages/web/src/components/InputCreator/index.tsx b/packages/web/src/components/InputCreator/index.tsx index 5c19f53a..0115816a 100644 --- a/packages/web/src/components/InputCreator/index.tsx +++ b/packages/web/src/components/InputCreator/index.tsx @@ -21,17 +21,13 @@ type RawOption = { value: string; }; -const optionGenerator = (options: RawOption[]): IFieldDropdownOption[] => options?.map(({ name, value }) => ({ label: name as string, value: value })); +const optionGenerator = (options: RawOption[]): IFieldDropdownOption[] => + options?.map(({ name, value }) => ({ label: name as string, value: value })); -export default function InputCreator(props: InputCreatorProps): React.ReactElement { - const { - onChange, - onBlur, - schema, - namePrefix, - stepId, - disabled, - } = props; +export default function InputCreator( + props: InputCreatorProps +): React.ReactElement { + const { onChange, onBlur, schema, namePrefix, stepId, disabled } = props; const { key: name, @@ -101,5 +97,5 @@ export default function InputCreator(props: InputCreatorProps): React.ReactEleme ); } - return () -}; + return ; +} diff --git a/packages/web/src/components/IntermediateStepCount/index.tsx b/packages/web/src/components/IntermediateStepCount/index.tsx index 554d2f78..b1efeb0e 100644 --- a/packages/web/src/components/IntermediateStepCount/index.tsx +++ b/packages/web/src/components/IntermediateStepCount/index.tsx @@ -5,16 +5,18 @@ import { Container } from './style'; type IntermediateStepCountProps = { count: number; -} +}; -export default function IntermediateStepCount(props: IntermediateStepCountProps) { +export default function IntermediateStepCount( + props: IntermediateStepCountProps +) { const { count } = props; return ( - + +{count} ); -} \ No newline at end of file +} diff --git a/packages/web/src/components/IntlProvider/index.tsx b/packages/web/src/components/IntlProvider/index.tsx index 62bafb34..2643293d 100644 --- a/packages/web/src/components/IntlProvider/index.tsx +++ b/packages/web/src/components/IntlProvider/index.tsx @@ -7,7 +7,11 @@ type IntlProviderProps = { const IntlProvider = ({ children }: IntlProviderProps): React.ReactElement => { return ( - + {children} ); diff --git a/packages/web/src/components/JSONViewer/index.tsx b/packages/web/src/components/JSONViewer/index.tsx index 6fa216d3..5faa5c18 100644 --- a/packages/web/src/components/JSONViewer/index.tsx +++ b/packages/web/src/components/JSONViewer/index.tsx @@ -4,7 +4,7 @@ import type { IJSONObject } from '@automatisch/types'; type JSONViewerProps = { data: IJSONObject; -} +}; const theme = { scheme: 'inspector', diff --git a/packages/web/src/components/JSONViewer/style.tsx b/packages/web/src/components/JSONViewer/style.tsx index 0e3d5ad9..1e9244c0 100644 --- a/packages/web/src/components/JSONViewer/style.tsx +++ b/packages/web/src/components/JSONViewer/style.tsx @@ -1,29 +1,35 @@ import GlobalStyles from '@mui/material/GlobalStyles'; -export const jsonViewerStyles = ( ({ - 'json-viewer': { - '--background-color': 'transparent', - '--font-family': 'monaco, Consolas, Lucida Console, monospace', - '--font-size': '1rem', - '--indent-size': '1.5em', - '--indentguide-size': '1px', - '--indentguide-style': 'solid', - '--indentguide-color': theme.palette.text.primary, - '--indentguide-color-active': '#666', - '--indentguide': 'var(--indentguide-size) var(--indentguide-style) var(--indentguide-color)', - '--indentguide-active': 'var(--indentguide-size) var(--indentguide-style) var(--indentguide-color-active)', +export const jsonViewerStyles = ( + ({ + 'json-viewer': { + '--background-color': 'transparent', + '--font-family': 'monaco, Consolas, Lucida Console, monospace', + '--font-size': '1rem', + '--indent-size': '1.5em', + '--indentguide-size': '1px', + '--indentguide-style': 'solid', + '--indentguide-color': theme.palette.text.primary, + '--indentguide-color-active': '#666', + '--indentguide': + 'var(--indentguide-size) var(--indentguide-style) var(--indentguide-color)', + '--indentguide-active': + 'var(--indentguide-size) var(--indentguide-style) var(--indentguide-color-active)', - /* Types colors */ - '--string-color': theme.palette.text.secondary, - '--number-color': theme.palette.text.primary, - '--boolean-color': theme.palette.text.primary, - '--null-color': theme.palette.text.primary, - '--property-color': theme.palette.text.primary, + /* Types colors */ + '--string-color': theme.palette.text.secondary, + '--number-color': theme.palette.text.primary, + '--boolean-color': theme.palette.text.primary, + '--null-color': theme.palette.text.primary, + '--property-color': theme.palette.text.primary, - /* Collapsed node preview */ - '--preview-color': theme.palette.text.primary, + /* Collapsed node preview */ + '--preview-color': theme.palette.text.primary, - /* Search highlight color */ - '--highlight-color': '#6fb3d2', - } -})} />) + /* Search highlight color */ + '--highlight-color': '#6fb3d2', + }, + })} + /> +); diff --git a/packages/web/src/components/Layout/index.tsx b/packages/web/src/components/Layout/index.tsx index b89beaef..05e3838c 100644 --- a/packages/web/src/components/Layout/index.tsx +++ b/packages/web/src/components/Layout/index.tsx @@ -15,7 +15,7 @@ import Drawer from 'components/Drawer'; type PublicLayoutProps = { children: React.ReactNode; -} +}; const drawerLinks = [ { @@ -45,12 +45,16 @@ const generateDrawerBottomLinks = ({ notificationBadgeContent = 0 }) => [ to: URLS.UPDATES, badgeContent: notificationBadgeContent, }, -] +]; -export default function PublicLayout({ children }: PublicLayoutProps): React.ReactElement { +export default function PublicLayout({ + children, +}: PublicLayoutProps): React.ReactElement { const version = useVersion(); const theme = useTheme(); - const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'), { noSsr: true }); + const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'), { + noSsr: true, + }); const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens); const openDrawer = () => setDrawerOpen(true); @@ -62,9 +66,13 @@ export default function PublicLayout({ children }: PublicLayoutProps): React.Rea return ( <> - + - + - + {children} diff --git a/packages/web/src/components/ListItemLink/index.tsx b/packages/web/src/components/ListItemLink/index.tsx index 5d4b7aca..e6b8744d 100644 --- a/packages/web/src/components/ListItemLink/index.tsx +++ b/packages/web/src/components/ListItemLink/index.tsx @@ -11,21 +11,22 @@ type ListItemLinkProps = { to: string; onClick?: (event: React.SyntheticEvent) => void; 'data-test'?: string; -} +}; -export default function ListItemLink(props: ListItemLinkProps): React.ReactElement { +export default function ListItemLink( + props: ListItemLinkProps +): React.ReactElement { const { icon, primary, to, onClick, 'data-test': dataTest } = props; const selected = useMatch({ path: to, end: true }); const CustomLink = React.useMemo( () => - React.forwardRef>(function InLineLink( - linkProps, - ref, - ) { - return ; - }), - [to], + React.forwardRef>( + function InLineLink(linkProps, ref) { + return ; + } + ), + [to] ); return ( @@ -38,8 +39,11 @@ export default function ListItemLink(props: ListItemLinkProps): React.ReactEleme data-test={dataTest} > {icon} - + ); -}; +} diff --git a/packages/web/src/components/LoginForm/index.tsx b/packages/web/src/components/LoginForm/index.tsx index e9c0004d..1fec7ab2 100644 --- a/packages/web/src/components/LoginForm/index.tsx +++ b/packages/web/src/components/LoginForm/index.tsx @@ -11,7 +11,6 @@ import { LOGIN } from 'graphql/mutations/login'; import Form from 'components/Form'; import TextField from 'components/TextField'; - function renderFields(props: { loading: boolean }) { const { loading = false } = props; @@ -52,7 +51,7 @@ function renderFields(props: { loading: boolean }) { ); - } + }; } function LoginForm() { @@ -69,7 +68,7 @@ function LoginForm() { const handleSubmit = async (values: any) => { const { data } = await login({ variables: { - input: values + input: values, }, }); @@ -85,14 +84,20 @@ function LoginForm() { theme.palette.text.disabled, pb: 2, mb: 2 }} - gutterBottom> + sx={{ + borderBottom: '1px solid', + borderColor: (theme) => theme.palette.text.disabled, + pb: 2, + mb: 2, + }} + gutterBottom + > Login
); -}; +} export default LoginForm; diff --git a/packages/web/src/components/NoResultFound/index.tsx b/packages/web/src/components/NoResultFound/index.tsx index 1ed981d0..4a3a7100 100644 --- a/packages/web/src/components/NoResultFound/index.tsx +++ b/packages/web/src/components/NoResultFound/index.tsx @@ -10,22 +10,23 @@ import { CardContent } from './style'; type NoResultFoundProps = { text?: string; to?: string; -} +}; -export default function NoResultFound(props: NoResultFoundProps): React.ReactElement { +export default function NoResultFound( + props: NoResultFoundProps +): React.ReactElement { const { text, to } = props; const ActionAreaLink = React.useMemo( () => - React.forwardRef>(function InlineLink( - linkProps, - ref, - ) { - if (!to) return
{linkProps.children}
; + React.forwardRef>( + function InlineLink(linkProps, ref) { + if (!to) return
{linkProps.children}
; - return ; - }), - [to], + return ; + } + ), + [to] ); return ( @@ -34,11 +35,9 @@ export default function NoResultFound(props: NoResultFoundProps): React.ReactEle {!!to && } - - {text} - + {text} - ) -}; + ); +} diff --git a/packages/web/src/components/NoResultFound/style.ts b/packages/web/src/components/NoResultFound/style.ts index eedbaff9..9f0f61be 100644 --- a/packages/web/src/components/NoResultFound/style.ts +++ b/packages/web/src/components/NoResultFound/style.ts @@ -8,4 +8,4 @@ export const CardContent = styled(MuiCardContent)` flex-direction: column; gap: ${({ theme }) => theme.spacing(2)}; min-height: 200px; -`; \ No newline at end of file +`; diff --git a/packages/web/src/components/NotificationCard/index.tsx b/packages/web/src/components/NotificationCard/index.tsx index bf77f6c6..51dbeddf 100644 --- a/packages/web/src/components/NotificationCard/index.tsx +++ b/packages/web/src/components/NotificationCard/index.tsx @@ -15,32 +15,26 @@ interface NotificationCardProps { description: string; } -const getHumanlyDate = (timestamp: number) => DateTime.fromMillis(timestamp).toRelative(); +const getHumanlyDate = (timestamp: number) => + DateTime.fromMillis(timestamp).toRelative(); export default function NotificationCard(props: NotificationCardProps) { - const { - name, - createdAt, - documentationUrl, - description, - } = props; + const { name, createdAt, documentationUrl, description } = props; const formatMessage = useFormatMessage(); - const relativeCreatedAt = getHumanlyDate((new Date(createdAt)).getTime()); - const subheader = formatMessage('notification.releasedAt', { relativeDate: relativeCreatedAt }); + const relativeCreatedAt = getHumanlyDate(new Date(createdAt).getTime()); + const subheader = formatMessage('notification.releasedAt', { + relativeDate: relativeCreatedAt, + }); return ( - + diff --git a/packages/web/src/components/PageTitle/index.tsx b/packages/web/src/components/PageTitle/index.tsx index ca9eb530..ca643b48 100644 --- a/packages/web/src/components/PageTitle/index.tsx +++ b/packages/web/src/components/PageTitle/index.tsx @@ -4,7 +4,5 @@ import Typography, { TypographyProps } from '@mui/material/Typography'; type PageTitleProps = TypographyProps; export default function PageTitle(props: PageTitleProps): React.ReactElement { - return ( - - ); -} \ No newline at end of file + return ; +} diff --git a/packages/web/src/components/Portal/index.tsx b/packages/web/src/components/Portal/index.tsx index 94e1a2e1..4e792293 100644 --- a/packages/web/src/components/Portal/index.tsx +++ b/packages/web/src/components/Portal/index.tsx @@ -1,4 +1,4 @@ -import * as React from 'react' +import * as React from 'react'; import ReactDOM from 'react-dom'; type PortalProps = { @@ -8,7 +8,7 @@ type PortalProps = { const Portal = ({ children }: PortalProps) => { return typeof document === 'object' ? ReactDOM.createPortal(children, document.body) - : null -} + : null; +}; export default Portal; diff --git a/packages/web/src/components/PowerInput/index.tsx b/packages/web/src/components/PowerInput/index.tsx index b5905c83..701cb6f9 100644 --- a/packages/web/src/components/PowerInput/index.tsx +++ b/packages/web/src/components/PowerInput/index.tsx @@ -6,12 +6,7 @@ import InputLabel from '@mui/material/InputLabel'; import FormHelperText from '@mui/material/FormHelperText'; import { Controller, useFormContext } from 'react-hook-form'; import { Editor, Transforms, Range, createEditor } from 'slate'; -import { - Slate, - Editable, - useSelected, - useFocused, -} from 'slate-react'; +import { Slate, Editable, useSelected, useFocused } from 'slate-react'; import { serialize, @@ -39,7 +34,7 @@ type PowerInputProps = { docUrl?: string; clickToCopy?: boolean; disabled?: boolean; -} +}; const PowerInput = (props: PowerInputProps) => { const { control } = useFormContext(); @@ -54,21 +49,28 @@ const PowerInput = (props: PowerInputProps) => { } = props; const priorStepsWithExecutions = React.useContext(StepExecutionsContext); const editorRef = React.useRef(null); - const renderElement = React.useCallback(props => , []); + const renderElement = React.useCallback( + (props) => , + [] + ); const [editor] = React.useState(() => customizeEditor(createEditor())); - const [showVariableSuggestions, setShowVariableSuggestions] = React.useState(false); + const [showVariableSuggestions, setShowVariableSuggestions] = + React.useState(false); const stepsWithVariables = React.useMemo(() => { return processStepWithExecutions(priorStepsWithExecutions); - }, [priorStepsWithExecutions]) + }, [priorStepsWithExecutions]); - const handleBlur = React.useCallback((value) => { - onBlur?.(value); - }, [onBlur]); + const handleBlur = React.useCallback( + (value) => { + onBlur?.(value); + }, + [onBlur] + ); const handleVariableSuggestionClick = React.useCallback( - (variable: Pick) => { - insertVariable(editor, variable, stepsWithVariables); + (variable: Pick) => { + insertVariable(editor, variable, stepsWithVariables); }, [stepsWithVariables] ); @@ -80,17 +82,25 @@ const PowerInput = (props: PowerInputProps) => { control={control} defaultValue={defaultValue} shouldUnregister={false} - render={({ field: { value, onChange: controllerOnChange, onBlur: controllerOnBlur, } }) => ( + render={({ + field: { + value, + onChange: controllerOnChange, + onBlur: controllerOnBlur, + }, + }) => ( { + onChange={(value) => { controllerOnChange(serialize(value)); }} > { setShowVariableSuggestions(false); }} + onClickAway={() => { + setShowVariableSuggestions(false); + }} > {/* ref-able single child for ClickAwayListener */}
@@ -100,7 +110,7 @@ const PowerInput = (props: PowerInputProps) => { shrink={true} disabled={disabled} variant="outlined" - sx={{ bgcolor: 'white', display: 'inline-block', px: .75 }} + sx={{ bgcolor: 'white', display: 'inline-block', px: 0.75 }} > {label} @@ -113,17 +123,16 @@ const PowerInput = (props: PowerInputProps) => { onFocus={() => { setShowVariableSuggestions(true); }} - onBlur={() => { controllerOnBlur(); handleBlur(value); }} + onBlur={() => { + controllerOnBlur(); + handleBlur(value); + }} /> {/* ghost placer for the variables popover */}
- - {description} - + {description} { )} /> - ) -} + ); +}; const SuggestionsPopper = (props: any) => { - const { - open, - anchorEl, - data, - onSuggestionClick, - } = props; + const { open, anchorEl, data, onSuggestionClick } = props; return ( - + ); }; @@ -178,9 +179,9 @@ const Element = (props: any) => { default: return

{children}

; } -} +}; -const Variable = ({ attributes, children, element }: any) => { +const Variable = ({ attributes, children, element }: any) => { const selected = useSelected(); const focused = useFocused(); const label = ( @@ -200,7 +201,7 @@ const Variable = ({ attributes, children, element }: any) => { size="small" label={label} /> - ) -} + ); +}; export default PowerInput; diff --git a/packages/web/src/components/PowerInput/style.ts b/packages/web/src/components/PowerInput/style.ts index 1df5f29e..52373108 100644 --- a/packages/web/src/components/PowerInput/style.ts +++ b/packages/web/src/components/PowerInput/style.ts @@ -7,17 +7,21 @@ export const InputLabelWrapper = styled('div')` left: -6px; `; -export const FakeInput = styled('div', { shouldForwardProp: prop => prop !== 'disabled'})<{ disabled?: boolean }>` +export const FakeInput = styled('div', { + shouldForwardProp: (prop) => prop !== 'disabled', +})<{ disabled?: boolean }>` border: 1px solid #eee; min-height: 52px; width: 100%; display: block; padding: ${({ theme }) => theme.spacing(0, 1.75)}; - border-radius: ${({ theme }) => theme.spacing(.5)}; + border-radius: ${({ theme }) => theme.spacing(0.5)}; border-color: rgba(0, 0, 0, 0.23); position: relative; - ${({ disabled, theme }) => !!disabled && ` + ${({ disabled, theme }) => + !!disabled && + ` color: ${theme.palette.action.disabled}, border-color: ${theme.palette.action.disabled}, `} diff --git a/packages/web/src/components/PowerInput/types.ts b/packages/web/src/components/PowerInput/types.ts index 3fb2b1e4..859730c6 100644 --- a/packages/web/src/components/PowerInput/types.ts +++ b/packages/web/src/components/PowerInput/types.ts @@ -6,7 +6,7 @@ export type VariableElement = { value?: unknown; name?: string; children: Text[]; -} +}; export type ParagraphElement = { type: 'paragraph'; diff --git a/packages/web/src/components/PowerInput/utils.ts b/packages/web/src/components/PowerInput/utils.ts index d60a6f7a..1a44cf53 100644 --- a/packages/web/src/components/PowerInput/utils.ts +++ b/packages/web/src/components/PowerInput/utils.ts @@ -2,13 +2,12 @@ import { Text, Descendant, Transforms } from 'slate'; import { withHistory } from 'slate-history'; import { withReact } from 'slate-react'; -import type { - CustomEditor, - CustomElement, - VariableElement, -} from './types'; +import type { CustomEditor, CustomElement, VariableElement } from './types'; -function getStepPosition(id: string, stepsWithVariables: Record[]) { +function getStepPosition( + id: string, + stepsWithVariables: Record[] +) { const stepIndex = stepsWithVariables.findIndex((stepWithVariables) => { return stepWithVariables.id === id; }); @@ -16,30 +15,42 @@ function getStepPosition(id: string, stepsWithVariables: Record return stepIndex + 1; } -function humanizeVariableName(variableName: string, stepsWithVariables: Record[]) { +function humanizeVariableName( + variableName: string, + stepsWithVariables: Record[] +) { const nameWithoutCurlies = variableName.replace(/{{|}}/g, ''); const stepId = nameWithoutCurlies.match(stepIdRegExp)?.[1] || ''; const stepPosition = getStepPosition(stepId, stepsWithVariables); - const humanizedVariableName = nameWithoutCurlies.replace(`step.${stepId}.`, `step${stepPosition}.`); + const humanizedVariableName = nameWithoutCurlies.replace( + `step.${stepId}.`, + `step${stepPosition}.` + ); return humanizedVariableName; } const variableRegExp = /({{.*?}})/; const stepIdRegExp = /^step.([\da-zA-Z-]*)/; -export const deserialize = (value: string, stepsWithVariables: any[]): Descendant[] => { - if (!value) return [{ - type: 'paragraph', - children: [{ text: '', }], - }]; +export const deserialize = ( + value: string, + stepsWithVariables: any[] +): Descendant[] => { + if (!value) + return [ + { + type: 'paragraph', + children: [{ text: '' }], + }, + ]; - return value.split('\n').map(line => { + return value.split('\n').map((line) => { const nodes = line.split(variableRegExp); if (nodes.length > 1) { return { type: 'paragraph', - children: nodes.map(node => { + children: nodes.map((node) => { if (node.match(variableRegExp)) { return { type: 'variable', @@ -52,19 +63,19 @@ export const deserialize = (value: string, stepsWithVariables: any[]): Descendan return { text: node, }; - }) + }), }; } return { type: 'paragraph', children: [{ text: line }], - } - }) + }; + }); }; export const serialize = (value: Descendant[]): string => { - return value.map(node => serializeNode(node)).join('\n'); + return value.map((node) => serializeNode(node)).join('\n'); }; const serializeNode = (node: CustomElement | Descendant): string => { @@ -76,7 +87,7 @@ const serializeNode = (node: CustomElement | Descendant): string => { return node.value as string; } - return node.children.map(n => serializeNode(n)).join(''); + return node.children.map((n) => serializeNode(n)).join(''); }; export const withVariables = (editor: CustomEditor) => { @@ -84,16 +95,20 @@ export const withVariables = (editor: CustomEditor) => { editor.isInline = (element: CustomElement) => { return element.type === 'variable' ? true : isInline(element); - } + }; editor.isVoid = (element: CustomElement) => { return element.type === 'variable' ? true : isVoid(element); - } + }; return editor; -} +}; -export const insertVariable = (editor: CustomEditor, variableData: Pick, stepsWithVariables: Record[]) => { +export const insertVariable = ( + editor: CustomEditor, + variableData: Pick, + stepsWithVariables: Record[] +) => { const variable: VariableElement = { type: 'variable', name: humanizeVariableName(variableData.name as string, stepsWithVariables), @@ -103,7 +118,7 @@ export const insertVariable = (editor: CustomEditor, variableData: Pick { return withVariables(withReact(withHistory(editor))); diff --git a/packages/web/src/components/PublicLayout/index.tsx b/packages/web/src/components/PublicLayout/index.tsx index 17832c1f..ef6a8b23 100644 --- a/packages/web/src/components/PublicLayout/index.tsx +++ b/packages/web/src/components/PublicLayout/index.tsx @@ -10,10 +10,9 @@ import { FormattedMessage } from 'react-intl'; type LayoutProps = { children: React.ReactNode; -} +}; export default function Layout({ children }: LayoutProps): React.ReactElement { - return ( <> diff --git a/packages/web/src/components/Router/index.tsx b/packages/web/src/components/Router/index.tsx index a08471de..217af656 100644 --- a/packages/web/src/components/Router/index.tsx +++ b/packages/web/src/components/Router/index.tsx @@ -1,5 +1,3 @@ -import { - BrowserRouter as Router, -} from 'react-router-dom'; +import { BrowserRouter as Router } from 'react-router-dom'; export default Router; diff --git a/packages/web/src/components/SearchInput/index.tsx b/packages/web/src/components/SearchInput/index.tsx index 16e4c029..53ffe96a 100644 --- a/packages/web/src/components/SearchInput/index.tsx +++ b/packages/web/src/components/SearchInput/index.tsx @@ -11,14 +11,14 @@ type SearchInputProps = { onChange?: (event: React.ChangeEvent) => void; }; -export default function SearchInput({ onChange }: SearchInputProps): React.ReactElement { +export default function SearchInput({ + onChange, +}: SearchInputProps): React.ReactElement { const formatMessage = useFormatMessage(); return ( - + {formatMessage('searchPlaceholder')} diff --git a/packages/web/src/components/SettingsLayout/index.tsx b/packages/web/src/components/SettingsLayout/index.tsx index e1f0cd68..7e8f1be8 100644 --- a/packages/web/src/components/SettingsLayout/index.tsx +++ b/packages/web/src/components/SettingsLayout/index.tsx @@ -12,7 +12,7 @@ import Drawer from 'components/Drawer'; type SettingsLayoutProps = { children: React.ReactNode; -} +}; const drawerLinks = [ { @@ -27,12 +27,16 @@ const drawerBottomLinks = [ Icon: ArrowBackIosNewIcon, primary: 'settingsDrawer.goBack', to: '/', - } + }, ]; -export default function SettingsLayout({ children }: SettingsLayoutProps): React.ReactElement { +export default function SettingsLayout({ + children, +}: SettingsLayoutProps): React.ReactElement { const theme = useTheme(); - const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'), { noSsr: true }); + const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'), { + noSsr: true, + }); const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens); const openDrawer = () => setDrawerOpen(true); @@ -40,9 +44,13 @@ export default function SettingsLayout({ children }: SettingsLayoutProps): React return ( <> - + - + - + {children} diff --git a/packages/web/src/components/SnackbarProvider/index.tsx b/packages/web/src/components/SnackbarProvider/index.tsx index 9e391dfe..19fcd70d 100644 --- a/packages/web/src/components/SnackbarProvider/index.tsx +++ b/packages/web/src/components/SnackbarProvider/index.tsx @@ -1,5 +1,8 @@ import * as React from 'react'; -import { SnackbarProvider as BaseSnackbarProvider, SnackbarProviderProps } from 'notistack'; +import { + SnackbarProvider as BaseSnackbarProvider, + SnackbarProviderProps, +} from 'notistack'; const SnackbarProvider = (props: SnackbarProviderProps): React.ReactElement => { return ( @@ -11,7 +14,7 @@ const SnackbarProvider = (props: SnackbarProviderProps): React.ReactElement => { }} dense /> - ) + ); }; export default SnackbarProvider; diff --git a/packages/web/src/components/TabPanel/index.tsx b/packages/web/src/components/TabPanel/index.tsx index e66bf2ae..0bceb55c 100644 --- a/packages/web/src/components/TabPanel/index.tsx +++ b/packages/web/src/components/TabPanel/index.tsx @@ -10,12 +10,8 @@ export default function TabPanel(props: TabPanelProps): React.ReactElement { const { children, value, index, ...other } = props; return ( -