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