style: auto format whole project
This commit is contained in:
310
LICENSE.md
310
LICENSE.md
@@ -1,178 +1,178 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
Version 3, 19 November 2007
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
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
|
software and other kinds of works, specifically designed to ensure
|
||||||
cooperation with the community in the case of network server software.
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
The licenses for most software and other practical works are designed
|
||||||
to take away your freedom to share and change the works. By contrast,
|
to take away your freedom to share and change the works. By contrast,
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
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
|
share and change all versions of a program--to make sure it remains free
|
||||||
software for all its users.
|
software for all its users.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
have the freedom to distribute copies of free software (and charge for
|
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
|
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
|
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.
|
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
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
you this License which gives you legal permission to copy, distribute
|
you this License which gives you legal permission to copy, distribute
|
||||||
and/or modify the software.
|
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
|
improvements made in alternate versions of the program, if they
|
||||||
receive widespread use, become available for other developers to
|
receive widespread use, become available for other developers to
|
||||||
incorporate. Many developers of free software are heartened and
|
incorporate. Many developers of free software are heartened and
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
software used on network servers, this result may fail to come about.
|
software used on network servers, this result may fail to come about.
|
||||||
The GNU General Public License permits making a modified version and
|
The GNU General Public License permits making a modified version and
|
||||||
letting the public access it on a server without ever releasing its
|
letting the public access it on a server without ever releasing its
|
||||||
source code to the public.
|
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
|
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
|
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
|
a publicly accessible server, gives the public access to the source
|
||||||
code of the modified version.
|
code of the modified version.
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
An older license, called the Affero General Public License and
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
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
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
this license.
|
this license.
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
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.
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
"recipients" may be individuals or organizations.
|
"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
|
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.
|
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.
|
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
|
permission, would make you directly or secondarily liable for
|
||||||
infringement under applicable copyright law, except executing it on a
|
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
|
distribution (with or without modification), making available to the
|
||||||
public, and in some countries other activities as well.
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
To "convey" a work means any kind of propagation that enables other
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
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
|
to the extent that it includes a convenient and prominently visible
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
tells the user that there is no warranty for the work (except to the
|
tells the user that there is no warranty for the work (except to the
|
||||||
extent that warranties are provided), that licensees may convey 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
|
the interface presents a list of user commands or options, such as a
|
||||||
menu, a prominent item in the list meets this criterion.
|
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
|
The "source code" for a work means the preferred form of the work
|
||||||
for making modifications to it. "Object code" means any non-source
|
for making modifications to it. "Object code" means any non-source
|
||||||
form of a work.
|
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
|
standard defined by a recognized standards body, or, in the case of
|
||||||
interfaces specified for a particular programming language, one that
|
interfaces specified for a particular programming language, one that
|
||||||
is widely used among developers working in that language.
|
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
|
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
|
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
|
Component, and (b) serves only to enable use of the work with that
|
||||||
Major Component, or to implement a Standard Interface for which an
|
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
|
"Major Component", in this context, means a major essential component
|
||||||
(kernel, window system, and so on) of the specific operating system
|
(kernel, window system, and so on) of the specific operating system
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
(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.
|
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
|
the source code needed to generate, install, and (for an executable
|
||||||
work) run the object code and to modify the work, including scripts to
|
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
|
System Libraries, or general-purpose tools or generally available free
|
||||||
programs which are used unmodified in performing those activities but
|
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
|
includes interface definition files associated with source files for
|
||||||
the work, and the source code for shared libraries and dynamically
|
the work, and the source code for shared libraries and dynamically
|
||||||
linked subprograms that the work is specifically designed to require,
|
linked subprograms that the work is specifically designed to require,
|
||||||
such as by intimate data communication or control flow between those
|
such as by intimate data communication or control flow between those
|
||||||
subprograms and other parts of the work.
|
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
|
can regenerate automatically from other parts of the Corresponding
|
||||||
Source.
|
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.
|
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
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
permission to run the unmodified Program. The output from running a
|
permission to run the unmodified Program. The output from running a
|
||||||
covered work is covered by this License only if the output, given its
|
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.
|
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
|
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
|
of having them make modifications exclusively for you, or provide you
|
||||||
with facilities for running those works, provided that you comply with
|
with facilities for running those works, provided that you comply with
|
||||||
the terms of this License in conveying all material for which you do
|
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
|
for you must do so exclusively on your behalf, under your direction
|
||||||
and control, on terms that prohibit them from making any copies of
|
and control, on terms that prohibit them from making any copies of
|
||||||
your copyrighted material outside their relationship with you.
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
Conveying under any other circumstances is permitted solely under
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
makes it unnecessary.
|
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
|
measure under any applicable law fulfilling obligations under article
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
similar laws prohibiting or restricting circumvention of such
|
similar laws prohibiting or restricting circumvention of such
|
||||||
measures.
|
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
|
circumvention of technological measures to the extent such circumvention
|
||||||
is effected by exercising rights under this License with respect to
|
is effected by exercising rights under this License with respect to
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
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
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
technological measures.
|
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
|
receive it, in any medium, provided that you conspicuously and
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
keep intact all notices stating that this License and any
|
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
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
recipients a copy of this License along with the Program.
|
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.
|
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
|
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:
|
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
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
work need not make them do so.
|
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,
|
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,
|
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
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
used to limit the access or legal rights of the compilation's users
|
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
|
in an aggregate does not cause this License to apply to the other
|
||||||
parts of the aggregate.
|
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
|
of sections 4 and 5, provided that you also convey the
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
in one of these ways:
|
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
|
Source of the work are being offered to the general public at no
|
||||||
charge under subsection 6d.
|
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
|
from the Corresponding Source as a System Library, need not be
|
||||||
included in conveying the object code work.
|
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,
|
tangible personal property which is normally used for personal, family,
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
product received by a particular user, "normally used" refers to a
|
product received by a particular user, "normally used" refers to a
|
||||||
typical or common use of that class of product, regardless of the status
|
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
|
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
|
is a consumer product regardless of whether the product has substantial
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
the only significant mode of use of the product.
|
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
|
procedures, authorization keys, or other information required to install
|
||||||
and execute modified versions of a covered work in that User Product from
|
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
|
suffice to ensure that the continued functioning of the modified object
|
||||||
code is in no case prevented or interfered with solely because
|
code is in no case prevented or interfered with solely because
|
||||||
modification has been made.
|
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
|
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
|
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
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
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
|
if neither you nor any third party retains the ability to install
|
||||||
modified object code on the User Product (for example, the work has
|
modified object code on the User Product (for example, the work has
|
||||||
been installed in ROM).
|
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
|
requirement to continue to provide support service, warranty, or updates
|
||||||
for a work that has been modified or installed by the recipient, or for
|
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
|
network may be denied when the modification itself materially and
|
||||||
adversely affects the operation of the network or violates the rules and
|
adversely affects the operation of the network or violates the rules and
|
||||||
protocols for communication across the network.
|
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
|
in accord with this section must be in a format that is publicly
|
||||||
documented (and with an implementation available to the public in
|
documented (and with an implementation available to the public in
|
||||||
source code form), and must require no special password or key for
|
source code form), and must require no special password or key for
|
||||||
unpacking, reading or copying.
|
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.
|
License by making exceptions from one or more of its conditions.
|
||||||
Additional permissions that are applicable to the entire Program shall
|
Additional permissions that are applicable to the entire Program shall
|
||||||
be treated as though they were included in this License, to the extent
|
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
|
apply only to part of the Program, that part may be used separately
|
||||||
under those permissions, but the entire Program remains governed by
|
under those permissions, but the entire Program remains governed by
|
||||||
this License without regard to the additional permissions.
|
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
|
remove any additional permissions from that copy, or from any part of
|
||||||
it. (Additional permissions may be written to require their own
|
it. (Additional permissions may be written to require their own
|
||||||
removal in certain cases when you modify the work.) You may place
|
removal in certain cases when you modify the work.) You may place
|
||||||
additional permissions on material, added by you to a covered work,
|
additional permissions on material, added by you to a covered work,
|
||||||
for which you have or can give appropriate copyright permission.
|
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
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
that material) supplement the terms of this License with terms:
|
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
|
any liability that these contractual assumptions directly impose on
|
||||||
those licensors and authors.
|
those licensors and authors.
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
All other non-permissive additional terms are considered "further
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
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
|
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
|
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
|
a further restriction but permits relicensing or conveying under this
|
||||||
License, you may add to a covered work material governed by the terms
|
License, you may add to a covered work material governed by the terms
|
||||||
of that license document, provided that the further restriction does
|
of that license document, provided that the further restriction does
|
||||||
not survive such relicensing or conveying.
|
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
|
must place, in the relevant source files, a statement of the
|
||||||
additional terms that apply to those files, or a notice indicating
|
additional terms that apply to those files, or a notice indicating
|
||||||
where to find the applicable terms.
|
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;
|
form of a separately written license, or stated as exceptions;
|
||||||
the above requirements apply either way.
|
the above requirements apply either way.
|
||||||
|
|
||||||
8. Termination.
|
8. Termination.
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
You may not propagate or modify a covered work except as expressly
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
modify it is void, and will automatically terminate your rights under
|
modify it is void, and will automatically terminate your rights under
|
||||||
this License (including any patent licenses granted under the third
|
this License (including any patent licenses granted under the third
|
||||||
paragraph of section 11).
|
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)
|
license from a particular copyright holder is reinstated (a)
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
holder fails to notify you of the violation by some reasonable means
|
holder fails to notify you of the violation by some reasonable means
|
||||||
prior to 60 days after the cessation.
|
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
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
violation by some reasonable means, this is the first time you have
|
violation by some reasonable means, this is the first time you have
|
||||||
received notice of violation of this License (for any work) from that
|
received notice of violation of this License (for any work) from that
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
your receipt of the notice.
|
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
|
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
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
material under section 10.
|
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
|
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
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
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
|
nothing other than this License grants you permission to propagate or
|
||||||
modify any covered work. These actions infringe copyright if you do
|
modify any covered work. These actions infringe copyright if you do
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
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
|
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.
|
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 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
|
work results from an entity transaction, each party to that
|
||||||
transaction who receives a copy of the work also receives whatever
|
transaction who receives a copy of the work also receives whatever
|
||||||
licenses to the work the party's predecessor in interest had or could
|
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
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
You may not impose any further restrictions on the exercise of the
|
||||||
rights granted or affirmed under this License. For example, you may
|
rights granted or affirmed under this License. For example, you may
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
rights granted under this License, and you may not initiate litigation
|
rights granted under this License, and you may not initiate litigation
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
sale, or importing the Program or any portion of it.
|
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
|
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
|
License of the Program or a work on which the Program is based. The
|
||||||
work thus licensed is called the contributor's "contributor version".
|
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
|
owned or controlled by the contributor, whether already acquired or
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
by this License, of making, using, or selling its contributor version,
|
by this License, of making, using, or selling its contributor version,
|
||||||
but do not include claims that would be infringed only as a
|
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
|
purposes of this definition, "control" includes the right to grant
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
this License.
|
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
|
patent license under the contributor's essential patent claims, to
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
propagate the contents of its contributor version.
|
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
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
(such as an express permission to practice a patent or covenant not to
|
(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
|
party means to make such an agreement or commitment not to enforce a
|
||||||
patent against the party.
|
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
|
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
|
to copy, free of charge and under the terms of this License, through a
|
||||||
publicly available network server or other readily accessible means,
|
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
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
consistent with the requirements of this License, to extend the patent
|
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
|
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
|
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
|
in a country, would infringe one or more identifiable patents in that
|
||||||
country that you have reason to believe are valid.
|
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
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
covered work, and grant a patent license to some of the parties
|
covered work, and grant a patent license to some of the parties
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
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
|
you grant is automatically extended to all recipients of the covered
|
||||||
work and works based on it.
|
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
|
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
|
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
|
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
|
in the business of distributing software, under which you make payment
|
||||||
to the third party based on the extent of your activity of conveying
|
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,
|
contain the covered work, unless you entered into that arrangement,
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
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
|
any implied license or other defenses to infringement that may
|
||||||
otherwise be available to you under applicable patent law.
|
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
|
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
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
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
|
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
|
the Program, the only way you could satisfy both those terms and this
|
||||||
License would be to refrain entirely from conveying the Program.
|
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
|
Program, your modified version must prominently offer all users
|
||||||
interacting with it remotely through a computer network (if your version
|
interacting with it remotely through a computer network (if your version
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
Source of your version by providing access to the Corresponding Source
|
Source of your version by providing access to the Corresponding Source
|
||||||
from a network server at no charge, through some standard or customary
|
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
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
following paragraph.
|
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
|
permission to link or combine any covered work with a work licensed
|
||||||
under version 3 of the GNU General Public License into a single
|
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,
|
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
|
but the work with which it is combined will remain governed by version
|
||||||
3 of the GNU General Public License.
|
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 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 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
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
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
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
Public License "or any later version" applies to it, you have the
|
Public License "or any later version" applies to it, you have the
|
||||||
option of following the terms and conditions either of that numbered
|
option of following the terms and conditions either of that numbered
|
||||||
version or of any later version published by the Free Software
|
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
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
by the Free Software Foundation.
|
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
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
public statement of acceptance of a version permanently authorizes you
|
public statement of acceptance of a version permanently authorizes you
|
||||||
to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
Later license versions may give you additional or different
|
||||||
permissions. However, no additional obligations are imposed on any
|
permissions. However, no additional obligations are imposed on any
|
||||||
author or copyright holder as a result of your choosing to follow a
|
author or copyright holder as a result of your choosing to follow a
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
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
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
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
|
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
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
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
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGES.
|
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,
|
above cannot be given local legal effect according to their terms,
|
||||||
reviewing courts shall apply local law that most closely approximates
|
reviewing courts shall apply local law that most closely approximates
|
||||||
an absolute waiver of all civil liability in connection with the
|
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
|
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
|
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.
|
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
|
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
|
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.
|
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.
|
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
|
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
|
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
|
solutions will be better for different programs; see section 13 for the
|
||||||
specific requirements.
|
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.
|
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
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
<https://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
version: "3.9"
|
version: '3.9'
|
||||||
services:
|
services:
|
||||||
main:
|
main:
|
||||||
build:
|
build:
|
||||||
context: ../images/wait-for-postgres
|
context: ../images/wait-for-postgres
|
||||||
network: host
|
network: host
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- '3000:3000'
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
@@ -36,12 +36,12 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- automatisch_storage:/automatisch/storage
|
- automatisch_storage:/automatisch/storage
|
||||||
postgres:
|
postgres:
|
||||||
image: "postgres:14.5"
|
image: 'postgres:14.5'
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_HOST_AUTH_METHOD: trust
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
POSTGRES_DB: automatisch
|
POSTGRES_DB: automatisch
|
||||||
POSTGRES_USER: automatisch_user
|
POSTGRES_USER: automatisch_user
|
||||||
redis:
|
redis:
|
||||||
image: "redis:7.0.4"
|
image: 'redis:7.0.4'
|
||||||
volumes:
|
volumes:
|
||||||
automatisch_storage:
|
automatisch_storage:
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"packages": [
|
"packages": ["packages/*"],
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"version": "0.1.5",
|
"version": "0.1.5",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
|
@@ -4,6 +4,6 @@ const client = new Client({
|
|||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
user: 'postgres',
|
user: 'postgres',
|
||||||
port: 5432,
|
port: 5432,
|
||||||
})
|
});
|
||||||
|
|
||||||
export default client;
|
export default client;
|
||||||
|
@@ -4,7 +4,10 @@ import client from './client';
|
|||||||
import User from '../../src/models/user';
|
import User from '../../src/models/user';
|
||||||
import '../../src/config/orm';
|
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 UNIQUE_VIOLATION_CODE = '23505';
|
||||||
const userParams = {
|
const userParams = {
|
||||||
email,
|
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 client.connect();
|
||||||
await createDatabase(database);
|
await createDatabase(database);
|
||||||
await createDatabaseUser(user);
|
await createDatabaseUser(user);
|
||||||
await grantPrivileges(database, user);
|
await grantPrivileges(database, user);
|
||||||
|
|
||||||
await client.end();
|
await client.end();
|
||||||
}
|
};
|
||||||
|
|
||||||
export const createDatabase = async (database = appConfig.postgresDatabase) => {
|
export const createDatabase = async (database = appConfig.postgresDatabase) => {
|
||||||
const DUPLICATE_DB_CODE = '42P04';
|
const DUPLICATE_DB_CODE = '42P04';
|
||||||
@@ -51,7 +57,7 @@ export const createDatabase = async (database = appConfig.postgresDatabase) => {
|
|||||||
|
|
||||||
logger.info(`Database: ${database} already exists!`);
|
logger.info(`Database: ${database} already exists!`);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
|
export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
|
||||||
const DUPLICATE_OBJECT_CODE = '42710';
|
const DUPLICATE_OBJECT_CODE = '42710';
|
||||||
@@ -68,25 +74,25 @@ export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
|
|||||||
|
|
||||||
logger.info(`Database User: ${user} already exists!`);
|
logger.info(`Database User: ${user} already exists!`);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const grantPrivileges = async (
|
export const grantPrivileges = async (
|
||||||
database = appConfig.postgresDatabase, user = appConfig.postgresUsername
|
database = appConfig.postgresDatabase,
|
||||||
|
user = appConfig.postgresUsername
|
||||||
) => {
|
) => {
|
||||||
await client.query(
|
await client.query(
|
||||||
`GRANT ALL PRIVILEGES ON DATABASE ${database} TO ${user};`
|
`GRANT ALL PRIVILEGES ON DATABASE ${database} TO ${user};`
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.info(
|
logger.info(`${user} has granted all privileges on ${database}!`);
|
||||||
`${user} has granted all privileges on ${database}!`
|
};
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dropDatabase = async () => {
|
export const dropDatabase = async () => {
|
||||||
if (appConfig.appEnv != 'development' && appConfig.appEnv != 'test') {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,13 +100,15 @@ export const dropDatabase = async () => {
|
|||||||
await dropDatabaseAndUser();
|
await dropDatabaseAndUser();
|
||||||
|
|
||||||
await client.end();
|
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}`);
|
await client.query(`DROP DATABASE IF EXISTS ${database}`);
|
||||||
logger.info(`Database: ${database} removed!`);
|
logger.info(`Database: ${database} removed!`);
|
||||||
|
|
||||||
await client.query(`DROP USER IF EXISTS ${user}`);
|
await client.query(`DROP USER IF EXISTS ${user}`);
|
||||||
logger.info(`Database User: ${user} removed!`);
|
logger.info(`Database User: ${user} removed!`);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ const knexConfig = {
|
|||||||
user: appConfig.postgresUsername,
|
user: appConfig.postgresUsername,
|
||||||
password: appConfig.postgresPassword,
|
password: appConfig.postgresPassword,
|
||||||
database: appConfig.postgresDatabase,
|
database: appConfig.postgresDatabase,
|
||||||
ssl: appConfig.postgresEnableSsl
|
ssl: appConfig.postgresEnableSsl,
|
||||||
},
|
},
|
||||||
pool: { min: 0, max: 20 },
|
pool: { min: 0, max: 20 },
|
||||||
migrations: {
|
migrations: {
|
||||||
@@ -20,7 +20,7 @@ const knexConfig = {
|
|||||||
},
|
},
|
||||||
seeds: {
|
seeds: {
|
||||||
directory: __dirname + '/src/db/seeds',
|
directory: __dirname + '/src/db/seeds',
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export default knexConfig;
|
export default knexConfig;
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import sendMessageToChannel from "./send-message-to-channel";
|
import sendMessageToChannel from './send-message-to-channel';
|
||||||
|
|
||||||
export default [
|
export default [sendMessageToChannel];
|
||||||
sendMessageToChannel
|
|
||||||
];
|
|
||||||
|
@@ -17,12 +17,12 @@ export default async function createAuthData($: IGlobalVariable) {
|
|||||||
scope: scopes.join(' '),
|
scope: scopes.join(' '),
|
||||||
});
|
});
|
||||||
|
|
||||||
const url = `${$.app.apiBaseUrl}/oauth2/authorize?${searchParams.toString()}`;
|
const url = `${
|
||||||
|
$.app.apiBaseUrl
|
||||||
|
}/oauth2/authorize?${searchParams.toString()}`;
|
||||||
|
|
||||||
await $.auth.set({ url });
|
await $.auth.set({ url });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(`Error occured while verifying credentials: ${error}`);
|
||||||
`Error occured while verifying credentials: ${error}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,9 +12,10 @@ export default {
|
|||||||
readOnly: true,
|
readOnly: true,
|
||||||
value: '{WEB_APP_URL}/app/discord/connections/add',
|
value: '{WEB_APP_URL}/app/discord/connections/add',
|
||||||
placeholder: null,
|
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',
|
docUrl: 'https://automatisch.io/docs/discord#oauth-redirect-url',
|
||||||
clickToCopy: true
|
clickToCopy: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumerKey',
|
key: 'consumerKey',
|
||||||
@@ -26,7 +27,7 @@ export default {
|
|||||||
placeholder: null,
|
placeholder: null,
|
||||||
description: null,
|
description: null,
|
||||||
docUrl: 'https://automatisch.io/docs/discord#consumer-key',
|
docUrl: 'https://automatisch.io/docs/discord#consumer-key',
|
||||||
clickToCopy: false
|
clickToCopy: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumerSecret',
|
key: 'consumerSecret',
|
||||||
@@ -38,7 +39,7 @@ export default {
|
|||||||
placeholder: null,
|
placeholder: null,
|
||||||
description: null,
|
description: null,
|
||||||
docUrl: 'https://automatisch.io/docs/discord#consumer-secret',
|
docUrl: 'https://automatisch.io/docs/discord#consumer-secret',
|
||||||
clickToCopy: false
|
clickToCopy: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'botToken',
|
key: 'botToken',
|
||||||
@@ -50,8 +51,8 @@ export default {
|
|||||||
placeholder: null,
|
placeholder: null,
|
||||||
description: null,
|
description: null,
|
||||||
docUrl: 'https://automatisch.io/docs/discord#bot-token',
|
docUrl: 'https://automatisch.io/docs/discord#bot-token',
|
||||||
clickToCopy: false
|
clickToCopy: false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
authenticationSteps: [
|
authenticationSteps: [
|
||||||
{
|
{
|
||||||
@@ -60,7 +61,7 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'key',
|
name: 'key',
|
||||||
value: '{key}'
|
value: '{key}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'formattedData',
|
name: 'formattedData',
|
||||||
@@ -68,19 +69,19 @@ export default {
|
|||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'consumerKey',
|
name: 'consumerKey',
|
||||||
value: '{fields.consumerKey}'
|
value: '{fields.consumerKey}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'consumerSecret',
|
name: 'consumerSecret',
|
||||||
value: '{fields.consumerSecret}'
|
value: '{fields.consumerSecret}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'botToken',
|
name: 'botToken',
|
||||||
value: '{fields.botToken}'
|
value: '{fields.botToken}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -88,9 +89,9 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'openWithPopup' as const,
|
type: 'openWithPopup' as const,
|
||||||
@@ -98,9 +99,9 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'url',
|
name: 'url',
|
||||||
value: '{createAuthData.url}'
|
value: '{createAuthData.url}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -108,7 +109,7 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'formattedData',
|
name: 'formattedData',
|
||||||
@@ -116,11 +117,11 @@ export default {
|
|||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'oauthVerifier',
|
name: 'oauthVerifier',
|
||||||
value: '{openAuthPopup.code}'
|
value: '{openAuthPopup.code}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -128,10 +129,10 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
createAuthData,
|
createAuthData,
|
||||||
|
@@ -28,10 +28,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
|||||||
expires_in: expiresIn,
|
expires_in: expiresIn,
|
||||||
scope: scope,
|
scope: scope,
|
||||||
token_type: tokenType,
|
token_type: tokenType,
|
||||||
guild: {
|
guild: { id: guildId, name: guildName },
|
||||||
id: guildId,
|
|
||||||
name: guildName,
|
|
||||||
}
|
|
||||||
} = verifiedCredentials;
|
} = verifiedCredentials;
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
@@ -40,7 +37,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
|||||||
expiresIn,
|
expiresIn,
|
||||||
scope,
|
scope,
|
||||||
tokenType,
|
tokenType,
|
||||||
})
|
});
|
||||||
|
|
||||||
const user = await getCurrentUser($);
|
const user = await getCurrentUser($);
|
||||||
|
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import listChannels from "./list-channels";
|
import listChannels from './list-channels';
|
||||||
|
|
||||||
export default [
|
export default [listChannels];
|
||||||
listChannels,
|
|
||||||
];
|
|
||||||
|
@@ -13,7 +13,9 @@ export default {
|
|||||||
error: null,
|
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
|
channels.data = response.data
|
||||||
.filter((channel: IJSONObject) => {
|
.filter((channel: IJSONObject) => {
|
||||||
|
@@ -12,9 +12,10 @@ export default {
|
|||||||
readOnly: true,
|
readOnly: true,
|
||||||
value: '{WEB_APP_URL}/app/flickr/connections/add',
|
value: '{WEB_APP_URL}/app/flickr/connections/add',
|
||||||
placeholder: null,
|
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',
|
docUrl: 'https://automatisch.io/docs/flickr#oauth-redirect-url',
|
||||||
clickToCopy: true
|
clickToCopy: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumerKey',
|
key: 'consumerKey',
|
||||||
@@ -26,7 +27,7 @@ export default {
|
|||||||
placeholder: null,
|
placeholder: null,
|
||||||
description: null,
|
description: null,
|
||||||
docUrl: 'https://automatisch.io/docs/flickr#consumer-key',
|
docUrl: 'https://automatisch.io/docs/flickr#consumer-key',
|
||||||
clickToCopy: false
|
clickToCopy: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumerSecret',
|
key: 'consumerSecret',
|
||||||
@@ -38,8 +39,8 @@ export default {
|
|||||||
placeholder: null,
|
placeholder: null,
|
||||||
description: null,
|
description: null,
|
||||||
docUrl: 'https://automatisch.io/docs/flickr#consumer-secret',
|
docUrl: 'https://automatisch.io/docs/flickr#consumer-secret',
|
||||||
clickToCopy: false
|
clickToCopy: false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
authenticationSteps: [
|
authenticationSteps: [
|
||||||
{
|
{
|
||||||
@@ -48,7 +49,7 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'key',
|
name: 'key',
|
||||||
value: '{key}'
|
value: '{key}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'formattedData',
|
name: 'formattedData',
|
||||||
@@ -56,15 +57,15 @@ export default {
|
|||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'consumerKey',
|
name: 'consumerKey',
|
||||||
value: '{fields.consumerKey}'
|
value: '{fields.consumerKey}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'consumerSecret',
|
name: 'consumerSecret',
|
||||||
value: '{fields.consumerSecret}'
|
value: '{fields.consumerSecret}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -72,9 +73,9 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'openWithPopup' as const,
|
type: 'openWithPopup' as const,
|
||||||
@@ -82,9 +83,9 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'url',
|
name: 'url',
|
||||||
value: '{createAuthData.url}'
|
value: '{createAuthData.url}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -92,7 +93,7 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'formattedData',
|
name: 'formattedData',
|
||||||
@@ -100,11 +101,11 @@ export default {
|
|||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'oauthVerifier',
|
name: 'oauthVerifier',
|
||||||
value: '{openAuthPopup.oauth_verifier}'
|
value: '{openAuthPopup.oauth_verifier}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -112,10 +113,10 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
createAuthData,
|
createAuthData,
|
||||||
|
@@ -6,7 +6,7 @@ const isStillVerified = async ($: IGlobalVariable) => {
|
|||||||
method: 'flickr.test.login',
|
method: 'flickr.test.login',
|
||||||
format: 'json',
|
format: 'json',
|
||||||
nojsoncallback: 1,
|
nojsoncallback: 1,
|
||||||
}
|
};
|
||||||
const response = await $.http.get('/rest', { params });
|
const response = await $.http.get('/rest', { params });
|
||||||
return !!response.data.user.id;
|
return !!response.data.user.id;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@@ -10,7 +10,7 @@ type TPhotoset = {
|
|||||||
title: {
|
title: {
|
||||||
_content: string;
|
_content: string;
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'List albums',
|
name: 'List albums',
|
||||||
@@ -25,7 +25,7 @@ export default {
|
|||||||
format: 'json',
|
format: 'json',
|
||||||
nojsoncallback: 1,
|
nojsoncallback: 1,
|
||||||
};
|
};
|
||||||
let response = await $.http.get('/rest', { params, });
|
let response = await $.http.get('/rest', { params });
|
||||||
|
|
||||||
const aggregatedResponse: TResponse = {
|
const aggregatedResponse: TResponse = {
|
||||||
data: [...response.data.photosets.photoset],
|
data: [...response.data.photosets.photoset],
|
||||||
@@ -35,19 +35,21 @@ export default {
|
|||||||
response = await $.http.get('/rest', {
|
response = await $.http.get('/rest', {
|
||||||
params: {
|
params: {
|
||||||
...params,
|
...params,
|
||||||
page: response.data.photosets.page
|
page: response.data.photosets.page,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
aggregatedResponse.data.push(...response.data.photosets.photoset);
|
aggregatedResponse.data.push(...response.data.photosets.photoset);
|
||||||
}
|
}
|
||||||
|
|
||||||
aggregatedResponse.data = aggregatedResponse.data.map((photoset: TPhotoset) => {
|
aggregatedResponse.data = aggregatedResponse.data.map(
|
||||||
return {
|
(photoset: TPhotoset) => {
|
||||||
value: photoset.id,
|
return {
|
||||||
name: photoset.title._content,
|
value: photoset.id,
|
||||||
} as IJSONObject;
|
name: photoset.title._content,
|
||||||
});
|
} as IJSONObject;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return aggregatedResponse;
|
return aggregatedResponse;
|
||||||
},
|
},
|
||||||
|
@@ -3,9 +3,4 @@ import newFavoritePhotos from './new-favorite-photos';
|
|||||||
import newPhotos from './new-photos';
|
import newPhotos from './new-photos';
|
||||||
import newPhotosInAlbums from './new-photos-in-album';
|
import newPhotosInAlbums from './new-photos-in-album';
|
||||||
|
|
||||||
export default [
|
export default [newAlbums, newFavoritePhotos, newPhotos, newPhotosInAlbums];
|
||||||
newAlbums,
|
|
||||||
newFavoritePhotos,
|
|
||||||
newPhotos,
|
|
||||||
newPhotosInAlbums,
|
|
||||||
];
|
|
||||||
|
@@ -13,7 +13,9 @@ export default async function createAuthData($: IGlobalVariable) {
|
|||||||
scope: scopes.join(','),
|
scope: scopes.join(','),
|
||||||
});
|
});
|
||||||
|
|
||||||
const url = `${$.app.baseUrl}/login/oauth/authorize?${searchParams.toString()}`;
|
const url = `${
|
||||||
|
$.app.baseUrl
|
||||||
|
}/login/oauth/authorize?${searchParams.toString()}`;
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
url,
|
url,
|
||||||
|
@@ -12,9 +12,10 @@ export default {
|
|||||||
readOnly: true,
|
readOnly: true,
|
||||||
value: '{WEB_APP_URL}/app/github/connections/add',
|
value: '{WEB_APP_URL}/app/github/connections/add',
|
||||||
placeholder: null,
|
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',
|
docUrl: 'https://automatisch.io/docs/github#oauth-redirect-url',
|
||||||
clickToCopy: true
|
clickToCopy: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumerKey',
|
key: 'consumerKey',
|
||||||
@@ -26,7 +27,7 @@ export default {
|
|||||||
placeholder: null,
|
placeholder: null,
|
||||||
description: null,
|
description: null,
|
||||||
docUrl: 'https://automatisch.io/docs/github#client-id',
|
docUrl: 'https://automatisch.io/docs/github#client-id',
|
||||||
clickToCopy: false
|
clickToCopy: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumerSecret',
|
key: 'consumerSecret',
|
||||||
@@ -38,8 +39,8 @@ export default {
|
|||||||
placeholder: null,
|
placeholder: null,
|
||||||
description: null,
|
description: null,
|
||||||
docUrl: 'https://automatisch.io/docs/github#client-secret',
|
docUrl: 'https://automatisch.io/docs/github#client-secret',
|
||||||
clickToCopy: false
|
clickToCopy: false,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
authenticationSteps: [
|
authenticationSteps: [
|
||||||
{
|
{
|
||||||
@@ -48,7 +49,7 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'key',
|
name: 'key',
|
||||||
value: '{key}'
|
value: '{key}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'formattedData',
|
name: 'formattedData',
|
||||||
@@ -56,15 +57,15 @@ export default {
|
|||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'consumerKey',
|
name: 'consumerKey',
|
||||||
value: '{fields.consumerKey}'
|
value: '{fields.consumerKey}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'consumerSecret',
|
name: 'consumerSecret',
|
||||||
value: '{fields.consumerSecret}'
|
value: '{fields.consumerSecret}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -72,9 +73,9 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'openWithPopup' as const,
|
type: 'openWithPopup' as const,
|
||||||
@@ -82,9 +83,9 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'url',
|
name: 'url',
|
||||||
value: '{createAuthData.url}'
|
value: '{createAuthData.url}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -92,7 +93,7 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'formattedData',
|
name: 'formattedData',
|
||||||
@@ -100,11 +101,11 @@ export default {
|
|||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'oauthVerifier',
|
name: 'oauthVerifier',
|
||||||
value: '{openAuthPopup.code}'
|
value: '{openAuthPopup.code}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
@@ -112,10 +113,10 @@ export default {
|
|||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: '{createConnection.id}'
|
value: '{createConnection.id}',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
createAuthData,
|
createAuthData,
|
||||||
|
@@ -12,9 +12,10 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json'
|
Accept: 'application/json',
|
||||||
}
|
},
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
|
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { TBeforeRequest } from "@automatisch/types";
|
import { TBeforeRequest } from '@automatisch/types';
|
||||||
|
|
||||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||||
if (requestConfig.headers && $.auth.data?.accessToken) {
|
if (requestConfig.headers && $.auth.data?.accessToken) {
|
||||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`
|
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return requestConfig;
|
return requestConfig;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default addAuthHeader;
|
export default addAuthHeader;
|
||||||
|
@@ -1,15 +1,17 @@
|
|||||||
type TRepoOwnerAndRepo = {
|
type TRepoOwnerAndRepo = {
|
||||||
repoOwner?: string;
|
repoOwner?: string;
|
||||||
repo?: string;
|
repo?: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default function getRepoOwnerAndRepo(repoFullName: string): TRepoOwnerAndRepo {
|
export default function getRepoOwnerAndRepo(
|
||||||
|
repoFullName: string
|
||||||
|
): TRepoOwnerAndRepo {
|
||||||
if (!repoFullName) return {};
|
if (!repoFullName) return {};
|
||||||
|
|
||||||
const [repoOwner, repo] = repoFullName.split('/');
|
const [repoOwner, repo] = repoFullName.split('/');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
repoOwner,
|
repoOwner,
|
||||||
repo
|
repo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
import listLabels from './list-labels';
|
import listLabels from './list-labels';
|
||||||
import listRepos from './list-repos';
|
import listRepos from './list-repos';
|
||||||
|
|
||||||
export default [
|
export default [listLabels, listRepos];
|
||||||
listLabels,
|
|
||||||
listRepos,
|
|
||||||
];
|
|
||||||
|
@@ -7,10 +7,9 @@ export default {
|
|||||||
key: 'listLabels',
|
key: 'listLabels',
|
||||||
|
|
||||||
async run($: IGlobalVariable) {
|
async run($: IGlobalVariable) {
|
||||||
const {
|
const { repoOwner, repo } = getRepoOwnerAndRepo(
|
||||||
repoOwner,
|
$.step.parameters.repo as string
|
||||||
repo,
|
);
|
||||||
} = getRepoOwnerAndRepo($.step.parameters.repo as string);
|
|
||||||
|
|
||||||
if (!repo) return { data: [] };
|
if (!repo) return { data: [] };
|
||||||
|
|
||||||
|
@@ -3,9 +3,4 @@ import newPullRequests from './new-pull-requests';
|
|||||||
import newStargazers from './new-stargazers';
|
import newStargazers from './new-stargazers';
|
||||||
import newWatchers from './new-watchers';
|
import newWatchers from './new-watchers';
|
||||||
|
|
||||||
export default [
|
export default [newIssues, newPullRequests, newStargazers, newWatchers];
|
||||||
newIssues,
|
|
||||||
newPullRequests,
|
|
||||||
newStargazers,
|
|
||||||
newWatchers,
|
|
||||||
];
|
|
||||||
|
@@ -10,15 +10,13 @@ export default async function createAuthData($: IGlobalVariable) {
|
|||||||
const searchParams = qs.stringify({
|
const searchParams = qs.stringify({
|
||||||
client_id: $.auth.data.consumerKey as string,
|
client_id: $.auth.data.consumerKey as string,
|
||||||
redirect_uri: redirectUri,
|
redirect_uri: redirectUri,
|
||||||
response_type: 'code'
|
response_type: 'code',
|
||||||
})
|
});
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
url: `${$.auth.data.oauth2Url}/authorize?${searchParams}`,
|
url: `${$.auth.data.oauth2Url}/authorize?${searchParams}`,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(`Error occured while verifying credentials: ${error}`);
|
||||||
`Error occured while verifying credentials: ${error}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,8 +34,8 @@ export default {
|
|||||||
{
|
{
|
||||||
label: 'sandbox',
|
label: 'sandbox',
|
||||||
value: 'https://test.salesforce.com/services/oauth2',
|
value: 'https://test.salesforce.com/services/oauth2',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumerKey',
|
key: 'consumerKey',
|
||||||
@@ -76,7 +76,7 @@ export default {
|
|||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'oauth2Url',
|
name: 'oauth2Url',
|
||||||
value: '{fields.oauth2Url}'
|
value: '{fields.oauth2Url}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'consumerKey',
|
name: 'consumerKey',
|
||||||
|
@@ -13,10 +13,10 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
|||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
client_id: $.auth.data.consumerKey as string,
|
client_id: $.auth.data.consumerKey as string,
|
||||||
client_secret: $.auth.data.consumerSecret as string,
|
client_secret: $.auth.data.consumerSecret as string,
|
||||||
redirect_uri: redirectUri
|
redirect_uri: redirectUri,
|
||||||
});
|
});
|
||||||
const { data } = await $.http.post(
|
const { data } = await $.http.post(
|
||||||
`${$.auth.data.oauth2Url}/token?${searchParams}`,
|
`${$.auth.data.oauth2Url}/token?${searchParams}`
|
||||||
);
|
);
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
import listObjects from './list-objects';
|
import listObjects from './list-objects';
|
||||||
import listFields from './list-fields';
|
import listFields from './list-fields';
|
||||||
|
|
||||||
export default [
|
export default [listObjects, listFields];
|
||||||
listObjects,
|
|
||||||
listFields,
|
|
||||||
];
|
|
||||||
|
@@ -2,19 +2,21 @@ import { IGlobalVariable } from '@automatisch/types';
|
|||||||
|
|
||||||
type TResponse = {
|
type TResponse = {
|
||||||
sobjects: TObject[];
|
sobjects: TObject[];
|
||||||
}
|
};
|
||||||
|
|
||||||
type TObject = {
|
type TObject = {
|
||||||
name: string;
|
name: string;
|
||||||
label: string;
|
label: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'List objects',
|
name: 'List objects',
|
||||||
key: 'listObjects',
|
key: 'listObjects',
|
||||||
|
|
||||||
async run($: IGlobalVariable) {
|
async run($: IGlobalVariable) {
|
||||||
const response = await $.http.get<TResponse>('/services/data/v56.0/sobjects');
|
const response = await $.http.get<TResponse>(
|
||||||
|
'/services/data/v56.0/sobjects'
|
||||||
|
);
|
||||||
|
|
||||||
const objects = response.data.sobjects.map((object) => {
|
const objects = response.data.sobjects.map((object) => {
|
||||||
return {
|
return {
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import updatedFieldInRecords from "./updated-field-in-records";
|
import updatedFieldInRecords from './updated-field-in-records';
|
||||||
|
|
||||||
export default [
|
export default [updatedFieldInRecords];
|
||||||
updatedFieldInRecords
|
|
||||||
];
|
|
||||||
|
@@ -23,7 +23,7 @@ const updatedFieldInRecord = async ($: IGlobalVariable): Promise<void> => {
|
|||||||
const options = {
|
const options = {
|
||||||
params: {
|
params: {
|
||||||
q: getQuery(object, limit, offset),
|
q: getQuery(object, limit, offset),
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
response = await $.http.get('/services/data/v56.0/query', options);
|
response = await $.http.get('/services/data/v56.0/query', options);
|
||||||
@@ -34,7 +34,7 @@ const updatedFieldInRecord = async ($: IGlobalVariable): Promise<void> => {
|
|||||||
raw: record,
|
raw: record,
|
||||||
meta: {
|
meta: {
|
||||||
internalId: `${record.Id}-${record[field]}`,
|
internalId: `${record.Id}-${record[field]}`,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,7 +3,8 @@ const cronTimes = {
|
|||||||
everyHourExcludingWeekends: '0 * * * 1-5',
|
everyHourExcludingWeekends: '0 * * * 1-5',
|
||||||
everyDayAt: (hour: number) => `0 ${hour} * * *`,
|
everyDayAt: (hour: number) => `0 ${hour} * * *`,
|
||||||
everyDayExcludingWeekendsAt: (hour: number) => `0 ${hour} * * 1-5`,
|
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} * *`,
|
everyMonthOnAndAt: (day: number, hour: number) => `0 ${hour} ${day} * *`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -4,7 +4,9 @@ import cronParser from 'cron-parser';
|
|||||||
export default function getNextCronDateTime(cronString: string) {
|
export default function getNextCronDateTime(cronString: string) {
|
||||||
const cronDate = cronParser.parseExpression(cronString);
|
const cronDate = cronParser.parseExpression(cronString);
|
||||||
const matchingNextCronDateTime = cronDate.next();
|
const matchingNextCronDateTime = cronDate.next();
|
||||||
const matchingNextDateTime = DateTime.fromJSDate(matchingNextCronDateTime.toDate());
|
const matchingNextDateTime = DateTime.fromJSDate(
|
||||||
|
matchingNextCronDateTime.toDate()
|
||||||
|
);
|
||||||
|
|
||||||
return matchingNextDateTime;
|
return matchingNextDateTime;
|
||||||
};
|
}
|
||||||
|
@@ -3,9 +3,4 @@ import everyDay from './every-day';
|
|||||||
import everyWeek from './every-week';
|
import everyWeek from './every-week';
|
||||||
import everyMonth from './every-month';
|
import everyMonth from './every-month';
|
||||||
|
|
||||||
export default [
|
export default [everyHour, everyDay, everyWeek, everyMonth];
|
||||||
everyHour,
|
|
||||||
everyDay,
|
|
||||||
everyWeek,
|
|
||||||
everyMonth,
|
|
||||||
];
|
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
import findMessage from './find-message';
|
import findMessage from './find-message';
|
||||||
import sendMessageToChannel from './send-a-message-to-channel';
|
import sendMessageToChannel from './send-a-message-to-channel';
|
||||||
|
|
||||||
export default [
|
export default [findMessage, sendMessageToChannel];
|
||||||
findMessage,
|
|
||||||
sendMessageToChannel,
|
|
||||||
];
|
|
||||||
|
@@ -38,7 +38,8 @@ export default defineAction({
|
|||||||
type: 'dropdown' as const,
|
type: 'dropdown' as const,
|
||||||
required: false,
|
required: false,
|
||||||
value: 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,
|
variables: false,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -48,8 +49,8 @@ export default defineAction({
|
|||||||
{
|
{
|
||||||
label: 'No',
|
label: 'No',
|
||||||
value: false,
|
value: false,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Bot name',
|
label: 'Bot name',
|
||||||
@@ -57,7 +58,8 @@ export default defineAction({
|
|||||||
type: 'string' as const,
|
type: 'string' as const,
|
||||||
required: true,
|
required: true,
|
||||||
value: 'Automatisch',
|
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,
|
variables: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -65,7 +67,8 @@ export default defineAction({
|
|||||||
key: 'botIcon',
|
key: 'botIcon',
|
||||||
type: 'string' as const,
|
type: 'string' as const,
|
||||||
required: false,
|
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,
|
variables: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@@ -7,7 +7,7 @@ type TData = {
|
|||||||
username?: string;
|
username?: string;
|
||||||
icon_url?: string;
|
icon_url?: string;
|
||||||
icon_emoji?: string;
|
icon_emoji?: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
const postMessage = async ($: IGlobalVariable) => {
|
const postMessage = async ($: IGlobalVariable) => {
|
||||||
const { parameters } = $.step;
|
const { parameters } = $.step;
|
||||||
@@ -37,11 +37,9 @@ const postMessage = async ($: IGlobalVariable) => {
|
|||||||
sendAsBot,
|
sendAsBot,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await $.http.post(
|
const response = await $.http.post('/chat.postMessage', data, {
|
||||||
'/chat.postMessage',
|
additionalProperties: customConfig,
|
||||||
data,
|
});
|
||||||
{ additionalProperties: customConfig },
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.data.ok === false) {
|
if (response.data.ok === false) {
|
||||||
throw new Error(JSON.stringify(response.data));
|
throw new Error(JSON.stringify(response.data));
|
||||||
|
@@ -59,4 +59,4 @@ export default async function createAuthData($: IGlobalVariable) {
|
|||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
url,
|
url,
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
@@ -22,14 +22,9 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
bot_user_id: botId,
|
bot_user_id: botId,
|
||||||
authed_user: {
|
authed_user: { id: userId, access_token: userAccessToken },
|
||||||
id: userId,
|
|
||||||
access_token: userAccessToken,
|
|
||||||
},
|
|
||||||
access_token: botAccessToken,
|
access_token: botAccessToken,
|
||||||
team: {
|
team: { name: teamName },
|
||||||
name: teamName,
|
|
||||||
}
|
|
||||||
} = response.data;
|
} = response.data;
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
@@ -44,7 +39,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
|||||||
const currentUser = await getCurrentUser($);
|
const currentUser = await getCurrentUser($);
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
screenName: `${currentUser.real_name} @ ${teamName}`
|
screenName: `${currentUser.real_name} @ ${teamName}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -3,9 +3,9 @@ import { TBeforeRequest } from '@automatisch/types';
|
|||||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||||
const authData = $.auth.data;
|
const authData = $.auth.data;
|
||||||
if (
|
if (
|
||||||
requestConfig.headers
|
requestConfig.headers &&
|
||||||
&& authData?.userAccessToken
|
authData?.userAccessToken &&
|
||||||
&& authData?.botAccessToken
|
authData?.botAccessToken
|
||||||
) {
|
) {
|
||||||
if (requestConfig.additionalProperties?.sendAsBot) {
|
if (requestConfig.additionalProperties?.sendAsBot) {
|
||||||
requestConfig.headers.Authorization = `Bearer ${authData.botAccessToken}`;
|
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;
|
return requestConfig;
|
||||||
};
|
};
|
||||||
|
@@ -3,7 +3,7 @@ import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
|||||||
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||||
const params = {
|
const params = {
|
||||||
user: $.auth.data.userId as string,
|
user: $.auth.data.userId as string,
|
||||||
}
|
};
|
||||||
const response = await $.http.get('/users.info', { params });
|
const response = await $.http.get('/users.info', { params });
|
||||||
const currentUser = response.data.user;
|
const currentUser = response.data.user;
|
||||||
|
|
||||||
|
@@ -3,9 +3,4 @@ import newFollowerOfMe from './new-follower-of-me';
|
|||||||
import searchTweets from './search-tweets';
|
import searchTweets from './search-tweets';
|
||||||
import userTweets from './user-tweets';
|
import userTweets from './user-tweets';
|
||||||
|
|
||||||
export default [
|
export default [myTweets, newFollowerOfMe, searchTweets, userTweets];
|
||||||
myTweets,
|
|
||||||
newFollowerOfMe,
|
|
||||||
searchTweets,
|
|
||||||
userTweets,
|
|
||||||
];
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import appConfig from './app'
|
import appConfig from './app';
|
||||||
|
|
||||||
const corsOptions = {
|
const corsOptions = {
|
||||||
origin: appConfig.webAppUrl,
|
origin: appConfig.webAppUrl,
|
||||||
methods: 'POST',
|
methods: 'POST',
|
||||||
credentials: true,
|
credentials: true,
|
||||||
optionsSuccessStatus: 200,
|
optionsSuccessStatus: 200,
|
||||||
}
|
};
|
||||||
|
|
||||||
export default corsOptions;
|
export default corsOptions;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.createTable('users', (table) => {
|
return knex.schema.createTable('users', (table) => {
|
||||||
@@ -8,10 +8,8 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
|
|
||||||
table.timestamps(true, true);
|
table.timestamps(true, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
return knex.schema.dropTable('users');
|
return knex.schema.dropTable('users');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.createTable('credentials', (table) => {
|
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('key').notNullable();
|
||||||
table.string('display_name').notNullable();
|
table.string('display_name').notNullable();
|
||||||
table.text('data').notNullable();
|
table.text('data').notNullable();
|
||||||
@@ -11,7 +11,7 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
|
|
||||||
table.timestamps(true, true);
|
table.timestamps(true, true);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
return knex.schema.dropTable('credentials');
|
return knex.schema.dropTable('credentials');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.table('credentials', (table) => {
|
return knex.schema.table('credentials', (table) => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.renameTable('credentials', 'connections');
|
return knex.schema.renameTable('credentials', 'connections');
|
||||||
|
@@ -2,7 +2,7 @@ import { Knex } from 'knex';
|
|||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.createTable('steps', (table) => {
|
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('key').notNullable();
|
||||||
table.string('app_key').notNullable();
|
table.string('app_key').notNullable();
|
||||||
table.string('type').notNullable();
|
table.string('type').notNullable();
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.createTable('flows', (table) => {
|
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.string('name');
|
||||||
table.uuid('user_id').references('id').inTable('users');
|
table.uuid('user_id').references('id').inTable('users');
|
||||||
|
|
||||||
table.timestamps(true, true);
|
table.timestamps(true, true);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
return knex.schema.dropTable('flows');
|
return knex.schema.dropTable('flows');
|
||||||
|
@@ -1,15 +1,11 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.table('steps', (table) => {
|
return knex.schema.table('steps', (table) => {
|
||||||
table
|
table.uuid('flow_id').references('id').inTable('flows');
|
||||||
.uuid('flow_id')
|
|
||||||
.references('id')
|
|
||||||
.inTable('flows');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
return knex.schema.table('steps', (table) => {
|
return knex.schema.table('steps', (table) => {
|
||||||
table.dropColumn('flow_id');
|
table.dropColumn('flow_id');
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.alterTable('steps', table => {
|
return knex.schema.alterTable('steps', (table) => {
|
||||||
table.string('key').nullable().alter();
|
table.string('key').nullable().alter();
|
||||||
table.string('app_key').nullable().alter();
|
table.string('app_key').nullable().alter();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
return knex.schema.alterTable('steps', table => {
|
return knex.schema.alterTable('steps', (table) => {
|
||||||
table.string('key').notNullable().alter();
|
table.string('key').notNullable().alter();
|
||||||
table.string('app_key').notNullable().alter();
|
table.string('app_key').notNullable().alter();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.table('flows', (table) => {
|
return knex.schema.table('flows', (table) => {
|
||||||
table.boolean('active').defaultTo(false)
|
table.boolean('active').defaultTo(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ import { Knex } from 'knex';
|
|||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.createTable('executions', (table) => {
|
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.uuid('flow_id').references('id').inTable('flows');
|
||||||
table.boolean('test_run').notNullable().defaultTo(false);
|
table.boolean('test_run').notNullable().defaultTo(false);
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ import { Knex } from 'knex';
|
|||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
return knex.schema.createTable('execution_steps', (table) => {
|
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('execution_id').references('id').inTable('executions');
|
||||||
table.uuid('step_id').references('id').inTable('steps');
|
table.uuid('step_id').references('id').inTable('steps');
|
||||||
table.string('status');
|
table.string('status');
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
async function addDeletedColumn(knex: Knex, tableName: string) {
|
async function addDeletedColumn(knex: Knex, tableName: string) {
|
||||||
return await knex.schema.table(tableName, (table) => {
|
return await knex.schema.table(tableName, (table) => {
|
||||||
|
@@ -32,13 +32,13 @@ const createFlow = async (
|
|||||||
type: 'trigger',
|
type: 'trigger',
|
||||||
position: 1,
|
position: 1,
|
||||||
appKey,
|
appKey,
|
||||||
connectionId
|
connectionId,
|
||||||
});
|
});
|
||||||
|
|
||||||
await Step.query().insert({
|
await Step.query().insert({
|
||||||
flowId: flow.id,
|
flowId: flow.id,
|
||||||
type: 'action',
|
type: 'action',
|
||||||
position: 2
|
position: 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
return flow;
|
return flow;
|
||||||
|
@@ -18,7 +18,9 @@ const resetConnection = async (
|
|||||||
})
|
})
|
||||||
.throwIfNotFound();
|
.throwIfNotFound();
|
||||||
|
|
||||||
if (!connection.formattedData) { return null; }
|
if (!connection.formattedData) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
connection = await connection.$query().patchAndFetch({
|
connection = await connection.$query().patchAndFetch({
|
||||||
formattedData: { screenName: connection.formattedData.screenName },
|
formattedData: { screenName: connection.formattedData.screenName },
|
||||||
|
@@ -1,6 +1,10 @@
|
|||||||
import Context from '../../types/express/context';
|
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;
|
return context.currentUser;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -13,8 +13,8 @@ const getExecution = async (
|
|||||||
.$relatedQuery('executions')
|
.$relatedQuery('executions')
|
||||||
.withGraphFetched({
|
.withGraphFetched({
|
||||||
flow: {
|
flow: {
|
||||||
steps: true
|
steps: true,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
.findById(params.executionId)
|
.findById(params.executionId)
|
||||||
.throwIfNotFound();
|
.throwIfNotFound();
|
||||||
|
@@ -13,12 +13,12 @@ const getFlows = async (_parent: unknown, params: Params, context: Context) => {
|
|||||||
const flowsQuery = context.currentUser
|
const flowsQuery = context.currentUser
|
||||||
.$relatedQuery('flows')
|
.$relatedQuery('flows')
|
||||||
.joinRelated({
|
.joinRelated({
|
||||||
steps: true
|
steps: true,
|
||||||
})
|
})
|
||||||
.withGraphFetched({
|
.withGraphFetched({
|
||||||
steps: {
|
steps: {
|
||||||
connection: true
|
connection: true,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
.where((builder) => {
|
.where((builder) => {
|
||||||
if (params.connectionId) {
|
if (params.connectionId) {
|
||||||
|
@@ -3,7 +3,7 @@ import appConfig from '../../config/app';
|
|||||||
const healthcheck = () => {
|
const healthcheck = () => {
|
||||||
return {
|
return {
|
||||||
version: appConfig.version,
|
version: appConfig.version,
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default healthcheck;
|
export default healthcheck;
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { IApp, IAuthenticationStep, IAuthenticationStepField } from '@automatisch/types';
|
import {
|
||||||
|
IApp,
|
||||||
|
IAuthenticationStep,
|
||||||
|
IAuthenticationStepField,
|
||||||
|
} from '@automatisch/types';
|
||||||
import cloneDeep from 'lodash/cloneDeep';
|
import cloneDeep from 'lodash/cloneDeep';
|
||||||
|
|
||||||
const connectionIdArgument = {
|
const connectionIdArgument = {
|
||||||
@@ -9,16 +13,11 @@ const connectionIdArgument = {
|
|||||||
const resetConnectionStep = {
|
const resetConnectionStep = {
|
||||||
type: 'mutation' as const,
|
type: 'mutation' as const,
|
||||||
name: 'resetConnection',
|
name: 'resetConnection',
|
||||||
arguments: [
|
arguments: [connectionIdArgument],
|
||||||
connectionIdArgument,
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function replaceCreateConnection(string: string) {
|
function replaceCreateConnection(string: string) {
|
||||||
return string.replace(
|
return string.replace('{createConnection.id}', '{connection.id}');
|
||||||
'{createConnection.id}',
|
|
||||||
'{connection.id}'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeAppKeyArgument(args: IAuthenticationStepField[]) {
|
function removeAppKeyArgument(args: IAuthenticationStepField[]) {
|
||||||
@@ -36,7 +35,7 @@ function addConnectionId(step: IAuthenticationStep) {
|
|||||||
return {
|
return {
|
||||||
name: property.name,
|
name: property.name,
|
||||||
value: replaceCreateConnection(property.value),
|
value: replaceCreateConnection(property.value),
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +59,7 @@ function replaceCreateConnectionsWithUpdate(steps: IAuthenticationStep[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return step;
|
return step;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addReconnectionSteps(app: IApp): IApp {
|
function addReconnectionSteps(app: IApp): IApp {
|
||||||
@@ -68,12 +67,11 @@ function addReconnectionSteps(app: IApp): IApp {
|
|||||||
|
|
||||||
if (hasReconnectionSteps) return app;
|
if (hasReconnectionSteps) return app;
|
||||||
|
|
||||||
const updatedSteps = replaceCreateConnectionsWithUpdate(app.auth.authenticationSteps);
|
const updatedSteps = replaceCreateConnectionsWithUpdate(
|
||||||
|
app.auth.authenticationSteps
|
||||||
|
);
|
||||||
|
|
||||||
app.auth.reconnectionSteps = [
|
app.auth.reconnectionSteps = [resetConnectionStep, ...updatedSteps];
|
||||||
resetConnectionStep,
|
|
||||||
...updatedSteps,
|
|
||||||
]
|
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@ const appInfoConverter = (rawAppData: IApp) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return field
|
return field;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,15 +3,15 @@ import logger from './logger';
|
|||||||
|
|
||||||
type Error = {
|
type Error = {
|
||||||
message: string;
|
message: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
const errorHandler = (err: Error, req: Request, res: Response): void => {
|
const errorHandler = (err: Error, req: Request, res: Response): void => {
|
||||||
if(err.message === 'Not Found') {
|
if (err.message === 'Not Found') {
|
||||||
res.status(404).end()
|
res.status(404).end();
|
||||||
} else {
|
} else {
|
||||||
logger.error(err.message)
|
logger.error(err.message);
|
||||||
res.status(500).end()
|
res.status(500).end();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export default errorHandler;
|
export default errorHandler;
|
||||||
|
@@ -75,7 +75,10 @@ const globalVariable = async (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
pushTriggerItem: (triggerItem: ITriggerItem) => {
|
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
|
// early exit as we do not want to process duplicate items in actual executions
|
||||||
throw new EarlyExitError();
|
throw new EarlyExitError();
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@ const levels = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const level = () => {
|
const level = () => {
|
||||||
return appConfig.appEnv === 'development' ? 'debug' : 'info'
|
return appConfig.appEnv === 'development' ? 'debug' : 'info';
|
||||||
};
|
};
|
||||||
|
|
||||||
const colors = {
|
const colors = {
|
||||||
@@ -27,8 +27,8 @@ const format = winston.format.combine(
|
|||||||
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),
|
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),
|
||||||
winston.format.colorize({ all: true }),
|
winston.format.colorize({ all: true }),
|
||||||
winston.format.printf(
|
winston.format.printf(
|
||||||
(info) => `${info.timestamp} [${info.level}]: ${info.message}`,
|
(info) => `${info.timestamp} [${info.level}]: ${info.message}`
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const transports = [
|
const transports = [
|
||||||
|
@@ -3,13 +3,14 @@ import { Request } from 'express';
|
|||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
|
||||||
const stream: StreamOptions = {
|
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 = () => {
|
const registerGraphQLToken = () => {
|
||||||
morgan.token("graphql-query", (req: Request) => {
|
morgan.token('graphql-query', (req: Request) => {
|
||||||
if(req.body.query) {
|
if (req.body.query) {
|
||||||
return `GraphQL ${req.body.query}`
|
return `GraphQL ${req.body.query}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -17,7 +18,7 @@ const registerGraphQLToken = () => {
|
|||||||
registerGraphQLToken();
|
registerGraphQLToken();
|
||||||
|
|
||||||
const morganMiddleware = morgan(
|
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 }
|
{ stream }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -25,7 +25,10 @@ export default function parseLinkHeader(link: string): TParsedLinkHeader {
|
|||||||
const items = link.split(',');
|
const items = link.split(',');
|
||||||
|
|
||||||
for (const item of items) {
|
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 trimmedUriReference = rawUriReference.trim();
|
||||||
|
|
||||||
const reference = trimmedUriReference.slice(1, -1);
|
const reference = trimmedUriReference.slice(1, -1);
|
||||||
|
@@ -36,7 +36,10 @@ class Base extends Model {
|
|||||||
this.updatedAt = new Date().toISOString();
|
this.updatedAt = new Date().toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
async $beforeUpdate(opts: ModelOptions, queryContext: QueryContext): Promise<void> {
|
async $beforeUpdate(
|
||||||
|
opts: ModelOptions,
|
||||||
|
queryContext: QueryContext
|
||||||
|
): Promise<void> {
|
||||||
this.updatedAt = new Date().toISOString();
|
this.updatedAt = new Date().toISOString();
|
||||||
|
|
||||||
await super.$beforeUpdate(opts, queryContext);
|
await super.$beforeUpdate(opts, queryContext);
|
||||||
|
@@ -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 DELETED_COLUMN_NAME = 'deleted_at';
|
||||||
|
|
||||||
const buildQueryBuidlerForClass = (): ForClassMethod => {
|
const buildQueryBuidlerForClass = (): ForClassMethod => {
|
||||||
return (modelClass) => {
|
return (modelClass) => {
|
||||||
const qb: AnyQueryBuilder = Model.QueryBuilder.forClass.call(ExtendedQueryBuilder, modelClass);
|
const qb: AnyQueryBuilder = Model.QueryBuilder.forClass.call(
|
||||||
|
ExtendedQueryBuilder,
|
||||||
|
modelClass
|
||||||
|
);
|
||||||
qb.onBuild((builder) => {
|
qb.onBuild((builder) => {
|
||||||
if (!builder.context().withSoftDeleted) {
|
if (!builder.context().withSoftDeleted) {
|
||||||
builder.whereNull(`${qb.modelClass().tableName}.${DELETED_COLUMN_NAME}`);
|
builder.whereNull(
|
||||||
|
`${qb.modelClass().tableName}.${DELETED_COLUMN_NAME}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return qb;
|
return qb;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExtendedQueryBuilder<M extends Model, R = M[]> extends Model.QueryBuilder<M, R> {
|
class ExtendedQueryBuilder<M extends Model, R = M[]> extends Model.QueryBuilder<
|
||||||
|
M,
|
||||||
|
R
|
||||||
|
> {
|
||||||
ArrayQueryBuilderType!: ExtendedQueryBuilder<M, M[]>;
|
ArrayQueryBuilderType!: ExtendedQueryBuilder<M, M[]>;
|
||||||
SingleQueryBuilderType!: ExtendedQueryBuilder<M, M>;
|
SingleQueryBuilderType!: ExtendedQueryBuilder<M, M>;
|
||||||
MaybeSingleQueryBuilderType!: ExtendedQueryBuilder<M, M | undefined>;
|
MaybeSingleQueryBuilderType!: ExtendedQueryBuilder<M, M | undefined>;
|
||||||
@@ -25,7 +39,7 @@ class ExtendedQueryBuilder<M extends Model, R = M[]> extends Model.QueryBuilder<
|
|||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
return this.patch({
|
return this.patch({
|
||||||
[DELETED_COLUMN_NAME]: (new Date()).toISOString(),
|
[DELETED_COLUMN_NAME]: new Date().toISOString(),
|
||||||
} as unknown as PartialModelObject<M>);
|
} as unknown as PartialModelObject<M>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,13 +2,13 @@ import FieldType from './field';
|
|||||||
import AuthenticationStepType from './authentication-step';
|
import AuthenticationStepType from './authentication-step';
|
||||||
|
|
||||||
type AppInfo = {
|
type AppInfo = {
|
||||||
name: string,
|
name: string;
|
||||||
key: string,
|
key: string;
|
||||||
iconUrl: string,
|
iconUrl: string;
|
||||||
docUrl: string,
|
docUrl: string;
|
||||||
primaryColor: string,
|
primaryColor: string;
|
||||||
fields: FieldType[],
|
fields: FieldType[];
|
||||||
authenticationSteps?: AuthenticationStepType[]
|
authenticationSteps?: AuthenticationStepType[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export default AppInfo;
|
export default AppInfo;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
type AuthenticationStepField = {
|
type AuthenticationStepField = {
|
||||||
name: string,
|
name: string;
|
||||||
value: string | null,
|
value: string | null;
|
||||||
fields?: {
|
fields?: {
|
||||||
name: string,
|
name: string;
|
||||||
value: string | null
|
value: string | null;
|
||||||
}[]
|
}[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export default AuthenticationStepField;
|
export default AuthenticationStepField;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import type { IAuthenticationStepField } from '@automatisch/types';
|
import type { IAuthenticationStepField } from '@automatisch/types';
|
||||||
|
|
||||||
type AuthenticationStep = {
|
type AuthenticationStep = {
|
||||||
step: number,
|
step: number;
|
||||||
type: string,
|
type: string;
|
||||||
name: string,
|
name: string;
|
||||||
fields: IAuthenticationStepField[];
|
fields: IAuthenticationStepField[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export default AuthenticationStep;
|
export default AuthenticationStep;
|
||||||
|
22
packages/backend/src/types/field.d.ts
vendored
22
packages/backend/src/types/field.d.ts
vendored
@@ -1,14 +1,14 @@
|
|||||||
type Field = {
|
type Field = {
|
||||||
key: string,
|
key: string;
|
||||||
label: string,
|
label: string;
|
||||||
type: string,
|
type: string;
|
||||||
required: boolean,
|
required: boolean;
|
||||||
readOnly: boolean,
|
readOnly: boolean;
|
||||||
value: string,
|
value: string;
|
||||||
placeholder: string | null,
|
placeholder: string | null;
|
||||||
description: string,
|
description: string;
|
||||||
docUrl: string,
|
docUrl: string;
|
||||||
clickToCopy: boolean
|
clickToCopy: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Field;
|
export default Field;
|
||||||
|
@@ -2,6 +2,6 @@ import test from 'ava';
|
|||||||
|
|
||||||
const fn = () => 'foo';
|
const fn = () => 'foo';
|
||||||
|
|
||||||
test('fn() returns foo', t => {
|
test('fn() returns foo', (t) => {
|
||||||
t.is(fn(), 'foo');
|
t.is(fn(), 'foo');
|
||||||
});
|
});
|
||||||
|
16
packages/cli/.github/dependabot.yml
vendored
16
packages/cli/.github/dependabot.yml
vendored
@@ -1,16 +1,16 @@
|
|||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: 'npm'
|
||||||
versioning-strategy: increase
|
versioning-strategy: increase
|
||||||
directory: "/"
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "monthly"
|
interval: 'monthly'
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- 'dependencies'
|
||||||
open-pull-requests-limit: 100
|
open-pull-requests-limit: 100
|
||||||
pull-request-branch-name:
|
pull-request-branch-name:
|
||||||
separator: "-"
|
separator: '-'
|
||||||
ignore:
|
ignore:
|
||||||
- dependency-name: "fs-extra"
|
- dependency-name: 'fs-extra'
|
||||||
- dependency-name: "*"
|
- dependency-name: '*'
|
||||||
update-types: ["version-update:semver-major"]
|
update-types: ['version-update:semver-major']
|
||||||
|
@@ -11,7 +11,7 @@ export default class StartWorker extends Command {
|
|||||||
char: 'e',
|
char: 'e',
|
||||||
}),
|
}),
|
||||||
'env-file': Flags.string(),
|
'env-file': Flags.string(),
|
||||||
}
|
};
|
||||||
|
|
||||||
async prepareEnvVars(): Promise<void> {
|
async prepareEnvVars(): Promise<void> {
|
||||||
const { flags } = await this.parse(StartWorker);
|
const { flags } = await this.parse(StartWorker);
|
||||||
|
@@ -11,7 +11,7 @@ export default class Start extends Command {
|
|||||||
char: 'e',
|
char: 'e',
|
||||||
}),
|
}),
|
||||||
'env-file': Flags.string(),
|
'env-file': Flags.string(),
|
||||||
}
|
};
|
||||||
|
|
||||||
get isProduction() {
|
get isProduction() {
|
||||||
return process.env.APP_ENV === 'production';
|
return process.env.APP_ENV === 'production';
|
||||||
@@ -46,7 +46,7 @@ export default class Start extends Command {
|
|||||||
|
|
||||||
await utils.createDatabaseAndUser(
|
await utils.createDatabaseAndUser(
|
||||||
process.env.POSTGRES_DATABASE,
|
process.env.POSTGRES_DATABASE,
|
||||||
process.env.POSTGRES_USERNAME,
|
process.env.POSTGRES_USERNAME
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
export {run} from '@oclif/core'
|
export { run } from '@oclif/core';
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const { defineConfig } = require("cypress");
|
const { defineConfig } = require('cypress');
|
||||||
|
|
||||||
const TO_BE_PROVIDED = 'HAS_TO_BE_PROVIDED_IN_cypress.env.json';
|
const TO_BE_PROVIDED = 'HAS_TO_BE_PROVIDED_IN_cypress.env.json';
|
||||||
|
|
||||||
@@ -6,12 +6,12 @@ module.exports = defineConfig({
|
|||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: 'http://localhost:3001',
|
baseUrl: 'http://localhost:3001',
|
||||||
env: {
|
env: {
|
||||||
login_email: "user@automatisch.io",
|
login_email: 'user@automatisch.io',
|
||||||
login_password: "sample",
|
login_password: 'sample',
|
||||||
slack_user_token: TO_BE_PROVIDED,
|
slack_user_token: TO_BE_PROVIDED,
|
||||||
},
|
},
|
||||||
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
||||||
viewportWidth: 1280,
|
viewportWidth: 1280,
|
||||||
viewportHeight: 768
|
viewportHeight: 768,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@@ -23,24 +23,17 @@ describe('Connections page', () => {
|
|||||||
|
|
||||||
context('can add connection', () => {
|
context('can add connection', () => {
|
||||||
it('has a button to open add connection dialog', () => {
|
it('has a button to open add connection dialog', () => {
|
||||||
cy
|
cy.og('add-connection-button').scrollIntoView().should('be.visible');
|
||||||
.og('add-connection-button')
|
|
||||||
.scrollIntoView()
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('add connection button takes user to add connection page', () => {
|
it('add connection button takes user to add connection page', () => {
|
||||||
cy
|
cy.og('add-connection-button').click({ force: true });
|
||||||
.og('add-connection-button')
|
|
||||||
.click({ force: true });
|
|
||||||
|
|
||||||
cy.location('pathname').should('equal', '/app/slack/connections/add');
|
cy.location('pathname').should('equal', '/app/slack/connections/add');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows add connection dialog to create a new connection', () => {
|
it('shows add connection dialog to create a new connection', () => {
|
||||||
cy
|
cy.get('input[name="accessToken"]').type(Cypress.env('slack_user_token'));
|
||||||
.get('input[name="accessToken"]')
|
|
||||||
.type(Cypress.env('slack_user_token'));
|
|
||||||
|
|
||||||
cy.og('create-connection-button').click();
|
cy.og('create-connection-button').click();
|
||||||
|
|
||||||
|
@@ -27,10 +27,7 @@ describe('Flow editor page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('choose an event', () => {
|
it('choose an event', () => {
|
||||||
cy
|
cy.og('choose-event-autocomplete').should('be.visible').click();
|
||||||
.og('choose-event-autocomplete')
|
|
||||||
.should('be.visible')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
cy.get('li[role="option"]:contains("Every hour")').click();
|
cy.get('li[role="option"]:contains("Every hour")').click();
|
||||||
});
|
});
|
||||||
@@ -42,13 +39,12 @@ describe('Flow editor page', () => {
|
|||||||
it('collapses the substep', () => {
|
it('collapses the substep', () => {
|
||||||
cy.og('choose-app-autocomplete').should('not.be.visible');
|
cy.og('choose-app-autocomplete').should('not.be.visible');
|
||||||
cy.og('choose-event-autocomplete').should('not.be.visible');
|
cy.og('choose-event-autocomplete').should('not.be.visible');
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('set up a trigger', () => {
|
context('set up a trigger', () => {
|
||||||
it('choose "yes" in "trigger on weekends?"', () => {
|
it('choose "yes" in "trigger on weekends?"', () => {
|
||||||
cy
|
cy.og('parameters.triggersOnWeekend-autocomplete')
|
||||||
.og('parameters.triggersOnWeekend-autocomplete')
|
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
@@ -60,7 +56,9 @@ describe('Flow editor page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('collapses the substep', () => {
|
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', () => {
|
it('choose an event', () => {
|
||||||
cy
|
cy.og('choose-event-autocomplete').should('be.visible').click();
|
||||||
.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', () => {
|
it('continue to next step', () => {
|
||||||
@@ -130,14 +127,16 @@ describe('Flow editor page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('arrange message text', () => {
|
it('arrange message text', () => {
|
||||||
cy
|
cy.og('power-input', ' [contenteditable]')
|
||||||
.og('power-input', ' [contenteditable]')
|
|
||||||
.click()
|
.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
|
cy.og('power-input-suggestion-group')
|
||||||
.og('power-input-suggestion-group').first()
|
.first()
|
||||||
.og('power-input-suggestion-item').first()
|
.og('power-input-suggestion-item')
|
||||||
|
.first()
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
cy.clickOutside();
|
cy.clickOutside();
|
||||||
@@ -150,9 +149,7 @@ describe('Flow editor page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('collapses the substep', () => {
|
it('collapses the substep', () => {
|
||||||
cy
|
cy.og('power-input', ' [contenteditable]').should('not.exist');
|
||||||
.og('power-input', ' [contenteditable]')
|
|
||||||
.should('not.exist');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -176,10 +173,7 @@ describe('Flow editor page', () => {
|
|||||||
it('publish flow', () => {
|
it('publish flow', () => {
|
||||||
cy.og('unpublish-flow-button').should('not.exist');
|
cy.og('unpublish-flow-button').should('not.exist');
|
||||||
|
|
||||||
cy
|
cy.og('publish-flow-button').should('be.visible').click();
|
||||||
.og('publish-flow-button')
|
|
||||||
.should('be.visible')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
cy.og('publish-flow-button').should('not.exist');
|
cy.og('publish-flow-button').should('not.exist');
|
||||||
});
|
});
|
||||||
@@ -191,27 +185,19 @@ describe('Flow editor page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('unpublish from snackbar', () => {
|
it('unpublish from snackbar', () => {
|
||||||
cy
|
cy.og('unpublish-flow-from-snackbar').click();
|
||||||
.og('unpublish-flow-from-snackbar')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
cy.og('flow-cannot-edit-info-snackbar').should('not.exist');
|
cy.og('flow-cannot-edit-info-snackbar').should('not.exist');
|
||||||
})
|
});
|
||||||
|
|
||||||
it('publish once again', () => {
|
it('publish once again', () => {
|
||||||
cy
|
cy.og('publish-flow-button').should('be.visible').click();
|
||||||
.og('publish-flow-button')
|
|
||||||
.should('be.visible')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
cy.og('publish-flow-button').should('not.exist');
|
cy.og('publish-flow-button').should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('unpublish from layout top bar', () => {
|
it('unpublish from layout top bar', () => {
|
||||||
cy
|
cy.og('unpublish-flow-button').should('be.visible').click();
|
||||||
.og('unpublish-flow-button')
|
|
||||||
.should('be.visible')
|
|
||||||
.click();
|
|
||||||
|
|
||||||
cy.og('unpublish-flow-button').should('not.exist');
|
cy.og('unpublish-flow-button').should('not.exist');
|
||||||
|
|
||||||
|
@@ -1,10 +1,14 @@
|
|||||||
Cypress.Commands.add('og', { prevSubject: 'optional' }, (subject, selector, suffix = '') => {
|
Cypress.Commands.add(
|
||||||
if (subject) {
|
'og',
|
||||||
return cy.wrap(subject).get(`[data-test="${selector}"]${suffix}`);
|
{ 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', () => {
|
Cypress.Commands.add('login', () => {
|
||||||
cy.visit('/login');
|
cy.visit('/login');
|
||||||
@@ -12,12 +16,10 @@ Cypress.Commands.add('login', () => {
|
|||||||
cy.og('email-text-field').type(Cypress.env('login_email'));
|
cy.og('email-text-field').type(Cypress.env('login_email'));
|
||||||
cy.og('password-text-field').type(Cypress.env('login_password'));
|
cy.og('password-text-field').type(Cypress.env('login_password'));
|
||||||
|
|
||||||
cy
|
cy.intercept('/graphql').as('graphqlCalls');
|
||||||
.intercept('/graphql')
|
cy.intercept('https://notifications.automatisch.io/notifications.json').as(
|
||||||
.as('graphqlCalls');
|
'notificationsCall'
|
||||||
cy
|
);
|
||||||
.intercept('https://notifications.automatisch.io/notifications.json')
|
|
||||||
.as('notificationsCall');
|
|
||||||
cy.og('login-button').click();
|
cy.og('login-button').click();
|
||||||
|
|
||||||
cy.wait(['@graphqlCalls', '@notificationsCall']);
|
cy.wait(['@graphqlCalls', '@notificationsCall']);
|
||||||
@@ -30,14 +32,11 @@ Cypress.Commands.add('logout', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('ss', (name, opts = {}) => {
|
Cypress.Commands.add('ss', (name, opts = {}) => {
|
||||||
return cy.screenshot(
|
return cy.screenshot(name, {
|
||||||
name,
|
overwrite: true,
|
||||||
{
|
capture: 'viewport',
|
||||||
overwrite: true,
|
...opts,
|
||||||
capture: 'viewport',
|
});
|
||||||
...opts,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('clickOutside', () => {
|
Cypress.Commands.add('clickOutside', () => {
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands'
|
import './commands';
|
||||||
|
|
||||||
// Alternatively you can use CommonJS syntax:
|
// Alternatively you can use CommonJS syntax:
|
||||||
// require('./commands')
|
// require('./commands')
|
@@ -25,9 +25,12 @@
|
|||||||
-->
|
-->
|
||||||
<title>Automatisch</title>
|
<title>Automatisch</title>
|
||||||
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap" rel="stylesheet">
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
@@ -12,21 +12,18 @@ import useFormatMessage from 'hooks/useFormatMessage';
|
|||||||
type AccountDropdownMenuProps = {
|
type AccountDropdownMenuProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
anchorEl: MenuProps["anchorEl"];
|
anchorEl: MenuProps['anchorEl'];
|
||||||
id: string;
|
id: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
function AccountDropdownMenu(props: AccountDropdownMenuProps): React.ReactElement {
|
function AccountDropdownMenu(
|
||||||
|
props: AccountDropdownMenuProps
|
||||||
|
): React.ReactElement {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const authentication = useAuthentication();
|
const authentication = useAuthentication();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const {
|
const { open, onClose, anchorEl, id } = props;
|
||||||
open,
|
|
||||||
onClose,
|
|
||||||
anchorEl,
|
|
||||||
id
|
|
||||||
} = props
|
|
||||||
|
|
||||||
const logout = async () => {
|
const logout = async () => {
|
||||||
authentication.updateToken('');
|
authentication.updateToken('');
|
||||||
@@ -53,17 +50,11 @@ function AccountDropdownMenu(props: AccountDropdownMenuProps): React.ReactElemen
|
|||||||
open={open}
|
open={open}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem component={Link} to={URLS.SETTINGS_DASHBOARD}>
|
||||||
component={Link}
|
|
||||||
to={URLS.SETTINGS_DASHBOARD}
|
|
||||||
>
|
|
||||||
{formatMessage('accountDropdownMenu.settings')}
|
{formatMessage('accountDropdownMenu.settings')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
<MenuItem
|
<MenuItem onClick={logout} data-test="logout-item">
|
||||||
onClick={logout}
|
|
||||||
data-test="logout-item"
|
|
||||||
>
|
|
||||||
{formatMessage('accountDropdownMenu.logout')}
|
{formatMessage('accountDropdownMenu.logout')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@@ -14,9 +14,12 @@ import InputCreator from 'components/InputCreator';
|
|||||||
import type { IApp, IField } from '@automatisch/types';
|
import type { IApp, IField } from '@automatisch/types';
|
||||||
import { Form } from './style';
|
import { Form } from './style';
|
||||||
|
|
||||||
const generateDocsLink = (link: string) => (str: string) => (
|
const generateDocsLink = (link: string) => (str: string) =>
|
||||||
<a href={link} target="_blank">{str}</a>
|
(
|
||||||
);
|
<a href={link} target="_blank">
|
||||||
|
{str}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
|
||||||
type AddAppConnectionProps = {
|
type AddAppConnectionProps = {
|
||||||
onClose: (response: Record<string, unknown>) => void;
|
onClose: (response: Record<string, unknown>) => void;
|
||||||
@@ -26,79 +29,90 @@ type AddAppConnectionProps = {
|
|||||||
|
|
||||||
type Response = {
|
type Response = {
|
||||||
[key: string]: any;
|
[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 { application, connectionId, onClose } = props;
|
||||||
const { name, authDocUrl, key, auth } = application;
|
const { name, authDocUrl, key, auth } = application;
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const [errorMessage, setErrorMessage] = React.useState<string | null>(null);
|
const [errorMessage, setErrorMessage] = React.useState<string | null>(null);
|
||||||
const [inProgress, setInProgress] = React.useState(false);
|
const [inProgress, setInProgress] = React.useState(false);
|
||||||
const hasConnection = Boolean(connectionId);
|
const hasConnection = Boolean(connectionId);
|
||||||
const steps = hasConnection ? auth?.reconnectionSteps : auth?.authenticationSteps;
|
const steps = hasConnection
|
||||||
|
? auth?.reconnectionSteps
|
||||||
|
: auth?.authenticationSteps;
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (window.opener) {
|
if (window.opener) {
|
||||||
window.opener.postMessage({ source: 'automatisch', payload: window.location.search });
|
window.opener.postMessage({
|
||||||
|
source: 'automatisch',
|
||||||
|
payload: window.location.search,
|
||||||
|
});
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const submitHandler: SubmitHandler<FieldValues> = React.useCallback(async (data) => {
|
const submitHandler: SubmitHandler<FieldValues> = React.useCallback(
|
||||||
if (!steps) return;
|
async (data) => {
|
||||||
|
if (!steps) return;
|
||||||
|
|
||||||
setInProgress(true);
|
setInProgress(true);
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
|
||||||
const response: Response = {
|
const response: Response = {
|
||||||
key,
|
key,
|
||||||
connection: {
|
connection: {
|
||||||
id: connectionId
|
id: connectionId,
|
||||||
},
|
},
|
||||||
fields: data,
|
fields: data,
|
||||||
};
|
};
|
||||||
|
|
||||||
let stepIndex = 0;
|
let stepIndex = 0;
|
||||||
while (stepIndex < steps.length) {
|
while (stepIndex < steps.length) {
|
||||||
const step = steps[stepIndex];
|
const step = steps[stepIndex];
|
||||||
const variables = computeAuthStepVariables(step.arguments, response);
|
const variables = computeAuthStepVariables(step.arguments, response);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const stepResponse = await processStep(step, variables);
|
const stepResponse = await processStep(step, variables);
|
||||||
|
|
||||||
response[step.name] = stepResponse;
|
response[step.name] = stepResponse;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = err as Error;
|
const error = err as Error;
|
||||||
console.log(error);
|
console.log(error);
|
||||||
setErrorMessage(error.message);
|
setErrorMessage(error.message);
|
||||||
setInProgress(false);
|
setInProgress(false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
stepIndex++;
|
||||||
|
|
||||||
|
if (stepIndex === steps.length) {
|
||||||
|
onClose(response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stepIndex++;
|
setInProgress(false);
|
||||||
|
},
|
||||||
if (stepIndex === steps.length) {
|
[connectionId, key, steps, onClose]
|
||||||
onClose(response);
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setInProgress(false);
|
|
||||||
}, [connectionId, key, steps, onClose]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={true} onClose={onClose} data-test="add-app-connection-dialog">
|
<Dialog open={true} onClose={onClose} data-test="add-app-connection-dialog">
|
||||||
<DialogTitle>{hasConnection ? formatMessage('app.reconnectConnection') : formatMessage('app.addConnection')}</DialogTitle>
|
<DialogTitle>
|
||||||
|
{hasConnection
|
||||||
|
? formatMessage('app.reconnectConnection')
|
||||||
|
: formatMessage('app.addConnection')}
|
||||||
|
</DialogTitle>
|
||||||
|
|
||||||
{authDocUrl && (
|
{authDocUrl && (
|
||||||
<Alert severity="info" sx={{ fontWeight: 300 }}>
|
<Alert severity="info" sx={{ fontWeight: 300 }}>
|
||||||
{formatMessage(
|
{formatMessage('addAppConnection.callToDocs', {
|
||||||
'addAppConnection.callToDocs',
|
appName: name,
|
||||||
{
|
docsLink: generateDocsLink(authDocUrl),
|
||||||
appName: name,
|
})}
|
||||||
docsLink: generateDocsLink(authDocUrl)
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -111,7 +125,9 @@ export default function AddAppConnection(props: AddAppConnectionProps): React.Re
|
|||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogContentText tabIndex={-1} component="div">
|
<DialogContentText tabIndex={-1} component="div">
|
||||||
<Form onSubmit={submitHandler}>
|
<Form onSubmit={submitHandler}>
|
||||||
{auth?.fields?.map((field: IField) => (<InputCreator key={field.key} schema={field} />))}
|
{auth?.fields?.map((field: IField) => (
|
||||||
|
<InputCreator key={field.key} schema={field} />
|
||||||
|
))}
|
||||||
|
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -128,4 +144,4 @@ export default function AddAppConnection(props: AddAppConnectionProps): React.Re
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
@@ -13,9 +13,12 @@ const ApolloProvider = (props: ApolloProviderProps): React.ReactElement => {
|
|||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
const authentication = useAuthentication();
|
const authentication = useAuthentication();
|
||||||
|
|
||||||
const onError = React.useCallback((message) => {
|
const onError = React.useCallback(
|
||||||
enqueueSnackbar(message, { variant: 'error' });
|
(message) => {
|
||||||
}, [enqueueSnackbar]);
|
enqueueSnackbar(message, { variant: 'error' });
|
||||||
|
},
|
||||||
|
[enqueueSnackbar]
|
||||||
|
);
|
||||||
|
|
||||||
const client = React.useMemo(() => {
|
const client = React.useMemo(() => {
|
||||||
return mutateAndGetClient({
|
return mutateAndGetClient({
|
||||||
@@ -24,9 +27,7 @@ const ApolloProvider = (props: ApolloProviderProps): React.ReactElement => {
|
|||||||
});
|
});
|
||||||
}, [onError, authentication]);
|
}, [onError, authentication]);
|
||||||
|
|
||||||
return (
|
return <BaseApolloProvider client={client} {...props} />;
|
||||||
<BaseApolloProvider client={client} {...props} />
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ApolloProvider;
|
export default ApolloProvider;
|
||||||
|
@@ -20,23 +20,21 @@ type AppBarProps = {
|
|||||||
drawerOpen: boolean;
|
drawerOpen: boolean;
|
||||||
onDrawerOpen: () => void;
|
onDrawerOpen: () => void;
|
||||||
onDrawerClose: () => void;
|
onDrawerClose: () => void;
|
||||||
maxWidth?: ContainerProps["maxWidth"];
|
maxWidth?: ContainerProps['maxWidth'];
|
||||||
};
|
};
|
||||||
|
|
||||||
const accountMenuId = 'account-menu';
|
const accountMenuId = 'account-menu';
|
||||||
|
|
||||||
export default function AppBar(props: AppBarProps): React.ReactElement {
|
export default function AppBar(props: AppBarProps): React.ReactElement {
|
||||||
const {
|
const { drawerOpen, onDrawerOpen, onDrawerClose, maxWidth = false } = props;
|
||||||
drawerOpen,
|
|
||||||
onDrawerOpen,
|
|
||||||
onDrawerClose,
|
|
||||||
maxWidth = false,
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const theme = useTheme();
|
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 | HTMLElement>(null);
|
const [accountMenuAnchorElement, setAccountMenuAnchorElement] =
|
||||||
|
React.useState<null | HTMLElement>(null);
|
||||||
|
|
||||||
const isMenuOpen = Boolean(accountMenuAnchorElement);
|
const isMenuOpen = Boolean(accountMenuAnchorElement);
|
||||||
|
|
||||||
@@ -65,11 +63,7 @@ export default function AppBar(props: AppBarProps): React.ReactElement {
|
|||||||
|
|
||||||
<div style={{ flexGrow: 1 }}>
|
<div style={{ flexGrow: 1 }}>
|
||||||
<Link to={URLS.DASHBOARD}>
|
<Link to={URLS.DASHBOARD}>
|
||||||
<Typography
|
<Typography variant="h6" component="h1" noWrap>
|
||||||
variant="h6"
|
|
||||||
component="h1"
|
|
||||||
noWrap
|
|
||||||
>
|
|
||||||
<FormattedMessage id="brandText" />
|
<FormattedMessage id="brandText" />
|
||||||
</Typography>
|
</Typography>
|
||||||
</Link>
|
</Link>
|
||||||
|
@@ -19,17 +19,22 @@ type ContextMenuProps = {
|
|||||||
anchorEl: PopoverProps['anchorEl'];
|
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 { appKey, connectionId, onClose, onMenuItemClick, anchorEl } = props;
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
|
|
||||||
const createActionHandler = React.useCallback((action: Action) => {
|
const createActionHandler = React.useCallback(
|
||||||
return function clickHandler(event: React.MouseEvent) {
|
(action: Action) => {
|
||||||
onMenuItemClick(event, action);
|
return function clickHandler(event: React.MouseEvent) {
|
||||||
|
onMenuItemClick(event, action);
|
||||||
|
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
}, [onMenuItemClick, onClose]);
|
},
|
||||||
|
[onMenuItemClick, onClose]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
@@ -63,4 +68,4 @@ export default function ContextMenu(props: ContextMenuProps): React.ReactElement
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
@@ -20,13 +20,11 @@ import { CardContent, Typography } from './style';
|
|||||||
|
|
||||||
type AppConnectionRowProps = {
|
type AppConnectionRowProps = {
|
||||||
connection: IConnection;
|
connection: IConnection;
|
||||||
}
|
};
|
||||||
|
|
||||||
const countTranslation = (value: React.ReactNode) => (
|
const countTranslation = (value: React.ReactNode) => (
|
||||||
<>
|
<>
|
||||||
<Typography variant="body1">
|
<Typography variant="body1">{value}</Typography>
|
||||||
{value}
|
|
||||||
</Typography>
|
|
||||||
<br />
|
<br />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -34,15 +32,21 @@ const countTranslation = (value: React.ReactNode) => (
|
|||||||
function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
|
function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
const [verificationVisible, setVerificationVisible] = React.useState(false);
|
const [verificationVisible, setVerificationVisible] = React.useState(false);
|
||||||
const [testConnection, { called: testCalled, loading: testLoading }] = useLazyQuery(TEST_CONNECTION, {
|
const [testConnection, { called: testCalled, loading: testLoading }] =
|
||||||
fetchPolicy: 'network-only',
|
useLazyQuery(TEST_CONNECTION, {
|
||||||
onCompleted: () => { setTimeout(() => setVerificationVisible(false), 3000); },
|
fetchPolicy: 'network-only',
|
||||||
onError: () => { setTimeout(() => setVerificationVisible(false), 3000); },
|
onCompleted: () => {
|
||||||
});
|
setTimeout(() => setVerificationVisible(false), 3000);
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
setTimeout(() => setVerificationVisible(false), 3000);
|
||||||
|
},
|
||||||
|
});
|
||||||
const [deleteConnection] = useMutation(DELETE_CONNECTION);
|
const [deleteConnection] = useMutation(DELETE_CONNECTION);
|
||||||
|
|
||||||
const formatMessage = useFormatMessage();
|
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<SVGSVGElement | null>(null);
|
const contextButtonRef = React.useRef<SVGSVGElement | null>(null);
|
||||||
const [anchorEl, setAnchorEl] = React.useState<SVGSVGElement | null>(null);
|
const [anchorEl, setAnchorEl] = React.useState<SVGSVGElement | null>(null);
|
||||||
@@ -52,47 +56,52 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onContextMenuClick = () => setAnchorEl(contextButtonRef.current);
|
const onContextMenuClick = () => setAnchorEl(contextButtonRef.current);
|
||||||
const onContextMenuAction = React.useCallback(async (event, action: { [key: string]: string }) => {
|
const onContextMenuAction = React.useCallback(
|
||||||
if (action.type === 'delete') {
|
async (event, action: { [key: string]: string }) => {
|
||||||
await deleteConnection({
|
if (action.type === 'delete') {
|
||||||
variables: { input: { id } },
|
await deleteConnection({
|
||||||
update: (cache) => {
|
variables: { input: { id } },
|
||||||
const connectionCacheId = cache.identify({
|
update: (cache) => {
|
||||||
__typename: 'Connection',
|
const connectionCacheId = cache.identify({
|
||||||
id,
|
__typename: 'Connection',
|
||||||
});
|
id,
|
||||||
|
});
|
||||||
|
|
||||||
cache.evict({
|
cache.evict({
|
||||||
id: connectionCacheId,
|
id: connectionCacheId,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
enqueueSnackbar(formatMessage('connection.deletedMessage'), { variant: 'success' });
|
enqueueSnackbar(formatMessage('connection.deletedMessage'), {
|
||||||
} else if (action.type === 'test') {
|
variant: 'success',
|
||||||
setVerificationVisible(true);
|
});
|
||||||
testConnection({ variables: { id } });
|
} else if (action.type === 'test') {
|
||||||
}
|
setVerificationVisible(true);
|
||||||
}, [deleteConnection, id, testConnection, formatMessage, enqueueSnackbar]);
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card sx={{ my: 2 }} data-test="app-connection-row">
|
<Card sx={{ my: 2 }} data-test="app-connection-row">
|
||||||
<CardActionArea onClick={onContextMenuClick}>
|
<CardActionArea onClick={onContextMenuClick}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Stack
|
<Stack justifyContent="center" alignItems="flex-start" spacing={1}>
|
||||||
justifyContent="center"
|
|
||||||
alignItems="flex-start"
|
|
||||||
spacing={1}
|
|
||||||
>
|
|
||||||
<Typography variant="h6" sx={{ textAlign: 'left' }}>
|
<Typography variant="h6" sx={{ textAlign: 'left' }}>
|
||||||
{formattedData?.screenName}
|
{formattedData?.screenName}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Typography variant="caption">
|
<Typography variant="caption">
|
||||||
{formatMessage('connection.addedAt', { datetime: relativeCreatedAt })}
|
{formatMessage('connection.addedAt', {
|
||||||
|
datetime: relativeCreatedAt,
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
@@ -101,27 +110,42 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
|
|||||||
{verificationVisible && testCalled && testLoading && (
|
{verificationVisible && testCalled && testLoading && (
|
||||||
<>
|
<>
|
||||||
<CircularProgress size={16} />
|
<CircularProgress size={16} />
|
||||||
<Typography variant="caption">{formatMessage('connection.testing')}</Typography>
|
<Typography variant="caption">
|
||||||
|
{formatMessage('connection.testing')}
|
||||||
|
</Typography>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{verificationVisible && testCalled && !testLoading && verified && (
|
{verificationVisible && testCalled && !testLoading && verified && (
|
||||||
<>
|
<>
|
||||||
<CheckCircleIcon fontSize="small" color="success" />
|
<CheckCircleIcon fontSize="small" color="success" />
|
||||||
<Typography variant="caption">{formatMessage('connection.testSuccessful')}</Typography>
|
<Typography variant="caption">
|
||||||
</>
|
{formatMessage('connection.testSuccessful')}
|
||||||
)}
|
</Typography>
|
||||||
{verificationVisible && testCalled && !testLoading && !verified && (
|
|
||||||
<>
|
|
||||||
<ErrorIcon fontSize="small" color="error" />
|
|
||||||
<Typography variant="caption">{formatMessage('connection.testFailed')}</Typography>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{verificationVisible &&
|
||||||
|
testCalled &&
|
||||||
|
!testLoading &&
|
||||||
|
!verified && (
|
||||||
|
<>
|
||||||
|
<ErrorIcon fontSize="small" color="error" />
|
||||||
|
<Typography variant="caption">
|
||||||
|
{formatMessage('connection.testFailed')}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box sx={{ px: 2 }}>
|
<Box sx={{ px: 2 }}>
|
||||||
<Typography variant="caption" color="textSecondary" sx={{ display: ['none', 'inline-block'] }}>
|
<Typography
|
||||||
{formatMessage('connection.flowCount', { count: countTranslation(flowCount) })}
|
variant="caption"
|
||||||
|
color="textSecondary"
|
||||||
|
sx={{ display: ['none', 'inline-block'] }}
|
||||||
|
>
|
||||||
|
{formatMessage('connection.flowCount', {
|
||||||
|
count: countTranslation(flowCount),
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@@ -132,13 +156,15 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement {
|
|||||||
</CardActionArea>
|
</CardActionArea>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{anchorEl && <ConnectionContextMenu
|
{anchorEl && (
|
||||||
appKey={key}
|
<ConnectionContextMenu
|
||||||
connectionId={id}
|
appKey={key}
|
||||||
onClose={handleClose}
|
connectionId={id}
|
||||||
onMenuItemClick={onContextMenuAction}
|
onClose={handleClose}
|
||||||
anchorEl={anchorEl}
|
onMenuItemClick={onContextMenuAction}
|
||||||
/>}
|
anchorEl={anchorEl}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,6 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
export const Typography = styled(MuiTypography)(() => ({
|
export const Typography = styled(MuiTypography)(() => ({
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
display: 'inline-block',
|
display: 'inline-block',
|
||||||
|
@@ -10,12 +10,16 @@ import * as URLS from 'config/urls';
|
|||||||
|
|
||||||
type AppConnectionsProps = {
|
type AppConnectionsProps = {
|
||||||
appKey: string;
|
appKey: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default function AppConnections(props: AppConnectionsProps): React.ReactElement {
|
export default function AppConnections(
|
||||||
|
props: AppConnectionsProps
|
||||||
|
): React.ReactElement {
|
||||||
const { appKey } = props;
|
const { appKey } = props;
|
||||||
const formatMessage = useFormatMessage();
|
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 appConnections: IConnection[] = data?.getApp?.connections || [];
|
||||||
|
|
||||||
const hasConnections = appConnections?.length;
|
const hasConnections = appConnections?.length;
|
||||||
@@ -35,5 +39,5 @@ export default function AppConnections(props: AppConnectionsProps): React.ReactE
|
|||||||
<AppConnectionRow key={appConnection.id} connection={appConnection} />
|
<AppConnectionRow key={appConnection.id} connection={appConnection} />
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
};
|
}
|
||||||
|
@@ -12,7 +12,7 @@ import type { IFlow } from '@automatisch/types';
|
|||||||
|
|
||||||
type AppFlowsProps = {
|
type AppFlowsProps = {
|
||||||
appKey: string;
|
appKey: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
const FLOW_PER_PAGE = 10;
|
const FLOW_PER_PAGE = 10;
|
||||||
|
|
||||||
@@ -27,11 +27,13 @@ export default function AppFlows(props: AppFlowsProps): React.ReactElement {
|
|||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const connectionId = searchParams.get('connectionId') || undefined;
|
const connectionId = searchParams.get('connectionId') || undefined;
|
||||||
const page = parseInt(searchParams.get('page') || '', 10) || 1;
|
const page = parseInt(searchParams.get('page') || '', 10) || 1;
|
||||||
const { data } = useQuery(GET_FLOWS, { variables: {
|
const { data } = useQuery(GET_FLOWS, {
|
||||||
appKey,
|
variables: {
|
||||||
connectionId,
|
appKey,
|
||||||
...getLimitAndOffset(page)
|
connectionId,
|
||||||
}});
|
...getLimitAndOffset(page),
|
||||||
|
},
|
||||||
|
});
|
||||||
const getFlows = data?.getFlows || {};
|
const getFlows = data?.getFlows || {};
|
||||||
const { pageInfo, edges } = getFlows;
|
const { pageInfo, edges } = getFlows;
|
||||||
|
|
||||||
@@ -53,19 +55,21 @@ export default function AppFlows(props: AppFlowsProps): React.ReactElement {
|
|||||||
<AppFlowRow key={appFlow.id} flow={appFlow} />
|
<AppFlowRow key={appFlow.id} flow={appFlow} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{pageInfo && pageInfo.totalPages > 1 && <Pagination
|
{pageInfo && pageInfo.totalPages > 1 && (
|
||||||
sx={{ display: 'flex', justifyContent: 'center', mt: 3 }}
|
<Pagination
|
||||||
page={pageInfo?.currentPage}
|
sx={{ display: 'flex', justifyContent: 'center', mt: 3 }}
|
||||||
count={pageInfo?.totalPages}
|
page={pageInfo?.currentPage}
|
||||||
onChange={(event, page) => setSearchParams({ page: page.toString() })}
|
count={pageInfo?.totalPages}
|
||||||
renderItem={(item) => (
|
onChange={(event, page) => setSearchParams({ page: page.toString() })}
|
||||||
<PaginationItem
|
renderItem={(item) => (
|
||||||
component={Link}
|
<PaginationItem
|
||||||
to={`${item.page === 1 ? '' : `?page=${item.page}`}`}
|
component={Link}
|
||||||
{...item}
|
to={`${item.page === 1 ? '' : `?page=${item.page}`}`}
|
||||||
/>
|
{...item}
|
||||||
)}
|
/>
|
||||||
/>}
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
};
|
}
|
||||||
|
@@ -13,15 +13,10 @@ const inlineImgStyle: React.CSSProperties = {
|
|||||||
objectFit: 'contain',
|
objectFit: 'contain',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function AppIcon(props: AppIconProps & AvatarProps): React.ReactElement {
|
export default function AppIcon(
|
||||||
const {
|
props: AppIconProps & AvatarProps
|
||||||
name,
|
): React.ReactElement {
|
||||||
url,
|
const { name, url, color, sx = {}, variant = 'square', ...restProps } = props;
|
||||||
color,
|
|
||||||
sx = {},
|
|
||||||
variant = "square",
|
|
||||||
...restProps
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const initialLetter = name?.[0];
|
const initialLetter = name?.[0];
|
||||||
|
|
||||||
@@ -37,4 +32,4 @@ export default function AppIcon(props: AppIconProps & AvatarProps): React.ReactE
|
|||||||
{...restProps}
|
{...restProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
@@ -14,20 +14,19 @@ import { CardContent, Typography } from './style';
|
|||||||
|
|
||||||
type AppRowProps = {
|
type AppRowProps = {
|
||||||
application: IApp;
|
application: IApp;
|
||||||
}
|
};
|
||||||
|
|
||||||
const countTranslation = (value: React.ReactNode) => (
|
const countTranslation = (value: React.ReactNode) => (
|
||||||
<>
|
<>
|
||||||
<Typography variant="body1">
|
<Typography variant="body1">{value}</Typography>
|
||||||
{value}
|
|
||||||
</Typography>
|
|
||||||
<br />
|
<br />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
function AppRow(props: AppRowProps): React.ReactElement {
|
function AppRow(props: AppRowProps): React.ReactElement {
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const { name, primaryColor, iconUrl, connectionCount, flowCount } = props.application;
|
const { name, primaryColor, iconUrl, connectionCount, flowCount } =
|
||||||
|
props.application;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link to={URLS.APP(name.toLowerCase())} data-test="app-row">
|
<Link to={URLS.APP(name.toLowerCase())} data-test="app-row">
|
||||||
@@ -39,25 +38,37 @@ function AppRow(props: AppRowProps): React.ReactElement {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
<Typography variant="h6">
|
<Typography variant="h6">{name}</Typography>
|
||||||
{name}
|
</Box>
|
||||||
|
|
||||||
|
<Box sx={{ px: 2 }}>
|
||||||
|
<Typography
|
||||||
|
variant="caption"
|
||||||
|
color="textSecondary"
|
||||||
|
sx={{ display: ['none', 'inline-block'] }}
|
||||||
|
>
|
||||||
|
{formatMessage('app.connectionCount', {
|
||||||
|
count: countTranslation(connectionCount),
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box sx={{ px: 2 }}>
|
<Box sx={{ px: 2 }}>
|
||||||
<Typography variant="caption" color="textSecondary" sx={{ display: ['none', 'inline-block'] }}>
|
<Typography
|
||||||
{formatMessage('app.connectionCount', { count: countTranslation(connectionCount) })}
|
variant="caption"
|
||||||
</Typography>
|
color="textSecondary"
|
||||||
</Box>
|
sx={{ display: ['none', 'inline-block'] }}
|
||||||
|
>
|
||||||
<Box sx={{ px: 2 }}>
|
{formatMessage('app.flowCount', {
|
||||||
<Typography variant="caption" color="textSecondary" sx={{ display: ['none', 'inline-block'] }}>
|
count: countTranslation(flowCount),
|
||||||
{formatMessage('app.flowCount', { count: countTranslation(flowCount) })}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
<ArrowForwardIosIcon sx={{ color: (theme) => theme.palette.primary.main }} />
|
<ArrowForwardIosIcon
|
||||||
|
sx={{ color: (theme) => theme.palette.primary.main }}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</CardActionArea>
|
</CardActionArea>
|
||||||
|
@@ -10,7 +10,6 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
export const Typography = styled(MuiTypography)(() => ({
|
export const Typography = styled(MuiTypography)(() => ({
|
||||||
'&.MuiTypography-h6': {
|
'&.MuiTypography-h6': {
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
@@ -22,5 +21,5 @@ export const Typography = styled(MuiTypography)(() => ({
|
|||||||
export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({
|
export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({
|
||||||
[theme.breakpoints.down('sm')]: {
|
[theme.breakpoints.down('sm')]: {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
}
|
},
|
||||||
}));
|
}));
|
||||||
|
@@ -12,7 +12,13 @@ import useFormatMessage from 'hooks/useFormatMessage';
|
|||||||
import { EditorContext } from 'contexts/Editor';
|
import { EditorContext } from 'contexts/Editor';
|
||||||
import { GET_APPS } from 'graphql/queries/get-apps';
|
import { GET_APPS } from 'graphql/queries/get-apps';
|
||||||
import FlowSubstepTitle from 'components/FlowSubstepTitle';
|
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 = {
|
type ChooseAppAndEventSubstepProps = {
|
||||||
substep: ISubstep;
|
substep: ISubstep;
|
||||||
@@ -24,7 +30,10 @@ type ChooseAppAndEventSubstepProps = {
|
|||||||
step: IStep;
|
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,
|
label: app.name as string,
|
||||||
value: app.key as string,
|
value: app.key as string,
|
||||||
});
|
});
|
||||||
@@ -61,15 +70,15 @@ function ChooseAppAndEventSubstep(
|
|||||||
() => apps?.map((app) => optionGenerator(app)),
|
() => apps?.map((app) => optionGenerator(app)),
|
||||||
[apps]
|
[apps]
|
||||||
);
|
);
|
||||||
const actionsOrTriggers: Array<ITrigger | IAction> = (isTrigger ? app?.triggers : app?.actions) || [];
|
const actionsOrTriggers: Array<ITrigger | IAction> =
|
||||||
|
(isTrigger ? app?.triggers : app?.actions) || [];
|
||||||
const actionOptions = React.useMemo(
|
const actionOptions = React.useMemo(
|
||||||
() => actionsOrTriggers.map((trigger) => optionGenerator(trigger)),
|
() => actionsOrTriggers.map((trigger) => optionGenerator(trigger)),
|
||||||
[app?.key]
|
[app?.key]
|
||||||
);
|
);
|
||||||
const selectedActionOrTrigger =
|
const selectedActionOrTrigger = actionsOrTriggers.find(
|
||||||
actionsOrTriggers.find(
|
(actionOrTrigger: IAction | ITrigger) => actionOrTrigger.key === step?.key
|
||||||
(actionOrTrigger: IAction | ITrigger) => actionOrTrigger.key === step?.key
|
);
|
||||||
);
|
|
||||||
|
|
||||||
const { name } = substep;
|
const { name } = substep;
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ import { TEST_CONNECTION } from 'graphql/queries/test-connection';
|
|||||||
|
|
||||||
type ChooseConnectionSubstepProps = {
|
type ChooseConnectionSubstepProps = {
|
||||||
application: IApp;
|
application: IApp;
|
||||||
substep: ISubstep,
|
substep: ISubstep;
|
||||||
expanded?: boolean;
|
expanded?: boolean;
|
||||||
onExpand: () => void;
|
onExpand: () => void;
|
||||||
onCollapse: () => void;
|
onCollapse: () => void;
|
||||||
@@ -27,14 +27,19 @@ type ChooseConnectionSubstepProps = {
|
|||||||
|
|
||||||
const ADD_CONNECTION_VALUE = 'ADD_CONNECTION';
|
const ADD_CONNECTION_VALUE = 'ADD_CONNECTION';
|
||||||
|
|
||||||
const optionGenerator = (connection: IConnection): { label: string; value: string; } => ({
|
const optionGenerator = (
|
||||||
label: connection?.formattedData?.screenName as string ?? 'Unnamed',
|
connection: IConnection
|
||||||
|
): { label: string; value: string } => ({
|
||||||
|
label: (connection?.formattedData?.screenName as string) ?? 'Unnamed',
|
||||||
value: connection?.id as string,
|
value: connection?.id as string,
|
||||||
});
|
});
|
||||||
|
|
||||||
const getOption = (options: Record<string, unknown>[], connectionId?: string) => options.find(connection => connection.value === connectionId) || null;
|
const getOption = (options: Record<string, unknown>[], connectionId?: string) =>
|
||||||
|
options.find((connection) => connection.value === connectionId) || null;
|
||||||
|
|
||||||
function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.ReactElement {
|
function ChooseConnectionSubstep(
|
||||||
|
props: ChooseConnectionSubstepProps
|
||||||
|
): React.ReactElement {
|
||||||
const {
|
const {
|
||||||
substep,
|
substep,
|
||||||
expanded = false,
|
expanded = false,
|
||||||
@@ -45,36 +50,30 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea
|
|||||||
onChange,
|
onChange,
|
||||||
application,
|
application,
|
||||||
} = props;
|
} = props;
|
||||||
const {
|
const { connection, appKey } = step;
|
||||||
connection,
|
|
||||||
appKey,
|
|
||||||
} = step;
|
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const editorContext = React.useContext(EditorContext);
|
const editorContext = React.useContext(EditorContext);
|
||||||
const [showAddConnectionDialog, setShowAddConnectionDialog] = React.useState(false);
|
const [showAddConnectionDialog, setShowAddConnectionDialog] =
|
||||||
const { data, loading, refetch } = useQuery(GET_APP_CONNECTIONS, { variables: { key: appKey }});
|
React.useState(false);
|
||||||
|
const { data, loading, refetch } = useQuery(GET_APP_CONNECTIONS, {
|
||||||
|
variables: { key: appKey },
|
||||||
|
});
|
||||||
// TODO: show detailed error when connection test/verification fails
|
// TODO: show detailed error when connection test/verification fails
|
||||||
const [
|
const [
|
||||||
testConnection,
|
testConnection,
|
||||||
{
|
{ loading: testResultLoading, refetch: retestConnection },
|
||||||
loading: testResultLoading,
|
] = useLazyQuery(TEST_CONNECTION, {
|
||||||
refetch: retestConnection
|
variables: {
|
||||||
}
|
id: connection?.id,
|
||||||
] = useLazyQuery(
|
},
|
||||||
TEST_CONNECTION,
|
});
|
||||||
{
|
|
||||||
variables: {
|
|
||||||
id: connection?.id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (connection?.id) {
|
if (connection?.id) {
|
||||||
testConnection({
|
testConnection({
|
||||||
variables: {
|
variables: {
|
||||||
id: connection.id,
|
id: connection.id,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// intentionally no dependencies for initial test
|
// intentionally no dependencies for initial test
|
||||||
@@ -82,52 +81,30 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea
|
|||||||
|
|
||||||
const connectionOptions = React.useMemo(() => {
|
const connectionOptions = React.useMemo(() => {
|
||||||
const appWithConnections = data?.getApp as IApp;
|
const appWithConnections = data?.getApp as IApp;
|
||||||
const options = appWithConnections
|
const options =
|
||||||
?.connections
|
appWithConnections?.connections?.map((connection) =>
|
||||||
?.map((connection) => optionGenerator(connection)) || [];
|
optionGenerator(connection)
|
||||||
|
) || [];
|
||||||
|
|
||||||
options.push({
|
options.push({
|
||||||
label: formatMessage('chooseConnectionSubstep.addNewConnection'),
|
label: formatMessage('chooseConnectionSubstep.addNewConnection'),
|
||||||
value: ADD_CONNECTION_VALUE
|
value: ADD_CONNECTION_VALUE,
|
||||||
})
|
});
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}, [data, formatMessage]);
|
}, [data, formatMessage]);
|
||||||
|
|
||||||
const { name } = substep;
|
const { name } = substep;
|
||||||
|
|
||||||
const handleAddConnectionClose = React.useCallback(async (response) => {
|
const handleAddConnectionClose = React.useCallback(
|
||||||
setShowAddConnectionDialog(false);
|
async (response) => {
|
||||||
|
setShowAddConnectionDialog(false);
|
||||||
|
|
||||||
const connectionId = response?.createConnection.id;
|
const connectionId = response?.createConnection.id;
|
||||||
|
|
||||||
if (connectionId) {
|
if (connectionId) {
|
||||||
await refetch();
|
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({
|
onChange({
|
||||||
step: {
|
step: {
|
||||||
...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(() => {
|
React.useEffect(() => {
|
||||||
if (step.connection?.id) {
|
if (step.connection?.id) {
|
||||||
@@ -146,7 +152,7 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea
|
|||||||
id: step.connection.id,
|
id: step.connection.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [step.connection?.id, retestConnection])
|
}, [step.connection?.id, retestConnection]);
|
||||||
|
|
||||||
const onToggle = expanded ? onCollapse : onExpand;
|
const onToggle = expanded ? onCollapse : onExpand;
|
||||||
|
|
||||||
@@ -159,7 +165,14 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea
|
|||||||
valid={testResultLoading ? null : connection?.verified}
|
valid={testResultLoading ? null : connection?.verified}
|
||||||
/>
|
/>
|
||||||
<Collapse in={expanded} timeout="auto" unmountOnExit>
|
<Collapse in={expanded} timeout="auto" unmountOnExit>
|
||||||
<ListItem sx={{ pt: 2, pb: 3, flexDirection: 'column', alignItems: 'flex-start' }}>
|
<ListItem
|
||||||
|
sx={{
|
||||||
|
pt: 2,
|
||||||
|
pb: 3,
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
fullWidth
|
fullWidth
|
||||||
disablePortal
|
disablePortal
|
||||||
@@ -169,7 +182,9 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea
|
|||||||
renderInput={(params) => (
|
renderInput={(params) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...params}
|
{...params}
|
||||||
label={formatMessage('chooseConnectionSubstep.chooseConnection')}
|
label={formatMessage(
|
||||||
|
'chooseConnectionSubstep.chooseConnection'
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
value={getOption(connectionOptions, connection?.id)}
|
value={getOption(connectionOptions, connection?.id)}
|
||||||
@@ -183,17 +198,24 @@ function ChooseConnectionSubstep(props: ChooseConnectionSubstepProps): React.Rea
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={onSubmit}
|
onClick={onSubmit}
|
||||||
sx={{ mt: 2 }}
|
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')}
|
{formatMessage('chooseConnectionSubstep.continue')}
|
||||||
</Button>
|
</Button>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|
||||||
{application && showAddConnectionDialog && <AddAppConnection
|
{application && showAddConnectionDialog && (
|
||||||
onClose={handleAddConnectionClose}
|
<AddAppConnection
|
||||||
application={application}
|
onClose={handleAddConnectionClose}
|
||||||
/>}
|
application={application}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,9 @@ import { IconButton } from './style';
|
|||||||
export default function ConditionalIconButton(props: any): React.ReactElement {
|
export default function ConditionalIconButton(props: any): React.ReactElement {
|
||||||
const { icon, ...buttonProps } = props;
|
const { icon, ...buttonProps } = props;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true });
|
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), {
|
||||||
|
noSsr: true,
|
||||||
|
});
|
||||||
|
|
||||||
if (matchSmallScreens) {
|
if (matchSmallScreens) {
|
||||||
return (
|
return (
|
||||||
@@ -22,10 +24,8 @@ export default function ConditionalIconButton(props: any): React.ReactElement {
|
|||||||
>
|
>
|
||||||
{icon}
|
{icon}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <Button {...(buttonProps as ButtonProps)} />;
|
||||||
<Button {...(buttonProps as ButtonProps)} />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user